This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Be a bit clearer about always needing to regen perl.pod and friends at release time
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Tue Jun 30 00:49:36 CEST 2009 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 extern_C=''
211 mistrustnm=''
212 usedevel=''
213 perllibs=''
214 dynamic_ext=''
215 extensions=''
216 known_extensions=''
217 nonxs_ext=''
218 static_ext=''
219 useopcode=''
220 useposix=''
221 extras=''
222 d_bsd=''
223 d_eunice=''
224 d_xenix=''
225 eunicefix=''
226 ar=''
227 awk=''
228 bash=''
229 bison=''
230 byacc=''
231 cat=''
232 chgrp=''
233 chmod=''
234 chown=''
235 comm=''
236 compress=''
237 cp=''
238 cpio=''
239 cpp=''
240 csh=''
241 date=''
242 echo=''
243 egrep=''
244 emacs=''
245 expr=''
246 find=''
247 flex=''
248 gmake=''
249 grep=''
250 gzip=''
251 inews=''
252 ksh=''
253 less=''
254 line=''
255 lint=''
256 ln=''
257 lp=''
258 lpr=''
259 ls=''
260 mail=''
261 mailx=''
262 make=''
263 mkdir=''
264 more=''
265 mv=''
266 nm=''
267 nroff=''
268 perl=''
269 pg=''
270 pmake=''
271 pr=''
272 rm=''
273 rmail=''
274 sed=''
275 sendmail=''
276 shar=''
277 sleep=''
278 smail=''
279 sort=''
280 submit=''
281 tail=''
282 tar=''
283 tbl=''
284 tee=''
285 test=''
286 touch=''
287 tr=''
288 troff=''
289 uname=''
290 uniq=''
291 uuname=''
292 vi=''
293 zcat=''
294 zip=''
295 full_ar=''
296 full_sed=''
297 libswanted=''
298 hint=''
299 myuname=''
300 osname=''
301 osvers=''
302 Author=''
303 Date=''
304 Header=''
305 Id=''
306 Locker=''
307 Log=''
308 RCSfile=''
309 Revision=''
310 Source=''
311 State=''
312 _a=''
313 _exe=''
314 _o=''
315 archobjs=''
316 exe_ext=''
317 firstmakefile=''
318 lib_ext=''
319 obj_ext=''
320 path_sep=''
321 rm_try=''
322 afs=''
323 afsroot=''
324 alignbytes=''
325 ansi2knr=''
326 archlib=''
327 archlibexp=''
328 d_archlib=''
329 installarchlib=''
330 archname=''
331 myarchname=''
332 d_atolf=''
333 d_atoll=''
334 baserev=''
335 bin=''
336 binexp=''
337 initialinstalllocation=''
338 installbin=''
339 userelocatableinc=''
340 byteorder=''
341 cc=''
342 ccflags=''
343 cppflags=''
344 ldflags=''
345 lkflags=''
346 locincpth=''
347 optimize=''
348 cf_email=''
349 cf_by=''
350 cf_time=''
351 contains=''
352 cpp_stuff=''
353 cpplast=''
354 cppminus=''
355 cpprun=''
356 cppstdin=''
357 d__fwalk=''
358 d_access=''
359 d_accessx=''
360 d_aintl=''
361 d_alarm=''
362 asctime_r_proto=''
363 d_asctime_r=''
364 d_attribute_deprecated=''
365 d_attribute_format=''
366 d_attribute_malloc=''
367 d_attribute_nonnull=''
368 d_attribute_noreturn=''
369 d_attribute_pure=''
370 d_attribute_unused=''
371 d_attribute_warn_unused_result=''
372 d_printf_format_null=''
373 d_bcmp=''
374 d_bcopy=''
375 d_builtin_choose_expr=''
376 d_builtin_expect=''
377 d_bzero=''
378 d_c99_variadic_macros=''
379 d_casti32=''
380 castflags=''
381 d_castneg=''
382 d_chown=''
383 d_chroot=''
384 d_chsize=''
385 d_class=''
386 d_clearenv=''
387 d_closedir=''
388 d_void_closedir=''
389 d_cmsghdr_s=''
390 d_const=''
391 d_copysignl=''
392 d_cplusplus=''
393 cryptlib=''
394 d_crypt=''
395 crypt_r_proto=''
396 d_crypt_r=''
397 d_csh=''
398 full_csh=''
399 d_ctermid=''
400 ctermid_r_proto=''
401 d_ctermid_r=''
402 ctime_r_proto=''
403 d_ctime_r=''
404 d_cuserid=''
405 d_dbl_dig=''
406 d_dbminitproto=''
407 d_difftime=''
408 d_dir_dd_fd=''
409 d_dirfd=''
410 d_dlerror=''
411 d_dlopen=''
412 d_dlsymun=''
413 d_dosuid=''
414 d_suidsafe=''
415 d_drand48_r=''
416 drand48_r_proto=''
417 d_drand48proto=''
418 d_dup2=''
419 d_eaccess=''
420 d_endgrent=''
421 d_endgrent_r=''
422 endgrent_r_proto=''
423 d_endhent=''
424 d_endhostent_r=''
425 endhostent_r_proto=''
426 d_endnent=''
427 d_endnetent_r=''
428 endnetent_r_proto=''
429 d_endpent=''
430 d_endprotoent_r=''
431 endprotoent_r_proto=''
432 d_endpwent=''
433 d_endpwent_r=''
434 endpwent_r_proto=''
435 d_endsent=''
436 d_endservent_r=''
437 endservent_r_proto=''
438 d_faststdio=''
439 d_fchdir=''
440 d_fchmod=''
441 d_fchown=''
442 d_fcntl=''
443 d_fcntl_can_lock=''
444 d_fd_macros=''
445 d_fd_set=''
446 d_fds_bits=''
447 d_fgetpos=''
448 d_finite=''
449 d_finitel=''
450 d_flexfnam=''
451 d_flock=''
452 d_flockproto=''
453 d_fork=''
454 d_fp_class=''
455 d_fpclass=''
456 d_fpclassify=''
457 d_fpclassl=''
458 d_fpos64_t=''
459 d_frexpl=''
460 d_fs_data_s=''
461 d_fseeko=''
462 d_fsetpos=''
463 d_fstatfs=''
464 d_fsync=''
465 d_ftello=''
466 d_ftime=''
467 d_gettimeod=''
468 d_futimes=''
469 d_Gconvert=''
470 d_getaddrinfo=''
471 d_getcwd=''
472 d_getespwnam=''
473 d_getfsstat=''
474 d_getgrent=''
475 d_getgrent_r=''
476 getgrent_r_proto=''
477 d_getgrgid_r=''
478 getgrgid_r_proto=''
479 d_getgrnam_r=''
480 getgrnam_r_proto=''
481 d_getgrps=''
482 d_gethbyaddr=''
483 d_gethbyname=''
484 d_gethent=''
485 aphostname=''
486 d_gethname=''
487 d_phostname=''
488 d_uname=''
489 d_gethostbyaddr_r=''
490 gethostbyaddr_r_proto=''
491 d_gethostbyname_r=''
492 gethostbyname_r_proto=''
493 d_gethostent_r=''
494 gethostent_r_proto=''
495 d_gethostprotos=''
496 d_getitimer=''
497 d_getlogin=''
498 d_getlogin_r=''
499 getlogin_r_proto=''
500 d_getmnt=''
501 d_getmntent=''
502 d_getnameinfo=''
503 d_getnbyaddr=''
504 d_getnbyname=''
505 d_getnent=''
506 d_getnetbyaddr_r=''
507 getnetbyaddr_r_proto=''
508 d_getnetbyname_r=''
509 getnetbyname_r_proto=''
510 d_getnetent_r=''
511 getnetent_r_proto=''
512 d_getnetprotos=''
513 d_getpagsz=''
514 d_getpent=''
515 d_getpgid=''
516 d_getpgrp2=''
517 d_bsdgetpgrp=''
518 d_getpgrp=''
519 d_getppid=''
520 d_getprior=''
521 d_getpbyname=''
522 d_getpbynumber=''
523 d_getprotobyname_r=''
524 getprotobyname_r_proto=''
525 d_getprotobynumber_r=''
526 getprotobynumber_r_proto=''
527 d_getprotoent_r=''
528 getprotoent_r_proto=''
529 d_getprotoprotos=''
530 d_getprpwnam=''
531 d_getpwent=''
532 d_getpwent_r=''
533 getpwent_r_proto=''
534 d_getpwnam_r=''
535 getpwnam_r_proto=''
536 d_getpwuid_r=''
537 getpwuid_r_proto=''
538 d_getsent=''
539 d_getservbyname_r=''
540 getservbyname_r_proto=''
541 d_getservbyport_r=''
542 getservbyport_r_proto=''
543 d_getservent_r=''
544 getservent_r_proto=''
545 d_getservprotos=''
546 d_getspnam=''
547 d_getspnam_r=''
548 getspnam_r_proto=''
549 d_getsbyname=''
550 d_getsbyport=''
551 d_gmtime_r=''
552 gmtime_r_proto=''
553 d_gnulibc=''
554 gnulibc_version=''
555 d_hasmntopt=''
556 d_htonl=''
557 d_ilogbl=''
558 d_inetaton=''
559 d_inetntop=''
560 d_inetpton=''
561 d_int64_t=''
562 d_isascii=''
563 d_isfinite=''
564 d_isinf=''
565 d_isnan=''
566 d_isnanl=''
567 d_killpg=''
568 d_lchown=''
569 d_ldbl_dig=''
570 d_libm_lib_version=''
571 d_link=''
572 d_localtime_r=''
573 d_localtime_r_needs_tzset=''
574 localtime_r_proto=''
575 d_locconv=''
576 d_lockf=''
577 d_longdbl=''
578 longdblsize=''
579 d_longlong=''
580 longlongsize=''
581 d_lseekproto=''
582 d_lstat=''
583 d_madvise=''
584 d_malloc_good_size=''
585 d_malloc_size=''
586 d_mblen=''
587 d_mbstowcs=''
588 d_mbtowc=''
589 d_memchr=''
590 d_memcmp=''
591 d_memcpy=''
592 d_memmove=''
593 d_memset=''
594 d_mkdir=''
595 d_mkdtemp=''
596 d_mkfifo=''
597 d_mkstemp=''
598 d_mkstemps=''
599 d_mktime=''
600 d_mmap=''
601 mmaptype=''
602 d_modfl=''
603 d_modfl_pow32_bug=''
604 d_modflproto=''
605 d_mprotect=''
606 d_msg=''
607 d_msgctl=''
608 d_msgget=''
609 d_msghdr_s=''
610 d_msgrcv=''
611 d_msgsnd=''
612 d_msync=''
613 d_munmap=''
614 d_nice=''
615 d_nl_langinfo=''
616 d_off64_t=''
617 d_open3=''
618 d_fpathconf=''
619 d_pathconf=''
620 d_pause=''
621 d_pipe=''
622 d_poll=''
623 d_portable=''
624 d_procselfexe=''
625 procselfexe=''
626 d_old_pthread_create_joinable=''
627 old_pthread_create_joinable=''
628 d_pthread_atfork=''
629 d_pthread_attr_setscope=''
630 d_pthread_yield=''
631 d_sched_yield=''
632 sched_yield=''
633 d_qgcvt=''
634 d_random_r=''
635 random_r_proto=''
636 d_readdir64_r=''
637 readdir64_r_proto=''
638 d_readdir=''
639 d_rewinddir=''
640 d_seekdir=''
641 d_telldir=''
642 d_readdir_r=''
643 readdir_r_proto=''
644 d_readlink=''
645 d_readv=''
646 d_recvmsg=''
647 d_rename=''
648 d_rmdir=''
649 d_safebcpy=''
650 d_safemcpy=''
651 d_sanemcmp=''
652 d_sbrkproto=''
653 d_scalbnl=''
654 d_select=''
655 d_sem=''
656 d_semctl=''
657 d_semget=''
658 d_semop=''
659 d_sendmsg=''
660 d_setegid=''
661 d_seteuid=''
662 d_setgrent=''
663 d_setgrent_r=''
664 setgrent_r_proto=''
665 d_setgrps=''
666 d_sethent=''
667 d_sethostent_r=''
668 sethostent_r_proto=''
669 d_setitimer=''
670 d_setlinebuf=''
671 d_setlocale=''
672 d_setlocale_r=''
673 setlocale_r_proto=''
674 d_setnent=''
675 d_setnetent_r=''
676 setnetent_r_proto=''
677 d_setpent=''
678 d_setpgid=''
679 d_setpgrp2=''
680 d_bsdsetpgrp=''
681 d_setpgrp=''
682 d_setprior=''
683 d_setproctitle=''
684 d_setprotoent_r=''
685 setprotoent_r_proto=''
686 d_setpwent=''
687 d_setpwent_r=''
688 setpwent_r_proto=''
689 d_setregid=''
690 d_setresgid=''
691 d_setresuid=''
692 d_setreuid=''
693 d_setrgid=''
694 d_setruid=''
695 d_setsent=''
696 d_setservent_r=''
697 setservent_r_proto=''
698 d_setsid=''
699 d_setvbuf=''
700 d_sfio=''
701 usesfio=''
702 d_shm=''
703 d_shmat=''
704 d_shmatprototype=''
705 shmattype=''
706 d_shmctl=''
707 d_shmdt=''
708 d_shmget=''
709 d_sigaction=''
710 d_signbit=''
711 d_sigprocmask=''
712 d_sigsetjmp=''
713 usesitecustomize=''
714 d_snprintf=''
715 d_vsnprintf=''
716 d_sockatmark=''
717 d_sockatmarkproto=''
718 d_msg_ctrunc=''
719 d_msg_dontroute=''
720 d_msg_oob=''
721 d_msg_peek=''
722 d_msg_proxy=''
723 d_oldsock=''
724 d_scm_rights=''
725 d_socket=''
726 d_sockpair=''
727 sockethdr=''
728 socketlib=''
729 d_socklen_t=''
730 d_socks5_init=''
731 d_sprintf_returns_strlen=''
732 d_sqrtl=''
733 d_srand48_r=''
734 srand48_r_proto=''
735 d_srandom_r=''
736 srandom_r_proto=''
737 d_sresgproto=''
738 d_sresuproto=''
739 d_statblks=''
740 d_statfs_f_flags=''
741 d_statfs_s=''
742 d_fstatvfs=''
743 d_statvfs=''
744 d_stdio_cnt_lval=''
745 d_stdio_ptr_lval=''
746 d_stdio_ptr_lval_nochange_cnt=''
747 d_stdio_ptr_lval_sets_cnt=''
748 d_stdiobase=''
749 d_stdstdio=''
750 stdio_base=''
751 stdio_bufsiz=''
752 stdio_cnt=''
753 stdio_filbuf=''
754 stdio_ptr=''
755 d_index=''
756 d_strchr=''
757 d_strcoll=''
758 d_strctcpy=''
759 d_strerrm=''
760 d_strerror=''
761 d_sysernlst=''
762 d_syserrlst=''
763 d_strerror_r=''
764 strerror_r_proto=''
765 d_strftime=''
766 d_strlcat=''
767 d_strlcpy=''
768 d_strtod=''
769 d_strtol=''
770 d_strtold=''
771 d_strtoll=''
772 d_strtoq=''
773 d_strtoul=''
774 d_strtoull=''
775 d_strtouq=''
776 d_strxfrm=''
777 d_symlink=''
778 d_syscall=''
779 d_syscallproto=''
780 d_sysconf=''
781 d_system=''
782 d_tcgetpgrp=''
783 d_tcsetpgrp=''
784 d_telldirproto=''
785 d_time=''
786 timetype=''
787 d_asctime64=''
788 d_ctime64=''
789 d_difftime64=''
790 d_gmtime64=''
791 d_localtime64=''
792 d_mktime64=''
793 d_timegm=''
794 clocktype=''
795 d_times=''
796 d_tmpnam_r=''
797 tmpnam_r_proto=''
798 d_truncate=''
799 d_ttyname_r=''
800 ttyname_r_proto=''
801 d_tzname=''
802 d_u32align=''
803 d_ualarm=''
804 d_umask=''
805 d_semctl_semid_ds=''
806 d_semctl_semun=''
807 d_union_semun=''
808 d_unordered=''
809 d_unsetenv=''
810 d_usleep=''
811 d_usleepproto=''
812 d_ustat=''
813 d_pseudofork=''
814 d_vfork=''
815 usevfork=''
816 d_voidsig=''
817 signal_t=''
818 d_volatile=''
819 d_charvspr=''
820 d_vprintf=''
821 d_wait4=''
822 d_waitpid=''
823 d_wcstombs=''
824 d_wctomb=''
825 d_writev=''
826 dlext=''
827 bin_ELF=''
828 cccdlflags=''
829 ccdlflags=''
830 dlsrc=''
831 ld=''
832 lddlflags=''
833 usedl=''
834 doublesize=''
835 ebcdic=''
836 fflushNULL=''
837 fflushall=''
838 fpossize=''
839 fpostype=''
840 gccansipedantic=''
841 gccosandvers=''
842 gccversion=''
843 gidformat=''
844 gidsign=''
845 gidsize=''
846 gidtype=''
847 groupstype=''
848 h_fcntl=''
849 h_sysfile=''
850 html1dir=''
851 html1direxp=''
852 installhtml1dir=''
853 html3dir=''
854 html3direxp=''
855 installhtml3dir=''
856 i_arpainet=''
857 i_assert=''
858 i_crypt=''
859 db_hashtype=''
860 db_prefixtype=''
861 db_version_major=''
862 db_version_minor=''
863 db_version_patch=''
864 i_db=''
865 i_dbm=''
866 i_rpcsvcdbm=''
867 d_dirnamlen=''
868 direntrytype=''
869 i_dirent=''
870 i_dld=''
871 i_dlfcn=''
872 i_fcntl=''
873 i_float=''
874 i_fp=''
875 i_fp_class=''
876 i_gdbm=''
877 d_grpasswd=''
878 i_grp=''
879 i_ieeefp=''
880 i_inttypes=''
881 i_langinfo=''
882 i_libutil=''
883 i_limits=''
884 i_locale=''
885 i_machcthr=''
886 i_malloc=''
887 i_mallocmalloc=''
888 i_math=''
889 i_memory=''
890 i_mntent=''
891 d_gdbm_ndbm_h_uses_prototypes=''
892 d_gdbmndbm_h_uses_prototypes=''
893 d_ndbm=''
894 d_ndbm_h_uses_prototypes=''
895 i_gdbm_ndbm=''
896 i_gdbmndbm=''
897 i_ndbm=''
898 i_netdb=''
899 i_neterrno=''
900 i_netinettcp=''
901 i_niin=''
902 i_sysin=''
903 i_poll=''
904 i_prot=''
905 i_pthread=''
906 d_pwage=''
907 d_pwchange=''
908 d_pwclass=''
909 d_pwcomment=''
910 d_pwexpire=''
911 d_pwgecos=''
912 d_pwpasswd=''
913 d_pwquota=''
914 i_pwd=''
915 i_sfio=''
916 i_shadow=''
917 i_socks=''
918 i_stddef=''
919 i_stdlib=''
920 i_string=''
921 strings=''
922 i_sunmath=''
923 i_sysaccess=''
924 i_sysdir=''
925 i_sysfile=''
926 d_voidtty=''
927 i_bsdioctl=''
928 i_sysfilio=''
929 i_sysioctl=''
930 i_syssockio=''
931 i_syslog=''
932 i_sysmman=''
933 i_sysmode=''
934 i_sysmount=''
935 i_sysndir=''
936 i_sysparam=''
937 i_syspoll=''
938 i_sysresrc=''
939 i_syssecrt=''
940 i_sysselct=''
941 i_sysstat=''
942 i_sysstatfs=''
943 i_sysstatvfs=''
944 i_systimes=''
945 i_systypes=''
946 i_sysuio=''
947 i_sysun=''
948 i_sysutsname=''
949 i_sysvfs=''
950 i_syswait=''
951 i_sgtty=''
952 i_termio=''
953 i_termios=''
954 d_tm_tm_gmtoff=''
955 d_tm_tm_zone=''
956 i_systime=''
957 i_systimek=''
958 i_time=''
959 timeincl=''
960 i_unistd=''
961 i_ustat=''
962 i_utime=''
963 i_values=''
964 i_stdarg=''
965 i_varargs=''
966 i_varhdr=''
967 i_vfork=''
968 d_inc_version_list=''
969 inc_version_list=''
970 inc_version_list_init=''
971 installprefix=''
972 installprefixexp=''
973 installstyle=''
974 installusrbinperl=''
975 intsize=''
976 longsize=''
977 shortsize=''
978 issymlink=''
979 libc=''
980 ldlibpthname=''
981 libperl=''
982 shrpenv=''
983 useshrplib=''
984 glibpth=''
985 libpth=''
986 loclibpth=''
987 plibpth=''
988 xlibpth=''
989 ignore_versioned_solibs=''
990 libs=''
991 libsdirs=''
992 libsfiles=''
993 libsfound=''
994 libspath=''
995 lns=''
996 d_PRIEUldbl=''
997 d_PRIFUldbl=''
998 d_PRIGUldbl=''
999 d_PRIeldbl=''
1000 d_PRIfldbl=''
1001 d_PRIgldbl=''
1002 d_SCNfldbl=''
1003 sPRIEUldbl=''
1004 sPRIFUldbl=''
1005 sPRIGUldbl=''
1006 sPRIeldbl=''
1007 sPRIfldbl=''
1008 sPRIgldbl=''
1009 sSCNfldbl=''
1010 lseeksize=''
1011 lseektype=''
1012 mad=''
1013 madlyh=''
1014 madlyobj=''
1015 madlysrc=''
1016 make_set_make=''
1017 d_mymalloc=''
1018 freetype=''
1019 mallocobj=''
1020 mallocsrc=''
1021 malloctype=''
1022 usemallocwrap=''
1023 usemymalloc=''
1024 installman1dir=''
1025 man1dir=''
1026 man1direxp=''
1027 man1ext=''
1028 installman3dir=''
1029 man3dir=''
1030 man3direxp=''
1031 man3ext=''
1032 modetype=''
1033 multiarch=''
1034 mydomain=''
1035 myhostname=''
1036 phostname=''
1037 c=''
1038 n=''
1039 d_eofnblk=''
1040 eagain=''
1041 o_nonblock=''
1042 rd_nodata=''
1043 need_va_copy=''
1044 netdb_hlen_type=''
1045 netdb_host_type=''
1046 netdb_name_type=''
1047 netdb_net_type=''
1048 groupcat=''
1049 hostcat=''
1050 passcat=''
1051 orderlib=''
1052 ranlib=''
1053 d_perl_otherlibdirs=''
1054 otherlibdirs=''
1055 package=''
1056 spackage=''
1057 pager=''
1058 api_revision=''
1059 api_subversion=''
1060 api_version=''
1061 api_versionstring=''
1062 patchlevel=''
1063 perl_patchlevel=''
1064 revision=''
1065 subversion=''
1066 version=''
1067 version_patchlevel_string=''
1068 perl5=''
1069 perladmin=''
1070 perlpath=''
1071 d_nv_preserves_uv=''
1072 d_nv_zero_is_allbits_zero=''
1073 i16size=''
1074 i16type=''
1075 i32size=''
1076 i32type=''
1077 i64size=''
1078 i64type=''
1079 i8size=''
1080 i8type=''
1081 ivsize=''
1082 ivtype=''
1083 nv_overflows_integers_at=''
1084 nv_preserves_uv_bits=''
1085 nvsize=''
1086 nvtype=''
1087 u16size=''
1088 u16type=''
1089 u32size=''
1090 u32type=''
1091 u64size=''
1092 u64type=''
1093 u8size=''
1094 u8type=''
1095 uvsize=''
1096 uvtype=''
1097 ivdformat=''
1098 nvEUformat=''
1099 nvFUformat=''
1100 nvGUformat=''
1101 nveformat=''
1102 nvfformat=''
1103 nvgformat=''
1104 uvXUformat=''
1105 uvoformat=''
1106 uvuformat=''
1107 uvxformat=''
1108 pidtype=''
1109 prefix=''
1110 prefixexp=''
1111 installprivlib=''
1112 privlib=''
1113 privlibexp=''
1114 prototype=''
1115 ptrsize=''
1116 d_PRIXU64=''
1117 d_PRId64=''
1118 d_PRIi64=''
1119 d_PRIo64=''
1120 d_PRIu64=''
1121 d_PRIx64=''
1122 sPRIXU64=''
1123 sPRId64=''
1124 sPRIi64=''
1125 sPRIo64=''
1126 sPRIu64=''
1127 sPRIx64=''
1128 d_quad=''
1129 quadkind=''
1130 quadtype=''
1131 uquadtype=''
1132 drand01=''
1133 randbits=''
1134 randfunc=''
1135 randseedtype=''
1136 seedfunc=''
1137 installscript=''
1138 scriptdir=''
1139 scriptdirexp=''
1140 selectminbits=''
1141 selecttype=''
1142 sh=''
1143 sig_count=''
1144 sig_name=''
1145 sig_name_init=''
1146 sig_num=''
1147 sig_num_init=''
1148 sig_size=''
1149 d_sitearch=''
1150 installsitearch=''
1151 sitearch=''
1152 sitearchexp=''
1153 installsitebin=''
1154 sitebin=''
1155 sitebinexp=''
1156 installsitehtml1dir=''
1157 sitehtml1dir=''
1158 sitehtml1direxp=''
1159 installsitehtml3dir=''
1160 sitehtml3dir=''
1161 sitehtml3direxp=''
1162 installsitelib=''
1163 sitelib=''
1164 sitelib_stem=''
1165 sitelibexp=''
1166 installsiteman1dir=''
1167 siteman1dir=''
1168 siteman1direxp=''
1169 installsiteman3dir=''
1170 siteman3dir=''
1171 siteman3direxp=''
1172 siteprefix=''
1173 siteprefixexp=''
1174 installsitescript=''
1175 sitescript=''
1176 sitescriptexp=''
1177 sizesize=''
1178 sizetype=''
1179 so=''
1180 socksizetype=''
1181 sharpbang=''
1182 shsharp=''
1183 spitshell=''
1184 src=''
1185 ssizetype=''
1186 startperl=''
1187 startsh=''
1188 stdchar=''
1189 d_stdio_stream_array=''
1190 stdio_stream_array=''
1191 sysman=''
1192 sGMTIME_max=''
1193 sGMTIME_min=''
1194 sLOCALTIME_max=''
1195 sLOCALTIME_min=''
1196 trnl=''
1197 uidformat=''
1198 uidsign=''
1199 uidsize=''
1200 uidtype=''
1201 archname64=''
1202 use64bitall=''
1203 use64bitint=''
1204 dtrace=''
1205 usedtrace=''
1206 usefaststdio=''
1207 ccflags_uselargefiles=''
1208 ldflags_uselargefiles=''
1209 libswanted_uselargefiles=''
1210 uselargefiles=''
1211 uselongdouble=''
1212 usemorebits=''
1213 usemultiplicity=''
1214 nm_opt=''
1215 nm_so_opt=''
1216 runnm=''
1217 usenm=''
1218 useperlio=''
1219 usesocks=''
1220 d_oldpthreads=''
1221 use5005threads=''
1222 useithreads=''
1223 usereentrant=''
1224 usethreads=''
1225 incpath=''
1226 mips_type=''
1227 usrinc=''
1228 d_vendorarch=''
1229 installvendorarch=''
1230 vendorarch=''
1231 vendorarchexp=''
1232 d_vendorbin=''
1233 installvendorbin=''
1234 vendorbin=''
1235 vendorbinexp=''
1236 installvendorhtml1dir=''
1237 vendorhtml1dir=''
1238 vendorhtml1direxp=''
1239 installvendorhtml3dir=''
1240 vendorhtml3dir=''
1241 vendorhtml3direxp=''
1242 d_vendorlib=''
1243 installvendorlib=''
1244 vendorlib=''
1245 vendorlib_stem=''
1246 vendorlibexp=''
1247 installvendorman1dir=''
1248 vendorman1dir=''
1249 vendorman1direxp=''
1250 installvendorman3dir=''
1251 vendorman3dir=''
1252 vendorman3direxp=''
1253 usevendorprefix=''
1254 vendorprefix=''
1255 vendorprefixexp=''
1256 d_vendorscript=''
1257 installvendorscript=''
1258 vendorscript=''
1259 vendorscriptexp=''
1260 versiononly=''
1261 defvoidused=''
1262 voidflags=''
1263 yacc=''
1264 yaccflags=''
1265 CONFIG=''
1266
1267 : Detect odd OSs
1268 define='define'
1269 undef='undef'
1270 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1271 rmlist=''
1272
1273 : We must find out about Eunice early
1274 eunicefix=':'
1275 if test -f /etc/unixtovms; then
1276         eunicefix=/etc/unixtovms
1277 fi
1278 if test -f /etc/unixtovms.exe; then
1279         eunicefix=/etc/unixtovms.exe
1280 fi
1281
1282 : Set executable suffix now -- needed before hints available
1283 if test -f "/libs/version.library"; then
1284 : Amiga OS
1285     _exe=""
1286 elif test -f "/system/gnu_library/bin/ar.pm"; then
1287 : Stratus VOS
1288     _exe=".pm"
1289 elif test -n "$DJGPP"; then
1290 : DOS DJGPP
1291     _exe=".exe"
1292 elif test -d c:/. -o -n "$is_os2" ; then
1293 : OS/2 or cygwin
1294     _exe=".exe"
1295 fi
1296
1297 groupstype=''
1298 i_whoami=''
1299 : Trailing extension.  Override this in a hint file, if needed.
1300 : Extra object files, if any, needed on this platform.
1301 archobjs=''
1302 archname=''
1303 libnames=''
1304 : change the next line if compiling for Xenix/286 on Xenix/386
1305 xlibpth='/usr/lib/386 /lib/386'
1306 : Possible local library directories to search.
1307 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1308 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1309
1310 : general looking path for locating libraries
1311 glibpth="/lib /usr/lib $xlibpth"
1312 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1313 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1314 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1315 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1316
1317 : Private path used by Configure to find libraries.  Its value
1318 : is prepended to libpth. This variable takes care of special
1319 : machines, like the mips.  Usually, it should be empty.
1320 plibpth=''
1321
1322 : default library list
1323 libswanted=''
1324 : some systems want to use only the non-versioned libso:s
1325 ignore_versioned_solibs=''
1326 : set usethreads on the Configure command line to enable threads.
1327 usereentrant='undef'
1328 : full support for void wanted by default
1329 defvoidused=15
1330
1331 : Possible local include directories to search.
1332 : Set locincpth to "" in a hint file to defeat local include searches.
1333 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1334 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1335 :
1336 : no include file wanted by default
1337 inclwanted=''
1338
1339 : Enable -DEBUGGING and -DDEBUGGING from the command line
1340 EBUGGING=''
1341 DEBUGGING=old
1342
1343 ccname=''
1344 ccversion=''
1345 perllibs=''
1346 : set useposix=false in your hint file to disable the POSIX extension.
1347 useposix=true
1348 : set useopcode=false in your hint file to disable the Opcode extension.
1349 useopcode=true
1350 archname64=''
1351 ccflags_uselargefiles=''
1352 ldflags_uselargefiles=''
1353 libswanted_uselargefiles=''
1354 : set usemultiplicity on the Configure command line to enable multiplicity.
1355 : set usesocks on the Configure command line to enable socks.
1356 : List of libraries we want.
1357 : If anyone needs extra -lxxx, put those in a hint file.
1358 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1359 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1360 : We probably want to search /usr/shlib before most other libraries.
1361 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1362 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1363 glibpth="/usr/shlib $glibpth"
1364 : Do not use vfork unless overridden by a hint file.
1365 usevfork=false
1366
1367 : Find the basic shell for Bourne shell scripts
1368 case "$sh" in
1369 '')
1370         case "$SYSTYPE" in
1371         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1372         *) xxx='/bin/sh';;
1373         esac
1374         if test -f "$xxx"; then
1375                 sh="$xxx"
1376         else
1377                 : Build up a list and do a single loop so we can 'break' out.
1378                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1379                 for xxx in sh bash ksh pdksh ash; do
1380                         for p in $pth; do
1381                                 try="$try ${p}/${xxx}"
1382                         done
1383                 done
1384                 for xxx in $try; do
1385                         if test -f "$xxx"; then
1386                                 sh="$xxx";
1387                                 break
1388                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1389                                 sh="$xxx";
1390                                 break
1391                         elif test -f "$xxx.exe"; then
1392                                 sh="$xxx";
1393                                 break
1394                         fi
1395                 done
1396         fi
1397         ;;
1398 esac
1399
1400 case "$sh" in
1401 '')     cat >&2 <<EOM
1402 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1403
1404 Usually it's in /bin/sh.  How did you even get this far?
1405 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1406 we'll try to straighten this all out.
1407 EOM
1408         exit 1
1409         ;;
1410 esac
1411
1412 : see if sh knows # comments
1413 if `$sh -c '#' >/dev/null 2>&1`; then
1414         shsharp=true
1415         spitshell=cat
1416         xcat=/bin/cat
1417         test -f $xcat$_exe || xcat=/usr/bin/cat
1418         if test ! -f $xcat$_exe; then
1419                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1420                         if test -f $p/cat$_exe; then
1421                                 xcat=$p/cat
1422                                 break
1423                         fi
1424                 done
1425                 if test ! -f $xcat$_exe; then
1426                         echo "Can't find cat anywhere!"
1427                         exit 1
1428                 fi
1429         fi
1430         echo "#!$xcat" >sharp
1431         $eunicefix sharp
1432         chmod +x sharp
1433         ./sharp > today 2>/dev/null
1434         if test -s today; then
1435                 sharpbang='#!'
1436         else
1437                 echo "#! $xcat" > sharp
1438                 $eunicefix sharp
1439                 chmod +x sharp
1440                 ./sharp > today 2>/dev/null
1441                 if test -s today; then
1442                         sharpbang='#! '
1443                 else
1444                         sharpbang=': use '
1445                 fi
1446         fi
1447 else
1448         echo " "
1449         echo "Your $sh doesn't grok # comments--I will strip them later on."
1450         shsharp=false
1451         cd ..
1452         echo "exec grep -v '^[  ]*#'" >spitshell
1453         chmod +x spitshell
1454         $eunicefix spitshell
1455         spitshell=`pwd`/spitshell
1456         cd UU
1457         echo "I presume that if # doesn't work, #! won't work either!"
1458         sharpbang=': use '
1459 fi
1460 rm -f sharp today
1461
1462 : figure out how to guarantee sh startup
1463 case "$startsh" in
1464 '') startsh=${sharpbang}${sh} ;;
1465 *)
1466 esac
1467 cat >sharp <<EOSS
1468 $startsh
1469 set abc
1470 test "$?abc" != 1
1471 EOSS
1472
1473 chmod +x sharp
1474 $eunicefix sharp
1475 if ./sharp; then
1476         : echo "Yup, it does."
1477 else
1478         echo "Hmm... '$startsh' does not guarantee sh startup..."
1479         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1480 fi
1481 rm -f sharp
1482
1483 : Save command line options in file UU/cmdline.opt for later use in
1484 : generating config.sh.
1485 cat > cmdline.opt <<EOSH
1486 : Configure command line arguments.
1487 config_arg0='$0'
1488 config_args='$*'
1489 config_argc=$#
1490 EOSH
1491 argn=1
1492 args_exp=''
1493 args_sep=''
1494 for arg in "$@"; do
1495         cat >>cmdline.opt <<EOSH
1496 config_arg$argn='$arg'
1497 EOSH
1498         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1499 $arg
1500 EOC
1501         arg_exp=`cat cmdl.opt`
1502         args_exp="$args_exp$args_sep'$arg_exp'"
1503         argn=`expr $argn + 1`
1504         args_sep=' '
1505 done
1506 rm -f cmdl.opt
1507
1508 : produce awk script to parse command line options
1509 cat >options.awk <<'EOF'
1510 BEGIN {
1511         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1512
1513         len = length(optstr);
1514         for (i = 1; i <= len; i++) {
1515                 c = substr(optstr, i, 1);
1516                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1517                 if (a == ":") {
1518                         arg[c] = 1;
1519                         i++;
1520                 }
1521                 opt[c] = 1;
1522         }
1523 }
1524 {
1525         expect = 0;
1526         str = $0;
1527         if (substr(str, 1, 1) != "-") {
1528                 printf("'%s'\n", str);
1529                 next;
1530         }
1531         len = length($0);
1532         for (i = 2; i <= len; i++) {
1533                 c = substr(str, i, 1);
1534                 if (!opt[c]) {
1535                         printf("-%s\n", substr(str, i));
1536                         next;
1537                 }
1538                 printf("-%s\n", c);
1539                 if (arg[c]) {
1540                         if (i < len)
1541                                 printf("'%s'\n", substr(str, i + 1));
1542                         else
1543                                 expect = 1;
1544                         next;
1545                 }
1546         }
1547 }
1548 END {
1549         if (expect)
1550                 print "?";
1551 }
1552 EOF
1553
1554 : process the command line options
1555 set X `for arg in "$@"; do echo "X$arg"; done |
1556         sed -e s/X// | awk -f options.awk`
1557 eval "set $*"
1558 shift
1559 rm -f options.awk
1560
1561 : set up default values
1562 fastread=''
1563 reuseval=false
1564 config_sh=''
1565 alldone=''
1566 error=''
1567 silent=''
1568 extractsh=''
1569 override=''
1570 knowitall=''
1571 rm -f optdef.sh posthint.sh
1572 cat >optdef.sh <<EOS
1573 $startsh
1574 EOS
1575
1576
1577 : option parsing
1578 while test $# -gt 0; do
1579         case "$1" in
1580         -d) shift; fastread=yes;;
1581         -e) shift; alldone=cont;;
1582         -f)
1583                 shift
1584                 cd ..
1585                 if test -r "$1"; then
1586                         config_sh="$1"
1587                 else
1588                         echo "$me: cannot read config file $1." >&2
1589                         error=true
1590                 fi
1591                 cd UU
1592                 shift;;
1593         --help|\
1594         -h) shift; error=true;;
1595         -r) shift; reuseval=true;;
1596         -s) shift; silent=true; realsilent=true;;
1597         -E) shift; alldone=exit;;
1598         -K) shift; knowitall=true;;
1599         -O) shift; override=true;;
1600         -S) shift; silent=true; extractsh=true;;
1601         -D)
1602                 shift
1603                 case "$1" in
1604                 *=)
1605                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1606                         echo "$me: ignoring -D $1" >&2
1607                         ;;
1608                 *=*) echo "$1" | \
1609                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1610                 *) echo "$1='define'" >> optdef.sh;;
1611                 esac
1612                 shift
1613                 ;;
1614         -U)
1615                 shift
1616                 case "$1" in
1617                 *=) echo "$1" >> optdef.sh;;
1618                 *=*)
1619                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1620                         echo "$me: ignoring -U $1" >&2
1621                         ;;
1622                 *) echo "$1='undef'" >> optdef.sh;;
1623                 esac
1624                 shift
1625                 ;;
1626         -A)
1627             shift
1628             xxx=''
1629             yyy="$1"
1630             zzz=''
1631             uuu=undef
1632             case "$yyy" in
1633             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1634                  case "$zzz" in
1635                  *:*) zzz='' ;;
1636                  *)   xxx=append
1637                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1638                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1639                  esac
1640                  ;;
1641             esac
1642             case "$xxx" in
1643             '')  case "$yyy" in
1644                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1645                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1646                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1647                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1648                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1649                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1650                  esac
1651                  ;;
1652             esac
1653             case "$xxx" in
1654             append)
1655                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1656             clear)
1657                 echo "$yyy=''"                  >> posthint.sh ;;
1658             define)
1659                 case "$zzz" in
1660                 '') zzz=define ;;
1661                 esac
1662                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1663             eval)
1664                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1665             prepend)
1666                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1667             undef)
1668                 case "$zzz" in
1669                 '') zzz="$uuu" ;;
1670                 esac
1671                 echo "$yyy=$zzz"                >> posthint.sh ;;
1672             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1673             esac
1674             shift
1675             ;;
1676         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1677             exit 0;;
1678         --) break;;
1679         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1680         *) break;;
1681         esac
1682 done
1683
1684 case "$error" in
1685 true)
1686         cat >&2 <<EOM
1687 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1688                  [-U symbol] [-U symbol=] [-A command:symbol...]
1689   -d : use defaults for all answers.
1690   -e : go on without questioning past the production of config.sh.
1691   -f : specify an alternate default configuration file.
1692   -h : print this help message and exit (with an error status).
1693   -r : reuse C symbols value if possible (skips costly nm extraction).
1694   -s : silent mode, only echoes questions and essential information.
1695   -D : define symbol to have some value:
1696          -D symbol         symbol gets the value 'define'
1697          -D symbol=value   symbol gets the value 'value'
1698        common used examples (see INSTALL for more info):
1699          -Duse64bitint            use 64bit integers
1700          -Duse64bitall            use 64bit integers and pointers
1701          -Dusethreads             use thread support
1702          -Dinc_version_list=none  do not include older perl trees in @INC
1703          -DEBUGGING=none          DEBUGGING options
1704          -Dcc=gcc                 choose your compiler
1705          -Dprefix=/opt/perl5      choose your destination
1706   -E : stop at the end of questions, after having produced config.sh.
1707   -K : do not use unless you know what you are doing.
1708   -O : let -D and -U override definitions from loaded configuration file.
1709   -S : perform variable substitutions on all .SH files (can mix with -f)
1710   -U : undefine symbol:
1711          -U symbol    symbol gets the value 'undef'
1712          -U symbol=   symbol gets completely empty
1713        e.g.:  -Uversiononly
1714   -A : manipulate symbol after the platform specific hints have been applied:
1715          -A append:symbol=value   append value to symbol
1716          -A symbol=value          like append:, but with a separating space
1717          -A define:symbol=value   define symbol to have value
1718          -A clear:symbol          define symbol to be ''
1719          -A define:symbol         define symbol to be 'define'
1720          -A eval:symbol=value     define symbol to be eval of value
1721          -A prepend:symbol=value  prepend value to symbol
1722          -A undef:symbol          define symbol to be 'undef'
1723          -A undef:symbol=         define symbol to be ''
1724        e.g.:  -A prepend:libswanted='cl pthread '
1725               -A ccflags=-DSOME_MACRO
1726   -V : print version number and exit (with a zero status).
1727 EOM
1728         exit 1
1729         ;;
1730 esac
1731
1732 : Sanity checks
1733 case "$fastread$alldone" in
1734 yescont|yesexit) ;;
1735 *)
1736         case "$extractsh" in
1737         true) ;;
1738         *)
1739                 if test ! -t 0; then
1740                         echo "Say 'sh Configure', not 'sh <Configure'"
1741                         exit 1
1742                 fi
1743                 ;;
1744         esac
1745         ;;
1746 esac
1747
1748 exec 4>&1
1749 case "$silent" in
1750 true) exec 1>/dev/null;;
1751 esac
1752
1753 : run the defines and the undefines, if any, but leave the file out there...
1754 touch optdef.sh
1755 . ./optdef.sh
1756 : create the posthint manipulation script and leave the file out there...
1757 touch posthint.sh
1758
1759 : set package name
1760 package='perl5'
1761 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1762 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1763 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1764 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1765 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1766 esac
1767
1768 : Some greps do not return status, grrr.
1769 echo "grimblepritz" >grimble
1770 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1771         contains=contains
1772 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1773         contains=grep
1774 else
1775         contains=contains
1776 fi
1777 rm -f grimble
1778 : the following should work in any shell
1779 case "$contains" in
1780 contains*)
1781         echo " "
1782         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1783         cat >contains <<'EOSS'
1784 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1785 EOSS
1786 chmod +x contains
1787 esac
1788
1789 : Find the path to the source tree
1790 case "$src" in
1791 '') case "$0" in
1792     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1793          case "$src" in
1794          /*)    ;;
1795          .)     ;;
1796          *)     src=`cd ../$src && pwd` ;;
1797          esac
1798          ;;
1799     *)   src='.';;
1800     esac;;
1801 esac
1802 case "$src" in
1803 '')     src=/
1804         rsrc=/
1805         ;;
1806 /*)     rsrc="$src";;
1807 *)      rsrc="../$src";;
1808 esac
1809 if test -f $rsrc/Configure && \
1810         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1811 then
1812    : found it, so we are ok.
1813 else
1814         rsrc=''
1815         for src in . .. ../.. ../../.. ../../../..; do
1816                 if test -f ../$src/Configure && \
1817                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1818                 then
1819                         rsrc=../$src
1820                         break
1821                 fi
1822         done
1823 fi
1824 case "$rsrc" in
1825 '')
1826         cat <<EOM >&4
1827
1828 Sorry, I can't seem to locate the source dir for $package.  Please start
1829 Configure with an explicit path -- i.e. /some/path/Configure.
1830
1831 EOM
1832         exit 1
1833         ;;
1834 ../.)   rsrc='..';;
1835 *)
1836         echo " "
1837         echo "Sources for $package found in \"$src\"." >&4
1838         ;;
1839 esac
1840
1841 : script used to extract .SH files with variable substitutions
1842 cat >extract <<'EOS'
1843 PERL_CONFIG_SH=true
1844 echo "Doing variable substitutions on .SH files..."
1845 if test -f MANIFEST; then
1846         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1847 else
1848         echo "(Looking for .SH files under the source directory.)"
1849         set x `(cd "$src"; find . -name "*.SH" -print)`
1850 fi
1851 shift
1852 case $# in
1853 0) set x `(cd "$src"; echo *.SH)`; shift;;
1854 esac
1855 if test ! -f "$src/$1"; then
1856         shift
1857 fi
1858 mkdir_p='
1859 name=$1;
1860 create="";
1861 while test $name; do
1862         if test ! -d "$name"; then
1863                 create="$name $create";
1864                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1865                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1866         else
1867                 name="";
1868         fi;
1869 done;
1870 for file in $create; do
1871         mkdir $file;
1872 done
1873 '
1874 for file in $*; do
1875         case "$src" in
1876         ".")
1877                 case "$file" in
1878                 */*)
1879                         dir=`expr X$file : 'X\(.*\)/'`
1880                         file=`expr X$file : 'X.*/\(.*\)'`
1881                         (cd "$dir" && . ./$file)
1882                         ;;
1883                 *)
1884                         . ./$file
1885                         ;;
1886                 esac
1887                 ;;
1888         *)
1889                 case "$file" in
1890                 */*)
1891                         dir=`expr X$file : 'X\(.*\)/'`
1892                         file=`expr X$file : 'X.*/\(.*\)'`
1893                         (set x $dir; shift; eval $mkdir_p)
1894                         sh <"$src/$dir/$file"
1895                         ;;
1896                 *)
1897                         sh <"$src/$file"
1898                         ;;
1899                 esac
1900                 ;;
1901         esac
1902 done
1903 if test -f "$src/config_h.SH"; then
1904         if test ! -f config.h; then
1905         : oops, they left it out of MANIFEST, probably, so do it anyway.
1906         . "$src/config_h.SH"
1907         fi
1908 fi
1909 EOS
1910
1911 : extract files and exit if asked to do so
1912 case "$extractsh" in
1913 true)
1914         case "$realsilent" in
1915         true) ;;
1916         *) exec 1>&4;;
1917         esac
1918         case "$config_sh" in
1919         '') config_sh='config.sh';;
1920         esac
1921         echo " "
1922         echo "Fetching answers from $config_sh..."
1923         cd ..
1924         . $config_sh
1925         test "$override" && . ./optdef.sh
1926         echo " "
1927         . UU/extract
1928         rm -rf UU
1929         echo "Extraction done."
1930         exit 0
1931         ;;
1932 esac
1933
1934 : Eunice requires " " instead of "", can you believe it
1935 echo " "
1936 : Here we go...
1937 echo "Beginning of configuration questions for $package."
1938
1939 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1940
1941 : first determine how to suppress newline on echo command
1942 echo " "
1943 echo "Checking echo to see how to suppress newlines..."
1944 (echo "hi there\c" ; echo " ") >.echotmp
1945 if $contains c .echotmp >/dev/null 2>&1 ; then
1946         echo "...using -n."
1947         n='-n'
1948         c=''
1949 else
1950         cat <<'EOM'
1951 ...using \c
1952 EOM
1953         n=''
1954         c='\c'
1955 fi
1956 echo $n "The star should be here-->$c"
1957 echo '*'
1958 rm -f .echotmp
1959
1960 : Now test for existence of everything in MANIFEST
1961 echo " "
1962 if test -f "$rsrc/MANIFEST"; then
1963         echo "First let's make sure your kit is complete.  Checking..." >&4
1964         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1965                 (split -l 50 2>/dev/null || split -50)
1966         rm -f missing
1967         tmppwd=`pwd`
1968         for filelist in x??; do
1969                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1970                         >/dev/null 2>>"$tmppwd/missing")
1971         done
1972         if test -s missing; then
1973                 cat missing >&4
1974                 cat >&4 <<'EOM'
1975
1976 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1977
1978 You have the option of continuing the configuration process, despite the
1979 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1980 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1981 and contact the author (perlbug@perl.org).
1982
1983 EOM
1984                 echo $n "Continue? [n] $c" >&4
1985                 read ans
1986                 case "$ans" in
1987                 y*)
1988                         echo "Continuing..." >&4
1989                         rm -f missing
1990                         ;;
1991                 *)
1992                         echo "ABORTING..." >&4
1993                         kill $$
1994                         ;;
1995                 esac
1996         else
1997                 echo "Looks good..."
1998         fi
1999 else
2000         echo "There is no MANIFEST file.  I hope your kit is complete !"
2001 fi
2002 rm -f missing x??
2003
2004 : Find the appropriate value for a newline for tr
2005 echo " "
2006 if test -n "$DJGPP"; then
2007        trnl='\012'
2008 fi
2009 if test X"$trnl" = X; then
2010         case "`echo foo|tr '\n' x 2>/dev/null`" in
2011         foox) trnl='\n' ;;
2012         esac
2013 fi
2014 if test X"$trnl" = X; then
2015         case "`echo foo|tr '\012' x 2>/dev/null`" in
2016         foox) trnl='\012' ;;
2017         esac
2018 fi
2019 if test X"$trnl" = X; then
2020        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2021        fooxy) trnl='\n\r' ;;
2022        esac
2023 fi
2024 if test X"$trnl" = X; then
2025         cat <<EOM >&2
2026
2027 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2028
2029 EOM
2030         exit 1
2031 fi
2032
2033 : compute the number of columns on the terminal for proper question formatting
2034 case "$COLUMNS" in
2035 '') COLUMNS='80';;
2036 esac
2037
2038 : set up the echo used in my read
2039 myecho="case \"\$xxxm\" in
2040 '') echo $n \"\$rp $c\" >&4;;
2041 *) case \"\$rp\" in
2042         '') echo $n \"[\$xxxm] $c\";;
2043         *)
2044                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2045                         echo \"\$rp\" >&4
2046                         echo $n \"[\$xxxm] $c\" >&4
2047                 else
2048                         echo $n \"\$rp [\$xxxm] $c\" >&4
2049                 fi
2050                 ;;
2051         esac;;
2052 esac"
2053
2054 : now set up to do reads with possible shell escape and default assignment
2055 cat <<EOSC >myread
2056 $startsh
2057 xxxm=\$dflt
2058 $myecho
2059 ans='!'
2060 case "\$fastread" in
2061 yes) case "\$dflt" in
2062         '') ;;
2063         *) ans='';
2064                 case "\$silent-\$rp" in
2065                 true-) ;;
2066                 *) echo " " >&4;;
2067                 esac;;
2068         esac;;
2069 *) case "\$silent" in
2070         true) case "\$rp" in
2071                 '') ans='';;
2072                 esac;;
2073         esac;;
2074 esac
2075 while expr "X\$ans" : "X!" >/dev/null; do
2076         read answ
2077         set x \$xxxm
2078         shift
2079         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2080         case  "\$answ" in
2081         "!")
2082                 sh 1>&4
2083                 echo " "
2084                 $myecho
2085                 ;;
2086         !*)
2087                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2088                 shift
2089                 sh 1>&4 -c "\$*"
2090                 echo " "
2091                 $myecho
2092                 ;;
2093         "\$ans")
2094                 case "\$ans" in
2095                 \\&*)
2096                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2097                         shift
2098                         case "\$1" in
2099                         -d)
2100                                 fastread=yes
2101                                 echo "(OK, I'll run with -d after this question.)" >&4
2102                                 ;;
2103                         -*)
2104                                 echo "*** Sorry, \$1 not supported yet." >&4
2105                                 ;;
2106                         esac
2107                         $myecho
2108                         ans=!
2109                         ;;
2110                 esac;;
2111         *)
2112                 case "\$aok" in
2113                 y)
2114                         echo "*** Substitution done -- please confirm."
2115                         xxxm="\$ans"
2116                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2117                         xxxm="\$ans"
2118                         ans=!
2119                         ;;
2120                 *)
2121                         echo "*** Error -- try again."
2122                         ans=!
2123                         ;;
2124                 esac
2125                 $myecho
2126                 ;;
2127         esac
2128         case "\$ans\$xxxm\$nostick" in
2129         '')
2130                 ans=!
2131                 $myecho
2132                 ;;
2133         esac
2134 done
2135 case "\$ans" in
2136 '') ans="\$xxxm";;
2137 esac
2138 EOSC
2139
2140 : create .config dir to save info across Configure sessions
2141 test -d ../.config || mkdir ../.config
2142 cat >../.config/README <<EOF
2143 This directory created by Configure to save information that should
2144 persist across sessions for $package.
2145
2146 You may safely delete it if you wish.
2147 EOF
2148
2149 : See if we are using a devel version and want that
2150 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2151 case "$usedevel" in
2152 $define|true|[yY]*)
2153     usedevel="$define" ;;
2154 *) case "$xversion" in
2155    *[13579])
2156         cat >&4 <<EOH
2157 *** WHOA THERE!!! ***
2158
2159     This is an UNSTABLE DEVELOPMENT release.
2160     The version of this $package distribution is $xversion, that is, odd,
2161     (as opposed to even) and that signifies a development release.
2162     If you want a maintenance release, you want an even-numbered version.
2163
2164     Do ***NOT*** install this into production use.
2165     Data corruption and crashes are possible.
2166
2167     It is most seriously suggested that you do not continue any further
2168     unless you want to help in developing and debugging Perl.
2169
2170     If you *still* want to build perl, you can answer 'y' now,
2171     or pass -Dusedevel to Configure.
2172
2173 EOH
2174         rp='Do you really want to continue?'
2175         dflt='n'
2176         . ./myread
2177         case "$ans" in
2178         [yY]) echo >&4 "Okay, continuing."
2179               usedevel="$define" ;;
2180         *) echo >&4 "Okay, bye."
2181            exit 1
2182            ;;
2183         esac
2184         ;;
2185     esac
2186     usedevel="$undef"
2187     ;;
2188 esac
2189 case "$usedevel" in
2190 $define|true|[yY]*)
2191         case "$versiononly" in
2192         '') versiononly="$define" ;;
2193         esac
2194         case "$installusrbinperl" in
2195         '') installusrbinperl="$undef" ;;
2196         esac
2197         ;;
2198 esac
2199
2200 : general instructions
2201 needman=true
2202 firsttime=true
2203 user=`(logname) 2>/dev/null`
2204 case "$user" in
2205 '') user=`whoami 2>&1`;;
2206 esac
2207 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2208         firsttime=false
2209         echo " "
2210         rp='Would you like to see the instructions?'
2211         dflt=n
2212         . ./myread
2213         case "$ans" in
2214         [yY]*) ;;
2215         *) needman=false;;
2216         esac
2217 fi
2218 if $needman; then
2219         cat <<EOH
2220
2221 This installation shell script will examine your system and ask you questions
2222 to determine how the perl5 package should be installed. If you get
2223 stuck on a question, you may use a ! shell escape to start a subshell or
2224 execute a command.  Many of the questions will have default answers in square
2225 brackets; typing carriage return will give you the default.
2226
2227 On some of the questions which ask for file or directory names you are allowed
2228 to use the ~name construct to specify the login directory belonging to "name",
2229 even if you don't have a shell which knows about that.  Questions where this is
2230 allowed will be marked "(~name ok)".
2231
2232 EOH
2233         rp=''
2234         dflt='Type carriage return to continue'
2235         . ./myread
2236         cat <<'EOH'
2237
2238 The prompter used in this script allows you to use shell variables and
2239 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2240 in the default answer, as if the default line was a set of arguments given to a
2241 script shell.  This means you may also use $* to repeat the whole default line,
2242 so you do not have to re-type everything to add something to the default.
2243
2244 Everytime there is a substitution, you will have to confirm.  If there is an
2245 error (e.g. an unmatched backtick), the default answer will remain unchanged
2246 and you will be prompted again.
2247
2248 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2249 the questions and use the computed defaults (or the previous answers if there
2250 was already a config.sh file). Type 'Configure -h' for a list of options.
2251 You may also start interactively and then answer '& -d' at any prompt to turn
2252 on the non-interactive behaviour for the remainder of the execution.
2253
2254 EOH
2255         . ./myread
2256         cat <<EOH
2257
2258 Much effort has been expended to ensure that this shell script will run on any
2259 Unix system.  If despite that it blows up on yours, your best bet is to edit
2260 Configure and run it again.  If you can't run Configure for some reason,
2261 you'll have to generate a config.sh file by hand.  Whatever problems you
2262 have, let me (perlbug@perl.org) know how I blew it.
2263
2264 This installation script affects things in two ways:
2265
2266 1) it may do direct variable substitutions on some of the files included
2267    in this kit.
2268 2) it builds a config.h file for inclusion in C programs.  You may edit
2269    any of these files as the need arises after running this script.
2270
2271 If you make a mistake on a question, there is no easy way to back up to it
2272 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2273 files.  Configure will offer to let you do this before it runs the SH files.
2274
2275 EOH
2276         dflt='Type carriage return to continue'
2277         . ./myread
2278         case "$firsttime" in
2279         true) echo $user >>../.config/instruct;;
2280         esac
2281 fi
2282
2283 : find out where common programs are
2284 echo " "
2285 echo "Locating common programs..." >&4
2286 cat <<EOSC >loc
2287 $startsh
2288 case \$# in
2289 0) exit 1;;
2290 esac
2291 thing=\$1
2292 shift
2293 dflt=\$1
2294 shift
2295 for dir in \$*; do
2296         case "\$thing" in
2297         .)
2298         if test -d \$dir/\$thing; then
2299                 echo \$dir
2300                 exit 0
2301         fi
2302         ;;
2303         *)
2304         for thisthing in \$dir/\$thing; do
2305                 : just loop through to pick last item
2306         done
2307         if test -f \$thisthing; then
2308                 echo \$thisthing
2309                 exit 0
2310         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2311                 echo \$thisthing
2312                 exit 0
2313         elif test -f \$dir/\$thing.exe; then
2314                 if test -n "$DJGPP"; then
2315                         echo \$dir/\$thing.exe
2316                 elif test "$eunicefix" != ":"; then
2317                         : on Eunice apparently
2318                         echo \$dir/\$thing
2319                 fi
2320                 exit 0
2321         fi
2322         ;;
2323         esac
2324 done
2325 echo \$dflt
2326 exit 1
2327 EOSC
2328 chmod +x loc
2329 $eunicefix loc
2330 loclist="
2331 awk
2332 cat
2333 chmod
2334 comm
2335 cp
2336 echo
2337 expr
2338 grep
2339 ls
2340 mkdir
2341 rm
2342 sed
2343 sort
2344 touch
2345 tr
2346 uniq
2347 "
2348 trylist="
2349 ar
2350 bison
2351 byacc
2352 cpp
2353 csh
2354 date
2355 egrep
2356 gmake
2357 gzip
2358 less
2359 ln
2360 make
2361 more
2362 nm
2363 nroff
2364 pg
2365 test
2366 uname
2367 zip
2368 "
2369 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2370 pth="$pth /lib /usr/lib"
2371 for file in $loclist; do
2372         eval xxx=\$$file
2373         case "$xxx" in
2374         /*|?:[\\/]*)
2375                 if test -f "$xxx"; then
2376                         : ok
2377                 else
2378                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2379                         xxx=`./loc $file $file $pth`
2380                 fi
2381                 ;;
2382         '') xxx=`./loc $file $file $pth`;;
2383         *) xxx=`./loc $xxx $xxx $pth`;;
2384         esac
2385         eval $file=$xxx$_exe
2386         eval _$file=$xxx
2387         case "$xxx" in
2388         /*)
2389                 echo $file is in $xxx.
2390                 ;;
2391         ?:[\\/]*)
2392                 echo $file is in $xxx.
2393                 ;;
2394         *)
2395                 echo "I don't know where '$file' is, and my life depends on it." >&4
2396                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2397                 exit 1
2398                 ;;
2399         esac
2400 done
2401 echo " "
2402 echo "Don't worry if any of the following aren't found..."
2403 say=offhand
2404 for file in $trylist; do
2405         eval xxx=\$$file
2406         case "$xxx" in
2407         /*|?:[\\/]*)
2408                 if test -f "$xxx"; then
2409                         : ok
2410                 else
2411                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2412                         xxx=`./loc $file $file $pth`
2413                 fi
2414                 ;;
2415         '') xxx=`./loc $file $file $pth`;;
2416         *) xxx=`./loc $xxx $xxx $pth`;;
2417         esac
2418         eval $file=$xxx$_exe
2419         eval _$file=$xxx
2420         case "$xxx" in
2421         /*)
2422                 echo $file is in $xxx.
2423                 ;;
2424         ?:[\\/]*)
2425                 echo $file is in $xxx.
2426                 ;;
2427         *)
2428                 echo "I don't see $file out there, $say."
2429                 say=either
2430                 ;;
2431         esac
2432 done
2433 case "$egrep" in
2434 egrep)
2435         echo "Substituting grep for egrep."
2436         egrep=$grep
2437         _egrep=$grep
2438         ;;
2439 esac
2440 case "$ln" in
2441 ln)
2442         echo "Substituting cp for ln."
2443         ln=$cp
2444         _ln=$cp
2445         ;;
2446 esac
2447 case "$make" in
2448 make)
2449         case "$gmake" in
2450         gmake)
2451         echo "I can't find make or gmake, and my life depends on it." >&4
2452         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2453         exit 1
2454         ;;
2455         esac
2456         ;;
2457 esac
2458 case "$gmake" in
2459 gmake)  ;;
2460 *)      # We can't have osname yet.
2461         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2462                 # Assume that gmake, if found, is definitely GNU make
2463                 # and prefer it over the system make.
2464                 echo "Substituting gmake for make."
2465                 make=$gmake
2466                 _make=$gmake
2467         fi
2468         ;;
2469 esac
2470 case "$test" in
2471 test)
2472         echo "Hopefully test is built into your sh."
2473         ;;
2474 *)
2475         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2476                 echo "Using the test built into your sh."
2477                 test=test
2478                 _test=test
2479         fi
2480         ;;
2481 esac
2482 case "$echo" in
2483 echo)
2484         echo "Hopefully echo is built into your sh."
2485         ;;
2486 '') ;;
2487 *)
2488         echo " "
2489 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2490         $echo $n "hi there$c" >foo1
2491         echo $n "hi there$c" >foo2
2492         if cmp foo1 foo2 >/dev/null 2>&1; then
2493                 echo "They are compatible.  In fact, they may be identical."
2494         else
2495                 case "$n" in
2496                 '-n') n='' c='\c';;
2497                 *) n='-n' c='';;
2498                 esac
2499                 cat <<FOO
2500 They are not compatible!  You are probably running ksh on a non-USG system.
2501 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2502 have echo built in and we may have to run some Bourne shell scripts.  That
2503 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2504
2505 FOO
2506                 $echo $n "The star should be here-->$c"
2507                 $echo "*"
2508         fi
2509         $rm -f foo1 foo2
2510         ;;
2511 esac
2512
2513 # This question was auctioned at YAPC::Europe-2007 in Vienna
2514 # I never promised you could answer it. I only auctioned the question.
2515 cat <<FOO
2516 The following message is sponsored by
2517
2518   Dresden.pm<--The stars should be here.
2519
2520 Dear Perl user, system administrator or package
2521 maintainer, the Perl community sends greetings to
2522 you. Do you (emblematical) greet back [Y/n]? n
2523
2524 FOO
2525
2526 : Check what type of C compiler we use
2527 cat <<EOS >trygcc
2528 $startsh
2529 EOS
2530 cat <<'EOSC' >>trygcc
2531 case "$cc" in
2532 '') ;;
2533 *)  $rm -f try try.*
2534     $cat >try.c <<EOM
2535 int main(int argc, char *argv[]) {
2536   return 0;
2537 }
2538 EOM
2539     if $cc -o try $ccflags $ldflags try.c; then
2540        :
2541     else
2542         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2543         despair=yes
2544         trygcc=yes
2545         case "$cc" in
2546         *gcc*) trygcc=no ;;
2547         esac
2548         # Skip this test because it gives a false match on output like:
2549         #    ./trygcc: line 23: cc: command not found
2550         # case "`$cc -v -c try.c 2>&1`" in
2551         # *gcc*) trygcc=no ;;
2552         # esac
2553         if $test X"$trygcc" = Xyes; then
2554             if gcc -o try -c try.c; then
2555                 echo " "
2556                 echo "You seem to have a working gcc, though." >&4
2557                 # Switching compilers may undo the work of hints files.
2558                 # The most common problem is -D_REENTRANT for threads.
2559                 # This heuristic catches that case, but gets false positives
2560                 # if -Dusethreads was not actually specified.  Better to
2561                 # bail out here with a useful message than fail 
2562                 # mysteriously later. Should we perhaps just try to
2563                 # re-invoke Configure -Dcc=gcc config_args ?
2564                 if $test -f usethreads.cbu; then
2565                         $cat >&4 <<EOM 
2566
2567 *** However, any setting of the C compiler flags (e.g. for thread support)
2568 *** will be lost.  It may be necessary for you to restart Configure and
2569 *** add -Dcc=gcc to your Configure command line.
2570
2571 EOM
2572                         rp="Would you like to go ahead and try gcc anyway?"
2573                         dflt=n
2574                 else
2575                         rp="Would you like to use it?"
2576                         dflt=y
2577                 fi
2578                 if $test -f myread; then
2579                     . ./myread
2580                 else
2581                     if $test -f UU/myread; then
2582                         . ./UU/myread
2583                     else
2584                         echo "Cannot find myread, sorry.  Aborting." >&2
2585                         exit 1
2586                     fi
2587                 fi  
2588                 case "$ans" in
2589                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2590                 esac
2591             fi
2592         fi
2593     fi
2594     $rm -f try try.*
2595     ;;
2596 esac
2597 EOSC
2598
2599 cat <<EOS >checkcc
2600 $startsh
2601 EOS
2602 cat <<'EOSC' >>checkcc
2603 case "$cc" in        
2604 '') ;;
2605 *)  $rm -f try try.*              
2606     $cat >try.c <<EOM
2607 int main(int argc, char *argv[]) {
2608   return 0;
2609 }
2610 EOM
2611     if $cc -o try $ccflags $ldflags try.c; then
2612        :
2613     else
2614         if $test X"$despair" = Xyes; then
2615            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2616         fi
2617         $cat >&4 <<EOM         
2618 You need to find a working C compiler.
2619 Either (purchase and) install the C compiler supplied by your OS vendor,
2620 or for a free C compiler try http://gcc.gnu.org/
2621 I cannot continue any further, aborting.
2622 EOM
2623         exit 1
2624     fi
2625     $rm -f try try.*
2626     ;;
2627 esac
2628 EOSC
2629
2630 : determine whether symbolic links are supported
2631 echo " "
2632 $touch blurfl
2633 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2634         echo "Symbolic links are supported." >&4
2635         lns="$ln -s"
2636 else
2637         echo "Symbolic links are NOT supported." >&4
2638         lns="$ln"
2639 fi
2640 $rm -f blurfl sym
2641
2642 : determine whether symbolic links are supported
2643 echo " "
2644 case "$lns" in
2645 *"ln"*" -s")
2646         echo "Checking how to test for symbolic links..." >&4
2647         $lns blurfl sym
2648         if $test "X$issymlink" = X; then
2649                 case "$newsh" in
2650                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2651                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2652                 esac
2653                 if test $? = 0; then
2654                         issymlink="test -h"
2655                 else
2656                         echo "Your builtin 'test -h' may be broken." >&4
2657                         case "$test" in
2658                         /*)     ;;
2659                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2660                                 for p in $pth
2661                                 do
2662                                         if test -f "$p/$test"; then
2663                                                 test="$p/$test"
2664                                                 break
2665                                         fi
2666                                 done
2667                                 ;;
2668                         esac
2669                         case "$test" in
2670                         /*)
2671                                 echo "Trying external '$test -h'." >&4
2672                                 issymlink="$test -h"
2673                                 if $test ! -h sym >/dev/null 2>&1; then
2674                                         echo "External '$test -h' is broken, too." >&4
2675                                         issymlink=''
2676                                 fi
2677                                 ;;
2678                         *)      issymlink='' ;;
2679                         esac
2680                 fi              
2681         fi
2682         if $test "X$issymlink" = X; then
2683                 if $test -L sym 2>/dev/null; then
2684                         issymlink="$test -L"
2685                         echo "The builtin '$test -L' worked." >&4
2686                 fi
2687         fi
2688         if $test "X$issymlink" != X; then
2689                 echo "You can test for symbolic links with '$issymlink'." >&4
2690         else
2691                 echo "I do not know how you can test for symbolic links." >&4
2692         fi
2693         $rm -f blurfl sym
2694         ;;
2695 *)      echo "No symbolic links, so not testing for their testing..." >&4
2696         ;;
2697 esac
2698 echo " "
2699
2700 : Make symlinks util
2701 case "$mksymlinks" in
2702 $define|true|[yY]*)
2703         case "$src" in
2704         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2705                 exit 1
2706                 ;;
2707         *)      case "$lns:$issymlink" in
2708                 *"ln"*" -s:"*"test -"?)
2709                         echo "Creating the symbolic links..." >&4
2710                         echo "(First creating the subdirectories...)" >&4
2711                         cd ..
2712                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2713                                 read directory
2714                                 test -z "$directory" && break
2715                                 mkdir -p $directory
2716                         done
2717                         # Sanity check 1.
2718                         if test ! -d t/base; then
2719                                 echo "Failed to create the subdirectories.  Aborting." >&4
2720                                 exit 1
2721                         fi
2722                         echo "(Then creating the symlinks...)" >&4
2723                         awk '{print $1}' $src/MANIFEST | while true; do
2724                                 read filename
2725                                 test -z "$filename" && break
2726                                 if test -f $filename; then
2727                                         if $issymlink $filename; then
2728                                                 rm -f $filename
2729                                         fi
2730                                 fi
2731                                 if test -f $filename; then
2732                                         echo "$filename already exists, not symlinking."
2733                                 else
2734                                         ln -s $src/$filename $filename
2735                                 fi
2736                         done
2737                         # Sanity check 2.
2738                         if test ! -f t/base/lex.t; then
2739                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2740                                 exit 1
2741                         fi
2742                         cd UU
2743                         ;;
2744                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2745                         ;;
2746                 esac
2747                 ;;
2748         esac
2749         ;;
2750 esac
2751
2752 : Check for Cross-Compilation
2753 case "$usecrosscompile" in
2754 $define|true|[yY]*)
2755         $echo "Cross-compiling..."
2756         croak=''
2757         case "$cc" in
2758         *-*-gcc) # A cross-compiling gcc, probably.
2759             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2760             ar=$targetarch-ar
2761             # leave out ld, choosing it is more complex
2762             nm=$targetarch-nm
2763             ranlib=$targetarch-ranlib
2764             $echo 'extern int foo;' > try.c
2765             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2766             shift
2767             if $test $# -gt 0; then
2768                 incpth="$incpth $*"
2769                 incpth="`$echo $incpth|$sed 's/^ //'`"
2770                 echo "Guessing incpth '$incpth'." >&4
2771                 for i in $*; do
2772                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2773                     if $test -d $j; then
2774                         libpth="$libpth $j"
2775                     fi
2776                 done   
2777                 libpth="`$echo $libpth|$sed 's/^ //'`"
2778                 echo "Guessing libpth '$libpth'." >&4
2779             fi
2780             $rm -f try.c
2781             ;;
2782         esac
2783         case "$targetarch" in
2784         '') echo "Targetarch not defined." >&4; croak=y ;;
2785         *)  echo "Using targetarch $targetarch." >&4 ;;
2786         esac
2787         case "$incpth" in
2788         '') echo "Incpth not defined." >&4; croak=y ;;
2789         *)  echo "Using incpth '$incpth'." >&4 ;;
2790         esac
2791         case "$libpth" in
2792         '') echo "Libpth not defined." >&4; croak=y ;;
2793         *)  echo "Using libpth '$libpth'." >&4 ;;
2794         esac
2795         case "$usrinc" in
2796         '') for i in $incpth; do
2797                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2798                     usrinc=$i
2799                     echo "Guessing usrinc $usrinc." >&4
2800                     break
2801                 fi
2802             done
2803             case "$usrinc" in
2804             '') echo "Usrinc not defined." >&4; croak=y ;;
2805             esac
2806             ;;
2807         *)  echo "Using usrinc $usrinc." >&4 ;;
2808         esac
2809         case "$targethost" in
2810         '') echo "Targethost not defined." >&4; croak=y ;;
2811         *)  echo "Using targethost $targethost." >&4
2812         esac
2813         locincpth=' '
2814         loclibpth=' '
2815         case "$croak" in
2816         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2817         esac
2818         case "$src" in
2819         /*) run=$src/Cross/run
2820             targetmkdir=$src/Cross/mkdir
2821             to=$src/Cross/to
2822             from=$src/Cross/from
2823             ;;
2824         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2825             run=$pwd/Cross/run
2826             targetmkdir=$pwd/Cross/mkdir
2827             to=$pwd/Cross/to
2828             from=$pwd/Cross/from
2829             ;;
2830         esac
2831         case "$targetrun" in
2832         '') targetrun=ssh ;;
2833         esac
2834         case "$targetto" in
2835         '') targetto=scp ;;
2836         esac
2837         case "$targetfrom" in
2838         '') targetfrom=scp ;;
2839         esac
2840         run=$run-$targetrun
2841         to=$to-$targetto
2842         from=$from-$targetfrom
2843         case "$targetdir" in
2844         '')  targetdir=/tmp
2845              echo "Guessing targetdir $targetdir." >&4
2846              ;;
2847         esac
2848         case "$targetuser" in
2849         '')  targetuser=root
2850              echo "Guessing targetuser $targetuser." >&4
2851              ;;
2852         esac
2853         case "$targetfrom" in
2854         scp)    q=-q ;;
2855         *)      q='' ;;
2856         esac
2857         case "$targetrun" in
2858         ssh|rsh)
2859             cat >$run <<EOF
2860 #!/bin/sh
2861 case "\$1" in
2862 -cwd)
2863   shift
2864   cwd=\$1
2865   shift
2866   ;;
2867 esac
2868 case "\$cwd" in
2869 '') cwd=$targetdir ;;
2870 esac
2871 exe=\$1
2872 shift
2873 if $test ! -f \$exe.xok; then
2874   $to \$exe
2875   $touch \$exe.xok
2876 fi
2877 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2878 EOF
2879             ;;
2880         *)  echo "Unknown targetrun '$targetrun'" >&4
2881             exit 1
2882             ;;
2883         esac
2884         case "$targetmkdir" in
2885         */Cross/mkdir)
2886             cat >$targetmkdir <<EOF
2887 #!/bin/sh
2888 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2889 EOF
2890             $chmod a+rx $targetmkdir
2891             ;;
2892         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2893             exit 1
2894             ;;
2895         esac
2896         case "$targetto" in
2897         scp|rcp)
2898             cat >$to <<EOF
2899 #!/bin/sh
2900 for f in \$@
2901 do
2902   case "\$f" in
2903   /*)
2904     $targetmkdir \`dirname \$f\`
2905     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2906     ;;
2907   *)
2908     $targetmkdir $targetdir/\`dirname \$f\`
2909     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2910     ;;
2911   esac
2912 done
2913 exit 0
2914 EOF
2915             ;;
2916         cp) cat >$to <<EOF
2917 #!/bin/sh
2918 for f in \$@
2919 do
2920   case "\$f" in
2921   /*)
2922     $mkdir -p $targetdir/\`dirname \$f\`
2923     $cp \$f $targetdir/\$f || exit 1
2924     ;;
2925   *)
2926     $targetmkdir $targetdir/\`dirname \$f\`
2927     $cp \$f $targetdir/\$f || exit 1
2928     ;;
2929   esac
2930 done
2931 exit 0
2932 EOF
2933             ;;
2934         *)  echo "Unknown targetto '$targetto'" >&4
2935             exit 1
2936             ;;
2937         esac
2938         case "$targetfrom" in
2939         scp|rcp)
2940           cat >$from <<EOF
2941 #!/bin/sh
2942 for f in \$@
2943 do
2944   $rm -f \$f
2945   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2946 done
2947 exit 0
2948 EOF
2949             ;;
2950         cp) cat >$from <<EOF
2951 #!/bin/sh
2952 for f in \$@
2953 do
2954   $rm -f \$f
2955   cp $targetdir/\$f . || exit 1
2956 done
2957 exit 0
2958 EOF
2959             ;;
2960         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2961             exit 1
2962             ;;
2963         esac
2964         if $test ! -f $run; then
2965             echo "Target 'run' script '$run' not found." >&4
2966         else
2967             $chmod a+rx $run
2968         fi
2969         if $test ! -f $to; then
2970             echo "Target 'to' script '$to' not found." >&4
2971         else
2972             $chmod a+rx $to
2973         fi
2974         if $test ! -f $from; then
2975             echo "Target 'from' script '$from' not found." >&4
2976         else
2977             $chmod a+rx $from
2978         fi
2979         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2980             exit 1
2981         fi
2982         cat >&4 <<EOF
2983 Using '$run' for remote execution,
2984 and '$from' and '$to'
2985 for remote file transfer.
2986 EOF
2987         ;;
2988 *)      run=''
2989         to=:
2990         from=:
2991         usecrosscompile='undef'
2992         targetarch=''
2993         ;;
2994 esac
2995
2996 : see whether [:lower:] and [:upper:] are supported character classes
2997 echo " "
2998 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2999 ABYZ)
3000         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3001         up='[:upper:]'
3002         low='[:lower:]'
3003         ;;
3004 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3005         # (0xd9 and 0xe2), therefore that is a nice testing point.
3006         if test "X$up" = X -o "X$low" = X; then
3007             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3008             rs) up='[A-Z]'
3009                 low='[a-z]'
3010                 ;;
3011             esac
3012         fi
3013         if test "X$up" = X -o "X$low" = X; then
3014             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3015             rs) up='A-Z'
3016                 low='a-z'
3017                 ;;
3018             esac
3019         fi
3020         if test "X$up" = X -o "X$low" = X; then
3021             case "`echo RS | od -x 2>/dev/null`" in
3022             *D9E2*|*d9e2*)
3023                 echo "Hey, this might be EBCDIC." >&4
3024                 if test "X$up" = X -o "X$low" = X; then
3025                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3026                     rs) up='[A-IJ-RS-Z]'
3027                         low='[a-ij-rs-z]'
3028                         ;;
3029                     esac
3030                 fi
3031                 if test "X$up" = X -o "X$low" = X; then
3032                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3033                     rs) up='A-IJ-RS-Z'
3034                         low='a-ij-rs-z'
3035                         ;;
3036                     esac
3037                 fi
3038                 ;;
3039             esac
3040         fi
3041 esac
3042 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3043 rs)
3044     echo "Using $up and $low to convert case." >&4
3045     ;;
3046 *)
3047     echo "I don't know how to translate letters from upper to lower case." >&4
3048     echo "Your tr is not acting any way I know of." >&4
3049     exit 1
3050     ;;
3051 esac
3052 : set up the translation script tr, must be called with ./tr of course
3053 cat >tr <<EOSC
3054 $startsh
3055 case "\$1\$2" in
3056 '[A-Z][a-z]') exec $tr '$up' '$low';;
3057 '[a-z][A-Z]') exec $tr '$low' '$up';;
3058 esac
3059 exec $tr "\$@"
3060 EOSC
3061 chmod +x tr
3062 $eunicefix tr
3063
3064 : Try to determine whether config.sh was made on this system
3065 case "$config_sh" in
3066 '')
3067 myuname=`$uname -a 2>/dev/null`
3068 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3069 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3070 # because the A-Z/a-z are not consecutive.
3071 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3072         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3073 newmyuname="$myuname"
3074 dflt=n
3075 case "$knowitall" in
3076 '')
3077         if test -f ../config.sh; then
3078                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3079                         eval "`grep myuname= ../config.sh`"
3080                 fi
3081                 if test "X$myuname" = "X$newmyuname"; then
3082                         dflt=y
3083                 fi
3084         fi
3085         ;;
3086 *) dflt=y;;
3087 esac
3088
3089 : Get old answers from old config file if Configure was run on the
3090 : same system, otherwise use the hints.
3091 hint=default
3092 cd ..
3093 if test -f config.sh; then
3094         echo " "
3095         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3096         . UU/myread
3097         case "$ans" in
3098         n*|N*) echo "OK, I'll ignore it."
3099                 mv config.sh config.sh.old
3100                 myuname="$newmyuname"
3101                 ;;
3102         *)  echo "Fetching default answers from your old config.sh file..." >&4
3103                 tmp_n="$n"
3104                 tmp_c="$c"
3105                 tmp_sh="$sh"
3106                 . ./config.sh
3107                 cp config.sh UU
3108                 n="$tmp_n"
3109                 c="$tmp_c"
3110                 : Older versions did not always set $sh.  Catch re-use of such
3111                 : an old config.sh.
3112                 case "$sh" in
3113                 '') sh="$tmp_sh" ;;
3114                 esac
3115                 hint=previous
3116                 ;;
3117         esac
3118 fi
3119 . ./UU/checkcc
3120 if test ! -f config.sh; then
3121         $cat <<EOM
3122
3123 First time through, eh?  I have some defaults handy for some systems
3124 that need some extra help getting the Configure answers right:
3125
3126 EOM
3127         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3128         dflt=''
3129         : Half the following guesses are probably wrong... If you have better
3130         : tests or hints, please send them to perlbug@perl.org
3131         : The metaconfig authors would also appreciate a copy...
3132         $test -f /irix && osname=irix
3133         $test -f /xenix && osname=sco_xenix
3134         $test -f /dynix && osname=dynix
3135         $test -f /dnix && osname=dnix
3136         $test -f /lynx.os && osname=lynxos
3137         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3138         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3139         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3140         $test -f /bin/mips && /bin/mips && osname=mips
3141         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3142                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3143         $test -d /usr/apollo/bin && osname=apollo
3144         $test -f /etc/saf/_sactab && osname=svr4
3145         $test -d /usr/include/minix && osname=minix
3146         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3147         if $test -d /MachTen -o -d /MachTen_Folder; then
3148                 osname=machten
3149                 if $test -x /sbin/version; then
3150                         osvers=`/sbin/version | $awk '{print $2}' |
3151                         $sed -e 's/[A-Za-z]$//'`
3152                 elif $test -x /usr/etc/version; then
3153                         osvers=`/usr/etc/version | $awk '{print $2}' |
3154                         $sed -e 's/[A-Za-z]$//'`
3155                 else
3156                         osvers="$2.$3"
3157                 fi
3158         fi
3159
3160         $test -f /sys/posix.dll &&
3161                 $test -f /usr/bin/what &&
3162                 set X `/usr/bin/what /sys/posix.dll` &&
3163                 $test "$3" = UWIN &&
3164                 osname=uwin &&
3165                 osvers="$5"
3166
3167         if $test -f $uname; then
3168                 set X $myuname
3169                 shift
3170
3171                 case "$5" in
3172                 fps*) osname=fps ;;
3173                 mips*)
3174                         case "$4" in
3175                         umips) osname=umips ;;
3176                         *) osname=mips ;;
3177                         esac;;
3178                 [23]100) osname=mips ;;
3179                 next*) osname=next ;;
3180                 i386*)
3181                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3182                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3183                                 osname='sco'
3184                                 osvers=$tmp
3185                         elif $test -f /etc/kconfig; then
3186                                 osname=isc
3187                                 if test "$lns" = "$ln -s"; then
3188                                         osvers=4
3189                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3190                                         osvers=3
3191                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3192                                         osvers=2
3193                                 fi
3194                         fi
3195                         tmp=''
3196                         ;;
3197                 pc*)
3198                         if test -n "$DJGPP"; then
3199                                 osname=dos
3200                                 osvers=djgpp
3201                         fi
3202                         ;;
3203                 esac
3204
3205                 case "$1" in
3206                 aix) osname=aix
3207                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3208                         case "$tmp" in
3209                         # oslevel can fail with:
3210                         # oslevel: Unable to acquire lock.
3211                         *not\ found) osvers="$4"."$3" ;;
3212                         '<3240'|'<>3240') osvers=3.2.0 ;;
3213                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3214                         '=3250'|'>3250') osvers=3.2.5 ;;
3215                         *) osvers=$tmp;;
3216                         esac
3217                         ;;
3218                 bsd386) osname=bsd386
3219                         osvers=`$uname -r`
3220                         ;;
3221                 cygwin*) osname=cygwin
3222                         osvers="$3"
3223                         ;;
3224                 *dc.osx) osname=dcosx
3225                         osvers="$3"
3226                         ;;
3227                 dnix) osname=dnix
3228                         osvers="$3"
3229                         ;;
3230                 domainos) osname=apollo
3231                         osvers="$3"
3232                         ;;
3233                 dgux)   osname=dgux
3234                         osvers="$3"
3235                         ;;
3236                 dragonfly) osname=dragonfly
3237                         osvers="$3"
3238                         ;;
3239                 dynixptx*) osname=dynixptx
3240                         osvers=`echo "$4"|sed 's/^v//'`
3241                         ;;
3242                 freebsd) osname=freebsd
3243                         osvers="$3" ;;
3244                 genix)  osname=genix ;;
3245                 gnu)    osname=gnu
3246                         osvers="$3" ;;
3247                 hp*)    osname=hpux
3248                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3249                         ;;
3250                 irix*)  osname=irix
3251                         case "$3" in
3252                         4*) osvers=4 ;;
3253                         5*) osvers=5 ;;
3254                         *)      osvers="$3" ;;
3255                         esac
3256                         ;;
3257                 linux)  osname=linux
3258                         case "$3" in
3259                         *)      osvers="$3" ;;
3260                         esac
3261                         ;;
3262                 MiNT)   osname=mint
3263                         ;;
3264                 netbsd*) osname=netbsd
3265                         osvers="$3"
3266                         ;;
3267                 news-os) osvers="$3"
3268                         case "$3" in
3269                         4*) osname=newsos4 ;;
3270                         *) osname=newsos ;;
3271                         esac
3272                         ;;
3273                 next*) osname=next ;;
3274                 nonstop-ux) osname=nonstopux ;;
3275                 openbsd) osname=openbsd
3276                         osvers="$3"
3277                         ;;
3278                 os2)    osname=os2
3279                         osvers="$4"
3280                         ;;
3281                 POSIX-BC | posix-bc ) osname=posix-bc
3282                         osvers="$3"
3283                         ;;
3284                 powerux | power_ux | powermax_os | powermaxos | \
3285                 powerunix | power_unix) osname=powerux
3286                         osvers="$3"
3287                         ;;
3288                 qnx) osname=qnx
3289                         osvers="$4"
3290                         ;;
3291                 solaris) osname=solaris
3292                         case "$3" in
3293                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3294                         *)      osvers="$3" ;;
3295                         esac
3296                         ;;
3297                 sunos) osname=sunos
3298                         case "$3" in
3299                         5*) osname=solaris
3300                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3301                         *)      osvers="$3" ;;
3302                         esac
3303                         ;;
3304                 titanos) osname=titanos
3305                         case "$3" in
3306                         1*) osvers=1 ;;
3307                         2*) osvers=2 ;;
3308                         3*) osvers=3 ;;
3309                         4*) osvers=4 ;;
3310                         *)      osvers="$3" ;;
3311                         esac
3312                         ;;
3313                 ultrix) osname=ultrix
3314                         osvers="$3"
3315                         ;;
3316                 osf1|mls+)      case "$5" in
3317                                 alpha)
3318                                         osname=dec_osf
3319                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3320                                         case "$osvers" in
3321                                         [1-9].[0-9]*) ;;
3322                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3323                                         esac
3324                                         ;;
3325                         hp*)    osname=hp_osf1  ;;
3326                         mips)   osname=mips_osf1 ;;
3327                         esac
3328                         ;;
3329                 # UnixWare 7.1.2 is known as Open UNIX 8
3330                 openunix|unixware) osname=svr5
3331                         osvers="$4"
3332                         ;;
3333                 uts)    osname=uts
3334                         osvers="$3"
3335                         ;;
3336                 vos) osvers="$3"
3337                         ;;
3338                 $2) case "$osname" in
3339                         *isc*) ;;
3340                         *freebsd*) ;;
3341                         svr*)
3342                                 : svr4.x or possibly later
3343                                 case "svr$3" in
3344                                 ${osname}*)
3345                                         osname=svr$3
3346                                         osvers=$4
3347                                         ;;
3348                                 esac
3349                                 case "$osname" in
3350                                 svr4.0)
3351                                         : Check for ESIX
3352                                         if test -f /stand/boot ; then
3353                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3354                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3355                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3356                                                         if test -n "$isesix"; then
3357                                                                 osname=esix4
3358                                                         fi
3359                                                 fi
3360                                         fi
3361                                         ;;
3362                                 esac
3363                                 ;;
3364                         *)      if test -f /etc/systemid; then
3365                                         osname=sco
3366                                         set `echo $3 | $sed 's/\./ /g'` $4
3367                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3368                                                 osvers=$1.$2.$3
3369                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3370                                                 osvers=$1.$2
3371                                         elif $test -f $src/hints/sco_$1.sh; then
3372                                                 osvers=$1
3373                                         fi
3374                                 else
3375                                         case "$osname" in
3376                                         '') : Still unknown.  Probably a generic Sys V.
3377                                                 osname="sysv"
3378                                                 osvers="$3"
3379                                                 ;;
3380                                         esac
3381                                 fi
3382                                 ;;
3383                         esac
3384                         ;;
3385                 *)      case "$osname" in
3386                         '') : Still unknown.  Probably a generic BSD.
3387                                 osname="$1"
3388                                 osvers="$3"
3389                                 ;;
3390                         esac
3391                         ;;
3392                 esac
3393         else
3394                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3395                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3396                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3397                                 osname=news_os
3398                         fi
3399                         $rm -f UU/kernel.what
3400                 elif test -d c:/. -o -n "$is_os2" ; then
3401                         set X $myuname
3402                         osname=os2
3403                         osvers="$5"
3404                 fi
3405         fi
3406
3407         case "$targetarch" in
3408         '') ;;
3409         *)  hostarch=$osname
3410             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3411             osvers=''
3412             ;;
3413         esac
3414
3415         : Now look for a hint file osname_osvers, unless one has been
3416         : specified already.
3417         case "$hintfile" in
3418         ''|' ')
3419                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3420                 : Also try without trailing minor version numbers.
3421                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3422                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3423                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3424                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3425                 case "$file" in
3426                 '') dflt=none ;;
3427                 *)  case "$osvers" in
3428                         '') dflt=$file
3429                                 ;;
3430                         *)  if $test -f $src/hints/$file.sh ; then
3431                                         dflt=$file
3432                                 elif $test -f $src/hints/$xfile.sh ; then
3433                                         dflt=$xfile
3434                                 elif $test -f $src/hints/$xxfile.sh ; then
3435                                         dflt=$xxfile
3436                                 elif $test -f $src/hints/$xxxfile.sh ; then
3437                                         dflt=$xxxfile
3438                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3439                                         dflt=$xxxxfile
3440                                 elif $test -f "$src/hints/${osname}.sh" ; then
3441                                         dflt="${osname}"
3442                                 else
3443                                         dflt=none
3444                                 fi
3445                                 ;;
3446                         esac
3447                         ;;
3448                 esac
3449                 if $test -f Policy.sh ; then
3450                         case "$dflt" in
3451                         *Policy*) ;;
3452                         none) dflt="Policy" ;;
3453                         *) dflt="Policy $dflt" ;;
3454                         esac
3455                 fi
3456                 ;;
3457         *)
3458                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3459                 ;;
3460         esac
3461
3462         if $test -f Policy.sh ; then
3463                 $cat <<EOM
3464
3465 There's also a Policy hint file available, which should make the
3466 site-specific (policy) questions easier to answer.
3467 EOM
3468
3469         fi
3470
3471         $cat <<EOM
3472
3473 You may give one or more space-separated answers, or "none" if appropriate.
3474 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3475 previous run of Configure, you may specify it as well as or instead of
3476 OS-specific hints.  If hints are provided for your OS, you should use them:
3477 although Perl can probably be built without hints on many platforms, using
3478 hints often improve performance and may enable features that Configure can't
3479 set up on its own. If there are no hints that match your OS, specify "none";
3480 DO NOT give a wrong version or a wrong OS.
3481
3482 EOM
3483
3484         rp="Which of these apply, if any?"
3485         . UU/myread
3486         tans=$ans
3487         for file in $tans; do
3488                 if $test X$file = XPolicy -a -f Policy.sh; then
3489                         . Policy.sh
3490                         $cat Policy.sh >> UU/config.sh
3491                 elif $test -f $src/hints/$file.sh; then
3492                         . $src/hints/$file.sh
3493                         $cat $src/hints/$file.sh >> UU/config.sh
3494                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3495                         : nothing
3496                 else
3497                         : Give one chance to correct a possible typo.
3498                         echo "$file.sh does not exist"
3499                         dflt=$file
3500                         rp="hint to use instead?"
3501                         . UU/myread
3502                         for file in $ans; do
3503                                 if $test -f "$src/hints/$file.sh"; then
3504                                         . $src/hints/$file.sh
3505                                         $cat $src/hints/$file.sh >> UU/config.sh
3506                                 elif $test X$ans = X -o X$ans = Xnone ; then
3507                                         : nothing
3508                                 else
3509                                         echo "$file.sh does not exist -- ignored."
3510                                 fi
3511                         done
3512                 fi
3513         done
3514
3515         hint=recommended
3516         : Remember our hint file for later.
3517         if $test -f "$src/hints/$file.sh" ; then
3518                 hintfile="$file"
3519         else
3520                 hintfile=''
3521         fi
3522 fi
3523 cd UU
3524 ;;
3525 *)
3526         echo " "
3527         echo "Fetching default answers from $config_sh..." >&4
3528         tmp_n="$n"
3529         tmp_c="$c"
3530         cd ..
3531         cp $config_sh config.sh 2>/dev/null
3532         chmod +w config.sh
3533         . ./config.sh
3534         cd UU
3535         cp ../config.sh .
3536         n="$tmp_n"
3537         c="$tmp_c"
3538         hint=previous
3539         ;;
3540 esac
3541 test "$override" && . ./optdef.sh
3542
3543 : Restore computed paths
3544 for file in $loclist $trylist; do
3545         eval $file="\$_$file"
3546 done
3547
3548 cat << EOM
3549
3550 Configure uses the operating system name and version to set some defaults.
3551 The default value is probably right if the name rings a bell. Otherwise,
3552 since spelling matters for me, either accept the default or answer "none"
3553 to leave it blank.
3554
3555 EOM
3556 case "$osname" in
3557         ''|' ')
3558                 case "$hintfile" in
3559                 ''|' '|none) dflt=none ;;
3560                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3561                 esac
3562                 ;;
3563         *) dflt="$osname" ;;
3564 esac
3565 rp="Operating system name?"
3566 . ./myread
3567 case "$ans" in
3568 none)  osname='' ;;
3569 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3570 esac
3571 echo " "
3572 case "$osvers" in
3573         ''|' ')
3574                 case "$hintfile" in
3575                 ''|' '|none) dflt=none ;;
3576                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3577                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3578                         case "$dflt" in
3579                         ''|' ') dflt=none ;;
3580                         esac
3581                         ;;
3582                 esac
3583                 ;;
3584         *) dflt="$osvers" ;;
3585 esac
3586 rp="Operating system version?"
3587 . ./myread
3588 case "$ans" in
3589 none)  osvers='' ;;
3590 *) osvers="$ans" ;;
3591 esac
3592
3593
3594 . ./posthint.sh
3595
3596 : who configured the system
3597 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3598 case "$cf_by" in
3599 "")
3600         cf_by=`(logname) 2>/dev/null`
3601         case "$cf_by" in
3602         "")
3603                 cf_by=`(whoami) 2>/dev/null`
3604                 case "$cf_by" in
3605                 "") cf_by=unknown ;;
3606                 esac ;;
3607         esac ;;
3608 esac
3609
3610 : decide how portable to be.  Allow command line overrides.
3611 case "$d_portable" in
3612 "$undef") ;;
3613 *)      d_portable="$define" ;;
3614 esac
3615
3616 : set up shell script to do ~ expansion
3617 cat >filexp <<EOSS
3618 $startsh
3619 : expand filename
3620 case "\$1" in
3621  \~/*|\~)
3622         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3623         ;;
3624  \~*)
3625         if $test -f /bin/csh; then
3626                 /bin/csh -f -c "glob \$1"
3627                 failed=\$?
3628                 echo ""
3629                 exit \$failed
3630         else
3631                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3632                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3633                 if $test ! -d "\$dir"; then
3634                         me=\`basename \$0\`
3635                         echo "\$me: can't locate home directory for: \$name" >&2
3636                         exit 1
3637                 fi
3638                 case "\$1" in
3639                 */*)
3640                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3641                         ;;
3642                 *)
3643                         echo \$dir
3644                         ;;
3645                 esac
3646         fi
3647         ;;
3648 *)
3649         echo \$1
3650         ;;
3651 esac
3652 EOSS
3653 chmod +x filexp
3654 $eunicefix filexp
3655
3656 : now set up to get a file name
3657 cat <<EOS >getfile
3658 $startsh
3659 EOS
3660 cat <<'EOSC' >>getfile
3661 tilde=''
3662 fullpath=''
3663 already=''
3664 skip=''
3665 none_ok=''
3666 exp_file=''
3667 nopath_ok=''
3668 orig_rp="$rp"
3669 orig_dflt="$dflt"
3670 case "$gfpth" in
3671 '') gfpth='.' ;;
3672 esac
3673
3674 case "$fn" in
3675 *\(*)
3676         : getfile will accept an answer from the comma-separated list
3677         : enclosed in parentheses even if it does not meet other criteria.
3678         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3679         fn=`echo $fn | sed 's/(.*)//'`
3680         ;;
3681 esac
3682
3683 case "$fn" in
3684 *:*)
3685         loc_file=`expr $fn : '.*:\(.*\)'`
3686         fn=`expr $fn : '\(.*\):.*'`
3687         ;;
3688 esac
3689
3690 case "$fn" in
3691 *~*) tilde=true;;
3692 esac
3693 case "$fn" in
3694 */*) fullpath=true;;
3695 esac
3696 case "$fn" in
3697 *+*) skip=true;;
3698 esac
3699 case "$fn" in
3700 *n*) none_ok=true;;
3701 esac
3702 case "$fn" in
3703 *e*) exp_file=true;;
3704 esac
3705 case "$fn" in
3706 *p*) nopath_ok=true;;
3707 esac
3708
3709 case "$fn" in
3710 *f*) type='File';;
3711 *d*) type='Directory';;
3712 *l*) type='Locate';;
3713 esac
3714
3715 what="$type"
3716 case "$what" in
3717 Locate) what='File';;
3718 esac
3719
3720 case "$exp_file" in
3721 '')
3722         case "$d_portable" in
3723         "$define") ;;
3724         *) exp_file=true;;
3725         esac
3726         ;;
3727 esac
3728
3729 cd ..
3730 while test "$type"; do
3731         redo=''
3732         rp="$orig_rp"
3733         dflt="$orig_dflt"
3734         case "$tilde" in
3735         true) rp="$rp (~name ok)";;
3736         esac
3737         . UU/myread
3738         if test -f UU/getfile.ok && \
3739                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3740         then
3741                 value="$ans"
3742                 ansexp="$ans"
3743                 break
3744         fi
3745         case "$ans" in
3746         none)
3747                 value=''
3748                 ansexp=''
3749                 case "$none_ok" in
3750                 true) type='';;
3751                 esac
3752                 ;;
3753         *)
3754                 case "$tilde" in
3755                 '') value="$ans"
3756                         ansexp="$ans";;
3757                 *)
3758                         value=`UU/filexp $ans`
3759                         case $? in
3760                         0)
3761                                 if test "$ans" != "$value"; then
3762                                         echo "(That expands to $value on this system.)"
3763                                 fi
3764                                 ;;
3765                         *) value="$ans";;
3766                         esac
3767                         ansexp="$value"
3768                         case "$exp_file" in
3769                         '') value="$ans";;
3770                         esac
3771                         ;;
3772                 esac
3773                 case "$fullpath" in
3774                 true)
3775                         case "$ansexp" in
3776                         /*) value="$ansexp" ;;
3777                         [a-zA-Z]:/*) value="$ansexp" ;;
3778                         *)
3779                                 redo=true
3780                                 case "$already" in
3781                                 true)
3782                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3783                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3784                                         ;;
3785                                 *)
3786                                 echo "Please give a full path name, starting with slash." >&4
3787                                         case "$tilde" in
3788                                         true)
3789                                 echo "Note that using ~name is ok provided it expands well." >&4
3790                                                 already=true
3791                                                 ;;
3792                                         esac
3793                                 esac
3794                                 ;;
3795                         esac
3796                         ;;
3797                 esac
3798                 case "$redo" in
3799                 '')
3800                         case "$type" in
3801                         File)
3802                                 for fp in $gfpth; do
3803                                         if test "X$fp" = X.; then
3804                                             pf="$ansexp"
3805                                         else    
3806                                             pf="$fp/$ansexp"
3807                                         fi
3808                                         if test -f "$pf"; then
3809                                                 type=''
3810                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3811                                         then
3812                                                 echo "($value is not a plain file, but that's ok.)"
3813                                                 type=''
3814                                         fi
3815                                         if test X"$type" = X; then
3816                                             value="$pf"
3817                                             break
3818                                         fi
3819                                 done
3820                                 ;;
3821                         Directory)
3822                                 for fp in $gfpth; do
3823                                         if test "X$fp" = X.; then
3824                                             dir="$ans"
3825                                             direxp="$ansexp"
3826                                         else    
3827                                             dir="$fp/$ansexp"
3828                                             direxp="$fp/$ansexp"
3829                                         fi
3830                                         if test -d "$direxp"; then
3831                                                 type=''
3832                                                 value="$dir"
3833                                                 break
3834                                         fi
3835                                 done
3836                                 ;;
3837                         Locate)
3838                                 if test -d "$ansexp"; then
3839                                         echo "(Looking for $loc_file in directory $value.)"
3840                                         value="$value/$loc_file"
3841                                         ansexp="$ansexp/$loc_file"
3842                                 fi
3843                                 if test -f "$ansexp"; then
3844                                         type=''
3845                                 fi
3846                                 case "$nopath_ok" in
3847                                 true)   case "$value" in
3848                                         */*) ;;
3849                                         *)      echo "Assuming $value will be in people's path."
3850                                                 type=''
3851                                                 ;;
3852                                         esac
3853                                         ;;
3854                                 esac
3855                                 ;;
3856                         esac
3857
3858                         case "$skip" in
3859                         true) type='';
3860                         esac
3861
3862                         case "$type" in
3863                         '') ;;
3864                         *)
3865                                 if test "$fastread" = yes; then
3866                                         dflt=y
3867                                 else
3868                                         dflt=n
3869                                 fi
3870                                 rp="$what $value doesn't exist.  Use that name anyway?"
3871                                 . UU/myread
3872                                 dflt=''
3873                                 case "$ans" in
3874                                 y*) type='';;
3875                                 *) echo " ";;
3876                                 esac
3877                                 ;;
3878                         esac
3879                         ;;
3880                 esac
3881                 ;;
3882         esac
3883 done
3884 cd UU
3885 ans="$value"
3886 rp="$orig_rp"
3887 dflt="$orig_dflt"
3888 rm -f getfile.ok
3889 test "X$gfpthkeep" != Xy && gfpth=""
3890 EOSC
3891
3892 : determine root of directory hierarchy where package will be installed.
3893 case "$prefix" in
3894 '')
3895         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3896         ;;
3897 *?/)
3898         dflt=`echo "$prefix" | sed 's/.$//'`
3899         ;;
3900 *)
3901         dflt="$prefix"
3902         ;;
3903 esac
3904 $cat <<EOM
3905
3906 By default, $package will be installed in $dflt/bin, manual pages
3907 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3908 installation directories. Typically this is something like /usr/local.
3909 If you wish to have binaries under /usr/bin but other parts of the
3910 installation under /usr/local, that's ok: you will be prompted
3911 separately for each of the installation directories, the prefix being
3912 only used to set the defaults.
3913
3914 EOM
3915 fn=d~
3916 rp='Installation prefix to use?'
3917 . ./getfile
3918 oldprefix=''
3919 case "$prefix" in
3920 '') ;;
3921 *)
3922         case "$ans" in
3923         "$prefix") ;;
3924         *) oldprefix="$prefix";;
3925         esac
3926         ;;
3927 esac
3928 prefix="$ans"
3929 prefixexp="$ansexp"
3930
3931 : allow them to override the AFS root
3932 case "$afsroot" in
3933 '')     afsroot=/afs ;;
3934 *)      afsroot=$afsroot ;;
3935 esac
3936
3937 : is AFS running?
3938 echo " "
3939 case "$afs" in
3940 $define|true)   afs=true ;;
3941 $undef|false)   afs=false ;;
3942 *)      if $test -d $afsroot; then
3943                 afs=true
3944         else
3945                 afs=false
3946         fi
3947         ;;
3948 esac
3949 if $afs; then
3950         echo "AFS may be running... I'll be extra cautious then..." >&4
3951 else
3952         echo "AFS does not seem to be running..." >&4
3953 fi
3954
3955 : determine installation prefix for where package is to be installed.
3956 if $afs; then 
3957 $cat <<EOM
3958
3959 Since you are running AFS, I need to distinguish the directory in which
3960 files will reside from the directory in which they are installed (and from
3961 which they are presumably copied to the former directory by occult means).
3962
3963 EOM
3964         case "$installprefix" in
3965         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3966         *) dflt="$installprefix";;
3967         esac
3968 else
3969 $cat <<EOM
3970
3971 In some special cases, particularly when building $package for distribution,
3972 it is convenient to distinguish the directory in which files should be
3973 installed from the directory ($prefix) in which they will
3974 eventually reside.  For most users, these two directories are the same.
3975
3976 EOM
3977         case "$installprefix" in
3978         '') dflt=$prefix ;;
3979         *) dflt=$installprefix;;
3980         esac
3981 fi
3982 fn=d~
3983 rp='What installation prefix should I use for installing files?'
3984 . ./getfile
3985 installprefix="$ans"
3986 installprefixexp="$ansexp"
3987
3988 : Perform the prefixexp/installprefixexp correction if necessary
3989 cat <<EOS >installprefix
3990 $startsh
3991 EOS
3992 cat <<'EOSC' >>installprefix
3993 : Change installation prefix, if necessary.
3994 if $test X"$prefix" != X"$installprefix"; then
3995     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3996 else
3997     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3998 fi
3999 EOSC
4000 chmod +x installprefix
4001 $eunicefix installprefix
4002
4003 : Set variables such as privlib and privlibexp from the output of ./getfile
4004 : performing the prefixexp/installprefixexp correction if necessary.
4005 cat <<EOS >setprefixvar
4006 $startsh
4007 EOS
4008 cat <<'EOSC' >>setprefixvar
4009 eval "${prefixvar}=\"\$ans\""
4010 eval "${prefixvar}exp=\"\$ansexp\""
4011 . ./installprefix
4012 EOSC
4013 chmod +x setprefixvar
4014 $eunicefix setprefixvar
4015
4016 : set up the script used to warn in case of inconsistency
4017 cat <<EOS >whoa
4018 $startsh
4019 EOS
4020 cat <<'EOSC' >>whoa
4021 dflt=y
4022 case "$hint" in
4023     recommended)
4024         case "$hintfile" in
4025         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4026                 ;;
4027         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4028                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4029                 ;;
4030         esac
4031         ;;
4032     *)  echo " "
4033         echo "*** WHOA THERE!!! ***" >&4
4034         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4035         ;;
4036 esac
4037 rp="    Keep the $hint value?"
4038 . ./myread
4039 case "$ans" in
4040 y) td=$was; tu=$was;;
4041 esac
4042 EOSC
4043
4044 : function used to set '$1' to '$val'
4045 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4046 case "$val$was" in
4047 $define$undef) . ./whoa; eval "$var=\$td";;
4048 $undef$define) . ./whoa; eval "$var=\$tu";;
4049 *) eval "$var=$val";;
4050 esac'
4051
4052 : Check is we will use socks
4053 case "$usesocks" in
4054 $define|true|[yY]*)     dflt='y';;
4055 *) dflt='n';;
4056 esac
4057 cat <<EOM
4058
4059 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4060 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4061 to use the PerlIO abstraction layer, this will be implicitly selected.
4062
4063 If this doesn't make any sense to you, just accept the default '$dflt'.
4064 EOM
4065 rp='Build Perl for SOCKS?'
4066 . ./myread
4067 case "$ans" in
4068 y|Y)    val="$define" ;;
4069 *)      val="$undef" ;;
4070 esac
4071 set usesocks
4072 eval $setvar
4073
4074 case "$usesocks" in
4075 $define|true|[yY]*) useperlio="$define";;
4076 esac
4077
4078 : Check if we want perlio
4079 case "$useperlio" in
4080 $define|true|[yY]*|'')  dflt='y';;
4081 *) dflt='n';;
4082 esac
4083 cat <<EOM
4084
4085 Previous version of $package used the standard IO mechanisms as
4086 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4087 alternate IO mechanisms via the PerlIO abstraction layer, but the
4088 stdio mechanism is still available if needed.  The abstraction layer
4089 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4090 Using PerlIO with sfio may cause problems with some extension modules.
4091
4092 If this doesn't make any sense to you, just accept the default '$dflt'.
4093 EOM
4094 rp='Use the PerlIO abstraction layer?'
4095 . ./myread
4096 case "$ans" in
4097 y|Y)
4098         val="$define"
4099         ;;
4100 *)
4101         echo "Ok, doing things the stdio way."
4102         val="$undef"
4103         ;;
4104 esac
4105 set useperlio
4106 eval $setvar
4107
4108 case "$usesocks" in
4109 $define|true|[yY]*)
4110         case "$useperlio" in
4111         $define|true|[yY]*) ;;
4112         *)      cat >&4 <<EOM
4113
4114 You are using the SOCKS proxy protocol library which means that you
4115 should also use the PerlIO layer.  You may be headed for trouble.
4116
4117 EOM
4118                 ;;
4119         esac
4120         ;;
4121 esac
4122
4123 : get the patchlevel
4124 echo " "
4125 echo "Getting the current patchlevel..." >&4
4126 if $test -r $rsrc/patchlevel.h;then
4127         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4128         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4129         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4130         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4131         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4132         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4133         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4134 else
4135         revision=0
4136         patchlevel=0
4137         subversion=0
4138         api_revision=0
4139         api_version=0
4140         api_subversion=0
4141         perl_patchlevel=0
4142         $echo "(You do not have patchlevel.h.  Eek.)"
4143 fi
4144 if $test -r $rsrc/.patch ; then
4145         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4146                 perl_patchlevel=`cat $rsrc/.patch`
4147         fi
4148 fi
4149 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4150 version_patchlevel_string="version $patchlevel subversion $subversion"
4151 case "$perl_patchlevel" in
4152 0|'') ;;
4153 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4154     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4155     ;;
4156 esac
4157
4158 $echo "(You have $package $version_patchlevel_string.)"
4159
4160 case "$osname" in
4161 dos|vms)
4162         : XXX Should be a Configure test for double-dots in filenames.
4163         version=`echo $revision $patchlevel $subversion | \
4164                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4165         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4166                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4167         ;;
4168 *)
4169         version=`echo $revision $patchlevel $subversion | \
4170                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4171         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4172                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4173         ;;
4174 esac
4175 : Special case the 5.005_xx maintenance series, which used 5.005
4176 : without any subversion label as a subdirectory in $sitelib
4177 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4178         api_versionstring='5.005'
4179 fi
4180
4181 : Do we want threads support and if so, what type
4182 case "$usethreads" in
4183 $define|true|[yY]*)     dflt='y';;
4184 *)     # Catch case where user specified ithreads or 5005threads but
4185        # forgot -Dusethreads (A.D. 4/2002)
4186        case "$useithreads$use5005threads" in
4187        *$define*)
4188                 case "$useperlio" in
4189                 "$define")      dflt='y' ;;
4190                 *)              dflt='n' ;;
4191                 esac
4192                 ;;
4193        *)       dflt='n';;
4194        esac
4195        ;;
4196 esac
4197 cat <<EOM
4198
4199 Perl can be built to take advantage of threads on some systems.
4200 To do so, Configure can be run with -Dusethreads.
4201
4202 Note that Perl built with threading support runs slightly slower
4203 and uses more memory than plain Perl. The current implementation
4204 is believed to be stable, but it is fairly new, and so should be
4205 treated with caution.
4206
4207 If this doesn't make any sense to you, just accept the default '$dflt'.
4208 EOM
4209 rp='Build a threading Perl?'
4210 . ./myread
4211 case "$ans" in
4212 y|Y)    val="$define" ;;
4213 *)      val="$undef" ;;
4214 esac
4215 set usethreads
4216 eval $setvar
4217
4218 if $test $patchlevel -lt 9; then
4219     case "$usethreads" in
4220     $define)
4221         $cat <<EOM
4222
4223 Since release 5.6, Perl has had two different threading implementations,
4224 the newer interpreter-based version (ithreads) with one interpreter per
4225 thread, and the older 5.005 version (5005threads).
4226 The 5005threads version is effectively unmaintained and will probably be
4227 removed in Perl 5.10, so there should be no need to build a Perl using it
4228 unless needed for backwards compatibility with some existing 5.005threads
4229 code.
4230
4231 EOM
4232         : Default to ithreads unless overridden on command line or with
4233         : old config.sh
4234         dflt='y'
4235         case "$use5005threads" in
4236                 $define|true|[yY]*) dflt='n';;
4237         esac
4238         case "$useithreads" in
4239                 $undef|false|[nN]*) dflt='n';;
4240         esac
4241         rp='Use the newer interpreter-based ithreads?'
4242         . ./myread
4243         case "$ans" in
4244         y|Y)    val="$define" ;;
4245         *)      val="$undef" ;;
4246         esac
4247         set useithreads
4248         eval $setvar
4249         : Now set use5005threads to the opposite value.
4250         case "$useithreads" in
4251         $define) val="$undef" ;;
4252         *) val="$define" ;;
4253         esac
4254         set use5005threads
4255         eval $setvar
4256         ;;
4257     *)
4258         useithreads="$undef"
4259         use5005threads="$undef"
4260         ;;
4261     esac
4262
4263     case "$useithreads$use5005threads" in
4264     "$define$define")
4265         $cat >&4 <<EOM
4266
4267 You cannot have both the ithreads and the 5.005 threads enabled
4268 at the same time.  Disabling the 5.005 threads since they are
4269 much less stable than the ithreads.
4270
4271 EOM
4272         use5005threads="$undef"
4273         ;;
4274     esac
4275
4276 else
4277 : perl-5.9.x and later
4278
4279     if test X"$usethreads" = "X$define"; then
4280         case "$use5005threads" in
4281             $define|true|[yY]*)
4282                 $cat >&4 <<EOM
4283
4284 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4285
4286 EOM
4287             ;;
4288         esac
4289     fi
4290
4291     use5005threads="$undef"
4292     useithreads="$usethreads"
4293 fi
4294
4295 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4296         cat >&4 <<EOF
4297 ***
4298 *** To build with ithreads you must also use the PerlIO layer.
4299 *** Cannot continue, aborting.
4300 ***
4301 EOF
4302         exit 1
4303 fi
4304
4305 case "$d_oldpthreads" in
4306 '')     : Configure tests would be welcome here.  For now, assume undef.
4307         val="$undef" ;;
4308 *)      val="$d_oldpthreads" ;;
4309 esac
4310 set d_oldpthreads
4311 eval $setvar
4312
4313
4314 : Look for a hint-file generated 'call-back-unit'.  If the
4315 : user has specified that a threading perl is to be built,
4316 : we may need to set or change some other defaults.
4317 if $test -f usethreads.cbu; then
4318     echo "Your platform has some specific hints regarding threaded builds, using them..."
4319     . ./usethreads.cbu
4320 else
4321     case "$usethreads" in
4322         "$define"|true|[yY]*)
4323                 $cat <<EOM
4324 (Your platform does not have any specific hints for threaded builds.
4325  Assuming POSIX threads, then.)
4326 EOM
4327         ;;
4328     esac
4329 fi
4330
4331 : Check if multiplicity is required
4332 cat <<EOM
4333
4334 Perl can be built so that multiple Perl interpreters can coexist
4335 within the same Perl executable.
4336 EOM
4337
4338 case "$useithreads" in
4339 $define)
4340         cat <<EOM
4341 This multiple interpreter support is required for interpreter-based threads.
4342 EOM
4343         val="$define"
4344         ;;
4345 *)      case "$usemultiplicity" in
4346         $define|true|[yY]*)     dflt='y';;
4347         *) dflt='n';;
4348         esac
4349         echo " "
4350         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4351         rp='Build Perl for multiplicity?'
4352         . ./myread
4353         case "$ans" in
4354         y|Y)    val="$define" ;;
4355         *)      val="$undef" ;;
4356         esac
4357         ;;
4358 esac
4359 set usemultiplicity
4360 eval $setvar
4361
4362 : Check if morebits is requested
4363 case "$usemorebits" in
4364 "$define"|true|[yY]*)
4365         use64bitint="$define"
4366         uselongdouble="$define"
4367         usemorebits="$define"
4368         ;;
4369 *)      usemorebits="$undef"
4370         ;;
4371 esac
4372
4373 : Determine the C compiler to be used
4374 echo " "
4375 case "$cc" in
4376 '') dflt=cc;;
4377 *) dflt="$cc";;
4378 esac
4379 rp="Use which C compiler?"
4380 . ./myread
4381 cc="$ans"
4382
4383 : See whether they have no cc but they do have gcc
4384 . ./trygcc
4385 if $test -f cc.cbu; then
4386     . ./cc.cbu
4387 fi
4388 . ./checkcc
4389
4390 : make some quick guesses about what we are up against
4391 echo " "
4392 $echo $n "Hmm...  $c"
4393 echo exit 1 >bsd
4394 echo exit 1 >usg
4395 echo exit 1 >v7
4396 echo exit 1 >osf1
4397 echo exit 1 >eunice
4398 echo exit 1 >xenix
4399 echo exit 1 >venix
4400 echo exit 1 >os2
4401 d_bsd="$undef"
4402 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4403 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4404 then
4405         echo "Looks kind of like an OSF/1 system, but we'll see..."
4406         echo exit 0 >osf1
4407 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4408         xxx=`./loc addbib blurfl $pth`
4409         if $test -f $xxx; then
4410         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4411                 echo exit 0 >bsd
4412                 echo exit 0 >usg
4413         else
4414                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4415                         echo "Looks kind of like an extended USG system, but we'll see..."
4416                 else
4417                         echo "Looks kind of like a USG system, but we'll see..."
4418                 fi
4419                 echo exit 0 >usg
4420         fi
4421 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4422         echo "Looks kind of like a BSD system, but we'll see..."
4423         d_bsd="$define"
4424         echo exit 0 >bsd
4425 else
4426         echo "Looks kind of like a Version 7 system, but we'll see..."
4427         echo exit 0 >v7
4428 fi
4429 case "$eunicefix" in
4430 *unixtovms*)
4431         $cat <<'EOI'
4432 There is, however, a strange, musty smell in the air that reminds me of
4433 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4434 EOI
4435         echo exit 0 >eunice
4436         d_eunice="$define"
4437 : it so happens the Eunice I know will not run shell scripts in Unix format
4438         ;;
4439 *)
4440         echo " "
4441         echo "Congratulations.  You aren't running Eunice."
4442         d_eunice="$undef"
4443         ;;
4444 esac
4445 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4446 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4447 : semicolon as a patch separator
4448 case "$p_" in
4449 :) ;;
4450 *)
4451         $cat <<'EOI'
4452 I have the feeling something is not exactly right, however...don't tell me...
4453 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4454 (Or you may be running DOS with DJGPP.)
4455 EOI
4456         echo exit 0 >os2
4457         ;;
4458 esac
4459 if test -f /xenix; then
4460         echo "Actually, this looks more like a XENIX system..."
4461         echo exit 0 >xenix
4462         d_xenix="$define"
4463 else
4464         echo " "
4465         echo "It's not Xenix..."
4466         d_xenix="$undef"
4467 fi
4468 chmod +x xenix
4469 $eunicefix xenix
4470 if test -f /venix; then
4471         echo "Actually, this looks more like a VENIX system..."
4472         echo exit 0 >venix
4473 else
4474         echo " "
4475         if ./xenix; then
4476                 : null
4477         else
4478                 echo "Nor is it Venix..."
4479         fi
4480 fi
4481 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4482 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4483 $rm -f foo
4484
4485 : Check if we are using GNU gcc and what its version is
4486 echo " "
4487 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4488 $cat >try.c <<EOM
4489 #include <stdio.h>
4490 int main() {
4491 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4492 #ifdef __VERSION__
4493         printf("%s\n", __VERSION__);
4494 #else
4495         printf("%s\n", "1");
4496 #endif
4497 #endif
4498         return(0);
4499 }
4500 EOM
4501 if $cc -o try $ccflags $ldflags try.c; then
4502         gccversion=`$run ./try`
4503         case "$gccversion" in
4504         '') echo "You are not using GNU cc." ;;
4505         *)  echo "You are using GNU cc $gccversion."
4506             ccname=gcc
4507             ;;
4508         esac
4509 else
4510         echo " "
4511         echo "*** WHOA THERE!!! ***" >&4
4512         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4513         case "$knowitall" in
4514         '')
4515         echo "    You'd better start hunting for one and let me know about it." >&4
4516                 exit 1
4517                 ;;
4518         esac
4519 fi
4520 $rm -f try try.*
4521 case "$gccversion" in
4522 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4523 esac
4524 case "$gccversion" in
4525 '') gccosandvers='' ;;
4526 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4527    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4528    gccshortvers=''
4529    case "$gccosandvers" in
4530    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4531    $osname$osvers) ;; # looking good
4532    $osname*) cat <<EOM >&4
4533
4534 *** WHOA THERE!!! ***
4535
4536     Your gcc has not been compiled for the exact release of
4537     your operating system ($gccosandvers versus $osname$osvers).
4538
4539     In general it is a good idea to keep gcc synchronized with
4540     the operating system because otherwise serious problems
4541     may ensue when trying to compile software, like Perl.
4542
4543     I'm trying to be optimistic here, though, and will continue.
4544     If later during the configuration and build icky compilation
4545     problems appear (headerfile conflicts being the most common
4546     manifestation), I suggest reinstalling the gcc to match
4547     your operating system release.
4548
4549 EOM
4550       ;;
4551    *) gccosandvers='' ;; # failed to parse, better be silent
4552    esac
4553    ;;
4554 esac
4555 case "$ccname" in
4556 '') ccname="$cc" ;;
4557 esac
4558
4559 # gcc 3.* complain about adding -Idirectories that they already know about,
4560 # so we will take those off from locincpth.
4561 case "$gccversion" in
4562 3*)
4563     echo "main(){}">try.c
4564     for incdir in $locincpth; do
4565        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4566              grep '^c[cp]p*[01]: warning: changing search order '`
4567        if test "X$warn" != X; then
4568            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4569        fi
4570     done
4571     $rm -f try try.*
4572 esac
4573
4574 : What should the include directory be ?
4575 echo " "
4576 $echo $n "Hmm...  $c"
4577 dflt='/usr/include'
4578 incpath=''
4579 mips_type=''
4580 if $test -f /bin/mips && /bin/mips; then
4581         echo "Looks like a MIPS system..."
4582         $cat >usr.c <<'EOCP'
4583 #ifdef SYSTYPE_BSD43
4584 /bsd43
4585 #endif
4586 EOCP
4587         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4588                 dflt='/bsd43/usr/include'
4589                 incpath='/bsd43'
4590                 mips_type='BSD 4.3'
4591         else
4592                 mips_type='System V'
4593         fi
4594         $rm -f usr.c usr.out
4595         echo "and you're compiling with the $mips_type compiler and libraries."
4596         xxx_prompt=y
4597         echo "exit 0" >mips
4598 else
4599         echo "Doesn't look like a MIPS system."
4600         xxx_prompt=n
4601         echo "exit 1" >mips
4602 fi
4603 chmod +x mips
4604 $eunicefix mips
4605 case "$usrinc" in
4606 '') ;;
4607 *) dflt="$usrinc";;
4608 esac
4609 case "$xxx_prompt" in
4610 y)      fn=d/
4611         echo " "
4612         rp='Where are the include files you want to use?'
4613         . ./getfile
4614         usrinc="$ans"
4615         ;;
4616 *)      usrinc="$dflt"
4617         ;;
4618 esac
4619
4620 : see how we invoke the C preprocessor
4621 echo " "
4622 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4623 cat <<'EOT' >testcpp.c
4624 #define ABC abc
4625 #define XYZ xyz
4626 ABC.XYZ
4627 EOT
4628 cd ..
4629 if test ! -f cppstdin; then
4630         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4631                 # AIX cc -E doesn't show the absolute headerfile
4632                 # locations but we'll cheat by using the -M flag.
4633                 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
4634         else
4635                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4636         fi
4637 else
4638         echo "Keeping your $hint cppstdin wrapper."
4639 fi
4640 chmod 755 cppstdin
4641 wrapper=`pwd`/cppstdin
4642 ok='false'
4643 cd UU
4644
4645 if $test "X$cppstdin" != "X" && \
4646         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4648 then
4649         echo "You used to use $cppstdin $cppminus so we'll use that again."
4650         case "$cpprun" in
4651         '') echo "But let's see if we can live without a wrapper..." ;;
4652         *)
4653                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4654                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4655                 then
4656                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4657                         ok='true'
4658                 else
4659                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4660                 fi
4661                 ;;
4662         esac
4663 else
4664         case "$cppstdin" in
4665         '') ;;
4666         *)
4667                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4668                 ;;
4669         esac
4670 fi
4671
4672 if $ok; then
4673         : nothing
4674 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4675         $cc -E <testcpp.c >testcpp.out 2>&1; \
4676         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4677         echo "Yup, it does."
4678         x_cpp="$cc -E"
4679         x_minus='';
4680 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4681         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4682         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4683         echo "Yup, it does."
4684         x_cpp="$cc -E"
4685         x_minus='-';
4686 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4687         $cc -P <testcpp.c >testcpp.out 2>&1; \
4688         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4689         echo "Yipee, that works!"
4690         x_cpp="$cc -P"
4691         x_minus='';
4692 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4693         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4694         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4695         echo "At long last!"
4696         x_cpp="$cc -P"
4697         x_minus='-';
4698 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4699         $cpp <testcpp.c >testcpp.out 2>&1; \
4700         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4701         echo "It works!"
4702         x_cpp="$cpp"
4703         x_minus='';
4704 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4705         $cpp - <testcpp.c >testcpp.out 2>&1; \
4706         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4707         echo "Hooray, it works!  I was beginning to wonder."
4708         x_cpp="$cpp"
4709         x_minus='-';
4710 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4711         $wrapper <testcpp.c >testcpp.out 2>&1; \
4712         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4713         x_cpp="$wrapper"
4714         x_minus=''
4715         echo "Eureka!"
4716 else
4717         dflt=''
4718         rp="No dice.  I can't find a C preprocessor.  Name one:"
4719         . ./myread
4720         x_cpp="$ans"
4721         x_minus=''
4722         $x_cpp <testcpp.c >testcpp.out 2>&1
4723         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4724                 echo "OK, that will do." >&4
4725         else
4726 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4727                 exit 1
4728         fi
4729 fi
4730
4731 case "$ok" in
4732 false)
4733         cppstdin="$x_cpp"
4734         cppminus="$x_minus"
4735         cpprun="$x_cpp"
4736         cpplast="$x_minus"
4737         set X $x_cpp
4738         shift
4739         case "$1" in
4740         "$cpp")
4741                 echo "Perhaps can we force $cc -E using a wrapper..."
4742                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4743                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4744                 then
4745                         echo "Yup, we can."
4746                         cppstdin="$wrapper"
4747                         cppminus='';
4748                 else
4749                         echo "Nope, we'll have to live without it..."
4750                 fi
4751                 ;;
4752         esac
4753         case "$cpprun" in
4754         "$wrapper")
4755                 cpprun=''
4756                 cpplast=''
4757                 ;;
4758         esac
4759         ;;
4760 esac
4761
4762 case "$cppstdin" in
4763 "$wrapper"|'cppstdin') ;;
4764 *) $rm -f $wrapper;;
4765 esac
4766 $rm -f testcpp.c testcpp.out
4767
4768 : Set private lib path
4769 case "$plibpth" in
4770 '') if ./mips; then
4771                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4772         fi;;
4773 esac
4774 case "$libpth" in
4775 ' ') dlist='';;
4776 '') dlist="$loclibpth $plibpth $glibpth";;
4777 *) dlist="$libpth";;
4778 esac
4779
4780 : Now check and see which directories actually exist, avoiding duplicates
4781 libpth=''
4782 for xxx in $dlist
4783 do
4784     if $test -d $xxx; then
4785                 case " $libpth " in
4786                 *" $xxx "*) ;;
4787                 *) libpth="$libpth $xxx";;
4788                 esac
4789     fi
4790 done
4791 $cat <<'EOM'
4792
4793 Some systems have incompatible or broken versions of libraries.  Among
4794 the directories listed in the question below, please remove any you
4795 know not to be holding relevant libraries, and add any that are needed.
4796 Say "none" for none.
4797
4798 EOM
4799 case "$libpth" in
4800 '') dflt='none';;
4801 *)
4802         set X $libpth
4803         shift
4804         dflt=${1+"$@"}
4805         ;;
4806 esac
4807 rp="Directories to use for library searches?"
4808 . ./myread
4809 case "$ans" in
4810 none) libpth=' ';;
4811 *) libpth="$ans";;
4812 esac
4813
4814 : compute shared library extension
4815 case "$so" in
4816 '')
4817         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4818                 dflt='sl'
4819         else
4820                 dflt='so'
4821         fi
4822         ;;
4823 *) dflt="$so";;
4824 esac
4825 $cat <<EOM
4826
4827 On some systems, shared libraries may be available.  Answer 'none' if
4828 you want to suppress searching of shared libraries for the remainder
4829 of this configuration.
4830
4831 EOM
4832 rp='What is the file extension used for shared libraries?'
4833 . ./myread
4834 so="$ans"
4835
4836 : Define several unixisms.
4837 : Hints files or command line option can be used to override them.
4838 : The convoluted testing is in case hints files set either the old
4839 : or the new name.
4840 case "$_exe" in
4841 '')     case "$exe_ext" in
4842         '')     ;;
4843         *)      _exe="$exe_ext" ;;
4844         esac
4845         ;;
4846 esac
4847 case "$_a" in
4848 '')     case "$lib_ext" in
4849     '') _a='.a';;
4850         *)      _a="$lib_ext" ;;
4851         esac
4852         ;;
4853 esac
4854 case "$_o" in
4855 '') case "$obj_ext" in
4856         '')     _o='.o';;
4857         *)      _o="$obj_ext";;
4858         esac
4859         ;;
4860 esac
4861 case "$p_" in
4862 '') case "$path_sep" in
4863         '')     p_=':';;
4864         *)      p_="$path_sep";;
4865         esac
4866         ;;
4867 esac
4868 exe_ext=$_exe
4869 lib_ext=$_a
4870 obj_ext=$_o
4871 path_sep=$p_
4872
4873 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4874
4875 : Which makefile gets called first.  This is used by make depend.
4876 case "$firstmakefile" in
4877 '') firstmakefile='makefile';;
4878 esac
4879
4880 : Check for uselongdouble support
4881 case "$ccflags" in
4882 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4883 esac
4884
4885 case "$uselongdouble" in
4886 $define|true|[yY]*)     dflt='y';;
4887 *) dflt='n';;
4888 esac
4889 cat <<EOM
4890
4891 Perl can be built to take advantage of long doubles which
4892 (if available) may give more accuracy and range for floating point numbers.
4893
4894 If this doesn't make any sense to you, just accept the default '$dflt'.
4895 EOM
4896 rp='Try to use long doubles if available?'
4897 . ./myread
4898 case "$ans" in
4899 y|Y)    val="$define"   ;;
4900 *)      val="$undef"    ;;
4901 esac
4902 set uselongdouble
4903 eval $setvar
4904
4905 case "$uselongdouble" in
4906 true|[yY]*) uselongdouble="$define" ;;
4907 esac
4908
4909 : Look for a hint-file generated 'call-back-unit'.  If the
4910 : user has specified that long doubles should be used,
4911 : we may need to set or change some other defaults.
4912 if $test -f uselongdouble.cbu; then
4913     echo "Your platform has some specific hints regarding long doubles, using them..."
4914     . ./uselongdouble.cbu
4915 else
4916     case "$uselongdouble" in
4917         $define)
4918                 $cat <<EOM
4919 (Your platform does not have any specific hints for long doubles.)
4920 EOM
4921         ;;
4922     esac
4923 fi
4924
4925 : Looking for optional libraries
4926 echo " "
4927 echo "Checking for optional libraries..." >&4
4928 case "$libs" in
4929 ' '|'') dflt='';;
4930 *) dflt="$libs";;
4931 esac
4932 case "$libswanted" in
4933 '') libswanted='c_s';;
4934 esac
4935 case "$usesocks" in
4936 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4937 esac
4938 libsfound=''
4939 libsfiles=''
4940 libsdirs=''
4941 libspath=''
4942 for thisdir in $libpth $xlibpth; do
4943   test -d $thisdir && libspath="$libspath $thisdir"
4944 done
4945 for thislib in $libswanted; do
4946         for thisdir in $libspath; do
4947             xxx=''
4948             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4949                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4950                 $test -f "$xxx" && eval $libscheck
4951                 $test -f "$xxx" && libstyle=shared
4952             fi
4953             if test ! -f "$xxx"; then
4954                 xxx=$thisdir/lib$thislib.$so
4955                 $test -f "$xxx" && eval $libscheck
4956                 $test -f "$xxx" && libstyle=shared
4957             fi
4958             if test ! -f "$xxx"; then
4959                 xxx=$thisdir/lib$thislib$_a
4960                 $test -f "$xxx" && eval $libscheck
4961                 $test -f "$xxx" && libstyle=static
4962             fi
4963             if test ! -f "$xxx"; then
4964                 xxx=$thisdir/$thislib$_a
4965                 $test -f "$xxx" && eval $libscheck
4966                 $test -f "$xxx" && libstyle=static
4967             fi
4968             if test ! -f "$xxx"; then
4969                 xxx=$thisdir/lib${thislib}_s$_a
4970                 $test -f "$xxx" && eval $libscheck
4971                 $test -f "$xxx" && libstyle=static
4972                 $test -f "$xxx" && thislib=${thislib}_s
4973             fi
4974             if test ! -f "$xxx"; then
4975                 xxx=$thisdir/Slib$thislib$_a
4976                 $test -f "$xxx" && eval $libscheck
4977                 $test -f "$xxx" && libstyle=static
4978             fi
4979             if $test -f "$xxx"; then
4980                 case "$libstyle" in
4981                 shared) echo "Found -l$thislib (shared)." ;;
4982                 static) echo "Found -l$thislib." ;;
4983                 *)      echo "Found -l$thislib ($libstyle)." ;;
4984                 esac
4985                 case " $dflt " in
4986                 *"-l$thislib "*);;
4987                 *) dflt="$dflt -l$thislib"
4988                    libsfound="$libsfound $xxx"
4989                    yyy=`basename $xxx`
4990                    libsfiles="$libsfiles $yyy"
4991                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4992                    case " $libsdirs " in
4993                    *" $yyy "*) ;;
4994                    *) libsdirs="$libsdirs $yyy" ;;
4995                    esac
4996                    ;;
4997                 esac
4998                 break
4999             fi
5000         done
5001         if $test ! -f "$xxx"; then
5002             echo "No -l$thislib."
5003         fi
5004 done
5005 set X $dflt
5006 shift
5007 dflt="$*"
5008 case "$libs" in
5009 '') dflt="$dflt";;
5010 *) dflt="$libs";;
5011 esac
5012 case "$dflt" in
5013 ' '|'') dflt='none';;
5014 esac
5015
5016 $cat <<EOM
5017
5018 In order to compile $package on your machine, a number of libraries
5019 are usually needed.  Include any other special libraries here as well.
5020 Say "none" for none.  The default list is almost always right.
5021 EOM
5022
5023 echo " "
5024 rp="What libraries to use?"
5025 . ./myread
5026 case "$ans" in
5027 none) libs=' ';;
5028 *) libs="$ans";;
5029 esac
5030
5031 : determine optimization, if desired, or use for debug flag also
5032 case "$optimize" in
5033 ' '|$undef) dflt='none';;
5034 '') dflt='-O';;
5035 *) dflt="$optimize";;
5036 esac
5037 $cat <<EOH
5038
5039 By default, $package compiles with the -O flag to use the optimizer.
5040 Alternately, you might want to use the symbolic debugger, which uses
5041 the -g flag (on traditional Unix systems).  Either flag can be
5042 specified here.  To use neither flag, specify the word "none".
5043
5044 EOH
5045 rp="What optimizer/debugger flag should be used?"
5046 . ./myread
5047 optimize="$ans"
5048 case "$optimize" in
5049 'none') optimize=" ";;
5050 esac
5051
5052 : Check what DEBUGGING is required from the command line
5053 : -DEBUGGING      or -DDEBUGGING or
5054 : -DEBUGGING=both                       = -g + -DDEBUGGING
5055 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5056 : -DEBUGGING=none or -UDEBUGGING        =
5057 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5058 case "$EBUGGING" in
5059 '')     ;;
5060 *)      DEBUGGING=$EBUGGING ;;
5061 esac
5062
5063 case "$DEBUGGING" in
5064 -g|both|$define)
5065     case "$optimize" in
5066         *-g*) ;;
5067         *)    optimize="$optimize -g" ;;
5068     esac ;;
5069 none|$undef)
5070     case "$optimize" in
5071         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5072                 shift
5073                 optimize="$*"
5074                 ;;
5075     esac ;;
5076 esac
5077
5078 dflt=''
5079 case "$DEBUGGING" in
5080 both|$define) dflt='-DDEBUGGING'
5081 esac
5082
5083 : argument order is deliberate, as the flag will start with - which set could
5084 : think is an option
5085 checkccflag='check=$1; flag=$2; callback=$3;
5086 echo " ";
5087 echo "Checking if your compiler accepts $flag" 2>&1;
5088 echo "int main(void) { return 0; }" > gcctest.c;
5089 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5090     echo "Yes, it does." 2>&1;
5091     if $test -s gcctest.out ; then
5092         echo "But your platform does not like it:";
5093         cat gcctest.out;
5094     else
5095         case "$ccflags" in
5096         *$check*)
5097             echo "Leaving current flags $ccflags alone." 2>&1
5098             ;;
5099         *) dflt="$dflt $flag";
5100             eval $callback
5101             ;;
5102         esac
5103     fi
5104 else
5105     echo "Nope, it does not, but that is ok." 2>&1;
5106 fi
5107 '
5108
5109 : We will not override a previous value, but we might want to
5110 : augment a hint file
5111 case "$hint" in
5112 default|recommended)
5113         case "$gccversion" in
5114         1*) dflt="$dflt -fpcc-struct-return" ;;
5115         esac
5116         case "$optimize:$DEBUGGING" in
5117         *-g*:old) dflt="$dflt -DDEBUGGING";;
5118         esac
5119         case "$gccversion" in
5120         2*) if $test -d /etc/conf/kconfig.d &&
5121                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5122                 then
5123                         # Interactive Systems (ISC) POSIX mode.
5124                         dflt="$dflt -posix"
5125                 fi
5126                 ;;
5127         esac
5128         case "$gccversion" in
5129         1*) ;;
5130         2.[0-8]*) ;;
5131         ?*)     set strict-aliasing -fno-strict-aliasing
5132                 eval $checkccflag
5133                 ;;
5134         esac
5135         # For gcc, adding -pipe speeds up compilations for some, but apparently
5136         # some assemblers can't read from stdin.  (It also slows down compilations
5137         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5138         case "$gccversion" in
5139         ?*)     set pipe -pipe
5140                 eval $checkccflag
5141                 ;;
5142         esac
5143
5144         # on x86_64 (at least) we require an extra library (libssp) in the
5145         # link command line. This library is not named, so I infer that it is
5146         # an implementation detail that may change. Hence the safest approach
5147         # is to add the flag to the flags passed to the compiler at link time,
5148         # as that way the compiler can do the right implementation dependant
5149         # thing. (NWC)
5150         case "$gccversion" in
5151         ?*)     set stack-protector -fstack-protector
5152                 eval $checkccflag
5153                 ;;
5154         esac
5155         ;;
5156 esac
5157
5158 case "$mips_type" in
5159 *BSD*|'') inclwanted="$locincpth $usrinc";;
5160 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5161 esac
5162 for thisincl in $inclwanted; do
5163         if $test -d $thisincl; then
5164                 if $test x$thisincl != x$usrinc; then
5165                         case "$dflt" in
5166                         *" -I$thisincl "*);;
5167                         *) dflt="$dflt -I$thisincl ";;
5168                         esac
5169                 fi
5170         fi
5171 done
5172
5173 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5174         xxx=true;
5175 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5176         xxx=true;
5177 else
5178         xxx=false;
5179 fi;
5180 if $xxx; then
5181         case "$dflt" in
5182         *$2*);;
5183         *) dflt="$dflt -D$2";;
5184         esac;
5185 fi'
5186
5187 set signal.h LANGUAGE_C; eval $inctest
5188
5189 case "$usesocks" in
5190 $define)
5191         ccflags="$ccflags -DSOCKS"
5192         ;;
5193 esac
5194
5195 case "$hint" in
5196 default|recommended) dflt="$ccflags $dflt" ;;
5197 *) dflt="$ccflags";;
5198 esac
5199
5200 case "$dflt" in
5201 ''|' ') dflt=none;;
5202 esac
5203
5204 $cat <<EOH
5205
5206 Your C compiler may want other flags.  For this question you should include
5207 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5208 but you should NOT include libraries or ld flags like -lwhatever.  If you
5209 want $package to honor its debug switch, you should include -DDEBUGGING here.
5210 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5211
5212 To use no flags, specify the word "none".
5213
5214 EOH
5215 set X $dflt
5216 shift
5217 dflt=${1+"$@"}
5218 rp="Any additional cc flags?"
5219 . ./myread
5220 case "$ans" in
5221 none) ccflags='';;
5222 *) ccflags="$ans";;
5223 esac
5224
5225 : the following weeds options from ccflags that are of no interest to cpp
5226 case "$cppflags" in
5227 '') cppflags="$ccflags" ;;
5228 *)  cppflags="$cppflags $ccflags" ;;
5229 esac
5230 case "$gccversion" in
5231 1*) cppflags="$cppflags -D__GNUC__"
5232 esac
5233 case "$mips_type" in
5234 '');;
5235 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5236 esac
5237 case "$cppflags" in
5238 '');;
5239 *)
5240         echo " "
5241         echo "Let me guess what the preprocessor flags are..." >&4
5242         set X $cppflags
5243         shift
5244         cppflags=''
5245         $cat >cpp.c <<'EOM'
5246 #define BLURFL foo
5247
5248 BLURFL xx LFRULB
5249 EOM
5250         previous=''
5251         for flag in $*
5252         do
5253                 case "$flag" in
5254                 -*) ftry="$flag";;
5255                 *) ftry="$previous $flag";;
5256                 esac
5257                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5258                         >cpp1.out 2>/dev/null && \
5259                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5260                         >cpp2.out 2>/dev/null && \
5261                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5262                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5263                 then
5264                         cppflags="$cppflags $ftry"
5265                         previous=''
5266                 else
5267                         previous="$flag"
5268                 fi
5269         done
5270         set X $cppflags
5271         shift
5272         cppflags=${1+"$@"}
5273         case "$cppflags" in
5274         *-*)  echo "They appear to be: $cppflags";;
5275         esac
5276         $rm -f cpp.c cpp?.out
5277         ;;
5278 esac
5279
5280 : flags used in final linking phase
5281 case "$ldflags" in
5282 '') if ./venix; then
5283                 dflt='-i -z'
5284         else
5285                 dflt=''
5286         fi
5287         case "$ccflags" in
5288         *-posix*) dflt="$dflt -posix" ;;
5289         esac
5290         ;;
5291 *) dflt="$ldflags";;
5292 esac
5293 # See note above about -fstack-protector
5294 case "$ccflags" in
5295 *-fstack-protector*) 
5296         case "$dflt" in
5297         *-fstack-protector*) ;; # Don't add it again
5298         *) dflt="$dflt -fstack-protector" ;; 
5299         esac
5300         ;;
5301 esac
5302
5303 : Try to guess additional flags to pick up local libraries.
5304 for thislibdir in $libpth; do
5305         case " $loclibpth " in
5306         *" $thislibdir "*)
5307                 case "$dflt " in
5308                 *"-L$thislibdir "*) ;;
5309                 *)  dflt="$dflt -L$thislibdir" ;;
5310                 esac
5311                 ;;
5312         esac
5313 done
5314
5315 case "$dflt" in
5316 '') dflt='none' ;;
5317 esac
5318
5319 $cat <<EOH
5320
5321 Your C linker may need flags.  For this question you should
5322 include -L/whatever and any other flags used by the C linker, but you
5323 should NOT include libraries like -lwhatever.
5324
5325 Make sure you include the appropriate -L/path flags if your C linker
5326 does not normally search all of the directories you specified above,
5327 namely
5328         $libpth
5329 To use no flags, specify the word "none".
5330
5331 EOH
5332
5333 rp="Any additional ld flags (NOT including libraries)?"
5334 . ./myread
5335 case "$ans" in
5336 none) ldflags='';;
5337 *) ldflags="$ans";;
5338 esac
5339 rmlist="$rmlist pdp11"
5340
5341 : coherency check
5342 echo " "
5343 echo "Checking your choice of C compiler and flags for coherency..." >&4
5344 $cat > try.c <<'EOF'
5345 #include <stdio.h>
5346 int main() { printf("Ok\n"); return(0); }
5347 EOF
5348 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5349 shift
5350 $cat >try.msg <<'EOM'
5351 I've tried to compile and run the following simple program:
5352
5353 EOM
5354 $cat try.c >> try.msg
5355
5356 $cat >> try.msg <<EOM
5357
5358 I used the command:
5359
5360         $*
5361         $run ./try
5362
5363 and I got the following output:
5364
5365 EOM
5366 dflt=y
5367 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5368         if $sh -c "$run ./try " >>try.msg 2>&1; then
5369                 xxx=`$run ./try`
5370                 case "$xxx" in
5371                 "Ok") dflt=n ;;
5372                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5373                         case " $libs " in
5374                         *" -lsfio "*)
5375                                 cat >> try.msg <<'EOQS'
5376 If $libs contains -lsfio, and sfio is mis-configured, then it
5377 sometimes (apparently) runs and exits with a 0 status, but with no
5378 output!  It may have to do with sfio's use of _exit vs. exit.
5379
5380 EOQS
5381                                 rp="You have a big problem.  Shall I abort Configure"
5382                                 dflt=y
5383                                 ;;
5384                         esac
5385                         ;;
5386                 esac
5387         else
5388                 echo "The program compiled OK, but exited with status $?." >>try.msg
5389                 rp="You have a problem.  Shall I abort Configure"
5390                 dflt=y
5391         fi
5392 else
5393         echo "I can't compile the test program." >>try.msg
5394         rp="You have a BIG problem.  Shall I abort Configure"
5395         dflt=y
5396 fi
5397 case "$dflt" in
5398 y)
5399         $cat try.msg >&4
5400         case "$knowitall" in
5401         '')
5402                 echo "(The supplied flags or libraries might be incorrect.)"
5403                 ;;
5404         *) dflt=n;;
5405         esac
5406         echo " "
5407         . ./myread
5408         case "$ans" in
5409         n*|N*) ;;
5410         *)      echo "Ok.  Stopping Configure." >&4
5411                 exit 1
5412                 ;;
5413         esac
5414         ;;
5415 n) echo "OK, that should do.";;
5416 esac
5417 $rm_try gcctest gcctest.out
5418
5419 : define a shorthand compile call
5420 compile='
5421 mc_file=$1;
5422 shift;
5423 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5424 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5425 exit 1;
5426 fi;
5427 esac;
5428 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5429 : define a shorthand compile call for compilations that should be ok.
5430 compile_ok='
5431 mc_file=$1;
5432 shift;
5433 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5434
5435 : determine filename position in cpp output
5436 echo " "
5437 echo "Computing filename position in cpp output for #include directives..." >&4
5438 case "$osname" in
5439 vos) testaccess=-e ;;
5440 *)   testaccess=-r ;;
5441 esac
5442 echo '#include <stdio.h>' > foo.c
5443 $cat >fieldn <<EOF
5444 $startsh
5445 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5446 $grep '^[       ]*#.*stdio\.h' | \
5447 while read cline; do
5448         pos=1
5449         set \$cline
5450         while $test \$# -gt 0; do
5451                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5452                         echo "\$pos"
5453                         exit 0
5454                 fi
5455                 shift
5456                 pos=\`expr \$pos + 1\`
5457         done
5458 done
5459 EOF
5460 chmod +x fieldn
5461 fieldn=`./fieldn`
5462 $rm -f foo.c fieldn
5463 case $fieldn in
5464 '') pos='???';;
5465 1) pos=first;;
5466 2) pos=second;;
5467 3) pos=third;;
5468 *) pos="${fieldn}th";;
5469 esac
5470 echo "Your cpp writes the filename in the $pos field of the line."
5471
5472 case "$osname" in
5473 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5474 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5475 *)   cppfilter='' ;;
5476 esac
5477 : locate header file
5478 $cat >findhdr <<EOF
5479 $startsh
5480 wanted=\$1
5481 name=''
5482 for usrincdir in $usrinc
5483 do
5484         if test -f \$usrincdir/\$wanted; then
5485                 echo "\$usrincdir/\$wanted"
5486                 exit 0
5487         fi
5488 done
5489 awkprg='{ print \$$fieldn }'
5490 echo "#include <\$wanted>" > foo\$\$.c
5491 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5492 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5493 while read cline; do
5494         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5495         case "\$name" in
5496         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5497         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5498         *) exit 2;;
5499         esac;
5500 done;
5501 #
5502 # status = 0: grep returned 0 lines, case statement not executed
5503 # status = 1: headerfile found
5504 # status = 2: while loop executed, no headerfile found
5505 #
5506 status=\$?
5507 $rm -f foo\$\$.c;
5508 if test \$status -eq 1; then
5509         exit 0;
5510 fi
5511 exit 1
5512 EOF
5513 chmod +x findhdr
5514
5515 : define an alternate in-header-list? function
5516 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5517 cont=true; xxf="echo \"<\$1> found.\" >&4";
5518 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5519 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5520 esac;
5521 case $# in 4) instead=instead;; *) instead="at last";; esac;
5522 while $test "$cont"; do
5523         xxx=`./findhdr $1`
5524         var=$2; eval "was=\$$2";
5525         if $test "$xxx" && $test -r "$xxx";
5526         then eval $xxf;
5527         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5528                 cont="";
5529         else eval $xxnf;
5530         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5531         set $yyy; shift; shift; yyy=$@;
5532         case $# in 0) cont="";;
5533         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5534                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5535         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5536                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5537         esac;
5538 done;
5539 while $test "$yyy";
5540 do set $yyy; var=$2; eval "was=\$$2";
5541         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5542         set $yyy; shift; shift; yyy=$@;
5543 done'
5544
5545 : see if stdlib is available
5546 set stdlib.h i_stdlib
5547 eval $inhdr
5548
5549 : check for lengths of integral types
5550 echo " "
5551 case "$intsize" in
5552 '')
5553         echo "Checking to see how big your integers are..." >&4
5554         $cat >try.c <<EOCP
5555 #include <stdio.h>
5556 #$i_stdlib I_STDLIB
5557 #ifdef I_STDLIB
5558 #include <stdlib.h>
5559 #endif
5560 int main()
5561 {
5562         printf("intsize=%d;\n", (int)sizeof(int));
5563         printf("longsize=%d;\n", (int)sizeof(long));
5564         printf("shortsize=%d;\n", (int)sizeof(short));
5565         exit(0);
5566 }
5567 EOCP
5568         set try
5569         if eval $compile_ok && $run ./try > /dev/null; then
5570                 eval `$run ./try`
5571                 echo "Your integers are $intsize bytes long."
5572                 echo "Your long integers are $longsize bytes long."
5573                 echo "Your short integers are $shortsize bytes long."
5574         else
5575                 $cat >&4 <<EOM
5576 !
5577 Help! I can't compile and run the intsize test program: please enlighten me!
5578 (This is probably a misconfiguration in your system or libraries, and
5579 you really ought to fix it.  Still, I'll try anyway.)
5580 !
5581 EOM
5582                 dflt=4
5583                 rp="What is the size of an integer (in bytes)?"
5584                 . ./myread
5585                 intsize="$ans"
5586                 dflt=$intsize
5587                 rp="What is the size of a long integer (in bytes)?"
5588                 . ./myread
5589                 longsize="$ans"
5590                 dflt=2
5591                 rp="What is the size of a short integer (in bytes)?"
5592                 . ./myread
5593                 shortsize="$ans"
5594         fi
5595         ;;
5596 esac
5597 $rm_try
5598
5599 : check for long long
5600 echo " "
5601 echo "Checking to see if you have long long..." >&4
5602 echo 'int main() { long long x = 7; return 0; }' > try.c
5603 set try
5604 if eval $compile; then
5605         val="$define"
5606         echo "You have long long."
5607 else
5608         val="$undef"
5609         echo "You do not have long long."
5610 fi
5611 $rm_try
5612 set d_longlong
5613 eval $setvar
5614
5615 : check for length of long long
5616 case "${d_longlong}${longlongsize}" in
5617 $define)
5618         echo " "
5619         echo "Checking to see how big your long longs are..." >&4
5620         $cat >try.c <<'EOCP'
5621 #include <stdio.h>
5622 int main()
5623 {
5624     printf("%d\n", (int)sizeof(long long));
5625     return(0);
5626 }
5627 EOCP
5628         set try
5629         if eval $compile_ok; then
5630                 longlongsize=`$run ./try`
5631                 echo "Your long longs are $longlongsize bytes long."
5632         else
5633                 dflt='8'
5634                 echo " "
5635                 echo "(I can't seem to compile the test program.  Guessing...)"
5636                 rp="What is the size of a long long (in bytes)?"
5637                 . ./myread
5638                 longlongsize="$ans"
5639         fi
5640         if $test "X$longsize" = "X$longlongsize"; then
5641                 echo "(That isn't any different from an ordinary long.)"
5642         fi
5643         ;;
5644 esac
5645 $rm_try
5646
5647 : see if inttypes.h is available
5648 : we want a real compile instead of Inhdr because some systems
5649 : have an inttypes.h which includes non-existent headers
5650 echo " "
5651 $cat >try.c <<EOCP
5652 #include <inttypes.h>
5653 int main() {
5654         static int32_t foo32 = 0x12345678;
5655 }
5656 EOCP
5657 set try
5658 if eval $compile; then
5659         echo "<inttypes.h> found." >&4
5660         val="$define"
5661 else
5662         echo "<inttypes.h> NOT found." >&4
5663         val="$undef"
5664 fi
5665 $rm_try
5666 set i_inttypes
5667 eval $setvar
5668
5669 : check for int64_t
5670 echo " "
5671 echo "Checking to see if you have int64_t..." >&4
5672 $cat >try.c <<EOCP
5673 #include <sys/types.h>
5674 #$i_inttypes I_INTTYPES
5675 #ifdef I_INTTYPES
5676 #include <inttypes.h>
5677 #endif
5678 int main() { int64_t x = 7; }
5679 EOCP
5680 set try
5681 if eval $compile; then
5682         val="$define"
5683         echo "You have int64_t."
5684 else
5685         val="$undef"
5686         echo "You do not have int64_t."
5687 fi
5688 $rm_try
5689 set d_int64_t
5690 eval $setvar
5691
5692 : Check if 64bit ints have a quad type
5693 echo " "
5694 echo "Checking which 64-bit integer type we could use..." >&4
5695
5696 case "$intsize" in
5697 8) val=int
5698    set quadtype
5699    eval $setvar
5700    val='"unsigned int"'
5701    set uquadtype
5702    eval $setvar
5703    quadkind=1
5704    ;;
5705 *) case "$longsize" in
5706    8) val=long
5707       set quadtype
5708       eval $setvar
5709       val='"unsigned long"'
5710       set uquadtype
5711       eval $setvar
5712       quadkind=2
5713       ;;
5714    *) case "$d_longlong:$longlongsize" in
5715       define:8)
5716         val='"long long"'
5717         set quadtype
5718         eval $setvar
5719         val='"unsigned long long"'
5720         set uquadtype
5721         eval $setvar
5722         quadkind=3
5723         ;;
5724       *) case "$d_int64_t" in
5725          define)
5726            val=int64_t
5727            set quadtype
5728            eval $setvar
5729            val=uint64_t
5730            set uquadtype
5731            eval $setvar
5732            quadkind=4
5733            ;;
5734          esac
5735          ;;
5736       esac
5737       ;;
5738    esac
5739    ;;
5740 esac
5741
5742 case "$quadtype" in
5743 '')     echo "Alas, no 64-bit integer types in sight." >&4
5744         d_quad="$undef"
5745         ;;
5746 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5747         d_quad="$define"
5748         ;;
5749 esac
5750
5751 : Do we want 64bit support
5752 case "$uselonglong" in
5753 "$define"|true|[yY]*)
5754         cat <<EOM >&4
5755
5756 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5757 EOM
5758         use64bitint="$define"
5759         ;;
5760 esac
5761 case "$use64bits" in
5762 "$define"|true|[yY]*)
5763         cat <<EOM >&4
5764
5765 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5766 EOM
5767         use64bitint="$define"
5768         ;;
5769 esac
5770 case "$use64bitints" in
5771 "$define"|true|[yY]*)
5772         cat <<EOM >&4
5773
5774 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5775 EOM
5776         use64bitint="$define"
5777         ;;
5778 esac
5779 case "$use64bitsint" in
5780 "$define"|true|[yY]*)
5781         cat <<EOM >&4
5782
5783 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5784 EOM
5785         use64bitint="$define"
5786         ;;
5787 esac
5788 case "$uselonglongs" in
5789 "$define"|true|[yY]*)
5790         cat <<EOM >&4
5791
5792 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5793 EOM
5794         use64bitint="$define"
5795         ;;
5796 esac
5797 case "$use64bitsall" in
5798 "$define"|true|[yY]*)
5799         cat <<EOM >&4
5800
5801 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5802 EOM
5803         use64bitall="$define"
5804         ;;
5805 esac
5806
5807 case "$ccflags" in
5808 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5809 esac
5810 case "$use64bitall" in
5811 "$define"|true|[yY]*) use64bitint="$define" ;;
5812 esac
5813
5814 case "$longsize" in
5815 8) cat <<EOM
5816
5817 You have natively 64-bit long integers.
5818 EOM
5819    val="$define"
5820    ;;
5821 *) case "$use64bitint" in
5822    "$define"|true|[yY]*) dflt='y';;
5823    *) dflt='n';;
5824    esac
5825    case "$d_quad" in
5826    "$define") ;;
5827    *) dflt='n' ;;
5828    esac
5829    cat <<EOM
5830
5831 Perl can be built to take advantage of 64-bit integer types
5832 on some systems.  To do so, Configure can be run with -Duse64bitint.
5833 Choosing this option will most probably introduce binary incompatibilities.
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 64-bit integers, if available?'
5839    . ./myread
5840    case "$ans" in
5841    [yY]*) val="$define" ;;
5842    *)     val="$undef"  ;;
5843    esac
5844    ;;
5845 esac
5846 set use64bitint
5847 eval $setvar
5848
5849 case "$use64bitall" in
5850 "$define"|true|[yY]*) dflt='y' ;;
5851 *) case "$longsize" in
5852    8) dflt='y' ;;
5853    *) dflt='n' ;;
5854    esac
5855    ;;
5856 esac
5857 cat <<EOM
5858
5859 You may also choose to try maximal 64-bitness.  It means using as much
5860 64-bitness as possible on the platform.  This in turn means even more
5861 binary incompatibilities.  On the other hand, your platform may not
5862 have any more 64-bitness available than what you already have chosen.
5863
5864 If this doesn't make any sense to you, just accept the default '$dflt'.
5865 (The default has been chosen based on your configuration.)
5866 EOM
5867 rp='Try to use maximal 64-bit support, if available?'
5868 . ./myread
5869 case "$ans" in
5870 [yY]*) val="$define" ;;
5871 *)     val="$undef"  ;;
5872 esac
5873 set use64bitall
5874 eval $setvar
5875 case "$use64bitall" in
5876 "$define")
5877         case "$use64bitint" in
5878         "$undef")
5879                 cat <<EOM
5880
5881 Since you have chosen a maximally 64-bit build, I'm also turning on
5882 the use of 64-bit integers.
5883 EOM
5884                 use64bitint="$define" ;;
5885         esac
5886         ;;
5887 esac
5888
5889 : Look for a hint-file generated 'call-back-unit'.  If the
5890 : user has specified that a 64-bit perl is to be built,
5891 : we may need to set or change some other defaults.
5892 if $test -f use64bitint.cbu; then
5893         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5894         . ./use64bitint.cbu
5895 fi
5896 case "$use64bitint" in
5897 "$define"|true|[yY]*)
5898         case "$longsize" in
5899         4) case "$archname64" in
5900            '') archname64=64int ;;
5901            esac
5902            ;;
5903         esac
5904         ;;
5905 esac
5906
5907 : Look for a hint-file generated 'call-back-unit'.  If the
5908 : user has specified that a maximally 64-bit perl is to be built,
5909 : we may need to set or change some other defaults.
5910 if $test -f use64bitall.cbu; then
5911         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5912         . ./use64bitall.cbu
5913 fi
5914 case "$use64bitall" in
5915 "$define"|true|[yY]*)
5916         case "$longsize" in
5917         4) case "$archname64" in
5918            ''|64int) archname64=64all ;;
5919            esac
5920            ;;
5921         esac
5922         ;;
5923 esac
5924
5925 case "$d_quad:$use64bitint" in
5926 $undef:$define)
5927         cat >&4 <<EOF
5928
5929 *** You have chosen to use 64-bit integers,
5930 *** but none can be found.
5931 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5932 *** Cannot continue, aborting.
5933
5934 EOF
5935         exit 1
5936         ;;
5937 esac
5938
5939 : check for length of double
5940 echo " "
5941 case "$doublesize" in
5942 '')
5943         echo "Checking to see how big your double precision numbers are..." >&4
5944         $cat >try.c <<EOCP
5945 #include <stdio.h>
5946 #$i_stdlib I_STDLIB
5947 #ifdef I_STDLIB
5948 #include <stdlib.h>
5949 #endif
5950 int main()
5951 {
5952     printf("%d\n", (int)sizeof(double));
5953     exit(0);
5954 }
5955 EOCP
5956         set try
5957         if eval $compile_ok; then
5958                 doublesize=`$run ./try`
5959                 echo "Your double is $doublesize bytes long."
5960         else
5961                 dflt='8'
5962                 echo "(I can't seem to compile the test program.  Guessing...)"
5963                 rp="What is the size of a double precision number (in bytes)?"
5964                 . ./myread
5965                 doublesize="$ans"
5966         fi
5967         ;;
5968 esac
5969 $rm_try
5970
5971 : check for long doubles
5972 echo " "
5973 echo "Checking to see if you have long double..." >&4
5974 echo 'int main() { long double x = 7.0; }' > try.c
5975 set try
5976 if eval $compile; then
5977         val="$define"
5978         echo "You have long double."
5979 else
5980         val="$undef"
5981         echo "You do not have long double."
5982 fi
5983 $rm_try
5984 set d_longdbl
5985 eval $setvar
5986
5987 : check for length of long double
5988 case "${d_longdbl}${longdblsize}" in
5989 $define)
5990         echo " "
5991         echo "Checking to see how big your long doubles are..." >&4
5992         $cat >try.c <<'EOCP'
5993 #include <stdio.h>
5994 int main()
5995 {
5996         printf("%d\n", sizeof(long double));
5997 }
5998 EOCP
5999         set try
6000         set try
6001         if eval $compile; then
6002                 longdblsize=`$run ./try`
6003                 echo "Your long doubles are $longdblsize bytes long."
6004         else
6005                 dflt='8'
6006                 echo " "
6007                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6008                 rp="What is the size of a long double (in bytes)?"
6009                 . ./myread
6010                 longdblsize="$ans"
6011         fi
6012         if $test "X$doublesize" = "X$longdblsize"; then
6013                 echo "That isn't any different from an ordinary double."
6014                 echo "I'll keep your setting anyway, but you may see some"
6015                 echo "harmless compilation warnings."
6016         fi
6017         ;;
6018 esac
6019 $rm_try
6020
6021 : determine the architecture name
6022 echo " "
6023 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6024         tarch=`arch`"-$osname"
6025 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6026         if uname -m > tmparch 2>&1 ; then
6027                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6028                         -e 's/$/'"-$osname/" tmparch`
6029         else
6030                 tarch="$osname"
6031         fi
6032         $rm -f tmparch
6033 else
6034         tarch="$osname"
6035 fi
6036 case "$myarchname" in
6037 ''|"$tarch") ;;
6038 *)
6039         echo "(Your architecture name used to be $myarchname.)"
6040         archname=''
6041         ;;
6042 esac
6043 case "$targetarch" in
6044 '') ;;
6045 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6046 esac
6047 myarchname="$tarch"
6048 case "$archname" in
6049 '') dflt="$tarch";;
6050 *) dflt="$archname";;
6051 esac
6052 rp='What is your architecture name'
6053 . ./myread
6054 archname="$ans"
6055 case "$usethreads" in
6056 $define)
6057         echo "Threads selected." >&4
6058         case "$archname" in
6059         *-thread*) echo "...and architecture name already has -thread." >&4
6060                 ;;
6061         *)      archname="$archname-thread"
6062                 echo "...setting architecture name to $archname." >&4
6063                 ;;
6064         esac
6065         ;;
6066 esac
6067 case "$usemultiplicity" in
6068 $define)
6069         echo "Multiplicity selected." >&4
6070         case "$archname" in
6071         *-multi*) echo "...and architecture name already has -multi." >&4
6072                 ;;
6073         *)      archname="$archname-multi"
6074                 echo "...setting architecture name to $archname." >&4
6075                 ;;
6076         esac
6077         ;;
6078 esac
6079 case "$use64bitint$use64bitall" in
6080 *"$define"*)
6081         case "$archname64" in
6082         '')
6083                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6084                 ;;
6085         *)
6086                 case "$use64bitint" in
6087                 "$define") echo "64 bit integers selected." >&4 ;;
6088                 esac
6089                 case "$use64bitall" in
6090                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6091                 esac
6092                 case "$archname" in
6093                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6094                         ;;
6095                 *)      archname="$archname-$archname64"
6096                         echo "...setting architecture name to $archname." >&4
6097                         ;;
6098                 esac
6099                 ;;
6100         esac
6101 esac
6102 case "$uselongdouble" in
6103 $define)
6104         echo "Long doubles selected." >&4
6105         case "$longdblsize" in
6106         $doublesize)
6107                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6108                 ;;
6109         *)
6110                 case "$archname" in
6111                 *-ld*) echo "...and architecture name already has -ld." >&4
6112                         ;;
6113                 *)      archname="$archname-ld"
6114                         echo "...setting architecture name to $archname." >&4
6115                         ;;
6116                 esac
6117                 ;;
6118         esac
6119         ;;
6120 esac
6121 case "$useperlio" in
6122 $define)
6123         echo "Perlio selected." >&4
6124         ;;
6125 *)
6126         echo "Perlio not selected, using stdio." >&4
6127         case "$archname" in
6128         *-stdio*) echo "...and architecture name already has -stdio." >&4
6129                 ;;
6130         *)      archname="$archname-stdio"
6131                 echo "...setting architecture name to $archname." >&4
6132                 ;;
6133         esac
6134         ;;
6135 esac
6136 if $test -f archname.cbu; then
6137         echo "Your platform has some specific hints for architecture name, using them..."
6138         . ./archname.cbu
6139 fi
6140
6141 : set the prefixit variable, to compute a suitable default value
6142 prefixit='case "$3" in
6143 ""|none)
6144         case "$oldprefix" in
6145         "") eval "$1=\"\$$2\"";;
6146         *)
6147                 case "$3" in
6148                 "") eval "$1=";;
6149                 none)
6150                         eval "tp=\"\$$2\"";
6151                         case "$tp" in
6152                         ""|" ") eval "$1=\"\$$2\"";;
6153                         *) eval "$1=";;
6154                         esac;;
6155                 esac;;
6156         esac;;
6157 *)
6158         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6159         case "$tp" in
6160         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6161         /*-$oldprefix/*|\~*-$oldprefix/*)
6162                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6163         *) eval "$1=\"\$$2\"";;
6164         esac;;
6165 esac'
6166
6167 : determine installation style
6168 : For now, try to deduce it from prefix unless it is already set.
6169 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6170 case "$installstyle" in
6171 '')     case "$prefix" in
6172                 *perl*) dflt='lib';;
6173                 *) dflt='lib/perl5' ;;
6174         esac
6175         ;;
6176 *)      dflt="$installstyle" ;;
6177 esac
6178 : Probably not worth prompting for this since we prompt for all
6179 : the directories individually, and the prompt would be too long and
6180 : confusing anyway.
6181 installstyle=$dflt
6182
6183 : determine where public executables go
6184 echo " "
6185 set dflt bin bin
6186 eval $prefixit
6187 fn=d~
6188 rp='Pathname where the public executables will reside?'
6189 . ./getfile
6190 if $test "X$ansexp" != "X$binexp"; then
6191         installbin=''
6192 fi
6193 prefixvar=bin
6194 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6195 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6196 :     this via initialinstalllocation
6197 . ./setprefixvar
6198
6199 case "$userelocatableinc" in
6200 $define|true|[yY]*)     dflt='y' ;;
6201 *)                      dflt='n' ;;
6202 esac
6203 cat <<EOM
6204
6205 Would you like to build Perl so that the installation is relocatable, so that
6206 library paths in @INC are determined relative to the path of the perl binary?
6207 This is not advised for system Perl installs, or if you need to run setid
6208 scripts or scripts under taint mode.
6209
6210 If this doesn't make any sense to you, just accept the default '$dflt'.
6211 EOM
6212 rp='Use relocatable @INC?'
6213 . ./myread
6214 case "$ans" in
6215 y|Y)    val="$define" ;;
6216 *)      val="$undef"  ;;
6217 esac
6218 set userelocatableinc
6219 eval $setvar
6220
6221 initialinstalllocation="$binexp"
6222 : Default prefix is now "up one level from where the binaries are"
6223 case "$userelocatableinc" in
6224 $define|true|[yY]*)
6225     bin=".../"
6226     binexp=".../"
6227     prefix=".../.."
6228     prefixexp=".../.."
6229     installprefixexp=".../.."
6230     ;;
6231 esac
6232
6233 : determine where private library files go
6234 : Usual default is /usr/local/lib/perl5/$version.
6235 : Also allow things like /opt/perl/lib/$version, since
6236 : /opt/perl/lib/perl5... would be redundant.
6237 : The default "style" setting is made in installstyle.U
6238 case "$installstyle" in
6239 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6240 *)       set dflt privlib lib/$version ;;
6241 esac
6242 eval $prefixit
6243 $cat <<EOM
6244
6245 There are some auxiliary files for $package that need to be put into a
6246 private library directory that is accessible by everyone.
6247
6248 EOM
6249 fn=$binexp
6250 fn=d~+
6251 rp='Pathname where the private library files will reside?'
6252 . ./getfile
6253 prefixvar=privlib
6254 . ./setprefixvar
6255
6256 : set the prefixup variable, to restore leading tilda escape
6257 prefixup='case "$prefixexp" in
6258 "$prefix") ;;
6259 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6260 esac'
6261
6262 : determine where public architecture dependent libraries go
6263 set archlib archlib
6264 eval $prefixit
6265 : privlib default is /usr/local/lib/$package/$version
6266 : archlib default is /usr/local/lib/$package/$version/$archname
6267 : privlib may have an optional trailing /share.
6268 tdflt=`echo $privlib | $sed 's,/share$,,'`
6269 tdflt=$tdflt/$archname
6270 case "$archlib" in
6271 '')     dflt=$tdflt
6272         ;;
6273 *)      dflt="$archlib"
6274     ;;
6275 esac
6276 $cat <<EOM
6277
6278 $spackage contains architecture-dependent library files.  If you are
6279 sharing libraries in a heterogeneous environment, you might store
6280 these files in a separate location.  Otherwise, you can just include
6281 them with the rest of the public library files.
6282
6283 EOM
6284 fn=$binexp
6285 fn=d+~
6286 rp='Where do you want to put the public architecture-dependent libraries?'
6287 . ./getfile
6288 prefixvar=archlib
6289 . ./setprefixvar
6290 if $test X"$archlib" = X"$privlib"; then
6291         d_archlib="$undef"
6292 else
6293         d_archlib="$define"
6294 fi
6295
6296 : see if setuid scripts can be secure
6297 $cat <<EOM
6298
6299 Some kernels have a bug that prevents setuid #! scripts from being
6300 secure.  Some sites have disabled setuid #! scripts because of this.
6301
6302 First let's decide if your kernel supports secure setuid #! scripts.
6303 (If setuid #! scripts would be secure but have been disabled anyway,
6304 don't say that they are secure if asked.)
6305
6306 EOM
6307
6308 val="$undef"
6309 if $test -d /dev/fd; then
6310         echo "#!$ls" >reflect
6311         chmod +x,u+s reflect
6312         ./reflect >flect 2>&1
6313         if $contains "/dev/fd" flect >/dev/null; then
6314                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6315                 val="$define"
6316         else
6317                 $cat <<EOM
6318 If you are not sure if they are secure, I can check but I'll need a
6319 username and password different from the one you are using right now.
6320 If you don't have such a username or don't want me to test, simply
6321 enter 'none'.
6322
6323 EOM
6324                 rp='Other username to test security of setuid scripts with?'
6325                 dflt='none'
6326                 . ./myread
6327                 case "$ans" in
6328                 n|none)
6329                         case "$d_suidsafe" in
6330                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6331                                 dflt=n;;
6332                         "$undef")
6333                                 echo "Well, the $hint value is *not* secure." >&4
6334                                 dflt=n;;
6335                         *)      echo "Well, the $hint value *is* secure." >&4
6336                                 dflt=y;;
6337                         esac
6338                         ;;
6339                 *)
6340                         $rm -f reflect flect
6341                         echo "#!$ls" >reflect
6342                         chmod +x,u+s reflect
6343                         echo >flect
6344                         chmod a+w flect
6345                         echo '"su" will (probably) prompt you for '"$ans's password."
6346                         su $ans -c './reflect >flect'
6347                         if $contains "/dev/fd" flect >/dev/null; then
6348                                 echo "Okay, it looks like setuid scripts are secure." >&4
6349                                 dflt=y
6350                         else
6351                                 echo "I don't think setuid scripts are secure." >&4
6352                                 dflt=n
6353                         fi
6354                         ;;
6355                 esac
6356                 rp='Does your kernel have *secure* setuid scripts?'
6357                 . ./myread
6358                 case "$ans" in
6359                 [yY]*)  val="$define";;
6360                 *)      val="$undef";;
6361                 esac
6362         fi
6363 else
6364         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6365         echo "(That's for file descriptors, not floppy disks.)"
6366         val="$undef"
6367 fi
6368 set d_suidsafe
6369 eval $setvar
6370
6371 $rm -f reflect flect
6372
6373 : now see if they want to do setuid emulation
6374 if $test $patchlevel -lt 11; then
6375 echo " "
6376 val="$undef"
6377 case "$d_suidsafe" in
6378 "$define")
6379         val="$undef"
6380         echo "No need to emulate SUID scripts since they are secure here." >&4
6381         ;;
6382 *)
6383         $cat <<EOM
6384 Some systems have disabled setuid scripts, especially systems where
6385 setuid scripts cannot be secure.  On systems where setuid scripts have
6386 been disabled, the setuid/setgid bits on scripts are currently
6387 useless.  It is possible for $package to detect those bits and emulate
6388 setuid/setgid in a secure fashion.  This emulation will only work if
6389 setuid scripts have been disabled in your kernel.
6390
6391 EOM
6392         case "$d_dosuid" in
6393         "$define") dflt=y ;;
6394         *) dflt=n ;;
6395         esac
6396         rp="Do you want to do setuid/setgid emulation?"
6397         . ./myread
6398         case "$ans" in
6399         [yY]*)  val="$define";;
6400         *)      val="$undef";;
6401         esac
6402         ;;
6403 esac
6404 set d_dosuid
6405 eval $setvar
6406 else
6407     case "$d_dosuid" in
6408         "$define")
6409         cat >&4 <<EOH
6410
6411 SUID emulation has been removed for 5.12
6412 Please re-run Configure without -Dd_dosuid
6413
6414 EOH
6415         exit 1;
6416         ;;
6417     esac
6418     d_dosuid=undef
6419 fi
6420
6421 : Find perl5.005 or later.
6422 echo "Looking for a previously installed perl5.005 or later... "
6423 case "$perl5" in
6424 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6425                 : Check if this perl is recent and can load a simple module
6426                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6427                         perl5=$tdir/perl
6428                         break;
6429                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6430                         perl5=$tdir/perl5
6431                         break;
6432                 fi
6433         done
6434         ;;
6435 *)      perl5="$perl5"
6436         ;;
6437 esac
6438 case "$perl5" in
6439 '')     echo "None found.  That's ok.";;
6440 *)      echo "Using $perl5." ;;
6441 esac
6442
6443 : Set the siteprefix variables
6444 $cat <<EOM
6445
6446 After $package is installed, you may wish to install various
6447 add-on modules and utilities.  Typically, these add-ons will
6448 be installed under $prefix with the rest
6449 of this package.  However, you may wish to install such add-ons
6450 elsewhere under a different prefix.
6451
6452 If you do not wish to put everything under a single prefix, that's
6453 ok.  You will be prompted for the individual locations; this siteprefix
6454 is only used to suggest the defaults.
6455
6456 The default should be fine for most people.
6457
6458 EOM
6459 fn=d~+
6460 rp='Installation prefix to use for add-on modules and utilities?'
6461 : XXX Here might be another good place for an installstyle setting.
6462 case "$siteprefix" in
6463 '') dflt=$prefix ;;
6464 *)  dflt=$siteprefix ;;
6465 esac
6466 . ./getfile
6467 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6468 oldsiteprefix=''
6469 case "$siteprefix" in
6470 '') ;;
6471 *)      case "$ans" in
6472         "$prefix") ;;
6473         *) oldsiteprefix="$prefix";;
6474         esac
6475         ;;
6476 esac
6477 siteprefix="$ans"
6478 siteprefixexp="$ansexp"
6479
6480 : determine where site specific libraries go.
6481 : Usual default is /usr/local/lib/perl5/site_perl/$version
6482 : The default "style" setting is made in installstyle.U
6483 : XXX No longer works with Prefixit stuff.
6484 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6485 case "$sitelib" in
6486 '') case "$installstyle" in
6487         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6488         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6489         esac
6490         ;;
6491 *)      dflt="$sitelib"
6492         ;;
6493 esac
6494 $cat <<EOM
6495
6496 The installation process will create a directory for
6497 site-specific extensions and modules.  Most users find it convenient
6498 to place all site-specific files in this directory rather than in the
6499 main distribution directory.
6500
6501 EOM
6502 fn=d~+
6503 rp='Pathname for the site-specific library files?'
6504 . ./getfile
6505 prefixvar=sitelib
6506 . ./setprefixvar
6507 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6508
6509 : Determine list of previous versions to include in @INC
6510 $cat > getverlist <<EOPL
6511 #!$perl5 -w
6512 use File::Basename;
6513 \$api_versionstring = "$api_versionstring";
6514 \$version = "$version";
6515 \$stem = "$sitelib_stem";
6516 \$archname = "$archname";
6517 EOPL
6518         $cat >> getverlist <<'EOPL'
6519 # The list found is store twice for each entry: the original name, and
6520 # the binary broken down version as pack "sss", so sorting is easy and
6521 # unambiguous. This will work for all versions that have a maximum of
6522 # three digit groups, separate by '.'s or '_'s. Names are extended with
6523 # ".0.0" to ensure at least three elements for the pack.
6524 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6525
6526 # Can't have leading @ because metaconfig interprets it as a command!
6527 ;@inc_version_list=();
6528 # XXX Redo to do opendir/readdir?
6529 if (-d $stem) {
6530     chdir($stem);
6531     ;@candidates = map {
6532         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6533     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6534 }
6535 else {
6536     ;@candidates = ();
6537 }
6538
6539 ($pversion, $aversion, $vsn5005) = map {
6540     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6541 foreach $d (@candidates) {
6542     if ($d->[1] lt $pversion) {
6543         if ($d->[1] ge $aversion) {
6544             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6545         }
6546         elsif ($d->[1] ge $vsn5005) {
6547             unshift(@inc_version_list, grep { -d } $d->[0]);
6548         }
6549     }
6550     else {
6551         # Skip newer version.  I.e. don't look in
6552         # 5.7.0 if we're installing 5.6.1.
6553     }
6554 }
6555
6556 if (@inc_version_list) {
6557     print join(' ', @inc_version_list);
6558 }
6559 else {
6560     # Blank space to preserve value for next Configure run.
6561     print " ";
6562 }
6563 EOPL
6564 chmod +x getverlist
6565 case "$inc_version_list" in
6566 '')     if test -x "$perl5$exe_ext"; then
6567                 dflt=`$perl5 getverlist`
6568         else
6569                 dflt='none'
6570         fi
6571         ;;
6572 $undef) dflt='none' ;;
6573 *)  eval dflt=\"$inc_version_list\" ;;
6574 esac
6575 case "$dflt" in
6576 ''|' ') dflt=none ;;
6577 esac
6578 case "$dflt" in
6579 5.005) dflt=none ;;
6580 esac
6581 $cat <<EOM
6582
6583 In order to ease the process of upgrading, this version of perl
6584 can be configured to use modules built and installed with earlier
6585 versions of perl that were installed under $prefix.  Specify here
6586 the list of earlier versions that this version of perl should check.
6587 If Configure detected no earlier versions of perl installed under
6588 $prefix, then the list will be empty.  Answer 'none' to tell perl
6589 to not search earlier versions.
6590
6591 The default should almost always be sensible, so if you're not sure,
6592 just accept the default.
6593 EOM
6594
6595 rp='List of earlier versions to include in @INC?'
6596 . ./myread
6597 case "$ans" in
6598 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6599 *) inc_version_list="$ans" ;;
6600 esac
6601 case "$inc_version_list" in
6602 ''|' ')
6603         inc_version_list_init='0'
6604         d_inc_version_list="$undef"
6605         ;;
6606 *)      inc_version_list_init=`echo $inc_version_list |
6607                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6608         d_inc_version_list="$define"
6609         ;;
6610 esac
6611 $rm -f getverlist
6612
6613 : see if malloc/malloc.h has to be included
6614 set malloc/malloc.h i_mallocmalloc
6615 eval $inhdr
6616
6617 : see if this is a malloc.h system
6618 : we want a real compile instead of Inhdr because some systems have a
6619 : malloc.h that just gives a compile error saying to use stdlib.h instead
6620 echo " "
6621 $cat >try.c <<EOCP
6622 #include <stdlib.h>
6623 #include <malloc.h>
6624 #$i_mallocmalloc I_MALLOCMALLOC
6625 #ifdef I_MALLOCMALLOC
6626 # include <malloc/malloc.h>
6627 #endif
6628
6629 int main () { return 0; }
6630 EOCP
6631 set try
6632 if eval $compile; then
6633     echo "<malloc.h> found." >&4
6634     val="$define"
6635 else
6636     echo "<malloc.h> NOT found." >&4
6637     val="$undef"
6638 fi
6639 $rm_try
6640 set i_malloc
6641 eval $setvar
6642
6643 : check for void type
6644 echo " "
6645 echo "Checking to see how well your C compiler groks the void type..." >&4
6646 case "$voidflags" in
6647 '')
6648         $cat >try.c <<EOCP
6649 #$i_stdlib I_STDLIB
6650 #ifdef I_STDLIB
6651 #include <stdlib.h>
6652 #endif
6653 #if TRY & 1
6654 void sub() {
6655 #else
6656 sub() {
6657 #endif
6658         extern void moo();      /* function returning void */
6659         void (*goo)();          /* ptr to func returning void */
6660 #if TRY & 8
6661         void *hue;              /* generic ptr */
6662 #endif
6663 #if TRY & 2
6664         void (*foo[10])();
6665 #endif
6666
6667 #if TRY & 4
6668         if(goo == moo) {
6669                 exit(0);
6670         }
6671 #endif
6672         exit(0);
6673 }
6674 int main() { sub(); }
6675 EOCP
6676         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6677                 voidflags=$defvoidused
6678         echo "Good.  It appears to support void to the level $package wants.">&4
6679                 if $contains warning .out >/dev/null 2>&1; then
6680                         echo "However, you might get some warnings that look like this:"
6681                         $cat .out
6682                 fi
6683         else
6684 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6685                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6686                         echo "It supports 1..."
6687                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6688                                 echo "It also supports 2..."
6689                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6690                                         voidflags=7
6691                                         echo "And it supports 4 but not 8 definitely."
6692                                 else
6693                                         echo "It doesn't support 4..."
6694                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6695                                                 voidflags=11
6696                                                 echo "But it supports 8."
6697                                         else
6698                                                 voidflags=3
6699                                                 echo "Neither does it support 8."
6700                                         fi
6701                                 fi
6702                         else
6703                                 echo "It does not support 2..."
6704                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6705                                         voidflags=13
6706                                         echo "But it supports 4 and 8."
6707                                 else
6708                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6709                                                 voidflags=5
6710                                                 echo "And it supports 4 but has not heard about 8."
6711                                         else
6712                                                 echo "However it supports 8 but not 4."
6713                                         fi
6714                                 fi
6715                         fi
6716                 else
6717                         echo "There is no support at all for void."
6718                         voidflags=0
6719                 fi
6720         fi
6721 esac
6722 case "$voidflags" in
6723 "$defvoidused") ;;
6724 *)      $cat >&4 <<'EOM'
6725   Support flag bits are:
6726     1: basic void declarations.
6727     2: arrays of pointers to functions returning void.
6728     4: operations between pointers to and addresses of void functions.
6729     8: generic void pointers.
6730 EOM
6731         dflt="$voidflags";
6732         rp="Your void support flags add up to what?"
6733         . ./myread
6734         voidflags="$ans"
6735         ;;
6736 esac
6737 $rm_try
6738
6739 : check for length of pointer
6740 echo " "
6741 case "$ptrsize" in
6742 '')
6743         echo "Checking to see how big your pointers are..." >&4
6744         if test "$voidflags" -gt 7; then
6745                 echo '#define VOID_PTR char *' > try.c
6746         else
6747                 echo '#define VOID_PTR void *' > try.c
6748         fi
6749         $cat >>try.c <<EOCP
6750 #include <stdio.h>
6751 #$i_stdlib I_STDLIB
6752 #ifdef I_STDLIB
6753 #include <stdlib.h>
6754 #endif
6755 int main()
6756 {
6757     printf("%d\n", (int)sizeof(VOID_PTR));
6758     exit(0);
6759 }
6760 EOCP
6761         set try
6762         if eval $compile_ok; then
6763                 ptrsize=`$run ./try`
6764                 echo "Your pointers are $ptrsize bytes long."
6765         else
6766                 dflt='4'
6767                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6768                 rp="What is the size of a pointer (in bytes)?"
6769                 . ./myread
6770                 ptrsize="$ans"
6771         fi
6772         ;;
6773 esac
6774 $rm_try
6775 case "$use64bitall" in
6776 "$define"|true|[yY]*)
6777         case "$ptrsize" in
6778         4)      cat <<EOM >&4
6779
6780 *** You have chosen a maximally 64-bit build,
6781 *** but your pointers are only 4 bytes wide.
6782 *** Please rerun Configure without -Duse64bitall.
6783 EOM
6784                 case "$d_quad" in
6785                 define)
6786                         cat <<EOM >&4
6787 *** Since you have quads, you could possibly try with -Duse64bitint.
6788 EOM
6789                         ;;
6790                 esac
6791                 cat <<EOM >&4
6792 *** Cannot continue, aborting.
6793
6794 EOM
6795
6796                 exit 1
6797                 ;;
6798         esac
6799         ;;
6800 esac
6801
6802
6803 : determine whether to use malloc wrapping
6804 echo " "
6805 case "$usemallocwrap" in
6806 [yY]*|true|$define)     dflt='y' ;;
6807 [nN]*|false|$undef)     dflt='n' ;;
6808 *)      case "$usedevel" in
6809         [yY]*|true|$define)     dflt='y' ;;
6810         *) dflt='n' ;;
6811         esac
6812         ;;
6813 esac
6814 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6815 . ./myread
6816 usemallocwrap="$ans"
6817 case "$ans" in
6818 y*|true)
6819         usemallocwrap="$define" ;;
6820 *)
6821         usemallocwrap="$undef" ;;
6822 esac
6823
6824 : determine which malloc to compile in
6825 echo " "
6826 case "$usemymalloc" in
6827 [yY]*|true|$define)     dflt='y' ;;
6828 [nN]*|false|$undef)     dflt='n' ;;
6829 *)      case "$ptrsize" in
6830         4) dflt='y' ;;
6831         *) dflt='n' ;;
6832         esac
6833         ;;
6834 esac
6835 rp="Do you wish to attempt to use the malloc that comes with $package?"
6836 . ./myread
6837 usemymalloc="$ans"
6838 case "$ans" in
6839 y*|true)
6840         usemymalloc='y'
6841         mallocsrc='malloc.c'
6842         mallocobj="malloc$_o"
6843         d_mymalloc="$define"
6844         case "$libs" in
6845         *-lmalloc*)
6846                 : Remove malloc from list of libraries to use
6847                 echo "Removing unneeded -lmalloc from library list" >&4
6848                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6849                 shift
6850                 libs="$*"
6851                 echo "libs = $libs" >&4
6852                 ;;
6853         esac
6854         ;;
6855 *)
6856         usemymalloc='n'
6857         mallocsrc=''
6858         mallocobj=''
6859         d_mymalloc="$undef"
6860         ;;
6861 esac
6862
6863 : compute the return types of malloc and free
6864 echo " "
6865 $cat >malloc.c <<END
6866 #$i_malloc I_MALLOC
6867 #$i_stdlib I_STDLIB
6868 #include <stdio.h>
6869 #include <sys/types.h>
6870 #ifdef I_MALLOC
6871 #include <malloc.h>
6872 #endif
6873 #ifdef I_STDLIB
6874 #include <stdlib.h>
6875 #endif
6876 #ifdef TRY_MALLOC
6877 void *malloc();
6878 #endif
6879 #ifdef TRY_FREE
6880 void free();
6881 #endif
6882 END
6883 case "$malloctype" in
6884 '')
6885         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6886                 malloctype='void *'
6887         else
6888                 malloctype='char *'
6889         fi
6890         ;;
6891 esac
6892 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6893
6894 case "$freetype" in
6895 '')
6896         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6897                 freetype='void'
6898         else
6899                 freetype='int'
6900         fi
6901         ;;
6902 esac
6903 echo "Your system uses $freetype free(), it would seem." >&4
6904 $rm -f malloc.[co]
6905 : determine where site specific architecture-dependent libraries go.
6906 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6907 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6908 : sitelib may have an optional trailing /share.
6909 case "$sitearch" in
6910 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6911         dflt="$dflt/$archname"
6912         ;;
6913 *)      dflt="$sitearch"
6914         ;;
6915 esac
6916 set sitearch sitearch none
6917 eval $prefixit
6918 $cat <<EOM
6919
6920 The installation process will also create a directory for
6921 architecture-dependent site-specific extensions and modules.
6922
6923 EOM
6924 fn=d~+
6925 rp='Pathname for the site-specific architecture-dependent library files?'
6926 . ./getfile
6927 prefixvar=sitearch
6928 . ./setprefixvar
6929 if $test X"$sitearch" = X"$sitelib"; then
6930         d_sitearch="$undef"
6931 else
6932         d_sitearch="$define"
6933 fi
6934
6935 : Set the vendorprefix variables
6936 $cat <<EOM
6937
6938 The installation process will also create a directory for
6939 vendor-supplied add-ons.  Vendors who supply perl with their system
6940 may find it convenient to place all vendor-supplied files in this
6941 directory rather than in the main distribution directory.  This will
6942 ease upgrades between binary-compatible maintenance versions of perl.
6943
6944 Of course you may also use these directories in whatever way you see
6945 fit.  For example, you might use them to access modules shared over a
6946 company-wide network.
6947
6948 The default answer should be fine for most people.
6949 This causes further questions about vendor add-ons to be skipped
6950 and no vendor-specific directories will be configured for perl.
6951
6952 EOM
6953 rp='Do you want to configure vendor-specific add-on directories?'
6954 case "$usevendorprefix" in
6955 define|true|[yY]*) dflt=y ;;
6956 *)      : User may have set vendorprefix directly on Configure command line.
6957         case "$vendorprefix" in
6958         ''|' ') dflt=n ;;
6959         *)      dflt=y ;;
6960         esac
6961         ;;
6962 esac
6963 . ./myread
6964 case "$ans" in
6965 [yY]*)  fn=d~+
6966         rp='Installation prefix to use for vendor-supplied add-ons?'
6967         case "$vendorprefix" in
6968         '') dflt='' ;;
6969         *)  dflt=$vendorprefix ;;
6970         esac
6971         . ./getfile
6972         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6973         oldvendorprefix=''
6974         case "$vendorprefix" in
6975         '') ;;
6976         *)      case "$ans" in
6977                 "$prefix") ;;
6978                 *) oldvendorprefix="$prefix";;
6979                 esac
6980                 ;;
6981         esac
6982         usevendorprefix="$define"
6983         vendorprefix="$ans"
6984         vendorprefixexp="$ansexp"
6985         ;;
6986 *)      usevendorprefix="$undef"
6987         vendorprefix=''
6988         vendorprefixexp=''
6989         ;;
6990 esac
6991
6992 : Set the vendorlib variables
6993 case "$vendorprefix" in
6994 '')     d_vendorlib="$undef"
6995         vendorlib=''
6996         vendorlibexp=''
6997         ;;
6998 *)      d_vendorlib="$define"
6999         : determine where vendor-supplied modules go.
7000         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7001         case "$vendorlib" in
7002         '')
7003                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7004                 case "$installstyle" in
7005                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7006                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7007                 esac
7008                 ;;
7009         *)      dflt="$vendorlib"
7010                 ;;
7011         esac
7012         fn=d~+
7013         rp='Pathname for the vendor-supplied library files?'
7014         . ./getfile
7015         vendorlib="$ans"
7016         vendorlibexp="$ansexp"
7017         ;;
7018 esac
7019 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7020 prefixvar=vendorlib
7021 . ./installprefix
7022
7023 : Set the vendorarch variables
7024 case "$vendorprefix" in
7025 '')     d_vendorarch="$undef"
7026         vendorarch=''
7027         vendorarchexp=''
7028         ;;
7029 *)      d_vendorarch="$define"
7030         : determine where vendor-supplied architecture-dependent libraries go.
7031         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7032         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7033         : vendorlib may have an optional trailing /share.
7034         case "$vendorarch" in
7035         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7036                 dflt="$dflt/$archname"
7037                 ;;
7038         *)      dflt="$vendorarch" ;;
7039         esac
7040         fn=d~+
7041         rp='Pathname for vendor-supplied architecture-dependent files?'
7042         . ./getfile
7043         vendorarch="$ans"
7044         vendorarchexp="$ansexp"
7045         ;;
7046 esac
7047 prefixvar=vendorarch
7048 . ./installprefix
7049 if $test X"$vendorarch" = X"$vendorlib"; then
7050         d_vendorarch="$undef"
7051 else
7052         d_vendorarch="$define"
7053 fi
7054
7055 : Final catch-all directories to search
7056 $cat <<EOM
7057
7058 Lastly, you can have perl look in other directories for extensions and
7059 modules in addition to those already specified.
7060 These directories will be searched after 
7061         $sitearch 
7062         $sitelib 
7063 EOM
7064 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7065 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7066 echo ' '
7067 case "$otherlibdirs" in
7068 ''|' ') dflt='none' ;;
7069 *)      dflt="$otherlibdirs" ;;
7070 esac
7071 $cat <<EOM
7072 Enter a colon-separated set of extra paths to include in perl's @INC
7073 search path, or enter 'none' for no extra paths.
7074
7075 EOM
7076
7077 rp='Colon-separated list of additional directories for perl to search?'
7078 . ./myread
7079 case "$ans" in
7080 ' '|''|none)    otherlibdirs=' ' ;;     
7081 *)      otherlibdirs="$ans" ;;
7082 esac
7083 case "$otherlibdirs" in
7084 ' ') val=$undef ;;
7085 *)      val=$define ;;
7086 esac
7087 set d_perl_otherlibdirs
7088 eval $setvar
7089
7090 : Cruising for prototypes
7091 echo " "
7092 echo "Checking out function prototypes..." >&4
7093 $cat >prototype.c <<EOCP
7094 #$i_stdlib I_STDLIB
7095 #ifdef I_STDLIB
7096 #include <stdlib.h>
7097 #endif
7098 int main(int argc, char *argv[]) {
7099         exit(0);}
7100 EOCP
7101 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7102         echo "Your C compiler appears to support function prototypes."
7103         val="$define"
7104 else
7105         echo "Your C compiler doesn't seem to understand function prototypes."
7106         val="$undef"
7107 fi
7108 set prototype
7109 eval $setvar
7110 $rm -f prototype*
7111
7112 : Check if ansi2knr is required
7113 case "$prototype" in
7114 "$define") ;;
7115 *)      ansi2knr='ansi2knr'
7116         echo " "
7117         cat <<EOM >&4
7118
7119 $me:  FATAL ERROR:
7120 This version of $package can only be compiled by a compiler that 
7121 understands function prototypes.  Unfortunately, your C compiler 
7122         $cc $ccflags
7123 doesn't seem to understand them.  Sorry about that.
7124
7125 If GNU cc is available for your system, perhaps you could try that instead.  
7126
7127 Eventually, we hope to support building Perl with pre-ANSI compilers.
7128 If you would like to help in that effort, please contact <perlbug@perl.org>.
7129
7130 Aborting Configure now.
7131 EOM
7132         exit 2
7133         ;;
7134 esac
7135
7136 : DTrace support
7137 dflt_dtrace='/usr/sbin/dtrace'
7138 cat <<EOM
7139
7140 Perl can be built to support DTrace on platforms that support it.
7141 DTrace is a diagnosis and performance analysis tool from Sun.
7142
7143 If this doesn't make any sense to you, just accept the default '$dflt'.
7144 EOM
7145
7146 while $test 1 ; do
7147         case "$usedtrace" in
7148         $define|true|[yY]*)
7149                 dflt='y'
7150                 ;;
7151         ?*)
7152                 dflt='y'
7153                 dflt_dtrace=$usedtrace
7154                 ;;
7155         *)
7156                 dflt='n'
7157                 ;;
7158         esac
7159
7160         rp='Support DTrace if available?'
7161         . ./myread
7162         case "$ans" in
7163         y|Y)    val="$define" ;;
7164         *)      val="$undef" ;;
7165         esac
7166         set usedtrace
7167         eval $setvar
7168
7169         test "X$usedtrace" != "X$define" && break
7170
7171         echo " "
7172         rp='Where is the dtrace executable?'
7173         dflt=$dflt_dtrace
7174         . ./getfile
7175         val="$ans"
7176         set dtrace
7177         eval $setvar
7178
7179         if $test -f $dtrace
7180         then
7181                 if $dtrace -h -s ../perldtrace.d \
7182                         -o perldtrace.tmp >/dev/null 2>&1 \
7183                         && rm -f perldtrace.tmp
7184                 then
7185                         echo " "
7186                         echo "Good: your $dtrace knows about the -h flag."
7187                 else
7188                         cat >&2 <<EOM
7189
7190 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7191 ***
7192 *** Your installed dtrace doesn't support the -h switch to compile a D
7193 *** program into a C header. Can't continue.
7194
7195 EOM
7196                         exit 1
7197                 fi
7198                 break;
7199         fi
7200
7201         case "$fastread" in
7202         yes)
7203                 cat >&2 <<EOM
7204
7205 *** $me:  Fatal Error:  $dtrace not found.
7206 *** Can't continue.
7207
7208 EOM
7209                 exit 1
7210                 ;;
7211         *)
7212                 echo "*** $dtrace was not found."
7213                 echo " "
7214                 ;;
7215         esac
7216 done
7217
7218 : See if we want extra modules installed
7219 echo " "
7220 case "$extras" in
7221 '') dflt='n';;
7222 *) dflt='y';;
7223 esac
7224 cat <<EOM
7225 Perl can be built with extra modules or bundles of modules which
7226 will be fetched from the CPAN and installed alongside Perl.
7227
7228 Notice that you will need access to the CPAN; either via the Internet,
7229 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7230 be asked later to configure the CPAN.pm module which will in turn do
7231 the installation of the rest of the extra modules or bundles.)
7232
7233 Notice also that if the modules require any external software such as
7234 libraries and headers (the libz library and the zlib.h header for the
7235 Compress::Zlib module, for example) you MUST have any such software
7236 already installed, this configuration process will NOT install such
7237 things for you.
7238
7239 If this doesn't make any sense to you, just accept the default '$dflt'.
7240 EOM
7241 rp='Install any extra modules (y or n)?'
7242 . ./myread
7243 case "$ans" in
7244 y|Y)
7245         cat <<EOM
7246
7247 Please list any extra modules or bundles to be installed from CPAN,
7248 with spaces between the names.  The names can be in any format the
7249 'install' command of CPAN.pm will understand.  (Answer 'none',
7250 without the quotes, to install no extra modules or bundles.)
7251 EOM
7252         rp='Extras?'
7253         dflt="$extras"
7254         . ./myread
7255         extras="$ans"
7256 esac
7257 case "$extras" in
7258 ''|'none')
7259         val=''
7260         $rm -f ../extras.lst
7261         ;;
7262 *)      echo "(Saving the list of extras for later...)"
7263         echo "$extras" > ../extras.lst
7264         val="'$extras'"
7265         ;;
7266 esac
7267 set extras
7268 eval $setvar
7269 echo " "
7270
7271 : determine where html pages for programs go
7272 set html1dir html1dir none
7273 eval $prefixit
7274 $cat <<EOM
7275
7276 If you wish to install html files for programs in $spackage, indicate
7277 the appropriate directory here.  To skip installing html files,
7278 answer "none".
7279 EOM
7280 case "$html1dir" in
7281 ''|none|$undef|' ') dflt=none ;;
7282 *) dflt=$html1dir ;;
7283 esac
7284 fn=dn+~
7285 rp="Directory for the main $spackage html pages?"
7286 . ./getfile
7287 prefixvar=html1dir
7288 . ./setprefixvar
7289 : Use ' ' for none so value is preserved next time through Configure
7290 $test X"$html1dir" = "X" && html1dir=' '
7291
7292 : determine where html pages for libraries and modules go
7293 set html3dir html3dir none
7294 eval $prefixit
7295 $cat <<EOM
7296
7297 If you wish to install html files for modules associated with $spackage,
7298 indicate the appropriate directory here.  To skip installing html files,
7299 answer "none".
7300 EOM
7301 : There is no obvious default.  If they have specified html1dir, then
7302 : try to key off that, possibly changing .../html1 into .../html3.
7303 case "$html3dir" in
7304 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7305 *) dflt=$html3dir ;;
7306 esac
7307 fn=dn+~
7308 rp="Directory for the $spackage module html pages?"
7309 . ./getfile
7310 prefixvar=html3dir
7311 . ./setprefixvar
7312 : Use ' ' for none so value is preserved next time through Configure
7313 $test X"$html3dir" = "X" && html3dir=' '
7314
7315 : determine whether to install perl also as /usr/bin/perl
7316
7317 echo " "
7318 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7319         $cat <<EOM
7320 Many scripts expect perl to be installed as /usr/bin/perl.
7321
7322 If you want to, I can install the perl you are about to compile
7323 as /usr/bin/perl (in addition to $bin/perl).
7324 EOM
7325         if test -f /usr/bin/perl; then
7326             $cat <<EOM
7327
7328 However, please note that because you already have a /usr/bin/perl,
7329 overwriting that with a new Perl would very probably cause problems.
7330 Therefore I'm assuming you don't want to do that (unless you insist).
7331
7332 EOM
7333             case "$installusrbinperl" in
7334             "$define"|[yY]*)    dflt='y';;
7335             *)                  dflt='n';;
7336             esac
7337         else
7338             $cat <<EOM
7339
7340 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7341
7342 EOM
7343             case "$installusrbinperl" in
7344             "$undef"|[nN]*)     dflt='n';;
7345             *)                  dflt='y';;
7346             esac
7347         fi
7348         rp="Do you want to install perl as /usr/bin/perl?"
7349         . ./myread
7350         case "$ans" in
7351         [yY]*)  val="$define";;
7352         *)      val="$undef" ;;
7353         esac
7354 else
7355         val="$undef"
7356 fi
7357 set installusrbinperl
7358 eval $setvar
7359
7360 : Check if we are using the GNU C library
7361 echo " "
7362 echo "Checking for GNU C Library..." >&4
7363 cat >try.c <<'EOCP'
7364 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7365    alone are insufficient to distinguish different versions, such as
7366    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7367    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7368 */
7369 #include <stdio.h>
7370 int main(void)
7371 {
7372 #ifdef __GLIBC__
7373 #   ifdef __GLIBC_MINOR__
7374 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7375 #           include <gnu/libc-version.h>
7376             printf("%s\n",  gnu_get_libc_version());
7377 #       else
7378             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7379 #       endif
7380 #   else
7381         printf("%d\n",  __GLIBC__);
7382 #   endif
7383     return 0;
7384 #else
7385     return 1;
7386 #endif
7387 }
7388 EOCP
7389 set try
7390 if eval $compile_ok && $run ./try > glibc.ver; then
7391         val="$define"
7392         gnulibc_version=`$cat glibc.ver`
7393         echo "You are using the GNU C Library version $gnulibc_version"
7394 else
7395         val="$undef"
7396         gnulibc_version=''
7397         echo "You are not using the GNU C Library"
7398 fi
7399 $rm_try glibc.ver
7400 set d_gnulibc
7401 eval $setvar
7402
7403 : see if nm is to be used to determine whether a symbol is defined or not
7404 case "$usenm" in
7405 '')
7406         dflt=''
7407         case "$d_gnulibc" in
7408         "$define")
7409                 echo " "
7410                 echo "nm probably won't work on the GNU C Library." >&4
7411                 dflt=n
7412                 ;;
7413         esac
7414         case "$dflt" in
7415         '') 
7416                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7417                         echo " "
7418                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7419                         echo "'nm' won't be sufficient on this sytem." >&4
7420                         dflt=n
7421                 fi
7422                 ;;
7423         esac
7424         case "$dflt" in
7425         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7426                 if $test $dflt -gt 20; then
7427                         dflt=y
7428                 else
7429                         dflt=n
7430                 fi
7431                 ;;
7432         esac
7433         ;;
7434 *)
7435         case "$usenm" in
7436         true|$define) dflt=y;;
7437         *) dflt=n;;
7438         esac
7439         ;;
7440 esac
7441 $cat <<EOM
7442
7443 I can use $nm to extract the symbols from your C libraries. This
7444 is a time consuming task which may generate huge output on the disk (up
7445 to 3 megabytes) but that should make the symbols extraction faster. The
7446 alternative is to skip the 'nm' extraction part and to compile a small
7447 test program instead to determine whether each symbol is present. If
7448 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7449 this may be the best solution.
7450
7451 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7452
7453 EOM
7454 rp="Shall I use $nm to extract C symbols from the libraries?"
7455 . ./myread
7456 case "$ans" in
7457 [Nn]*) usenm=false;;
7458 *) usenm=true;;
7459 esac
7460
7461 runnm=$usenm
7462 case "$reuseval" in
7463 true) runnm=false;;
7464 esac
7465
7466 : nm options which may be necessary
7467 case "$nm_opt" in
7468 '') if $test -f /mach_boot; then
7469                 nm_opt=''       # Mach
7470         elif $test -d /usr/ccs/lib; then
7471                 nm_opt='-p'     # Solaris (and SunOS?)
7472         elif $test -f /dgux; then
7473                 nm_opt='-p'     # DG-UX
7474         elif $test -f /lib64/rld; then
7475                 nm_opt='-p'     # 64-bit Irix
7476         else
7477                 nm_opt=''
7478         fi;;
7479 esac
7480
7481 : nm options which may be necessary for shared libraries but illegal
7482 : for archive libraries.  Thank you, Linux.
7483 case "$nm_so_opt" in
7484 '')     case "$myuname" in
7485         *linux*|gnu*)
7486                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7487                         nm_so_opt='--dynamic'
7488                 fi
7489                 ;;
7490         esac
7491         ;;
7492 esac
7493
7494 : Figure out where the libc is located
7495 case "$runnm" in
7496 true)
7497 : get list of predefined functions in a handy place
7498 echo " "
7499 case "$libc" in
7500 '') libc=unknown
7501         case "$libs" in
7502         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7503         esac
7504         ;;
7505 esac
7506 case "$libs" in
7507 '') ;;
7508 *)  for thislib in $libs; do
7509         case "$thislib" in
7510         -lc|-lc_s)
7511                 : Handle C library specially below.
7512                 ;;
7513         -l*)
7514                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7515                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7516                         :
7517                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7518                         :
7519                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7520                         :
7521                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7522                         :
7523                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7524                         :
7525                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7526                         :
7527                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7528                         :
7529                 else
7530                         try=''
7531                 fi
7532                 libnames="$libnames $try"
7533                 ;;
7534         *) libnames="$libnames $thislib" ;;
7535         esac
7536         done
7537         ;;
7538 esac
7539 xxx=normal
7540 case "$libc" in
7541 unknown)
7542         set /lib/libc.$so
7543         for xxx in $libpth; do
7544                 $test -r $1 || set $xxx/libc.$so
7545                 : The messy sed command sorts on library version numbers.
7546                 $test -r $1 || \
7547                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7548                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7549                                 h
7550                                 s/[0-9][0-9]*/0000&/g
7551                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7552                                 G
7553                                 s/\n/ /' | \
7554                          $sort | $sed -e 's/^.* //'`
7555                 eval set \$$#
7556         done
7557         $test -r $1 || set /usr/ccs/lib/libc.$so
7558         $test -r $1 || set /lib/libsys_s$_a
7559         ;;
7560 *)
7561         set blurfl
7562         ;;
7563 esac
7564 if $test -r "$1"; then
7565         echo "Your (shared) C library seems to be in $1."
7566         libc="$1"
7567 elif $test -r /lib/libc && $test -r /lib/clib; then
7568         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7569         xxx=apollo
7570         libc='/lib/clib /lib/libc'
7571         if $test -r /lib/syslib; then
7572                 echo "(Your math library is in /lib/syslib.)"
7573                 libc="$libc /lib/syslib"
7574         fi
7575 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7576         echo "Your C library seems to be in $libc, as you said before."
7577 elif $test -r $incpath/usr/lib/libc$_a; then
7578         libc=$incpath/usr/lib/libc$_a;
7579         echo "Your C library seems to be in $libc.  That's fine."
7580 elif $test -r /lib/libc$_a; then
7581         libc=/lib/libc$_a;
7582         echo "Your C library seems to be in $libc.  You're normal."
7583 else
7584         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7585                 :
7586         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7587                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7588         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7589                 :
7590         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7591                 :
7592         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7593                 :
7594         else
7595                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7596         fi
7597         if $test -r "$tans"; then
7598                 echo "Your C library seems to be in $tans, of all places."
7599                 libc=$tans
7600         else
7601                 libc='blurfl'
7602         fi
7603 fi
7604 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7605         dflt="$libc"
7606         cat <<EOM
7607
7608 If the guess above is wrong (which it might be if you're using a strange
7609 compiler, or your machine supports multiple models), you can override it here.
7610
7611 EOM
7612 else
7613         dflt=''
7614         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7615         cat >&4 <<EOM
7616 I can't seem to find your C library.  I've looked in the following places:
7617
7618 EOM
7619         $sed 's/^/      /' libpath
7620         cat <<EOM
7621
7622 None of these seems to contain your C library. I need to get its name...
7623
7624 EOM
7625 fi
7626 fn=f
7627 rp='Where is your C library?'
7628 . ./getfile
7629 libc="$ans"
7630
7631 echo " "
7632 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7633 set X `cat libnames`
7634 shift
7635 xxx=files
7636 case $# in 1) xxx=file; esac
7637 echo "Extracting names from the following $xxx for later perusal:" >&4
7638 echo " "
7639 $sed 's/^/      /' libnames >&4
7640 echo " "
7641 $echo $n "This may take a while...$c" >&4
7642
7643 for file in $*; do
7644         case $file in
7645         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7646         *) $nm $nm_opt $file 2>/dev/null;;
7647         esac
7648 done >libc.tmp
7649
7650 $echo $n ".$c"
7651 $grep fprintf libc.tmp > libc.ptf
7652 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7653 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7654 xxx='[ADTSIW]'
7655 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7656         eval $xscan;\
7657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7658                 eval $xrun
7659 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7660         eval $xscan;\
7661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7662                 eval $xrun
7663 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7664         eval $xscan;\
7665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7666                 eval $xrun
7667 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7668         eval $xscan;\
7669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7670                 eval $xrun
7671 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7672         eval $xscan;\
7673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7674                 eval $xrun
7675 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7676         eval $xscan;\
7677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7678                 eval $xrun
7679 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7680                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7681         eval $xscan;\
7682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7683                 eval $xrun
7684 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7685         eval $xscan;\
7686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7687                 eval $xrun
7688 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7689         eval $xscan;\
7690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7691                 eval $xrun
7692 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7693         eval $xscan;\
7694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7695                 eval $xrun
7696 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7697         eval $xscan;\
7698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7699                 eval $xrun
7700 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7701         eval $xscan;\
7702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7703                 eval $xrun
7704 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7705         eval $xscan;\
7706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7707                 eval $xrun
7708 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7709         eval $xscan;\
7710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7711                 eval $xrun
7712 else
7713         $nm -p $* 2>/dev/null >libc.tmp
7714         $grep fprintf libc.tmp > libc.ptf
7715         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7716                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7717         then
7718                 nm_opt='-p'
7719                 eval $xrun
7720         else
7721                 echo " "
7722                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7723                 com=''
7724                 if $ar t $libc > libc.tmp && \
7725                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7726                 then
7727                         for thisname in $libnames $libc; do
7728                                 $ar t $thisname >>libc.tmp
7729                         done
7730                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7731                         echo "Ok." >&4
7732                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7733                         for thisname in $libnames $libc; do
7734                                 $ar tv $thisname >>libc.tmp
7735                                 emximp -o tmp.imp $thisname \
7736                                     2>/dev/null && \
7737                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7738                                     < tmp.imp >>libc.tmp
7739                                 $rm -f tmp.imp
7740                         done
7741                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7742                         echo "Ok." >&4
7743                 else
7744                         echo "$ar didn't seem to work right." >&4
7745                         echo "Maybe this is a Cray...trying bld instead..." >&4
7746                         if  bld t $libc | \
7747                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7748                                 $test -s libc.list
7749                         then
7750                                 for thisname in $libnames; do
7751                                         bld t $libnames | \
7752                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7753                                         $ar t $thisname >>libc.tmp
7754                                 done
7755                                 echo "Ok." >&4
7756                         else
7757                                 echo "That didn't work either.  Giving up." >&4
7758                                 exit 1
7759                         fi
7760                 fi
7761         fi
7762 fi
7763 nm_extract="$com"
7764 case "$PASE" in
7765 define)
7766     echo " "
7767     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7768     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7769     ;;
7770 *)  if $test -f /lib/syscalls.exp; then
7771         echo " "
7772         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7773         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7774                 /lib/syscalls.exp >>libc.list
7775     fi
7776     ;;
7777 esac
7778 ;;
7779 esac
7780 $rm -f libnames libpath
7781
7782 : see if dld is available
7783 set dld.h i_dld
7784 eval $inhdr
7785
7786 : Check if we are using C++
7787 echo " "
7788 echo "Checking for C++..." >&4
7789 $cat >try.c <<'EOCP'
7790 #include <stdio.h>
7791 int main(void)
7792 {
7793 #ifdef __cplusplus
7794     return 0;
7795 #else
7796     return 1;
7797 #endif
7798 }
7799 EOCP
7800 set try
7801 if eval $compile_ok && $run ./try; then
7802         val="$define"
7803         echo "You are using a C++ compiler."
7804 else
7805         val="$undef"
7806         echo "You are not using a C++ compiler."
7807 fi
7808 $rm_try cplusplus$$
7809 set d_cplusplus
7810 eval $setvar
7811
7812 : is a C symbol defined?
7813 csym='tlook=$1;
7814 case "$3" in
7815 -v) tf=libc.tmp; tdc="";;
7816 -a) tf=libc.tmp; tdc="[]";;
7817 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7818 esac;
7819 case "$d_cplusplus" in
7820     $define)    extern_C="extern \"C\"" ;;
7821     *)          extern_C="extern"       ;;
7822 esac;
7823 tx=yes;
7824 case "$reuseval-$4" in
7825 true-) ;;
7826 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7827 esac;
7828 case "$tx" in
7829 yes)
7830         tval=false;
7831         if $test "$runnm" = true; then
7832                 if $contains $tlook $tf >/dev/null 2>&1; then
7833                         tval=true;
7834                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7835                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7836                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7837                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7838                         $rm_try;
7839                 fi;
7840         else
7841                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7842                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7843                 $rm_try;
7844         fi;
7845         ;;
7846 *)
7847         case "$tval" in
7848         $define) tval=true;;
7849         *) tval=false;;
7850         esac;
7851         ;;
7852 esac;
7853 eval "$2=$tval"'
7854
7855 : define an is-in-libc? function
7856 inlibc='echo " "; td=$define; tu=$undef;
7857 sym=$1; var=$2; eval "was=\$$2";
7858 tx=yes;
7859 case "$reuseval$was" in
7860 true) ;;
7861 true*) tx=no;;
7862 esac;
7863 case "$tx" in
7864 yes)
7865         set $sym tres -f;
7866         eval $csym;
7867         case "$tres" in
7868         true)
7869                 echo "$sym() found." >&4;
7870                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7871         *)
7872                 echo "$sym() NOT found." >&4;
7873                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7874         esac;;
7875 *)
7876         case "$was" in
7877         $define) echo "$sym() found." >&4;;
7878         *) echo "$sym() NOT found." >&4;;
7879         esac;;
7880 esac'
7881
7882 : see if dlopen exists
7883 xxx_runnm="$runnm"
7884 xxx_ccflags="$ccflags"
7885 runnm=false
7886 : with g++ one needs -shared to get is-in-libc to work for dlopen
7887 case "$gccversion" in
7888 '')     ;;
7889 *)      case "$d_cplusplus" in
7890         "$define") ccflags="$ccflags -shared" ;;
7891         esac
7892         ;;
7893 esac
7894 set dlopen d_dlopen
7895 eval $inlibc
7896 runnm="$xxx_runnm"
7897 ccflags="$xxx_ccflags"
7898
7899 : see if this is a unistd.h system
7900 set unistd.h i_unistd
7901 eval $inhdr
7902
7903 : determine which dynamic loading, if any, to compile in
7904 echo " "
7905 dldir="ext/DynaLoader"
7906 case "$usedl" in
7907 $define|y|true)
7908         dflt='y'
7909         usedl="$define"
7910         ;;
7911 $undef|n|false)
7912         dflt='n'
7913         usedl="$undef"
7914         ;;
7915 *)
7916         dflt='n'
7917         case "$d_dlopen" in
7918             $define) dflt='y' ;;
7919         esac
7920         case "$i_dld" in
7921             $define) dflt='y' ;;
7922         esac
7923         : Does a dl_xxx.xs file exist for this operating system
7924         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7925         ;;
7926 esac
7927 rp="Do you wish to use dynamic loading?"
7928 . ./myread
7929 usedl="$ans"
7930 bin_ELF="$undef"
7931 case "$ans" in
7932 y*) usedl="$define"
7933         case "$dlsrc" in
7934         '')
7935                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7936                         dflt="$dldir/dl_${osname}.xs"
7937                 elif $test "$d_dlopen" = "$define" ; then
7938                         dflt="$dldir/dl_dlopen.xs"
7939                 elif $test "$i_dld" = "$define" ; then
7940                         dflt="$dldir/dl_dld.xs"
7941                 else
7942                         dflt=''
7943                 fi
7944                 ;;
7945         *)      dflt="$dldir/$dlsrc"
7946                 ;;
7947         esac
7948     echo "The following dynamic loading files are available:"
7949         : Can not go over to $dldir because getfile has path hard-coded in.
7950         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7951         rp="Source file to use for dynamic loading"
7952         fn="fne"
7953         gfpth="$src"
7954         . ./getfile
7955         usedl="$define"
7956         : emulate basename
7957         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7958
7959         $cat << EOM
7960
7961 Some systems may require passing special flags to $cc -c to
7962 compile modules that will be used to create a shared library.
7963 To use no flags, say "none".
7964
7965 EOM
7966     case "$cccdlflags" in
7967     '') case "$gccversion" in
7968                 '') case "$osname" in
7969                         hpux)   dflt='+z' ;;
7970                         next)   dflt='none' ;;
7971                         irix*)  dflt='-KPIC' ;;
7972                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7973                         sunos)  dflt='-pic' ;;
7974                         *)      dflt='none' ;;
7975                     esac
7976                         ;;
7977                 *)  case "$osname" in
7978                         darwin) dflt='none' ;;
7979                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7980                         *)      dflt='-fpic' ;;
7981                     esac ;;
7982             esac ;;
7983         ' ') dflt='none' ;;
7984     *)  dflt="$cccdlflags" ;;
7985     esac
7986     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7987     . ./myread
7988     case "$ans" in
7989     none) cccdlflags=' ' ;;
7990     *) cccdlflags="$ans" ;;
7991     esac
7992
7993     cat << EOM
7994
7995 Some systems use ld to create libraries that can be dynamically loaded,
7996 while other systems (such as those using ELF) use $cc.
7997
7998 EOM
7999         case "$ld" in
8000         '')     $cat >try.c <<EOM
8001 /* Test for whether ELF binaries are produced */
8002 #include <fcntl.h>
8003 #$i_stdlib I_STDLIB
8004 #ifdef I_STDLIB
8005 #include <stdlib.h>
8006 #endif
8007 #$i_unistd I_UNISTD
8008 #ifdef I_UNISTD
8009 #include <unistd.h>
8010 #endif
8011 int main() {
8012         char b[4];
8013         int i = open("a.out",O_RDONLY);
8014         if(i == -1)
8015                 exit(1); /* fail */
8016         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8017                 exit(0); /* succeed (yes, it's ELF) */
8018         else
8019                 exit(1); /* fail */
8020 }
8021 EOM
8022                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8023                         cat <<EOM
8024 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8025 EOM
8026                         dflt="$cc"
8027                         bin_ELF="$define"
8028                 else
8029                         echo "I'll use ld to build dynamic libraries."
8030                         dflt='ld'
8031                 fi
8032                 $rm_try
8033                 ;;
8034         *)      dflt="$ld"
8035                 ;;
8036         esac
8037
8038     rp="What command should be used to create dynamic libraries?"
8039     . ./myread
8040         ld="$ans"
8041
8042     cat << EOM
8043
8044 Some systems may require passing special flags to $ld to create a
8045 library that can be dynamically loaded.  If your ld flags include
8046 -L/other/path options to locate libraries outside your loader's normal
8047 search path, you may need to specify those -L options here as well.  To
8048 use no flags, say "none".
8049
8050 EOM
8051     case "$lddlflags" in
8052     '') case "$osname" in
8053                         beos) dflt='-nostart' ;;
8054                         haiku) dflt='-shared' ;;
8055                         hpux) dflt='-b';
8056                               case "$gccversion" in
8057                               '') dflt="$dflt +vnocompatwarnings" ;;
8058                               esac
8059                               ;;
8060                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8061                         next)  dflt='none' ;;
8062                         solaris) dflt='-G' ;;
8063                         sunos) dflt='-assert nodefinitions' ;;
8064                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8065                 *)     dflt='none' ;;
8066                         esac
8067                         ;;
8068     *) dflt="$lddlflags" ;;
8069     esac
8070
8071         : Try to guess additional flags to pick up local libraries.
8072         : Be careful not to append to a plain 'none'
8073         case "$dflt" in
8074         none) dflt='' ;;
8075         esac
8076         for thisflag in $ldflags; do
8077                 case "$thisflag" in
8078                 -L*|-R*|-Wl,-R*)
8079                         case " $dflt " in
8080                         *" $thisflag "*) ;;
8081                         *) dflt="$dflt $thisflag" ;;
8082                         esac
8083                         ;;
8084                 esac
8085         done
8086
8087         case "$dflt" in
8088         ''|' ') dflt='none' ;;
8089         esac
8090
8091         case "$ldflags" in
8092         *-fstack-protector*)
8093             case "$dflt" in
8094                         *-fstack-protector*) ;; # Don't add it again
8095                         *) dflt="$dflt -fstack-protector" ;; 
8096                 esac
8097                 ;;
8098         esac
8099
8100
8101     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8102     . ./myread
8103     case "$ans" in
8104     none) lddlflags=' ' ;;
8105     *) lddlflags="$ans" ;;
8106     esac
8107
8108         cat <<EOM
8109
8110 Some systems may require passing special flags to $cc to indicate that
8111 the resulting executable will use dynamic linking.  To use no flags,
8112 say "none".
8113
8114 EOM
8115     case "$ccdlflags" in
8116     '') case "$osname" in
8117             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8118             next|sunos) dflt='none' ;;
8119             *)          dflt='none' ;;
8120             esac ;;
8121     ' ')  dflt='none' ;;
8122     *)  dflt="$ccdlflags" ;;
8123     esac
8124     rp="Any special flags to pass to $cc to use dynamic linking?"
8125     . ./myread
8126     case "$ans" in
8127     none) ccdlflags=' ' ;;
8128     *) ccdlflags="$ans" ;;
8129     esac
8130     ;;
8131 *)  usedl="$undef"
8132         ld='ld'
8133     dlsrc='dl_none.xs'
8134     lddlflags=''
8135     ccdlflags=''
8136     ;;
8137 esac
8138
8139 : Do we want a shared libperl?
8140 also=''
8141 case "$usedl" in
8142 $undef)
8143         # No dynamic loading being used, so don't bother even to prompt.
8144         useshrplib='false'
8145         ;;
8146 *)      case "$useshrplib" in
8147         '')     case "$osname" in
8148                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8149                         dflt=y
8150                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8151                         ;;
8152                 next*)
8153                         case "$osvers" in
8154                         4*)     dflt=y
8155                                 also='Building a shared libperl is needed for MAB support.'
8156                                 ;;
8157                         *)      dflt=n
8158                                 ;;
8159                         esac
8160                         ;;
8161                 *)      dflt=n
8162                         ;;
8163                 esac
8164                 ;;
8165         $define|true|[Yy]*)
8166                 dflt=y
8167                 ;;
8168         *)      dflt=n
8169                 ;;
8170         esac
8171         $cat << EOM
8172
8173 The perl executable is normally obtained by linking perlmain.c with
8174 libperl${_a}, any static extensions (usually just DynaLoader), and
8175 any other libraries needed on this system (such as -lm, etc.).  Since
8176 your system supports dynamic loading, it is probably possible to build
8177 a shared libperl.$so.  If you will have more than one executable linked
8178 to libperl.$so, this will significantly reduce the size of each
8179 executable, but it may have a noticeable effect on performance.  The
8180 default is probably sensible for your system.
8181 $also
8182
8183 EOM
8184         rp="Build a shared libperl.$so (y/n)"
8185         . ./myread
8186         case "$ans" in
8187         true|$define|[Yy]*)
8188                 useshrplib='true'  ;;
8189         *)      useshrplib='false' ;;
8190         esac
8191         ;;
8192 esac
8193
8194 case "$useshrplib" in
8195 true)
8196         case "$userelocatableinc" in
8197         true|define)
8198                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8199                 echo "See INSTALL for an explanation why that won't work." >&4
8200                 exit 4
8201                 ;;
8202         esac
8203         case "$libperl" in
8204         '')
8205                 # Figure out a good name for libperl.so.  Since it gets stored in
8206                 # a version-specific architecture-dependent library, the version
8207                 # number isn't really that important, except for making cc/ld happy.
8208                 #
8209                 # A name such as libperl.so.10.1
8210                 majmin="libperl.$so.$patchlevel.$subversion"
8211                 # A name such as libperl.so.100
8212                 majonly=`echo $patchlevel $subversion |
8213                         $awk '{printf "%d%02d", $1, $2}'`
8214                 majonly=libperl.$so.$majonly
8215                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8216                 # rely on figuring it out from the naming of libc.
8217                 case "${osname}${osvers}" in
8218                 next4*)
8219                         dflt=libperl.5.$so
8220                         # XXX How handle the --version stuff for MAB?
8221                         ;;
8222                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8223                         dflt=libperl.$so
8224                         ;;
8225                 cygwin*) # ld links now against the dll directly
8226                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8227                         majonly=`echo $patchlevel $subversion |
8228                                 $awk '{printf "%03d%03d", $1, $2}'`
8229                         majonly=cygperl5.$majonly.$so
8230                         dflt=$majmin
8231                         ;;
8232                 *)      # Try to guess based on whether libc has major.minor.
8233                         case "$libc" in
8234                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8235                         *libc.$so.[0-9]*) dflt=$majonly ;;
8236                         *)      dflt=libperl.$so ;;
8237                         esac
8238                         ;;
8239                 esac
8240                 ;;
8241         *)      dflt=$libperl
8242                 ;;
8243         esac
8244         cat << EOM
8245
8246 I need to select a good name for the shared libperl.  If your system uses
8247 library names with major and minor numbers, then you might want something
8248 like $majmin.  Alternatively, if your system uses a single version
8249 number for shared libraries, then you might want to use $majonly.
8250 Or, your system might be quite happy with a simple libperl.$so.
8251
8252 Since the shared libperl will get installed into a version-specific
8253 architecture-dependent directory, the version number of the shared perl
8254 library probably isn't important, so the default should be o.k.
8255
8256 EOM
8257         rp='What name do you want to give to the shared libperl?'
8258         . ./myread
8259         libperl=$ans
8260         echo "Ok, I'll use $libperl"
8261         ;;
8262 *)
8263         libperl="libperl${_a}"
8264         ;;
8265 esac
8266
8267 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8268 case "$shrpdir" in
8269 '') ;;
8270 *)      $cat >&4 <<EOM
8271 WARNING:  Use of the shrpdir variable for the installation location of
8272 the shared $libperl is not supported.  It was never documented and
8273 will not work in this version.  Let me (perlbug@perl.org)
8274 know of any problems this may cause.
8275
8276 EOM
8277         case "$shrpdir" in
8278         "$archlibexp/CORE")
8279                 $cat >&4 <<EOM
8280 But your current setting of $shrpdir is
8281 the default anyway, so it's harmless.
8282 EOM
8283                 ;;
8284         *)
8285                 $cat >&4 <<EOM
8286 Further, your current attempted setting of $shrpdir
8287 conflicts with the value of $archlibexp/CORE
8288 that installperl will use.
8289 EOM
8290                 ;;
8291         esac
8292         ;;
8293 esac
8294
8295 # How will the perl executable find the installed shared $libperl?
8296 # Add $xxx to ccdlflags.
8297 # If we can't figure out a command-line option, use $shrpenv to
8298 # set env LD_RUN_PATH.  The main perl makefile uses this.
8299 shrpdir=$archlibexp/CORE
8300 xxx=''
8301 tmp_shrpenv=''
8302 if "$useshrplib"; then
8303     case "$osname" in
8304         aix)
8305                 # We'll set it in Makefile.SH...
8306                 ;;
8307         solaris)
8308                 xxx="-R $shrpdir"
8309                 ;;
8310         freebsd|netbsd|openbsd|interix|dragonfly)
8311                 xxx="-Wl,-R$shrpdir"
8312                 ;;
8313         bsdos|linux|irix*|dec_osf|gnu*)
8314                 xxx="-Wl,-rpath,$shrpdir"
8315                 ;;
8316         next)
8317                 # next doesn't like the default...
8318                 ;;
8319         beos)
8320                 # beos doesn't like the default, either.
8321                 ;;
8322         haiku)
8323                 # Haiku doesn't like the default, either.
8324                 ;;
8325         hpux*)
8326                 # hpux doesn't like the default, either.
8327                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8328                 ;;
8329         cygwin)
8330                 # cygwin needs only ldlibpth
8331                 ;;
8332         *)
8333                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8334                 ;;
8335         esac
8336         case "$xxx" in
8337         '') ;;
8338         *)
8339                 # Only add $xxx if it isn't already in ccdlflags.
8340                 case " $ccdlflags " in
8341                 *" $xxx "*)     ;;
8342                 *)      ccdlflags="$ccdlflags $xxx"
8343                         cat <<EOM >&4
8344
8345 Adding $xxx to the flags
8346 passed to $ld so that the perl executable will find the
8347 installed shared $libperl.
8348
8349 EOM
8350                         ;;
8351                 esac
8352                 ;;
8353         esac
8354 fi
8355 # Fix ccdlflags in AIX for building external extensions.
8356 # (For building Perl itself bare -bE:perl.exp is needed,
8357 #  Makefile.SH takes care of this.)
8358 case "$osname" in
8359 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8360 esac
8361 # Respect a hint or command-line value.
8362 case "$shrpenv" in
8363 '') shrpenv="$tmp_shrpenv" ;;
8364 esac
8365 case "$ldlibpthname" in
8366 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8367 none)   ldlibpthname='' ;;
8368 esac
8369
8370 : determine where manual pages are on this system
8371 echo " "
8372 case "$sysman" in
8373 '') 
8374         syspath='/usr/share/man/man1 /usr/man/man1'
8375         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8376         syspath="$syspath /usr/man/u_man/man1"
8377         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8378         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8379         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8380         sysman=`./loc . /usr/man/man1 $syspath`
8381         ;;
8382 esac
8383 if $test -d "$sysman"; then
8384         echo "System manual is in $sysman." >&4
8385 else
8386         echo "Could not find manual pages in source form." >&4
8387 fi
8388
8389 : determine where manual pages go
8390 set man1dir man1dir none
8391 eval $prefixit
8392 $cat <<EOM
8393
8394 $spackage has manual pages available in source form.
8395 EOM
8396 case "$nroff" in
8397 nroff)
8398         echo "However, you don't have nroff, so they're probably useless to you."
8399         case "$man1dir" in
8400         '') man1dir="none";;
8401         esac;;
8402 esac
8403 echo "If you don't want the manual sources installed, answer 'none'."
8404 case "$man1dir" in
8405 ' ') dflt=none
8406         ;;
8407 '')
8408         lookpath="$prefixexp/share/man/man1"
8409         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8410         lookpath="$lookpath $prefixexp/man/p_man/man1"
8411         lookpath="$lookpath $prefixexp/man/u_man/man1"
8412         lookpath="$lookpath $prefixexp/man/man.1"
8413         case "$sysman" in
8414         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8415         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8416         esac
8417         set dflt
8418         eval $prefixup
8419         ;;
8420 *)  dflt="$man1dir"
8421         ;;
8422 esac
8423 echo " "
8424 fn=dn+~
8425 rp="Where do the main $spackage manual pages (source) go?"
8426 . ./getfile
8427 if $test "X$man1direxp" != "X$ansexp"; then
8428         installman1dir=''
8429 fi
8430 prefixvar=man1dir
8431 . ./setprefixvar
8432
8433 case "$man1dir" in
8434 '')     man1dir=' '
8435         installman1dir='';;
8436 esac
8437
8438 : What suffix to use on installed man pages
8439
8440 case "$man1dir" in
8441 ' ')
8442         man1ext='0'
8443         ;;
8444 *)
8445         rp="What suffix should be used for the main $spackage man pages?"
8446         case "$man1ext" in
8447         '')     case "$man1dir" in
8448                 *1)  dflt=1 ;;
8449                 *1p) dflt=1p ;;
8450                 *1pm) dflt=1pm ;;
8451                 *l) dflt=l;;
8452                 *n) dflt=n;;
8453                 *o) dflt=o;;
8454                 *p) dflt=p;;
8455                 *C) dflt=C;;
8456                 *L) dflt=L;;
8457                 *L1) dflt=L1;;
8458                 *) dflt=1;;
8459                 esac
8460                 ;;
8461         *)      dflt="$man1ext";;
8462         esac
8463         . ./myread
8464         man1ext="$ans"
8465         ;;
8466 esac
8467
8468 : see if we can have long filenames
8469 echo " "
8470 first=123456789abcdef
8471 $rm -f $first
8472 if (echo hi >$first) 2>/dev/null; then
8473         if $test -f 123456789abcde; then
8474                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8475                 val="$undef"
8476         else
8477                 echo 'You can have filenames longer than 14 characters.'>&4
8478                 val="$define"
8479         fi
8480 else
8481         $cat <<'EOM'
8482 You can't have filenames longer than 14 chars.
8483 You can't even think about them!
8484 EOM
8485         val="$undef"
8486 fi
8487 set d_flexfnam
8488 eval $setvar
8489 $rm -rf 123456789abcde*
8490
8491 : determine where library module manual pages go
8492 set man3dir man3dir none
8493 eval $prefixit
8494 $cat <<EOM
8495
8496 $spackage has manual pages for many of the library modules.
8497 EOM
8498
8499 case "$nroff" in
8500 nroff)
8501         $cat <<'EOM'
8502 However, you don't have nroff, so they're probably useless to you.
8503 EOM
8504         case "$man3dir" in
8505         '') man3dir="none";;
8506         esac;;
8507 esac
8508
8509 case "$d_flexfnam" in
8510 undef)
8511         $cat <<'EOM'
8512 However, your system can't handle the long file names like File::Basename.3.
8513 EOM
8514         case "$man3dir" in
8515         '') man3dir="none";;
8516         esac;;
8517 esac
8518
8519 echo "If you don't want the manual sources installed, answer 'none'."
8520 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8521 case "$man3dir" in
8522 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8523         if $test -d "$privlib/man/man3"; then
8524                 cat <<EOM >&4
8525
8526 WARNING:  Previous versions of perl installed man3 pages into
8527 $privlib/man/man3.  This version will suggest a
8528 new default of $dflt.
8529 EOM
8530                 tdflt=$dflt
8531                 dflt='n'
8532                 rp='Do you wish to preserve the old behavior?(y/n)'
8533                 . ./myread
8534                 case "$ans" in
8535                 y*) dflt="$privlib/man/man3" ;;
8536                 *)  dflt=$tdflt ;;
8537                 esac
8538     fi
8539         ;;
8540 *)      dflt="$man3dir" ;;
8541 esac
8542 case "$dflt" in
8543 ' ') dflt=none ;;
8544 esac
8545 echo " "
8546 fn=dn+~
8547 rp="Where do the $package library man pages (source) go?"
8548 . ./getfile
8549 prefixvar=man3dir
8550 . ./setprefixvar
8551
8552 case "$man3dir" in
8553 '')     man3dir=' '
8554         installman3dir='';;
8555 esac
8556
8557 : What suffix to use on installed man pages
8558 case "$man3dir" in
8559 ' ')
8560         man3ext='0'
8561         ;;
8562 *)
8563         rp="What suffix should be used for the $package library man pages?"
8564         case "$man3ext" in
8565         '')     case "$man3dir" in
8566                 *3)  dflt=3 ;;
8567                 *3p) dflt=3p ;;
8568                 *3pm) dflt=3pm ;;
8569                 *l) dflt=l;;
8570                 *n) dflt=n;;
8571                 *o) dflt=o;;
8572                 *p) dflt=p;;
8573                 *C) dflt=C;;
8574                 *L) dflt=L;;
8575                 *L3) dflt=L3;;
8576                 *) dflt=3;;
8577                 esac
8578                 ;;
8579         *)      dflt="$man3ext";;
8580         esac
8581         . ./myread
8582         man3ext="$ans"
8583         ;;
8584 esac
8585
8586 : see if we have to deal with yellow pages, now NIS.
8587 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8588         if $test -f /usr/etc/nibindd; then
8589                 echo " "
8590                 echo "I'm fairly confident you're on a NeXT."
8591                 echo " "
8592                 rp='Do you get the hosts file via NetInfo?'
8593                 dflt=y
8594                 case "$hostcat" in
8595                 nidump*) ;;
8596                 '') ;;
8597                 *) dflt=n;;
8598                 esac
8599                 . ./myread
8600                 case "$ans" in
8601                 y*) hostcat='nidump hosts .';;
8602                 *)      case "$hostcat" in
8603                         nidump*) hostcat='';;
8604                         esac
8605                         ;;
8606                 esac
8607         fi
8608         case "$hostcat" in
8609         nidump*) ;;
8610         *)
8611                 case "$hostcat" in
8612                 *ypcat*) dflt=y;;
8613                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8614                                 dflt=y
8615                         else
8616                                 dflt=n
8617                         fi;;
8618                 *) dflt=n;;
8619                 esac
8620                 echo " "
8621                 rp='Are you getting the hosts file via yellow pages?'
8622                 . ./myread
8623                 case "$ans" in
8624                 y*) hostcat='ypcat hosts';;
8625                 *) hostcat='cat /etc/hosts';;
8626                 esac
8627                 ;;
8628         esac
8629 fi
8630 case "$hostcat" in
8631 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8632 esac
8633 case "$groupcat" in
8634 '') test -f /etc/group && groupcat='cat /etc/group';;
8635 esac
8636 case "$passcat" in
8637 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8638 esac
8639
8640 : now get the host name
8641 echo " "
8642 echo "Figuring out host name..." >&4
8643 case "$myhostname" in
8644 '') cont=true
8645         echo 'Maybe "hostname" will work...'
8646         if tans=`sh -c hostname 2>&1` ; then
8647                 myhostname=$tans
8648                 phostname=hostname
8649                 cont=''
8650         fi
8651         ;;
8652 *) cont='';;
8653 esac
8654 if $test "$cont"; then
8655         if ./xenix; then
8656                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8657                 if tans=`cat /etc/systemid 2>&1` ; then
8658                         myhostname=$tans
8659                         phostname='cat /etc/systemid'
8660                         echo "Whadyaknow.  Xenix always was a bit strange..."
8661                         cont=''
8662                 fi
8663         elif $test -r /etc/systemid; then
8664                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8665         fi
8666 fi
8667 if $test "$cont"; then
8668         echo 'No, maybe "uuname -l" will work...'
8669         if tans=`sh -c 'uuname -l' 2>&1` ; then
8670                 myhostname=$tans
8671                 phostname='uuname -l'
8672         else
8673                 echo 'Strange.  Maybe "uname -n" will work...'
8674                 if tans=`sh -c 'uname -n' 2>&1` ; then
8675                         myhostname=$tans
8676                         phostname='uname -n'
8677                 else
8678                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8679                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8680                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8681                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8682                         else
8683                                 case "$myhostname" in
8684                                 '') echo "Does this machine have an identity crisis or something?"
8685                                         phostname='';;
8686                                 *)
8687                                         echo "Well, you said $myhostname before..."
8688                                         phostname='echo $myhostname';;
8689                                 esac
8690                         fi
8691                 fi
8692         fi
8693 fi
8694 case "$myhostname" in
8695 '') myhostname=noname ;;
8696 esac
8697 : you do not want to know about this
8698 set $myhostname
8699 myhostname=$1
8700
8701 : verify guess
8702 if $test "$myhostname" ; then
8703         dflt=y
8704         rp='Your host name appears to be "'$myhostname'".'" Right?"
8705         . ./myread
8706         case "$ans" in
8707         y*) ;;
8708         *) myhostname='';;
8709         esac
8710 fi
8711
8712 : bad guess or no guess
8713 while $test "X$myhostname" = X ; do
8714         dflt=''
8715         rp="Please type the (one word) name of your host:"
8716         . ./myread
8717         myhostname="$ans"
8718 done
8719
8720 : translate upper to lower if necessary
8721 case "$myhostname" in
8722 *[A-Z]*)
8723         echo "(Normalizing case in your host name)"
8724         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8725         ;;
8726 esac
8727
8728 case "$myhostname" in
8729 *.*)
8730         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8731         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8732         echo "(Trimming domain name from host name--host name is now $myhostname)"
8733         ;;
8734 *) case "$mydomain" in
8735         '')
8736                 {
8737                         test "X$hostcat" = "Xypcat hosts" &&
8738                         ypmatch "$myhostname" hosts 2>/dev/null |\
8739                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8740                         $test -s hosts
8741                 } || {
8742                         test "X$hostcat" != "X" &&
8743                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8744                                         /[       ]$myhostname[  . ]/p" > hosts
8745                 }
8746                 tmp_re="[       . ]"
8747                 if $test -f hosts; then
8748                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8749                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8750                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8751                                 hosts | $sort | $uniq | \
8752                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8753                         case `$echo X$dflt` in
8754                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8755                                 dflt=.
8756                                 ;;
8757                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8758                                 ;;
8759                         esac
8760                 else
8761                         echo "(I cannot locate a hosts database anywhere)"
8762                         dflt=.
8763                 fi
8764                 case "$dflt" in
8765                 .)
8766                         tans=`./loc resolv.conf X /etc /usr/etc`
8767                         if $test -f "$tans"; then
8768                                 echo "(Attempting domain name extraction from $tans)"
8769                                 dflt=.`$sed -n -e 's/   / /g' \
8770                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8771                                   -e 1q 2>/dev/null`
8772                                 case "$dflt" in
8773                                 .) dflt=.`$sed -n -e 's/        / /g' \
8774                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8775                                      -e 1q 2>/dev/null`
8776                                         ;;
8777                                 esac
8778                         fi
8779                         ;;
8780                 esac
8781                 case "$dflt" in
8782                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8783                         dflt=.`sh -c domainname 2>/dev/null`
8784                         case "$dflt" in
8785                         '') dflt='.';;
8786                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8787                         esac
8788                         ;;
8789                 esac
8790                 case "$dflt$osname" in
8791                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8792                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8793                         ;;
8794                 esac
8795                 case "$dflt" in
8796                 .) echo "(Lost all hope -- silly guess then)"
8797                         dflt='.nonet'
8798                         ;;
8799                 esac
8800                 $rm -f hosts
8801                 ;;
8802         *) dflt="$mydomain";;
8803         esac;;
8804 esac
8805 echo " "
8806 rp="What is your domain name?"
8807 . ./myread
8808 tans="$ans"
8809 case "$ans" in
8810 '') ;;
8811 .*) ;;
8812 *) tans=".$tans";;
8813 esac
8814 mydomain="$tans"
8815
8816 : translate upper to lower if necessary
8817 case "$mydomain" in
8818 *[A-Z]*)
8819         echo "(Normalizing case in your domain name)"
8820         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8821         ;;
8822 esac
8823
8824 : a little sanity check here
8825 case "$phostname" in
8826 '') ;;
8827 *)
8828         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8829         $myhostname$mydomain|$myhostname) ;;
8830         *)
8831                 case "$phostname" in
8832                 sed*)
8833                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8834                         ;;
8835                 *)
8836                         echo "(That doesn't agree with your $phostname command, by the way.)"
8837                         ;;
8838                 esac
8839         ;;
8840         esac
8841         ;;
8842 esac
8843
8844 : determine the e-mail address of the user who is running us
8845 $cat <<EOM
8846
8847 I need to get your e-mail address in Internet format if possible, i.e.
8848 something like user@host.domain. Please answer accurately since I have
8849 no easy means to double check it. The default value provided below
8850 is most probably close to reality but may not be valid from outside
8851 your organization...
8852
8853 EOM
8854 cont=x
8855 while test "$cont"; do
8856         case "$cf_email" in
8857         '') dflt="$cf_by@$myhostname$mydomain";;
8858         *) dflt="$cf_email";;
8859         esac
8860         rp='What is your e-mail address?'
8861         . ./myread
8862         cf_email="$ans"
8863         case "$cf_email" in
8864         *@*.*) cont='' ;;
8865         *)
8866                 rp='Address does not look like an Internet one.  Use it anyway?'
8867                 case "$fastread" in
8868                 yes) dflt=y ;;
8869                 *) dflt=n ;;
8870                 esac
8871                 . ./myread
8872                 case "$ans" in
8873                 y*) cont='' ;;
8874                 *) echo " " ;;
8875                 esac
8876                 ;;
8877         esac
8878 done
8879
8880 : Ask e-mail of administrator
8881 $cat <<EOM
8882
8883 If you or somebody else will be maintaining perl at your site, please
8884 fill in the correct e-mail address here so that they may be contacted
8885 if necessary. Currently, the "perlbug" program included with perl
8886 will send mail to this address in addition to perlbug@perl.org. You may
8887 enter "none" for no administrator.
8888
8889 EOM
8890 case "$perladmin" in
8891 '') dflt="$cf_email";;
8892 *) dflt="$perladmin";;
8893 esac
8894 rp='Perl administrator e-mail address'
8895 . ./myread
8896 perladmin="$ans"
8897
8898 : determine whether to only install version-specific parts.
8899 echo " "
8900 $cat <<EOM
8901 Do you want to install only the version-specific parts of the perl
8902 distribution?  Usually you do *not* want to do this.
8903 EOM
8904 case "$versiononly" in
8905 "$define"|[Yy]*|true) dflt='y' ;;
8906 *) dflt='n';
8907 esac
8908 rp="Do you want to install only the version-specific parts of perl?"
8909 . ./myread
8910 case "$ans" in
8911 [yY]*)  val="$define";;
8912 *)      val="$undef" ;;
8913 esac
8914 set versiononly
8915 eval $setvar
8916
8917 case "$versiononly" in
8918 "$define") inc_version_list=''
8919            inc_version_list_init=0
8920            ;;
8921 esac
8922
8923 : figure out how to guarantee perl startup
8924 : XXX Note that this currently takes advantage of the bug that binexp ignores
8925 :     the Configure -Dinstallprefix setting, which in turn means that under
8926 :     relocatable @INC, initialinstalllocation is what binexp started as.
8927 case "$startperl" in
8928 '')
8929         case "$sharpbang" in
8930         *!)
8931                 $cat <<EOH
8932
8933 I can use the #! construct to start perl on your system. This will
8934 make startup of perl scripts faster, but may cause problems if you
8935 want to share those scripts and perl is not in a standard place
8936 ($initialinstalllocation/perl) on all your platforms. The alternative
8937 is to force a shell by starting the script with a single ':' character.
8938
8939 EOH
8940                 case "$versiononly" in
8941                 "$define")      dflt="$initialinstalllocation/perl$version";;
8942                 *)              dflt="$initialinstalllocation/perl";;
8943                 esac
8944                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8945                 . ./myread
8946                 case "$ans" in
8947                 none)   startperl=": # use perl";;
8948                 *)      startperl="#!$ans"
8949                         if $test 30 -lt `echo "$ans" | wc -c`; then
8950                                 $cat >&4 <<EOM
8951
8952 WARNING:  Some systems limit the #! command to 32 characters.
8953 If you experience difficulty running Perl scripts with #!, try
8954 installing Perl in a directory with a shorter pathname.
8955
8956 EOM
8957                         fi ;;
8958                 esac
8959                 ;;
8960         *) startperl=": # use perl"
8961                 ;;
8962         esac
8963         ;;
8964 esac
8965 echo "I'll use $startperl to start perl scripts."
8966
8967 : figure best path for perl in scripts
8968 case "$perlpath" in
8969 '')
8970         case "$versiononly" in
8971         "$define")      perlpath="$initialinstalllocation/perl$version";;
8972         *)              perlpath="$initialinstalllocation/perl";;
8973         esac
8974         case "$startperl" in
8975         *!*) ;;
8976         *)
8977                 $cat <<EOH
8978
8979 I will use the "eval 'exec'" idiom to start Perl on your system.
8980 I can use the full path of your Perl binary for this purpose, but
8981 doing so may cause problems if you want to share those scripts and
8982 Perl is not always in a standard place ($initialinstalllocation/perl).
8983
8984 EOH
8985                 dflt="$initialinstalllocation/perl"
8986                 rp="What path shall I use in \"eval 'exec'\"?"
8987                 . ./myread
8988                 perlpath="$ans"
8989                 ;;
8990         esac
8991         ;;
8992 esac
8993 case "$startperl" in
8994 *!*)    ;;
8995 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8996 esac
8997
8998 : determine where public executable scripts go
8999 set scriptdir scriptdir
9000 eval $prefixit
9001 case "$scriptdir" in
9002 '')
9003         dflt="$bin"
9004         : guess some guesses
9005         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9006         $test -d /usr/share/bin     && dflt=/usr/share/bin
9007         $test -d /usr/local/script  && dflt=/usr/local/script
9008         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9009         $test -d $prefixexp/script  && dflt=$prefixexp/script
9010         set dflt
9011         eval $prefixup
9012         ;;
9013 *)  dflt="$scriptdir"
9014         ;;
9015 esac
9016 $cat <<EOM
9017
9018 Some installations have a separate directory just for executable scripts so
9019 that they can mount it across multiple architectures but keep the scripts in
9020 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9021 Or you might just lump your scripts in with all your other executables.
9022
9023 EOM
9024 fn=d~
9025 rp='Where do you keep publicly executable scripts?'
9026 . ./getfile
9027 if $test "X$ansexp" != "X$scriptdirexp"; then
9028         installscript=''
9029 fi
9030 installscriptdir=''
9031 prefixvar=scriptdir
9032 . ./setprefixvar
9033 : A little fix up for an irregularly named variable.
9034 installscript="$installscriptdir"
9035
9036 : determine where add-on public executables go
9037 case "$sitebin" in
9038 '')     dflt=$siteprefix/bin ;;
9039 *)      dflt=$sitebin ;;
9040 esac
9041 fn=d~
9042 rp='Pathname where the add-on public executables should be installed?'
9043 . ./getfile
9044 prefixvar=sitebin
9045 . ./setprefixvar
9046
9047 : determine where add-on html pages go
9048 : There is no standard location, so try to copy the previously-selected
9049 : directory structure for the core html pages.
9050 case "$sitehtml1dir" in
9051 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9052 *)     dflt=$sitehtml1dir ;;
9053 esac
9054 case "$dflt" in
9055 ''|' ') dflt=none ;;
9056 esac
9057 fn=dn+~
9058 rp='Pathname where the site-specific html pages should be installed?'
9059 . ./getfile
9060 prefixvar=sitehtml1dir
9061 . ./setprefixvar
9062
9063 : determine where add-on library html pages go
9064 : There is no standard location, so try to copy the previously-selected
9065 : directory structure for the core html pages.
9066 case "$sitehtml3dir" in
9067 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9068 *)     dflt=$sitehtml3dir ;;
9069 esac
9070 case "$dflt" in
9071 ''|' ') dflt=none ;;
9072 esac
9073 fn=dn+~
9074 rp='Pathname where the site-specific library html pages should be installed?'
9075 . ./getfile
9076 prefixvar=sitehtml3dir
9077 . ./setprefixvar
9078
9079 : determine where add-on manual pages go
9080 case "$siteman1dir" in
9081 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9082 *)      dflt=$siteman1dir ;;
9083 esac
9084 case "$dflt" in
9085 ''|' ') dflt=none ;;
9086 esac
9087 fn=dn+~
9088 rp='Pathname where the site-specific manual pages should be installed?'
9089 . ./getfile
9090 prefixvar=siteman1dir
9091 . ./setprefixvar
9092
9093 : determine where add-on library man pages go
9094 case "$siteman3dir" in
9095 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9096 *)      dflt=$siteman3dir ;;
9097 esac
9098 case "$dflt" in
9099 ''|' ') dflt=none ;;
9100 esac
9101 fn=dn+~
9102 rp='Pathname where the site-specific library manual pages should be installed?'
9103 . ./getfile
9104 prefixvar=siteman3dir
9105 . ./setprefixvar
9106
9107 : determine where add-on public executable scripts go
9108 case "$sitescript" in
9109 '')     dflt=$siteprefix/script
9110         $test -d $dflt || dflt=$sitebin ;;
9111 *)  dflt="$sitescript" ;;
9112 esac
9113 fn=d~+
9114 rp='Pathname where add-on public executable scripts should be installed?'
9115 . ./getfile
9116 prefixvar=sitescript
9117 . ./setprefixvar
9118
9119 : Check if faststdio is requested and available
9120 case "$usefaststdio" in
9121 $define|true|[yY]*|'')
9122         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9123         case "$xversion" in
9124         [68])   dflt='y' ;;
9125         *)      dflt='n' ;;
9126         esac
9127         ;;
9128 *) dflt='n';;
9129 esac
9130 cat <<EOM
9131
9132 Perl can be built to use 'fast stdio', which means using the stdio
9133 library but also directly manipulating the stdio buffers to enable
9134 faster I/O.  Using stdio is better for backward compatibility (especially
9135 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9136 interface has been preferred instead of stdio.
9137
9138 If this doesn't make any sense to you, just accept the default '$dflt'.
9139 EOM
9140 rp='Use the "fast stdio" if available?'
9141 . ./myread
9142 case "$ans" in
9143 y|Y)    val="$define" ;;
9144 *)      val="$undef" ;;
9145 esac
9146 set usefaststdio
9147 eval $setvar
9148
9149
9150 : define an is-a-typedef? function
9151 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9152 case "$inclist" in
9153 "") inclist="sys/types.h";;
9154 esac;
9155 eval "varval=\$$var";
9156 case "$varval" in
9157 "")
9158         $rm -f temp.c;
9159         for inc in $inclist; do
9160                 echo "#include <$inc>" >>temp.c;
9161         done;
9162         echo "#ifdef $type" >> temp.c;
9163         echo "printf(\"We have $type\");" >> temp.c;
9164         echo "#endif" >> temp.c;
9165         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9166         if $contains $type temp.E >/dev/null 2>&1; then
9167                 eval "$var=\$type";
9168         else
9169                 eval "$var=\$def";
9170         fi;
9171         $rm -f temp.?;;
9172 *) eval "$var=\$varval";;
9173 esac'
9174
9175 : define an is-a-typedef? function that prompts if the type is not available.
9176 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9177 case "$inclist" in
9178 "") inclist="sys/types.h";;
9179 esac;
9180 eval "varval=\$$var";
9181 case "$varval" in
9182 "")
9183         $rm -f temp.c;
9184         for inc in $inclist; do
9185                 echo "#include <$inc>" >>temp.c;
9186         done;
9187         echo "#ifdef $type" >> temp.c;
9188         echo "printf(\"We have $type\");" >> temp.c;
9189         echo "#endif" >> temp.c;
9190         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9191         echo " " ;
9192         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9193         if $contains $type temp.E >/dev/null 2>&1; then
9194                 echo "$type found." >&4;
9195                 eval "$var=\$type";
9196         else
9197                 echo "$type NOT found." >&4;
9198                 dflt="$def";
9199                 . ./myread ;
9200                 eval "$var=\$ans";
9201         fi;
9202         $rm -f temp.?;;
9203 *) eval "$var=\$varval";;
9204 esac'
9205
9206 : see what type lseek is declared as in the kernel
9207 rp="What is the type used for lseek's offset on this system?"
9208 set off_t lseektype long stdio.h sys/types.h
9209 eval $typedef_ask
9210
9211 echo " "
9212 echo "Checking to see how big your file offsets are..." >&4
9213 $cat >try.c <<EOCP
9214 #include <sys/types.h>
9215 #include <stdio.h>
9216 int main()
9217 {
9218     printf("%d\n", (int)sizeof($lseektype));
9219     return(0);
9220 }
9221 EOCP
9222 set try
9223 if eval $compile_ok; then
9224         lseeksize=`$run ./try`
9225         echo "Your file offsets are $lseeksize bytes long."
9226 else
9227         dflt=$longsize
9228         echo " "
9229         echo "(I can't seem to compile the test program.  Guessing...)"
9230         rp="What is the size of your file offsets (in bytes)?"
9231         . ./myread
9232         lseeksize="$ans"
9233 fi
9234 $rm_try
9235
9236 : see what type file positions are declared as in the library
9237 rp="What is the type for file position used by fsetpos()?"
9238 set fpos_t fpostype long stdio.h sys/types.h
9239 eval $typedef_ask
9240
9241 : Check size for Fpos_t
9242 echo " "
9243 case "$fpostype" in
9244 *_t) zzz="$fpostype"    ;;
9245 *)   zzz="fpos_t"       ;;
9246 esac
9247 echo "Checking the size of $zzz..." >&4
9248 cat > try.c <<EOCP
9249 #include <sys/types.h>
9250 #include <stdio.h>
9251 #$i_stdlib I_STDLIB
9252 #ifdef I_STDLIB
9253 #include <stdlib.h>
9254 #endif
9255 int main() {
9256     printf("%d\n", (int)sizeof($fpostype));
9257     exit(0);
9258 }
9259 EOCP
9260 set try
9261 if eval $compile_ok; then
9262         yyy=`$run ./try`
9263         case "$yyy" in
9264         '')     fpossize=4
9265                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9266                 ;;
9267         *)      fpossize=$yyy
9268                 echo "Your $zzz is $fpossize bytes long."
9269                 ;;
9270         esac
9271 else
9272         dflt="$longsize"
9273         echo " " >&4
9274         echo "(I can't compile the test program.  Guessing...)" >&4
9275         rp="What is the size of your file positions (in bytes)?"
9276         . ./myread
9277         fpossize="$ans"
9278 fi
9279
9280 : Check for large file support
9281 # Backward compatibility (uselfs is deprecated).
9282 case "$uselfs" in
9283 "$define"|true|[yY]*)
9284         cat <<EOM >&4
9285
9286 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9287 EOM
9288         uselargefiles="$define"
9289         ;;
9290 esac
9291
9292 case "$lseeksize:$fpossize" in
9293 8:8) cat <<EOM
9294
9295 You can have files larger than 2 gigabytes.
9296 EOM
9297    val="$define" ;;
9298 *)    case "$uselargefiles" in
9299    "$undef"|false|[nN]*) dflt='n' ;;
9300    *)   dflt='y' ;;
9301    esac
9302    cat <<EOM
9303
9304 Perl can be built to understand large files (files larger than 2 gigabytes)
9305 on some systems.  To do so, Configure can be run with -Duselargefiles.
9306
9307 If this doesn't make any sense to you, just accept the default '$dflt'.
9308 EOM
9309    rp='Try to understand large files, if available?'
9310    . ./myread
9311    case "$ans" in
9312    y|Y)         val="$define" ;;
9313    *)           val="$undef"  ;;
9314    esac
9315    ;;
9316 esac
9317 set uselargefiles
9318 eval $setvar
9319 : Look for a hint-file generated 'call-back-unit'.  If the
9320 : user has specified that a large files perl is to be built,
9321 : we may need to set or change some other defaults.
9322 if $test -f uselargefiles.cbu; then
9323         echo "Your platform has some specific hints regarding large file builds, using them..."
9324         . ./uselargefiles.cbu
9325 fi
9326 case "$uselargefiles" in
9327 "$define")
9328         if $test -f uselargefiles.cbu; then
9329                 echo " "
9330                 echo "Rechecking to see how big your file offsets are..." >&4
9331                 $cat >try.c <<EOCP
9332 #include <sys/types.h>
9333 #include <stdio.h>
9334 int main()
9335 {
9336     printf("%d\n", (int)sizeof($lseektype));
9337     return(0);
9338 }
9339 EOCP
9340                 set try
9341                 if eval $compile_ok; then
9342                         lseeksize=`$run ./try`
9343                         $echo "Your file offsets are now $lseeksize bytes long."
9344                 else
9345                         dflt="$lseeksize"
9346                         echo " "
9347                         echo "(I can't seem to compile the test program.  Guessing...)"
9348                         rp="What is the size of your file offsets (in bytes)?"
9349                         . ./myread
9350                         lseeksize="$ans"
9351                 fi
9352                 case "$fpostype" in
9353                 *_t) zzz="$fpostype"    ;;
9354                 *)   zzz="fpos_t"       ;;
9355                 esac
9356                 $echo $n "Rechecking the size of $zzz...$c" >&4
9357                 $cat > try.c <<EOCP
9358 #include <sys/types.h>
9359 #include <stdio.h>
9360 #$i_stdlib I_STDLIB
9361 #ifdef I_STDLIB
9362 #include <stdlib.h>
9363 #endif
9364 int main() {
9365     printf("%d\n", (int)sizeof($fpostype));
9366     return(0);
9367 }
9368 EOCP
9369                 set try
9370                 if eval $compile_ok; then
9371                         yyy=`$run ./try`
9372                         dflt="$lseeksize"
9373                         case "$yyy" in
9374                         '')     echo " "
9375                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9376                                 ;;
9377                         *)      fpossize=$yyy
9378                                 echo " $fpossize bytes." >&4
9379                                 ;;
9380                         esac
9381                 else
9382                         dflt="$fpossize"
9383                         echo " "
9384                         echo "(I can't compile the test program.  Guessing...)" >&4
9385                         rp="What is the size of your file positions (in bytes)?"
9386                         . ./myread
9387                         fpossize="$ans"
9388                 fi
9389                 $rm_try
9390         fi
9391         ;;
9392 esac
9393
9394 : Set the vendorbin variables
9395 case "$vendorprefix" in
9396 '')     d_vendorbin="$undef"
9397         vendorbin=''
9398         vendorbinexp=''
9399         ;;
9400 *)      d_vendorbin="$define"
9401         : determine where vendor-supplied executables go.
9402         case "$vendorbin" in
9403         '') dflt=$vendorprefix/bin ;;
9404         *)      dflt="$vendorbin" ;;
9405         esac
9406         fn=d~+
9407         rp='Pathname for the vendor-supplied executables directory?'
9408         . ./getfile
9409         vendorbin="$ans"
9410         vendorbinexp="$ansexp"
9411         ;;
9412 esac
9413 prefixvar=vendorbin
9414 . ./installprefix
9415
9416 : Set the vendorhtml1dir variables
9417 case "$vendorprefix" in
9418 '')     vendorhtml1dir=''
9419         vendorhtml1direxp=''
9420         ;;
9421 *)      : determine where vendor-supplied html pages go.
9422         : There is no standard location, so try to copy the previously-selected
9423         : directory structure for the core html pages.
9424         : XXX Better default suggestions would be welcome.
9425         case "$vendorhtml1dir" in
9426         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9427         *)      dflt=$vendorhtml1dir ;;
9428         esac
9429         case "$dflt" in
9430         ''|' ') dflt=none ;;
9431         esac
9432         fn=dn+~
9433         rp='Pathname for the vendor-supplied html pages?'
9434         . ./getfile
9435         vendorhtml1dir="$ans"
9436         vendorhtml1direxp="$ansexp"
9437         ;;
9438 esac
9439 : Use ' ' for none so value is preserved next time through Configure
9440 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9441 prefixvar=vendorhtml1dir
9442 . ./installprefix
9443
9444 : Set the vendorhtml3dir variables
9445 case "$vendorprefix" in
9446 '')     vendorhtml3dir=''
9447         vendorhtml3direxp=''
9448         ;;
9449 *)      : determine where vendor-supplied module html pages go.
9450         : There is no standard location, so try to copy the previously-selected
9451         : directory structure for the core html pages.
9452         : XXX Better default suggestions would be welcome.
9453         case "$vendorhtml3dir" in
9454         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9455         *)      dflt=$vendorhtml3dir ;;
9456         esac
9457         case "$dflt" in
9458         ''|' ') dflt=none ;;
9459         esac
9460         fn=dn+~
9461         rp='Pathname for the vendor-supplied html pages?'
9462         . ./getfile
9463         vendorhtml3dir="$ans"
9464         vendorhtml3direxp="$ansexp"
9465         ;;
9466 esac
9467 : Use ' ' for none so value is preserved next time through Configure
9468 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9469 prefixvar=vendorhtml3dir
9470 . ./installprefix
9471
9472 : Set the vendorman1dir variables
9473 case "$vendorprefix" in
9474 '')     vendorman1dir=''
9475         vendorman1direxp=''
9476         ;;
9477 *)      : determine where vendor-supplied manual pages go.
9478         case "$vendorman1dir" in
9479         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9480         *)      dflt=$vendorman1dir ;;
9481         esac
9482         case "$dflt" in
9483         ''|' ') dflt=none ;;
9484         esac
9485         fn=nd~+
9486         rp='Pathname for the vendor-supplied manual section 1 pages?'
9487         . ./getfile
9488         vendorman1dir="$ans"
9489         vendorman1direxp="$ansexp"
9490         ;;
9491 esac
9492 : Use ' ' for none so value is preserved next time through Configure
9493 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9494 prefixvar=vendorman1dir
9495 . ./installprefix
9496
9497 : Set the vendorman3dir variables
9498 case "$vendorprefix" in
9499 '')     vendorman3dir=''
9500         vendorman3direxp=''
9501         ;;
9502 *)      : determine where vendor-supplied module manual pages go.
9503         case "$vendorman3dir" in
9504         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9505         *)      dflt=$vendorman3dir ;;
9506         esac
9507         case "$dflt" in
9508         ''|' ') dflt=none ;;
9509         esac
9510         fn=nd~+
9511         rp='Pathname for the vendor-supplied manual section 3 pages?'
9512         . ./getfile
9513         vendorman3dir="$ans"
9514         vendorman3direxp="$ansexp"
9515         ;;
9516 esac
9517 : Use ' ' for none so value is preserved next time through Configure
9518 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9519 prefixvar=vendorman3dir
9520 . ./installprefix
9521
9522 : Set the vendorscript variables
9523 case "$vendorprefix" in
9524 '')     d_vendorscript="$undef"
9525         vendorscript=''
9526         vendorscriptexp=''
9527         ;;
9528 *)      d_vendorscript="$define"
9529         : determine where vendor-supplied scripts go.
9530         case "$vendorscript" in
9531         '')     dflt=$vendorprefix/script
9532                 $test -d $dflt || dflt=$vendorbin ;;
9533         *)  dflt="$vendorscript" ;;
9534         esac
9535         $cat <<EOM
9536
9537 The installation process will create a directory for
9538 vendor-supplied scripts.
9539
9540 EOM
9541         fn=d~+
9542         rp='Pathname for the vendor-supplied scripts directory?'
9543         . ./getfile
9544         vendorscript="$ans"
9545         vendorscriptexp="$ansexp"
9546         ;;
9547 esac
9548 prefixvar=vendorscript
9549 . ./installprefix
9550
9551 : script used to emit important warnings
9552 cat >warn <<EOS
9553 $startsh
9554 if test \$# -gt 0; then
9555         echo "\$@" >msg
9556 else
9557         cat >msg
9558 fi
9559 echo "*** WARNING:" >&4
9560 sed -e 's/^/*** /' <msg >&4
9561 echo "*** " >&4
9562 cat msg >>config.msg
9563 echo " " >>config.msg
9564 rm -f msg
9565 EOS
9566 chmod +x warn
9567 $eunicefix warn
9568
9569 : see which of string.h or strings.h is needed
9570 echo " "
9571 strings=`./findhdr string.h`
9572 if $test "$strings" && $test -r "$strings"; then
9573         echo "Using <string.h> instead of <strings.h>." >&4
9574         val="$define"
9575 else
9576         val="$undef"
9577         strings=`./findhdr strings.h`
9578         if $test "$strings" && $test -r "$strings"; then
9579                 echo "Using <strings.h> instead of <string.h>." >&4
9580         else
9581                 ./warn "No string header found -- You'll surely have problems."
9582         fi
9583 fi
9584 set i_string
9585 eval $setvar
9586 case "$i_string" in
9587 "$undef") strings=`./findhdr strings.h`;;
9588 *)        strings=`./findhdr string.h`;;
9589 esac
9590
9591 : see if qgcvt exists
9592 set qgcvt d_qgcvt
9593 eval $inlibc
9594
9595 : Check print/scan long double stuff
9596 echo " "
9597
9598 if $test X"$d_longdbl" = X"$define"; then
9599
9600 echo "Checking how to print long doubles..." >&4
9601
9602 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9603         $cat >try.c <<'EOCP'
9604 #include <sys/types.h>
9605 #include <stdio.h>
9606 int main() {
9607   double d = 123.456;
9608   printf("%.3f\n", d);
9609 }
9610 EOCP
9611         set try
9612         if eval $compile; then
9613                 yyy=`$run ./try`
9614                 case "$yyy" in
9615                 123.456)
9616                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9617                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9618                         echo "We will use %f."
9619                         ;;
9620                 esac
9621         fi
9622 fi
9623
9624 if $test X"$sPRIfldbl" = X; then
9625         $cat >try.c <<'EOCP'
9626 #include <sys/types.h>
9627 #include <stdio.h>
9628 int main() {
9629   long double d = 123.456;
9630   printf("%.3Lf\n", d);
9631 }
9632 EOCP
9633         set try
9634         if eval $compile; then
9635                 yyy=`$run ./try`
9636                 case "$yyy" in
9637                 123.456)
9638                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9639                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9640                         echo "We will use %Lf."
9641                         ;;
9642                 esac
9643         fi
9644 fi
9645
9646 if $test X"$sPRIfldbl" = X; then
9647         $cat >try.c <<'EOCP'
9648 #include <sys/types.h>
9649 #include <stdio.h>
9650 int main() {
9651   long double d = 123.456;
9652   printf("%.3llf\n", d);
9653 }
9654 EOCP
9655         set try
9656         if eval $compile; then
9657                 yyy=`$run ./try`
9658                 case "$yyy" in
9659                 123.456)
9660                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9661                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9662                         echo "We will use %llf."
9663                         ;;
9664                 esac
9665         fi
9666 fi
9667
9668 if $test X"$sPRIfldbl" = X; then
9669         $cat >try.c <<'EOCP'
9670 #include <sys/types.h>
9671 #include <stdio.h>
9672 int main() {
9673   long double d = 123.456;
9674   printf("%.3lf\n", d);
9675 }
9676 EOCP
9677         set try
9678         if eval $compile; then
9679                 yyy=`$run ./try`
9680                 case "$yyy" in
9681                 123.456)
9682                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9683                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9684                         echo "We will use %lf."
9685                         ;;
9686                 esac
9687         fi
9688 fi
9689
9690 if $test X"$sPRIfldbl" = X; then
9691         echo "Cannot figure out how to print long doubles." >&4
9692 else
9693         sSCNfldbl=$sPRIfldbl    # expect consistency
9694 fi
9695
9696 $rm_try
9697
9698 fi # d_longdbl
9699
9700 case "$sPRIfldbl" in
9701 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9702         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9703         d_SCNfldbl="$undef";
9704         ;;
9705 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9706         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9707         d_SCNfldbl="$define";
9708         ;;
9709 esac
9710
9711 : Check how to convert floats to strings.
9712
9713 if test "X$d_Gconvert" = X; then
9714
9715 echo " "
9716 echo "Checking for an efficient way to convert floats to strings."
9717 echo " " > try.c
9718 case "$uselongdouble" in
9719 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9720 esac
9721 case "$d_longdbl" in
9722 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9723 esac
9724 case "$d_PRIgldbl" in
9725 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9726 esac
9727 $cat >>try.c <<EOP
9728 #ifdef TRY_gconvert
9729 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9730 char *myname = "gconvert";
9731 #endif
9732 #ifdef TRY_gcvt
9733 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9734 char *myname = "gcvt";
9735 #endif
9736 #ifdef TRY_qgcvt
9737 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9738 char *myname = "qgcvt";
9739 #define DOUBLETYPE long double
9740 #endif
9741 #ifdef TRY_sprintf
9742 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9743 #ifdef HAS_PRIgldbl
9744 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9745 #else
9746 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9747 #endif
9748 #else
9749 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9750 #endif
9751 char *myname = "sprintf";
9752 #endif
9753
9754 #ifndef DOUBLETYPE
9755 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9756 #define DOUBLETYPE long double
9757 #else
9758 #define DOUBLETYPE double
9759 #endif
9760 #endif
9761
9762 #include <stdio.h>
9763
9764 #$i_stdlib I_STDLIB
9765 #ifdef I_STDLIB
9766 #include <stdlib.h>
9767 #endif
9768 #$i_string I_STRING
9769 #ifdef I_STRING
9770 #  include <string.h>
9771 #else
9772 #  include <strings.h>
9773 #endif
9774
9775 int checkit(char *expect, char *got)
9776 {
9777     if (strcmp(expect, got)) {
9778                 printf("%s oddity:  Expected %s, got %s\n",
9779                         myname, expect, got);
9780                 exit(1);
9781         }
9782 }
9783
9784 int main()
9785 {
9786         char buf[64];
9787         buf[63] = '\0';
9788
9789         /* This must be 1st test on (which?) platform */
9790         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9791         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9792         checkit("0.1", buf);
9793
9794         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9795         checkit("0.01", buf);
9796
9797         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9798         checkit("0.001", buf);
9799
9800         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9801         checkit("0.0001", buf);
9802
9803         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9804         if (strlen(buf) > 5)
9805             checkit("9e-005", buf); /* for Microsoft ?? */
9806         else
9807             checkit("9e-05", buf);
9808
9809         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9810         checkit("1", buf);
9811
9812         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9813         checkit("1.1", buf);
9814
9815         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9816         checkit("1.01", buf);
9817
9818         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9819         checkit("1.001", buf);
9820
9821         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9822         checkit("1.0001", buf);
9823
9824         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9825         checkit("1.00001", buf);
9826
9827         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9828         checkit("1.000001", buf);
9829
9830         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9831         checkit("0", buf);
9832
9833         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9834         checkit("-1", buf);
9835
9836         /* Some Linux gcvt's give 1.e+5 here. */
9837         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9838         checkit("100000", buf);
9839
9840         /* Some Linux gcvt's give -1.e+5 here. */
9841         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9842         checkit("-100000", buf);
9843
9844         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9845         checkit("123.456", buf);
9846
9847         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9848         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9849         /* 34 should be enough to scare even long double
9850          * places into using the e notation. */
9851         if (strlen(buf) > 5)
9852             checkit("1e+034", buf); /* for Microsoft */
9853         else
9854             checkit("1e+34", buf);
9855
9856         /* For Perl, if you add additional tests here, also add them to
9857          * t/base/num.t for benefit of platforms not using Configure or
9858          * overriding d_Gconvert */
9859
9860         exit(0);
9861 }
9862 EOP
9863 : first add preferred functions to our list
9864 xxx_list=""
9865 for xxx_convert in $gconvert_preference; do
9866     case $xxx_convert in
9867     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9868     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9869     esac
9870 done
9871 : then add any others
9872 for xxx_convert in gconvert gcvt sprintf; do
9873     case "$xxx_list" in
9874     *$xxx_convert*) ;;
9875     *) xxx_list="$xxx_list $xxx_convert" ;;
9876     esac
9877 done
9878
9879 case "$d_longdbl$uselongdouble" in
9880 "$define$define")
9881     : again, add prefered functions to our list first
9882     xxx_ld_list=""
9883     for xxx_convert in $gconvert_ld_preference; do
9884         case $xxx_convert in
9885         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9886         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9887         esac
9888     done
9889     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9890     for xxx_convert in qgcvt sprintf $xxx_list; do
9891         case "$xxx_ld_list" in
9892         $xxx_convert*|*" $xxx_convert"*) ;;
9893         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9894         esac
9895     done
9896     : if sprintf cannot do long doubles, move it to the end
9897     if test "$d_PRIgldbl" != "$define"; then
9898         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9899     fi
9900     : if no qgcvt, remove it
9901     if test "$d_qgcvt" != "$define"; then
9902         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9903     fi
9904     : use the ld_list
9905     xxx_list="$xxx_ld_list"
9906     ;;
9907 esac
9908
9909 for xxx_convert in $xxx_list; do
9910         echo "Trying $xxx_convert..."
9911         $rm -f try try$_o core
9912         set try -DTRY_$xxx_convert
9913         if eval $compile; then
9914                 echo "$xxx_convert() found." >&4
9915                 if $run ./try; then
9916                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9917                         break;
9918                 else
9919                         echo "...But $xxx_convert didn't work as I expected."
9920                         xxx_convert=''
9921                 fi
9922         else
9923                 echo "$xxx_convert NOT found." >&4
9924         fi
9925 done
9926
9927 if test X$xxx_convert = X; then
9928     echo "*** WHOA THERE!!! ***" >&4
9929     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9930     xxx_convert=sprintf
9931 fi
9932
9933 case "$xxx_convert" in
9934 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9935 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9936 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9937 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9938    "$define$define$define")
9939       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9940    "$define$define$undef")
9941       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9942    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9943    esac
9944    ;;
9945 esac
9946
9947 fi
9948 $rm_try
9949
9950 : see if _fwalk exists
9951 set fwalk d__fwalk
9952 eval $inlibc
9953
9954 : Initialize h_fcntl
9955 h_fcntl=false
9956
9957 : Initialize h_sysfile
9958 h_sysfile=false
9959
9960 : access call always available on UNIX
9961 set access d_access
9962 eval $inlibc
9963
9964 : locate the flags for 'access()'
9965 case "$d_access" in
9966 "$define")
9967         echo " "
9968         $cat >access.c <<EOCP
9969 #include <sys/types.h>
9970 #ifdef I_FCNTL
9971 #include <fcntl.h>
9972 #endif
9973 #ifdef I_SYS_FILE
9974 #include <sys/file.h>
9975 #endif
9976 #ifdef I_UNISTD
9977 #include <unistd.h>
9978 #endif
9979 #$i_stdlib I_STDLIB
9980 #ifdef I_STDLIB
9981 #include <stdlib.h>
9982 #endif
9983 int main() {
9984         exit(R_OK);
9985 }
9986 EOCP
9987         : check sys/file.h first, no particular reason here
9988         if $test `./findhdr sys/file.h` && \
9989                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9990                 h_sysfile=true;
9991                 echo "<sys/file.h> defines the *_OK access constants." >&4
9992         elif $test `./findhdr fcntl.h` && \
9993                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9994                 h_fcntl=true;
9995                 echo "<fcntl.h> defines the *_OK access constants." >&4
9996         elif $test `./findhdr unistd.h` && \
9997                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9998                 echo "<unistd.h> defines the *_OK access constants." >&4
9999         else
10000                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10001         fi
10002         ;;
10003 esac
10004 $rm -f access*
10005
10006 : see if accessx exists
10007 set accessx d_accessx
10008 eval $inlibc
10009
10010 : see if aintl exists
10011 set aintl d_aintl
10012 eval $inlibc
10013
10014 : see if alarm exists
10015 set alarm d_alarm
10016 eval $inlibc
10017
10018 : see if 64bit time functions exists
10019
10020 set ctime64 d_ctime64
10021 eval $inlibc
10022
10023 set localtime64 d_localtime64
10024 eval $inlibc
10025
10026 set gmtime64 d_gmtime64
10027 eval $inlibc
10028
10029 set mktime64 d_mktime64
10030 eval $inlibc
10031
10032 set difftime64 d_difftime64
10033 eval $inlibc
10034
10035 set asctime64 d_asctime64
10036 eval $inlibc
10037
10038 : see if POSIX threads are available
10039 set pthread.h i_pthread
10040 eval $inhdr
10041
10042 : define a fucntion to check prototypes
10043 $cat > protochk <<EOSH
10044 $startsh
10045 cc="$cc"
10046 optimize="$optimize"
10047 ccflags="$ccflags"
10048 prototype="$prototype"
10049 define="$define"
10050 rm_try="$rm_try"
10051 usethreads=$usethreads
10052 i_pthread=$i_pthread
10053 pthread_h_first=$pthread_h_first
10054 EOSH
10055
10056 $cat >> protochk <<'EOSH'
10057
10058 $rm_try
10059 foo="$1"
10060 shift
10061 while test $# -ge 2; do
10062         case "$1" in
10063                 $define) echo "#include <$2>" >> try.c ;;
10064                 literal) echo "$2" >> try.c ;;
10065         esac
10066     # Extra magic for the benefit of systems that need pthread.h
10067     # to be included early to correctly detect threadsafe functions.
10068     # Such functions must guarantee themselves, though, that the usethreads
10069     # and i_pthread have been defined, before calling protochk.
10070     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10071         echo "#include <pthread.h>" >> try.c
10072         pthread_h_done=yes
10073     fi
10074     shift 2
10075 done
10076 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10077 cat >> try.c <<'EOCP'
10078 #ifdef CAN_PROTOTYPE
10079 #define _(args) args
10080 #else
10081 #define _(args) ()
10082 #endif
10083 EOCP
10084 echo "$foo" >> try.c
10085 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10086 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10087 status=$?
10088 $rm_try
10089 exit $status
10090 EOSH
10091 chmod +x protochk
10092 $eunicefix protochk
10093
10094 : Define hasproto macro for Configure internal use
10095 hasproto='varname=$1; func=$2; shift; shift;
10096 while $test $# -ge 2; do
10097         case "$1" in
10098         $define) echo "#include <$2>";;
10099         esac ;
10100     shift 2;
10101 done > try.c;
10102 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10103 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10104         echo "$func() prototype found.";
10105         val="$define";
10106 else
10107         echo "$func() prototype NOT found.";
10108         val="$undef";
10109 fi;
10110 set $varname;
10111 eval $setvar;
10112 $rm_try tryout.c'
10113
10114 : see if sys/types.h has to be included
10115 set sys/types.h i_systypes
10116 eval $inhdr
10117
10118 : see if sys/select.h has to be included
10119 set sys/select.h i_sysselct
10120 eval $inhdr
10121
10122 : Define hasfield macro for Configure internal use
10123 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10124 while $test $# -ge 2; do
10125         case "$1" in
10126         $define) echo "#include <$2>";;
10127         esac ;
10128     shift 2;
10129 done > try.c;
10130 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10131 set try;
10132 if eval $compile; then
10133         val="$define";
10134 else
10135         val="$undef";
10136 fi;
10137 set $varname;
10138 eval $setvar;
10139 $rm_try'
10140
10141 : see if we should include time.h, sys/time.h, or both
10142 echo " "
10143 if test "X$timeincl" = X; then
10144         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10145         $echo $n "I'm now running the test program...$c"
10146         $cat >try.c <<EOCP
10147 #include <sys/types.h>
10148 #ifdef I_TIME
10149 #include <time.h>
10150 #endif
10151 #ifdef I_SYSTIME
10152 #ifdef SYSTIMEKERNEL
10153 #define KERNEL
10154 #endif
10155 #include <sys/time.h>
10156 #endif
10157 #ifdef I_SYSSELECT
10158 #include <sys/select.h>
10159 #endif
10160 #$i_stdlib I_STDLIB
10161 #ifdef I_STDLIB
10162 #include <stdlib.h>
10163 #endif
10164 int main()
10165 {
10166         struct tm foo;
10167 #ifdef S_TIMEVAL
10168         struct timeval bar;
10169 #endif
10170 #ifdef S_TIMEZONE
10171         struct timezone tzp;
10172 #endif
10173         if (foo.tm_sec == foo.tm_sec)
10174                 exit(0);
10175 #ifdef S_TIMEVAL
10176         if (bar.tv_sec == bar.tv_sec)
10177                 exit(0);
10178 #endif
10179         exit(1);
10180 }
10181 EOCP
10182         flags=''
10183         for s_timezone in '-DS_TIMEZONE' ''; do
10184         sysselect=''
10185         for s_timeval in '-DS_TIMEVAL' ''; do
10186         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10187         for i_time in '' '-DI_TIME'; do
10188         for i_systime in '-DI_SYSTIME' ''; do
10189                 case "$flags" in
10190                 '') $echo $n ".$c"
10191                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10192                         if eval $compile; then
10193                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10194                                 shift
10195                                 flags="$*"
10196                                 echo " "
10197                                 $echo $n "Succeeded with $flags$c"
10198                         fi
10199                         ;;
10200                 esac
10201         done
10202         done
10203         done
10204         done
10205         done
10206         timeincl=''
10207         echo " "
10208         case "$flags" in
10209         *SYSTIMEKERNEL*) i_systimek="$define"
10210                 timeincl=`./findhdr sys/time.h`
10211                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10212         *) i_systimek="$undef";;
10213         esac
10214         case "$flags" in
10215         *I_TIME*) i_time="$define"
10216                 timeincl=`./findhdr time.h`" $timeincl"
10217                 echo "We'll include <time.h>." >&4;;
10218         *) i_time="$undef";;
10219         esac
10220         case "$flags" in
10221         *I_SYSTIME*) i_systime="$define"
10222                 timeincl=`./findhdr sys/time.h`" $timeincl"
10223                 echo "We'll include <sys/time.h>." >&4;;
10224         *) i_systime="$undef";;
10225         esac
10226         $rm_try
10227 fi
10228 : see if struct tm knows about tm_zone
10229 case "$i_systime$i_time" in
10230 *$define*)
10231         echo " "
10232         echo "Checking to see if your struct tm has tm_zone field..." >&4
10233         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10234         eval $hasfield
10235         ;;
10236 *)      val="$undef"
10237         set d_tm_tm_zone
10238         eval $setvar
10239         ;;
10240 esac
10241 case "$d_tm_tm_zone" in
10242 "$define")      echo "Yes, it does."   ;;
10243 *)              echo "No, it doesn't." ;;
10244 esac
10245 : see if struct tm knows about tm_gmtoff
10246 case "$i_systime$i_time" in
10247 *$define*)
10248         echo " "
10249         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10250         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10251         eval $hasfield
10252         ;;
10253 *)      val="$undef"
10254         set d_tm_tm_gmtoff
10255         eval $setvar
10256         ;;
10257 esac
10258 case "$d_tm_tm_gmtoff" in
10259 "$define")      echo "Yes, it does."   ;;
10260 *)              echo "No, it doesn't." ;;
10261 esac
10262
10263 : see if asctime_r exists
10264 set asctime_r d_asctime_r
10265 eval $inlibc
10266 case "$d_asctime_r" in
10267 "$define")
10268         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10269         case "$d_asctime_r_proto:$usethreads" in
10270         ":define")      d_asctime_r_proto=define
10271                 set d_asctime_r_proto asctime_r $hdrs
10272                 eval $hasproto ;;
10273         *)      ;;
10274         esac
10275         case "$d_asctime_r_proto" in
10276         define)
10277         case "$asctime_r_proto" in
10278         ''|0) try='char* asctime_r(const struct tm*, char*);'
10279         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10280         esac
10281         case "$asctime_r_proto" in
10282         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10283         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10284         esac
10285         case "$asctime_r_proto" in
10286         ''|0) try='int asctime_r(const struct tm*, char*);'
10287         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10288         esac
10289         case "$asctime_r_proto" in
10290         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10291         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10292         esac
10293         case "$asctime_r_proto" in
10294         ''|0)   d_asctime_r=undef
10295                 asctime_r_proto=0
10296                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10297         * )     case "$asctime_r_proto" in
10298                 REENTRANT_PROTO*) ;;
10299                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10300                 esac
10301                 echo "Prototype: $try" ;;
10302         esac
10303         ;;
10304         *)      case "$usethreads" in
10305                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10306                 esac
10307                 d_asctime_r=undef
10308                 asctime_r_proto=0
10309                 ;;
10310         esac
10311         ;;
10312 *)      asctime_r_proto=0
10313         ;;
10314 esac
10315
10316 : see if atolf exists
10317 set atolf d_atolf
10318 eval $inlibc
10319
10320 : see if atoll exists
10321 set atoll d_atoll
10322 eval $inlibc
10323
10324 : Look for GCC-style attribute format
10325 case "$d_attribute_format" in
10326 '')
10327 echo " "
10328 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10329 $cat >attrib.c <<'EOCP'
10330 #include <stdio.h>
10331 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10332 EOCP
10333 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10334         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10335                 echo "Your C compiler doesn't support __attribute__((format))."
10336                 val="$undef"
10337         else
10338                 echo "Your C compiler supports __attribute__((format))."
10339                 val="$define"
10340         fi
10341 else
10342         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10343         val="$undef"
10344 fi
10345 ;;
10346 *) val="$d_attribute_format" ;;
10347 esac
10348 set d_attribute_format
10349 eval $setvar
10350 $rm -f attrib*
10351
10352 : Look for GCC-style attribute format with null format allowed
10353 case "$d_printf_format_null" in
10354 '') case "$d_attribute_format" in
10355     $define)
10356         echo " "
10357         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10358 $cat >attrib.c <<EOCP
10359 #include <stdio.h>
10360 #$i_stdlib I_STDLIB
10361 #ifdef I_STDLIB
10362 #include <stdlib.h>
10363 #endif
10364 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10365 int null_printf (char* pat,...) { return (int)pat; }
10366 int main () { exit(null_printf(NULL)); }
10367 EOCP
10368         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10369             : run the executable in case it produces a run-time warning
10370             if $run ./attrib >>attrib.out 2>&1; then
10371                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10372                     echo "Your C compiler doesn't allow __printf__ format to be null."
10373                     val="$undef"
10374                 else
10375                     echo "Your C compiler allows __printf__ format to be null."
10376                     val="$define"
10377                 fi
10378             else
10379             echo "Your C compiler executable failed with __printf__ format null."
10380             val="$undef"
10381         fi
10382     else
10383         echo "Your C compiler fails with __printf__ format null."
10384         val="$undef"
10385     fi
10386     ;;
10387     *)  val="$undef" ;;
10388     esac
10389 ;;
10390 *)  val="$d_printf_format_null" ;;
10391 esac
10392 set d_printf_format_null
10393 eval $setvar
10394 $rm -f attrib*
10395
10396 : Look for GCC-style attribute malloc
10397 case "$d_attribute_malloc" in
10398 '')
10399 echo " "
10400 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10401 $cat >attrib.c <<'EOCP'
10402 #include <stdio.h>
10403 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10404 EOCP
10405 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10406         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10407                 echo "Your C compiler doesn't support __attribute__((malloc))."
10408                 val="$undef"
10409         else
10410                 echo "Your C compiler supports __attribute__((malloc))."
10411                 val="$define"
10412         fi
10413 else
10414         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10415         val="$undef"
10416 fi
10417 ;;
10418 *) val="$d_attribute_malloc" ;;
10419 esac
10420 set d_attribute_malloc
10421 eval $setvar
10422 $rm -f attrib*
10423
10424 : Look for GCC-style attribute nonnull
10425 case "$d_attribute_nonnull" in
10426 '')
10427 echo " "
10428 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10429 $cat >attrib.c <<'EOCP'
10430 #include <stdio.h>
10431 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10432 EOCP
10433 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10434         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10435                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10436                 val="$undef"
10437         else
10438                 echo "Your C compiler supports __attribute__((nonnull))."
10439                 val="$define"
10440         fi
10441 else
10442         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10443         val="$undef"
10444 fi
10445 ;;
10446 *) val="$d_attribute_nonnull" ;;
10447 esac
10448 set d_attribute_nonnull
10449 eval $setvar
10450 $rm -f attrib*
10451
10452 : Look for GCC-style attribute noreturn
10453 case "$d_attribute_noreturn" in
10454 '')
10455 echo " "
10456 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10457 $cat >attrib.c <<'EOCP'
10458 #include <stdio.h>
10459 void fall_over_dead( void ) __attribute__((noreturn));
10460 EOCP
10461 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10462         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10463                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10464                 val="$undef"
10465         else
10466                 echo "Your C compiler supports __attribute__((noreturn))."
10467                 val="$define"
10468         fi
10469 else
10470         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10471         val="$undef"
10472 fi
10473 ;;
10474 *) val="$d_attribute_noreturn" ;;
10475 esac
10476 set d_attribute_noreturn
10477 eval $setvar
10478 $rm -f attrib*
10479
10480 : Look for GCC-style attribute pure
10481 case "$d_attribute_pure" in
10482 '')
10483 echo " "
10484 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10485 $cat >attrib.c <<'EOCP'
10486 #include <stdio.h>
10487 int square( int n ) __attribute__((pure));
10488 EOCP
10489 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10490         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10491                 echo "Your C compiler doesn't support __attribute__((pure))."
10492                 val="$undef"
10493         else
10494                 echo "Your C compiler supports __attribute__((pure))."
10495                 val="$define"
10496         fi
10497 else
10498         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10499         val="$undef"
10500 fi
10501 ;;
10502 *) val="$d_attribute_pure" ;;
10503 esac
10504 set d_attribute_pure
10505 eval $setvar
10506 $rm -f attrib*
10507
10508 : Look for GCC-style attribute unused
10509 case "$d_attribute_unused" in
10510 '')
10511 echo " "
10512 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10513 $cat >attrib.c <<'EOCP'
10514 #include <stdio.h>
10515 int do_something( int dummy __attribute__((unused)), int n );
10516 EOCP
10517 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10518         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10519                 echo "Your C compiler doesn't support __attribute__((unused))."
10520                 val="$undef"
10521         else
10522                 echo "Your C compiler supports __attribute__((unused))."
10523                 val="$define"
10524         fi
10525 else
10526         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10527         val="$undef"
10528 fi
10529 ;;
10530 *) val="$d_attribute_unused" ;;
10531 esac
10532 set d_attribute_unused
10533 eval $setvar
10534 $rm -f attrib*
10535
10536 : Look for GCC-style attribute deprecated
10537 case "$d_attribute_deprecated" in
10538 '')
10539 echo " "
10540 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10541 $cat >attrib.c <<'EOCP'
10542 #include <stdio.h>
10543 int I_am_deprecated(void) __attribute__((deprecated));
10544 EOCP
10545 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10546         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10547                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10548                 val="$undef"
10549         else
10550                 echo "Your C compiler supports __attribute__((deprecated))."
10551                 val="$define"
10552         fi
10553 else
10554         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10555         val="$undef"
10556 fi
10557 ;;
10558 *) val="$d_attribute_deprecated" ;;
10559 esac
10560 set d_attribute_deprecated
10561 eval $setvar
10562 $rm -f attrib*
10563
10564 : Look for GCC-style attribute warn_unused_result
10565 case "$d_attribute_warn_unused_result" in
10566 '')
10567 echo " "
10568 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10569 $cat >attrib.c <<'EOCP'
10570 #include <stdio.h>
10571 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10572 EOCP
10573 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10574         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10575                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10576                 val="$undef"
10577         else
10578                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10579                 val="$define"
10580         fi
10581 else
10582         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10583         val="$undef"
10584 fi
10585 ;;
10586 *) val="$d_attribute_warn_unused_result" ;;
10587 esac
10588 set d_attribute_warn_unused_result
10589 eval $setvar
10590 $rm -f attrib*
10591
10592 : see if bcmp exists
10593 set bcmp d_bcmp
10594 eval $inlibc
10595
10596 : see if bcopy exists
10597 set bcopy d_bcopy
10598 eval $inlibc
10599
10600 : see if getpgrp exists
10601 set getpgrp d_getpgrp
10602 eval $inlibc
10603
10604 case "$d_getpgrp" in
10605 "$define")
10606         echo " "
10607         echo "Checking to see which flavor of getpgrp is in use..."
10608         $cat >try.c <<EOP
10609 #$i_unistd I_UNISTD
10610 #include <sys/types.h>
10611 #ifdef I_UNISTD
10612 #  include <unistd.h>
10613 #endif
10614 #$i_stdlib I_STDLIB
10615 #ifdef I_STDLIB
10616 #include <stdlib.h>
10617 #endif
10618 int main()
10619 {
10620         if (getuid() == 0) {
10621                 printf("(I see you are running Configure as super-user...)\n");
10622                 setuid(1);
10623         }
10624 #ifdef TRY_BSD_PGRP
10625         if (getpgrp(1) == 0)
10626                 exit(0);
10627 #else
10628         if (getpgrp() > 0)
10629                 exit(0);
10630 #endif
10631         exit(1);
10632 }
10633 EOP
10634         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10635                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10636                 val="$define"
10637         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10638                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10639                 val="$undef"
10640         else
10641                 echo "I can't seem to compile and run the test program."
10642                 if ./usg; then
10643                         xxx="a USG one, i.e. you use getpgrp()."
10644                 else
10645                         # SVR4 systems can appear rather BSD-ish.
10646                         case "$i_unistd" in
10647                         $undef)
10648                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10649                                 val="$define"
10650                                 ;;
10651                         $define)
10652                                 xxx="probably a USG one, i.e. you use getpgrp()."
10653                                 val="$undef"
10654                                 ;;
10655                         esac
10656                 fi
10657                 echo "Assuming your getpgrp is $xxx" >&4
10658         fi
10659         ;;
10660 *) val="$undef";;
10661 esac
10662 set d_bsdgetpgrp
10663 eval $setvar
10664 $rm_try
10665
10666 : see if setpgrp exists
10667 set setpgrp d_setpgrp
10668 eval $inlibc
10669
10670 case "$d_setpgrp" in
10671 "$define")
10672         echo " "
10673         echo "Checking to see which flavor of setpgrp is in use..."
10674         $cat >try.c <<EOP
10675 #$i_unistd I_UNISTD
10676 #include <sys/types.h>
10677 #ifdef I_UNISTD
10678 #  include <unistd.h>
10679 #endif
10680 #$i_stdlib I_STDLIB
10681 #ifdef I_STDLIB
10682 #include <stdlib.h>
10683 #endif
10684 int main()
10685 {
10686         if (getuid() == 0) {
10687                 printf("(I see you are running Configure as super-user...)\n");
10688                 setuid(1);
10689         }
10690 #ifdef TRY_BSD_PGRP
10691         if (-1 == setpgrp(1, 1))
10692                 exit(0);
10693 #else
10694         if (setpgrp() != -1)
10695                 exit(0);
10696 #endif
10697         exit(1);
10698 }
10699 EOP
10700         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10701                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10702                 val="$define"
10703         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10704                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10705                 val="$undef"
10706         else
10707                 echo "(I can't seem to compile and run the test program.)"
10708                 if ./usg; then
10709                         xxx="a USG one, i.e. you use setpgrp()."
10710                 else
10711                         # SVR4 systems can appear rather BSD-ish.
10712                         case "$i_unistd" in
10713                         $undef)
10714                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10715                                 val="$define"
10716                                 ;;
10717                         $define)
10718                                 xxx="probably a USG one, i.e. you use setpgrp()."
10719                                 val="$undef"
10720                                 ;;
10721                         esac
10722                 fi
10723                 echo "Assuming your setpgrp is $xxx" >&4
10724         fi
10725         ;;
10726 *) val="$undef";;
10727 esac
10728 set d_bsdsetpgrp
10729 eval $setvar
10730 $rm_try
10731
10732 : Look for GCC-style __builtin_choose_expr
10733 case "$d_builtin_choose_expr" in
10734 '')
10735     echo " "
10736     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10737     $cat >try.c <<'EOCP'
10738 #include <assert.h>
10739 #include <stdlib.h>
10740 #include <stdio.h>
10741
10742 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10743
10744 int main(void) {
10745     assert( SYRINX(1) == 2112 );
10746     assert( SYRINX(1) != 5150 );
10747     assert( SYRINX(0) == 5150 );
10748     assert( SYRINX(0) != 2112 );
10749     puts( "All good!" );
10750     exit(0);
10751 }
10752
10753 EOCP
10754     set try
10755     if eval $compile && $run ./try; then
10756         echo "Your C compiler supports __builtin_choose_expr."
10757         val="$define"
10758     else
10759         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10760         val="$undef"
10761     fi
10762 ;;
10763 *) val="$d_builtin_choose_expr" ;;
10764 esac
10765
10766 set d_builtin_choose_expr
10767 eval $setvar
10768 $rm_try
10769
10770 : Look for GCC-style __builtin_expect
10771 case "$d_builtin_expect" in
10772 '')
10773     echo " "
10774     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10775     $cat >try.c <<'EOCP'
10776 int main(void) {
10777     int n = 50;
10778     if ( __builtin_expect(n, 0) ) n = 1;
10779     /* Remember shell exit code truth is 0, C truth is non-zero */
10780     return !(n == 1);
10781 }
10782 EOCP
10783     set try
10784     if eval $compile && $run ./try; then
10785         echo "Your C compiler supports __builtin_expect."
10786         val="$define"
10787     else
10788         echo "Your C compiler doesn't seem to understand __builtin_expect."
10789         val="$undef"
10790     fi
10791     ;;
10792 *) val="$d_builtin_expect" ;;
10793 esac
10794
10795 set d_builtin_expect
10796 eval $setvar
10797 $rm_try
10798
10799 : see if bzero exists
10800 set bzero d_bzero
10801 eval $inlibc
10802
10803 : see if stdarg is available
10804 echo " "
10805 if $test `./findhdr stdarg.h`; then
10806         echo "<stdarg.h> found." >&4
10807         valstd="$define"
10808 else
10809         echo "<stdarg.h> NOT found." >&4
10810         valstd="$undef"
10811 fi
10812
10813 : see if varags is available
10814 echo " "
10815 if $test `./findhdr varargs.h`; then
10816         echo "<varargs.h> found." >&4
10817 else
10818         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10819 fi
10820
10821 : set up the varargs testing programs
10822 $cat > varargs.c <<EOP
10823 #ifdef I_STDARG
10824 #include <stdarg.h>
10825 #endif
10826 #ifdef I_VARARGS
10827 #include <varargs.h>
10828 #endif
10829
10830 #ifdef I_STDARG
10831 int f(char *p, ...)
10832 #else
10833 int f(va_alist)
10834 va_dcl
10835 #endif
10836 {
10837         va_list ap;
10838 #ifndef I_STDARG
10839         char *p;
10840 #endif
10841 #ifdef I_STDARG
10842         va_start(ap,p);
10843 #else
10844         va_start(ap);
10845         p = va_arg(ap, char *);
10846 #endif
10847         va_end(ap);
10848         return 0;
10849 }
10850 EOP
10851 $cat > varargs <<EOP
10852 $startsh
10853 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10854         echo "true"
10855 else
10856         echo "false"
10857 fi
10858 $rm -f varargs$_o
10859 EOP
10860 chmod +x varargs
10861
10862 : now check which varargs header should be included
10863 echo " "
10864 i_varhdr=''
10865 case "$valstd" in
10866 "$define")
10867         if `./varargs I_STDARG`; then
10868                 val='stdarg.h'
10869         elif `./varargs I_VARARGS`; then
10870                 val='varargs.h'
10871         fi
10872         ;;
10873 *)
10874         if `./varargs I_VARARGS`; then
10875                 val='varargs.h'
10876         fi
10877         ;;
10878 esac
10879 case "$val" in
10880 '')
10881 echo "I could not find the definition for va_dcl... You have problems..." >&4
10882         val="$undef"; set i_stdarg; eval $setvar
10883         val="$undef"; set i_varargs; eval $setvar
10884         ;;
10885 *)
10886         set i_varhdr
10887         eval $setvar
10888         case "$i_varhdr" in
10889         stdarg.h)
10890                 val="$define"; set i_stdarg; eval $setvar
10891                 val="$undef"; set i_varargs; eval $setvar
10892                 ;;
10893         varargs.h)
10894                 val="$undef"; set i_stdarg; eval $setvar
10895                 val="$define"; set i_varargs; eval $setvar
10896                 ;;
10897         esac
10898         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10899 esac
10900 $rm -f varargs*
10901
10902 : see if the Compiler supports C99 variadic macros
10903 case "$i_stdarg$i_stdlib" in
10904     "$define$define")
10905     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10906     $cat >try.c <<EOCP
10907 #include <stdio.h>
10908 #include <stdarg.h>
10909
10910 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10911
10912 int main() {
10913   char buf[20];
10914   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10915   puts(buf);
10916   return 0;
10917 }
10918 EOCP
10919     set try
10920     if eval $compile && $run ./try 2>&1 >/dev/null; then
10921         case "`$run ./try`" in
10922             "123 456 789")
10923             echo "You have C99 variadic macros." >&4
10924             d_c99_variadic_macros="$define"
10925             ;;
10926             *)
10927             echo "You don't have functional C99 variadic macros." >&4
10928             d_c99_variadic_macros="$undef"
10929             ;;
10930         esac
10931     else
10932         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10933         d_c99_variadic_macros="$undef"
10934     fi
10935     $rm_try
10936     ;;
10937     *)
10938     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10939     d_c99_variadic_macros="$undef"
10940     ;;
10941 esac
10942
10943 : see if signal is declared as pointer to function returning int or void
10944 echo " "
10945 xxx=`./findhdr signal.h`
10946 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10947 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10948         echo "You have int (*signal())() instead of void." >&4
10949         val="$undef"
10950 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10951         echo "You have void (*signal())()." >&4
10952         val="$define"
10953 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10954         echo "You have int (*signal())() instead of void." >&4
10955         val="$undef"
10956 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10957         echo "You have void (*signal())()." >&4
10958         val="$define"
10959 else
10960         case "$d_voidsig" in
10961         '')
10962         echo "I can't determine whether signal handler returns void or int..." >&4
10963                 dflt=void
10964                 rp="What type does your signal handler return?"
10965                 . ./myread
10966                 case "$ans" in
10967                 v*) val="$define";;
10968                 *) val="$undef";;
10969                 esac;;
10970         "$define")
10971                 echo "As you already told me, signal handler returns void." >&4
10972                 val="$define"
10973                 ;;
10974         *)      echo "As you already told me, signal handler returns int." >&4
10975                 val="$undef"
10976                 ;;
10977         esac
10978 fi
10979 set d_voidsig
10980 eval $setvar
10981 case "$d_voidsig" in
10982 "$define") signal_t="void";;
10983 *) signal_t="int";;
10984 esac
10985 $rm -f $$.tmp
10986
10987 : check for ability to cast large floats to 32-bit ints.
10988 echo " "
10989 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10990 if $test "$intsize" -ge 4; then
10991         xxx=int
10992 else
10993         xxx=long
10994 fi
10995 $cat >try.c <<EOCP
10996 #include <stdio.h>
10997 #$i_stdlib I_STDLIB
10998 #ifdef I_STDLIB
10999 #include <stdlib.h>
11000 #endif
11001 #include <sys/types.h>
11002 #include <signal.h>
11003 $signal_t blech(int s) { exit(3); }
11004 int main()
11005 {
11006         $xxx i32;
11007         double f, g;
11008         int result = 0;
11009         char str[16];
11010         signal(SIGFPE, blech);
11011
11012         /* Don't let compiler optimize the test away.  Store the number
11013            in a writable string for gcc to pass to sscanf under HP/UX.
11014         */
11015         sprintf(str, "2147483647");
11016         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11017         g = 10 * f;
11018         i32  = ($xxx) g;
11019
11020         /* x86 processors will probably give 0x8000 0000, which is a
11021            sign change.  We don't want that.  We want to mimic SPARC
11022            behavior here, which is to preserve the sign and give
11023            back 0x7fff ffff.
11024         */
11025         if (i32 != ($xxx) f)
11026                 result |= 1;
11027         exit(result);
11028 }
11029 EOCP
11030 set try
11031 if eval $compile_ok; then
11032         $run ./try
11033         yyy=$?
11034 else
11035         echo "(I can't seem to compile the test program--assuming it can't)"
11036         yyy=1
11037 fi
11038 case "$yyy" in
11039 0)      val="$define"
11040         echo "Yup, it can."
11041         ;;
11042 *)      val="$undef"
11043         echo "Nope, it can't."
11044         ;;
11045 esac
11046 set d_casti32
11047 eval $setvar
11048 $rm_try
11049
11050 : check for ability to cast negative floats to unsigned
11051 echo " "
11052 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11053 $cat >try.c <<EOCP
11054 #include <stdio.h>
11055 #$i_stdlib I_STDLIB
11056 #ifdef I_STDLIB
11057 #include <stdlib.h>
11058 #endif
11059 #include <sys/types.h>
11060 #include <signal.h>
11061 $signal_t blech(int s) { exit(7); }
11062 $signal_t blech_in_list(int s) { exit(4); }
11063 unsigned long dummy_long(unsigned long p) { return p; }
11064 unsigned int dummy_int(unsigned int p) { return p; }
11065 unsigned short dummy_short(unsigned short p) { return p; }
11066 int main()
11067 {
11068         double f;
11069         unsigned long along;
11070         unsigned int aint;
11071         unsigned short ashort;
11072         int result = 0;
11073         char str[16];
11074
11075         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11076            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11077            optimized the whole file away
11078         */
11079         /* Store the number in a writable string for gcc to pass to
11080            sscanf under HP/UX.
11081         */
11082         sprintf(str, "-123");
11083         sscanf(str, "%lf", &f);  /* f = -123.; */
11084
11085         signal(SIGFPE, blech);
11086         along = (unsigned long)f;
11087         aint = (unsigned int)f;
11088         ashort = (unsigned short)f;
11089         if (along != (unsigned long)-123)
11090                 result |= 1;
11091         if (aint != (unsigned int)-123)
11092                 result |= 1;
11093         if (ashort != (unsigned short)-123)
11094                 result |= 1;
11095         sprintf(str, "1073741824.");
11096         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11097         f = f + f;
11098         along = 0;
11099         along = (unsigned long)f;
11100         if (along != 0x80000000)
11101                 result |= 2;
11102         f -= 1.;
11103         along = 0;
11104         along = (unsigned long)f;
11105         if (along != 0x7fffffff)
11106                 result |= 1;
11107         f += 2.;
11108         along = 0;
11109         along = (unsigned long)f;
11110         if (along != 0x80000001)
11111                 result |= 2;
11112         if (result)
11113                 exit(result);
11114         signal(SIGFPE, blech_in_list);
11115         sprintf(str, "123.");
11116         sscanf(str, "%lf", &f);  /* f = 123.; */
11117         along = dummy_long((unsigned long)f);
11118         aint = dummy_int((unsigned int)f);
11119         ashort = dummy_short((unsigned short)f);
11120         if (along != (unsigned long)123)
11121                 result |= 4;
11122         if (aint != (unsigned int)123)
11123                 result |= 4;
11124         if (ashort != (unsigned short)123)
11125                 result |= 4;
11126         exit(result);
11127
11128 }
11129 EOCP
11130 set try
11131 if eval $compile_ok; then
11132         $run ./try
11133         castflags=$?
11134 else
11135         echo "(I can't seem to compile the test program--assuming it can't)"
11136         castflags=7
11137 fi
11138 case "$castflags" in
11139 0)      val="$define"
11140         echo "Yup, it can."
11141         ;;
11142 *)      val="$undef"
11143         echo "Nope, it can't."
11144         ;;
11145 esac
11146 set d_castneg
11147 eval $setvar
11148 $rm_try
11149
11150 : see if vprintf exists
11151 echo " "
11152 if set vprintf val -f d_vprintf; eval $csym; $val; then
11153         echo 'vprintf() found.' >&4
11154         val="$define"
11155         $cat >try.c <<EOF
11156 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11157 #$i_varargs I_VARARGS
11158
11159 #$i_stdlib I_STDLIB
11160 #$i_unistd I_UNISTD
11161
11162 #ifdef I_STDARG
11163 #  include <stdarg.h>
11164 #else /* I_VARARGS */
11165 #  include <varargs.h>
11166 #endif
11167
11168 #ifdef I_UNISTD
11169 #  include <unistd.h>
11170 #endif
11171
11172 #ifdef I_STDLIB
11173 #  include <stdlib.h>
11174 #endif
11175
11176 #include <stdio.h> /* vsprintf prototype */
11177
11178 #ifdef I_STDARG
11179 void xxx(int n, ...)
11180 {
11181     va_list args;
11182     char buf[10];
11183     va_start(args, n);
11184     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11185 }
11186 int main() { xxx(1, "foo"); }
11187
11188 #else /* I_VARARGS */
11189
11190 xxx(va_alist)
11191 va_dcl
11192 {
11193     va_list args;
11194     char buf[10];
11195     va_start(args);
11196     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11197 }
11198 int main() { xxx("foo"); }
11199
11200 #endif
11201
11202 EOF
11203         set try
11204         if eval $compile_ok; then
11205                 if $run ./try; then
11206                         echo "Your vsprintf() returns (int)." >&4
11207                         val2="$undef"
11208                 else
11209                         echo "Your vsprintf() returns (char*)." >&4
11210                         val2="$define"
11211                 fi
11212         else
11213                 echo 'I am unable to compile the vsprintf() test program.' >&4
11214                 # We shouldn't get here.  If we do, assume the standard signature,
11215                 # not the old BSD one.
11216                 echo 'Guessing that vsprintf() returns (int).' >&4
11217                 val2="$undef"
11218         fi
11219 else
11220         echo 'vprintf() NOT found.' >&4
11221         val="$undef"
11222         val2="$undef"
11223 fi
11224 $rm_try
11225 set d_vprintf
11226 eval $setvar
11227 val=$val2
11228 set d_charvspr
11229 eval $setvar
11230
11231 : see if chown exists
11232 set chown d_chown
11233 eval $inlibc
11234
11235 : see if chroot exists
11236 set chroot d_chroot
11237 eval $inlibc
11238
11239 : see if chsize exists
11240 set chsize d_chsize
11241 eval $inlibc
11242
11243 : see if class exists
11244 set class d_class
11245 eval $inlibc
11246
11247 : see if clearenv exists
11248 set clearenv d_clearenv
11249 eval $inlibc
11250
11251 : Define hasstruct macro for Configure internal use
11252 hasstruct='varname=$1; struct=$2; shift; shift;
11253 while $test $# -ge 2; do
11254         case "$1" in
11255         $define) echo "#include <$2>";;
11256         esac ;
11257     shift 2;
11258 done > try.c;
11259 echo "int main () { struct $struct foo; }" >> try.c;
11260 set try;
11261 if eval $compile; then
11262         val="$define";
11263 else
11264         val="$undef";
11265 fi;
11266 set $varname;
11267 eval $setvar;
11268 $rm_try'
11269
11270 : see whether socket exists
11271 socketlib=''
11272 sockethdr=''
11273 echo " "
11274 $echo $n "Hmm... $c" >&4
11275 if set socket val -f d_socket; eval $csym; $val; then
11276         echo "Looks like you have Berkeley networking support." >&4
11277         d_socket="$define"
11278         if set setsockopt val -f; eval $csym; $val; then
11279                 d_oldsock="$undef"
11280         else
11281                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11282                 d_oldsock="$define"
11283         fi
11284 else
11285         if $contains socklib libc.list >/dev/null 2>&1; then
11286                 echo "Looks like you have Berkeley networking support." >&4
11287                 d_socket="$define"
11288                 : we will have to assume that it supports the 4.2 BSD interface
11289                 d_oldsock="$undef"
11290         else
11291                 echo "You don't have Berkeley networking in libc$_a..." >&4
11292                 if test "X$d_socket" = "X$define"; then
11293                    echo "...but you seem to believe that you have sockets." >&4
11294                 else
11295                         for net in net socket
11296                         do
11297                                 if test -f /usr/lib/lib$net$_a; then
11298                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11299                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11300                                         if $contains socket libc.list >/dev/null 2>&1; then
11301                                                 d_socket="$define"
11302                                                 socketlib="-l$net"
11303                                                 case "$net" in
11304                                                 net)
11305                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11306                                                         sockethdr="-I/usr/netinclude"
11307                                                         ;;
11308                                                 esac
11309                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11310                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11311                                                         d_oldsock="$undef"
11312                                                 else
11313                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11314                                                         d_oldsock="$define"
11315                                                 fi
11316                                                 break
11317                                         fi
11318                                 fi
11319                         done
11320                         if test "X$d_socket" != "X$define"; then
11321                            echo "or anywhere else I see." >&4
11322                            d_socket="$undef"
11323                            d_oldsock="$undef"
11324                         fi
11325                 fi
11326         fi
11327 fi
11328
11329 : see if socketpair exists
11330 set socketpair d_sockpair
11331 eval $inlibc
11332
11333
11334 echo " "
11335 echo "Checking the availability of certain socket constants..." >&4
11336 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11337         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11338         $cat >try.c <<EOF
11339 #include <sys/types.h>
11340 #include <sys/socket.h>
11341 int main() {
11342     int i = $ENUM;
11343 }
11344 EOF
11345         val="$undef"
11346         set try; if eval $compile; then
11347                 val="$define"
11348         fi
11349         set d_${enum}; eval $setvar
11350         $rm_try
11351 done
11352
11353 : see if this is a sys/uio.h system
11354 set sys/uio.h i_sysuio
11355 eval $inhdr
11356
11357 : Check for cmsghdr support
11358 echo " "
11359 echo "Checking to see if your system supports struct cmsghdr..." >&4
11360 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11361 eval $hasstruct
11362 case "$d_cmsghdr_s" in
11363 "$define")      echo "Yes, it does."   ;;
11364 *)              echo "No, it doesn't." ;;
11365 esac
11366
11367
11368 : check for const keyword
11369 echo " "
11370 echo 'Checking to see if your C compiler knows about "const"...' >&4
11371 $cat >const.c <<'EOCP'
11372 typedef struct spug { int drokk; } spug;
11373 int main()
11374 {
11375         const char *foo;
11376         const spug y = { 0 };
11377 }
11378 EOCP
11379 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11380         val="$define"
11381         echo "Yup, it does."
11382 else
11383         val="$undef"
11384         echo "Nope, it doesn't."
11385 fi
11386 set d_const
11387 eval $setvar
11388
11389 : see if copysignl exists
11390 set copysignl d_copysignl
11391 eval $inlibc
11392
11393 : see if crypt exists
11394 echo " "
11395 set crypt d_crypt
11396 eval $inlibc
11397 case "$d_crypt" in
11398 $define) cryptlib='' ;;
11399 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11400                 echo 'crypt() found.' >&4
11401                 val="$define"
11402                 cryptlib=''
11403         else
11404                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11405                 if $test -z "$cryptlib"; then
11406                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11407                 else
11408                         cryptlib=-lcrypt
11409                 fi
11410                 if $test -z "$cryptlib"; then
11411                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11412                 else
11413                         cryptlib=-lcrypt
11414                 fi
11415                 if $test -z "$cryptlib"; then
11416                         cryptlib=`./loc libcrypt$_a "" $libpth`
11417                 else
11418                         cryptlib=-lcrypt
11419                 fi
11420                 if $test -z "$cryptlib"; then
11421                         echo 'crypt() NOT found.' >&4
11422                         val="$undef"
11423                 else
11424                         val="$define"
11425                 fi
11426         fi
11427         set d_crypt
11428         eval $setvar
11429         ;;
11430 esac
11431
11432 : see if this is a crypt.h system
11433 set crypt.h i_crypt
11434 eval $inhdr
11435
11436 : see if crypt_r exists
11437 set crypt_r d_crypt_r
11438 eval $inlibc
11439 case "$d_crypt_r" in
11440 "$define")
11441         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11442         case "$d_crypt_r_proto:$usethreads" in
11443         ":define")      d_crypt_r_proto=define
11444                 set d_crypt_r_proto crypt_r $hdrs
11445                 eval $hasproto ;;
11446         *)      ;;
11447         esac
11448         case "$d_crypt_r_proto" in
11449         define)
11450         case "$crypt_r_proto" in
11451         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11452         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11453         esac
11454         case "$crypt_r_proto" in
11455         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11456         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11457         esac
11458         case "$crypt_r_proto" in
11459         ''|0)   d_crypt_r=undef
11460                 crypt_r_proto=0
11461                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11462         * )     case "$crypt_r_proto" in
11463                 REENTRANT_PROTO*) ;;
11464                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11465                 esac
11466                 echo "Prototype: $try" ;;
11467         esac
11468         ;;
11469         *)      case "$usethreads" in
11470                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11471                 esac
11472                 d_crypt_r=undef
11473                 crypt_r_proto=0
11474                 ;;
11475         esac
11476         ;;
11477 *)      crypt_r_proto=0
11478         ;;
11479 esac
11480
11481 : get csh whereabouts
11482 case "$csh" in
11483 'csh') val="$undef" ;;
11484 *) val="$define" ;;
11485 esac
11486 set d_csh
11487 eval $setvar
11488 : Respect a hint or command line value for full_csh.
11489 case "$full_csh" in
11490 '') full_csh=$csh ;;
11491 esac
11492
11493 : see if ctermid exists
11494 set ctermid d_ctermid
11495 eval $inlibc
11496
11497 : see if ctermid_r exists
11498 set ctermid_r d_ctermid_r
11499 eval $inlibc
11500 case "$d_ctermid_r" in
11501 "$define")
11502         hdrs="$i_systypes sys/types.h define stdio.h "
11503         case "$d_ctermid_r_proto:$usethreads" in
11504         ":define")      d_ctermid_r_proto=define
11505                 set d_ctermid_r_proto ctermid_r $hdrs
11506                 eval $hasproto ;;
11507         *)      ;;
11508         esac
11509         case "$d_ctermid_r_proto" in
11510         define)
11511         case "$ctermid_r_proto" in
11512         ''|0) try='char* ctermid_r(char*);'
11513         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11514         esac
11515         case "$ctermid_r_proto" in
11516         ''|0)   d_ctermid_r=undef
11517                 ctermid_r_proto=0
11518                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11519         * )     case "$ctermid_r_proto" in
11520                 REENTRANT_PROTO*) ;;
11521                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11522                 esac
11523                 echo "Prototype: $try" ;;
11524         esac
11525         ;;
11526         *)      case "$usethreads" in
11527                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11528                 esac
11529                 d_ctermid_r=undef
11530                 ctermid_r_proto=0
11531                 ;;
11532         esac
11533         ;;
11534 *)      ctermid_r_proto=0
11535         ;;
11536 esac
11537
11538 : see if ctime_r exists
11539 set ctime_r d_ctime_r
11540 eval $inlibc
11541 case "$d_ctime_r" in
11542 "$define")
11543         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11544         case "$d_ctime_r_proto:$usethreads" in
11545         ":define")      d_ctime_r_proto=define
11546                 set d_ctime_r_proto ctime_r $hdrs
11547                 eval $hasproto ;;
11548         *)      ;;
11549         esac
11550         case "$d_ctime_r_proto" in
11551         define)
11552         case "$ctime_r_proto" in
11553         ''|0) try='char* ctime_r(const time_t*, char*);'
11554         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11555         esac
11556         case "$ctime_r_proto" in
11557         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11558         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11559         esac
11560         case "$ctime_r_proto" in
11561         ''|0) try='int ctime_r(const time_t*, char*);'
11562         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11563         esac
11564         case "$ctime_r_proto" in
11565         ''|0) try='int ctime_r(const time_t*, char*, int);'
11566         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11567         esac
11568         case "$ctime_r_proto" in
11569         ''|0)   d_ctime_r=undef
11570                 ctime_r_proto=0
11571                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11572         * )     case "$ctime_r_proto" in
11573                 REENTRANT_PROTO*) ;;
11574                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11575                 esac
11576                 echo "Prototype: $try" ;;
11577         esac
11578         ;;
11579         *)      case "$usethreads" in
11580                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11581                 esac
11582                 d_ctime_r=undef
11583                 ctime_r_proto=0
11584                 ;;
11585         esac
11586         ;;
11587 *)      ctime_r_proto=0
11588         ;;
11589 esac
11590
11591 : see if cuserid exists
11592 set cuserid d_cuserid
11593 eval $inlibc
11594
11595 : see if this is a limits.h system
11596 set limits.h i_limits
11597 eval $inhdr
11598
11599 : see if this is a float.h system
11600 set float.h i_float
11601 eval $inhdr
11602
11603 : See if number of significant digits in a double precision number is known
11604 echo " "
11605 $cat >dbl_dig.c <<EOM
11606 #$i_limits I_LIMITS
11607 #$i_float I_FLOAT
11608 #ifdef I_LIMITS
11609 #include <limits.h>
11610 #endif
11611 #ifdef I_FLOAT
11612 #include <float.h>
11613 #endif
11614 #ifdef DBL_DIG
11615 printf("Contains DBL_DIG");
11616 #endif
11617 EOM
11618 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11619 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11620         echo "DBL_DIG found." >&4
11621         val="$define"
11622 else
11623         echo "DBL_DIG NOT found." >&4
11624         val="$undef"
11625 fi
11626 $rm -f dbl_dig.?
11627 set d_dbl_dig
11628 eval $setvar
11629
11630 : see if dbm.h is available
11631 : see if dbmclose exists
11632 set dbmclose d_dbmclose
11633 eval $inlibc
11634
11635 case "$d_dbmclose" in
11636 $define)
11637         set dbm.h i_dbm
11638         eval $inhdr
11639         case "$i_dbm" in
11640         $define)
11641                 val="$undef"
11642                 set i_rpcsvcdbm
11643                 eval $setvar
11644                 ;;
11645         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11646                 eval $inhdr
11647                 ;;
11648         esac
11649         ;;
11650 *)      echo "We won't be including <dbm.h>"
11651         val="$undef"
11652         set i_dbm
11653         eval $setvar
11654         val="$undef"
11655         set i_rpcsvcdbm
11656         eval $setvar
11657         ;;
11658 esac
11659
11660 : see if prototype for dbminit is available
11661 echo " "
11662 set d_dbminitproto dbminit $i_dbm dbm.h
11663 eval $hasproto
11664
11665 : see if difftime exists
11666 set difftime d_difftime
11667 eval $inlibc
11668
11669 : see if this is a dirent system
11670 echo " "
11671 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11672         val="$define"
11673         echo "<dirent.h> found." >&4
11674 else
11675         val="$undef"
11676         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11677                 echo "<sys/dir.h> found." >&4
11678                 echo " "
11679         else
11680                 xinc=`./findhdr sys/ndir.h`
11681         fi
11682         echo "<dirent.h> NOT found." >&4
11683 fi
11684 set i_dirent
11685 eval $setvar
11686
11687 : Look for type of directory structure.
11688 echo " "
11689 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11690
11691 case "$direntrytype" in
11692 ''|' ')
11693         case "$i_dirent" in
11694         $define) guess1='struct dirent' ;;
11695         *) guess1='struct direct'  ;;
11696         esac
11697         ;;
11698 *)      guess1="$direntrytype"
11699         ;;
11700 esac
11701
11702 case "$guess1" in
11703 'struct dirent') guess2='struct direct' ;;
11704 *) guess2='struct dirent' ;;
11705 esac
11706
11707 if $contains "$guess1" try.c >/dev/null 2>&1; then
11708         direntrytype="$guess1"
11709         echo "Your directory entries are $direntrytype." >&4
11710 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11711         direntrytype="$guess2"
11712         echo "Your directory entries seem to be $direntrytype." >&4
11713 else
11714         echo "I don't recognize your system's directory entries." >&4
11715         rp="What type is used for directory entries on this system?"
11716         dflt="$guess1"
11717         . ./myread
11718         direntrytype="$ans"
11719 fi
11720 $rm_try
11721
11722 : see if the directory entry stores field length
11723 echo " "
11724 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11725 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11726         echo "Good, your directory entry keeps length information in d_namlen." >&4
11727         val="$define"
11728 else
11729         echo "Your directory entry does not know about the d_namlen field." >&4
11730         val="$undef"
11731 fi
11732 set d_dirnamlen
11733 eval $setvar
11734 $rm_try
11735
11736 : Look for DIR.dd_fd
11737 case "$i_dirent" in
11738 "$define")
11739     echo "Checking to see if DIR has a dd_fd member variable" >&4
11740     $cat >try.c <<EOCP
11741 #$i_stdlib I_STDLIB
11742 #ifdef I_STDLIB
11743 #include <stdlib.h>
11744 #endif
11745 #include <dirent.h>
11746
11747 int main() {
11748     DIR dir;
11749     dir.dd_fd = 1;
11750     return 0;
11751 }
11752 EOCP
11753     val=$undef
11754     set try
11755     if eval $compile; then
11756         echo "Yes, it does."
11757         val="$define"
11758     else
11759         echo "No, it does not."
11760         val="$undef"
11761     fi
11762     ;;
11763 *)
11764     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11765     val="$undef"
11766     ;;
11767 esac
11768 set d_dir_dd_fd
11769 eval $setvar
11770 $rm_try
11771
11772 : see if this is an sysdir system
11773 set sys/dir.h i_sysdir
11774 eval $inhdr
11775
11776 : see if this is an sysndir system
11777 set sys/ndir.h i_sysndir
11778 eval $inhdr
11779
11780 : Look for dirfd
11781 echo " "
11782 $cat >dirfd.c <<EOM
11783 #include <stdio.h>
11784 #$i_stdlib I_STDLIB
11785 #ifdef I_STDLIB
11786 #include <stdlib.h>
11787 #endif
11788 #$i_dirent I_DIRENT             /**/
11789 #$i_sysdir I_SYS_DIR            /**/
11790 #$i_sysndir I_SYS_NDIR          /**/
11791 #$i_systypes I_SYS_TYPES        /**/
11792 #if defined(I_SYS_TYPES)
11793 #include <sys/types.h>
11794 #endif
11795 #if defined(I_DIRENT)
11796 #include <dirent.h>
11797 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11798 #include <sys/dir.h>
11799 #endif
11800 #else
11801 #ifdef I_SYS_NDIR
11802 #include <sys/ndir.h>
11803 #else
11804 #ifdef I_SYS_DIR
11805 #ifdef hp9000s500
11806 #include <ndir.h>       /* may be wrong in the future */
11807 #else
11808 #include <sys/dir.h>
11809 #endif
11810 #endif
11811 #endif
11812 #endif 
11813 int main() {
11814         DIR *dirp = opendir(".");
11815         if (dirfd(dirp) >= 0)
11816                 exit(0);
11817         else
11818                 exit(1);
11819 }
11820 EOM
11821 val=$undef
11822 set dirfd
11823 if eval $compile; then
11824         val="$define"
11825 fi
11826 case "$val" in
11827 $define)        echo "dirfd() found." >&4       ;;
11828 *)              echo "dirfd() NOT found." >&4   ;;
11829 esac
11830 set d_dirfd
11831 eval $setvar
11832 $rm -f dirfd*
11833
11834 : see if dlerror exists
11835 xxx_runnm="$runnm"
11836 runnm=false
11837 set dlerror d_dlerror
11838 eval $inlibc
11839 runnm="$xxx_runnm"
11840
11841 : see if dlfcn is available
11842 set dlfcn.h i_dlfcn
11843 eval $inhdr
11844
11845 : Check what extension to use for shared libs
11846 case "$usedl" in
11847 $define|y|true)
11848         $cat << EOM
11849
11850 On a few systems, the dynamically loaded modules that perl generates and uses
11851 will need a different extension than shared libs. The default will probably
11852 be appropriate.
11853
11854 EOM
11855         case "$dlext" in
11856         '')     dflt="$so" ;;
11857         *)      dflt="$dlext" ;;
11858         esac
11859         rp='What is the extension of dynamically loaded modules'
11860         . ./myread
11861         dlext="$ans"
11862         ;;
11863 *)
11864         dlext="none"
11865         ;;
11866 esac
11867
11868 : Check if dlsym need a leading underscore
11869 echo " "
11870 val="$undef"
11871
11872 case "$dlsrc" in
11873 dl_dlopen.xs)
11874         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11875         $cat >dyna.c <<'EOM'
11876 fred () { }
11877 EOM
11878
11879 $cat >fred.c<<EOM
11880
11881 #include <stdio.h>
11882 #$i_stdlib I_STDLIB
11883 #ifdef I_STDLIB
11884 #include <stdlib.h>
11885 #endif
11886 #$i_dlfcn I_DLFCN
11887 #ifdef I_DLFCN
11888 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11889 #else
11890 #include <sys/types.h>
11891 #include <nlist.h>
11892 #include <link.h>
11893 #endif
11894
11895 extern int fred() ;
11896
11897 int main()
11898 {
11899     void * handle ;
11900     void * symbol ;
11901 #ifndef RTLD_LAZY
11902     int mode = 1 ;
11903 #else
11904     int mode = RTLD_LAZY ;
11905 #endif
11906     handle = dlopen("./dyna.$dlext", mode) ;
11907     if (handle == NULL) {
11908         printf ("1\n") ;
11909         fflush (stdout) ;
11910         exit(0);
11911     }
11912     symbol = dlsym(handle, "fred") ;
11913     if (symbol == NULL) {
11914         /* try putting a leading underscore */
11915         symbol = dlsym(handle, "_fred") ;
11916         if (symbol == NULL) {
11917             printf ("2\n") ;
11918             fflush (stdout) ;
11919             exit(0);
11920         }
11921         printf ("3\n") ;
11922     }
11923     else
11924         printf ("4\n") ;
11925     fflush (stdout) ;
11926     exit(0);
11927 }
11928 EOM
11929         : Call the object file tmp-dyna.o in case dlext=o.
11930         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11931                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11932                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11933                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11934                 xxx=`$run ./fred`
11935                 case $xxx in
11936                 1)      echo "Test program failed using dlopen." >&4
11937                         echo "Perhaps you should not use dynamic loading." >&4;;
11938                 2)      echo "Test program failed using dlsym." >&4
11939                         echo "Perhaps you should not use dynamic loading." >&4;;
11940                 3)      echo "dlsym needs a leading underscore" >&4
11941                         val="$define" ;;
11942                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11943                 esac
11944         else
11945                 echo "I can't compile and run the test program." >&4
11946                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11947         fi
11948         ;;
11949 esac
11950
11951 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11952
11953 set d_dlsymun
11954 eval $setvar
11955
11956 : see if drand48_r exists
11957 set drand48_r d_drand48_r
11958 eval $inlibc
11959 case "$d_drand48_r" in
11960 "$define")
11961         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11962         case "$d_drand48_r_proto:$usethreads" in
11963         ":define")      d_drand48_r_proto=define
11964                 set d_drand48_r_proto drand48_r $hdrs
11965                 eval $hasproto ;;
11966         *)      ;;
11967         esac
11968         case "$d_drand48_r_proto" in
11969         define)
11970         case "$drand48_r_proto" in
11971         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11972         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11973         esac
11974         case "$drand48_r_proto" in
11975         ''|0)   d_drand48_r=undef
11976                 drand48_r_proto=0
11977                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11978         * )     case "$drand48_r_proto" in
11979                 REENTRANT_PROTO*) ;;
11980                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11981                 esac
11982                 echo "Prototype: $try" ;;
11983         esac
11984         ;;
11985         *)      case "$usethreads" in
11986                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11987                 esac
11988                 d_drand48_r=undef
11989                 drand48_r_proto=0
11990                 ;;
11991         esac
11992         ;;
11993 *)      drand48_r_proto=0
11994         ;;
11995 esac
11996
11997 : see if prototype for drand48 is available
11998 echo " "
11999 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12000 eval $hasproto
12001
12002 : see if dup2 exists
12003 set dup2 d_dup2
12004 eval $inlibc
12005
12006 : see if eaccess exists
12007 set eaccess d_eaccess
12008 eval $inlibc
12009
12010 : see if endgrent exists
12011 set endgrent d_endgrent
12012 eval $inlibc
12013
12014 : see if this is an grp system
12015 set grp.h i_grp
12016 eval $inhdr
12017
12018 case "$i_grp" in
12019 $define)
12020         xxx=`./findhdr grp.h`
12021         $cppstdin $cppflags $cppminus < $xxx >$$.h
12022
12023         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12024                 val="$define"
12025         else
12026                 val="$undef"
12027         fi
12028         set d_grpasswd
12029         eval $setvar
12030
12031         $rm -f $$.h
12032         ;;
12033 *)
12034         val="$undef";
12035         set d_grpasswd; eval $setvar
12036         ;;
12037 esac
12038
12039 : see if endgrent_r exists
12040 set endgrent_r d_endgrent_r
12041 eval $inlibc
12042 case "$d_endgrent_r" in
12043 "$define")
12044         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12045         case "$d_endgrent_r_proto:$usethreads" in
12046         ":define")      d_endgrent_r_proto=define
12047                 set d_endgrent_r_proto endgrent_r $hdrs
12048                 eval $hasproto ;;
12049         *)      ;;
12050         esac
12051         case "$d_endgrent_r_proto" in
12052         define)
12053         case "$endgrent_r_proto" in
12054         ''|0) try='int endgrent_r(FILE**);'
12055         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12056         esac
12057         case "$endgrent_r_proto" in
12058         ''|0) try='void endgrent_r(FILE**);'
12059         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12060         esac
12061         case "$endgrent_r_proto" in
12062         ''|0)   d_endgrent_r=undef
12063                 endgrent_r_proto=0
12064                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12065         * )     case "$endgrent_r_proto" in
12066                 REENTRANT_PROTO*) ;;
12067                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12068                 esac
12069                 echo "Prototype: $try" ;;
12070         esac
12071         ;;
12072         *)      case "$usethreads" in
12073                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12074                 esac
12075                 d_endgrent_r=undef
12076                 endgrent_r_proto=0
12077                 ;;
12078         esac
12079         ;;
12080 *)      endgrent_r_proto=0
12081         ;;
12082 esac
12083
12084 : see if endhostent exists
12085 set endhostent d_endhent
12086 eval $inlibc
12087
12088 : see if this is a netdb.h system
12089 set netdb.h i_netdb
12090 eval $inhdr
12091
12092 : see if endhostent_r exists
12093 set endhostent_r d_endhostent_r
12094 eval $inlibc
12095 case "$d_endhostent_r" in
12096 "$define")
12097         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12098         case "$d_endhostent_r_proto:$usethreads" in
12099         ":define")      d_endhostent_r_proto=define
12100                 set d_endhostent_r_proto endhostent_r $hdrs
12101                 eval $hasproto ;;
12102         *)      ;;
12103         esac
12104         case "$d_endhostent_r_proto" in
12105         define)
12106         case "$endhostent_r_proto" in
12107         ''|0) try='int endhostent_r(struct hostent_data*);'
12108         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12109         esac
12110         case "$endhostent_r_proto" in
12111         ''|0) try='void endhostent_r(struct hostent_data*);'
12112         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12113         esac
12114         case "$endhostent_r_proto" in
12115         ''|0)   d_endhostent_r=undef
12116                 endhostent_r_proto=0
12117                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12118         * )     case "$endhostent_r_proto" in
12119                 REENTRANT_PROTO*) ;;
12120                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12121                 esac
12122                 echo "Prototype: $try" ;;
12123         esac
12124         ;;
12125         *)      case "$usethreads" in
12126                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12127                 esac
12128                 d_endhostent_r=undef
12129                 endhostent_r_proto=0
12130                 ;;
12131         esac
12132         ;;
12133 *)      endhostent_r_proto=0
12134         ;;
12135 esac
12136
12137 : see if endnetent exists
12138 set endnetent d_endnent
12139 eval $inlibc
12140
12141 : see if endnetent_r exists
12142 set endnetent_r d_endnetent_r
12143 eval $inlibc
12144 case "$d_endnetent_r" in
12145 "$define")
12146         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12147         case "$d_endnetent_r_proto:$usethreads" in
12148         ":define")      d_endnetent_r_proto=define
12149                 set d_endnetent_r_proto endnetent_r $hdrs
12150                 eval $hasproto ;;
12151         *)      ;;
12152         esac
12153         case "$d_endnetent_r_proto" in
12154         define)
12155         case "$endnetent_r_proto" in
12156         ''|0) try='int endnetent_r(struct netent_data*);'
12157         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12158         esac
12159         case "$endnetent_r_proto" in
12160         ''|0) try='void endnetent_r(struct netent_data*);'
12161         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12162         esac
12163         case "$endnetent_r_proto" in
12164         ''|0)   d_endnetent_r=undef
12165                 endnetent_r_proto=0
12166                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12167         * )     case "$endnetent_r_proto" in
12168                 REENTRANT_PROTO*) ;;
12169                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12170                 esac
12171                 echo "Prototype: $try" ;;
12172         esac
12173         ;;
12174         *)      case "$usethreads" in
12175                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12176                 esac
12177                 d_endnetent_r=undef
12178                 endnetent_r_proto=0
12179                 ;;
12180         esac
12181         ;;
12182 *)      endnetent_r_proto=0
12183         ;;
12184 esac
12185
12186 : see if endprotoent exists
12187 set endprotoent d_endpent
12188 eval $inlibc
12189
12190 : see if endprotoent_r exists
12191 set endprotoent_r d_endprotoent_r
12192 eval $inlibc
12193 case "$d_endprotoent_r" in
12194 "$define")
12195         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12196         case "$d_endprotoent_r_proto:$usethreads" in
12197         ":define")      d_endprotoent_r_proto=define
12198                 set d_endprotoent_r_proto endprotoent_r $hdrs
12199                 eval $hasproto ;;
12200         *)      ;;
12201         esac
12202         case "$d_endprotoent_r_proto" in
12203         define)
12204         case "$endprotoent_r_proto" in
12205         ''|0) try='int endprotoent_r(struct protoent_data*);'
12206         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12207         esac
12208         case "$endprotoent_r_proto" in
12209         ''|0) try='void endprotoent_r(struct protoent_data*);'
12210         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12211         esac
12212         case "$endprotoent_r_proto" in
12213         ''|0)   d_endprotoent_r=undef
12214                 endprotoent_r_proto=0
12215                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12216         * )     case "$endprotoent_r_proto" in
12217                 REENTRANT_PROTO*) ;;
12218                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12219                 esac
12220                 echo "Prototype: $try" ;;
12221         esac
12222         ;;
12223         *)      case "$usethreads" in
12224                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12225                 esac
12226                 d_endprotoent_r=undef
12227                 endprotoent_r_proto=0
12228                 ;;
12229         esac
12230         ;;
12231 *)      endprotoent_r_proto=0
12232         ;;
12233 esac
12234
12235 : see if endpwent exists
12236 set endpwent d_endpwent
12237 eval $inlibc
12238
12239 : see if this is a pwd.h system
12240 set pwd.h i_pwd
12241 eval $inhdr
12242
12243 case "$i_pwd" in
12244 $define)
12245         xxx=`./findhdr pwd.h`
12246         $cppstdin $cppflags $cppminus < $xxx >$$.h
12247
12248         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12249                 val="$define"
12250         else
12251                 val="$undef"
12252         fi
12253         set d_pwquota
12254         eval $setvar
12255
12256         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12257                 val="$define"
12258         else
12259                 val="$undef"
12260         fi
12261         set d_pwage
12262         eval $setvar
12263
12264         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12265                 val="$define"
12266         else
12267                 val="$undef"
12268         fi
12269         set d_pwchange
12270         eval $setvar
12271
12272         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12273                 val="$define"
12274         else
12275                 val="$undef"
12276         fi
12277         set d_pwclass
12278         eval $setvar
12279
12280         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12281                 val="$define"
12282         else
12283                 val="$undef"
12284         fi
12285         set d_pwexpire
12286         eval $setvar
12287
12288         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12289                 val="$define"
12290         else
12291                 val="$undef"
12292         fi
12293         set d_pwcomment
12294         eval $setvar
12295
12296         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12297                 val="$define"
12298         else
12299                 val="$undef"
12300         fi
12301         set d_pwgecos
12302         eval $setvar
12303
12304         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12305                 val="$define"
12306         else
12307                 val="$undef"
12308         fi
12309         set d_pwpasswd
12310         eval $setvar
12311
12312         $rm -f $$.h
12313         ;;
12314 *)
12315         val="$undef"; 
12316         set d_pwquota; eval $setvar
12317         set d_pwage; eval $setvar
12318         set d_pwchange; eval $setvar
12319         set d_pwclass; eval $setvar
12320         set d_pwexpire; eval $setvar
12321         set d_pwcomment; eval $setvar
12322         set d_pwgecos; eval $setvar
12323         set d_pwpasswd; eval $setvar
12324         ;;
12325 esac
12326
12327 : see if endpwent_r exists
12328 set endpwent_r d_endpwent_r
12329 eval $inlibc
12330 case "$d_endpwent_r" in
12331 "$define")
12332         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12333         case "$d_endpwent_r_proto:$usethreads" in
12334         ":define")      d_endpwent_r_proto=define
12335                 set d_endpwent_r_proto endpwent_r $hdrs
12336                 eval $hasproto ;;
12337         *)      ;;
12338         esac
12339         case "$d_endpwent_r_proto" in
12340         define)
12341         case "$endpwent_r_proto" in
12342         ''|0) try='int endpwent_r(FILE**);'
12343         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12344         esac
12345         case "$endpwent_r_proto" in
12346         ''|0) try='void endpwent_r(FILE**);'
12347         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12348         esac
12349         case "$endpwent_r_proto" in
12350         ''|0)   d_endpwent_r=undef
12351                 endpwent_r_proto=0
12352                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12353         * )     case "$endpwent_r_proto" in
12354                 REENTRANT_PROTO*) ;;
12355                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12356                 esac
12357                 echo "Prototype: $try" ;;
12358         esac
12359         ;;
12360         *)      case "$usethreads" in
12361                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12362                 esac
12363                 d_endpwent_r=undef
12364                 endpwent_r_proto=0
12365                 ;;
12366         esac
12367         ;;
12368 *)      endpwent_r_proto=0
12369         ;;
12370 esac
12371
12372 : see if endservent exists
12373 set endservent d_endsent
12374 eval $inlibc
12375
12376 : see if endservent_r exists
12377 set endservent_r d_endservent_r
12378 eval $inlibc
12379 case "$d_endservent_r" in
12380 "$define")
12381         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12382         case "$d_endservent_r_proto:$usethreads" in
12383         ":define")      d_endservent_r_proto=define
12384                 set d_endservent_r_proto endservent_r $hdrs
12385                 eval $hasproto ;;
12386         *)      ;;
12387         esac
12388         case "$d_endservent_r_proto" in
12389         define)
12390         case "$endservent_r_proto" in
12391         ''|0) try='int endservent_r(struct servent_data*);'
12392         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12393         esac
12394         case "$endservent_r_proto" in
12395         ''|0) try='void endservent_r(struct servent_data*);'
12396         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12397         esac
12398         case "$endservent_r_proto" in
12399         ''|0)   d_endservent_r=undef
12400                 endservent_r_proto=0
12401                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12402         * )     case "$endservent_r_proto" in
12403                 REENTRANT_PROTO*) ;;
12404                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12405                 esac
12406                 echo "Prototype: $try" ;;
12407         esac
12408         ;;
12409         *)      case "$usethreads" in
12410                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12411                 esac
12412                 d_endservent_r=undef
12413                 endservent_r_proto=0
12414                 ;;
12415         esac
12416         ;;
12417 *)      endservent_r_proto=0
12418         ;;
12419 esac
12420
12421 : Locate the flags for 'open()'
12422 echo " "
12423 $cat >try.c <<EOCP
12424 #include <sys/types.h>
12425 #ifdef I_FCNTL
12426 #include <fcntl.h>
12427 #endif
12428 #ifdef I_SYS_FILE
12429 #include <sys/file.h>
12430 #endif
12431 #$i_stdlib I_STDLIB
12432 #ifdef I_STDLIB
12433 #include <stdlib.h>
12434 #endif
12435 int main() {
12436         if(O_RDONLY);
12437 #ifdef O_TRUNC
12438         exit(0);
12439 #else
12440         exit(1);
12441 #endif
12442 }
12443 EOCP
12444 : check sys/file.h first to get FREAD on Sun
12445 if $test `./findhdr sys/file.h` && \
12446                 set try -DI_SYS_FILE && eval $compile; then
12447         h_sysfile=true;
12448         echo "<sys/file.h> defines the O_* constants..." >&4
12449         if $run ./try; then
12450                 echo "and you have the 3 argument form of open()." >&4
12451                 val="$define"
12452         else
12453                 echo "but not the 3 argument form of open().  Oh, well." >&4
12454                 val="$undef"
12455         fi
12456 elif $test `./findhdr fcntl.h` && \
12457                 set try -DI_FCNTL && eval $compile; then
12458         h_fcntl=true;
12459         echo "<fcntl.h> defines the O_* constants..." >&4
12460         if $run ./try; then
12461                 echo "and you have the 3 argument form of open()." >&4
12462                 val="$define"
12463         else
12464                 echo "but not the 3 argument form of open().  Oh, well." >&4
12465                 val="$undef"
12466         fi
12467 else
12468         val="$undef"
12469         echo "I can't find the O_* constant definitions!  You got problems." >&4
12470 fi
12471 set d_open3
12472 eval $setvar
12473 $rm_try
12474
12475 : see if this is a sys/file.h system
12476 val=''
12477 set sys/file.h val
12478 eval $inhdr
12479
12480 : do we need to include sys/file.h ?
12481 case "$val" in
12482 "$define")
12483         echo " "
12484         if $h_sysfile; then
12485                 val="$define"
12486                 echo "We'll be including <sys/file.h>." >&4
12487         else
12488                 val="$undef"
12489                 echo "We won't be including <sys/file.h>." >&4
12490         fi
12491         ;;
12492 *)
12493         h_sysfile=false
12494         ;;
12495 esac
12496 set i_sysfile
12497 eval $setvar
12498
12499 : see if fcntl.h is there
12500 val=''
12501 set fcntl.h val
12502 eval $inhdr
12503
12504 : see if we can include fcntl.h
12505 case "$val" in
12506 "$define")
12507         echo " "
12508         if $h_fcntl; then
12509                 val="$define"
12510                 echo "We'll be including <fcntl.h>." >&4
12511         else
12512                 val="$undef"
12513                 if $h_sysfile; then
12514         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12515                 else
12516                         echo "We won't be including <fcntl.h>." >&4
12517                 fi
12518         fi
12519         ;;
12520 *)
12521         h_fcntl=false
12522         val="$undef"
12523         ;;
12524 esac
12525 set i_fcntl
12526 eval $setvar
12527
12528 : see if fork exists
12529 set fork d_fork
12530 eval $inlibc
12531
12532 : see if pipe exists
12533 set pipe d_pipe
12534 eval $inlibc
12535
12536 : check for non-blocking I/O stuff
12537 case "$h_sysfile" in
12538 true) echo "#include <sys/file.h>" > head.c;;
12539 *)
12540        case "$h_fcntl" in
12541        true) echo "#include <fcntl.h>" > head.c;;
12542        *) echo "#include <sys/fcntl.h>" > head.c;;
12543        esac
12544        ;;
12545 esac
12546 echo " "
12547 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12548 case "$o_nonblock" in
12549 '')
12550         $cat head.c > try.c
12551         $cat >>try.c <<EOCP
12552 #include <stdio.h>
12553 #$i_stdlib I_STDLIB
12554 #ifdef I_STDLIB
12555 #include <stdlib.h>
12556 #endif
12557 #$i_fcntl I_FCNTL
12558 #ifdef I_FCNTL
12559 #include <fcntl.h>
12560 #endif
12561 int main() {
12562 #ifdef O_NONBLOCK
12563         printf("O_NONBLOCK\n");
12564         exit(0);
12565 #endif
12566 #ifdef O_NDELAY
12567         printf("O_NDELAY\n");
12568         exit(0);
12569 #endif
12570 #ifdef FNDELAY
12571         printf("FNDELAY\n");
12572         exit(0);
12573 #endif
12574         exit(0);
12575 }
12576 EOCP
12577         set try
12578         if eval $compile_ok; then
12579                 o_nonblock=`$run ./try`
12580                 case "$o_nonblock" in
12581                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12582                 *) echo "Seems like we can use $o_nonblock.";;
12583                 esac
12584         else
12585                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12586         fi
12587         ;;
12588 *) echo "Using $hint value $o_nonblock.";;
12589 esac
12590 $rm_try
12591
12592 echo " "
12593 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12594 case "$eagain" in
12595 '')
12596         case "$d_fork:$d_pipe" in
12597         define:define)
12598         $cat head.c > try.c
12599         $cat >>try.c <<EOCP
12600 #include <errno.h>
12601 #include <sys/types.h>
12602 #include <signal.h>
12603 #include <stdio.h>
12604 #$i_stdlib I_STDLIB
12605 #ifdef I_STDLIB
12606 #include <stdlib.h>
12607 #endif
12608 #$i_fcntl I_FCNTL
12609 #ifdef I_FCNTL
12610 #include <fcntl.h>
12611 #endif
12612 #define MY_O_NONBLOCK $o_nonblock
12613 #ifndef errno  /* XXX need better Configure test */
12614 extern int errno;
12615 #endif
12616 #$i_unistd I_UNISTD
12617 #ifdef I_UNISTD
12618 #include <unistd.h>
12619 #endif
12620 #$i_string I_STRING
12621 #ifdef I_STRING
12622 #include <string.h>
12623 #else
12624 #include <strings.h>
12625 #endif
12626 $signal_t blech(int x) { exit(3); }
12627 EOCP
12628         $cat >> try.c <<'EOCP'
12629 int main()
12630 {
12631         int pd[2];
12632         int pu[2];
12633         char buf[1];
12634         char string[100];
12635
12636         pipe(pd);       /* Down: child -> parent */
12637         pipe(pu);       /* Up: parent -> child */
12638         if (0 != fork()) {
12639                 int ret;
12640                 close(pd[1]);   /* Parent reads from pd[0] */
12641                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12642 #ifdef F_SETFL
12643                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12644                         exit(1);
12645 #else
12646                 exit(4);
12647 #endif
12648                 signal(SIGALRM, blech);
12649                 alarm(5);
12650                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12651                         exit(2);
12652                 sprintf(string, "%d\n", ret);
12653                 write(2, string, strlen(string));
12654                 alarm(0);
12655 #ifdef EAGAIN
12656                 if (errno == EAGAIN) {
12657                         printf("EAGAIN\n");
12658                         goto ok;
12659                 }
12660 #endif
12661 #ifdef EWOULDBLOCK
12662                 if (errno == EWOULDBLOCK)
12663                         printf("EWOULDBLOCK\n");
12664 #endif
12665         ok:
12666                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12667                 sleep(2);                               /* Give it time to close our pipe */
12668                 alarm(5);
12669                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12670                 alarm(0);
12671                 sprintf(string, "%d\n", ret);
12672                 write(4, string, strlen(string));
12673                 exit(0);
12674         }
12675
12676         close(pd[0]);                   /* We write to pd[1] */
12677         close(pu[1]);                   /* We read from pu[0] */
12678         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12679         close(pd[1]);                   /* Pipe pd is now fully closed! */
12680         exit(0);                                /* Bye bye, thank you for playing! */
12681 }
12682 EOCP
12683         set try
12684         if eval $compile_ok; then
12685                 echo "$startsh" >mtry
12686                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12687                 chmod +x mtry
12688                 ./mtry >/dev/null 2>&1
12689                 case $? in
12690                 0) eagain=`$cat try.out`;;
12691                 1) echo "Could not perform non-blocking setting!";;
12692                 2) echo "I did a successful read() for something that was not there!";;
12693                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12694                 4) echo "Could not find F_SETFL!";;
12695                 *) echo "Something terribly wrong happened during testing.";;
12696                 esac
12697                 rd_nodata=`$cat try.ret`
12698                 echo "A read() system call with no data present returns $rd_nodata."
12699                 case "$rd_nodata" in
12700                 0|-1) ;;
12701                 *)
12702                         echo "(That's peculiar, fixing that to be -1.)"
12703                         rd_nodata=-1
12704                         ;;
12705                 esac
12706                 case "$eagain" in
12707                 '')
12708                         echo "Forcing errno EAGAIN on read() with no data available."
12709                         eagain=EAGAIN
12710                         ;;
12711                 *)
12712                         echo "Your read() sets errno to $eagain when no data is available."
12713                         ;;
12714                 esac
12715                 status=`$cat try.err`
12716                 case "$status" in
12717                 0) echo "And it correctly returns 0 to signal EOF.";;
12718                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12719                 *) echo "However, your read() returns '$status' on EOF??";;
12720                 esac
12721                 val="$define"
12722                 if test "$status" = "$rd_nodata"; then
12723                         echo "WARNING: you can't distinguish between EOF and no data!"
12724                         val="$undef"
12725                 fi
12726         else
12727                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12728                 eagain=EAGAIN
12729         fi
12730         ;;
12731         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12732                 eagain=EAGAIN
12733                 val="$define"
12734                 ;;
12735         esac
12736         set d_eofnblk
12737         eval $setvar
12738         ;;
12739 *)
12740         echo "Using $hint value $eagain."
12741         echo "Your read() returns $rd_nodata when no data is present."
12742         case "$d_eofnblk" in
12743         "$define") echo "And you can see EOF because read() returns 0.";;
12744         "$undef") echo "But you can't see EOF status from read() returned value.";;
12745         *)
12746                 echo "(Assuming you can't see EOF status from read anyway.)"
12747                 d_eofnblk=$undef
12748                 ;;
12749         esac
12750         ;;
12751 esac
12752 $rm_try head.c mtry
12753
12754 : see if _ptr and _cnt from stdio act std
12755 echo " "
12756
12757 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12758         echo "(Looks like you have stdio.h from BSD.)"
12759         case "$stdio_ptr" in
12760         '') stdio_ptr='((fp)->_p)'
12761                 ptr_lval=$define
12762                 ;;
12763         *)      ptr_lval=$d_stdio_ptr_lval;;
12764         esac
12765         case "$stdio_cnt" in
12766         '') stdio_cnt='((fp)->_r)'
12767                 cnt_lval=$define
12768                 ;;
12769         *)      cnt_lval=$d_stdio_cnt_lval;;
12770         esac
12771         case "$stdio_base" in
12772         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12773         esac
12774         case "$stdio_bufsiz" in
12775         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12776         esac
12777 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12778         echo "(Looks like you have stdio.h from Linux.)"
12779         case "$stdio_ptr" in
12780         '') stdio_ptr='((fp)->_IO_read_ptr)'
12781                 ptr_lval=$define
12782                 ;;
12783         *)      ptr_lval=$d_stdio_ptr_lval;;
12784         esac
12785         case "$stdio_cnt" in
12786         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12787                 cnt_lval=$undef
12788                 ;;
12789         *)      cnt_lval=$d_stdio_cnt_lval;;
12790         esac
12791         case "$stdio_base" in
12792         '') stdio_base='((fp)->_IO_read_base)';;
12793         esac
12794         case "$stdio_bufsiz" in
12795         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12796         esac
12797 else
12798         case "$stdio_ptr" in
12799         '') stdio_ptr='((fp)->_ptr)'
12800                 ptr_lval=$define
12801                 ;;
12802         *)      ptr_lval=$d_stdio_ptr_lval;;
12803         esac
12804         case "$stdio_cnt" in
12805         '') stdio_cnt='((fp)->_cnt)'
12806                 cnt_lval=$define
12807                 ;;
12808         *)      cnt_lval=$d_stdio_cnt_lval;;
12809         esac
12810         case "$stdio_base" in
12811         '') stdio_base='((fp)->_base)';;
12812         esac
12813         case "$stdio_bufsiz" in
12814         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12815         esac
12816 fi
12817
12818 : test whether _ptr and _cnt really work
12819 echo "Checking how std your stdio is..." >&4
12820 $cat >try.c <<EOP
12821 #include <stdio.h>
12822 #$i_stdlib I_STDLIB
12823 #ifdef I_STDLIB
12824 #include <stdlib.h>
12825 #endif
12826 #define FILE_ptr(fp)    $stdio_ptr
12827 #define FILE_cnt(fp)    $stdio_cnt
12828 int main() {
12829         FILE *fp = fopen("try.c", "r");
12830         char c = getc(fp);
12831         if (
12832                 18 <= FILE_cnt(fp) &&
12833                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12834         )
12835                 exit(0);
12836         exit(1);
12837 }
12838 EOP
12839 val="$undef"
12840 set try
12841 if eval $compile && $to try.c; then
12842         if $run ./try; then
12843                 echo "Your stdio acts pretty std."
12844                 val="$define"
12845         else
12846                 echo "Your stdio isn't very std."
12847         fi
12848 else
12849         echo "Your stdio doesn't appear very std."
12850 fi
12851 $rm_try
12852
12853 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12854 # direct buffer manipulation no longer works.  The Configure tests
12855 # should be changed to correctly detect this, but until then,
12856 # the following check should at least let perl compile and run.
12857 # (This quick fix should be updated before 5.8.1.)
12858 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12859 # A. Dougherty, June 3, 2002.
12860 case "$d_gnulibc" in
12861 $define)
12862         case "$gnulibc_version" in
12863         2.[01]*)  ;;
12864         2.2) ;;
12865         2.2.[0-9]) ;;
12866         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12867                 val="$undef"
12868                 ;;
12869         esac
12870         ;;
12871 esac
12872 set d_stdstdio
12873 eval $setvar
12874
12875 : Can _ptr be used as an lvalue?
12876 case "$d_stdstdio$ptr_lval" in
12877 $define$define) val=$define ;;
12878 *) val=$undef ;;
12879 esac
12880 set d_stdio_ptr_lval
12881 eval $setvar
12882
12883 : Can _cnt be used as an lvalue?
12884 case "$d_stdstdio$cnt_lval" in
12885 $define$define) val=$define ;;
12886 *) val=$undef ;;
12887 esac
12888 set d_stdio_cnt_lval
12889 eval $setvar
12890
12891
12892 : test whether setting _ptr sets _cnt as a side effect
12893 d_stdio_ptr_lval_sets_cnt="$undef"
12894 d_stdio_ptr_lval_nochange_cnt="$undef"
12895 case "$d_stdio_ptr_lval$d_stdstdio" in
12896 $define$define)
12897         echo "Checking to see what happens if we set the stdio ptr..." >&4
12898 $cat >try.c <<EOP
12899 #include <stdio.h>
12900 /* Can we scream? */
12901 /* Eat dust sed :-) */
12902 /* In the buffer space, no one can hear you scream. */
12903 #$i_stdlib I_STDLIB
12904 #ifdef I_STDLIB
12905 #include <stdlib.h>
12906 #endif
12907 #define FILE_ptr(fp)    $stdio_ptr
12908 #define FILE_cnt(fp)    $stdio_cnt
12909 #include <sys/types.h>
12910 int main() {
12911         FILE *fp = fopen("try.c", "r");
12912         int c;
12913         char *ptr;
12914         size_t cnt;
12915         if (!fp) {
12916             puts("Fail even to read");
12917             exit(1);
12918         }
12919         c = getc(fp); /* Read away the first # */
12920         if (c == EOF) {
12921             puts("Fail even to read");
12922             exit(1);
12923         }
12924         if (!(
12925                 18 <= FILE_cnt(fp) &&
12926                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12927         )) {
12928                 puts("Fail even to read");
12929                 exit (1);
12930         }
12931         ptr = (char*) FILE_ptr(fp);
12932         cnt = (size_t)FILE_cnt(fp);
12933
12934         FILE_ptr(fp) += 42;
12935
12936         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12937                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12938                 exit (1);
12939         }
12940         if (FILE_cnt(fp) <= 20) {
12941                 printf ("Fail (<20 chars to test)");
12942                 exit (1);
12943         }
12944         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12945                 puts("Fail compare");
12946                 exit (1);
12947         }
12948         if (cnt == FILE_cnt(fp)) {
12949                 puts("Pass_unchanged");
12950                 exit (0);
12951         }
12952         if (FILE_cnt(fp) == (cnt - 42)) {
12953                 puts("Pass_changed");
12954                 exit (0);
12955         }
12956         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12957         return 1;
12958
12959 }
12960 EOP
12961         set try
12962         if eval $compile && $to try.c; then
12963                 case `$run ./try` in
12964                 Pass_changed)
12965                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12966                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12967                 Pass_unchanged)
12968                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12969                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12970                 Fail*)
12971                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12972                 *)
12973                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12974         esac
12975         else
12976                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12977         fi
12978         $rm_try
12979         ;;
12980 esac
12981
12982 : see if _base is also standard
12983 val="$undef"
12984 case "$d_stdstdio" in
12985 $define)
12986         $cat >try.c <<EOP
12987 #include <stdio.h>
12988 #$i_stdlib I_STDLIB
12989 #ifdef I_STDLIB
12990 #include <stdlib.h>
12991 #endif
12992 #define FILE_base(fp)   $stdio_base
12993 #define FILE_bufsiz(fp) $stdio_bufsiz
12994 int main() {
12995         FILE *fp = fopen("try.c", "r");
12996         char c = getc(fp);
12997         if (
12998                 19 <= FILE_bufsiz(fp) &&
12999                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13000         )
13001                 exit(0);
13002         exit(1);
13003 }
13004 EOP
13005         set try
13006         if eval $compile && $to try.c; then
13007                 if $run ./try; then
13008                         echo "And its _base field acts std."
13009                         val="$define"
13010                 else
13011                         echo "But its _base field isn't std."
13012                 fi
13013         else
13014                 echo "However, it seems to be lacking the _base field."
13015         fi
13016         $rm_try
13017         ;;
13018 esac
13019 set d_stdiobase
13020 eval $setvar
13021
13022 : see if fast_stdio exists
13023 val="$undef"
13024 case "$d_stdstdio:$d_stdio_ptr_lval" in
13025 "$define:$define")
13026         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13027         *$define*)
13028                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13029                 val="$define"
13030                 ;;
13031         esac
13032         ;;
13033 esac
13034 set d_faststdio
13035 eval $setvar
13036
13037
13038
13039 : see if fchdir exists
13040 set fchdir d_fchdir
13041 eval $inlibc
13042
13043 : see if fchmod exists
13044 set fchmod d_fchmod
13045 eval $inlibc
13046
13047 : see if fchown exists
13048 set fchown d_fchown
13049 eval $inlibc
13050
13051 : see if this is an fcntl system
13052 set fcntl d_fcntl
13053 eval $inlibc
13054
13055 : See if fcntl-based locking works.
13056 echo " "
13057 $cat >try.c <<EOCP
13058 #$i_stdlib I_STDLIB
13059 #ifdef I_STDLIB
13060 #include <stdlib.h>
13061 #endif
13062 #include <unistd.h>
13063 #include <fcntl.h>
13064 #include <signal.h>
13065 $signal_t blech(int x) { exit(3); }
13066 int main() {
13067 #if defined(F_SETLK) && defined(F_SETLKW)
13068      struct flock flock;
13069      int retval, fd;
13070      fd = open("try.c", O_RDONLY);
13071      flock.l_type = F_RDLCK;
13072      flock.l_whence = SEEK_SET;
13073      flock.l_start = flock.l_len = 0;
13074      signal(SIGALRM, blech);
13075      alarm(10);
13076      retval = fcntl(fd, F_SETLK, &flock);
13077      close(fd);
13078      (retval < 0 ? exit(2) : exit(0));
13079 #else
13080      exit(2);
13081 #endif
13082 }
13083 EOCP
13084 echo "Checking if fcntl-based file locking works... "
13085 case "$d_fcntl" in
13086 "$define")
13087         set try
13088         if eval $compile_ok; then
13089                 if $run ./try; then
13090                         echo "Yes, it seems to work."
13091                         val="$define"
13092                 else
13093                         echo "Nope, it didn't work."
13094                         val="$undef"
13095                         case "$?" in
13096                         3) $cat >&4 <<EOM
13097 ***
13098 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13099 *** This is (almost) impossible.
13100 *** If your NFS lock daemons are not feeling well, something like
13101 *** this may happen, please investigate.  Cannot continue, aborting.
13102 ***
13103 EOM
13104                                 exit 1
13105                                 ;;
13106                         esac
13107                 fi
13108         else
13109                 echo "I'm unable to compile the test program, so I'll assume not."
13110                 val="$undef"
13111         fi
13112         ;;
13113 *) val="$undef";
13114         echo "Nope, since you don't even have fcntl()."
13115         ;;
13116 esac
13117 set d_fcntl_can_lock
13118 eval $setvar
13119 $rm_try
13120
13121 : check for fd_set items
13122 $cat <<EOM
13123
13124 Checking to see how well your C compiler handles fd_set and friends ...
13125 EOM
13126 $cat >try.c <<EOCP
13127 #$i_stdlib I_STDLIB
13128 #ifdef I_STDLIB
13129 #include <stdlib.h>
13130 #endif
13131 #$i_systime I_SYS_TIME
13132 #$i_sysselct I_SYS_SELECT
13133 #$d_socket HAS_SOCKET
13134 #include <sys/types.h>
13135 #ifdef HAS_SOCKET
13136 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13137 #endif
13138 #ifdef I_SYS_TIME
13139 #include <sys/time.h>
13140 #endif
13141 #ifdef I_SYS_SELECT
13142 #include <sys/select.h>
13143 #endif
13144 int main() {
13145         fd_set fds;
13146
13147 #ifdef TRYBITS
13148         if(fds.fds_bits);
13149 #endif
13150
13151 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13152         exit(0);
13153 #else
13154         exit(1);
13155 #endif
13156 }
13157 EOCP
13158 set try -DTRYBITS
13159 if eval $compile; then
13160         d_fds_bits="$define"
13161         d_fd_set="$define"
13162         echo "Well, your system knows about the normal fd_set typedef..." >&4
13163         if $run ./try; then
13164                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13165                 d_fd_macros="$define"
13166         else
13167                 $cat >&4 <<'EOM'
13168 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13169 EOM
13170                 d_fd_macros="$undef"
13171         fi
13172 else
13173         $cat <<'EOM'
13174 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13175 EOM
13176         set try
13177         if eval $compile; then
13178                 d_fds_bits="$undef"
13179                 d_fd_set="$define"
13180                 echo "Well, your system has some sort of fd_set available..." >&4
13181                 if $run ./try; then
13182                         echo "and you have the normal fd_set macros." >&4
13183                         d_fd_macros="$define"
13184                 else
13185                         $cat <<'EOM'
13186 but not the normal fd_set macros!  Gross!  More work for me...
13187 EOM
13188                         d_fd_macros="$undef"
13189                 fi
13190         else
13191         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13192                 d_fd_set="$undef"
13193                 d_fds_bits="$undef"
13194                 d_fd_macros="$undef"
13195         fi
13196 fi
13197 $rm_try
13198
13199 : see if fgetpos exists
13200 set fgetpos d_fgetpos
13201 eval $inlibc
13202
13203 : see if finite exists
13204 set finite d_finite
13205 eval $inlibc
13206
13207 : see if finitel exists
13208 set finitel d_finitel
13209 eval $inlibc
13210
13211 : see if flock exists
13212 set flock d_flock
13213 eval $inlibc
13214
13215 : see if prototype for flock is available
13216 echo " "
13217 set d_flockproto flock $i_sysfile sys/file.h
13218 eval $hasproto
13219
13220 : see if fp_class exists
13221 set fp_class d_fp_class
13222 eval $inlibc
13223
13224 : see if pathconf exists
13225 set pathconf d_pathconf
13226 eval $inlibc
13227
13228 : see if fpathconf exists
13229 set fpathconf d_fpathconf
13230 eval $inlibc
13231
13232 : see if fpclass exists
13233 set fpclass d_fpclass
13234 eval $inlibc
13235
13236 : see if fpclassify exists
13237 set fpclassify d_fpclassify
13238 eval $inlibc
13239
13240 : see if fpclassl exists
13241 set fpclassl d_fpclassl
13242 eval $inlibc
13243
13244 : check for fpos64_t
13245 echo " "
13246 echo "Checking to see if you have fpos64_t..." >&4
13247 $cat >try.c <<EOCP
13248 #include <stdio.h>
13249 int main() { fpos64_t x = 7; }
13250 EOCP
13251 set try
13252 if eval $compile; then
13253         val="$define"
13254         echo "You have fpos64_t."
13255 else
13256         val="$undef"
13257         echo "You do not have fpos64_t."
13258         case "$fpossize" in
13259         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13260         esac
13261 fi
13262 $rm_try
13263 set d_fpos64_t
13264 eval $setvar
13265
13266 : see if frexpl exists
13267 set frexpl d_frexpl
13268 eval $inlibc
13269
13270 : see if this is a sys/param system
13271 set sys/param.h i_sysparam
13272 eval $inhdr
13273
13274 : see if this is a sys/mount.h system
13275 set sys/mount.h i_sysmount
13276 eval $inhdr
13277
13278 : Check for fs_data_s
13279 echo " "
13280 echo "Checking to see if your system supports struct fs_data..." >&4
13281 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13282 eval $hasstruct
13283 case "$d_fs_data_s" in
13284 "$define")      echo "Yes, it does."   ;;
13285 *)              echo "No, it doesn't." ;;
13286 esac
13287
13288 : see if fseeko exists
13289 set fseeko d_fseeko
13290 eval $inlibc
13291 case "$longsize" in
13292 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13293 esac
13294
13295 : see if fsetpos exists
13296 set fsetpos d_fsetpos
13297 eval $inlibc
13298
13299 : see if fstatfs exists
13300 set fstatfs d_fstatfs
13301 eval $inlibc
13302
13303 : see if statvfs exists
13304 set statvfs d_statvfs
13305 eval $inlibc
13306
13307 : see if fstatvfs exists
13308 set fstatvfs d_fstatvfs
13309 eval $inlibc
13310
13311
13312 : see if fsync exists
13313 set fsync d_fsync
13314 eval $inlibc
13315
13316 : see if ftello exists
13317 set ftello d_ftello
13318 eval $inlibc
13319 case "$longsize" in
13320 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13321 esac
13322
13323 : check for a working futimes
13324 d_futimes="$undef"
13325 echo " "
13326 echo "Checking if you have a working futimes()" >&4
13327 $cat >try.c <<EOCP
13328 #include <stdio.h>
13329 #include <sys/time.h>
13330 #include <errno.h>
13331 #include <fcntl.h>
13332
13333 int main ()
13334 {
13335     int fd, rv;
13336     fd = open ("try.c", O_RDWR);
13337     if (-1 == fd) exit (1);
13338     rv = futimes (fd, NULL);
13339     exit (rv == -1 ? errno : 0);
13340 }
13341 EOCP
13342 set try
13343 if eval $compile; then
13344     `$run ./try`
13345     rc=$?
13346     case "$rc" in
13347         0)  echo "Yes, you have" >&4
13348             d_futimes="$define"
13349             ;;
13350         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13351             ;;
13352     esac
13353 else
13354     echo "No, it does not (probably harmless)" >&4
13355 fi
13356 $rm_try
13357
13358 : see if ndbm.h is available
13359 set ndbm.h i_ndbm
13360 eval $inhdr
13361 : Compatibility location for RedHat 7.1
13362 set gdbm/ndbm.h i_gdbmndbm
13363 eval $inhdr
13364 : Compatibility location for Debian 4.0
13365 set gdbm-ndbm.h i_gdbm_ndbm
13366 eval $inhdr
13367
13368 val="$undef"
13369 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13370         : see if dbm_open exists
13371         set dbm_open d_dbm_open
13372         eval $inlibc
13373         case "$d_dbm_open" in
13374         $undef)
13375                 i_ndbm="$undef"
13376                 i_gdbmndbm="$undef"
13377                 i_gdbm_ndbm="$undef"
13378                 echo "We won't be including <ndbm.h>"
13379                 val="$undef"
13380                 ;;
13381         *) val="$define"
13382            ;;
13383         esac
13384 fi
13385 set d_ndbm
13386 eval $setvar
13387
13388 ndbm_hdr_protochk='name=$1; hdr=$2;
13389 eval "ihdr=\$""i_$name";
13390 val="$undef";
13391 if $test "$ihdr" = "$define"; then
13392         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13393         case "$d_cplusplus" in
13394         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13395         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13396         esac;
13397         case "$val" in
13398         $define) $echo "Your <$hdr> seems to have prototypes";;
13399         *) $echo "Your <$hdr> does not seem to have prototypes";;
13400         esac;
13401 fi;
13402 set "d_${name}_h_uses_prototypes";
13403 eval $setvar'
13404
13405 set ndbm ndbm.h
13406 eval $ndbm_hdr_protochk
13407 set gdbmndbm gdbm/ndbm.h
13408 eval $ndbm_hdr_protochk
13409 set gdbm_ndbm gdbm-ndbm.h
13410 eval $ndbm_hdr_protochk
13411
13412 : see if getaddrinfo exists
13413 set getaddrinfo d_getaddrinfo
13414 eval $inlibc
13415
13416 : see if getcwd exists
13417 set getcwd d_getcwd
13418 eval $inlibc
13419
13420 : see if getespwnam exists
13421 set getespwnam d_getespwnam
13422 eval $inlibc
13423
13424 : see if getfsstat exists
13425 set getfsstat d_getfsstat
13426 eval $inlibc
13427
13428 : see if getgrent exists
13429 set getgrent d_getgrent
13430 eval $inlibc
13431
13432 : see if getgrent_r exists
13433 set getgrent_r d_getgrent_r
13434 eval $inlibc
13435 case "$d_getgrent_r" in
13436 "$define")
13437         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13438         case "$d_getgrent_r_proto:$usethreads" in
13439         ":define")      d_getgrent_r_proto=define
13440                 set d_getgrent_r_proto getgrent_r $hdrs
13441                 eval $hasproto ;;
13442         *)      ;;
13443         esac
13444         case "$d_getgrent_r_proto" in
13445         define)
13446         case "$getgrent_r_proto" in
13447         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13448         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13449         esac
13450         case "$getgrent_r_proto" in
13451         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13452         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13453         esac
13454         case "$getgrent_r_proto" in
13455         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13456         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13457         esac
13458         case "$getgrent_r_proto" in
13459         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13460         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13461         esac
13462         case "$getgrent_r_proto" in
13463         ''|0) try='int getgrent_r(struct group*, char*, int);'
13464         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13465         esac
13466         case "$getgrent_r_proto" in
13467         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13468         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13469         esac
13470         case "$getgrent_r_proto" in
13471         ''|0)   d_getgrent_r=undef
13472                 getgrent_r_proto=0
13473                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13474         * )     case "$getgrent_r_proto" in
13475                 REENTRANT_PROTO*) ;;
13476                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13477                 esac
13478                 echo "Prototype: $try" ;;
13479         esac
13480         ;;
13481         *)      case "$usethreads" in
13482                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13483                 esac
13484                 d_getgrent_r=undef
13485                 getgrent_r_proto=0
13486                 ;;
13487         esac
13488         ;;
13489 *)      getgrent_r_proto=0
13490         ;;
13491 esac
13492
13493 : see if getgrgid_r exists
13494 set getgrgid_r d_getgrgid_r
13495 eval $inlibc
13496 case "$d_getgrgid_r" in
13497 "$define")
13498         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13499         case "$d_getgrgid_r_proto:$usethreads" in
13500         ":define")      d_getgrgid_r_proto=define
13501                 set d_getgrgid_r_proto getgrgid_r $hdrs
13502                 eval $hasproto ;;
13503         *)      ;;
13504         esac
13505         case "$d_getgrgid_r_proto" in
13506         define)
13507         case "$getgrgid_r_proto" in
13508         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13509         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13510         esac
13511         case "$getgrgid_r_proto" in
13512         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13513         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13514         esac
13515         case "$getgrgid_r_proto" in
13516         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13517         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13518         esac
13519         case "$getgrgid_r_proto" in
13520         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13521         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13522         esac
13523         case "$getgrgid_r_proto" in
13524         ''|0)   d_getgrgid_r=undef
13525                 getgrgid_r_proto=0
13526                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13527         * )     case "$getgrgid_r_proto" in
13528                 REENTRANT_PROTO*) ;;
13529                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13530                 esac
13531                 echo "Prototype: $try" ;;
13532         esac
13533         ;;
13534         *)      case "$usethreads" in
13535                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13536                 esac
13537                 d_getgrgid_r=undef
13538                 getgrgid_r_proto=0
13539                 ;;
13540         esac
13541         ;;
13542 *)      getgrgid_r_proto=0
13543         ;;
13544 esac
13545
13546 : see if getgrnam_r exists
13547 set getgrnam_r d_getgrnam_r
13548 eval $inlibc
13549 case "$d_getgrnam_r" in
13550 "$define")
13551         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13552         case "$d_getgrnam_r_proto:$usethreads" in
13553         ":define")      d_getgrnam_r_proto=define
13554                 set d_getgrnam_r_proto getgrnam_r $hdrs
13555                 eval $hasproto ;;
13556         *)      ;;
13557         esac
13558         case "$d_getgrnam_r_proto" in
13559         define)
13560         case "$getgrnam_r_proto" in
13561         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13562         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13563         esac
13564         case "$getgrnam_r_proto" in
13565         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13566         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13567         esac
13568         case "$getgrnam_r_proto" in
13569         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13570         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13571         esac
13572         case "$getgrnam_r_proto" in
13573         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13574         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13575         esac
13576         case "$getgrnam_r_proto" in
13577         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13578         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13579         esac
13580         case "$getgrnam_r_proto" in
13581         ''|0)   d_getgrnam_r=undef
13582                 getgrnam_r_proto=0
13583                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13584         * )     case "$getgrnam_r_proto" in
13585                 REENTRANT_PROTO*) ;;
13586                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13587                 esac
13588                 echo "Prototype: $try" ;;
13589         esac
13590         ;;
13591         *)      case "$usethreads" in
13592                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13593                 esac
13594                 d_getgrnam_r=undef
13595                 getgrnam_r_proto=0
13596                 ;;
13597         esac
13598         ;;
13599 *)      getgrnam_r_proto=0
13600         ;;
13601 esac
13602
13603 : see if gethostbyaddr exists
13604 set gethostbyaddr d_gethbyaddr
13605 eval $inlibc
13606
13607 : see if gethostbyname exists
13608 set gethostbyname d_gethbyname
13609 eval $inlibc
13610
13611 : see if gethostent exists
13612 set gethostent d_gethent
13613 eval $inlibc
13614
13615 : see how we will look up host name
13616 echo " "
13617 call=''
13618 if set gethostname val -f d_gethname; eval $csym; $val; then
13619         echo 'gethostname() found.' >&4
13620         d_gethname="$define"
13621         call=gethostname
13622 fi
13623 if set uname val -f d_uname; eval $csym; $val; then
13624         if ./xenix; then
13625                 $cat <<'EOM'
13626 uname() was found, but you're running xenix, and older versions of xenix
13627 have a broken uname(). If you don't really know whether your xenix is old
13628 enough to have a broken system call, use the default answer.
13629
13630 EOM
13631                 dflt=y
13632                 case "$d_uname" in
13633                 "$define") dflt=n;;
13634                 esac
13635                 rp='Is your uname() broken?'
13636                 . ./myread
13637                 case "$ans" in
13638                 n*) d_uname="$define"; call=uname;;
13639                 esac
13640         else
13641                 echo 'uname() found.' >&4
13642                 d_uname="$define"
13643                 case "$call" in
13644                 '') call=uname ;;
13645                 esac
13646         fi
13647 fi
13648 case "$d_gethname" in
13649 '') d_gethname="$undef";;
13650 esac
13651 case "$d_uname" in
13652 '') d_uname="$undef";;
13653 esac
13654 case "$d_uname$d_gethname" in
13655 *define*)
13656         dflt=n
13657         cat <<EOM
13658
13659 Every now and then someone has a $call() that lies about the hostname
13660 but can't be fixed for political or economic reasons.  If you wish, I can
13661 pretend $call() isn't there and maybe compute hostname at run-time
13662 thanks to the '$phostname' command.
13663
13664 EOM
13665         rp="Shall I ignore $call() from now on?"
13666         . ./myread
13667         case "$ans" in
13668         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13669         esac;;
13670 esac
13671 case "$phostname" in
13672 '') aphostname='';;
13673 *) case "$aphostname" in
13674         /*) ;;
13675         *) set X $phostname
13676                 shift
13677                 file=$1
13678                 shift
13679                 file=`./loc $file $file $pth`
13680                 aphostname=`echo $file $*`
13681                 ;;
13682         esac
13683         ;;
13684 esac
13685 case "$d_uname$d_gethname" in
13686 *define*) ;;
13687 *)
13688         case "$phostname" in
13689         '')
13690                 echo "There will be no way for $package to get your hostname." >&4;;
13691         *)
13692         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13693                 ;;
13694         esac;;
13695 esac
13696 case "$d_phostname" in
13697 '') d_phostname="$undef";;
13698 esac
13699
13700 : see if gethostbyaddr_r exists
13701 set gethostbyaddr_r d_gethostbyaddr_r
13702 eval $inlibc
13703 case "$d_gethostbyaddr_r" in
13704 "$define")
13705         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13706         case "$d_gethostbyaddr_r_proto:$usethreads" in
13707         ":define")      d_gethostbyaddr_r_proto=define
13708                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13709                 eval $hasproto ;;
13710         *)      ;;
13711         esac
13712         case "$d_gethostbyaddr_r_proto" in
13713         define)
13714         case "$gethostbyaddr_r_proto" in
13715         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13716         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13717         esac
13718         case "$gethostbyaddr_r_proto" in
13719         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13720         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13721         esac
13722         case "$gethostbyaddr_r_proto" in
13723         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13724         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13725         esac
13726         case "$gethostbyaddr_r_proto" in
13727         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13728         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13729         esac
13730         case "$gethostbyaddr_r_proto" in
13731         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13732         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13733         esac
13734         case "$gethostbyaddr_r_proto" in
13735         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13736         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13737         esac
13738         case "$gethostbyaddr_r_proto" in
13739         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13740         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13741         esac
13742         case "$gethostbyaddr_r_proto" in
13743         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13744         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13745         esac
13746         case "$gethostbyaddr_r_proto" in
13747         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13748         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13749         esac
13750         case "$gethostbyaddr_r_proto" in
13751         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13752         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13753         esac
13754         case "$gethostbyaddr_r_proto" in
13755         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13756         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13757         esac
13758         case "$gethostbyaddr_r_proto" in
13759         ''|0)   d_gethostbyaddr_r=undef
13760                 gethostbyaddr_r_proto=0
13761                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13762         * )     case "$gethostbyaddr_r_proto" in
13763                 REENTRANT_PROTO*) ;;
13764                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13765                 esac
13766                 echo "Prototype: $try" ;;
13767         esac
13768         ;;
13769         *)      case "$usethreads" in
13770                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13771                 esac
13772                 d_gethostbyaddr_r=undef
13773                 gethostbyaddr_r_proto=0
13774                 ;;
13775         esac
13776         ;;
13777 *)      gethostbyaddr_r_proto=0
13778         ;;
13779 esac
13780
13781 : see if gethostbyname_r exists
13782 set gethostbyname_r d_gethostbyname_r
13783 eval $inlibc
13784 case "$d_gethostbyname_r" in
13785 "$define")
13786         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13787         case "$d_gethostbyname_r_proto:$usethreads" in
13788         ":define")      d_gethostbyname_r_proto=define
13789                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13790                 eval $hasproto ;;
13791         *)      ;;
13792         esac
13793         case "$d_gethostbyname_r_proto" in
13794         define)
13795         case "$gethostbyname_r_proto" in
13796         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13797         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13798         esac
13799         case "$gethostbyname_r_proto" in
13800         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13801         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13802         esac
13803         case "$gethostbyname_r_proto" in
13804         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13805         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13806         esac
13807         case "$gethostbyname_r_proto" in
13808         ''|0)   d_gethostbyname_r=undef
13809                 gethostbyname_r_proto=0
13810                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13811         * )     case "$gethostbyname_r_proto" in
13812                 REENTRANT_PROTO*) ;;
13813                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13814                 esac
13815                 echo "Prototype: $try" ;;
13816         esac
13817         ;;
13818         *)      case "$usethreads" in
13819                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13820                 esac
13821                 d_gethostbyname_r=undef
13822                 gethostbyname_r_proto=0
13823                 ;;
13824         esac
13825         ;;
13826 *)      gethostbyname_r_proto=0
13827         ;;
13828 esac
13829
13830 : see if gethostent_r exists
13831 set gethostent_r d_gethostent_r
13832 eval $inlibc
13833 case "$d_gethostent_r" in
13834 "$define")
13835         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13836         case "$d_gethostent_r_proto:$usethreads" in
13837         ":define")      d_gethostent_r_proto=define
13838                 set d_gethostent_r_proto gethostent_r $hdrs
13839                 eval $hasproto ;;
13840         *)      ;;
13841         esac
13842         case "$d_gethostent_r_proto" in
13843         define)
13844         case "$gethostent_r_proto" in
13845         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13846         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13847         esac
13848         case "$gethostent_r_proto" in
13849         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13850         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13851         esac
13852         case "$gethostent_r_proto" in
13853         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13854         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13855         esac
13856         case "$gethostent_r_proto" in
13857         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13858         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13859         esac
13860         case "$gethostent_r_proto" in
13861         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13862         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13863         esac
13864         case "$gethostent_r_proto" in
13865         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13866         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13867         esac
13868         case "$gethostent_r_proto" in
13869         ''|0)   d_gethostent_r=undef
13870                 gethostent_r_proto=0
13871                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13872         * )     case "$gethostent_r_proto" in
13873                 REENTRANT_PROTO*) ;;
13874                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13875                 esac
13876                 echo "Prototype: $try" ;;
13877         esac
13878         ;;
13879         *)      case "$usethreads" in
13880                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13881                 esac
13882                 d_gethostent_r=undef
13883                 gethostent_r_proto=0
13884                 ;;
13885         esac
13886         ;;
13887 *)      gethostent_r_proto=0
13888         ;;
13889 esac
13890
13891 : see if prototypes for various gethostxxx netdb.h functions are available
13892 echo " "
13893 set d_gethostprotos gethostent $i_netdb netdb.h
13894 eval $hasproto
13895
13896 : see if getitimer exists
13897 set getitimer d_getitimer
13898 eval $inlibc
13899
13900 : see if getlogin exists
13901 set getlogin d_getlogin
13902 eval $inlibc
13903
13904 : see if getlogin_r exists
13905 set getlogin_r d_getlogin_r
13906 eval $inlibc
13907 case "$d_getlogin_r" in
13908 "$define")
13909         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13910         case "$d_getlogin_r_proto:$usethreads" in
13911         ":define")      d_getlogin_r_proto=define
13912                 set d_getlogin_r_proto getlogin_r $hdrs
13913                 eval $hasproto ;;
13914         *)      ;;
13915         esac
13916         case "$d_getlogin_r_proto" in
13917         define)
13918         case "$getlogin_r_proto" in
13919         ''|0) try='int getlogin_r(char*, size_t);'
13920         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13921         esac
13922         case "$getlogin_r_proto" in
13923         ''|0) try='int getlogin_r(char*, int);'
13924         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13925         esac
13926         case "$getlogin_r_proto" in
13927         ''|0) try='char* getlogin_r(char*, size_t);'
13928         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13929         esac
13930         case "$getlogin_r_proto" in
13931         ''|0) try='char* getlogin_r(char*, int);'
13932         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13933         esac
13934         case "$getlogin_r_proto" in
13935         ''|0)   d_getlogin_r=undef
13936                 getlogin_r_proto=0
13937                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13938         * )     case "$getlogin_r_proto" in
13939                 REENTRANT_PROTO*) ;;
13940                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13941                 esac
13942                 echo "Prototype: $try" ;;
13943         esac
13944         ;;
13945         *)      case "$usethreads" in
13946                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13947                 esac
13948                 d_getlogin_r=undef
13949                 getlogin_r_proto=0
13950                 ;;
13951         esac
13952         ;;
13953 *)      getlogin_r_proto=0
13954         ;;
13955 esac
13956
13957 : see if getmnt exists
13958 set getmnt d_getmnt
13959 eval $inlibc
13960
13961 : see if getmntent exists
13962 set getmntent d_getmntent
13963 eval $inlibc
13964
13965 : see if getnameinfo exists
13966 set getnameinfo d_getnameinfo
13967 eval $inlibc
13968
13969 : see if getnetbyaddr exists
13970 set getnetbyaddr d_getnbyaddr
13971 eval $inlibc
13972
13973 : see if getnetbyname exists
13974 set getnetbyname d_getnbyname
13975 eval $inlibc
13976
13977 : see if getnetent exists
13978 set getnetent d_getnent
13979 eval $inlibc
13980
13981 : see if getnetbyaddr_r exists
13982 set getnetbyaddr_r d_getnetbyaddr_r
13983 eval $inlibc
13984 case "$d_getnetbyaddr_r" in
13985 "$define")
13986         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13987         case "$d_getnetbyaddr_r_proto:$usethreads" in
13988         ":define")      d_getnetbyaddr_r_proto=define
13989                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13990                 eval $hasproto ;;
13991         *)      ;;
13992         esac
13993         case "$d_getnetbyaddr_r_proto" in
13994         define)
13995         case "$getnetbyaddr_r_proto" in
13996         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13997         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13998         esac
13999         case "$getnetbyaddr_r_proto" in
14000         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14001         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14002         esac
14003         case "$getnetbyaddr_r_proto" in
14004         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14005         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14006         esac
14007         case "$getnetbyaddr_r_proto" in
14008         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14009         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14010         esac
14011         case "$getnetbyaddr_r_proto" in
14012         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14013         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14014         esac
14015         case "$getnetbyaddr_r_proto" in
14016         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14017         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14018         esac
14019         case "$getnetbyaddr_r_proto" in
14020         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14021         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14022         esac
14023         case "$getnetbyaddr_r_proto" in
14024         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14025         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14026         esac
14027         case "$getnetbyaddr_r_proto" in
14028         ''|0)   d_getnetbyaddr_r=undef
14029                 getnetbyaddr_r_proto=0
14030                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14031         * )     case "$getnetbyaddr_r_proto" in
14032                 REENTRANT_PROTO*) ;;
14033                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14034                 esac
14035                 echo "Prototype: $try" ;;
14036         esac
14037         ;;
14038         *)      case "$usethreads" in
14039                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14040                 esac
14041                 d_getnetbyaddr_r=undef
14042                 getnetbyaddr_r_proto=0
14043                 ;;
14044         esac
14045         ;;
14046 *)      getnetbyaddr_r_proto=0
14047         ;;
14048 esac
14049
14050 : see if getnetbyname_r exists
14051 set getnetbyname_r d_getnetbyname_r
14052 eval $inlibc
14053 case "$d_getnetbyname_r" in
14054 "$define")
14055         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14056         case "$d_getnetbyname_r_proto:$usethreads" in
14057         ":define")      d_getnetbyname_r_proto=define
14058                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14059                 eval $hasproto ;;
14060         *)      ;;
14061         esac
14062         case "$d_getnetbyname_r_proto" in
14063         define)
14064         case "$getnetbyname_r_proto" in
14065         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14066         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14067         esac
14068         case "$getnetbyname_r_proto" in
14069         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14070         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14071         esac
14072         case "$getnetbyname_r_proto" in
14073         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14074         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14075         esac
14076         case "$getnetbyname_r_proto" in
14077         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14078         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14079         esac
14080         case "$getnetbyname_r_proto" in
14081         ''|0)   d_getnetbyname_r=undef
14082                 getnetbyname_r_proto=0
14083                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14084         * )     case "$getnetbyname_r_proto" in
14085                 REENTRANT_PROTO*) ;;
14086                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14087                 esac
14088                 echo "Prototype: $try" ;;
14089         esac
14090         ;;
14091         *)      case "$usethreads" in
14092                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14093                 esac
14094                 d_getnetbyname_r=undef
14095                 getnetbyname_r_proto=0
14096                 ;;
14097         esac
14098         ;;
14099 *)      getnetbyname_r_proto=0
14100         ;;
14101 esac
14102
14103 : see if getnetent_r exists
14104 set getnetent_r d_getnetent_r
14105 eval $inlibc
14106 case "$d_getnetent_r" in
14107 "$define")
14108         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14109         case "$d_getnetent_r_proto:$usethreads" in
14110         ":define")      d_getnetent_r_proto=define
14111                 set d_getnetent_r_proto getnetent_r $hdrs
14112                 eval $hasproto ;;
14113         *)      ;;
14114         esac
14115         case "$d_getnetent_r_proto" in
14116         define)
14117         case "$getnetent_r_proto" in
14118         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14119         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14120         esac
14121         case "$getnetent_r_proto" in
14122         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14123         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14124         esac
14125         case "$getnetent_r_proto" in
14126         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14127         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14128         esac
14129         case "$getnetent_r_proto" in
14130         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14131         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14132         esac
14133         case "$getnetent_r_proto" in
14134         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14135         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14136         esac
14137         case "$getnetent_r_proto" in
14138         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14139         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14140         esac
14141         case "$getnetent_r_proto" in
14142         ''|0)   d_getnetent_r=undef
14143                 getnetent_r_proto=0
14144                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14145         * )     case "$getnetent_r_proto" in
14146                 REENTRANT_PROTO*) ;;
14147                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14148                 esac
14149                 echo "Prototype: $try" ;;
14150         esac
14151         ;;
14152         *)      case "$usethreads" in
14153                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14154                 esac
14155                 d_getnetent_r=undef
14156                 getnetent_r_proto=0
14157                 ;;
14158         esac
14159         ;;
14160 *)      getnetent_r_proto=0
14161         ;;
14162 esac
14163
14164 : see if prototypes for various getnetxxx netdb.h functions are available
14165 echo " "
14166 set d_getnetprotos getnetent $i_netdb netdb.h
14167 eval $hasproto
14168
14169 : see if getpagesize exists
14170 set getpagesize d_getpagsz
14171 eval $inlibc
14172
14173 : Optional checks for getprotobyname and getprotobynumber
14174
14175 : see if getprotobyname exists
14176 set getprotobyname d_getpbyname
14177 eval $inlibc
14178
14179 : see if getprotobynumber exists
14180 set getprotobynumber d_getpbynumber
14181 eval $inlibc
14182
14183 : see if getprotoent exists
14184 set getprotoent d_getpent
14185 eval $inlibc
14186
14187 : see if getpgid exists
14188 set getpgid d_getpgid
14189 eval $inlibc
14190
14191 : see if getpgrp2 exists
14192 set getpgrp2 d_getpgrp2
14193 eval $inlibc
14194
14195 : see if getppid exists
14196 set getppid d_getppid
14197 eval $inlibc
14198
14199 : see if getpriority exists
14200 set getpriority d_getprior
14201 eval $inlibc
14202
14203 : see if getprotobyname_r exists
14204 set getprotobyname_r d_getprotobyname_r
14205 eval $inlibc
14206 case "$d_getprotobyname_r" in
14207 "$define")
14208         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14209         case "$d_getprotobyname_r_proto:$usethreads" in
14210         ":define")      d_getprotobyname_r_proto=define
14211                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14212                 eval $hasproto ;;
14213         *)      ;;
14214         esac
14215         case "$d_getprotobyname_r_proto" in
14216         define)
14217         case "$getprotobyname_r_proto" in
14218         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14219         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14220         esac
14221         case "$getprotobyname_r_proto" in
14222         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14223         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14224         esac
14225         case "$getprotobyname_r_proto" in
14226         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14227         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14228         esac
14229         case "$getprotobyname_r_proto" in
14230         ''|0)   d_getprotobyname_r=undef
14231                 getprotobyname_r_proto=0
14232                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14233         * )     case "$getprotobyname_r_proto" in
14234                 REENTRANT_PROTO*) ;;
14235                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14236                 esac
14237                 echo "Prototype: $try" ;;
14238         esac
14239         ;;
14240         *)      case "$usethreads" in
14241                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14242                 esac
14243                 d_getprotobyname_r=undef
14244                 getprotobyname_r_proto=0
14245                 ;;
14246         esac
14247         ;;
14248 *)      getprotobyname_r_proto=0
14249         ;;
14250 esac
14251
14252 : see if getprotobynumber_r exists
14253 set getprotobynumber_r d_getprotobynumber_r
14254 eval $inlibc
14255 case "$d_getprotobynumber_r" in
14256 "$define")
14257         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14258         case "$d_getprotobynumber_r_proto:$usethreads" in
14259         ":define")      d_getprotobynumber_r_proto=define
14260                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14261                 eval $hasproto ;;
14262         *)      ;;
14263         esac
14264         case "$d_getprotobynumber_r_proto" in
14265         define)
14266         case "$getprotobynumber_r_proto" in
14267         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14268         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14269         esac
14270         case "$getprotobynumber_r_proto" in
14271         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14272         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14273         esac
14274         case "$getprotobynumber_r_proto" in
14275         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14276         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14277         esac
14278         case "$getprotobynumber_r_proto" in
14279         ''|0)   d_getprotobynumber_r=undef
14280                 getprotobynumber_r_proto=0
14281                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14282         * )     case "$getprotobynumber_r_proto" in
14283                 REENTRANT_PROTO*) ;;
14284                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14285                 esac
14286                 echo "Prototype: $try" ;;
14287         esac
14288         ;;
14289         *)      case "$usethreads" in
14290                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14291                 esac
14292                 d_getprotobynumber_r=undef
14293                 getprotobynumber_r_proto=0
14294                 ;;
14295         esac
14296         ;;
14297 *)      getprotobynumber_r_proto=0
14298         ;;
14299 esac
14300
14301 : see if getprotoent_r exists
14302 set getprotoent_r d_getprotoent_r
14303 eval $inlibc
14304 case "$d_getprotoent_r" in
14305 "$define")
14306         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14307         case "$d_getprotoent_r_proto:$usethreads" in
14308         ":define")      d_getprotoent_r_proto=define
14309                 set d_getprotoent_r_proto getprotoent_r $hdrs
14310                 eval $hasproto ;;
14311         *)      ;;
14312         esac
14313         case "$d_getprotoent_r_proto" in
14314         define)
14315         case "$getprotoent_r_proto" in
14316         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14317         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14318         esac
14319         case "$getprotoent_r_proto" in
14320         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14321         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14322         esac
14323         case "$getprotoent_r_proto" in
14324         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14325         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14326         esac
14327         case "$getprotoent_r_proto" in
14328         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14329         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14330         esac
14331         case "$getprotoent_r_proto" in
14332         ''|0)   d_getprotoent_r=undef
14333                 getprotoent_r_proto=0
14334                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14335         * )     case "$getprotoent_r_proto" in
14336                 REENTRANT_PROTO*) ;;
14337                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14338                 esac
14339                 echo "Prototype: $try" ;;
14340         esac
14341         ;;
14342         *)      case "$usethreads" in
14343                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14344                 esac
14345                 d_getprotoent_r=undef
14346                 getprotoent_r_proto=0
14347                 ;;
14348         esac
14349         ;;
14350 *)      getprotoent_r_proto=0
14351         ;;
14352 esac
14353
14354 : see if prototypes for various getprotoxxx netdb.h functions are available
14355 echo " "
14356 set d_getprotoprotos getprotoent $i_netdb netdb.h
14357 eval $hasproto
14358
14359 : see if getprpwnam exists
14360 set getprpwnam d_getprpwnam
14361 eval $inlibc
14362
14363 : see if getpwent exists
14364 set getpwent d_getpwent
14365 eval $inlibc
14366
14367 : see if getpwent_r exists
14368 set getpwent_r d_getpwent_r
14369 eval $inlibc
14370 case "$d_getpwent_r" in
14371 "$define")
14372         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14373         case "$d_getpwent_r_proto:$usethreads" in
14374         ":define")      d_getpwent_r_proto=define
14375                 set d_getpwent_r_proto getpwent_r $hdrs
14376                 eval $hasproto ;;
14377         *)      ;;
14378         esac
14379         case "$d_getpwent_r_proto" in
14380         define)
14381         case "$getpwent_r_proto" in
14382         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14383         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14384         esac
14385         case "$getpwent_r_proto" in
14386         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14387         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14388         esac
14389         case "$getpwent_r_proto" in
14390         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14391         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14392         esac
14393         case "$getpwent_r_proto" in
14394         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14395         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14396         esac
14397         case "$getpwent_r_proto" in
14398         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14399         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14400         esac
14401         case "$getpwent_r_proto" in
14402         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14403         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14404         esac
14405         case "$getpwent_r_proto" in
14406         ''|0)   d_getpwent_r=undef
14407                 getpwent_r_proto=0
14408                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14409         * )     case "$getpwent_r_proto" in
14410                 REENTRANT_PROTO*) ;;
14411                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14412                 esac
14413                 echo "Prototype: $try" ;;
14414         esac
14415         ;;
14416         *)      case "$usethreads" in
14417                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14418                 esac
14419                 d_getpwent_r=undef
14420                 getpwent_r_proto=0
14421                 ;;
14422         esac
14423         ;;
14424 *)      getpwent_r_proto=0
14425         ;;
14426 esac
14427
14428 : see if getpwnam_r exists
14429 set getpwnam_r d_getpwnam_r
14430 eval $inlibc
14431 case "$d_getpwnam_r" in
14432 "$define")
14433         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14434         case "$d_getpwnam_r_proto:$usethreads" in
14435         ":define")      d_getpwnam_r_proto=define
14436                 set d_getpwnam_r_proto getpwnam_r $hdrs
14437                 eval $hasproto ;;
14438         *)      ;;
14439         esac
14440         case "$d_getpwnam_r_proto" in
14441         define)
14442         case "$getpwnam_r_proto" in
14443         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14444         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14445         esac
14446         case "$getpwnam_r_proto" in
14447         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14448         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14449         esac
14450         case "$getpwnam_r_proto" in
14451         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14452         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14453         esac
14454         case "$getpwnam_r_proto" in
14455         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14456         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14457         esac
14458         case "$getpwnam_r_proto" in
14459         ''|0)   d_getpwnam_r=undef
14460                 getpwnam_r_proto=0
14461                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14462         * )     case "$getpwnam_r_proto" in
14463                 REENTRANT_PROTO*) ;;
14464                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14465                 esac
14466                 echo "Prototype: $try" ;;
14467         esac
14468         ;;
14469         *)      case "$usethreads" in
14470                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14471                 esac
14472                 d_getpwnam_r=undef
14473                 getpwnam_r_proto=0
14474                 ;;
14475         esac
14476         ;;
14477 *)      getpwnam_r_proto=0
14478         ;;
14479 esac
14480
14481 : see if getpwuid_r exists
14482 set getpwuid_r d_getpwuid_r
14483 eval $inlibc
14484 case "$d_getpwuid_r" in
14485 "$define")
14486         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14487         case "$d_getpwuid_r_proto:$usethreads" in
14488         ":define")      d_getpwuid_r_proto=define
14489                 set d_getpwuid_r_proto getpwuid_r $hdrs
14490                 eval $hasproto ;;
14491         *)      ;;
14492         esac
14493         case "$d_getpwuid_r_proto" in
14494         define)
14495         case "$getpwuid_r_proto" in
14496         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14497         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14498         esac
14499         case "$getpwuid_r_proto" in
14500         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14501         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14502         esac
14503         case "$getpwuid_r_proto" in
14504         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14505         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14506         esac
14507         case "$getpwuid_r_proto" in
14508         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14509         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14510         esac
14511         case "$getpwuid_r_proto" in
14512         ''|0)   d_getpwuid_r=undef
14513                 getpwuid_r_proto=0
14514                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14515         * )     case "$getpwuid_r_proto" in
14516                 REENTRANT_PROTO*) ;;
14517                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14518                 esac
14519                 echo "Prototype: $try" ;;
14520         esac
14521         ;;
14522         *)      case "$usethreads" in
14523                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14524                 esac
14525                 d_getpwuid_r=undef
14526                 getpwuid_r_proto=0
14527                 ;;
14528         esac
14529         ;;
14530 *)      getpwuid_r_proto=0
14531         ;;
14532 esac
14533
14534 : Optional checks for getsbyname and getsbyport
14535
14536 : see if getservbyname exists
14537 set getservbyname d_getsbyname
14538 eval $inlibc
14539
14540 : see if getservbyport exists
14541 set getservbyport d_getsbyport
14542 eval $inlibc
14543
14544 : see if getservent exists
14545 set getservent d_getsent
14546 eval $inlibc
14547
14548 : see if getservbyname_r exists
14549 set getservbyname_r d_getservbyname_r
14550 eval $inlibc
14551 case "$d_getservbyname_r" in
14552 "$define")
14553         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14554         case "$d_getservbyname_r_proto:$usethreads" in
14555         ":define")      d_getservbyname_r_proto=define
14556                 set d_getservbyname_r_proto getservbyname_r $hdrs
14557                 eval $hasproto ;;
14558         *)      ;;
14559         esac
14560         case "$d_getservbyname_r_proto" in
14561         define)
14562         case "$getservbyname_r_proto" in
14563         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14564         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14565         esac
14566         case "$getservbyname_r_proto" in
14567         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14568         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14569         esac
14570         case "$getservbyname_r_proto" in
14571         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14572         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14573         esac
14574         case "$getservbyname_r_proto" in
14575         ''|0)   d_getservbyname_r=undef
14576                 getservbyname_r_proto=0
14577                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14578         * )     case "$getservbyname_r_proto" in
14579                 REENTRANT_PROTO*) ;;
14580                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14581                 esac
14582                 echo "Prototype: $try" ;;
14583         esac
14584         ;;
14585         *)      case "$usethreads" in
14586                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14587                 esac
14588                 d_getservbyname_r=undef
14589                 getservbyname_r_proto=0
14590                 ;;
14591         esac
14592         ;;
14593 *)      getservbyname_r_proto=0
14594         ;;
14595 esac
14596
14597 : see if getservbyport_r exists
14598 set getservbyport_r d_getservbyport_r
14599 eval $inlibc
14600 case "$d_getservbyport_r" in
14601 "$define")
14602         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14603         case "$d_getservbyport_r_proto:$usethreads" in
14604         ":define")      d_getservbyport_r_proto=define
14605                 set d_getservbyport_r_proto getservbyport_r $hdrs
14606                 eval $hasproto ;;
14607         *)      ;;
14608         esac
14609         case "$d_getservbyport_r_proto" in
14610         define)
14611         case "$getservbyport_r_proto" in
14612         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14613         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14614         esac
14615         case "$getservbyport_r_proto" in
14616         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14617         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14618         esac
14619         case "$getservbyport_r_proto" in
14620         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14621         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14622         esac
14623         case "$getservbyport_r_proto" in
14624         ''|0)   d_getservbyport_r=undef
14625                 getservbyport_r_proto=0
14626                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14627         * )     case "$getservbyport_r_proto" in
14628                 REENTRANT_PROTO*) ;;
14629                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14630                 esac
14631                 echo "Prototype: $try" ;;
14632         esac
14633         ;;
14634         *)      case "$usethreads" in
14635                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14636                 esac
14637                 d_getservbyport_r=undef
14638                 getservbyport_r_proto=0
14639                 ;;
14640         esac
14641         ;;
14642 *)      getservbyport_r_proto=0
14643         ;;
14644 esac
14645
14646 : see if getservent_r exists
14647 set getservent_r d_getservent_r
14648 eval $inlibc
14649 case "$d_getservent_r" in
14650 "$define")
14651         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14652         case "$d_getservent_r_proto:$usethreads" in
14653         ":define")      d_getservent_r_proto=define
14654                 set d_getservent_r_proto getservent_r $hdrs
14655                 eval $hasproto ;;
14656         *)      ;;
14657         esac
14658         case "$d_getservent_r_proto" in
14659         define)
14660         case "$getservent_r_proto" in
14661         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14662         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14663         esac
14664         case "$getservent_r_proto" in
14665         ''|0) try='int getservent_r(struct servent*, char*, int);'
14666         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14667         esac
14668         case "$getservent_r_proto" in
14669         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14670         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14671         esac
14672         case "$getservent_r_proto" in
14673         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14674         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14675         esac
14676         case "$getservent_r_proto" in
14677         ''|0)   d_getservent_r=undef
14678                 getservent_r_proto=0
14679                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14680         * )     case "$getservent_r_proto" in
14681                 REENTRANT_PROTO*) ;;
14682                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14683                 esac
14684                 echo "Prototype: $try" ;;
14685         esac
14686         ;;
14687         *)      case "$usethreads" in
14688                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14689                 esac
14690                 d_getservent_r=undef
14691                 getservent_r_proto=0
14692                 ;;
14693         esac
14694         ;;
14695 *)      getservent_r_proto=0
14696         ;;
14697 esac
14698
14699 : see if prototypes for various getservxxx netdb.h functions are available
14700 echo " "
14701 set d_getservprotos getservent $i_netdb netdb.h
14702 eval $hasproto
14703
14704 : see if getspnam exists
14705 set getspnam d_getspnam
14706 eval $inlibc
14707
14708 : see if this is a shadow.h system
14709 set shadow.h i_shadow
14710 eval $inhdr
14711
14712 : see if getspnam_r exists
14713 set getspnam_r d_getspnam_r
14714 eval $inlibc
14715 case "$d_getspnam_r" in
14716 "$define")
14717         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14718         case "$d_getspnam_r_proto:$usethreads" in
14719         ":define")      d_getspnam_r_proto=define
14720                 set d_getspnam_r_proto getspnam_r $hdrs
14721                 eval $hasproto ;;
14722         *)      ;;
14723         esac
14724         case "$d_getspnam_r_proto" in
14725         define)
14726         case "$getspnam_r_proto" in
14727         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14728         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14729         esac
14730         case "$getspnam_r_proto" in
14731         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14732         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14733         esac
14734         case "$getspnam_r_proto" in
14735         ''|0)   d_getspnam_r=undef
14736                 getspnam_r_proto=0
14737                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14738         * )     case "$getspnam_r_proto" in
14739                 REENTRANT_PROTO*) ;;
14740                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14741                 esac
14742                 echo "Prototype: $try" ;;
14743         esac
14744         ;;
14745         *)      case "$usethreads" in
14746                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14747                 esac
14748                 d_getspnam_r=undef
14749                 getspnam_r_proto=0
14750                 ;;
14751         esac
14752         ;;
14753 *)      getspnam_r_proto=0
14754         ;;
14755 esac
14756
14757 : see if gettimeofday or ftime exists
14758 set gettimeofday d_gettimeod
14759 eval $inlibc
14760 case "$d_gettimeod" in
14761 "$undef")
14762         set ftime d_ftime 
14763         eval $inlibc
14764         ;;
14765 *)
14766         val="$undef"; set d_ftime; eval $setvar
14767         ;;
14768 esac
14769 case "$d_gettimeod$d_ftime" in
14770 "$undef$undef")
14771         echo " "
14772         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14773         ;;
14774 esac
14775
14776 : see if gmtime_r exists
14777 set gmtime_r d_gmtime_r
14778 eval $inlibc
14779 case "$d_gmtime_r" in
14780 "$define")
14781         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14782         case "$d_gmtime_r_proto:$usethreads" in
14783         ":define")      d_gmtime_r_proto=define
14784                 set d_gmtime_r_proto gmtime_r $hdrs
14785                 eval $hasproto ;;
14786         *)      ;;
14787         esac
14788         case "$d_gmtime_r_proto" in
14789         define)
14790         case "$gmtime_r_proto" in
14791         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14792         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14793         esac
14794         case "$gmtime_r_proto" in
14795         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14796         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14797         esac
14798         case "$gmtime_r_proto" in
14799         ''|0)   d_gmtime_r=undef
14800                 gmtime_r_proto=0
14801                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14802         * )     case "$gmtime_r_proto" in
14803                 REENTRANT_PROTO*) ;;
14804                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14805                 esac
14806                 echo "Prototype: $try" ;;
14807         esac
14808         ;;
14809         *)      case "$usethreads" in
14810                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14811                 esac
14812                 d_gmtime_r=undef
14813                 gmtime_r_proto=0
14814                 ;;
14815         esac
14816         ;;
14817 *)      gmtime_r_proto=0
14818         ;;
14819 esac
14820
14821 : see if hasmntopt exists
14822 set hasmntopt d_hasmntopt
14823 eval $inlibc
14824
14825 : see if this is a netinet/in.h or sys/in.h system
14826 set netinet/in.h i_niin sys/in.h i_sysin
14827 eval $inhdr
14828
14829 : see if arpa/inet.h has to be included
14830 set arpa/inet.h i_arpainet
14831 eval $inhdr
14832
14833 : see if htonl --and friends-- exists
14834 val=''
14835 set htonl val
14836 eval $inlibc
14837
14838 : Maybe they are macros.
14839 case "$val" in
14840 $undef)
14841         $cat >htonl.c <<EOM
14842 #include <stdio.h>
14843 #include <sys/types.h>
14844 #$i_niin I_NETINET_IN
14845 #$i_sysin I_SYS_IN
14846 #$i_arpainet I_ARPA_INET
14847 #ifdef I_NETINET_IN
14848 #include <netinet/in.h>
14849 #endif
14850 #ifdef I_SYS_IN
14851 #include <sys/in.h>
14852 #endif
14853 #ifdef I_ARPA_INET
14854 #include <arpa/inet.h>
14855 #endif
14856 #ifdef htonl
14857 printf("Defined as a macro.");
14858 #endif
14859 EOM
14860         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14861         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14862                 val="$define"
14863                 echo "But it seems to be defined as a macro." >&4
14864         fi
14865         $rm -f htonl.?
14866         ;;
14867 esac
14868 set d_htonl
14869 eval $setvar
14870
14871 : see if ilogbl exists
14872 set ilogbl d_ilogbl
14873 eval $inlibc
14874
14875 : index or strchr
14876 echo " "
14877 if set index val -f; eval $csym; $val; then
14878         if set strchr val -f d_strchr; eval $csym; $val; then
14879                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14880                         val="$define"
14881                         vali="$undef"
14882                         echo "strchr() found." >&4
14883                 else
14884                         val="$undef"
14885                         vali="$define"
14886                         echo "index() found." >&4
14887                 fi
14888         else
14889                 val="$undef"
14890                 vali="$define"
14891                 echo "index() found." >&4
14892         fi
14893 else
14894         if set strchr val -f d_strchr; eval $csym; $val; then
14895                 val="$define"
14896                 vali="$undef"
14897                 echo "strchr() found." >&4
14898         else
14899                 echo "No index() or strchr() found!" >&4
14900                 val="$undef"
14901                 vali="$undef"
14902         fi
14903 fi
14904 set d_strchr; eval $setvar
14905 val="$vali"
14906 set d_index; eval $setvar
14907
14908 : check whether inet_aton exists
14909 set inet_aton d_inetaton
14910 eval $inlibc
14911
14912 : see if inet_ntop exists
14913 set inet_ntop d_inetntop
14914 eval $inlibc
14915
14916 : see if inet_pton exists
14917 set inet_pton d_inetpton
14918 eval $inlibc
14919
14920 : Look for isascii
14921 echo " "
14922 $cat >isascii.c <<EOCP
14923 #include <stdio.h>
14924 #include <ctype.h>
14925 #$i_stdlib I_STDLIB
14926 #ifdef I_STDLIB
14927 #include <stdlib.h>
14928 #endif
14929 int main() {
14930         int c = 'A';
14931         if (isascii(c))
14932                 exit(0);
14933         else
14934                 exit(1);
14935 }
14936 EOCP
14937 set isascii
14938 if eval $compile; then
14939         echo "isascii() found." >&4
14940         val="$define"
14941 else
14942         echo "isascii() NOT found." >&4
14943         val="$undef"
14944 fi
14945 set d_isascii
14946 eval $setvar
14947 $rm -f isascii*
14948
14949 : see if isfinite exists
14950 set isfinite d_isfinite
14951 eval $inlibc
14952
14953 : see if isinf exists
14954 set isinf d_isinf
14955 eval $inlibc
14956
14957 : see if isnan exists
14958 set isnan d_isnan
14959 eval $inlibc
14960
14961 : see if isnanl exists
14962 set isnanl d_isnanl
14963 eval $inlibc
14964
14965 : see if killpg exists
14966 set killpg d_killpg
14967 eval $inlibc
14968
14969 : see if lchown exists
14970 echo " "
14971 $cat > try.c <<'EOCP'
14972 /* System header to define __stub macros and hopefully few prototypes,
14973     which can conflict with char lchown(); below.  */
14974 #include <assert.h>
14975 /* Override any gcc2 internal prototype to avoid an error.  */
14976 /* We use char because int might match the return type of a gcc2
14977    builtin and then its argument prototype would still apply.  */
14978 char lchown();
14979 int main() {
14980     /*  The GNU C library defines this for functions which it implements
14981         to always fail with ENOSYS.  Some functions are actually named
14982         something starting with __ and the normal name is an alias.  */
14983 #if defined (__stub_lchown) || defined (__stub___lchown)
14984 choke me
14985 #else
14986 lchown();
14987 #endif
14988 ; return 0; }
14989 EOCP
14990 set try
14991 if eval $compile; then
14992     $echo "lchown() found." >&4
14993     val="$define"
14994 else
14995     $echo "lchown() NOT found." >&4
14996     val="$undef"
14997 fi
14998 set d_lchown
14999 eval $setvar
15000
15001 : See if number of significant digits in a double precision number is known
15002 echo " "
15003 $cat >ldbl_dig.c <<EOM
15004 #$i_limits I_LIMITS
15005 #$i_float I_FLOAT
15006 #ifdef I_LIMITS
15007 #include <limits.h>
15008 #endif
15009 #ifdef I_FLOAT
15010 #include <float.h>
15011 #endif
15012 #ifdef LDBL_DIG
15013 printf("Contains LDBL_DIG");
15014 #endif
15015 EOM
15016 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15017 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15018         echo "LDBL_DIG found." >&4
15019         val="$define"
15020 else
15021         echo "LDBL_DIG NOT found." >&4
15022         val="$undef"
15023 fi
15024 $rm -f ldbl_dig.?
15025 set d_ldbl_dig
15026 eval $setvar
15027
15028 : see if this is a math.h system
15029 set math.h i_math
15030 eval $inhdr
15031
15032 : check to see if math.h defines _LIB_VERSION
15033 d_libm_lib_version="$undef"
15034 case $i_math in
15035     $define)
15036         echo " "
15037         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15038         $cat >try.c <<EOCP
15039 #include <unistd.h>
15040 #include <math.h>
15041 int main (int argc, char *argv[])
15042 {
15043     printf ("%d\n", _LIB_VERSION);
15044     return (0);
15045     } /* main */
15046 EOCP
15047         set try
15048         if eval $compile; then
15049             foo=`$run ./try`
15050             echo "Yes, it does ($foo)" >&4
15051             d_libm_lib_version="$define"
15052         else
15053             echo "No, it does not (probably harmless)" >&4
15054             fi
15055         $rm_try
15056         ;;
15057
15058     esac
15059
15060 : see if link exists
15061 set link d_link
15062 eval $inlibc
15063
15064 : see if localtime_r exists
15065 set localtime_r d_localtime_r
15066 eval $inlibc
15067 case "$d_localtime_r" in
15068 "$define")
15069         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15070         case "$d_localtime_r_proto:$usethreads" in
15071         ":define")      d_localtime_r_proto=define
15072                 set d_localtime_r_proto localtime_r $hdrs
15073                 eval $hasproto ;;
15074         *)      ;;
15075         esac
15076         case "$d_localtime_r_proto" in
15077         define)
15078         case "$localtime_r_proto" in
15079         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15080         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15081         esac
15082         case "$localtime_r_proto" in
15083         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15084         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15085         esac
15086         case "$localtime_r_proto" in
15087         ''|0)   d_localtime_r=undef
15088                 localtime_r_proto=0
15089                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15090         * )     case "$localtime_r_proto" in
15091                 REENTRANT_PROTO*) ;;
15092                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15093                 esac
15094                 echo "Prototype: $try" ;;
15095         esac
15096         ;;
15097         *)      case "$usethreads" in
15098                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15099                 esac
15100                 d_localtime_r=undef
15101                 localtime_r_proto=0
15102                 ;;
15103         esac
15104         ;;
15105 *)      localtime_r_proto=0
15106         ;;
15107 esac
15108
15109 : see if localtime_r calls tzset
15110 case "$localtime_r_proto" in
15111 REENTRANT_PROTO*)
15112         $cat >try.c <<EOCP
15113 /*  Does our libc's localtime_r call tzset ?
15114  *  return 0 if so, 1 otherwise.
15115  */
15116 #$i_systypes    I_SYS_TYPES
15117 #$i_unistd      I_UNISTD
15118 #$i_time        I_TIME
15119 #$i_stdlib      I_STDLIB
15120 #$i_string      I_STRING
15121 #$i_malloc      I_MALLOC
15122 #ifdef I_SYS_TYPES
15123 #  include <sys/types.h>
15124 #endif
15125 #ifdef I_UNISTD
15126 #  include <unistd.h>
15127 #endif
15128 #ifdef I_TIME
15129 #  include <time.h>
15130 #endif
15131 #ifdef I_STDLIB
15132 #include <stdlib.h>
15133 #endif
15134 #ifdef I_STRING
15135 #  include <string.h>
15136 #else
15137 #  include <strings.h>
15138 #endif
15139 #ifdef I_MALLOC
15140 #  include <malloc.h>
15141 #endif
15142 int main()
15143 {
15144     time_t t = time(0L);
15145     char w_tz[]="TZ" "=GMT+5",
15146          e_tz[]="TZ" "=GMT-5",
15147         *tz_e = (char*)malloc(16),
15148         *tz_w = (char*)malloc(16);
15149     struct tm tm_e, tm_w;
15150     memset(&tm_e,'\0',sizeof(struct tm));
15151     memset(&tm_w,'\0',sizeof(struct tm));
15152     strcpy(tz_e,e_tz);
15153     strcpy(tz_w,w_tz);
15154
15155     putenv(tz_e);
15156     localtime_r(&t, &tm_e);
15157
15158     putenv(tz_w);
15159     localtime_r(&t, &tm_w);
15160
15161     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15162         return 1;
15163     return 0;
15164 }
15165 EOCP
15166         set try
15167         if eval $compile; then
15168             if $run ./try; then
15169                 d_localtime_r_needs_tzset=undef;
15170             else
15171                 d_localtime_r_needs_tzset=define;
15172             fi;
15173         else
15174             d_localtime_r_needs_tzset=undef;
15175         fi;
15176      ;;
15177   *)
15178      d_localtime_r_needs_tzset=undef;
15179      ;;
15180 esac
15181 $rm_try
15182
15183 : see if localeconv exists
15184 set localeconv d_locconv
15185 eval $inlibc
15186
15187 : see if lockf exists
15188 set lockf d_lockf
15189 eval $inlibc
15190
15191 : see if prototype for lseek is available
15192 echo " "
15193 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15194 eval $hasproto
15195
15196 : see if lstat exists
15197 set lstat d_lstat
15198 eval $inlibc
15199
15200 : see if madvise exists
15201 set madvise d_madvise
15202 eval $inlibc
15203
15204 : see if malloc_size exists
15205 set malloc_size d_malloc_size
15206 eval $inlibc
15207
15208 : see if malloc_size_good exists
15209 set malloc_good_size d_malloc_good_size
15210 eval $inlibc
15211
15212 : see if mblen exists
15213 set mblen d_mblen
15214 eval $inlibc
15215
15216 : see if mbstowcs exists
15217 set mbstowcs d_mbstowcs
15218 eval $inlibc
15219
15220 : see if mbtowc exists
15221 set mbtowc d_mbtowc
15222 eval $inlibc
15223
15224 : see if memchr exists
15225 set memchr d_memchr
15226 eval $inlibc
15227
15228 : see if memcmp exists
15229 set memcmp d_memcmp
15230 eval $inlibc
15231
15232 : see if memcpy exists
15233 set memcpy d_memcpy
15234 eval $inlibc
15235
15236 : see if memmove exists
15237 set memmove d_memmove
15238 eval $inlibc
15239
15240 : see if memset exists
15241 set memset d_memset
15242 eval $inlibc
15243
15244 : see if mkdir exists
15245 set mkdir d_mkdir
15246 eval $inlibc
15247
15248 : see if mkdtemp exists
15249 set mkdtemp d_mkdtemp
15250 eval $inlibc
15251
15252 : see if mkfifo exists
15253 set mkfifo d_mkfifo
15254 eval $inlibc
15255
15256 : see if mkstemp exists
15257 set mkstemp d_mkstemp
15258 eval $inlibc
15259
15260 : see if mkstemps exists
15261 set mkstemps d_mkstemps
15262 eval $inlibc
15263
15264 : see if mktime exists
15265 set mktime d_mktime
15266 eval $inlibc
15267
15268 : see if this is a sys/mman.h system
15269 set sys/mman.h i_sysmman
15270 eval $inhdr
15271
15272 : see if mmap exists
15273 set mmap d_mmap
15274 eval $inlibc
15275 : see what shmat returns
15276 : default to something harmless
15277 mmaptype='void *'
15278 case "$i_sysmman$d_mmap" in
15279 "$define$define")
15280         $cat >mmap.c <<'END'
15281 #include <sys/mman.h>
15282 void *mmap();
15283 END
15284         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15285                 mmaptype='void *'
15286         else
15287                 mmaptype='caddr_t'
15288         fi
15289         echo "and it returns ($mmaptype)." >&4
15290         ;;
15291 esac
15292
15293
15294
15295 : see if sqrtl exists
15296 set sqrtl d_sqrtl
15297 eval $inlibc
15298
15299 : see if scalbnl exists
15300 set scalbnl d_scalbnl
15301 eval $inlibc
15302
15303 : see if modfl exists
15304 set modfl d_modfl
15305 eval $inlibc
15306
15307 : see if prototype for modfl is available
15308 echo " "
15309 set d_modflproto modfl $i_math math.h
15310 eval $hasproto
15311
15312 d_modfl_pow32_bug="$undef"
15313
15314 case "$d_longdbl$d_modfl" in
15315 $define$define)
15316         $cat <<EOM
15317 Checking to see whether your modfl() is okay for large values...
15318 EOM
15319 $cat >try.c <<EOCP
15320 #include <math.h>
15321 #include <stdio.h>
15322 EOCP
15323 if $test "X$d_modflproto" != "X$define"; then
15324         $cat >>try.c <<EOCP
15325 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15326 long double modfl (long double, long double *);
15327 EOCP
15328 fi
15329 $cat >>try.c <<EOCP
15330 int main() {
15331     long double nv = 4294967303.15;
15332     long double v, w;
15333     v = modfl(nv, &w);
15334 #ifdef __GLIBC__
15335     printf("glibc");
15336 #endif
15337     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15338     return 0;
15339 }
15340 EOCP
15341         case "$osname:$gccversion" in
15342         aix:)   saveccflags="$ccflags"
15343                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15344         esac
15345         set try
15346         if eval $compile; then
15347                 foo=`$run ./try`
15348                 case "$foo" in
15349                 *" 4294967303.150000 1.150000 4294967302.000000")
15350                         echo >&4 "Your modfl() is broken for large values."
15351                         d_modfl_pow32_bug="$define"
15352                         case "$foo" in
15353                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15354                         ;;
15355                         esac
15356                         ;;
15357                 *" 4294967303.150000 0.150000 4294967303.000000")
15358                         echo >&4 "Your modfl() seems okay for large values."
15359                         ;;
15360                 *)      echo >&4 "I don't understand your modfl() at all."
15361                         d_modfl="$undef"
15362                         ;;
15363                 esac
15364                 $rm_try
15365         else
15366                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15367                 d_modfl="$undef"
15368         fi
15369         case "$osname:$gccversion" in
15370         aix:)   ccflags="$saveccflags" ;; # restore
15371         esac
15372         ;;
15373 esac
15374
15375 if $test "$uselongdouble" = "$define"; then
15376     message=""
15377     if $test "$d_sqrtl" != "$define"; then
15378         message="$message sqrtl"
15379     fi
15380     if $test "$d_modfl" != "$define"; then
15381         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15382             echo "You have both aintl and copysignl, so I can emulate modfl."
15383         else
15384             message="$message modfl"
15385         fi
15386     fi
15387     if $test "$d_frexpl" != "$define"; then
15388         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15389             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15390         else
15391             message="$message frexpl"
15392         fi
15393     fi
15394
15395     if $test "$message" != ""; then
15396         $cat <<EOM >&4
15397
15398 *** You requested the use of long doubles but you do not seem to have
15399 *** the following mathematical functions needed for long double support:
15400 ***    $message
15401 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15402 *** Cannot continue, aborting.
15403
15404 EOM
15405
15406         exit 1
15407     fi
15408 fi
15409
15410 : see if mprotect exists
15411 set mprotect d_mprotect
15412 eval $inlibc
15413
15414 : see if msgctl exists
15415 set msgctl d_msgctl
15416 eval $inlibc
15417
15418 : see if msgget exists
15419 set msgget d_msgget
15420 eval $inlibc
15421
15422 : see if msgsnd exists
15423 set msgsnd d_msgsnd
15424 eval $inlibc
15425
15426 : see if msgrcv exists
15427 set msgrcv d_msgrcv
15428 eval $inlibc
15429
15430 : see how much of the 'msg*(2)' library is present.
15431 h_msg=true
15432 echo " "
15433 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15434 *"$undef"*) h_msg=false;;
15435 esac
15436 case "$osname" in
15437 freebsd)
15438     case "`ipcs 2>&1`" in
15439     "SVID messages"*"not configured"*)
15440         echo "Your $osname does not have the msg*(2) configured." >&4
15441         h_msg=false
15442         val="$undef"
15443         set msgctl d_msgctl
15444         eval $setvar
15445         set msgget d_msgget
15446         eval $setvar
15447         set msgsnd d_msgsnd
15448         eval $setvar
15449         set msgrcv d_msgrcv
15450         eval $setvar
15451         ;;
15452     esac
15453     ;;
15454 esac
15455 : we could also check for sys/ipc.h ...
15456 if $h_msg && $test `./findhdr sys/msg.h`; then
15457         echo "You have the full msg*(2) library." >&4
15458         val="$define"
15459 else
15460         echo "You don't have the full msg*(2) library." >&4
15461         val="$undef"
15462 fi
15463 set d_msg
15464 eval $setvar
15465
15466 : Check for msghdr_s
15467 echo " "
15468 echo "Checking to see if your system supports struct msghdr..." >&4
15469 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15470 eval $hasstruct
15471 case "$d_msghdr_s" in
15472 "$define")      echo "Yes, it does."   ;;
15473 *)              echo "No, it doesn't." ;;
15474 esac
15475
15476
15477 : see if msync exists
15478 set msync d_msync
15479 eval $inlibc
15480
15481 : see if munmap exists
15482 set munmap d_munmap
15483 eval $inlibc
15484
15485 : see if nice exists
15486 set nice d_nice
15487 eval $inlibc
15488
15489 : see if this is a langinfo.h system
15490 set langinfo.h i_langinfo
15491 eval $inhdr
15492
15493 : see if nl_langinfo exists
15494 set nl_langinfo d_nl_langinfo
15495 eval $inlibc
15496
15497 : check for volatile keyword
15498 echo " "
15499 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15500 $cat >try.c <<'EOCP'
15501 int main()
15502 {
15503         typedef struct _goo_struct goo_struct;
15504         goo_struct * volatile goo = ((goo_struct *)0);
15505         struct _goo_struct {
15506                 long long_int;
15507                 int reg_int;
15508                 char char_var;
15509         };
15510         typedef unsigned short foo_t;
15511         char *volatile foo;
15512         volatile int bar;
15513         volatile foo_t blech;
15514         foo = foo;
15515 }
15516 EOCP
15517 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15518         val="$define"
15519         echo "Yup, it does."
15520 else
15521         val="$undef"
15522         echo "Nope, it doesn't."
15523 fi
15524 set d_volatile
15525 eval $setvar
15526 $rm_try
15527
15528 : Check basic sizes
15529 echo " "
15530 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15531
15532 case "$use64bitint:$d_quad:$quadtype" in
15533 define:define:?*)
15534         ivtype="$quadtype"
15535         uvtype="$uquadtype"
15536         ivsize=8
15537         uvsize=8
15538         ;;
15539 *)      ivtype="long"
15540         uvtype="unsigned long"
15541         ivsize=$longsize
15542         uvsize=$longsize
15543         ;;
15544 esac
15545
15546 case "$uselongdouble:$d_longdbl" in
15547 define:define)
15548         nvtype="long double"
15549         nvsize=$longdblsize
15550         ;;
15551 *)      nvtype=double
15552         nvsize=$doublesize
15553         ;;
15554 esac
15555
15556 $echo "(IV will be "$ivtype", $ivsize bytes)"
15557 $echo "(UV will be "$uvtype", $uvsize bytes)"
15558 $echo "(NV will be "$nvtype", $nvsize bytes)"
15559
15560 $cat >try.c <<EOCP
15561 #$i_inttypes I_INTTYPES
15562 #ifdef I_INTTYPES
15563 #include <inttypes.h>
15564 #endif
15565 #include <stdio.h>
15566 int main() {
15567 #ifdef INT8
15568    int8_t i =  INT8_MAX;
15569   uint8_t u = UINT8_MAX;
15570   printf("int8_t\n");
15571 #endif
15572 #ifdef INT16
15573    int16_t i =  INT16_MAX;
15574   uint16_t i = UINT16_MAX;
15575   printf("int16_t\n");
15576 #endif
15577 #ifdef INT32
15578    int32_t i =  INT32_MAX;
15579   uint32_t u = UINT32_MAX;
15580   printf("int32_t\n");
15581 #endif
15582 }
15583 EOCP
15584
15585 i8type="signed char"
15586 u8type="unsigned char"
15587 i8size=1
15588 u8size=1
15589
15590 case "$i16type" in
15591 '')     case "$shortsize" in
15592         2)      i16type=short
15593                 u16type="unsigned short"
15594                 i16size=$shortsize
15595                 u16size=$shortsize
15596                 ;;
15597         esac
15598         ;;
15599 esac
15600 case "$i16type" in
15601 '')     set try -DINT16
15602         if eval $compile; then
15603                 case "`$run ./try`" in
15604                 int16_t)
15605                         i16type=int16_t
15606                         u16type=uint16_t
15607                         i16size=2
15608                         u16size=2
15609                         ;;
15610                 esac
15611         fi
15612         ;;
15613 esac
15614 case "$i16type" in
15615 '')     if $test $shortsize -ge 2; then
15616                 i16type=short
15617                 u16type="unsigned short"
15618                 i16size=$shortsize
15619                 u16size=$shortsize
15620         fi
15621         ;;
15622 esac
15623
15624 case "$i32type" in
15625 '')     case "$longsize" in
15626         4)      i32type=long
15627                 u32type="unsigned long"
15628                 i32size=$longsize
15629                 u32size=$longsize
15630                 ;;
15631         *)      case "$intsize" in
15632                 4)      i32type=int
15633                         u32type="unsigned int"
15634                         i32size=$intsize
15635                         u32size=$intsize
15636                         ;;
15637                 esac
15638                 ;;
15639         esac
15640         ;;
15641 esac
15642 case "$i32type" in
15643 '')     set try -DINT32
15644         if eval $compile; then
15645                 case "`$run ./try`" in
15646                 int32_t)
15647                         i32type=int32_t
15648                         u32type=uint32_t
15649                         i32size=4
15650                         u32size=4
15651                         ;;
15652                 esac
15653         fi
15654         ;;
15655 esac
15656 case "$i32type" in
15657 '')     if $test $intsize -ge 4; then
15658                 i32type=int
15659                 u32type="unsigned int"
15660                 i32size=$intsize
15661                 u32size=$intsize
15662         fi
15663         ;;
15664 esac
15665
15666 case "$i64type" in
15667 '')     case "$d_quad:$quadtype" in
15668         define:?*)
15669                 i64type="$quadtype"
15670                 u64type="$uquadtype"
15671                 i64size=8
15672                 u64size=8
15673                 ;;
15674         esac
15675         ;;
15676 esac
15677
15678 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15679 : volatile so that the compiler has to store it out to memory.
15680 if test X"$d_volatile" = X"$define"; then
15681         volatile=volatile
15682 fi
15683 $cat <<EOP >try.c
15684 #include <stdio.h>
15685 #$i_stdlib I_STDLIB
15686 #ifdef I_STDLIB
15687 #include <stdlib.h>
15688 #endif
15689 #include <sys/types.h>
15690 #include <signal.h>
15691 #ifdef SIGFPE
15692 $volatile int bletched = 0;
15693 $signal_t blech(int s) { bletched = 1; }
15694 #endif
15695 int main() {
15696     $uvtype u = 0;
15697     $nvtype d;
15698     int     n = 8 * $uvsize;
15699     int     i;
15700 #ifdef SIGFPE
15701     signal(SIGFPE, blech);
15702 #endif
15703
15704     for (i = 0; i < n; i++) {
15705       u = u << 1 | ($uvtype)1;
15706       d = ($nvtype)u;
15707       if (($uvtype)d != u)
15708         break;
15709       if (d <= 0)
15710         break;
15711       d = ($nvtype)(u - 1);
15712       if (($uvtype)d != (u - 1))
15713         break;
15714 #ifdef SIGFPE
15715       if (bletched)
15716         break;
15717 #endif
15718     }
15719     printf("%d\n", ((i == n) ? -n : i));
15720     exit(0);
15721 }
15722 EOP
15723 set try
15724
15725 d_nv_preserves_uv="$undef"
15726 if eval $compile; then
15727         nv_preserves_uv_bits="`$run ./try`"
15728 fi
15729 case "$nv_preserves_uv_bits" in
15730 \-[1-9]*)
15731         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15732         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15733         d_nv_preserves_uv="$define"
15734         ;;
15735 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15736         d_nv_preserves_uv="$undef" ;;
15737 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15738         nv_preserves_uv_bits="0" ;;
15739 esac
15740 $rm_try
15741
15742 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15743 : volatile so that the compiler has to store it out to memory.
15744 if test X"$d_volatile" = X"$define"; then
15745         volatile=volatile
15746 fi
15747 $cat <<EOP >try.c
15748 #include <stdio.h>
15749
15750 typedef $nvtype NV;
15751
15752 int
15753 main() {
15754   NV value = 2;
15755   int count = 1;
15756
15757   while(count < 256) {
15758     $volatile NV up = value + 1.0;
15759     $volatile NV negated = -value;
15760     $volatile NV down = negated - 1.0;
15761     $volatile NV got_up = up - value;
15762     int up_good = got_up == 1.0;
15763     int got_down = down - negated;
15764     int down_good = got_down == -1.0;
15765
15766     if (down_good != up_good) {
15767       fprintf(stderr,
15768               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15769               up_good, (double) got_up, down_good, (double) got_down,
15770               count, (double) value);
15771       return 1;
15772     }
15773     if (!up_good) {
15774       while (1) {
15775         if (count > 8) {
15776           count -= 8;
15777           fputs("256.0", stdout);
15778         } else {
15779           count--;
15780           fputs("2.0", stdout);
15781         }
15782         if (!count) {
15783           puts("");
15784           return 0;
15785         }
15786         fputs("*", stdout);
15787       }
15788     }
15789     value *= 2;
15790     ++count;
15791   }
15792   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15793           count, (double) value);
15794   return 1;
15795 }
15796 EOP
15797 set try
15798
15799 nv_overflows_integers_at='0'
15800 if eval $compile; then
15801     xxx="`$run ./try`"
15802     case "$?" in
15803         0)
15804             case "$xxx" in
15805                 2*)  cat >&4 <<EOM
15806 The largest integer your NVs can preserve is equal to $xxx
15807 EOM
15808                     nv_overflows_integers_at="$xxx"
15809                     ;;
15810                 *)  cat >&4 <<EOM
15811 Cannot determine the largest integer value your NVs can hold, unexpected output
15812 '$xxx'
15813 EOM
15814                     ;;
15815             esac
15816             ;;
15817         *)  cat >&4 <<EOM
15818 Cannot determine the largest integer value your NVs can hold
15819 EOM
15820             ;;
15821     esac
15822 fi
15823 $rm_try
15824
15825 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15826 : volatile so that the compiler has to store it out to memory.
15827 if test X"$d_volatile" = X"$define"; then
15828         volatile=volatile
15829 fi
15830 $cat <<EOP >try.c
15831 #include <stdio.h>
15832 #$i_stdlib I_STDLIB
15833 #ifdef I_STDLIB
15834 #include <stdlib.h>
15835 #endif
15836 #$i_string I_STRING
15837 #ifdef I_STRING
15838 #  include <string.h>
15839 #else
15840 #  include <strings.h>
15841 #endif
15842 #include <sys/types.h>
15843 #include <signal.h>
15844 #ifdef SIGFPE
15845 $volatile int bletched = 0;
15846 $signal_t blech(int s) { bletched = 1; }
15847 #endif
15848
15849 int checkit($nvtype d, char *where) {
15850     unsigned char *p = (char *)&d;
15851     unsigned char *end = p + sizeof(d);
15852     int fail = 0;
15853
15854     while (p < end)
15855         fail += *p++;
15856
15857     if (!fail)
15858         return 0;
15859
15860     p = (char *)&d;
15861     printf("No - %s: 0x", where);
15862     while (p < end)
15863         printf ("%02X", *p++);
15864     printf("\n");
15865     return 1;
15866 }
15867
15868 int main(int argc, char **argv) {
15869     $nvtype d = 0.0;
15870     int fail = 0;
15871     fail += checkit(d, "0.0");
15872
15873     /* The compiler shouldn't be assuming that bletched is 0  */
15874     d = bletched;
15875
15876     fail += checkit(d, "bleched");
15877
15878 #ifdef SIGFPE
15879     signal(SIGFPE, blech);
15880 #endif
15881
15882     /* Paranoia - the compiler should have no way of knowing that ANSI says
15883        that argv[argc] will always be NULL.  Actually, if it did assume this it
15884        would be buggy, as this is C and main() can be called from elsewhere in
15885        the program.  */
15886     d = argv[argc] ? 1 : 0;
15887
15888     if (d) {
15889         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15890     }
15891
15892     fail += checkit(d, "ternary");
15893
15894     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15895
15896     if (d != 0.0) {
15897         printf("No - memset doesn't give 0.0\n");
15898         /* This might just blow up:  */
15899         printf("(gives %g)\n", d);
15900         return 1;
15901     }
15902
15903 #ifdef SIGFPE
15904     if (bletched) {
15905         printf("No - something bleched\n");
15906         return 1;
15907     }
15908 #endif
15909     if (fail) {
15910       printf("No - %d fail(s)\n", fail);
15911       return 1;
15912     }
15913     printf("Yes\n");
15914     return 0;
15915 }
15916 EOP
15917 set try
15918
15919 d_nv_zero_is_allbits_zero="$undef"
15920 if eval $compile; then
15921     xxx="`$run ./try`"
15922     case "$?" in
15923         0)
15924             case "$xxx" in
15925                 Yes)  cat >&4 <<EOM
15926 0.0 is represented as all bits zero in memory
15927 EOM
15928                     d_nv_zero_is_allbits_zero="$define"
15929                     ;;
15930                 *)  cat >&4 <<EOM
15931 0.0 is not represented as all bits zero in memory
15932 EOM
15933                     d_nv_zero_is_allbits_zero="$undef"
15934                     ;;
15935             esac
15936             ;;
15937         *)  cat >&4 <<EOM
15938 0.0 is not represented as all bits zero in memory
15939 EOM
15940             d_nv_zero_is_allbits_zero="$undef"
15941             ;;
15942     esac
15943 fi
15944 $rm_try
15945
15946 : check for off64_t
15947 echo " "
15948 echo "Checking to see if you have off64_t..." >&4
15949 $cat >try.c <<EOCP
15950 #include <sys/types.h>
15951 #include <unistd.h>
15952 int main() { off64_t x = 7; }
15953 EOCP
15954 set try
15955 if eval $compile; then
15956         val="$define"
15957         echo "You have off64_t."
15958 else
15959         val="$undef"
15960         echo "You do not have off64_t."
15961         case "$lseeksize" in
15962         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15963         esac
15964 fi
15965 $rm_try
15966 set d_off64_t
15967 eval $setvar
15968
15969 : how to create joinable pthreads
15970 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15971         echo " "
15972         echo "Checking what constant to use for creating joinable pthreads..." >&4
15973         $cat >try.c <<'EOCP'
15974 #include <pthread.h>
15975 int main() {
15976     int detachstate = JOINABLE;
15977 }
15978 EOCP
15979         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15980         if eval $compile; then
15981                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15982                 val="$undef" # Yes, undef.
15983                 set d_old_pthread_create_joinable
15984                 eval $setvar
15985                 val=""
15986                 set old_pthread_create_joinable
15987                 eval $setvar
15988         else
15989                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15990                 if eval $compile; then
15991                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15992                         val="$define"
15993                         set d_old_pthread_create_joinable
15994                         eval $setvar
15995                         val=PTHREAD_CREATE_UNDETACHED
15996                         set old_pthread_create_joinable
15997                         eval $setvar
15998                 else
15999                         set try -DJOINABLE=__UNDETACHED
16000                         if eval $compile; then
16001                                 echo "You seem to use __UNDETACHED." >&4
16002                                 val="$define"
16003                                 set d_old_pthread_create_joinable
16004                                 eval $setvar
16005                                 val=__UNDETACHED
16006                                 set old_pthread_create_joinable
16007                                 eval $setvar
16008                         else
16009                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16010                                 val="$define"
16011                                 set d_old_pthread_create_joinable
16012                                 eval $setvar
16013                                 val=0
16014                                 set old_pthread_create_joinable
16015                                 eval $setvar
16016                         fi
16017                 fi
16018         fi
16019         $rm_try
16020 else
16021     d_old_pthread_create_joinable="$undef"
16022     old_pthread_create_joinable=""
16023 fi
16024
16025 : see if pause exists
16026 set pause d_pause
16027 eval $inlibc
16028
16029 : see if poll exists
16030 set poll d_poll
16031 eval $inlibc
16032
16033 : see if readlink exists
16034 set readlink d_readlink
16035 eval $inlibc
16036
16037 : Check if exe is symlink to abs path of executing program
16038 echo " "
16039 procselfexe=''
16040 val="$undef"
16041 case "$d_readlink" in
16042 "$define")
16043         if $issymlink /proc/self/exe ; then
16044                 $ls -l /proc/self/exe > reflect
16045                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16046                         echo "You have Linux-like /proc/self/exe."
16047                         procselfexe='"/proc/self/exe"'
16048                         val="$define"
16049                 fi
16050         fi
16051         if $issymlink /proc/curproc/file ; then
16052                 $ls -l /proc/curproc/file > reflect
16053                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16054                         echo "You have BSD-like /proc/curproc/file."
16055                         procselfexe='"/proc/curproc/file"'
16056                         val="$define"
16057                 fi
16058         fi
16059         ;;
16060 esac
16061 $rm -f reflect
16062 set d_procselfexe
16063 eval $setvar
16064
16065 : backward compatibility for d_hvfork
16066 if test X$d_hvfork != X; then
16067         d_vfork="$d_hvfork"
16068         d_hvfork=''
16069 fi
16070 : see if there is a vfork
16071 val=''
16072 set vfork val
16073 eval $inlibc
16074
16075 d_pseudofork=$undef
16076
16077 : Ok, but do we want to use it. vfork is reportedly unreliable in
16078 : perl on Solaris 2.x, and probably elsewhere.
16079 case "$val" in
16080 $define)
16081         echo " "
16082         case "$usevfork" in
16083         false) dflt='n';;
16084         *) dflt='y';;
16085         esac
16086         cat <<'EOM'
16087
16088 Perl can only use a vfork() that doesn't suffer from strict
16089 restrictions on calling functions or modifying global data in
16090 the child.  For example, glibc-2.1 contains such a vfork()
16091 that is unsuitable.  If your system provides a proper fork()
16092 call, chances are that you do NOT want perl to use vfork().
16093
16094 EOM
16095         rp="Do you still want to use vfork()?"
16096         . ./myread
16097         case "$ans" in
16098         y|Y) ;;
16099         *)
16100                 echo "Ok, we won't use vfork()."
16101                 val="$undef"
16102                 ;;
16103         esac
16104         ;;
16105 esac
16106 set d_vfork
16107 eval $setvar
16108 case "$d_vfork" in
16109 $define) usevfork='true';;
16110 *) usevfork='false';;
16111 esac
16112
16113 : see whether the pthread_atfork exists
16114 $cat >try.c <<EOP
16115 #include <pthread.h>
16116 #include <stdio.h>
16117 int main() {
16118 #ifdef  PTHREAD_ATFORK
16119         pthread_atfork(NULL,NULL,NULL);
16120 #endif
16121 }
16122 EOP
16123
16124 : see if pthread_atfork exists
16125 set try -DPTHREAD_ATFORK
16126 if eval $compile; then
16127     val="$define"
16128 else
16129     val="$undef"
16130 fi
16131 case "$usethreads" in
16132 $define)
16133         case "$val" in
16134         $define) echo 'pthread_atfork found.' >&4        ;;
16135         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16136         esac
16137 esac
16138 set d_pthread_atfork
16139 eval $setvar
16140
16141 : see if pthread_attr_setscope exists
16142 set pthread_attr_setscope d_pthread_attr_setscope
16143 eval $inlibc
16144
16145 : see whether the various POSIXish _yields exist
16146 $cat >try.c <<EOP
16147 #include <pthread.h>
16148 #include <stdio.h>
16149 int main() {
16150 #ifdef SCHED_YIELD
16151         sched_yield();
16152 #else
16153 #ifdef PTHREAD_YIELD
16154         pthread_yield();
16155 #else
16156 #ifdef PTHREAD_YIELD_NULL
16157         pthread_yield(NULL);
16158 #endif
16159 #endif
16160 #endif
16161 }
16162 EOP
16163 : see if sched_yield exists
16164 set try -DSCHED_YIELD
16165 if eval $compile; then
16166     val="$define"
16167     sched_yield='sched_yield()'
16168 else
16169     val="$undef"
16170 fi
16171 case "$usethreads" in
16172 $define)
16173         case "$val" in
16174         $define) echo 'sched_yield() found.' >&4        ;;
16175         *)       echo 'sched_yield() NOT found.' >&4    ;;
16176         esac
16177 esac
16178 set d_sched_yield
16179 eval $setvar
16180
16181 : see if pthread_yield exists
16182 set try -DPTHREAD_YIELD
16183 if eval $compile; then
16184     val="$define"
16185     case "$sched_yield" in
16186     '') sched_yield='pthread_yield()' ;;
16187     esac
16188 else
16189     set try -DPTHREAD_YIELD_NULL
16190     if eval $compile; then
16191         val="$define"
16192         case "$sched_yield" in
16193         '') sched_yield='pthread_yield(NULL)' ;;
16194         esac
16195     else
16196         val="$undef"
16197     fi
16198 fi
16199 case "$usethreads" in
16200 $define)
16201         case "$val" in
16202         $define) echo 'pthread_yield() found.' >&4      ;;
16203         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16204         esac
16205         ;;
16206 esac
16207 set d_pthread_yield
16208 eval $setvar
16209 case "$sched_yield" in
16210 '') sched_yield=undef ;;
16211 esac
16212 $rm_try
16213
16214 : see if random_r exists
16215 set random_r d_random_r
16216 eval $inlibc
16217 case "$d_random_r" in
16218 "$define")
16219         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16220         case "$d_random_r_proto:$usethreads" in
16221         ":define")      d_random_r_proto=define
16222                 set d_random_r_proto random_r $hdrs
16223                 eval $hasproto ;;
16224         *)      ;;
16225         esac
16226         case "$d_random_r_proto" in
16227         define)
16228         case "$random_r_proto" in
16229         ''|0) try='int random_r(int*, struct random_data*);'
16230         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16231         esac
16232         case "$random_r_proto" in
16233         ''|0) try='int random_r(long*, struct random_data*);'
16234         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16235         esac
16236         case "$random_r_proto" in
16237         ''|0) try='int random_r(struct random_data*, int32_t*);'
16238         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16239         esac
16240         case "$random_r_proto" in
16241         ''|0)   d_random_r=undef
16242                 random_r_proto=0
16243                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16244         * )     case "$random_r_proto" in
16245                 REENTRANT_PROTO*) ;;
16246                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16247                 esac
16248                 echo "Prototype: $try" ;;
16249         esac
16250         ;;
16251         *)      case "$usethreads" in
16252                 define) echo "random_r has no prototype, not using it." >&4 ;;
16253                 esac
16254                 d_random_r=undef
16255                 random_r_proto=0
16256                 ;;
16257         esac
16258         ;;
16259 *)      random_r_proto=0
16260         ;;
16261 esac
16262
16263 : see if readdir and friends exist
16264 set readdir d_readdir
16265 eval $inlibc
16266 set seekdir d_seekdir
16267 eval $inlibc
16268 set telldir d_telldir
16269 eval $inlibc
16270 set rewinddir d_rewinddir
16271 eval $inlibc
16272
16273 : see if readdir64_r exists
16274 set readdir64_r d_readdir64_r
16275 eval $inlibc
16276 case "$d_readdir64_r" in
16277 "$define")
16278         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16279         case "$d_readdir64_r_proto:$usethreads" in
16280         ":define")      d_readdir64_r_proto=define
16281                 set d_readdir64_r_proto readdir64_r $hdrs
16282                 eval $hasproto ;;
16283         *)      ;;
16284         esac
16285         case "$d_readdir64_r_proto" in
16286         define)
16287         case "$readdir64_r_proto" in
16288         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16289         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16290         esac
16291         case "$readdir64_r_proto" in
16292         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16293         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16294         esac
16295         case "$readdir64_r_proto" in
16296         ''|0)   d_readdir64_r=undef
16297                 readdir64_r_proto=0
16298                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16299         * )     case "$readdir64_r_proto" in
16300                 REENTRANT_PROTO*) ;;
16301                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16302                 esac
16303                 echo "Prototype: $try" ;;
16304         esac
16305         ;;
16306         *)      case "$usethreads" in
16307                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16308                 esac
16309                 d_readdir64_r=undef
16310                 readdir64_r_proto=0
16311                 ;;
16312         esac
16313         ;;
16314 *)      readdir64_r_proto=0
16315         ;;
16316 esac
16317
16318 : see if readdir_r exists
16319 set readdir_r d_readdir_r
16320 eval $inlibc
16321 case "$d_readdir_r" in
16322 "$define")
16323         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16324         case "$d_readdir_r_proto:$usethreads" in
16325         ":define")      d_readdir_r_proto=define
16326                 set d_readdir_r_proto readdir_r $hdrs
16327                 eval $hasproto ;;
16328         *)      ;;
16329         esac
16330         case "$d_readdir_r_proto" in
16331         define)
16332         case "$readdir_r_proto" in
16333         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16334         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16335         esac
16336         case "$readdir_r_proto" in
16337         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16338         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16339         esac
16340         case "$readdir_r_proto" in
16341         ''|0)   d_readdir_r=undef
16342                 readdir_r_proto=0
16343                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16344         * )     case "$readdir_r_proto" in
16345                 REENTRANT_PROTO*) ;;
16346                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16347                 esac
16348                 echo "Prototype: $try" ;;
16349         esac
16350         ;;
16351         *)      case "$usethreads" in
16352                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16353                 esac
16354                 d_readdir_r=undef
16355                 readdir_r_proto=0
16356                 ;;
16357         esac
16358         ;;
16359 *)      readdir_r_proto=0
16360         ;;
16361 esac
16362
16363 : see if readv exists
16364 set readv d_readv
16365 eval $inlibc
16366
16367 : see if recvmsg exists
16368 set recvmsg d_recvmsg
16369 eval $inlibc
16370
16371 : see if rename exists
16372 set rename d_rename
16373 eval $inlibc
16374
16375 : see if rmdir exists
16376 set rmdir d_rmdir
16377 eval $inlibc
16378
16379 : see if memory.h is available.
16380 val=''
16381 set memory.h val
16382 eval $inhdr
16383
16384 : See if it conflicts with string.h
16385 case "$val" in
16386 $define)
16387         case "$strings" in
16388         '') ;;
16389         *)
16390                 $cppstdin $cppflags $cppminus < $strings > mem.h
16391                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16392                         echo " "
16393                         echo "We won't be including <memory.h>."
16394                         val="$undef"
16395                 fi
16396                 $rm -f mem.h
16397                 ;;
16398         esac
16399 esac
16400 set i_memory
16401 eval $setvar
16402
16403 : can bcopy handle overlapping blocks?
16404 echo " "
16405 val="$undef"
16406 case "$d_memmove" in
16407 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16408 *)      case "$d_bcopy" in
16409         "$define")
16410                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16411                 $cat >try.c <<EOCP
16412 #$i_memory I_MEMORY
16413 #$i_stdlib I_STDLIB
16414 #$i_string I_STRING
16415 #$i_unistd I_UNISTD
16416 EOCP
16417         $cat >>try.c <<'EOCP'
16418 #include <stdio.h>
16419 #ifdef I_MEMORY
16420 #  include <memory.h>
16421 #endif
16422 #ifdef I_STDLIB
16423 #  include <stdlib.h>
16424 #endif
16425 #ifdef I_STRING
16426 #  include <string.h>
16427 #else
16428 #  include <strings.h>
16429 #endif
16430 #ifdef I_UNISTD
16431 #  include <unistd.h>  /* Needed for NetBSD */
16432 #endif
16433 int main()
16434 {
16435 char buf[128], abc[128];
16436 char *b;
16437 int len;
16438 int off;
16439 int align;
16440
16441 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16442    try to store the string in read-only memory. */
16443 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16444
16445 for (align = 7; align >= 0; align--) {
16446         for (len = 36; len; len--) {
16447                 b = buf+align;
16448                 bcopy(abc, b, len);
16449                 for (off = 1; off <= len; off++) {
16450                         bcopy(b, b+off, len);
16451                         bcopy(b+off, b, len);
16452                         if (bcmp(b, abc, len))
16453                                 exit(1);
16454                 }
16455         }
16456 }
16457 exit(0);
16458 }
16459 EOCP
16460                 set try
16461                 if eval $compile_ok; then
16462                         if $run ./try 2>/dev/null; then
16463                                 echo "Yes, it can."
16464                                 val="$define"
16465                         else
16466                                 echo "It can't, sorry."
16467                         fi
16468                 else
16469                         echo "(I can't compile the test program, so we'll assume not...)"
16470                 fi
16471                 ;;
16472         esac
16473         $rm_try
16474         ;;
16475 esac
16476 set d_safebcpy
16477 eval $setvar
16478
16479 : can memcpy handle overlapping blocks?
16480 echo " "
16481 val="$undef"
16482 case "$d_memmove" in
16483 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16484 *)      case "$d_memcpy" in
16485         "$define")
16486                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16487                 $cat >try.c <<EOCP
16488 #$i_memory I_MEMORY
16489 #$i_stdlib I_STDLIB
16490 #$i_string I_STRING
16491 #$i_unistd I_UNISTD
16492 EOCP
16493         $cat >>try.c <<'EOCP'
16494 #include <stdio.h>
16495 #ifdef I_MEMORY
16496 #  include <memory.h>
16497 #endif
16498 #ifdef I_STDLIB
16499 #  include <stdlib.h>
16500 #endif
16501 #ifdef I_STRING
16502 #  include <string.h>
16503 #else
16504 #  include <strings.h>
16505 #endif
16506 #ifdef I_UNISTD
16507 #  include <unistd.h>  /* Needed for NetBSD */
16508 #endif
16509 int main()
16510 {
16511 char buf[128], abc[128];
16512 char *b;
16513 int len;
16514 int off;
16515 int align;
16516
16517 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16518    try to store the string in read-only memory. */
16519 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16520
16521 for (align = 7; align >= 0; align--) {
16522         for (len = 36; len; len--) {
16523                 b = buf+align;
16524                 memcpy(b, abc, len);
16525                 for (off = 1; off <= len; off++) {
16526                         memcpy(b+off, b, len);
16527                         memcpy(b, b+off, len);
16528                         if (memcmp(b, abc, len))
16529                                 exit(1);
16530                 }
16531         }
16532 }
16533 exit(0);
16534 }
16535 EOCP
16536                 set try
16537                 if eval $compile_ok; then
16538                         if $run ./try 2>/dev/null; then
16539                                 echo "Yes, it can."
16540                                 val="$define"
16541                         else
16542                                 echo "It can't, sorry."
16543                         fi
16544                 else
16545                         echo "(I can't compile the test program, so we'll assume not...)"
16546                 fi
16547                 ;;
16548         esac
16549         $rm_try
16550         ;;
16551 esac
16552 set d_safemcpy
16553 eval $setvar
16554
16555 : can memcmp be trusted to compare relative magnitude?
16556 val="$undef"
16557 case "$d_memcmp" in
16558 "$define")
16559         echo " "
16560         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16561         $cat >try.c <<EOCP
16562 #$i_memory I_MEMORY
16563 #$i_stdlib I_STDLIB
16564 #$i_string I_STRING
16565 #$i_unistd I_UNISTD
16566 EOCP
16567         $cat >>try.c <<'EOCP'
16568 #include <stdio.h>
16569 #ifdef I_MEMORY
16570 #  include <memory.h>
16571 #endif
16572 #ifdef I_STDLIB
16573 #  include <stdlib.h>
16574 #endif
16575 #ifdef I_STRING
16576 #  include <string.h>
16577 #else
16578 #  include <strings.h>
16579 #endif
16580 #ifdef I_UNISTD
16581 #  include <unistd.h>  /* Needed for NetBSD */
16582 #endif
16583 int main()
16584 {
16585 char a = -1;
16586 char b = 0;
16587 if ((a < b) && memcmp(&a, &b, 1) < 0)
16588         exit(1);
16589 exit(0);
16590 }
16591 EOCP
16592         set try
16593         if eval $compile_ok; then
16594                 if $run ./try 2>/dev/null; then
16595                         echo "Yes, it can."
16596                         val="$define"
16597                 else
16598                         echo "No, it can't (it uses signed chars)."
16599                 fi
16600         else
16601                 echo "(I can't compile the test program, so we'll assume not...)"
16602         fi
16603         ;;
16604 esac
16605 $rm_try
16606 set d_sanemcmp
16607 eval $setvar
16608
16609 : see if prototype for sbrk is available
16610 echo " "
16611 set d_sbrkproto sbrk $i_unistd unistd.h
16612 eval $hasproto
16613
16614 : see if select exists
16615 set select d_select
16616 eval $inlibc
16617
16618 : see if semctl exists
16619 set semctl d_semctl
16620 eval $inlibc
16621
16622 : see if semget exists
16623 set semget d_semget
16624 eval $inlibc
16625
16626 : see if semop exists
16627 set semop d_semop
16628 eval $inlibc
16629
16630 : see how much of the 'sem*(2)' library is present.
16631 h_sem=true
16632 echo " "
16633 case "$d_semctl$d_semget$d_semop" in
16634 *"$undef"*) h_sem=false;;
16635 esac
16636 case "$osname" in
16637 freebsd)
16638     case "`ipcs 2>&1`" in
16639     "SVID messages"*"not configured"*)
16640         echo "Your $osname does not have the sem*(2) configured." >&4
16641         h_sem=false
16642         val="$undef"
16643         set semctl d_semctl
16644         eval $setvar
16645         set semget d_semget
16646         eval $setvar
16647         set semop d_semop
16648         eval $setvar
16649         ;;
16650     esac
16651     ;;
16652 esac
16653 : we could also check for sys/ipc.h ...
16654 if $h_sem && $test `./findhdr sys/sem.h`; then
16655         echo "You have the full sem*(2) library." >&4
16656         val="$define"
16657 else
16658         echo "You don't have the full sem*(2) library." >&4
16659         val="$undef"
16660 fi
16661 set d_sem
16662 eval $setvar
16663
16664 : see whether sys/sem.h defines union semun
16665 echo " "
16666 $cat > try.c <<'END'
16667 #include <sys/types.h>
16668 #include <sys/ipc.h>
16669 #include <sys/sem.h>
16670 int main () { union semun semun; semun.buf = 0; }
16671 END
16672 set try
16673 if eval $compile; then
16674     echo "You have union semun in <sys/sem.h>." >&4
16675     val="$define"
16676 else
16677     echo "You do not have union semun in <sys/sem.h>." >&4
16678     val="$undef"
16679 fi
16680 $rm_try
16681 set d_union_semun
16682 eval $setvar
16683
16684 : see how to do semctl IPC_STAT
16685 case "$d_sem" in
16686 $define)
16687     echo " "
16688     $cat > tryh.h <<END
16689 #ifndef S_IRUSR
16690 #   ifdef S_IREAD
16691 #       define S_IRUSR S_IREAD
16692 #       define S_IWUSR S_IWRITE
16693 #       define S_IXUSR S_IEXEC
16694 #   else
16695 #       define S_IRUSR 0400
16696 #       define S_IWUSR 0200
16697 #       define S_IXUSR 0100
16698 #   endif
16699 #   define S_IRGRP (S_IRUSR>>3)
16700 #   define S_IWGRP (S_IWUSR>>3)
16701 #   define S_IXGRP (S_IXUSR>>3)
16702 #   define S_IROTH (S_IRUSR>>6)
16703 #   define S_IWOTH (S_IWUSR>>6)
16704 #   define S_IXOTH (S_IXUSR>>6)
16705 #endif
16706 #ifndef S_IRWXU
16707 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16708 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16709 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16710 #endif
16711 END
16712     : see whether semctl IPC_STAT can use union semun
16713     case "$d_semctl_semun" in
16714     '')
16715       val="$undef"
16716       $cat > try.c <<END
16717 #include <sys/types.h>
16718 #include <sys/ipc.h>
16719 #include <sys/sem.h>
16720 #include <sys/stat.h>
16721 #include <stdio.h>
16722 #include <errno.h>
16723 #include "tryh.h"
16724 #ifndef errno
16725 extern int errno;
16726 #endif
16727 #$d_union_semun HAS_UNION_SEMUN
16728 int main() {
16729     union semun
16730 #ifndef HAS_UNION_SEMUN
16731     {
16732         int val;
16733         struct semid_ds *buf;
16734         unsigned short *array;
16735     }
16736 #endif
16737     arg;
16738     int sem, st;
16739
16740 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16741     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16742     if (sem > -1) {
16743         struct semid_ds argbuf;
16744         arg.buf = &argbuf;
16745 #       ifdef IPC_STAT
16746         st = semctl(sem, 0, IPC_STAT, arg);
16747         if (st == 0)
16748             printf("semun\n");
16749         else
16750 #       endif /* IPC_STAT */
16751             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16752 #       ifdef IPC_RMID
16753         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16754 #       endif /* IPC_RMID */
16755             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16756     } else
16757 #endif /* IPC_PRIVATE && ... */
16758         printf("semget failed: errno = %d\n", errno);
16759   return 0;
16760 }
16761 END
16762       set try
16763       if eval $compile; then
16764           xxx=`$run ./try`
16765           case "$xxx" in
16766           semun) val="$define" ;;
16767           esac
16768       fi
16769       $rm_try
16770       set d_semctl_semun
16771       eval $setvar
16772       ;;
16773     esac
16774     case "$d_semctl_semun" in
16775     $define)
16776         echo "You can use union semun for semctl IPC_STAT." >&4
16777         also='also'
16778         ;;
16779     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16780         also=''
16781         ;;
16782     esac
16783
16784     : see whether semctl IPC_STAT can use struct semid_ds pointer
16785     case "$d_semctl_semid_ds" in
16786     '')
16787       val="$undef"
16788       $cat > try.c <<'END'
16789 #include <sys/types.h>
16790 #include <sys/ipc.h>
16791 #include <sys/sem.h>
16792 #include <sys/stat.h>
16793 #include "tryh.h"
16794 #include <stdio.h>
16795 #include <errno.h>
16796 #ifndef errno
16797 extern int errno;
16798 #endif
16799 int main() {
16800     struct semid_ds arg;
16801     int sem, st;
16802
16803 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16804     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16805     if (sem > -1) {
16806 #       ifdef IPC_STAT
16807         st = semctl(sem, 0, IPC_STAT, &arg);
16808         if (st == 0)
16809             printf("semid_ds\n");
16810         else
16811 #       endif /* IPC_STAT */
16812             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16813 #       ifdef IPC_RMID
16814         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16815 #       endif /* IPC_RMID */
16816             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16817     } else
16818 #endif /* IPC_PRIVATE && ... */
16819         printf("semget failed: errno = %d\n", errno);
16820
16821     return 0;
16822 }
16823 END
16824       set try
16825       if eval $compile; then
16826           xxx=`$run ./try`
16827           case "$xxx" in
16828           semid_ds) val="$define" ;;
16829           esac
16830       fi
16831       $rm_try
16832       set d_semctl_semid_ds
16833       eval $setvar
16834       ;;
16835     esac
16836     case "$d_semctl_semid_ds" in
16837     $define)
16838         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16839         ;;
16840     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16841         ;;
16842     esac
16843     ;;
16844 *)  val="$undef"
16845
16846     # We do not have the full sem*(2) library, so assume we can not
16847     # use either.
16848
16849     set d_semctl_semun
16850     eval $setvar
16851
16852     set d_semctl_semid_ds
16853     eval $setvar
16854     ;;
16855 esac
16856 $rm_try tryh.h
16857
16858 : see if sendmsg exists
16859 set sendmsg d_sendmsg
16860 eval $inlibc
16861
16862 : see if setegid exists
16863 set setegid d_setegid
16864 eval $inlibc
16865
16866 : see if seteuid exists
16867 set seteuid d_seteuid
16868 eval $inlibc
16869
16870 : see if setgrent exists
16871 set setgrent d_setgrent
16872 eval $inlibc
16873
16874 : see if setgrent_r exists
16875 set setgrent_r d_setgrent_r
16876 eval $inlibc
16877 case "$d_setgrent_r" in
16878 "$define")
16879         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16880         case "$d_setgrent_r_proto:$usethreads" in
16881         ":define")      d_setgrent_r_proto=define
16882                 set d_setgrent_r_proto setgrent_r $hdrs
16883                 eval $hasproto ;;
16884         *)      ;;
16885         esac
16886         case "$d_setgrent_r_proto" in
16887         define)
16888         case "$setgrent_r_proto" in
16889         ''|0) try='int setgrent_r(FILE**);'
16890         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16891         esac
16892         case "$setgrent_r_proto" in
16893         ''|0) try='void setgrent_r(FILE**);'
16894         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16895         esac
16896         case "$setgrent_r_proto" in
16897         ''|0)   d_setgrent_r=undef
16898                 setgrent_r_proto=0
16899                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16900         * )     case "$setgrent_r_proto" in
16901                 REENTRANT_PROTO*) ;;
16902                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16903                 esac
16904                 echo "Prototype: $try" ;;
16905         esac
16906         ;;
16907         *)      case "$usethreads" in
16908                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16909                 esac
16910                 d_setgrent_r=undef
16911                 setgrent_r_proto=0
16912                 ;;
16913         esac
16914         ;;
16915 *)      setgrent_r_proto=0
16916         ;;
16917 esac
16918
16919 : see if sethostent exists
16920 set sethostent d_sethent
16921 eval $inlibc
16922
16923 : see if sethostent_r exists
16924 set sethostent_r d_sethostent_r
16925 eval $inlibc
16926 case "$d_sethostent_r" in
16927 "$define")
16928         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16929         case "$d_sethostent_r_proto:$usethreads" in
16930         ":define")      d_sethostent_r_proto=define
16931                 set d_sethostent_r_proto sethostent_r $hdrs
16932                 eval $hasproto ;;
16933         *)      ;;
16934         esac
16935         case "$d_sethostent_r_proto" in
16936         define)
16937         case "$sethostent_r_proto" in
16938         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16939         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16940         esac
16941         case "$sethostent_r_proto" in
16942         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16943         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16944         esac
16945         case "$sethostent_r_proto" in
16946         ''|0)   d_sethostent_r=undef
16947                 sethostent_r_proto=0
16948                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16949         * )     case "$sethostent_r_proto" in
16950                 REENTRANT_PROTO*) ;;
16951                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16952                 esac
16953                 echo "Prototype: $try" ;;
16954         esac
16955         ;;
16956         *)      case "$usethreads" in
16957                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16958                 esac
16959                 d_sethostent_r=undef
16960                 sethostent_r_proto=0
16961                 ;;
16962         esac
16963         ;;
16964 *)      sethostent_r_proto=0
16965         ;;
16966 esac
16967
16968 : see if setitimer exists
16969 set setitimer d_setitimer
16970 eval $inlibc
16971
16972 : see if setlinebuf exists
16973 set setlinebuf d_setlinebuf
16974 eval $inlibc
16975
16976 : see if setlocale exists
16977 set setlocale d_setlocale
16978 eval $inlibc
16979
16980 : see if locale.h is available
16981 set locale.h i_locale
16982 eval $inhdr
16983
16984 : see if setlocale_r exists
16985 set setlocale_r d_setlocale_r
16986 eval $inlibc
16987 case "$d_setlocale_r" in
16988 "$define")
16989         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16990         case "$d_setlocale_r_proto:$usethreads" in
16991         ":define")      d_setlocale_r_proto=define
16992                 set d_setlocale_r_proto setlocale_r $hdrs
16993                 eval $hasproto ;;
16994         *)      ;;
16995         esac
16996         case "$d_setlocale_r_proto" in
16997         define)
16998         case "$setlocale_r_proto" in
16999         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17000         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17001         esac
17002         case "$setlocale_r_proto" in
17003         ''|0)   d_setlocale_r=undef
17004                 setlocale_r_proto=0
17005                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17006         * )     case "$setlocale_r_proto" in
17007                 REENTRANT_PROTO*) ;;
17008                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17009                 esac
17010                 echo "Prototype: $try" ;;
17011         esac
17012         ;;
17013         *)      case "$usethreads" in
17014                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17015                 esac
17016                 d_setlocale_r=undef
17017                 setlocale_r_proto=0
17018                 ;;
17019         esac
17020         ;;
17021 *)      setlocale_r_proto=0
17022         ;;
17023 esac
17024
17025 : see if setnetent exists
17026 set setnetent d_setnent
17027 eval $inlibc
17028
17029 : see if setnetent_r exists
17030 set setnetent_r d_setnetent_r
17031 eval $inlibc
17032 case "$d_setnetent_r" in
17033 "$define")
17034         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17035         case "$d_setnetent_r_proto:$usethreads" in
17036         ":define")      d_setnetent_r_proto=define
17037                 set d_setnetent_r_proto setnetent_r $hdrs
17038                 eval $hasproto ;;
17039         *)      ;;
17040         esac
17041         case "$d_setnetent_r_proto" in
17042         define)
17043         case "$setnetent_r_proto" in
17044         ''|0) try='int setnetent_r(int, struct netent_data*);'
17045         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17046         esac
17047         case "$setnetent_r_proto" in
17048         ''|0) try='void setnetent_r(int, struct netent_data*);'
17049         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17050         esac
17051         case "$setnetent_r_proto" in
17052         ''|0)   d_setnetent_r=undef
17053                 setnetent_r_proto=0
17054                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17055         * )     case "$setnetent_r_proto" in
17056                 REENTRANT_PROTO*) ;;
17057                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17058                 esac
17059                 echo "Prototype: $try" ;;
17060         esac
17061         ;;
17062         *)      case "$usethreads" in
17063                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17064                 esac
17065                 d_setnetent_r=undef
17066                 setnetent_r_proto=0
17067                 ;;
17068         esac
17069         ;;
17070 *)      setnetent_r_proto=0
17071         ;;
17072 esac
17073
17074 : see if setprotoent exists
17075 set setprotoent d_setpent
17076 eval $inlibc
17077
17078 : see if setpgid exists
17079 set setpgid d_setpgid
17080 eval $inlibc
17081
17082 : see if setpgrp2 exists
17083 set setpgrp2 d_setpgrp2
17084 eval $inlibc
17085
17086 : see if setpriority exists
17087 set setpriority d_setprior
17088 eval $inlibc
17089
17090 : see if setproctitle exists
17091 set setproctitle d_setproctitle
17092 eval $inlibc
17093
17094 : see if setprotoent_r exists
17095 set setprotoent_r d_setprotoent_r
17096 eval $inlibc
17097 case "$d_setprotoent_r" in
17098 "$define")
17099         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17100         case "$d_setprotoent_r_proto:$usethreads" in
17101         ":define")      d_setprotoent_r_proto=define
17102                 set d_setprotoent_r_proto setprotoent_r $hdrs
17103                 eval $hasproto ;;
17104         *)      ;;
17105         esac
17106         case "$d_setprotoent_r_proto" in
17107         define)
17108         case "$setprotoent_r_proto" in
17109         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17110         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17111         esac
17112         case "$setprotoent_r_proto" in
17113         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17114         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17115         esac
17116         case "$setprotoent_r_proto" in
17117         ''|0)   d_setprotoent_r=undef
17118                 setprotoent_r_proto=0
17119                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17120         * )     case "$setprotoent_r_proto" in
17121                 REENTRANT_PROTO*) ;;
17122                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17123                 esac
17124                 echo "Prototype: $try" ;;
17125         esac
17126         ;;
17127         *)      case "$usethreads" in
17128                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17129                 esac
17130                 d_setprotoent_r=undef
17131                 setprotoent_r_proto=0
17132                 ;;
17133         esac
17134         ;;
17135 *)      setprotoent_r_proto=0
17136         ;;
17137 esac
17138
17139 : see if setpwent exists
17140 set setpwent d_setpwent
17141 eval $inlibc
17142
17143 : see if setpwent_r exists
17144 set setpwent_r d_setpwent_r
17145 eval $inlibc
17146 case "$d_setpwent_r" in
17147 "$define")
17148         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17149         case "$d_setpwent_r_proto:$usethreads" in
17150         ":define")      d_setpwent_r_proto=define
17151                 set d_setpwent_r_proto setpwent_r $hdrs
17152                 eval $hasproto ;;
17153         *)      ;;
17154         esac
17155         case "$d_setpwent_r_proto" in
17156         define)
17157         case "$setpwent_r_proto" in
17158         ''|0) try='int setpwent_r(FILE**);'
17159         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17160         esac
17161         case "$setpwent_r_proto" in
17162         ''|0) try='void setpwent_r(FILE**);'
17163         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17164         esac
17165         case "$setpwent_r_proto" in
17166         ''|0)   d_setpwent_r=undef
17167                 setpwent_r_proto=0
17168                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17169         * )     case "$setpwent_r_proto" in
17170                 REENTRANT_PROTO*) ;;
17171                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17172                 esac
17173                 echo "Prototype: $try" ;;
17174         esac
17175         ;;
17176         *)      case "$usethreads" in
17177                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17178                 esac
17179                 d_setpwent_r=undef
17180                 setpwent_r_proto=0
17181                 ;;
17182         esac
17183         ;;
17184 *)      setpwent_r_proto=0
17185         ;;
17186 esac
17187
17188 : see if setregid exists
17189 set setregid d_setregid
17190 eval $inlibc
17191 set setresgid d_setresgid
17192 eval $inlibc
17193
17194 : see if setreuid exists
17195 set setreuid d_setreuid
17196 eval $inlibc
17197 set setresuid d_setresuid
17198 eval $inlibc
17199
17200 : see if setrgid exists
17201 set setrgid d_setrgid
17202 eval $inlibc
17203
17204 : see if setruid exists
17205 set setruid d_setruid
17206 eval $inlibc
17207
17208 : see if setservent exists
17209 set setservent d_setsent
17210 eval $inlibc
17211
17212 : see if setservent_r exists
17213 set setservent_r d_setservent_r
17214 eval $inlibc
17215 case "$d_setservent_r" in
17216 "$define")
17217         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17218         case "$d_setservent_r_proto:$usethreads" in
17219         ":define")      d_setservent_r_proto=define
17220                 set d_setservent_r_proto setservent_r $hdrs
17221                 eval $hasproto ;;
17222         *)      ;;
17223         esac
17224         case "$d_setservent_r_proto" in
17225         define)
17226         case "$setservent_r_proto" in
17227         ''|0) try='int setservent_r(int, struct servent_data*);'
17228         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17229         esac
17230         case "$setservent_r_proto" in
17231         ''|0) try='void setservent_r(int, struct servent_data*);'
17232         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17233         esac
17234         case "$setservent_r_proto" in
17235         ''|0)   d_setservent_r=undef
17236                 setservent_r_proto=0
17237                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17238         * )     case "$setservent_r_proto" in
17239                 REENTRANT_PROTO*) ;;
17240                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17241                 esac
17242                 echo "Prototype: $try" ;;
17243         esac
17244         ;;
17245         *)      case "$usethreads" in
17246                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17247                 esac
17248                 d_setservent_r=undef
17249                 setservent_r_proto=0
17250                 ;;
17251         esac
17252         ;;
17253 *)      setservent_r_proto=0
17254         ;;
17255 esac
17256
17257 : see if setsid exists
17258 set setsid d_setsid
17259 eval $inlibc
17260
17261 : see if setvbuf exists
17262 set setvbuf d_setvbuf
17263 eval $inlibc
17264
17265 : see if sfio.h is available
17266 set sfio.h i_sfio
17267 eval $inhdr
17268
17269 : see if sfio library is available
17270 case "$i_sfio" in
17271 $define)
17272         val=''
17273         set sfreserve val
17274         eval $inlibc
17275         ;;
17276 *)
17277         val="$undef"
17278         ;;
17279 esac
17280 : Ok, but do we want to use it.
17281 case "$val" in
17282 $define)
17283         case "$usesfio" in
17284         true|$define|[yY]*) dflt='y';;
17285         *) dflt='n';;
17286         esac
17287         echo "$package can use the sfio library, but it is experimental."
17288         case "$useperlio" in
17289         "$undef")
17290             echo "For sfio also the PerlIO abstraction layer is needed."
17291             echo "Earlier you said you wouldn't want that."
17292             ;;
17293         esac
17294         rp="You seem to have sfio available, do you want to try using it?"
17295         . ./myread
17296         case "$ans" in
17297         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17298                 useperlio="$define"
17299                 val="$define"
17300                 ;;
17301         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17302                 val="$undef"
17303                 ;;
17304         esac
17305         ;;
17306 *)      case "$usesfio" in
17307         true|$define|[yY]*)
17308                 echo "Sorry, cannot find sfio on this machine." >&4
17309                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17310                 val="$undef"
17311                 ;;
17312         esac
17313         ;;
17314 esac
17315 set d_sfio
17316 eval $setvar
17317 case "$d_sfio" in
17318 $define) usesfio='true';;
17319 *) usesfio='false';;
17320 esac
17321 case "$d_sfio" in
17322 $define) ;;
17323 *)      : Remove sfio from list of libraries to use
17324         case "$libs" in
17325         *-lsfio*)
17326                 echo "Removing unneeded -lsfio from library list" >&4
17327                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17328                 shift
17329                 libs="$*"
17330                 echo "libs = $libs" >&4
17331                 ;;
17332         esac
17333 ;;
17334 esac
17335
17336
17337 : see if shmctl exists
17338 set shmctl d_shmctl
17339 eval $inlibc
17340
17341 : see if shmget exists
17342 set shmget d_shmget
17343 eval $inlibc
17344
17345 : see if shmat exists
17346 set shmat d_shmat
17347 eval $inlibc
17348 : see what shmat returns
17349 case "$d_shmat" in
17350 "$define")
17351         $cat >shmat.c <<'END'
17352 #include <sys/shm.h>
17353 void *shmat();
17354 END
17355         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17356                 shmattype='void *'
17357         else
17358                 shmattype='char *'
17359         fi
17360         echo "and it returns ($shmattype)." >&4
17361         : see if a prototype for shmat is available
17362         xxx=`./findhdr sys/shm.h`
17363         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17364         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17365                 val="$define"
17366         else
17367                 val="$undef"
17368         fi
17369         $rm -f shmat.[co]
17370         ;;
17371 *)
17372         val="$undef"
17373         ;;
17374 esac
17375 set d_shmatprototype
17376 eval $setvar
17377
17378 : see if shmdt exists
17379 set shmdt d_shmdt
17380 eval $inlibc
17381
17382 : see how much of the 'shm*(2)' library is present.
17383 h_shm=true
17384 echo " "
17385 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17386 *"$undef"*) h_shm=false;;
17387 esac
17388 case "$osname" in
17389 freebsd)
17390     case "`ipcs 2>&1`" in
17391     "SVID shared memory"*"not configured"*)
17392         echo "Your $osname does not have the shm*(2) configured." >&4
17393         h_shm=false
17394         val="$undef"
17395         set shmctl d_shmctl
17396         evat $setvar
17397         set shmget d_shmget
17398         evat $setvar
17399         set shmat d_shmat
17400         evat $setvar
17401         set shmdt d_shmdt
17402         evat $setvar
17403         ;;
17404     esac
17405     ;;
17406 esac
17407 : we could also check for sys/ipc.h ...
17408 if $h_shm && $test `./findhdr sys/shm.h`; then
17409         echo "You have the full shm*(2) library." >&4
17410         val="$define"
17411 else
17412         echo "You don't have the full shm*(2) library." >&4
17413         val="$undef"
17414 fi
17415 set d_shm
17416 eval $setvar
17417
17418 : see if we have sigaction
17419 echo " "
17420 if set sigaction val -f d_sigaction; eval $csym; $val; then
17421         echo 'sigaction() found.' >&4
17422         $cat > try.c <<EOP
17423 #include <stdio.h>
17424 #include <sys/types.h>
17425 #include <signal.h>
17426 #$i_stdlib I_STDLIB
17427 #ifdef I_STDLIB
17428 #include <stdlib.h>
17429 #endif
17430 int main()
17431 {
17432     struct sigaction act, oact;
17433     act.sa_flags = 0;
17434     oact.sa_handler = 0;
17435     /* so that act and oact are used */
17436     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17437 }
17438 EOP
17439         set try
17440         if eval $compile_ok; then
17441                 val="$define"
17442         else
17443                 echo "But you don't seem to have a useable struct sigaction." >&4
17444                 val="$undef"
17445         fi
17446 else
17447         echo 'sigaction NOT found.' >&4
17448         val="$undef"
17449 fi
17450 set d_sigaction; eval $setvar
17451 $rm_try
17452
17453 : see if this is a sunmath.h system
17454 set sunmath.h i_sunmath
17455 eval $inhdr
17456
17457 : see if signbit exists
17458 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17459 $cat >try.c <<EOCP
17460 #$i_math I_MATH
17461 #$i_sunmath I_SUNMATH
17462 #ifdef I_MATH
17463 #  include <math.h>
17464 #endif
17465 #ifdef I_SUNMATH  /* Solaris special math library */
17466 #  include <sunmath.h>
17467 #endif
17468 #define NV $nvtype
17469 int main(int argc, char **argv)
17470 {
17471     NV x = 0.0;
17472     NV y = -0.0;
17473     if ((signbit(x) == 0) && (signbit(y) != 0))
17474         return 0;
17475     else
17476         return 1;
17477 }
17478 EOCP
17479 val="$undef"
17480 set try
17481 if eval $compile; then
17482     if $run ./try; then
17483         $echo "Yes." >&4
17484         val="$define"
17485     else
17486         $echo "Signbit seems to be available, but doesn't work as I expected."
17487         $echo "I won't use it." >&4
17488         val="$undef"
17489     fi
17490 else
17491     $echo "Nope." >&4
17492     dflt="$undef"
17493 fi
17494 set d_signbit
17495 eval $setvar
17496 $rm_try
17497
17498 : see if sigprocmask exists
17499 set sigprocmask d_sigprocmask
17500 eval $inlibc
17501
17502 : see if sigsetjmp exists
17503 echo " "
17504 case "$d_sigsetjmp" in
17505 '')
17506         $cat >try.c <<EOP
17507 #include <setjmp.h>
17508 #$i_stdlib I_STDLIB
17509 #ifdef I_STDLIB
17510 #include <stdlib.h>
17511 #endif
17512 sigjmp_buf env;
17513 int set = 1;
17514 int main()
17515 {
17516         if (sigsetjmp(env,1))
17517                 exit(set);
17518         set = 0;
17519         siglongjmp(env, 1);
17520         exit(1);
17521 }
17522 EOP
17523         set try
17524         if eval $compile; then
17525                 if $run ./try >/dev/null 2>&1; then
17526                         echo "POSIX sigsetjmp found." >&4
17527                         val="$define"
17528                 else
17529                         $cat >&4 <<EOM
17530 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17531 I'll ignore them.
17532 EOM
17533                         val="$undef"
17534                 fi
17535         else
17536                 echo "sigsetjmp not found." >&4
17537                 val="$undef"
17538         fi
17539         ;;
17540 *) val="$d_sigsetjmp"
17541         case "$d_sigsetjmp" in
17542         $define) echo "POSIX sigsetjmp found." >&4;;
17543         $undef) echo "sigsetjmp not found." >&4;;
17544         esac
17545         ;;
17546 esac
17547 set d_sigsetjmp
17548 eval $setvar
17549 $rm_try
17550
17551 : see if snprintf exists
17552 set snprintf d_snprintf
17553 eval $inlibc
17554
17555 : see if vsnprintf exists
17556 set vsnprintf d_vsnprintf
17557 eval $inlibc
17558
17559 case "$d_snprintf-$d_vsnprintf" in
17560 "$define-$define")
17561     $cat <<EOM
17562 Checking whether your snprintf() and vsnprintf() work okay...
17563 EOM
17564     $cat >try.c <<'EOCP'
17565 /* v?snprintf testing logic courtesy of Russ Allbery.
17566  * According to C99:
17567  * - if the buffer is too short it still must be \0-terminated
17568  * - if the buffer is too short the potentially required length
17569  *   must be returned and not -1
17570  * - if the buffer is NULL the potentially required length
17571  *   must be returned and not -1 or core dump
17572  */
17573 #include <stdio.h>
17574 #include <stdarg.h>
17575
17576 char buf[2];
17577
17578 int test (char *format, ...)
17579 {
17580     va_list args;
17581     int count;
17582
17583     va_start (args, format);
17584     count = vsnprintf (buf, sizeof buf, format, args);
17585     va_end (args);
17586     return count;
17587 }
17588
17589 int main ()
17590 {
17591     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17592              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17593 }
17594 EOCP
17595     set try
17596     if eval $compile; then
17597         `$run ./try`
17598         case "$?" in
17599         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17600         *) cat <<EOM >&4
17601 Your snprintf() and snprintf() don't seem to be working okay.
17602 EOM
17603            d_snprintf="$undef"
17604            d_vsnprintf="$undef"
17605            ;;
17606         esac
17607     else
17608         echo "(I can't seem to compile the test program--assuming they don't)"
17609         d_snprintf="$undef"
17610         d_vsnprintf="$undef"
17611     fi
17612     $rm_try
17613     ;;
17614 esac
17615
17616 : see if sockatmark exists
17617 set sockatmark d_sockatmark
17618 eval $inlibc
17619
17620 : see if prototype for sockatmark is available
17621 echo " "
17622 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17623 eval $hasproto
17624
17625 : see if socks5_init exists
17626 set socks5_init d_socks5_init
17627 eval $inlibc
17628
17629 : see if sprintf returns the length of the string in the buffer as per ANSI
17630 $echo "Checking whether sprintf returns the length of the string..." >&4
17631 $cat <<EOP >try.c
17632 #include <stdio.h>
17633 #$i_stdlib I_STDLIB
17634 #ifdef I_STDLIB
17635 #include <stdlib.h>
17636 #endif
17637 #$i_string I_STRING
17638 #ifdef I_STRING
17639 #  include <string.h>
17640 #else
17641 #  include <strings.h>
17642 #endif
17643 #$i_math I_MATH
17644 #ifdef I_MATH
17645 #include <math.h>
17646 #endif
17647
17648 char buffer[256];
17649
17650 int check (size_t expect, int test) {
17651   size_t got = strlen(buffer);
17652   if (expect == got)
17653     return 0;
17654
17655   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17656        test, buffer);
17657   exit (test);
17658 }
17659
17660 int main(int argc, char **argv) {
17661   int test = 0;
17662
17663   check(sprintf(buffer, ""), ++test);
17664   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17665   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17666
17667   return 0;
17668 }
17669 EOP
17670 set try
17671
17672 if eval $compile; then
17673     xxx="`$run ./try`"
17674     case "$?" in
17675         0) cat >&4 <<EOM
17676 sprintf returns the length of the string (as ANSI says it should)
17677 EOM
17678         d_sprintf_returns_strlen="$define"
17679         ;;
17680         *) cat >&4 <<EOM
17681 sprintf does not return the length of the string (how old is this system?)
17682 EOM
17683         d_sprintf_returns_strlen="$undef"
17684         ;;
17685     esac
17686 else
17687     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17688     d_sprintf_returns_strlen="$undef"
17689 fi
17690 $rm_try
17691
17692 : see if srand48_r exists
17693 set srand48_r d_srand48_r
17694 eval $inlibc
17695 case "$d_srand48_r" in
17696 "$define")
17697         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17698         case "$d_srand48_r_proto:$usethreads" in
17699         ":define")      d_srand48_r_proto=define
17700                 set d_srand48_r_proto srand48_r $hdrs
17701                 eval $hasproto ;;
17702         *)      ;;
17703         esac
17704         case "$d_srand48_r_proto" in
17705         define)
17706         case "$srand48_r_proto" in
17707         ''|0) try='int srand48_r(long, struct drand48_data*);'
17708         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17709         esac
17710         case "$srand48_r_proto" in
17711         ''|0)   d_srand48_r=undef
17712                 srand48_r_proto=0
17713                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17714         * )     case "$srand48_r_proto" in
17715                 REENTRANT_PROTO*) ;;
17716                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17717                 esac
17718                 echo "Prototype: $try" ;;
17719         esac
17720         ;;
17721         *)      case "$usethreads" in
17722                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17723                 esac
17724                 d_srand48_r=undef
17725                 srand48_r_proto=0
17726                 ;;
17727         esac
17728         ;;
17729 *)      srand48_r_proto=0
17730         ;;
17731 esac
17732
17733 : see if srandom_r exists
17734 set srandom_r d_srandom_r
17735 eval $inlibc
17736 case "$d_srandom_r" in
17737 "$define")
17738         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17739         case "$d_srandom_r_proto:$usethreads" in
17740         ":define")      d_srandom_r_proto=define
17741                 set d_srandom_r_proto srandom_r $hdrs
17742                 eval $hasproto ;;
17743         *)      ;;
17744         esac
17745         case "$d_srandom_r_proto" in
17746         define)
17747         case "$srandom_r_proto" in
17748         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17749         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17750         esac
17751         case "$srandom_r_proto" in
17752         ''|0)   d_srandom_r=undef
17753                 srandom_r_proto=0
17754                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17755         * )     case "$srandom_r_proto" in
17756                 REENTRANT_PROTO*) ;;
17757                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17758                 esac
17759                 echo "Prototype: $try" ;;
17760         esac
17761         ;;
17762         *)      case "$usethreads" in
17763                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17764                 esac
17765                 d_srandom_r=undef
17766                 srandom_r_proto=0
17767                 ;;
17768         esac
17769         ;;
17770 *)      srandom_r_proto=0
17771         ;;
17772 esac
17773
17774 : see if prototype for setresgid is available
17775 echo " "
17776 set d_sresgproto setresgid $i_unistd unistd.h
17777 eval $hasproto
17778
17779 : see if prototype for setresuid is available
17780 echo " "
17781 set d_sresuproto setresuid $i_unistd unistd.h
17782 eval $hasproto
17783
17784 : see if sys/stat.h is available
17785 set sys/stat.h i_sysstat
17786 eval $inhdr
17787
17788 : see if stat knows about block sizes
17789 echo " "
17790 echo "Checking to see if your struct stat has st_blocks field..." >&4
17791 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17792 eval $hasfield
17793
17794 : see if this is a sys/vfs.h system
17795 set sys/vfs.h i_sysvfs
17796 eval $inhdr
17797
17798 : see if this is a sys/statfs.h system
17799 set sys/statfs.h i_sysstatfs
17800 eval $inhdr
17801
17802 : Check for statfs_s
17803 echo " "
17804 echo "Checking to see if your system supports struct statfs..." >&4
17805 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
17806 eval $hasstruct
17807 case "$d_statfs_s" in
17808 "$define")      echo "Yes, it does."   ;;
17809 *)              echo "No, it doesn't." ;;
17810 esac
17811
17812
17813 : see if struct statfs knows about f_flags
17814 case "$d_statfs_s" in
17815 define)
17816         echo " "
17817         echo "Checking to see if your struct statfs has f_flags field..." >&4
17818         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
17819         eval $hasfield
17820         ;;
17821 *)      val="$undef"
17822         set d_statfs_f_flags
17823         eval $setvar
17824         ;;
17825 esac
17826 case "$d_statfs_f_flags" in
17827 "$define")      echo "Yes, it does."   ;;
17828 *)              echo "No, it doesn't." ;;
17829 esac
17830
17831 : Check stream access
17832 $cat >&4 <<EOM
17833 Checking how to access stdio streams by file descriptor number...
17834 EOM
17835 case "$stdio_stream_array" in
17836 '')     $cat >try.c <<EOCP
17837 #include <stdio.h>
17838 int main() {
17839   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17840     printf("yes\n");
17841 }
17842 EOCP
17843         for s in _iob __iob __sF
17844         do
17845                 set try -DSTDIO_STREAM_ARRAY=$s
17846                 if eval $compile; then
17847                         case "`$run ./try`" in
17848                         yes)    stdio_stream_array=$s; break ;;
17849                         esac
17850                 fi
17851         done
17852         $rm_try
17853 esac
17854 case "$stdio_stream_array" in
17855 '')     $cat >&4 <<EOM
17856 I can't figure out how to access stdio streams by file descriptor number.
17857 EOM
17858         d_stdio_stream_array="$undef"
17859         ;;
17860 *)      $cat >&4 <<EOM
17861 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17862 EOM
17863         d_stdio_stream_array="$define"
17864         ;;
17865 esac
17866
17867 : see if strcoll exists
17868 set strcoll d_strcoll
17869 eval $inlibc
17870
17871 : check for structure copying
17872 echo " "
17873 echo "Checking to see if your C compiler can copy structs..." >&4
17874 $cat >try.c <<'EOCP'
17875 int main()
17876 {
17877         struct blurfl {
17878                 int dyick;
17879         } foo, bar;
17880
17881         foo = bar;
17882 }
17883 EOCP
17884 if $cc -c try.c >/dev/null 2>&1 ; then
17885         val="$define"
17886         echo "Yup, it can."
17887 else
17888         val="$undef"
17889         echo "Nope, it can't."
17890 fi
17891 set d_strctcpy
17892 eval $setvar
17893 $rm_try
17894
17895 : see if strerror and/or sys_errlist[] exist
17896 echo " "
17897 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17898     if set strerror val -f d_strerror; eval $csym; $val; then
17899                 echo 'strerror() found.' >&4
17900                 d_strerror="$define"
17901                 d_strerrm='strerror(e)'
17902                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17903                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17904                         d_syserrlst="$define"
17905                 else
17906                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17907                         d_syserrlst="$undef"
17908                 fi
17909     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17910                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17911                 echo 'strerror() found in string header.' >&4
17912                 d_strerror="$define"
17913                 d_strerrm='strerror(e)'
17914                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17915                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17916                                 d_syserrlst="$define"
17917                 else
17918                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17919                         d_syserrlst="$undef"
17920                 fi
17921     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17922                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17923                 d_strerror="$undef"
17924                 d_syserrlst="$define"
17925                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17926     else
17927                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17928                 d_strerror="$undef"
17929                 d_syserrlst="$undef"
17930                 d_strerrm='"unknown"'
17931     fi
17932 fi
17933
17934 : see if strerror_r exists
17935 set strerror_r d_strerror_r
17936 eval $inlibc
17937 case "$d_strerror_r" in
17938 "$define")
17939         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17940         case "$d_strerror_r_proto:$usethreads" in
17941         ":define")      d_strerror_r_proto=define
17942                 set d_strerror_r_proto strerror_r $hdrs
17943                 eval $hasproto ;;
17944         *)      ;;
17945         esac
17946         case "$d_strerror_r_proto" in
17947         define)
17948         case "$strerror_r_proto" in
17949         ''|0) try='int strerror_r(int, char*, size_t);'
17950         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17951         esac
17952         case "$strerror_r_proto" in
17953         ''|0) try='int strerror_r(int, char*, int);'
17954         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17955         esac
17956         case "$strerror_r_proto" in
17957         ''|0) try='char* strerror_r(int, char*, size_t);'
17958         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17959         esac
17960         case "$strerror_r_proto" in
17961         ''|0)   d_strerror_r=undef
17962                 strerror_r_proto=0
17963                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17964         * )     case "$strerror_r_proto" in
17965                 REENTRANT_PROTO*) ;;
17966                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17967                 esac
17968                 echo "Prototype: $try" ;;
17969         esac
17970         ;;
17971         *)      case "$usethreads" in
17972                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17973                 esac
17974                 d_strerror_r=undef
17975                 strerror_r_proto=0
17976                 ;;
17977         esac
17978         ;;
17979 *)      strerror_r_proto=0
17980         ;;
17981 esac
17982
17983 : see if strftime exists
17984 set strftime d_strftime
17985 eval $inlibc
17986
17987 : see if strlcat exists
17988 set strlcat d_strlcat
17989 eval $inlibc
17990
17991 : see if strlcpy exists
17992 set strlcpy d_strlcpy
17993 eval $inlibc
17994
17995 : see if strtod exists
17996 set strtod d_strtod
17997 eval $inlibc
17998
17999 : see if strtol exists
18000 set strtol d_strtol
18001 eval $inlibc
18002
18003 : see if strtold exists
18004 set strtold d_strtold
18005 eval $inlibc
18006
18007 : see if strtoll exists
18008 set strtoll d_strtoll
18009 eval $inlibc
18010
18011 case "$d_longlong-$d_strtoll" in
18012 "$define-$define")
18013         $cat <<EOM
18014 Checking whether your strtoll() works okay...
18015 EOM
18016         $cat >try.c <<'EOCP'
18017 #include <errno.h>
18018 #ifdef __hpux
18019 #define strtoll __strtoll
18020 #endif
18021 #ifdef __EMX__
18022 #define strtoll _strtoll
18023 #endif
18024 #include <stdio.h>
18025 extern long long int strtoll(char *s, char **, int);
18026 static int bad = 0;
18027 int check(char *s, long long ell, int een) {
18028         long long gll;
18029         errno = 0;
18030         gll = strtoll(s, 0, 10);
18031         if (!((gll == ell) && (errno == een)))
18032                 bad++;
18033 }
18034 int main() {
18035         check(" 1",                                      1LL, 0);
18036         check(" 0",                                      0LL, 0);
18037         check("-1",                                     -1LL, 0);
18038         check("-9223372036854775808", -9223372036854775808LL, 0);
18039         check("-9223372036854775808", -9223372036854775808LL, 0);
18040         check(" 9223372036854775807",  9223372036854775807LL, 0);
18041         check("-9223372036854775808", -9223372036854775808LL, 0);
18042         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18043         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18044         if (!bad)
18045                 printf("ok\n");
18046 }
18047 EOCP
18048         set try
18049         if eval $compile; then
18050                 yyy=`$run ./try`
18051                 case "$yyy" in
18052                 ok) echo "Your strtoll() seems to be working okay." ;;
18053                 *) cat <<EOM >&4
18054 Your strtoll() doesn't seem to be working okay.
18055 EOM
18056                    d_strtoll="$undef"
18057                    ;;
18058                 esac
18059         else
18060                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18061                 d_strtoll="$undef"
18062         fi
18063         ;;
18064 esac
18065
18066 : see if strtoq exists
18067 set strtoq d_strtoq
18068 eval $inlibc
18069
18070 : see if strtoul exists
18071 set strtoul d_strtoul
18072 eval $inlibc
18073
18074 case "$d_strtoul" in
18075 "$define")
18076         $cat <<EOM
18077 Checking whether your strtoul() works okay...
18078 EOM
18079         $cat >try.c <<'EOCP'
18080 #include <errno.h>
18081 #include <stdio.h>
18082 extern unsigned long int strtoul(char *s, char **, int);
18083 static int bad = 0;
18084 void check(char *s, unsigned long eul, int een) {
18085         unsigned long gul;
18086         errno = 0;
18087         gul = strtoul(s, 0, 10);
18088         if (!((gul == eul) && (errno == een)))
18089                 bad++;
18090 }
18091 int main() {
18092         check(" 1", 1L, 0);
18093         check(" 0", 0L, 0);
18094 EOCP
18095         case "$longsize" in
18096         8)
18097             $cat >>try.c <<'EOCP'
18098         check("18446744073709551615", 18446744073709551615UL, 0);
18099         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18100 #if 0 /* strtoul() for /^-/ strings is undefined. */
18101         check("-1", 18446744073709551615UL, 0);
18102         check("-18446744073709551614", 2, 0);
18103         check("-18446744073709551615", 1, 0);
18104         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18105         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18106 #endif
18107 EOCP
18108                 ;;
18109         4)
18110                     $cat >>try.c <<'EOCP'
18111         check("4294967295", 4294967295UL, 0);
18112         check("4294967296", 4294967295UL, ERANGE);
18113 #if 0 /* strtoul() for /^-/ strings is undefined. */
18114         check("-1", 4294967295UL, 0);
18115         check("-4294967294", 2, 0);
18116         check("-4294967295", 1, 0);
18117         check("-4294967296", 4294967295UL, ERANGE);
18118         check("-4294967297", 4294967295UL, ERANGE);
18119 #endif
18120 EOCP
18121                 ;;
18122         *)
18123 : Should we write these tests to be more portable by sprintf-ing
18124 : ~0 and then manipulating that char string as input for strtol?
18125                 ;;
18126         esac
18127         $cat >>try.c <<'EOCP'
18128         if (!bad)
18129                 printf("ok\n");
18130         return 0;
18131 }
18132 EOCP
18133         set try
18134         if eval $compile; then
18135                 case "`$run ./try`" in
18136                 ok) echo "Your strtoul() seems to be working okay." ;;
18137                 *) cat <<EOM >&4
18138 Your strtoul() doesn't seem to be working okay.
18139 EOM
18140                    d_strtoul="$undef"
18141                    ;;
18142                 esac
18143         else
18144                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18145                 d_strtoul="$undef"
18146         fi
18147         ;;
18148 esac
18149
18150 : see if strtoull exists
18151 set strtoull d_strtoull
18152 eval $inlibc
18153
18154 case "$d_longlong-$d_strtoull" in
18155 "$define-$define")
18156         $cat <<EOM
18157 Checking whether your strtoull() works okay...
18158 EOM
18159         $cat >try.c <<'EOCP'
18160 #include <errno.h>
18161 #ifdef __hpux
18162 #define strtoull __strtoull
18163 #endif
18164 #include <stdio.h>
18165 extern unsigned long long int strtoull(char *s, char **, int);
18166 static int bad = 0;
18167 int check(char *s, long long eull, int een) {
18168         long long gull;
18169         errno = 0;
18170         gull = strtoull(s, 0, 10);
18171         if (!((gull == eull) && (errno == een)))
18172                 bad++;
18173 }
18174 int main() {
18175         check(" 1",                                        1LL, 0);
18176         check(" 0",                                        0LL, 0);
18177         check("18446744073709551615",  18446744073709551615ULL, 0);
18178         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18179 #if 0 /* strtoull() for /^-/ strings is undefined. */
18180         check("-1",                    18446744073709551615ULL, 0);
18181         check("-18446744073709551614",                     2LL, 0);
18182         check("-18446744073709551615",                     1LL, 0);
18183         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18184         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18185 #endif
18186         if (!bad)
18187                 printf("ok\n");
18188 }
18189 EOCP
18190         set try
18191         if eval $compile; then
18192                 case "`$run ./try`" in
18193                 ok) echo "Your strtoull() seems to be working okay." ;;
18194                 *) cat <<EOM >&4
18195 Your strtoull() doesn't seem to be working okay.
18196 EOM
18197                    d_strtoull="$undef"
18198                    ;;
18199                 esac
18200         else
18201                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18202                 d_strtoull="$undef"
18203         fi
18204         ;;
18205 esac
18206
18207 : see if strtouq exists
18208 set strtouq d_strtouq
18209 eval $inlibc
18210
18211 case "$d_strtouq" in
18212 "$define")
18213         $cat <<EOM
18214 Checking whether your strtouq() works okay...
18215 EOM
18216         $cat >try.c <<'EOCP'
18217 #include <errno.h>
18218 #include <stdio.h>
18219 extern unsigned long long int strtouq(char *s, char **, int);
18220 static int bad = 0;
18221 void check(char *s, unsigned long long eull, int een) {
18222         unsigned long long gull;
18223         errno = 0;
18224         gull = strtouq(s, 0, 10);
18225         if (!((gull == eull) && (errno == een)))
18226                 bad++;
18227 }
18228 int main() {
18229         check(" 1",                                        1LL, 0);
18230         check(" 0",                                        0LL, 0);
18231         check("18446744073709551615",  18446744073709551615ULL, 0);
18232         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18233 #if 0 /* strtouq() for /^-/ strings is undefined. */
18234         check("-1",                    18446744073709551615ULL, 0);
18235         check("-18446744073709551614",                     2LL, 0);
18236         check("-18446744073709551615",                     1LL, 0);
18237         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18238         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18239 #endif
18240         if (!bad)
18241                 printf("ok\n");
18242         return 0;
18243 }
18244 EOCP
18245         set try
18246         if eval $compile; then
18247                 case "`$run ./try`" in
18248                 ok) echo "Your strtouq() seems to be working okay." ;;
18249                 *) cat <<EOM >&4
18250 Your strtouq() doesn't seem to be working okay.
18251 EOM
18252                    d_strtouq="$undef"
18253                    ;;
18254                 esac
18255         else
18256                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18257                 d_strtouq="$undef"
18258         fi
18259         ;;
18260 esac
18261
18262 : see if strxfrm exists
18263 set strxfrm d_strxfrm
18264 eval $inlibc
18265
18266 : see if symlink exists
18267 set symlink d_symlink
18268 eval $inlibc
18269
18270 : see if syscall exists
18271 set syscall d_syscall
18272 eval $inlibc
18273
18274 : see if prototype for syscall is available
18275 echo " "
18276 set d_syscallproto syscall $i_unistd unistd.h
18277 eval $hasproto
18278
18279 : see if sysconf exists
18280 set sysconf d_sysconf
18281 eval $inlibc
18282
18283 : see if system exists
18284 set system d_system
18285 eval $inlibc
18286
18287 : see if tcgetpgrp exists
18288 set tcgetpgrp d_tcgetpgrp
18289 eval $inlibc
18290
18291 : see if tcsetpgrp exists
18292 set tcsetpgrp d_tcsetpgrp
18293 eval $inlibc
18294
18295 : see if prototype for telldir is available
18296 echo " "
18297 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18298 eval $hasproto
18299
18300 : see if time exists
18301 echo " "
18302 if test "X$d_time" = X -o X"$timetype" = X; then
18303     if set time val -f d_time; eval $csym; $val; then
18304                 echo 'time() found.' >&4
18305                 val="$define"
18306                 rp="What is the type returned by time() on this system?"
18307                 set time_t timetype long stdio.h sys/types.h
18308                 eval $typedef_ask
18309     else
18310                 echo 'time() not found, hope that will do.' >&4
18311                 val="$undef"
18312                 timetype='int';
18313     fi
18314     set d_time
18315     eval $setvar
18316 fi
18317
18318 : see if timegm exists
18319 set timegm d_timegm
18320 eval $inlibc
18321
18322 : see if this is a sys/times.h system
18323 set sys/times.h i_systimes
18324 eval $inhdr
18325
18326 : see if times exists
18327 echo " "
18328 if set times val -f d_times; eval $csym; $val; then
18329         echo 'times() found.' >&4
18330         d_times="$define"
18331         inc=''
18332         case "$i_systimes" in
18333         "$define") inc='sys/times.h';;
18334         esac
18335         rp="What is the type returned by times() on this system?"
18336         set clock_t clocktype long stdio.h sys/types.h $inc
18337         eval $typedef_ask
18338 else
18339         echo 'times() NOT found, hope that will do.' >&4
18340         d_times="$undef"
18341         clocktype='int'
18342 fi
18343
18344 : see if tmpnam_r exists
18345 set tmpnam_r d_tmpnam_r
18346 eval $inlibc
18347 case "$d_tmpnam_r" in
18348 "$define")
18349         hdrs="$i_systypes sys/types.h define stdio.h "
18350         case "$d_tmpnam_r_proto:$usethreads" in
18351         ":define")      d_tmpnam_r_proto=define
18352                 set d_tmpnam_r_proto tmpnam_r $hdrs
18353                 eval $hasproto ;;
18354         *)      ;;
18355         esac
18356         case "$d_tmpnam_r_proto" in
18357         define)
18358         case "$tmpnam_r_proto" in
18359         ''|0) try='char* tmpnam_r(char*);'
18360         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18361         esac
18362         case "$tmpnam_r_proto" in
18363         ''|0)   d_tmpnam_r=undef
18364                 tmpnam_r_proto=0
18365                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18366         * )     case "$tmpnam_r_proto" in
18367                 REENTRANT_PROTO*) ;;
18368                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18369                 esac
18370                 echo "Prototype: $try" ;;
18371         esac
18372         ;;
18373         *)      case "$usethreads" in
18374                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18375                 esac
18376                 d_tmpnam_r=undef
18377                 tmpnam_r_proto=0
18378                 ;;
18379         esac
18380         ;;
18381 *)      tmpnam_r_proto=0
18382         ;;
18383 esac
18384
18385 : see if truncate exists
18386 set truncate d_truncate
18387 eval $inlibc
18388
18389 : see if ttyname_r exists
18390 set ttyname_r d_ttyname_r
18391 eval $inlibc
18392 case "$d_ttyname_r" in
18393 "$define")
18394         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18395         case "$d_ttyname_r_proto:$usethreads" in
18396         ":define")      d_ttyname_r_proto=define
18397                 set d_ttyname_r_proto ttyname_r $hdrs
18398                 eval $hasproto ;;
18399         *)      ;;
18400         esac
18401         case "$d_ttyname_r_proto" in
18402         define)
18403         case "$ttyname_r_proto" in
18404         ''|0) try='int ttyname_r(int, char*, size_t);'
18405         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18406         esac
18407         case "$ttyname_r_proto" in
18408         ''|0) try='int ttyname_r(int, char*, int);'
18409         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18410         esac
18411         case "$ttyname_r_proto" in
18412         ''|0) try='char* ttyname_r(int, char*, int);'
18413         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18414         esac
18415         case "$ttyname_r_proto" in
18416         ''|0)   d_ttyname_r=undef
18417                 ttyname_r_proto=0
18418                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18419         * )     case "$ttyname_r_proto" in
18420                 REENTRANT_PROTO*) ;;
18421                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18422                 esac
18423                 echo "Prototype: $try" ;;
18424         esac
18425         ;;
18426         *)      case "$usethreads" in
18427                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18428                 esac
18429                 d_ttyname_r=undef
18430                 ttyname_r_proto=0
18431                 ;;
18432         esac
18433         ;;
18434 *)      ttyname_r_proto=0
18435         ;;
18436 esac
18437
18438 : see if tzname[] exists
18439 echo " "
18440 if set tzname val -a d_tzname; eval $csym; $val; then
18441         val="$define"
18442         echo 'tzname[] found.' >&4
18443 else
18444         val="$undef"
18445         echo 'tzname[] NOT found.' >&4
18446 fi
18447 set d_tzname
18448 eval $setvar
18449
18450 : Check if is a multiplatform env
18451 case "$osname" in
18452 next|rhapsody|darwin) multiarch="$define" ;;
18453 esac
18454 case "$multiarch" in
18455 ''|[nN]*) multiarch="$undef" ;;
18456 esac
18457
18458 : check for ordering of bytes in a UV
18459 echo " "
18460 case "$usecrosscompile$multiarch" in
18461 *$define*)
18462         $cat <<EOM
18463 You seem to be either cross-compiling or doing a multiarchitecture build,
18464 skipping the byteorder check.
18465
18466 EOM
18467         byteorder='ffff'
18468         ;;
18469 *)
18470         case "$byteorder" in
18471         '')
18472                 $cat <<'EOM'
18473 In the following, larger digits indicate more significance.  A big-endian
18474 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18475 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18476 machines may have weird orders like 3412.  A Cray will report 87654321,
18477 an Alpha will report 12345678. If the test program works the default is
18478 probably right.
18479 I'm now running the test program...
18480 EOM
18481                 $cat >try.c <<EOCP
18482 #include <stdio.h>
18483 #$i_stdlib I_STDLIB
18484 #ifdef I_STDLIB
18485 #include <stdlib.h>
18486 #endif
18487 #include <sys/types.h>
18488 typedef $uvtype UV;
18489 int main()
18490 {
18491         int i;
18492         union {
18493                 UV l;
18494                 char c[$uvsize];
18495         } u;
18496
18497         if ($uvsize > 4)
18498                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18499         else
18500                 u.l = (UV)0x04030201;
18501         for (i = 0; i < $uvsize; i++)
18502                 printf("%c", u.c[i]+'0');
18503         printf("\n");
18504         exit(0);
18505 }
18506 EOCP
18507                 xxx_prompt=y
18508                 set try
18509                 if eval $compile && $run ./try > /dev/null; then
18510                         dflt=`$run ./try`
18511                         case "$dflt" in
18512                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18513                                 echo "(The test program ran ok.)"
18514                                 echo "byteorder=$dflt"
18515                                 xxx_prompt=n
18516                         ;;
18517                         ????|????????) echo "(The test program ran ok.)" ;;
18518                         *) echo "(The test program didn't run right for some reason.)" ;;
18519                         esac
18520                 else
18521                         dflt='4321'
18522                         cat <<'EOM'
18523 (I can't seem to compile the test program.  Guessing big-endian...)
18524 EOM
18525                 fi
18526                 case "$xxx_prompt" in
18527                 y)
18528                         rp="What is the order of bytes in $uvtype?"
18529                         . ./myread
18530                         byteorder="$ans"
18531                         ;;
18532                 *)      byteorder=$dflt
18533                         ;;
18534                 esac
18535                 ;;
18536         esac
18537         $rm_try
18538         ;;
18539 esac
18540
18541 : Checking 32bit aligndness
18542 $cat <<EOM
18543
18544 Checking to see whether you can access character data unalignedly...
18545 EOM
18546 case "$d_u32align" in
18547 '')   $cat >try.c <<EOCP
18548 #include <stdio.h>
18549 #$i_stdlib I_STDLIB
18550 #ifdef I_STDLIB
18551 #include <stdlib.h>
18552 #endif
18553 #define U32 $u32type
18554 #define BYTEORDER 0x$byteorder
18555 #define U8 $u8type
18556 #include <signal.h>
18557 #ifdef SIGBUS
18558 $signal_t bletch(int s) { exit(4); }
18559 #endif
18560 int main() {
18561 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18562     U8 buf[8];
18563     U32 *up;
18564     int i;
18565
18566     if (sizeof(U32) != 4) {
18567         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18568         exit(1);
18569     }
18570
18571     fflush(stdout);
18572
18573 #ifdef SIGBUS
18574     signal(SIGBUS, bletch);
18575 #endif
18576
18577     buf[0] = 0;
18578     buf[1] = 0;
18579     buf[2] = 0;
18580     buf[3] = 1;
18581     buf[4] = 0;
18582     buf[5] = 0;
18583     buf[6] = 0;
18584     buf[7] = 1;
18585
18586     for (i = 0; i < 4; i++) {
18587         up = (U32*)(buf + i);
18588         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18589                (*up == 1 << (8*(3-i)))  /* little-endian */
18590               )
18591            )
18592         {
18593             printf("read failed (%x)\n", *up);
18594             exit(2);
18595         }
18596     }
18597
18598     /* write test */
18599     for (i = 0; i < 4; i++) {
18600         up = (U32*)(buf + i);
18601         *up = 0xBeef;
18602         if (*up != 0xBeef) {
18603             printf("write failed (%x)\n", *up);
18604             exit(3);
18605         }
18606     }
18607
18608     exit(0);
18609 #else
18610     printf("1\n");
18611     exit(1);
18612 #endif
18613     return 0;
18614 }
18615 EOCP
18616 set try
18617 if eval $compile_ok; then
18618         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18619         $run ./try 2>&1 >/dev/null
18620         case "$?" in
18621         0)      cat >&4 <<EOM
18622 You can access character data pretty unalignedly.
18623 EOM
18624                 d_u32align="$undef"
18625                 ;;
18626         *)      cat >&4 <<EOM
18627 It seems that you must access character data in an aligned manner.
18628 EOM
18629                 d_u32align="$define"
18630                 ;;
18631         esac
18632 else
18633         rp='Can you access character data at unaligned addresses?'
18634         dflt='n'
18635         . ./myread
18636         case "$ans" in
18637         [yY]*)  d_u32align="$undef"  ;;
18638         *)      d_u32align="$define" ;;
18639         esac
18640 fi
18641 $rm_try
18642 ;;
18643 esac
18644
18645 : see if ualarm exists
18646 set ualarm d_ualarm
18647 eval $inlibc
18648
18649 : see if umask exists
18650 set umask d_umask
18651 eval $inlibc
18652
18653 : see if unordered exists
18654 set unordered d_unordered
18655 eval $inlibc
18656
18657 : see if unsetenv exists
18658 set unsetenv d_unsetenv
18659 eval $inlibc
18660
18661 : see if usleep exists
18662 set usleep d_usleep
18663 eval $inlibc
18664
18665 : see if prototype for usleep is available
18666 echo " "
18667 set d_usleepproto usleep $i_unistd unistd.h
18668 eval $hasproto
18669
18670 : see if ustat exists
18671 set ustat d_ustat
18672 eval $inlibc
18673
18674 : see if closedir exists
18675 set closedir d_closedir
18676 eval $inlibc
18677
18678 case "$d_closedir" in
18679 "$define")
18680         echo " "
18681         echo "Checking whether closedir() returns a status..." >&4
18682         cat > try.c <<EOM
18683 #$i_dirent I_DIRENT             /**/
18684 #$i_sysdir I_SYS_DIR            /**/
18685 #$i_sysndir I_SYS_NDIR          /**/
18686 #$i_systypes I_SYS_TYPES        /**/
18687
18688 #if defined(I_SYS_TYPES)
18689 #include <sys/types.h>
18690 #endif
18691 #if defined(I_DIRENT)
18692 #include <dirent.h>
18693 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18694 #include <sys/dir.h>
18695 #endif
18696 #else
18697 #ifdef I_SYS_NDIR
18698 #include <sys/ndir.h>
18699 #else
18700 #ifdef I_SYS_DIR
18701 #ifdef hp9000s500
18702 #include <ndir.h>       /* may be wrong in the future */
18703 #else
18704 #include <sys/dir.h>
18705 #endif
18706 #endif
18707 #endif
18708 #endif
18709 int main() { return closedir(opendir(".")); }
18710 EOM
18711         set try
18712         if eval $compile_ok; then
18713                 if $run ./try > /dev/null 2>&1 ; then
18714                         echo "Yes, it does."
18715                         val="$undef"
18716                 else
18717                         echo "No, it doesn't."
18718                         val="$define"
18719                 fi
18720         else
18721                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18722                 val="$define"
18723         fi
18724         ;;
18725 *)
18726         val="$undef";
18727         ;;
18728 esac
18729 set d_void_closedir
18730 eval $setvar
18731 $rm_try
18732
18733 : see if there is a wait4
18734 set wait4 d_wait4
18735 eval $inlibc
18736
18737 : see if waitpid exists
18738 set waitpid d_waitpid
18739 eval $inlibc
18740
18741 : see if wcstombs exists
18742 set wcstombs d_wcstombs
18743 eval $inlibc
18744
18745 : see if wctomb exists
18746 set wctomb d_wctomb
18747 eval $inlibc
18748
18749 : see if writev exists
18750 set writev d_writev
18751 eval $inlibc
18752
18753 : preserve RCS keywords in files with variable substitution, grrr
18754 Date='$Date'
18755 Id='$Id'
18756 Log='$Log'
18757 RCSfile='$RCSfile'
18758 Revision='$Revision'
18759
18760 : check for alignment requirements
18761 echo " "
18762 case "$usecrosscompile$multiarch" in
18763 *$define*)
18764         $cat <<EOM
18765 You seem to be either cross-compiling or doing a multiarchitecture build,
18766 skipping the memory alignment check.
18767
18768 EOM
18769         case "$alignbytes" in
18770         '') alignbytes=8 ;;
18771         esac
18772         ;;
18773 *)
18774         case "$alignbytes" in
18775         '') echo "Checking alignment constraints..." >&4
18776                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18777                         $cat >try.c <<'EOCP'
18778 typedef long double NV;
18779 EOCP
18780                 else
18781                         $cat >try.c <<'EOCP'
18782 typedef double NV;
18783 EOCP
18784                 fi
18785                 $cat >>try.c <<'EOCP'
18786 #include <stdio.h>
18787 struct foobar {
18788         char foo;
18789         NV bar;
18790 } try_algn;
18791 int main()
18792 {
18793     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18794     return(0);
18795 }
18796 EOCP
18797                 set try
18798                 if eval $compile_ok; then
18799                         dflt=`$run ./try`
18800                 else
18801                         dflt='8'
18802                         echo "(I can't seem to compile the test program...)"
18803                 fi
18804                 ;;
18805         *) dflt="$alignbytes"
18806                 ;;
18807         esac
18808         rp="Doubles must be aligned on a how-many-byte boundary?"
18809         . ./myread
18810         alignbytes="$ans"
18811         $rm_try
18812         ;;
18813 esac
18814
18815
18816 : set the base revision
18817 baserev=5.0
18818
18819 : how do we concatenate cpp tokens here?
18820 echo " "
18821 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18822 $cat >cpp_stuff.c <<'EOCP'
18823 #define RCAT(a,b)a/**/b
18824 #define ACAT(a,b)a ## b
18825 RCAT(Rei,ser)
18826 ACAT(Cir,cus)
18827 EOCP
18828 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18829 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18830         echo "Oh!  Smells like ANSI's been here." >&4
18831         echo "We can catify or stringify, separately or together!"
18832         cpp_stuff=42
18833 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18834         echo "Ah, yes!  The good old days!" >&4
18835         echo "However, in the good old days we don't know how to stringify and"
18836         echo "catify at the same time."
18837         cpp_stuff=1
18838 else
18839         $cat >&4 <<EOM
18840 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18841 You're going to have to edit the values of CAT[2-5] in config.h...
18842 EOM
18843         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18844 fi
18845 $rm -f cpp_stuff.*
18846
18847 : see if this is a db.h system
18848 set db.h i_db
18849 eval $inhdr
18850
18851 case "$i_db" in
18852 $define)
18853         : Check db version.
18854         echo " "
18855         echo "Checking Berkeley DB version ..." >&4
18856         $cat >try.c <<EOCP
18857 #$d_const HASCONST
18858 #ifndef HASCONST
18859 #define const
18860 #endif
18861 #include <sys/types.h>
18862 #include <stdio.h>
18863 #$i_stdlib I_STDLIB
18864 #ifdef I_STDLIB
18865 #include <stdlib.h>
18866 #endif
18867 #include <db.h>
18868 int main(int argc, char *argv[])
18869 {
18870 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18871     int Major, Minor, Patch ;
18872     unsigned long Version ;
18873     (void)db_version(&Major, &Minor, &Patch) ;
18874     if (argc == 2) {
18875         printf("%d %d %d %d %d %d\n",
18876                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18877                Major, Minor, Patch);
18878         exit(0);
18879     }
18880     printf("You have Berkeley DB Version 2 or greater.\n");
18881
18882     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18883                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18884     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18885                 Major, Minor, Patch) ;
18886
18887     /* check that db.h & libdb are compatible */
18888     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18889         printf("db.h and libdb are incompatible.\n") ;
18890         exit(3);
18891     }
18892
18893     printf("db.h and libdb are compatible.\n") ;
18894
18895     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18896                 + DB_VERSION_PATCH ;
18897
18898     /* needs to be >= 2.3.4 */
18899     if (Version < 2003004) {
18900     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18901         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18902         exit(2);
18903     }
18904
18905     exit(0);
18906 #else
18907 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18908     if (argc == 2) {
18909         printf("1 0 0\n");
18910         exit(0);
18911     }
18912     printf("You have Berkeley DB Version 1.\n");
18913     exit(0);    /* DB version < 2: the coast is clear. */
18914 #else
18915     exit(1);    /* <db.h> not Berkeley DB? */
18916 #endif
18917 #endif
18918 }
18919 EOCP
18920         set try
18921         if eval $compile_ok && $run ./try; then
18922                 echo 'Looks OK.' >&4
18923                 set `$run ./try 1`
18924                 db_version_major=$1
18925                 db_version_minor=$2
18926                 db_version_patch=$3
18927         else
18928                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18929                 i_db=$undef
18930                 case " $libs " in
18931                 *"-ldb "*)
18932                         : Remove db from list of libraries to use
18933                         echo "Removing unusable -ldb from library list" >&4
18934                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18935                         shift
18936                         libs="$*"
18937                         echo "libs = $libs" >&4
18938                         ;;
18939                 esac
18940         fi
18941         $rm_try
18942         ;;
18943 esac
18944
18945 case "$i_db" in
18946 define)
18947         : Check the return type needed for hash
18948         echo " "
18949         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18950         $cat >try.c <<EOCP
18951 #$d_const HASCONST
18952 #ifndef HASCONST
18953 #define const
18954 #endif
18955 #include <sys/types.h>
18956 #include <db.h>
18957
18958 #ifndef DB_VERSION_MAJOR
18959 u_int32_t hash_cb (ptr, size)
18960 const void *ptr;
18961 size_t size;
18962 {
18963 }
18964 HASHINFO info;
18965 int main()
18966 {
18967         info.hash = hash_cb;
18968 }
18969 #endif
18970 EOCP
18971         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18972                 if $contains warning try.out >>/dev/null 2>&1 ; then
18973                         db_hashtype='int'
18974                 else
18975                         db_hashtype='u_int32_t'
18976                 fi
18977         else
18978                 : XXX Maybe we should just give up here.
18979                 db_hashtype=u_int32_t
18980                 $cat try.out >&4
18981                 echo "Help:  I can't seem to compile the db test program." >&4
18982                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18983         fi
18984         $rm_try
18985         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18986         ;;
18987 *)      db_hashtype=u_int32_t
18988         ;;
18989 esac
18990 case "$i_db" in
18991 define)
18992         : Check the return type needed for prefix
18993         echo " "
18994         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18995         cat >try.c <<EOCP
18996 #$d_const HASCONST
18997 #ifndef HASCONST
18998 #define const
18999 #endif
19000 #include <sys/types.h>
19001 #include <db.h>
19002
19003 #ifndef DB_VERSION_MAJOR
19004 size_t prefix_cb (key1, key2)
19005 const DBT *key1;
19006 const DBT *key2;
19007 {
19008 }
19009 BTREEINFO info;
19010 int main()
19011 {
19012         info.prefix = prefix_cb;
19013 }
19014 #endif
19015 EOCP
19016         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19017                 if $contains warning try.out >>/dev/null 2>&1 ; then
19018                         db_prefixtype='int'
19019                 else
19020                         db_prefixtype='size_t'
19021                 fi
19022         else
19023                 db_prefixtype='size_t'
19024                 : XXX Maybe we should just give up here.
19025                 $cat try.out >&4
19026                 echo "Help:  I can't seem to compile the db test program." >&4
19027                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19028         fi
19029         $rm_try
19030         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19031         ;;
19032 *)      db_prefixtype='size_t'
19033         ;;
19034 esac
19035
19036 : How can we generate normalized random numbers ?
19037 echo " "
19038 echo "Looking for a random number function..." >&4
19039 case "$randfunc" in
19040 '')
19041         if set drand48 val -f; eval $csym; $val; then
19042                 dflt="drand48"
19043                 echo "Good, found drand48()." >&4
19044         elif set random val -f; eval $csym; $val; then
19045                 dflt="random"
19046                 echo "OK, found random()." >&4
19047         else
19048                 dflt="rand"
19049                 echo "Yick, looks like I have to use rand()." >&4
19050         fi
19051         echo " "
19052         ;;
19053 *)
19054         dflt="$randfunc"
19055         ;;
19056 esac
19057 cont=true
19058
19059 case "$ccflags" in
19060 *-Dmy_rand=*|*-Dmy_srand=*)
19061         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19062         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19063         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19064         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19065         ;;
19066 esac
19067
19068 while $test "$cont"; do
19069         rp="Use which function to generate random numbers?"
19070         . ./myread
19071         if $test "$ans" = "$dflt"; then
19072                 : null
19073         else
19074                 randbits=''
19075         fi
19076         randfunc="$ans"
19077         if set $ans val -f; eval $csym; $val; then
19078                 cont=''
19079         else
19080                 dflt=y
19081                 rp="I cannot find function $ans. Use that name anyway?"
19082                 . ./myread
19083                 dflt=rand
19084                 case "$ans" in
19085                         [yY]*) cont='';;
19086                 esac
19087         fi
19088         case "$cont" in
19089         '')
19090                 case "$randfunc" in
19091                 drand48)
19092                         drand01="drand48()"
19093                         seedfunc="srand48"
19094                         randbits=48
19095                         randseedtype=long
19096                         ;;
19097                 rand|random)
19098                         case "$randbits" in
19099                         '')
19100 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19101                                 $cat >try.c <<EOCP
19102 #$i_unistd I_UNISTD
19103 #$i_stdlib I_STDLIB
19104 #include <stdio.h>
19105 #ifdef I_UNISTD
19106 #  include <unistd.h>
19107 #endif
19108 #ifdef I_STDLIB
19109 #  include <stdlib.h>
19110 #endif
19111 int main()
19112 {
19113         register int i;
19114         register unsigned long tmp;
19115         register unsigned long max = 0L;
19116
19117         for (i = 1000; i; i--) {
19118                 tmp = (unsigned long) $randfunc();
19119                 if (tmp > max) max = tmp;
19120         }
19121         for (i = 0; max; i++)
19122                 max /= 2;
19123         printf("%d\n",i);
19124 }
19125 EOCP
19126                                 set try
19127                                 if eval $compile_ok; then
19128                                         dflt=`try`
19129                                 else
19130                                         dflt='?'
19131                                         echo "(I can't seem to compile the test program...)"
19132                                 fi
19133                                 ;;
19134                         *)
19135                                 dflt="$randbits"
19136                                 ;;
19137                         esac
19138                         rp="How many bits does your $randfunc() function produce?"
19139                         . ./myread
19140                         randbits="$ans"
19141                         $rm_try
19142                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19143                         seedfunc="s$randfunc"
19144                         randseedtype=unsigned
19145                         ;;
19146                 *)
19147                         dflt="31"
19148                         rp="How many bits does your $randfunc() function produce?"
19149                         . ./myread
19150                         randbits="$ans"
19151                         seedfunc="s$randfunc"
19152                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19153                         if set $seedfunc val -f; eval $csym; $val; then
19154                                 echo "(Using $seedfunc() to seed random generator)"
19155                         else
19156                                 echo "(Warning: no $seedfunc() to seed random generator)"
19157                                 seedfunc=rand
19158                         fi
19159                         randseedtype=unsigned
19160                         ;;
19161                 esac
19162                 ;;
19163         esac
19164 done
19165
19166 : Determine if this is an EBCDIC system
19167 echo " "
19168 echo "Determining whether or not we are on an EBCDIC system..." >&4
19169 $cat >try.c <<'EOM'
19170 int main()
19171 {
19172   if ('M'==0xd4) return 0;
19173   return 1;
19174 }
19175 EOM
19176
19177 val=$undef
19178 set try
19179 if eval $compile_ok; then
19180         if $run ./try; then
19181                 echo "You seem to speak EBCDIC." >&4
19182                 val="$define"
19183         else
19184                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19185         fi
19186 else
19187         echo "I'm unable to compile the test program." >&4
19188         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19189 fi
19190 $rm_try
19191 set ebcdic
19192 eval $setvar
19193
19194 : Check how to flush
19195 echo " "
19196 $cat >&4 <<EOM
19197 Checking how to flush all pending stdio output...
19198 EOM
19199 # I only know how to find the first 32 possibly open files on SunOS.
19200 # See also hints/sunos_4_1.sh and util.c  --AD
19201 case "$osname" in
19202 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19203 esac
19204 $cat >>try.c <<EOCP
19205 #include <stdio.h>
19206 #$i_stdlib I_STDLIB
19207 #ifdef I_STDLIB
19208 #include <stdlib.h>
19209 #endif
19210 #$i_unistd I_UNISTD
19211 #ifdef I_UNISTD
19212 # include <unistd.h>
19213 #endif
19214 #$d_sysconf HAS_SYSCONF
19215 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19216 #ifdef HAS_STDIO_STREAM_ARRAY
19217 # define STDIO_STREAM_ARRAY $stdio_stream_array
19218 #endif
19219 int main() {
19220   FILE* p;
19221   unlink("try.out");
19222   p = fopen("try.out", "w");
19223 #ifdef TRY_FPUTC
19224   fputc('x', p);
19225 #else
19226 # ifdef TRY_FPRINTF
19227   fprintf(p, "x");
19228 # endif
19229 #endif
19230 #ifdef TRY_FFLUSH_NULL
19231   fflush(NULL);
19232 #endif
19233 #ifdef TRY_FFLUSH_ALL
19234   {
19235     long open_max = -1;
19236 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19237     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19238 # else
19239 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19240     open_max = sysconf(_SC_OPEN_MAX);
19241 #  else
19242 #   ifdef FOPEN_MAX
19243     open_max = FOPEN_MAX;
19244 #   else
19245 #    ifdef OPEN_MAX
19246     open_max = OPEN_MAX;
19247 #    else
19248 #     ifdef _NFILE
19249     open_max = _NFILE;
19250 #     endif
19251 #    endif
19252 #   endif
19253 #  endif
19254 # endif
19255 # ifdef HAS_STDIO_STREAM_ARRAY
19256     if (open_max > 0) {
19257       long i;
19258       for (i = 0; i < open_max; i++)
19259             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19260                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19261                 STDIO_STREAM_ARRAY[i]._flag)
19262                 fflush(&STDIO_STREAM_ARRAY[i]);
19263     }
19264   }
19265 # endif
19266 #endif
19267   _exit(42);
19268 }
19269 EOCP
19270 : first we have to find out how _not_ to flush
19271 $to try.c
19272 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19273     output=''
19274     set try -DTRY_FPUTC
19275     if eval $compile; then
19276             $run ./try 2>/dev/null
19277             code="$?"
19278             $from try.out
19279             if $test ! -s try.out -a "X$code" = X42; then
19280                 output=-DTRY_FPUTC
19281             fi
19282     fi
19283     case "$output" in
19284     '')
19285             set try -DTRY_FPRINTF
19286             if eval $compile; then
19287                     $run ./try 2>/dev/null
19288                     code="$?"
19289                     $from try.out
19290                     if $test ! -s try.out -a "X$code" = X42; then
19291                         output=-DTRY_FPRINTF
19292                     fi
19293             fi
19294         ;;
19295     esac
19296 fi
19297 : check for fflush NULL behaviour
19298 case "$fflushNULL" in
19299 '')     set try -DTRY_FFLUSH_NULL $output
19300         if eval $compile; then
19301                 $run ./try 2>/dev/null
19302                 code="$?"
19303                 $from try.out
19304                 if $test -s try.out -a "X$code" = X42; then
19305                         fflushNULL="`$cat try.out`"
19306                 else
19307                         if $test "X$code" != X42; then
19308                                 $cat >&4 <<EOM
19309 (If this test failed, don't worry, we'll try another method shortly.)
19310 EOM
19311                         fi
19312                 fi
19313         fi
19314         $rm -f core try.core core.try.*
19315         case "$fflushNULL" in
19316         x)      $cat >&4 <<EOM
19317 Your fflush(NULL) works okay for output streams.
19318 Let's see if it clobbers input pipes...
19319 EOM
19320 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19321 # bug that improperly flushes the input end of pipes.  So we avoid the
19322 # autoflush on fork/system/exec support for now. :-(
19323 $cat >tryp.c <<EOCP
19324 #include <stdio.h>
19325 int
19326 main(int argc, char **argv)
19327 {
19328     char buf[1024];
19329     int i;
19330     char *bp = buf;
19331     while (1) {
19332         while ((i = getc(stdin)) != -1
19333                && (*bp++ = i) != '\n'
19334                && bp < &buf[1024])
19335         /* DO NOTHING */ ;
19336         *bp = '\0';
19337         fprintf(stdout, "%s", buf);
19338         fflush(NULL);
19339         if (i == -1)
19340             return 0;
19341         bp = buf;
19342     }
19343 }
19344 EOCP
19345                 fflushNULL="$define"
19346                 set tryp
19347                 if eval $compile; then
19348                     $rm -f tryp.out
19349                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19350                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19351                        $cat >&4 <<EOM
19352 fflush(NULL) seems to behave okay with input streams.
19353 EOM
19354                         fflushNULL="$define"
19355                     else
19356                         $cat >&4 <<EOM
19357 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19358 EOM
19359                         fflushNULL="$undef"
19360                     fi
19361                 fi
19362                 $rm -f core tryp.c tryp.core core.tryp.*
19363                 ;;
19364         '')     $cat >&4 <<EOM
19365 Your fflush(NULL) isn't working (contrary to ANSI C).
19366 EOM
19367                 fflushNULL="$undef"
19368                 ;;
19369         *)      $cat >&4 <<EOM
19370 Cannot figure out whether your fflush(NULL) works or not.
19371 I'm assuming it doesn't (contrary to ANSI C).
19372 EOM
19373                 fflushNULL="$undef"
19374                 ;;
19375         esac
19376         ;;
19377 $define|true|[yY]*)
19378         fflushNULL="$define"
19379         ;;
19380 *)
19381         fflushNULL="$undef"
19382         ;;
19383 esac
19384 : check explicit looping only if NULL did not work, and if the pipe
19385 : bug does not show up on an explicit flush too
19386 case "$fflushNULL" in
19387 "$undef")
19388         $cat >tryp.c <<EOCP
19389 #include <stdio.h>
19390 int
19391 main(int argc, char **argv)
19392 {
19393     char buf[1024];
19394     int i;
19395     char *bp = buf;
19396     while (1) {
19397         while ((i = getc(stdin)) != -1
19398                && (*bp++ = i) != '\n'
19399                && bp < &buf[1024])
19400         /* DO NOTHING */ ;
19401         *bp = '\0';
19402         fprintf(stdout, "%s", buf);
19403         fflush(stdin);
19404         if (i == -1)
19405             return 0;
19406         bp = buf;
19407     }
19408 }
19409 EOCP
19410         set tryp
19411         if eval $compile; then
19412             $rm -f tryp.out
19413             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19414             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19415                $cat >&4 <<EOM
19416 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19417 EOM
19418                 : now check for fflushall behaviour
19419                 case "$fflushall" in
19420                 '')     set try -DTRY_FFLUSH_ALL $output
19421                         if eval $compile; then
19422                                 $cat >&4 <<EOM
19423 (Now testing the other method--but note that this also may fail.)
19424 EOM
19425                                 $run ./try 2>/dev/null
19426                                 code=$?
19427                                 $from try.out
19428                                 if $test -s try.out -a "X$code" = X42; then
19429                                         fflushall="`$cat try.out`"
19430                                 fi
19431                         fi
19432                         $rm_try
19433                         case "$fflushall" in
19434                         x)      $cat >&4 <<EOM
19435 Whew. Flushing explicitly all the stdio streams works.
19436 EOM
19437                                 fflushall="$define"
19438                                 ;;
19439                         '')     $cat >&4 <<EOM
19440 Sigh. Flushing explicitly all the stdio streams doesn't work.
19441 EOM
19442                                 fflushall="$undef"
19443                                 ;;
19444                         *)      $cat >&4 <<EOM
19445 Cannot figure out whether flushing stdio streams explicitly works or not.
19446 I'm assuming it doesn't.
19447 EOM
19448                                 fflushall="$undef"
19449                                 ;;
19450                         esac
19451                         ;;
19452                 "$define"|true|[yY]*)
19453                         fflushall="$define"
19454                         ;;
19455                 *)
19456                         fflushall="$undef"
19457                         ;;
19458                 esac
19459             else
19460                 $cat >&4 <<EOM
19461 All is futile.  Even fflush(stdin) clobbers input pipes!
19462 EOM
19463                 fflushall="$undef"
19464             fi
19465         else
19466             fflushall="$undef"
19467         fi
19468         $rm -f core tryp.c tryp.core core.tryp.*
19469         ;;
19470 *)      fflushall="$undef"
19471         ;;
19472 esac
19473
19474 case "$fflushNULL$fflushall" in
19475 undefundef)
19476         $cat <<EOM
19477 OK, I give up.  I cannot figure out how to flush pending stdio output.
19478 We won't be flushing handles at all before fork/exec/popen.
19479 EOM
19480         ;;
19481 esac
19482 $rm_try tryp
19483
19484 : Store the full pathname to the ar program for use in the C program
19485 : Respect a hint or command line value for full_ar.
19486 case "$full_ar" in
19487 '') full_ar=$ar ;;
19488 esac
19489
19490 : Store the full pathname to the sed program for use in the C program
19491 full_sed=$sed
19492
19493 : see what type gids are declared as in the kernel
19494 echo " "
19495 echo "Looking for the type for group ids returned by getgid()."
19496 set gid_t gidtype xxx stdio.h sys/types.h
19497 eval $typedef
19498 case "$gidtype" in
19499 xxx)
19500         xxx=`./findhdr sys/user.h`
19501         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19502         case $1 in
19503         unsigned) dflt="$1 $2" ;;
19504         *) dflt="$1" ;;
19505         esac
19506         ;;
19507 *) dflt="$gidtype";;
19508 esac
19509 case "$gidtype" in
19510 gid_t) echo "gid_t found." ;;
19511 *)      rp="What is the type for group ids returned by getgid()?"
19512         . ./myread
19513         gidtype="$ans"
19514         ;;
19515 esac
19516
19517 : Check the size of GID
19518 echo " "
19519 case "$gidtype" in
19520 *_t) zzz="$gidtype"     ;;
19521 *)   zzz="gid"          ;;
19522 esac
19523 echo "Checking the size of $zzz..." >&4
19524 cat > try.c <<EOCP
19525 #include <sys/types.h>
19526 #include <stdio.h>
19527 #$i_stdlib I_STDLIB
19528 #ifdef I_STDLIB
19529 #include <stdlib.h>
19530 #endif
19531 int main() {
19532     printf("%d\n", (int)sizeof($gidtype));
19533     exit(0);
19534 }
19535 EOCP
19536 set try
19537 if eval $compile_ok; then
19538         yyy=`$run ./try`
19539         case "$yyy" in
19540         '')     gidsize=4
19541                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19542                 ;;
19543         *)      gidsize=$yyy
19544                 echo "Your $zzz is $gidsize bytes long."
19545                 ;;
19546         esac
19547 else
19548         gidsize=4
19549         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19550 fi
19551
19552
19553 : Check if GID is signed
19554 echo " "
19555 case "$gidtype" in
19556 *_t) zzz="$gidtype"     ;;
19557 *)   zzz="gid"          ;;
19558 esac
19559 echo "Checking the sign of $zzz..." >&4
19560 cat > try.c <<EOCP
19561 #include <sys/types.h>
19562 #include <stdio.h>
19563 int main() {
19564         $gidtype foo = -1;
19565         if (foo < 0)
19566                 printf("-1\n");
19567         else
19568                 printf("1\n");
19569 }
19570 EOCP
19571 set try
19572 if eval $compile; then
19573         yyy=`$run ./try`
19574         case "$yyy" in
19575         '')     gidsign=1
19576                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19577                 ;;
19578         *)      gidsign=$yyy
19579                 case "$gidsign" in
19580                  1) echo "Your $zzz is unsigned." ;;
19581                 -1) echo "Your $zzz is signed."   ;;
19582                 esac
19583                 ;;
19584         esac
19585 else
19586         gidsign=1
19587         echo "(I can't compile the test program--guessing unsigned.)" >&4
19588 fi
19589
19590
19591 : Check 64bit sizes
19592 echo " "
19593
19594 if $test X"$quadtype" != X; then
19595
19596 echo "Checking how to print 64-bit integers..." >&4
19597
19598 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19599         $cat >try.c <<'EOCP'
19600 #include <sys/types.h>
19601 #include <stdio.h>
19602 int main() {
19603   int q = 12345678901;
19604   printf("%ld\n", q);
19605 }
19606 EOCP
19607         set try
19608         if eval $compile; then
19609                 yyy=`$run ./try`
19610                 case "$yyy" in
19611                 12345678901)
19612                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19613                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19614                         echo "We will use %d."
19615                         ;;
19616                 esac
19617         fi
19618 fi
19619
19620 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19621         $cat >try.c <<'EOCP'
19622 #include <sys/types.h>
19623 #include <stdio.h>
19624 int main() {
19625   long q = 12345678901;
19626   printf("%ld\n", q);
19627 }
19628 EOCP
19629         set try
19630         if eval $compile; then
19631                 yyy=`$run ./try`
19632                 case "$yyy" in
19633                 12345678901)
19634                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19635                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19636                         echo "We will use %ld."
19637                         ;;
19638                 esac
19639         fi
19640 fi
19641
19642 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19643         $cat >try.c <<'EOCP'
19644 #include <sys/types.h>
19645 #include <inttypes.h>
19646 #include <stdio.h>
19647 int main() {
19648   int64_t q = 12345678901;
19649   printf("%" PRId64 "\n", q);
19650 }
19651 EOCP
19652         set try
19653         if eval $compile; then
19654                 yyy=`$run ./try`
19655                 case "$yyy" in
19656                 12345678901)
19657                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19658                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19659                         echo "We will use the C9X style."
19660                         ;;
19661                 esac
19662         fi
19663 fi
19664
19665 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19666         $cat >try.c <<EOCP
19667 #include <sys/types.h>
19668 #include <stdio.h>
19669 int main() {
19670   $quadtype q = 12345678901;
19671   printf("%Ld\n", q);
19672 }
19673 EOCP
19674         set try
19675         if eval $compile; then
19676                 yyy=`$run ./try`
19677                 case "$yyy" in
19678                 12345678901)
19679                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19680                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19681                         echo "We will use %Ld."
19682                         ;;
19683                 esac
19684         fi
19685 fi
19686
19687 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19688         $cat >try.c <<'EOCP'
19689 #include <sys/types.h>
19690 #include <stdio.h>
19691 int main() {
19692   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19693   printf("%lld\n", q);
19694 }
19695 EOCP
19696         set try
19697         if eval $compile; then
19698                 yyy=`$run ./try`
19699                 case "$yyy" in
19700                 12345678901)
19701                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19702                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19703                         echo "We will use the %lld style."
19704                         ;;
19705                 esac
19706         fi
19707 fi
19708
19709 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19710         $cat >try.c <<EOCP
19711 #include <sys/types.h>
19712 #include <stdio.h>
19713 int main() {
19714   $quadtype q = 12345678901;
19715   printf("%qd\n", q);
19716 }
19717 EOCP
19718         set try
19719         if eval $compile; then
19720                 yyy=`$run ./try`
19721                 case "$yyy" in
19722                 12345678901)
19723                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19724                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19725                         echo "We will use %qd."
19726                         ;;
19727                 esac
19728         fi
19729 fi
19730
19731 if $test X"$sPRId64" = X; then
19732         echo "Cannot figure out how to print 64-bit integers." >&4
19733 fi
19734 $rm_try
19735
19736 fi
19737
19738 case "$sPRId64" in
19739 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19740         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19741         ;;
19742 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19743         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19744         ;;
19745 esac
19746
19747 : Check format strings for internal types
19748 echo " "
19749 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19750
19751 if $test X"$ivsize" = X8; then
19752         ivdformat="$sPRId64"
19753         uvuformat="$sPRIu64"
19754         uvoformat="$sPRIo64"
19755         uvxformat="$sPRIx64"
19756         uvXUformat="$sPRIXU64"
19757 else
19758         if $test X"$ivsize" = X"$longsize"; then
19759                 ivdformat='"ld"'
19760                 uvuformat='"lu"'
19761                 uvoformat='"lo"'
19762                 uvxformat='"lx"'
19763                 uvXUformat='"lX"'
19764         else
19765                 if $test X"$ivsize" = X"$intsize"; then
19766                         ivdformat='"d"'
19767                         uvuformat='"u"'
19768                         uvoformat='"o"'
19769                         uvxformat='"x"'
19770                         uvXUformat='"X"'
19771                 else
19772                         : far out
19773                         if $test X"$ivsize" = X"$shortsize"; then
19774                                 ivdformat='"hd"'
19775                                 uvuformat='"hu"'
19776                                 uvoformat='"ho"'
19777                                 uvxformat='"hx"'
19778                                 uvXUformat='"hX"'
19779                         fi
19780                 fi
19781         fi
19782 fi
19783
19784 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19785         nveformat="$sPRIeldbl"
19786         nvfformat="$sPRIfldbl"
19787         nvgformat="$sPRIgldbl"
19788         nvEUformat="$sPRIEUldbl"
19789         nvFUformat="$sPRIFUldbl"
19790         nvGUformat="$sPRIGUldbl"
19791 else
19792         nveformat='"e"'
19793         nvfformat='"f"'
19794         nvgformat='"g"'
19795         nvEUformat='"E"'
19796         nvFUformat='"F"'
19797         nvGUformat='"G"'
19798 fi
19799
19800 case "$ivdformat" in
19801 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19802     exit 1
19803     ;;
19804 esac
19805
19806 : Check format string for GID
19807
19808 echo " "
19809 $echo "Checking the format string to be used for gids..." >&4
19810
19811 case "$gidsign" in
19812 -1)     if $test X"$gidsize" = X"$ivsize"; then
19813                 gidformat="$ivdformat"
19814         else
19815                 if $test X"$gidsize" = X"$longsize"; then
19816                         gidformat='"ld"'
19817                 else
19818                         if $test X"$gidsize" = X"$intsize"; then
19819                                 gidformat='"d"'
19820                         else
19821                                 if $test X"$gidsize" = X"$shortsize"; then
19822                                         gidformat='"hd"'
19823                                 fi
19824                         fi
19825                 fi
19826         fi
19827         ;;
19828 *)      if $test X"$gidsize" = X"$uvsize"; then
19829                 gidformat="$uvuformat"
19830         else
19831                 if $test X"$gidsize" = X"$longsize"; then
19832                         gidformat='"lu"'
19833                 else
19834                         if $test X"$gidsize" = X"$intsize"; then
19835                                 gidformat='"u"'
19836                         else
19837                                 if $test X"$gidsize" = X"$shortsize"; then
19838                                         gidformat='"hu"'
19839                                 fi
19840                         fi
19841                 fi
19842         fi
19843         ;;
19844 esac
19845
19846 : see if getgroups exists
19847 set getgroups d_getgrps
19848 eval $inlibc
19849
19850 : see if setgroups exists
19851 set setgroups d_setgrps
19852 eval $inlibc
19853
19854 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19855 echo " "
19856 case "$d_getgrps$d_setgrps" in
19857 *define*)
19858         case "$groupstype" in
19859         '') dflt="$gidtype" ;;
19860         *)  dflt="$groupstype" ;;
19861         esac
19862         $cat <<EOM
19863 What type of pointer is the second argument to getgroups() and setgroups()?
19864 Usually this is the same as group ids, $gidtype, but not always.
19865
19866 EOM
19867         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19868         . ./myread
19869         groupstype="$ans"
19870         ;;
19871 *)  groupstype="$gidtype";;
19872 esac
19873
19874 : MAD = Misc Attribute Definition
19875
19876 if $test $patchlevel -lt 9; then
19877 : MAD is not available in 5.8.x or earlier.
19878     ans=n;
19879 else
19880     case "$mad" in
19881     $define|true|[yY]*) dflt='y' ;;
19882     *)                  dflt='n' ;;
19883     esac
19884     cat <<EOM
19885
19886 Would you like to build with Misc Attribute Decoration? This is development
19887 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19888 overhead on the interpreter.
19889
19890 If this doesn't make any sense to you, just accept the default '$dflt'.
19891 EOM
19892     rp='Build Perl with MAD?'
19893     . ./myread
19894 fi
19895 case "$ans" in
19896 y|Y)    val="$define"
19897         madlyh='madly.h madly.act madly.tab'
19898         madlysrc='madly.c'
19899         madlyobj="madly$_o" ;;
19900 *)      val="$undef"
19901         madlyh=''
19902         madlysrc=''
19903         madlyobj='' ;;
19904 esac
19905 set mad
19906 eval $setvar
19907
19908 : check whether make sets MAKE
19909 echo " "
19910 echo "Checking if your $make program sets \$(MAKE)..." >&4
19911 case "$make_set_make" in
19912 '')
19913         $sed 's/^X //' > testmake.mak << 'EOF'
19914 Xall:
19915 X       @echo 'maketemp="$(MAKE)"'
19916 EOF
19917         case "`$make -f testmake.mak 2>/dev/null`" in
19918         *maketemp=*) make_set_make='#' ;;
19919         *)      make_set_make="MAKE=$make" ;;
19920         esac
19921         $rm -f testmake.mak
19922         ;;
19923 esac
19924 case "$make_set_make" in
19925 '#') echo "Yup, it does.";;
19926 *) echo "Nope, it doesn't.";;
19927 esac
19928
19929 : see what type is used for mode_t
19930 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19931 set mode_t modetype int stdio.h sys/types.h
19932 eval $typedef_ask
19933
19934 : see if we need va_copy
19935 echo " "
19936 case "$i_stdarg" in
19937 "$define")
19938         $cat >try.c <<EOCP
19939 #include <stdarg.h>
19940 #include <stdio.h>
19941 #$i_stdlib I_STDLIB
19942 #ifdef I_STDLIB
19943 #include <stdlib.h>
19944 #endif
19945 #include <signal.h>
19946
19947 int
19948 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19949 {
19950   return vfprintf(f, fmt, *valp);
19951 }
19952
19953 int
19954 myvfprintf(FILE *f, const  char *fmt, va_list val)
19955 {
19956   return ivfprintf(f, fmt, &val);
19957 }
19958
19959 int
19960 myprintf(char *fmt, ...)
19961 {
19962   va_list val;
19963   va_start(val, fmt);
19964   return myvfprintf(stdout, fmt, val);
19965 }
19966
19967 int
19968 main(int ac, char **av)
19969 {
19970   signal(SIGSEGV, exit);
19971
19972   myprintf("%s%cs all right, then\n", "that", '\'');
19973   exit(0);
19974 }
19975 EOCP
19976         set try
19977         if eval $compile && $run ./try 2>&1 >/dev/null; then
19978                 case "`$run ./try`" in
19979                 "that's all right, then")
19980                         okay=yes
19981                         ;;
19982                 esac
19983         fi
19984         case "$okay" in
19985         yes)    echo "It seems that you don't need va_copy()." >&4
19986                 need_va_copy="$undef"
19987                 ;;
19988         *)      echo "It seems that va_copy() or similar will be needed." >&4
19989                 need_va_copy="$define"
19990                 ;;
19991         esac
19992         $rm_try
19993         ;;
19994 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19995         ;;
19996 esac
19997
19998 : see what type is used for size_t
19999 rp="What is the type used for the length parameter for string functions?"
20000 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20001 eval $typedef_ask
20002
20003 : check for type of arguments to gethostbyaddr. 
20004 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20005         case "$d_gethbyaddr" in
20006         $define)
20007                 $cat <<EOM
20008
20009 Checking to see what type of arguments are accepted by gethostbyaddr().
20010 EOM
20011                 hdrs="$define sys/types.h
20012                         $d_socket sys/socket.h 
20013                         $i_niin netinet/in.h 
20014                         $i_netdb netdb.h
20015                         $i_unistd unistd.h"
20016                 : The first arg can 'char *' or 'void *'
20017                 : The second arg is some of integral type
20018                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20019                         for yyy in size_t long int; do
20020                                 case "$netdb_host_type" in
20021                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20022                                         if ./protochk "$try" $hdrs; then
20023                                                 echo "Your system accepts $xxx for the first arg."
20024                                                 echo "...and $yyy for the second arg."
20025                                                 netdb_host_type="$xxx"
20026                                                 netdb_hlen_type="$yyy"
20027                                         fi
20028                                         ;;
20029                                 esac
20030                         done
20031                 done
20032                 : In case none of those worked, prompt the user.
20033                 case "$netdb_host_type" in
20034                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20035                         dflt='char *'
20036                         . ./myread
20037                         netdb_host_type=$ans
20038                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20039                         dflt="$sizetype"
20040                         . ./myread
20041                         netdb_hlen_type=$ans
20042                         ;;
20043                 esac
20044                 ;;
20045         *)      : no gethostbyaddr, so pick harmless defaults
20046                 netdb_host_type='char *'
20047                 netdb_hlen_type="$sizetype"
20048                 ;;
20049         esac
20050         # Remove the "const" if needed. -- but then we'll have a 
20051         # prototype clash!
20052         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20053 fi
20054
20055 : check for type of argument to gethostbyname. 
20056 if test "X$netdb_name_type" = X ; then
20057         case "$d_gethbyname" in
20058         $define)
20059                 $cat <<EOM
20060
20061 Checking to see what type of argument is accepted by gethostbyname().
20062 EOM
20063                 hdrs="$define sys/types.h
20064                         $d_socket sys/socket.h 
20065                         $i_niin netinet/in.h 
20066                         $i_netdb netdb.h
20067                         $i_unistd unistd.h"
20068                 for xxx in "const char *" "char *"; do
20069                         case "$netdb_name_type" in
20070                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20071                                 if ./protochk "$try" $hdrs; then
20072                                         echo "Your system accepts $xxx."
20073                                         netdb_name_type="$xxx"
20074                                 fi
20075                                 ;;
20076                         esac
20077                 done
20078                 : In case none of those worked, prompt the user.
20079                 case "$netdb_name_type" in
20080                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20081                         dflt='char *'
20082                         . ./myread
20083                         netdb_name_type=$ans
20084                         ;;
20085                 esac
20086                 ;;
20087         *)      : no gethostbyname, so pick harmless default
20088                 netdb_name_type='char *'
20089                 ;;
20090         esac
20091 fi
20092
20093 : check for type of 1st argument to getnetbyaddr. 
20094 if test "X$netdb_net_type" = X ; then
20095         case "$d_getnbyaddr" in
20096         $define)
20097                 $cat <<EOM
20098
20099 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20100 EOM
20101                 hdrs="$define sys/types.h
20102                         $d_socket sys/socket.h 
20103                         $i_niin netinet/in.h 
20104                         $i_netdb netdb.h
20105                         $i_unistd unistd.h"
20106                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20107                         case "$netdb_net_type" in
20108                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20109                                 if ./protochk "$try" $hdrs; then
20110                                         echo "Your system accepts $xxx."
20111                                         netdb_net_type="$xxx"
20112                                 fi
20113                                 ;;
20114                         esac
20115                 done
20116                 : In case none of those worked, prompt the user.
20117                 case "$netdb_net_type" in
20118                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20119                         dflt='long'
20120                         . ./myread
20121                         netdb_net_type=$ans
20122                         ;;
20123                 esac
20124                 ;;
20125         *)      : no getnetbyaddr, so pick harmless default
20126                 netdb_net_type='long'
20127                 ;;
20128         esac
20129 fi
20130 : locate the preferred pager for this system
20131 fn=f/
20132 case "$pager" in
20133 '')
20134         dflt=''
20135         case "$pg" in
20136         /*) dflt=$pg;;
20137         [a-zA-Z]:/*) dflt=$pg;;
20138         esac
20139         case "$more" in
20140         /*) dflt=$more;;
20141         [a-zA-Z]:/*) dflt=$more;;
20142         esac
20143         case "$less" in
20144         /*) dflt=$less;;
20145         [a-zA-Z]:/*) dflt=$less;;
20146         esac
20147         case "$dflt" in
20148         '') dflt=/usr/ucb/more;;
20149         esac
20150         ;;
20151 *)      dflt="$pager"
20152         fn="f/($pager)"
20153         ;;
20154 esac
20155 echo " "
20156 rp='What pager is used on your system?'
20157 . ./getfile
20158 pager="$ans"
20159
20160 : see what type pids are declared as in the kernel
20161 rp="What is the type of process ids on this system?"
20162 set pid_t pidtype int stdio.h sys/types.h
20163 eval $typedef_ask
20164
20165 : see if ar generates random libraries by itself
20166 echo " "
20167 echo "Checking how to generate random libraries on your machine..." >&4
20168 echo 'int bar1() { return bar2(); }' > bar1.c
20169 echo 'int bar2() { return 2; }' > bar2.c
20170 $cat > foo.c <<EOP
20171 #$i_stdlib I_STDLIB
20172 #ifdef I_STDLIB
20173 #include <stdlib.h>
20174 #endif
20175 int main() { printf("%d\n", bar1()); exit(0); }
20176 EOP
20177 $cc $ccflags -c bar1.c >/dev/null 2>&1
20178 $cc $ccflags -c bar2.c >/dev/null 2>&1
20179 $cc $ccflags -c foo.c >/dev/null 2>&1
20180 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20181 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20182         $run ./foobar >/dev/null 2>&1; then
20183         echo "$ar appears to generate random libraries itself."
20184         orderlib=false
20185         if [ "X$ranlib" = "X" ]; then
20186             ranlib=":"
20187         fi
20188 elif $ar s bar$_a >/dev/null 2>&1 &&
20189         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20190         $run ./foobar >/dev/null 2>&1; then
20191                 echo "a table of contents needs to be added with '$ar s'."
20192                 orderlib=false
20193                 ranlib="$ar s"
20194 elif $ar ts bar$_a >/dev/null 2>&1 &&
20195         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20196         $run ./foobar >/dev/null 2>&1; then
20197                 echo "a table of contents needs to be added with '$ar ts'."
20198                 orderlib=false
20199                 ranlib="$ar ts"
20200 else
20201         case "$ranlib" in
20202         :) ranlib='';;
20203         '')
20204                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20205                 $test -f $ranlib || ranlib=''
20206                 ;;
20207         esac
20208         if $test -n "$ranlib"; then
20209                 echo "your system has '$ranlib'; we'll use that."
20210                 orderlib=false
20211         else
20212                 echo "your system doesn't seem to support random libraries"
20213                 echo "so we'll use lorder and tsort to order the libraries."
20214                 orderlib=true
20215                 ranlib=":"
20216         fi
20217 fi
20218 $rm -f foo* bar*
20219
20220 : see if this is a values.h system
20221 set values.h i_values
20222 eval $inhdr
20223
20224 : Check the max offset that gmtime and localtime accept
20225 echo "Checking max offsets that gmtime () accepts"
20226
20227 case $i_values in
20228     define) yyy="#include <values.h>" ;;
20229     *)      yyy="" ;;
20230     esac
20231
20232 case "$sGMTIME_min/$sGMTIME_max" in
20233     0/0|/)
20234         $cat >try.c <<EOCP
20235 #include <sys/types.h>
20236 #include <stdio.h>
20237 #include <time.h>
20238 $yyy
20239
20240 int i;
20241 struct tm *tmp;
20242 time_t pt;
20243
20244 void gm_check (time_t t, int min_year, int max_year)
20245 {
20246     tmp = gmtime (&t);
20247     if ( tmp == NULL ||
20248         /* Check tm_year overflow */
20249          tmp->tm_year < min_year || tmp->tm_year > max_year)
20250         tmp = NULL;
20251     else
20252         pt = t;
20253     } /* gm_check */
20254
20255 int check_max ()
20256 {
20257     tmp = NULL;
20258     pt  = 0;
20259 #ifdef MAXLONG
20260     gm_check (MAXLONG, 69, 0x7fffffff);
20261 #endif
20262     if (tmp == NULL || tmp->tm_year < 0) {
20263         for (i = 63; i >= 0; i--) {
20264             time_t x = pt | ((time_t)1 << i);
20265             if (x < 0 || x < pt) continue;
20266             gm_check (x, 69, 0x7fffffff);
20267             }
20268         }
20269     printf ("sGMTIME_max=%ld\n", pt);
20270     return (0);
20271     } /* check_max */
20272
20273 int check_min ()
20274 {
20275     tmp = NULL;
20276     pt  = 0;
20277 #ifdef MINLONG
20278     gm_check (MINLONG, -1900, 70);
20279 #endif
20280     if (tmp == NULL) {
20281         for (i = 36; i >= 0; i--) {
20282             time_t x = pt - ((time_t)1 << i);
20283             if (x > 0) continue;
20284             gm_check (x, -1900, 70);
20285             }
20286         }
20287     printf ("sGMTIME_min=%ld\n", pt);
20288     return (0);
20289     } /* check_min */
20290
20291 int main (int argc, char *argv[])
20292 {
20293     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20294     check_max ();
20295     check_min ();
20296     return (0);
20297     } /* main */
20298 EOCP
20299         set try
20300         if eval $compile; then
20301             eval `$run ./try`
20302         else
20303             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20304             fi
20305         $rm_try
20306         ;;
20307     esac
20308
20309 echo "Checking max offsets that localtime () accepts"
20310
20311 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20312     0/0|/)
20313         $cat >try.c <<EOCP
20314 #include <sys/types.h>
20315 #include <stdio.h>
20316 #include <time.h>
20317 $yyy
20318
20319 int i;
20320 struct tm *tmp;
20321 time_t pt;
20322
20323 void local_check (time_t t, int min_year, int max_year)
20324 {
20325     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20326         tmp = NULL;
20327     else
20328         tmp = localtime (&t);
20329     if ( tmp == NULL ||
20330         /* Check tm_year overflow */
20331          tmp->tm_year < min_year || tmp->tm_year > max_year)
20332         tmp = NULL;
20333     else
20334         pt = t;
20335     } /* local_check */
20336
20337 int check_max ()
20338 {
20339     tmp = NULL;
20340     pt  = 0;
20341 #ifdef MAXLONG
20342     local_check (MAXLONG, 69, 0x7fffffff);
20343 #endif
20344     if (tmp == NULL || tmp->tm_year < 0) {
20345         for (i = 63; i >= 0; i--) {
20346             time_t x = pt | ((time_t)1 << i);
20347             if (x < 0 || x < pt) continue;
20348             local_check (x, 69, 0x7fffffff);
20349             }
20350         }
20351     printf ("sLOCALTIME_max=%ld\n", pt);
20352     return (0);
20353    } /* check_max */
20354
20355 int check_min ()
20356 {
20357     tmp = NULL;
20358     pt  = 0;
20359 #ifdef MINLONG
20360     local_check (MINLONG, -1900, 70);
20361 #endif
20362     if (tmp == NULL) {
20363         for (i = 36; i >= 0; i--) {
20364             time_t x = pt - ((time_t)1 << i);
20365             if (x > 0) continue;
20366             local_check (x, -1900, 70);
20367             }
20368         }
20369     printf ("sLOCALTIME_min=%ld\n", pt);
20370     return (0);
20371     } /* check_min */
20372
20373 int main (int argc, char *argv[])
20374 {
20375     check_max ();
20376     check_min ();
20377     return (0);
20378     } /* main */
20379 EOCP
20380         set try
20381         if eval $compile; then
20382             eval `$run ./try`
20383         else
20384             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20385             fi
20386         $rm_try
20387         ;;
20388     esac
20389
20390 : check for type of arguments to select.
20391 case "$selecttype" in
20392 '') case "$d_select" in
20393         $define)
20394                 echo " "
20395                 $cat <<EOM
20396 Checking to see what type of arguments are accepted by select().
20397 EOM
20398                 hdrs="$define sys/types.h
20399                         $i_systime sys/time.h
20400                         $i_sysselct sys/select.h
20401                         $d_socket sys/socket.h"
20402                 : The first arg can be int, unsigned, or size_t
20403                 : The last arg may or may not be 'const'
20404                 val=''
20405                 : void pointer has been seen but using that
20406                 : breaks the selectminbits test
20407                 for xxx in 'fd_set *' 'int *'; do
20408                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20409                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20410                                         case "$val" in
20411                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20412                                                 if ./protochk "$try" $hdrs; then
20413                                                         echo "Your system accepts $xxx."
20414                                                         val="$xxx"
20415                                                 fi
20416                                                 ;;
20417                                         esac
20418                                 done
20419                         done
20420                 done
20421                 case "$val" in
20422                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20423                         case "$d_fd_set" in
20424                                 $define) dflt="fd_set *" ;;
20425                                 *)              dflt="int *" ;;
20426                         esac
20427                         . ./myread
20428                         val=$ans
20429                         ;;
20430                 esac
20431                 selecttype="$val"
20432                 ;;
20433         *)      : no select, so pick a harmless default
20434                 selecttype='int *'
20435                 ;;
20436         esac
20437         ;;
20438 esac
20439
20440 : check for the select 'width'
20441 case "$selectminbits" in
20442 '') safebits=`expr $ptrsize \* 8`
20443     case "$d_select" in
20444         $define)
20445                 $cat <<EOM
20446
20447 Checking to see on how many bits at a time your select() operates...
20448 EOM
20449                 $cat >try.c <<EOCP
20450 #include <sys/types.h>
20451 #$i_time I_TIME
20452 #$i_systime I_SYS_TIME
20453 #$i_systimek I_SYS_TIME_KERNEL
20454 #ifdef I_TIME
20455 #   include <time.h>
20456 #endif
20457 #ifdef I_SYS_TIME
20458 #   ifdef I_SYS_TIME_KERNEL
20459 #       define KERNEL
20460 #   endif
20461 #   include <sys/time.h>
20462 #   ifdef I_SYS_TIME_KERNEL
20463 #       undef KERNEL
20464 #   endif
20465 #endif
20466 #$i_sysselct I_SYS_SELECT
20467 #ifdef I_SYS_SELECT
20468 #include <sys/select.h>
20469 #endif
20470 #$d_socket HAS_SOCKET
20471 #ifdef HAS_SOCKET
20472 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20473 #endif
20474 #include <stdio.h>
20475 #$i_stdlib I_STDLIB
20476 #ifdef I_STDLIB
20477 #include <stdlib.h>
20478 #endif
20479 $selecttype b;
20480 #define S sizeof(*(b))
20481 #define MINBITS 64
20482 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20483 #define NBITS  (NBYTES * 8)
20484 int main() {
20485     char *s = (char *)malloc(NBYTES);
20486     struct timeval t;
20487     int i;
20488     FILE* fp;
20489     int fd;
20490
20491     if (!s)
20492         exit(1);
20493     fclose(stdin);
20494     fp = fopen("try.c", "r");
20495     if (fp == 0)
20496       exit(2);
20497     fd = fileno(fp);
20498     if (fd < 0)
20499       exit(3);
20500     b = ($selecttype)s;
20501     for (i = 0; i < NBITS; i++)
20502         FD_SET(i, b);
20503     t.tv_sec  = 0;
20504     t.tv_usec = 0;
20505     select(fd + 1, b, 0, 0, &t);
20506     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20507     free(s);
20508     printf("%d\n", i + 1);
20509     return 0;
20510 }
20511 EOCP
20512                 set try
20513                 if eval $compile_ok; then
20514                         selectminbits=`$run ./try`
20515                         case "$selectminbits" in
20516                         '')     cat >&4 <<EOM
20517 Cannot figure out on how many bits at a time your select() operates.
20518 I'll play safe and guess it is $safebits bits.
20519 EOM
20520                                 selectminbits=$safebits
20521                                 bits="$safebits bits"
20522                                 ;;
20523                         1)      bits="1 bit" ;;
20524                         *)      bits="$selectminbits bits" ;;
20525                         esac
20526                         echo "Your select() operates on $bits at a time." >&4
20527                 else
20528                         rp='What is the minimum number of bits your select() operates on?'
20529                         case "$byteorder" in
20530                         12345678)       dflt=64 ;;
20531                         1234)           dflt=32 ;;
20532                         *)              dflt=1  ;;
20533                         esac
20534                         . ./myread
20535                         val=$ans
20536                         selectminbits="$val"
20537                 fi
20538                 $rm_try
20539                 ;;
20540         *)      : no select, so pick a harmless default
20541                 selectminbits=$safebits
20542                 ;;
20543         esac
20544         ;;
20545 esac
20546
20547 : Trace out the files included by signal.h, then look for SIGxxx names.
20548 if [ "X$fieldn" = X ]; then
20549         : Just make some guesses.  We check them later.
20550         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20551 else
20552         xxx=`echo '#include <signal.h>' |
20553         $cppstdin $cppminus $cppflags 2>/dev/null |
20554         $grep '^[       ]*#.*include' |
20555         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20556                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20557 fi
20558 xxxfiles=''
20559 for xx in $xxx /dev/null ; do
20560         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20561 done
20562 case "$xxxfiles" in
20563 '')     xxxfiles=`./findhdr signal.h` ;;
20564 esac
20565 xxx=`awk '
20566 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20567         print substr($2, 4, 20)
20568 }
20569 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20570         print substr($3, 4, 20)
20571 }' $xxxfiles`
20572 : Append some common names just in case the awk scan failed.
20573 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20574 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20575 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20576 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20577 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20578
20579 : generate a few handy files for later
20580 $cat > signal.c <<EOCP
20581 #include <sys/types.h>
20582 #include <signal.h>
20583 #$i_stdlib I_STDLIB
20584 #ifdef I_STDLIB
20585 #include <stdlib.h>
20586 #endif
20587 #include <stdio.h>
20588 int main() {
20589
20590 /* Strange style to avoid deeply-nested #if/#else/#endif */
20591 #ifndef NSIG
20592 #  ifdef _NSIG
20593 #    define NSIG (_NSIG)
20594 #  endif
20595 #endif
20596
20597 #ifndef NSIG
20598 #  ifdef SIGMAX
20599 #    define NSIG (SIGMAX+1)
20600 #  endif
20601 #endif
20602
20603 #ifndef NSIG
20604 #  ifdef SIG_MAX
20605 #    define NSIG (SIG_MAX+1)
20606 #  endif
20607 #endif
20608
20609 #ifndef NSIG
20610 #  ifdef _SIG_MAX
20611 #    define NSIG (_SIG_MAX+1)
20612 #  endif
20613 #endif
20614
20615 #ifndef NSIG
20616 #  ifdef MAXSIG
20617 #    define NSIG (MAXSIG+1)
20618 #  endif
20619 #endif
20620
20621 #ifndef NSIG
20622 #  ifdef MAX_SIG
20623 #    define NSIG (MAX_SIG+1)
20624 #  endif
20625 #endif
20626
20627 #ifndef NSIG
20628 #  ifdef SIGARRAYSIZE
20629 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20630 #  endif
20631 #endif
20632
20633 #ifndef NSIG
20634 #  ifdef _sys_nsig
20635 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20636 #  endif
20637 #endif
20638
20639 /* Default to some arbitrary number that's big enough to get most
20640    of the common signals.
20641 */
20642 #ifndef NSIG
20643 #    define NSIG 50
20644 #endif
20645
20646 printf("NSIG %d\n", NSIG);
20647
20648 #ifndef JUST_NSIG
20649
20650 EOCP
20651
20652 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20653 {
20654         printf "#ifdef SIG"; printf $1; printf "\n"
20655         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20656         printf $1; printf ");\n"
20657         printf "#endif\n"
20658 }
20659 END {
20660         printf "#endif /* JUST_NSIG */\n";
20661         printf "exit(0);\n}\n";
20662 }
20663 ' >>signal.c
20664 $cat >signal.awk <<'EOP'
20665 BEGIN { ndups = 0 }
20666 $1 ~ /^NSIG$/ { nsig = $2 }
20667 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20668     if ($2 > maxsig) { maxsig = $2 }
20669     if (sig_name[$2]) {
20670         dup_name[ndups] = $1
20671         dup_num[ndups] = $2
20672         ndups++
20673     }
20674     else {
20675         sig_name[$2] = $1
20676         sig_num[$2] = $2
20677     }
20678 }
20679 END {
20680     if (nsig == 0) {
20681         nsig = maxsig + 1
20682     }
20683     printf("NSIG %d\n", nsig);
20684     for (n = 1; n < nsig; n++) {
20685         if (sig_name[n]) {
20686             printf("%s %d\n", sig_name[n], sig_num[n])
20687         }
20688         else {
20689             printf("NUM%d %d\n", n, n)
20690         }
20691     }
20692     for (n = 0; n < ndups; n++) {
20693         printf("%s %d\n", dup_name[n], dup_num[n])
20694     }
20695 }
20696 EOP
20697 $cat >signal_cmd <<EOS
20698 $startsh
20699 if $test -s signal.lst; then
20700     echo "Using your existing signal.lst file"
20701         exit 0
20702 fi
20703 xxx="$xxx"
20704 EOS
20705 $cat >>signal_cmd <<'EOS'
20706
20707 set signal
20708 if eval $compile_ok; then
20709         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20710                 $uniq | $awk -f signal.awk >signal.lst
20711 else
20712         echo "(I can't seem be able to compile the whole test program)" >&4
20713         echo "(I'll try it in little pieces.)" >&4
20714         set signal -DJUST_NSIG
20715         if eval $compile_ok; then
20716                 $run ./signal$_exe > signal.nsg
20717                 $cat signal.nsg
20718         else
20719                 echo "I can't seem to figure out how many signals you have." >&4
20720                 echo "Guessing 50." >&4
20721                 echo 'NSIG 50' > signal.nsg
20722         fi
20723         : Now look at all the signal names, one at a time.
20724         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20725                 $cat > signal.c <<EOCP
20726 #include <sys/types.h>
20727 #include <signal.h>
20728 #include <stdio.h>
20729 int main() {
20730 printf("$xx %d\n", SIG${xx});
20731 return 0;
20732 }
20733 EOCP
20734                 set signal
20735                 if eval $compile; then
20736                         echo "SIG${xx} found."
20737                         $run ./signal$_exe  >> signal.ls1
20738                 else
20739                         echo "SIG${xx} NOT found."
20740                 fi
20741         done
20742         if $test -s signal.ls1; then
20743                 $cat signal.nsg signal.ls1 |
20744                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20745         fi
20746
20747 fi
20748 if $test -s signal.lst; then
20749         :
20750 else
20751         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20752         echo 'kill -l' >signal
20753         set X `csh -f <signal`
20754         $rm -f signal
20755         shift
20756         case $# in
20757         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20758         esac
20759         echo $@ | $tr ' ' $trnl | \
20760             $awk '{ printf "%s %d\n", $1, ++s; }
20761                   END { printf "NSIG %d\n", ++s }' >signal.lst
20762 fi
20763 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20764 EOS
20765 chmod a+x signal_cmd
20766 $eunicefix signal_cmd
20767
20768 : generate list of signal names
20769 echo " "
20770 case "$sig_name_init" in
20771 '') doinit=yes ;;
20772 *)  case "$sig_num_init" in
20773     ''|*,*) doinit=yes ;;
20774     esac ;;
20775 esac
20776 case "$doinit" in
20777 yes)
20778         echo "Generating a list of signal names and numbers..." >&4
20779         . ./signal_cmd
20780         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20781         sig_name=`$awk 'BEGIN { printf "ZERO " }
20782                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20783         sig_num=`$awk  'BEGIN { printf "0 " }
20784                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20785         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20786                              !/^NSIG/   { printf "\"%s\", ", $1 }
20787                              END        { printf "0\n" }' signal.lst`
20788         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20789                              !/^NSIG/   { printf "%d, ", $2}
20790                              END        { printf "0\n"}' signal.lst`
20791         ;;
20792 esac
20793 echo "The following $sig_count signals are available:"
20794 echo " "
20795 echo $sig_name | $awk \
20796 'BEGIN { linelen = 0 }
20797 {
20798         for (i = 1; i <= NF; i++) {
20799                 name = "SIG" $i " "
20800                 linelen = linelen + length(name)
20801                 if (linelen > 70) {
20802                         printf "\n"
20803                         linelen = length(name)
20804                 }
20805                 printf "%s", name
20806         }
20807         printf "\n"
20808 }'
20809 sig_size=`echo $sig_name | awk '{print NF}'`
20810 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20811
20812 : Check size of size
20813 echo " "
20814 case "$sizetype" in
20815 *_t) zzz="$sizetype"    ;;
20816 *)   zzz="filesize"     ;;
20817 esac
20818 echo "Checking the size of $zzz..." >&4
20819 cat > try.c <<EOCP
20820 #include <sys/types.h>
20821 #include <stdio.h>
20822 #$i_stdlib I_STDLIB
20823 #ifdef I_STDLIB
20824 #include <stdlib.h>
20825 #endif
20826 int main() {
20827     printf("%d\n", (int)sizeof($sizetype));
20828     exit(0);
20829 }
20830 EOCP
20831 set try
20832 if eval $compile_ok; then
20833         yyy=`$run ./try`
20834         case "$yyy" in
20835         '')     sizesize=4
20836                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20837                 ;;
20838         *)      sizesize=$yyy
20839                 echo "Your $zzz size is $sizesize bytes."
20840                 ;;
20841         esac
20842 else
20843         sizesize=4
20844         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20845 fi
20846
20847
20848 : check for socklen_t
20849 echo " "
20850 echo "Checking to see if you have socklen_t..." >&4
20851 $cat >try.c <<EOCP
20852 #include <sys/types.h>
20853 #$d_socket HAS_SOCKET
20854 #ifdef HAS_SOCKET
20855 #include <sys/socket.h>
20856 #endif
20857 int main() { socklen_t x = 16; }
20858 EOCP
20859 set try
20860 if eval $compile; then
20861         val="$define"
20862         echo "You have socklen_t."
20863 else
20864         val="$undef"
20865         echo "You do not have socklen_t."
20866         case "$sizetype" in
20867         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20868         esac
20869 fi
20870 $rm_try
20871 set d_socklen_t
20872 eval $setvar
20873
20874 : see if this is a socks.h system
20875 set socks.h i_socks
20876 eval $inhdr
20877
20878 : check for type of the size argument to socket calls
20879 case "$d_socket" in
20880 "$define")
20881         $cat <<EOM
20882
20883 Checking to see what type is the last argument of accept().
20884 EOM
20885         yyy=''
20886         case "$d_socklen_t" in
20887         "$define") yyy="$yyy socklen_t"
20888         esac
20889         yyy="$yyy $sizetype int long unsigned"
20890         for xxx in $yyy; do
20891                 case "$socksizetype" in
20892                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20893                         case "$usesocks" in
20894                         "$define")
20895                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20896                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20897                                         socksizetype="$xxx"
20898                                 fi
20899                                 ;;
20900                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20901                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20902                                         socksizetype="$xxx"
20903                                 fi
20904                                 ;;
20905                         esac
20906                         ;;
20907                 esac
20908         done
20909 : In case none of those worked, prompt the user.
20910         case "$socksizetype" in
20911         '')     rp='What is the type for socket address structure sizes?'
20912                 dflt='int'
20913                 . ./myread
20914                 socksizetype=$ans
20915                 ;;
20916         esac
20917         ;;
20918 *)      : no sockets, so pick relatively harmless default
20919         socksizetype='int'
20920         ;;
20921 esac
20922
20923 : see what type is used for signed size_t
20924 set ssize_t ssizetype int stdio.h sys/types.h
20925 eval $typedef
20926 dflt="$ssizetype"
20927 $cat > try.c <<EOM
20928 #include <stdio.h>
20929 #$i_stdlib I_STDLIB
20930 #ifdef I_STDLIB
20931 #include <stdlib.h>
20932 #endif
20933 #include <sys/types.h>
20934 #define Size_t $sizetype
20935 #define SSize_t $dflt
20936 int main()
20937 {
20938         if (sizeof(Size_t) == sizeof(SSize_t))
20939                 printf("$dflt\n");
20940         else if (sizeof(Size_t) == sizeof(int))
20941                 printf("int\n");
20942         else
20943                 printf("long\n");
20944         exit(0);
20945 }
20946 EOM
20947 echo " "
20948 set try
20949 if eval $compile_ok && $run ./try > /dev/null; then
20950         ssizetype=`$run ./try`
20951         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20952 else
20953         $cat >&4 <<EOM
20954 Help! I can't compile and run the ssize_t test program: please enlighten me!
20955 (This is probably a misconfiguration in your system or libraries, and
20956 you really ought to fix it.  Still, I'll try anyway.)
20957
20958 I need a type that is the same size as $sizetype, but is guaranteed to
20959 be signed.  Common values are ssize_t, int and long.
20960
20961 EOM
20962         rp="What signed type is the same size as $sizetype?"
20963         . ./myread
20964         ssizetype="$ans"
20965 fi
20966 $rm_try
20967
20968 : see what type of char stdio uses.
20969 echo " "
20970 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20971 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20972         echo "Your stdio uses unsigned chars." >&4
20973         stdchar="unsigned char"
20974 else
20975         echo "Your stdio uses signed chars." >&4
20976         stdchar="char"
20977 fi
20978 $rm -f stdioh
20979
20980 : see what type uids are declared as in the kernel
20981 echo " "
20982 echo "Looking for the type for user ids returned by getuid()."
20983 set uid_t uidtype xxx stdio.h sys/types.h
20984 eval $typedef
20985 case "$uidtype" in
20986 xxx)
20987         xxx=`./findhdr sys/user.h`
20988         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20989         case $1 in
20990         unsigned) dflt="$1 $2" ;;
20991         *) dflt="$1" ;;
20992         esac
20993         ;;
20994 *) dflt="$uidtype";;
20995 esac
20996 case "$uidtype" in
20997 uid_t)  echo "uid_t found." ;;
20998 *)      rp="What is the type for user ids returned by getuid()?"
20999         . ./myread
21000         uidtype="$ans"
21001         ;;
21002 esac
21003
21004 : Check size of UID
21005 echo " "
21006 case "$uidtype" in
21007 *_t) zzz="$uidtype"     ;;
21008 *)   zzz="uid"          ;;
21009 esac
21010 echo "Checking the size of $zzz..." >&4
21011 cat > try.c <<EOCP
21012 #include <sys/types.h>
21013 #include <stdio.h>
21014 #$i_stdlib I_STDLIB
21015 #ifdef I_STDLIB
21016 #include <stdlib.h>
21017 #endif
21018 int main() {
21019     printf("%d\n", (int)sizeof($uidtype));
21020     exit(0);
21021 }
21022 EOCP
21023 set try
21024 if eval $compile_ok; then
21025         yyy=`$run ./try`
21026         case "$yyy" in
21027         '')     uidsize=4
21028                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21029                 ;;
21030         *)      uidsize=$yyy
21031                 echo "Your $zzz is $uidsize bytes long."
21032                 ;;
21033         esac
21034 else
21035         uidsize=4
21036         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21037 fi
21038
21039 : Check if UID is signed
21040 echo " "
21041 case "$uidtype" in
21042 *_t) zzz="$uidtype"     ;;
21043 *)   zzz="uid"          ;;
21044 esac
21045 echo "Checking the sign of $zzz..." >&4
21046 cat > try.c <<EOCP
21047 #include <sys/types.h>
21048 #include <stdio.h>
21049 int main() {
21050         $uidtype foo = -1;
21051         if (foo < 0)
21052                 printf("-1\n");
21053         else
21054                 printf("1\n");
21055 }
21056 EOCP
21057 set try
21058 if eval $compile; then
21059         yyy=`$run ./try`
21060         case "$yyy" in
21061         '')     uidsign=1
21062                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21063                 ;;
21064         *)      uidsign=$yyy
21065                 case "$uidsign" in
21066                  1) echo "Your $zzz is unsigned." ;;
21067                 -1) echo "Your $zzz is signed."   ;;
21068                 esac
21069                 ;;
21070         esac
21071 else
21072         uidsign=1
21073         echo "(I can't compile the test program--guessing unsigned.)" >&4
21074 fi
21075
21076
21077 : Check format string for UID
21078 echo " "
21079 $echo "Checking the format string to be used for uids..." >&4
21080
21081 case "$uidsign" in
21082 -1)     if $test X"$uidsize" = X"$ivsize"; then
21083                 uidformat="$ivdformat"
21084         else
21085                 if $test X"$uidsize" = X"$longsize"; then
21086                         uidformat='"ld"'
21087                 else
21088                         if $test X"$uidsize" = X"$intsize"; then
21089                                 uidformat='"d"'
21090                         else
21091                                 if $test X"$uidsize" = X"$shortsize"; then
21092                                         uidformat='"hd"'
21093                                 fi
21094                         fi
21095                 fi
21096         fi
21097         ;;
21098 *)      if $test X"$uidsize" = X"$uvsize"; then
21099                 uidformat="$uvuformat"
21100         else
21101                 if $test X"$uidsize" = X"$longsize"; then
21102                         uidformat='"lu"'
21103                 else
21104                         if $test X"$uidsize" = X"$intsize"; then
21105                                 uidformat='"u"'
21106                         else
21107                                 if $test X"$uidsize" = X"$shortsize"; then
21108                                         uidformat='"hu"'
21109                                 fi
21110                         fi
21111                 fi
21112         fi
21113         ;;
21114 esac
21115
21116 : Check if site customization support was requested
21117 case "$usesitecustomize" in
21118     $define|true|[Yy]*)
21119         usesitecustomize="$define"
21120         ;;
21121     *)
21122         usesitecustomize="$undef"
21123         ;;
21124     esac
21125
21126 : determine compiler compiler
21127 case "$yacc" in
21128 '')
21129         dflt=yacc;;
21130 *)
21131         dflt="$yacc";;
21132 esac
21133 echo " "
21134 comp='yacc'
21135 if $test -f "$byacc$_exe"; then
21136         dflt="$byacc"
21137         comp="byacc or $comp"
21138 fi
21139 if $test -f "$bison$_exe"; then
21140         comp="$comp or bison -y"
21141 fi
21142 rp="Which compiler compiler ($comp) shall I use?"
21143 . ./myread
21144 yacc="$ans"
21145 case "$yacc" in
21146 *bis*)
21147         case "$yacc" in
21148         *-y*) ;;
21149         *)
21150                 yacc="$yacc -y"
21151                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21152                 ;;
21153         esac
21154         ;;
21155 esac
21156
21157 : see if this is a assert.h system
21158 set assert.h i_assert
21159 eval $inhdr
21160
21161 : see if this is a fp.h system
21162 set fp.h i_fp
21163 eval $inhdr
21164
21165 : see if this is a fp_class.h system
21166 set fp_class.h i_fp_class
21167 eval $inhdr
21168
21169 : see if gdbm.h is available
21170 set gdbm.h t_gdbm
21171 eval $inhdr
21172 case "$t_gdbm" in
21173 $define)
21174         : see if gdbm_open exists
21175         set gdbm_open d_gdbm_open
21176         eval $inlibc
21177         case "$d_gdbm_open" in
21178         $undef)
21179                 t_gdbm="$undef"
21180                 echo "We won't be including <gdbm.h>"
21181                 ;;
21182         esac
21183         ;;
21184 esac
21185 val="$t_gdbm"
21186 set i_gdbm
21187 eval $setvar
21188
21189 : see if this is a ieeefp.h system
21190 case "$i_ieeefp" in
21191 '' ) set ieeefp.h i_ieeefp
21192      eval $inhdr
21193      ;;
21194 esac
21195
21196 : see if this is a libutil.h system
21197 set libutil.h i_libutil
21198 eval $inhdr
21199
21200 : see if mach cthreads are available
21201 if test "X$usethreads" = "X$define"; then
21202         set mach/cthreads.h i_machcthr
21203         eval $inhdr
21204 else
21205         i_machcthr="$undef"
21206 fi
21207
21208 : see if this is a mntent.h system
21209 set mntent.h i_mntent
21210 eval $inhdr
21211
21212 : see if net/errno.h is available
21213 val=''
21214 set net/errno.h val
21215 eval $inhdr
21216
21217 : Unfortunately, it causes problems on some systems.  Arrgh.
21218 case "$val" in
21219 $define)
21220         cat > try.c <<'EOM'
21221 #include <stdio.h>
21222 #include <errno.h>
21223 #include <net/errno.h>
21224 int func()
21225 {
21226         return ENOTSOCK;
21227 }
21228 EOM
21229         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21230                 echo "We'll be including <net/errno.h>." >&4
21231         else
21232                 echo "We won't be including <net/errno.h>." >&4
21233                 val="$undef"
21234         fi
21235         $rm_try
21236         ;;
21237 esac
21238 set i_neterrno
21239 eval $setvar
21240
21241 : see if netinet/tcp.h is available
21242 set netinet/tcp.h i_netinettcp
21243 eval $inhdr
21244
21245 : see if this is a poll.h system
21246 set poll.h i_poll
21247 eval $inhdr
21248
21249 : see if this is a prot.h system
21250 set prot.h i_prot
21251 eval $inhdr
21252
21253 : Preprocessor symbols
21254 echo " "
21255 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21256 $cat <<'EOSH' > Cppsym.know
21257 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21258 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21259 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21260 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21261 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21262 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21263 bull c cadmus clipper CMU COFF COMPILER_VERSION
21264 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21265 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21266 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21267 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21268 GLIBC GLIBC_MINOR
21269 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21270 H3050R H3050RX hbullx20 hcx host_mips
21271 hp200 hp300 hp700 HP700 hp800 hp9000
21272 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21273 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21274 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21275 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21276 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21277 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21278 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21279 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21280 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21281 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21282 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21283 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21284 MATH_HAS_NO_SIDE_EFFECTS
21285 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21286 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21287 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21288 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21289 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21290 NetBSD news1500 news1700 news1800 news1900 news3700
21291 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21292 ns32016 ns32332 ns32k nsc32000
21293 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21294 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21295 pc532 pdp11 PGC PIC plexus PORTAR posix
21296 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21297 POSIX_C_SOURCE POSIX_SOURCE POWER
21298 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21299 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21300 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21301 sony sony_news sonyrisc sparc sparclite spectrum
21302 stardent stdc STDC_EXT stratos sun sun3 sun386
21303 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21304 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21305 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21306 sysV68 sysV88 Tek4132 Tek4300 titan
21307 TM3200 TM5400 TM5600
21308 tower tower32 tower32_200 tower32_600 tower32_700
21309 tower32_800 tower32_850 tss
21310 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21311 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21312 unix UNIX95 UNIX99 unixpc unos
21313 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21314 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21315 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21316 USGr4 USGr4_2
21317 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21318 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21319 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21320 z8000
21321 EOSH
21322 # Maybe put other stuff here too.
21323 cat <<EOSH >>Cppsym.know
21324 $osname
21325 EOSH
21326 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21327 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21328 $cat Cppsym.know > Cppsym.c
21329 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21330 $rm -f Cppsym.a Cppsym.b Cppsym.c
21331 cat <<EOSH > Cppsym
21332 $startsh
21333 if $test \$# -gt 0; then
21334     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21335     if $test -s Cppsym.got; then
21336         $rm -f Cppsym.got
21337         exit 0
21338     fi
21339     $rm -f Cppsym.got
21340     exit 1
21341 else
21342     $tr " " "$trnl" | ./Cppsym.try
21343     exit 0
21344 fi
21345 EOSH
21346 chmod +x Cppsym
21347 $eunicefix Cppsym
21348 cat <<EOSH > Cppsym.try
21349 $startsh
21350 cat <<'EOCP' > try.c
21351 #include <stdio.h>
21352 #if cpp_stuff == 1
21353 #define STRINGIFY(a)    "a"
21354 #endif
21355 #if cpp_stuff == 42
21356 #define StGiFy(a)  #a
21357 #define STRINGIFY(a)    StGiFy(a)
21358 #endif
21359 #if $cpp_stuff != 1 && $cpp_stuff != 42
21360 #   include "Bletch: How does this C preprocessor stringify macros?"
21361 #endif
21362 int main() {
21363 EOCP
21364 $awk \\
21365 EOSH
21366 cat <<'EOSH' >> Cppsym.try
21367 'length($1) > 0 {
21368     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21369     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21370     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21371     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21372 }'       >> try.c
21373 echo 'return 0;}' >> try.c
21374 EOSH
21375 cat <<EOSH >> Cppsym.try
21376 ccflags="$ccflags"
21377 case "$osname-$gccversion" in
21378 irix-) ccflags="\$ccflags -woff 1178" ;;
21379 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21380 esac
21381 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21382 EOSH
21383 chmod +x Cppsym.try
21384 $eunicefix Cppsym.try
21385 ./Cppsym < Cppsym.know > Cppsym.true
21386 : Add in any linux cpp "predefined macros":
21387 case "$osname::$gccversion" in
21388   *linux*::*.*|*gnukfreebsd*::*.*)
21389     tHdrH=_tmpHdr
21390     rm -f $tHdrH'.h' $tHdrH
21391     touch $tHdrH'.h'
21392     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21393        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21394        if [ -s $tHdrH'_cppsym.real' ]; then
21395           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21396        fi
21397     fi
21398     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21399   ;;
21400 esac
21401 : now check the C compiler for additional symbols
21402 postprocess_cc_v=''
21403 case "$osname" in
21404 aix) postprocess_cc_v="|$tr , ' '" ;;
21405 esac
21406 $cat >ccsym <<EOS
21407 $startsh
21408 $cat >tmp.c <<EOF
21409 extern int foo;
21410 EOF
21411 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21412 do
21413         case "\$i" in
21414         -D*) echo "\$i" | $sed 's/^-D//';;
21415         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21416         esac
21417 done
21418 $rm_try
21419 EOS
21420 postprocess_cc_v=''
21421 chmod +x ccsym
21422 $eunicefix ccsym
21423 ./ccsym > ccsym1.raw
21424 if $test -s ccsym1.raw; then
21425        $sort ccsym1.raw | $uniq >ccsym.raw
21426 else
21427        mv ccsym1.raw ccsym.raw
21428 fi
21429
21430 $awk '/\=/ { print $0; next }
21431         { print $0"=1" }' ccsym.raw >ccsym.list
21432 $comm -13 Cppsym.true ccsym.list >ccsym.own
21433 $comm -12 Cppsym.true ccsym.list >ccsym.com
21434 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21435 also=''
21436 if $test -z ccsym.raw; then
21437         echo "Your C compiler doesn't seem to define any symbols!" >&4
21438         echo " "
21439         echo "However, your C preprocessor defines the following symbols:"
21440         $cat Cppsym.true
21441         ccsymbols=''
21442         cppsymbols=`$cat Cppsym.true`
21443         cppsymbols=`echo $cppsymbols`
21444         cppccsymbols="$cppsymbols"
21445 else
21446         if $test -s ccsym.com; then
21447                 echo "Your C compiler and pre-processor define these symbols:"
21448                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21449                 also='also '
21450                 symbols='ones'
21451                 cppccsymbols=`$cat ccsym.com`
21452                 cppccsymbols=`echo $cppccsymbols`
21453                 $test "$silent" || sleep 1
21454         fi
21455         if $test -s ccsym.cpp; then
21456                 $test "$also" && echo " "
21457                 echo "Your C pre-processor ${also}defines the following symbols:"
21458                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21459                 also='further '
21460                 cppsymbols=`$cat ccsym.cpp`
21461                 cppsymbols=`echo $cppsymbols`
21462                 $test "$silent" || sleep 1
21463         fi
21464         if $test -s ccsym.own; then
21465                 $test "$also" && echo " "
21466                 echo "Your C compiler ${also}defines the following cpp symbols:"
21467                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21468                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21469                 ccsymbols=`$cat ccsym.own`
21470                 ccsymbols=`echo $ccsymbols`
21471                 $test "$silent" || sleep 1
21472         fi
21473 fi
21474
21475 : see if this is a termio system
21476 val="$undef"
21477 val2="$undef"
21478 val3="$undef"
21479 if $test `./findhdr termios.h`; then
21480         set tcsetattr i_termios
21481         eval $inlibc
21482         val3="$i_termios"
21483 fi
21484 echo " "
21485 case "$val3" in
21486 "$define") echo "You have POSIX termios.h... good!" >&4;;
21487 *) if ./Cppsym pyr; then
21488                 case "`/bin/universe`" in
21489                 ucb) if $test `./findhdr sgtty.h`; then
21490                                 val2="$define"
21491                                 echo "<sgtty.h> found." >&4
21492                         else
21493                                 echo "System is pyramid with BSD universe."
21494                                 ./warn "<sgtty.h> not found--you could have problems."
21495                         fi;;
21496                 *) if $test `./findhdr termio.h`; then
21497                                 val="$define"
21498                                 echo "<termio.h> found." >&4
21499                         else
21500                                 echo "System is pyramid with USG universe."
21501                                 ./warn "<termio.h> not found--you could have problems."
21502                         fi;;
21503                 esac
21504         elif ./usg; then
21505                 if $test `./findhdr termio.h`; then
21506                         echo "<termio.h> found." >&4
21507                         val="$define"
21508                 elif $test `./findhdr sgtty.h`; then
21509                         echo "<sgtty.h> found." >&4
21510                         val2="$define"
21511                 else
21512                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21513                 fi
21514         else
21515                 if $test `./findhdr sgtty.h`; then
21516                         echo "<sgtty.h> found." >&4
21517                         val2="$define"
21518                 elif $test `./findhdr termio.h`; then
21519                         echo "<termio.h> found." >&4
21520                         val="$define"
21521                 else
21522                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21523                 fi
21524         fi;;
21525 esac
21526 set i_termio; eval $setvar
21527 val=$val2; set i_sgtty; eval $setvar
21528 val=$val3; set i_termios; eval $setvar
21529
21530 : see if stddef is available
21531 set stddef.h i_stddef
21532 eval $inhdr
21533
21534 : see if sys/access.h is available
21535 set sys/access.h i_sysaccess
21536 eval $inhdr
21537
21538 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21539 set sys/filio.h i_sysfilio
21540 eval $inhdr
21541 echo " "
21542 if $test `./findhdr sys/ioctl.h`; then
21543         val="$define"
21544         echo '<sys/ioctl.h> found.' >&4
21545 else
21546         val="$undef"
21547         if $test $i_sysfilio = "$define"; then
21548             echo '<sys/ioctl.h> NOT found.' >&4
21549         else
21550                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21551                 $test $i_termio = "$define" && xxx="termio.h"
21552                 $test $i_termios = "$define" && xxx="termios.h"
21553 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21554         fi
21555 fi
21556 set i_sysioctl
21557 eval $setvar
21558
21559 : see if socket ioctl defs are in sys/sockio.h
21560 echo " "
21561 xxx=`./findhdr sys/sockio.h`
21562 if $test "$xxx"; then
21563         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21564                 val="$define"
21565                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21566         else
21567                 val="$undef"
21568                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21569         fi
21570 else
21571         val="$undef"
21572         $cat <<EOM
21573 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21574 EOM
21575 fi
21576 set i_syssockio
21577 eval $setvar
21578
21579 : see if this is a syslog.h system
21580 set syslog.h i_syslog
21581 eval $inhdr
21582
21583 : see if this is a sys/mode.h system
21584 set sys/mode.h i_sysmode
21585 eval $inhdr
21586
21587 : see if there is a sys/poll.h file
21588 set sys/poll.h i_syspoll
21589 eval $inhdr
21590
21591 : see if sys/resource.h has to be included
21592 set sys/resource.h i_sysresrc
21593 eval $inhdr
21594
21595 : see if sys/security.h is available
21596 set sys/security.h i_syssecrt
21597 eval $inhdr
21598
21599 : see if this is a sys/statvfs.h system
21600 set sys/statvfs.h i_sysstatvfs
21601 eval $inhdr
21602
21603 : see if this is a sys/un.h system
21604 set sys/un.h i_sysun
21605 eval $inhdr
21606
21607 : see if this is a sys/utsname.h system
21608 set sys/utsname.h i_sysutsname
21609 eval $inhdr
21610
21611 : see if this is a syswait system
21612 set sys/wait.h i_syswait
21613 eval $inhdr
21614
21615 : see if this is a ustat.h system
21616 set ustat.h i_ustat
21617 eval $inhdr
21618
21619 : see if this is an utime system
21620 set utime.h i_utime
21621 eval $inhdr
21622
21623 : see if this is a vfork system
21624 case "$d_vfork" in
21625 "$define")
21626         set vfork.h i_vfork
21627         eval $inhdr
21628         ;;
21629 *)
21630         i_vfork="$undef"
21631         ;;
21632 esac
21633
21634 : Check extensions
21635 echo " "
21636 echo "Looking for extensions..." >&4
21637 : If we are using the old config.sh, known_extensions may contain
21638 : old or inaccurate or duplicate values.
21639 known_extensions=''
21640 nonxs_extensions=''
21641 : We do not use find because it might not be available.
21642 : We do not just use MANIFEST because the user may have dropped
21643 : some additional extensions into the source tree and expect them
21644 : to be built.
21645
21646 : Function to recursively find available extensions, ignoring DynaLoader
21647 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21648 find_extensions='
21649     for xxx in *; do
21650         case "$xxx" in
21651             DynaLoader|dynaload) ;;
21652             *)
21653             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21654             leaf=`echo $xxx | $sed -e s/.*-//`;
21655             if $test -d File-Glob; then
21656                 $ls -1 $xxx > $$.tmp;
21657                 if $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21658                     known_extensions="$known_extensions $this_ext";
21659                 elif $contains "\.c$" $$.tmp > /dev/null 2>&1; then
21660                     known_extensions="$known_extensions $this_ext";
21661                 elif $test -d $xxx; then
21662                     nonxs_extensions="$nonxs_extensions $this_ext";
21663                 fi;
21664                 $rm -f $$.tmp;
21665             else
21666                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21667                     known_extensions="$known_extensions $1$this_ext";
21668                 elif $test -f $xxx/Makefile.PL; then
21669                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21670                 else
21671                     if $test -d $xxx -a $# -lt 10; then
21672                         set $1$xxx/ $*;
21673                         cd "$xxx";
21674                         eval $find_extensions;
21675                         cd ..;
21676                         shift;
21677                     fi;
21678                 fi;
21679             fi
21680             ;;
21681         esac;
21682     done'
21683 tdir=`pwd`
21684 cd "$rsrc/ext"
21685 set X
21686 shift
21687 eval $find_extensions
21688 if $test -d File-Glob; then
21689     : All ext/ flattened
21690 else
21691     # Special case:  Add in modules that nest beyond the first level.
21692     # Currently threads/shared and Hash/Util/FieldHash, since they are
21693     # not picked up by the recursive find above (and adding in general
21694     # recursive finding breaks SDBM_File/sdbm).
21695     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21696     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21697 fi
21698 set X $known_extensions
21699 shift
21700 known_extensions="$*"
21701 set X $nonxs_extensions
21702 shift
21703 nonxs_extensions="$*"
21704 cd "$tdir"
21705
21706 : Now see which are supported on this system.
21707 avail_ext=''
21708 for xxx in $known_extensions ; do
21709         case "$xxx" in
21710         DB_File|db_file)
21711                 case "$i_db" in
21712                 $define) avail_ext="$avail_ext $xxx" ;;
21713                 esac
21714                 ;;
21715         GDBM_File|gdbm_fil)
21716                 case "$i_gdbm" in
21717                 $define) avail_ext="$avail_ext $xxx" ;;
21718                 esac
21719                 ;;
21720         I18N/Langinfo|i18n_lan)
21721                 case "$i_langinfo$d_nl_langinfo" in
21722                 $define$define) avail_ext="$avail_ext $xxx" ;;
21723                 esac
21724                 ;;
21725         IPC/SysV|ipc/sysv)
21726                 : XXX Do we need a useipcsysv variable here
21727                 case "${d_msg}${d_sem}${d_shm}" in
21728                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21729                 esac
21730                 ;;
21731         NDBM_File|ndbm_fil)
21732                 case "$i_ndbm" in
21733                 $define)
21734                     case "$osname-$use64bitint" in
21735                     hpux-define)
21736                         case "$libs" in
21737                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21738                         esac
21739                         ;;
21740                     *) avail_ext="$avail_ext $xxx" ;;
21741                     esac
21742                     ;;
21743                 esac
21744                 ;;
21745         ODBM_File|odbm_fil)
21746                 case "${i_dbm}${i_rpcsvcdbm}" in
21747                 *"${define}"*)
21748                     case "$d_cplusplus" in
21749                     define) ;; # delete as a function name will not work
21750                     *)  case "$osname-$use64bitint" in
21751                         hpux-define)
21752                             case "$libs" in
21753                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21754                             esac
21755                             ;;
21756                         *) avail_ext="$avail_ext $xxx" ;;
21757                         esac
21758                         ;;
21759                     esac
21760                     ;;
21761                 esac
21762                 ;;
21763         Opcode|opcode)
21764                 case "$useopcode" in
21765                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21766                 esac
21767                 ;;
21768         POSIX|posix)
21769                 case "$useposix" in
21770                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21771                 esac
21772                 ;;
21773         Socket|socket)
21774                 case "$d_socket" in
21775                 true|$define|y)
21776                     case "$osname" in
21777                     beos) ;; # not unless BONE
21778                     *) avail_ext="$avail_ext $xxx" ;;
21779                     esac
21780                     ;;
21781                 esac
21782                 ;;
21783         Sys/Syslog|sys/syslog)
21784                 : XXX syslog requires socket
21785                 case "$d_socket" in
21786                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21787                 esac
21788                 ;;
21789         Thread|thread)
21790                 case "$usethreads" in
21791                 true|$define|y)
21792                         case "$use5005threads" in
21793                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21794                         esac
21795                 esac
21796                 ;;
21797         threads|threads/shared)
21798                 # threads and threads::shared are special cases.
21799                 # To stop people from asking "Perl 5.8.0 was supposed
21800                 # to have this new fancy threads implementation but my
21801                 # perl doesn't have it" and from people trying to
21802                 # (re)install the threads module using CPAN.pm and
21803                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21804                 # the threads.pm and threads/shared.pm will always be
21805                 # there, croaking informatively ("you need to rebuild
21806                 # all of Perl with threads, sorry") when threads haven't
21807                 # been compiled in.
21808                 # --jhi
21809                 avail_ext="$avail_ext $xxx"
21810                 ;;
21811         VMS*)
21812                 ;;
21813         Win32*)
21814                 case "$osname" in
21815                 cygwin) avail_ext="$avail_ext $xxx" ;;
21816                 esac
21817                 ;;
21818         XS/APItest|xs/apitest)
21819                 # This is just for testing.  Skip it unless we have dynamic loading.
21820
21821                 case "$usedl" in
21822                 $define) avail_ext="$avail_ext $xxx" ;;
21823                 esac
21824                 ;;
21825         XS/Typemap|xs/typemap)
21826                 # This is just for testing.  Skip it unless we have dynamic loading.
21827                 case "$usedl" in
21828                 $define) avail_ext="$avail_ext $xxx" ;;
21829                 esac
21830                 ;;
21831         *)      avail_ext="$avail_ext $xxx"
21832                 ;;
21833         esac
21834 done
21835
21836 set X $avail_ext
21837 shift
21838 avail_ext="$*"
21839
21840 case "$onlyextensions" in
21841 '') ;;
21842 *)  keepextensions=''
21843     echo "You have requested that only certains extensions be included..." >&4
21844     for i in $onlyextensions; do
21845         case " $avail_ext " in
21846         *" $i "*)
21847             echo "Keeping extension $i."
21848             keepextensions="$keepextensions $i"
21849             ;;
21850         *) echo "Ignoring extension $i." ;;
21851         esac
21852     done
21853     avail_ext="$keepextensions"
21854     ;;
21855 esac
21856
21857 case "$noextensions" in
21858 '') ;;
21859 *)  keepextensions=''
21860     echo "You have requested that certain extensions be ignored..." >&4
21861     for i in $avail_ext; do
21862         case " $noextensions " in
21863         *" $i "*) echo "Ignoring extension $i." ;;
21864         *) echo "Keeping extension $i.";
21865            keepextensions="$keepextensions $i"
21866            ;;
21867         esac
21868     done
21869     avail_ext="$keepextensions"
21870     ;;
21871 esac
21872
21873 : Now see which nonxs extensions are supported on this system.
21874 : For now assume all are.
21875 nonxs_ext=''
21876 for xxx in $nonxs_extensions ; do
21877         case "$xxx" in
21878         *)      nonxs_ext="$nonxs_ext $xxx"
21879                 ;;
21880         esac
21881 done
21882
21883 set X $nonxs_ext
21884 shift
21885 nonxs_ext="$*"
21886
21887 case $usedl in
21888 $define)
21889         $cat <<EOM
21890 A number of extensions are supplied with $package.  You may choose to
21891 compile these extensions for dynamic loading (the default), compile
21892 them into the $package executable (static loading), or not include
21893 them at all.  Answer "none" to include no extensions.
21894 Note that DynaLoader is always built and need not be mentioned here.
21895
21896 EOM
21897         case "$dynamic_ext" in
21898         '')
21899                 : Exclude those listed in static_ext
21900                 dflt=''
21901                 for xxx in $avail_ext; do
21902                         case " $static_ext " in
21903                         *" $xxx "*) ;;
21904                         *) dflt="$dflt $xxx" ;;
21905                         esac
21906                 done
21907                 set X $dflt
21908                 shift
21909                 dflt="$*"
21910                 ;;
21911         *)      dflt="$dynamic_ext"
21912                 # Perhaps we are reusing an old out-of-date config.sh.
21913                 case "$hint" in
21914                 previous)
21915                         if test X"$dynamic_ext" != X"$avail_ext"; then
21916                                 $cat <<EOM
21917 NOTICE:  Your previous config.sh list may be incorrect.
21918 The extensions now available to you are
21919         ${avail_ext}
21920 but the default list from your previous config.sh is
21921         ${dynamic_ext}
21922
21923 EOM
21924                         fi
21925                         ;;
21926                 esac
21927                 ;;
21928         esac
21929         case "$dflt" in
21930         '')     dflt=none;;
21931         esac
21932         rp="What extensions do you wish to load dynamically?"
21933         . ./myread
21934         case "$ans" in
21935         none) dynamic_ext=' ' ;;
21936         *) dynamic_ext="$ans" ;;
21937         esac
21938
21939         case "$static_ext" in
21940         '')
21941                 : Exclude those already listed in dynamic linking
21942                 dflt=''
21943                 for xxx in $avail_ext; do
21944                         case " $dynamic_ext " in
21945                         *" $xxx "*) ;;
21946                         *) dflt="$dflt $xxx" ;;
21947                         esac
21948                 done
21949                 set X $dflt
21950                 shift
21951                 dflt="$*"
21952                 ;;
21953         *)  dflt="$static_ext"
21954                 ;;
21955         esac
21956
21957         case "$dflt" in
21958         '')     dflt=none;;
21959         esac
21960         rp="What extensions do you wish to load statically?"
21961         . ./myread
21962         case "$ans" in
21963         none) static_ext=' ' ;;
21964         *) static_ext="$ans" ;;
21965         esac
21966         ;;
21967 *)
21968         $cat <<EOM
21969 A number of extensions are supplied with $package.  Answer "none"
21970 to include no extensions.
21971 Note that DynaLoader is always built and need not be mentioned here.
21972
21973 EOM
21974         case "$static_ext" in
21975         '') dflt="$avail_ext" ;;
21976         *)      dflt="$static_ext"
21977                 # Perhaps we are reusing an old out-of-date config.sh.
21978                 case "$hint" in
21979                 previous)
21980                         if test X"$static_ext" != X"$avail_ext"; then
21981                                 $cat <<EOM
21982 NOTICE:  Your previous config.sh list may be incorrect.
21983 The extensions now available to you are
21984         ${avail_ext}
21985 but the default list from your previous config.sh is
21986         ${static_ext}
21987
21988 EOM
21989                         fi
21990                         ;;
21991                 esac
21992                 ;;
21993         esac
21994         : Exclude those that are not xs extensions
21995         case "$dflt" in
21996         '')     dflt=none;;
21997         esac
21998         rp="What extensions do you wish to include?"
21999         . ./myread
22000         case "$ans" in
22001         none) static_ext=' ' ;;
22002         *) static_ext="$ans" ;;
22003         esac
22004         ;;
22005 esac
22006 #
22007 # Encode is a special case.  If we are building Encode as a static
22008 # extension, we need to explicitly list its subextensions as well.
22009 # For other nested extensions, this is handled automatically by
22010 # the appropriate Makefile.PL.
22011 case " $static_ext " in
22012         *" Encode "*) # Add the subextensions of Encode
22013         cd "$rsrc/ext"
22014         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22015                 static_ext="$static_ext Encode/$xxx"
22016         done
22017         cd "$tdir"
22018         ;;
22019 esac
22020
22021 set X $dynamic_ext $static_ext $nonxs_ext
22022 shift
22023 extensions="$*"
22024
22025 # Sanity check:  We require an extension suitable for use with
22026 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22027 # should show up as failures in the test suite, but it's helpful to
22028 # catch them now.) The 'extensions' list is normally sorted
22029 # alphabetically, so we need to accept either
22030 #    DB_File ... Fcntl ... IO  ....
22031 # or something like
22032 #    Fcntl ... NDBM_File ... IO  ....
22033 case " $extensions"  in
22034 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22035 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22036 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22037 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22038    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22039    ;;
22040 esac
22041
22042 : Remove libraries needed only for extensions
22043 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22044 : The exception is SunOS 4.x, which needs them.
22045 case "${osname}X${osvers}" in
22046 sunos*X4*)
22047     perllibs="$libs"
22048     ;;
22049 *) case "$usedl" in
22050     $define|true|[yY]*)
22051             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22052             shift
22053             perllibs="$*"
22054             ;;
22055     *)  perllibs="$libs"
22056             ;;
22057     esac
22058     ;;
22059 esac
22060
22061 : Remove build directory name from cppstdin so it can be used from
22062 : either the present location or the final installed location.
22063 echo " "
22064 : Get out of the UU directory to get correct path name.
22065 cd ..
22066 case "$cppstdin" in
22067 `pwd`/cppstdin)
22068         echo "Stripping down cppstdin path name"
22069         cppstdin=cppstdin
22070         ;;
22071 esac
22072 cd UU
22073
22074 : end of configuration questions
22075 echo " "
22076 echo "End of configuration questions."
22077 echo " "
22078
22079 : back to where it started
22080 if test -d ../UU; then
22081         cd ..
22082 fi
22083
22084 : configuration may be unconditionally patched via a 'config.arch' file
22085 if $test -f config.arch; then
22086         echo "I see a config.arch file, loading it." >&4
22087         . ./config.arch
22088 fi
22089
22090 : configuration may be patched via a 'config.over' file
22091 if $test -f config.over; then
22092         echo " "
22093         dflt=y
22094         rp='I see a config.over file.  Do you wish to load it?'
22095         . UU/myread
22096         case "$ans" in
22097         n*) echo "OK, I'll ignore it.";;
22098         *)      . ./config.over
22099                 echo "Configuration override changes have been loaded."
22100                 ;;
22101         esac
22102 fi
22103
22104 : in case they want portability, strip down executable paths
22105 case "$d_portable" in
22106 "$define")
22107         echo " "
22108         echo "Stripping down executable paths..." >&4
22109         for file in $loclist $trylist; do
22110                 eval temp=\$$file
22111                 eval $file=`basename $temp`
22112         done
22113         ;;
22114 esac
22115
22116 : create config.sh file
22117 echo " "
22118 echo "Creating config.sh..." >&4
22119 $spitshell <<EOT >config.sh
22120 $startsh
22121 #
22122 # This file was produced by running the Configure script. It holds all the
22123 # definitions figured out by Configure. Should you modify one of these values,
22124 # do not forget to propagate your changes by running "Configure -der". You may
22125 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22126 #
22127
22128 # Package name      : $package
22129 # Source directory  : $src
22130 # Configuration time: $cf_time
22131 # Configured by     : $cf_by
22132 # Target system     : $myuname
22133
22134 EOT
22135 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22136 $spitshell <<EOT >>config.sh
22137
22138 Author='$Author'
22139 Date='$Date'
22140 Header='$Header'
22141 Id='$Id'
22142 Locker='$Locker'
22143 Log='$Log'
22144 RCSfile='$RCSfile'
22145 Revision='$Revision'
22146 Source='$Source'
22147 State='$State'
22148 _a='$_a'
22149 _exe='$_exe'
22150 _o='$_o'
22151 afs='$afs'
22152 afsroot='$afsroot'
22153 alignbytes='$alignbytes'
22154 ansi2knr='$ansi2knr'
22155 aphostname='$aphostname'
22156 api_revision='$api_revision'
22157 api_subversion='$api_subversion'
22158 api_version='$api_version'
22159 api_versionstring='$api_versionstring'
22160 ar='$ar'
22161 archlib='$archlib'
22162 archlibexp='$archlibexp'
22163 archname64='$archname64'
22164 archname='$archname'
22165 archobjs='$archobjs'
22166 asctime_r_proto='$asctime_r_proto'
22167 awk='$awk'
22168 baserev='$baserev'
22169 bash='$bash'
22170 bin='$bin'
22171 bin_ELF='$bin_ELF'
22172 binexp='$binexp'
22173 bison='$bison'
22174 byacc='$byacc'
22175 byteorder='$byteorder'
22176 c='$c'
22177 castflags='$castflags'
22178 cat='$cat'
22179 cc='$cc'
22180 cccdlflags='$cccdlflags'
22181 ccdlflags='$ccdlflags'
22182 ccflags='$ccflags'
22183 ccflags_uselargefiles='$ccflags_uselargefiles'
22184 ccname='$ccname'
22185 ccsymbols='$ccsymbols'
22186 ccversion='$ccversion'
22187 cf_by='$cf_by'
22188 cf_email='$cf_email'
22189 cf_time='$cf_time'
22190 chgrp='$chgrp'
22191 chmod='$chmod'
22192 chown='$chown'
22193 clocktype='$clocktype'
22194 comm='$comm'
22195 compress='$compress'
22196 contains='$contains'
22197 cp='$cp'
22198 cpio='$cpio'
22199 cpp='$cpp'
22200 cpp_stuff='$cpp_stuff'
22201 cppccsymbols='$cppccsymbols'
22202 cppflags='$cppflags'
22203 cpplast='$cpplast'
22204 cppminus='$cppminus'
22205 cpprun='$cpprun'
22206 cppstdin='$cppstdin'
22207 cppsymbols='$cppsymbols'
22208 crypt_r_proto='$crypt_r_proto'
22209 cryptlib='$cryptlib'
22210 csh='$csh'
22211 ctermid_r_proto='$ctermid_r_proto'
22212 ctime_r_proto='$ctime_r_proto'
22213 d_Gconvert='$d_Gconvert'
22214 d_PRIEUldbl='$d_PRIEUldbl'
22215 d_PRIFUldbl='$d_PRIFUldbl'
22216 d_PRIGUldbl='$d_PRIGUldbl'
22217 d_PRIXU64='$d_PRIXU64'
22218 d_PRId64='$d_PRId64'
22219 d_PRIeldbl='$d_PRIeldbl'
22220 d_PRIfldbl='$d_PRIfldbl'
22221 d_PRIgldbl='$d_PRIgldbl'
22222 d_PRIi64='$d_PRIi64'
22223 d_PRIo64='$d_PRIo64'
22224 d_PRIu64='$d_PRIu64'
22225 d_PRIx64='$d_PRIx64'
22226 d_SCNfldbl='$d_SCNfldbl'
22227 d__fwalk='$d__fwalk'
22228 d_access='$d_access'
22229 d_accessx='$d_accessx'
22230 d_aintl='$d_aintl'
22231 d_alarm='$d_alarm'
22232 d_archlib='$d_archlib'
22233 d_asctime64='$d_asctime64'
22234 d_asctime_r='$d_asctime_r'
22235 d_atolf='$d_atolf'
22236 d_atoll='$d_atoll'
22237 d_attribute_deprecated='$d_attribute_deprecated'
22238 d_attribute_format='$d_attribute_format'
22239 d_attribute_malloc='$d_attribute_malloc'
22240 d_attribute_nonnull='$d_attribute_nonnull'
22241 d_attribute_noreturn='$d_attribute_noreturn'
22242 d_attribute_pure='$d_attribute_pure'
22243 d_attribute_unused='$d_attribute_unused'
22244 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22245 d_bcmp='$d_bcmp'
22246 d_bcopy='$d_bcopy'
22247 d_bsd='$d_bsd'
22248 d_bsdgetpgrp='$d_bsdgetpgrp'
22249 d_bsdsetpgrp='$d_bsdsetpgrp'
22250 d_builtin_choose_expr='$d_builtin_choose_expr'
22251 d_builtin_expect='$d_builtin_expect'
22252 d_bzero='$d_bzero'
22253 d_c99_variadic_macros='$d_c99_variadic_macros'
22254 d_casti32='$d_casti32'
22255 d_castneg='$d_castneg'
22256 d_charvspr='$d_charvspr'
22257 d_chown='$d_chown'
22258 d_chroot='$d_chroot'
22259 d_chsize='$d_chsize'
22260 d_class='$d_class'
22261 d_clearenv='$d_clearenv'
22262 d_closedir='$d_closedir'
22263 d_cmsghdr_s='$d_cmsghdr_s'
22264 d_const='$d_const'
22265 d_copysignl='$d_copysignl'
22266 d_cplusplus='$d_cplusplus'
22267 d_crypt='$d_crypt'
22268 d_crypt_r='$d_crypt_r'
22269 d_csh='$d_csh'
22270 d_ctermid='$d_ctermid'
22271 d_ctermid_r='$d_ctermid_r'
22272 d_ctime64='$d_ctime64'
22273 d_ctime_r='$d_ctime_r'
22274 d_cuserid='$d_cuserid'
22275 d_dbl_dig='$d_dbl_dig'
22276 d_dbminitproto='$d_dbminitproto'
22277 d_difftime64='$d_difftime64'
22278 d_difftime='$d_difftime'
22279 d_dir_dd_fd='$d_dir_dd_fd'
22280 d_dirfd='$d_dirfd'
22281 d_dirnamlen='$d_dirnamlen'
22282 d_dlerror='$d_dlerror'
22283 d_dlopen='$d_dlopen'
22284 d_dlsymun='$d_dlsymun'
22285 d_dosuid='$d_dosuid'
22286 d_drand48_r='$d_drand48_r'
22287 d_drand48proto='$d_drand48proto'
22288 d_dup2='$d_dup2'
22289 d_eaccess='$d_eaccess'
22290 d_endgrent='$d_endgrent'
22291 d_endgrent_r='$d_endgrent_r'
22292 d_endhent='$d_endhent'
22293 d_endhostent_r='$d_endhostent_r'
22294 d_endnent='$d_endnent'
22295 d_endnetent_r='$d_endnetent_r'
22296 d_endpent='$d_endpent'
22297 d_endprotoent_r='$d_endprotoent_r'
22298 d_endpwent='$d_endpwent'
22299 d_endpwent_r='$d_endpwent_r'
22300 d_endsent='$d_endsent'
22301 d_endservent_r='$d_endservent_r'
22302 d_eofnblk='$d_eofnblk'
22303 d_eunice='$d_eunice'
22304 d_faststdio='$d_faststdio'
22305 d_fchdir='$d_fchdir'
22306 d_fchmod='$d_fchmod'
22307 d_fchown='$d_fchown'
22308 d_fcntl='$d_fcntl'
22309 d_fcntl_can_lock='$d_fcntl_can_lock'
22310 d_fd_macros='$d_fd_macros'
22311 d_fd_set='$d_fd_set'
22312 d_fds_bits='$d_fds_bits'
22313 d_fgetpos='$d_fgetpos'
22314 d_finite='$d_finite'
22315 d_finitel='$d_finitel'
22316 d_flexfnam='$d_flexfnam'
22317 d_flock='$d_flock'
22318 d_flockproto='$d_flockproto'
22319 d_fork='$d_fork'
22320 d_fp_class='$d_fp_class'
22321 d_fpathconf='$d_fpathconf'
22322 d_fpclass='$d_fpclass'
22323 d_fpclassify='$d_fpclassify'
22324 d_fpclassl='$d_fpclassl'
22325 d_fpos64_t='$d_fpos64_t'
22326 d_frexpl='$d_frexpl'
22327 d_fs_data_s='$d_fs_data_s'
22328 d_fseeko='$d_fseeko'
22329 d_fsetpos='$d_fsetpos'
22330 d_fstatfs='$d_fstatfs'
22331 d_fstatvfs='$d_fstatvfs'
22332 d_fsync='$d_fsync'
22333 d_ftello='$d_ftello'
22334 d_ftime='$d_ftime'
22335 d_futimes='$d_futimes'
22336 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22337 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22338 d_getaddrinfo='$d_getaddrinfo'
22339 d_getcwd='$d_getcwd'
22340 d_getespwnam='$d_getespwnam'
22341 d_getfsstat='$d_getfsstat'
22342 d_getgrent='$d_getgrent'
22343 d_getgrent_r='$d_getgrent_r'
22344 d_getgrgid_r='$d_getgrgid_r'
22345 d_getgrnam_r='$d_getgrnam_r'
22346 d_getgrps='$d_getgrps'
22347 d_gethbyaddr='$d_gethbyaddr'
22348 d_gethbyname='$d_gethbyname'
22349 d_gethent='$d_gethent'
22350 d_gethname='$d_gethname'
22351 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22352 d_gethostbyname_r='$d_gethostbyname_r'
22353 d_gethostent_r='$d_gethostent_r'
22354 d_gethostprotos='$d_gethostprotos'
22355 d_getitimer='$d_getitimer'
22356 d_getlogin='$d_getlogin'
22357 d_getlogin_r='$d_getlogin_r'
22358 d_getmnt='$d_getmnt'
22359 d_getmntent='$d_getmntent'
22360 d_getnameinfo='$d_getnameinfo'
22361 d_getnbyaddr='$d_getnbyaddr'
22362 d_getnbyname='$d_getnbyname'
22363 d_getnent='$d_getnent'
22364 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22365 d_getnetbyname_r='$d_getnetbyname_r'
22366 d_getnetent_r='$d_getnetent_r'
22367 d_getnetprotos='$d_getnetprotos'
22368 d_getpagsz='$d_getpagsz'
22369 d_getpbyname='$d_getpbyname'
22370 d_getpbynumber='$d_getpbynumber'
22371 d_getpent='$d_getpent'
22372 d_getpgid='$d_getpgid'
22373 d_getpgrp2='$d_getpgrp2'
22374 d_getpgrp='$d_getpgrp'
22375 d_getppid='$d_getppid'
22376 d_getprior='$d_getprior'
22377 d_getprotobyname_r='$d_getprotobyname_r'
22378 d_getprotobynumber_r='$d_getprotobynumber_r'
22379 d_getprotoent_r='$d_getprotoent_r'
22380 d_getprotoprotos='$d_getprotoprotos'
22381 d_getprpwnam='$d_getprpwnam'
22382 d_getpwent='$d_getpwent'
22383 d_getpwent_r='$d_getpwent_r'
22384 d_getpwnam_r='$d_getpwnam_r'
22385 d_getpwuid_r='$d_getpwuid_r'
22386 d_getsbyname='$d_getsbyname'
22387 d_getsbyport='$d_getsbyport'
22388 d_getsent='$d_getsent'
22389 d_getservbyname_r='$d_getservbyname_r'
22390 d_getservbyport_r='$d_getservbyport_r'
22391 d_getservent_r='$d_getservent_r'
22392 d_getservprotos='$d_getservprotos'
22393 d_getspnam='$d_getspnam'
22394 d_getspnam_r='$d_getspnam_r'
22395 d_gettimeod='$d_gettimeod'
22396 d_gmtime64='$d_gmtime64'
22397 d_gmtime_r='$d_gmtime_r'
22398 d_gnulibc='$d_gnulibc'
22399 d_grpasswd='$d_grpasswd'
22400 d_hasmntopt='$d_hasmntopt'
22401 d_htonl='$d_htonl'
22402 d_ilogbl='$d_ilogbl'
22403 d_inc_version_list='$d_inc_version_list'
22404 d_index='$d_index'
22405 d_inetaton='$d_inetaton'
22406 d_inetntop='$d_inetntop'
22407 d_inetpton='$d_inetpton'
22408 d_int64_t='$d_int64_t'
22409 d_isascii='$d_isascii'
22410 d_isfinite='$d_isfinite'
22411 d_isinf='$d_isinf'
22412 d_isnan='$d_isnan'
22413 d_isnanl='$d_isnanl'
22414 d_killpg='$d_killpg'
22415 d_lchown='$d_lchown'
22416 d_ldbl_dig='$d_ldbl_dig'
22417 d_libm_lib_version='$d_libm_lib_version'
22418 d_link='$d_link'
22419 d_localtime64='$d_localtime64'
22420 d_localtime_r='$d_localtime_r'
22421 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22422 d_locconv='$d_locconv'
22423 d_lockf='$d_lockf'
22424 d_longdbl='$d_longdbl'
22425 d_longlong='$d_longlong'
22426 d_lseekproto='$d_lseekproto'
22427 d_lstat='$d_lstat'
22428 d_madvise='$d_madvise'
22429 d_malloc_good_size='$d_malloc_good_size'
22430 d_malloc_size='$d_malloc_size'
22431 d_mblen='$d_mblen'
22432 d_mbstowcs='$d_mbstowcs'
22433 d_mbtowc='$d_mbtowc'
22434 d_memchr='$d_memchr'
22435 d_memcmp='$d_memcmp'
22436 d_memcpy='$d_memcpy'
22437 d_memmove='$d_memmove'
22438 d_memset='$d_memset'
22439 d_mkdir='$d_mkdir'
22440 d_mkdtemp='$d_mkdtemp'
22441 d_mkfifo='$d_mkfifo'
22442 d_mkstemp='$d_mkstemp'
22443 d_mkstemps='$d_mkstemps'
22444 d_mktime64='$d_mktime64'
22445 d_mktime='$d_mktime'
22446 d_mmap='$d_mmap'
22447 d_modfl='$d_modfl'
22448 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22449 d_modflproto='$d_modflproto'
22450 d_mprotect='$d_mprotect'
22451 d_msg='$d_msg'
22452 d_msg_ctrunc='$d_msg_ctrunc'
22453 d_msg_dontroute='$d_msg_dontroute'
22454 d_msg_oob='$d_msg_oob'
22455 d_msg_peek='$d_msg_peek'
22456 d_msg_proxy='$d_msg_proxy'
22457 d_msgctl='$d_msgctl'
22458 d_msgget='$d_msgget'
22459 d_msghdr_s='$d_msghdr_s'
22460 d_msgrcv='$d_msgrcv'
22461 d_msgsnd='$d_msgsnd'
22462 d_msync='$d_msync'
22463 d_munmap='$d_munmap'
22464 d_mymalloc='$d_mymalloc'
22465 d_ndbm='$d_ndbm'
22466 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22467 d_nice='$d_nice'
22468 d_nl_langinfo='$d_nl_langinfo'
22469 d_nv_preserves_uv='$d_nv_preserves_uv'
22470 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22471 d_off64_t='$d_off64_t'
22472 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22473 d_oldpthreads='$d_oldpthreads'
22474 d_oldsock='$d_oldsock'
22475 d_open3='$d_open3'
22476 d_pathconf='$d_pathconf'
22477 d_pause='$d_pause'
22478 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22479 d_phostname='$d_phostname'
22480 d_pipe='$d_pipe'
22481 d_poll='$d_poll'
22482 d_portable='$d_portable'
22483 d_printf_format_null='$d_printf_format_null'
22484 d_procselfexe='$d_procselfexe'
22485 d_pseudofork='$d_pseudofork'
22486 d_pthread_atfork='$d_pthread_atfork'
22487 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22488 d_pthread_yield='$d_pthread_yield'
22489 d_pwage='$d_pwage'
22490 d_pwchange='$d_pwchange'
22491 d_pwclass='$d_pwclass'
22492 d_pwcomment='$d_pwcomment'
22493 d_pwexpire='$d_pwexpire'
22494 d_pwgecos='$d_pwgecos'
22495 d_pwpasswd='$d_pwpasswd'
22496 d_pwquota='$d_pwquota'
22497 d_qgcvt='$d_qgcvt'
22498 d_quad='$d_quad'
22499 d_random_r='$d_random_r'
22500 d_readdir64_r='$d_readdir64_r'
22501 d_readdir='$d_readdir'
22502 d_readdir_r='$d_readdir_r'
22503 d_readlink='$d_readlink'
22504 d_readv='$d_readv'
22505 d_recvmsg='$d_recvmsg'
22506 d_rename='$d_rename'
22507 d_rewinddir='$d_rewinddir'
22508 d_rmdir='$d_rmdir'
22509 d_safebcpy='$d_safebcpy'
22510 d_safemcpy='$d_safemcpy'
22511 d_sanemcmp='$d_sanemcmp'
22512 d_sbrkproto='$d_sbrkproto'
22513 d_scalbnl='$d_scalbnl'
22514 d_sched_yield='$d_sched_yield'
22515 d_scm_rights='$d_scm_rights'
22516 d_seekdir='$d_seekdir'
22517 d_select='$d_select'
22518 d_sem='$d_sem'
22519 d_semctl='$d_semctl'
22520 d_semctl_semid_ds='$d_semctl_semid_ds'
22521 d_semctl_semun='$d_semctl_semun'
22522 d_semget='$d_semget'
22523 d_semop='$d_semop'
22524 d_sendmsg='$d_sendmsg'
22525 d_setegid='$d_setegid'
22526 d_seteuid='$d_seteuid'
22527 d_setgrent='$d_setgrent'
22528 d_setgrent_r='$d_setgrent_r'
22529 d_setgrps='$d_setgrps'
22530 d_sethent='$d_sethent'
22531 d_sethostent_r='$d_sethostent_r'
22532 d_setitimer='$d_setitimer'
22533 d_setlinebuf='$d_setlinebuf'
22534 d_setlocale='$d_setlocale'
22535 d_setlocale_r='$d_setlocale_r'
22536 d_setnent='$d_setnent'
22537 d_setnetent_r='$d_setnetent_r'
22538 d_setpent='$d_setpent'
22539 d_setpgid='$d_setpgid'
22540 d_setpgrp2='$d_setpgrp2'
22541 d_setpgrp='$d_setpgrp'
22542 d_setprior='$d_setprior'
22543 d_setproctitle='$d_setproctitle'
22544 d_setprotoent_r='$d_setprotoent_r'
22545 d_setpwent='$d_setpwent'
22546 d_setpwent_r='$d_setpwent_r'
22547 d_setregid='$d_setregid'
22548 d_setresgid='$d_setresgid'
22549 d_setresuid='$d_setresuid'
22550 d_setreuid='$d_setreuid'
22551 d_setrgid='$d_setrgid'
22552 d_setruid='$d_setruid'
22553 d_setsent='$d_setsent'
22554 d_setservent_r='$d_setservent_r'
22555 d_setsid='$d_setsid'
22556 d_setvbuf='$d_setvbuf'
22557 d_sfio='$d_sfio'
22558 d_shm='$d_shm'
22559 d_shmat='$d_shmat'
22560 d_shmatprototype='$d_shmatprototype'
22561 d_shmctl='$d_shmctl'
22562 d_shmdt='$d_shmdt'
22563 d_shmget='$d_shmget'
22564 d_sigaction='$d_sigaction'
22565 d_signbit='$d_signbit'
22566 d_sigprocmask='$d_sigprocmask'
22567 d_sigsetjmp='$d_sigsetjmp'
22568 d_sitearch='$d_sitearch'
22569 d_snprintf='$d_snprintf'
22570 d_sockatmark='$d_sockatmark'
22571 d_sockatmarkproto='$d_sockatmarkproto'
22572 d_socket='$d_socket'
22573 d_socklen_t='$d_socklen_t'
22574 d_sockpair='$d_sockpair'
22575 d_socks5_init='$d_socks5_init'
22576 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22577 d_sqrtl='$d_sqrtl'
22578 d_srand48_r='$d_srand48_r'
22579 d_srandom_r='$d_srandom_r'
22580 d_sresgproto='$d_sresgproto'
22581 d_sresuproto='$d_sresuproto'
22582 d_statblks='$d_statblks'
22583 d_statfs_f_flags='$d_statfs_f_flags'
22584 d_statfs_s='$d_statfs_s'
22585 d_statvfs='$d_statvfs'
22586 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22587 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22588 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22589 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22590 d_stdio_stream_array='$d_stdio_stream_array'
22591 d_stdiobase='$d_stdiobase'
22592 d_stdstdio='$d_stdstdio'
22593 d_strchr='$d_strchr'
22594 d_strcoll='$d_strcoll'
22595 d_strctcpy='$d_strctcpy'
22596 d_strerrm='$d_strerrm'
22597 d_strerror='$d_strerror'
22598 d_strerror_r='$d_strerror_r'
22599 d_strftime='$d_strftime'
22600 d_strlcat='$d_strlcat'
22601 d_strlcpy='$d_strlcpy'
22602 d_strtod='$d_strtod'
22603 d_strtol='$d_strtol'
22604 d_strtold='$d_strtold'
22605 d_strtoll='$d_strtoll'
22606 d_strtoq='$d_strtoq'
22607 d_strtoul='$d_strtoul'
22608 d_strtoull='$d_strtoull'
22609 d_strtouq='$d_strtouq'
22610 d_strxfrm='$d_strxfrm'
22611 d_suidsafe='$d_suidsafe'
22612 d_symlink='$d_symlink'
22613 d_syscall='$d_syscall'
22614 d_syscallproto='$d_syscallproto'
22615 d_sysconf='$d_sysconf'
22616 d_sysernlst='$d_sysernlst'
22617 d_syserrlst='$d_syserrlst'
22618 d_system='$d_system'
22619 d_tcgetpgrp='$d_tcgetpgrp'
22620 d_tcsetpgrp='$d_tcsetpgrp'
22621 d_telldir='$d_telldir'
22622 d_telldirproto='$d_telldirproto'
22623 d_time='$d_time'
22624 d_timegm='$d_timegm'
22625 d_times='$d_times'
22626 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22627 d_tm_tm_zone='$d_tm_tm_zone'
22628 d_tmpnam_r='$d_tmpnam_r'
22629 d_truncate='$d_truncate'
22630 d_ttyname_r='$d_ttyname_r'
22631 d_tzname='$d_tzname'
22632 d_u32align='$d_u32align'
22633 d_ualarm='$d_ualarm'
22634 d_umask='$d_umask'
22635 d_uname='$d_uname'
22636 d_union_semun='$d_union_semun'
22637 d_unordered='$d_unordered'
22638 d_unsetenv='$d_unsetenv'
22639 d_usleep='$d_usleep'
22640 d_usleepproto='$d_usleepproto'
22641 d_ustat='$d_ustat'
22642 d_vendorarch='$d_vendorarch'
22643 d_vendorbin='$d_vendorbin'
22644 d_vendorlib='$d_vendorlib'
22645 d_vendorscript='$d_vendorscript'
22646 d_vfork='$d_vfork'
22647 d_void_closedir='$d_void_closedir'
22648 d_voidsig='$d_voidsig'
22649 d_voidtty='$d_voidtty'
22650 d_volatile='$d_volatile'
22651 d_vprintf='$d_vprintf'
22652 d_vsnprintf='$d_vsnprintf'
22653 d_wait4='$d_wait4'
22654 d_waitpid='$d_waitpid'
22655 d_wcstombs='$d_wcstombs'
22656 d_wctomb='$d_wctomb'
22657 d_writev='$d_writev'
22658 d_xenix='$d_xenix'
22659 date='$date'
22660 db_hashtype='$db_hashtype'
22661 db_prefixtype='$db_prefixtype'
22662 db_version_major='$db_version_major'
22663 db_version_minor='$db_version_minor'
22664 db_version_patch='$db_version_patch'
22665 defvoidused='$defvoidused'
22666 direntrytype='$direntrytype'
22667 dlext='$dlext'
22668 dlsrc='$dlsrc'
22669 doublesize='$doublesize'
22670 drand01='$drand01'
22671 drand48_r_proto='$drand48_r_proto'
22672 dtrace='$dtrace'
22673 dynamic_ext='$dynamic_ext'
22674 eagain='$eagain'
22675 ebcdic='$ebcdic'
22676 echo='$echo'
22677 egrep='$egrep'
22678 emacs='$emacs'
22679 endgrent_r_proto='$endgrent_r_proto'
22680 endhostent_r_proto='$endhostent_r_proto'
22681 endnetent_r_proto='$endnetent_r_proto'
22682 endprotoent_r_proto='$endprotoent_r_proto'
22683 endpwent_r_proto='$endpwent_r_proto'
22684 endservent_r_proto='$endservent_r_proto'
22685 eunicefix='$eunicefix'
22686 exe_ext='$exe_ext'
22687 expr='$expr'
22688 extensions='$extensions'
22689 extern_C='$extern_C'
22690 extras='$extras'
22691 fflushNULL='$fflushNULL'
22692 fflushall='$fflushall'
22693 find='$find'
22694 firstmakefile='$firstmakefile'
22695 flex='$flex'
22696 fpossize='$fpossize'
22697 fpostype='$fpostype'
22698 freetype='$freetype'
22699 from='$from'
22700 full_ar='$full_ar'
22701 full_csh='$full_csh'
22702 full_sed='$full_sed'
22703 gccansipedantic='$gccansipedantic'
22704 gccosandvers='$gccosandvers'
22705 gccversion='$gccversion'
22706 getgrent_r_proto='$getgrent_r_proto'
22707 getgrgid_r_proto='$getgrgid_r_proto'
22708 getgrnam_r_proto='$getgrnam_r_proto'
22709 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22710 gethostbyname_r_proto='$gethostbyname_r_proto'
22711 gethostent_r_proto='$gethostent_r_proto'
22712 getlogin_r_proto='$getlogin_r_proto'
22713 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22714 getnetbyname_r_proto='$getnetbyname_r_proto'
22715 getnetent_r_proto='$getnetent_r_proto'
22716 getprotobyname_r_proto='$getprotobyname_r_proto'
22717 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22718 getprotoent_r_proto='$getprotoent_r_proto'
22719 getpwent_r_proto='$getpwent_r_proto'
22720 getpwnam_r_proto='$getpwnam_r_proto'
22721 getpwuid_r_proto='$getpwuid_r_proto'
22722 getservbyname_r_proto='$getservbyname_r_proto'
22723 getservbyport_r_proto='$getservbyport_r_proto'
22724 getservent_r_proto='$getservent_r_proto'
22725 getspnam_r_proto='$getspnam_r_proto'
22726 gidformat='$gidformat'
22727 gidsign='$gidsign'
22728 gidsize='$gidsize'
22729 gidtype='$gidtype'
22730 glibpth='$glibpth'
22731 gmake='$gmake'
22732 gmtime_r_proto='$gmtime_r_proto'
22733 gnulibc_version='$gnulibc_version'
22734 grep='$grep'
22735 groupcat='$groupcat'
22736 groupstype='$groupstype'
22737 gzip='$gzip'
22738 h_fcntl='$h_fcntl'
22739 h_sysfile='$h_sysfile'
22740 hint='$hint'
22741 hostcat='$hostcat'
22742 html1dir='$html1dir'
22743 html1direxp='$html1direxp'
22744 html3dir='$html3dir'
22745 html3direxp='$html3direxp'
22746 i16size='$i16size'
22747 i16type='$i16type'
22748 i32size='$i32size'
22749 i32type='$i32type'
22750 i64size='$i64size'
22751 i64type='$i64type'
22752 i8size='$i8size'
22753 i8type='$i8type'
22754 i_arpainet='$i_arpainet'
22755 i_assert='$i_assert'
22756 i_bsdioctl='$i_bsdioctl'
22757 i_crypt='$i_crypt'
22758 i_db='$i_db'
22759 i_dbm='$i_dbm'
22760 i_dirent='$i_dirent'
22761 i_dld='$i_dld'
22762 i_dlfcn='$i_dlfcn'
22763 i_fcntl='$i_fcntl'
22764 i_float='$i_float'
22765 i_fp='$i_fp'
22766 i_fp_class='$i_fp_class'
22767 i_gdbm='$i_gdbm'
22768 i_gdbm_ndbm='$i_gdbm_ndbm'
22769 i_gdbmndbm='$i_gdbmndbm'
22770 i_grp='$i_grp'
22771 i_ieeefp='$i_ieeefp'
22772 i_inttypes='$i_inttypes'
22773 i_langinfo='$i_langinfo'
22774 i_libutil='$i_libutil'
22775 i_limits='$i_limits'
22776 i_locale='$i_locale'
22777 i_machcthr='$i_machcthr'
22778 i_malloc='$i_malloc'
22779 i_mallocmalloc='$i_mallocmalloc'
22780 i_math='$i_math'
22781 i_memory='$i_memory'
22782 i_mntent='$i_mntent'
22783 i_ndbm='$i_ndbm'
22784 i_netdb='$i_netdb'
22785 i_neterrno='$i_neterrno'
22786 i_netinettcp='$i_netinettcp'
22787 i_niin='$i_niin'
22788 i_poll='$i_poll'
22789 i_prot='$i_prot'
22790 i_pthread='$i_pthread'
22791 i_pwd='$i_pwd'
22792 i_rpcsvcdbm='$i_rpcsvcdbm'
22793 i_sfio='$i_sfio'
22794 i_sgtty='$i_sgtty'
22795 i_shadow='$i_shadow'
22796 i_socks='$i_socks'
22797 i_stdarg='$i_stdarg'
22798 i_stddef='$i_stddef'
22799 i_stdlib='$i_stdlib'
22800 i_string='$i_string'
22801 i_sunmath='$i_sunmath'
22802 i_sysaccess='$i_sysaccess'
22803 i_sysdir='$i_sysdir'
22804 i_sysfile='$i_sysfile'
22805 i_sysfilio='$i_sysfilio'
22806 i_sysin='$i_sysin'
22807 i_sysioctl='$i_sysioctl'
22808 i_syslog='$i_syslog'
22809 i_sysmman='$i_sysmman'
22810 i_sysmode='$i_sysmode'
22811 i_sysmount='$i_sysmount'
22812 i_sysndir='$i_sysndir'
22813 i_sysparam='$i_sysparam'
22814 i_syspoll='$i_syspoll'
22815 i_sysresrc='$i_sysresrc'
22816 i_syssecrt='$i_syssecrt'
22817 i_sysselct='$i_sysselct'
22818 i_syssockio='$i_syssockio'
22819 i_sysstat='$i_sysstat'
22820 i_sysstatfs='$i_sysstatfs'
22821 i_sysstatvfs='$i_sysstatvfs'
22822 i_systime='$i_systime'
22823 i_systimek='$i_systimek'
22824 i_systimes='$i_systimes'
22825 i_systypes='$i_systypes'
22826 i_sysuio='$i_sysuio'
22827 i_sysun='$i_sysun'
22828 i_sysutsname='$i_sysutsname'
22829 i_sysvfs='$i_sysvfs'
22830 i_syswait='$i_syswait'
22831 i_termio='$i_termio'
22832 i_termios='$i_termios'
22833 i_time='$i_time'
22834 i_unistd='$i_unistd'
22835 i_ustat='$i_ustat'
22836 i_utime='$i_utime'
22837 i_values='$i_values'
22838 i_varargs='$i_varargs'
22839 i_varhdr='$i_varhdr'
22840 i_vfork='$i_vfork'
22841 ignore_versioned_solibs='$ignore_versioned_solibs'
22842 inc_version_list='$inc_version_list'
22843 inc_version_list_init='$inc_version_list_init'
22844 incpath='$incpath'
22845 inews='$inews'
22846 initialinstalllocation='$initialinstalllocation'
22847 installarchlib='$installarchlib'
22848 installbin='$installbin'
22849 installhtml1dir='$installhtml1dir'
22850 installhtml3dir='$installhtml3dir'
22851 installman1dir='$installman1dir'
22852 installman3dir='$installman3dir'
22853 installprefix='$installprefix'
22854 installprefixexp='$installprefixexp'
22855 installprivlib='$installprivlib'
22856 installscript='$installscript'
22857 installsitearch='$installsitearch'
22858 installsitebin='$installsitebin'
22859 installsitehtml1dir='$installsitehtml1dir'
22860 installsitehtml3dir='$installsitehtml3dir'
22861 installsitelib='$installsitelib'
22862 installsiteman1dir='$installsiteman1dir'
22863 installsiteman3dir='$installsiteman3dir'
22864 installsitescript='$installsitescript'
22865 installstyle='$installstyle'
22866 installusrbinperl='$installusrbinperl'
22867 installvendorarch='$installvendorarch'
22868 installvendorbin='$installvendorbin'
22869 installvendorhtml1dir='$installvendorhtml1dir'
22870 installvendorhtml3dir='$installvendorhtml3dir'
22871 installvendorlib='$installvendorlib'
22872 installvendorman1dir='$installvendorman1dir'
22873 installvendorman3dir='$installvendorman3dir'
22874 installvendorscript='$installvendorscript'
22875 intsize='$intsize'
22876 issymlink='$issymlink'
22877 ivdformat='$ivdformat'
22878 ivsize='$ivsize'
22879 ivtype='$ivtype'
22880 known_extensions='$known_extensions'
22881 ksh='$ksh'
22882 ld='$ld'
22883 lddlflags='$lddlflags'
22884 ldflags='$ldflags'
22885 ldflags_uselargefiles='$ldflags_uselargefiles'
22886 ldlibpthname='$ldlibpthname'
22887 less='$less'
22888 lib_ext='$lib_ext'
22889 libc='$libc'
22890 libperl='$libperl'
22891 libpth='$libpth'
22892 libs='$libs'
22893 libsdirs='$libsdirs'
22894 libsfiles='$libsfiles'
22895 libsfound='$libsfound'
22896 libspath='$libspath'
22897 libswanted='$libswanted'
22898 libswanted_uselargefiles='$libswanted_uselargefiles'
22899 line='$line'
22900 lint='$lint'
22901 lkflags='$lkflags'
22902 ln='$ln'
22903 lns='$lns'
22904 localtime_r_proto='$localtime_r_proto'
22905 locincpth='$locincpth'
22906 loclibpth='$loclibpth'
22907 longdblsize='$longdblsize'
22908 longlongsize='$longlongsize'
22909 longsize='$longsize'
22910 lp='$lp'
22911 lpr='$lpr'
22912 ls='$ls'
22913 lseeksize='$lseeksize'
22914 lseektype='$lseektype'
22915 mad='$mad'
22916 madlyh='$madlyh'
22917 madlyobj='$madlyobj'
22918 madlysrc='$madlysrc'
22919 mail='$mail'
22920 mailx='$mailx'
22921 make='$make'
22922 make_set_make='$make_set_make'
22923 mallocobj='$mallocobj'
22924 mallocsrc='$mallocsrc'
22925 malloctype='$malloctype'
22926 man1dir='$man1dir'
22927 man1direxp='$man1direxp'
22928 man1ext='$man1ext'
22929 man3dir='$man3dir'
22930 man3direxp='$man3direxp'
22931 man3ext='$man3ext'
22932 mips_type='$mips_type'
22933 mistrustnm='$mistrustnm'
22934 mkdir='$mkdir'
22935 mmaptype='$mmaptype'
22936 modetype='$modetype'
22937 more='$more'
22938 multiarch='$multiarch'
22939 mv='$mv'
22940 myarchname='$myarchname'
22941 mydomain='$mydomain'
22942 myhostname='$myhostname'
22943 myuname='$myuname'
22944 n='$n'
22945 need_va_copy='$need_va_copy'
22946 netdb_hlen_type='$netdb_hlen_type'
22947 netdb_host_type='$netdb_host_type'
22948 netdb_name_type='$netdb_name_type'
22949 netdb_net_type='$netdb_net_type'
22950 nm='$nm'
22951 nm_opt='$nm_opt'
22952 nm_so_opt='$nm_so_opt'
22953 nonxs_ext='$nonxs_ext'
22954 nroff='$nroff'
22955 nvEUformat='$nvEUformat'
22956 nvFUformat='$nvFUformat'
22957 nvGUformat='$nvGUformat'
22958 nv_overflows_integers_at='$nv_overflows_integers_at'
22959 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22960 nveformat='$nveformat'
22961 nvfformat='$nvfformat'
22962 nvgformat='$nvgformat'
22963 nvsize='$nvsize'
22964 nvtype='$nvtype'
22965 o_nonblock='$o_nonblock'
22966 obj_ext='$obj_ext'
22967 old_pthread_create_joinable='$old_pthread_create_joinable'
22968 optimize='$optimize'
22969 orderlib='$orderlib'
22970 osname='$osname'
22971 osvers='$osvers'
22972 otherlibdirs='$otherlibdirs'
22973 package='$package'
22974 pager='$pager'
22975 passcat='$passcat'
22976 patchlevel='$patchlevel'
22977 path_sep='$path_sep'
22978 perl5='$perl5'
22979 perl='$perl'
22980 perl_patchlevel='$perl_patchlevel'
22981 perladmin='$perladmin'
22982 perllibs='$perllibs'
22983 perlpath='$perlpath'
22984 pg='$pg'
22985 phostname='$phostname'
22986 pidtype='$pidtype'
22987 plibpth='$plibpth'
22988 pmake='$pmake'
22989 pr='$pr'
22990 prefix='$prefix'
22991 prefixexp='$prefixexp'
22992 privlib='$privlib'
22993 privlibexp='$privlibexp'
22994 procselfexe='$procselfexe'
22995 prototype='$prototype'
22996 ptrsize='$ptrsize'
22997 quadkind='$quadkind'
22998 quadtype='$quadtype'
22999 randbits='$randbits'
23000 randfunc='$randfunc'
23001 random_r_proto='$random_r_proto'
23002 randseedtype='$randseedtype'
23003 ranlib='$ranlib'
23004 rd_nodata='$rd_nodata'
23005 readdir64_r_proto='$readdir64_r_proto'
23006 readdir_r_proto='$readdir_r_proto'
23007 revision='$revision'
23008 rm='$rm'
23009 rm_try='$rm_try'
23010 rmail='$rmail'
23011 run='$run'
23012 runnm='$runnm'
23013 sGMTIME_max='$sGMTIME_max'
23014 sGMTIME_min='$sGMTIME_min'
23015 sLOCALTIME_max='$sLOCALTIME_max'
23016 sLOCALTIME_min='$sLOCALTIME_min'
23017 sPRIEUldbl='$sPRIEUldbl'
23018 sPRIFUldbl='$sPRIFUldbl'
23019 sPRIGUldbl='$sPRIGUldbl'
23020 sPRIXU64='$sPRIXU64'
23021 sPRId64='$sPRId64'
23022 sPRIeldbl='$sPRIeldbl'
23023 sPRIfldbl='$sPRIfldbl'
23024 sPRIgldbl='$sPRIgldbl'
23025 sPRIi64='$sPRIi64'
23026 sPRIo64='$sPRIo64'
23027 sPRIu64='$sPRIu64'
23028 sPRIx64='$sPRIx64'
23029 sSCNfldbl='$sSCNfldbl'
23030 sched_yield='$sched_yield'
23031 scriptdir='$scriptdir'
23032 scriptdirexp='$scriptdirexp'
23033 sed='$sed'
23034 seedfunc='$seedfunc'
23035 selectminbits='$selectminbits'
23036 selecttype='$selecttype'
23037 sendmail='$sendmail'
23038 setgrent_r_proto='$setgrent_r_proto'
23039 sethostent_r_proto='$sethostent_r_proto'
23040 setlocale_r_proto='$setlocale_r_proto'
23041 setnetent_r_proto='$setnetent_r_proto'
23042 setprotoent_r_proto='$setprotoent_r_proto'
23043 setpwent_r_proto='$setpwent_r_proto'
23044 setservent_r_proto='$setservent_r_proto'
23045 sh='$sh'
23046 shar='$shar'
23047 sharpbang='$sharpbang'
23048 shmattype='$shmattype'
23049 shortsize='$shortsize'
23050 shrpenv='$shrpenv'
23051 shsharp='$shsharp'
23052 sig_count='$sig_count'
23053 sig_name='$sig_name'
23054 sig_name_init='$sig_name_init'
23055 sig_num='$sig_num'
23056 sig_num_init='$sig_num_init'
23057 sig_size='$sig_size'
23058 signal_t='$signal_t'
23059 sitearch='$sitearch'
23060 sitearchexp='$sitearchexp'
23061 sitebin='$sitebin'
23062 sitebinexp='$sitebinexp'
23063 sitehtml1dir='$sitehtml1dir'
23064 sitehtml1direxp='$sitehtml1direxp'
23065 sitehtml3dir='$sitehtml3dir'
23066 sitehtml3direxp='$sitehtml3direxp'
23067 sitelib='$sitelib'
23068 sitelib_stem='$sitelib_stem'
23069 sitelibexp='$sitelibexp'
23070 siteman1dir='$siteman1dir'
23071 siteman1direxp='$siteman1direxp'
23072 siteman3dir='$siteman3dir'
23073 siteman3direxp='$siteman3direxp'
23074 siteprefix='$siteprefix'
23075 siteprefixexp='$siteprefixexp'
23076 sitescript='$sitescript'
23077 sitescriptexp='$sitescriptexp'
23078 sizesize='$sizesize'
23079 sizetype='$sizetype'
23080 sleep='$sleep'
23081 smail='$smail'
23082 so='$so'
23083 sockethdr='$sockethdr'
23084 socketlib='$socketlib'
23085 socksizetype='$socksizetype'
23086 sort='$sort'
23087 spackage='$spackage'
23088 spitshell='$spitshell'
23089 srand48_r_proto='$srand48_r_proto'
23090 srandom_r_proto='$srandom_r_proto'
23091 src='$src'
23092 ssizetype='$ssizetype'
23093 startperl='$startperl'
23094 startsh='$startsh'
23095 static_ext='$static_ext'
23096 stdchar='$stdchar'
23097 stdio_base='$stdio_base'
23098 stdio_bufsiz='$stdio_bufsiz'
23099 stdio_cnt='$stdio_cnt'
23100 stdio_filbuf='$stdio_filbuf'
23101 stdio_ptr='$stdio_ptr'
23102 stdio_stream_array='$stdio_stream_array'
23103 strerror_r_proto='$strerror_r_proto'
23104 strings='$strings'
23105 submit='$submit'
23106 subversion='$subversion'
23107 sysman='$sysman'
23108 tail='$tail'
23109 tar='$tar'
23110 targetarch='$targetarch'
23111 tbl='$tbl'
23112 tee='$tee'
23113 test='$test'
23114 timeincl='$timeincl'
23115 timetype='$timetype'
23116 tmpnam_r_proto='$tmpnam_r_proto'
23117 to='$to'
23118 touch='$touch'
23119 tr='$tr'
23120 trnl='$trnl'
23121 troff='$troff'
23122 ttyname_r_proto='$ttyname_r_proto'
23123 u16size='$u16size'
23124 u16type='$u16type'
23125 u32size='$u32size'
23126 u32type='$u32type'
23127 u64size='$u64size'
23128 u64type='$u64type'
23129 u8size='$u8size'
23130 u8type='$u8type'
23131 uidformat='$uidformat'
23132 uidsign='$uidsign'
23133 uidsize='$uidsize'
23134 uidtype='$uidtype'
23135 uname='$uname'
23136 uniq='$uniq'
23137 uquadtype='$uquadtype'
23138 use5005threads='$use5005threads'
23139 use64bitall='$use64bitall'
23140 use64bitint='$use64bitint'
23141 usecrosscompile='$usecrosscompile'
23142 usedevel='$usedevel'
23143 usedl='$usedl'
23144 usedtrace='$usedtrace'
23145 usefaststdio='$usefaststdio'
23146 useithreads='$useithreads'
23147 uselargefiles='$uselargefiles'
23148 uselongdouble='$uselongdouble'
23149 usemallocwrap='$usemallocwrap'
23150 usemorebits='$usemorebits'
23151 usemultiplicity='$usemultiplicity'
23152 usemymalloc='$usemymalloc'
23153 usenm='$usenm'
23154 useopcode='$useopcode'
23155 useperlio='$useperlio'
23156 useposix='$useposix'
23157 usereentrant='$usereentrant'
23158 userelocatableinc='$userelocatableinc'
23159 usesfio='$usesfio'
23160 useshrplib='$useshrplib'
23161 usesitecustomize='$usesitecustomize'
23162 usesocks='$usesocks'
23163 usethreads='$usethreads'
23164 usevendorprefix='$usevendorprefix'
23165 usevfork='$usevfork'
23166 usrinc='$usrinc'
23167 uuname='$uuname'
23168 uvXUformat='$uvXUformat'
23169 uvoformat='$uvoformat'
23170 uvsize='$uvsize'
23171 uvtype='$uvtype'
23172 uvuformat='$uvuformat'
23173 uvxformat='$uvxformat'
23174 vendorarch='$vendorarch'
23175 vendorarchexp='$vendorarchexp'
23176 vendorbin='$vendorbin'
23177 vendorbinexp='$vendorbinexp'
23178 vendorhtml1dir='$vendorhtml1dir'
23179 vendorhtml1direxp='$vendorhtml1direxp'
23180 vendorhtml3dir='$vendorhtml3dir'
23181 vendorhtml3direxp='$vendorhtml3direxp'
23182 vendorlib='$vendorlib'
23183 vendorlib_stem='$vendorlib_stem'
23184 vendorlibexp='$vendorlibexp'
23185 vendorman1dir='$vendorman1dir'
23186 vendorman1direxp='$vendorman1direxp'
23187 vendorman3dir='$vendorman3dir'
23188 vendorman3direxp='$vendorman3direxp'
23189 vendorprefix='$vendorprefix'
23190 vendorprefixexp='$vendorprefixexp'
23191 vendorscript='$vendorscript'
23192 vendorscriptexp='$vendorscriptexp'
23193 version='$version'
23194 version_patchlevel_string='$version_patchlevel_string'
23195 versiononly='$versiononly'
23196 vi='$vi'
23197 voidflags='$voidflags'
23198 xlibpth='$xlibpth'
23199 yacc='$yacc'
23200 yaccflags='$yaccflags'
23201 zcat='$zcat'
23202 zip='$zip'
23203 EOT
23204
23205 : Add in command line options if available
23206 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23207
23208 : add special variables
23209 $test -f $src/patchlevel.h && \
23210 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23211 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23212 echo "PERL_CONFIG_SH=true" >>config.sh
23213
23214 : propagate old symbols
23215 if $test -f UU/config.sh; then
23216         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23217         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23218                 config.sh config.sh UU/oldconfig.sh |\
23219                 $sort | $uniq -u >UU/oldsyms
23220         set X `cat UU/oldsyms`
23221         shift
23222         case $# in
23223         0) ;;
23224         *)
23225                 cat <<EOM
23226 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23227 EOM
23228                 echo ": Variables propagated from previous config.sh file." >>config.sh
23229                 for sym in `cat UU/oldsyms`; do
23230                         echo "    Propagating $hint variable "'$'"$sym..."
23231                         eval 'tmp="$'"${sym}"'"'
23232                         echo "$tmp" | \
23233                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23234                 done
23235                 ;;
23236         esac
23237 fi
23238
23239 : Finish up by extracting the .SH files
23240 case "$alldone" in
23241 exit)
23242         $rm -rf UU
23243         echo "Extraction done."
23244         exit 0
23245         ;;
23246 cont)
23247         ;;
23248 '')
23249         dflt=''
23250         nostick=true
23251         $cat <<EOM
23252
23253 If you'd like to make any changes to the config.sh file before I begin
23254 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23255
23256 EOM
23257         rp="Press return or use a shell escape to edit config.sh:"
23258         . UU/myread
23259         nostick=''
23260         case "$ans" in
23261         '') ;;
23262         *) : in case they cannot read
23263                 sh 1>&4 -c "$ans";;
23264         esac
23265         ;;
23266 esac
23267
23268 : if this fails, just run all the .SH files by hand
23269 . ./config.sh
23270
23271 echo " "
23272 exec 1>&4
23273 pwd=`pwd`
23274 . ./UU/extract
23275 cd "$pwd"
23276
23277 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23278         dflt=y
23279         case "$silent" in
23280         true) ;;
23281         *)
23282                 $cat <<EOM
23283
23284 Now you need to generate make dependencies by running "$make depend".
23285 You might prefer to run it in background: "$make depend > makedepend.out &"
23286 It can take a while, so you might not want to run it right now.
23287
23288 EOM
23289                 ;;
23290         esac
23291         rp="Run $make depend now?"
23292         . UU/myread
23293         case "$ans" in
23294         y*)
23295                 $make depend && echo "Now you must run '$make'."
23296                 ;;
23297         *)
23298                 echo "You must run '$make depend' then '$make'."
23299                 ;;
23300         esac
23301 elif test -f [Mm]akefile; then
23302         echo " "
23303         echo "Now you must run a $make."
23304 else
23305         echo "Configure done."
23306 fi
23307
23308 if $test -f Policy.sh; then
23309     $cat <<EOM
23310
23311 If you compile $package on a different machine or from a different object
23312 directory, copy the Policy.sh file from this object directory to the
23313 new one before you run Configure -- this will help you with most of
23314 the policy defaults.
23315
23316 EOM
23317 fi
23318 if $test -f config.msg; then
23319     echo "Hmm.  I also noted the following information while running:"
23320     echo " "
23321     $cat config.msg >&4
23322     $rm -f config.msg
23323 fi
23324 $rm -f kit*isdone ark*isdone
23325 $rm -rf UU
23326
23327 : End of Configure
23328