This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #70748] threads panic in del_backref
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
32 #
33 # Generated on Fri Nov  6 07:43:05 CET 2009 [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat >&4 <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test ! -c /dev/null ; then
73         cat >&4 <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 run=''
212 targetarch=''
213 to=''
214 usecrosscompile=''
215 extern_C=''
216 mistrustnm=''
217 usedevel=''
218 perllibs=''
219 dynamic_ext=''
220 extensions=''
221 known_extensions=''
222 nonxs_ext=''
223 static_ext=''
224 useopcode=''
225 useposix=''
226 extras=''
227 d_bsd=''
228 d_eunice=''
229 d_xenix=''
230 eunicefix=''
231 ar=''
232 awk=''
233 bash=''
234 bison=''
235 byacc=''
236 cat=''
237 chgrp=''
238 chmod=''
239 chown=''
240 comm=''
241 compress=''
242 cp=''
243 cpio=''
244 cpp=''
245 csh=''
246 date=''
247 echo=''
248 egrep=''
249 emacs=''
250 expr=''
251 find=''
252 flex=''
253 gmake=''
254 grep=''
255 gzip=''
256 inews=''
257 ksh=''
258 less=''
259 line=''
260 lint=''
261 ln=''
262 lp=''
263 lpr=''
264 ls=''
265 mail=''
266 mailx=''
267 make=''
268 mkdir=''
269 more=''
270 mv=''
271 nm=''
272 nroff=''
273 perl=''
274 pg=''
275 pmake=''
276 pr=''
277 rm=''
278 rmail=''
279 sed=''
280 sendmail=''
281 shar=''
282 sleep=''
283 smail=''
284 sort=''
285 submit=''
286 tail=''
287 tar=''
288 tbl=''
289 tee=''
290 test=''
291 touch=''
292 tr=''
293 troff=''
294 uname=''
295 uniq=''
296 uuname=''
297 vi=''
298 zcat=''
299 zip=''
300 full_ar=''
301 full_sed=''
302 libswanted=''
303 hint=''
304 myuname=''
305 osname=''
306 osvers=''
307 Author=''
308 Date=''
309 Header=''
310 Id=''
311 Locker=''
312 Log=''
313 RCSfile=''
314 Revision=''
315 Source=''
316 State=''
317 _a=''
318 _exe=''
319 _o=''
320 archobjs=''
321 exe_ext=''
322 firstmakefile=''
323 lib_ext=''
324 obj_ext=''
325 path_sep=''
326 rm_try=''
327 afs=''
328 afsroot=''
329 alignbytes=''
330 ansi2knr=''
331 archlib=''
332 archlibexp=''
333 d_archlib=''
334 installarchlib=''
335 archname=''
336 myarchname=''
337 d_atolf=''
338 d_atoll=''
339 baserev=''
340 bin=''
341 binexp=''
342 initialinstalllocation=''
343 installbin=''
344 userelocatableinc=''
345 byteorder=''
346 cc=''
347 ccflags=''
348 cppflags=''
349 ldflags=''
350 lkflags=''
351 locincpth=''
352 optimize=''
353 cf_email=''
354 cf_by=''
355 cf_time=''
356 charbits=''
357 charsize=''
358 contains=''
359 cpp_stuff=''
360 cpplast=''
361 cppminus=''
362 cpprun=''
363 cppstdin=''
364 d__fwalk=''
365 d_access=''
366 d_accessx=''
367 d_aintl=''
368 d_alarm=''
369 asctime_r_proto=''
370 d_asctime_r=''
371 d_attribute_deprecated=''
372 d_attribute_format=''
373 d_attribute_malloc=''
374 d_attribute_nonnull=''
375 d_attribute_noreturn=''
376 d_attribute_pure=''
377 d_attribute_unused=''
378 d_attribute_warn_unused_result=''
379 d_printf_format_null=''
380 d_bcmp=''
381 d_bcopy=''
382 d_builtin_choose_expr=''
383 d_builtin_expect=''
384 d_bzero=''
385 d_c99_variadic_macros=''
386 d_casti32=''
387 castflags=''
388 d_castneg=''
389 d_chown=''
390 d_chroot=''
391 d_chsize=''
392 d_class=''
393 d_clearenv=''
394 d_closedir=''
395 d_void_closedir=''
396 d_cmsghdr_s=''
397 d_const=''
398 d_copysignl=''
399 d_cplusplus=''
400 cryptlib=''
401 d_crypt=''
402 crypt_r_proto=''
403 d_crypt_r=''
404 d_csh=''
405 full_csh=''
406 d_ctermid=''
407 ctermid_r_proto=''
408 d_ctermid_r=''
409 ctime_r_proto=''
410 d_ctime_r=''
411 d_cuserid=''
412 d_dbl_dig=''
413 d_dbminitproto=''
414 d_difftime=''
415 d_dir_dd_fd=''
416 d_dirfd=''
417 d_dlerror=''
418 d_dlopen=''
419 d_dlsymun=''
420 d_dosuid=''
421 d_suidsafe=''
422 d_drand48_r=''
423 drand48_r_proto=''
424 d_drand48proto=''
425 d_dup2=''
426 d_eaccess=''
427 d_endgrent=''
428 d_endgrent_r=''
429 endgrent_r_proto=''
430 d_endhent=''
431 d_endhostent_r=''
432 endhostent_r_proto=''
433 d_endnent=''
434 d_endnetent_r=''
435 endnetent_r_proto=''
436 d_endpent=''
437 d_endprotoent_r=''
438 endprotoent_r_proto=''
439 d_endpwent=''
440 d_endpwent_r=''
441 endpwent_r_proto=''
442 d_endsent=''
443 d_endservent_r=''
444 endservent_r_proto=''
445 d_faststdio=''
446 d_fchdir=''
447 d_fchmod=''
448 d_fchown=''
449 d_fcntl=''
450 d_fcntl_can_lock=''
451 d_fd_macros=''
452 d_fd_set=''
453 d_fds_bits=''
454 d_fgetpos=''
455 d_finite=''
456 d_finitel=''
457 d_flexfnam=''
458 d_flock=''
459 d_flockproto=''
460 d_fork=''
461 d_fp_class=''
462 d_fpclass=''
463 d_fpclassify=''
464 d_fpclassl=''
465 d_fpos64_t=''
466 d_frexpl=''
467 d_fs_data_s=''
468 d_fseeko=''
469 d_fsetpos=''
470 d_fstatfs=''
471 d_fsync=''
472 d_ftello=''
473 d_ftime=''
474 d_gettimeod=''
475 d_futimes=''
476 d_Gconvert=''
477 d_getaddrinfo=''
478 d_getcwd=''
479 d_getespwnam=''
480 d_getfsstat=''
481 d_getgrent=''
482 d_getgrent_r=''
483 getgrent_r_proto=''
484 d_getgrgid_r=''
485 getgrgid_r_proto=''
486 d_getgrnam_r=''
487 getgrnam_r_proto=''
488 d_getgrps=''
489 d_gethbyaddr=''
490 d_gethbyname=''
491 d_gethent=''
492 aphostname=''
493 d_gethname=''
494 d_phostname=''
495 d_uname=''
496 d_gethostbyaddr_r=''
497 gethostbyaddr_r_proto=''
498 d_gethostbyname_r=''
499 gethostbyname_r_proto=''
500 d_gethostent_r=''
501 gethostent_r_proto=''
502 d_gethostprotos=''
503 d_getitimer=''
504 d_getlogin=''
505 d_getlogin_r=''
506 getlogin_r_proto=''
507 d_getmnt=''
508 d_getmntent=''
509 d_getnameinfo=''
510 d_getnbyaddr=''
511 d_getnbyname=''
512 d_getnent=''
513 d_getnetbyaddr_r=''
514 getnetbyaddr_r_proto=''
515 d_getnetbyname_r=''
516 getnetbyname_r_proto=''
517 d_getnetent_r=''
518 getnetent_r_proto=''
519 d_getnetprotos=''
520 d_getpagsz=''
521 d_getpent=''
522 d_getpgid=''
523 d_getpgrp2=''
524 d_bsdgetpgrp=''
525 d_getpgrp=''
526 d_getppid=''
527 d_getprior=''
528 d_getpbyname=''
529 d_getpbynumber=''
530 d_getprotobyname_r=''
531 getprotobyname_r_proto=''
532 d_getprotobynumber_r=''
533 getprotobynumber_r_proto=''
534 d_getprotoent_r=''
535 getprotoent_r_proto=''
536 d_getprotoprotos=''
537 d_getprpwnam=''
538 d_getpwent=''
539 d_getpwent_r=''
540 getpwent_r_proto=''
541 d_getpwnam_r=''
542 getpwnam_r_proto=''
543 d_getpwuid_r=''
544 getpwuid_r_proto=''
545 d_getsent=''
546 d_getservbyname_r=''
547 getservbyname_r_proto=''
548 d_getservbyport_r=''
549 getservbyport_r_proto=''
550 d_getservent_r=''
551 getservent_r_proto=''
552 d_getservprotos=''
553 d_getspnam=''
554 d_getspnam_r=''
555 getspnam_r_proto=''
556 d_getsbyname=''
557 d_getsbyport=''
558 d_gmtime_r=''
559 gmtime_r_proto=''
560 d_gnulibc=''
561 gnulibc_version=''
562 d_hasmntopt=''
563 d_htonl=''
564 d_ilogbl=''
565 d_inetaton=''
566 d_inetntop=''
567 d_inetpton=''
568 d_int64_t=''
569 d_isascii=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_procselfexe=''
632 procselfexe=''
633 d_old_pthread_create_joinable=''
634 old_pthread_create_joinable=''
635 d_pthread_atfork=''
636 d_pthread_attr_setscope=''
637 d_pthread_yield=''
638 d_sched_yield=''
639 sched_yield=''
640 d_qgcvt=''
641 d_random_r=''
642 random_r_proto=''
643 d_readdir64_r=''
644 readdir64_r_proto=''
645 d_readdir=''
646 d_rewinddir=''
647 d_seekdir=''
648 d_telldir=''
649 d_readdir_r=''
650 readdir_r_proto=''
651 d_readlink=''
652 d_readv=''
653 d_recvmsg=''
654 d_rename=''
655 d_rmdir=''
656 d_safebcpy=''
657 d_safemcpy=''
658 d_sanemcmp=''
659 d_sbrkproto=''
660 d_scalbnl=''
661 d_select=''
662 d_sem=''
663 d_semctl=''
664 d_semget=''
665 d_semop=''
666 d_sendmsg=''
667 d_setegid=''
668 d_seteuid=''
669 d_setgrent=''
670 d_setgrent_r=''
671 setgrent_r_proto=''
672 d_setgrps=''
673 d_sethent=''
674 d_sethostent_r=''
675 sethostent_r_proto=''
676 d_setitimer=''
677 d_setlinebuf=''
678 d_setlocale=''
679 d_setlocale_r=''
680 setlocale_r_proto=''
681 d_setnent=''
682 d_setnetent_r=''
683 setnetent_r_proto=''
684 d_setpent=''
685 d_setpgid=''
686 d_setpgrp2=''
687 d_bsdsetpgrp=''
688 d_setpgrp=''
689 d_setprior=''
690 d_setproctitle=''
691 d_setprotoent_r=''
692 setprotoent_r_proto=''
693 d_setpwent=''
694 d_setpwent_r=''
695 setpwent_r_proto=''
696 d_setregid=''
697 d_setresgid=''
698 d_setresuid=''
699 d_setreuid=''
700 d_setrgid=''
701 d_setruid=''
702 d_setsent=''
703 d_setservent_r=''
704 setservent_r_proto=''
705 d_setsid=''
706 d_setvbuf=''
707 d_sfio=''
708 usesfio=''
709 d_shm=''
710 d_shmat=''
711 d_shmatprototype=''
712 shmattype=''
713 d_shmctl=''
714 d_shmdt=''
715 d_shmget=''
716 d_sigaction=''
717 d_signbit=''
718 d_sigprocmask=''
719 d_sigsetjmp=''
720 usesitecustomize=''
721 d_snprintf=''
722 d_vsnprintf=''
723 d_sockatmark=''
724 d_sockatmarkproto=''
725 d_msg_ctrunc=''
726 d_msg_dontroute=''
727 d_msg_oob=''
728 d_msg_peek=''
729 d_msg_proxy=''
730 d_oldsock=''
731 d_scm_rights=''
732 d_socket=''
733 d_sockpair=''
734 sockethdr=''
735 socketlib=''
736 d_socklen_t=''
737 d_socks5_init=''
738 d_sprintf_returns_strlen=''
739 d_sqrtl=''
740 d_srand48_r=''
741 srand48_r_proto=''
742 d_srandom_r=''
743 srandom_r_proto=''
744 d_sresgproto=''
745 d_sresuproto=''
746 d_statblks=''
747 d_statfs_f_flags=''
748 d_statfs_s=''
749 d_fstatvfs=''
750 d_statvfs=''
751 d_stdio_cnt_lval=''
752 d_stdio_ptr_lval=''
753 d_stdio_ptr_lval_nochange_cnt=''
754 d_stdio_ptr_lval_sets_cnt=''
755 d_stdiobase=''
756 d_stdstdio=''
757 stdio_base=''
758 stdio_bufsiz=''
759 stdio_cnt=''
760 stdio_filbuf=''
761 stdio_ptr=''
762 d_index=''
763 d_strchr=''
764 d_strcoll=''
765 d_strctcpy=''
766 d_strerrm=''
767 d_strerror=''
768 d_sysernlst=''
769 d_syserrlst=''
770 d_strerror_r=''
771 strerror_r_proto=''
772 d_strftime=''
773 d_strlcat=''
774 d_strlcpy=''
775 d_strtod=''
776 d_strtol=''
777 d_strtold=''
778 d_strtoll=''
779 d_strtoq=''
780 d_strtoul=''
781 d_strtoull=''
782 d_strtouq=''
783 d_strxfrm=''
784 d_symlink=''
785 d_syscall=''
786 d_syscallproto=''
787 d_sysconf=''
788 d_system=''
789 d_tcgetpgrp=''
790 d_tcsetpgrp=''
791 d_telldirproto=''
792 d_time=''
793 timetype=''
794 d_asctime64=''
795 d_ctime64=''
796 d_difftime64=''
797 d_gmtime64=''
798 d_localtime64=''
799 d_mktime64=''
800 d_timegm=''
801 clocktype=''
802 d_times=''
803 d_tmpnam_r=''
804 tmpnam_r_proto=''
805 d_truncate=''
806 d_ttyname_r=''
807 ttyname_r_proto=''
808 d_tzname=''
809 d_u32align=''
810 d_ualarm=''
811 d_umask=''
812 d_semctl_semid_ds=''
813 d_semctl_semun=''
814 d_union_semun=''
815 d_unordered=''
816 d_unsetenv=''
817 d_usleep=''
818 d_usleepproto=''
819 d_ustat=''
820 d_pseudofork=''
821 d_vfork=''
822 usevfork=''
823 d_voidsig=''
824 signal_t=''
825 d_volatile=''
826 d_charvspr=''
827 d_vprintf=''
828 d_wait4=''
829 d_waitpid=''
830 d_wcstombs=''
831 d_wctomb=''
832 d_writev=''
833 dlext=''
834 bin_ELF=''
835 cccdlflags=''
836 ccdlflags=''
837 dlsrc=''
838 ld=''
839 lddlflags=''
840 usedl=''
841 doublesize=''
842 ebcdic=''
843 fflushNULL=''
844 fflushall=''
845 fpossize=''
846 fpostype=''
847 gccansipedantic=''
848 gccosandvers=''
849 gccversion=''
850 gidformat=''
851 gidsign=''
852 gidsize=''
853 gidtype=''
854 groupstype=''
855 h_fcntl=''
856 h_sysfile=''
857 html1dir=''
858 html1direxp=''
859 installhtml1dir=''
860 html3dir=''
861 html3direxp=''
862 installhtml3dir=''
863 i_arpainet=''
864 i_assert=''
865 i_crypt=''
866 db_hashtype=''
867 db_prefixtype=''
868 db_version_major=''
869 db_version_minor=''
870 db_version_patch=''
871 i_db=''
872 i_dbm=''
873 i_rpcsvcdbm=''
874 d_dirnamlen=''
875 direntrytype=''
876 i_dirent=''
877 i_dld=''
878 i_dlfcn=''
879 i_fcntl=''
880 i_float=''
881 i_fp=''
882 i_fp_class=''
883 i_gdbm=''
884 d_grpasswd=''
885 i_grp=''
886 i_ieeefp=''
887 i_inttypes=''
888 i_langinfo=''
889 i_libutil=''
890 i_limits=''
891 i_locale=''
892 i_machcthr=''
893 i_malloc=''
894 i_mallocmalloc=''
895 i_math=''
896 i_memory=''
897 i_mntent=''
898 d_gdbm_ndbm_h_uses_prototypes=''
899 d_gdbmndbm_h_uses_prototypes=''
900 d_ndbm=''
901 d_ndbm_h_uses_prototypes=''
902 i_gdbm_ndbm=''
903 i_gdbmndbm=''
904 i_ndbm=''
905 i_netdb=''
906 i_neterrno=''
907 i_netinettcp=''
908 i_niin=''
909 i_sysin=''
910 i_poll=''
911 i_prot=''
912 i_pthread=''
913 d_pwage=''
914 d_pwchange=''
915 d_pwclass=''
916 d_pwcomment=''
917 d_pwexpire=''
918 d_pwgecos=''
919 d_pwpasswd=''
920 d_pwquota=''
921 i_pwd=''
922 i_sfio=''
923 i_shadow=''
924 i_socks=''
925 i_stddef=''
926 i_stdlib=''
927 i_string=''
928 strings=''
929 i_sunmath=''
930 i_sysaccess=''
931 i_sysdir=''
932 i_sysfile=''
933 d_voidtty=''
934 i_bsdioctl=''
935 i_sysfilio=''
936 i_sysioctl=''
937 i_syssockio=''
938 i_syslog=''
939 i_sysmman=''
940 i_sysmode=''
941 i_sysmount=''
942 i_sysndir=''
943 i_sysparam=''
944 i_syspoll=''
945 i_sysresrc=''
946 i_syssecrt=''
947 i_sysselct=''
948 i_sysstat=''
949 i_sysstatfs=''
950 i_sysstatvfs=''
951 i_systimes=''
952 i_systypes=''
953 i_sysuio=''
954 i_sysun=''
955 i_sysutsname=''
956 i_sysvfs=''
957 i_syswait=''
958 i_sgtty=''
959 i_termio=''
960 i_termios=''
961 d_tm_tm_gmtoff=''
962 d_tm_tm_zone=''
963 i_systime=''
964 i_systimek=''
965 i_time=''
966 timeincl=''
967 i_unistd=''
968 i_ustat=''
969 i_utime=''
970 i_values=''
971 i_stdarg=''
972 i_varargs=''
973 i_varhdr=''
974 i_vfork=''
975 d_inc_version_list=''
976 inc_version_list=''
977 inc_version_list_init=''
978 installprefix=''
979 installprefixexp=''
980 installstyle=''
981 installusrbinperl=''
982 intsize=''
983 longsize=''
984 shortsize=''
985 issymlink=''
986 libc=''
987 ldlibpthname=''
988 libperl=''
989 shrpenv=''
990 useshrplib=''
991 glibpth=''
992 libpth=''
993 loclibpth=''
994 plibpth=''
995 xlibpth=''
996 ignore_versioned_solibs=''
997 libs=''
998 libsdirs=''
999 libsfiles=''
1000 libsfound=''
1001 libspath=''
1002 lns=''
1003 d_PRIEUldbl=''
1004 d_PRIFUldbl=''
1005 d_PRIGUldbl=''
1006 d_PRIeldbl=''
1007 d_PRIfldbl=''
1008 d_PRIgldbl=''
1009 d_SCNfldbl=''
1010 sPRIEUldbl=''
1011 sPRIFUldbl=''
1012 sPRIGUldbl=''
1013 sPRIeldbl=''
1014 sPRIfldbl=''
1015 sPRIgldbl=''
1016 sSCNfldbl=''
1017 lseeksize=''
1018 lseektype=''
1019 mad=''
1020 madlyh=''
1021 madlyobj=''
1022 madlysrc=''
1023 make_set_make=''
1024 d_mymalloc=''
1025 freetype=''
1026 mallocobj=''
1027 mallocsrc=''
1028 malloctype=''
1029 usemallocwrap=''
1030 usemymalloc=''
1031 installman1dir=''
1032 man1dir=''
1033 man1direxp=''
1034 man1ext=''
1035 installman3dir=''
1036 man3dir=''
1037 man3direxp=''
1038 man3ext=''
1039 modetype=''
1040 multiarch=''
1041 mydomain=''
1042 myhostname=''
1043 phostname=''
1044 c=''
1045 n=''
1046 d_eofnblk=''
1047 eagain=''
1048 o_nonblock=''
1049 rd_nodata=''
1050 need_va_copy=''
1051 netdb_hlen_type=''
1052 netdb_host_type=''
1053 netdb_name_type=''
1054 netdb_net_type=''
1055 groupcat=''
1056 hostcat=''
1057 passcat=''
1058 orderlib=''
1059 ranlib=''
1060 d_perl_otherlibdirs=''
1061 otherlibdirs=''
1062 package=''
1063 spackage=''
1064 pager=''
1065 api_revision=''
1066 api_subversion=''
1067 api_version=''
1068 api_versionstring=''
1069 patchlevel=''
1070 perl_patchlevel=''
1071 revision=''
1072 subversion=''
1073 version=''
1074 version_patchlevel_string=''
1075 perl5=''
1076 perladmin=''
1077 perlpath=''
1078 d_nv_preserves_uv=''
1079 d_nv_zero_is_allbits_zero=''
1080 i16size=''
1081 i16type=''
1082 i32size=''
1083 i32type=''
1084 i64size=''
1085 i64type=''
1086 i8size=''
1087 i8type=''
1088 ivsize=''
1089 ivtype=''
1090 nv_overflows_integers_at=''
1091 nv_preserves_uv_bits=''
1092 nvsize=''
1093 nvtype=''
1094 u16size=''
1095 u16type=''
1096 u32size=''
1097 u32type=''
1098 u64size=''
1099 u64type=''
1100 u8size=''
1101 u8type=''
1102 uvsize=''
1103 uvtype=''
1104 ivdformat=''
1105 nvEUformat=''
1106 nvFUformat=''
1107 nvGUformat=''
1108 nveformat=''
1109 nvfformat=''
1110 nvgformat=''
1111 uvXUformat=''
1112 uvoformat=''
1113 uvuformat=''
1114 uvxformat=''
1115 pidtype=''
1116 prefix=''
1117 prefixexp=''
1118 installprivlib=''
1119 privlib=''
1120 privlibexp=''
1121 prototype=''
1122 ptrsize=''
1123 d_PRIXU64=''
1124 d_PRId64=''
1125 d_PRIi64=''
1126 d_PRIo64=''
1127 d_PRIu64=''
1128 d_PRIx64=''
1129 sPRIXU64=''
1130 sPRId64=''
1131 sPRIi64=''
1132 sPRIo64=''
1133 sPRIu64=''
1134 sPRIx64=''
1135 d_quad=''
1136 quadkind=''
1137 quadtype=''
1138 uquadtype=''
1139 drand01=''
1140 randbits=''
1141 randfunc=''
1142 randseedtype=''
1143 seedfunc=''
1144 installscript=''
1145 scriptdir=''
1146 scriptdirexp=''
1147 selectminbits=''
1148 selecttype=''
1149 sh=''
1150 sig_count=''
1151 sig_name=''
1152 sig_name_init=''
1153 sig_num=''
1154 sig_num_init=''
1155 sig_size=''
1156 d_sitearch=''
1157 installsitearch=''
1158 sitearch=''
1159 sitearchexp=''
1160 installsitebin=''
1161 sitebin=''
1162 sitebinexp=''
1163 installsitehtml1dir=''
1164 sitehtml1dir=''
1165 sitehtml1direxp=''
1166 installsitehtml3dir=''
1167 sitehtml3dir=''
1168 sitehtml3direxp=''
1169 installsitelib=''
1170 sitelib=''
1171 sitelib_stem=''
1172 sitelibexp=''
1173 installsiteman1dir=''
1174 siteman1dir=''
1175 siteman1direxp=''
1176 installsiteman3dir=''
1177 siteman3dir=''
1178 siteman3direxp=''
1179 siteprefix=''
1180 siteprefixexp=''
1181 installsitescript=''
1182 sitescript=''
1183 sitescriptexp=''
1184 sizesize=''
1185 sizetype=''
1186 so=''
1187 socksizetype=''
1188 sharpbang=''
1189 shsharp=''
1190 spitshell=''
1191 src=''
1192 ssizetype=''
1193 startperl=''
1194 startsh=''
1195 stdchar=''
1196 d_stdio_stream_array=''
1197 stdio_stream_array=''
1198 sysman=''
1199 sGMTIME_max=''
1200 sGMTIME_min=''
1201 sLOCALTIME_max=''
1202 sLOCALTIME_min=''
1203 trnl=''
1204 uidformat=''
1205 uidsign=''
1206 uidsize=''
1207 uidtype=''
1208 archname64=''
1209 use64bitall=''
1210 use64bitint=''
1211 dtrace=''
1212 usedtrace=''
1213 usefaststdio=''
1214 ccflags_uselargefiles=''
1215 ldflags_uselargefiles=''
1216 libswanted_uselargefiles=''
1217 uselargefiles=''
1218 uselongdouble=''
1219 usemorebits=''
1220 usemultiplicity=''
1221 nm_opt=''
1222 nm_so_opt=''
1223 runnm=''
1224 usenm=''
1225 useperlio=''
1226 usesocks=''
1227 d_oldpthreads=''
1228 use5005threads=''
1229 useithreads=''
1230 usereentrant=''
1231 usethreads=''
1232 incpath=''
1233 mips_type=''
1234 usrinc=''
1235 d_vendorarch=''
1236 installvendorarch=''
1237 vendorarch=''
1238 vendorarchexp=''
1239 d_vendorbin=''
1240 installvendorbin=''
1241 vendorbin=''
1242 vendorbinexp=''
1243 installvendorhtml1dir=''
1244 vendorhtml1dir=''
1245 vendorhtml1direxp=''
1246 installvendorhtml3dir=''
1247 vendorhtml3dir=''
1248 vendorhtml3direxp=''
1249 d_vendorlib=''
1250 installvendorlib=''
1251 vendorlib=''
1252 vendorlib_stem=''
1253 vendorlibexp=''
1254 installvendorman1dir=''
1255 vendorman1dir=''
1256 vendorman1direxp=''
1257 installvendorman3dir=''
1258 vendorman3dir=''
1259 vendorman3direxp=''
1260 usevendorprefix=''
1261 vendorprefix=''
1262 vendorprefixexp=''
1263 d_vendorscript=''
1264 installvendorscript=''
1265 vendorscript=''
1266 vendorscriptexp=''
1267 versiononly=''
1268 defvoidused=''
1269 voidflags=''
1270 yacc=''
1271 yaccflags=''
1272 CONFIG=''
1273
1274 : Detect odd OSs
1275 define='define'
1276 undef='undef'
1277 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1278 rmlist=''
1279
1280 : We must find out about Eunice early
1281 eunicefix=':'
1282 if test -f /etc/unixtovms; then
1283         eunicefix=/etc/unixtovms
1284 fi
1285 if test -f /etc/unixtovms.exe; then
1286         eunicefix=/etc/unixtovms.exe
1287 fi
1288
1289 : Set executable suffix now -- needed before hints available
1290 if test -f "/libs/version.library"; then
1291 : Amiga OS
1292     _exe=""
1293 elif test -f "/system/gnu_library/bin/ar.pm"; then
1294 : Stratus VOS
1295     _exe=".pm"
1296 elif test -n "$DJGPP"; then
1297 : DOS DJGPP
1298     _exe=".exe"
1299 elif test -d c:/. -o -n "$is_os2" ; then
1300 : OS/2 or cygwin
1301     _exe=".exe"
1302 fi
1303
1304 groupstype=''
1305 i_whoami=''
1306 : Trailing extension.  Override this in a hint file, if needed.
1307 : Extra object files, if any, needed on this platform.
1308 archobjs=''
1309 archname=''
1310 libnames=''
1311 : change the next line if compiling for Xenix/286 on Xenix/386
1312 xlibpth='/usr/lib/386 /lib/386'
1313 : Possible local library directories to search.
1314 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1315 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1316
1317 : general looking path for locating libraries
1318 glibpth="/lib /usr/lib $xlibpth"
1319 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1320 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1321 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1322 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1323
1324 : Private path used by Configure to find libraries.  Its value
1325 : is prepended to libpth. This variable takes care of special
1326 : machines, like the mips.  Usually, it should be empty.
1327 plibpth=''
1328
1329 : default library list
1330 libswanted=''
1331 : some systems want to use only the non-versioned libso:s
1332 ignore_versioned_solibs=''
1333 : set usethreads on the Configure command line to enable threads.
1334 usereentrant='undef'
1335 : full support for void wanted by default
1336 defvoidused=15
1337
1338 : Possible local include directories to search.
1339 : Set locincpth to "" in a hint file to defeat local include searches.
1340 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1341 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1342 :
1343 : no include file wanted by default
1344 inclwanted=''
1345
1346 : Enable -DEBUGGING and -DDEBUGGING from the command line
1347 EBUGGING=''
1348 DEBUGGING=old
1349
1350 ccname=''
1351 ccversion=''
1352 perllibs=''
1353 : set useposix=false in your hint file to disable the POSIX extension.
1354 useposix=true
1355 : set useopcode=false in your hint file to disable the Opcode extension.
1356 useopcode=true
1357 archname64=''
1358 ccflags_uselargefiles=''
1359 ldflags_uselargefiles=''
1360 libswanted_uselargefiles=''
1361 : set usemultiplicity on the Configure command line to enable multiplicity.
1362 : set usesocks on the Configure command line to enable socks.
1363 : List of libraries we want.
1364 : If anyone needs extra -lxxx, put those in a hint file.
1365 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1366 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1367 : We probably want to search /usr/shlib before most other libraries.
1368 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1369 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1370 glibpth="/usr/shlib $glibpth"
1371 : Do not use vfork unless overridden by a hint file.
1372 usevfork=false
1373
1374 : Find the basic shell for Bourne shell scripts
1375 case "$sh" in
1376 '')
1377         case "$SYSTYPE" in
1378         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1379         *) xxx='/bin/sh';;
1380         esac
1381         if test -f "$xxx"; then
1382                 sh="$xxx"
1383         else
1384                 : Build up a list and do a single loop so we can 'break' out.
1385                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1386                 for xxx in sh bash ksh pdksh ash; do
1387                         for p in $pth; do
1388                                 try="$try ${p}/${xxx}"
1389                         done
1390                 done
1391                 for xxx in $try; do
1392                         if test -f "$xxx"; then
1393                                 sh="$xxx";
1394                                 break
1395                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1396                                 sh="$xxx";
1397                                 break
1398                         elif test -f "$xxx.exe"; then
1399                                 sh="$xxx";
1400                                 break
1401                         fi
1402                 done
1403         fi
1404         ;;
1405 esac
1406
1407 case "$sh" in
1408 '')     cat >&2 <<EOM
1409 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1410
1411 Usually it's in /bin/sh.  How did you even get this far?
1412 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1413 we'll try to straighten this all out.
1414 EOM
1415         exit 1
1416         ;;
1417 esac
1418
1419 : see if sh knows # comments
1420 if `$sh -c '#' >/dev/null 2>&1`; then
1421         shsharp=true
1422         spitshell=cat
1423         xcat=/bin/cat
1424         test -f $xcat$_exe || xcat=/usr/bin/cat
1425         if test ! -f $xcat$_exe; then
1426                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1427                         if test -f $p/cat$_exe; then
1428                                 xcat=$p/cat
1429                                 break
1430                         fi
1431                 done
1432                 if test ! -f $xcat$_exe; then
1433                         echo "Can't find cat anywhere!"
1434                         exit 1
1435                 fi
1436         fi
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                 echo "#! $xcat" > sharp
1445                 $eunicefix sharp
1446                 chmod +x sharp
1447                 ./sharp > today 2>/dev/null
1448                 if test -s today; then
1449                         sharpbang='#! '
1450                 else
1451                         sharpbang=': use '
1452                 fi
1453         fi
1454 else
1455         echo " "
1456         echo "Your $sh doesn't grok # comments--I will strip them later on."
1457         shsharp=false
1458         cd ..
1459         echo "exec grep -v '^[  ]*#'" >spitshell
1460         chmod +x spitshell
1461         $eunicefix spitshell
1462         spitshell=`pwd`/spitshell
1463         cd UU
1464         echo "I presume that if # doesn't work, #! won't work either!"
1465         sharpbang=': use '
1466 fi
1467 rm -f sharp today
1468
1469 : figure out how to guarantee sh startup
1470 case "$startsh" in
1471 '') startsh=${sharpbang}${sh} ;;
1472 *)
1473 esac
1474 cat >sharp <<EOSS
1475 $startsh
1476 set abc
1477 test "$?abc" != 1
1478 EOSS
1479
1480 chmod +x sharp
1481 $eunicefix sharp
1482 if ./sharp; then
1483         : echo "Yup, it does."
1484 else
1485         echo "Hmm... '$startsh' does not guarantee sh startup..."
1486         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1487 fi
1488 rm -f sharp
1489
1490 : Save command line options in file UU/cmdline.opt for later use in
1491 : generating config.sh.
1492 cat > cmdline.opt <<EOSH
1493 : Configure command line arguments.
1494 config_arg0='$0'
1495 config_args='$*'
1496 config_argc=$#
1497 EOSH
1498 argn=1
1499 args_exp=''
1500 args_sep=''
1501 for arg in "$@"; do
1502         cat >>cmdline.opt <<EOSH
1503 config_arg$argn='$arg'
1504 EOSH
1505         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1506 $arg
1507 EOC
1508         arg_exp=`cat cmdl.opt`
1509         args_exp="$args_exp$args_sep'$arg_exp'"
1510         argn=`expr $argn + 1`
1511         args_sep=' '
1512 done
1513 rm -f cmdl.opt
1514
1515 : produce awk script to parse command line options
1516 cat >options.awk <<'EOF'
1517 BEGIN {
1518         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1519
1520         len = length(optstr);
1521         for (i = 1; i <= len; i++) {
1522                 c = substr(optstr, i, 1);
1523                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1524                 if (a == ":") {
1525                         arg[c] = 1;
1526                         i++;
1527                 }
1528                 opt[c] = 1;
1529         }
1530 }
1531 {
1532         expect = 0;
1533         str = $0;
1534         if (substr(str, 1, 1) != "-") {
1535                 printf("'%s'\n", str);
1536                 next;
1537         }
1538         len = length($0);
1539         for (i = 2; i <= len; i++) {
1540                 c = substr(str, i, 1);
1541                 if (!opt[c]) {
1542                         printf("-%s\n", substr(str, i));
1543                         next;
1544                 }
1545                 printf("-%s\n", c);
1546                 if (arg[c]) {
1547                         if (i < len)
1548                                 printf("'%s'\n", substr(str, i + 1));
1549                         else
1550                                 expect = 1;
1551                         next;
1552                 }
1553         }
1554 }
1555 END {
1556         if (expect)
1557                 print "?";
1558 }
1559 EOF
1560
1561 : process the command line options
1562 set X `for arg in "$@"; do echo "X$arg"; done |
1563         sed -e s/X// | awk -f options.awk`
1564 eval "set $*"
1565 shift
1566 rm -f options.awk
1567
1568 : set up default values
1569 fastread=''
1570 reuseval=false
1571 config_sh=''
1572 alldone=''
1573 error=''
1574 silent=''
1575 extractsh=''
1576 override=''
1577 knowitall=''
1578 rm -f optdef.sh posthint.sh
1579 cat >optdef.sh <<EOS
1580 $startsh
1581 EOS
1582
1583
1584 : option parsing
1585 while test $# -gt 0; do
1586         case "$1" in
1587         -d) shift; fastread=yes;;
1588         -e) shift; alldone=cont;;
1589         -f)
1590                 shift
1591                 cd ..
1592                 if test -r "$1"; then
1593                         config_sh="$1"
1594                 else
1595                         echo "$me: cannot read config file $1." >&2
1596                         error=true
1597                 fi
1598                 cd UU
1599                 shift;;
1600         --help|\
1601         -h) shift; error=true;;
1602         -r) shift; reuseval=true;;
1603         -s) shift; silent=true; realsilent=true;;
1604         -E) shift; alldone=exit;;
1605         -K) shift; knowitall=true;;
1606         -O) shift; override=true;;
1607         -S) shift; silent=true; extractsh=true;;
1608         -D)
1609                 shift
1610                 case "$1" in
1611                 *=)
1612                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1613                         echo "$me: ignoring -D $1" >&2
1614                         ;;
1615                 *=*) echo "$1" | \
1616                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1617                 *) echo "$1='define'" >> optdef.sh;;
1618                 esac
1619                 shift
1620                 ;;
1621         -U)
1622                 shift
1623                 case "$1" in
1624                 *=) echo "$1" >> optdef.sh;;
1625                 *=*)
1626                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1627                         echo "$me: ignoring -U $1" >&2
1628                         ;;
1629                 *) echo "$1='undef'" >> optdef.sh;;
1630                 esac
1631                 shift
1632                 ;;
1633         -A)
1634             shift
1635             xxx=''
1636             yyy="$1"
1637             zzz=''
1638             uuu=undef
1639             case "$yyy" in
1640             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1641                  case "$zzz" in
1642                  *:*) zzz='' ;;
1643                  *)   xxx=append
1644                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1645                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1646                  esac
1647                  ;;
1648             esac
1649             case "$xxx" in
1650             '')  case "$yyy" in
1651                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1652                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1653                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1654                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1655                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1656                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1657                  esac
1658                  ;;
1659             esac
1660             case "$xxx" in
1661             append)
1662                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1663             clear)
1664                 echo "$yyy=''"                  >> posthint.sh ;;
1665             define)
1666                 case "$zzz" in
1667                 '') zzz=define ;;
1668                 esac
1669                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1670             eval)
1671                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1672             prepend)
1673                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1674             undef)
1675                 case "$zzz" in
1676                 '') zzz="$uuu" ;;
1677                 esac
1678                 echo "$yyy=$zzz"                >> posthint.sh ;;
1679             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1680             esac
1681             shift
1682             ;;
1683         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1684             exit 0;;
1685         --) break;;
1686         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1687         *) break;;
1688         esac
1689 done
1690
1691 case "$error" in
1692 true)
1693         cat >&2 <<EOM
1694 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1695                  [-U symbol] [-U symbol=] [-A command:symbol...]
1696   -d : use defaults for all answers.
1697   -e : go on without questioning past the production of config.sh.
1698   -f : specify an alternate default configuration file.
1699   -h : print this help message and exit (with an error status).
1700   -r : reuse C symbols value if possible (skips costly nm extraction).
1701   -s : silent mode, only echoes questions and essential information.
1702   -D : define symbol to have some value:
1703          -D symbol         symbol gets the value 'define'
1704          -D symbol=value   symbol gets the value 'value'
1705        common used examples (see INSTALL for more info):
1706          -Duse64bitint            use 64bit integers
1707          -Duse64bitall            use 64bit integers and pointers
1708          -Dusethreads             use thread support
1709          -Dinc_version_list=none  do not include older perl trees in @INC
1710          -DEBUGGING=none          DEBUGGING options
1711          -Dcc=gcc                 choose your compiler
1712          -Dprefix=/opt/perl5      choose your destination
1713   -E : stop at the end of questions, after having produced config.sh.
1714   -K : do not use unless you know what you are doing.
1715   -O : let -D and -U override definitions from loaded configuration file.
1716   -S : perform variable substitutions on all .SH files (can mix with -f)
1717   -U : undefine symbol:
1718          -U symbol    symbol gets the value 'undef'
1719          -U symbol=   symbol gets completely empty
1720        e.g.:  -Uversiononly
1721   -A : manipulate symbol after the platform specific hints have been applied:
1722          -A append:symbol=value   append value to symbol
1723          -A symbol=value          like append:, but with a separating space
1724          -A define:symbol=value   define symbol to have value
1725          -A clear:symbol          define symbol to be ''
1726          -A define:symbol         define symbol to be 'define'
1727          -A eval:symbol=value     define symbol to be eval of value
1728          -A prepend:symbol=value  prepend value to symbol
1729          -A undef:symbol          define symbol to be 'undef'
1730          -A undef:symbol=         define symbol to be ''
1731        e.g.:  -A prepend:libswanted='cl pthread '
1732               -A ccflags=-DSOME_MACRO
1733   -V : print version number and exit (with a zero status).
1734 EOM
1735         exit 1
1736         ;;
1737 esac
1738
1739 : Sanity checks
1740 case "$fastread$alldone" in
1741 yescont|yesexit) ;;
1742 *)
1743         case "$extractsh" in
1744         true) ;;
1745         *)
1746                 if test ! -t 0; then
1747                         echo "Say 'sh Configure', not 'sh <Configure'"
1748                         exit 1
1749                 fi
1750                 ;;
1751         esac
1752         ;;
1753 esac
1754
1755 exec 4>&1
1756 case "$silent" in
1757 true) exec 1>/dev/null;;
1758 esac
1759
1760 : run the defines and the undefines, if any, but leave the file out there...
1761 touch optdef.sh
1762 . ./optdef.sh
1763 : create the posthint manipulation script and leave the file out there...
1764 touch posthint.sh
1765
1766 : set package name
1767 package='perl5'
1768 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1769 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1770 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1771 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1772 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1773 esac
1774
1775 : Some greps do not return status, grrr.
1776 echo "grimblepritz" >grimble
1777 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1778         contains=contains
1779 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1780         contains=grep
1781 else
1782         contains=contains
1783 fi
1784 rm -f grimble
1785 : the following should work in any shell
1786 case "$contains" in
1787 contains*)
1788         echo " "
1789         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1790         cat >contains <<'EOSS'
1791 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1792 EOSS
1793 chmod +x contains
1794 esac
1795
1796 : Find the path to the source tree
1797 case "$src" in
1798 '') case "$0" in
1799     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1800          case "$src" in
1801          /*)    ;;
1802          .)     ;;
1803          *)     src=`cd ../$src && pwd` ;;
1804          esac
1805          ;;
1806     *)   src='.';;
1807     esac;;
1808 esac
1809 case "$src" in
1810 '')     src=/
1811         rsrc=/
1812         ;;
1813 /*)     rsrc="$src";;
1814 *)      rsrc="../$src";;
1815 esac
1816 if test -f $rsrc/Configure && \
1817         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1818 then
1819    : found it, so we are ok.
1820 else
1821         rsrc=''
1822         for src in . .. ../.. ../../.. ../../../..; do
1823                 if test -f ../$src/Configure && \
1824                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1825                 then
1826                         rsrc=../$src
1827                         break
1828                 fi
1829         done
1830 fi
1831 case "$rsrc" in
1832 '')
1833         cat <<EOM >&4
1834
1835 Sorry, I can't seem to locate the source dir for $package.  Please start
1836 Configure with an explicit path -- i.e. /some/path/Configure.
1837
1838 EOM
1839         exit 1
1840         ;;
1841 ../.)   rsrc='..';;
1842 *)
1843         echo " "
1844         echo "Sources for $package found in \"$src\"." >&4
1845         ;;
1846 esac
1847
1848 : script used to extract .SH files with variable substitutions
1849 cat >extract <<'EOS'
1850 PERL_CONFIG_SH=true
1851 echo "Doing variable substitutions on .SH files..."
1852 if test -f MANIFEST; then
1853         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1854 else
1855         echo "(Looking for .SH files under the source directory.)"
1856         set x `(cd "$src"; find . -name "*.SH" -print)`
1857 fi
1858 shift
1859 case $# in
1860 0) set x `(cd "$src"; echo *.SH)`; shift;;
1861 esac
1862 if test ! -f "$src/$1"; then
1863         shift
1864 fi
1865 mkdir_p='
1866 name=$1;
1867 create="";
1868 while test $name; do
1869         if test ! -d "$name"; then
1870                 create="$name $create";
1871                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1872                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1873         else
1874                 name="";
1875         fi;
1876 done;
1877 for file in $create; do
1878         mkdir $file;
1879 done
1880 '
1881 for file in $*; do
1882         case "$src" in
1883         ".")
1884                 case "$file" in
1885                 */*)
1886                         dir=`expr X$file : 'X\(.*\)/'`
1887                         file=`expr X$file : 'X.*/\(.*\)'`
1888                         (cd "$dir" && . ./$file)
1889                         ;;
1890                 *)
1891                         . ./$file
1892                         ;;
1893                 esac
1894                 ;;
1895         *)
1896                 case "$file" in
1897                 */*)
1898                         dir=`expr X$file : 'X\(.*\)/'`
1899                         file=`expr X$file : 'X.*/\(.*\)'`
1900                         (set x $dir; shift; eval $mkdir_p)
1901                         sh <"$src/$dir/$file"
1902                         ;;
1903                 *)
1904                         sh <"$src/$file"
1905                         ;;
1906                 esac
1907                 ;;
1908         esac
1909 done
1910 if test -f "$src/config_h.SH"; then
1911         if test ! -f config.h; then
1912         : oops, they left it out of MANIFEST, probably, so do it anyway.
1913         . "$src/config_h.SH"
1914         fi
1915 fi
1916 EOS
1917
1918 : extract files and exit if asked to do so
1919 case "$extractsh" in
1920 true)
1921         case "$realsilent" in
1922         true) ;;
1923         *) exec 1>&4;;
1924         esac
1925         case "$config_sh" in
1926         '') config_sh='config.sh';;
1927         esac
1928         echo " "
1929         echo "Fetching answers from $config_sh..."
1930         cd ..
1931         . $config_sh
1932         test "$override" && . ./optdef.sh
1933         echo " "
1934         . UU/extract
1935         rm -rf UU
1936         echo "Extraction done."
1937         exit 0
1938         ;;
1939 esac
1940
1941 : Eunice requires " " instead of "", can you believe it
1942 echo " "
1943 : Here we go...
1944 echo "Beginning of configuration questions for $package."
1945
1946 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1947
1948 : first determine how to suppress newline on echo command
1949 echo " "
1950 echo "Checking echo to see how to suppress newlines..."
1951 (echo "hi there\c" ; echo " ") >.echotmp
1952 if $contains c .echotmp >/dev/null 2>&1 ; then
1953         echo "...using -n."
1954         n='-n'
1955         c=''
1956 else
1957         cat <<'EOM'
1958 ...using \c
1959 EOM
1960         n=''
1961         c='\c'
1962 fi
1963 echo $n "The star should be here-->$c"
1964 echo '*'
1965 rm -f .echotmp
1966
1967 : Now test for existence of everything in MANIFEST
1968 echo " "
1969 if test -f "$rsrc/MANIFEST"; then
1970         echo "First let's make sure your kit is complete.  Checking..." >&4
1971         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1972                 (split -l 50 2>/dev/null || split -50)
1973         rm -f missing
1974         tmppwd=`pwd`
1975         for filelist in x??; do
1976                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1977                         >/dev/null 2>>"$tmppwd/missing")
1978         done
1979         if test -s missing; then
1980                 cat missing >&4
1981                 cat >&4 <<'EOM'
1982
1983 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1984
1985 You have the option of continuing the configuration process, despite the
1986 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1987 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1988 and contact the author (perlbug@perl.org).
1989
1990 EOM
1991                 echo $n "Continue? [n] $c" >&4
1992                 read ans
1993                 case "$ans" in
1994                 y*)
1995                         echo "Continuing..." >&4
1996                         rm -f missing
1997                         ;;
1998                 *)
1999                         echo "ABORTING..." >&4
2000                         kill $$
2001                         ;;
2002                 esac
2003         else
2004                 echo "Looks good..."
2005         fi
2006 else
2007         echo "There is no MANIFEST file.  I hope your kit is complete !"
2008 fi
2009 rm -f missing x??
2010
2011 : Find the appropriate value for a newline for tr
2012 echo " "
2013 if test -n "$DJGPP"; then
2014        trnl='\012'
2015 fi
2016 if test X"$trnl" = X; then
2017         case "`echo foo|tr '\n' x 2>/dev/null`" in
2018         foox) trnl='\n' ;;
2019         esac
2020 fi
2021 if test X"$trnl" = X; then
2022         case "`echo foo|tr '\012' x 2>/dev/null`" in
2023         foox) trnl='\012' ;;
2024         esac
2025 fi
2026 if test X"$trnl" = X; then
2027        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2028        fooxy) trnl='\n\r' ;;
2029        esac
2030 fi
2031 if test X"$trnl" = X; then
2032         cat <<EOM >&2
2033
2034 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2035
2036 EOM
2037         exit 1
2038 fi
2039
2040 : compute the number of columns on the terminal for proper question formatting
2041 case "$COLUMNS" in
2042 '') COLUMNS='80';;
2043 esac
2044
2045 : set up the echo used in my read
2046 myecho="case \"\$xxxm\" in
2047 '') echo $n \"\$rp $c\" >&4;;
2048 *) case \"\$rp\" in
2049         '') echo $n \"[\$xxxm] $c\";;
2050         *)
2051                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2052                         echo \"\$rp\" >&4
2053                         echo $n \"[\$xxxm] $c\" >&4
2054                 else
2055                         echo $n \"\$rp [\$xxxm] $c\" >&4
2056                 fi
2057                 ;;
2058         esac;;
2059 esac"
2060
2061 : now set up to do reads with possible shell escape and default assignment
2062 cat <<EOSC >myread
2063 $startsh
2064 xxxm=\$dflt
2065 $myecho
2066 ans='!'
2067 case "\$fastread" in
2068 yes) case "\$dflt" in
2069         '') ;;
2070         *) ans='';
2071                 case "\$silent-\$rp" in
2072                 true-) ;;
2073                 *) echo " " >&4;;
2074                 esac;;
2075         esac;;
2076 *) case "\$silent" in
2077         true) case "\$rp" in
2078                 '') ans='';;
2079                 esac;;
2080         esac;;
2081 esac
2082 while expr "X\$ans" : "X!" >/dev/null; do
2083         read answ
2084         set x \$xxxm
2085         shift
2086         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2087         case  "\$answ" in
2088         "!")
2089                 sh 1>&4
2090                 echo " "
2091                 $myecho
2092                 ;;
2093         !*)
2094                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2095                 shift
2096                 sh 1>&4 -c "\$*"
2097                 echo " "
2098                 $myecho
2099                 ;;
2100         "\$ans")
2101                 case "\$ans" in
2102                 \\&*)
2103                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2104                         shift
2105                         case "\$1" in
2106                         -d)
2107                                 fastread=yes
2108                                 echo "(OK, I'll run with -d after this question.)" >&4
2109                                 ;;
2110                         -*)
2111                                 echo "*** Sorry, \$1 not supported yet." >&4
2112                                 ;;
2113                         esac
2114                         $myecho
2115                         ans=!
2116                         ;;
2117                 esac;;
2118         *)
2119                 case "\$aok" in
2120                 y)
2121                         echo "*** Substitution done -- please confirm."
2122                         xxxm="\$ans"
2123                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2124                         xxxm="\$ans"
2125                         ans=!
2126                         ;;
2127                 *)
2128                         echo "*** Error -- try again."
2129                         ans=!
2130                         ;;
2131                 esac
2132                 $myecho
2133                 ;;
2134         esac
2135         case "\$ans\$xxxm\$nostick" in
2136         '')
2137                 ans=!
2138                 $myecho
2139                 ;;
2140         esac
2141 done
2142 case "\$ans" in
2143 '') ans="\$xxxm";;
2144 esac
2145 EOSC
2146
2147 : create .config dir to save info across Configure sessions
2148 test -d ../.config || mkdir ../.config
2149 cat >../.config/README <<EOF
2150 This directory created by Configure to save information that should
2151 persist across sessions for $package.
2152
2153 You may safely delete it if you wish.
2154 EOF
2155
2156 : See if we are using a devel version and want that
2157 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2158 case "$usedevel" in
2159 $define|true|[yY]*)
2160     usedevel="$define" ;;
2161 *) case "$xversion" in
2162    *[13579])
2163         cat >&4 <<EOH
2164 *** WHOA THERE!!! ***
2165
2166     This is an UNSTABLE DEVELOPMENT release.
2167     The version of this $package distribution is $xversion, that is, odd,
2168     (as opposed to even) and that signifies a development release.
2169     If you want a maintenance release, you want an even-numbered version.
2170
2171     Do ***NOT*** install this into production use.
2172     Data corruption and crashes are possible.
2173
2174     It is most seriously suggested that you do not continue any further
2175     unless you want to help in developing and debugging Perl.
2176
2177     If you *still* want to build perl, you can answer 'y' now,
2178     or pass -Dusedevel to Configure.
2179
2180 EOH
2181         rp='Do you really want to continue?'
2182         dflt='n'
2183         . ./myread
2184         case "$ans" in
2185         [yY]) echo >&4 "Okay, continuing."
2186               usedevel="$define" ;;
2187         *) echo >&4 "Okay, bye."
2188            exit 1
2189            ;;
2190         esac
2191         ;;
2192     esac
2193     usedevel="$undef"
2194     ;;
2195 esac
2196 case "$usedevel" in
2197 $define|true|[yY]*)
2198         case "$versiononly" in
2199         '') versiononly="$define" ;;
2200         esac
2201         case "$installusrbinperl" in
2202         '') installusrbinperl="$undef" ;;
2203         esac
2204         ;;
2205 esac
2206
2207 : general instructions
2208 needman=true
2209 firsttime=true
2210 user=`(logname) 2>/dev/null`
2211 case "$user" in
2212 '') user=`whoami 2>&1`;;
2213 esac
2214 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2215         firsttime=false
2216         echo " "
2217         rp='Would you like to see the instructions?'
2218         dflt=n
2219         . ./myread
2220         case "$ans" in
2221         [yY]*) ;;
2222         *) needman=false;;
2223         esac
2224 fi
2225 if $needman; then
2226         cat <<EOH
2227
2228 This installation shell script will examine your system and ask you questions
2229 to determine how the perl5 package should be installed. If you get
2230 stuck on a question, you may use a ! shell escape to start a subshell or
2231 execute a command.  Many of the questions will have default answers in square
2232 brackets; typing carriage return will give you the default.
2233
2234 On some of the questions which ask for file or directory names you are allowed
2235 to use the ~name construct to specify the login directory belonging to "name",
2236 even if you don't have a shell which knows about that.  Questions where this is
2237 allowed will be marked "(~name ok)".
2238
2239 EOH
2240         rp=''
2241         dflt='Type carriage return to continue'
2242         . ./myread
2243         cat <<'EOH'
2244
2245 The prompter used in this script allows you to use shell variables and
2246 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2247 in the default answer, as if the default line was a set of arguments given to a
2248 script shell.  This means you may also use $* to repeat the whole default line,
2249 so you do not have to re-type everything to add something to the default.
2250
2251 Everytime there is a substitution, you will have to confirm.  If there is an
2252 error (e.g. an unmatched backtick), the default answer will remain unchanged
2253 and you will be prompted again.
2254
2255 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2256 the questions and use the computed defaults (or the previous answers if there
2257 was already a config.sh file). Type 'Configure -h' for a list of options.
2258 You may also start interactively and then answer '& -d' at any prompt to turn
2259 on the non-interactive behaviour for the remainder of the execution.
2260
2261 EOH
2262         . ./myread
2263         cat <<EOH
2264
2265 Much effort has been expended to ensure that this shell script will run on any
2266 Unix system.  If despite that it blows up on yours, your best bet is to edit
2267 Configure and run it again.  If you can't run Configure for some reason,
2268 you'll have to generate a config.sh file by hand.  Whatever problems you
2269 have, let me (perlbug@perl.org) know how I blew it.
2270
2271 This installation script affects things in two ways:
2272
2273 1) it may do direct variable substitutions on some of the files included
2274    in this kit.
2275 2) it builds a config.h file for inclusion in C programs.  You may edit
2276    any of these files as the need arises after running this script.
2277
2278 If you make a mistake on a question, there is no easy way to back up to it
2279 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2280 files.  Configure will offer to let you do this before it runs the SH files.
2281
2282 EOH
2283         dflt='Type carriage return to continue'
2284         . ./myread
2285         case "$firsttime" in
2286         true) echo $user >>../.config/instruct;;
2287         esac
2288 fi
2289
2290 : find out where common programs are
2291 echo " "
2292 echo "Locating common programs..." >&4
2293 cat <<EOSC >loc
2294 $startsh
2295 case \$# in
2296 0) exit 1;;
2297 esac
2298 thing=\$1
2299 shift
2300 dflt=\$1
2301 shift
2302 for dir in \$*; do
2303         case "\$thing" in
2304         .)
2305         if test -d \$dir/\$thing; then
2306                 echo \$dir
2307                 exit 0
2308         fi
2309         ;;
2310         *)
2311         for thisthing in \$dir/\$thing; do
2312                 : just loop through to pick last item
2313         done
2314         if test -f \$thisthing; then
2315                 echo \$thisthing
2316                 exit 0
2317         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2318                 echo \$thisthing
2319                 exit 0
2320         elif test -f \$dir/\$thing.exe; then
2321                 if test -n "$DJGPP"; then
2322                         echo \$dir/\$thing.exe
2323                 elif test "$eunicefix" != ":"; then
2324                         : on Eunice apparently
2325                         echo \$dir/\$thing
2326                 fi
2327                 exit 0
2328         fi
2329         ;;
2330         esac
2331 done
2332 echo \$dflt
2333 exit 1
2334 EOSC
2335 chmod +x loc
2336 $eunicefix loc
2337 loclist="
2338 awk
2339 cat
2340 chmod
2341 comm
2342 cp
2343 echo
2344 expr
2345 grep
2346 ls
2347 mkdir
2348 rm
2349 sed
2350 sort
2351 touch
2352 tr
2353 uniq
2354 "
2355 trylist="
2356 ar
2357 bison
2358 byacc
2359 cpp
2360 csh
2361 date
2362 egrep
2363 gmake
2364 gzip
2365 less
2366 ln
2367 make
2368 more
2369 nm
2370 nroff
2371 pg
2372 test
2373 uname
2374 zip
2375 "
2376 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2377 pth="$pth /lib /usr/lib"
2378 for file in $loclist; do
2379         eval xxx=\$$file
2380         case "$xxx" in
2381         /*|?:[\\/]*)
2382                 if test -f "$xxx"; then
2383                         : ok
2384                 else
2385                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2386                         xxx=`./loc $file $file $pth`
2387                 fi
2388                 ;;
2389         '') xxx=`./loc $file $file $pth`;;
2390         *) xxx=`./loc $xxx $xxx $pth`;;
2391         esac
2392         eval $file=$xxx$_exe
2393         eval _$file=$xxx
2394         case "$xxx" in
2395         /*)
2396                 echo $file is in $xxx.
2397                 ;;
2398         ?:[\\/]*)
2399                 echo $file is in $xxx.
2400                 ;;
2401         *)
2402                 echo "I don't know where '$file' is, and my life depends on it." >&4
2403                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2404                 exit 1
2405                 ;;
2406         esac
2407 done
2408 echo " "
2409 echo "Don't worry if any of the following aren't found..."
2410 say=offhand
2411 for file in $trylist; do
2412         eval xxx=\$$file
2413         case "$xxx" in
2414         /*|?:[\\/]*)
2415                 if test -f "$xxx"; then
2416                         : ok
2417                 else
2418                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2419                         xxx=`./loc $file $file $pth`
2420                 fi
2421                 ;;
2422         '') xxx=`./loc $file $file $pth`;;
2423         *) xxx=`./loc $xxx $xxx $pth`;;
2424         esac
2425         eval $file=$xxx$_exe
2426         eval _$file=$xxx
2427         case "$xxx" in
2428         /*)
2429                 echo $file is in $xxx.
2430                 ;;
2431         ?:[\\/]*)
2432                 echo $file is in $xxx.
2433                 ;;
2434         *)
2435                 echo "I don't see $file out there, $say."
2436                 say=either
2437                 ;;
2438         esac
2439 done
2440 case "$egrep" in
2441 egrep)
2442         echo "Substituting grep for egrep."
2443         egrep=$grep
2444         _egrep=$grep
2445         ;;
2446 esac
2447 case "$ln" in
2448 ln)
2449         echo "Substituting cp for ln."
2450         ln=$cp
2451         _ln=$cp
2452         ;;
2453 esac
2454 case "$make" in
2455 make)
2456         case "$gmake" in
2457         gmake)
2458         echo "I can't find make or gmake, and my life depends on it." >&4
2459         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2460         exit 1
2461         ;;
2462         esac
2463         ;;
2464 esac
2465 case "$gmake" in
2466 gmake)  ;;
2467 *)      # We can't have osname yet.
2468         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2469                 # Assume that gmake, if found, is definitely GNU make
2470                 # and prefer it over the system make.
2471                 echo "Substituting gmake for make."
2472                 make=$gmake
2473                 _make=$gmake
2474         fi
2475         ;;
2476 esac
2477 case "$test" in
2478 test)
2479         echo "Hopefully test is built into your sh."
2480         ;;
2481 *)
2482         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2483                 echo "Using the test built into your sh."
2484                 test=test
2485                 _test=test
2486         fi
2487         ;;
2488 esac
2489 case "$echo" in
2490 echo)
2491         echo "Hopefully echo is built into your sh."
2492         ;;
2493 '') ;;
2494 *)
2495         echo " "
2496 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2497         $echo $n "hi there$c" >foo1
2498         echo $n "hi there$c" >foo2
2499         if cmp foo1 foo2 >/dev/null 2>&1; then
2500                 echo "They are compatible.  In fact, they may be identical."
2501         else
2502                 case "$n" in
2503                 '-n') n='' c='\c';;
2504                 *) n='-n' c='';;
2505                 esac
2506                 cat <<FOO
2507 They are not compatible!  You are probably running ksh on a non-USG system.
2508 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2509 have echo built in and we may have to run some Bourne shell scripts.  That
2510 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2511
2512 FOO
2513                 $echo $n "The star should be here-->$c"
2514                 $echo "*"
2515         fi
2516         $rm -f foo1 foo2
2517         ;;
2518 esac
2519
2520 # This question was auctioned at YAPC::Europe-2007 in Vienna
2521 # I never promised you could answer it. I only auctioned the question.
2522 cat <<FOO
2523 The following message is sponsored by
2524
2525   Dresden.pm<--The stars should be here.
2526
2527 Dear Perl user, system administrator or package
2528 maintainer, the Perl community sends greetings to
2529 you. Do you (emblematical) greet back [Y/n]? n
2530
2531 FOO
2532
2533 : Check what type of C compiler we use
2534 cat <<EOS >trygcc
2535 $startsh
2536 EOS
2537 cat <<'EOSC' >>trygcc
2538 case "$cc" in
2539 '') ;;
2540 *)  $rm -f try try.*
2541     $cat >try.c <<EOM
2542 int main(int argc, char *argv[]) {
2543   return 0;
2544 }
2545 EOM
2546     if $cc -o try $ccflags $ldflags try.c; then
2547        :
2548     else
2549         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2550         despair=yes
2551         trygcc=yes
2552         case "$cc" in
2553         *gcc*) trygcc=no ;;
2554         esac
2555         # Skip this test because it gives a false match on output like:
2556         #    ./trygcc: line 23: cc: command not found
2557         # case "`$cc -v -c try.c 2>&1`" in
2558         # *gcc*) trygcc=no ;;
2559         # esac
2560         if $test X"$trygcc" = Xyes; then
2561             if gcc -o try -c try.c; then
2562                 echo " "
2563                 echo "You seem to have a working gcc, though." >&4
2564                 # Switching compilers may undo the work of hints files.
2565                 # The most common problem is -D_REENTRANT for threads.
2566                 # This heuristic catches that case, but gets false positives
2567                 # if -Dusethreads was not actually specified.  Better to
2568                 # bail out here with a useful message than fail 
2569                 # mysteriously later. Should we perhaps just try to
2570                 # re-invoke Configure -Dcc=gcc config_args ?
2571                 if $test -f usethreads.cbu; then
2572                         $cat >&4 <<EOM 
2573
2574 *** However, any setting of the C compiler flags (e.g. for thread support)
2575 *** will be lost.  It may be necessary for you to restart Configure and
2576 *** add -Dcc=gcc to your Configure command line.
2577
2578 EOM
2579                         rp="Would you like to go ahead and try gcc anyway?"
2580                         dflt=n
2581                 else
2582                         rp="Would you like to use it?"
2583                         dflt=y
2584                 fi
2585                 if $test -f myread; then
2586                     . ./myread
2587                 else
2588                     if $test -f UU/myread; then
2589                         . ./UU/myread
2590                     else
2591                         echo "Cannot find myread, sorry.  Aborting." >&2
2592                         exit 1
2593                     fi
2594                 fi  
2595                 case "$ans" in
2596                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2597                 esac
2598             fi
2599         fi
2600     fi
2601     $rm -f try try.*
2602     ;;
2603 esac
2604 EOSC
2605
2606 cat <<EOS >checkcc
2607 $startsh
2608 EOS
2609 cat <<'EOSC' >>checkcc
2610 case "$cc" in        
2611 '') ;;
2612 *)  $rm -f try try.*              
2613     $cat >try.c <<EOM
2614 int main(int argc, char *argv[]) {
2615   return 0;
2616 }
2617 EOM
2618     if $cc -o try $ccflags $ldflags try.c; then
2619        :
2620     else
2621         if $test X"$despair" = Xyes; then
2622            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2623         fi
2624         $cat >&4 <<EOM         
2625 You need to find a working C compiler.
2626 Either (purchase and) install the C compiler supplied by your OS vendor,
2627 or for a free C compiler try http://gcc.gnu.org/
2628 I cannot continue any further, aborting.
2629 EOM
2630         exit 1
2631     fi
2632     $rm -f try try.*
2633     ;;
2634 esac
2635 EOSC
2636
2637 : determine whether symbolic links are supported
2638 echo " "
2639 $touch blurfl
2640 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2641         echo "Symbolic links are supported." >&4
2642         lns="$ln -s"
2643 else
2644         echo "Symbolic links are NOT supported." >&4
2645         lns="$ln"
2646 fi
2647 $rm -f blurfl sym
2648
2649 : determine whether symbolic links are supported
2650 echo " "
2651 case "$lns" in
2652 *"ln"*" -s")
2653         echo "Checking how to test for symbolic links..." >&4
2654         $lns blurfl sym
2655         if $test "X$issymlink" = X; then
2656                 case "$newsh" in
2657                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2658                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2659                 esac
2660                 if test $? = 0; then
2661                         issymlink="test -h"
2662                 else
2663                         echo "Your builtin 'test -h' may be broken." >&4
2664                         case "$test" in
2665                         /*)     ;;
2666                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2667                                 for p in $pth
2668                                 do
2669                                         if test -f "$p/$test"; then
2670                                                 test="$p/$test"
2671                                                 break
2672                                         fi
2673                                 done
2674                                 ;;
2675                         esac
2676                         case "$test" in
2677                         /*)
2678                                 echo "Trying external '$test -h'." >&4
2679                                 issymlink="$test -h"
2680                                 if $test ! -h sym >/dev/null 2>&1; then
2681                                         echo "External '$test -h' is broken, too." >&4
2682                                         issymlink=''
2683                                 fi
2684                                 ;;
2685                         *)      issymlink='' ;;
2686                         esac
2687                 fi              
2688         fi
2689         if $test "X$issymlink" = X; then
2690                 if $test -L sym 2>/dev/null; then
2691                         issymlink="$test -L"
2692                         echo "The builtin '$test -L' worked." >&4
2693                 fi
2694         fi
2695         if $test "X$issymlink" != X; then
2696                 echo "You can test for symbolic links with '$issymlink'." >&4
2697         else
2698                 echo "I do not know how you can test for symbolic links." >&4
2699         fi
2700         $rm -f blurfl sym
2701         ;;
2702 *)      echo "No symbolic links, so not testing for their testing..." >&4
2703         ;;
2704 esac
2705 echo " "
2706
2707 : Make symlinks util
2708 case "$mksymlinks" in
2709 $define|true|[yY]*)
2710         case "$src" in
2711         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2712                 exit 1
2713                 ;;
2714         *)      case "$lns:$issymlink" in
2715                 *"ln"*" -s:"*"test -"?)
2716                         echo "Creating the symbolic links..." >&4
2717                         echo "(First creating the subdirectories...)" >&4
2718                         cd ..
2719                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2720                                 read directory
2721                                 test -z "$directory" && break
2722                                 mkdir -p $directory
2723                         done
2724                         # Sanity check 1.
2725                         if test ! -d t/base; then
2726                                 echo "Failed to create the subdirectories.  Aborting." >&4
2727                                 exit 1
2728                         fi
2729                         echo "(Then creating the symlinks...)" >&4
2730                         awk '{print $1}' $src/MANIFEST | while true; do
2731                                 read filename
2732                                 test -z "$filename" && break
2733                                 if test -f $filename; then
2734                                         if $issymlink $filename; then
2735                                                 rm -f $filename
2736                                         fi
2737                                 fi
2738                                 if test -f $filename; then
2739                                         echo "$filename already exists, not symlinking."
2740                                 else
2741                                         ln -s $src/$filename $filename
2742                                 fi
2743                         done
2744                         # Sanity check 2.
2745                         if test ! -f t/base/lex.t; then
2746                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2747                                 exit 1
2748                         fi
2749                         cd UU
2750                         ;;
2751                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2752                         ;;
2753                 esac
2754                 ;;
2755         esac
2756         ;;
2757 esac
2758
2759 : Check for Cross-Compilation
2760 case "$usecrosscompile" in
2761 $define|true|[yY]*)
2762         $echo "Cross-compiling..."
2763         croak=''
2764         case "$cc" in
2765         *-*-gcc) # A cross-compiling gcc, probably.
2766             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2767             ar=$targetarch-ar
2768             # leave out ld, choosing it is more complex
2769             nm=$targetarch-nm
2770             ranlib=$targetarch-ranlib
2771             $echo 'extern int foo;' > try.c
2772             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2773             shift
2774             if $test $# -gt 0; then
2775                 incpth="$incpth $*"
2776                 incpth="`$echo $incpth|$sed 's/^ //'`"
2777                 echo "Guessing incpth '$incpth'." >&4
2778                 for i in $*; do
2779                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2780                     if $test -d $j; then
2781                         libpth="$libpth $j"
2782                     fi
2783                 done   
2784                 libpth="`$echo $libpth|$sed 's/^ //'`"
2785                 echo "Guessing libpth '$libpth'." >&4
2786             fi
2787             $rm -f try.c
2788             ;;
2789         esac
2790         case "$targetarch" in
2791         '') echo "Targetarch not defined." >&4; croak=y ;;
2792         *)  echo "Using targetarch $targetarch." >&4 ;;
2793         esac
2794         case "$incpth" in
2795         '') echo "Incpth not defined." >&4; croak=y ;;
2796         *)  echo "Using incpth '$incpth'." >&4 ;;
2797         esac
2798         case "$libpth" in
2799         '') echo "Libpth not defined." >&4; croak=y ;;
2800         *)  echo "Using libpth '$libpth'." >&4 ;;
2801         esac
2802         case "$usrinc" in
2803         '') for i in $incpth; do
2804                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2805                     usrinc=$i
2806                     echo "Guessing usrinc $usrinc." >&4
2807                     break
2808                 fi
2809             done
2810             case "$usrinc" in
2811             '') echo "Usrinc not defined." >&4; croak=y ;;
2812             esac
2813             ;;
2814         *)  echo "Using usrinc $usrinc." >&4 ;;
2815         esac
2816         case "$targethost" in
2817         '') echo "Targethost not defined." >&4; croak=y ;;
2818         *)  echo "Using targethost $targethost." >&4
2819         esac
2820         locincpth=' '
2821         loclibpth=' '
2822         case "$croak" in
2823         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2824         esac
2825         case "$src" in
2826         /*) run=$src/Cross/run
2827             targetmkdir=$src/Cross/mkdir
2828             to=$src/Cross/to
2829             from=$src/Cross/from
2830             ;;
2831         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2832             run=$pwd/Cross/run
2833             targetmkdir=$pwd/Cross/mkdir
2834             to=$pwd/Cross/to
2835             from=$pwd/Cross/from
2836             ;;
2837         esac
2838         case "$targetrun" in
2839         '') targetrun=ssh ;;
2840         esac
2841         case "$targetto" in
2842         '') targetto=scp ;;
2843         esac
2844         case "$targetfrom" in
2845         '') targetfrom=scp ;;
2846         esac
2847         run=$run-$targetrun
2848         to=$to-$targetto
2849         from=$from-$targetfrom
2850         case "$targetdir" in
2851         '')  targetdir=/tmp
2852              echo "Guessing targetdir $targetdir." >&4
2853              ;;
2854         esac
2855         case "$targetuser" in
2856         '')  targetuser=root
2857              echo "Guessing targetuser $targetuser." >&4
2858              ;;
2859         esac
2860         case "$targetfrom" in
2861         scp)    q=-q ;;
2862         *)      q='' ;;
2863         esac
2864         case "$targetrun" in
2865         ssh|rsh)
2866             cat >$run <<EOF
2867 #!/bin/sh
2868 case "\$1" in
2869 -cwd)
2870   shift
2871   cwd=\$1
2872   shift
2873   ;;
2874 esac
2875 case "\$cwd" in
2876 '') cwd=$targetdir ;;
2877 esac
2878 exe=\$1
2879 shift
2880 if $test ! -f \$exe.xok; then
2881   $to \$exe
2882   $touch \$exe.xok
2883 fi
2884 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2885 EOF
2886             ;;
2887         *)  echo "Unknown targetrun '$targetrun'" >&4
2888             exit 1
2889             ;;
2890         esac
2891         case "$targetmkdir" in
2892         */Cross/mkdir)
2893             cat >$targetmkdir <<EOF
2894 #!/bin/sh
2895 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2896 EOF
2897             $chmod a+rx $targetmkdir
2898             ;;
2899         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2900             exit 1
2901             ;;
2902         esac
2903         case "$targetto" in
2904         scp|rcp)
2905             cat >$to <<EOF
2906 #!/bin/sh
2907 for f in \$@
2908 do
2909   case "\$f" in
2910   /*)
2911     $targetmkdir \`dirname \$f\`
2912     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2913     ;;
2914   *)
2915     $targetmkdir $targetdir/\`dirname \$f\`
2916     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2917     ;;
2918   esac
2919 done
2920 exit 0
2921 EOF
2922             ;;
2923         cp) cat >$to <<EOF
2924 #!/bin/sh
2925 for f in \$@
2926 do
2927   case "\$f" in
2928   /*)
2929     $mkdir -p $targetdir/\`dirname \$f\`
2930     $cp \$f $targetdir/\$f || exit 1
2931     ;;
2932   *)
2933     $targetmkdir $targetdir/\`dirname \$f\`
2934     $cp \$f $targetdir/\$f || exit 1
2935     ;;
2936   esac
2937 done
2938 exit 0
2939 EOF
2940             ;;
2941         *)  echo "Unknown targetto '$targetto'" >&4
2942             exit 1
2943             ;;
2944         esac
2945         case "$targetfrom" in
2946         scp|rcp)
2947           cat >$from <<EOF
2948 #!/bin/sh
2949 for f in \$@
2950 do
2951   $rm -f \$f
2952   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2953 done
2954 exit 0
2955 EOF
2956             ;;
2957         cp) cat >$from <<EOF
2958 #!/bin/sh
2959 for f in \$@
2960 do
2961   $rm -f \$f
2962   cp $targetdir/\$f . || exit 1
2963 done
2964 exit 0
2965 EOF
2966             ;;
2967         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2968             exit 1
2969             ;;
2970         esac
2971         if $test ! -f $run; then
2972             echo "Target 'run' script '$run' not found." >&4
2973         else
2974             $chmod a+rx $run
2975         fi
2976         if $test ! -f $to; then
2977             echo "Target 'to' script '$to' not found." >&4
2978         else
2979             $chmod a+rx $to
2980         fi
2981         if $test ! -f $from; then
2982             echo "Target 'from' script '$from' not found." >&4
2983         else
2984             $chmod a+rx $from
2985         fi
2986         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2987             exit 1
2988         fi
2989         cat >&4 <<EOF
2990 Using '$run' for remote execution,
2991 and '$from' and '$to'
2992 for remote file transfer.
2993 EOF
2994         ;;
2995 *)      run=''
2996         to=:
2997         from=:
2998         usecrosscompile='undef'
2999         targetarch=''
3000         ;;
3001 esac
3002
3003 : see whether [:lower:] and [:upper:] are supported character classes
3004 echo " "
3005 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3006 ABYZ)
3007         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3008         up='[:upper:]'
3009         low='[:lower:]'
3010         ;;
3011 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3012         # (0xd9 and 0xe2), therefore that is a nice testing point.
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 | $tr R-S r-s 2>/dev/null`" in
3022             rs) up='A-Z'
3023                 low='a-z'
3024                 ;;
3025             esac
3026         fi
3027         if test "X$up" = X -o "X$low" = X; then
3028             case "`echo RS | od -x 2>/dev/null`" in
3029             *D9E2*|*d9e2*)
3030                 echo "Hey, this might be EBCDIC." >&4
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                 if test "X$up" = X -o "X$low" = X; then
3039                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3040                     rs) up='A-IJ-RS-Z'
3041                         low='a-ij-rs-z'
3042                         ;;
3043                     esac
3044                 fi
3045                 ;;
3046             esac
3047         fi
3048 esac
3049 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3050 rs)
3051     echo "Using $up and $low to convert case." >&4
3052     ;;
3053 *)
3054     echo "I don't know how to translate letters from upper to lower case." >&4
3055     echo "Your tr is not acting any way I know of." >&4
3056     exit 1
3057     ;;
3058 esac
3059 : set up the translation script tr, must be called with ./tr of course
3060 cat >tr <<EOSC
3061 $startsh
3062 case "\$1\$2" in
3063 '[A-Z][a-z]') exec $tr '$up' '$low';;
3064 '[a-z][A-Z]') exec $tr '$low' '$up';;
3065 esac
3066 exec $tr "\$@"
3067 EOSC
3068 chmod +x tr
3069 $eunicefix tr
3070
3071 : Try to determine whether config.sh was made on this system
3072 case "$config_sh" in
3073 '')
3074 myuname=`$uname -a 2>/dev/null`
3075 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3076 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3077 # because the A-Z/a-z are not consecutive.
3078 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3079         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3080 newmyuname="$myuname"
3081 dflt=n
3082 case "$knowitall" in
3083 '')
3084         if test -f ../config.sh; then
3085                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3086                         eval "`grep myuname= ../config.sh`"
3087                 fi
3088                 if test "X$myuname" = "X$newmyuname"; then
3089                         dflt=y
3090                 fi
3091         fi
3092         ;;
3093 *) dflt=y;;
3094 esac
3095
3096 : Get old answers from old config file if Configure was run on the
3097 : same system, otherwise use the hints.
3098 hint=default
3099 cd ..
3100 if test -f config.sh; then
3101         echo " "
3102         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3103         . UU/myread
3104         case "$ans" in
3105         n*|N*) echo "OK, I'll ignore it."
3106                 mv config.sh config.sh.old
3107                 myuname="$newmyuname"
3108                 ;;
3109         *)  echo "Fetching default answers from your old config.sh file..." >&4
3110                 tmp_n="$n"
3111                 tmp_c="$c"
3112                 tmp_sh="$sh"
3113                 . ./config.sh
3114                 cp config.sh UU
3115                 n="$tmp_n"
3116                 c="$tmp_c"
3117                 : Older versions did not always set $sh.  Catch re-use of such
3118                 : an old config.sh.
3119                 case "$sh" in
3120                 '') sh="$tmp_sh" ;;
3121                 esac
3122                 hint=previous
3123                 ;;
3124         esac
3125 fi
3126 . ./UU/checkcc
3127 if test ! -f config.sh; then
3128         $cat <<EOM
3129
3130 First time through, eh?  I have some defaults handy for some systems
3131 that need some extra help getting the Configure answers right:
3132
3133 EOM
3134         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3135         dflt=''
3136         : Half the following guesses are probably wrong... If you have better
3137         : tests or hints, please send them to perlbug@perl.org
3138         : The metaconfig authors would also appreciate a copy...
3139         $test -f /irix && osname=irix
3140         $test -f /xenix && osname=sco_xenix
3141         $test -f /dynix && osname=dynix
3142         $test -f /dnix && osname=dnix
3143         $test -f /lynx.os && osname=lynxos
3144         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3145         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3146         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3147         $test -f /bin/mips && /bin/mips && osname=mips
3148         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3149                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3150         $test -d /usr/apollo/bin && osname=apollo
3151         $test -f /etc/saf/_sactab && osname=svr4
3152         $test -d /usr/include/minix && osname=minix
3153         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3154         if $test -d /MachTen -o -d /MachTen_Folder; then
3155                 osname=machten
3156                 if $test -x /sbin/version; then
3157                         osvers=`/sbin/version | $awk '{print $2}' |
3158                         $sed -e 's/[A-Za-z]$//'`
3159                 elif $test -x /usr/etc/version; then
3160                         osvers=`/usr/etc/version | $awk '{print $2}' |
3161                         $sed -e 's/[A-Za-z]$//'`
3162                 else
3163                         osvers="$2.$3"
3164                 fi
3165         fi
3166
3167         $test -f /sys/posix.dll &&
3168                 $test -f /usr/bin/what &&
3169                 set X `/usr/bin/what /sys/posix.dll` &&
3170                 $test "$3" = UWIN &&
3171                 osname=uwin &&
3172                 osvers="$5"
3173
3174         if $test -f $uname; then
3175                 set X $myuname
3176                 shift
3177
3178                 case "$5" in
3179                 fps*) osname=fps ;;
3180                 mips*)
3181                         case "$4" in
3182                         umips) osname=umips ;;
3183                         *) osname=mips ;;
3184                         esac;;
3185                 [23]100) osname=mips ;;
3186                 next*) osname=next ;;
3187                 i386*)
3188                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3189                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3190                                 osname='sco'
3191                                 osvers=$tmp
3192                         elif $test -f /etc/kconfig; then
3193                                 osname=isc
3194                                 if test "$lns" = "$ln -s"; then
3195                                         osvers=4
3196                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3197                                         osvers=3
3198                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3199                                         osvers=2
3200                                 fi
3201                         fi
3202                         tmp=''
3203                         ;;
3204                 pc*)
3205                         if test -n "$DJGPP"; then
3206                                 osname=dos
3207                                 osvers=djgpp
3208                         fi
3209                         ;;
3210                 esac
3211
3212                 case "$1" in
3213                 aix) osname=aix
3214                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3215                         case "$tmp" in
3216                         # oslevel can fail with:
3217                         # oslevel: Unable to acquire lock.
3218                         *not\ found) osvers="$4"."$3" ;;
3219                         '<3240'|'<>3240') osvers=3.2.0 ;;
3220                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3221                         '=3250'|'>3250') osvers=3.2.5 ;;
3222                         *) osvers=$tmp;;
3223                         esac
3224                         ;;
3225                 bsd386) osname=bsd386
3226                         osvers=`$uname -r`
3227                         ;;
3228                 cygwin*) osname=cygwin
3229                         osvers="$3"
3230                         ;;
3231                 *dc.osx) osname=dcosx
3232                         osvers="$3"
3233                         ;;
3234                 dnix) osname=dnix
3235                         osvers="$3"
3236                         ;;
3237                 domainos) osname=apollo
3238                         osvers="$3"
3239                         ;;
3240                 dgux)   osname=dgux
3241                         osvers="$3"
3242                         ;;
3243                 dragonfly) osname=dragonfly
3244                         osvers="$3"
3245                         ;;
3246                 dynixptx*) osname=dynixptx
3247                         osvers=`echo "$4"|sed 's/^v//'`
3248                         ;;
3249                 freebsd) osname=freebsd
3250                         osvers="$3" ;;
3251                 genix)  osname=genix ;;
3252                 gnu)    osname=gnu
3253                         osvers="$3" ;;
3254                 hp*)    osname=hpux
3255                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3256                         ;;
3257                 irix*)  osname=irix
3258                         case "$3" in
3259                         4*) osvers=4 ;;
3260                         5*) osvers=5 ;;
3261                         *)      osvers="$3" ;;
3262                         esac
3263                         ;;
3264                 linux)  osname=linux
3265                         case "$3" in
3266                         *)      osvers="$3" ;;
3267                         esac
3268                         ;;
3269                 MiNT)   osname=mint
3270                         ;;
3271                 netbsd*) osname=netbsd
3272                         osvers="$3"
3273                         ;;
3274                 news-os) osvers="$3"
3275                         case "$3" in
3276                         4*) osname=newsos4 ;;
3277                         *) osname=newsos ;;
3278                         esac
3279                         ;;
3280                 next*) osname=next ;;
3281                 nonstop-ux) osname=nonstopux ;;
3282                 openbsd) osname=openbsd
3283                         osvers="$3"
3284                         ;;
3285                 os2)    osname=os2
3286                         osvers="$4"
3287                         ;;
3288                 POSIX-BC | posix-bc ) osname=posix-bc
3289                         osvers="$3"
3290                         ;;
3291                 powerux | power_ux | powermax_os | powermaxos | \
3292                 powerunix | power_unix) osname=powerux
3293                         osvers="$3"
3294                         ;;
3295                 qnx) osname=qnx
3296                         osvers="$4"
3297                         ;;
3298                 solaris) osname=solaris
3299                         case "$3" in
3300                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3301                         *)      osvers="$3" ;;
3302                         esac
3303                         ;;
3304                 sunos) osname=sunos
3305                         case "$3" in
3306                         5*) osname=solaris
3307                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3308                         *)      osvers="$3" ;;
3309                         esac
3310                         ;;
3311                 titanos) osname=titanos
3312                         case "$3" in
3313                         1*) osvers=1 ;;
3314                         2*) osvers=2 ;;
3315                         3*) osvers=3 ;;
3316                         4*) osvers=4 ;;
3317                         *)      osvers="$3" ;;
3318                         esac
3319                         ;;
3320                 ultrix) osname=ultrix
3321                         osvers="$3"
3322                         ;;
3323                 osf1|mls+)      case "$5" in
3324                                 alpha)
3325                                         osname=dec_osf
3326                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3327                                         case "$osvers" in
3328                                         [1-9].[0-9]*) ;;
3329                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3330                                         esac
3331                                         ;;
3332                         hp*)    osname=hp_osf1  ;;
3333                         mips)   osname=mips_osf1 ;;
3334                         esac
3335                         ;;
3336                 # UnixWare 7.1.2 is known as Open UNIX 8
3337                 openunix|unixware) osname=svr5
3338                         osvers="$4"
3339                         ;;
3340                 uts)    osname=uts
3341                         osvers="$3"
3342                         ;;
3343                 vos) osvers="$3"
3344                         ;;
3345                 $2) case "$osname" in
3346                         *isc*) ;;
3347                         *freebsd*) ;;
3348                         svr*)
3349                                 : svr4.x or possibly later
3350                                 case "svr$3" in
3351                                 ${osname}*)
3352                                         osname=svr$3
3353                                         osvers=$4
3354                                         ;;
3355                                 esac
3356                                 case "$osname" in
3357                                 svr4.0)
3358                                         : Check for ESIX
3359                                         if test -f /stand/boot ; then
3360                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3361                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3362                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3363                                                         if test -n "$isesix"; then
3364                                                                 osname=esix4
3365                                                         fi
3366                                                 fi
3367                                         fi
3368                                         ;;
3369                                 esac
3370                                 ;;
3371                         *)      if test -f /etc/systemid; then
3372                                         osname=sco
3373                                         set `echo $3 | $sed 's/\./ /g'` $4
3374                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3375                                                 osvers=$1.$2.$3
3376                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3377                                                 osvers=$1.$2
3378                                         elif $test -f $src/hints/sco_$1.sh; then
3379                                                 osvers=$1
3380                                         fi
3381                                 else
3382                                         case "$osname" in
3383                                         '') : Still unknown.  Probably a generic Sys V.
3384                                                 osname="sysv"
3385                                                 osvers="$3"
3386                                                 ;;
3387                                         esac
3388                                 fi
3389                                 ;;
3390                         esac
3391                         ;;
3392                 *)      case "$osname" in
3393                         '') : Still unknown.  Probably a generic BSD.
3394                                 osname="$1"
3395                                 osvers="$3"
3396                                 ;;
3397                         esac
3398                         ;;
3399                 esac
3400         else
3401                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3402                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3403                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3404                                 osname=news_os
3405                         fi
3406                         $rm -f UU/kernel.what
3407                 elif test -d c:/. -o -n "$is_os2" ; then
3408                         set X $myuname
3409                         osname=os2
3410                         osvers="$5"
3411                 fi
3412         fi
3413
3414         case "$targetarch" in
3415         '') ;;
3416         *)  hostarch=$osname
3417             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3418             osvers=''
3419             ;;
3420         esac
3421
3422         : Now look for a hint file osname_osvers, unless one has been
3423         : specified already.
3424         case "$hintfile" in
3425         ''|' ')
3426                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3427                 : Also try without trailing minor version numbers.
3428                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3429                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3430                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3431                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3432                 case "$file" in
3433                 '') dflt=none ;;
3434                 *)  case "$osvers" in
3435                         '') dflt=$file
3436                                 ;;
3437                         *)  if $test -f $src/hints/$file.sh ; then
3438                                         dflt=$file
3439                                 elif $test -f $src/hints/$xfile.sh ; then
3440                                         dflt=$xfile
3441                                 elif $test -f $src/hints/$xxfile.sh ; then
3442                                         dflt=$xxfile
3443                                 elif $test -f $src/hints/$xxxfile.sh ; then
3444                                         dflt=$xxxfile
3445                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3446                                         dflt=$xxxxfile
3447                                 elif $test -f "$src/hints/${osname}.sh" ; then
3448                                         dflt="${osname}"
3449                                 else
3450                                         dflt=none
3451                                 fi
3452                                 ;;
3453                         esac
3454                         ;;
3455                 esac
3456                 if $test -f Policy.sh ; then
3457                         case "$dflt" in
3458                         *Policy*) ;;
3459                         none) dflt="Policy" ;;
3460                         *) dflt="Policy $dflt" ;;
3461                         esac
3462                 fi
3463                 ;;
3464         *)
3465                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3466                 ;;
3467         esac
3468
3469         if $test -f Policy.sh ; then
3470                 $cat <<EOM
3471
3472 There's also a Policy hint file available, which should make the
3473 site-specific (policy) questions easier to answer.
3474 EOM
3475
3476         fi
3477
3478         $cat <<EOM
3479
3480 You may give one or more space-separated answers, or "none" if appropriate.
3481 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3482 previous run of Configure, you may specify it as well as or instead of
3483 OS-specific hints.  If hints are provided for your OS, you should use them:
3484 although Perl can probably be built without hints on many platforms, using
3485 hints often improve performance and may enable features that Configure can't
3486 set up on its own. If there are no hints that match your OS, specify "none";
3487 DO NOT give a wrong version or a wrong OS.
3488
3489 EOM
3490
3491         rp="Which of these apply, if any?"
3492         . UU/myread
3493         tans=$ans
3494         for file in $tans; do
3495                 if $test X$file = XPolicy -a -f Policy.sh; then
3496                         . Policy.sh
3497                         $cat Policy.sh >> UU/config.sh
3498                 elif $test -f $src/hints/$file.sh; then
3499                         . $src/hints/$file.sh
3500                         $cat $src/hints/$file.sh >> UU/config.sh
3501                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3502                         : nothing
3503                 else
3504                         : Give one chance to correct a possible typo.
3505                         echo "$file.sh does not exist"
3506                         dflt=$file
3507                         rp="hint to use instead?"
3508                         . UU/myread
3509                         for file in $ans; do
3510                                 if $test -f "$src/hints/$file.sh"; then
3511                                         . $src/hints/$file.sh
3512                                         $cat $src/hints/$file.sh >> UU/config.sh
3513                                 elif $test X$ans = X -o X$ans = Xnone ; then
3514                                         : nothing
3515                                 else
3516                                         echo "$file.sh does not exist -- ignored."
3517                                 fi
3518                         done
3519                 fi
3520         done
3521
3522         hint=recommended
3523         : Remember our hint file for later.
3524         if $test -f "$src/hints/$file.sh" ; then
3525                 hintfile="$file"
3526         else
3527                 hintfile=''
3528         fi
3529 fi
3530 cd UU
3531 ;;
3532 *)
3533         echo " "
3534         echo "Fetching default answers from $config_sh..." >&4
3535         tmp_n="$n"
3536         tmp_c="$c"
3537         cd ..
3538         cp $config_sh config.sh 2>/dev/null
3539         chmod +w config.sh
3540         . ./config.sh
3541         cd UU
3542         cp ../config.sh .
3543         n="$tmp_n"
3544         c="$tmp_c"
3545         hint=previous
3546         ;;
3547 esac
3548 test "$override" && . ./optdef.sh
3549
3550 : Restore computed paths
3551 for file in $loclist $trylist; do
3552         eval $file="\$_$file"
3553 done
3554
3555 cat << EOM
3556
3557 Configure uses the operating system name and version to set some defaults.
3558 The default value is probably right if the name rings a bell. Otherwise,
3559 since spelling matters for me, either accept the default or answer "none"
3560 to leave it blank.
3561
3562 EOM
3563 case "$osname" in
3564         ''|' ')
3565                 case "$hintfile" in
3566                 ''|' '|none) dflt=none ;;
3567                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3568                 esac
3569                 ;;
3570         *) dflt="$osname" ;;
3571 esac
3572 rp="Operating system name?"
3573 . ./myread
3574 case "$ans" in
3575 none)  osname='' ;;
3576 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3577 esac
3578 echo " "
3579 case "$osvers" in
3580         ''|' ')
3581                 case "$hintfile" in
3582                 ''|' '|none) dflt=none ;;
3583                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3584                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3585                         case "$dflt" in
3586                         ''|' ') dflt=none ;;
3587                         esac
3588                         ;;
3589                 esac
3590                 ;;
3591         *) dflt="$osvers" ;;
3592 esac
3593 rp="Operating system version?"
3594 . ./myread
3595 case "$ans" in
3596 none)  osvers='' ;;
3597 *) osvers="$ans" ;;
3598 esac
3599
3600
3601 . ./posthint.sh
3602
3603 : who configured the system
3604 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3605 case "$cf_by" in
3606 "")
3607         cf_by=`(logname) 2>/dev/null`
3608         case "$cf_by" in
3609         "")
3610                 cf_by=`(whoami) 2>/dev/null`
3611                 case "$cf_by" in
3612                 "") cf_by=unknown ;;
3613                 esac ;;
3614         esac ;;
3615 esac
3616
3617 : decide how portable to be.  Allow command line overrides.
3618 case "$d_portable" in
3619 "$undef") ;;
3620 *)      d_portable="$define" ;;
3621 esac
3622
3623 : set up shell script to do ~ expansion
3624 cat >filexp <<EOSS
3625 $startsh
3626 : expand filename
3627 case "\$1" in
3628  \~/*|\~)
3629         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3630         ;;
3631  \~*)
3632         if $test -f /bin/csh; then
3633                 /bin/csh -f -c "glob \$1"
3634                 failed=\$?
3635                 echo ""
3636                 exit \$failed
3637         else
3638                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3639                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3640                 if $test ! -d "\$dir"; then
3641                         me=\`basename \$0\`
3642                         echo "\$me: can't locate home directory for: \$name" >&2
3643                         exit 1
3644                 fi
3645                 case "\$1" in
3646                 */*)
3647                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3648                         ;;
3649                 *)
3650                         echo \$dir
3651                         ;;
3652                 esac
3653         fi
3654         ;;
3655 *)
3656         echo \$1
3657         ;;
3658 esac
3659 EOSS
3660 chmod +x filexp
3661 $eunicefix filexp
3662
3663 : now set up to get a file name
3664 cat <<EOS >getfile
3665 $startsh
3666 EOS
3667 cat <<'EOSC' >>getfile
3668 tilde=''
3669 fullpath=''
3670 already=''
3671 skip=''
3672 none_ok=''
3673 exp_file=''
3674 nopath_ok=''
3675 orig_rp="$rp"
3676 orig_dflt="$dflt"
3677 case "$gfpth" in
3678 '') gfpth='.' ;;
3679 esac
3680
3681 case "$fn" in
3682 *\(*)
3683         : getfile will accept an answer from the comma-separated list
3684         : enclosed in parentheses even if it does not meet other criteria.
3685         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3686         fn=`echo $fn | sed 's/(.*)//'`
3687         ;;
3688 esac
3689
3690 case "$fn" in
3691 *:*)
3692         loc_file=`expr $fn : '.*:\(.*\)'`
3693         fn=`expr $fn : '\(.*\):.*'`
3694         ;;
3695 esac
3696
3697 case "$fn" in
3698 *~*) tilde=true;;
3699 esac
3700 case "$fn" in
3701 */*) fullpath=true;;
3702 esac
3703 case "$fn" in
3704 *+*) skip=true;;
3705 esac
3706 case "$fn" in
3707 *n*) none_ok=true;;
3708 esac
3709 case "$fn" in
3710 *e*) exp_file=true;;
3711 esac
3712 case "$fn" in
3713 *p*) nopath_ok=true;;
3714 esac
3715
3716 case "$fn" in
3717 *f*) type='File';;
3718 *d*) type='Directory';;
3719 *l*) type='Locate';;
3720 esac
3721
3722 what="$type"
3723 case "$what" in
3724 Locate) what='File';;
3725 esac
3726
3727 case "$exp_file" in
3728 '')
3729         case "$d_portable" in
3730         "$define") ;;
3731         *) exp_file=true;;
3732         esac
3733         ;;
3734 esac
3735
3736 cd ..
3737 while test "$type"; do
3738         redo=''
3739         rp="$orig_rp"
3740         dflt="$orig_dflt"
3741         case "$tilde" in
3742         true) rp="$rp (~name ok)";;
3743         esac
3744         . UU/myread
3745         if test -f UU/getfile.ok && \
3746                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3747         then
3748                 value="$ans"
3749                 ansexp="$ans"
3750                 break
3751         fi
3752         case "$ans" in
3753         none)
3754                 value=''
3755                 ansexp=''
3756                 case "$none_ok" in
3757                 true) type='';;
3758                 esac
3759                 ;;
3760         *)
3761                 case "$tilde" in
3762                 '') value="$ans"
3763                         ansexp="$ans";;
3764                 *)
3765                         value=`UU/filexp $ans`
3766                         case $? in
3767                         0)
3768                                 if test "$ans" != "$value"; then
3769                                         echo "(That expands to $value on this system.)"
3770                                 fi
3771                                 ;;
3772                         *) value="$ans";;
3773                         esac
3774                         ansexp="$value"
3775                         case "$exp_file" in
3776                         '') value="$ans";;
3777                         esac
3778                         ;;
3779                 esac
3780                 case "$fullpath" in
3781                 true)
3782                         case "$ansexp" in
3783                         /*) value="$ansexp" ;;
3784                         [a-zA-Z]:/*) value="$ansexp" ;;
3785                         *)
3786                                 redo=true
3787                                 case "$already" in
3788                                 true)
3789                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3790                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3791                                         ;;
3792                                 *)
3793                                 echo "Please give a full path name, starting with slash." >&4
3794                                         case "$tilde" in
3795                                         true)
3796                                 echo "Note that using ~name is ok provided it expands well." >&4
3797                                                 already=true
3798                                                 ;;
3799                                         esac
3800                                 esac
3801                                 ;;
3802                         esac
3803                         ;;
3804                 esac
3805                 case "$redo" in
3806                 '')
3807                         case "$type" in
3808                         File)
3809                                 for fp in $gfpth; do
3810                                         if test "X$fp" = X.; then
3811                                             pf="$ansexp"
3812                                         else    
3813                                             pf="$fp/$ansexp"
3814                                         fi
3815                                         if test -f "$pf"; then
3816                                                 type=''
3817                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3818                                         then
3819                                                 echo "($value is not a plain file, but that's ok.)"
3820                                                 type=''
3821                                         fi
3822                                         if test X"$type" = X; then
3823                                             value="$pf"
3824                                             break
3825                                         fi
3826                                 done
3827                                 ;;
3828                         Directory)
3829                                 for fp in $gfpth; do
3830                                         if test "X$fp" = X.; then
3831                                             dir="$ans"
3832                                             direxp="$ansexp"
3833                                         else    
3834                                             dir="$fp/$ansexp"
3835                                             direxp="$fp/$ansexp"
3836                                         fi
3837                                         if test -d "$direxp"; then
3838                                                 type=''
3839                                                 value="$dir"
3840                                                 break
3841                                         fi
3842                                 done
3843                                 ;;
3844                         Locate)
3845                                 if test -d "$ansexp"; then
3846                                         echo "(Looking for $loc_file in directory $value.)"
3847                                         value="$value/$loc_file"
3848                                         ansexp="$ansexp/$loc_file"
3849                                 fi
3850                                 if test -f "$ansexp"; then
3851                                         type=''
3852                                 fi
3853                                 case "$nopath_ok" in
3854                                 true)   case "$value" in
3855                                         */*) ;;
3856                                         *)      echo "Assuming $value will be in people's path."
3857                                                 type=''
3858                                                 ;;
3859                                         esac
3860                                         ;;
3861                                 esac
3862                                 ;;
3863                         esac
3864
3865                         case "$skip" in
3866                         true) type='';
3867                         esac
3868
3869                         case "$type" in
3870                         '') ;;
3871                         *)
3872                                 if test "$fastread" = yes; then
3873                                         dflt=y
3874                                 else
3875                                         dflt=n
3876                                 fi
3877                                 rp="$what $value doesn't exist.  Use that name anyway?"
3878                                 . UU/myread
3879                                 dflt=''
3880                                 case "$ans" in
3881                                 y*) type='';;
3882                                 *) echo " ";;
3883                                 esac
3884                                 ;;
3885                         esac
3886                         ;;
3887                 esac
3888                 ;;
3889         esac
3890 done
3891 cd UU
3892 ans="$value"
3893 rp="$orig_rp"
3894 dflt="$orig_dflt"
3895 rm -f getfile.ok
3896 test "X$gfpthkeep" != Xy && gfpth=""
3897 EOSC
3898
3899 : determine root of directory hierarchy where package will be installed.
3900 case "$prefix" in
3901 '')
3902         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3903         ;;
3904 *?/)
3905         dflt=`echo "$prefix" | sed 's/.$//'`
3906         ;;
3907 *)
3908         dflt="$prefix"
3909         ;;
3910 esac
3911 $cat <<EOM
3912
3913 By default, $package will be installed in $dflt/bin, manual pages
3914 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3915 installation directories. Typically this is something like /usr/local.
3916 If you wish to have binaries under /usr/bin but other parts of the
3917 installation under /usr/local, that's ok: you will be prompted
3918 separately for each of the installation directories, the prefix being
3919 only used to set the defaults.
3920
3921 EOM
3922 fn=d~
3923 rp='Installation prefix to use?'
3924 . ./getfile
3925 oldprefix=''
3926 case "$prefix" in
3927 '') ;;
3928 *)
3929         case "$ans" in
3930         "$prefix") ;;
3931         *) oldprefix="$prefix";;
3932         esac
3933         ;;
3934 esac
3935 prefix="$ans"
3936 prefixexp="$ansexp"
3937
3938 : allow them to override the AFS root
3939 case "$afsroot" in
3940 '')     afsroot=/afs ;;
3941 *)      afsroot=$afsroot ;;
3942 esac
3943
3944 : is AFS running?
3945 echo " "
3946 case "$afs" in
3947 $define|true)   afs=true ;;
3948 $undef|false)   afs=false ;;
3949 *)      if $test -d $afsroot; then
3950                 afs=true
3951         else
3952                 afs=false
3953         fi
3954         ;;
3955 esac
3956 if $afs; then
3957         echo "AFS may be running... I'll be extra cautious then..." >&4
3958 else
3959         echo "AFS does not seem to be running..." >&4
3960 fi
3961
3962 : determine installation prefix for where package is to be installed.
3963 if $afs; then 
3964 $cat <<EOM
3965
3966 Since you are running AFS, I need to distinguish the directory in which
3967 files will reside from the directory in which they are installed (and from
3968 which they are presumably copied to the former directory by occult means).
3969
3970 EOM
3971         case "$installprefix" in
3972         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3973         *) dflt="$installprefix";;
3974         esac
3975 else
3976 $cat <<EOM
3977
3978 In some special cases, particularly when building $package for distribution,
3979 it is convenient to distinguish the directory in which files should be
3980 installed from the directory ($prefix) in which they will
3981 eventually reside.  For most users, these two directories are the same.
3982
3983 EOM
3984         case "$installprefix" in
3985         '') dflt=$prefix ;;
3986         *) dflt=$installprefix;;
3987         esac
3988 fi
3989 fn=d~
3990 rp='What installation prefix should I use for installing files?'
3991 . ./getfile
3992 installprefix="$ans"
3993 installprefixexp="$ansexp"
3994
3995 : Perform the prefixexp/installprefixexp correction if necessary
3996 cat <<EOS >installprefix
3997 $startsh
3998 EOS
3999 cat <<'EOSC' >>installprefix
4000 : Change installation prefix, if necessary.
4001 if $test X"$prefix" != X"$installprefix"; then
4002     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4003 else
4004     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4005 fi
4006 EOSC
4007 chmod +x installprefix
4008 $eunicefix installprefix
4009
4010 : Set variables such as privlib and privlibexp from the output of ./getfile
4011 : performing the prefixexp/installprefixexp correction if necessary.
4012 cat <<EOS >setprefixvar
4013 $startsh
4014 EOS
4015 cat <<'EOSC' >>setprefixvar
4016 eval "${prefixvar}=\"\$ans\""
4017 eval "${prefixvar}exp=\"\$ansexp\""
4018 . ./installprefix
4019 EOSC
4020 chmod +x setprefixvar
4021 $eunicefix setprefixvar
4022
4023 : set up the script used to warn in case of inconsistency
4024 cat <<EOS >whoa
4025 $startsh
4026 EOS
4027 cat <<'EOSC' >>whoa
4028 dflt=y
4029 case "$hint" in
4030     recommended)
4031         case "$hintfile" in
4032         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4033                 ;;
4034         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4035                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4036                 ;;
4037         esac
4038         ;;
4039     *)  echo " "
4040         echo "*** WHOA THERE!!! ***" >&4
4041         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4042         ;;
4043 esac
4044 rp="    Keep the $hint value?"
4045 . ./myread
4046 case "$ans" in
4047 y) td=$was; tu=$was;;
4048 esac
4049 EOSC
4050
4051 : function used to set '$1' to '$val'
4052 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4053 case "$val$was" in
4054 $define$undef) . ./whoa; eval "$var=\$td";;
4055 $undef$define) . ./whoa; eval "$var=\$tu";;
4056 *) eval "$var=$val";;
4057 esac'
4058
4059 : Check is we will use socks
4060 case "$usesocks" in
4061 $define|true|[yY]*)     dflt='y';;
4062 *) dflt='n';;
4063 esac
4064 cat <<EOM
4065
4066 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4067 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4068 to use the PerlIO abstraction layer, this will be implicitly selected.
4069
4070 If this doesn't make any sense to you, just accept the default '$dflt'.
4071 EOM
4072 rp='Build Perl for SOCKS?'
4073 . ./myread
4074 case "$ans" in
4075 y|Y)    val="$define" ;;
4076 *)      val="$undef" ;;
4077 esac
4078 set usesocks
4079 eval $setvar
4080
4081 case "$usesocks" in
4082 $define|true|[yY]*) useperlio="$define";;
4083 esac
4084
4085 : Check if we want perlio
4086 case "$useperlio" in
4087 $define|true|[yY]*|'')  dflt='y';;
4088 *) dflt='n';;
4089 esac
4090 cat <<EOM
4091
4092 Previous version of $package used the standard IO mechanisms as
4093 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4094 alternate IO mechanisms via the PerlIO abstraction layer, but the
4095 stdio mechanism is still available if needed.  The abstraction layer
4096 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4097 Using PerlIO with sfio may cause problems with some extension modules.
4098
4099 If this doesn't make any sense to you, just accept the default '$dflt'.
4100 EOM
4101 rp='Use the PerlIO abstraction layer?'
4102 . ./myread
4103 case "$ans" in
4104 y|Y)
4105         val="$define"
4106         ;;
4107 *)
4108         echo "Ok, doing things the stdio way."
4109         val="$undef"
4110         ;;
4111 esac
4112 set useperlio
4113 eval $setvar
4114
4115 case "$usesocks" in
4116 $define|true|[yY]*)
4117         case "$useperlio" in
4118         $define|true|[yY]*) ;;
4119         *)      cat >&4 <<EOM
4120
4121 You are using the SOCKS proxy protocol library which means that you
4122 should also use the PerlIO layer.  You may be headed for trouble.
4123
4124 EOM
4125                 ;;
4126         esac
4127         ;;
4128 esac
4129
4130 : get the patchlevel
4131 echo " "
4132 echo "Getting the current patchlevel..." >&4
4133 if $test -r $rsrc/patchlevel.h;then
4134         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4135         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4136         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4137         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4138         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4139         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4140         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4141 else
4142         revision=0
4143         patchlevel=0
4144         subversion=0
4145         api_revision=0
4146         api_version=0
4147         api_subversion=0
4148         perl_patchlevel=0
4149         $echo "(You do not have patchlevel.h.  Eek.)"
4150 fi
4151 if $test -r $rsrc/.patch ; then
4152         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4153                 perl_patchlevel=`cat $rsrc/.patch`
4154         fi
4155 fi
4156 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4157 version_patchlevel_string="version $patchlevel subversion $subversion"
4158 case "$perl_patchlevel" in
4159 0|'') ;;
4160 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4161     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4162     ;;
4163 esac
4164
4165 $echo "(You have $package $version_patchlevel_string.)"
4166
4167 case "$osname" in
4168 dos|vms)
4169         : XXX Should be a Configure test for double-dots in filenames.
4170         version=`echo $revision $patchlevel $subversion | \
4171                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4172         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4173                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4174         ;;
4175 *)
4176         version=`echo $revision $patchlevel $subversion | \
4177                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4178         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4179                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4180         ;;
4181 esac
4182 : Special case the 5.005_xx maintenance series, which used 5.005
4183 : without any subversion label as a subdirectory in $sitelib
4184 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4185         api_versionstring='5.005'
4186 fi
4187
4188 : Do we want threads support and if so, what type
4189 case "$usethreads" in
4190 $define|true|[yY]*)     dflt='y';;
4191 *)     # Catch case where user specified ithreads or 5005threads but
4192        # forgot -Dusethreads (A.D. 4/2002)
4193        case "$useithreads$use5005threads" in
4194        *$define*)
4195                 case "$useperlio" in
4196                 "$define")      dflt='y' ;;
4197                 *)              dflt='n' ;;
4198                 esac
4199                 ;;
4200        *)       dflt='n';;
4201        esac
4202        ;;
4203 esac
4204 cat <<EOM
4205
4206 Perl can be built to take advantage of threads on some systems.
4207 To do so, Configure can be run with -Dusethreads.
4208
4209 Note that Perl built with threading support runs slightly slower
4210 and uses more memory than plain Perl. The current implementation
4211 is believed to be stable, but it is fairly new, and so should be
4212 treated with caution.
4213
4214 If this doesn't make any sense to you, just accept the default '$dflt'.
4215 EOM
4216 rp='Build a threading Perl?'
4217 . ./myread
4218 case "$ans" in
4219 y|Y)    val="$define" ;;
4220 *)      val="$undef" ;;
4221 esac
4222 set usethreads
4223 eval $setvar
4224
4225 if $test $patchlevel -lt 9; then
4226     case "$usethreads" in
4227     $define)
4228         $cat <<EOM
4229
4230 Since release 5.6, Perl has had two different threading implementations,
4231 the newer interpreter-based version (ithreads) with one interpreter per
4232 thread, and the older 5.005 version (5005threads).
4233 The 5005threads version is effectively unmaintained and will probably be
4234 removed in Perl 5.10, so there should be no need to build a Perl using it
4235 unless needed for backwards compatibility with some existing 5.005threads
4236 code.
4237
4238 EOM
4239         : Default to ithreads unless overridden on command line or with
4240         : old config.sh
4241         dflt='y'
4242         case "$use5005threads" in
4243                 $define|true|[yY]*) dflt='n';;
4244         esac
4245         case "$useithreads" in
4246                 $undef|false|[nN]*) dflt='n';;
4247         esac
4248         rp='Use the newer interpreter-based ithreads?'
4249         . ./myread
4250         case "$ans" in
4251         y|Y)    val="$define" ;;
4252         *)      val="$undef" ;;
4253         esac
4254         set useithreads
4255         eval $setvar
4256         : Now set use5005threads to the opposite value.
4257         case "$useithreads" in
4258         $define) val="$undef" ;;
4259         *) val="$define" ;;
4260         esac
4261         set use5005threads
4262         eval $setvar
4263         ;;
4264     *)
4265         useithreads="$undef"
4266         use5005threads="$undef"
4267         ;;
4268     esac
4269
4270     case "$useithreads$use5005threads" in
4271     "$define$define")
4272         $cat >&4 <<EOM
4273
4274 You cannot have both the ithreads and the 5.005 threads enabled
4275 at the same time.  Disabling the 5.005 threads since they are
4276 much less stable than the ithreads.
4277
4278 EOM
4279         use5005threads="$undef"
4280         ;;
4281     esac
4282
4283 else
4284 : perl-5.9.x and later
4285
4286     if test X"$usethreads" = "X$define"; then
4287         case "$use5005threads" in
4288             $define|true|[yY]*)
4289                 $cat >&4 <<EOM
4290
4291 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4292
4293 EOM
4294             ;;
4295         esac
4296     fi
4297
4298     use5005threads="$undef"
4299     useithreads="$usethreads"
4300 fi
4301
4302 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4303         cat >&4 <<EOF
4304 ***
4305 *** To build with ithreads you must also use the PerlIO layer.
4306 *** Cannot continue, aborting.
4307 ***
4308 EOF
4309         exit 1
4310 fi
4311
4312 case "$d_oldpthreads" in
4313 '')     : Configure tests would be welcome here.  For now, assume undef.
4314         val="$undef" ;;
4315 *)      val="$d_oldpthreads" ;;
4316 esac
4317 set d_oldpthreads
4318 eval $setvar
4319
4320
4321 : Look for a hint-file generated 'call-back-unit'.  If the
4322 : user has specified that a threading perl is to be built,
4323 : we may need to set or change some other defaults.
4324 if $test -f usethreads.cbu; then
4325     echo "Your platform has some specific hints regarding threaded builds, using them..."
4326     . ./usethreads.cbu
4327 else
4328     case "$usethreads" in
4329         "$define"|true|[yY]*)
4330                 $cat <<EOM
4331 (Your platform does not have any specific hints for threaded builds.
4332  Assuming POSIX threads, then.)
4333 EOM
4334         ;;
4335     esac
4336 fi
4337
4338 : Check if multiplicity is required
4339 cat <<EOM
4340
4341 Perl can be built so that multiple Perl interpreters can coexist
4342 within the same Perl executable.
4343 EOM
4344
4345 case "$useithreads" in
4346 $define)
4347         cat <<EOM
4348 This multiple interpreter support is required for interpreter-based threads.
4349 EOM
4350         val="$define"
4351         ;;
4352 *)      case "$usemultiplicity" in
4353         $define|true|[yY]*)     dflt='y';;
4354         *) dflt='n';;
4355         esac
4356         echo " "
4357         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4358         rp='Build Perl for multiplicity?'
4359         . ./myread
4360         case "$ans" in
4361         y|Y)    val="$define" ;;
4362         *)      val="$undef" ;;
4363         esac
4364         ;;
4365 esac
4366 set usemultiplicity
4367 eval $setvar
4368
4369 : Check if morebits is requested
4370 case "$usemorebits" in
4371 "$define"|true|[yY]*)
4372         use64bitint="$define"
4373         uselongdouble="$define"
4374         usemorebits="$define"
4375         ;;
4376 *)      usemorebits="$undef"
4377         ;;
4378 esac
4379
4380 : Determine the C compiler to be used
4381 echo " "
4382 case "$cc" in
4383 '') dflt=cc;;
4384 *) dflt="$cc";;
4385 esac
4386 rp="Use which C compiler?"
4387 . ./myread
4388 cc="$ans"
4389
4390 : See whether they have no cc but they do have gcc
4391 . ./trygcc
4392 if $test -f cc.cbu; then
4393     . ./cc.cbu
4394 fi
4395 . ./checkcc
4396
4397 : make some quick guesses about what we are up against
4398 echo " "
4399 $echo $n "Hmm...  $c"
4400 echo exit 1 >bsd
4401 echo exit 1 >usg
4402 echo exit 1 >v7
4403 echo exit 1 >osf1
4404 echo exit 1 >eunice
4405 echo exit 1 >xenix
4406 echo exit 1 >venix
4407 echo exit 1 >os2
4408 d_bsd="$undef"
4409 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4410 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4411 then
4412         echo "Looks kind of like an OSF/1 system, but we'll see..."
4413         echo exit 0 >osf1
4414 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4415         xxx=`./loc addbib blurfl $pth`
4416         if $test -f $xxx; then
4417         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4418                 echo exit 0 >bsd
4419                 echo exit 0 >usg
4420         else
4421                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4422                         echo "Looks kind of like an extended USG system, but we'll see..."
4423                 else
4424                         echo "Looks kind of like a USG system, but we'll see..."
4425                 fi
4426                 echo exit 0 >usg
4427         fi
4428 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4429         echo "Looks kind of like a BSD system, but we'll see..."
4430         d_bsd="$define"
4431         echo exit 0 >bsd
4432 else
4433         echo "Looks kind of like a Version 7 system, but we'll see..."
4434         echo exit 0 >v7
4435 fi
4436 case "$eunicefix" in
4437 *unixtovms*)
4438         $cat <<'EOI'
4439 There is, however, a strange, musty smell in the air that reminds me of
4440 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4441 EOI
4442         echo exit 0 >eunice
4443         d_eunice="$define"
4444 : it so happens the Eunice I know will not run shell scripts in Unix format
4445         ;;
4446 *)
4447         echo " "
4448         echo "Congratulations.  You aren't running Eunice."
4449         d_eunice="$undef"
4450         ;;
4451 esac
4452 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4453 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4454 : semicolon as a patch separator
4455 case "$p_" in
4456 :) ;;
4457 *)
4458         $cat <<'EOI'
4459 I have the feeling something is not exactly right, however...don't tell me...
4460 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4461 (Or you may be running DOS with DJGPP.)
4462 EOI
4463         echo exit 0 >os2
4464         ;;
4465 esac
4466 if test -f /xenix; then
4467         echo "Actually, this looks more like a XENIX system..."
4468         echo exit 0 >xenix
4469         d_xenix="$define"
4470 else
4471         echo " "
4472         echo "It's not Xenix..."
4473         d_xenix="$undef"
4474 fi
4475 chmod +x xenix
4476 $eunicefix xenix
4477 if test -f /venix; then
4478         echo "Actually, this looks more like a VENIX system..."
4479         echo exit 0 >venix
4480 else
4481         echo " "
4482         if ./xenix; then
4483                 : null
4484         else
4485                 echo "Nor is it Venix..."
4486         fi
4487 fi
4488 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4489 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4490 $rm -f foo
4491
4492 : Check if we are using GNU gcc and what its version is
4493 echo " "
4494 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4495 $cat >try.c <<EOM
4496 #include <stdio.h>
4497 int main() {
4498 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4499 #ifdef __VERSION__
4500         printf("%s\n", __VERSION__);
4501 #else
4502         printf("%s\n", "1");
4503 #endif
4504 #endif
4505         return(0);
4506 }
4507 EOM
4508 if $cc -o try $ccflags $ldflags try.c; then
4509         gccversion=`$run ./try`
4510         case "$gccversion" in
4511         '') echo "You are not using GNU cc." ;;
4512         *)  echo "You are using GNU cc $gccversion."
4513             ccname=gcc
4514             ;;
4515         esac
4516 else
4517         echo " "
4518         echo "*** WHOA THERE!!! ***" >&4
4519         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4520         case "$knowitall" in
4521         '')
4522         echo "    You'd better start hunting for one and let me know about it." >&4
4523                 exit 1
4524                 ;;
4525         esac
4526 fi
4527 $rm -f try try.*
4528 case "$gccversion" in
4529 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4530 esac
4531 case "$gccversion" in
4532 '') gccosandvers='' ;;
4533 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4534    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4535    gccshortvers=''
4536    case "$gccosandvers" in
4537    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4538    $osname$osvers) ;; # looking good
4539    $osname*) cat <<EOM >&4
4540
4541 *** WHOA THERE!!! ***
4542
4543     Your gcc has not been compiled for the exact release of
4544     your operating system ($gccosandvers versus $osname$osvers).
4545
4546     In general it is a good idea to keep gcc synchronized with
4547     the operating system because otherwise serious problems
4548     may ensue when trying to compile software, like Perl.
4549
4550     I'm trying to be optimistic here, though, and will continue.
4551     If later during the configuration and build icky compilation
4552     problems appear (headerfile conflicts being the most common
4553     manifestation), I suggest reinstalling the gcc to match
4554     your operating system release.
4555
4556 EOM
4557       ;;
4558    *) gccosandvers='' ;; # failed to parse, better be silent
4559    esac
4560    ;;
4561 esac
4562 case "$ccname" in
4563 '') ccname="$cc" ;;
4564 esac
4565
4566 # gcc 3.* complain about adding -Idirectories that they already know about,
4567 # so we will take those off from locincpth.
4568 case "$gccversion" in
4569 3*)
4570     echo "main(){}">try.c
4571     for incdir in $locincpth; do
4572        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4573              grep '^c[cp]p*[01]: warning: changing search order '`
4574        if test "X$warn" != X; then
4575            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4576        fi
4577     done
4578     $rm -f try try.*
4579 esac
4580
4581 : What should the include directory be ?
4582 echo " "
4583 $echo $n "Hmm...  $c"
4584 dflt='/usr/include'
4585 incpath=''
4586 mips_type=''
4587 if $test -f /bin/mips && /bin/mips; then
4588         echo "Looks like a MIPS system..."
4589         $cat >usr.c <<'EOCP'
4590 #ifdef SYSTYPE_BSD43
4591 /bsd43
4592 #endif
4593 EOCP
4594         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4595                 dflt='/bsd43/usr/include'
4596                 incpath='/bsd43'
4597                 mips_type='BSD 4.3'
4598         else
4599                 mips_type='System V'
4600         fi
4601         $rm -f usr.c usr.out
4602         echo "and you're compiling with the $mips_type compiler and libraries."
4603         xxx_prompt=y
4604         echo "exit 0" >mips
4605 else
4606         echo "Doesn't look like a MIPS system."
4607         xxx_prompt=n
4608         echo "exit 1" >mips
4609 fi
4610 chmod +x mips
4611 $eunicefix mips
4612 case "$usrinc" in
4613 '') ;;
4614 *) dflt="$usrinc";;
4615 esac
4616 case "$xxx_prompt" in
4617 y)      fn=d/
4618         echo " "
4619         rp='Where are the include files you want to use?'
4620         . ./getfile
4621         usrinc="$ans"
4622         ;;
4623 *)      usrinc="$dflt"
4624         ;;
4625 esac
4626
4627 : see how we invoke the C preprocessor
4628 echo " "
4629 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4630 cat <<'EOT' >testcpp.c
4631 #define ABC abc
4632 #define XYZ xyz
4633 ABC.XYZ
4634 EOT
4635 cd ..
4636 if test ! -f cppstdin; then
4637         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4638                 # AIX cc -E doesn't show the absolute headerfile
4639                 # locations but we'll cheat by using the -M flag.
4640                 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
4641         else
4642                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4643         fi
4644 else
4645         echo "Keeping your $hint cppstdin wrapper."
4646 fi
4647 chmod 755 cppstdin
4648 wrapper=`pwd`/cppstdin
4649 ok='false'
4650 cd UU
4651
4652 if $test "X$cppstdin" != "X" && \
4653         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4654         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4655 then
4656         echo "You used to use $cppstdin $cppminus so we'll use that again."
4657         case "$cpprun" in
4658         '') echo "But let's see if we can live without a wrapper..." ;;
4659         *)
4660                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4661                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4662                 then
4663                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4664                         ok='true'
4665                 else
4666                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4667                 fi
4668                 ;;
4669         esac
4670 else
4671         case "$cppstdin" in
4672         '') ;;
4673         *)
4674                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4675                 ;;
4676         esac
4677 fi
4678
4679 if $ok; then
4680         : nothing
4681 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4682         $cc -E <testcpp.c >testcpp.out 2>&1; \
4683         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4684         echo "Yup, it does."
4685         x_cpp="$cc -E"
4686         x_minus='';
4687 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4688         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4689         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690         echo "Yup, it does."
4691         x_cpp="$cc -E"
4692         x_minus='-';
4693 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4694         $cc -P <testcpp.c >testcpp.out 2>&1; \
4695         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4696         echo "Yipee, that works!"
4697         x_cpp="$cc -P"
4698         x_minus='';
4699 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4700         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4701         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4702         echo "At long last!"
4703         x_cpp="$cc -P"
4704         x_minus='-';
4705 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4706         $cpp <testcpp.c >testcpp.out 2>&1; \
4707         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4708         echo "It works!"
4709         x_cpp="$cpp"
4710         x_minus='';
4711 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4712         $cpp - <testcpp.c >testcpp.out 2>&1; \
4713         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4714         echo "Hooray, it works!  I was beginning to wonder."
4715         x_cpp="$cpp"
4716         x_minus='-';
4717 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4718         $wrapper <testcpp.c >testcpp.out 2>&1; \
4719         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4720         x_cpp="$wrapper"
4721         x_minus=''
4722         echo "Eureka!"
4723 else
4724         dflt=''
4725         rp="No dice.  I can't find a C preprocessor.  Name one:"
4726         . ./myread
4727         x_cpp="$ans"
4728         x_minus=''
4729         $x_cpp <testcpp.c >testcpp.out 2>&1
4730         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4731                 echo "OK, that will do." >&4
4732         else
4733 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4734                 exit 1
4735         fi
4736 fi
4737
4738 case "$ok" in
4739 false)
4740         cppstdin="$x_cpp"
4741         cppminus="$x_minus"
4742         cpprun="$x_cpp"
4743         cpplast="$x_minus"
4744         set X $x_cpp
4745         shift
4746         case "$1" in
4747         "$cpp")
4748                 echo "Perhaps can we force $cc -E using a wrapper..."
4749                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4750                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4751                 then
4752                         echo "Yup, we can."
4753                         cppstdin="$wrapper"
4754                         cppminus='';
4755                 else
4756                         echo "Nope, we'll have to live without it..."
4757                 fi
4758                 ;;
4759         esac
4760         case "$cpprun" in
4761         "$wrapper")
4762                 cpprun=''
4763                 cpplast=''
4764                 ;;
4765         esac
4766         ;;
4767 esac
4768
4769 case "$cppstdin" in
4770 "$wrapper"|'cppstdin') ;;
4771 *) $rm -f $wrapper;;
4772 esac
4773 $rm -f testcpp.c testcpp.out
4774
4775 : Set private lib path
4776 case "$plibpth" in
4777 '') if ./mips; then
4778                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4779         fi;;
4780 esac
4781 case "$libpth" in
4782 ' ') dlist='';;
4783 '') dlist="$loclibpth $plibpth $glibpth";;
4784 *) dlist="$libpth";;
4785 esac
4786
4787 : Now check and see which directories actually exist, avoiding duplicates
4788 libpth=''
4789 for xxx in $dlist
4790 do
4791     if $test -d $xxx; then
4792                 case " $libpth " in
4793                 *" $xxx "*) ;;
4794                 *) libpth="$libpth $xxx";;
4795                 esac
4796     fi
4797 done
4798 $cat <<'EOM'
4799
4800 Some systems have incompatible or broken versions of libraries.  Among
4801 the directories listed in the question below, please remove any you
4802 know not to be holding relevant libraries, and add any that are needed.
4803 Say "none" for none.
4804
4805 EOM
4806 case "$libpth" in
4807 '') dflt='none';;
4808 *)
4809         set X $libpth
4810         shift
4811         dflt=${1+"$@"}
4812         ;;
4813 esac
4814 rp="Directories to use for library searches?"
4815 . ./myread
4816 case "$ans" in
4817 none) libpth=' ';;
4818 *) libpth="$ans";;
4819 esac
4820
4821 : compute shared library extension
4822 case "$so" in
4823 '')
4824         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4825                 dflt='sl'
4826         else
4827                 dflt='so'
4828         fi
4829         ;;
4830 *) dflt="$so";;
4831 esac
4832 $cat <<EOM
4833
4834 On some systems, shared libraries may be available.  Answer 'none' if
4835 you want to suppress searching of shared libraries for the remainder
4836 of this configuration.
4837
4838 EOM
4839 rp='What is the file extension used for shared libraries?'
4840 . ./myread
4841 so="$ans"
4842
4843 : Define several unixisms.
4844 : Hints files or command line option can be used to override them.
4845 : The convoluted testing is in case hints files set either the old
4846 : or the new name.
4847 case "$_exe" in
4848 '')     case "$exe_ext" in
4849         '')     ;;
4850         *)      _exe="$exe_ext" ;;
4851         esac
4852         ;;
4853 esac
4854 case "$_a" in
4855 '')     case "$lib_ext" in
4856     '') _a='.a';;
4857         *)      _a="$lib_ext" ;;
4858         esac
4859         ;;
4860 esac
4861 case "$_o" in
4862 '') case "$obj_ext" in
4863         '')     _o='.o';;
4864         *)      _o="$obj_ext";;
4865         esac
4866         ;;
4867 esac
4868 case "$p_" in
4869 '') case "$path_sep" in
4870         '')     p_=':';;
4871         *)      p_="$path_sep";;
4872         esac
4873         ;;
4874 esac
4875 exe_ext=$_exe
4876 lib_ext=$_a
4877 obj_ext=$_o
4878 path_sep=$p_
4879
4880 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4881
4882 : Which makefile gets called first.  This is used by make depend.
4883 case "$firstmakefile" in
4884 '') firstmakefile='makefile';;
4885 esac
4886
4887 : Check for uselongdouble support
4888 case "$ccflags" in
4889 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4890 esac
4891
4892 case "$uselongdouble" in
4893 $define|true|[yY]*)     dflt='y';;
4894 *) dflt='n';;
4895 esac
4896 cat <<EOM
4897
4898 Perl can be built to take advantage of long doubles which
4899 (if available) may give more accuracy and range for floating point numbers.
4900
4901 If this doesn't make any sense to you, just accept the default '$dflt'.
4902 EOM
4903 rp='Try to use long doubles if available?'
4904 . ./myread
4905 case "$ans" in
4906 y|Y)    val="$define"   ;;
4907 *)      val="$undef"    ;;
4908 esac
4909 set uselongdouble
4910 eval $setvar
4911
4912 case "$uselongdouble" in
4913 true|[yY]*) uselongdouble="$define" ;;
4914 esac
4915
4916 : Look for a hint-file generated 'call-back-unit'.  If the
4917 : user has specified that long doubles should be used,
4918 : we may need to set or change some other defaults.
4919 if $test -f uselongdouble.cbu; then
4920     echo "Your platform has some specific hints regarding long doubles, using them..."
4921     . ./uselongdouble.cbu
4922 else
4923     case "$uselongdouble" in
4924         $define)
4925                 $cat <<EOM
4926 (Your platform does not have any specific hints for long doubles.)
4927 EOM
4928         ;;
4929     esac
4930 fi
4931
4932 : Looking for optional libraries
4933 echo " "
4934 echo "Checking for optional libraries..." >&4
4935 case "$libs" in
4936 ' '|'') dflt='';;
4937 *) dflt="$libs";;
4938 esac
4939 case "$libswanted" in
4940 '') libswanted='c_s';;
4941 esac
4942 case "$usesocks" in
4943 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4944 esac
4945 libsfound=''
4946 libsfiles=''
4947 libsdirs=''
4948 libspath=''
4949 for thisdir in $libpth $xlibpth; do
4950   test -d $thisdir && libspath="$libspath $thisdir"
4951 done
4952 for thislib in $libswanted; do
4953         for thisdir in $libspath; do
4954             xxx=''
4955             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4956                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4957                 $test -f "$xxx" && eval $libscheck
4958                 $test -f "$xxx" && libstyle=shared
4959             fi
4960             if test ! -f "$xxx"; then
4961                 xxx=$thisdir/lib$thislib.$so
4962                 $test -f "$xxx" && eval $libscheck
4963                 $test -f "$xxx" && libstyle=shared
4964             fi
4965             if test ! -f "$xxx"; then
4966                 xxx=$thisdir/lib$thislib$_a
4967                 $test -f "$xxx" && eval $libscheck
4968                 $test -f "$xxx" && libstyle=static
4969             fi
4970             if test ! -f "$xxx"; then
4971                 xxx=$thisdir/$thislib$_a
4972                 $test -f "$xxx" && eval $libscheck
4973                 $test -f "$xxx" && libstyle=static
4974             fi
4975             if test ! -f "$xxx"; then
4976                 xxx=$thisdir/lib${thislib}_s$_a
4977                 $test -f "$xxx" && eval $libscheck
4978                 $test -f "$xxx" && libstyle=static
4979                 $test -f "$xxx" && thislib=${thislib}_s
4980             fi
4981             if test ! -f "$xxx"; then
4982                 xxx=$thisdir/Slib$thislib$_a
4983                 $test -f "$xxx" && eval $libscheck
4984                 $test -f "$xxx" && libstyle=static
4985             fi
4986             if $test -f "$xxx"; then
4987                 case "$libstyle" in
4988                 shared) echo "Found -l$thislib (shared)." ;;
4989                 static) echo "Found -l$thislib." ;;
4990                 *)      echo "Found -l$thislib ($libstyle)." ;;
4991                 esac
4992                 case " $dflt " in
4993                 *"-l$thislib "*);;
4994                 *) dflt="$dflt -l$thislib"
4995                    libsfound="$libsfound $xxx"
4996                    yyy=`basename $xxx`
4997                    libsfiles="$libsfiles $yyy"
4998                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4999                    case " $libsdirs " in
5000                    *" $yyy "*) ;;
5001                    *) libsdirs="$libsdirs $yyy" ;;
5002                    esac
5003                    ;;
5004                 esac
5005                 break
5006             fi
5007         done
5008         if $test ! -f "$xxx"; then
5009             echo "No -l$thislib."
5010         fi
5011 done
5012 set X $dflt
5013 shift
5014 dflt="$*"
5015 case "$libs" in
5016 '') dflt="$dflt";;
5017 *) dflt="$libs";;
5018 esac
5019 case "$dflt" in
5020 ' '|'') dflt='none';;
5021 esac
5022
5023 $cat <<EOM
5024
5025 In order to compile $package on your machine, a number of libraries
5026 are usually needed.  Include any other special libraries here as well.
5027 Say "none" for none.  The default list is almost always right.
5028 EOM
5029
5030 echo " "
5031 rp="What libraries to use?"
5032 . ./myread
5033 case "$ans" in
5034 none) libs=' ';;
5035 *) libs="$ans";;
5036 esac
5037
5038 : determine optimization, if desired, or use for debug flag also
5039 case "$optimize" in
5040 ' '|$undef) dflt='none';;
5041 '') dflt='-O';;
5042 *) dflt="$optimize";;
5043 esac
5044 $cat <<EOH
5045
5046 By default, $package compiles with the -O flag to use the optimizer.
5047 Alternately, you might want to use the symbolic debugger, which uses
5048 the -g flag (on traditional Unix systems).  Either flag can be
5049 specified here.  To use neither flag, specify the word "none".
5050
5051 EOH
5052 rp="What optimizer/debugger flag should be used?"
5053 . ./myread
5054 optimize="$ans"
5055 case "$optimize" in
5056 'none') optimize=" ";;
5057 esac
5058
5059 : Check what DEBUGGING is required from the command line
5060 : -DEBUGGING      or -DDEBUGGING or
5061 : -DEBUGGING=both                       = -g + -DDEBUGGING
5062 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5063 : -DEBUGGING=none or -UDEBUGGING        =
5064 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5065 case "$EBUGGING" in
5066 '')     ;;
5067 *)      DEBUGGING=$EBUGGING ;;
5068 esac
5069
5070 case "$DEBUGGING" in
5071 -g|both|$define)
5072     case "$optimize" in
5073         *-g*) ;;
5074         *)    optimize="$optimize -g" ;;
5075     esac ;;
5076 none|$undef)
5077     case "$optimize" in
5078         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5079                 shift
5080                 optimize="$*"
5081                 ;;
5082     esac ;;
5083 esac
5084
5085 dflt=''
5086 case "$DEBUGGING" in
5087 both|$define) dflt='-DDEBUGGING'
5088 esac
5089
5090 : argument order is deliberate, as the flag will start with - which set could
5091 : think is an option
5092 checkccflag='check=$1; flag=$2; callback=$3;
5093 echo " ";
5094 echo "Checking if your compiler accepts $flag" 2>&1;
5095 echo "int main(void) { return 0; }" > gcctest.c;
5096 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5097     echo "Yes, it does." 2>&1;
5098     if $test -s gcctest.out ; then
5099         echo "But your platform does not like it:";
5100         cat gcctest.out;
5101     else
5102         case "$ccflags" in
5103         *$check*)
5104             echo "Leaving current flags $ccflags alone." 2>&1
5105             ;;
5106         *) dflt="$dflt $flag";
5107             eval $callback
5108             ;;
5109         esac
5110     fi
5111 else
5112     echo "Nope, it does not, but that is ok." 2>&1;
5113 fi
5114 '
5115
5116 : We will not override a previous value, but we might want to
5117 : augment a hint file
5118 case "$hint" in
5119 default|recommended)
5120         case "$gccversion" in
5121         1*) dflt="$dflt -fpcc-struct-return" ;;
5122         esac
5123         case "$optimize:$DEBUGGING" in
5124         *-g*:old) dflt="$dflt -DDEBUGGING";;
5125         esac
5126         case "$gccversion" in
5127         2*) if $test -d /etc/conf/kconfig.d &&
5128                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5129                 then
5130                         # Interactive Systems (ISC) POSIX mode.
5131                         dflt="$dflt -posix"
5132                 fi
5133                 ;;
5134         esac
5135         case "$gccversion" in
5136         1*) ;;
5137         2.[0-8]*) ;;
5138         ?*)     set strict-aliasing -fno-strict-aliasing
5139                 eval $checkccflag
5140                 ;;
5141         esac
5142         # For gcc, adding -pipe speeds up compilations for some, but apparently
5143         # some assemblers can't read from stdin.  (It also slows down compilations
5144         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5145         case "$gccversion" in
5146         ?*)     set pipe -pipe
5147                 eval $checkccflag
5148                 ;;
5149         esac
5150
5151         # on x86_64 (at least) we require an extra library (libssp) in the
5152         # link command line. This library is not named, so I infer that it is
5153         # an implementation detail that may change. Hence the safest approach
5154         # is to add the flag to the flags passed to the compiler at link time,
5155         # as that way the compiler can do the right implementation dependant
5156         # thing. (NWC)
5157         case "$gccversion" in
5158         ?*)     set stack-protector -fstack-protector
5159                 eval $checkccflag
5160                 ;;
5161         esac
5162         ;;
5163 esac
5164
5165 case "$mips_type" in
5166 *BSD*|'') inclwanted="$locincpth $usrinc";;
5167 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5168 esac
5169 for thisincl in $inclwanted; do
5170         if $test -d $thisincl; then
5171                 if $test x$thisincl != x$usrinc; then
5172                         case "$dflt" in
5173                         *" -I$thisincl "*);;
5174                         *) dflt="$dflt -I$thisincl ";;
5175                         esac
5176                 fi
5177         fi
5178 done
5179
5180 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5181         xxx=true;
5182 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5183         xxx=true;
5184 else
5185         xxx=false;
5186 fi;
5187 if $xxx; then
5188         case "$dflt" in
5189         *$2*);;
5190         *) dflt="$dflt -D$2";;
5191         esac;
5192 fi'
5193
5194 set signal.h LANGUAGE_C; eval $inctest
5195
5196 case "$usesocks" in
5197 $define)
5198         ccflags="$ccflags -DSOCKS"
5199         ;;
5200 esac
5201
5202 case "$hint" in
5203 default|recommended) dflt="$ccflags $dflt" ;;
5204 *) dflt="$ccflags";;
5205 esac
5206
5207 case "$dflt" in
5208 ''|' ') dflt=none;;
5209 esac
5210
5211 $cat <<EOH
5212
5213 Your C compiler may want other flags.  For this question you should include
5214 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5215 but you should NOT include libraries or ld flags like -lwhatever.  If you
5216 want $package to honor its debug switch, you should include -DDEBUGGING here.
5217 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5218
5219 To use no flags, specify the word "none".
5220
5221 EOH
5222 set X $dflt
5223 shift
5224 dflt=${1+"$@"}
5225 rp="Any additional cc flags?"
5226 . ./myread
5227 case "$ans" in
5228 none) ccflags='';;
5229 *) ccflags="$ans";;
5230 esac
5231
5232 : the following weeds options from ccflags that are of no interest to cpp
5233 case "$cppflags" in
5234 '') cppflags="$ccflags" ;;
5235 *)  cppflags="$cppflags $ccflags" ;;
5236 esac
5237 case "$gccversion" in
5238 1*) cppflags="$cppflags -D__GNUC__"
5239 esac
5240 case "$mips_type" in
5241 '');;
5242 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5243 esac
5244 case "$cppflags" in
5245 '');;
5246 *)
5247         echo " "
5248         echo "Let me guess what the preprocessor flags are..." >&4
5249         set X $cppflags
5250         shift
5251         cppflags=''
5252         $cat >cpp.c <<'EOM'
5253 #define BLURFL foo
5254
5255 BLURFL xx LFRULB
5256 EOM
5257         previous=''
5258         for flag in $*
5259         do
5260                 case "$flag" in
5261                 -*) ftry="$flag";;
5262                 *) ftry="$previous $flag";;
5263                 esac
5264                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5265                         >cpp1.out 2>/dev/null && \
5266                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5267                         >cpp2.out 2>/dev/null && \
5268                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5269                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5270                 then
5271                         cppflags="$cppflags $ftry"
5272                         previous=''
5273                 else
5274                         previous="$flag"
5275                 fi
5276         done
5277         set X $cppflags
5278         shift
5279         cppflags=${1+"$@"}
5280         case "$cppflags" in
5281         *-*)  echo "They appear to be: $cppflags";;
5282         esac
5283         $rm -f cpp.c cpp?.out
5284         ;;
5285 esac
5286
5287 : flags used in final linking phase
5288 case "$ldflags" in
5289 '') if ./venix; then
5290                 dflt='-i -z'
5291         else
5292                 dflt=''
5293         fi
5294         case "$ccflags" in
5295         *-posix*) dflt="$dflt -posix" ;;
5296         esac
5297         ;;
5298 *) dflt="$ldflags";;
5299 esac
5300 # See note above about -fstack-protector
5301 case "$ccflags" in
5302 *-fstack-protector*) 
5303         case "$dflt" in
5304         *-fstack-protector*) ;; # Don't add it again
5305         *) dflt="$dflt -fstack-protector" ;; 
5306         esac
5307         ;;
5308 esac
5309
5310 : Try to guess additional flags to pick up local libraries.
5311 for thislibdir in $libpth; do
5312         case " $loclibpth " in
5313         *" $thislibdir "*)
5314                 case "$dflt " in
5315                 *"-L$thislibdir "*) ;;
5316                 *)  dflt="$dflt -L$thislibdir" ;;
5317                 esac
5318                 ;;
5319         esac
5320 done
5321
5322 case "$dflt" in
5323 '') dflt='none' ;;
5324 esac
5325
5326 $cat <<EOH
5327
5328 Your C linker may need flags.  For this question you should
5329 include -L/whatever and any other flags used by the C linker, but you
5330 should NOT include libraries like -lwhatever.
5331
5332 Make sure you include the appropriate -L/path flags if your C linker
5333 does not normally search all of the directories you specified above,
5334 namely
5335         $libpth
5336 To use no flags, specify the word "none".
5337
5338 EOH
5339
5340 rp="Any additional ld flags (NOT including libraries)?"
5341 . ./myread
5342 case "$ans" in
5343 none) ldflags='';;
5344 *) ldflags="$ans";;
5345 esac
5346 rmlist="$rmlist pdp11"
5347
5348 : coherency check
5349 echo " "
5350 echo "Checking your choice of C compiler and flags for coherency..." >&4
5351 $cat > try.c <<'EOF'
5352 #include <stdio.h>
5353 int main() { printf("Ok\n"); return(0); }
5354 EOF
5355 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5356 shift
5357 $cat >try.msg <<'EOM'
5358 I've tried to compile and run the following simple program:
5359
5360 EOM
5361 $cat try.c >> try.msg
5362
5363 $cat >> try.msg <<EOM
5364
5365 I used the command:
5366
5367         $*
5368         $run ./try
5369
5370 and I got the following output:
5371
5372 EOM
5373 dflt=y
5374 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5375         if $sh -c "$run ./try " >>try.msg 2>&1; then
5376                 xxx=`$run ./try`
5377                 case "$xxx" in
5378                 "Ok") dflt=n ;;
5379                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5380                         case " $libs " in
5381                         *" -lsfio "*)
5382                                 cat >> try.msg <<'EOQS'
5383 If $libs contains -lsfio, and sfio is mis-configured, then it
5384 sometimes (apparently) runs and exits with a 0 status, but with no
5385 output!  It may have to do with sfio's use of _exit vs. exit.
5386
5387 EOQS
5388                                 rp="You have a big problem.  Shall I abort Configure"
5389                                 dflt=y
5390                                 ;;
5391                         esac
5392                         ;;
5393                 esac
5394         else
5395                 echo "The program compiled OK, but exited with status $?." >>try.msg
5396                 rp="You have a problem.  Shall I abort Configure"
5397                 dflt=y
5398         fi
5399 else
5400         echo "I can't compile the test program." >>try.msg
5401         rp="You have a BIG problem.  Shall I abort Configure"
5402         dflt=y
5403 fi
5404 case "$dflt" in
5405 y)
5406         $cat try.msg >&4
5407         case "$knowitall" in
5408         '')
5409                 echo "(The supplied flags or libraries might be incorrect.)"
5410                 ;;
5411         *) dflt=n;;
5412         esac
5413         echo " "
5414         . ./myread
5415         case "$ans" in
5416         n*|N*) ;;
5417         *)      echo "Ok.  Stopping Configure." >&4
5418                 exit 1
5419                 ;;
5420         esac
5421         ;;
5422 n) echo "OK, that should do.";;
5423 esac
5424 $rm_try gcctest gcctest.out
5425
5426 : define a shorthand compile call
5427 compile='
5428 mc_file=$1;
5429 shift;
5430 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5431 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5432 exit 1;
5433 fi;
5434 esac;
5435 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5436 : define a shorthand compile call for compilations that should be ok.
5437 compile_ok='
5438 mc_file=$1;
5439 shift;
5440 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5441
5442 : determine filename position in cpp output
5443 echo " "
5444 echo "Computing filename position in cpp output for #include directives..." >&4
5445 case "$osname" in
5446 vos) testaccess=-e ;;
5447 *)   testaccess=-r ;;
5448 esac
5449 echo '#include <stdio.h>' > foo.c
5450 $cat >fieldn <<EOF
5451 $startsh
5452 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5453 $grep '^[       ]*#.*stdio\.h' | \
5454 while read cline; do
5455         pos=1
5456         set \$cline
5457         while $test \$# -gt 0; do
5458                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5459                         echo "\$pos"
5460                         exit 0
5461                 fi
5462                 shift
5463                 pos=\`expr \$pos + 1\`
5464         done
5465 done
5466 EOF
5467 chmod +x fieldn
5468 fieldn=`./fieldn`
5469 $rm -f foo.c fieldn
5470 case $fieldn in
5471 '') pos='???';;
5472 1) pos=first;;
5473 2) pos=second;;
5474 3) pos=third;;
5475 *) pos="${fieldn}th";;
5476 esac
5477 echo "Your cpp writes the filename in the $pos field of the line."
5478
5479 case "$osname" in
5480 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5481 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5482 *)   cppfilter='' ;;
5483 esac
5484 : locate header file
5485 $cat >findhdr <<EOF
5486 $startsh
5487 wanted=\$1
5488 name=''
5489 for usrincdir in $usrinc
5490 do
5491         if test -f \$usrincdir/\$wanted; then
5492                 echo "\$usrincdir/\$wanted"
5493                 exit 0
5494         fi
5495 done
5496 awkprg='{ print \$$fieldn }'
5497 echo "#include <\$wanted>" > foo\$\$.c
5498 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5499 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5500 while read cline; do
5501         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5502         case "\$name" in
5503         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5504         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5505         *) exit 2;;
5506         esac;
5507 done;
5508 #
5509 # status = 0: grep returned 0 lines, case statement not executed
5510 # status = 1: headerfile found
5511 # status = 2: while loop executed, no headerfile found
5512 #
5513 status=\$?
5514 $rm -f foo\$\$.c;
5515 if test \$status -eq 1; then
5516         exit 0;
5517 fi
5518 exit 1
5519 EOF
5520 chmod +x findhdr
5521
5522 : define an alternate in-header-list? function
5523 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5524 cont=true; xxf="echo \"<\$1> found.\" >&4";
5525 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5526 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5527 esac;
5528 case $# in 4) instead=instead;; *) instead="at last";; esac;
5529 while $test "$cont"; do
5530         xxx=`./findhdr $1`
5531         var=$2; eval "was=\$$2";
5532         if $test "$xxx" && $test -r "$xxx";
5533         then eval $xxf;
5534         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5535                 cont="";
5536         else eval $xxnf;
5537         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5538         set $yyy; shift; shift; yyy=$@;
5539         case $# in 0) cont="";;
5540         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5541                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5542         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5543                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5544         esac;
5545 done;
5546 while $test "$yyy";
5547 do set $yyy; var=$2; eval "was=\$$2";
5548         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5549         set $yyy; shift; shift; yyy=$@;
5550 done'
5551
5552 : see if stdlib is available
5553 set stdlib.h i_stdlib
5554 eval $inhdr
5555
5556 : check for lengths of integral types
5557 echo " "
5558 case "$intsize" in
5559 '')
5560         echo "Checking to see how big your integers are..." >&4
5561         $cat >try.c <<EOCP
5562 #include <stdio.h>
5563 #$i_stdlib I_STDLIB
5564 #ifdef I_STDLIB
5565 #include <stdlib.h>
5566 #endif
5567 int main()
5568 {
5569         printf("intsize=%d;\n", (int)sizeof(int));
5570         printf("longsize=%d;\n", (int)sizeof(long));
5571         printf("shortsize=%d;\n", (int)sizeof(short));
5572         exit(0);
5573 }
5574 EOCP
5575         set try
5576         if eval $compile_ok && $run ./try > /dev/null; then
5577                 eval `$run ./try`
5578                 echo "Your integers are $intsize bytes long."
5579                 echo "Your long integers are $longsize bytes long."
5580                 echo "Your short integers are $shortsize bytes long."
5581         else
5582                 $cat >&4 <<EOM
5583 !
5584 Help! I can't compile and run the intsize test program: please enlighten me!
5585 (This is probably a misconfiguration in your system or libraries, and
5586 you really ought to fix it.  Still, I'll try anyway.)
5587 !
5588 EOM
5589                 dflt=4
5590                 rp="What is the size of an integer (in bytes)?"
5591                 . ./myread
5592                 intsize="$ans"
5593                 dflt=$intsize
5594                 rp="What is the size of a long integer (in bytes)?"
5595                 . ./myread
5596                 longsize="$ans"
5597                 dflt=2
5598                 rp="What is the size of a short integer (in bytes)?"
5599                 . ./myread
5600                 shortsize="$ans"
5601         fi
5602         ;;
5603 esac
5604 $rm_try
5605
5606 : check for long long
5607 echo " "
5608 echo "Checking to see if you have long long..." >&4
5609 echo 'int main() { long long x = 7; return 0; }' > try.c
5610 set try
5611 if eval $compile; then
5612         val="$define"
5613         echo "You have long long."
5614 else
5615         val="$undef"
5616         echo "You do not have long long."
5617 fi
5618 $rm_try
5619 set d_longlong
5620 eval $setvar
5621
5622 : check for length of long long
5623 case "${d_longlong}${longlongsize}" in
5624 $define)
5625         echo " "
5626         echo "Checking to see how big your long longs are..." >&4
5627         $cat >try.c <<'EOCP'
5628 #include <stdio.h>
5629 int main()
5630 {
5631     printf("%d\n", (int)sizeof(long long));
5632     return(0);
5633 }
5634 EOCP
5635         set try
5636         if eval $compile_ok; then
5637                 longlongsize=`$run ./try`
5638                 echo "Your long longs are $longlongsize bytes long."
5639         else
5640                 dflt='8'
5641                 echo " "
5642                 echo "(I can't seem to compile the test program.  Guessing...)"
5643                 rp="What is the size of a long long (in bytes)?"
5644                 . ./myread
5645                 longlongsize="$ans"
5646         fi
5647         if $test "X$longsize" = "X$longlongsize"; then
5648                 echo "(That isn't any different from an ordinary long.)"
5649         fi
5650         ;;
5651 esac
5652 $rm_try
5653
5654 : see if inttypes.h is available
5655 : we want a real compile instead of Inhdr because some systems
5656 : have an inttypes.h which includes non-existent headers
5657 echo " "
5658 $cat >try.c <<EOCP
5659 #include <inttypes.h>
5660 int main() {
5661         static int32_t foo32 = 0x12345678;
5662 }
5663 EOCP
5664 set try
5665 if eval $compile; then
5666         echo "<inttypes.h> found." >&4
5667         val="$define"
5668 else
5669         echo "<inttypes.h> NOT found." >&4
5670         val="$undef"
5671 fi
5672 $rm_try
5673 set i_inttypes
5674 eval $setvar
5675
5676 : check for int64_t
5677 echo " "
5678 echo "Checking to see if you have int64_t..." >&4
5679 $cat >try.c <<EOCP
5680 #include <sys/types.h>
5681 #$i_inttypes I_INTTYPES
5682 #ifdef I_INTTYPES
5683 #include <inttypes.h>
5684 #endif
5685 int main() { int64_t x = 7; }
5686 EOCP
5687 set try
5688 if eval $compile; then
5689         val="$define"
5690         echo "You have int64_t."
5691 else
5692         val="$undef"
5693         echo "You do not have int64_t."
5694 fi
5695 $rm_try
5696 set d_int64_t
5697 eval $setvar
5698
5699 : Check if 64bit ints have a quad type
5700 echo " "
5701 echo "Checking which 64-bit integer type we could use..." >&4
5702
5703 case "$intsize" in
5704 8) val=int
5705    set quadtype
5706    eval $setvar
5707    val='"unsigned int"'
5708    set uquadtype
5709    eval $setvar
5710    quadkind=1
5711    ;;
5712 *) case "$longsize" in
5713    8) val=long
5714       set quadtype
5715       eval $setvar
5716       val='"unsigned long"'
5717       set uquadtype
5718       eval $setvar
5719       quadkind=2
5720       ;;
5721    *) case "$d_longlong:$longlongsize" in
5722       define:8)
5723         val='"long long"'
5724         set quadtype
5725         eval $setvar
5726         val='"unsigned long long"'
5727         set uquadtype
5728         eval $setvar
5729         quadkind=3
5730         ;;
5731       *) case "$d_int64_t" in
5732          define)
5733            val=int64_t
5734            set quadtype
5735            eval $setvar
5736            val=uint64_t
5737            set uquadtype
5738            eval $setvar
5739            quadkind=4
5740            ;;
5741          esac
5742          ;;
5743       esac
5744       ;;
5745    esac
5746    ;;
5747 esac
5748
5749 case "$quadtype" in
5750 '')     echo "Alas, no 64-bit integer types in sight." >&4
5751         d_quad="$undef"
5752         ;;
5753 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5754         d_quad="$define"
5755         ;;
5756 esac
5757
5758 : Do we want 64bit support
5759 case "$uselonglong" in
5760 "$define"|true|[yY]*)
5761         cat <<EOM >&4
5762
5763 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5764 EOM
5765         use64bitint="$define"
5766         ;;
5767 esac
5768 case "$use64bits" in
5769 "$define"|true|[yY]*)
5770         cat <<EOM >&4
5771
5772 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5773 EOM
5774         use64bitint="$define"
5775         ;;
5776 esac
5777 case "$use64bitints" in
5778 "$define"|true|[yY]*)
5779         cat <<EOM >&4
5780
5781 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5782 EOM
5783         use64bitint="$define"
5784         ;;
5785 esac
5786 case "$use64bitsint" in
5787 "$define"|true|[yY]*)
5788         cat <<EOM >&4
5789
5790 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5791 EOM
5792         use64bitint="$define"
5793         ;;
5794 esac
5795 case "$uselonglongs" in
5796 "$define"|true|[yY]*)
5797         cat <<EOM >&4
5798
5799 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5800 EOM
5801         use64bitint="$define"
5802         ;;
5803 esac
5804 case "$use64bitsall" in
5805 "$define"|true|[yY]*)
5806         cat <<EOM >&4
5807
5808 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5809 EOM
5810         use64bitall="$define"
5811         ;;
5812 esac
5813
5814 case "$ccflags" in
5815 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5816 esac
5817 case "$use64bitall" in
5818 "$define"|true|[yY]*) use64bitint="$define" ;;
5819 esac
5820
5821 case "$longsize" in
5822 8) cat <<EOM
5823
5824 You have natively 64-bit long integers.
5825 EOM
5826    val="$define"
5827    ;;
5828 *) case "$use64bitint" in
5829    "$define"|true|[yY]*) dflt='y';;
5830    *) dflt='n';;
5831    esac
5832    case "$d_quad" in
5833    "$define") ;;
5834    *) dflt='n' ;;
5835    esac
5836    cat <<EOM
5837
5838 Perl can be built to take advantage of 64-bit integer types
5839 on some systems.  To do so, Configure can be run with -Duse64bitint.
5840 Choosing this option will most probably introduce binary incompatibilities.
5841
5842 If this doesn't make any sense to you, just accept the default '$dflt'.
5843 (The default has been chosen based on your configuration.)
5844 EOM
5845    rp='Try to use 64-bit integers, if available?'
5846    . ./myread
5847    case "$ans" in
5848    [yY]*) val="$define" ;;
5849    *)     val="$undef"  ;;
5850    esac
5851    ;;
5852 esac
5853 set use64bitint
5854 eval $setvar
5855
5856 case "$use64bitall" in
5857 "$define"|true|[yY]*) dflt='y' ;;
5858 *) case "$longsize" in
5859    8) dflt='y' ;;
5860    *) dflt='n' ;;
5861    esac
5862    ;;
5863 esac
5864 cat <<EOM
5865
5866 You may also choose to try maximal 64-bitness.  It means using as much
5867 64-bitness as possible on the platform.  This in turn means even more
5868 binary incompatibilities.  On the other hand, your platform may not
5869 have any more 64-bitness available than what you already have chosen.
5870
5871 If this doesn't make any sense to you, just accept the default '$dflt'.
5872 (The default has been chosen based on your configuration.)
5873 EOM
5874 rp='Try to use maximal 64-bit support, if available?'
5875 . ./myread
5876 case "$ans" in
5877 [yY]*) val="$define" ;;
5878 *)     val="$undef"  ;;
5879 esac
5880 set use64bitall
5881 eval $setvar
5882 case "$use64bitall" in
5883 "$define")
5884         case "$use64bitint" in
5885         "$undef")
5886                 cat <<EOM
5887
5888 Since you have chosen a maximally 64-bit build, I'm also turning on
5889 the use of 64-bit integers.
5890 EOM
5891                 use64bitint="$define" ;;
5892         esac
5893         ;;
5894 esac
5895
5896 : Look for a hint-file generated 'call-back-unit'.  If the
5897 : user has specified that a 64-bit perl is to be built,
5898 : we may need to set or change some other defaults.
5899 if $test -f use64bitint.cbu; then
5900         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5901         . ./use64bitint.cbu
5902 fi
5903 case "$use64bitint" in
5904 "$define"|true|[yY]*)
5905         case "$longsize" in
5906         4) case "$archname64" in
5907            '') archname64=64int ;;
5908            esac
5909            ;;
5910         esac
5911         ;;
5912 esac
5913
5914 : Look for a hint-file generated 'call-back-unit'.  If the
5915 : user has specified that a maximally 64-bit perl is to be built,
5916 : we may need to set or change some other defaults.
5917 if $test -f use64bitall.cbu; then
5918         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5919         . ./use64bitall.cbu
5920 fi
5921 case "$use64bitall" in
5922 "$define"|true|[yY]*)
5923         case "$longsize" in
5924         4) case "$archname64" in
5925            ''|64int) archname64=64all ;;
5926            esac
5927            ;;
5928         esac
5929         ;;
5930 esac
5931
5932 case "$d_quad:$use64bitint" in
5933 $undef:$define)
5934         cat >&4 <<EOF
5935
5936 *** You have chosen to use 64-bit integers,
5937 *** but none can be found.
5938 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5939 *** Cannot continue, aborting.
5940
5941 EOF
5942         exit 1
5943         ;;
5944 esac
5945
5946 : check for length of double
5947 echo " "
5948 case "$doublesize" in
5949 '')
5950         echo "Checking to see how big your double precision numbers are..." >&4
5951         $cat >try.c <<EOCP
5952 #include <stdio.h>
5953 #$i_stdlib I_STDLIB
5954 #ifdef I_STDLIB
5955 #include <stdlib.h>
5956 #endif
5957 int main()
5958 {
5959     printf("%d\n", (int)sizeof(double));
5960     exit(0);
5961 }
5962 EOCP
5963         set try
5964         if eval $compile_ok; then
5965                 doublesize=`$run ./try`
5966                 echo "Your double is $doublesize bytes long."
5967         else
5968                 dflt='8'
5969                 echo "(I can't seem to compile the test program.  Guessing...)"
5970                 rp="What is the size of a double precision number (in bytes)?"
5971                 . ./myread
5972                 doublesize="$ans"
5973         fi
5974         ;;
5975 esac
5976 $rm_try
5977
5978 : check for long doubles
5979 echo " "
5980 echo "Checking to see if you have long double..." >&4
5981 echo 'int main() { long double x = 7.0; }' > try.c
5982 set try
5983 if eval $compile; then
5984         val="$define"
5985         echo "You have long double."
5986 else
5987         val="$undef"
5988         echo "You do not have long double."
5989 fi
5990 $rm_try
5991 set d_longdbl
5992 eval $setvar
5993
5994 : check for length of long double
5995 case "${d_longdbl}${longdblsize}" in
5996 $define)
5997         echo " "
5998         echo "Checking to see how big your long doubles are..." >&4
5999         $cat >try.c <<'EOCP'
6000 #include <stdio.h>
6001 int main()
6002 {
6003         printf("%d\n", sizeof(long double));
6004 }
6005 EOCP
6006         set try
6007         set try
6008         if eval $compile; then
6009                 longdblsize=`$run ./try`
6010                 echo "Your long doubles are $longdblsize bytes long."
6011         else
6012                 dflt='8'
6013                 echo " "
6014                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6015                 rp="What is the size of a long double (in bytes)?"
6016                 . ./myread
6017                 longdblsize="$ans"
6018         fi
6019         if $test "X$doublesize" = "X$longdblsize"; then
6020                 echo "That isn't any different from an ordinary double."
6021                 echo "I'll keep your setting anyway, but you may see some"
6022                 echo "harmless compilation warnings."
6023         fi
6024         ;;
6025 esac
6026 $rm_try
6027
6028 : determine the architecture name
6029 echo " "
6030 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6031         tarch=`arch`"-$osname"
6032 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6033         if uname -m > tmparch 2>&1 ; then
6034                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6035                         -e 's/$/'"-$osname/" tmparch`
6036         else
6037                 tarch="$osname"
6038         fi
6039         $rm -f tmparch
6040 else
6041         tarch="$osname"
6042 fi
6043 case "$myarchname" in
6044 ''|"$tarch") ;;
6045 *)
6046         echo "(Your architecture name used to be $myarchname.)"
6047         archname=''
6048         ;;
6049 esac
6050 case "$targetarch" in
6051 '') ;;
6052 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6053 esac
6054 myarchname="$tarch"
6055 case "$archname" in
6056 '') dflt="$tarch";;
6057 *) dflt="$archname";;
6058 esac
6059 rp='What is your architecture name'
6060 . ./myread
6061 archname="$ans"
6062 case "$usethreads" in
6063 $define)
6064         echo "Threads selected." >&4
6065         case "$archname" in
6066         *-thread*) echo "...and architecture name already has -thread." >&4
6067                 ;;
6068         *)      archname="$archname-thread"
6069                 echo "...setting architecture name to $archname." >&4
6070                 ;;
6071         esac
6072         ;;
6073 esac
6074 case "$usemultiplicity" in
6075 $define)
6076         echo "Multiplicity selected." >&4
6077         case "$archname" in
6078         *-multi*) echo "...and architecture name already has -multi." >&4
6079                 ;;
6080         *)      archname="$archname-multi"
6081                 echo "...setting architecture name to $archname." >&4
6082                 ;;
6083         esac
6084         ;;
6085 esac
6086 case "$use64bitint$use64bitall" in
6087 *"$define"*)
6088         case "$archname64" in
6089         '')
6090                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6091                 ;;
6092         *)
6093                 case "$use64bitint" in
6094                 "$define") echo "64 bit integers selected." >&4 ;;
6095                 esac
6096                 case "$use64bitall" in
6097                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6098                 esac
6099                 case "$archname" in
6100                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6101                         ;;
6102                 *)      archname="$archname-$archname64"
6103                         echo "...setting architecture name to $archname." >&4
6104                         ;;
6105                 esac
6106                 ;;
6107         esac
6108 esac
6109 case "$uselongdouble" in
6110 $define)
6111         echo "Long doubles selected." >&4
6112         case "$longdblsize" in
6113         $doublesize)
6114                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6115                 ;;
6116         *)
6117                 case "$archname" in
6118                 *-ld*) echo "...and architecture name already has -ld." >&4
6119                         ;;
6120                 *)      archname="$archname-ld"
6121                         echo "...setting architecture name to $archname." >&4
6122                         ;;
6123                 esac
6124                 ;;
6125         esac
6126         ;;
6127 esac
6128 case "$useperlio" in
6129 $define)
6130         echo "Perlio selected." >&4
6131         ;;
6132 *)
6133         echo "Perlio not selected, using stdio." >&4
6134         case "$archname" in
6135         *-stdio*) echo "...and architecture name already has -stdio." >&4
6136                 ;;
6137         *)      archname="$archname-stdio"
6138                 echo "...setting architecture name to $archname." >&4
6139                 ;;
6140         esac
6141         ;;
6142 esac
6143 if $test -f archname.cbu; then
6144         echo "Your platform has some specific hints for architecture name, using them..."
6145         . ./archname.cbu
6146 fi
6147
6148 : set the prefixit variable, to compute a suitable default value
6149 prefixit='case "$3" in
6150 ""|none)
6151         case "$oldprefix" in
6152         "") eval "$1=\"\$$2\"";;
6153         *)
6154                 case "$3" in
6155                 "") eval "$1=";;
6156                 none)
6157                         eval "tp=\"\$$2\"";
6158                         case "$tp" in
6159                         ""|" ") eval "$1=\"\$$2\"";;
6160                         *) eval "$1=";;
6161                         esac;;
6162                 esac;;
6163         esac;;
6164 *)
6165         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6166         case "$tp" in
6167         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6168         /*-$oldprefix/*|\~*-$oldprefix/*)
6169                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6170         *) eval "$1=\"\$$2\"";;
6171         esac;;
6172 esac'
6173
6174 : determine installation style
6175 : For now, try to deduce it from prefix unless it is already set.
6176 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6177 case "$installstyle" in
6178 '')     case "$prefix" in
6179                 *perl*) dflt='lib';;
6180                 *) dflt='lib/perl5' ;;
6181         esac
6182         ;;
6183 *)      dflt="$installstyle" ;;
6184 esac
6185 : Probably not worth prompting for this since we prompt for all
6186 : the directories individually, and the prompt would be too long and
6187 : confusing anyway.
6188 installstyle=$dflt
6189
6190 : determine where public executables go
6191 echo " "
6192 set dflt bin bin
6193 eval $prefixit
6194 fn=d~
6195 rp='Pathname where the public executables will reside?'
6196 . ./getfile
6197 if $test "X$ansexp" != "X$binexp"; then
6198         installbin=''
6199 fi
6200 prefixvar=bin
6201 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6202 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6203 :     this via initialinstalllocation
6204 . ./setprefixvar
6205
6206 case "$userelocatableinc" in
6207 $define|true|[yY]*)     dflt='y' ;;
6208 *)                      dflt='n' ;;
6209 esac
6210 cat <<EOM
6211
6212 Would you like to build Perl so that the installation is relocatable, so that
6213 library paths in @INC are determined relative to the path of the perl binary?
6214 This is not advised for system Perl installs, or if you need to run setid
6215 scripts or scripts under taint mode.
6216
6217 If this doesn't make any sense to you, just accept the default '$dflt'.
6218 EOM
6219 rp='Use relocatable @INC?'
6220 . ./myread
6221 case "$ans" in
6222 y|Y)    val="$define" ;;
6223 *)      val="$undef"  ;;
6224 esac
6225 set userelocatableinc
6226 eval $setvar
6227
6228 initialinstalllocation="$binexp"
6229 : Default prefix is now "up one level from where the binaries are"
6230 case "$userelocatableinc" in
6231 $define|true|[yY]*)
6232     bin=".../"
6233     binexp=".../"
6234     prefix=".../.."
6235     prefixexp=".../.."
6236     installprefixexp=".../.."
6237     ;;
6238 esac
6239
6240 : determine where private library files go
6241 : Usual default is /usr/local/lib/perl5/$version.
6242 : Also allow things like /opt/perl/lib/$version, since
6243 : /opt/perl/lib/perl5... would be redundant.
6244 : The default "style" setting is made in installstyle.U
6245 case "$installstyle" in
6246 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6247 *)       set dflt privlib lib/$version ;;
6248 esac
6249 eval $prefixit
6250 $cat <<EOM
6251
6252 There are some auxiliary files for $package that need to be put into a
6253 private library directory that is accessible by everyone.
6254
6255 EOM
6256 fn=$binexp
6257 fn=d~+
6258 rp='Pathname where the private library files will reside?'
6259 . ./getfile
6260 prefixvar=privlib
6261 . ./setprefixvar
6262
6263 : set the prefixup variable, to restore leading tilda escape
6264 prefixup='case "$prefixexp" in
6265 "$prefix") ;;
6266 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6267 esac'
6268
6269 : determine where public architecture dependent libraries go
6270 set archlib archlib
6271 eval $prefixit
6272 : privlib default is /usr/local/lib/$package/$version
6273 : archlib default is /usr/local/lib/$package/$version/$archname
6274 : privlib may have an optional trailing /share.
6275 tdflt=`echo $privlib | $sed 's,/share$,,'`
6276 tdflt=$tdflt/$archname
6277 case "$archlib" in
6278 '')     dflt=$tdflt
6279         ;;
6280 *)      dflt="$archlib"
6281     ;;
6282 esac
6283 $cat <<EOM
6284
6285 $spackage contains architecture-dependent library files.  If you are
6286 sharing libraries in a heterogeneous environment, you might store
6287 these files in a separate location.  Otherwise, you can just include
6288 them with the rest of the public library files.
6289
6290 EOM
6291 fn=$binexp
6292 fn=d+~
6293 rp='Where do you want to put the public architecture-dependent libraries?'
6294 . ./getfile
6295 prefixvar=archlib
6296 . ./setprefixvar
6297 if $test X"$archlib" = X"$privlib"; then
6298         d_archlib="$undef"
6299 else
6300         d_archlib="$define"
6301 fi
6302
6303 : see if setuid scripts can be secure
6304 $cat <<EOM
6305
6306 Some kernels have a bug that prevents setuid #! scripts from being
6307 secure.  Some sites have disabled setuid #! scripts because of this.
6308
6309 First let's decide if your kernel supports secure setuid #! scripts.
6310 (If setuid #! scripts would be secure but have been disabled anyway,
6311 don't say that they are secure if asked.)
6312
6313 EOM
6314
6315 val="$undef"
6316 if $test -d /dev/fd; then
6317         echo "#!$ls" >reflect
6318         chmod +x,u+s reflect
6319         ./reflect >flect 2>&1
6320         if $contains "/dev/fd" flect >/dev/null; then
6321                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6322                 val="$define"
6323         else
6324                 $cat <<EOM
6325 If you are not sure if they are secure, I can check but I'll need a
6326 username and password different from the one you are using right now.
6327 If you don't have such a username or don't want me to test, simply
6328 enter 'none'.
6329
6330 EOM
6331                 rp='Other username to test security of setuid scripts with?'
6332                 dflt='none'
6333                 . ./myread
6334                 case "$ans" in
6335                 n|none)
6336                         case "$d_suidsafe" in
6337                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6338                                 dflt=n;;
6339                         "$undef")
6340                                 echo "Well, the $hint value is *not* secure." >&4
6341                                 dflt=n;;
6342                         *)      echo "Well, the $hint value *is* secure." >&4
6343                                 dflt=y;;
6344                         esac
6345                         ;;
6346                 *)
6347                         $rm -f reflect flect
6348                         echo "#!$ls" >reflect
6349                         chmod +x,u+s reflect
6350                         echo >flect
6351                         chmod a+w flect
6352                         echo '"su" will (probably) prompt you for '"$ans's password."
6353                         su $ans -c './reflect >flect'
6354                         if $contains "/dev/fd" flect >/dev/null; then
6355                                 echo "Okay, it looks like setuid scripts are secure." >&4
6356                                 dflt=y
6357                         else
6358                                 echo "I don't think setuid scripts are secure." >&4
6359                                 dflt=n
6360                         fi
6361                         ;;
6362                 esac
6363                 rp='Does your kernel have *secure* setuid scripts?'
6364                 . ./myread
6365                 case "$ans" in
6366                 [yY]*)  val="$define";;
6367                 *)      val="$undef";;
6368                 esac
6369         fi
6370 else
6371         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6372         echo "(That's for file descriptors, not floppy disks.)"
6373         val="$undef"
6374 fi
6375 set d_suidsafe
6376 eval $setvar
6377
6378 $rm -f reflect flect
6379
6380 : now see if they want to do setuid emulation
6381 if $test $patchlevel -lt 11; then
6382 echo " "
6383 val="$undef"
6384 case "$d_suidsafe" in
6385 "$define")
6386         val="$undef"
6387         echo "No need to emulate SUID scripts since they are secure here." >&4
6388         ;;
6389 *)
6390         $cat <<EOM
6391 Some systems have disabled setuid scripts, especially systems where
6392 setuid scripts cannot be secure.  On systems where setuid scripts have
6393 been disabled, the setuid/setgid bits on scripts are currently
6394 useless.  It is possible for $package to detect those bits and emulate
6395 setuid/setgid in a secure fashion.  This emulation will only work if
6396 setuid scripts have been disabled in your kernel.
6397
6398 EOM
6399         case "$d_dosuid" in
6400         "$define") dflt=y ;;
6401         *) dflt=n ;;
6402         esac
6403         rp="Do you want to do setuid/setgid emulation?"
6404         . ./myread
6405         case "$ans" in
6406         [yY]*)  val="$define";;
6407         *)      val="$undef";;
6408         esac
6409         ;;
6410 esac
6411 set d_dosuid
6412 eval $setvar
6413 else
6414     case "$d_dosuid" in
6415         "$define")
6416         cat >&4 <<EOH
6417
6418 SUID emulation has been removed for 5.12
6419 Please re-run Configure without -Dd_dosuid
6420
6421 EOH
6422         exit 1;
6423         ;;
6424     esac
6425     d_dosuid=undef
6426 fi
6427
6428 : Find perl5.005 or later.
6429 echo "Looking for a previously installed perl5.005 or later... "
6430 case "$perl5" in
6431 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6432                 : Check if this perl is recent and can load a simple module
6433                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6434                         perl5=$tdir/perl
6435                         break;
6436                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6437                         perl5=$tdir/perl5
6438                         break;
6439                 fi
6440         done
6441         ;;
6442 *)      perl5="$perl5"
6443         ;;
6444 esac
6445 case "$perl5" in
6446 '')     echo "None found.  That's ok.";;
6447 *)      echo "Using $perl5." ;;
6448 esac
6449
6450 : Set the siteprefix variables
6451 $cat <<EOM
6452
6453 After $package is installed, you may wish to install various
6454 add-on modules and utilities.  Typically, these add-ons will
6455 be installed under $prefix with the rest
6456 of this package.  However, you may wish to install such add-ons
6457 elsewhere under a different prefix.
6458
6459 If you do not wish to put everything under a single prefix, that's
6460 ok.  You will be prompted for the individual locations; this siteprefix
6461 is only used to suggest the defaults.
6462
6463 The default should be fine for most people.
6464
6465 EOM
6466 fn=d~+
6467 rp='Installation prefix to use for add-on modules and utilities?'
6468 : XXX Here might be another good place for an installstyle setting.
6469 case "$siteprefix" in
6470 '') dflt=$prefix ;;
6471 *)  dflt=$siteprefix ;;
6472 esac
6473 . ./getfile
6474 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6475 oldsiteprefix=''
6476 case "$siteprefix" in
6477 '') ;;
6478 *)      case "$ans" in
6479         "$prefix") ;;
6480         *) oldsiteprefix="$prefix";;
6481         esac
6482         ;;
6483 esac
6484 siteprefix="$ans"
6485 siteprefixexp="$ansexp"
6486
6487 : determine where site specific libraries go.
6488 : Usual default is /usr/local/lib/perl5/site_perl/$version
6489 : The default "style" setting is made in installstyle.U
6490 : XXX No longer works with Prefixit stuff.
6491 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6492 case "$sitelib" in
6493 '') case "$installstyle" in
6494         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6495         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6496         esac
6497         ;;
6498 *)      dflt="$sitelib"
6499         ;;
6500 esac
6501 $cat <<EOM
6502
6503 The installation process will create a directory for
6504 site-specific extensions and modules.  Most users find it convenient
6505 to place all site-specific files in this directory rather than in the
6506 main distribution directory.
6507
6508 EOM
6509 fn=d~+
6510 rp='Pathname for the site-specific library files?'
6511 . ./getfile
6512 prefixvar=sitelib
6513 . ./setprefixvar
6514 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6515
6516 : Determine list of previous versions to include in @INC
6517 $cat > getverlist <<EOPL
6518 #!$perl5 -w
6519 use File::Basename;
6520 \$api_versionstring = "$api_versionstring";
6521 \$version = "$version";
6522 \$stem = "$sitelib_stem";
6523 \$archname = "$archname";
6524 EOPL
6525         $cat >> getverlist <<'EOPL'
6526 # The list found is store twice for each entry: the original name, and
6527 # the binary broken down version as pack "sss", so sorting is easy and
6528 # unambiguous. This will work for all versions that have a maximum of
6529 # three digit groups, separate by '.'s or '_'s. Names are extended with
6530 # ".0.0" to ensure at least three elements for the pack.
6531 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6532
6533 # Can't have leading @ because metaconfig interprets it as a command!
6534 ;@inc_version_list=();
6535 # XXX Redo to do opendir/readdir?
6536 if (-d $stem) {
6537     chdir($stem);
6538     ;@candidates = map {
6539         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6540     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6541 }
6542 else {
6543     ;@candidates = ();
6544 }
6545
6546 ($pversion, $aversion, $vsn5005) = map {
6547     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6548 foreach $d (@candidates) {
6549     if ($d->[1] lt $pversion) {
6550         if ($d->[1] ge $aversion) {
6551             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6552         }
6553         elsif ($d->[1] ge $vsn5005) {
6554             unshift(@inc_version_list, grep { -d } $d->[0]);
6555         }
6556     }
6557     else {
6558         # Skip newer version.  I.e. don't look in
6559         # 5.7.0 if we're installing 5.6.1.
6560     }
6561 }
6562
6563 if (@inc_version_list) {
6564     print join(' ', @inc_version_list);
6565 }
6566 else {
6567     # Blank space to preserve value for next Configure run.
6568     print " ";
6569 }
6570 EOPL
6571 chmod +x getverlist
6572 case "$inc_version_list" in
6573 '')     if test -x "$perl5$exe_ext"; then
6574                 dflt=`$perl5 getverlist`
6575         else
6576                 dflt='none'
6577         fi
6578         ;;
6579 $undef) dflt='none' ;;
6580 *)  eval dflt=\"$inc_version_list\" ;;
6581 esac
6582 case "$dflt" in
6583 ''|' ') dflt=none ;;
6584 esac
6585 case "$dflt" in
6586 5.005) dflt=none ;;
6587 esac
6588 $cat <<EOM
6589
6590 In order to ease the process of upgrading, this version of perl
6591 can be configured to use modules built and installed with earlier
6592 versions of perl that were installed under $prefix.  Specify here
6593 the list of earlier versions that this version of perl should check.
6594 If Configure detected no earlier versions of perl installed under
6595 $prefix, then the list will be empty.  Answer 'none' to tell perl
6596 to not search earlier versions.
6597
6598 The default should almost always be sensible, so if you're not sure,
6599 just accept the default.
6600 EOM
6601
6602 rp='List of earlier versions to include in @INC?'
6603 . ./myread
6604 case "$ans" in
6605 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6606 *) inc_version_list="$ans" ;;
6607 esac
6608 case "$inc_version_list" in
6609 ''|' ')
6610         inc_version_list_init='0'
6611         d_inc_version_list="$undef"
6612         ;;
6613 *)      inc_version_list_init=`echo $inc_version_list |
6614                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6615         d_inc_version_list="$define"
6616         ;;
6617 esac
6618 $rm -f getverlist
6619
6620 : see if malloc/malloc.h has to be included
6621 set malloc/malloc.h i_mallocmalloc
6622 eval $inhdr
6623
6624 : see if this is a malloc.h system
6625 : we want a real compile instead of Inhdr because some systems have a
6626 : malloc.h that just gives a compile error saying to use stdlib.h instead
6627 echo " "
6628 $cat >try.c <<EOCP
6629 #include <stdlib.h>
6630 #include <malloc.h>
6631 #$i_mallocmalloc I_MALLOCMALLOC
6632 #ifdef I_MALLOCMALLOC
6633 # include <malloc/malloc.h>
6634 #endif
6635
6636 int main () { return 0; }
6637 EOCP
6638 set try
6639 if eval $compile; then
6640     echo "<malloc.h> found." >&4
6641     val="$define"
6642 else
6643     echo "<malloc.h> NOT found." >&4
6644     val="$undef"
6645 fi
6646 $rm_try
6647 set i_malloc
6648 eval $setvar
6649
6650 : check for void type
6651 echo " "
6652 echo "Checking to see how well your C compiler groks the void type..." >&4
6653 case "$voidflags" in
6654 '')
6655         $cat >try.c <<EOCP
6656 #$i_stdlib I_STDLIB
6657 #ifdef I_STDLIB
6658 #include <stdlib.h>
6659 #endif
6660 #if TRY & 1
6661 void sub() {
6662 #else
6663 sub() {
6664 #endif
6665         extern void moo();      /* function returning void */
6666         void (*goo)();          /* ptr to func returning void */
6667 #if TRY & 8
6668         void *hue;              /* generic ptr */
6669 #endif
6670 #if TRY & 2
6671         void (*foo[10])();
6672 #endif
6673
6674 #if TRY & 4
6675         if(goo == moo) {
6676                 exit(0);
6677         }
6678 #endif
6679         exit(0);
6680 }
6681 int main() { sub(); }
6682 EOCP
6683         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6684                 voidflags=$defvoidused
6685         echo "Good.  It appears to support void to the level $package wants.">&4
6686                 if $contains warning .out >/dev/null 2>&1; then
6687                         echo "However, you might get some warnings that look like this:"
6688                         $cat .out
6689                 fi
6690         else
6691 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6692                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6693                         echo "It supports 1..."
6694                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6695                                 echo "It also supports 2..."
6696                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6697                                         voidflags=7
6698                                         echo "And it supports 4 but not 8 definitely."
6699                                 else
6700                                         echo "It doesn't support 4..."
6701                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6702                                                 voidflags=11
6703                                                 echo "But it supports 8."
6704                                         else
6705                                                 voidflags=3
6706                                                 echo "Neither does it support 8."
6707                                         fi
6708                                 fi
6709                         else
6710                                 echo "It does not support 2..."
6711                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6712                                         voidflags=13
6713                                         echo "But it supports 4 and 8."
6714                                 else
6715                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6716                                                 voidflags=5
6717                                                 echo "And it supports 4 but has not heard about 8."
6718                                         else
6719                                                 echo "However it supports 8 but not 4."
6720                                         fi
6721                                 fi
6722                         fi
6723                 else
6724                         echo "There is no support at all for void."
6725                         voidflags=0
6726                 fi
6727         fi
6728 esac
6729 case "$voidflags" in
6730 "$defvoidused") ;;
6731 *)      $cat >&4 <<'EOM'
6732   Support flag bits are:
6733     1: basic void declarations.
6734     2: arrays of pointers to functions returning void.
6735     4: operations between pointers to and addresses of void functions.
6736     8: generic void pointers.
6737 EOM
6738         dflt="$voidflags";
6739         rp="Your void support flags add up to what?"
6740         . ./myread
6741         voidflags="$ans"
6742         ;;
6743 esac
6744 $rm_try
6745
6746 : check for length of pointer
6747 echo " "
6748 case "$ptrsize" in
6749 '')
6750         echo "Checking to see how big your pointers are..." >&4
6751         if test "$voidflags" -gt 7; then
6752                 echo '#define VOID_PTR char *' > try.c
6753         else
6754                 echo '#define VOID_PTR void *' > try.c
6755         fi
6756         $cat >>try.c <<EOCP
6757 #include <stdio.h>
6758 #$i_stdlib I_STDLIB
6759 #ifdef I_STDLIB
6760 #include <stdlib.h>
6761 #endif
6762 int main()
6763 {
6764     printf("%d\n", (int)sizeof(VOID_PTR));
6765     exit(0);
6766 }
6767 EOCP
6768         set try
6769         if eval $compile_ok; then
6770                 ptrsize=`$run ./try`
6771                 echo "Your pointers are $ptrsize bytes long."
6772         else
6773                 dflt='4'
6774                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6775                 rp="What is the size of a pointer (in bytes)?"
6776                 . ./myread
6777                 ptrsize="$ans"
6778         fi
6779         ;;
6780 esac
6781 $rm_try
6782 case "$use64bitall" in
6783 "$define"|true|[yY]*)
6784         case "$ptrsize" in
6785         4)      cat <<EOM >&4
6786
6787 *** You have chosen a maximally 64-bit build,
6788 *** but your pointers are only 4 bytes wide.
6789 *** Please rerun Configure without -Duse64bitall.
6790 EOM
6791                 case "$d_quad" in
6792                 define)
6793                         cat <<EOM >&4
6794 *** Since you have quads, you could possibly try with -Duse64bitint.
6795 EOM
6796                         ;;
6797                 esac
6798                 cat <<EOM >&4
6799 *** Cannot continue, aborting.
6800
6801 EOM
6802
6803                 exit 1
6804                 ;;
6805         esac
6806         ;;
6807 esac
6808
6809
6810 : determine whether to use malloc wrapping
6811 echo " "
6812 case "$usemallocwrap" in
6813 [yY]*|true|$define)     dflt='y' ;;
6814 [nN]*|false|$undef)     dflt='n' ;;
6815 *)      case "$usedevel" in
6816         [yY]*|true|$define)     dflt='y' ;;
6817         *) dflt='n' ;;
6818         esac
6819         ;;
6820 esac
6821 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6822 . ./myread
6823 usemallocwrap="$ans"
6824 case "$ans" in
6825 y*|true)
6826         usemallocwrap="$define" ;;
6827 *)
6828         usemallocwrap="$undef" ;;
6829 esac
6830
6831 : determine which malloc to compile in
6832 echo " "
6833 case "$usemymalloc" in
6834 [yY]*|true|$define)     dflt='y' ;;
6835 [nN]*|false|$undef)     dflt='n' ;;
6836 *)      case "$ptrsize" in
6837         4) dflt='y' ;;
6838         *) dflt='n' ;;
6839         esac
6840         ;;
6841 esac
6842 rp="Do you wish to attempt to use the malloc that comes with $package?"
6843 . ./myread
6844 usemymalloc="$ans"
6845 case "$ans" in
6846 y*|true)
6847         usemymalloc='y'
6848         mallocsrc='malloc.c'
6849         mallocobj="malloc$_o"
6850         d_mymalloc="$define"
6851         case "$libs" in
6852         *-lmalloc*)
6853                 : Remove malloc from list of libraries to use
6854                 echo "Removing unneeded -lmalloc from library list" >&4
6855                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6856                 shift
6857                 libs="$*"
6858                 echo "libs = $libs" >&4
6859                 ;;
6860         esac
6861         ;;
6862 *)
6863         usemymalloc='n'
6864         mallocsrc=''
6865         mallocobj=''
6866         d_mymalloc="$undef"
6867         ;;
6868 esac
6869
6870 : compute the return types of malloc and free
6871 echo " "
6872 $cat >malloc.c <<END
6873 #$i_malloc I_MALLOC
6874 #$i_stdlib I_STDLIB
6875 #include <stdio.h>
6876 #include <sys/types.h>
6877 #ifdef I_MALLOC
6878 #include <malloc.h>
6879 #endif
6880 #ifdef I_STDLIB
6881 #include <stdlib.h>
6882 #endif
6883 #ifdef TRY_MALLOC
6884 void *malloc();
6885 #endif
6886 #ifdef TRY_FREE
6887 void free();
6888 #endif
6889 END
6890 case "$malloctype" in
6891 '')
6892         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6893                 malloctype='void *'
6894         else
6895                 malloctype='char *'
6896         fi
6897         ;;
6898 esac
6899 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6900
6901 case "$freetype" in
6902 '')
6903         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6904                 freetype='void'
6905         else
6906                 freetype='int'
6907         fi
6908         ;;
6909 esac
6910 echo "Your system uses $freetype free(), it would seem." >&4
6911 $rm -f malloc.[co]
6912 : determine where site specific architecture-dependent libraries go.
6913 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6914 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6915 : sitelib may have an optional trailing /share.
6916 case "$sitearch" in
6917 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6918         dflt="$dflt/$archname"
6919         ;;
6920 *)      dflt="$sitearch"
6921         ;;
6922 esac
6923 set sitearch sitearch none
6924 eval $prefixit
6925 $cat <<EOM
6926
6927 The installation process will also create a directory for
6928 architecture-dependent site-specific extensions and modules.
6929
6930 EOM
6931 fn=d~+
6932 rp='Pathname for the site-specific architecture-dependent library files?'
6933 . ./getfile
6934 prefixvar=sitearch
6935 . ./setprefixvar
6936 if $test X"$sitearch" = X"$sitelib"; then
6937         d_sitearch="$undef"
6938 else
6939         d_sitearch="$define"
6940 fi
6941
6942 : Set the vendorprefix variables
6943 $cat <<EOM
6944
6945 The installation process will also create a directory for
6946 vendor-supplied add-ons.  Vendors who supply perl with their system
6947 may find it convenient to place all vendor-supplied files in this
6948 directory rather than in the main distribution directory.  This will
6949 ease upgrades between binary-compatible maintenance versions of perl.
6950
6951 Of course you may also use these directories in whatever way you see
6952 fit.  For example, you might use them to access modules shared over a
6953 company-wide network.
6954
6955 The default answer should be fine for most people.
6956 This causes further questions about vendor add-ons to be skipped
6957 and no vendor-specific directories will be configured for perl.
6958
6959 EOM
6960 rp='Do you want to configure vendor-specific add-on directories?'
6961 case "$usevendorprefix" in
6962 define|true|[yY]*) dflt=y ;;
6963 *)      : User may have set vendorprefix directly on Configure command line.
6964         case "$vendorprefix" in
6965         ''|' ') dflt=n ;;
6966         *)      dflt=y ;;
6967         esac
6968         ;;
6969 esac
6970 . ./myread
6971 case "$ans" in
6972 [yY]*)  fn=d~+
6973         rp='Installation prefix to use for vendor-supplied add-ons?'
6974         case "$vendorprefix" in
6975         '') dflt='' ;;
6976         *)  dflt=$vendorprefix ;;
6977         esac
6978         . ./getfile
6979         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6980         oldvendorprefix=''
6981         case "$vendorprefix" in
6982         '') ;;
6983         *)      case "$ans" in
6984                 "$prefix") ;;
6985                 *) oldvendorprefix="$prefix";;
6986                 esac
6987                 ;;
6988         esac
6989         usevendorprefix="$define"
6990         vendorprefix="$ans"
6991         vendorprefixexp="$ansexp"
6992         ;;
6993 *)      usevendorprefix="$undef"
6994         vendorprefix=''
6995         vendorprefixexp=''
6996         ;;
6997 esac
6998
6999 : Set the vendorlib variables
7000 case "$vendorprefix" in
7001 '')     d_vendorlib="$undef"
7002         vendorlib=''
7003         vendorlibexp=''
7004         ;;
7005 *)      d_vendorlib="$define"
7006         : determine where vendor-supplied modules go.
7007         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7008         case "$vendorlib" in
7009         '')
7010                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7011                 case "$installstyle" in
7012                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7013                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7014                 esac
7015                 ;;
7016         *)      dflt="$vendorlib"
7017                 ;;
7018         esac
7019         fn=d~+
7020         rp='Pathname for the vendor-supplied library files?'
7021         . ./getfile
7022         vendorlib="$ans"
7023         vendorlibexp="$ansexp"
7024         ;;
7025 esac
7026 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7027 prefixvar=vendorlib
7028 . ./installprefix
7029
7030 : Set the vendorarch variables
7031 case "$vendorprefix" in
7032 '')     d_vendorarch="$undef"
7033         vendorarch=''
7034         vendorarchexp=''
7035         ;;
7036 *)      d_vendorarch="$define"
7037         : determine where vendor-supplied architecture-dependent libraries go.
7038         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7039         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7040         : vendorlib may have an optional trailing /share.
7041         case "$vendorarch" in
7042         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7043                 dflt="$dflt/$archname"
7044                 ;;
7045         *)      dflt="$vendorarch" ;;
7046         esac
7047         fn=d~+
7048         rp='Pathname for vendor-supplied architecture-dependent files?'
7049         . ./getfile
7050         vendorarch="$ans"
7051         vendorarchexp="$ansexp"
7052         ;;
7053 esac
7054 prefixvar=vendorarch
7055 . ./installprefix
7056 if $test X"$vendorarch" = X"$vendorlib"; then
7057         d_vendorarch="$undef"
7058 else
7059         d_vendorarch="$define"
7060 fi
7061
7062 : Final catch-all directories to search
7063 $cat <<EOM
7064
7065 Lastly, you can have perl look in other directories for extensions and
7066 modules in addition to those already specified.
7067 These directories will be searched after 
7068         $sitearch 
7069         $sitelib 
7070 EOM
7071 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7072 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7073 echo ' '
7074 case "$otherlibdirs" in
7075 ''|' ') dflt='none' ;;
7076 *)      dflt="$otherlibdirs" ;;
7077 esac
7078 $cat <<EOM
7079 Enter a colon-separated set of extra paths to include in perl's @INC
7080 search path, or enter 'none' for no extra paths.
7081
7082 EOM
7083
7084 rp='Colon-separated list of additional directories for perl to search?'
7085 . ./myread
7086 case "$ans" in
7087 ' '|''|none)    otherlibdirs=' ' ;;     
7088 *)      otherlibdirs="$ans" ;;
7089 esac
7090 case "$otherlibdirs" in
7091 ' ') val=$undef ;;
7092 *)      val=$define ;;
7093 esac
7094 set d_perl_otherlibdirs
7095 eval $setvar
7096
7097 : Cruising for prototypes
7098 echo " "
7099 echo "Checking out function prototypes..." >&4
7100 $cat >prototype.c <<EOCP
7101 #$i_stdlib I_STDLIB
7102 #ifdef I_STDLIB
7103 #include <stdlib.h>
7104 #endif
7105 int main(int argc, char *argv[]) {
7106         exit(0);}
7107 EOCP
7108 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7109         echo "Your C compiler appears to support function prototypes."
7110         val="$define"
7111 else
7112         echo "Your C compiler doesn't seem to understand function prototypes."
7113         val="$undef"
7114 fi
7115 set prototype
7116 eval $setvar
7117 $rm -f prototype*
7118
7119 : Check if ansi2knr is required
7120 case "$prototype" in
7121 "$define") ;;
7122 *)      ansi2knr='ansi2knr'
7123         echo " "
7124         cat <<EOM >&4
7125
7126 $me:  FATAL ERROR:
7127 This version of $package can only be compiled by a compiler that 
7128 understands function prototypes.  Unfortunately, your C compiler 
7129         $cc $ccflags
7130 doesn't seem to understand them.  Sorry about that.
7131
7132 If GNU cc is available for your system, perhaps you could try that instead.  
7133
7134 Eventually, we hope to support building Perl with pre-ANSI compilers.
7135 If you would like to help in that effort, please contact <perlbug@perl.org>.
7136
7137 Aborting Configure now.
7138 EOM
7139         exit 2
7140         ;;
7141 esac
7142
7143 : DTrace support
7144 dflt_dtrace='/usr/sbin/dtrace'
7145 cat <<EOM
7146
7147 Perl can be built to support DTrace on platforms that support it.
7148 DTrace is a diagnosis and performance analysis tool from Sun.
7149
7150 If this doesn't make any sense to you, just accept the default '$dflt'.
7151 EOM
7152
7153 while $test 1 ; do
7154         case "$usedtrace" in
7155         $define|true|[yY]*)
7156                 dflt='y'
7157                 ;;
7158         ?*)
7159                 dflt='y'
7160                 dflt_dtrace=$usedtrace
7161                 ;;
7162         *)
7163                 dflt='n'
7164                 ;;
7165         esac
7166
7167         rp='Support DTrace if available?'
7168         . ./myread
7169         case "$ans" in
7170         y|Y)    val="$define" ;;
7171         *)      val="$undef" ;;
7172         esac
7173         set usedtrace
7174         eval $setvar
7175
7176         test "X$usedtrace" != "X$define" && break
7177
7178         echo " "
7179         rp='Where is the dtrace executable?'
7180         dflt=$dflt_dtrace
7181         . ./getfile
7182         val="$ans"
7183         set dtrace
7184         eval $setvar
7185
7186         if $test -f $dtrace
7187         then
7188                 if $dtrace -h -s ../perldtrace.d \
7189                         -o perldtrace.tmp >/dev/null 2>&1 \
7190                         && rm -f perldtrace.tmp
7191                 then
7192                         echo " "
7193                         echo "Good: your $dtrace knows about the -h flag."
7194                 else
7195                         cat >&2 <<EOM
7196
7197 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7198 ***
7199 *** Your installed dtrace doesn't support the -h switch to compile a D
7200 *** program into a C header. Can't continue.
7201
7202 EOM
7203                         exit 1
7204                 fi
7205                 break;
7206         fi
7207
7208         case "$fastread" in
7209         yes)
7210                 cat >&2 <<EOM
7211
7212 *** $me:  Fatal Error:  $dtrace not found.
7213 *** Can't continue.
7214
7215 EOM
7216                 exit 1
7217                 ;;
7218         *)
7219                 echo "*** $dtrace was not found."
7220                 echo " "
7221                 ;;
7222         esac
7223 done
7224
7225 : See if we want extra modules installed
7226 echo " "
7227 case "$extras" in
7228 '') dflt='n';;
7229 *) dflt='y';;
7230 esac
7231 cat <<EOM
7232 Perl can be built with extra modules or bundles of modules which
7233 will be fetched from the CPAN and installed alongside Perl.
7234
7235 Notice that you will need access to the CPAN; either via the Internet,
7236 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7237 be asked later to configure the CPAN.pm module which will in turn do
7238 the installation of the rest of the extra modules or bundles.)
7239
7240 Notice also that if the modules require any external software such as
7241 libraries and headers (the libz library and the zlib.h header for the
7242 Compress::Zlib module, for example) you MUST have any such software
7243 already installed, this configuration process will NOT install such
7244 things for you.
7245
7246 If this doesn't make any sense to you, just accept the default '$dflt'.
7247 EOM
7248 rp='Install any extra modules (y or n)?'
7249 . ./myread
7250 case "$ans" in
7251 y|Y)
7252         cat <<EOM
7253
7254 Please list any extra modules or bundles to be installed from CPAN,
7255 with spaces between the names.  The names can be in any format the
7256 'install' command of CPAN.pm will understand.  (Answer 'none',
7257 without the quotes, to install no extra modules or bundles.)
7258 EOM
7259         rp='Extras?'
7260         dflt="$extras"
7261         . ./myread
7262         extras="$ans"
7263 esac
7264 case "$extras" in
7265 ''|'none')
7266         val=''
7267         $rm -f ../extras.lst
7268         ;;
7269 *)      echo "(Saving the list of extras for later...)"
7270         echo "$extras" > ../extras.lst
7271         val="'$extras'"
7272         ;;
7273 esac
7274 set extras
7275 eval $setvar
7276 echo " "
7277
7278 : determine where html pages for programs go
7279 set html1dir html1dir none
7280 eval $prefixit
7281 $cat <<EOM
7282
7283 If you wish to install html files for programs in $spackage, indicate
7284 the appropriate directory here.  To skip installing html files,
7285 answer "none".
7286 EOM
7287 case "$html1dir" in
7288 ''|none|$undef|' ') dflt=none ;;
7289 *) dflt=$html1dir ;;
7290 esac
7291 fn=dn+~
7292 rp="Directory for the main $spackage html pages?"
7293 . ./getfile
7294 prefixvar=html1dir
7295 . ./setprefixvar
7296 : Use ' ' for none so value is preserved next time through Configure
7297 $test X"$html1dir" = "X" && html1dir=' '
7298
7299 : determine where html pages for libraries and modules go
7300 set html3dir html3dir none
7301 eval $prefixit
7302 $cat <<EOM
7303
7304 If you wish to install html files for modules associated with $spackage,
7305 indicate the appropriate directory here.  To skip installing html files,
7306 answer "none".
7307 EOM
7308 : There is no obvious default.  If they have specified html1dir, then
7309 : try to key off that, possibly changing .../html1 into .../html3.
7310 case "$html3dir" in
7311 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7312 *) dflt=$html3dir ;;
7313 esac
7314 fn=dn+~
7315 rp="Directory for the $spackage module html pages?"
7316 . ./getfile
7317 prefixvar=html3dir
7318 . ./setprefixvar
7319 : Use ' ' for none so value is preserved next time through Configure
7320 $test X"$html3dir" = "X" && html3dir=' '
7321
7322 : determine whether to install perl also as /usr/bin/perl
7323
7324 echo " "
7325 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7326         $cat <<EOM
7327 Many scripts expect perl to be installed as /usr/bin/perl.
7328
7329 If you want to, I can install the perl you are about to compile
7330 as /usr/bin/perl (in addition to $bin/perl).
7331 EOM
7332         if test -f /usr/bin/perl; then
7333             $cat <<EOM
7334
7335 However, please note that because you already have a /usr/bin/perl,
7336 overwriting that with a new Perl would very probably cause problems.
7337 Therefore I'm assuming you don't want to do that (unless you insist).
7338
7339 EOM
7340             case "$installusrbinperl" in
7341             "$define"|[yY]*)    dflt='y';;
7342             *)                  dflt='n';;
7343             esac
7344         else
7345             $cat <<EOM
7346
7347 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7348
7349 EOM
7350             case "$installusrbinperl" in
7351             "$undef"|[nN]*)     dflt='n';;
7352             *)                  dflt='y';;
7353             esac
7354         fi
7355         rp="Do you want to install perl as /usr/bin/perl?"
7356         . ./myread
7357         case "$ans" in
7358         [yY]*)  val="$define";;
7359         *)      val="$undef" ;;
7360         esac
7361 else
7362         val="$undef"
7363 fi
7364 set installusrbinperl
7365 eval $setvar
7366
7367 : Check if we are using the GNU C library
7368 echo " "
7369 echo "Checking for GNU C Library..." >&4
7370 cat >try.c <<'EOCP'
7371 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7372    alone are insufficient to distinguish different versions, such as
7373    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7374    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7375 */
7376 #include <stdio.h>
7377 int main(void)
7378 {
7379 #ifdef __GLIBC__
7380 #   ifdef __GLIBC_MINOR__
7381 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7382 #           include <gnu/libc-version.h>
7383             printf("%s\n",  gnu_get_libc_version());
7384 #       else
7385             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7386 #       endif
7387 #   else
7388         printf("%d\n",  __GLIBC__);
7389 #   endif
7390     return 0;
7391 #else
7392     return 1;
7393 #endif
7394 }
7395 EOCP
7396 set try
7397 if eval $compile_ok && $run ./try > glibc.ver; then
7398         val="$define"
7399         gnulibc_version=`$cat glibc.ver`
7400         echo "You are using the GNU C Library version $gnulibc_version"
7401 else
7402         val="$undef"
7403         gnulibc_version=''
7404         echo "You are not using the GNU C Library"
7405 fi
7406 $rm_try glibc.ver
7407 set d_gnulibc
7408 eval $setvar
7409
7410 : see if nm is to be used to determine whether a symbol is defined or not
7411 case "$usenm" in
7412 '')
7413         dflt=''
7414         case "$d_gnulibc" in
7415         "$define")
7416                 echo " "
7417                 echo "nm probably won't work on the GNU C Library." >&4
7418                 dflt=n
7419                 ;;
7420         esac
7421         case "$dflt" in
7422         '') 
7423                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7424                         echo " "
7425                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7426                         echo "'nm' won't be sufficient on this sytem." >&4
7427                         dflt=n
7428                 fi
7429                 ;;
7430         esac
7431         case "$dflt" in
7432         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7433                 if $test $dflt -gt 20; then
7434                         dflt=y
7435                 else
7436                         dflt=n
7437                 fi
7438                 ;;
7439         esac
7440         ;;
7441 *)
7442         case "$usenm" in
7443         true|$define) dflt=y;;
7444         *) dflt=n;;
7445         esac
7446         ;;
7447 esac
7448 $cat <<EOM
7449
7450 I can use $nm to extract the symbols from your C libraries. This
7451 is a time consuming task which may generate huge output on the disk (up
7452 to 3 megabytes) but that should make the symbols extraction faster. The
7453 alternative is to skip the 'nm' extraction part and to compile a small
7454 test program instead to determine whether each symbol is present. If
7455 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7456 this may be the best solution.
7457
7458 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7459
7460 EOM
7461 rp="Shall I use $nm to extract C symbols from the libraries?"
7462 . ./myread
7463 case "$ans" in
7464 [Nn]*) usenm=false;;
7465 *) usenm=true;;
7466 esac
7467
7468 runnm=$usenm
7469 case "$reuseval" in
7470 true) runnm=false;;
7471 esac
7472
7473 : nm options which may be necessary
7474 case "$nm_opt" in
7475 '') if $test -f /mach_boot; then
7476                 nm_opt=''       # Mach
7477         elif $test -d /usr/ccs/lib; then
7478                 nm_opt='-p'     # Solaris (and SunOS?)
7479         elif $test -f /dgux; then
7480                 nm_opt='-p'     # DG-UX
7481         elif $test -f /lib64/rld; then
7482                 nm_opt='-p'     # 64-bit Irix
7483         else
7484                 nm_opt=''
7485         fi;;
7486 esac
7487
7488 : nm options which may be necessary for shared libraries but illegal
7489 : for archive libraries.  Thank you, Linux.
7490 case "$nm_so_opt" in
7491 '')     case "$myuname" in
7492         *linux*|gnu*)
7493                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7494                         nm_so_opt='--dynamic'
7495                 fi
7496                 ;;
7497         esac
7498         ;;
7499 esac
7500
7501 : Figure out where the libc is located
7502 case "$runnm" in
7503 true)
7504 : get list of predefined functions in a handy place
7505 echo " "
7506 case "$libc" in
7507 '') libc=unknown
7508         case "$libs" in
7509         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7510         esac
7511         ;;
7512 esac
7513 case "$libs" in
7514 '') ;;
7515 *)  for thislib in $libs; do
7516         case "$thislib" in
7517         -lc|-lc_s)
7518                 : Handle C library specially below.
7519                 ;;
7520         -l*)
7521                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7522                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7523                         :
7524                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7525                         :
7526                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7527                         :
7528                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7529                         :
7530                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7531                         :
7532                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7533                         :
7534                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7535                         :
7536                 else
7537                         try=''
7538                 fi
7539                 libnames="$libnames $try"
7540                 ;;
7541         *) libnames="$libnames $thislib" ;;
7542         esac
7543         done
7544         ;;
7545 esac
7546 xxx=normal
7547 case "$libc" in
7548 unknown)
7549         set /lib/libc.$so
7550         for xxx in $libpth; do
7551                 $test -r $1 || set $xxx/libc.$so
7552                 : The messy sed command sorts on library version numbers.
7553                 $test -r $1 || \
7554                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7555                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7556                                 h
7557                                 s/[0-9][0-9]*/0000&/g
7558                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7559                                 G
7560                                 s/\n/ /' | \
7561                          $sort | $sed -e 's/^.* //'`
7562                 eval set \$$#
7563         done
7564         $test -r $1 || set /usr/ccs/lib/libc.$so
7565         $test -r $1 || set /lib/libsys_s$_a
7566         ;;
7567 *)
7568         set blurfl
7569         ;;
7570 esac
7571 if $test -r "$1"; then
7572         echo "Your (shared) C library seems to be in $1."
7573         libc="$1"
7574 elif $test -r /lib/libc && $test -r /lib/clib; then
7575         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7576         xxx=apollo
7577         libc='/lib/clib /lib/libc'
7578         if $test -r /lib/syslib; then
7579                 echo "(Your math library is in /lib/syslib.)"
7580                 libc="$libc /lib/syslib"
7581         fi
7582 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7583         echo "Your C library seems to be in $libc, as you said before."
7584 elif $test -r $incpath/usr/lib/libc$_a; then
7585         libc=$incpath/usr/lib/libc$_a;
7586         echo "Your C library seems to be in $libc.  That's fine."
7587 elif $test -r /lib/libc$_a; then
7588         libc=/lib/libc$_a;
7589         echo "Your C library seems to be in $libc.  You're normal."
7590 else
7591         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7592                 :
7593         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7594                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7595         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7596                 :
7597         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7598                 :
7599         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7600                 :
7601         else
7602                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7603         fi
7604         if $test -r "$tans"; then
7605                 echo "Your C library seems to be in $tans, of all places."
7606                 libc=$tans
7607         else
7608                 libc='blurfl'
7609         fi
7610 fi
7611 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7612         dflt="$libc"
7613         cat <<EOM
7614
7615 If the guess above is wrong (which it might be if you're using a strange
7616 compiler, or your machine supports multiple models), you can override it here.
7617
7618 EOM
7619 else
7620         dflt=''
7621         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7622         cat >&4 <<EOM
7623 I can't seem to find your C library.  I've looked in the following places:
7624
7625 EOM
7626         $sed 's/^/      /' libpath
7627         cat <<EOM
7628
7629 None of these seems to contain your C library. I need to get its name...
7630
7631 EOM
7632 fi
7633 fn=f
7634 rp='Where is your C library?'
7635 . ./getfile
7636 libc="$ans"
7637
7638 echo " "
7639 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7640 set X `cat libnames`
7641 shift
7642 xxx=files
7643 case $# in 1) xxx=file; esac
7644 echo "Extracting names from the following $xxx for later perusal:" >&4
7645 echo " "
7646 $sed 's/^/      /' libnames >&4
7647 echo " "
7648 $echo $n "This may take a while...$c" >&4
7649
7650 for file in $*; do
7651         case $file in
7652         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7653         *) $nm $nm_opt $file 2>/dev/null;;
7654         esac
7655 done >libc.tmp
7656
7657 $echo $n ".$c"
7658 $grep fprintf libc.tmp > libc.ptf
7659 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7660 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7661 xxx='[ADTSIW]'
7662 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7663         eval $xscan;\
7664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7665                 eval $xrun
7666 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7667         eval $xscan;\
7668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7669                 eval $xrun
7670 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7671         eval $xscan;\
7672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7673                 eval $xrun
7674 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7675         eval $xscan;\
7676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7677                 eval $xrun
7678 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7679         eval $xscan;\
7680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681                 eval $xrun
7682 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7683         eval $xscan;\
7684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685                 eval $xrun
7686 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7687                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7688         eval $xscan;\
7689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7690                 eval $xrun
7691 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7692         eval $xscan;\
7693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7694                 eval $xrun
7695 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7696         eval $xscan;\
7697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7698                 eval $xrun
7699 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7700         eval $xscan;\
7701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7702                 eval $xrun
7703 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7704         eval $xscan;\
7705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7706                 eval $xrun
7707 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7708         eval $xscan;\
7709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7710                 eval $xrun
7711 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7712         eval $xscan;\
7713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7714                 eval $xrun
7715 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7716         eval $xscan;\
7717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7718                 eval $xrun
7719 else
7720         $nm -p $* 2>/dev/null >libc.tmp
7721         $grep fprintf libc.tmp > libc.ptf
7722         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7723                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7724         then
7725                 nm_opt='-p'
7726                 eval $xrun
7727         else
7728                 echo " "
7729                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7730                 com=''
7731                 if $ar t $libc > libc.tmp && \
7732                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7733                 then
7734                         for thisname in $libnames $libc; do
7735                                 $ar t $thisname >>libc.tmp
7736                         done
7737                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7738                         echo "Ok." >&4
7739                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7740                         for thisname in $libnames $libc; do
7741                                 $ar tv $thisname >>libc.tmp
7742                                 emximp -o tmp.imp $thisname \
7743                                     2>/dev/null && \
7744                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7745                                     < tmp.imp >>libc.tmp
7746                                 $rm -f tmp.imp
7747                         done
7748                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7749                         echo "Ok." >&4
7750                 else
7751                         echo "$ar didn't seem to work right." >&4
7752                         echo "Maybe this is a Cray...trying bld instead..." >&4
7753                         if  bld t $libc | \
7754                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7755                                 $test -s libc.list
7756                         then
7757                                 for thisname in $libnames; do
7758                                         bld t $libnames | \
7759                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7760                                         $ar t $thisname >>libc.tmp
7761                                 done
7762                                 echo "Ok." >&4
7763                         else
7764                                 echo "That didn't work either.  Giving up." >&4
7765                                 exit 1
7766                         fi
7767                 fi
7768         fi
7769 fi
7770 nm_extract="$com"
7771 case "$PASE" in
7772 define)
7773     echo " "
7774     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7775     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7776     ;;
7777 *)  if $test -f /lib/syscalls.exp; then
7778         echo " "
7779         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7780         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7781                 /lib/syscalls.exp >>libc.list
7782     fi
7783     ;;
7784 esac
7785 ;;
7786 esac
7787 $rm -f libnames libpath
7788
7789 : see if dld is available
7790 set dld.h i_dld
7791 eval $inhdr
7792
7793 : Check if we are using C++
7794 echo " "
7795 echo "Checking for C++..." >&4
7796 $cat >try.c <<'EOCP'
7797 #include <stdio.h>
7798 int main(void)
7799 {
7800 #ifdef __cplusplus
7801     return 0;
7802 #else
7803     return 1;
7804 #endif
7805 }
7806 EOCP
7807 set try
7808 if eval $compile_ok && $run ./try; then
7809         val="$define"
7810         echo "You are using a C++ compiler."
7811 else
7812         val="$undef"
7813         echo "You are not using a C++ compiler."
7814 fi
7815 $rm_try cplusplus$$
7816 set d_cplusplus
7817 eval $setvar
7818
7819 : is a C symbol defined?
7820 csym='tlook=$1;
7821 case "$3" in
7822 -v) tf=libc.tmp; tdc="";;
7823 -a) tf=libc.tmp; tdc="[]";;
7824 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7825 esac;
7826 case "$d_cplusplus" in
7827     $define)    extern_C="extern \"C\"" ;;
7828     *)          extern_C="extern"       ;;
7829 esac;
7830 tx=yes;
7831 case "$reuseval-$4" in
7832 true-) ;;
7833 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7834 esac;
7835 case "$tx" in
7836 yes)
7837         tval=false;
7838         if $test "$runnm" = true; then
7839                 if $contains $tlook $tf >/dev/null 2>&1; then
7840                         tval=true;
7841                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7842                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7843                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7844                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7845                         $rm_try;
7846                 fi;
7847         else
7848                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7849                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7850                 $rm_try;
7851         fi;
7852         ;;
7853 *)
7854         case "$tval" in
7855         $define) tval=true;;
7856         *) tval=false;;
7857         esac;
7858         ;;
7859 esac;
7860 eval "$2=$tval"'
7861
7862 : define an is-in-libc? function
7863 inlibc='echo " "; td=$define; tu=$undef;
7864 sym=$1; var=$2; eval "was=\$$2";
7865 tx=yes;
7866 case "$reuseval$was" in
7867 true) ;;
7868 true*) tx=no;;
7869 esac;
7870 case "$tx" in
7871 yes)
7872         set $sym tres -f;
7873         eval $csym;
7874         case "$tres" in
7875         true)
7876                 echo "$sym() found." >&4;
7877                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7878         *)
7879                 echo "$sym() NOT found." >&4;
7880                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7881         esac;;
7882 *)
7883         case "$was" in
7884         $define) echo "$sym() found." >&4;;
7885         *) echo "$sym() NOT found." >&4;;
7886         esac;;
7887 esac'
7888
7889 : see if dlopen exists
7890 xxx_runnm="$runnm"
7891 xxx_ccflags="$ccflags"
7892 runnm=false
7893 : with g++ one needs -shared to get is-in-libc to work for dlopen
7894 case "$gccversion" in
7895 '')     ;;
7896 *)      case "$d_cplusplus" in
7897         "$define") ccflags="$ccflags -shared" ;;
7898         esac
7899         ;;
7900 esac
7901 set dlopen d_dlopen
7902 eval $inlibc
7903 runnm="$xxx_runnm"
7904 ccflags="$xxx_ccflags"
7905
7906 : see if this is a unistd.h system
7907 set unistd.h i_unistd
7908 eval $inhdr
7909
7910 : determine which dynamic loading, if any, to compile in
7911 echo " "
7912 dldir="ext/DynaLoader"
7913 case "$usedl" in
7914 $define|y|true)
7915         dflt='y'
7916         usedl="$define"
7917         ;;
7918 $undef|n|false)
7919         dflt='n'
7920         usedl="$undef"
7921         ;;
7922 *)
7923         dflt='n'
7924         case "$d_dlopen" in
7925             $define) dflt='y' ;;
7926         esac
7927         case "$i_dld" in
7928             $define) dflt='y' ;;
7929         esac
7930         : Does a dl_xxx.xs file exist for this operating system
7931         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7932         ;;
7933 esac
7934 rp="Do you wish to use dynamic loading?"
7935 . ./myread
7936 usedl="$ans"
7937 bin_ELF="$undef"
7938 case "$ans" in
7939 y*) usedl="$define"
7940         case "$dlsrc" in
7941         '')
7942                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7943                         dflt="$dldir/dl_${osname}.xs"
7944                 elif $test "$d_dlopen" = "$define" ; then
7945                         dflt="$dldir/dl_dlopen.xs"
7946                 elif $test "$i_dld" = "$define" ; then
7947                         dflt="$dldir/dl_dld.xs"
7948                 else
7949                         dflt=''
7950                 fi
7951                 ;;
7952         *)      dflt="$dldir/$dlsrc"
7953                 ;;
7954         esac
7955     echo "The following dynamic loading files are available:"
7956         : Can not go over to $dldir because getfile has path hard-coded in.
7957         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7958         rp="Source file to use for dynamic loading"
7959         fn="fne"
7960         gfpth="$src"
7961         . ./getfile
7962         usedl="$define"
7963         : emulate basename
7964         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7965
7966         $cat << EOM
7967
7968 Some systems may require passing special flags to $cc -c to
7969 compile modules that will be used to create a shared library.
7970 To use no flags, say "none".
7971
7972 EOM
7973     case "$cccdlflags" in
7974     '') case "$gccversion" in
7975                 '') case "$osname" in
7976                         hpux)   dflt='+z' ;;
7977                         next)   dflt='none' ;;
7978                         irix*)  dflt='-KPIC' ;;
7979                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7980                         sunos)  dflt='-pic' ;;
7981                         *)      dflt='none' ;;
7982                     esac
7983                         ;;
7984                 *)  case "$osname" in
7985                         darwin) dflt='none' ;;
7986                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7987                         *)      dflt='-fpic' ;;
7988                     esac ;;
7989             esac ;;
7990         ' ') dflt='none' ;;
7991     *)  dflt="$cccdlflags" ;;
7992     esac
7993     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7994     . ./myread
7995     case "$ans" in
7996     none) cccdlflags=' ' ;;
7997     *) cccdlflags="$ans" ;;
7998     esac
7999
8000     cat << EOM
8001
8002 Some systems use ld to create libraries that can be dynamically loaded,
8003 while other systems (such as those using ELF) use $cc.
8004
8005 EOM
8006         case "$ld" in
8007         '')     $cat >try.c <<EOM
8008 /* Test for whether ELF binaries are produced */
8009 #include <fcntl.h>
8010 #$i_stdlib I_STDLIB
8011 #ifdef I_STDLIB
8012 #include <stdlib.h>
8013 #endif
8014 #$i_unistd I_UNISTD
8015 #ifdef I_UNISTD
8016 #include <unistd.h>
8017 #endif
8018 int main() {
8019         char b[4];
8020         int i = open("a.out",O_RDONLY);
8021         if(i == -1)
8022                 exit(1); /* fail */
8023         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8024                 exit(0); /* succeed (yes, it's ELF) */
8025         else
8026                 exit(1); /* fail */
8027 }
8028 EOM
8029                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8030                         cat <<EOM
8031 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8032 EOM
8033                         dflt="$cc"
8034                         bin_ELF="$define"
8035                 else
8036                         echo "I'll use ld to build dynamic libraries."
8037                         dflt='ld'
8038                 fi
8039                 $rm_try
8040                 ;;
8041         *)      dflt="$ld"
8042                 ;;
8043         esac
8044
8045     rp="What command should be used to create dynamic libraries?"
8046     . ./myread
8047         ld="$ans"
8048
8049     cat << EOM
8050
8051 Some systems may require passing special flags to $ld to create a
8052 library that can be dynamically loaded.  If your ld flags include
8053 -L/other/path options to locate libraries outside your loader's normal
8054 search path, you may need to specify those -L options here as well.  To
8055 use no flags, say "none".
8056
8057 EOM
8058     case "$lddlflags" in
8059     '') case "$osname" in
8060                         beos) dflt='-nostart' ;;
8061                         haiku) dflt='-shared' ;;
8062                         hpux) dflt='-b';
8063                               case "$gccversion" in
8064                               '') dflt="$dflt +vnocompatwarnings" ;;
8065                               esac
8066                               ;;
8067                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8068                         next)  dflt='none' ;;
8069                         solaris) dflt='-G' ;;
8070                         sunos) dflt='-assert nodefinitions' ;;
8071                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8072                 *)     dflt='none' ;;
8073                         esac
8074                         ;;
8075     *) dflt="$lddlflags" ;;
8076     esac
8077
8078         : Try to guess additional flags to pick up local libraries.
8079         : Be careful not to append to a plain 'none'
8080         case "$dflt" in
8081         none) dflt='' ;;
8082         esac
8083         for thisflag in $ldflags; do
8084                 case "$thisflag" in
8085                 -L*|-R*|-Wl,-R*)
8086                         case " $dflt " in
8087                         *" $thisflag "*) ;;
8088                         *) dflt="$dflt $thisflag" ;;
8089                         esac
8090                         ;;
8091                 esac
8092         done
8093
8094         case "$dflt" in
8095         ''|' ') dflt='none' ;;
8096         esac
8097
8098         case "$ldflags" in
8099         *-fstack-protector*)
8100             case "$dflt" in
8101                         *-fstack-protector*) ;; # Don't add it again
8102                         *) dflt="$dflt -fstack-protector" ;; 
8103                 esac
8104                 ;;
8105         esac
8106
8107
8108     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8109     . ./myread
8110     case "$ans" in
8111     none) lddlflags=' ' ;;
8112     *) lddlflags="$ans" ;;
8113     esac
8114
8115         cat <<EOM
8116
8117 Some systems may require passing special flags to $cc to indicate that
8118 the resulting executable will use dynamic linking.  To use no flags,
8119 say "none".
8120
8121 EOM
8122     case "$ccdlflags" in
8123     '') case "$osname" in
8124             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8125             next|sunos) dflt='none' ;;
8126             *)          dflt='none' ;;
8127             esac ;;
8128     ' ')  dflt='none' ;;
8129     *)  dflt="$ccdlflags" ;;
8130     esac
8131     rp="Any special flags to pass to $cc to use dynamic linking?"
8132     . ./myread
8133     case "$ans" in
8134     none) ccdlflags=' ' ;;
8135     *) ccdlflags="$ans" ;;
8136     esac
8137     ;;
8138 *)  usedl="$undef"
8139         ld='ld'
8140     dlsrc='dl_none.xs'
8141     lddlflags=''
8142     ccdlflags=''
8143     ;;
8144 esac
8145
8146 : Do we want a shared libperl?
8147 also=''
8148 case "$usedl" in
8149 $undef)
8150         # No dynamic loading being used, so don't bother even to prompt.
8151         useshrplib='false'
8152         ;;
8153 *)      case "$useshrplib" in
8154         '')     case "$osname" in
8155                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8156                         dflt=y
8157                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8158                         ;;
8159                 next*)
8160                         case "$osvers" in
8161                         4*)     dflt=y
8162                                 also='Building a shared libperl is needed for MAB support.'
8163                                 ;;
8164                         *)      dflt=n
8165                                 ;;
8166                         esac
8167                         ;;
8168                 *)      dflt=n
8169                         ;;
8170                 esac
8171                 ;;
8172         $define|true|[Yy]*)
8173                 dflt=y
8174                 ;;
8175         *)      dflt=n
8176                 ;;
8177         esac
8178         $cat << EOM
8179
8180 The perl executable is normally obtained by linking perlmain.c with
8181 libperl${_a}, any static extensions (usually just DynaLoader), and
8182 any other libraries needed on this system (such as -lm, etc.).  Since
8183 your system supports dynamic loading, it is probably possible to build
8184 a shared libperl.$so.  If you will have more than one executable linked
8185 to libperl.$so, this will significantly reduce the size of each
8186 executable, but it may have a noticeable effect on performance.  The
8187 default is probably sensible for your system.
8188 $also
8189
8190 EOM
8191         rp="Build a shared libperl.$so (y/n)"
8192         . ./myread
8193         case "$ans" in
8194         true|$define|[Yy]*)
8195                 useshrplib='true'  ;;
8196         *)      useshrplib='false' ;;
8197         esac
8198         ;;
8199 esac
8200
8201 case "$useshrplib" in
8202 true)
8203         case "$userelocatableinc" in
8204         true|define)
8205                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8206                 echo "See INSTALL for an explanation why that won't work." >&4
8207                 exit 4
8208                 ;;
8209         esac
8210         case "$libperl" in
8211         '')
8212                 # Figure out a good name for libperl.so.  Since it gets stored in
8213                 # a version-specific architecture-dependent library, the version
8214                 # number isn't really that important, except for making cc/ld happy.
8215                 #
8216                 # A name such as libperl.so.10.1
8217                 majmin="libperl.$so.$patchlevel.$subversion"
8218                 # A name such as libperl.so.100
8219                 majonly=`echo $patchlevel $subversion |
8220                         $awk '{printf "%d%02d", $1, $2}'`
8221                 majonly=libperl.$so.$majonly
8222                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8223                 # rely on figuring it out from the naming of libc.
8224                 case "${osname}${osvers}" in
8225                 next4*)
8226                         dflt=libperl.5.$so
8227                         # XXX How handle the --version stuff for MAB?
8228                         ;;
8229                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8230                         dflt=libperl.$so
8231                         ;;
8232                 cygwin*) # ld links now against the dll directly
8233                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8234                         majonly=`echo $patchlevel $subversion |
8235                                 $awk '{printf "%03d%03d", $1, $2}'`
8236                         majonly=cygperl5.$majonly.$so
8237                         dflt=$majmin
8238                         ;;
8239                 *)      # Try to guess based on whether libc has major.minor.
8240                         case "$libc" in
8241                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8242                         *libc.$so.[0-9]*) dflt=$majonly ;;
8243                         *)      dflt=libperl.$so ;;
8244                         esac
8245                         ;;
8246                 esac
8247                 ;;
8248         *)      dflt=$libperl
8249                 ;;
8250         esac
8251         cat << EOM
8252
8253 I need to select a good name for the shared libperl.  If your system uses
8254 library names with major and minor numbers, then you might want something
8255 like $majmin.  Alternatively, if your system uses a single version
8256 number for shared libraries, then you might want to use $majonly.
8257 Or, your system might be quite happy with a simple libperl.$so.
8258
8259 Since the shared libperl will get installed into a version-specific
8260 architecture-dependent directory, the version number of the shared perl
8261 library probably isn't important, so the default should be o.k.
8262
8263 EOM
8264         rp='What name do you want to give to the shared libperl?'
8265         . ./myread
8266         libperl=$ans
8267         echo "Ok, I'll use $libperl"
8268         ;;
8269 *)
8270         libperl="libperl${_a}"
8271         ;;
8272 esac
8273
8274 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8275 case "$shrpdir" in
8276 '') ;;
8277 *)      $cat >&4 <<EOM
8278 WARNING:  Use of the shrpdir variable for the installation location of
8279 the shared $libperl is not supported.  It was never documented and
8280 will not work in this version.  Let me (perlbug@perl.org)
8281 know of any problems this may cause.
8282
8283 EOM
8284         case "$shrpdir" in
8285         "$archlibexp/CORE")
8286                 $cat >&4 <<EOM
8287 But your current setting of $shrpdir is
8288 the default anyway, so it's harmless.
8289 EOM
8290                 ;;
8291         *)
8292                 $cat >&4 <<EOM
8293 Further, your current attempted setting of $shrpdir
8294 conflicts with the value of $archlibexp/CORE
8295 that installperl will use.
8296 EOM
8297                 ;;
8298         esac
8299         ;;
8300 esac
8301
8302 # How will the perl executable find the installed shared $libperl?
8303 # Add $xxx to ccdlflags.
8304 # If we can't figure out a command-line option, use $shrpenv to
8305 # set env LD_RUN_PATH.  The main perl makefile uses this.
8306 shrpdir=$archlibexp/CORE
8307 xxx=''
8308 tmp_shrpenv=''
8309 if "$useshrplib"; then
8310     case "$osname" in
8311         aix)
8312                 # We'll set it in Makefile.SH...
8313                 ;;
8314         solaris)
8315                 xxx="-R $shrpdir"
8316                 ;;
8317         freebsd|netbsd|openbsd|interix|dragonfly)
8318                 xxx="-Wl,-R$shrpdir"
8319                 ;;
8320         bsdos|linux|irix*|dec_osf|gnu*)
8321                 xxx="-Wl,-rpath,$shrpdir"
8322                 ;;
8323         next)
8324                 # next doesn't like the default...
8325                 ;;
8326         beos)
8327                 # beos doesn't like the default, either.
8328                 ;;
8329         haiku)
8330                 # Haiku doesn't like the default, either.
8331                 ;;
8332         hpux*)
8333                 # hpux doesn't like the default, either.
8334                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8335                 ;;
8336         cygwin)
8337                 # cygwin needs only ldlibpth
8338                 ;;
8339         *)
8340                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8341                 ;;
8342         esac
8343         case "$xxx" in
8344         '') ;;
8345         *)
8346                 # Only add $xxx if it isn't already in ccdlflags.
8347                 case " $ccdlflags " in
8348                 *" $xxx "*)     ;;
8349                 *)      ccdlflags="$ccdlflags $xxx"
8350                         cat <<EOM >&4
8351
8352 Adding $xxx to the flags
8353 passed to $ld so that the perl executable will find the
8354 installed shared $libperl.
8355
8356 EOM
8357                         ;;
8358                 esac
8359                 ;;
8360         esac
8361 fi
8362 # Fix ccdlflags in AIX for building external extensions.
8363 # (For building Perl itself bare -bE:perl.exp is needed,
8364 #  Makefile.SH takes care of this.)
8365 case "$osname" in
8366 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8367 esac
8368 # Respect a hint or command-line value.
8369 case "$shrpenv" in
8370 '') shrpenv="$tmp_shrpenv" ;;
8371 esac
8372 case "$ldlibpthname" in
8373 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8374 none)   ldlibpthname='' ;;
8375 esac
8376
8377 : determine where manual pages are on this system
8378 echo " "
8379 case "$sysman" in
8380 '') 
8381         syspath='/usr/share/man/man1 /usr/man/man1'
8382         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8383         syspath="$syspath /usr/man/u_man/man1"
8384         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8385         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8386         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8387         sysman=`./loc . /usr/man/man1 $syspath`
8388         ;;
8389 esac
8390 if $test -d "$sysman"; then
8391         echo "System manual is in $sysman." >&4
8392 else
8393         echo "Could not find manual pages in source form." >&4
8394 fi
8395
8396 : determine where manual pages go
8397 set man1dir man1dir none
8398 eval $prefixit
8399 $cat <<EOM
8400
8401 $spackage has manual pages available in source form.
8402 EOM
8403 case "$nroff" in
8404 nroff)
8405         echo "However, you don't have nroff, so they're probably useless to you."
8406         case "$man1dir" in
8407         '') man1dir="none";;
8408         esac;;
8409 esac
8410 echo "If you don't want the manual sources installed, answer 'none'."
8411 case "$man1dir" in
8412 ' ') dflt=none
8413         ;;
8414 '')
8415         lookpath="$prefixexp/share/man/man1"
8416         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8417         lookpath="$lookpath $prefixexp/man/p_man/man1"
8418         lookpath="$lookpath $prefixexp/man/u_man/man1"
8419         lookpath="$lookpath $prefixexp/man/man.1"
8420         case "$sysman" in
8421         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8422         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8423         esac
8424         set dflt
8425         eval $prefixup
8426         ;;
8427 *)  dflt="$man1dir"
8428         ;;
8429 esac
8430 echo " "
8431 fn=dn+~
8432 rp="Where do the main $spackage manual pages (source) go?"
8433 . ./getfile
8434 if $test "X$man1direxp" != "X$ansexp"; then
8435         installman1dir=''
8436 fi
8437 prefixvar=man1dir
8438 . ./setprefixvar
8439
8440 case "$man1dir" in
8441 '')     man1dir=' '
8442         installman1dir='';;
8443 esac
8444
8445 : What suffix to use on installed man pages
8446
8447 case "$man1dir" in
8448 ' ')
8449         man1ext='0'
8450         ;;
8451 *)
8452         rp="What suffix should be used for the main $spackage man pages?"
8453         case "$man1ext" in
8454         '')     case "$man1dir" in
8455                 *1)  dflt=1 ;;
8456                 *1p) dflt=1p ;;
8457                 *1pm) dflt=1pm ;;
8458                 *l) dflt=l;;
8459                 *n) dflt=n;;
8460                 *o) dflt=o;;
8461                 *p) dflt=p;;
8462                 *C) dflt=C;;
8463                 *L) dflt=L;;
8464                 *L1) dflt=L1;;
8465                 *) dflt=1;;
8466                 esac
8467                 ;;
8468         *)      dflt="$man1ext";;
8469         esac
8470         . ./myread
8471         man1ext="$ans"
8472         ;;
8473 esac
8474
8475 : see if we can have long filenames
8476 echo " "
8477 first=123456789abcdef
8478 $rm -f $first
8479 if (echo hi >$first) 2>/dev/null; then
8480         if $test -f 123456789abcde; then
8481                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8482                 val="$undef"
8483         else
8484                 echo 'You can have filenames longer than 14 characters.'>&4
8485                 val="$define"
8486         fi
8487 else
8488         $cat <<'EOM'
8489 You can't have filenames longer than 14 chars.
8490 You can't even think about them!
8491 EOM
8492         val="$undef"
8493 fi
8494 set d_flexfnam
8495 eval $setvar
8496 $rm -rf 123456789abcde*
8497
8498 : determine where library module manual pages go
8499 set man3dir man3dir none
8500 eval $prefixit
8501 $cat <<EOM
8502
8503 $spackage has manual pages for many of the library modules.
8504 EOM
8505
8506 case "$nroff" in
8507 nroff)
8508         $cat <<'EOM'
8509 However, you don't have nroff, so they're probably useless to you.
8510 EOM
8511         case "$man3dir" in
8512         '') man3dir="none";;
8513         esac;;
8514 esac
8515
8516 case "$d_flexfnam" in
8517 undef)
8518         $cat <<'EOM'
8519 However, your system can't handle the long file names like File::Basename.3.
8520 EOM
8521         case "$man3dir" in
8522         '') man3dir="none";;
8523         esac;;
8524 esac
8525
8526 echo "If you don't want the manual sources installed, answer 'none'."
8527 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8528 case "$man3dir" in
8529 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8530         if $test -d "$privlib/man/man3"; then
8531                 cat <<EOM >&4
8532
8533 WARNING:  Previous versions of perl installed man3 pages into
8534 $privlib/man/man3.  This version will suggest a
8535 new default of $dflt.
8536 EOM
8537                 tdflt=$dflt
8538                 dflt='n'
8539                 rp='Do you wish to preserve the old behavior?(y/n)'
8540                 . ./myread
8541                 case "$ans" in
8542                 y*) dflt="$privlib/man/man3" ;;
8543                 *)  dflt=$tdflt ;;
8544                 esac
8545     fi
8546         ;;
8547 *)      dflt="$man3dir" ;;
8548 esac
8549 case "$dflt" in
8550 ' ') dflt=none ;;
8551 esac
8552 echo " "
8553 fn=dn+~
8554 rp="Where do the $package library man pages (source) go?"
8555 . ./getfile
8556 prefixvar=man3dir
8557 . ./setprefixvar
8558
8559 case "$man3dir" in
8560 '')     man3dir=' '
8561         installman3dir='';;
8562 esac
8563
8564 : What suffix to use on installed man pages
8565 case "$man3dir" in
8566 ' ')
8567         man3ext='0'
8568         ;;
8569 *)
8570         rp="What suffix should be used for the $package library man pages?"
8571         case "$man3ext" in
8572         '')     case "$man3dir" in
8573                 *3)  dflt=3 ;;
8574                 *3p) dflt=3p ;;
8575                 *3pm) dflt=3pm ;;
8576                 *l) dflt=l;;
8577                 *n) dflt=n;;
8578                 *o) dflt=o;;
8579                 *p) dflt=p;;
8580                 *C) dflt=C;;
8581                 *L) dflt=L;;
8582                 *L3) dflt=L3;;
8583                 *) dflt=3;;
8584                 esac
8585                 ;;
8586         *)      dflt="$man3ext";;
8587         esac
8588         . ./myread
8589         man3ext="$ans"
8590         ;;
8591 esac
8592
8593 : see if we have to deal with yellow pages, now NIS.
8594 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8595         if $test -f /usr/etc/nibindd; then
8596                 echo " "
8597                 echo "I'm fairly confident you're on a NeXT."
8598                 echo " "
8599                 rp='Do you get the hosts file via NetInfo?'
8600                 dflt=y
8601                 case "$hostcat" in
8602                 nidump*) ;;
8603                 '') ;;
8604                 *) dflt=n;;
8605                 esac
8606                 . ./myread
8607                 case "$ans" in
8608                 y*) hostcat='nidump hosts .';;
8609                 *)      case "$hostcat" in
8610                         nidump*) hostcat='';;
8611                         esac
8612                         ;;
8613                 esac
8614         fi
8615         case "$hostcat" in
8616         nidump*) ;;
8617         *)
8618                 case "$hostcat" in
8619                 *ypcat*) dflt=y;;
8620                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8621                                 dflt=y
8622                         else
8623                                 dflt=n
8624                         fi;;
8625                 *) dflt=n;;
8626                 esac
8627                 echo " "
8628                 rp='Are you getting the hosts file via yellow pages?'
8629                 . ./myread
8630                 case "$ans" in
8631                 y*) hostcat='ypcat hosts';;
8632                 *) hostcat='cat /etc/hosts';;
8633                 esac
8634                 ;;
8635         esac
8636 fi
8637 case "$hostcat" in
8638 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8639 esac
8640 case "$groupcat" in
8641 '') test -f /etc/group && groupcat='cat /etc/group';;
8642 esac
8643 case "$passcat" in
8644 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8645 esac
8646
8647 : now get the host name
8648 echo " "
8649 echo "Figuring out host name..." >&4
8650 case "$myhostname" in
8651 '') cont=true
8652         echo 'Maybe "hostname" will work...'
8653         if tans=`sh -c hostname 2>&1` ; then
8654                 myhostname=$tans
8655                 phostname=hostname
8656                 cont=''
8657         fi
8658         ;;
8659 *) cont='';;
8660 esac
8661 if $test "$cont"; then
8662         if ./xenix; then
8663                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8664                 if tans=`cat /etc/systemid 2>&1` ; then
8665                         myhostname=$tans
8666                         phostname='cat /etc/systemid'
8667                         echo "Whadyaknow.  Xenix always was a bit strange..."
8668                         cont=''
8669                 fi
8670         elif $test -r /etc/systemid; then
8671                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8672         fi
8673 fi
8674 if $test "$cont"; then
8675         echo 'No, maybe "uuname -l" will work...'
8676         if tans=`sh -c 'uuname -l' 2>&1` ; then
8677                 myhostname=$tans
8678                 phostname='uuname -l'
8679         else
8680                 echo 'Strange.  Maybe "uname -n" will work...'
8681                 if tans=`sh -c 'uname -n' 2>&1` ; then
8682                         myhostname=$tans
8683                         phostname='uname -n'
8684                 else
8685                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8686                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8687                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8688                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8689                         else
8690                                 case "$myhostname" in
8691                                 '') echo "Does this machine have an identity crisis or something?"
8692                                         phostname='';;
8693                                 *)
8694                                         echo "Well, you said $myhostname before..."
8695                                         phostname='echo $myhostname';;
8696                                 esac
8697                         fi
8698                 fi
8699         fi
8700 fi
8701 case "$myhostname" in
8702 '') myhostname=noname ;;
8703 esac
8704 : you do not want to know about this
8705 set $myhostname
8706 myhostname=$1
8707
8708 : verify guess
8709 if $test "$myhostname" ; then
8710         dflt=y
8711         rp='Your host name appears to be "'$myhostname'".'" Right?"
8712         . ./myread
8713         case "$ans" in
8714         y*) ;;
8715         *) myhostname='';;
8716         esac
8717 fi
8718
8719 : bad guess or no guess
8720 while $test "X$myhostname" = X ; do
8721         dflt=''
8722         rp="Please type the (one word) name of your host:"
8723         . ./myread
8724         myhostname="$ans"
8725 done
8726
8727 : translate upper to lower if necessary
8728 case "$myhostname" in
8729 *[A-Z]*)
8730         echo "(Normalizing case in your host name)"
8731         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8732         ;;
8733 esac
8734
8735 case "$myhostname" in
8736 *.*)
8737         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8738         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8739         echo "(Trimming domain name from host name--host name is now $myhostname)"
8740         ;;
8741 *) case "$mydomain" in
8742         '')
8743                 {
8744                         test "X$hostcat" = "Xypcat hosts" &&
8745                         ypmatch "$myhostname" hosts 2>/dev/null |\
8746                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8747                         $test -s hosts
8748                 } || {
8749                         test "X$hostcat" != "X" &&
8750                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8751                                         /[       ]$myhostname[  . ]/p" > hosts
8752                 }
8753                 tmp_re="[       . ]"
8754                 if $test -f hosts; then
8755                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8756                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8757                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8758                                 hosts | $sort | $uniq | \
8759                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8760                         case `$echo X$dflt` in
8761                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8762                                 dflt=.
8763                                 ;;
8764                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8765                                 ;;
8766                         esac
8767                 else
8768                         echo "(I cannot locate a hosts database anywhere)"
8769                         dflt=.
8770                 fi
8771                 case "$dflt" in
8772                 .)
8773                         tans=`./loc resolv.conf X /etc /usr/etc`
8774                         if $test -f "$tans"; then
8775                                 echo "(Attempting domain name extraction from $tans)"
8776                                 dflt=.`$sed -n -e 's/   / /g' \
8777                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8778                                   -e 1q 2>/dev/null`
8779                                 case "$dflt" in
8780                                 .) dflt=.`$sed -n -e 's/        / /g' \
8781                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8782                                      -e 1q 2>/dev/null`
8783                                         ;;
8784                                 esac
8785                         fi
8786                         ;;
8787                 esac
8788                 case "$dflt" in
8789                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8790                         dflt=.`sh -c domainname 2>/dev/null`
8791                         case "$dflt" in
8792                         '') dflt='.';;
8793                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8794                         esac
8795                         ;;
8796                 esac
8797                 case "$dflt$osname" in
8798                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8799                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8800                         ;;
8801                 esac
8802                 case "$dflt" in
8803                 .) echo "(Lost all hope -- silly guess then)"
8804                         dflt='.nonet'
8805                         ;;
8806                 esac
8807                 $rm -f hosts
8808                 ;;
8809         *) dflt="$mydomain";;
8810         esac;;
8811 esac
8812 echo " "
8813 rp="What is your domain name?"
8814 . ./myread
8815 tans="$ans"
8816 case "$ans" in
8817 '') ;;
8818 .*) ;;
8819 *) tans=".$tans";;
8820 esac
8821 mydomain="$tans"
8822
8823 : translate upper to lower if necessary
8824 case "$mydomain" in
8825 *[A-Z]*)
8826         echo "(Normalizing case in your domain name)"
8827         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8828         ;;
8829 esac
8830
8831 : a little sanity check here
8832 case "$phostname" in
8833 '') ;;
8834 *)
8835         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8836         $myhostname$mydomain|$myhostname) ;;
8837         *)
8838                 case "$phostname" in
8839                 sed*)
8840                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8841                         ;;
8842                 *)
8843                         echo "(That doesn't agree with your $phostname command, by the way.)"
8844                         ;;
8845                 esac
8846         ;;
8847         esac
8848         ;;
8849 esac
8850
8851 : determine the e-mail address of the user who is running us
8852 $cat <<EOM
8853
8854 I need to get your e-mail address in Internet format if possible, i.e.
8855 something like user@host.domain. Please answer accurately since I have
8856 no easy means to double check it. The default value provided below
8857 is most probably close to reality but may not be valid from outside
8858 your organization...
8859
8860 EOM
8861 cont=x
8862 while test "$cont"; do
8863         case "$cf_email" in
8864         '') dflt="$cf_by@$myhostname$mydomain";;
8865         *) dflt="$cf_email";;
8866         esac
8867         rp='What is your e-mail address?'
8868         . ./myread
8869         cf_email="$ans"
8870         case "$cf_email" in
8871         *@*.*) cont='' ;;
8872         *)
8873                 rp='Address does not look like an Internet one.  Use it anyway?'
8874                 case "$fastread" in
8875                 yes) dflt=y ;;
8876                 *) dflt=n ;;
8877                 esac
8878                 . ./myread
8879                 case "$ans" in
8880                 y*) cont='' ;;
8881                 *) echo " " ;;
8882                 esac
8883                 ;;
8884         esac
8885 done
8886
8887 : Ask e-mail of administrator
8888 $cat <<EOM
8889
8890 If you or somebody else will be maintaining perl at your site, please
8891 fill in the correct e-mail address here so that they may be contacted
8892 if necessary. Currently, the "perlbug" program included with perl
8893 will send mail to this address in addition to perlbug@perl.org. You may
8894 enter "none" for no administrator.
8895
8896 EOM
8897 case "$perladmin" in
8898 '') dflt="$cf_email";;
8899 *) dflt="$perladmin";;
8900 esac
8901 rp='Perl administrator e-mail address'
8902 . ./myread
8903 perladmin="$ans"
8904
8905 : determine whether to only install version-specific parts.
8906 echo " "
8907 $cat <<EOM
8908 Do you want to install only the version-specific parts of the perl
8909 distribution?  Usually you do *not* want to do this.
8910 EOM
8911 case "$versiononly" in
8912 "$define"|[Yy]*|true) dflt='y' ;;
8913 *) dflt='n';
8914 esac
8915 rp="Do you want to install only the version-specific parts of perl?"
8916 . ./myread
8917 case "$ans" in
8918 [yY]*)  val="$define";;
8919 *)      val="$undef" ;;
8920 esac
8921 set versiononly
8922 eval $setvar
8923
8924 case "$versiononly" in
8925 "$define") inc_version_list=''
8926            inc_version_list_init=0
8927            ;;
8928 esac
8929
8930 : figure out how to guarantee perl startup
8931 : XXX Note that this currently takes advantage of the bug that binexp ignores
8932 :     the Configure -Dinstallprefix setting, which in turn means that under
8933 :     relocatable @INC, initialinstalllocation is what binexp started as.
8934 case "$startperl" in
8935 '')
8936         case "$sharpbang" in
8937         *!)
8938                 $cat <<EOH
8939
8940 I can use the #! construct to start perl on your system. This will
8941 make startup of perl scripts faster, but may cause problems if you
8942 want to share those scripts and perl is not in a standard place
8943 ($initialinstalllocation/perl) on all your platforms. The alternative
8944 is to force a shell by starting the script with a single ':' character.
8945
8946 EOH
8947                 case "$versiononly" in
8948                 "$define")      dflt="$initialinstalllocation/perl$version";;
8949                 *)              dflt="$initialinstalllocation/perl";;
8950                 esac
8951                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8952                 . ./myread
8953                 case "$ans" in
8954                 none)   startperl=": # use perl";;
8955                 *)      startperl="#!$ans"
8956                         if $test 30 -lt `echo "$ans" | wc -c`; then
8957                                 $cat >&4 <<EOM
8958
8959 WARNING:  Some systems limit the #! command to 32 characters.
8960 If you experience difficulty running Perl scripts with #!, try
8961 installing Perl in a directory with a shorter pathname.
8962
8963 EOM
8964                         fi ;;
8965                 esac
8966                 ;;
8967         *) startperl=": # use perl"
8968                 ;;
8969         esac
8970         ;;
8971 esac
8972 echo "I'll use $startperl to start perl scripts."
8973
8974 : figure best path for perl in scripts
8975 case "$perlpath" in
8976 '')
8977         case "$versiononly" in
8978         "$define")      perlpath="$initialinstalllocation/perl$version";;
8979         *)              perlpath="$initialinstalllocation/perl";;
8980         esac
8981         case "$startperl" in
8982         *!*) ;;
8983         *)
8984                 $cat <<EOH
8985
8986 I will use the "eval 'exec'" idiom to start Perl on your system.
8987 I can use the full path of your Perl binary for this purpose, but
8988 doing so may cause problems if you want to share those scripts and
8989 Perl is not always in a standard place ($initialinstalllocation/perl).
8990
8991 EOH
8992                 dflt="$initialinstalllocation/perl"
8993                 rp="What path shall I use in \"eval 'exec'\"?"
8994                 . ./myread
8995                 perlpath="$ans"
8996                 ;;
8997         esac
8998         ;;
8999 esac
9000 case "$startperl" in
9001 *!*)    ;;
9002 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9003 esac
9004
9005 : determine where public executable scripts go
9006 set scriptdir scriptdir
9007 eval $prefixit
9008 case "$scriptdir" in
9009 '')
9010         dflt="$bin"
9011         : guess some guesses
9012         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9013         $test -d /usr/share/bin     && dflt=/usr/share/bin
9014         $test -d /usr/local/script  && dflt=/usr/local/script
9015         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9016         $test -d $prefixexp/script  && dflt=$prefixexp/script
9017         set dflt
9018         eval $prefixup
9019         ;;
9020 *)  dflt="$scriptdir"
9021         ;;
9022 esac
9023 $cat <<EOM
9024
9025 Some installations have a separate directory just for executable scripts so
9026 that they can mount it across multiple architectures but keep the scripts in
9027 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9028 Or you might just lump your scripts in with all your other executables.
9029
9030 EOM
9031 fn=d~
9032 rp='Where do you keep publicly executable scripts?'
9033 . ./getfile
9034 if $test "X$ansexp" != "X$scriptdirexp"; then
9035         installscript=''
9036 fi
9037 installscriptdir=''
9038 prefixvar=scriptdir
9039 . ./setprefixvar
9040 : A little fix up for an irregularly named variable.
9041 installscript="$installscriptdir"
9042
9043 : determine where add-on public executables go
9044 case "$sitebin" in
9045 '')     dflt=$siteprefix/bin ;;
9046 *)      dflt=$sitebin ;;
9047 esac
9048 fn=d~
9049 rp='Pathname where the add-on public executables should be installed?'
9050 . ./getfile
9051 prefixvar=sitebin
9052 . ./setprefixvar
9053
9054 : determine where add-on html pages go
9055 : There is no standard location, so try to copy the previously-selected
9056 : directory structure for the core html pages.
9057 case "$sitehtml1dir" in
9058 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9059 *)     dflt=$sitehtml1dir ;;
9060 esac
9061 case "$dflt" in
9062 ''|' ') dflt=none ;;
9063 esac
9064 fn=dn+~
9065 rp='Pathname where the site-specific html pages should be installed?'
9066 . ./getfile
9067 prefixvar=sitehtml1dir
9068 . ./setprefixvar
9069
9070 : determine where add-on library html pages go
9071 : There is no standard location, so try to copy the previously-selected
9072 : directory structure for the core html pages.
9073 case "$sitehtml3dir" in
9074 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9075 *)     dflt=$sitehtml3dir ;;
9076 esac
9077 case "$dflt" in
9078 ''|' ') dflt=none ;;
9079 esac
9080 fn=dn+~
9081 rp='Pathname where the site-specific library html pages should be installed?'
9082 . ./getfile
9083 prefixvar=sitehtml3dir
9084 . ./setprefixvar
9085
9086 : determine where add-on manual pages go
9087 case "$siteman1dir" in
9088 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9089 *)      dflt=$siteman1dir ;;
9090 esac
9091 case "$dflt" in
9092 ''|' ') dflt=none ;;
9093 esac
9094 fn=dn+~
9095 rp='Pathname where the site-specific manual pages should be installed?'
9096 . ./getfile
9097 prefixvar=siteman1dir
9098 . ./setprefixvar
9099
9100 : determine where add-on library man pages go
9101 case "$siteman3dir" in
9102 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9103 *)      dflt=$siteman3dir ;;
9104 esac
9105 case "$dflt" in
9106 ''|' ') dflt=none ;;
9107 esac
9108 fn=dn+~
9109 rp='Pathname where the site-specific library manual pages should be installed?'
9110 . ./getfile
9111 prefixvar=siteman3dir
9112 . ./setprefixvar
9113
9114 : determine where add-on public executable scripts go
9115 case "$sitescript" in
9116 '')     dflt=$siteprefix/script
9117         $test -d $dflt || dflt=$sitebin ;;
9118 *)  dflt="$sitescript" ;;
9119 esac
9120 fn=d~+
9121 rp='Pathname where add-on public executable scripts should be installed?'
9122 . ./getfile
9123 prefixvar=sitescript
9124 . ./setprefixvar
9125
9126 : Check if faststdio is requested and available
9127 case "$usefaststdio" in
9128 $define|true|[yY]*|'')
9129         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9130         case "$xversion" in
9131         [68])   dflt='y' ;;
9132         *)      dflt='n' ;;
9133         esac
9134         ;;
9135 *) dflt='n';;
9136 esac
9137 cat <<EOM
9138
9139 Perl can be built to use 'fast stdio', which means using the stdio
9140 library but also directly manipulating the stdio buffers to enable
9141 faster I/O.  Using stdio is better for backward compatibility (especially
9142 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9143 interface has been preferred instead of stdio.
9144
9145 If this doesn't make any sense to you, just accept the default '$dflt'.
9146 EOM
9147 rp='Use the "fast stdio" if available?'
9148 . ./myread
9149 case "$ans" in
9150 y|Y)    val="$define" ;;
9151 *)      val="$undef" ;;
9152 esac
9153 set usefaststdio
9154 eval $setvar
9155
9156
9157 : define an is-a-typedef? function
9158 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9159 case "$inclist" in
9160 "") inclist="sys/types.h";;
9161 esac;
9162 eval "varval=\$$var";
9163 case "$varval" in
9164 "")
9165         $rm -f temp.c;
9166         for inc in $inclist; do
9167                 echo "#include <$inc>" >>temp.c;
9168         done;
9169         echo "#ifdef $type" >> temp.c;
9170         echo "printf(\"We have $type\");" >> temp.c;
9171         echo "#endif" >> temp.c;
9172         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9173         if $contains $type temp.E >/dev/null 2>&1; then
9174                 eval "$var=\$type";
9175         else
9176                 eval "$var=\$def";
9177         fi;
9178         $rm -f temp.?;;
9179 *) eval "$var=\$varval";;
9180 esac'
9181
9182 : define an is-a-typedef? function that prompts if the type is not available.
9183 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9184 case "$inclist" in
9185 "") inclist="sys/types.h";;
9186 esac;
9187 eval "varval=\$$var";
9188 case "$varval" in
9189 "")
9190         $rm -f temp.c;
9191         for inc in $inclist; do
9192                 echo "#include <$inc>" >>temp.c;
9193         done;
9194         echo "#ifdef $type" >> temp.c;
9195         echo "printf(\"We have $type\");" >> temp.c;
9196         echo "#endif" >> temp.c;
9197         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9198         echo " " ;
9199         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9200         if $contains $type temp.E >/dev/null 2>&1; then
9201                 echo "$type found." >&4;
9202                 eval "$var=\$type";
9203         else
9204                 echo "$type NOT found." >&4;
9205                 dflt="$def";
9206                 . ./myread ;
9207                 eval "$var=\$ans";
9208         fi;
9209         $rm -f temp.?;;
9210 *) eval "$var=\$varval";;
9211 esac'
9212
9213 : see what type lseek is declared as in the kernel
9214 rp="What is the type used for lseek's offset on this system?"
9215 set off_t lseektype long stdio.h sys/types.h
9216 eval $typedef_ask
9217
9218 echo " "
9219 echo "Checking to see how big your file offsets are..." >&4
9220 $cat >try.c <<EOCP
9221 #include <sys/types.h>
9222 #include <stdio.h>
9223 int main()
9224 {
9225     printf("%d\n", (int)sizeof($lseektype));
9226     return(0);
9227 }
9228 EOCP
9229 set try
9230 if eval $compile_ok; then
9231         lseeksize=`$run ./try`
9232         echo "Your file offsets are $lseeksize bytes long."
9233 else
9234         dflt=$longsize
9235         echo " "
9236         echo "(I can't seem to compile the test program.  Guessing...)"
9237         rp="What is the size of your file offsets (in bytes)?"
9238         . ./myread
9239         lseeksize="$ans"
9240 fi
9241 $rm_try
9242
9243 : see what type file positions are declared as in the library
9244 rp="What is the type for file position used by fsetpos()?"
9245 set fpos_t fpostype long stdio.h sys/types.h
9246 eval $typedef_ask
9247
9248 : Check size for Fpos_t
9249 echo " "
9250 case "$fpostype" in
9251 *_t) zzz="$fpostype"    ;;
9252 *)   zzz="fpos_t"       ;;
9253 esac
9254 echo "Checking the size of $zzz..." >&4
9255 cat > try.c <<EOCP
9256 #include <sys/types.h>
9257 #include <stdio.h>
9258 #$i_stdlib I_STDLIB
9259 #ifdef I_STDLIB
9260 #include <stdlib.h>
9261 #endif
9262 int main() {
9263     printf("%d\n", (int)sizeof($fpostype));
9264     exit(0);
9265 }
9266 EOCP
9267 set try
9268 if eval $compile_ok; then
9269         yyy=`$run ./try`
9270         case "$yyy" in
9271         '')     fpossize=4
9272                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9273                 ;;
9274         *)      fpossize=$yyy
9275                 echo "Your $zzz is $fpossize bytes long."
9276                 ;;
9277         esac
9278 else
9279         dflt="$longsize"
9280         echo " " >&4
9281         echo "(I can't compile the test program.  Guessing...)" >&4
9282         rp="What is the size of your file positions (in bytes)?"
9283         . ./myread
9284         fpossize="$ans"
9285 fi
9286
9287 : Check for large file support
9288 # Backward compatibility (uselfs is deprecated).
9289 case "$uselfs" in
9290 "$define"|true|[yY]*)
9291         cat <<EOM >&4
9292
9293 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9294 EOM
9295         uselargefiles="$define"
9296         ;;
9297 esac
9298
9299 case "$lseeksize:$fpossize" in
9300 8:8) cat <<EOM
9301
9302 You can have files larger than 2 gigabytes.
9303 EOM
9304    val="$define" ;;
9305 *)    case "$uselargefiles" in
9306    "$undef"|false|[nN]*) dflt='n' ;;
9307    *)   dflt='y' ;;
9308    esac
9309    cat <<EOM
9310
9311 Perl can be built to understand large files (files larger than 2 gigabytes)
9312 on some systems.  To do so, Configure can be run with -Duselargefiles.
9313
9314 If this doesn't make any sense to you, just accept the default '$dflt'.
9315 EOM
9316    rp='Try to understand large files, if available?'
9317    . ./myread
9318    case "$ans" in
9319    y|Y)         val="$define" ;;
9320    *)           val="$undef"  ;;
9321    esac
9322    ;;
9323 esac
9324 set uselargefiles
9325 eval $setvar
9326 : Look for a hint-file generated 'call-back-unit'.  If the
9327 : user has specified that a large files perl is to be built,
9328 : we may need to set or change some other defaults.
9329 if $test -f uselargefiles.cbu; then
9330         echo "Your platform has some specific hints regarding large file builds, using them..."
9331         . ./uselargefiles.cbu
9332 fi
9333 case "$uselargefiles" in
9334 "$define")
9335         if $test -f uselargefiles.cbu; then
9336                 echo " "
9337                 echo "Rechecking to see how big your file offsets are..." >&4
9338                 $cat >try.c <<EOCP
9339 #include <sys/types.h>
9340 #include <stdio.h>
9341 int main()
9342 {
9343     printf("%d\n", (int)sizeof($lseektype));
9344     return(0);
9345 }
9346 EOCP
9347                 set try
9348                 if eval $compile_ok; then
9349                         lseeksize=`$run ./try`
9350                         $echo "Your file offsets are now $lseeksize bytes long."
9351                 else
9352                         dflt="$lseeksize"
9353                         echo " "
9354                         echo "(I can't seem to compile the test program.  Guessing...)"
9355                         rp="What is the size of your file offsets (in bytes)?"
9356                         . ./myread
9357                         lseeksize="$ans"
9358                 fi
9359                 case "$fpostype" in
9360                 *_t) zzz="$fpostype"    ;;
9361                 *)   zzz="fpos_t"       ;;
9362                 esac
9363                 $echo $n "Rechecking the size of $zzz...$c" >&4
9364                 $cat > try.c <<EOCP
9365 #include <sys/types.h>
9366 #include <stdio.h>
9367 #$i_stdlib I_STDLIB
9368 #ifdef I_STDLIB
9369 #include <stdlib.h>
9370 #endif
9371 int main() {
9372     printf("%d\n", (int)sizeof($fpostype));
9373     return(0);
9374 }
9375 EOCP
9376                 set try
9377                 if eval $compile_ok; then
9378                         yyy=`$run ./try`
9379                         dflt="$lseeksize"
9380                         case "$yyy" in
9381                         '')     echo " "
9382                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9383                                 ;;
9384                         *)      fpossize=$yyy
9385                                 echo " $fpossize bytes." >&4
9386                                 ;;
9387                         esac
9388                 else
9389                         dflt="$fpossize"
9390                         echo " "
9391                         echo "(I can't compile the test program.  Guessing...)" >&4
9392                         rp="What is the size of your file positions (in bytes)?"
9393                         . ./myread
9394                         fpossize="$ans"
9395                 fi
9396                 $rm_try
9397         fi
9398         ;;
9399 esac
9400
9401 : Set the vendorbin variables
9402 case "$vendorprefix" in
9403 '')     d_vendorbin="$undef"
9404         vendorbin=''
9405         vendorbinexp=''
9406         ;;
9407 *)      d_vendorbin="$define"
9408         : determine where vendor-supplied executables go.
9409         case "$vendorbin" in
9410         '') dflt=$vendorprefix/bin ;;
9411         *)      dflt="$vendorbin" ;;
9412         esac
9413         fn=d~+
9414         rp='Pathname for the vendor-supplied executables directory?'
9415         . ./getfile
9416         vendorbin="$ans"
9417         vendorbinexp="$ansexp"
9418         ;;
9419 esac
9420 prefixvar=vendorbin
9421 . ./installprefix
9422
9423 : Set the vendorhtml1dir variables
9424 case "$vendorprefix" in
9425 '')     vendorhtml1dir=''
9426         vendorhtml1direxp=''
9427         ;;
9428 *)      : determine where vendor-supplied html pages go.
9429         : There is no standard location, so try to copy the previously-selected
9430         : directory structure for the core html pages.
9431         : XXX Better default suggestions would be welcome.
9432         case "$vendorhtml1dir" in
9433         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9434         *)      dflt=$vendorhtml1dir ;;
9435         esac
9436         case "$dflt" in
9437         ''|' ') dflt=none ;;
9438         esac
9439         fn=dn+~
9440         rp='Pathname for the vendor-supplied html pages?'
9441         . ./getfile
9442         vendorhtml1dir="$ans"
9443         vendorhtml1direxp="$ansexp"
9444         ;;
9445 esac
9446 : Use ' ' for none so value is preserved next time through Configure
9447 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9448 prefixvar=vendorhtml1dir
9449 . ./installprefix
9450
9451 : Set the vendorhtml3dir variables
9452 case "$vendorprefix" in
9453 '')     vendorhtml3dir=''
9454         vendorhtml3direxp=''
9455         ;;
9456 *)      : determine where vendor-supplied module html pages go.
9457         : There is no standard location, so try to copy the previously-selected
9458         : directory structure for the core html pages.
9459         : XXX Better default suggestions would be welcome.
9460         case "$vendorhtml3dir" in
9461         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9462         *)      dflt=$vendorhtml3dir ;;
9463         esac
9464         case "$dflt" in
9465         ''|' ') dflt=none ;;
9466         esac
9467         fn=dn+~
9468         rp='Pathname for the vendor-supplied html pages?'
9469         . ./getfile
9470         vendorhtml3dir="$ans"
9471         vendorhtml3direxp="$ansexp"
9472         ;;
9473 esac
9474 : Use ' ' for none so value is preserved next time through Configure
9475 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9476 prefixvar=vendorhtml3dir
9477 . ./installprefix
9478
9479 : Set the vendorman1dir variables
9480 case "$vendorprefix" in
9481 '')     vendorman1dir=''
9482         vendorman1direxp=''
9483         ;;
9484 *)      : determine where vendor-supplied manual pages go.
9485         case "$vendorman1dir" in
9486         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9487         *)      dflt=$vendorman1dir ;;
9488         esac
9489         case "$dflt" in
9490         ''|' ') dflt=none ;;
9491         esac
9492         fn=nd~+
9493         rp='Pathname for the vendor-supplied manual section 1 pages?'
9494         . ./getfile
9495         vendorman1dir="$ans"
9496         vendorman1direxp="$ansexp"
9497         ;;
9498 esac
9499 : Use ' ' for none so value is preserved next time through Configure
9500 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9501 prefixvar=vendorman1dir
9502 . ./installprefix
9503
9504 : Set the vendorman3dir variables
9505 case "$vendorprefix" in
9506 '')     vendorman3dir=''
9507         vendorman3direxp=''
9508         ;;
9509 *)      : determine where vendor-supplied module manual pages go.
9510         case "$vendorman3dir" in
9511         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9512         *)      dflt=$vendorman3dir ;;
9513         esac
9514         case "$dflt" in
9515         ''|' ') dflt=none ;;
9516         esac
9517         fn=nd~+
9518         rp='Pathname for the vendor-supplied manual section 3 pages?'
9519         . ./getfile
9520         vendorman3dir="$ans"
9521         vendorman3direxp="$ansexp"
9522         ;;
9523 esac
9524 : Use ' ' for none so value is preserved next time through Configure
9525 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9526 prefixvar=vendorman3dir
9527 . ./installprefix
9528
9529 : Set the vendorscript variables
9530 case "$vendorprefix" in
9531 '')     d_vendorscript="$undef"
9532         vendorscript=''
9533         vendorscriptexp=''
9534         ;;
9535 *)      d_vendorscript="$define"
9536         : determine where vendor-supplied scripts go.
9537         case "$vendorscript" in
9538         '')     dflt=$vendorprefix/script
9539                 $test -d $dflt || dflt=$vendorbin ;;
9540         *)  dflt="$vendorscript" ;;
9541         esac
9542         $cat <<EOM
9543
9544 The installation process will create a directory for
9545 vendor-supplied scripts.
9546
9547 EOM
9548         fn=d~+
9549         rp='Pathname for the vendor-supplied scripts directory?'
9550         . ./getfile
9551         vendorscript="$ans"
9552         vendorscriptexp="$ansexp"
9553         ;;
9554 esac
9555 prefixvar=vendorscript
9556 . ./installprefix
9557
9558 : script used to emit important warnings
9559 cat >warn <<EOS
9560 $startsh
9561 if test \$# -gt 0; then
9562         echo "\$@" >msg
9563 else
9564         cat >msg
9565 fi
9566 echo "*** WARNING:" >&4
9567 sed -e 's/^/*** /' <msg >&4
9568 echo "*** " >&4
9569 cat msg >>config.msg
9570 echo " " >>config.msg
9571 rm -f msg
9572 EOS
9573 chmod +x warn
9574 $eunicefix warn
9575
9576 : see which of string.h or strings.h is needed
9577 echo " "
9578 strings=`./findhdr string.h`
9579 if $test "$strings" && $test -r "$strings"; then
9580         echo "Using <string.h> instead of <strings.h>." >&4
9581         val="$define"
9582 else
9583         val="$undef"
9584         strings=`./findhdr strings.h`
9585         if $test "$strings" && $test -r "$strings"; then
9586                 echo "Using <strings.h> instead of <string.h>." >&4
9587         else
9588                 ./warn "No string header found -- You'll surely have problems."
9589         fi
9590 fi
9591 set i_string
9592 eval $setvar
9593 case "$i_string" in
9594 "$undef") strings=`./findhdr strings.h`;;
9595 *)        strings=`./findhdr string.h`;;
9596 esac
9597
9598 : see if qgcvt exists
9599 set qgcvt d_qgcvt
9600 eval $inlibc
9601
9602 : Check print/scan long double stuff
9603 echo " "
9604
9605 if $test X"$d_longdbl" = X"$define"; then
9606
9607 echo "Checking how to print long doubles..." >&4
9608
9609 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9610         $cat >try.c <<'EOCP'
9611 #include <sys/types.h>
9612 #include <stdio.h>
9613 int main() {
9614   double d = 123.456;
9615   printf("%.3f\n", d);
9616 }
9617 EOCP
9618         set try
9619         if eval $compile; then
9620                 yyy=`$run ./try`
9621                 case "$yyy" in
9622                 123.456)
9623                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9624                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9625                         echo "We will use %f."
9626                         ;;
9627                 esac
9628         fi
9629 fi
9630
9631 if $test X"$sPRIfldbl" = X; then
9632         $cat >try.c <<'EOCP'
9633 #include <sys/types.h>
9634 #include <stdio.h>
9635 int main() {
9636   long double d = 123.456;
9637   printf("%.3Lf\n", d);
9638 }
9639 EOCP
9640         set try
9641         if eval $compile; then
9642                 yyy=`$run ./try`
9643                 case "$yyy" in
9644                 123.456)
9645                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9646                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9647                         echo "We will use %Lf."
9648                         ;;
9649                 esac
9650         fi
9651 fi
9652
9653 if $test X"$sPRIfldbl" = X; then
9654         $cat >try.c <<'EOCP'
9655 #include <sys/types.h>
9656 #include <stdio.h>
9657 int main() {
9658   long double d = 123.456;
9659   printf("%.3llf\n", d);
9660 }
9661 EOCP
9662         set try
9663         if eval $compile; then
9664                 yyy=`$run ./try`
9665                 case "$yyy" in
9666                 123.456)
9667                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9668                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9669                         echo "We will use %llf."
9670                         ;;
9671                 esac
9672         fi
9673 fi
9674
9675 if $test X"$sPRIfldbl" = X; then
9676         $cat >try.c <<'EOCP'
9677 #include <sys/types.h>
9678 #include <stdio.h>
9679 int main() {
9680   long double d = 123.456;
9681   printf("%.3lf\n", d);
9682 }
9683 EOCP
9684         set try
9685         if eval $compile; then
9686                 yyy=`$run ./try`
9687                 case "$yyy" in
9688                 123.456)
9689                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9690                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9691                         echo "We will use %lf."
9692                         ;;
9693                 esac
9694         fi
9695 fi
9696
9697 if $test X"$sPRIfldbl" = X; then
9698         echo "Cannot figure out how to print long doubles." >&4
9699 else
9700         sSCNfldbl=$sPRIfldbl    # expect consistency
9701 fi
9702
9703 $rm_try
9704
9705 fi # d_longdbl
9706
9707 case "$sPRIfldbl" in
9708 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9709         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9710         d_SCNfldbl="$undef";
9711         ;;
9712 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9713         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9714         d_SCNfldbl="$define";
9715         ;;
9716 esac
9717
9718 : Check how to convert floats to strings.
9719
9720 if test "X$d_Gconvert" = X; then
9721
9722 echo " "
9723 echo "Checking for an efficient way to convert floats to strings."
9724 echo " " > try.c
9725 case "$uselongdouble" in
9726 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9727 esac
9728 case "$d_longdbl" in
9729 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9730 esac
9731 case "$d_PRIgldbl" in
9732 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9733 esac
9734 $cat >>try.c <<EOP
9735 #ifdef TRY_gconvert
9736 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9737 char *myname = "gconvert";
9738 #endif
9739 #ifdef TRY_gcvt
9740 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9741 char *myname = "gcvt";
9742 #endif
9743 #ifdef TRY_qgcvt
9744 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9745 char *myname = "qgcvt";
9746 #define DOUBLETYPE long double
9747 #endif
9748 #ifdef TRY_sprintf
9749 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9750 #ifdef HAS_PRIgldbl
9751 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9752 #else
9753 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9754 #endif
9755 #else
9756 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9757 #endif
9758 char *myname = "sprintf";
9759 #endif
9760
9761 #ifndef DOUBLETYPE
9762 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9763 #define DOUBLETYPE long double
9764 #else
9765 #define DOUBLETYPE double
9766 #endif
9767 #endif
9768
9769 #include <stdio.h>
9770
9771 #$i_stdlib I_STDLIB
9772 #ifdef I_STDLIB
9773 #include <stdlib.h>
9774 #endif
9775 #$i_string I_STRING
9776 #ifdef I_STRING
9777 #  include <string.h>
9778 #else
9779 #  include <strings.h>
9780 #endif
9781
9782 int checkit(char *expect, char *got)
9783 {
9784     if (strcmp(expect, got)) {
9785                 printf("%s oddity:  Expected %s, got %s\n",
9786                         myname, expect, got);
9787                 exit(1);
9788         }
9789 }
9790
9791 int main()
9792 {
9793         char buf[64];
9794         buf[63] = '\0';
9795
9796         /* This must be 1st test on (which?) platform */
9797         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9798         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9799         checkit("0.1", buf);
9800
9801         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9802         checkit("0.01", buf);
9803
9804         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9805         checkit("0.001", buf);
9806
9807         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9808         checkit("0.0001", buf);
9809
9810         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9811         if (strlen(buf) > 5)
9812             checkit("9e-005", buf); /* for Microsoft ?? */
9813         else
9814             checkit("9e-05", buf);
9815
9816         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9817         checkit("1", buf);
9818
9819         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9820         checkit("1.1", buf);
9821
9822         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9823         checkit("1.01", buf);
9824
9825         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9826         checkit("1.001", buf);
9827
9828         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9829         checkit("1.0001", buf);
9830
9831         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9832         checkit("1.00001", buf);
9833
9834         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9835         checkit("1.000001", buf);
9836
9837         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9838         checkit("0", buf);
9839
9840         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9841         checkit("-1", buf);
9842
9843         /* Some Linux gcvt's give 1.e+5 here. */
9844         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9845         checkit("100000", buf);
9846
9847         /* Some Linux gcvt's give -1.e+5 here. */
9848         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9849         checkit("-100000", buf);
9850
9851         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9852         checkit("123.456", buf);
9853
9854         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9855         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9856         /* 34 should be enough to scare even long double
9857          * places into using the e notation. */
9858         if (strlen(buf) > 5)
9859             checkit("1e+034", buf); /* for Microsoft */
9860         else
9861             checkit("1e+34", buf);
9862
9863         /* For Perl, if you add additional tests here, also add them to
9864          * t/base/num.t for benefit of platforms not using Configure or
9865          * overriding d_Gconvert */
9866
9867         exit(0);
9868 }
9869 EOP
9870 : first add preferred functions to our list
9871 xxx_list=""
9872 for xxx_convert in $gconvert_preference; do
9873     case $xxx_convert in
9874     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9875     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9876     esac
9877 done
9878 : then add any others
9879 for xxx_convert in gconvert gcvt sprintf; do
9880     case "$xxx_list" in
9881     *$xxx_convert*) ;;
9882     *) xxx_list="$xxx_list $xxx_convert" ;;
9883     esac
9884 done
9885
9886 case "$d_longdbl$uselongdouble" in
9887 "$define$define")
9888     : again, add prefered functions to our list first
9889     xxx_ld_list=""
9890     for xxx_convert in $gconvert_ld_preference; do
9891         case $xxx_convert in
9892         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9893         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9894         esac
9895     done
9896     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9897     for xxx_convert in qgcvt sprintf $xxx_list; do
9898         case "$xxx_ld_list" in
9899         $xxx_convert*|*" $xxx_convert"*) ;;
9900         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9901         esac
9902     done
9903     : if sprintf cannot do long doubles, move it to the end
9904     if test "$d_PRIgldbl" != "$define"; then
9905         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9906     fi
9907     : if no qgcvt, remove it
9908     if test "$d_qgcvt" != "$define"; then
9909         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9910     fi
9911     : use the ld_list
9912     xxx_list="$xxx_ld_list"
9913     ;;
9914 esac
9915
9916 for xxx_convert in $xxx_list; do
9917         echo "Trying $xxx_convert..."
9918         $rm -f try try$_o core
9919         set try -DTRY_$xxx_convert
9920         if eval $compile; then
9921                 echo "$xxx_convert() found." >&4
9922                 if $run ./try; then
9923                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9924                         break;
9925                 else
9926                         echo "...But $xxx_convert didn't work as I expected."
9927                         xxx_convert=''
9928                 fi
9929         else
9930                 echo "$xxx_convert NOT found." >&4
9931         fi
9932 done
9933
9934 if test X$xxx_convert = X; then
9935     echo "*** WHOA THERE!!! ***" >&4
9936     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9937     xxx_convert=sprintf
9938 fi
9939
9940 case "$xxx_convert" in
9941 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9942 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9943 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9944 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9945    "$define$define$define")
9946       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9947    "$define$define$undef")
9948       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9949    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9950    esac
9951    ;;
9952 esac
9953
9954 fi
9955 $rm_try
9956
9957 : see if _fwalk exists
9958 set fwalk d__fwalk
9959 eval $inlibc
9960
9961 : Initialize h_fcntl
9962 h_fcntl=false
9963
9964 : Initialize h_sysfile
9965 h_sysfile=false
9966
9967 : access call always available on UNIX
9968 set access d_access
9969 eval $inlibc
9970
9971 : locate the flags for 'access()'
9972 case "$d_access" in
9973 "$define")
9974         echo " "
9975         $cat >access.c <<EOCP
9976 #include <sys/types.h>
9977 #ifdef I_FCNTL
9978 #include <fcntl.h>
9979 #endif
9980 #ifdef I_SYS_FILE
9981 #include <sys/file.h>
9982 #endif
9983 #ifdef I_UNISTD
9984 #include <unistd.h>
9985 #endif
9986 #$i_stdlib I_STDLIB
9987 #ifdef I_STDLIB
9988 #include <stdlib.h>
9989 #endif
9990 int main() {
9991         exit(R_OK);
9992 }
9993 EOCP
9994         : check sys/file.h first, no particular reason here
9995         if $test `./findhdr sys/file.h` && \
9996                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9997                 h_sysfile=true;
9998                 echo "<sys/file.h> defines the *_OK access constants." >&4
9999         elif $test `./findhdr fcntl.h` && \
10000                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10001                 h_fcntl=true;
10002                 echo "<fcntl.h> defines the *_OK access constants." >&4
10003         elif $test `./findhdr unistd.h` && \
10004                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10005                 echo "<unistd.h> defines the *_OK access constants." >&4
10006         else
10007                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10008         fi
10009         ;;
10010 esac
10011 $rm -f access*
10012
10013 : see if accessx exists
10014 set accessx d_accessx
10015 eval $inlibc
10016
10017 : see if aintl exists
10018 set aintl d_aintl
10019 eval $inlibc
10020
10021 : see if alarm exists
10022 set alarm d_alarm
10023 eval $inlibc
10024
10025 : see if 64bit time functions exists
10026
10027 set ctime64 d_ctime64
10028 eval $inlibc
10029
10030 set localtime64 d_localtime64
10031 eval $inlibc
10032
10033 set gmtime64 d_gmtime64
10034 eval $inlibc
10035
10036 set mktime64 d_mktime64
10037 eval $inlibc
10038
10039 set difftime64 d_difftime64
10040 eval $inlibc
10041
10042 set asctime64 d_asctime64
10043 eval $inlibc
10044
10045 : see if POSIX threads are available
10046 set pthread.h i_pthread
10047 eval $inhdr
10048
10049 : define a fucntion to check prototypes
10050 $cat > protochk <<EOSH
10051 $startsh
10052 cc="$cc"
10053 optimize="$optimize"
10054 ccflags="$ccflags"
10055 prototype="$prototype"
10056 define="$define"
10057 rm_try="$rm_try"
10058 usethreads=$usethreads
10059 i_pthread=$i_pthread
10060 pthread_h_first=$pthread_h_first
10061 EOSH
10062
10063 $cat >> protochk <<'EOSH'
10064
10065 $rm_try
10066 foo="$1"
10067 shift
10068 while test $# -ge 2; do
10069         case "$1" in
10070                 $define) echo "#include <$2>" >> try.c ;;
10071                 literal) echo "$2" >> try.c ;;
10072         esac
10073     # Extra magic for the benefit of systems that need pthread.h
10074     # to be included early to correctly detect threadsafe functions.
10075     # Such functions must guarantee themselves, though, that the usethreads
10076     # and i_pthread have been defined, before calling protochk.
10077     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10078         echo "#include <pthread.h>" >> try.c
10079         pthread_h_done=yes
10080     fi
10081     shift 2
10082 done
10083 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10084 cat >> try.c <<'EOCP'
10085 #ifdef CAN_PROTOTYPE
10086 #define _(args) args
10087 #else
10088 #define _(args) ()
10089 #endif
10090 EOCP
10091 echo "$foo" >> try.c
10092 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10093 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10094 status=$?
10095 $rm_try
10096 exit $status
10097 EOSH
10098 chmod +x protochk
10099 $eunicefix protochk
10100
10101 : Define hasproto macro for Configure internal use
10102 hasproto='varname=$1; func=$2; shift; shift;
10103 while $test $# -ge 2; do
10104         case "$1" in
10105         $define) echo "#include <$2>";;
10106         esac ;
10107     shift 2;
10108 done > try.c;
10109 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10110 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10111         echo "$func() prototype found.";
10112         val="$define";
10113 else
10114         echo "$func() prototype NOT found.";
10115         val="$undef";
10116 fi;
10117 set $varname;
10118 eval $setvar;
10119 $rm_try tryout.c'
10120
10121 : see if sys/types.h has to be included
10122 set sys/types.h i_systypes
10123 eval $inhdr
10124
10125 : see if sys/select.h has to be included
10126 set sys/select.h i_sysselct
10127 eval $inhdr
10128
10129 : Define hasfield macro for Configure internal use
10130 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10131 while $test $# -ge 2; do
10132         case "$1" in
10133         $define) echo "#include <$2>";;
10134         esac ;
10135     shift 2;
10136 done > try.c;
10137 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10138 set try;
10139 if eval $compile; then
10140         val="$define";
10141 else
10142         val="$undef";
10143 fi;
10144 set $varname;
10145 eval $setvar;
10146 $rm_try'
10147
10148 : see if we should include time.h, sys/time.h, or both
10149 echo " "
10150 if test "X$timeincl" = X; then
10151         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10152         $echo $n "I'm now running the test program...$c"
10153         $cat >try.c <<EOCP
10154 #include <sys/types.h>
10155 #ifdef I_TIME
10156 #include <time.h>
10157 #endif
10158 #ifdef I_SYSTIME
10159 #ifdef SYSTIMEKERNEL
10160 #define KERNEL
10161 #endif
10162 #include <sys/time.h>
10163 #endif
10164 #ifdef I_SYSSELECT
10165 #include <sys/select.h>
10166 #endif
10167 #$i_stdlib I_STDLIB
10168 #ifdef I_STDLIB
10169 #include <stdlib.h>
10170 #endif
10171 int main()
10172 {
10173         struct tm foo;
10174 #ifdef S_TIMEVAL
10175         struct timeval bar;
10176 #endif
10177 #ifdef S_TIMEZONE
10178         struct timezone tzp;
10179 #endif
10180         if (foo.tm_sec == foo.tm_sec)
10181                 exit(0);
10182 #ifdef S_TIMEVAL
10183         if (bar.tv_sec == bar.tv_sec)
10184                 exit(0);
10185 #endif
10186         exit(1);
10187 }
10188 EOCP
10189         flags=''
10190         for s_timezone in '-DS_TIMEZONE' ''; do
10191         sysselect=''
10192         for s_timeval in '-DS_TIMEVAL' ''; do
10193         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10194         for i_time in '' '-DI_TIME'; do
10195         for i_systime in '-DI_SYSTIME' ''; do
10196                 case "$flags" in
10197                 '') $echo $n ".$c"
10198                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10199                         if eval $compile; then
10200                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10201                                 shift
10202                                 flags="$*"
10203                                 echo " "
10204                                 $echo $n "Succeeded with $flags$c"
10205                         fi
10206                         ;;
10207                 esac
10208         done
10209         done
10210         done
10211         done
10212         done
10213         timeincl=''
10214         echo " "
10215         case "$flags" in
10216         *SYSTIMEKERNEL*) i_systimek="$define"
10217                 timeincl=`./findhdr sys/time.h`
10218                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10219         *) i_systimek="$undef";;
10220         esac
10221         case "$flags" in
10222         *I_TIME*) i_time="$define"
10223                 timeincl=`./findhdr time.h`" $timeincl"
10224                 echo "We'll include <time.h>." >&4;;
10225         *) i_time="$undef";;
10226         esac
10227         case "$flags" in
10228         *I_SYSTIME*) i_systime="$define"
10229                 timeincl=`./findhdr sys/time.h`" $timeincl"
10230                 echo "We'll include <sys/time.h>." >&4;;
10231         *) i_systime="$undef";;
10232         esac
10233         $rm_try
10234 fi
10235 : see if struct tm knows about tm_zone
10236 case "$i_systime$i_time" in
10237 *$define*)
10238         echo " "
10239         echo "Checking to see if your struct tm has tm_zone field..." >&4
10240         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10241         eval $hasfield
10242         ;;
10243 *)      val="$undef"
10244         set d_tm_tm_zone
10245         eval $setvar
10246         ;;
10247 esac
10248 case "$d_tm_tm_zone" in
10249 "$define")      echo "Yes, it does."   ;;
10250 *)              echo "No, it doesn't." ;;
10251 esac
10252 : see if struct tm knows about tm_gmtoff
10253 case "$i_systime$i_time" in
10254 *$define*)
10255         echo " "
10256         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10257         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10258         eval $hasfield
10259         ;;
10260 *)      val="$undef"
10261         set d_tm_tm_gmtoff
10262         eval $setvar
10263         ;;
10264 esac
10265 case "$d_tm_tm_gmtoff" in
10266 "$define")      echo "Yes, it does."   ;;
10267 *)              echo "No, it doesn't." ;;
10268 esac
10269
10270 : see if asctime_r exists
10271 set asctime_r d_asctime_r
10272 eval $inlibc
10273 case "$d_asctime_r" in
10274 "$define")
10275         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10276         case "$d_asctime_r_proto:$usethreads" in
10277         ":define")      d_asctime_r_proto=define
10278                 set d_asctime_r_proto asctime_r $hdrs
10279                 eval $hasproto ;;
10280         *)      ;;
10281         esac
10282         case "$d_asctime_r_proto" in
10283         define)
10284         case "$asctime_r_proto" in
10285         ''|0) try='char* asctime_r(const struct tm*, char*);'
10286         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10287         esac
10288         case "$asctime_r_proto" in
10289         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10290         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10291         esac
10292         case "$asctime_r_proto" in
10293         ''|0) try='int asctime_r(const struct tm*, char*);'
10294         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10295         esac
10296         case "$asctime_r_proto" in
10297         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10298         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10299         esac
10300         case "$asctime_r_proto" in
10301         ''|0)   d_asctime_r=undef
10302                 asctime_r_proto=0
10303                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10304         * )     case "$asctime_r_proto" in
10305                 REENTRANT_PROTO*) ;;
10306                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10307                 esac
10308                 echo "Prototype: $try" ;;
10309         esac
10310         ;;
10311         *)      case "$usethreads" in
10312                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10313                 esac
10314                 d_asctime_r=undef
10315                 asctime_r_proto=0
10316                 ;;
10317         esac
10318         ;;
10319 *)      asctime_r_proto=0
10320         ;;
10321 esac
10322
10323 : see if atolf exists
10324 set atolf d_atolf
10325 eval $inlibc
10326
10327 : see if atoll exists
10328 set atoll d_atoll
10329 eval $inlibc
10330
10331 : Look for GCC-style attribute format
10332 case "$d_attribute_format" in
10333 '')
10334 echo " "
10335 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10336 $cat >attrib.c <<'EOCP'
10337 #include <stdio.h>
10338 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10339 EOCP
10340 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10341         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10342                 echo "Your C compiler doesn't support __attribute__((format))."
10343                 val="$undef"
10344         else
10345                 echo "Your C compiler supports __attribute__((format))."
10346                 val="$define"
10347         fi
10348 else
10349         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10350         val="$undef"
10351 fi
10352 ;;
10353 *) val="$d_attribute_format" ;;
10354 esac
10355 set d_attribute_format
10356 eval $setvar
10357 $rm -f attrib*
10358
10359 : Look for GCC-style attribute format with null format allowed
10360 case "$d_printf_format_null" in
10361 '') case "$d_attribute_format" in
10362     $define)
10363         echo " "
10364         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10365 $cat >attrib.c <<EOCP
10366 #include <stdio.h>
10367 #$i_stdlib I_STDLIB
10368 #ifdef I_STDLIB
10369 #include <stdlib.h>
10370 #endif
10371 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10372 int null_printf (char* pat,...) { return (int)pat; }
10373 int main () { exit(null_printf(NULL)); }
10374 EOCP
10375         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10376             : run the executable in case it produces a run-time warning
10377             if $run ./attrib >>attrib.out 2>&1; then
10378                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10379                     echo "Your C compiler doesn't allow __printf__ format to be null."
10380                     val="$undef"
10381                 else
10382                     echo "Your C compiler allows __printf__ format to be null."
10383                     val="$define"
10384                 fi
10385             else
10386             echo "Your C compiler executable failed with __printf__ format null."
10387             val="$undef"
10388         fi
10389     else
10390         echo "Your C compiler fails with __printf__ format null."
10391         val="$undef"
10392     fi
10393     ;;
10394     *)  val="$undef" ;;
10395     esac
10396 ;;
10397 *)  val="$d_printf_format_null" ;;
10398 esac
10399 set d_printf_format_null
10400 eval $setvar
10401 $rm -f attrib*
10402
10403 : Look for GCC-style attribute malloc
10404 case "$d_attribute_malloc" in
10405 '')
10406 echo " "
10407 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10408 $cat >attrib.c <<'EOCP'
10409 #include <stdio.h>
10410 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10411 EOCP
10412 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10413         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10414                 echo "Your C compiler doesn't support __attribute__((malloc))."
10415                 val="$undef"
10416         else
10417                 echo "Your C compiler supports __attribute__((malloc))."
10418                 val="$define"
10419         fi
10420 else
10421         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10422         val="$undef"
10423 fi
10424 ;;
10425 *) val="$d_attribute_malloc" ;;
10426 esac
10427 set d_attribute_malloc
10428 eval $setvar
10429 $rm -f attrib*
10430
10431 : Look for GCC-style attribute nonnull
10432 case "$d_attribute_nonnull" in
10433 '')
10434 echo " "
10435 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10436 $cat >attrib.c <<'EOCP'
10437 #include <stdio.h>
10438 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10439 EOCP
10440 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10441         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10442                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10443                 val="$undef"
10444         else
10445                 echo "Your C compiler supports __attribute__((nonnull))."
10446                 val="$define"
10447         fi
10448 else
10449         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10450         val="$undef"
10451 fi
10452 ;;
10453 *) val="$d_attribute_nonnull" ;;
10454 esac
10455 set d_attribute_nonnull
10456 eval $setvar
10457 $rm -f attrib*
10458
10459 : Look for GCC-style attribute noreturn
10460 case "$d_attribute_noreturn" in
10461 '')
10462 echo " "
10463 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10464 $cat >attrib.c <<'EOCP'
10465 #include <stdio.h>
10466 void fall_over_dead( void ) __attribute__((noreturn));
10467 EOCP
10468 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10469         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10470                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10471                 val="$undef"
10472         else
10473                 echo "Your C compiler supports __attribute__((noreturn))."
10474                 val="$define"
10475         fi
10476 else
10477         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10478         val="$undef"
10479 fi
10480 ;;
10481 *) val="$d_attribute_noreturn" ;;
10482 esac
10483 set d_attribute_noreturn
10484 eval $setvar
10485 $rm -f attrib*
10486
10487 : Look for GCC-style attribute pure
10488 case "$d_attribute_pure" in
10489 '')
10490 echo " "
10491 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10492 $cat >attrib.c <<'EOCP'
10493 #include <stdio.h>
10494 int square( int n ) __attribute__((pure));
10495 EOCP
10496 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10497         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10498                 echo "Your C compiler doesn't support __attribute__((pure))."
10499                 val="$undef"
10500         else
10501                 echo "Your C compiler supports __attribute__((pure))."
10502                 val="$define"
10503         fi
10504 else
10505         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10506         val="$undef"
10507 fi
10508 ;;
10509 *) val="$d_attribute_pure" ;;
10510 esac
10511 set d_attribute_pure
10512 eval $setvar
10513 $rm -f attrib*
10514
10515 : Look for GCC-style attribute unused
10516 case "$d_attribute_unused" in
10517 '')
10518 echo " "
10519 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10520 $cat >attrib.c <<'EOCP'
10521 #include <stdio.h>
10522 int do_something( int dummy __attribute__((unused)), int n );
10523 EOCP
10524 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10525         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10526                 echo "Your C compiler doesn't support __attribute__((unused))."
10527                 val="$undef"
10528         else
10529                 echo "Your C compiler supports __attribute__((unused))."
10530                 val="$define"
10531         fi
10532 else
10533         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10534         val="$undef"
10535 fi
10536 ;;
10537 *) val="$d_attribute_unused" ;;
10538 esac
10539 set d_attribute_unused
10540 eval $setvar
10541 $rm -f attrib*
10542
10543 : Look for GCC-style attribute deprecated
10544 case "$d_attribute_deprecated" in
10545 '')
10546 echo " "
10547 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10548 $cat >attrib.c <<'EOCP'
10549 #include <stdio.h>
10550 int I_am_deprecated(void) __attribute__((deprecated));
10551 EOCP
10552 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10553         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10554                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10555                 val="$undef"
10556         else
10557                 echo "Your C compiler supports __attribute__((deprecated))."
10558                 val="$define"
10559         fi
10560 else
10561         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10562         val="$undef"
10563 fi
10564 ;;
10565 *) val="$d_attribute_deprecated" ;;
10566 esac
10567 set d_attribute_deprecated
10568 eval $setvar
10569 $rm -f attrib*
10570
10571 : Look for GCC-style attribute warn_unused_result
10572 case "$d_attribute_warn_unused_result" in
10573 '')
10574 echo " "
10575 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10576 $cat >attrib.c <<'EOCP'
10577 #include <stdio.h>
10578 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10579 EOCP
10580 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10581         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10582                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10583                 val="$undef"
10584         else
10585                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10586                 val="$define"
10587         fi
10588 else
10589         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10590         val="$undef"
10591 fi
10592 ;;
10593 *) val="$d_attribute_warn_unused_result" ;;
10594 esac
10595 set d_attribute_warn_unused_result
10596 eval $setvar
10597 $rm -f attrib*
10598
10599 : see if bcmp exists
10600 set bcmp d_bcmp
10601 eval $inlibc
10602
10603 : see if bcopy exists
10604 set bcopy d_bcopy
10605 eval $inlibc
10606
10607 : see if getpgrp exists
10608 set getpgrp d_getpgrp
10609 eval $inlibc
10610
10611 case "$d_getpgrp" in
10612 "$define")
10613         echo " "
10614         echo "Checking to see which flavor of getpgrp is in use..."
10615         $cat >try.c <<EOP
10616 #$i_unistd I_UNISTD
10617 #include <sys/types.h>
10618 #ifdef I_UNISTD
10619 #  include <unistd.h>
10620 #endif
10621 #$i_stdlib I_STDLIB
10622 #ifdef I_STDLIB
10623 #include <stdlib.h>
10624 #endif
10625 int main()
10626 {
10627         if (getuid() == 0) {
10628                 printf("(I see you are running Configure as super-user...)\n");
10629                 setuid(1);
10630         }
10631 #ifdef TRY_BSD_PGRP
10632         if (getpgrp(1) == 0)
10633                 exit(0);
10634 #else
10635         if (getpgrp() > 0)
10636                 exit(0);
10637 #endif
10638         exit(1);
10639 }
10640 EOP
10641         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10642                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10643                 val="$define"
10644         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10645                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10646                 val="$undef"
10647         else
10648                 echo "I can't seem to compile and run the test program."
10649                 if ./usg; then
10650                         xxx="a USG one, i.e. you use getpgrp()."
10651                 else
10652                         # SVR4 systems can appear rather BSD-ish.
10653                         case "$i_unistd" in
10654                         $undef)
10655                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10656                                 val="$define"
10657                                 ;;
10658                         $define)
10659                                 xxx="probably a USG one, i.e. you use getpgrp()."
10660                                 val="$undef"
10661                                 ;;
10662                         esac
10663                 fi
10664                 echo "Assuming your getpgrp is $xxx" >&4
10665         fi
10666         ;;
10667 *) val="$undef";;
10668 esac
10669 set d_bsdgetpgrp
10670 eval $setvar
10671 $rm_try
10672
10673 : see if setpgrp exists
10674 set setpgrp d_setpgrp
10675 eval $inlibc
10676
10677 case "$d_setpgrp" in
10678 "$define")
10679         echo " "
10680         echo "Checking to see which flavor of setpgrp is in use..."
10681         $cat >try.c <<EOP
10682 #$i_unistd I_UNISTD
10683 #include <sys/types.h>
10684 #ifdef I_UNISTD
10685 #  include <unistd.h>
10686 #endif
10687 #$i_stdlib I_STDLIB
10688 #ifdef I_STDLIB
10689 #include <stdlib.h>
10690 #endif
10691 int main()
10692 {
10693         if (getuid() == 0) {
10694                 printf("(I see you are running Configure as super-user...)\n");
10695                 setuid(1);
10696         }
10697 #ifdef TRY_BSD_PGRP
10698         if (-1 == setpgrp(1, 1))
10699                 exit(0);
10700 #else
10701         if (setpgrp() != -1)
10702                 exit(0);
10703 #endif
10704         exit(1);
10705 }
10706 EOP
10707         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10708                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10709                 val="$define"
10710         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10711                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10712                 val="$undef"
10713         else
10714                 echo "(I can't seem to compile and run the test program.)"
10715                 if ./usg; then
10716                         xxx="a USG one, i.e. you use setpgrp()."
10717                 else
10718                         # SVR4 systems can appear rather BSD-ish.
10719                         case "$i_unistd" in
10720                         $undef)
10721                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10722                                 val="$define"
10723                                 ;;
10724                         $define)
10725                                 xxx="probably a USG one, i.e. you use setpgrp()."
10726                                 val="$undef"
10727                                 ;;
10728                         esac
10729                 fi
10730                 echo "Assuming your setpgrp is $xxx" >&4
10731         fi
10732         ;;
10733 *) val="$undef";;
10734 esac
10735 set d_bsdsetpgrp
10736 eval $setvar
10737 $rm_try
10738
10739 : Look for GCC-style __builtin_choose_expr
10740 case "$d_builtin_choose_expr" in
10741 '')
10742     echo " "
10743     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10744     $cat >try.c <<'EOCP'
10745 #include <assert.h>
10746 #include <stdlib.h>
10747 #include <stdio.h>
10748
10749 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10750
10751 int main(void) {
10752     assert( SYRINX(1) == 2112 );
10753     assert( SYRINX(1) != 5150 );
10754     assert( SYRINX(0) == 5150 );
10755     assert( SYRINX(0) != 2112 );
10756     puts( "All good!" );
10757     exit(0);
10758 }
10759
10760 EOCP
10761     set try
10762     if eval $compile && $run ./try; then
10763         echo "Your C compiler supports __builtin_choose_expr."
10764         val="$define"
10765     else
10766         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10767         val="$undef"
10768     fi
10769 ;;
10770 *) val="$d_builtin_choose_expr" ;;
10771 esac
10772
10773 set d_builtin_choose_expr
10774 eval $setvar
10775 $rm_try
10776
10777 : Look for GCC-style __builtin_expect
10778 case "$d_builtin_expect" in
10779 '')
10780     echo " "
10781     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10782     $cat >try.c <<'EOCP'
10783 int main(void) {
10784     int n = 50;
10785     if ( __builtin_expect(n, 0) ) n = 1;
10786     /* Remember shell exit code truth is 0, C truth is non-zero */
10787     return !(n == 1);
10788 }
10789 EOCP
10790     set try
10791     if eval $compile && $run ./try; then
10792         echo "Your C compiler supports __builtin_expect."
10793         val="$define"
10794     else
10795         echo "Your C compiler doesn't seem to understand __builtin_expect."
10796         val="$undef"
10797     fi
10798     ;;
10799 *) val="$d_builtin_expect" ;;
10800 esac
10801
10802 set d_builtin_expect
10803 eval $setvar
10804 $rm_try
10805
10806 : see if bzero exists
10807 set bzero d_bzero
10808 eval $inlibc
10809
10810 : see if stdarg is available
10811 echo " "
10812 if $test `./findhdr stdarg.h`; then
10813         echo "<stdarg.h> found." >&4
10814         valstd="$define"
10815 else
10816         echo "<stdarg.h> NOT found." >&4
10817         valstd="$undef"
10818 fi
10819
10820 : see if varags is available
10821 echo " "
10822 if $test `./findhdr varargs.h`; then
10823         echo "<varargs.h> found." >&4
10824 else
10825         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10826 fi
10827
10828 : set up the varargs testing programs
10829 $cat > varargs.c <<EOP
10830 #ifdef I_STDARG
10831 #include <stdarg.h>
10832 #endif
10833 #ifdef I_VARARGS
10834 #include <varargs.h>
10835 #endif
10836
10837 #ifdef I_STDARG
10838 int f(char *p, ...)
10839 #else
10840 int f(va_alist)
10841 va_dcl
10842 #endif
10843 {
10844         va_list ap;
10845 #ifndef I_STDARG
10846         char *p;
10847 #endif
10848 #ifdef I_STDARG
10849         va_start(ap,p);
10850 #else
10851         va_start(ap);
10852         p = va_arg(ap, char *);
10853 #endif
10854         va_end(ap);
10855         return 0;
10856 }
10857 EOP
10858 $cat > varargs <<EOP
10859 $startsh
10860 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10861         echo "true"
10862 else
10863         echo "false"
10864 fi
10865 $rm -f varargs$_o
10866 EOP
10867 chmod +x varargs
10868
10869 : now check which varargs header should be included
10870 echo " "
10871 i_varhdr=''
10872 case "$valstd" in
10873 "$define")
10874         if `./varargs I_STDARG`; then
10875                 val='stdarg.h'
10876         elif `./varargs I_VARARGS`; then
10877                 val='varargs.h'
10878         fi
10879         ;;
10880 *)
10881         if `./varargs I_VARARGS`; then
10882                 val='varargs.h'
10883         fi
10884         ;;
10885 esac
10886 case "$val" in
10887 '')
10888 echo "I could not find the definition for va_dcl... You have problems..." >&4
10889         val="$undef"; set i_stdarg; eval $setvar
10890         val="$undef"; set i_varargs; eval $setvar
10891         ;;
10892 *)
10893         set i_varhdr
10894         eval $setvar
10895         case "$i_varhdr" in
10896         stdarg.h)
10897                 val="$define"; set i_stdarg; eval $setvar
10898                 val="$undef"; set i_varargs; eval $setvar
10899                 ;;
10900         varargs.h)
10901                 val="$undef"; set i_stdarg; eval $setvar
10902                 val="$define"; set i_varargs; eval $setvar
10903                 ;;
10904         esac
10905         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10906 esac
10907 $rm -f varargs*
10908
10909 : see if the Compiler supports C99 variadic macros
10910 case "$i_stdarg$i_stdlib" in
10911     "$define$define")
10912     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10913     $cat >try.c <<EOCP
10914 #include <stdio.h>
10915 #include <stdarg.h>
10916
10917 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10918
10919 int main() {
10920   char buf[20];
10921   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10922   puts(buf);
10923   return 0;
10924 }
10925 EOCP
10926     set try
10927     if eval $compile && $run ./try 2>&1 >/dev/null; then
10928         case "`$run ./try`" in
10929             "123 456 789")
10930             echo "You have C99 variadic macros." >&4
10931             d_c99_variadic_macros="$define"
10932             ;;
10933             *)
10934             echo "You don't have functional C99 variadic macros." >&4
10935             d_c99_variadic_macros="$undef"
10936             ;;
10937         esac
10938     else
10939         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10940         d_c99_variadic_macros="$undef"
10941     fi
10942     $rm_try
10943     ;;
10944     *)
10945     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10946     d_c99_variadic_macros="$undef"
10947     ;;
10948 esac
10949
10950 : see if signal is declared as pointer to function returning int or void
10951 echo " "
10952 xxx=`./findhdr signal.h`
10953 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10954 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10955         echo "You have int (*signal())() instead of void." >&4
10956         val="$undef"
10957 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10958         echo "You have void (*signal())()." >&4
10959         val="$define"
10960 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10961         echo "You have int (*signal())() instead of void." >&4
10962         val="$undef"
10963 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10964         echo "You have void (*signal())()." >&4
10965         val="$define"
10966 else
10967         case "$d_voidsig" in
10968         '')
10969         echo "I can't determine whether signal handler returns void or int..." >&4
10970                 dflt=void
10971                 rp="What type does your signal handler return?"
10972                 . ./myread
10973                 case "$ans" in
10974                 v*) val="$define";;
10975                 *) val="$undef";;
10976                 esac;;
10977         "$define")
10978                 echo "As you already told me, signal handler returns void." >&4
10979                 val="$define"
10980                 ;;
10981         *)      echo "As you already told me, signal handler returns int." >&4
10982                 val="$undef"
10983                 ;;
10984         esac
10985 fi
10986 set d_voidsig
10987 eval $setvar
10988 case "$d_voidsig" in
10989 "$define") signal_t="void";;
10990 *) signal_t="int";;
10991 esac
10992 $rm -f $$.tmp
10993
10994 : check for ability to cast large floats to 32-bit ints.
10995 echo " "
10996 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10997 if $test "$intsize" -ge 4; then
10998         xxx=int
10999 else
11000         xxx=long
11001 fi
11002 $cat >try.c <<EOCP
11003 #include <stdio.h>
11004 #$i_stdlib I_STDLIB
11005 #ifdef I_STDLIB
11006 #include <stdlib.h>
11007 #endif
11008 #include <sys/types.h>
11009 #include <signal.h>
11010 $signal_t blech(int s) { exit(3); }
11011 int main()
11012 {
11013         $xxx i32;
11014         double f, g;
11015         int result = 0;
11016         char str[16];
11017         signal(SIGFPE, blech);
11018
11019         /* Don't let compiler optimize the test away.  Store the number
11020            in a writable string for gcc to pass to sscanf under HP-UX.
11021         */
11022         sprintf(str, "2147483647");
11023         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11024         g = 10 * f;
11025         i32  = ($xxx) g;
11026
11027         /* x86 processors will probably give 0x8000 0000, which is a
11028            sign change.  We don't want that.  We want to mimic SPARC
11029            behavior here, which is to preserve the sign and give
11030            back 0x7fff ffff.
11031         */
11032         if (i32 != ($xxx) f)
11033                 result |= 1;
11034         exit(result);
11035 }
11036 EOCP
11037 set try
11038 if eval $compile_ok; then
11039         $run ./try
11040         yyy=$?
11041 else
11042         echo "(I can't seem to compile the test program--assuming it can't)"
11043         yyy=1
11044 fi
11045 case "$yyy" in
11046 0)      val="$define"
11047         echo "Yup, it can."
11048         ;;
11049 *)      val="$undef"
11050         echo "Nope, it can't."
11051         ;;
11052 esac
11053 set d_casti32
11054 eval $setvar
11055 $rm_try
11056
11057 : check for ability to cast negative floats to unsigned
11058 echo " "
11059 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11060 $cat >try.c <<EOCP
11061 #include <stdio.h>
11062 #$i_stdlib I_STDLIB
11063 #ifdef I_STDLIB
11064 #include <stdlib.h>
11065 #endif
11066 #include <sys/types.h>
11067 #include <signal.h>
11068 $signal_t blech(int s) { exit(7); }
11069 $signal_t blech_in_list(int s) { exit(4); }
11070 unsigned long dummy_long(unsigned long p) { return p; }
11071 unsigned int dummy_int(unsigned int p) { return p; }
11072 unsigned short dummy_short(unsigned short p) { return p; }
11073 int main()
11074 {
11075         double f;
11076         unsigned long along;
11077         unsigned int aint;
11078         unsigned short ashort;
11079         int result = 0;
11080         char str[16];
11081
11082         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11083            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11084            optimized the whole file away
11085         */
11086         /* Store the number in a writable string for gcc to pass to
11087            sscanf under HP-UX.
11088         */
11089         sprintf(str, "-123");
11090         sscanf(str, "%lf", &f);  /* f = -123.; */
11091
11092         signal(SIGFPE, blech);
11093         along = (unsigned long)f;
11094         aint = (unsigned int)f;
11095         ashort = (unsigned short)f;
11096         if (along != (unsigned long)-123)
11097                 result |= 1;
11098         if (aint != (unsigned int)-123)
11099                 result |= 1;
11100         if (ashort != (unsigned short)-123)
11101                 result |= 1;
11102         sprintf(str, "1073741824.");
11103         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11104         f = f + f;
11105         along = 0;
11106         along = (unsigned long)f;
11107         if (along != 0x80000000)
11108                 result |= 2;
11109         f -= 1.;
11110         along = 0;
11111         along = (unsigned long)f;
11112         if (along != 0x7fffffff)
11113                 result |= 1;
11114         f += 2.;
11115         along = 0;
11116         along = (unsigned long)f;
11117         if (along != 0x80000001)
11118                 result |= 2;
11119         if (result)
11120                 exit(result);
11121         signal(SIGFPE, blech_in_list);
11122         sprintf(str, "123.");
11123         sscanf(str, "%lf", &f);  /* f = 123.; */
11124         along = dummy_long((unsigned long)f);
11125         aint = dummy_int((unsigned int)f);
11126         ashort = dummy_short((unsigned short)f);
11127         if (along != (unsigned long)123)
11128                 result |= 4;
11129         if (aint != (unsigned int)123)
11130                 result |= 4;
11131         if (ashort != (unsigned short)123)
11132                 result |= 4;
11133         exit(result);
11134
11135 }
11136 EOCP
11137 set try
11138 if eval $compile_ok; then
11139         $run ./try
11140         castflags=$?
11141 else
11142         echo "(I can't seem to compile the test program--assuming it can't)"
11143         castflags=7
11144 fi
11145 case "$castflags" in
11146 0)      val="$define"
11147         echo "Yup, it can."
11148         ;;
11149 *)      val="$undef"
11150         echo "Nope, it can't."
11151         ;;
11152 esac
11153 set d_castneg
11154 eval $setvar
11155 $rm_try
11156
11157 : see if vprintf exists
11158 echo " "
11159 if set vprintf val -f d_vprintf; eval $csym; $val; then
11160         echo 'vprintf() found.' >&4
11161         val="$define"
11162         $cat >try.c <<EOF
11163 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11164 #$i_varargs I_VARARGS
11165
11166 #$i_stdlib I_STDLIB
11167 #$i_unistd I_UNISTD
11168
11169 #ifdef I_STDARG
11170 #  include <stdarg.h>
11171 #else /* I_VARARGS */
11172 #  include <varargs.h>
11173 #endif
11174
11175 #ifdef I_UNISTD
11176 #  include <unistd.h>
11177 #endif
11178
11179 #ifdef I_STDLIB
11180 #  include <stdlib.h>
11181 #endif
11182
11183 #include <stdio.h> /* vsprintf prototype */
11184
11185 #ifdef I_STDARG
11186 void xxx(int n, ...)
11187 {
11188     va_list args;
11189     char buf[10];
11190     va_start(args, n);
11191     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11192 }
11193 int main() { xxx(1, "foo"); }
11194
11195 #else /* I_VARARGS */
11196
11197 xxx(va_alist)
11198 va_dcl
11199 {
11200     va_list args;
11201     char buf[10];
11202     va_start(args);
11203     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11204 }
11205 int main() { xxx("foo"); }
11206
11207 #endif
11208
11209 EOF
11210         set try
11211         if eval $compile_ok; then
11212                 if $run ./try; then
11213                         echo "Your vsprintf() returns (int)." >&4
11214                         val2="$undef"
11215                 else
11216                         echo "Your vsprintf() returns (char*)." >&4
11217                         val2="$define"
11218                 fi
11219         else
11220                 echo 'I am unable to compile the vsprintf() test program.' >&4
11221                 # We shouldn't get here.  If we do, assume the standard signature,
11222                 # not the old BSD one.
11223                 echo 'Guessing that vsprintf() returns (int).' >&4
11224                 val2="$undef"
11225         fi
11226 else
11227         echo 'vprintf() NOT found.' >&4
11228         val="$undef"
11229         val2="$undef"
11230 fi
11231 $rm_try
11232 set d_vprintf
11233 eval $setvar
11234 val=$val2
11235 set d_charvspr
11236 eval $setvar
11237
11238 : see if chown exists
11239 set chown d_chown
11240 eval $inlibc
11241
11242 : see if chroot exists
11243 set chroot d_chroot
11244 eval $inlibc
11245
11246 : see if chsize exists
11247 set chsize d_chsize
11248 eval $inlibc
11249
11250 : see if class exists
11251 set class d_class
11252 eval $inlibc
11253
11254 : see if clearenv exists
11255 set clearenv d_clearenv
11256 eval $inlibc
11257
11258 : Define hasstruct macro for Configure internal use
11259 hasstruct='varname=$1; struct=$2; shift; shift;
11260 while $test $# -ge 2; do
11261         case "$1" in
11262         $define) echo "#include <$2>";;
11263         esac ;
11264     shift 2;
11265 done > try.c;
11266 echo "int main () { struct $struct foo; }" >> try.c;
11267 set try;
11268 if eval $compile; then
11269         val="$define";
11270 else
11271         val="$undef";
11272 fi;
11273 set $varname;
11274 eval $setvar;
11275 $rm_try'
11276
11277 : see whether socket exists
11278 socketlib=''
11279 sockethdr=''
11280 echo " "
11281 $echo $n "Hmm... $c" >&4
11282 if set socket val -f d_socket; eval $csym; $val; then
11283         echo "Looks like you have Berkeley networking support." >&4
11284         d_socket="$define"
11285         if set setsockopt val -f; eval $csym; $val; then
11286                 d_oldsock="$undef"
11287         else
11288                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11289                 d_oldsock="$define"
11290         fi
11291 else
11292         if $contains socklib libc.list >/dev/null 2>&1; then
11293                 echo "Looks like you have Berkeley networking support." >&4
11294                 d_socket="$define"
11295                 : we will have to assume that it supports the 4.2 BSD interface
11296                 d_oldsock="$undef"
11297         else
11298                 echo "You don't have Berkeley networking in libc$_a..." >&4
11299                 if test "X$d_socket" = "X$define"; then
11300                    echo "...but you seem to believe that you have sockets." >&4
11301                 else
11302                         for net in net socket
11303                         do
11304                                 if test -f /usr/lib/lib$net$_a; then
11305                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11306                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11307                                         if $contains socket libc.list >/dev/null 2>&1; then
11308                                                 d_socket="$define"
11309                                                 socketlib="-l$net"
11310                                                 case "$net" in
11311                                                 net)
11312                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11313                                                         sockethdr="-I/usr/netinclude"
11314                                                         ;;
11315                                                 esac
11316                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11317                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11318                                                         d_oldsock="$undef"
11319                                                 else
11320                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11321                                                         d_oldsock="$define"
11322                                                 fi
11323                                                 break
11324                                         fi
11325                                 fi
11326                         done
11327                         if test "X$d_socket" != "X$define"; then
11328                            echo "or anywhere else I see." >&4
11329                            d_socket="$undef"
11330                            d_oldsock="$undef"
11331                         fi
11332                 fi
11333         fi
11334 fi
11335
11336 : see if socketpair exists
11337 set socketpair d_sockpair
11338 eval $inlibc
11339
11340
11341 echo " "
11342 echo "Checking the availability of certain socket constants..." >&4
11343 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11344         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11345         $cat >try.c <<EOF
11346 #include <sys/types.h>
11347 #include <sys/socket.h>
11348 int main() {
11349     int i = $ENUM;
11350 }
11351 EOF
11352         val="$undef"
11353         set try; if eval $compile; then
11354                 val="$define"
11355         fi
11356         set d_${enum}; eval $setvar
11357         $rm_try
11358 done
11359
11360 : see if this is a sys/uio.h system
11361 set sys/uio.h i_sysuio
11362 eval $inhdr
11363
11364 : Check for cmsghdr support
11365 echo " "
11366 echo "Checking to see if your system supports struct cmsghdr..." >&4
11367 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11368 eval $hasstruct
11369 case "$d_cmsghdr_s" in
11370 "$define")      echo "Yes, it does."   ;;
11371 *)              echo "No, it doesn't." ;;
11372 esac
11373
11374
11375 : check for const keyword
11376 echo " "
11377 echo 'Checking to see if your C compiler knows about "const"...' >&4
11378 $cat >const.c <<'EOCP'
11379 typedef struct spug { int drokk; } spug;
11380 int main()
11381 {
11382         const char *foo;
11383         const spug y = { 0 };
11384 }
11385 EOCP
11386 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11387         val="$define"
11388         echo "Yup, it does."
11389 else
11390         val="$undef"
11391         echo "Nope, it doesn't."
11392 fi
11393 set d_const
11394 eval $setvar
11395
11396 : see if copysignl exists
11397 set copysignl d_copysignl
11398 eval $inlibc
11399
11400 : see if crypt exists
11401 echo " "
11402 set crypt d_crypt
11403 eval $inlibc
11404 case "$d_crypt" in
11405 $define) cryptlib='' ;;
11406 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11407                 echo 'crypt() found.' >&4
11408                 val="$define"
11409                 cryptlib=''
11410         else
11411                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11412                 if $test -z "$cryptlib"; then
11413                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11414                 else
11415                         cryptlib=-lcrypt
11416                 fi
11417                 if $test -z "$cryptlib"; then
11418                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11419                 else
11420                         cryptlib=-lcrypt
11421                 fi
11422                 if $test -z "$cryptlib"; then
11423                         cryptlib=`./loc libcrypt$_a "" $libpth`
11424                 else
11425                         cryptlib=-lcrypt
11426                 fi
11427                 if $test -z "$cryptlib"; then
11428                         echo 'crypt() NOT found.' >&4
11429                         val="$undef"
11430                 else
11431                         val="$define"
11432                 fi
11433         fi
11434         set d_crypt
11435         eval $setvar
11436         ;;
11437 esac
11438
11439 : see if this is a crypt.h system
11440 set crypt.h i_crypt
11441 eval $inhdr
11442
11443 : see if crypt_r exists
11444 set crypt_r d_crypt_r
11445 eval $inlibc
11446 case "$d_crypt_r" in
11447 "$define")
11448         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11449         case "$d_crypt_r_proto:$usethreads" in
11450         ":define")      d_crypt_r_proto=define
11451                 set d_crypt_r_proto crypt_r $hdrs
11452                 eval $hasproto ;;
11453         *)      ;;
11454         esac
11455         case "$d_crypt_r_proto" in
11456         define)
11457         case "$crypt_r_proto" in
11458         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11459         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11460         esac
11461         case "$crypt_r_proto" in
11462         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11463         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11464         esac
11465         case "$crypt_r_proto" in
11466         ''|0)   d_crypt_r=undef
11467                 crypt_r_proto=0
11468                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11469         * )     case "$crypt_r_proto" in
11470                 REENTRANT_PROTO*) ;;
11471                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11472                 esac
11473                 echo "Prototype: $try" ;;
11474         esac
11475         ;;
11476         *)      case "$usethreads" in
11477                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11478                 esac
11479                 d_crypt_r=undef
11480                 crypt_r_proto=0
11481                 ;;
11482         esac
11483         ;;
11484 *)      crypt_r_proto=0
11485         ;;
11486 esac
11487
11488 : get csh whereabouts
11489 case "$csh" in
11490 'csh') val="$undef" ;;
11491 *) val="$define" ;;
11492 esac
11493 set d_csh
11494 eval $setvar
11495 : Respect a hint or command line value for full_csh.
11496 case "$full_csh" in
11497 '') full_csh=$csh ;;
11498 esac
11499
11500 : see if ctermid exists
11501 set ctermid d_ctermid
11502 eval $inlibc
11503
11504 : see if ctermid_r exists
11505 set ctermid_r d_ctermid_r
11506 eval $inlibc
11507 case "$d_ctermid_r" in
11508 "$define")
11509         hdrs="$i_systypes sys/types.h define stdio.h "
11510         case "$d_ctermid_r_proto:$usethreads" in
11511         ":define")      d_ctermid_r_proto=define
11512                 set d_ctermid_r_proto ctermid_r $hdrs
11513                 eval $hasproto ;;
11514         *)      ;;
11515         esac
11516         case "$d_ctermid_r_proto" in
11517         define)
11518         case "$ctermid_r_proto" in
11519         ''|0) try='char* ctermid_r(char*);'
11520         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11521         esac
11522         case "$ctermid_r_proto" in
11523         ''|0)   d_ctermid_r=undef
11524                 ctermid_r_proto=0
11525                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11526         * )     case "$ctermid_r_proto" in
11527                 REENTRANT_PROTO*) ;;
11528                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11529                 esac
11530                 echo "Prototype: $try" ;;
11531         esac
11532         ;;
11533         *)      case "$usethreads" in
11534                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11535                 esac
11536                 d_ctermid_r=undef
11537                 ctermid_r_proto=0
11538                 ;;
11539         esac
11540         ;;
11541 *)      ctermid_r_proto=0
11542         ;;
11543 esac
11544
11545 : see if ctime_r exists
11546 set ctime_r d_ctime_r
11547 eval $inlibc
11548 case "$d_ctime_r" in
11549 "$define")
11550         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11551         case "$d_ctime_r_proto:$usethreads" in
11552         ":define")      d_ctime_r_proto=define
11553                 set d_ctime_r_proto ctime_r $hdrs
11554                 eval $hasproto ;;
11555         *)      ;;
11556         esac
11557         case "$d_ctime_r_proto" in
11558         define)
11559         case "$ctime_r_proto" in
11560         ''|0) try='char* ctime_r(const time_t*, char*);'
11561         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11562         esac
11563         case "$ctime_r_proto" in
11564         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11565         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11566         esac
11567         case "$ctime_r_proto" in
11568         ''|0) try='int ctime_r(const time_t*, char*);'
11569         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11570         esac
11571         case "$ctime_r_proto" in
11572         ''|0) try='int ctime_r(const time_t*, char*, int);'
11573         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11574         esac
11575         case "$ctime_r_proto" in
11576         ''|0)   d_ctime_r=undef
11577                 ctime_r_proto=0
11578                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11579         * )     case "$ctime_r_proto" in
11580                 REENTRANT_PROTO*) ;;
11581                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11582                 esac
11583                 echo "Prototype: $try" ;;
11584         esac
11585         ;;
11586         *)      case "$usethreads" in
11587                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11588                 esac
11589                 d_ctime_r=undef
11590                 ctime_r_proto=0
11591                 ;;
11592         esac
11593         ;;
11594 *)      ctime_r_proto=0
11595         ;;
11596 esac
11597
11598 : see if cuserid exists
11599 set cuserid d_cuserid
11600 eval $inlibc
11601
11602 : see if this is a limits.h system
11603 set limits.h i_limits
11604 eval $inhdr
11605
11606 : see if this is a float.h system
11607 set float.h i_float
11608 eval $inhdr
11609
11610 : See if number of significant digits in a double precision number is known
11611 echo " "
11612 $cat >dbl_dig.c <<EOM
11613 #$i_limits I_LIMITS
11614 #$i_float I_FLOAT
11615 #ifdef I_LIMITS
11616 #include <limits.h>
11617 #endif
11618 #ifdef I_FLOAT
11619 #include <float.h>
11620 #endif
11621 #ifdef DBL_DIG
11622 printf("Contains DBL_DIG");
11623 #endif
11624 EOM
11625 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11626 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11627         echo "DBL_DIG found." >&4
11628         val="$define"
11629 else
11630         echo "DBL_DIG NOT found." >&4
11631         val="$undef"
11632 fi
11633 $rm -f dbl_dig.?
11634 set d_dbl_dig
11635 eval $setvar
11636
11637 : see if dbm.h is available
11638 : see if dbmclose exists
11639 set dbmclose d_dbmclose
11640 eval $inlibc
11641
11642 case "$d_dbmclose" in
11643 $define)
11644         set dbm.h i_dbm
11645         eval $inhdr
11646         case "$i_dbm" in
11647         $define)
11648                 val="$undef"
11649                 set i_rpcsvcdbm
11650                 eval $setvar
11651                 ;;
11652         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11653                 eval $inhdr
11654                 ;;
11655         esac
11656         ;;
11657 *)      echo "We won't be including <dbm.h>"
11658         val="$undef"
11659         set i_dbm
11660         eval $setvar
11661         val="$undef"
11662         set i_rpcsvcdbm
11663         eval $setvar
11664         ;;
11665 esac
11666
11667 : see if prototype for dbminit is available
11668 echo " "
11669 set d_dbminitproto dbminit $i_dbm dbm.h
11670 eval $hasproto
11671
11672 : see if difftime exists
11673 set difftime d_difftime
11674 eval $inlibc
11675
11676 : see if this is a dirent system
11677 echo " "
11678 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11679         val="$define"
11680         echo "<dirent.h> found." >&4
11681 else
11682         val="$undef"
11683         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11684                 echo "<sys/dir.h> found." >&4
11685                 echo " "
11686         else
11687                 xinc=`./findhdr sys/ndir.h`
11688         fi
11689         echo "<dirent.h> NOT found." >&4
11690 fi
11691 set i_dirent
11692 eval $setvar
11693
11694 : Look for type of directory structure.
11695 echo " "
11696 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11697
11698 case "$direntrytype" in
11699 ''|' ')
11700         case "$i_dirent" in
11701         $define) guess1='struct dirent' ;;
11702         *) guess1='struct direct'  ;;
11703         esac
11704         ;;
11705 *)      guess1="$direntrytype"
11706         ;;
11707 esac
11708
11709 case "$guess1" in
11710 'struct dirent') guess2='struct direct' ;;
11711 *) guess2='struct dirent' ;;
11712 esac
11713
11714 if $contains "$guess1" try.c >/dev/null 2>&1; then
11715         direntrytype="$guess1"
11716         echo "Your directory entries are $direntrytype." >&4
11717 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11718         direntrytype="$guess2"
11719         echo "Your directory entries seem to be $direntrytype." >&4
11720 else
11721         echo "I don't recognize your system's directory entries." >&4
11722         rp="What type is used for directory entries on this system?"
11723         dflt="$guess1"
11724         . ./myread
11725         direntrytype="$ans"
11726 fi
11727 $rm_try
11728
11729 : see if the directory entry stores field length
11730 echo " "
11731 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11732 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11733         echo "Good, your directory entry keeps length information in d_namlen." >&4
11734         val="$define"
11735 else
11736         echo "Your directory entry does not know about the d_namlen field." >&4
11737         val="$undef"
11738 fi
11739 set d_dirnamlen
11740 eval $setvar
11741 $rm_try
11742
11743 : Look for DIR.dd_fd
11744 case "$i_dirent" in
11745 "$define")
11746     echo "Checking to see if DIR has a dd_fd member variable" >&4
11747     $cat >try.c <<EOCP
11748 #$i_stdlib I_STDLIB
11749 #ifdef I_STDLIB
11750 #include <stdlib.h>
11751 #endif
11752 #include <dirent.h>
11753
11754 int main() {
11755     DIR dir;
11756     dir.dd_fd = 1;
11757     return 0;
11758 }
11759 EOCP
11760     val=$undef
11761     set try
11762     if eval $compile; then
11763         echo "Yes, it does."
11764         val="$define"
11765     else
11766         echo "No, it does not."
11767         val="$undef"
11768     fi
11769     ;;
11770 *)
11771     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11772     val="$undef"
11773     ;;
11774 esac
11775 set d_dir_dd_fd
11776 eval $setvar
11777 $rm_try
11778
11779 : see if this is an sysdir system
11780 set sys/dir.h i_sysdir
11781 eval $inhdr
11782
11783 : see if this is an sysndir system
11784 set sys/ndir.h i_sysndir
11785 eval $inhdr
11786
11787 : Look for dirfd
11788 echo " "
11789 $cat >dirfd.c <<EOM
11790 #include <stdio.h>
11791 #$i_stdlib I_STDLIB
11792 #ifdef I_STDLIB
11793 #include <stdlib.h>
11794 #endif
11795 #$i_dirent I_DIRENT             /**/
11796 #$i_sysdir I_SYS_DIR            /**/
11797 #$i_sysndir I_SYS_NDIR          /**/
11798 #$i_systypes I_SYS_TYPES        /**/
11799 #if defined(I_SYS_TYPES)
11800 #include <sys/types.h>
11801 #endif
11802 #if defined(I_DIRENT)
11803 #include <dirent.h>
11804 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11805 #include <sys/dir.h>
11806 #endif
11807 #else
11808 #ifdef I_SYS_NDIR
11809 #include <sys/ndir.h>
11810 #else
11811 #ifdef I_SYS_DIR
11812 #ifdef hp9000s500
11813 #include <ndir.h>       /* may be wrong in the future */
11814 #else
11815 #include <sys/dir.h>
11816 #endif
11817 #endif
11818 #endif
11819 #endif 
11820 int main() {
11821         DIR *dirp = opendir(".");
11822         if (dirfd(dirp) >= 0)
11823                 exit(0);
11824         else
11825                 exit(1);
11826 }
11827 EOM
11828 val=$undef
11829 set dirfd
11830 if eval $compile; then
11831         val="$define"
11832 fi
11833 case "$val" in
11834 $define)        echo "dirfd() found." >&4       ;;
11835 *)              echo "dirfd() NOT found." >&4   ;;
11836 esac
11837 set d_dirfd
11838 eval $setvar
11839 $rm -f dirfd*
11840
11841 : see if dlerror exists
11842 xxx_runnm="$runnm"
11843 runnm=false
11844 set dlerror d_dlerror
11845 eval $inlibc
11846 runnm="$xxx_runnm"
11847
11848 : see if dlfcn is available
11849 set dlfcn.h i_dlfcn
11850 eval $inhdr
11851
11852 : Check what extension to use for shared libs
11853 case "$usedl" in
11854 $define|y|true)
11855         $cat << EOM
11856
11857 On a few systems, the dynamically loaded modules that perl generates and uses
11858 will need a different extension than shared libs. The default will probably
11859 be appropriate.
11860
11861 EOM
11862         case "$dlext" in
11863         '')     dflt="$so" ;;
11864         *)      dflt="$dlext" ;;
11865         esac
11866         rp='What is the extension of dynamically loaded modules'
11867         . ./myread
11868         dlext="$ans"
11869         ;;
11870 *)
11871         dlext="none"
11872         ;;
11873 esac
11874
11875 : Check if dlsym need a leading underscore
11876 echo " "
11877 val="$undef"
11878
11879 case "$dlsrc" in
11880 dl_dlopen.xs)
11881         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11882         $cat >dyna.c <<'EOM'
11883 fred () { }
11884 EOM
11885
11886 $cat >fred.c<<EOM
11887
11888 #include <stdio.h>
11889 #$i_stdlib I_STDLIB
11890 #ifdef I_STDLIB
11891 #include <stdlib.h>
11892 #endif
11893 #$i_dlfcn I_DLFCN
11894 #ifdef I_DLFCN
11895 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11896 #else
11897 #include <sys/types.h>
11898 #include <nlist.h>
11899 #include <link.h>
11900 #endif
11901
11902 extern int fred() ;
11903
11904 int main()
11905 {
11906     void * handle ;
11907     void * symbol ;
11908 #ifndef RTLD_LAZY
11909     int mode = 1 ;
11910 #else
11911     int mode = RTLD_LAZY ;
11912 #endif
11913     handle = dlopen("./dyna.$dlext", mode) ;
11914     if (handle == NULL) {
11915         printf ("1\n") ;
11916         fflush (stdout) ;
11917         exit(0);
11918     }
11919     symbol = dlsym(handle, "fred") ;
11920     if (symbol == NULL) {
11921         /* try putting a leading underscore */
11922         symbol = dlsym(handle, "_fred") ;
11923         if (symbol == NULL) {
11924             printf ("2\n") ;
11925             fflush (stdout) ;
11926             exit(0);
11927         }
11928         printf ("3\n") ;
11929     }
11930     else
11931         printf ("4\n") ;
11932     fflush (stdout) ;
11933     exit(0);
11934 }
11935 EOM
11936         : Call the object file tmp-dyna.o in case dlext=o.
11937         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11938                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11939                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11940                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11941                 xxx=`$run ./fred`
11942                 case $xxx in
11943                 1)      echo "Test program failed using dlopen." >&4
11944                         echo "Perhaps you should not use dynamic loading." >&4;;
11945                 2)      echo "Test program failed using dlsym." >&4
11946                         echo "Perhaps you should not use dynamic loading." >&4;;
11947                 3)      echo "dlsym needs a leading underscore" >&4
11948                         val="$define" ;;
11949                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11950                 esac
11951         else
11952                 echo "I can't compile and run the test program." >&4
11953                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11954         fi
11955         ;;
11956 esac
11957
11958 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11959
11960 set d_dlsymun
11961 eval $setvar
11962
11963 : see if drand48_r exists
11964 set drand48_r d_drand48_r
11965 eval $inlibc
11966 case "$d_drand48_r" in
11967 "$define")
11968         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11969         case "$d_drand48_r_proto:$usethreads" in
11970         ":define")      d_drand48_r_proto=define
11971                 set d_drand48_r_proto drand48_r $hdrs
11972                 eval $hasproto ;;
11973         *)      ;;
11974         esac
11975         case "$d_drand48_r_proto" in
11976         define)
11977         case "$drand48_r_proto" in
11978         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11979         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11980         esac
11981         case "$drand48_r_proto" in
11982         ''|0)   d_drand48_r=undef
11983                 drand48_r_proto=0
11984                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11985         * )     case "$drand48_r_proto" in
11986                 REENTRANT_PROTO*) ;;
11987                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11988                 esac
11989                 echo "Prototype: $try" ;;
11990         esac
11991         ;;
11992         *)      case "$usethreads" in
11993                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11994                 esac
11995                 d_drand48_r=undef
11996                 drand48_r_proto=0
11997                 ;;
11998         esac
11999         ;;
12000 *)      drand48_r_proto=0
12001         ;;
12002 esac
12003
12004 : see if prototype for drand48 is available
12005 echo " "
12006 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12007 eval $hasproto
12008
12009 : see if dup2 exists
12010 set dup2 d_dup2
12011 eval $inlibc
12012
12013 : see if eaccess exists
12014 set eaccess d_eaccess
12015 eval $inlibc
12016
12017 : see if endgrent exists
12018 set endgrent d_endgrent
12019 eval $inlibc
12020
12021 : see if this is an grp system
12022 set grp.h i_grp
12023 eval $inhdr
12024
12025 case "$i_grp" in
12026 $define)
12027         xxx=`./findhdr grp.h`
12028         $cppstdin $cppflags $cppminus < $xxx >$$.h
12029
12030         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12031                 val="$define"
12032         else
12033                 val="$undef"
12034         fi
12035         set d_grpasswd
12036         eval $setvar
12037
12038         $rm -f $$.h
12039         ;;
12040 *)
12041         val="$undef";
12042         set d_grpasswd; eval $setvar
12043         ;;
12044 esac
12045
12046 : see if endgrent_r exists
12047 set endgrent_r d_endgrent_r
12048 eval $inlibc
12049 case "$d_endgrent_r" in
12050 "$define")
12051         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12052         case "$d_endgrent_r_proto:$usethreads" in
12053         ":define")      d_endgrent_r_proto=define
12054                 set d_endgrent_r_proto endgrent_r $hdrs
12055                 eval $hasproto ;;
12056         *)      ;;
12057         esac
12058         case "$d_endgrent_r_proto" in
12059         define)
12060         case "$endgrent_r_proto" in
12061         ''|0) try='int endgrent_r(FILE**);'
12062         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12063         esac
12064         case "$endgrent_r_proto" in
12065         ''|0) try='void endgrent_r(FILE**);'
12066         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12067         esac
12068         case "$endgrent_r_proto" in
12069         ''|0)   d_endgrent_r=undef
12070                 endgrent_r_proto=0
12071                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12072         * )     case "$endgrent_r_proto" in
12073                 REENTRANT_PROTO*) ;;
12074                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12075                 esac
12076                 echo "Prototype: $try" ;;
12077         esac
12078         ;;
12079         *)      case "$usethreads" in
12080                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12081                 esac
12082                 d_endgrent_r=undef
12083                 endgrent_r_proto=0
12084                 ;;
12085         esac
12086         ;;
12087 *)      endgrent_r_proto=0
12088         ;;
12089 esac
12090
12091 : see if endhostent exists
12092 set endhostent d_endhent
12093 eval $inlibc
12094
12095 : see if this is a netdb.h system
12096 set netdb.h i_netdb
12097 eval $inhdr
12098
12099 : see if endhostent_r exists
12100 set endhostent_r d_endhostent_r
12101 eval $inlibc
12102 case "$d_endhostent_r" in
12103 "$define")
12104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12105         case "$d_endhostent_r_proto:$usethreads" in
12106         ":define")      d_endhostent_r_proto=define
12107                 set d_endhostent_r_proto endhostent_r $hdrs
12108                 eval $hasproto ;;
12109         *)      ;;
12110         esac
12111         case "$d_endhostent_r_proto" in
12112         define)
12113         case "$endhostent_r_proto" in
12114         ''|0) try='int endhostent_r(struct hostent_data*);'
12115         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12116         esac
12117         case "$endhostent_r_proto" in
12118         ''|0) try='void endhostent_r(struct hostent_data*);'
12119         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12120         esac
12121         case "$endhostent_r_proto" in
12122         ''|0)   d_endhostent_r=undef
12123                 endhostent_r_proto=0
12124                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12125         * )     case "$endhostent_r_proto" in
12126                 REENTRANT_PROTO*) ;;
12127                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12128                 esac
12129                 echo "Prototype: $try" ;;
12130         esac
12131         ;;
12132         *)      case "$usethreads" in
12133                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12134                 esac
12135                 d_endhostent_r=undef
12136                 endhostent_r_proto=0
12137                 ;;
12138         esac
12139         ;;
12140 *)      endhostent_r_proto=0
12141         ;;
12142 esac
12143
12144 : see if endnetent exists
12145 set endnetent d_endnent
12146 eval $inlibc
12147
12148 : see if endnetent_r exists
12149 set endnetent_r d_endnetent_r
12150 eval $inlibc
12151 case "$d_endnetent_r" in
12152 "$define")
12153         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12154         case "$d_endnetent_r_proto:$usethreads" in
12155         ":define")      d_endnetent_r_proto=define
12156                 set d_endnetent_r_proto endnetent_r $hdrs
12157                 eval $hasproto ;;
12158         *)      ;;
12159         esac
12160         case "$d_endnetent_r_proto" in
12161         define)
12162         case "$endnetent_r_proto" in
12163         ''|0) try='int endnetent_r(struct netent_data*);'
12164         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12165         esac
12166         case "$endnetent_r_proto" in
12167         ''|0) try='void endnetent_r(struct netent_data*);'
12168         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12169         esac
12170         case "$endnetent_r_proto" in
12171         ''|0)   d_endnetent_r=undef
12172                 endnetent_r_proto=0
12173                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12174         * )     case "$endnetent_r_proto" in
12175                 REENTRANT_PROTO*) ;;
12176                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12177                 esac
12178                 echo "Prototype: $try" ;;
12179         esac
12180         ;;
12181         *)      case "$usethreads" in
12182                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12183                 esac
12184                 d_endnetent_r=undef
12185                 endnetent_r_proto=0
12186                 ;;
12187         esac
12188         ;;
12189 *)      endnetent_r_proto=0
12190         ;;
12191 esac
12192
12193 : see if endprotoent exists
12194 set endprotoent d_endpent
12195 eval $inlibc
12196
12197 : see if endprotoent_r exists
12198 set endprotoent_r d_endprotoent_r
12199 eval $inlibc
12200 case "$d_endprotoent_r" in
12201 "$define")
12202         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12203         case "$d_endprotoent_r_proto:$usethreads" in
12204         ":define")      d_endprotoent_r_proto=define
12205                 set d_endprotoent_r_proto endprotoent_r $hdrs
12206                 eval $hasproto ;;
12207         *)      ;;
12208         esac
12209         case "$d_endprotoent_r_proto" in
12210         define)
12211         case "$endprotoent_r_proto" in
12212         ''|0) try='int endprotoent_r(struct protoent_data*);'
12213         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12214         esac
12215         case "$endprotoent_r_proto" in
12216         ''|0) try='void endprotoent_r(struct protoent_data*);'
12217         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12218         esac
12219         case "$endprotoent_r_proto" in
12220         ''|0)   d_endprotoent_r=undef
12221                 endprotoent_r_proto=0
12222                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12223         * )     case "$endprotoent_r_proto" in
12224                 REENTRANT_PROTO*) ;;
12225                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12226                 esac
12227                 echo "Prototype: $try" ;;
12228         esac
12229         ;;
12230         *)      case "$usethreads" in
12231                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12232                 esac
12233                 d_endprotoent_r=undef
12234                 endprotoent_r_proto=0
12235                 ;;
12236         esac
12237         ;;
12238 *)      endprotoent_r_proto=0
12239         ;;
12240 esac
12241
12242 : see if endpwent exists
12243 set endpwent d_endpwent
12244 eval $inlibc
12245
12246 : see if this is a pwd.h system
12247 set pwd.h i_pwd
12248 eval $inhdr
12249
12250 case "$i_pwd" in
12251 $define)
12252         xxx=`./findhdr pwd.h`
12253         $cppstdin $cppflags $cppminus < $xxx >$$.h
12254
12255         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12256                 val="$define"
12257         else
12258                 val="$undef"
12259         fi
12260         set d_pwquota
12261         eval $setvar
12262
12263         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12264                 val="$define"
12265         else
12266                 val="$undef"
12267         fi
12268         set d_pwage
12269         eval $setvar
12270
12271         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12272                 val="$define"
12273         else
12274                 val="$undef"
12275         fi
12276         set d_pwchange
12277         eval $setvar
12278
12279         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12280                 val="$define"
12281         else
12282                 val="$undef"
12283         fi
12284         set d_pwclass
12285         eval $setvar
12286
12287         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12288                 val="$define"
12289         else
12290                 val="$undef"
12291         fi
12292         set d_pwexpire
12293         eval $setvar
12294
12295         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12296                 val="$define"
12297         else
12298                 val="$undef"
12299         fi
12300         set d_pwcomment
12301         eval $setvar
12302
12303         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12304                 val="$define"
12305         else
12306                 val="$undef"
12307         fi
12308         set d_pwgecos
12309         eval $setvar
12310
12311         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12312                 val="$define"
12313         else
12314                 val="$undef"
12315         fi
12316         set d_pwpasswd
12317         eval $setvar
12318
12319         $rm -f $$.h
12320         ;;
12321 *)
12322         val="$undef"; 
12323         set d_pwquota; eval $setvar
12324         set d_pwage; eval $setvar
12325         set d_pwchange; eval $setvar
12326         set d_pwclass; eval $setvar
12327         set d_pwexpire; eval $setvar
12328         set d_pwcomment; eval $setvar
12329         set d_pwgecos; eval $setvar
12330         set d_pwpasswd; eval $setvar
12331         ;;
12332 esac
12333
12334 : see if endpwent_r exists
12335 set endpwent_r d_endpwent_r
12336 eval $inlibc
12337 case "$d_endpwent_r" in
12338 "$define")
12339         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12340         case "$d_endpwent_r_proto:$usethreads" in
12341         ":define")      d_endpwent_r_proto=define
12342                 set d_endpwent_r_proto endpwent_r $hdrs
12343                 eval $hasproto ;;
12344         *)      ;;
12345         esac
12346         case "$d_endpwent_r_proto" in
12347         define)
12348         case "$endpwent_r_proto" in
12349         ''|0) try='int endpwent_r(FILE**);'
12350         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12351         esac
12352         case "$endpwent_r_proto" in
12353         ''|0) try='void endpwent_r(FILE**);'
12354         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12355         esac
12356         case "$endpwent_r_proto" in
12357         ''|0)   d_endpwent_r=undef
12358                 endpwent_r_proto=0
12359                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12360         * )     case "$endpwent_r_proto" in
12361                 REENTRANT_PROTO*) ;;
12362                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12363                 esac
12364                 echo "Prototype: $try" ;;
12365         esac
12366         ;;
12367         *)      case "$usethreads" in
12368                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12369                 esac
12370                 d_endpwent_r=undef
12371                 endpwent_r_proto=0
12372                 ;;
12373         esac
12374         ;;
12375 *)      endpwent_r_proto=0
12376         ;;
12377 esac
12378
12379 : see if endservent exists
12380 set endservent d_endsent
12381 eval $inlibc
12382
12383 : see if endservent_r exists
12384 set endservent_r d_endservent_r
12385 eval $inlibc
12386 case "$d_endservent_r" in
12387 "$define")
12388         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12389         case "$d_endservent_r_proto:$usethreads" in
12390         ":define")      d_endservent_r_proto=define
12391                 set d_endservent_r_proto endservent_r $hdrs
12392                 eval $hasproto ;;
12393         *)      ;;
12394         esac
12395         case "$d_endservent_r_proto" in
12396         define)
12397         case "$endservent_r_proto" in
12398         ''|0) try='int endservent_r(struct servent_data*);'
12399         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12400         esac
12401         case "$endservent_r_proto" in
12402         ''|0) try='void endservent_r(struct servent_data*);'
12403         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12404         esac
12405         case "$endservent_r_proto" in
12406         ''|0)   d_endservent_r=undef
12407                 endservent_r_proto=0
12408                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12409         * )     case "$endservent_r_proto" in
12410                 REENTRANT_PROTO*) ;;
12411                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12412                 esac
12413                 echo "Prototype: $try" ;;
12414         esac
12415         ;;
12416         *)      case "$usethreads" in
12417                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12418                 esac
12419                 d_endservent_r=undef
12420                 endservent_r_proto=0
12421                 ;;
12422         esac
12423         ;;
12424 *)      endservent_r_proto=0
12425         ;;
12426 esac
12427
12428 : Locate the flags for 'open()'
12429 echo " "
12430 $cat >try.c <<EOCP
12431 #include <sys/types.h>
12432 #ifdef I_FCNTL
12433 #include <fcntl.h>
12434 #endif
12435 #ifdef I_SYS_FILE
12436 #include <sys/file.h>
12437 #endif
12438 #$i_stdlib I_STDLIB
12439 #ifdef I_STDLIB
12440 #include <stdlib.h>
12441 #endif
12442 int main() {
12443         if(O_RDONLY);
12444 #ifdef O_TRUNC
12445         exit(0);
12446 #else
12447         exit(1);
12448 #endif
12449 }
12450 EOCP
12451 : check sys/file.h first to get FREAD on Sun
12452 if $test `./findhdr sys/file.h` && \
12453                 set try -DI_SYS_FILE && eval $compile; then
12454         h_sysfile=true;
12455         echo "<sys/file.h> defines the O_* constants..." >&4
12456         if $run ./try; then
12457                 echo "and you have the 3 argument form of open()." >&4
12458                 val="$define"
12459         else
12460                 echo "but not the 3 argument form of open().  Oh, well." >&4
12461                 val="$undef"
12462         fi
12463 elif $test `./findhdr fcntl.h` && \
12464                 set try -DI_FCNTL && eval $compile; then
12465         h_fcntl=true;
12466         echo "<fcntl.h> defines the O_* constants..." >&4
12467         if $run ./try; then
12468                 echo "and you have the 3 argument form of open()." >&4
12469                 val="$define"
12470         else
12471                 echo "but not the 3 argument form of open().  Oh, well." >&4
12472                 val="$undef"
12473         fi
12474 else
12475         val="$undef"
12476         echo "I can't find the O_* constant definitions!  You got problems." >&4
12477 fi
12478 set d_open3
12479 eval $setvar
12480 $rm_try
12481
12482 : see if this is a sys/file.h system
12483 val=''
12484 set sys/file.h val
12485 eval $inhdr
12486
12487 : do we need to include sys/file.h ?
12488 case "$val" in
12489 "$define")
12490         echo " "
12491         if $h_sysfile; then
12492                 val="$define"
12493                 echo "We'll be including <sys/file.h>." >&4
12494         else
12495                 val="$undef"
12496                 echo "We won't be including <sys/file.h>." >&4
12497         fi
12498         ;;
12499 *)
12500         h_sysfile=false
12501         ;;
12502 esac
12503 set i_sysfile
12504 eval $setvar
12505
12506 : see if fcntl.h is there
12507 val=''
12508 set fcntl.h val
12509 eval $inhdr
12510
12511 : see if we can include fcntl.h
12512 case "$val" in
12513 "$define")
12514         echo " "
12515         if $h_fcntl; then
12516                 val="$define"
12517                 echo "We'll be including <fcntl.h>." >&4
12518         else
12519                 val="$undef"
12520                 if $h_sysfile; then
12521         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12522                 else
12523                         echo "We won't be including <fcntl.h>." >&4
12524                 fi
12525         fi
12526         ;;
12527 *)
12528         h_fcntl=false
12529         val="$undef"
12530         ;;
12531 esac
12532 set i_fcntl
12533 eval $setvar
12534
12535 : see if fork exists
12536 set fork d_fork
12537 eval $inlibc
12538
12539 : see if pipe exists
12540 set pipe d_pipe
12541 eval $inlibc
12542
12543 : check for non-blocking I/O stuff
12544 case "$h_sysfile" in
12545 true) echo "#include <sys/file.h>" > head.c;;
12546 *)
12547        case "$h_fcntl" in
12548        true) echo "#include <fcntl.h>" > head.c;;
12549        *) echo "#include <sys/fcntl.h>" > head.c;;
12550        esac
12551        ;;
12552 esac
12553 echo " "
12554 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12555 case "$o_nonblock" in
12556 '')
12557         $cat head.c > try.c
12558         $cat >>try.c <<EOCP
12559 #include <stdio.h>
12560 #$i_stdlib I_STDLIB
12561 #ifdef I_STDLIB
12562 #include <stdlib.h>
12563 #endif
12564 #$i_fcntl I_FCNTL
12565 #ifdef I_FCNTL
12566 #include <fcntl.h>
12567 #endif
12568 int main() {
12569 #ifdef O_NONBLOCK
12570         printf("O_NONBLOCK\n");
12571         exit(0);
12572 #endif
12573 #ifdef O_NDELAY
12574         printf("O_NDELAY\n");
12575         exit(0);
12576 #endif
12577 #ifdef FNDELAY
12578         printf("FNDELAY\n");
12579         exit(0);
12580 #endif
12581         exit(0);
12582 }
12583 EOCP
12584         set try
12585         if eval $compile_ok; then
12586                 o_nonblock=`$run ./try`
12587                 case "$o_nonblock" in
12588                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12589                 *) echo "Seems like we can use $o_nonblock.";;
12590                 esac
12591         else
12592                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12593         fi
12594         ;;
12595 *) echo "Using $hint value $o_nonblock.";;
12596 esac
12597 $rm_try
12598
12599 echo " "
12600 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12601 case "$eagain" in
12602 '')
12603         case "$d_fork:$d_pipe" in
12604         define:define)
12605         $cat head.c > try.c
12606         $cat >>try.c <<EOCP
12607 #include <errno.h>
12608 #include <sys/types.h>
12609 #include <signal.h>
12610 #include <stdio.h>
12611 #$i_stdlib I_STDLIB
12612 #ifdef I_STDLIB
12613 #include <stdlib.h>
12614 #endif
12615 #$i_fcntl I_FCNTL
12616 #ifdef I_FCNTL
12617 #include <fcntl.h>
12618 #endif
12619 #define MY_O_NONBLOCK $o_nonblock
12620 #ifndef errno  /* XXX need better Configure test */
12621 extern int errno;
12622 #endif
12623 #$i_unistd I_UNISTD
12624 #ifdef I_UNISTD
12625 #include <unistd.h>
12626 #endif
12627 #$i_string I_STRING
12628 #ifdef I_STRING
12629 #include <string.h>
12630 #else
12631 #include <strings.h>
12632 #endif
12633 $signal_t blech(int x) { exit(3); }
12634 EOCP
12635         $cat >> try.c <<'EOCP'
12636 int main()
12637 {
12638         int pd[2];
12639         int pu[2];
12640         char buf[1];
12641         char string[100];
12642
12643         pipe(pd);       /* Down: child -> parent */
12644         pipe(pu);       /* Up: parent -> child */
12645         if (0 != fork()) {
12646                 int ret;
12647                 close(pd[1]);   /* Parent reads from pd[0] */
12648                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12649 #ifdef F_SETFL
12650                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12651                         exit(1);
12652 #else
12653                 exit(4);
12654 #endif
12655                 signal(SIGALRM, blech);
12656                 alarm(5);
12657                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12658                         exit(2);
12659                 sprintf(string, "%d\n", ret);
12660                 write(2, string, strlen(string));
12661                 alarm(0);
12662 #ifdef EAGAIN
12663                 if (errno == EAGAIN) {
12664                         printf("EAGAIN\n");
12665                         goto ok;
12666                 }
12667 #endif
12668 #ifdef EWOULDBLOCK
12669                 if (errno == EWOULDBLOCK)
12670                         printf("EWOULDBLOCK\n");
12671 #endif
12672         ok:
12673                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12674                 sleep(2);                               /* Give it time to close our pipe */
12675                 alarm(5);
12676                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12677                 alarm(0);
12678                 sprintf(string, "%d\n", ret);
12679                 write(4, string, strlen(string));
12680                 exit(0);
12681         }
12682
12683         close(pd[0]);                   /* We write to pd[1] */
12684         close(pu[1]);                   /* We read from pu[0] */
12685         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12686         close(pd[1]);                   /* Pipe pd is now fully closed! */
12687         exit(0);                                /* Bye bye, thank you for playing! */
12688 }
12689 EOCP
12690         set try
12691         if eval $compile_ok; then
12692                 echo "$startsh" >mtry
12693                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12694                 chmod +x mtry
12695                 ./mtry >/dev/null 2>&1
12696                 case $? in
12697                 0) eagain=`$cat try.out`;;
12698                 1) echo "Could not perform non-blocking setting!";;
12699                 2) echo "I did a successful read() for something that was not there!";;
12700                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12701                 4) echo "Could not find F_SETFL!";;
12702                 *) echo "Something terribly wrong happened during testing.";;
12703                 esac
12704                 rd_nodata=`$cat try.ret`
12705                 echo "A read() system call with no data present returns $rd_nodata."
12706                 case "$rd_nodata" in
12707                 0|-1) ;;
12708                 *)
12709                         echo "(That's peculiar, fixing that to be -1.)"
12710                         rd_nodata=-1
12711                         ;;
12712                 esac
12713                 case "$eagain" in
12714                 '')
12715                         echo "Forcing errno EAGAIN on read() with no data available."
12716                         eagain=EAGAIN
12717                         ;;
12718                 *)
12719                         echo "Your read() sets errno to $eagain when no data is available."
12720                         ;;
12721                 esac
12722                 status=`$cat try.err`
12723                 case "$status" in
12724                 0) echo "And it correctly returns 0 to signal EOF.";;
12725                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12726                 *) echo "However, your read() returns '$status' on EOF??";;
12727                 esac
12728                 val="$define"
12729                 if test "$status" = "$rd_nodata"; then
12730                         echo "WARNING: you can't distinguish between EOF and no data!"
12731                         val="$undef"
12732                 fi
12733         else
12734                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12735                 eagain=EAGAIN
12736         fi
12737         ;;
12738         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12739                 eagain=EAGAIN
12740                 val="$define"
12741                 ;;
12742         esac
12743         set d_eofnblk
12744         eval $setvar
12745         ;;
12746 *)
12747         echo "Using $hint value $eagain."
12748         echo "Your read() returns $rd_nodata when no data is present."
12749         case "$d_eofnblk" in
12750         "$define") echo "And you can see EOF because read() returns 0.";;
12751         "$undef") echo "But you can't see EOF status from read() returned value.";;
12752         *)
12753                 echo "(Assuming you can't see EOF status from read anyway.)"
12754                 d_eofnblk=$undef
12755                 ;;
12756         esac
12757         ;;
12758 esac
12759 $rm_try head.c mtry
12760
12761 : see if _ptr and _cnt from stdio act std
12762 echo " "
12763
12764 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12765         echo "(Looks like you have stdio.h from BSD.)"
12766         case "$stdio_ptr" in
12767         '') stdio_ptr='((fp)->_p)'
12768                 ptr_lval=$define
12769                 ;;
12770         *)      ptr_lval=$d_stdio_ptr_lval;;
12771         esac
12772         case "$stdio_cnt" in
12773         '') stdio_cnt='((fp)->_r)'
12774                 cnt_lval=$define
12775                 ;;
12776         *)      cnt_lval=$d_stdio_cnt_lval;;
12777         esac
12778         case "$stdio_base" in
12779         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12780         esac
12781         case "$stdio_bufsiz" in
12782         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12783         esac
12784 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12785         echo "(Looks like you have stdio.h from Linux.)"
12786         case "$stdio_ptr" in
12787         '') stdio_ptr='((fp)->_IO_read_ptr)'
12788                 ptr_lval=$define
12789                 ;;
12790         *)      ptr_lval=$d_stdio_ptr_lval;;
12791         esac
12792         case "$stdio_cnt" in
12793         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12794                 cnt_lval=$undef
12795                 ;;
12796         *)      cnt_lval=$d_stdio_cnt_lval;;
12797         esac
12798         case "$stdio_base" in
12799         '') stdio_base='((fp)->_IO_read_base)';;
12800         esac
12801         case "$stdio_bufsiz" in
12802         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12803         esac
12804 else
12805         case "$stdio_ptr" in
12806         '') stdio_ptr='((fp)->_ptr)'
12807                 ptr_lval=$define
12808                 ;;
12809         *)      ptr_lval=$d_stdio_ptr_lval;;
12810         esac
12811         case "$stdio_cnt" in
12812         '') stdio_cnt='((fp)->_cnt)'
12813                 cnt_lval=$define
12814                 ;;
12815         *)      cnt_lval=$d_stdio_cnt_lval;;
12816         esac
12817         case "$stdio_base" in
12818         '') stdio_base='((fp)->_base)';;
12819         esac
12820         case "$stdio_bufsiz" in
12821         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12822         esac
12823 fi
12824
12825 : test whether _ptr and _cnt really work
12826 echo "Checking how std your stdio is..." >&4
12827 $cat >try.c <<EOP
12828 #include <stdio.h>
12829 #$i_stdlib I_STDLIB
12830 #ifdef I_STDLIB
12831 #include <stdlib.h>
12832 #endif
12833 #define FILE_ptr(fp)    $stdio_ptr
12834 #define FILE_cnt(fp)    $stdio_cnt
12835 int main() {
12836         FILE *fp = fopen("try.c", "r");
12837         char c = getc(fp);
12838         if (
12839                 18 <= FILE_cnt(fp) &&
12840                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12841         )
12842                 exit(0);
12843         exit(1);
12844 }
12845 EOP
12846 val="$undef"
12847 set try
12848 if eval $compile && $to try.c; then
12849         if $run ./try; then
12850                 echo "Your stdio acts pretty std."
12851                 val="$define"
12852         else
12853                 echo "Your stdio isn't very std."
12854         fi
12855 else
12856         echo "Your stdio doesn't appear very std."
12857 fi
12858 $rm_try
12859
12860 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12861 # direct buffer manipulation no longer works.  The Configure tests
12862 # should be changed to correctly detect this, but until then,
12863 # the following check should at least let perl compile and run.
12864 # (This quick fix should be updated before 5.8.1.)
12865 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12866 # A. Dougherty, June 3, 2002.
12867 case "$d_gnulibc" in
12868 $define)
12869         case "$gnulibc_version" in
12870         2.[01]*)  ;;
12871         2.2) ;;
12872         2.2.[0-9]) ;;
12873         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12874                 val="$undef"
12875                 ;;
12876         esac
12877         ;;
12878 esac
12879 set d_stdstdio
12880 eval $setvar
12881
12882 : Can _ptr be used as an lvalue?
12883 case "$d_stdstdio$ptr_lval" in
12884 $define$define) val=$define ;;
12885 *) val=$undef ;;
12886 esac
12887 set d_stdio_ptr_lval
12888 eval $setvar
12889
12890 : Can _cnt be used as an lvalue?
12891 case "$d_stdstdio$cnt_lval" in
12892 $define$define) val=$define ;;
12893 *) val=$undef ;;
12894 esac
12895 set d_stdio_cnt_lval
12896 eval $setvar
12897
12898
12899 : test whether setting _ptr sets _cnt as a side effect
12900 d_stdio_ptr_lval_sets_cnt="$undef"
12901 d_stdio_ptr_lval_nochange_cnt="$undef"
12902 case "$d_stdio_ptr_lval$d_stdstdio" in
12903 $define$define)
12904         echo "Checking to see what happens if we set the stdio ptr..." >&4
12905 $cat >try.c <<EOP
12906 #include <stdio.h>
12907 /* Can we scream? */
12908 /* Eat dust sed :-) */
12909 /* In the buffer space, no one can hear you scream. */
12910 #$i_stdlib I_STDLIB
12911 #ifdef I_STDLIB
12912 #include <stdlib.h>
12913 #endif
12914 #define FILE_ptr(fp)    $stdio_ptr
12915 #define FILE_cnt(fp)    $stdio_cnt
12916 #include <sys/types.h>
12917 int main() {
12918         FILE *fp = fopen("try.c", "r");
12919         int c;
12920         char *ptr;
12921         size_t cnt;
12922         if (!fp) {
12923             puts("Fail even to read");
12924             exit(1);
12925         }
12926         c = getc(fp); /* Read away the first # */
12927         if (c == EOF) {
12928             puts("Fail even to read");
12929             exit(1);
12930         }
12931         if (!(
12932                 18 <= FILE_cnt(fp) &&
12933                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12934         )) {
12935                 puts("Fail even to read");
12936                 exit (1);
12937         }
12938         ptr = (char*) FILE_ptr(fp);
12939         cnt = (size_t)FILE_cnt(fp);
12940
12941         FILE_ptr(fp) += 42;
12942
12943         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12944                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12945                 exit (1);
12946         }
12947         if (FILE_cnt(fp) <= 20) {
12948                 printf ("Fail (<20 chars to test)");
12949                 exit (1);
12950         }
12951         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12952                 puts("Fail compare");
12953                 exit (1);
12954         }
12955         if (cnt == FILE_cnt(fp)) {
12956                 puts("Pass_unchanged");
12957                 exit (0);
12958         }
12959         if (FILE_cnt(fp) == (cnt - 42)) {
12960                 puts("Pass_changed");
12961                 exit (0);
12962         }
12963         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12964         return 1;
12965
12966 }
12967 EOP
12968         set try
12969         if eval $compile && $to try.c; then
12970                 case `$run ./try` in
12971                 Pass_changed)
12972                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12973                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12974                 Pass_unchanged)
12975                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12976                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12977                 Fail*)
12978                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12979                 *)
12980                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12981         esac
12982         else
12983                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12984         fi
12985         $rm_try
12986         ;;
12987 esac
12988
12989 : see if _base is also standard
12990 val="$undef"
12991 case "$d_stdstdio" in
12992 $define)
12993         $cat >try.c <<EOP
12994 #include <stdio.h>
12995 #$i_stdlib I_STDLIB
12996 #ifdef I_STDLIB
12997 #include <stdlib.h>
12998 #endif
12999 #define FILE_base(fp)   $stdio_base
13000 #define FILE_bufsiz(fp) $stdio_bufsiz
13001 int main() {
13002         FILE *fp = fopen("try.c", "r");
13003         char c = getc(fp);
13004         if (
13005                 19 <= FILE_bufsiz(fp) &&
13006                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13007         )
13008                 exit(0);
13009         exit(1);
13010 }
13011 EOP
13012         set try
13013         if eval $compile && $to try.c; then
13014                 if $run ./try; then
13015                         echo "And its _base field acts std."
13016                         val="$define"
13017                 else
13018                         echo "But its _base field isn't std."
13019                 fi
13020         else
13021                 echo "However, it seems to be lacking the _base field."
13022         fi
13023         $rm_try
13024         ;;
13025 esac
13026 set d_stdiobase
13027 eval $setvar
13028
13029 : see if fast_stdio exists
13030 val="$undef"
13031 case "$d_stdstdio:$d_stdio_ptr_lval" in
13032 "$define:$define")
13033         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13034         *$define*)
13035                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13036                 val="$define"
13037                 ;;
13038         esac
13039         ;;
13040 esac
13041 set d_faststdio
13042 eval $setvar
13043
13044
13045
13046 : see if fchdir exists
13047 set fchdir d_fchdir
13048 eval $inlibc
13049
13050 : see if fchmod exists
13051 set fchmod d_fchmod
13052 eval $inlibc
13053
13054 : see if fchown exists
13055 set fchown d_fchown
13056 eval $inlibc
13057
13058 : see if this is an fcntl system
13059 set fcntl d_fcntl
13060 eval $inlibc
13061
13062 : See if fcntl-based locking works.
13063 echo " "
13064 $cat >try.c <<EOCP
13065 #$i_stdlib I_STDLIB
13066 #ifdef I_STDLIB
13067 #include <stdlib.h>
13068 #endif
13069 #include <unistd.h>
13070 #include <fcntl.h>
13071 #include <signal.h>
13072 $signal_t blech(int x) { exit(3); }
13073 int main() {
13074 #if defined(F_SETLK) && defined(F_SETLKW)
13075      struct flock flock;
13076      int retval, fd;
13077      fd = open("try.c", O_RDONLY);
13078      flock.l_type = F_RDLCK;
13079      flock.l_whence = SEEK_SET;
13080      flock.l_start = flock.l_len = 0;
13081      signal(SIGALRM, blech);
13082      alarm(10);
13083      retval = fcntl(fd, F_SETLK, &flock);
13084      close(fd);
13085      (retval < 0 ? exit(2) : exit(0));
13086 #else
13087      exit(2);
13088 #endif
13089 }
13090 EOCP
13091 echo "Checking if fcntl-based file locking works... "
13092 case "$d_fcntl" in
13093 "$define")
13094         set try
13095         if eval $compile_ok; then
13096                 if $run ./try; then
13097                         echo "Yes, it seems to work."
13098                         val="$define"
13099                 else
13100                         echo "Nope, it didn't work."
13101                         val="$undef"
13102                         case "$?" in
13103                         3) $cat >&4 <<EOM
13104 ***
13105 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13106 *** This is (almost) impossible.
13107 *** If your NFS lock daemons are not feeling well, something like
13108 *** this may happen, please investigate.  Cannot continue, aborting.
13109 ***
13110 EOM
13111                                 exit 1
13112                                 ;;
13113                         esac
13114                 fi
13115         else
13116                 echo "I'm unable to compile the test program, so I'll assume not."
13117                 val="$undef"
13118         fi
13119         ;;
13120 *) val="$undef";
13121         echo "Nope, since you don't even have fcntl()."
13122         ;;
13123 esac
13124 set d_fcntl_can_lock
13125 eval $setvar
13126 $rm_try
13127
13128 : check for fd_set items
13129 $cat <<EOM
13130
13131 Checking to see how well your C compiler handles fd_set and friends ...
13132 EOM
13133 $cat >try.c <<EOCP
13134 #$i_stdlib I_STDLIB
13135 #ifdef I_STDLIB
13136 #include <stdlib.h>
13137 #endif
13138 #$i_systime I_SYS_TIME
13139 #$i_sysselct I_SYS_SELECT
13140 #$d_socket HAS_SOCKET
13141 #include <sys/types.h>
13142 #ifdef HAS_SOCKET
13143 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13144 #endif
13145 #ifdef I_SYS_TIME
13146 #include <sys/time.h>
13147 #endif
13148 #ifdef I_SYS_SELECT
13149 #include <sys/select.h>
13150 #endif
13151 int main() {
13152         fd_set fds;
13153
13154 #ifdef TRYBITS
13155         if(fds.fds_bits);
13156 #endif
13157
13158 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13159         exit(0);
13160 #else
13161         exit(1);
13162 #endif
13163 }
13164 EOCP
13165 set try -DTRYBITS
13166 if eval $compile; then
13167         d_fds_bits="$define"
13168         d_fd_set="$define"
13169         echo "Well, your system knows about the normal fd_set typedef..." >&4
13170         if $run ./try; then
13171                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13172                 d_fd_macros="$define"
13173         else
13174                 $cat >&4 <<'EOM'
13175 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13176 EOM
13177                 d_fd_macros="$undef"
13178         fi
13179 else
13180         $cat <<'EOM'
13181 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13182 EOM
13183         set try
13184         if eval $compile; then
13185                 d_fds_bits="$undef"
13186                 d_fd_set="$define"
13187                 echo "Well, your system has some sort of fd_set available..." >&4
13188                 if $run ./try; then
13189                         echo "and you have the normal fd_set macros." >&4
13190                         d_fd_macros="$define"
13191                 else
13192                         $cat <<'EOM'
13193 but not the normal fd_set macros!  Gross!  More work for me...
13194 EOM
13195                         d_fd_macros="$undef"
13196                 fi
13197         else
13198         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13199                 d_fd_set="$undef"
13200                 d_fds_bits="$undef"
13201                 d_fd_macros="$undef"
13202         fi
13203 fi
13204 $rm_try
13205
13206 : see if fgetpos exists
13207 set fgetpos d_fgetpos
13208 eval $inlibc
13209
13210 : see if finite exists
13211 set finite d_finite
13212 eval $inlibc
13213
13214 : see if finitel exists
13215 set finitel d_finitel
13216 eval $inlibc
13217
13218 : see if flock exists
13219 set flock d_flock
13220 eval $inlibc
13221
13222 : see if prototype for flock is available
13223 echo " "
13224 set d_flockproto flock $i_sysfile sys/file.h
13225 eval $hasproto
13226
13227 : see if fp_class exists
13228 set fp_class d_fp_class
13229 eval $inlibc
13230
13231 : see if pathconf exists
13232 set pathconf d_pathconf
13233 eval $inlibc
13234
13235 : see if fpathconf exists
13236 set fpathconf d_fpathconf
13237 eval $inlibc
13238
13239 : see if fpclass exists
13240 set fpclass d_fpclass
13241 eval $inlibc
13242
13243 : see if fpclassify exists
13244 set fpclassify d_fpclassify
13245 eval $inlibc
13246
13247 : see if fpclassl exists
13248 set fpclassl d_fpclassl
13249 eval $inlibc
13250
13251 : check for fpos64_t
13252 echo " "
13253 echo "Checking to see if you have fpos64_t..." >&4
13254 $cat >try.c <<EOCP
13255 #include <stdio.h>
13256 int main() { fpos64_t x = 7; }
13257 EOCP
13258 set try
13259 if eval $compile; then
13260         val="$define"
13261         echo "You have fpos64_t."
13262 else
13263         val="$undef"
13264         echo "You do not have fpos64_t."
13265         case "$fpossize" in
13266         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13267         esac
13268 fi
13269 $rm_try
13270 set d_fpos64_t
13271 eval $setvar
13272
13273 : see if frexpl exists
13274 set frexpl d_frexpl
13275 eval $inlibc
13276
13277 : see if this is a sys/param system
13278 set sys/param.h i_sysparam
13279 eval $inhdr
13280
13281 : see if this is a sys/mount.h system
13282 set sys/mount.h i_sysmount
13283 eval $inhdr
13284
13285 : Check for fs_data_s
13286 echo " "
13287 echo "Checking to see if your system supports struct fs_data..." >&4
13288 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13289 eval $hasstruct
13290 case "$d_fs_data_s" in
13291 "$define")      echo "Yes, it does."   ;;
13292 *)              echo "No, it doesn't." ;;
13293 esac
13294
13295 : see if fseeko exists
13296 set fseeko d_fseeko
13297 eval $inlibc
13298 case "$longsize" in
13299 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13300 esac
13301
13302 : see if fsetpos exists
13303 set fsetpos d_fsetpos
13304 eval $inlibc
13305
13306 : see if fstatfs exists
13307 set fstatfs d_fstatfs
13308 eval $inlibc
13309
13310 : see if statvfs exists
13311 set statvfs d_statvfs
13312 eval $inlibc
13313
13314 : see if fstatvfs exists
13315 set fstatvfs d_fstatvfs
13316 eval $inlibc
13317
13318
13319 : see if fsync exists
13320 set fsync d_fsync
13321 eval $inlibc
13322
13323 : see if ftello exists
13324 set ftello d_ftello
13325 eval $inlibc
13326 case "$longsize" in
13327 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13328 esac
13329
13330 : check for a working futimes
13331 d_futimes="$undef"
13332 echo " "
13333 echo "Checking if you have a working futimes()" >&4
13334 $cat >try.c <<EOCP
13335 #include <stdio.h>
13336 #include <sys/time.h>
13337 #include <errno.h>
13338 #include <fcntl.h>
13339
13340 int main ()
13341 {
13342     int fd, rv;
13343     fd = open ("try.c", O_RDWR);
13344     if (-1 == fd) exit (1);
13345     rv = futimes (fd, NULL);
13346     exit (rv == -1 ? errno : 0);
13347 }
13348 EOCP
13349 set try
13350 if eval $compile; then
13351     `$run ./try`
13352     rc=$?
13353     case "$rc" in
13354         0)  echo "Yes, you have" >&4
13355             d_futimes="$define"
13356             ;;
13357         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13358             ;;
13359     esac
13360 else
13361     echo "No, it does not (probably harmless)" >&4
13362 fi
13363 $rm_try
13364
13365 : see if ndbm.h is available
13366 set ndbm.h i_ndbm
13367 eval $inhdr
13368 : Compatibility location for RedHat 7.1
13369 set gdbm/ndbm.h i_gdbmndbm
13370 eval $inhdr
13371 : Compatibility location for Debian 4.0
13372 set gdbm-ndbm.h i_gdbm_ndbm
13373 eval $inhdr
13374
13375 val="$undef"
13376 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13377         : see if dbm_open exists
13378         set dbm_open d_dbm_open
13379         eval $inlibc
13380         case "$d_dbm_open" in
13381         $undef)
13382                 i_ndbm="$undef"
13383                 i_gdbmndbm="$undef"
13384                 i_gdbm_ndbm="$undef"
13385                 echo "We won't be including <ndbm.h>"
13386                 val="$undef"
13387                 ;;
13388         *) val="$define"
13389            ;;
13390         esac
13391 fi
13392 set d_ndbm
13393 eval $setvar
13394
13395 ndbm_hdr_protochk='name=$1; hdr=$2;
13396 eval "ihdr=\$""i_$name";
13397 val="$undef";
13398 if $test "$ihdr" = "$define"; then
13399         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13400         case "$d_cplusplus" in
13401         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13402         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13403         esac;
13404         case "$val" in
13405         $define) $echo "Your <$hdr> seems to have prototypes";;
13406         *) $echo "Your <$hdr> does not seem to have prototypes";;
13407         esac;
13408 fi;
13409 set "d_${name}_h_uses_prototypes";
13410 eval $setvar'
13411
13412 set ndbm ndbm.h
13413 eval $ndbm_hdr_protochk
13414 set gdbmndbm gdbm/ndbm.h
13415 eval $ndbm_hdr_protochk
13416 set gdbm_ndbm gdbm-ndbm.h
13417 eval $ndbm_hdr_protochk
13418
13419 : see if getaddrinfo exists
13420 set getaddrinfo d_getaddrinfo
13421 eval $inlibc
13422
13423 : see if getcwd exists
13424 set getcwd d_getcwd
13425 eval $inlibc
13426
13427 : see if getespwnam exists
13428 set getespwnam d_getespwnam
13429 eval $inlibc
13430
13431 : see if getfsstat exists
13432 set getfsstat d_getfsstat
13433 eval $inlibc
13434
13435 : see if getgrent exists
13436 set getgrent d_getgrent
13437 eval $inlibc
13438
13439 : see if getgrent_r exists
13440 set getgrent_r d_getgrent_r
13441 eval $inlibc
13442 case "$d_getgrent_r" in
13443 "$define")
13444         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13445         case "$d_getgrent_r_proto:$usethreads" in
13446         ":define")      d_getgrent_r_proto=define
13447                 set d_getgrent_r_proto getgrent_r $hdrs
13448                 eval $hasproto ;;
13449         *)      ;;
13450         esac
13451         case "$d_getgrent_r_proto" in
13452         define)
13453         case "$getgrent_r_proto" in
13454         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13455         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13456         esac
13457         case "$getgrent_r_proto" in
13458         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13459         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13460         esac
13461         case "$getgrent_r_proto" in
13462         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13463         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13464         esac
13465         case "$getgrent_r_proto" in
13466         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13467         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13468         esac
13469         case "$getgrent_r_proto" in
13470         ''|0) try='int getgrent_r(struct group*, char*, int);'
13471         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13472         esac
13473         case "$getgrent_r_proto" in
13474         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13475         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13476         esac
13477         case "$getgrent_r_proto" in
13478         ''|0)   d_getgrent_r=undef
13479                 getgrent_r_proto=0
13480                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13481         * )     case "$getgrent_r_proto" in
13482                 REENTRANT_PROTO*) ;;
13483                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13484                 esac
13485                 echo "Prototype: $try" ;;
13486         esac
13487         ;;
13488         *)      case "$usethreads" in
13489                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13490                 esac
13491                 d_getgrent_r=undef
13492                 getgrent_r_proto=0
13493                 ;;
13494         esac
13495         ;;
13496 *)      getgrent_r_proto=0
13497         ;;
13498 esac
13499
13500 : see if getgrgid_r exists
13501 set getgrgid_r d_getgrgid_r
13502 eval $inlibc
13503 case "$d_getgrgid_r" in
13504 "$define")
13505         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13506         case "$d_getgrgid_r_proto:$usethreads" in
13507         ":define")      d_getgrgid_r_proto=define
13508                 set d_getgrgid_r_proto getgrgid_r $hdrs
13509                 eval $hasproto ;;
13510         *)      ;;
13511         esac
13512         case "$d_getgrgid_r_proto" in
13513         define)
13514         case "$getgrgid_r_proto" in
13515         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13516         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13517         esac
13518         case "$getgrgid_r_proto" in
13519         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13520         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13521         esac
13522         case "$getgrgid_r_proto" in
13523         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13524         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13525         esac
13526         case "$getgrgid_r_proto" in
13527         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13528         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13529         esac
13530         case "$getgrgid_r_proto" in
13531         ''|0)   d_getgrgid_r=undef
13532                 getgrgid_r_proto=0
13533                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13534         * )     case "$getgrgid_r_proto" in
13535                 REENTRANT_PROTO*) ;;
13536                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13537                 esac
13538                 echo "Prototype: $try" ;;
13539         esac
13540         ;;
13541         *)      case "$usethreads" in
13542                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13543                 esac
13544                 d_getgrgid_r=undef
13545                 getgrgid_r_proto=0
13546                 ;;
13547         esac
13548         ;;
13549 *)      getgrgid_r_proto=0
13550         ;;
13551 esac
13552
13553 : see if getgrnam_r exists
13554 set getgrnam_r d_getgrnam_r
13555 eval $inlibc
13556 case "$d_getgrnam_r" in
13557 "$define")
13558         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13559         case "$d_getgrnam_r_proto:$usethreads" in
13560         ":define")      d_getgrnam_r_proto=define
13561                 set d_getgrnam_r_proto getgrnam_r $hdrs
13562                 eval $hasproto ;;
13563         *)      ;;
13564         esac
13565         case "$d_getgrnam_r_proto" in
13566         define)
13567         case "$getgrnam_r_proto" in
13568         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13569         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13570         esac
13571         case "$getgrnam_r_proto" in
13572         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13573         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13574         esac
13575         case "$getgrnam_r_proto" in
13576         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13577         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13578         esac
13579         case "$getgrnam_r_proto" in
13580         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13581         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13582         esac
13583         case "$getgrnam_r_proto" in
13584         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13585         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13586         esac
13587         case "$getgrnam_r_proto" in
13588         ''|0)   d_getgrnam_r=undef
13589                 getgrnam_r_proto=0
13590                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13591         * )     case "$getgrnam_r_proto" in
13592                 REENTRANT_PROTO*) ;;
13593                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13594                 esac
13595                 echo "Prototype: $try" ;;
13596         esac
13597         ;;
13598         *)      case "$usethreads" in
13599                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13600                 esac
13601                 d_getgrnam_r=undef
13602                 getgrnam_r_proto=0
13603                 ;;
13604         esac
13605         ;;
13606 *)      getgrnam_r_proto=0
13607         ;;
13608 esac
13609
13610 : see if gethostbyaddr exists
13611 set gethostbyaddr d_gethbyaddr
13612 eval $inlibc
13613
13614 : see if gethostbyname exists
13615 set gethostbyname d_gethbyname
13616 eval $inlibc
13617
13618 : see if gethostent exists
13619 set gethostent d_gethent
13620 eval $inlibc
13621
13622 : see how we will look up host name
13623 echo " "
13624 call=''
13625 if set gethostname val -f d_gethname; eval $csym; $val; then
13626         echo 'gethostname() found.' >&4
13627         d_gethname="$define"
13628         call=gethostname
13629 fi
13630 if set uname val -f d_uname; eval $csym; $val; then
13631         if ./xenix; then
13632                 $cat <<'EOM'
13633 uname() was found, but you're running xenix, and older versions of xenix
13634 have a broken uname(). If you don't really know whether your xenix is old
13635 enough to have a broken system call, use the default answer.
13636
13637 EOM
13638                 dflt=y
13639                 case "$d_uname" in
13640                 "$define") dflt=n;;
13641                 esac
13642                 rp='Is your uname() broken?'
13643                 . ./myread
13644                 case "$ans" in
13645                 n*) d_uname="$define"; call=uname;;
13646                 esac
13647         else
13648                 echo 'uname() found.' >&4
13649                 d_uname="$define"
13650                 case "$call" in
13651                 '') call=uname ;;
13652                 esac
13653         fi
13654 fi
13655 case "$d_gethname" in
13656 '') d_gethname="$undef";;
13657 esac
13658 case "$d_uname" in
13659 '') d_uname="$undef";;
13660 esac
13661 case "$d_uname$d_gethname" in
13662 *define*)
13663         dflt=n
13664         cat <<EOM
13665
13666 Every now and then someone has a $call() that lies about the hostname
13667 but can't be fixed for political or economic reasons.  If you wish, I can
13668 pretend $call() isn't there and maybe compute hostname at run-time
13669 thanks to the '$phostname' command.
13670
13671 EOM
13672         rp="Shall I ignore $call() from now on?"
13673         . ./myread
13674         case "$ans" in
13675         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13676         esac;;
13677 esac
13678 case "$phostname" in
13679 '') aphostname='';;
13680 *) case "$aphostname" in
13681         /*) ;;
13682         *) set X $phostname
13683                 shift
13684                 file=$1
13685                 shift
13686                 file=`./loc $file $file $pth`
13687                 aphostname=`echo $file $*`
13688                 ;;
13689         esac
13690         ;;
13691 esac
13692 case "$d_uname$d_gethname" in
13693 *define*) ;;
13694 *)
13695         case "$phostname" in
13696         '')
13697                 echo "There will be no way for $package to get your hostname." >&4;;
13698         *)
13699         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13700                 ;;
13701         esac;;
13702 esac
13703 case "$d_phostname" in
13704 '') d_phostname="$undef";;
13705 esac
13706
13707 : see if gethostbyaddr_r exists
13708 set gethostbyaddr_r d_gethostbyaddr_r
13709 eval $inlibc
13710 case "$d_gethostbyaddr_r" in
13711 "$define")
13712         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13713         case "$d_gethostbyaddr_r_proto:$usethreads" in
13714         ":define")      d_gethostbyaddr_r_proto=define
13715                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13716                 eval $hasproto ;;
13717         *)      ;;
13718         esac
13719         case "$d_gethostbyaddr_r_proto" in
13720         define)
13721         case "$gethostbyaddr_r_proto" in
13722         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13723         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13724         esac
13725         case "$gethostbyaddr_r_proto" in
13726         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13727         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13728         esac
13729         case "$gethostbyaddr_r_proto" in
13730         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13731         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13732         esac
13733         case "$gethostbyaddr_r_proto" in
13734         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13735         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13736         esac
13737         case "$gethostbyaddr_r_proto" in
13738         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13739         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13740         esac
13741         case "$gethostbyaddr_r_proto" in
13742         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13743         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13744         esac
13745         case "$gethostbyaddr_r_proto" in
13746         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13747         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13748         esac
13749         case "$gethostbyaddr_r_proto" in
13750         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13751         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13752         esac
13753         case "$gethostbyaddr_r_proto" in
13754         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13755         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13756         esac
13757         case "$gethostbyaddr_r_proto" in
13758         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13759         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13760         esac
13761         case "$gethostbyaddr_r_proto" in
13762         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13763         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13764         esac
13765         case "$gethostbyaddr_r_proto" in
13766         ''|0)   d_gethostbyaddr_r=undef
13767                 gethostbyaddr_r_proto=0
13768                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13769         * )     case "$gethostbyaddr_r_proto" in
13770                 REENTRANT_PROTO*) ;;
13771                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13772                 esac
13773                 echo "Prototype: $try" ;;
13774         esac
13775         ;;
13776         *)      case "$usethreads" in
13777                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13778                 esac
13779                 d_gethostbyaddr_r=undef
13780                 gethostbyaddr_r_proto=0
13781                 ;;
13782         esac
13783         ;;
13784 *)      gethostbyaddr_r_proto=0
13785         ;;
13786 esac
13787
13788 : see if gethostbyname_r exists
13789 set gethostbyname_r d_gethostbyname_r
13790 eval $inlibc
13791 case "$d_gethostbyname_r" in
13792 "$define")
13793         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13794         case "$d_gethostbyname_r_proto:$usethreads" in
13795         ":define")      d_gethostbyname_r_proto=define
13796                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13797                 eval $hasproto ;;
13798         *)      ;;
13799         esac
13800         case "$d_gethostbyname_r_proto" in
13801         define)
13802         case "$gethostbyname_r_proto" in
13803         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13804         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13805         esac
13806         case "$gethostbyname_r_proto" in
13807         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13808         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13809         esac
13810         case "$gethostbyname_r_proto" in
13811         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13812         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13813         esac
13814         case "$gethostbyname_r_proto" in
13815         ''|0)   d_gethostbyname_r=undef
13816                 gethostbyname_r_proto=0
13817                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13818         * )     case "$gethostbyname_r_proto" in
13819                 REENTRANT_PROTO*) ;;
13820                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13821                 esac
13822                 echo "Prototype: $try" ;;
13823         esac
13824         ;;
13825         *)      case "$usethreads" in
13826                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13827                 esac
13828                 d_gethostbyname_r=undef
13829                 gethostbyname_r_proto=0
13830                 ;;
13831         esac
13832         ;;
13833 *)      gethostbyname_r_proto=0
13834         ;;
13835 esac
13836
13837 : see if gethostent_r exists
13838 set gethostent_r d_gethostent_r
13839 eval $inlibc
13840 case "$d_gethostent_r" in
13841 "$define")
13842         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13843         case "$d_gethostent_r_proto:$usethreads" in
13844         ":define")      d_gethostent_r_proto=define
13845                 set d_gethostent_r_proto gethostent_r $hdrs
13846                 eval $hasproto ;;
13847         *)      ;;
13848         esac
13849         case "$d_gethostent_r_proto" in
13850         define)
13851         case "$gethostent_r_proto" in
13852         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13853         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13854         esac
13855         case "$gethostent_r_proto" in
13856         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13857         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13858         esac
13859         case "$gethostent_r_proto" in
13860         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13861         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13862         esac
13863         case "$gethostent_r_proto" in
13864         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13865         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13866         esac
13867         case "$gethostent_r_proto" in
13868         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13869         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13870         esac
13871         case "$gethostent_r_proto" in
13872         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13873         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13874         esac
13875         case "$gethostent_r_proto" in
13876         ''|0)   d_gethostent_r=undef
13877                 gethostent_r_proto=0
13878                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13879         * )     case "$gethostent_r_proto" in
13880                 REENTRANT_PROTO*) ;;
13881                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13882                 esac
13883                 echo "Prototype: $try" ;;
13884         esac
13885         ;;
13886         *)      case "$usethreads" in
13887                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13888                 esac
13889                 d_gethostent_r=undef
13890                 gethostent_r_proto=0
13891                 ;;
13892         esac
13893         ;;
13894 *)      gethostent_r_proto=0
13895         ;;
13896 esac
13897
13898 : see if prototypes for various gethostxxx netdb.h functions are available
13899 echo " "
13900 set d_gethostprotos gethostent $i_netdb netdb.h
13901 eval $hasproto
13902
13903 : see if getitimer exists
13904 set getitimer d_getitimer
13905 eval $inlibc
13906
13907 : see if getlogin exists
13908 set getlogin d_getlogin
13909 eval $inlibc
13910
13911 : see if getlogin_r exists
13912 set getlogin_r d_getlogin_r
13913 eval $inlibc
13914 case "$d_getlogin_r" in
13915 "$define")
13916         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13917         case "$d_getlogin_r_proto:$usethreads" in
13918         ":define")      d_getlogin_r_proto=define
13919                 set d_getlogin_r_proto getlogin_r $hdrs
13920                 eval $hasproto ;;
13921         *)      ;;
13922         esac
13923         case "$d_getlogin_r_proto" in
13924         define)
13925         case "$getlogin_r_proto" in
13926         ''|0) try='int getlogin_r(char*, size_t);'
13927         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13928         esac
13929         case "$getlogin_r_proto" in
13930         ''|0) try='int getlogin_r(char*, int);'
13931         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13932         esac
13933         case "$getlogin_r_proto" in
13934         ''|0) try='char* getlogin_r(char*, size_t);'
13935         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13936         esac
13937         case "$getlogin_r_proto" in
13938         ''|0) try='char* getlogin_r(char*, int);'
13939         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13940         esac
13941         case "$getlogin_r_proto" in
13942         ''|0)   d_getlogin_r=undef
13943                 getlogin_r_proto=0
13944                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13945         * )     case "$getlogin_r_proto" in
13946                 REENTRANT_PROTO*) ;;
13947                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13948                 esac
13949                 echo "Prototype: $try" ;;
13950         esac
13951         ;;
13952         *)      case "$usethreads" in
13953                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13954                 esac
13955                 d_getlogin_r=undef
13956                 getlogin_r_proto=0
13957                 ;;
13958         esac
13959         ;;
13960 *)      getlogin_r_proto=0
13961         ;;
13962 esac
13963
13964 : see if getmnt exists
13965 set getmnt d_getmnt
13966 eval $inlibc
13967
13968 : see if getmntent exists
13969 set getmntent d_getmntent
13970 eval $inlibc
13971
13972 : see if getnameinfo exists
13973 set getnameinfo d_getnameinfo
13974 eval $inlibc
13975
13976 : see if getnetbyaddr exists
13977 set getnetbyaddr d_getnbyaddr
13978 eval $inlibc
13979
13980 : see if getnetbyname exists
13981 set getnetbyname d_getnbyname
13982 eval $inlibc
13983
13984 : see if getnetent exists
13985 set getnetent d_getnent
13986 eval $inlibc
13987
13988 : see if getnetbyaddr_r exists
13989 set getnetbyaddr_r d_getnetbyaddr_r
13990 eval $inlibc
13991 case "$d_getnetbyaddr_r" in
13992 "$define")
13993         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13994         case "$d_getnetbyaddr_r_proto:$usethreads" in
13995         ":define")      d_getnetbyaddr_r_proto=define
13996                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13997                 eval $hasproto ;;
13998         *)      ;;
13999         esac
14000         case "$d_getnetbyaddr_r_proto" in
14001         define)
14002         case "$getnetbyaddr_r_proto" in
14003         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14004         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14005         esac
14006         case "$getnetbyaddr_r_proto" in
14007         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14008         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14009         esac
14010         case "$getnetbyaddr_r_proto" in
14011         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14012         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14013         esac
14014         case "$getnetbyaddr_r_proto" in
14015         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14016         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14017         esac
14018         case "$getnetbyaddr_r_proto" in
14019         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14020         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14021         esac
14022         case "$getnetbyaddr_r_proto" in
14023         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14024         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14025         esac
14026         case "$getnetbyaddr_r_proto" in
14027         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14028         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14029         esac
14030         case "$getnetbyaddr_r_proto" in
14031         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14032         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14033         esac
14034         case "$getnetbyaddr_r_proto" in
14035         ''|0)   d_getnetbyaddr_r=undef
14036                 getnetbyaddr_r_proto=0
14037                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14038         * )     case "$getnetbyaddr_r_proto" in
14039                 REENTRANT_PROTO*) ;;
14040                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14041                 esac
14042                 echo "Prototype: $try" ;;
14043         esac
14044         ;;
14045         *)      case "$usethreads" in
14046                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14047                 esac
14048                 d_getnetbyaddr_r=undef
14049                 getnetbyaddr_r_proto=0
14050                 ;;
14051         esac
14052         ;;
14053 *)      getnetbyaddr_r_proto=0
14054         ;;
14055 esac
14056
14057 : see if getnetbyname_r exists
14058 set getnetbyname_r d_getnetbyname_r
14059 eval $inlibc
14060 case "$d_getnetbyname_r" in
14061 "$define")
14062         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14063         case "$d_getnetbyname_r_proto:$usethreads" in
14064         ":define")      d_getnetbyname_r_proto=define
14065                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14066                 eval $hasproto ;;
14067         *)      ;;
14068         esac
14069         case "$d_getnetbyname_r_proto" in
14070         define)
14071         case "$getnetbyname_r_proto" in
14072         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14073         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14074         esac
14075         case "$getnetbyname_r_proto" in
14076         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14077         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14078         esac
14079         case "$getnetbyname_r_proto" in
14080         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14081         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14082         esac
14083         case "$getnetbyname_r_proto" in
14084         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14085         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14086         esac
14087         case "$getnetbyname_r_proto" in
14088         ''|0)   d_getnetbyname_r=undef
14089                 getnetbyname_r_proto=0
14090                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14091         * )     case "$getnetbyname_r_proto" in
14092                 REENTRANT_PROTO*) ;;
14093                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14094                 esac
14095                 echo "Prototype: $try" ;;
14096         esac
14097         ;;
14098         *)      case "$usethreads" in
14099                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14100                 esac
14101                 d_getnetbyname_r=undef
14102                 getnetbyname_r_proto=0
14103                 ;;
14104         esac
14105         ;;
14106 *)      getnetbyname_r_proto=0
14107         ;;
14108 esac
14109
14110 : see if getnetent_r exists
14111 set getnetent_r d_getnetent_r
14112 eval $inlibc
14113 case "$d_getnetent_r" in
14114 "$define")
14115         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14116         case "$d_getnetent_r_proto:$usethreads" in
14117         ":define")      d_getnetent_r_proto=define
14118                 set d_getnetent_r_proto getnetent_r $hdrs
14119                 eval $hasproto ;;
14120         *)      ;;
14121         esac
14122         case "$d_getnetent_r_proto" in
14123         define)
14124         case "$getnetent_r_proto" in
14125         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14126         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14127         esac
14128         case "$getnetent_r_proto" in
14129         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14130         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14131         esac
14132         case "$getnetent_r_proto" in
14133         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14134         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14135         esac
14136         case "$getnetent_r_proto" in
14137         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14138         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14139         esac
14140         case "$getnetent_r_proto" in
14141         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14142         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14143         esac
14144         case "$getnetent_r_proto" in
14145         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14146         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14147         esac
14148         case "$getnetent_r_proto" in
14149         ''|0)   d_getnetent_r=undef
14150                 getnetent_r_proto=0
14151                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14152         * )     case "$getnetent_r_proto" in
14153                 REENTRANT_PROTO*) ;;
14154                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14155                 esac
14156                 echo "Prototype: $try" ;;
14157         esac
14158         ;;
14159         *)      case "$usethreads" in
14160                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14161                 esac
14162                 d_getnetent_r=undef
14163                 getnetent_r_proto=0
14164                 ;;
14165         esac
14166         ;;
14167 *)      getnetent_r_proto=0
14168         ;;
14169 esac
14170
14171 : see if prototypes for various getnetxxx netdb.h functions are available
14172 echo " "
14173 set d_getnetprotos getnetent $i_netdb netdb.h
14174 eval $hasproto
14175
14176 : see if getpagesize exists
14177 set getpagesize d_getpagsz
14178 eval $inlibc
14179
14180 : Optional checks for getprotobyname and getprotobynumber
14181
14182 : see if getprotobyname exists
14183 set getprotobyname d_getpbyname
14184 eval $inlibc
14185
14186 : see if getprotobynumber exists
14187 set getprotobynumber d_getpbynumber
14188 eval $inlibc
14189
14190 : see if getprotoent exists
14191 set getprotoent d_getpent
14192 eval $inlibc
14193
14194 : see if getpgid exists
14195 set getpgid d_getpgid
14196 eval $inlibc
14197
14198 : see if getpgrp2 exists
14199 set getpgrp2 d_getpgrp2
14200 eval $inlibc
14201
14202 : see if getppid exists
14203 set getppid d_getppid
14204 eval $inlibc
14205
14206 : see if getpriority exists
14207 set getpriority d_getprior
14208 eval $inlibc
14209
14210 : see if getprotobyname_r exists
14211 set getprotobyname_r d_getprotobyname_r
14212 eval $inlibc
14213 case "$d_getprotobyname_r" in
14214 "$define")
14215         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14216         case "$d_getprotobyname_r_proto:$usethreads" in
14217         ":define")      d_getprotobyname_r_proto=define
14218                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14219                 eval $hasproto ;;
14220         *)      ;;
14221         esac
14222         case "$d_getprotobyname_r_proto" in
14223         define)
14224         case "$getprotobyname_r_proto" in
14225         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14226         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14227         esac
14228         case "$getprotobyname_r_proto" in
14229         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14230         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14231         esac
14232         case "$getprotobyname_r_proto" in
14233         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14234         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14235         esac
14236         case "$getprotobyname_r_proto" in
14237         ''|0)   d_getprotobyname_r=undef
14238                 getprotobyname_r_proto=0
14239                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14240         * )     case "$getprotobyname_r_proto" in
14241                 REENTRANT_PROTO*) ;;
14242                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14243                 esac
14244                 echo "Prototype: $try" ;;
14245         esac
14246         ;;
14247         *)      case "$usethreads" in
14248                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14249                 esac
14250                 d_getprotobyname_r=undef
14251                 getprotobyname_r_proto=0
14252                 ;;
14253         esac
14254         ;;
14255 *)      getprotobyname_r_proto=0
14256         ;;
14257 esac
14258
14259 : see if getprotobynumber_r exists
14260 set getprotobynumber_r d_getprotobynumber_r
14261 eval $inlibc
14262 case "$d_getprotobynumber_r" in
14263 "$define")
14264         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14265         case "$d_getprotobynumber_r_proto:$usethreads" in
14266         ":define")      d_getprotobynumber_r_proto=define
14267                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14268                 eval $hasproto ;;
14269         *)      ;;
14270         esac
14271         case "$d_getprotobynumber_r_proto" in
14272         define)
14273         case "$getprotobynumber_r_proto" in
14274         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14275         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14276         esac
14277         case "$getprotobynumber_r_proto" in
14278         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14279         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14280         esac
14281         case "$getprotobynumber_r_proto" in
14282         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14283         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14284         esac
14285         case "$getprotobynumber_r_proto" in
14286         ''|0)   d_getprotobynumber_r=undef
14287                 getprotobynumber_r_proto=0
14288                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14289         * )     case "$getprotobynumber_r_proto" in
14290                 REENTRANT_PROTO*) ;;
14291                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14292                 esac
14293                 echo "Prototype: $try" ;;
14294         esac
14295         ;;
14296         *)      case "$usethreads" in
14297                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14298                 esac
14299                 d_getprotobynumber_r=undef
14300                 getprotobynumber_r_proto=0
14301                 ;;
14302         esac
14303         ;;
14304 *)      getprotobynumber_r_proto=0
14305         ;;
14306 esac
14307
14308 : see if getprotoent_r exists
14309 set getprotoent_r d_getprotoent_r
14310 eval $inlibc
14311 case "$d_getprotoent_r" in
14312 "$define")
14313         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14314         case "$d_getprotoent_r_proto:$usethreads" in
14315         ":define")      d_getprotoent_r_proto=define
14316                 set d_getprotoent_r_proto getprotoent_r $hdrs
14317                 eval $hasproto ;;
14318         *)      ;;
14319         esac
14320         case "$d_getprotoent_r_proto" in
14321         define)
14322         case "$getprotoent_r_proto" in
14323         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14324         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14325         esac
14326         case "$getprotoent_r_proto" in
14327         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14328         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14329         esac
14330         case "$getprotoent_r_proto" in
14331         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14332         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14333         esac
14334         case "$getprotoent_r_proto" in
14335         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14336         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14337         esac
14338         case "$getprotoent_r_proto" in
14339         ''|0)   d_getprotoent_r=undef
14340                 getprotoent_r_proto=0
14341                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14342         * )     case "$getprotoent_r_proto" in
14343                 REENTRANT_PROTO*) ;;
14344                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14345                 esac
14346                 echo "Prototype: $try" ;;
14347         esac
14348         ;;
14349         *)      case "$usethreads" in
14350                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14351                 esac
14352                 d_getprotoent_r=undef
14353                 getprotoent_r_proto=0
14354                 ;;
14355         esac
14356         ;;
14357 *)      getprotoent_r_proto=0
14358         ;;
14359 esac
14360
14361 : see if prototypes for various getprotoxxx netdb.h functions are available
14362 echo " "
14363 set d_getprotoprotos getprotoent $i_netdb netdb.h
14364 eval $hasproto
14365
14366 : see if getprpwnam exists
14367 set getprpwnam d_getprpwnam
14368 eval $inlibc
14369
14370 : see if getpwent exists
14371 set getpwent d_getpwent
14372 eval $inlibc
14373
14374 : see if getpwent_r exists
14375 set getpwent_r d_getpwent_r
14376 eval $inlibc
14377 case "$d_getpwent_r" in
14378 "$define")
14379         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14380         case "$d_getpwent_r_proto:$usethreads" in
14381         ":define")      d_getpwent_r_proto=define
14382                 set d_getpwent_r_proto getpwent_r $hdrs
14383                 eval $hasproto ;;
14384         *)      ;;
14385         esac
14386         case "$d_getpwent_r_proto" in
14387         define)
14388         case "$getpwent_r_proto" in
14389         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14390         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14391         esac
14392         case "$getpwent_r_proto" in
14393         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14394         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14395         esac
14396         case "$getpwent_r_proto" in
14397         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14398         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14399         esac
14400         case "$getpwent_r_proto" in
14401         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14402         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14403         esac
14404         case "$getpwent_r_proto" in
14405         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14406         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14407         esac
14408         case "$getpwent_r_proto" in
14409         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14410         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14411         esac
14412         case "$getpwent_r_proto" in
14413         ''|0)   d_getpwent_r=undef
14414                 getpwent_r_proto=0
14415                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14416         * )     case "$getpwent_r_proto" in
14417                 REENTRANT_PROTO*) ;;
14418                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14419                 esac
14420                 echo "Prototype: $try" ;;
14421         esac
14422         ;;
14423         *)      case "$usethreads" in
14424                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14425                 esac
14426                 d_getpwent_r=undef
14427                 getpwent_r_proto=0
14428                 ;;
14429         esac
14430         ;;
14431 *)      getpwent_r_proto=0
14432         ;;
14433 esac
14434
14435 : see if getpwnam_r exists
14436 set getpwnam_r d_getpwnam_r
14437 eval $inlibc
14438 case "$d_getpwnam_r" in
14439 "$define")
14440         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14441         case "$d_getpwnam_r_proto:$usethreads" in
14442         ":define")      d_getpwnam_r_proto=define
14443                 set d_getpwnam_r_proto getpwnam_r $hdrs
14444                 eval $hasproto ;;
14445         *)      ;;
14446         esac
14447         case "$d_getpwnam_r_proto" in
14448         define)
14449         case "$getpwnam_r_proto" in
14450         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14451         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14452         esac
14453         case "$getpwnam_r_proto" in
14454         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14455         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14456         esac
14457         case "$getpwnam_r_proto" in
14458         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14459         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14460         esac
14461         case "$getpwnam_r_proto" in
14462         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14463         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14464         esac
14465         case "$getpwnam_r_proto" in
14466         ''|0)   d_getpwnam_r=undef
14467                 getpwnam_r_proto=0
14468                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14469         * )     case "$getpwnam_r_proto" in
14470                 REENTRANT_PROTO*) ;;
14471                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14472                 esac
14473                 echo "Prototype: $try" ;;
14474         esac
14475         ;;
14476         *)      case "$usethreads" in
14477                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14478                 esac
14479                 d_getpwnam_r=undef
14480                 getpwnam_r_proto=0
14481                 ;;
14482         esac
14483         ;;
14484 *)      getpwnam_r_proto=0
14485         ;;
14486 esac
14487
14488 : see if getpwuid_r exists
14489 set getpwuid_r d_getpwuid_r
14490 eval $inlibc
14491 case "$d_getpwuid_r" in
14492 "$define")
14493         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14494         case "$d_getpwuid_r_proto:$usethreads" in
14495         ":define")      d_getpwuid_r_proto=define
14496                 set d_getpwuid_r_proto getpwuid_r $hdrs
14497                 eval $hasproto ;;
14498         *)      ;;
14499         esac
14500         case "$d_getpwuid_r_proto" in
14501         define)
14502         case "$getpwuid_r_proto" in
14503         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14504         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14505         esac
14506         case "$getpwuid_r_proto" in
14507         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14508         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14509         esac
14510         case "$getpwuid_r_proto" in
14511         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14512         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14513         esac
14514         case "$getpwuid_r_proto" in
14515         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14516         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14517         esac
14518         case "$getpwuid_r_proto" in
14519         ''|0)   d_getpwuid_r=undef
14520                 getpwuid_r_proto=0
14521                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14522         * )     case "$getpwuid_r_proto" in
14523                 REENTRANT_PROTO*) ;;
14524                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14525                 esac
14526                 echo "Prototype: $try" ;;
14527         esac
14528         ;;
14529         *)      case "$usethreads" in
14530                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14531                 esac
14532                 d_getpwuid_r=undef
14533                 getpwuid_r_proto=0
14534                 ;;
14535         esac
14536         ;;
14537 *)      getpwuid_r_proto=0
14538         ;;
14539 esac
14540
14541 : Optional checks for getsbyname and getsbyport
14542
14543 : see if getservbyname exists
14544 set getservbyname d_getsbyname
14545 eval $inlibc
14546
14547 : see if getservbyport exists
14548 set getservbyport d_getsbyport
14549 eval $inlibc
14550
14551 : see if getservent exists
14552 set getservent d_getsent
14553 eval $inlibc
14554
14555 : see if getservbyname_r exists
14556 set getservbyname_r d_getservbyname_r
14557 eval $inlibc
14558 case "$d_getservbyname_r" in
14559 "$define")
14560         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14561         case "$d_getservbyname_r_proto:$usethreads" in
14562         ":define")      d_getservbyname_r_proto=define
14563                 set d_getservbyname_r_proto getservbyname_r $hdrs
14564                 eval $hasproto ;;
14565         *)      ;;
14566         esac
14567         case "$d_getservbyname_r_proto" in
14568         define)
14569         case "$getservbyname_r_proto" in
14570         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14571         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14572         esac
14573         case "$getservbyname_r_proto" in
14574         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14575         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14576         esac
14577         case "$getservbyname_r_proto" in
14578         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14579         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14580         esac
14581         case "$getservbyname_r_proto" in
14582         ''|0)   d_getservbyname_r=undef
14583                 getservbyname_r_proto=0
14584                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14585         * )     case "$getservbyname_r_proto" in
14586                 REENTRANT_PROTO*) ;;
14587                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14588                 esac
14589                 echo "Prototype: $try" ;;
14590         esac
14591         ;;
14592         *)      case "$usethreads" in
14593                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14594                 esac
14595                 d_getservbyname_r=undef
14596                 getservbyname_r_proto=0
14597                 ;;
14598         esac
14599         ;;
14600 *)      getservbyname_r_proto=0
14601         ;;
14602 esac
14603
14604 : see if getservbyport_r exists
14605 set getservbyport_r d_getservbyport_r
14606 eval $inlibc
14607 case "$d_getservbyport_r" in
14608 "$define")
14609         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14610         case "$d_getservbyport_r_proto:$usethreads" in
14611         ":define")      d_getservbyport_r_proto=define
14612                 set d_getservbyport_r_proto getservbyport_r $hdrs
14613                 eval $hasproto ;;
14614         *)      ;;
14615         esac
14616         case "$d_getservbyport_r_proto" in
14617         define)
14618         case "$getservbyport_r_proto" in
14619         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14620         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14621         esac
14622         case "$getservbyport_r_proto" in
14623         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14624         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14625         esac
14626         case "$getservbyport_r_proto" in
14627         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14628         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14629         esac
14630         case "$getservbyport_r_proto" in
14631         ''|0)   d_getservbyport_r=undef
14632                 getservbyport_r_proto=0
14633                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14634         * )     case "$getservbyport_r_proto" in
14635                 REENTRANT_PROTO*) ;;
14636                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14637                 esac
14638                 echo "Prototype: $try" ;;
14639         esac
14640         ;;
14641         *)      case "$usethreads" in
14642                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14643                 esac
14644                 d_getservbyport_r=undef
14645                 getservbyport_r_proto=0
14646                 ;;
14647         esac
14648         ;;
14649 *)      getservbyport_r_proto=0
14650         ;;
14651 esac
14652
14653 : see if getservent_r exists
14654 set getservent_r d_getservent_r
14655 eval $inlibc
14656 case "$d_getservent_r" in
14657 "$define")
14658         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14659         case "$d_getservent_r_proto:$usethreads" in
14660         ":define")      d_getservent_r_proto=define
14661                 set d_getservent_r_proto getservent_r $hdrs
14662                 eval $hasproto ;;
14663         *)      ;;
14664         esac
14665         case "$d_getservent_r_proto" in
14666         define)
14667         case "$getservent_r_proto" in
14668         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14669         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14670         esac
14671         case "$getservent_r_proto" in
14672         ''|0) try='int getservent_r(struct servent*, char*, int);'
14673         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14674         esac
14675         case "$getservent_r_proto" in
14676         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14677         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14678         esac
14679         case "$getservent_r_proto" in
14680         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14681         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14682         esac
14683         case "$getservent_r_proto" in
14684         ''|0)   d_getservent_r=undef
14685                 getservent_r_proto=0
14686                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14687         * )     case "$getservent_r_proto" in
14688                 REENTRANT_PROTO*) ;;
14689                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14690                 esac
14691                 echo "Prototype: $try" ;;
14692         esac
14693         ;;
14694         *)      case "$usethreads" in
14695                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14696                 esac
14697                 d_getservent_r=undef
14698                 getservent_r_proto=0
14699                 ;;
14700         esac
14701         ;;
14702 *)      getservent_r_proto=0
14703         ;;
14704 esac
14705
14706 : see if prototypes for various getservxxx netdb.h functions are available
14707 echo " "
14708 set d_getservprotos getservent $i_netdb netdb.h
14709 eval $hasproto
14710
14711 : see if getspnam exists
14712 set getspnam d_getspnam
14713 eval $inlibc
14714
14715 : see if this is a shadow.h system
14716 set shadow.h i_shadow
14717 eval $inhdr
14718
14719 : see if getspnam_r exists
14720 set getspnam_r d_getspnam_r
14721 eval $inlibc
14722 case "$d_getspnam_r" in
14723 "$define")
14724         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14725         case "$d_getspnam_r_proto:$usethreads" in
14726         ":define")      d_getspnam_r_proto=define
14727                 set d_getspnam_r_proto getspnam_r $hdrs
14728                 eval $hasproto ;;
14729         *)      ;;
14730         esac
14731         case "$d_getspnam_r_proto" in
14732         define)
14733         case "$getspnam_r_proto" in
14734         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14735         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14736         esac
14737         case "$getspnam_r_proto" in
14738         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14739         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14740         esac
14741         case "$getspnam_r_proto" in
14742         ''|0)   d_getspnam_r=undef
14743                 getspnam_r_proto=0
14744                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14745         * )     case "$getspnam_r_proto" in
14746                 REENTRANT_PROTO*) ;;
14747                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14748                 esac
14749                 echo "Prototype: $try" ;;
14750         esac
14751         ;;
14752         *)      case "$usethreads" in
14753                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14754                 esac
14755                 d_getspnam_r=undef
14756                 getspnam_r_proto=0
14757                 ;;
14758         esac
14759         ;;
14760 *)      getspnam_r_proto=0
14761         ;;
14762 esac
14763
14764 : see if gettimeofday or ftime exists
14765 set gettimeofday d_gettimeod
14766 eval $inlibc
14767 case "$d_gettimeod" in
14768 "$undef")
14769         set ftime d_ftime 
14770         eval $inlibc
14771         ;;
14772 *)
14773         val="$undef"; set d_ftime; eval $setvar
14774         ;;
14775 esac
14776 case "$d_gettimeod$d_ftime" in
14777 "$undef$undef")
14778         echo " "
14779         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14780         ;;
14781 esac
14782
14783 : see if gmtime_r exists
14784 set gmtime_r d_gmtime_r
14785 eval $inlibc
14786 case "$d_gmtime_r" in
14787 "$define")
14788         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14789         case "$d_gmtime_r_proto:$usethreads" in
14790         ":define")      d_gmtime_r_proto=define
14791                 set d_gmtime_r_proto gmtime_r $hdrs
14792                 eval $hasproto ;;
14793         *)      ;;
14794         esac
14795         case "$d_gmtime_r_proto" in
14796         define)
14797         case "$gmtime_r_proto" in
14798         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14799         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14800         esac
14801         case "$gmtime_r_proto" in
14802         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14803         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14804         esac
14805         case "$gmtime_r_proto" in
14806         ''|0)   d_gmtime_r=undef
14807                 gmtime_r_proto=0
14808                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14809         * )     case "$gmtime_r_proto" in
14810                 REENTRANT_PROTO*) ;;
14811                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14812                 esac
14813                 echo "Prototype: $try" ;;
14814         esac
14815         ;;
14816         *)      case "$usethreads" in
14817                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14818                 esac
14819                 d_gmtime_r=undef
14820                 gmtime_r_proto=0
14821                 ;;
14822         esac
14823         ;;
14824 *)      gmtime_r_proto=0
14825         ;;
14826 esac
14827
14828 : see if hasmntopt exists
14829 set hasmntopt d_hasmntopt
14830 eval $inlibc
14831
14832 : see if this is a netinet/in.h or sys/in.h system
14833 set netinet/in.h i_niin sys/in.h i_sysin
14834 eval $inhdr
14835
14836 : see if arpa/inet.h has to be included
14837 set arpa/inet.h i_arpainet
14838 eval $inhdr
14839
14840 : see if htonl --and friends-- exists
14841 val=''
14842 set htonl val
14843 eval $inlibc
14844
14845 : Maybe they are macros.
14846 case "$val" in
14847 $undef)
14848         $cat >htonl.c <<EOM
14849 #include <stdio.h>
14850 #include <sys/types.h>
14851 #$i_niin I_NETINET_IN
14852 #$i_sysin I_SYS_IN
14853 #$i_arpainet I_ARPA_INET
14854 #ifdef I_NETINET_IN
14855 #include <netinet/in.h>
14856 #endif
14857 #ifdef I_SYS_IN
14858 #include <sys/in.h>
14859 #endif
14860 #ifdef I_ARPA_INET
14861 #include <arpa/inet.h>
14862 #endif
14863 #ifdef htonl
14864 printf("Defined as a macro.");
14865 #endif
14866 EOM
14867         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14868         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14869                 val="$define"
14870                 echo "But it seems to be defined as a macro." >&4
14871         fi
14872         $rm -f htonl.?
14873         ;;
14874 esac
14875 set d_htonl
14876 eval $setvar
14877
14878 : see if ilogbl exists
14879 set ilogbl d_ilogbl
14880 eval $inlibc
14881
14882 : index or strchr
14883 echo " "
14884 if set index val -f; eval $csym; $val; then
14885         if set strchr val -f d_strchr; eval $csym; $val; then
14886                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14887                         val="$define"
14888                         vali="$undef"
14889                         echo "strchr() found." >&4
14890                 else
14891                         val="$undef"
14892                         vali="$define"
14893                         echo "index() found." >&4
14894                 fi
14895         else
14896                 val="$undef"
14897                 vali="$define"
14898                 echo "index() found." >&4
14899         fi
14900 else
14901         if set strchr val -f d_strchr; eval $csym; $val; then
14902                 val="$define"
14903                 vali="$undef"
14904                 echo "strchr() found." >&4
14905         else
14906                 echo "No index() or strchr() found!" >&4
14907                 val="$undef"
14908                 vali="$undef"
14909         fi
14910 fi
14911 set d_strchr; eval $setvar
14912 val="$vali"
14913 set d_index; eval $setvar
14914
14915 : check whether inet_aton exists
14916 set inet_aton d_inetaton
14917 eval $inlibc
14918
14919 : see if inet_ntop exists
14920 set inet_ntop d_inetntop
14921 eval $inlibc
14922
14923 : see if inet_pton exists
14924 set inet_pton d_inetpton
14925 eval $inlibc
14926
14927 : Look for isascii
14928 echo " "
14929 $cat >isascii.c <<EOCP
14930 #include <stdio.h>
14931 #include <ctype.h>
14932 #$i_stdlib I_STDLIB
14933 #ifdef I_STDLIB
14934 #include <stdlib.h>
14935 #endif
14936 int main() {
14937         int c = 'A';
14938         if (isascii(c))
14939                 exit(0);
14940         else
14941                 exit(1);
14942 }
14943 EOCP
14944 set isascii
14945 if eval $compile; then
14946         echo "isascii() found." >&4
14947         val="$define"
14948 else
14949         echo "isascii() NOT found." >&4
14950         val="$undef"
14951 fi
14952 set d_isascii
14953 eval $setvar
14954 $rm -f isascii*
14955
14956 : see if isfinite exists
14957 set isfinite d_isfinite
14958 eval $inlibc
14959
14960 : see if isinf exists
14961 set isinf d_isinf
14962 eval $inlibc
14963
14964 : see if isnan exists
14965 set isnan d_isnan
14966 eval $inlibc
14967
14968 : see if isnanl exists
14969 set isnanl d_isnanl
14970 eval $inlibc
14971
14972 : see if killpg exists
14973 set killpg d_killpg
14974 eval $inlibc
14975
14976 : see if lchown exists
14977 echo " "
14978 $cat > try.c <<'EOCP'
14979 /* System header to define __stub macros and hopefully few prototypes,
14980     which can conflict with char lchown(); below.  */
14981 #include <assert.h>
14982 /* Override any gcc2 internal prototype to avoid an error.  */
14983 /* We use char because int might match the return type of a gcc2
14984    builtin and then its argument prototype would still apply.  */
14985 char lchown();
14986 int main() {
14987     /*  The GNU C library defines this for functions which it implements
14988         to always fail with ENOSYS.  Some functions are actually named
14989         something starting with __ and the normal name is an alias.  */
14990 #if defined (__stub_lchown) || defined (__stub___lchown)
14991 choke me
14992 #else
14993 lchown();
14994 #endif
14995 ; return 0; }
14996 EOCP
14997 set try
14998 if eval $compile; then
14999     $echo "lchown() found." >&4
15000     val="$define"
15001 else
15002     $echo "lchown() NOT found." >&4
15003     val="$undef"
15004 fi
15005 set d_lchown
15006 eval $setvar
15007
15008 : See if number of significant digits in a double precision number is known
15009 echo " "
15010 $cat >ldbl_dig.c <<EOM
15011 #$i_limits I_LIMITS
15012 #$i_float I_FLOAT
15013 #ifdef I_LIMITS
15014 #include <limits.h>
15015 #endif
15016 #ifdef I_FLOAT
15017 #include <float.h>
15018 #endif
15019 #ifdef LDBL_DIG
15020 printf("Contains LDBL_DIG");
15021 #endif
15022 EOM
15023 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15024 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15025         echo "LDBL_DIG found." >&4
15026         val="$define"
15027 else
15028         echo "LDBL_DIG NOT found." >&4
15029         val="$undef"
15030 fi
15031 $rm -f ldbl_dig.?
15032 set d_ldbl_dig
15033 eval $setvar
15034
15035 : see if this is a math.h system
15036 set math.h i_math
15037 eval $inhdr
15038
15039 : check to see if math.h defines _LIB_VERSION
15040 d_libm_lib_version="$undef"
15041 case $i_math in
15042     $define)
15043         echo " "
15044         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15045         $cat >try.c <<EOCP
15046 #include <unistd.h>
15047 #include <math.h>
15048 int main (int argc, char *argv[])
15049 {
15050     printf ("%d\n", _LIB_VERSION);
15051     return (0);
15052     } /* main */
15053 EOCP
15054         set try
15055         if eval $compile; then
15056             foo=`$run ./try`
15057             echo "Yes, it does ($foo)" >&4
15058             d_libm_lib_version="$define"
15059         else
15060             echo "No, it does not (probably harmless)" >&4
15061             fi
15062         $rm_try
15063         ;;
15064
15065     esac
15066
15067 : see if link exists
15068 set link d_link
15069 eval $inlibc
15070
15071 : see if localtime_r exists
15072 set localtime_r d_localtime_r
15073 eval $inlibc
15074 case "$d_localtime_r" in
15075 "$define")
15076         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15077         case "$d_localtime_r_proto:$usethreads" in
15078         ":define")      d_localtime_r_proto=define
15079                 set d_localtime_r_proto localtime_r $hdrs
15080                 eval $hasproto ;;
15081         *)      ;;
15082         esac
15083         case "$d_localtime_r_proto" in
15084         define)
15085         case "$localtime_r_proto" in
15086         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15087         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15088         esac
15089         case "$localtime_r_proto" in
15090         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15091         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15092         esac
15093         case "$localtime_r_proto" in
15094         ''|0)   d_localtime_r=undef
15095                 localtime_r_proto=0
15096                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15097         * )     case "$localtime_r_proto" in
15098                 REENTRANT_PROTO*) ;;
15099                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15100                 esac
15101                 echo "Prototype: $try" ;;
15102         esac
15103         ;;
15104         *)      case "$usethreads" in
15105                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15106                 esac
15107                 d_localtime_r=undef
15108                 localtime_r_proto=0
15109                 ;;
15110         esac
15111         ;;
15112 *)      localtime_r_proto=0
15113         ;;
15114 esac
15115
15116 : see if localtime_r calls tzset
15117 case "$localtime_r_proto" in
15118 REENTRANT_PROTO*)
15119         $cat >try.c <<EOCP
15120 /*  Does our libc's localtime_r call tzset ?
15121  *  return 0 if so, 1 otherwise.
15122  */
15123 #$i_systypes    I_SYS_TYPES
15124 #$i_unistd      I_UNISTD
15125 #$i_time        I_TIME
15126 #$i_stdlib      I_STDLIB
15127 #$i_string      I_STRING
15128 #$i_malloc      I_MALLOC
15129 #ifdef I_SYS_TYPES
15130 #  include <sys/types.h>
15131 #endif
15132 #ifdef I_UNISTD
15133 #  include <unistd.h>
15134 #endif
15135 #ifdef I_TIME
15136 #  include <time.h>
15137 #endif
15138 #ifdef I_STDLIB
15139 #include <stdlib.h>
15140 #endif
15141 #ifdef I_STRING
15142 #  include <string.h>
15143 #else
15144 #  include <strings.h>
15145 #endif
15146 #ifdef I_MALLOC
15147 #  include <malloc.h>
15148 #endif
15149 int main()
15150 {
15151     time_t t = time(0L);
15152     char w_tz[]="TZ" "=GMT+5",
15153          e_tz[]="TZ" "=GMT-5",
15154         *tz_e = (char*)malloc(16),
15155         *tz_w = (char*)malloc(16);
15156     struct tm tm_e, tm_w;
15157     memset(&tm_e,'\0',sizeof(struct tm));
15158     memset(&tm_w,'\0',sizeof(struct tm));
15159     strcpy(tz_e,e_tz);
15160     strcpy(tz_w,w_tz);
15161
15162     putenv(tz_e);
15163     localtime_r(&t, &tm_e);
15164
15165     putenv(tz_w);
15166     localtime_r(&t, &tm_w);
15167
15168     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15169         return 1;
15170     return 0;
15171 }
15172 EOCP
15173         set try
15174         if eval $compile; then
15175             if $run ./try; then
15176                 d_localtime_r_needs_tzset=undef;
15177             else
15178                 d_localtime_r_needs_tzset=define;
15179             fi;
15180         else
15181             d_localtime_r_needs_tzset=undef;
15182         fi;
15183      ;;
15184   *)
15185      d_localtime_r_needs_tzset=undef;
15186      ;;
15187 esac
15188 $rm_try
15189
15190 : see if localeconv exists
15191 set localeconv d_locconv
15192 eval $inlibc
15193
15194 : see if lockf exists
15195 set lockf d_lockf
15196 eval $inlibc
15197
15198 : see if prototype for lseek is available
15199 echo " "
15200 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15201 eval $hasproto
15202
15203 : see if lstat exists
15204 set lstat d_lstat
15205 eval $inlibc
15206
15207 : see if madvise exists
15208 set madvise d_madvise
15209 eval $inlibc
15210
15211 : see if malloc_size exists
15212 set malloc_size d_malloc_size
15213 eval $inlibc
15214
15215 : see if malloc_size_good exists
15216 set malloc_good_size d_malloc_good_size
15217 eval $inlibc
15218
15219 : see if mblen exists
15220 set mblen d_mblen
15221 eval $inlibc
15222
15223 : see if mbstowcs exists
15224 set mbstowcs d_mbstowcs
15225 eval $inlibc
15226
15227 : see if mbtowc exists
15228 set mbtowc d_mbtowc
15229 eval $inlibc
15230
15231 : see if memchr exists
15232 set memchr d_memchr
15233 eval $inlibc
15234
15235 : see if memcmp exists
15236 set memcmp d_memcmp
15237 eval $inlibc
15238
15239 : see if memcpy exists
15240 set memcpy d_memcpy
15241 eval $inlibc
15242
15243 : see if memmove exists
15244 set memmove d_memmove
15245 eval $inlibc
15246
15247 : see if memset exists
15248 set memset d_memset
15249 eval $inlibc
15250
15251 : see if mkdir exists
15252 set mkdir d_mkdir
15253 eval $inlibc
15254
15255 : see if mkdtemp exists
15256 set mkdtemp d_mkdtemp
15257 eval $inlibc
15258
15259 : see if mkfifo exists
15260 set mkfifo d_mkfifo
15261 eval $inlibc
15262
15263 : see if mkstemp exists
15264 set mkstemp d_mkstemp
15265 eval $inlibc
15266
15267 : see if mkstemps exists
15268 set mkstemps d_mkstemps
15269 eval $inlibc
15270
15271 : see if mktime exists
15272 set mktime d_mktime
15273 eval $inlibc
15274
15275 : see if this is a sys/mman.h system
15276 set sys/mman.h i_sysmman
15277 eval $inhdr
15278
15279 : see if mmap exists
15280 set mmap d_mmap
15281 eval $inlibc
15282 : see what shmat returns
15283 : default to something harmless
15284 mmaptype='void *'
15285 case "$i_sysmman$d_mmap" in
15286 "$define$define")
15287         $cat >mmap.c <<'END'
15288 #include <sys/mman.h>
15289 void *mmap();
15290 END
15291         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15292                 mmaptype='void *'
15293         else
15294                 mmaptype='caddr_t'
15295         fi
15296         echo "and it returns ($mmaptype)." >&4
15297         ;;
15298 esac
15299
15300
15301
15302 : see if sqrtl exists
15303 set sqrtl d_sqrtl
15304 eval $inlibc
15305
15306 : see if scalbnl exists
15307 set scalbnl d_scalbnl
15308 eval $inlibc
15309
15310 : see if modfl exists
15311 set modfl d_modfl
15312 eval $inlibc
15313
15314 : see if prototype for modfl is available
15315 echo " "
15316 set d_modflproto modfl $i_math math.h
15317 eval $hasproto
15318
15319 d_modfl_pow32_bug="$undef"
15320
15321 case "$d_longdbl$d_modfl" in
15322 $define$define)
15323         $cat <<EOM
15324 Checking to see whether your modfl() is okay for large values...
15325 EOM
15326 $cat >try.c <<EOCP
15327 #include <math.h>
15328 #include <stdio.h>
15329 EOCP
15330 if $test "X$d_modflproto" != "X$define"; then
15331         $cat >>try.c <<EOCP
15332 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15333 long double modfl (long double, long double *);
15334 EOCP
15335 fi
15336 $cat >>try.c <<EOCP
15337 int main() {
15338     long double nv = 4294967303.15;
15339     long double v, w;
15340     v = modfl(nv, &w);
15341 #ifdef __GLIBC__
15342     printf("glibc");
15343 #endif
15344     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15345     return 0;
15346 }
15347 EOCP
15348         case "$osname:$gccversion" in
15349         aix:)   saveccflags="$ccflags"
15350                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15351         esac
15352         set try
15353         if eval $compile; then
15354                 foo=`$run ./try`
15355                 case "$foo" in
15356                 *" 4294967303.150000 1.150000 4294967302.000000")
15357                         echo >&4 "Your modfl() is broken for large values."
15358                         d_modfl_pow32_bug="$define"
15359                         case "$foo" in
15360                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15361                         ;;
15362                         esac
15363                         ;;
15364                 *" 4294967303.150000 0.150000 4294967303.000000")
15365                         echo >&4 "Your modfl() seems okay for large values."
15366                         ;;
15367                 *)      echo >&4 "I don't understand your modfl() at all."
15368                         d_modfl="$undef"
15369                         ;;
15370                 esac
15371                 $rm_try
15372         else
15373                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15374                 d_modfl="$undef"
15375         fi
15376         case "$osname:$gccversion" in
15377         aix:)   ccflags="$saveccflags" ;; # restore
15378         esac
15379         ;;
15380 esac
15381
15382 if $test "$uselongdouble" = "$define"; then
15383     message=""
15384     if $test "$d_sqrtl" != "$define"; then
15385         message="$message sqrtl"
15386     fi
15387     if $test "$d_modfl" != "$define"; then
15388         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15389             echo "You have both aintl and copysignl, so I can emulate modfl."
15390         else
15391             message="$message modfl"
15392         fi
15393     fi
15394     if $test "$d_frexpl" != "$define"; then
15395         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15396             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15397         else
15398             message="$message frexpl"
15399         fi
15400     fi
15401
15402     if $test "$message" != ""; then
15403         $cat <<EOM >&4
15404
15405 *** You requested the use of long doubles but you do not seem to have
15406 *** the following mathematical functions needed for long double support:
15407 ***    $message
15408 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15409 *** Cannot continue, aborting.
15410
15411 EOM
15412
15413         exit 1
15414     fi
15415 fi
15416
15417 : see if mprotect exists
15418 set mprotect d_mprotect
15419 eval $inlibc
15420
15421 : see if msgctl exists
15422 set msgctl d_msgctl
15423 eval $inlibc
15424
15425 : see if msgget exists
15426 set msgget d_msgget
15427 eval $inlibc
15428
15429 : see if msgsnd exists
15430 set msgsnd d_msgsnd
15431 eval $inlibc
15432
15433 : see if msgrcv exists
15434 set msgrcv d_msgrcv
15435 eval $inlibc
15436
15437 : see how much of the 'msg*(2)' library is present.
15438 h_msg=true
15439 echo " "
15440 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15441 *"$undef"*) h_msg=false;;
15442 esac
15443 case "$osname" in
15444 freebsd)
15445     case "`ipcs 2>&1`" in
15446     "SVID messages"*"not configured"*)
15447         echo "Your $osname does not have the msg*(2) configured." >&4
15448         h_msg=false
15449         val="$undef"
15450         set msgctl d_msgctl
15451         eval $setvar
15452         set msgget d_msgget
15453         eval $setvar
15454         set msgsnd d_msgsnd
15455         eval $setvar
15456         set msgrcv d_msgrcv
15457         eval $setvar
15458         ;;
15459     esac
15460     ;;
15461 esac
15462 : we could also check for sys/ipc.h ...
15463 if $h_msg && $test `./findhdr sys/msg.h`; then
15464         echo "You have the full msg*(2) library." >&4
15465         val="$define"
15466 else
15467         echo "You don't have the full msg*(2) library." >&4
15468         val="$undef"
15469 fi
15470 set d_msg
15471 eval $setvar
15472
15473 : Check for msghdr_s
15474 echo " "
15475 echo "Checking to see if your system supports struct msghdr..." >&4
15476 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15477 eval $hasstruct
15478 case "$d_msghdr_s" in
15479 "$define")      echo "Yes, it does."   ;;
15480 *)              echo "No, it doesn't." ;;
15481 esac
15482
15483
15484 : see if msync exists
15485 set msync d_msync
15486 eval $inlibc
15487
15488 : see if munmap exists
15489 set munmap d_munmap
15490 eval $inlibc
15491
15492 : see if nice exists
15493 set nice d_nice
15494 eval $inlibc
15495
15496 : see if this is a langinfo.h system
15497 set langinfo.h i_langinfo
15498 eval $inhdr
15499
15500 : see if nl_langinfo exists
15501 set nl_langinfo d_nl_langinfo
15502 eval $inlibc
15503
15504 : check for volatile keyword
15505 echo " "
15506 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15507 $cat >try.c <<'EOCP'
15508 int main()
15509 {
15510         typedef struct _goo_struct goo_struct;
15511         goo_struct * volatile goo = ((goo_struct *)0);
15512         struct _goo_struct {
15513                 long long_int;
15514                 int reg_int;
15515                 char char_var;
15516         };
15517         typedef unsigned short foo_t;
15518         char *volatile foo;
15519         volatile int bar;
15520         volatile foo_t blech;
15521         foo = foo;
15522 }
15523 EOCP
15524 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15525         val="$define"
15526         echo "Yup, it does."
15527 else
15528         val="$undef"
15529         echo "Nope, it doesn't."
15530 fi
15531 set d_volatile
15532 eval $setvar
15533 $rm_try
15534
15535 : Check basic sizes
15536 echo " "
15537 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15538
15539 case "$use64bitint:$d_quad:$quadtype" in
15540 define:define:?*)
15541         ivtype="$quadtype"
15542         uvtype="$uquadtype"
15543         ivsize=8
15544         uvsize=8
15545         ;;
15546 *)      ivtype="long"
15547         uvtype="unsigned long"
15548         ivsize=$longsize
15549         uvsize=$longsize
15550         ;;
15551 esac
15552
15553 case "$uselongdouble:$d_longdbl" in
15554 define:define)
15555         nvtype="long double"
15556         nvsize=$longdblsize
15557         ;;
15558 *)      nvtype=double
15559         nvsize=$doublesize
15560         ;;
15561 esac
15562
15563 $echo "(IV will be "$ivtype", $ivsize bytes)"
15564 $echo "(UV will be "$uvtype", $uvsize bytes)"
15565 $echo "(NV will be "$nvtype", $nvsize bytes)"
15566
15567 $cat >try.c <<EOCP
15568 #$i_inttypes I_INTTYPES
15569 #ifdef I_INTTYPES
15570 #include <inttypes.h>
15571 #endif
15572 #include <stdio.h>
15573 int main() {
15574 #ifdef INT8
15575    int8_t i =  INT8_MAX;
15576   uint8_t u = UINT8_MAX;
15577   printf("int8_t\n");
15578 #endif
15579 #ifdef INT16
15580    int16_t i =  INT16_MAX;
15581   uint16_t i = UINT16_MAX;
15582   printf("int16_t\n");
15583 #endif
15584 #ifdef INT32
15585    int32_t i =  INT32_MAX;
15586   uint32_t u = UINT32_MAX;
15587   printf("int32_t\n");
15588 #endif
15589 }
15590 EOCP
15591
15592 i8type="signed char"
15593 u8type="unsigned char"
15594 i8size=1
15595 u8size=1
15596
15597 case "$i16type" in
15598 '')     case "$shortsize" in
15599         2)      i16type=short
15600                 u16type="unsigned short"
15601                 i16size=$shortsize
15602                 u16size=$shortsize
15603                 ;;
15604         esac
15605         ;;
15606 esac
15607 case "$i16type" in
15608 '')     set try -DINT16
15609         if eval $compile; then
15610                 case "`$run ./try`" in
15611                 int16_t)
15612                         i16type=int16_t
15613                         u16type=uint16_t
15614                         i16size=2
15615                         u16size=2
15616                         ;;
15617                 esac
15618         fi
15619         ;;
15620 esac
15621 case "$i16type" in
15622 '')     if $test $shortsize -ge 2; then
15623                 i16type=short
15624                 u16type="unsigned short"
15625                 i16size=$shortsize
15626                 u16size=$shortsize
15627         fi
15628         ;;
15629 esac
15630
15631 case "$i32type" in
15632 '')     case "$longsize" in
15633         4)      i32type=long
15634                 u32type="unsigned long"
15635                 i32size=$longsize
15636                 u32size=$longsize
15637                 ;;
15638         *)      case "$intsize" in
15639                 4)      i32type=int
15640                         u32type="unsigned int"
15641                         i32size=$intsize
15642                         u32size=$intsize
15643                         ;;
15644                 esac
15645                 ;;
15646         esac
15647         ;;
15648 esac
15649 case "$i32type" in
15650 '')     set try -DINT32
15651         if eval $compile; then
15652                 case "`$run ./try`" in
15653                 int32_t)
15654                         i32type=int32_t
15655                         u32type=uint32_t
15656                         i32size=4
15657                         u32size=4
15658                         ;;
15659                 esac
15660         fi
15661         ;;
15662 esac
15663 case "$i32type" in
15664 '')     if $test $intsize -ge 4; then
15665                 i32type=int
15666                 u32type="unsigned int"
15667                 i32size=$intsize
15668                 u32size=$intsize
15669         fi
15670         ;;
15671 esac
15672
15673 case "$i64type" in
15674 '')     case "$d_quad:$quadtype" in
15675         define:?*)
15676                 i64type="$quadtype"
15677                 u64type="$uquadtype"
15678                 i64size=8
15679                 u64size=8
15680                 ;;
15681         esac
15682         ;;
15683 esac
15684
15685 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15686 : volatile so that the compiler has to store it out to memory.
15687 if test X"$d_volatile" = X"$define"; then
15688         volatile=volatile
15689 fi
15690 $cat <<EOP >try.c
15691 #include <stdio.h>
15692 #$i_stdlib I_STDLIB
15693 #ifdef I_STDLIB
15694 #include <stdlib.h>
15695 #endif
15696 #include <sys/types.h>
15697 #include <signal.h>
15698 #ifdef SIGFPE
15699 $volatile int bletched = 0;
15700 $signal_t blech(int s) { bletched = 1; }
15701 #endif
15702 int main() {
15703     $uvtype u = 0;
15704     $nvtype d;
15705     int     n = 8 * $uvsize;
15706     int     i;
15707 #ifdef SIGFPE
15708     signal(SIGFPE, blech);
15709 #endif
15710
15711     for (i = 0; i < n; i++) {
15712       u = u << 1 | ($uvtype)1;
15713       d = ($nvtype)u;
15714       if (($uvtype)d != u)
15715         break;
15716       if (d <= 0)
15717         break;
15718       d = ($nvtype)(u - 1);
15719       if (($uvtype)d != (u - 1))
15720         break;
15721 #ifdef SIGFPE
15722       if (bletched)
15723         break;
15724 #endif
15725     }
15726     printf("%d\n", ((i == n) ? -n : i));
15727     exit(0);
15728 }
15729 EOP
15730 set try
15731
15732 d_nv_preserves_uv="$undef"
15733 if eval $compile; then
15734         nv_preserves_uv_bits="`$run ./try`"
15735 fi
15736 case "$nv_preserves_uv_bits" in
15737 \-[1-9]*)
15738         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15739         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15740         d_nv_preserves_uv="$define"
15741         ;;
15742 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15743         d_nv_preserves_uv="$undef" ;;
15744 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15745         nv_preserves_uv_bits="0" ;;
15746 esac
15747 $rm_try
15748
15749 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15750 : volatile so that the compiler has to store it out to memory.
15751 if test X"$d_volatile" = X"$define"; then
15752         volatile=volatile
15753 fi
15754 $cat <<EOP >try.c
15755 #include <stdio.h>
15756
15757 typedef $nvtype NV;
15758
15759 int
15760 main() {
15761   NV value = 2;
15762   int count = 1;
15763
15764   while(count < 256) {
15765     $volatile NV up = value + 1.0;
15766     $volatile NV negated = -value;
15767     $volatile NV down = negated - 1.0;
15768     $volatile NV got_up = up - value;
15769     int up_good = got_up == 1.0;
15770     int got_down = down - negated;
15771     int down_good = got_down == -1.0;
15772
15773     if (down_good != up_good) {
15774       fprintf(stderr,
15775               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15776               up_good, (double) got_up, down_good, (double) got_down,
15777               count, (double) value);
15778       return 1;
15779     }
15780     if (!up_good) {
15781       while (1) {
15782         if (count > 8) {
15783           count -= 8;
15784           fputs("256.0", stdout);
15785         } else {
15786           count--;
15787           fputs("2.0", stdout);
15788         }
15789         if (!count) {
15790           puts("");
15791           return 0;
15792         }
15793         fputs("*", stdout);
15794       }
15795     }
15796     value *= 2;
15797     ++count;
15798   }
15799   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15800           count, (double) value);
15801   return 1;
15802 }
15803 EOP
15804 set try
15805
15806 nv_overflows_integers_at='0'
15807 if eval $compile; then
15808     xxx="`$run ./try`"
15809     case "$?" in
15810         0)
15811             case "$xxx" in
15812                 2*)  cat >&4 <<EOM
15813 The largest integer your NVs can preserve is equal to $xxx
15814 EOM
15815                     nv_overflows_integers_at="$xxx"
15816                     ;;
15817                 *)  cat >&4 <<EOM
15818 Cannot determine the largest integer value your NVs can hold, unexpected output
15819 '$xxx'
15820 EOM
15821                     ;;
15822             esac
15823             ;;
15824         *)  cat >&4 <<EOM
15825 Cannot determine the largest integer value your NVs can hold
15826 EOM
15827             ;;
15828     esac
15829 fi
15830 $rm_try
15831
15832 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15833 : volatile so that the compiler has to store it out to memory.
15834 if test X"$d_volatile" = X"$define"; then
15835         volatile=volatile
15836 fi
15837 $cat <<EOP >try.c
15838 #include <stdio.h>
15839 #$i_stdlib I_STDLIB
15840 #ifdef I_STDLIB
15841 #include <stdlib.h>
15842 #endif
15843 #$i_string I_STRING
15844 #ifdef I_STRING
15845 #  include <string.h>
15846 #else
15847 #  include <strings.h>
15848 #endif
15849 #include <sys/types.h>
15850 #include <signal.h>
15851 #ifdef SIGFPE
15852 $volatile int bletched = 0;
15853 $signal_t blech(int s) { bletched = 1; }
15854 #endif
15855
15856 int checkit($nvtype d, char *where) {
15857     unsigned char *p = (char *)&d;
15858     unsigned char *end = p + sizeof(d);
15859     int fail = 0;
15860
15861     while (p < end)
15862         fail += *p++;
15863
15864     if (!fail)
15865         return 0;
15866
15867     p = (char *)&d;
15868     printf("No - %s: 0x", where);
15869     while (p < end)
15870         printf ("%02X", *p++);
15871     printf("\n");
15872     return 1;
15873 }
15874
15875 int main(int argc, char **argv) {
15876     $nvtype d = 0.0;
15877     int fail = 0;
15878     fail += checkit(d, "0.0");
15879
15880     /* The compiler shouldn't be assuming that bletched is 0  */
15881     d = bletched;
15882
15883     fail += checkit(d, "bleched");
15884
15885 #ifdef SIGFPE
15886     signal(SIGFPE, blech);
15887 #endif
15888
15889     /* Paranoia - the compiler should have no way of knowing that ANSI says
15890        that argv[argc] will always be NULL.  Actually, if it did assume this it
15891        would be buggy, as this is C and main() can be called from elsewhere in
15892        the program.  */
15893     d = argv[argc] ? 1 : 0;
15894
15895     if (d) {
15896         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15897     }
15898
15899     fail += checkit(d, "ternary");
15900
15901     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15902
15903     if (d != 0.0) {
15904         printf("No - memset doesn't give 0.0\n");
15905         /* This might just blow up:  */
15906         printf("(gives %g)\n", d);
15907         return 1;
15908     }
15909
15910 #ifdef SIGFPE
15911     if (bletched) {
15912         printf("No - something bleched\n");
15913         return 1;
15914     }
15915 #endif
15916     if (fail) {
15917       printf("No - %d fail(s)\n", fail);
15918       return 1;
15919     }
15920     printf("Yes\n");
15921     return 0;
15922 }
15923 EOP
15924 set try
15925
15926 d_nv_zero_is_allbits_zero="$undef"
15927 if eval $compile; then
15928     xxx="`$run ./try`"
15929     case "$?" in
15930         0)
15931             case "$xxx" in
15932                 Yes)  cat >&4 <<EOM
15933 0.0 is represented as all bits zero in memory
15934 EOM
15935                     d_nv_zero_is_allbits_zero="$define"
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             ;;
15944         *)  cat >&4 <<EOM
15945 0.0 is not represented as all bits zero in memory
15946 EOM
15947             d_nv_zero_is_allbits_zero="$undef"
15948             ;;
15949     esac
15950 fi
15951 $rm_try
15952
15953 : check for off64_t
15954 echo " "
15955 echo "Checking to see if you have off64_t..." >&4
15956 $cat >try.c <<EOCP
15957 #include <sys/types.h>
15958 #include <unistd.h>
15959 int main() { off64_t x = 7; }
15960 EOCP
15961 set try
15962 if eval $compile; then
15963         val="$define"
15964         echo "You have off64_t."
15965 else
15966         val="$undef"
15967         echo "You do not have off64_t."
15968         case "$lseeksize" in
15969         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15970         esac
15971 fi
15972 $rm_try
15973 set d_off64_t
15974 eval $setvar
15975
15976 : how to create joinable pthreads
15977 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15978         echo " "
15979         echo "Checking what constant to use for creating joinable pthreads..." >&4
15980         $cat >try.c <<'EOCP'
15981 #include <pthread.h>
15982 int main() {
15983     int detachstate = JOINABLE;
15984 }
15985 EOCP
15986         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15987         if eval $compile; then
15988                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15989                 val="$undef" # Yes, undef.
15990                 set d_old_pthread_create_joinable
15991                 eval $setvar
15992                 val=""
15993                 set old_pthread_create_joinable
15994                 eval $setvar
15995         else
15996                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15997                 if eval $compile; then
15998                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15999                         val="$define"
16000                         set d_old_pthread_create_joinable
16001                         eval $setvar
16002                         val=PTHREAD_CREATE_UNDETACHED
16003                         set old_pthread_create_joinable
16004                         eval $setvar
16005                 else
16006                         set try -DJOINABLE=__UNDETACHED
16007                         if eval $compile; then
16008                                 echo "You seem to use __UNDETACHED." >&4
16009                                 val="$define"
16010                                 set d_old_pthread_create_joinable
16011                                 eval $setvar
16012                                 val=__UNDETACHED
16013                                 set old_pthread_create_joinable
16014                                 eval $setvar
16015                         else
16016                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16017                                 val="$define"
16018                                 set d_old_pthread_create_joinable
16019                                 eval $setvar
16020                                 val=0
16021                                 set old_pthread_create_joinable
16022                                 eval $setvar
16023                         fi
16024                 fi
16025         fi
16026         $rm_try
16027 else
16028     d_old_pthread_create_joinable="$undef"
16029     old_pthread_create_joinable=""
16030 fi
16031
16032 : see if pause exists
16033 set pause d_pause
16034 eval $inlibc
16035
16036 : see if poll exists
16037 set poll d_poll
16038 eval $inlibc
16039
16040 : see if readlink exists
16041 set readlink d_readlink
16042 eval $inlibc
16043
16044 : Check if exe is symlink to abs path of executing program
16045 echo " "
16046 procselfexe=''
16047 val="$undef"
16048 case "$d_readlink" in
16049 "$define")
16050         if $issymlink /proc/self/exe ; then
16051                 $ls -l /proc/self/exe > reflect
16052                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16053                         echo "You have Linux-like /proc/self/exe."
16054                         procselfexe='"/proc/self/exe"'
16055                         val="$define"
16056                 fi
16057         fi
16058         if $issymlink /proc/curproc/file ; then
16059                 $ls -l /proc/curproc/file > reflect
16060                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16061                         echo "You have BSD-like /proc/curproc/file."
16062                         procselfexe='"/proc/curproc/file"'
16063                         val="$define"
16064                 fi
16065         fi
16066         ;;
16067 esac
16068 $rm -f reflect
16069 set d_procselfexe
16070 eval $setvar
16071
16072 : backward compatibility for d_hvfork
16073 if test X$d_hvfork != X; then
16074         d_vfork="$d_hvfork"
16075         d_hvfork=''
16076 fi
16077 : see if there is a vfork
16078 val=''
16079 set vfork val
16080 eval $inlibc
16081
16082 d_pseudofork=$undef
16083
16084 : Ok, but do we want to use it. vfork is reportedly unreliable in
16085 : perl on Solaris 2.x, and probably elsewhere.
16086 case "$val" in
16087 $define)
16088         echo " "
16089         case "$usevfork" in
16090         false) dflt='n';;
16091         *) dflt='y';;
16092         esac
16093         cat <<'EOM'
16094
16095 Perl can only use a vfork() that doesn't suffer from strict
16096 restrictions on calling functions or modifying global data in
16097 the child.  For example, glibc-2.1 contains such a vfork()
16098 that is unsuitable.  If your system provides a proper fork()
16099 call, chances are that you do NOT want perl to use vfork().
16100
16101 EOM
16102         rp="Do you still want to use vfork()?"
16103         . ./myread
16104         case "$ans" in
16105         y|Y) ;;
16106         *)
16107                 echo "Ok, we won't use vfork()."
16108                 val="$undef"
16109                 ;;
16110         esac
16111         ;;
16112 esac
16113 set d_vfork
16114 eval $setvar
16115 case "$d_vfork" in
16116 $define) usevfork='true';;
16117 *) usevfork='false';;
16118 esac
16119
16120 : see whether the pthread_atfork exists
16121 $cat >try.c <<EOP
16122 #include <pthread.h>
16123 #include <stdio.h>
16124 int main() {
16125 #ifdef  PTHREAD_ATFORK
16126         pthread_atfork(NULL,NULL,NULL);
16127 #endif
16128 }
16129 EOP
16130
16131 : see if pthread_atfork exists
16132 set try -DPTHREAD_ATFORK
16133 if eval $compile; then
16134     val="$define"
16135 else
16136     val="$undef"
16137 fi
16138 case "$usethreads" in
16139 $define)
16140         case "$val" in
16141         $define) echo 'pthread_atfork found.' >&4        ;;
16142         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16143         esac
16144 esac
16145 set d_pthread_atfork
16146 eval $setvar
16147
16148 : see if pthread_attr_setscope exists
16149 set pthread_attr_setscope d_pthread_attr_setscope
16150 eval $inlibc
16151
16152 : see whether the various POSIXish _yields exist
16153 $cat >try.c <<EOP
16154 #include <pthread.h>
16155 #include <stdio.h>
16156 int main() {
16157 #ifdef SCHED_YIELD
16158         sched_yield();
16159 #else
16160 #ifdef PTHREAD_YIELD
16161         pthread_yield();
16162 #else
16163 #ifdef PTHREAD_YIELD_NULL
16164         pthread_yield(NULL);
16165 #endif
16166 #endif
16167 #endif
16168 }
16169 EOP
16170 : see if sched_yield exists
16171 set try -DSCHED_YIELD
16172 if eval $compile; then
16173     val="$define"
16174     sched_yield='sched_yield()'
16175 else
16176     val="$undef"
16177 fi
16178 case "$usethreads" in
16179 $define)
16180         case "$val" in
16181         $define) echo 'sched_yield() found.' >&4        ;;
16182         *)       echo 'sched_yield() NOT found.' >&4    ;;
16183         esac
16184 esac
16185 set d_sched_yield
16186 eval $setvar
16187
16188 : see if pthread_yield exists
16189 set try -DPTHREAD_YIELD
16190 if eval $compile; then
16191     val="$define"
16192     case "$sched_yield" in
16193     '') sched_yield='pthread_yield()' ;;
16194     esac
16195 else
16196     set try -DPTHREAD_YIELD_NULL
16197     if eval $compile; then
16198         val="$define"
16199         case "$sched_yield" in
16200         '') sched_yield='pthread_yield(NULL)' ;;
16201         esac
16202     else
16203         val="$undef"
16204     fi
16205 fi
16206 case "$usethreads" in
16207 $define)
16208         case "$val" in
16209         $define) echo 'pthread_yield() found.' >&4      ;;
16210         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16211         esac
16212         ;;
16213 esac
16214 set d_pthread_yield
16215 eval $setvar
16216 case "$sched_yield" in
16217 '') sched_yield=undef ;;
16218 esac
16219 $rm_try
16220
16221 : see if random_r exists
16222 set random_r d_random_r
16223 eval $inlibc
16224 case "$d_random_r" in
16225 "$define")
16226         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16227         case "$d_random_r_proto:$usethreads" in
16228         ":define")      d_random_r_proto=define
16229                 set d_random_r_proto random_r $hdrs
16230                 eval $hasproto ;;
16231         *)      ;;
16232         esac
16233         case "$d_random_r_proto" in
16234         define)
16235         case "$random_r_proto" in
16236         ''|0) try='int random_r(int*, struct random_data*);'
16237         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16238         esac
16239         case "$random_r_proto" in
16240         ''|0) try='int random_r(long*, struct random_data*);'
16241         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16242         esac
16243         case "$random_r_proto" in
16244         ''|0) try='int random_r(struct random_data*, int32_t*);'
16245         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16246         esac
16247         case "$random_r_proto" in
16248         ''|0)   d_random_r=undef
16249                 random_r_proto=0
16250                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16251         * )     case "$random_r_proto" in
16252                 REENTRANT_PROTO*) ;;
16253                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16254                 esac
16255                 echo "Prototype: $try" ;;
16256         esac
16257         ;;
16258         *)      case "$usethreads" in
16259                 define) echo "random_r has no prototype, not using it." >&4 ;;
16260                 esac
16261                 d_random_r=undef
16262                 random_r_proto=0
16263                 ;;
16264         esac
16265         ;;
16266 *)      random_r_proto=0
16267         ;;
16268 esac
16269
16270 : see if readdir and friends exist
16271 set readdir d_readdir
16272 eval $inlibc
16273 set seekdir d_seekdir
16274 eval $inlibc
16275 set telldir d_telldir
16276 eval $inlibc
16277 set rewinddir d_rewinddir
16278 eval $inlibc
16279
16280 : see if readdir64_r exists
16281 set readdir64_r d_readdir64_r
16282 eval $inlibc
16283 case "$d_readdir64_r" in
16284 "$define")
16285         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16286         case "$d_readdir64_r_proto:$usethreads" in
16287         ":define")      d_readdir64_r_proto=define
16288                 set d_readdir64_r_proto readdir64_r $hdrs
16289                 eval $hasproto ;;
16290         *)      ;;
16291         esac
16292         case "$d_readdir64_r_proto" in
16293         define)
16294         case "$readdir64_r_proto" in
16295         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16296         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16297         esac
16298         case "$readdir64_r_proto" in
16299         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16300         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16301         esac
16302         case "$readdir64_r_proto" in
16303         ''|0)   d_readdir64_r=undef
16304                 readdir64_r_proto=0
16305                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16306         * )     case "$readdir64_r_proto" in
16307                 REENTRANT_PROTO*) ;;
16308                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16309                 esac
16310                 echo "Prototype: $try" ;;
16311         esac
16312         ;;
16313         *)      case "$usethreads" in
16314                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16315                 esac
16316                 d_readdir64_r=undef
16317                 readdir64_r_proto=0
16318                 ;;
16319         esac
16320         ;;
16321 *)      readdir64_r_proto=0
16322         ;;
16323 esac
16324
16325 : see if readdir_r exists
16326 set readdir_r d_readdir_r
16327 eval $inlibc
16328 case "$d_readdir_r" in
16329 "$define")
16330         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16331         case "$d_readdir_r_proto:$usethreads" in
16332         ":define")      d_readdir_r_proto=define
16333                 set d_readdir_r_proto readdir_r $hdrs
16334                 eval $hasproto ;;
16335         *)      ;;
16336         esac
16337         case "$d_readdir_r_proto" in
16338         define)
16339         case "$readdir_r_proto" in
16340         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16341         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16342         esac
16343         case "$readdir_r_proto" in
16344         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16345         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16346         esac
16347         case "$readdir_r_proto" in
16348         ''|0)   d_readdir_r=undef
16349                 readdir_r_proto=0
16350                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16351         * )     case "$readdir_r_proto" in
16352                 REENTRANT_PROTO*) ;;
16353                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16354                 esac
16355                 echo "Prototype: $try" ;;
16356         esac
16357         ;;
16358         *)      case "$usethreads" in
16359                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16360                 esac
16361                 d_readdir_r=undef
16362                 readdir_r_proto=0
16363                 ;;
16364         esac
16365         ;;
16366 *)      readdir_r_proto=0
16367         ;;
16368 esac
16369
16370 : see if readv exists
16371 set readv d_readv
16372 eval $inlibc
16373
16374 : see if recvmsg exists
16375 set recvmsg d_recvmsg
16376 eval $inlibc
16377
16378 : see if rename exists
16379 set rename d_rename
16380 eval $inlibc
16381
16382 : see if rmdir exists
16383 set rmdir d_rmdir
16384 eval $inlibc
16385
16386 : see if memory.h is available.
16387 val=''
16388 set memory.h val
16389 eval $inhdr
16390
16391 : See if it conflicts with string.h
16392 case "$val" in
16393 $define)
16394         case "$strings" in
16395         '') ;;
16396         *)
16397                 $cppstdin $cppflags $cppminus < $strings > mem.h
16398                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16399                         echo " "
16400                         echo "We won't be including <memory.h>."
16401                         val="$undef"
16402                 fi
16403                 $rm -f mem.h
16404                 ;;
16405         esac
16406 esac
16407 set i_memory
16408 eval $setvar
16409
16410 : can bcopy handle overlapping blocks?
16411 echo " "
16412 val="$undef"
16413 case "$d_memmove" in
16414 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16415 *)      case "$d_bcopy" in
16416         "$define")
16417                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16418                 $cat >try.c <<EOCP
16419 #$i_memory I_MEMORY
16420 #$i_stdlib I_STDLIB
16421 #$i_string I_STRING
16422 #$i_unistd I_UNISTD
16423 EOCP
16424         $cat >>try.c <<'EOCP'
16425 #include <stdio.h>
16426 #ifdef I_MEMORY
16427 #  include <memory.h>
16428 #endif
16429 #ifdef I_STDLIB
16430 #  include <stdlib.h>
16431 #endif
16432 #ifdef I_STRING
16433 #  include <string.h>
16434 #else
16435 #  include <strings.h>
16436 #endif
16437 #ifdef I_UNISTD
16438 #  include <unistd.h>  /* Needed for NetBSD */
16439 #endif
16440 int main()
16441 {
16442 char buf[128], abc[128];
16443 char *b;
16444 int len;
16445 int off;
16446 int align;
16447
16448 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16449    try to store the string in read-only memory. */
16450 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16451
16452 for (align = 7; align >= 0; align--) {
16453         for (len = 36; len; len--) {
16454                 b = buf+align;
16455                 bcopy(abc, b, len);
16456                 for (off = 1; off <= len; off++) {
16457                         bcopy(b, b+off, len);
16458                         bcopy(b+off, b, len);
16459                         if (bcmp(b, abc, len))
16460                                 exit(1);
16461                 }
16462         }
16463 }
16464 exit(0);
16465 }
16466 EOCP
16467                 set try
16468                 if eval $compile_ok; then
16469                         if $run ./try 2>/dev/null; then
16470                                 echo "Yes, it can."
16471                                 val="$define"
16472                         else
16473                                 echo "It can't, sorry."
16474                         fi
16475                 else
16476                         echo "(I can't compile the test program, so we'll assume not...)"
16477                 fi
16478                 ;;
16479         esac
16480         $rm_try
16481         ;;
16482 esac
16483 set d_safebcpy
16484 eval $setvar
16485
16486 : can memcpy handle overlapping blocks?
16487 echo " "
16488 val="$undef"
16489 case "$d_memmove" in
16490 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16491 *)      case "$d_memcpy" in
16492         "$define")
16493                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16494                 $cat >try.c <<EOCP
16495 #$i_memory I_MEMORY
16496 #$i_stdlib I_STDLIB
16497 #$i_string I_STRING
16498 #$i_unistd I_UNISTD
16499 EOCP
16500         $cat >>try.c <<'EOCP'
16501 #include <stdio.h>
16502 #ifdef I_MEMORY
16503 #  include <memory.h>
16504 #endif
16505 #ifdef I_STDLIB
16506 #  include <stdlib.h>
16507 #endif
16508 #ifdef I_STRING
16509 #  include <string.h>
16510 #else
16511 #  include <strings.h>
16512 #endif
16513 #ifdef I_UNISTD
16514 #  include <unistd.h>  /* Needed for NetBSD */
16515 #endif
16516 int main()
16517 {
16518 char buf[128], abc[128];
16519 char *b;
16520 int len;
16521 int off;
16522 int align;
16523
16524 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16525    try to store the string in read-only memory. */
16526 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16527
16528 for (align = 7; align >= 0; align--) {
16529         for (len = 36; len; len--) {
16530                 b = buf+align;
16531                 memcpy(b, abc, len);
16532                 for (off = 1; off <= len; off++) {
16533                         memcpy(b+off, b, len);
16534                         memcpy(b, b+off, len);
16535                         if (memcmp(b, abc, len))
16536                                 exit(1);
16537                 }
16538         }
16539 }
16540 exit(0);
16541 }
16542 EOCP
16543                 set try
16544                 if eval $compile_ok; then
16545                         if $run ./try 2>/dev/null; then
16546                                 echo "Yes, it can."
16547                                 val="$define"
16548                         else
16549                                 echo "It can't, sorry."
16550                         fi
16551                 else
16552                         echo "(I can't compile the test program, so we'll assume not...)"
16553                 fi
16554                 ;;
16555         esac
16556         $rm_try
16557         ;;
16558 esac
16559 set d_safemcpy
16560 eval $setvar
16561
16562 : can memcmp be trusted to compare relative magnitude?
16563 val="$undef"
16564 case "$d_memcmp" in
16565 "$define")
16566         echo " "
16567         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16568         $cat >try.c <<EOCP
16569 #$i_memory I_MEMORY
16570 #$i_stdlib I_STDLIB
16571 #$i_string I_STRING
16572 #$i_unistd I_UNISTD
16573 EOCP
16574         $cat >>try.c <<'EOCP'
16575 #include <stdio.h>
16576 #ifdef I_MEMORY
16577 #  include <memory.h>
16578 #endif
16579 #ifdef I_STDLIB
16580 #  include <stdlib.h>
16581 #endif
16582 #ifdef I_STRING
16583 #  include <string.h>
16584 #else
16585 #  include <strings.h>
16586 #endif
16587 #ifdef I_UNISTD
16588 #  include <unistd.h>  /* Needed for NetBSD */
16589 #endif
16590 int main()
16591 {
16592 char a = -1;
16593 char b = 0;
16594 if ((a < b) && memcmp(&a, &b, 1) < 0)
16595         exit(1);
16596 exit(0);
16597 }
16598 EOCP
16599         set try
16600         if eval $compile_ok; then
16601                 if $run ./try 2>/dev/null; then
16602                         echo "Yes, it can."
16603                         val="$define"
16604                 else
16605                         echo "No, it can't (it uses signed chars)."
16606                 fi
16607         else
16608                 echo "(I can't compile the test program, so we'll assume not...)"
16609         fi
16610         ;;
16611 esac
16612 $rm_try
16613 set d_sanemcmp
16614 eval $setvar
16615
16616 : see if prototype for sbrk is available
16617 echo " "
16618 set d_sbrkproto sbrk $i_unistd unistd.h
16619 eval $hasproto
16620
16621 : see if select exists
16622 set select d_select
16623 eval $inlibc
16624
16625 : see if semctl exists
16626 set semctl d_semctl
16627 eval $inlibc
16628
16629 : see if semget exists
16630 set semget d_semget
16631 eval $inlibc
16632
16633 : see if semop exists
16634 set semop d_semop
16635 eval $inlibc
16636
16637 : see how much of the 'sem*(2)' library is present.
16638 h_sem=true
16639 echo " "
16640 case "$d_semctl$d_semget$d_semop" in
16641 *"$undef"*) h_sem=false;;
16642 esac
16643 case "$osname" in
16644 freebsd)
16645     case "`ipcs 2>&1`" in
16646     "SVID messages"*"not configured"*)
16647         echo "Your $osname does not have the sem*(2) configured." >&4
16648         h_sem=false
16649         val="$undef"
16650         set semctl d_semctl
16651         eval $setvar
16652         set semget d_semget
16653         eval $setvar
16654         set semop d_semop
16655         eval $setvar
16656         ;;
16657     esac
16658     ;;
16659 esac
16660 : we could also check for sys/ipc.h ...
16661 if $h_sem && $test `./findhdr sys/sem.h`; then
16662         echo "You have the full sem*(2) library." >&4
16663         val="$define"
16664 else
16665         echo "You don't have the full sem*(2) library." >&4
16666         val="$undef"
16667 fi
16668 set d_sem
16669 eval $setvar
16670
16671 : see whether sys/sem.h defines union semun
16672 echo " "
16673 $cat > try.c <<'END'
16674 #include <sys/types.h>
16675 #include <sys/ipc.h>
16676 #include <sys/sem.h>
16677 int main () { union semun semun; semun.buf = 0; }
16678 END
16679 set try
16680 if eval $compile; then
16681     echo "You have union semun in <sys/sem.h>." >&4
16682     val="$define"
16683 else
16684     echo "You do not have union semun in <sys/sem.h>." >&4
16685     val="$undef"
16686 fi
16687 $rm_try
16688 set d_union_semun
16689 eval $setvar
16690
16691 : see how to do semctl IPC_STAT
16692 case "$d_sem" in
16693 $define)
16694     echo " "
16695     $cat > tryh.h <<END
16696 #ifndef S_IRUSR
16697 #   ifdef S_IREAD
16698 #       define S_IRUSR S_IREAD
16699 #       define S_IWUSR S_IWRITE
16700 #       define S_IXUSR S_IEXEC
16701 #   else
16702 #       define S_IRUSR 0400
16703 #       define S_IWUSR 0200
16704 #       define S_IXUSR 0100
16705 #   endif
16706 #   define S_IRGRP (S_IRUSR>>3)
16707 #   define S_IWGRP (S_IWUSR>>3)
16708 #   define S_IXGRP (S_IXUSR>>3)
16709 #   define S_IROTH (S_IRUSR>>6)
16710 #   define S_IWOTH (S_IWUSR>>6)
16711 #   define S_IXOTH (S_IXUSR>>6)
16712 #endif
16713 #ifndef S_IRWXU
16714 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16715 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16716 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16717 #endif
16718 END
16719     : see whether semctl IPC_STAT can use union semun
16720     case "$d_semctl_semun" in
16721     '')
16722       val="$undef"
16723       $cat > try.c <<END
16724 #include <sys/types.h>
16725 #include <sys/ipc.h>
16726 #include <sys/sem.h>
16727 #include <sys/stat.h>
16728 #include <stdio.h>
16729 #include <errno.h>
16730 #include "tryh.h"
16731 #ifndef errno
16732 extern int errno;
16733 #endif
16734 #$d_union_semun HAS_UNION_SEMUN
16735 int main() {
16736     union semun
16737 #ifndef HAS_UNION_SEMUN
16738     {
16739         int val;
16740         struct semid_ds *buf;
16741         unsigned short *array;
16742     }
16743 #endif
16744     arg;
16745     int sem, st;
16746
16747 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16748     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16749     if (sem > -1) {
16750         struct semid_ds argbuf;
16751         arg.buf = &argbuf;
16752 #       ifdef IPC_STAT
16753         st = semctl(sem, 0, IPC_STAT, arg);
16754         if (st == 0)
16755             printf("semun\n");
16756         else
16757 #       endif /* IPC_STAT */
16758             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16759 #       ifdef IPC_RMID
16760         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16761 #       endif /* IPC_RMID */
16762             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16763     } else
16764 #endif /* IPC_PRIVATE && ... */
16765         printf("semget failed: errno = %d\n", errno);
16766   return 0;
16767 }
16768 END
16769       set try
16770       if eval $compile; then
16771           xxx=`$run ./try`
16772           case "$xxx" in
16773           semun) val="$define" ;;
16774           esac
16775       fi
16776       $rm_try
16777       set d_semctl_semun
16778       eval $setvar
16779       ;;
16780     esac
16781     case "$d_semctl_semun" in
16782     $define)
16783         echo "You can use union semun for semctl IPC_STAT." >&4
16784         also='also'
16785         ;;
16786     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16787         also=''
16788         ;;
16789     esac
16790
16791     : see whether semctl IPC_STAT can use struct semid_ds pointer
16792     case "$d_semctl_semid_ds" in
16793     '')
16794       val="$undef"
16795       $cat > try.c <<'END'
16796 #include <sys/types.h>
16797 #include <sys/ipc.h>
16798 #include <sys/sem.h>
16799 #include <sys/stat.h>
16800 #include "tryh.h"
16801 #include <stdio.h>
16802 #include <errno.h>
16803 #ifndef errno
16804 extern int errno;
16805 #endif
16806 int main() {
16807     struct semid_ds arg;
16808     int sem, st;
16809
16810 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16811     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16812     if (sem > -1) {
16813 #       ifdef IPC_STAT
16814         st = semctl(sem, 0, IPC_STAT, &arg);
16815         if (st == 0)
16816             printf("semid_ds\n");
16817         else
16818 #       endif /* IPC_STAT */
16819             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16820 #       ifdef IPC_RMID
16821         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16822 #       endif /* IPC_RMID */
16823             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16824     } else
16825 #endif /* IPC_PRIVATE && ... */
16826         printf("semget failed: errno = %d\n", errno);
16827
16828     return 0;
16829 }
16830 END
16831       set try
16832       if eval $compile; then
16833           xxx=`$run ./try`
16834           case "$xxx" in
16835           semid_ds) val="$define" ;;
16836           esac
16837       fi
16838       $rm_try
16839       set d_semctl_semid_ds
16840       eval $setvar
16841       ;;
16842     esac
16843     case "$d_semctl_semid_ds" in
16844     $define)
16845         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16846         ;;
16847     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16848         ;;
16849     esac
16850     ;;
16851 *)  val="$undef"
16852
16853     # We do not have the full sem*(2) library, so assume we can not
16854     # use either.
16855
16856     set d_semctl_semun
16857     eval $setvar
16858
16859     set d_semctl_semid_ds
16860     eval $setvar
16861     ;;
16862 esac
16863 $rm_try tryh.h
16864
16865 : see if sendmsg exists
16866 set sendmsg d_sendmsg
16867 eval $inlibc
16868
16869 : see if setegid exists
16870 set setegid d_setegid
16871 eval $inlibc
16872
16873 : see if seteuid exists
16874 set seteuid d_seteuid
16875 eval $inlibc
16876
16877 : see if setgrent exists
16878 set setgrent d_setgrent
16879 eval $inlibc
16880
16881 : see if setgrent_r exists
16882 set setgrent_r d_setgrent_r
16883 eval $inlibc
16884 case "$d_setgrent_r" in
16885 "$define")
16886         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16887         case "$d_setgrent_r_proto:$usethreads" in
16888         ":define")      d_setgrent_r_proto=define
16889                 set d_setgrent_r_proto setgrent_r $hdrs
16890                 eval $hasproto ;;
16891         *)      ;;
16892         esac
16893         case "$d_setgrent_r_proto" in
16894         define)
16895         case "$setgrent_r_proto" in
16896         ''|0) try='int setgrent_r(FILE**);'
16897         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16898         esac
16899         case "$setgrent_r_proto" in
16900         ''|0) try='void setgrent_r(FILE**);'
16901         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16902         esac
16903         case "$setgrent_r_proto" in
16904         ''|0)   d_setgrent_r=undef
16905                 setgrent_r_proto=0
16906                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16907         * )     case "$setgrent_r_proto" in
16908                 REENTRANT_PROTO*) ;;
16909                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16910                 esac
16911                 echo "Prototype: $try" ;;
16912         esac
16913         ;;
16914         *)      case "$usethreads" in
16915                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16916                 esac
16917                 d_setgrent_r=undef
16918                 setgrent_r_proto=0
16919                 ;;
16920         esac
16921         ;;
16922 *)      setgrent_r_proto=0
16923         ;;
16924 esac
16925
16926 : see if sethostent exists
16927 set sethostent d_sethent
16928 eval $inlibc
16929
16930 : see if sethostent_r exists
16931 set sethostent_r d_sethostent_r
16932 eval $inlibc
16933 case "$d_sethostent_r" in
16934 "$define")
16935         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16936         case "$d_sethostent_r_proto:$usethreads" in
16937         ":define")      d_sethostent_r_proto=define
16938                 set d_sethostent_r_proto sethostent_r $hdrs
16939                 eval $hasproto ;;
16940         *)      ;;
16941         esac
16942         case "$d_sethostent_r_proto" in
16943         define)
16944         case "$sethostent_r_proto" in
16945         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16946         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16947         esac
16948         case "$sethostent_r_proto" in
16949         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16950         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16951         esac
16952         case "$sethostent_r_proto" in
16953         ''|0)   d_sethostent_r=undef
16954                 sethostent_r_proto=0
16955                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16956         * )     case "$sethostent_r_proto" in
16957                 REENTRANT_PROTO*) ;;
16958                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16959                 esac
16960                 echo "Prototype: $try" ;;
16961         esac
16962         ;;
16963         *)      case "$usethreads" in
16964                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16965                 esac
16966                 d_sethostent_r=undef
16967                 sethostent_r_proto=0
16968                 ;;
16969         esac
16970         ;;
16971 *)      sethostent_r_proto=0
16972         ;;
16973 esac
16974
16975 : see if setitimer exists
16976 set setitimer d_setitimer
16977 eval $inlibc
16978
16979 : see if setlinebuf exists
16980 set setlinebuf d_setlinebuf
16981 eval $inlibc
16982
16983 : see if setlocale exists
16984 set setlocale d_setlocale
16985 eval $inlibc
16986
16987 : see if locale.h is available
16988 set locale.h i_locale
16989 eval $inhdr
16990
16991 : see if setlocale_r exists
16992 set setlocale_r d_setlocale_r
16993 eval $inlibc
16994 case "$d_setlocale_r" in
16995 "$define")
16996         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16997         case "$d_setlocale_r_proto:$usethreads" in
16998         ":define")      d_setlocale_r_proto=define
16999                 set d_setlocale_r_proto setlocale_r $hdrs
17000                 eval $hasproto ;;
17001         *)      ;;
17002         esac
17003         case "$d_setlocale_r_proto" in
17004         define)
17005         case "$setlocale_r_proto" in
17006         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17007         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17008         esac
17009         case "$setlocale_r_proto" in
17010         ''|0)   d_setlocale_r=undef
17011                 setlocale_r_proto=0
17012                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17013         * )     case "$setlocale_r_proto" in
17014                 REENTRANT_PROTO*) ;;
17015                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17016                 esac
17017                 echo "Prototype: $try" ;;
17018         esac
17019         ;;
17020         *)      case "$usethreads" in
17021                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17022                 esac
17023                 d_setlocale_r=undef
17024                 setlocale_r_proto=0
17025                 ;;
17026         esac
17027         ;;
17028 *)      setlocale_r_proto=0
17029         ;;
17030 esac
17031
17032 : see if setnetent exists
17033 set setnetent d_setnent
17034 eval $inlibc
17035
17036 : see if setnetent_r exists
17037 set setnetent_r d_setnetent_r
17038 eval $inlibc
17039 case "$d_setnetent_r" in
17040 "$define")
17041         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17042         case "$d_setnetent_r_proto:$usethreads" in
17043         ":define")      d_setnetent_r_proto=define
17044                 set d_setnetent_r_proto setnetent_r $hdrs
17045                 eval $hasproto ;;
17046         *)      ;;
17047         esac
17048         case "$d_setnetent_r_proto" in
17049         define)
17050         case "$setnetent_r_proto" in
17051         ''|0) try='int setnetent_r(int, struct netent_data*);'
17052         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17053         esac
17054         case "$setnetent_r_proto" in
17055         ''|0) try='void setnetent_r(int, struct netent_data*);'
17056         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17057         esac
17058         case "$setnetent_r_proto" in
17059         ''|0)   d_setnetent_r=undef
17060                 setnetent_r_proto=0
17061                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17062         * )     case "$setnetent_r_proto" in
17063                 REENTRANT_PROTO*) ;;
17064                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17065                 esac
17066                 echo "Prototype: $try" ;;
17067         esac
17068         ;;
17069         *)      case "$usethreads" in
17070                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17071                 esac
17072                 d_setnetent_r=undef
17073                 setnetent_r_proto=0
17074                 ;;
17075         esac
17076         ;;
17077 *)      setnetent_r_proto=0
17078         ;;
17079 esac
17080
17081 : see if setprotoent exists
17082 set setprotoent d_setpent
17083 eval $inlibc
17084
17085 : see if setpgid exists
17086 set setpgid d_setpgid
17087 eval $inlibc
17088
17089 : see if setpgrp2 exists
17090 set setpgrp2 d_setpgrp2
17091 eval $inlibc
17092
17093 : see if setpriority exists
17094 set setpriority d_setprior
17095 eval $inlibc
17096
17097 : see if setproctitle exists
17098 set setproctitle d_setproctitle
17099 eval $inlibc
17100
17101 : see if setprotoent_r exists
17102 set setprotoent_r d_setprotoent_r
17103 eval $inlibc
17104 case "$d_setprotoent_r" in
17105 "$define")
17106         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17107         case "$d_setprotoent_r_proto:$usethreads" in
17108         ":define")      d_setprotoent_r_proto=define
17109                 set d_setprotoent_r_proto setprotoent_r $hdrs
17110                 eval $hasproto ;;
17111         *)      ;;
17112         esac
17113         case "$d_setprotoent_r_proto" in
17114         define)
17115         case "$setprotoent_r_proto" in
17116         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17117         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17118         esac
17119         case "$setprotoent_r_proto" in
17120         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17121         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17122         esac
17123         case "$setprotoent_r_proto" in
17124         ''|0)   d_setprotoent_r=undef
17125                 setprotoent_r_proto=0
17126                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17127         * )     case "$setprotoent_r_proto" in
17128                 REENTRANT_PROTO*) ;;
17129                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17130                 esac
17131                 echo "Prototype: $try" ;;
17132         esac
17133         ;;
17134         *)      case "$usethreads" in
17135                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17136                 esac
17137                 d_setprotoent_r=undef
17138                 setprotoent_r_proto=0
17139                 ;;
17140         esac
17141         ;;
17142 *)      setprotoent_r_proto=0
17143         ;;
17144 esac
17145
17146 : see if setpwent exists
17147 set setpwent d_setpwent
17148 eval $inlibc
17149
17150 : see if setpwent_r exists
17151 set setpwent_r d_setpwent_r
17152 eval $inlibc
17153 case "$d_setpwent_r" in
17154 "$define")
17155         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17156         case "$d_setpwent_r_proto:$usethreads" in
17157         ":define")      d_setpwent_r_proto=define
17158                 set d_setpwent_r_proto setpwent_r $hdrs
17159                 eval $hasproto ;;
17160         *)      ;;
17161         esac
17162         case "$d_setpwent_r_proto" in
17163         define)
17164         case "$setpwent_r_proto" in
17165         ''|0) try='int setpwent_r(FILE**);'
17166         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17167         esac
17168         case "$setpwent_r_proto" in
17169         ''|0) try='void setpwent_r(FILE**);'
17170         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17171         esac
17172         case "$setpwent_r_proto" in
17173         ''|0)   d_setpwent_r=undef
17174                 setpwent_r_proto=0
17175                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17176         * )     case "$setpwent_r_proto" in
17177                 REENTRANT_PROTO*) ;;
17178                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17179                 esac
17180                 echo "Prototype: $try" ;;
17181         esac
17182         ;;
17183         *)      case "$usethreads" in
17184                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17185                 esac
17186                 d_setpwent_r=undef
17187                 setpwent_r_proto=0
17188                 ;;
17189         esac
17190         ;;
17191 *)      setpwent_r_proto=0
17192         ;;
17193 esac
17194
17195 : see if setregid exists
17196 set setregid d_setregid
17197 eval $inlibc
17198 set setresgid d_setresgid
17199 eval $inlibc
17200
17201 : see if setreuid exists
17202 set setreuid d_setreuid
17203 eval $inlibc
17204 set setresuid d_setresuid
17205 eval $inlibc
17206
17207 : see if setrgid exists
17208 set setrgid d_setrgid
17209 eval $inlibc
17210
17211 : see if setruid exists
17212 set setruid d_setruid
17213 eval $inlibc
17214
17215 : see if setservent exists
17216 set setservent d_setsent
17217 eval $inlibc
17218
17219 : see if setservent_r exists
17220 set setservent_r d_setservent_r
17221 eval $inlibc
17222 case "$d_setservent_r" in
17223 "$define")
17224         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17225         case "$d_setservent_r_proto:$usethreads" in
17226         ":define")      d_setservent_r_proto=define
17227                 set d_setservent_r_proto setservent_r $hdrs
17228                 eval $hasproto ;;
17229         *)      ;;
17230         esac
17231         case "$d_setservent_r_proto" in
17232         define)
17233         case "$setservent_r_proto" in
17234         ''|0) try='int setservent_r(int, struct servent_data*);'
17235         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17236         esac
17237         case "$setservent_r_proto" in
17238         ''|0) try='void setservent_r(int, struct servent_data*);'
17239         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17240         esac
17241         case "$setservent_r_proto" in
17242         ''|0)   d_setservent_r=undef
17243                 setservent_r_proto=0
17244                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17245         * )     case "$setservent_r_proto" in
17246                 REENTRANT_PROTO*) ;;
17247                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17248                 esac
17249                 echo "Prototype: $try" ;;
17250         esac
17251         ;;
17252         *)      case "$usethreads" in
17253                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17254                 esac
17255                 d_setservent_r=undef
17256                 setservent_r_proto=0
17257                 ;;
17258         esac
17259         ;;
17260 *)      setservent_r_proto=0
17261         ;;
17262 esac
17263
17264 : see if setsid exists
17265 set setsid d_setsid
17266 eval $inlibc
17267
17268 : see if setvbuf exists
17269 set setvbuf d_setvbuf
17270 eval $inlibc
17271
17272 : see if sfio.h is available
17273 set sfio.h i_sfio
17274 eval $inhdr
17275
17276 : see if sfio library is available
17277 case "$i_sfio" in
17278 $define)
17279         val=''
17280         set sfreserve val
17281         eval $inlibc
17282         ;;
17283 *)
17284         val="$undef"
17285         ;;
17286 esac
17287 : Ok, but do we want to use it.
17288 case "$val" in
17289 $define)
17290         case "$usesfio" in
17291         true|$define|[yY]*) dflt='y';;
17292         *) dflt='n';;
17293         esac
17294         echo "$package can use the sfio library, but it is experimental."
17295         case "$useperlio" in
17296         "$undef")
17297             echo "For sfio also the PerlIO abstraction layer is needed."
17298             echo "Earlier you said you wouldn't want that."
17299             ;;
17300         esac
17301         rp="You seem to have sfio available, do you want to try using it?"
17302         . ./myread
17303         case "$ans" in
17304         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17305                 useperlio="$define"
17306                 val="$define"
17307                 ;;
17308         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17309                 val="$undef"
17310                 ;;
17311         esac
17312         ;;
17313 *)      case "$usesfio" in
17314         true|$define|[yY]*)
17315                 echo "Sorry, cannot find sfio on this machine." >&4
17316                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17317                 val="$undef"
17318                 ;;
17319         esac
17320         ;;
17321 esac
17322 set d_sfio
17323 eval $setvar
17324 case "$d_sfio" in
17325 $define) usesfio='true';;
17326 *) usesfio='false';;
17327 esac
17328 case "$d_sfio" in
17329 $define) ;;
17330 *)      : Remove sfio from list of libraries to use
17331         case "$libs" in
17332         *-lsfio*)
17333                 echo "Removing unneeded -lsfio from library list" >&4
17334                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17335                 shift
17336                 libs="$*"
17337                 echo "libs = $libs" >&4
17338                 ;;
17339         esac
17340 ;;
17341 esac
17342
17343
17344 : see if shmctl exists
17345 set shmctl d_shmctl
17346 eval $inlibc
17347
17348 : see if shmget exists
17349 set shmget d_shmget
17350 eval $inlibc
17351
17352 : see if shmat exists
17353 set shmat d_shmat
17354 eval $inlibc
17355 : see what shmat returns
17356 case "$d_shmat" in
17357 "$define")
17358         $cat >shmat.c <<'END'
17359 #include <sys/shm.h>
17360 void *shmat();
17361 END
17362         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17363                 shmattype='void *'
17364         else
17365                 shmattype='char *'
17366         fi
17367         echo "and it returns ($shmattype)." >&4
17368         : see if a prototype for shmat is available
17369         xxx=`./findhdr sys/shm.h`
17370         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17371         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17372                 val="$define"
17373         else
17374                 val="$undef"
17375         fi
17376         $rm -f shmat.[co]
17377         ;;
17378 *)
17379         val="$undef"
17380         ;;
17381 esac
17382 set d_shmatprototype
17383 eval $setvar
17384
17385 : see if shmdt exists
17386 set shmdt d_shmdt
17387 eval $inlibc
17388
17389 : see how much of the 'shm*(2)' library is present.
17390 h_shm=true
17391 echo " "
17392 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17393 *"$undef"*) h_shm=false;;
17394 esac
17395 case "$osname" in
17396 freebsd)
17397     case "`ipcs 2>&1`" in
17398     "SVID shared memory"*"not configured"*)
17399         echo "Your $osname does not have the shm*(2) configured." >&4
17400         h_shm=false
17401         val="$undef"
17402         set shmctl d_shmctl
17403         evat $setvar
17404         set shmget d_shmget
17405         evat $setvar
17406         set shmat d_shmat
17407         evat $setvar
17408         set shmdt d_shmdt
17409         evat $setvar
17410         ;;
17411     esac
17412     ;;
17413 esac
17414 : we could also check for sys/ipc.h ...
17415 if $h_shm && $test `./findhdr sys/shm.h`; then
17416         echo "You have the full shm*(2) library." >&4
17417         val="$define"
17418 else
17419         echo "You don't have the full shm*(2) library." >&4
17420         val="$undef"
17421 fi
17422 set d_shm
17423 eval $setvar
17424
17425 : see if we have sigaction
17426 echo " "
17427 if set sigaction val -f d_sigaction; eval $csym; $val; then
17428         echo 'sigaction() found.' >&4
17429         $cat > try.c <<EOP
17430 #include <stdio.h>
17431 #include <sys/types.h>
17432 #include <signal.h>
17433 #$i_stdlib I_STDLIB
17434 #ifdef I_STDLIB
17435 #include <stdlib.h>
17436 #endif
17437 int main()
17438 {
17439     struct sigaction act, oact;
17440     act.sa_flags = 0;
17441     oact.sa_handler = 0;
17442     /* so that act and oact are used */
17443     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17444 }
17445 EOP
17446         set try
17447         if eval $compile_ok; then
17448                 val="$define"
17449         else
17450                 echo "But you don't seem to have a useable struct sigaction." >&4
17451                 val="$undef"
17452         fi
17453 else
17454         echo 'sigaction NOT found.' >&4
17455         val="$undef"
17456 fi
17457 set d_sigaction; eval $setvar
17458 $rm_try
17459
17460 : see if this is a sunmath.h system
17461 set sunmath.h i_sunmath
17462 eval $inhdr
17463
17464 : see if signbit exists
17465 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17466 $cat >try.c <<EOCP
17467 #$i_math I_MATH
17468 #$i_sunmath I_SUNMATH
17469 #ifdef I_MATH
17470 #  include <math.h>
17471 #endif
17472 #ifdef I_SUNMATH  /* Solaris special math library */
17473 #  include <sunmath.h>
17474 #endif
17475 #define NV $nvtype
17476 int main(int argc, char **argv)
17477 {
17478     NV x = 0.0;
17479     NV y = -0.0;
17480     if ((signbit(x) == 0) && (signbit(y) != 0))
17481         return 0;
17482     else
17483         return 1;
17484 }
17485 EOCP
17486 val="$undef"
17487 set try
17488 if eval $compile; then
17489     if $run ./try; then
17490         $echo "Yes." >&4
17491         val="$define"
17492     else
17493         $echo "Signbit seems to be available, but doesn't work as I expected."
17494         $echo "I won't use it." >&4
17495         val="$undef"
17496     fi
17497 else
17498     $echo "Nope." >&4
17499     dflt="$undef"
17500 fi
17501 set d_signbit
17502 eval $setvar
17503 $rm_try
17504
17505 : see if sigprocmask exists
17506 set sigprocmask d_sigprocmask
17507 eval $inlibc
17508
17509 : see if sigsetjmp exists
17510 echo " "
17511 case "$d_sigsetjmp" in
17512 '')
17513         $cat >try.c <<EOP
17514 #include <setjmp.h>
17515 #$i_stdlib I_STDLIB
17516 #ifdef I_STDLIB
17517 #include <stdlib.h>
17518 #endif
17519 sigjmp_buf env;
17520 int set = 1;
17521 int main()
17522 {
17523         if (sigsetjmp(env,1))
17524                 exit(set);
17525         set = 0;
17526         siglongjmp(env, 1);
17527         exit(1);
17528 }
17529 EOP
17530         set try
17531         if eval $compile; then
17532                 if $run ./try >/dev/null 2>&1; then
17533                         echo "POSIX sigsetjmp found." >&4
17534                         val="$define"
17535                 else
17536                         $cat >&4 <<EOM
17537 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17538 I'll ignore them.
17539 EOM
17540                         val="$undef"
17541                 fi
17542         else
17543                 echo "sigsetjmp not found." >&4
17544                 val="$undef"
17545         fi
17546         ;;
17547 *) val="$d_sigsetjmp"
17548         case "$d_sigsetjmp" in
17549         $define) echo "POSIX sigsetjmp found." >&4;;
17550         $undef) echo "sigsetjmp not found." >&4;;
17551         esac
17552         ;;
17553 esac
17554 set d_sigsetjmp
17555 eval $setvar
17556 $rm_try
17557
17558 : see if snprintf exists
17559 set snprintf d_snprintf
17560 eval $inlibc
17561
17562 : see if vsnprintf exists
17563 set vsnprintf d_vsnprintf
17564 eval $inlibc
17565
17566 case "$d_snprintf-$d_vsnprintf" in
17567 "$define-$define")
17568     $cat <<EOM
17569 Checking whether your snprintf() and vsnprintf() work okay...
17570 EOM
17571     $cat >try.c <<'EOCP'
17572 /* v?snprintf testing logic courtesy of Russ Allbery.
17573  * According to C99:
17574  * - if the buffer is too short it still must be \0-terminated
17575  * - if the buffer is too short the potentially required length
17576  *   must be returned and not -1
17577  * - if the buffer is NULL the potentially required length
17578  *   must be returned and not -1 or core dump
17579  */
17580 #include <stdio.h>
17581 #include <stdarg.h>
17582
17583 char buf[2];
17584
17585 int test (char *format, ...)
17586 {
17587     va_list args;
17588     int count;
17589
17590     va_start (args, format);
17591     count = vsnprintf (buf, sizeof buf, format, args);
17592     va_end (args);
17593     return count;
17594 }
17595
17596 int main ()
17597 {
17598     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17599              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17600 }
17601 EOCP
17602     set try
17603     if eval $compile; then
17604         `$run ./try`
17605         case "$?" in
17606         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17607         *) cat <<EOM >&4
17608 Your snprintf() and snprintf() don't seem to be working okay.
17609 EOM
17610            d_snprintf="$undef"
17611            d_vsnprintf="$undef"
17612            ;;
17613         esac
17614     else
17615         echo "(I can't seem to compile the test program--assuming they don't)"
17616         d_snprintf="$undef"
17617         d_vsnprintf="$undef"
17618     fi
17619     $rm_try
17620     ;;
17621 esac
17622
17623 : see if sockatmark exists
17624 set sockatmark d_sockatmark
17625 eval $inlibc
17626
17627 : see if prototype for sockatmark is available
17628 echo " "
17629 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17630 eval $hasproto
17631
17632 : see if socks5_init exists
17633 set socks5_init d_socks5_init
17634 eval $inlibc
17635
17636 : see if sprintf returns the length of the string in the buffer as per ANSI
17637 $echo "Checking whether sprintf returns the length of the string..." >&4
17638 $cat <<EOP >try.c
17639 #include <stdio.h>
17640 #$i_stdlib I_STDLIB
17641 #ifdef I_STDLIB
17642 #include <stdlib.h>
17643 #endif
17644 #$i_string I_STRING
17645 #ifdef I_STRING
17646 #  include <string.h>
17647 #else
17648 #  include <strings.h>
17649 #endif
17650 #$i_math I_MATH
17651 #ifdef I_MATH
17652 #include <math.h>
17653 #endif
17654
17655 char buffer[256];
17656
17657 int check (size_t expect, int test) {
17658   size_t got = strlen(buffer);
17659   if (expect == got)
17660     return 0;
17661
17662   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17663        test, buffer);
17664   exit (test);
17665 }
17666
17667 int main(int argc, char **argv) {
17668   int test = 0;
17669
17670   check(sprintf(buffer, ""), ++test);
17671   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17672   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17673
17674   return 0;
17675 }
17676 EOP
17677 set try
17678
17679 if eval $compile; then
17680     xxx="`$run ./try`"
17681     case "$?" in
17682         0) cat >&4 <<EOM
17683 sprintf returns the length of the string (as ANSI says it should)
17684 EOM
17685         d_sprintf_returns_strlen="$define"
17686         ;;
17687         *) cat >&4 <<EOM
17688 sprintf does not return the length of the string (how old is this system?)
17689 EOM
17690         d_sprintf_returns_strlen="$undef"
17691         ;;
17692     esac
17693 else
17694     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17695     d_sprintf_returns_strlen="$undef"
17696 fi
17697 $rm_try
17698
17699 : see if srand48_r exists
17700 set srand48_r d_srand48_r
17701 eval $inlibc
17702 case "$d_srand48_r" in
17703 "$define")
17704         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17705         case "$d_srand48_r_proto:$usethreads" in
17706         ":define")      d_srand48_r_proto=define
17707                 set d_srand48_r_proto srand48_r $hdrs
17708                 eval $hasproto ;;
17709         *)      ;;
17710         esac
17711         case "$d_srand48_r_proto" in
17712         define)
17713         case "$srand48_r_proto" in
17714         ''|0) try='int srand48_r(long, struct drand48_data*);'
17715         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17716         esac
17717         case "$srand48_r_proto" in
17718         ''|0)   d_srand48_r=undef
17719                 srand48_r_proto=0
17720                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17721         * )     case "$srand48_r_proto" in
17722                 REENTRANT_PROTO*) ;;
17723                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17724                 esac
17725                 echo "Prototype: $try" ;;
17726         esac
17727         ;;
17728         *)      case "$usethreads" in
17729                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17730                 esac
17731                 d_srand48_r=undef
17732                 srand48_r_proto=0
17733                 ;;
17734         esac
17735         ;;
17736 *)      srand48_r_proto=0
17737         ;;
17738 esac
17739
17740 : see if srandom_r exists
17741 set srandom_r d_srandom_r
17742 eval $inlibc
17743 case "$d_srandom_r" in
17744 "$define")
17745         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17746         case "$d_srandom_r_proto:$usethreads" in
17747         ":define")      d_srandom_r_proto=define
17748                 set d_srandom_r_proto srandom_r $hdrs
17749                 eval $hasproto ;;
17750         *)      ;;
17751         esac
17752         case "$d_srandom_r_proto" in
17753         define)
17754         case "$srandom_r_proto" in
17755         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17756         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17757         esac
17758         case "$srandom_r_proto" in
17759         ''|0)   d_srandom_r=undef
17760                 srandom_r_proto=0
17761                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17762         * )     case "$srandom_r_proto" in
17763                 REENTRANT_PROTO*) ;;
17764                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17765                 esac
17766                 echo "Prototype: $try" ;;
17767         esac
17768         ;;
17769         *)      case "$usethreads" in
17770                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17771                 esac
17772                 d_srandom_r=undef
17773                 srandom_r_proto=0
17774                 ;;
17775         esac
17776         ;;
17777 *)      srandom_r_proto=0
17778         ;;
17779 esac
17780
17781 : see if prototype for setresgid is available
17782 echo " "
17783 set d_sresgproto setresgid $i_unistd unistd.h
17784 eval $hasproto
17785
17786 : see if prototype for setresuid is available
17787 echo " "
17788 set d_sresuproto setresuid $i_unistd unistd.h
17789 eval $hasproto
17790
17791 : see if sys/stat.h is available
17792 set sys/stat.h i_sysstat
17793 eval $inhdr
17794
17795 : see if stat knows about block sizes
17796 echo " "
17797 echo "Checking to see if your struct stat has st_blocks field..." >&4
17798 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17799 eval $hasfield
17800
17801 : see if this is a sys/vfs.h system
17802 set sys/vfs.h i_sysvfs
17803 eval $inhdr
17804
17805 : see if this is a sys/statfs.h system
17806 set sys/statfs.h i_sysstatfs
17807 eval $inhdr
17808
17809 : Check for statfs_s
17810 echo " "
17811 echo "Checking to see if your system supports struct statfs..." >&4
17812 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
17813 eval $hasstruct
17814 case "$d_statfs_s" in
17815 "$define")      echo "Yes, it does."   ;;
17816 *)              echo "No, it doesn't." ;;
17817 esac
17818
17819
17820 : see if struct statfs knows about f_flags
17821 case "$d_statfs_s" in
17822 define)
17823         echo " "
17824         echo "Checking to see if your struct statfs has f_flags field..." >&4
17825         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
17826         eval $hasfield
17827         ;;
17828 *)      val="$undef"
17829         set d_statfs_f_flags
17830         eval $setvar
17831         ;;
17832 esac
17833 case "$d_statfs_f_flags" in
17834 "$define")      echo "Yes, it does."   ;;
17835 *)              echo "No, it doesn't." ;;
17836 esac
17837
17838 : Check stream access
17839 $cat >&4 <<EOM
17840 Checking how to access stdio streams by file descriptor number...
17841 EOM
17842 case "$stdio_stream_array" in
17843 '')     $cat >try.c <<EOCP
17844 #include <stdio.h>
17845 int main() {
17846   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17847     printf("yes\n");
17848 }
17849 EOCP
17850         for s in _iob __iob __sF
17851         do
17852                 set try -DSTDIO_STREAM_ARRAY=$s
17853                 if eval $compile; then
17854                         case "`$run ./try`" in
17855                         yes)    stdio_stream_array=$s; break ;;
17856                         esac
17857                 fi
17858         done
17859         $rm_try
17860 esac
17861 case "$stdio_stream_array" in
17862 '')     $cat >&4 <<EOM
17863 I can't figure out how to access stdio streams by file descriptor number.
17864 EOM
17865         d_stdio_stream_array="$undef"
17866         ;;
17867 *)      $cat >&4 <<EOM
17868 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17869 EOM
17870         d_stdio_stream_array="$define"
17871         ;;
17872 esac
17873
17874 : see if strcoll exists
17875 set strcoll d_strcoll
17876 eval $inlibc
17877
17878 : check for structure copying
17879 echo " "
17880 echo "Checking to see if your C compiler can copy structs..." >&4
17881 $cat >try.c <<'EOCP'
17882 int main()
17883 {
17884         struct blurfl {
17885                 int dyick;
17886         } foo, bar;
17887
17888         foo = bar;
17889 }
17890 EOCP
17891 if $cc -c try.c >/dev/null 2>&1 ; then
17892         val="$define"
17893         echo "Yup, it can."
17894 else
17895         val="$undef"
17896         echo "Nope, it can't."
17897 fi
17898 set d_strctcpy
17899 eval $setvar
17900 $rm_try
17901
17902 : see if strerror and/or sys_errlist[] exist
17903 echo " "
17904 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17905     if set strerror val -f d_strerror; eval $csym; $val; then
17906                 echo 'strerror() found.' >&4
17907                 d_strerror="$define"
17908                 d_strerrm='strerror(e)'
17909                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17910                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17911                         d_syserrlst="$define"
17912                 else
17913                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17914                         d_syserrlst="$undef"
17915                 fi
17916     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17917                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17918                 echo 'strerror() found in string header.' >&4
17919                 d_strerror="$define"
17920                 d_strerrm='strerror(e)'
17921                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17922                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17923                                 d_syserrlst="$define"
17924                 else
17925                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17926                         d_syserrlst="$undef"
17927                 fi
17928     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17929                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17930                 d_strerror="$undef"
17931                 d_syserrlst="$define"
17932                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17933     else
17934                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17935                 d_strerror="$undef"
17936                 d_syserrlst="$undef"
17937                 d_strerrm='"unknown"'
17938     fi
17939 fi
17940
17941 : see if strerror_r exists
17942 set strerror_r d_strerror_r
17943 eval $inlibc
17944 case "$d_strerror_r" in
17945 "$define")
17946         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17947         case "$d_strerror_r_proto:$usethreads" in
17948         ":define")      d_strerror_r_proto=define
17949                 set d_strerror_r_proto strerror_r $hdrs
17950                 eval $hasproto ;;
17951         *)      ;;
17952         esac
17953         case "$d_strerror_r_proto" in
17954         define)
17955         case "$strerror_r_proto" in
17956         ''|0) try='int strerror_r(int, char*, size_t);'
17957         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17958         esac
17959         case "$strerror_r_proto" in
17960         ''|0) try='int strerror_r(int, char*, int);'
17961         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17962         esac
17963         case "$strerror_r_proto" in
17964         ''|0) try='char* strerror_r(int, char*, size_t);'
17965         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17966         esac
17967         case "$strerror_r_proto" in
17968         ''|0)   d_strerror_r=undef
17969                 strerror_r_proto=0
17970                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17971         * )     case "$strerror_r_proto" in
17972                 REENTRANT_PROTO*) ;;
17973                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17974                 esac
17975                 echo "Prototype: $try" ;;
17976         esac
17977         ;;
17978         *)      case "$usethreads" in
17979                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17980                 esac
17981                 d_strerror_r=undef
17982                 strerror_r_proto=0
17983                 ;;
17984         esac
17985         ;;
17986 *)      strerror_r_proto=0
17987         ;;
17988 esac
17989
17990 : see if strftime exists
17991 set strftime d_strftime
17992 eval $inlibc
17993
17994 : see if strlcat exists
17995 set strlcat d_strlcat
17996 eval $inlibc
17997
17998 : see if strlcpy exists
17999 set strlcpy d_strlcpy
18000 eval $inlibc
18001
18002 : see if strtod exists
18003 set strtod d_strtod
18004 eval $inlibc
18005
18006 : see if strtol exists
18007 set strtol d_strtol
18008 eval $inlibc
18009
18010 : see if strtold exists
18011 set strtold d_strtold
18012 eval $inlibc
18013
18014 : see if strtoll exists
18015 set strtoll d_strtoll
18016 eval $inlibc
18017
18018 case "$d_longlong-$d_strtoll" in
18019 "$define-$define")
18020         $cat <<EOM
18021 Checking whether your strtoll() works okay...
18022 EOM
18023         $cat >try.c <<'EOCP'
18024 #include <errno.h>
18025 #ifdef __hpux
18026 #define strtoll __strtoll
18027 #endif
18028 #ifdef __EMX__
18029 #define strtoll _strtoll
18030 #endif
18031 #include <stdio.h>
18032 extern long long int strtoll(char *s, char **, int);
18033 static int bad = 0;
18034 int check(char *s, long long ell, int een) {
18035         long long gll;
18036         errno = 0;
18037         gll = strtoll(s, 0, 10);
18038         if (!((gll == ell) && (errno == een)))
18039                 bad++;
18040 }
18041 int main() {
18042         check(" 1",                                      1LL, 0);
18043         check(" 0",                                      0LL, 0);
18044         check("-1",                                     -1LL, 0);
18045         check("-9223372036854775808", -9223372036854775808LL, 0);
18046         check("-9223372036854775808", -9223372036854775808LL, 0);
18047         check(" 9223372036854775807",  9223372036854775807LL, 0);
18048         check("-9223372036854775808", -9223372036854775808LL, 0);
18049         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18050         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18051         if (!bad)
18052                 printf("ok\n");
18053 }
18054 EOCP
18055         set try
18056         if eval $compile; then
18057                 yyy=`$run ./try`
18058                 case "$yyy" in
18059                 ok) echo "Your strtoll() seems to be working okay." ;;
18060                 *) cat <<EOM >&4
18061 Your strtoll() doesn't seem to be working okay.
18062 EOM
18063                    d_strtoll="$undef"
18064                    ;;
18065                 esac
18066         else
18067                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18068                 d_strtoll="$undef"
18069         fi
18070         ;;
18071 esac
18072
18073 : see if strtoq exists
18074 set strtoq d_strtoq
18075 eval $inlibc
18076
18077 : see if strtoul exists
18078 set strtoul d_strtoul
18079 eval $inlibc
18080
18081 case "$d_strtoul" in
18082 "$define")
18083         $cat <<EOM
18084 Checking whether your strtoul() works okay...
18085 EOM
18086         $cat >try.c <<'EOCP'
18087 #include <errno.h>
18088 #include <stdio.h>
18089 extern unsigned long int strtoul(char *s, char **, int);
18090 static int bad = 0;
18091 void check(char *s, unsigned long eul, int een) {
18092         unsigned long gul;
18093         errno = 0;
18094         gul = strtoul(s, 0, 10);
18095         if (!((gul == eul) && (errno == een)))
18096                 bad++;
18097 }
18098 int main() {
18099         check(" 1", 1L, 0);
18100         check(" 0", 0L, 0);
18101 EOCP
18102         case "$longsize" in
18103         8)
18104             $cat >>try.c <<'EOCP'
18105         check("18446744073709551615", 18446744073709551615UL, 0);
18106         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18107 #if 0 /* strtoul() for /^-/ strings is undefined. */
18108         check("-1", 18446744073709551615UL, 0);
18109         check("-18446744073709551614", 2, 0);
18110         check("-18446744073709551615", 1, 0);
18111         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18112         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18113 #endif
18114 EOCP
18115                 ;;
18116         4)
18117                     $cat >>try.c <<'EOCP'
18118         check("4294967295", 4294967295UL, 0);
18119         check("4294967296", 4294967295UL, ERANGE);
18120 #if 0 /* strtoul() for /^-/ strings is undefined. */
18121         check("-1", 4294967295UL, 0);
18122         check("-4294967294", 2, 0);
18123         check("-4294967295", 1, 0);
18124         check("-4294967296", 4294967295UL, ERANGE);
18125         check("-4294967297", 4294967295UL, ERANGE);
18126 #endif
18127 EOCP
18128                 ;;
18129         *)
18130 : Should we write these tests to be more portable by sprintf-ing
18131 : ~0 and then manipulating that char string as input for strtol?
18132                 ;;
18133         esac
18134         $cat >>try.c <<'EOCP'
18135         if (!bad)
18136                 printf("ok\n");
18137         return 0;
18138 }
18139 EOCP
18140         set try
18141         if eval $compile; then
18142                 case "`$run ./try`" in
18143                 ok) echo "Your strtoul() seems to be working okay." ;;
18144                 *) cat <<EOM >&4
18145 Your strtoul() doesn't seem to be working okay.
18146 EOM
18147                    d_strtoul="$undef"
18148                    ;;
18149                 esac
18150         else
18151                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18152                 d_strtoul="$undef"
18153         fi
18154         ;;
18155 esac
18156
18157 : see if strtoull exists
18158 set strtoull d_strtoull
18159 eval $inlibc
18160
18161 case "$d_longlong-$d_strtoull" in
18162 "$define-$define")
18163         $cat <<EOM
18164 Checking whether your strtoull() works okay...
18165 EOM
18166         $cat >try.c <<'EOCP'
18167 #include <errno.h>
18168 #ifdef __hpux
18169 #define strtoull __strtoull
18170 #endif
18171 #include <stdio.h>
18172 extern unsigned long long int strtoull(char *s, char **, int);
18173 static int bad = 0;
18174 int check(char *s, long long eull, int een) {
18175         long long gull;
18176         errno = 0;
18177         gull = strtoull(s, 0, 10);
18178         if (!((gull == eull) && (errno == een)))
18179                 bad++;
18180 }
18181 int main() {
18182         check(" 1",                                        1LL, 0);
18183         check(" 0",                                        0LL, 0);
18184         check("18446744073709551615",  18446744073709551615ULL, 0);
18185         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18186 #if 0 /* strtoull() for /^-/ strings is undefined. */
18187         check("-1",                    18446744073709551615ULL, 0);
18188         check("-18446744073709551614",                     2LL, 0);
18189         check("-18446744073709551615",                     1LL, 0);
18190         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18191         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18192 #endif
18193         if (!bad)
18194                 printf("ok\n");
18195 }
18196 EOCP
18197         set try
18198         if eval $compile; then
18199                 case "`$run ./try`" in
18200                 ok) echo "Your strtoull() seems to be working okay." ;;
18201                 *) cat <<EOM >&4
18202 Your strtoull() doesn't seem to be working okay.
18203 EOM
18204                    d_strtoull="$undef"
18205                    ;;
18206                 esac
18207         else
18208                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18209                 d_strtoull="$undef"
18210         fi
18211         ;;
18212 esac
18213
18214 : see if strtouq exists
18215 set strtouq d_strtouq
18216 eval $inlibc
18217
18218 case "$d_strtouq" in
18219 "$define")
18220         $cat <<EOM
18221 Checking whether your strtouq() works okay...
18222 EOM
18223         $cat >try.c <<'EOCP'
18224 #include <errno.h>
18225 #include <stdio.h>
18226 extern unsigned long long int strtouq(char *s, char **, int);
18227 static int bad = 0;
18228 void check(char *s, unsigned long long eull, int een) {
18229         unsigned long long gull;
18230         errno = 0;
18231         gull = strtouq(s, 0, 10);
18232         if (!((gull == eull) && (errno == een)))
18233                 bad++;
18234 }
18235 int main() {
18236         check(" 1",                                        1LL, 0);
18237         check(" 0",                                        0LL, 0);
18238         check("18446744073709551615",  18446744073709551615ULL, 0);
18239         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18240 #if 0 /* strtouq() for /^-/ strings is undefined. */
18241         check("-1",                    18446744073709551615ULL, 0);
18242         check("-18446744073709551614",                     2LL, 0);
18243         check("-18446744073709551615",                     1LL, 0);
18244         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18245         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18246 #endif
18247         if (!bad)
18248                 printf("ok\n");
18249         return 0;
18250 }
18251 EOCP
18252         set try
18253         if eval $compile; then
18254                 case "`$run ./try`" in
18255                 ok) echo "Your strtouq() seems to be working okay." ;;
18256                 *) cat <<EOM >&4
18257 Your strtouq() doesn't seem to be working okay.
18258 EOM
18259                    d_strtouq="$undef"
18260                    ;;
18261                 esac
18262         else
18263                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18264                 d_strtouq="$undef"
18265         fi
18266         ;;
18267 esac
18268
18269 : see if strxfrm exists
18270 set strxfrm d_strxfrm
18271 eval $inlibc
18272
18273 : see if symlink exists
18274 set symlink d_symlink
18275 eval $inlibc
18276
18277 : see if syscall exists
18278 set syscall d_syscall
18279 eval $inlibc
18280
18281 : see if prototype for syscall is available
18282 echo " "
18283 set d_syscallproto syscall $i_unistd unistd.h
18284 eval $hasproto
18285
18286 : see if sysconf exists
18287 set sysconf d_sysconf
18288 eval $inlibc
18289
18290 : see if system exists
18291 set system d_system
18292 eval $inlibc
18293
18294 : see if tcgetpgrp exists
18295 set tcgetpgrp d_tcgetpgrp
18296 eval $inlibc
18297
18298 : see if tcsetpgrp exists
18299 set tcsetpgrp d_tcsetpgrp
18300 eval $inlibc
18301
18302 : see if prototype for telldir is available
18303 echo " "
18304 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18305 eval $hasproto
18306
18307 : see if time exists
18308 echo " "
18309 if test "X$d_time" = X -o X"$timetype" = X; then
18310     if set time val -f d_time; eval $csym; $val; then
18311                 echo 'time() found.' >&4
18312                 val="$define"
18313                 rp="What is the type returned by time() on this system?"
18314                 set time_t timetype long stdio.h sys/types.h
18315                 eval $typedef_ask
18316     else
18317                 echo 'time() not found, hope that will do.' >&4
18318                 val="$undef"
18319                 timetype='int';
18320     fi
18321     set d_time
18322     eval $setvar
18323 fi
18324
18325 : see if timegm exists
18326 set timegm d_timegm
18327 eval $inlibc
18328
18329 : see if this is a sys/times.h system
18330 set sys/times.h i_systimes
18331 eval $inhdr
18332
18333 : see if times exists
18334 echo " "
18335 if set times val -f d_times; eval $csym; $val; then
18336         echo 'times() found.' >&4
18337         d_times="$define"
18338         inc=''
18339         case "$i_systimes" in
18340         "$define") inc='sys/times.h';;
18341         esac
18342         rp="What is the type returned by times() on this system?"
18343         set clock_t clocktype long stdio.h sys/types.h $inc
18344         eval $typedef_ask
18345 else
18346         echo 'times() NOT found, hope that will do.' >&4
18347         d_times="$undef"
18348         clocktype='int'
18349 fi
18350
18351 : see if tmpnam_r exists
18352 set tmpnam_r d_tmpnam_r
18353 eval $inlibc
18354 case "$d_tmpnam_r" in
18355 "$define")
18356         hdrs="$i_systypes sys/types.h define stdio.h "
18357         case "$d_tmpnam_r_proto:$usethreads" in
18358         ":define")      d_tmpnam_r_proto=define
18359                 set d_tmpnam_r_proto tmpnam_r $hdrs
18360                 eval $hasproto ;;
18361         *)      ;;
18362         esac
18363         case "$d_tmpnam_r_proto" in
18364         define)
18365         case "$tmpnam_r_proto" in
18366         ''|0) try='char* tmpnam_r(char*);'
18367         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18368         esac
18369         case "$tmpnam_r_proto" in
18370         ''|0)   d_tmpnam_r=undef
18371                 tmpnam_r_proto=0
18372                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18373         * )     case "$tmpnam_r_proto" in
18374                 REENTRANT_PROTO*) ;;
18375                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18376                 esac
18377                 echo "Prototype: $try" ;;
18378         esac
18379         ;;
18380         *)      case "$usethreads" in
18381                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18382                 esac
18383                 d_tmpnam_r=undef
18384                 tmpnam_r_proto=0
18385                 ;;
18386         esac
18387         ;;
18388 *)      tmpnam_r_proto=0
18389         ;;
18390 esac
18391
18392 : see if truncate exists
18393 set truncate d_truncate
18394 eval $inlibc
18395
18396 : see if ttyname_r exists
18397 set ttyname_r d_ttyname_r
18398 eval $inlibc
18399 case "$d_ttyname_r" in
18400 "$define")
18401         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18402         case "$d_ttyname_r_proto:$usethreads" in
18403         ":define")      d_ttyname_r_proto=define
18404                 set d_ttyname_r_proto ttyname_r $hdrs
18405                 eval $hasproto ;;
18406         *)      ;;
18407         esac
18408         case "$d_ttyname_r_proto" in
18409         define)
18410         case "$ttyname_r_proto" in
18411         ''|0) try='int ttyname_r(int, char*, size_t);'
18412         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18413         esac
18414         case "$ttyname_r_proto" in
18415         ''|0) try='int ttyname_r(int, char*, int);'
18416         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18417         esac
18418         case "$ttyname_r_proto" in
18419         ''|0) try='char* ttyname_r(int, char*, int);'
18420         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18421         esac
18422         case "$ttyname_r_proto" in
18423         ''|0)   d_ttyname_r=undef
18424                 ttyname_r_proto=0
18425                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18426         * )     case "$ttyname_r_proto" in
18427                 REENTRANT_PROTO*) ;;
18428                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18429                 esac
18430                 echo "Prototype: $try" ;;
18431         esac
18432         ;;
18433         *)      case "$usethreads" in
18434                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18435                 esac
18436                 d_ttyname_r=undef
18437                 ttyname_r_proto=0
18438                 ;;
18439         esac
18440         ;;
18441 *)      ttyname_r_proto=0
18442         ;;
18443 esac
18444
18445 : see if tzname[] exists
18446 echo " "
18447 if set tzname val -a d_tzname; eval $csym; $val; then
18448         val="$define"
18449         echo 'tzname[] found.' >&4
18450 else
18451         val="$undef"
18452         echo 'tzname[] NOT found.' >&4
18453 fi
18454 set d_tzname
18455 eval $setvar
18456
18457 : Check if is a multiplatform env
18458 case "$osname" in
18459 next|rhapsody|darwin) multiarch="$define" ;;
18460 esac
18461 case "$multiarch" in
18462 ''|[nN]*) multiarch="$undef" ;;
18463 esac
18464
18465 : check for ordering of bytes in a UV
18466 echo " "
18467 case "$usecrosscompile$multiarch" in
18468 *$define*)
18469         $cat <<EOM
18470 You seem to be either cross-compiling or doing a multiarchitecture build,
18471 skipping the byteorder check.
18472
18473 EOM
18474         byteorder='ffff'
18475         ;;
18476 *)
18477         case "$byteorder" in
18478         '')
18479                 $cat <<'EOM'
18480 In the following, larger digits indicate more significance.  A big-endian
18481 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18482 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18483 machines may have weird orders like 3412.  A Cray will report 87654321,
18484 an Alpha will report 12345678. If the test program works the default is
18485 probably right.
18486 I'm now running the test program...
18487 EOM
18488                 $cat >try.c <<EOCP
18489 #include <stdio.h>
18490 #$i_stdlib I_STDLIB
18491 #ifdef I_STDLIB
18492 #include <stdlib.h>
18493 #endif
18494 #include <sys/types.h>
18495 typedef $uvtype UV;
18496 int main()
18497 {
18498         int i;
18499         union {
18500                 UV l;
18501                 char c[$uvsize];
18502         } u;
18503
18504         if ($uvsize > 4)
18505                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18506         else
18507                 u.l = (UV)0x04030201;
18508         for (i = 0; i < $uvsize; i++)
18509                 printf("%c", u.c[i]+'0');
18510         printf("\n");
18511         exit(0);
18512 }
18513 EOCP
18514                 xxx_prompt=y
18515                 set try
18516                 if eval $compile && $run ./try > /dev/null; then
18517                         dflt=`$run ./try`
18518                         case "$dflt" in
18519                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18520                                 echo "(The test program ran ok.)"
18521                                 echo "byteorder=$dflt"
18522                                 xxx_prompt=n
18523                         ;;
18524                         ????|????????) echo "(The test program ran ok.)" ;;
18525                         *) echo "(The test program didn't run right for some reason.)" ;;
18526                         esac
18527                 else
18528                         dflt='4321'
18529                         cat <<'EOM'
18530 (I can't seem to compile the test program.  Guessing big-endian...)
18531 EOM
18532                 fi
18533                 case "$xxx_prompt" in
18534                 y)
18535                         rp="What is the order of bytes in $uvtype?"
18536                         . ./myread
18537                         byteorder="$ans"
18538                         ;;
18539                 *)      byteorder=$dflt
18540                         ;;
18541                 esac
18542                 ;;
18543         esac
18544         $rm_try
18545         ;;
18546 esac
18547
18548 : Checking 32bit aligndness
18549 $cat <<EOM
18550
18551 Checking to see whether you can access character data unalignedly...
18552 EOM
18553 case "$d_u32align" in
18554 '')   $cat >try.c <<EOCP
18555 #include <stdio.h>
18556 #$i_stdlib I_STDLIB
18557 #ifdef I_STDLIB
18558 #include <stdlib.h>
18559 #endif
18560 #define U32 $u32type
18561 #define BYTEORDER 0x$byteorder
18562 #define U8 $u8type
18563 #include <signal.h>
18564 #ifdef SIGBUS
18565 $signal_t bletch(int s) { exit(4); }
18566 #endif
18567 int main() {
18568 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18569     U8 buf[8];
18570     U32 *up;
18571     int i;
18572
18573     if (sizeof(U32) != 4) {
18574         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18575         exit(1);
18576     }
18577
18578     fflush(stdout);
18579
18580 #ifdef SIGBUS
18581     signal(SIGBUS, bletch);
18582 #endif
18583
18584     buf[0] = 0;
18585     buf[1] = 0;
18586     buf[2] = 0;
18587     buf[3] = 1;
18588     buf[4] = 0;
18589     buf[5] = 0;
18590     buf[6] = 0;
18591     buf[7] = 1;
18592
18593     for (i = 0; i < 4; i++) {
18594         up = (U32*)(buf + i);
18595         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18596                (*up == 1 << (8*(3-i)))  /* little-endian */
18597               )
18598            )
18599         {
18600             printf("read failed (%x)\n", *up);
18601             exit(2);
18602         }
18603     }
18604
18605     /* write test */
18606     for (i = 0; i < 4; i++) {
18607         up = (U32*)(buf + i);
18608         *up = 0xBeef;
18609         if (*up != 0xBeef) {
18610             printf("write failed (%x)\n", *up);
18611             exit(3);
18612         }
18613     }
18614
18615     exit(0);
18616 #else
18617     printf("1\n");
18618     exit(1);
18619 #endif
18620     return 0;
18621 }
18622 EOCP
18623 set try
18624 if eval $compile_ok; then
18625         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18626         $run ./try 2>&1 >/dev/null
18627         case "$?" in
18628         0)      cat >&4 <<EOM
18629 You can access character data pretty unalignedly.
18630 EOM
18631                 d_u32align="$undef"
18632                 ;;
18633         *)      cat >&4 <<EOM
18634 It seems that you must access character data in an aligned manner.
18635 EOM
18636                 d_u32align="$define"
18637                 ;;
18638         esac
18639 else
18640         rp='Can you access character data at unaligned addresses?'
18641         dflt='n'
18642         . ./myread
18643         case "$ans" in
18644         [yY]*)  d_u32align="$undef"  ;;
18645         *)      d_u32align="$define" ;;
18646         esac
18647 fi
18648 $rm_try
18649 ;;
18650 esac
18651
18652 : see if ualarm exists
18653 set ualarm d_ualarm
18654 eval $inlibc
18655
18656 : see if umask exists
18657 set umask d_umask
18658 eval $inlibc
18659
18660 : see if unordered exists
18661 set unordered d_unordered
18662 eval $inlibc
18663
18664 : see if unsetenv exists
18665 set unsetenv d_unsetenv
18666 eval $inlibc
18667
18668 : see if usleep exists
18669 set usleep d_usleep
18670 eval $inlibc
18671
18672 : see if prototype for usleep is available
18673 echo " "
18674 set d_usleepproto usleep $i_unistd unistd.h
18675 eval $hasproto
18676
18677 : see if ustat exists
18678 set ustat d_ustat
18679 eval $inlibc
18680
18681 : see if closedir exists
18682 set closedir d_closedir
18683 eval $inlibc
18684
18685 case "$d_closedir" in
18686 "$define")
18687         echo " "
18688         echo "Checking whether closedir() returns a status..." >&4
18689         cat > try.c <<EOM
18690 #$i_dirent I_DIRENT             /**/
18691 #$i_sysdir I_SYS_DIR            /**/
18692 #$i_sysndir I_SYS_NDIR          /**/
18693 #$i_systypes I_SYS_TYPES        /**/
18694
18695 #if defined(I_SYS_TYPES)
18696 #include <sys/types.h>
18697 #endif
18698 #if defined(I_DIRENT)
18699 #include <dirent.h>
18700 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18701 #include <sys/dir.h>
18702 #endif
18703 #else
18704 #ifdef I_SYS_NDIR
18705 #include <sys/ndir.h>
18706 #else
18707 #ifdef I_SYS_DIR
18708 #ifdef hp9000s500
18709 #include <ndir.h>       /* may be wrong in the future */
18710 #else
18711 #include <sys/dir.h>
18712 #endif
18713 #endif
18714 #endif
18715 #endif
18716 int main() { return closedir(opendir(".")); }
18717 EOM
18718         set try
18719         if eval $compile_ok; then
18720                 if $run ./try > /dev/null 2>&1 ; then
18721                         echo "Yes, it does."
18722                         val="$undef"
18723                 else
18724                         echo "No, it doesn't."
18725                         val="$define"
18726                 fi
18727         else
18728                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18729                 val="$define"
18730         fi
18731         ;;
18732 *)
18733         val="$undef";
18734         ;;
18735 esac
18736 set d_void_closedir
18737 eval $setvar
18738 $rm_try
18739
18740 : see if there is a wait4
18741 set wait4 d_wait4
18742 eval $inlibc
18743
18744 : see if waitpid exists
18745 set waitpid d_waitpid
18746 eval $inlibc
18747
18748 : see if wcstombs exists
18749 set wcstombs d_wcstombs
18750 eval $inlibc
18751
18752 : see if wctomb exists
18753 set wctomb d_wctomb
18754 eval $inlibc
18755
18756 : see if writev exists
18757 set writev d_writev
18758 eval $inlibc
18759
18760 : preserve RCS keywords in files with variable substitution, grrr
18761 Date='$Date'
18762 Id='$Id'
18763 Log='$Log'
18764 RCSfile='$RCSfile'
18765 Revision='$Revision'
18766
18767 : check for alignment requirements
18768 echo " "
18769 case "$usecrosscompile$multiarch" in
18770 *$define*)
18771         $cat <<EOM
18772 You seem to be either cross-compiling or doing a multiarchitecture build,
18773 skipping the memory alignment check.
18774
18775 EOM
18776         case "$alignbytes" in
18777         '') alignbytes=8 ;;
18778         esac
18779         ;;
18780 *)
18781         case "$alignbytes" in
18782         '') echo "Checking alignment constraints..." >&4
18783                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18784                         $cat >try.c <<'EOCP'
18785 typedef long double NV;
18786 EOCP
18787                 else
18788                         $cat >try.c <<'EOCP'
18789 typedef double NV;
18790 EOCP
18791                 fi
18792                 $cat >>try.c <<'EOCP'
18793 #include <stdio.h>
18794 struct foobar {
18795         char foo;
18796         NV bar;
18797 } try_algn;
18798 int main()
18799 {
18800     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18801     return(0);
18802 }
18803 EOCP
18804                 set try
18805                 if eval $compile_ok; then
18806                         dflt=`$run ./try`
18807                 else
18808                         dflt='8'
18809                         echo "(I can't seem to compile the test program...)"
18810                 fi
18811                 ;;
18812         *) dflt="$alignbytes"
18813                 ;;
18814         esac
18815         rp="Doubles must be aligned on a how-many-byte boundary?"
18816         . ./myread
18817         alignbytes="$ans"
18818         $rm_try
18819         ;;
18820 esac
18821
18822
18823 : set the base revision
18824 baserev=5.0
18825
18826 : check for length of character
18827 echo " "
18828 case "$charsize" in
18829 '')
18830         echo "Checking to see how big your characters are (hey, you never know)..." >&4
18831         $cat >try.c <<EOCP
18832 #include <stdio.h>
18833 #$i_stdlib I_STDLIB
18834 #ifdef I_STDLIB
18835 #include <stdlib.h>
18836 #endif
18837 int main()
18838 {
18839     printf("%d\n", (int)sizeof(char));
18840     exit(0);
18841 }
18842 EOCP
18843         set try
18844         if eval $compile_ok; then
18845                 dflt=`$run ./try`
18846         else
18847                 dflt='1'
18848                 echo "(I can't seem to compile the test program.  Guessing...)"
18849         fi
18850         ;;
18851 *)
18852         dflt="$charsize"
18853         ;;
18854 esac
18855 rp="What is the size of a character (in bytes)?"
18856 . ./myread
18857 charsize="$ans"
18858 $rm_try
18859
18860 : Check for the number of bits in a character
18861 case "$charbits" in
18862 '')     echo "Checking how long a character is (in bits)..." >&4
18863         $cat >try.c <<EOCP
18864 #include <stdio.h>
18865 int main ()
18866 {
18867     int n;
18868     unsigned char c;
18869     for (c = 1, n = 0; c; c <<= 1, n++) ;
18870     printf ("%d\n", n);
18871     return (0);
18872     }
18873 EOCP
18874         set try
18875         if eval $compile_ok; then
18876                 dflt=`$run ./try`
18877         else
18878                 dflt='8'
18879                 echo "(I can't seem to compile the test program.  Guessing...)"
18880         fi
18881         ;;
18882 *)
18883         dflt="$charbits"
18884         ;;
18885 esac
18886 rp="What is the length of a character (in bits)?"
18887 . ./myread
18888 charbits="$ans"
18889 $rm_try
18890 case "$charbits" in
18891 8)      ;;
18892 *)      cat >&4 << EOM
18893 Your system has an unsigned character size of $charbits bits, which
18894 is rather unusual (normally it is 8 bits).  Perl likely will not work
18895 correctly on your system, with subtle bugs in various places.
18896 EOM
18897         rp='Do you really want to continue?'
18898         dflt='n'
18899         . ./myread
18900         case "$ans" in
18901                 [yY])   echo >&4 "Okay, continuing."    ;;
18902                 *)      exit 1                          ;;
18903         esac
18904 esac
18905
18906 : how do we concatenate cpp tokens here?
18907 echo " "
18908 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18909 $cat >cpp_stuff.c <<'EOCP'
18910 #define RCAT(a,b)a/**/b
18911 #define ACAT(a,b)a ## b
18912 RCAT(Rei,ser)
18913 ACAT(Cir,cus)
18914 EOCP
18915 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18916 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18917         echo "Oh!  Smells like ANSI's been here." >&4
18918         echo "We can catify or stringify, separately or together!"
18919         cpp_stuff=42
18920 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18921         echo "Ah, yes!  The good old days!" >&4
18922         echo "However, in the good old days we don't know how to stringify and"
18923         echo "catify at the same time."
18924         cpp_stuff=1
18925 else
18926         $cat >&4 <<EOM
18927 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18928 You're going to have to edit the values of CAT[2-5] in config.h...
18929 EOM
18930         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18931 fi
18932 $rm -f cpp_stuff.*
18933
18934 : see if this is a db.h system
18935 set db.h i_db
18936 eval $inhdr
18937
18938 case "$i_db" in
18939 $define)
18940         : Check db version.
18941         echo " "
18942         echo "Checking Berkeley DB version ..." >&4
18943         $cat >try.c <<EOCP
18944 #$d_const HASCONST
18945 #ifndef HASCONST
18946 #define const
18947 #endif
18948 #include <sys/types.h>
18949 #include <stdio.h>
18950 #$i_stdlib I_STDLIB
18951 #ifdef I_STDLIB
18952 #include <stdlib.h>
18953 #endif
18954 #include <db.h>
18955 int main(int argc, char *argv[])
18956 {
18957 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18958     int Major, Minor, Patch ;
18959     unsigned long Version ;
18960     (void)db_version(&Major, &Minor, &Patch) ;
18961     if (argc == 2) {
18962         printf("%d %d %d %d %d %d\n",
18963                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18964                Major, Minor, Patch);
18965         exit(0);
18966     }
18967     printf("You have Berkeley DB Version 2 or greater.\n");
18968
18969     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18970                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18971     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18972                 Major, Minor, Patch) ;
18973
18974     /* check that db.h & libdb are compatible */
18975     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18976         printf("db.h and libdb are incompatible.\n") ;
18977         exit(3);
18978     }
18979
18980     printf("db.h and libdb are compatible.\n") ;
18981
18982     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18983                 + DB_VERSION_PATCH ;
18984
18985     /* needs to be >= 2.3.4 */
18986     if (Version < 2003004) {
18987     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18988         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18989         exit(2);
18990     }
18991
18992     exit(0);
18993 #else
18994 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18995     if (argc == 2) {
18996         printf("1 0 0\n");
18997         exit(0);
18998     }
18999     printf("You have Berkeley DB Version 1.\n");
19000     exit(0);    /* DB version < 2: the coast is clear. */
19001 #else
19002     exit(1);    /* <db.h> not Berkeley DB? */
19003 #endif
19004 #endif
19005 }
19006 EOCP
19007         set try
19008         if eval $compile_ok && $run ./try; then
19009                 echo 'Looks OK.' >&4
19010                 set `$run ./try 1`
19011                 db_version_major=$1
19012                 db_version_minor=$2
19013                 db_version_patch=$3
19014         else
19015                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19016                 i_db=$undef
19017                 case " $libs " in
19018                 *"-ldb "*)
19019                         : Remove db from list of libraries to use
19020                         echo "Removing unusable -ldb from library list" >&4
19021                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19022                         shift
19023                         libs="$*"
19024                         echo "libs = $libs" >&4
19025                         ;;
19026                 esac
19027         fi
19028         $rm_try
19029         ;;
19030 esac
19031
19032 case "$i_db" in
19033 define)
19034         : Check the return type needed for hash
19035         echo " "
19036         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19037         $cat >try.c <<EOCP
19038 #$d_const HASCONST
19039 #ifndef HASCONST
19040 #define const
19041 #endif
19042 #include <sys/types.h>
19043 #include <db.h>
19044
19045 #ifndef DB_VERSION_MAJOR
19046 u_int32_t hash_cb (ptr, size)
19047 const void *ptr;
19048 size_t size;
19049 {
19050 }
19051 HASHINFO info;
19052 int main()
19053 {
19054         info.hash = hash_cb;
19055 }
19056 #endif
19057 EOCP
19058         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19059                 if $contains warning try.out >>/dev/null 2>&1 ; then
19060                         db_hashtype='int'
19061                 else
19062                         db_hashtype='u_int32_t'
19063                 fi
19064         else
19065                 : XXX Maybe we should just give up here.
19066                 db_hashtype=u_int32_t
19067                 $cat try.out >&4
19068                 echo "Help:  I can't seem to compile the db test program." >&4
19069                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19070         fi
19071         $rm_try
19072         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19073         ;;
19074 *)      db_hashtype=u_int32_t
19075         ;;
19076 esac
19077 case "$i_db" in
19078 define)
19079         : Check the return type needed for prefix
19080         echo " "
19081         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19082         cat >try.c <<EOCP
19083 #$d_const HASCONST
19084 #ifndef HASCONST
19085 #define const
19086 #endif
19087 #include <sys/types.h>
19088 #include <db.h>
19089
19090 #ifndef DB_VERSION_MAJOR
19091 size_t prefix_cb (key1, key2)
19092 const DBT *key1;
19093 const DBT *key2;
19094 {
19095 }
19096 BTREEINFO info;
19097 int main()
19098 {
19099         info.prefix = prefix_cb;
19100 }
19101 #endif
19102 EOCP
19103         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19104                 if $contains warning try.out >>/dev/null 2>&1 ; then
19105                         db_prefixtype='int'
19106                 else
19107                         db_prefixtype='size_t'
19108                 fi
19109         else
19110                 db_prefixtype='size_t'
19111                 : XXX Maybe we should just give up here.
19112                 $cat try.out >&4
19113                 echo "Help:  I can't seem to compile the db test program." >&4
19114                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19115         fi
19116         $rm_try
19117         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19118         ;;
19119 *)      db_prefixtype='size_t'
19120         ;;
19121 esac
19122
19123 : How can we generate normalized random numbers ?
19124 echo " "
19125 echo "Looking for a random number function..." >&4
19126 case "$randfunc" in
19127 '')
19128         if set drand48 val -f; eval $csym; $val; then
19129                 dflt="drand48"
19130                 echo "Good, found drand48()." >&4
19131         elif set random val -f; eval $csym; $val; then
19132                 dflt="random"
19133                 echo "OK, found random()." >&4
19134         else
19135                 dflt="rand"
19136                 echo "Yick, looks like I have to use rand()." >&4
19137         fi
19138         echo " "
19139         ;;
19140 *)
19141         dflt="$randfunc"
19142         ;;
19143 esac
19144 cont=true
19145
19146 case "$ccflags" in
19147 *-Dmy_rand=*|*-Dmy_srand=*)
19148         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19149         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19150         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19151         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19152         ;;
19153 esac
19154
19155 while $test "$cont"; do
19156         rp="Use which function to generate random numbers?"
19157         . ./myread
19158         if $test "$ans" = "$dflt"; then
19159                 : null
19160         else
19161                 randbits=''
19162         fi
19163         randfunc="$ans"
19164         if set $ans val -f; eval $csym; $val; then
19165                 cont=''
19166         else
19167                 dflt=y
19168                 rp="I cannot find function $ans. Use that name anyway?"
19169                 . ./myread
19170                 dflt=rand
19171                 case "$ans" in
19172                         [yY]*) cont='';;
19173                 esac
19174         fi
19175         case "$cont" in
19176         '')
19177                 case "$randfunc" in
19178                 drand48)
19179                         drand01="drand48()"
19180                         seedfunc="srand48"
19181                         randbits=48
19182                         randseedtype=long
19183                         ;;
19184                 rand|random)
19185                         case "$randbits" in
19186                         '')
19187 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19188                                 $cat >try.c <<EOCP
19189 #$i_unistd I_UNISTD
19190 #$i_stdlib I_STDLIB
19191 #include <stdio.h>
19192 #ifdef I_UNISTD
19193 #  include <unistd.h>
19194 #endif
19195 #ifdef I_STDLIB
19196 #  include <stdlib.h>
19197 #endif
19198 int main()
19199 {
19200         register int i;
19201         register unsigned long tmp;
19202         register unsigned long max = 0L;
19203
19204         for (i = 1000; i; i--) {
19205                 tmp = (unsigned long) $randfunc();
19206                 if (tmp > max) max = tmp;
19207         }
19208         for (i = 0; max; i++)
19209                 max /= 2;
19210         printf("%d\n",i);
19211 }
19212 EOCP
19213                                 set try
19214                                 if eval $compile_ok; then
19215                                         dflt=`try`
19216                                 else
19217                                         dflt='?'
19218                                         echo "(I can't seem to compile the test program...)"
19219                                 fi
19220                                 ;;
19221                         *)
19222                                 dflt="$randbits"
19223                                 ;;
19224                         esac
19225                         rp="How many bits does your $randfunc() function produce?"
19226                         . ./myread
19227                         randbits="$ans"
19228                         $rm_try
19229                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19230                         seedfunc="s$randfunc"
19231                         randseedtype=unsigned
19232                         ;;
19233                 *)
19234                         dflt="31"
19235                         rp="How many bits does your $randfunc() function produce?"
19236                         . ./myread
19237                         randbits="$ans"
19238                         seedfunc="s$randfunc"
19239                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19240                         if set $seedfunc val -f; eval $csym; $val; then
19241                                 echo "(Using $seedfunc() to seed random generator)"
19242                         else
19243                                 echo "(Warning: no $seedfunc() to seed random generator)"
19244                                 seedfunc=rand
19245                         fi
19246                         randseedtype=unsigned
19247                         ;;
19248                 esac
19249                 ;;
19250         esac
19251 done
19252
19253 : Determine if this is an EBCDIC system
19254 echo " "
19255 echo "Determining whether or not we are on an EBCDIC system..." >&4
19256 $cat >try.c <<'EOM'
19257 int main()
19258 {
19259   if ('M'==0xd4) return 0;
19260   return 1;
19261 }
19262 EOM
19263
19264 val=$undef
19265 set try
19266 if eval $compile_ok; then
19267         if $run ./try; then
19268                 echo "You seem to speak EBCDIC." >&4
19269                 val="$define"
19270         else
19271                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19272         fi
19273 else
19274         echo "I'm unable to compile the test program." >&4
19275         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19276 fi
19277 $rm_try
19278 set ebcdic
19279 eval $setvar
19280
19281 : Check how to flush
19282 echo " "
19283 $cat >&4 <<EOM
19284 Checking how to flush all pending stdio output...
19285 EOM
19286 # I only know how to find the first 32 possibly open files on SunOS.
19287 # See also hints/sunos_4_1.sh and util.c  --AD
19288 case "$osname" in
19289 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19290 esac
19291 $cat >>try.c <<EOCP
19292 #include <stdio.h>
19293 #$i_stdlib I_STDLIB
19294 #ifdef I_STDLIB
19295 #include <stdlib.h>
19296 #endif
19297 #$i_unistd I_UNISTD
19298 #ifdef I_UNISTD
19299 # include <unistd.h>
19300 #endif
19301 #$d_sysconf HAS_SYSCONF
19302 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19303 #ifdef HAS_STDIO_STREAM_ARRAY
19304 # define STDIO_STREAM_ARRAY $stdio_stream_array
19305 #endif
19306 int main() {
19307   FILE* p;
19308   unlink("try.out");
19309   p = fopen("try.out", "w");
19310 #ifdef TRY_FPUTC
19311   fputc('x', p);
19312 #else
19313 # ifdef TRY_FPRINTF
19314   fprintf(p, "x");
19315 # endif
19316 #endif
19317 #ifdef TRY_FFLUSH_NULL
19318   fflush(NULL);
19319 #endif
19320 #ifdef TRY_FFLUSH_ALL
19321   {
19322     long open_max = -1;
19323 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19324     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19325 # else
19326 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19327     open_max = sysconf(_SC_OPEN_MAX);
19328 #  else
19329 #   ifdef FOPEN_MAX
19330     open_max = FOPEN_MAX;
19331 #   else
19332 #    ifdef OPEN_MAX
19333     open_max = OPEN_MAX;
19334 #    else
19335 #     ifdef _NFILE
19336     open_max = _NFILE;
19337 #     endif
19338 #    endif
19339 #   endif
19340 #  endif
19341 # endif
19342 # ifdef HAS_STDIO_STREAM_ARRAY
19343     if (open_max > 0) {
19344       long i;
19345       for (i = 0; i < open_max; i++)
19346             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19347                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19348                 STDIO_STREAM_ARRAY[i]._flag)
19349                 fflush(&STDIO_STREAM_ARRAY[i]);
19350     }
19351   }
19352 # endif
19353 #endif
19354   _exit(42);
19355 }
19356 EOCP
19357 : first we have to find out how _not_ to flush
19358 $to try.c
19359 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19360     output=''
19361     set try -DTRY_FPUTC
19362     if eval $compile; then
19363             $run ./try 2>/dev/null
19364             code="$?"
19365             $from try.out
19366             if $test ! -s try.out -a "X$code" = X42; then
19367                 output=-DTRY_FPUTC
19368             fi
19369     fi
19370     case "$output" in
19371     '')
19372             set try -DTRY_FPRINTF
19373             if eval $compile; then
19374                     $run ./try 2>/dev/null
19375                     code="$?"
19376                     $from try.out
19377                     if $test ! -s try.out -a "X$code" = X42; then
19378                         output=-DTRY_FPRINTF
19379                     fi
19380             fi
19381         ;;
19382     esac
19383 fi
19384 : check for fflush NULL behaviour
19385 case "$fflushNULL" in
19386 '')     set try -DTRY_FFLUSH_NULL $output
19387         if eval $compile; then
19388                 $run ./try 2>/dev/null
19389                 code="$?"
19390                 $from try.out
19391                 if $test -s try.out -a "X$code" = X42; then
19392                         fflushNULL="`$cat try.out`"
19393                 else
19394                         if $test "X$code" != X42; then
19395                                 $cat >&4 <<EOM
19396 (If this test failed, don't worry, we'll try another method shortly.)
19397 EOM
19398                         fi
19399                 fi
19400         fi
19401         $rm -f core try.core core.try.*
19402         case "$fflushNULL" in
19403         x)      $cat >&4 <<EOM
19404 Your fflush(NULL) works okay for output streams.
19405 Let's see if it clobbers input pipes...
19406 EOM
19407 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19408 # bug that improperly flushes the input end of pipes.  So we avoid the
19409 # autoflush on fork/system/exec support for now. :-(
19410 $cat >tryp.c <<EOCP
19411 #include <stdio.h>
19412 int
19413 main(int argc, char **argv)
19414 {
19415     char buf[1024];
19416     int i;
19417     char *bp = buf;
19418     while (1) {
19419         while ((i = getc(stdin)) != -1
19420                && (*bp++ = i) != '\n'
19421                && bp < &buf[1024])
19422         /* DO NOTHING */ ;
19423         *bp = '\0';
19424         fprintf(stdout, "%s", buf);
19425         fflush(NULL);
19426         if (i == -1)
19427             return 0;
19428         bp = buf;
19429     }
19430 }
19431 EOCP
19432                 fflushNULL="$define"
19433                 set tryp
19434                 if eval $compile; then
19435                     $rm -f tryp.out
19436                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19437                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19438                        $cat >&4 <<EOM
19439 fflush(NULL) seems to behave okay with input streams.
19440 EOM
19441                         fflushNULL="$define"
19442                     else
19443                         $cat >&4 <<EOM
19444 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19445 EOM
19446                         fflushNULL="$undef"
19447                     fi
19448                 fi
19449                 $rm -f core tryp.c tryp.core core.tryp.*
19450                 ;;
19451         '')     $cat >&4 <<EOM
19452 Your fflush(NULL) isn't working (contrary to ANSI C).
19453 EOM
19454                 fflushNULL="$undef"
19455                 ;;
19456         *)      $cat >&4 <<EOM
19457 Cannot figure out whether your fflush(NULL) works or not.
19458 I'm assuming it doesn't (contrary to ANSI C).
19459 EOM
19460                 fflushNULL="$undef"
19461                 ;;
19462         esac
19463         ;;
19464 $define|true|[yY]*)
19465         fflushNULL="$define"
19466         ;;
19467 *)
19468         fflushNULL="$undef"
19469         ;;
19470 esac
19471 : check explicit looping only if NULL did not work, and if the pipe
19472 : bug does not show up on an explicit flush too
19473 case "$fflushNULL" in
19474 "$undef")
19475         $cat >tryp.c <<EOCP
19476 #include <stdio.h>
19477 int
19478 main(int argc, char **argv)
19479 {
19480     char buf[1024];
19481     int i;
19482     char *bp = buf;
19483     while (1) {
19484         while ((i = getc(stdin)) != -1
19485                && (*bp++ = i) != '\n'
19486                && bp < &buf[1024])
19487         /* DO NOTHING */ ;
19488         *bp = '\0';
19489         fprintf(stdout, "%s", buf);
19490         fflush(stdin);
19491         if (i == -1)
19492             return 0;
19493         bp = buf;
19494     }
19495 }
19496 EOCP
19497         set tryp
19498         if eval $compile; then
19499             $rm -f tryp.out
19500             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19501             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19502                $cat >&4 <<EOM
19503 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19504 EOM
19505                 : now check for fflushall behaviour
19506                 case "$fflushall" in
19507                 '')     set try -DTRY_FFLUSH_ALL $output
19508                         if eval $compile; then
19509                                 $cat >&4 <<EOM
19510 (Now testing the other method--but note that this also may fail.)
19511 EOM
19512                                 $run ./try 2>/dev/null
19513                                 code=$?
19514                                 $from try.out
19515                                 if $test -s try.out -a "X$code" = X42; then
19516                                         fflushall="`$cat try.out`"
19517                                 fi
19518                         fi
19519                         $rm_try
19520                         case "$fflushall" in
19521                         x)      $cat >&4 <<EOM
19522 Whew. Flushing explicitly all the stdio streams works.
19523 EOM
19524                                 fflushall="$define"
19525                                 ;;
19526                         '')     $cat >&4 <<EOM
19527 Sigh. Flushing explicitly all the stdio streams doesn't work.
19528 EOM
19529                                 fflushall="$undef"
19530                                 ;;
19531                         *)      $cat >&4 <<EOM
19532 Cannot figure out whether flushing stdio streams explicitly works or not.
19533 I'm assuming it doesn't.
19534 EOM
19535                                 fflushall="$undef"
19536                                 ;;
19537                         esac
19538                         ;;
19539                 "$define"|true|[yY]*)
19540                         fflushall="$define"
19541                         ;;
19542                 *)
19543                         fflushall="$undef"
19544                         ;;
19545                 esac
19546             else
19547                 $cat >&4 <<EOM
19548 All is futile.  Even fflush(stdin) clobbers input pipes!
19549 EOM
19550                 fflushall="$undef"
19551             fi
19552         else
19553             fflushall="$undef"
19554         fi
19555         $rm -f core tryp.c tryp.core core.tryp.*
19556         ;;
19557 *)      fflushall="$undef"
19558         ;;
19559 esac
19560
19561 case "$fflushNULL$fflushall" in
19562 undefundef)
19563         $cat <<EOM
19564 OK, I give up.  I cannot figure out how to flush pending stdio output.
19565 We won't be flushing handles at all before fork/exec/popen.
19566 EOM
19567         ;;
19568 esac
19569 $rm_try tryp
19570
19571 : Store the full pathname to the ar program for use in the C program
19572 : Respect a hint or command line value for full_ar.
19573 case "$full_ar" in
19574 '') full_ar=$ar ;;
19575 esac
19576
19577 : Store the full pathname to the sed program for use in the C program
19578 full_sed=$sed
19579
19580 : see what type gids are declared as in the kernel
19581 echo " "
19582 echo "Looking for the type for group ids returned by getgid()."
19583 set gid_t gidtype xxx stdio.h sys/types.h
19584 eval $typedef
19585 case "$gidtype" in
19586 xxx)
19587         xxx=`./findhdr sys/user.h`
19588         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19589         case $1 in
19590         unsigned) dflt="$1 $2" ;;
19591         *) dflt="$1" ;;
19592         esac
19593         ;;
19594 *) dflt="$gidtype";;
19595 esac
19596 case "$gidtype" in
19597 gid_t) echo "gid_t found." ;;
19598 *)      rp="What is the type for group ids returned by getgid()?"
19599         . ./myread
19600         gidtype="$ans"
19601         ;;
19602 esac
19603
19604 : Check the size of GID
19605 echo " "
19606 case "$gidtype" in
19607 *_t) zzz="$gidtype"     ;;
19608 *)   zzz="gid"          ;;
19609 esac
19610 echo "Checking the size of $zzz..." >&4
19611 cat > try.c <<EOCP
19612 #include <sys/types.h>
19613 #include <stdio.h>
19614 #$i_stdlib I_STDLIB
19615 #ifdef I_STDLIB
19616 #include <stdlib.h>
19617 #endif
19618 int main() {
19619     printf("%d\n", (int)sizeof($gidtype));
19620     exit(0);
19621 }
19622 EOCP
19623 set try
19624 if eval $compile_ok; then
19625         yyy=`$run ./try`
19626         case "$yyy" in
19627         '')     gidsize=4
19628                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19629                 ;;
19630         *)      gidsize=$yyy
19631                 echo "Your $zzz is $gidsize bytes long."
19632                 ;;
19633         esac
19634 else
19635         gidsize=4
19636         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19637 fi
19638
19639
19640 : Check if GID is signed
19641 echo " "
19642 case "$gidtype" in
19643 *_t) zzz="$gidtype"     ;;
19644 *)   zzz="gid"          ;;
19645 esac
19646 echo "Checking the sign of $zzz..." >&4
19647 cat > try.c <<EOCP
19648 #include <sys/types.h>
19649 #include <stdio.h>
19650 int main() {
19651         $gidtype foo = -1;
19652         if (foo < 0)
19653                 printf("-1\n");
19654         else
19655                 printf("1\n");
19656 }
19657 EOCP
19658 set try
19659 if eval $compile; then
19660         yyy=`$run ./try`
19661         case "$yyy" in
19662         '')     gidsign=1
19663                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19664                 ;;
19665         *)      gidsign=$yyy
19666                 case "$gidsign" in
19667                  1) echo "Your $zzz is unsigned." ;;
19668                 -1) echo "Your $zzz is signed."   ;;
19669                 esac
19670                 ;;
19671         esac
19672 else
19673         gidsign=1
19674         echo "(I can't compile the test program--guessing unsigned.)" >&4
19675 fi
19676
19677
19678 : Check 64bit sizes
19679 echo " "
19680
19681 if $test X"$quadtype" != X; then
19682
19683 echo "Checking how to print 64-bit integers..." >&4
19684
19685 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19686         $cat >try.c <<'EOCP'
19687 #include <sys/types.h>
19688 #include <stdio.h>
19689 int main() {
19690   int q = 12345678901;
19691   printf("%ld\n", q);
19692 }
19693 EOCP
19694         set try
19695         if eval $compile; then
19696                 yyy=`$run ./try`
19697                 case "$yyy" in
19698                 12345678901)
19699                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19700                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19701                         echo "We will use %d."
19702                         ;;
19703                 esac
19704         fi
19705 fi
19706
19707 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19708         $cat >try.c <<'EOCP'
19709 #include <sys/types.h>
19710 #include <stdio.h>
19711 int main() {
19712   long q = 12345678901;
19713   printf("%ld\n", q);
19714 }
19715 EOCP
19716         set try
19717         if eval $compile; then
19718                 yyy=`$run ./try`
19719                 case "$yyy" in
19720                 12345678901)
19721                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19722                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19723                         echo "We will use %ld."
19724                         ;;
19725                 esac
19726         fi
19727 fi
19728
19729 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19730         $cat >try.c <<'EOCP'
19731 #include <sys/types.h>
19732 #include <inttypes.h>
19733 #include <stdio.h>
19734 int main() {
19735   int64_t q = 12345678901;
19736   printf("%" PRId64 "\n", q);
19737 }
19738 EOCP
19739         set try
19740         if eval $compile; then
19741                 yyy=`$run ./try`
19742                 case "$yyy" in
19743                 12345678901)
19744                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19745                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19746                         echo "We will use the C9X style."
19747                         ;;
19748                 esac
19749         fi
19750 fi
19751
19752 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19753         $cat >try.c <<EOCP
19754 #include <sys/types.h>
19755 #include <stdio.h>
19756 int main() {
19757   $quadtype q = 12345678901;
19758   printf("%Ld\n", q);
19759 }
19760 EOCP
19761         set try
19762         if eval $compile; then
19763                 yyy=`$run ./try`
19764                 case "$yyy" in
19765                 12345678901)
19766                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19767                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19768                         echo "We will use %Ld."
19769                         ;;
19770                 esac
19771         fi
19772 fi
19773
19774 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19775         $cat >try.c <<'EOCP'
19776 #include <sys/types.h>
19777 #include <stdio.h>
19778 int main() {
19779   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19780   printf("%lld\n", q);
19781 }
19782 EOCP
19783         set try
19784         if eval $compile; then
19785                 yyy=`$run ./try`
19786                 case "$yyy" in
19787                 12345678901)
19788                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19789                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19790                         echo "We will use the %lld style."
19791                         ;;
19792                 esac
19793         fi
19794 fi
19795
19796 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19797         $cat >try.c <<EOCP
19798 #include <sys/types.h>
19799 #include <stdio.h>
19800 int main() {
19801   $quadtype q = 12345678901;
19802   printf("%qd\n", q);
19803 }
19804 EOCP
19805         set try
19806         if eval $compile; then
19807                 yyy=`$run ./try`
19808                 case "$yyy" in
19809                 12345678901)
19810                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19811                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19812                         echo "We will use %qd."
19813                         ;;
19814                 esac
19815         fi
19816 fi
19817
19818 if $test X"$sPRId64" = X; then
19819         echo "Cannot figure out how to print 64-bit integers." >&4
19820 fi
19821 $rm_try
19822
19823 fi
19824
19825 case "$sPRId64" in
19826 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19827         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19828         ;;
19829 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19830         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19831         ;;
19832 esac
19833
19834 : Check format strings for internal types
19835 echo " "
19836 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19837
19838 if $test X"$ivsize" = X8; then
19839         ivdformat="$sPRId64"
19840         uvuformat="$sPRIu64"
19841         uvoformat="$sPRIo64"
19842         uvxformat="$sPRIx64"
19843         uvXUformat="$sPRIXU64"
19844 else
19845         if $test X"$ivsize" = X"$longsize"; then
19846                 ivdformat='"ld"'
19847                 uvuformat='"lu"'
19848                 uvoformat='"lo"'
19849                 uvxformat='"lx"'
19850                 uvXUformat='"lX"'
19851         else
19852                 if $test X"$ivsize" = X"$intsize"; then
19853                         ivdformat='"d"'
19854                         uvuformat='"u"'
19855                         uvoformat='"o"'
19856                         uvxformat='"x"'
19857                         uvXUformat='"X"'
19858                 else
19859                         : far out
19860                         if $test X"$ivsize" = X"$shortsize"; then
19861                                 ivdformat='"hd"'
19862                                 uvuformat='"hu"'
19863                                 uvoformat='"ho"'
19864                                 uvxformat='"hx"'
19865                                 uvXUformat='"hX"'
19866                         fi
19867                 fi
19868         fi
19869 fi
19870
19871 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19872         nveformat="$sPRIeldbl"
19873         nvfformat="$sPRIfldbl"
19874         nvgformat="$sPRIgldbl"
19875         nvEUformat="$sPRIEUldbl"
19876         nvFUformat="$sPRIFUldbl"
19877         nvGUformat="$sPRIGUldbl"
19878 else
19879         nveformat='"e"'
19880         nvfformat='"f"'
19881         nvgformat='"g"'
19882         nvEUformat='"E"'
19883         nvFUformat='"F"'
19884         nvGUformat='"G"'
19885 fi
19886
19887 case "$ivdformat" in
19888 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19889     exit 1
19890     ;;
19891 esac
19892
19893 : Check format string for GID
19894
19895 echo " "
19896 $echo "Checking the format string to be used for gids..." >&4
19897
19898 case "$gidsign" in
19899 -1)     if $test X"$gidsize" = X"$ivsize"; then
19900                 gidformat="$ivdformat"
19901         else
19902                 if $test X"$gidsize" = X"$longsize"; then
19903                         gidformat='"ld"'
19904                 else
19905                         if $test X"$gidsize" = X"$intsize"; then
19906                                 gidformat='"d"'
19907                         else
19908                                 if $test X"$gidsize" = X"$shortsize"; then
19909                                         gidformat='"hd"'
19910                                 fi
19911                         fi
19912                 fi
19913         fi
19914         ;;
19915 *)      if $test X"$gidsize" = X"$uvsize"; then
19916                 gidformat="$uvuformat"
19917         else
19918                 if $test X"$gidsize" = X"$longsize"; then
19919                         gidformat='"lu"'
19920                 else
19921                         if $test X"$gidsize" = X"$intsize"; then
19922                                 gidformat='"u"'
19923                         else
19924                                 if $test X"$gidsize" = X"$shortsize"; then
19925                                         gidformat='"hu"'
19926                                 fi
19927                         fi
19928                 fi
19929         fi
19930         ;;
19931 esac
19932
19933 : see if getgroups exists
19934 set getgroups d_getgrps
19935 eval $inlibc
19936
19937 : see if setgroups exists
19938 set setgroups d_setgrps
19939 eval $inlibc
19940
19941 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19942 echo " "
19943 case "$d_getgrps$d_setgrps" in
19944 *define*)
19945         case "$groupstype" in
19946         '') dflt="$gidtype" ;;
19947         *)  dflt="$groupstype" ;;
19948         esac
19949         $cat <<EOM
19950 What type of pointer is the second argument to getgroups() and setgroups()?
19951 Usually this is the same as group ids, $gidtype, but not always.
19952
19953 EOM
19954         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19955         . ./myread
19956         groupstype="$ans"
19957         ;;
19958 *)  groupstype="$gidtype";;
19959 esac
19960
19961 : MAD = Misc Attribute Definition
19962
19963 if $test $patchlevel -lt 9; then
19964 : MAD is not available in 5.8.x or earlier.
19965     ans=n;
19966 else
19967     case "$mad" in
19968     $define|true|[yY]*) dflt='y' ;;
19969     *)                  dflt='n' ;;
19970     esac
19971     cat <<EOM
19972
19973 Would you like to build with Misc Attribute Decoration? This is development
19974 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19975 overhead on the interpreter.
19976
19977 If this doesn't make any sense to you, just accept the default '$dflt'.
19978 EOM
19979     rp='Build Perl with MAD?'
19980     . ./myread
19981 fi
19982 case "$ans" in
19983 y|Y)    val="$define"
19984         madlyh='madly.h madly.act madly.tab'
19985         madlysrc='madly.c'
19986         madlyobj="madly$_o" ;;
19987 *)      val="$undef"
19988         madlyh=''
19989         madlysrc=''
19990         madlyobj='' ;;
19991 esac
19992 set mad
19993 eval $setvar
19994
19995 : check whether make sets MAKE
19996 echo " "
19997 echo "Checking if your $make program sets \$(MAKE)..." >&4
19998 case "$make_set_make" in
19999 '')
20000         $sed 's/^X //' > testmake.mak << 'EOF'
20001 Xall:
20002 X       @echo 'maketemp="$(MAKE)"'
20003 EOF
20004         case "`$make -f testmake.mak 2>/dev/null`" in
20005         *maketemp=*) make_set_make='#' ;;
20006         *)      make_set_make="MAKE=$make" ;;
20007         esac
20008         $rm -f testmake.mak
20009         ;;
20010 esac
20011 case "$make_set_make" in
20012 '#') echo "Yup, it does.";;
20013 *) echo "Nope, it doesn't.";;
20014 esac
20015
20016 : see what type is used for mode_t
20017 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20018 set mode_t modetype int stdio.h sys/types.h
20019 eval $typedef_ask
20020
20021 : see if we need va_copy
20022 echo " "
20023 case "$i_stdarg" in
20024 "$define")
20025         $cat >try.c <<EOCP
20026 #include <stdarg.h>
20027 #include <stdio.h>
20028 #$i_stdlib I_STDLIB
20029 #ifdef I_STDLIB
20030 #include <stdlib.h>
20031 #endif
20032 #include <signal.h>
20033
20034 int
20035 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20036 {
20037   return vfprintf(f, fmt, *valp);
20038 }
20039
20040 int
20041 myvfprintf(FILE *f, const  char *fmt, va_list val)
20042 {
20043   return ivfprintf(f, fmt, &val);
20044 }
20045
20046 int
20047 myprintf(char *fmt, ...)
20048 {
20049   va_list val;
20050   va_start(val, fmt);
20051   return myvfprintf(stdout, fmt, val);
20052 }
20053
20054 int
20055 main(int ac, char **av)
20056 {
20057   signal(SIGSEGV, exit);
20058
20059   myprintf("%s%cs all right, then\n", "that", '\'');
20060   exit(0);
20061 }
20062 EOCP
20063         set try
20064         if eval $compile && $run ./try 2>&1 >/dev/null; then
20065                 case "`$run ./try`" in
20066                 "that's all right, then")
20067                         okay=yes
20068                         ;;
20069                 esac
20070         fi
20071         case "$okay" in
20072         yes)    echo "It seems that you don't need va_copy()." >&4
20073                 need_va_copy="$undef"
20074                 ;;
20075         *)      echo "It seems that va_copy() or similar will be needed." >&4
20076                 need_va_copy="$define"
20077                 ;;
20078         esac
20079         $rm_try
20080         ;;
20081 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20082         ;;
20083 esac
20084
20085 : see what type is used for size_t
20086 rp="What is the type used for the length parameter for string functions?"
20087 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20088 eval $typedef_ask
20089
20090 : check for type of arguments to gethostbyaddr. 
20091 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20092         case "$d_gethbyaddr" in
20093         $define)
20094                 $cat <<EOM
20095
20096 Checking to see what type of arguments are accepted by gethostbyaddr().
20097 EOM
20098                 hdrs="$define sys/types.h
20099                         $d_socket sys/socket.h 
20100                         $i_niin netinet/in.h 
20101                         $i_netdb netdb.h
20102                         $i_unistd unistd.h"
20103                 : The first arg can 'char *' or 'void *'
20104                 : The second arg is some of integral type
20105                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20106                         for yyy in size_t long int; do
20107                                 case "$netdb_host_type" in
20108                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20109                                         if ./protochk "$try" $hdrs; then
20110                                                 echo "Your system accepts $xxx for the first arg."
20111                                                 echo "...and $yyy for the second arg."
20112                                                 netdb_host_type="$xxx"
20113                                                 netdb_hlen_type="$yyy"
20114                                         fi
20115                                         ;;
20116                                 esac
20117                         done
20118                 done
20119                 : In case none of those worked, prompt the user.
20120                 case "$netdb_host_type" in
20121                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20122                         dflt='char *'
20123                         . ./myread
20124                         netdb_host_type=$ans
20125                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20126                         dflt="$sizetype"
20127                         . ./myread
20128                         netdb_hlen_type=$ans
20129                         ;;
20130                 esac
20131                 ;;
20132         *)      : no gethostbyaddr, so pick harmless defaults
20133                 netdb_host_type='char *'
20134                 netdb_hlen_type="$sizetype"
20135                 ;;
20136         esac
20137         # Remove the "const" if needed. -- but then we'll have a 
20138         # prototype clash!
20139         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20140 fi
20141
20142 : check for type of argument to gethostbyname. 
20143 if test "X$netdb_name_type" = X ; then
20144         case "$d_gethbyname" in
20145         $define)
20146                 $cat <<EOM
20147
20148 Checking to see what type of argument is accepted by gethostbyname().
20149 EOM
20150                 hdrs="$define sys/types.h
20151                         $d_socket sys/socket.h 
20152                         $i_niin netinet/in.h 
20153                         $i_netdb netdb.h
20154                         $i_unistd unistd.h"
20155                 for xxx in "const char *" "char *"; do
20156                         case "$netdb_name_type" in
20157                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20158                                 if ./protochk "$try" $hdrs; then
20159                                         echo "Your system accepts $xxx."
20160                                         netdb_name_type="$xxx"
20161                                 fi
20162                                 ;;
20163                         esac
20164                 done
20165                 : In case none of those worked, prompt the user.
20166                 case "$netdb_name_type" in
20167                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20168                         dflt='char *'
20169                         . ./myread
20170                         netdb_name_type=$ans
20171                         ;;
20172                 esac
20173                 ;;
20174         *)      : no gethostbyname, so pick harmless default
20175                 netdb_name_type='char *'
20176                 ;;
20177         esac
20178 fi
20179
20180 : check for type of 1st argument to getnetbyaddr. 
20181 if test "X$netdb_net_type" = X ; then
20182         case "$d_getnbyaddr" in
20183         $define)
20184                 $cat <<EOM
20185
20186 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20187 EOM
20188                 hdrs="$define sys/types.h
20189                         $d_socket sys/socket.h 
20190                         $i_niin netinet/in.h 
20191                         $i_netdb netdb.h
20192                         $i_unistd unistd.h"
20193                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20194                         case "$netdb_net_type" in
20195                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20196                                 if ./protochk "$try" $hdrs; then
20197                                         echo "Your system accepts $xxx."
20198                                         netdb_net_type="$xxx"
20199                                 fi
20200                                 ;;
20201                         esac
20202                 done
20203                 : In case none of those worked, prompt the user.
20204                 case "$netdb_net_type" in
20205                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20206                         dflt='long'
20207                         . ./myread
20208                         netdb_net_type=$ans
20209                         ;;
20210                 esac
20211                 ;;
20212         *)      : no getnetbyaddr, so pick harmless default
20213                 netdb_net_type='long'
20214                 ;;
20215         esac
20216 fi
20217 : locate the preferred pager for this system
20218 fn=f/
20219 case "$pager" in
20220 '')
20221         dflt=''
20222         case "$pg" in
20223         /*) dflt=$pg;;
20224         [a-zA-Z]:/*) dflt=$pg;;
20225         esac
20226         case "$more" in
20227         /*) dflt=$more;;
20228         [a-zA-Z]:/*) dflt=$more;;
20229         esac
20230         case "$less" in
20231         /*) dflt=$less;;
20232         [a-zA-Z]:/*) dflt=$less;;
20233         esac
20234         case "$dflt" in
20235         '') dflt=/usr/ucb/more;;
20236         esac
20237         ;;
20238 *)      dflt="$pager"
20239         fn="f/($pager)"
20240         ;;
20241 esac
20242 echo " "
20243 rp='What pager is used on your system?'
20244 . ./getfile
20245 pager="$ans"
20246
20247 : see what type pids are declared as in the kernel
20248 rp="What is the type of process ids on this system?"
20249 set pid_t pidtype int stdio.h sys/types.h
20250 eval $typedef_ask
20251
20252 : see if ar generates random libraries by itself
20253 echo " "
20254 echo "Checking how to generate random libraries on your machine..." >&4
20255 echo 'int bar1() { return bar2(); }' > bar1.c
20256 echo 'int bar2() { return 2; }' > bar2.c
20257 $cat > foo.c <<EOP
20258 #$i_stdlib I_STDLIB
20259 #ifdef I_STDLIB
20260 #include <stdlib.h>
20261 #endif
20262 int main() { printf("%d\n", bar1()); exit(0); }
20263 EOP
20264 $cc $ccflags -c bar1.c >/dev/null 2>&1
20265 $cc $ccflags -c bar2.c >/dev/null 2>&1
20266 $cc $ccflags -c foo.c >/dev/null 2>&1
20267 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20268 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20269         $run ./foobar >/dev/null 2>&1; then
20270         echo "$ar appears to generate random libraries itself."
20271         orderlib=false
20272         if [ "X$ranlib" = "X" ]; then
20273             ranlib=":"
20274         fi
20275 elif $ar s bar$_a >/dev/null 2>&1 &&
20276         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20277         $run ./foobar >/dev/null 2>&1; then
20278                 echo "a table of contents needs to be added with '$ar s'."
20279                 orderlib=false
20280                 ranlib="$ar s"
20281 elif $ar ts bar$_a >/dev/null 2>&1 &&
20282         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20283         $run ./foobar >/dev/null 2>&1; then
20284                 echo "a table of contents needs to be added with '$ar ts'."
20285                 orderlib=false
20286                 ranlib="$ar ts"
20287 else
20288         case "$ranlib" in
20289         :) ranlib='';;
20290         '')
20291                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20292                 $test -f $ranlib || ranlib=''
20293                 ;;
20294         esac
20295         if $test -n "$ranlib"; then
20296                 echo "your system has '$ranlib'; we'll use that."
20297                 orderlib=false
20298         else
20299                 echo "your system doesn't seem to support random libraries"
20300                 echo "so we'll use lorder and tsort to order the libraries."
20301                 orderlib=true
20302                 ranlib=":"
20303         fi
20304 fi
20305 $rm -f foo* bar*
20306
20307 : see if this is a values.h system
20308 set values.h i_values
20309 eval $inhdr
20310
20311 : Check the max offset that gmtime and localtime accept
20312 echo "Checking max offsets that gmtime () accepts"
20313
20314 case $i_values in
20315     define) yyy="#include <values.h>" ;;
20316     *)      yyy="" ;;
20317     esac
20318
20319 case "$sGMTIME_min/$sGMTIME_max" in
20320     0/0|/)
20321         $cat >try.c <<EOCP
20322 #include <sys/types.h>
20323 #include <stdio.h>
20324 #include <time.h>
20325 $yyy
20326
20327 int i;
20328 struct tm *tmp;
20329 time_t pt;
20330
20331 void gm_check (time_t t, int min_year, int max_year)
20332 {
20333     tmp = gmtime (&t);
20334     if ( tmp == NULL ||
20335         /* Check tm_year overflow */
20336          tmp->tm_year < min_year || tmp->tm_year > max_year)
20337         tmp = NULL;
20338     else
20339         pt = t;
20340     } /* gm_check */
20341
20342 int check_max ()
20343 {
20344     tmp = NULL;
20345     pt  = 0;
20346 #ifdef MAXLONG
20347     gm_check (MAXLONG, 69, 0x7fffffff);
20348 #endif
20349     if (tmp == NULL || tmp->tm_year < 0) {
20350         for (i = 63; i >= 0; i--) {
20351             time_t x = pt | ((time_t)1 << i);
20352             if (x < 0 || x < pt) continue;
20353             gm_check (x, 69, 0x7fffffff);
20354             }
20355         }
20356     printf ("sGMTIME_max=%ld\n", pt);
20357     return (0);
20358     } /* check_max */
20359
20360 int check_min ()
20361 {
20362     tmp = NULL;
20363     pt  = 0;
20364 #ifdef MINLONG
20365     gm_check (MINLONG, -1900, 70);
20366 #endif
20367     if (tmp == NULL) {
20368         for (i = 36; i >= 0; i--) {
20369             time_t x = pt - ((time_t)1 << i);
20370             if (x > 0) continue;
20371             gm_check (x, -1900, 70);
20372             }
20373         }
20374     printf ("sGMTIME_min=%ld\n", pt);
20375     return (0);
20376     } /* check_min */
20377
20378 int main (int argc, char *argv[])
20379 {
20380     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20381     check_max ();
20382     check_min ();
20383     return (0);
20384     } /* main */
20385 EOCP
20386         set try
20387         if eval $compile; then
20388             eval `$run ./try`
20389         else
20390             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20391             fi
20392         $rm_try
20393         ;;
20394     esac
20395
20396 echo "Checking max offsets that localtime () accepts"
20397
20398 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20399     0/0|/)
20400         $cat >try.c <<EOCP
20401 #include <sys/types.h>
20402 #include <stdio.h>
20403 #include <time.h>
20404 $yyy
20405
20406 int i;
20407 struct tm *tmp;
20408 time_t pt;
20409
20410 void local_check (time_t t, int min_year, int max_year)
20411 {
20412     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20413         tmp = NULL;
20414     else
20415         tmp = localtime (&t);
20416     if ( tmp == NULL ||
20417         /* Check tm_year overflow */
20418          tmp->tm_year < min_year || tmp->tm_year > max_year)
20419         tmp = NULL;
20420     else
20421         pt = t;
20422     } /* local_check */
20423
20424 int check_max ()
20425 {
20426     tmp = NULL;
20427     pt  = 0;
20428 #ifdef MAXLONG
20429     local_check (MAXLONG, 69, 0x7fffffff);
20430 #endif
20431     if (tmp == NULL || tmp->tm_year < 0) {
20432         for (i = 63; i >= 0; i--) {
20433             time_t x = pt | ((time_t)1 << i);
20434             if (x < 0 || x < pt) continue;
20435             local_check (x, 69, 0x7fffffff);
20436             }
20437         }
20438     printf ("sLOCALTIME_max=%ld\n", pt);
20439     return (0);
20440    } /* check_max */
20441
20442 int check_min ()
20443 {
20444     tmp = NULL;
20445     pt  = 0;
20446 #ifdef MINLONG
20447     local_check (MINLONG, -1900, 70);
20448 #endif
20449     if (tmp == NULL) {
20450         for (i = 36; i >= 0; i--) {
20451             time_t x = pt - ((time_t)1 << i);
20452             if (x > 0) continue;
20453             local_check (x, -1900, 70);
20454             }
20455         }
20456     printf ("sLOCALTIME_min=%ld\n", pt);
20457     return (0);
20458     } /* check_min */
20459
20460 int main (int argc, char *argv[])
20461 {
20462     check_max ();
20463     check_min ();
20464     return (0);
20465     } /* main */
20466 EOCP
20467         set try
20468         if eval $compile; then
20469             eval `$run ./try`
20470         else
20471             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20472             fi
20473         $rm_try
20474         ;;
20475     esac
20476
20477 : check for type of arguments to select.
20478 case "$selecttype" in
20479 '') case "$d_select" in
20480         $define)
20481                 echo " "
20482                 $cat <<EOM
20483 Checking to see what type of arguments are accepted by select().
20484 EOM
20485                 hdrs="$define sys/types.h
20486                         $i_systime sys/time.h
20487                         $i_sysselct sys/select.h
20488                         $d_socket sys/socket.h"
20489                 : The first arg can be int, unsigned, or size_t
20490                 : The last arg may or may not be 'const'
20491                 val=''
20492                 : void pointer has been seen but using that
20493                 : breaks the selectminbits test
20494                 for xxx in 'fd_set *' 'int *'; do
20495                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20496                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20497                                         case "$val" in
20498                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20499                                                 if ./protochk "$try" $hdrs; then
20500                                                         echo "Your system accepts $xxx."
20501                                                         val="$xxx"
20502                                                 fi
20503                                                 ;;
20504                                         esac
20505                                 done
20506                         done
20507                 done
20508                 case "$val" in
20509                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20510                         case "$d_fd_set" in
20511                                 $define) dflt="fd_set *" ;;
20512                                 *)              dflt="int *" ;;
20513                         esac
20514                         . ./myread
20515                         val=$ans
20516                         ;;
20517                 esac
20518                 selecttype="$val"
20519                 ;;
20520         *)      : no select, so pick a harmless default
20521                 selecttype='int *'
20522                 ;;
20523         esac
20524         ;;
20525 esac
20526
20527 : check for the select 'width'
20528 case "$selectminbits" in
20529 '') safebits=`expr $ptrsize \* 8`
20530     case "$d_select" in
20531         $define)
20532                 $cat <<EOM
20533
20534 Checking to see on how many bits at a time your select() operates...
20535 EOM
20536                 $cat >try.c <<EOCP
20537 #include <sys/types.h>
20538 #$i_time I_TIME
20539 #$i_systime I_SYS_TIME
20540 #$i_systimek I_SYS_TIME_KERNEL
20541 #ifdef I_TIME
20542 #   include <time.h>
20543 #endif
20544 #ifdef I_SYS_TIME
20545 #   ifdef I_SYS_TIME_KERNEL
20546 #       define KERNEL
20547 #   endif
20548 #   include <sys/time.h>
20549 #   ifdef I_SYS_TIME_KERNEL
20550 #       undef KERNEL
20551 #   endif
20552 #endif
20553 #$i_sysselct I_SYS_SELECT
20554 #ifdef I_SYS_SELECT
20555 #include <sys/select.h>
20556 #endif
20557 #$d_socket HAS_SOCKET
20558 #ifdef HAS_SOCKET
20559 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20560 #endif
20561 #include <stdio.h>
20562 #$i_stdlib I_STDLIB
20563 #ifdef I_STDLIB
20564 #include <stdlib.h>
20565 #endif
20566 $selecttype b;
20567 #define S sizeof(*(b))
20568 #define MINBITS 64
20569 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20570 #define NBITS  (NBYTES * 8)
20571 int main() {
20572     char *s = (char *)malloc(NBYTES);
20573     struct timeval t;
20574     int i;
20575     FILE* fp;
20576     int fd;
20577
20578     if (!s)
20579         exit(1);
20580     fclose(stdin);
20581     fp = fopen("try.c", "r");
20582     if (fp == 0)
20583       exit(2);
20584     fd = fileno(fp);
20585     if (fd < 0)
20586       exit(3);
20587     b = ($selecttype)s;
20588     for (i = 0; i < NBITS; i++)
20589         FD_SET(i, b);
20590     t.tv_sec  = 0;
20591     t.tv_usec = 0;
20592     select(fd + 1, b, 0, 0, &t);
20593     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20594     free(s);
20595     printf("%d\n", i + 1);
20596     return 0;
20597 }
20598 EOCP
20599                 set try
20600                 if eval $compile_ok; then
20601                         selectminbits=`$run ./try`
20602                         case "$selectminbits" in
20603                         '')     cat >&4 <<EOM
20604 Cannot figure out on how many bits at a time your select() operates.
20605 I'll play safe and guess it is $safebits bits.
20606 EOM
20607                                 selectminbits=$safebits
20608                                 bits="$safebits bits"
20609                                 ;;
20610                         1)      bits="1 bit" ;;
20611                         *)      bits="$selectminbits bits" ;;
20612                         esac
20613                         echo "Your select() operates on $bits at a time." >&4
20614                 else
20615                         rp='What is the minimum number of bits your select() operates on?'
20616                         case "$byteorder" in
20617                         12345678)       dflt=64 ;;
20618                         1234)           dflt=32 ;;
20619                         *)              dflt=1  ;;
20620                         esac
20621                         . ./myread
20622                         val=$ans
20623                         selectminbits="$val"
20624                 fi
20625                 $rm_try
20626                 ;;
20627         *)      : no select, so pick a harmless default
20628                 selectminbits=$safebits
20629                 ;;
20630         esac
20631         ;;
20632 esac
20633
20634 : Trace out the files included by signal.h, then look for SIGxxx names.
20635 if [ "X$fieldn" = X ]; then
20636         : Just make some guesses.  We check them later.
20637         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20638 else
20639         xxx=`echo '#include <signal.h>' |
20640         $cppstdin $cppminus $cppflags 2>/dev/null |
20641         $grep '^[       ]*#.*include' |
20642         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20643                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20644 fi
20645 xxxfiles=''
20646 for xx in $xxx /dev/null ; do
20647         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20648 done
20649 case "$xxxfiles" in
20650 '')     xxxfiles=`./findhdr signal.h` ;;
20651 esac
20652 xxx=`awk '
20653 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20654         print substr($2, 4, 20)
20655 }
20656 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20657         print substr($3, 4, 20)
20658 }' $xxxfiles`
20659 : Append some common names just in case the awk scan failed.
20660 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20661 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20662 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20663 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20664 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20665
20666 : generate a few handy files for later
20667 $cat > signal.c <<EOCP
20668 #include <sys/types.h>
20669 #include <signal.h>
20670 #$i_stdlib I_STDLIB
20671 #ifdef I_STDLIB
20672 #include <stdlib.h>
20673 #endif
20674 #include <stdio.h>
20675 int main() {
20676
20677 /* Strange style to avoid deeply-nested #if/#else/#endif */
20678 #ifndef NSIG
20679 #  ifdef _NSIG
20680 #    define NSIG (_NSIG)
20681 #  endif
20682 #endif
20683
20684 #ifndef NSIG
20685 #  ifdef SIGMAX
20686 #    define NSIG (SIGMAX+1)
20687 #  endif
20688 #endif
20689
20690 #ifndef NSIG
20691 #  ifdef SIG_MAX
20692 #    define NSIG (SIG_MAX+1)
20693 #  endif
20694 #endif
20695
20696 #ifndef NSIG
20697 #  ifdef _SIG_MAX
20698 #    define NSIG (_SIG_MAX+1)
20699 #  endif
20700 #endif
20701
20702 #ifndef NSIG
20703 #  ifdef MAXSIG
20704 #    define NSIG (MAXSIG+1)
20705 #  endif
20706 #endif
20707
20708 #ifndef NSIG
20709 #  ifdef MAX_SIG
20710 #    define NSIG (MAX_SIG+1)
20711 #  endif
20712 #endif
20713
20714 #ifndef NSIG
20715 #  ifdef SIGARRAYSIZE
20716 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20717 #  endif
20718 #endif
20719
20720 #ifndef NSIG
20721 #  ifdef _sys_nsig
20722 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20723 #  endif
20724 #endif
20725
20726 /* Default to some arbitrary number that's big enough to get most
20727    of the common signals.
20728 */
20729 #ifndef NSIG
20730 #    define NSIG 50
20731 #endif
20732
20733 printf("NSIG %d\n", NSIG);
20734
20735 #ifndef JUST_NSIG
20736
20737 EOCP
20738
20739 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20740 {
20741         printf "#ifdef SIG"; printf $1; printf "\n"
20742         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20743         printf $1; printf ");\n"
20744         printf "#endif\n"
20745 }
20746 END {
20747         printf "#endif /* JUST_NSIG */\n";
20748         printf "exit(0);\n}\n";
20749 }
20750 ' >>signal.c
20751 $cat >signal.awk <<'EOP'
20752 BEGIN { ndups = 0 }
20753 $1 ~ /^NSIG$/ { nsig = $2 }
20754 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20755     if ($2 > maxsig) { maxsig = $2 }
20756     if (sig_name[$2]) {
20757         dup_name[ndups] = $1
20758         dup_num[ndups] = $2
20759         ndups++
20760     }
20761     else {
20762         sig_name[$2] = $1
20763         sig_num[$2] = $2
20764     }
20765 }
20766 END {
20767     if (nsig == 0) {
20768         nsig = maxsig + 1
20769     }
20770     printf("NSIG %d\n", nsig);
20771     for (n = 1; n < nsig; n++) {
20772         if (sig_name[n]) {
20773             printf("%s %d\n", sig_name[n], sig_num[n])
20774         }
20775         else {
20776             printf("NUM%d %d\n", n, n)
20777         }
20778     }
20779     for (n = 0; n < ndups; n++) {
20780         printf("%s %d\n", dup_name[n], dup_num[n])
20781     }
20782 }
20783 EOP
20784 $cat >signal_cmd <<EOS
20785 $startsh
20786 if $test -s signal.lst; then
20787     echo "Using your existing signal.lst file"
20788         exit 0
20789 fi
20790 xxx="$xxx"
20791 EOS
20792 $cat >>signal_cmd <<'EOS'
20793
20794 set signal
20795 if eval $compile_ok; then
20796         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20797                 $uniq | $awk -f signal.awk >signal.lst
20798 else
20799         echo "(I can't seem be able to compile the whole test program)" >&4
20800         echo "(I'll try it in little pieces.)" >&4
20801         set signal -DJUST_NSIG
20802         if eval $compile_ok; then
20803                 $run ./signal$_exe > signal.nsg
20804                 $cat signal.nsg
20805         else
20806                 echo "I can't seem to figure out how many signals you have." >&4
20807                 echo "Guessing 50." >&4
20808                 echo 'NSIG 50' > signal.nsg
20809         fi
20810         : Now look at all the signal names, one at a time.
20811         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20812                 $cat > signal.c <<EOCP
20813 #include <sys/types.h>
20814 #include <signal.h>
20815 #include <stdio.h>
20816 int main() {
20817 printf("$xx %d\n", SIG${xx});
20818 return 0;
20819 }
20820 EOCP
20821                 set signal
20822                 if eval $compile; then
20823                         echo "SIG${xx} found."
20824                         $run ./signal$_exe  >> signal.ls1
20825                 else
20826                         echo "SIG${xx} NOT found."
20827                 fi
20828         done
20829         if $test -s signal.ls1; then
20830                 $cat signal.nsg signal.ls1 |
20831                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20832         fi
20833
20834 fi
20835 if $test -s signal.lst; then
20836         :
20837 else
20838         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20839         echo 'kill -l' >signal
20840         set X `csh -f <signal`
20841         $rm -f signal
20842         shift
20843         case $# in
20844         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20845         esac
20846         echo $@ | $tr ' ' $trnl | \
20847             $awk '{ printf "%s %d\n", $1, ++s; }
20848                   END { printf "NSIG %d\n", ++s }' >signal.lst
20849 fi
20850 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20851 EOS
20852 chmod a+x signal_cmd
20853 $eunicefix signal_cmd
20854
20855 : generate list of signal names
20856 echo " "
20857 case "$sig_name_init" in
20858 '') doinit=yes ;;
20859 *)  case "$sig_num_init" in
20860     ''|*,*) doinit=yes ;;
20861     esac ;;
20862 esac
20863 case "$doinit" in
20864 yes)
20865         echo "Generating a list of signal names and numbers..." >&4
20866         . ./signal_cmd
20867         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20868         sig_name=`$awk 'BEGIN { printf "ZERO " }
20869                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20870         sig_num=`$awk  'BEGIN { printf "0 " }
20871                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20872         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20873                              !/^NSIG/   { printf "\"%s\", ", $1 }
20874                              END        { printf "0\n" }' signal.lst`
20875         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20876                              !/^NSIG/   { printf "%d, ", $2}
20877                              END        { printf "0\n"}' signal.lst`
20878         ;;
20879 esac
20880 echo "The following $sig_count signals are available:"
20881 echo " "
20882 echo $sig_name | $awk \
20883 'BEGIN { linelen = 0 }
20884 {
20885         for (i = 1; i <= NF; i++) {
20886                 name = "SIG" $i " "
20887                 linelen = linelen + length(name)
20888                 if (linelen > 70) {
20889                         printf "\n"
20890                         linelen = length(name)
20891                 }
20892                 printf "%s", name
20893         }
20894         printf "\n"
20895 }'
20896 sig_size=`echo $sig_name | awk '{print NF}'`
20897 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20898
20899 : Check size of size
20900 echo " "
20901 case "$sizetype" in
20902 *_t) zzz="$sizetype"    ;;
20903 *)   zzz="filesize"     ;;
20904 esac
20905 echo "Checking the size of $zzz..." >&4
20906 cat > try.c <<EOCP
20907 #include <sys/types.h>
20908 #include <stdio.h>
20909 #$i_stdlib I_STDLIB
20910 #ifdef I_STDLIB
20911 #include <stdlib.h>
20912 #endif
20913 int main() {
20914     printf("%d\n", (int)sizeof($sizetype));
20915     exit(0);
20916 }
20917 EOCP
20918 set try
20919 if eval $compile_ok; then
20920         yyy=`$run ./try`
20921         case "$yyy" in
20922         '')     sizesize=4
20923                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20924                 ;;
20925         *)      sizesize=$yyy
20926                 echo "Your $zzz size is $sizesize bytes."
20927                 ;;
20928         esac
20929 else
20930         sizesize=4
20931         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20932 fi
20933
20934
20935 : check for socklen_t
20936 echo " "
20937 echo "Checking to see if you have socklen_t..." >&4
20938 $cat >try.c <<EOCP
20939 #include <sys/types.h>
20940 #$d_socket HAS_SOCKET
20941 #ifdef HAS_SOCKET
20942 #include <sys/socket.h>
20943 #endif
20944 int main() { socklen_t x = 16; }
20945 EOCP
20946 set try
20947 if eval $compile; then
20948         val="$define"
20949         echo "You have socklen_t."
20950 else
20951         val="$undef"
20952         echo "You do not have socklen_t."
20953         case "$sizetype" in
20954         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20955         esac
20956 fi
20957 $rm_try
20958 set d_socklen_t
20959 eval $setvar
20960
20961 : see if this is a socks.h system
20962 set socks.h i_socks
20963 eval $inhdr
20964
20965 : check for type of the size argument to socket calls
20966 case "$d_socket" in
20967 "$define")
20968         $cat <<EOM
20969
20970 Checking to see what type is the last argument of accept().
20971 EOM
20972         yyy=''
20973         case "$d_socklen_t" in
20974         "$define") yyy="$yyy socklen_t"
20975         esac
20976         yyy="$yyy $sizetype int long unsigned"
20977         for xxx in $yyy; do
20978                 case "$socksizetype" in
20979                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20980                         case "$usesocks" in
20981                         "$define")
20982                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20983                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20984                                         socksizetype="$xxx"
20985                                 fi
20986                                 ;;
20987                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20988                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20989                                         socksizetype="$xxx"
20990                                 fi
20991                                 ;;
20992                         esac
20993                         ;;
20994                 esac
20995         done
20996 : In case none of those worked, prompt the user.
20997         case "$socksizetype" in
20998         '')     rp='What is the type for socket address structure sizes?'
20999                 dflt='int'
21000                 . ./myread
21001                 socksizetype=$ans
21002                 ;;
21003         esac
21004         ;;
21005 *)      : no sockets, so pick relatively harmless default
21006         socksizetype='int'
21007         ;;
21008 esac
21009
21010 : see what type is used for signed size_t
21011 set ssize_t ssizetype int stdio.h sys/types.h
21012 eval $typedef
21013 dflt="$ssizetype"
21014 $cat > try.c <<EOM
21015 #include <stdio.h>
21016 #$i_stdlib I_STDLIB
21017 #ifdef I_STDLIB
21018 #include <stdlib.h>
21019 #endif
21020 #include <sys/types.h>
21021 #define Size_t $sizetype
21022 #define SSize_t $dflt
21023 int main()
21024 {
21025         if (sizeof(Size_t) == sizeof(SSize_t))
21026                 printf("$dflt\n");
21027         else if (sizeof(Size_t) == sizeof(int))
21028                 printf("int\n");
21029         else
21030                 printf("long\n");
21031         exit(0);
21032 }
21033 EOM
21034 echo " "
21035 set try
21036 if eval $compile_ok && $run ./try > /dev/null; then
21037         ssizetype=`$run ./try`
21038         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21039 else
21040         $cat >&4 <<EOM
21041 Help! I can't compile and run the ssize_t test program: please enlighten me!
21042 (This is probably a misconfiguration in your system or libraries, and
21043 you really ought to fix it.  Still, I'll try anyway.)
21044
21045 I need a type that is the same size as $sizetype, but is guaranteed to
21046 be signed.  Common values are ssize_t, int and long.
21047
21048 EOM
21049         rp="What signed type is the same size as $sizetype?"
21050         . ./myread
21051         ssizetype="$ans"
21052 fi
21053 $rm_try
21054
21055 : see what type of char stdio uses.
21056 echo " "
21057 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21058 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21059         echo "Your stdio uses unsigned chars." >&4
21060         stdchar="unsigned char"
21061 else
21062         echo "Your stdio uses signed chars." >&4
21063         stdchar="char"
21064 fi
21065 $rm -f stdioh
21066
21067 : see what type uids are declared as in the kernel
21068 echo " "
21069 echo "Looking for the type for user ids returned by getuid()."
21070 set uid_t uidtype xxx stdio.h sys/types.h
21071 eval $typedef
21072 case "$uidtype" in
21073 xxx)
21074         xxx=`./findhdr sys/user.h`
21075         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21076         case $1 in
21077         unsigned) dflt="$1 $2" ;;
21078         *) dflt="$1" ;;
21079         esac
21080         ;;
21081 *) dflt="$uidtype";;
21082 esac
21083 case "$uidtype" in
21084 uid_t)  echo "uid_t found." ;;
21085 *)      rp="What is the type for user ids returned by getuid()?"
21086         . ./myread
21087         uidtype="$ans"
21088         ;;
21089 esac
21090
21091 : Check size of UID
21092 echo " "
21093 case "$uidtype" in
21094 *_t) zzz="$uidtype"     ;;
21095 *)   zzz="uid"          ;;
21096 esac
21097 echo "Checking the size of $zzz..." >&4
21098 cat > try.c <<EOCP
21099 #include <sys/types.h>
21100 #include <stdio.h>
21101 #$i_stdlib I_STDLIB
21102 #ifdef I_STDLIB
21103 #include <stdlib.h>
21104 #endif
21105 int main() {
21106     printf("%d\n", (int)sizeof($uidtype));
21107     exit(0);
21108 }
21109 EOCP
21110 set try
21111 if eval $compile_ok; then
21112         yyy=`$run ./try`
21113         case "$yyy" in
21114         '')     uidsize=4
21115                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21116                 ;;
21117         *)      uidsize=$yyy
21118                 echo "Your $zzz is $uidsize bytes long."
21119                 ;;
21120         esac
21121 else
21122         uidsize=4
21123         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21124 fi
21125
21126 : Check if UID is signed
21127 echo " "
21128 case "$uidtype" in
21129 *_t) zzz="$uidtype"     ;;
21130 *)   zzz="uid"          ;;
21131 esac
21132 echo "Checking the sign of $zzz..." >&4
21133 cat > try.c <<EOCP
21134 #include <sys/types.h>
21135 #include <stdio.h>
21136 int main() {
21137         $uidtype foo = -1;
21138         if (foo < 0)
21139                 printf("-1\n");
21140         else
21141                 printf("1\n");
21142 }
21143 EOCP
21144 set try
21145 if eval $compile; then
21146         yyy=`$run ./try`
21147         case "$yyy" in
21148         '')     uidsign=1
21149                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21150                 ;;
21151         *)      uidsign=$yyy
21152                 case "$uidsign" in
21153                  1) echo "Your $zzz is unsigned." ;;
21154                 -1) echo "Your $zzz is signed."   ;;
21155                 esac
21156                 ;;
21157         esac
21158 else
21159         uidsign=1
21160         echo "(I can't compile the test program--guessing unsigned.)" >&4
21161 fi
21162
21163
21164 : Check format string for UID
21165 echo " "
21166 $echo "Checking the format string to be used for uids..." >&4
21167
21168 case "$uidsign" in
21169 -1)     if $test X"$uidsize" = X"$ivsize"; then
21170                 uidformat="$ivdformat"
21171         else
21172                 if $test X"$uidsize" = X"$longsize"; then
21173                         uidformat='"ld"'
21174                 else
21175                         if $test X"$uidsize" = X"$intsize"; then
21176                                 uidformat='"d"'
21177                         else
21178                                 if $test X"$uidsize" = X"$shortsize"; then
21179                                         uidformat='"hd"'
21180                                 fi
21181                         fi
21182                 fi
21183         fi
21184         ;;
21185 *)      if $test X"$uidsize" = X"$uvsize"; then
21186                 uidformat="$uvuformat"
21187         else
21188                 if $test X"$uidsize" = X"$longsize"; then
21189                         uidformat='"lu"'
21190                 else
21191                         if $test X"$uidsize" = X"$intsize"; then
21192                                 uidformat='"u"'
21193                         else
21194                                 if $test X"$uidsize" = X"$shortsize"; then
21195                                         uidformat='"hu"'
21196                                 fi
21197                         fi
21198                 fi
21199         fi
21200         ;;
21201 esac
21202
21203 : Check if site customization support was requested
21204 case "$usesitecustomize" in
21205     $define|true|[Yy]*)
21206         usesitecustomize="$define"
21207         ;;
21208     *)
21209         usesitecustomize="$undef"
21210         ;;
21211     esac
21212
21213 : determine compiler compiler
21214 case "$yacc" in
21215 '')
21216         dflt=yacc;;
21217 *)
21218         dflt="$yacc";;
21219 esac
21220 echo " "
21221 comp='yacc'
21222 if $test -f "$byacc$_exe"; then
21223         dflt="$byacc"
21224         comp="byacc or $comp"
21225 fi
21226 if $test -f "$bison$_exe"; then
21227         comp="$comp or bison -y"
21228 fi
21229 rp="Which compiler compiler ($comp) shall I use?"
21230 . ./myread
21231 yacc="$ans"
21232 case "$yacc" in
21233 *bis*)
21234         case "$yacc" in
21235         *-y*) ;;
21236         *)
21237                 yacc="$yacc -y"
21238                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21239                 ;;
21240         esac
21241         ;;
21242 esac
21243
21244 : see if this is a assert.h system
21245 set assert.h i_assert
21246 eval $inhdr
21247
21248 : see if this is a fp.h system
21249 set fp.h i_fp
21250 eval $inhdr
21251
21252 : see if this is a fp_class.h system
21253 set fp_class.h i_fp_class
21254 eval $inhdr
21255
21256 : see if gdbm.h is available
21257 set gdbm.h t_gdbm
21258 eval $inhdr
21259 case "$t_gdbm" in
21260 $define)
21261         : see if gdbm_open exists
21262         set gdbm_open d_gdbm_open
21263         eval $inlibc
21264         case "$d_gdbm_open" in
21265         $undef)
21266                 t_gdbm="$undef"
21267                 echo "We won't be including <gdbm.h>"
21268                 ;;
21269         esac
21270         ;;
21271 esac
21272 val="$t_gdbm"
21273 set i_gdbm
21274 eval $setvar
21275
21276 : see if this is a ieeefp.h system
21277 case "$i_ieeefp" in
21278 '' ) set ieeefp.h i_ieeefp
21279      eval $inhdr
21280      ;;
21281 esac
21282
21283 : see if this is a libutil.h system
21284 set libutil.h i_libutil
21285 eval $inhdr
21286
21287 : see if mach cthreads are available
21288 if test "X$usethreads" = "X$define"; then
21289         set mach/cthreads.h i_machcthr
21290         eval $inhdr
21291 else
21292         i_machcthr="$undef"
21293 fi
21294
21295 : see if this is a mntent.h system
21296 set mntent.h i_mntent
21297 eval $inhdr
21298
21299 : see if net/errno.h is available
21300 val=''
21301 set net/errno.h val
21302 eval $inhdr
21303
21304 : Unfortunately, it causes problems on some systems.  Arrgh.
21305 case "$val" in
21306 $define)
21307         cat > try.c <<'EOM'
21308 #include <stdio.h>
21309 #include <errno.h>
21310 #include <net/errno.h>
21311 int func()
21312 {
21313         return ENOTSOCK;
21314 }
21315 EOM
21316         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21317                 echo "We'll be including <net/errno.h>." >&4
21318         else
21319                 echo "We won't be including <net/errno.h>." >&4
21320                 val="$undef"
21321         fi
21322         $rm_try
21323         ;;
21324 esac
21325 set i_neterrno
21326 eval $setvar
21327
21328 : see if netinet/tcp.h is available
21329 set netinet/tcp.h i_netinettcp
21330 eval $inhdr
21331
21332 : see if this is a poll.h system
21333 set poll.h i_poll
21334 eval $inhdr
21335
21336 : see if this is a prot.h system
21337 set prot.h i_prot
21338 eval $inhdr
21339
21340 : Preprocessor symbols
21341 echo " "
21342 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21343 $cat <<'EOSH' > Cppsym.know
21344 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21345 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21346 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21347 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21348 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21349 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21350 bull c cadmus clipper CMU COFF COMPILER_VERSION
21351 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21352 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21353 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21354 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21355 GLIBC GLIBC_MINOR
21356 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21357 H3050R H3050RX hbullx20 hcx host_mips
21358 hp200 hp300 hp700 HP700 hp800 hp9000
21359 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21360 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21361 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21362 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21363 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21364 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21365 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21366 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21367 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21368 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21369 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21370 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21371 MATH_HAS_NO_SIDE_EFFECTS
21372 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21373 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21374 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21375 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21376 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21377 NetBSD news1500 news1700 news1800 news1900 news3700
21378 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21379 ns32016 ns32332 ns32k nsc32000
21380 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21381 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21382 pc532 pdp11 PGC PIC plexus PORTAR posix
21383 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21384 POSIX_C_SOURCE POSIX_SOURCE POWER
21385 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21386 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21387 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21388 sony sony_news sonyrisc sparc sparclite spectrum
21389 stardent stdc STDC_EXT stratos sun sun3 sun386
21390 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21391 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21392 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21393 sysV68 sysV88 Tek4132 Tek4300 titan
21394 TM3200 TM5400 TM5600
21395 tower tower32 tower32_200 tower32_600 tower32_700
21396 tower32_800 tower32_850 tss
21397 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21398 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21399 unix UNIX95 UNIX99 unixpc unos
21400 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21401 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21402 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21403 USGr4 USGr4_2
21404 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21405 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21406 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21407 z8000
21408 EOSH
21409 # Maybe put other stuff here too.
21410 cat <<EOSH >>Cppsym.know
21411 $osname
21412 EOSH
21413 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21414 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21415 $cat Cppsym.know > Cppsym.c
21416 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21417 $rm -f Cppsym.a Cppsym.b Cppsym.c
21418 cat <<EOSH > Cppsym
21419 $startsh
21420 if $test \$# -gt 0; then
21421     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21422     if $test -s Cppsym.got; then
21423         $rm -f Cppsym.got
21424         exit 0
21425     fi
21426     $rm -f Cppsym.got
21427     exit 1
21428 else
21429     $tr " " "$trnl" | ./Cppsym.try
21430     exit 0
21431 fi
21432 EOSH
21433 chmod +x Cppsym
21434 $eunicefix Cppsym
21435 cat <<EOSH > Cppsym.try
21436 $startsh
21437 cat <<'EOCP' > try.c
21438 #include <stdio.h>
21439 #if cpp_stuff == 1
21440 #define STRINGIFY(a)    "a"
21441 #endif
21442 #if cpp_stuff == 42
21443 #define StGiFy(a)  #a
21444 #define STRINGIFY(a)    StGiFy(a)
21445 #endif
21446 #if $cpp_stuff != 1 && $cpp_stuff != 42
21447 #   include "Bletch: How does this C preprocessor stringify macros?"
21448 #endif
21449 int main() {
21450 EOCP
21451 $awk \\
21452 EOSH
21453 cat <<'EOSH' >> Cppsym.try
21454 'length($1) > 0 {
21455     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21456     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21457     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21458     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21459 }'       >> try.c
21460 echo 'return 0;}' >> try.c
21461 EOSH
21462 cat <<EOSH >> Cppsym.try
21463 ccflags="$ccflags"
21464 case "$osname-$gccversion" in
21465 irix-) ccflags="\$ccflags -woff 1178" ;;
21466 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21467 esac
21468 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21469 EOSH
21470 chmod +x Cppsym.try
21471 $eunicefix Cppsym.try
21472 ./Cppsym < Cppsym.know > Cppsym.true
21473 : Add in any linux cpp "predefined macros":
21474 case "$osname::$gccversion" in
21475   *linux*::*.*|*gnukfreebsd*::*.*)
21476     tHdrH=_tmpHdr
21477     rm -f $tHdrH'.h' $tHdrH
21478     touch $tHdrH'.h'
21479     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21480        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21481        if [ -s $tHdrH'_cppsym.real' ]; then
21482           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21483        fi
21484     fi
21485     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21486   ;;
21487 esac
21488 : now check the C compiler for additional symbols
21489 postprocess_cc_v=''
21490 case "$osname" in
21491 aix) postprocess_cc_v="|$tr , ' '" ;;
21492 esac
21493 $cat >ccsym <<EOS
21494 $startsh
21495 $cat >tmp.c <<EOF
21496 extern int foo;
21497 EOF
21498 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21499 do
21500         case "\$i" in
21501         -D*) echo "\$i" | $sed 's/^-D//';;
21502         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21503         esac
21504 done
21505 $rm_try
21506 EOS
21507 postprocess_cc_v=''
21508 chmod +x ccsym
21509 $eunicefix ccsym
21510 ./ccsym > ccsym1.raw
21511 if $test -s ccsym1.raw; then
21512        $sort ccsym1.raw | $uniq >ccsym.raw
21513 else
21514        mv ccsym1.raw ccsym.raw
21515 fi
21516
21517 $awk '/\=/ { print $0; next }
21518         { print $0"=1" }' ccsym.raw >ccsym.list
21519 $comm -13 Cppsym.true ccsym.list >ccsym.own
21520 $comm -12 Cppsym.true ccsym.list >ccsym.com
21521 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21522 also=''
21523 if $test -z ccsym.raw; then
21524         echo "Your C compiler doesn't seem to define any symbols!" >&4
21525         echo " "
21526         echo "However, your C preprocessor defines the following symbols:"
21527         $cat Cppsym.true
21528         ccsymbols=''
21529         cppsymbols=`$cat Cppsym.true`
21530         cppsymbols=`echo $cppsymbols`
21531         cppccsymbols="$cppsymbols"
21532 else
21533         if $test -s ccsym.com; then
21534                 echo "Your C compiler and pre-processor define these symbols:"
21535                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21536                 also='also '
21537                 symbols='ones'
21538                 cppccsymbols=`$cat ccsym.com`
21539                 cppccsymbols=`echo $cppccsymbols`
21540                 $test "$silent" || sleep 1
21541         fi
21542         if $test -s ccsym.cpp; then
21543                 $test "$also" && echo " "
21544                 echo "Your C pre-processor ${also}defines the following symbols:"
21545                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21546                 also='further '
21547                 cppsymbols=`$cat ccsym.cpp`
21548                 cppsymbols=`echo $cppsymbols`
21549                 $test "$silent" || sleep 1
21550         fi
21551         if $test -s ccsym.own; then
21552                 $test "$also" && echo " "
21553                 echo "Your C compiler ${also}defines the following cpp symbols:"
21554                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21555                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21556                 ccsymbols=`$cat ccsym.own`
21557                 ccsymbols=`echo $ccsymbols`
21558                 $test "$silent" || sleep 1
21559         fi
21560 fi
21561
21562 : see if this is a termio system
21563 val="$undef"
21564 val2="$undef"
21565 val3="$undef"
21566 if $test `./findhdr termios.h`; then
21567         set tcsetattr i_termios
21568         eval $inlibc
21569         val3="$i_termios"
21570 fi
21571 echo " "
21572 case "$val3" in
21573 "$define") echo "You have POSIX termios.h... good!" >&4;;
21574 *) if ./Cppsym pyr; then
21575                 case "`/bin/universe`" in
21576                 ucb) if $test `./findhdr sgtty.h`; then
21577                                 val2="$define"
21578                                 echo "<sgtty.h> found." >&4
21579                         else
21580                                 echo "System is pyramid with BSD universe."
21581                                 ./warn "<sgtty.h> not found--you could have problems."
21582                         fi;;
21583                 *) if $test `./findhdr termio.h`; then
21584                                 val="$define"
21585                                 echo "<termio.h> found." >&4
21586                         else
21587                                 echo "System is pyramid with USG universe."
21588                                 ./warn "<termio.h> not found--you could have problems."
21589                         fi;;
21590                 esac
21591         elif ./usg; then
21592                 if $test `./findhdr termio.h`; then
21593                         echo "<termio.h> found." >&4
21594                         val="$define"
21595                 elif $test `./findhdr sgtty.h`; then
21596                         echo "<sgtty.h> found." >&4
21597                         val2="$define"
21598                 else
21599                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21600                 fi
21601         else
21602                 if $test `./findhdr sgtty.h`; then
21603                         echo "<sgtty.h> found." >&4
21604                         val2="$define"
21605                 elif $test `./findhdr termio.h`; then
21606                         echo "<termio.h> found." >&4
21607                         val="$define"
21608                 else
21609                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21610                 fi
21611         fi;;
21612 esac
21613 set i_termio; eval $setvar
21614 val=$val2; set i_sgtty; eval $setvar
21615 val=$val3; set i_termios; eval $setvar
21616
21617 : see if stddef is available
21618 set stddef.h i_stddef
21619 eval $inhdr
21620
21621 : see if sys/access.h is available
21622 set sys/access.h i_sysaccess
21623 eval $inhdr
21624
21625 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21626 set sys/filio.h i_sysfilio
21627 eval $inhdr
21628 echo " "
21629 if $test `./findhdr sys/ioctl.h`; then
21630         val="$define"
21631         echo '<sys/ioctl.h> found.' >&4
21632 else
21633         val="$undef"
21634         if $test $i_sysfilio = "$define"; then
21635             echo '<sys/ioctl.h> NOT found.' >&4
21636         else
21637                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21638                 $test $i_termio = "$define" && xxx="termio.h"
21639                 $test $i_termios = "$define" && xxx="termios.h"
21640 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21641         fi
21642 fi
21643 set i_sysioctl
21644 eval $setvar
21645
21646 : see if socket ioctl defs are in sys/sockio.h
21647 echo " "
21648 xxx=`./findhdr sys/sockio.h`
21649 if $test "$xxx"; then
21650         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21651                 val="$define"
21652                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21653         else
21654                 val="$undef"
21655                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21656         fi
21657 else
21658         val="$undef"
21659         $cat <<EOM
21660 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21661 EOM
21662 fi
21663 set i_syssockio
21664 eval $setvar
21665
21666 : see if this is a syslog.h system
21667 set syslog.h i_syslog
21668 eval $inhdr
21669
21670 : see if this is a sys/mode.h system
21671 set sys/mode.h i_sysmode
21672 eval $inhdr
21673
21674 : see if there is a sys/poll.h file
21675 set sys/poll.h i_syspoll
21676 eval $inhdr
21677
21678 : see if sys/resource.h has to be included
21679 set sys/resource.h i_sysresrc
21680 eval $inhdr
21681
21682 : see if sys/security.h is available
21683 set sys/security.h i_syssecrt
21684 eval $inhdr
21685
21686 : see if this is a sys/statvfs.h system
21687 set sys/statvfs.h i_sysstatvfs
21688 eval $inhdr
21689
21690 : see if this is a sys/un.h system
21691 set sys/un.h i_sysun
21692 eval $inhdr
21693
21694 : see if this is a sys/utsname.h system
21695 set sys/utsname.h i_sysutsname
21696 eval $inhdr
21697
21698 : see if this is a syswait system
21699 set sys/wait.h i_syswait
21700 eval $inhdr
21701
21702 : see if this is a ustat.h system
21703 set ustat.h i_ustat
21704 eval $inhdr
21705
21706 : see if this is an utime system
21707 set utime.h i_utime
21708 eval $inhdr
21709
21710 : see if this is a vfork system
21711 case "$d_vfork" in
21712 "$define")
21713         set vfork.h i_vfork
21714         eval $inhdr
21715         ;;
21716 *)
21717         i_vfork="$undef"
21718         ;;
21719 esac
21720
21721 : Check extensions
21722 echo " "
21723 echo "Looking for extensions..." >&4
21724 : If we are using the old config.sh, known_extensions may contain
21725 : old or inaccurate or duplicate values.
21726 known_extensions=''
21727 nonxs_extensions=''
21728 : We do not use find because it might not be available.
21729 : We do not just use MANIFEST because the user may have dropped
21730 : some additional extensions into the source tree and expect them
21731 : to be built.
21732
21733 : Function to recursively find available extensions, ignoring DynaLoader
21734 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21735 : In 5.10.1 and later, extensions are stored in directories
21736 : like File-Glob instead of the older File/Glob/.
21737 find_extensions='
21738     for xxx in *; do
21739         case "$xxx" in
21740             DynaLoader|dynaload) ;;
21741             *)
21742             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21743             leaf=`echo $xxx | $sed -e s/.*-//`;
21744             if $test -d File; then
21745                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21746                     known_extensions="$known_extensions $1$this_ext";
21747                 elif $test -f $xxx/Makefile.PL; then
21748                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21749                 else
21750                     if $test -d $xxx -a $# -lt 10; then
21751                         set $1$xxx/ $*;
21752                         cd "$xxx";
21753                         eval $find_extensions;
21754                         cd ..;
21755                         shift;
21756                     fi;
21757                 fi;
21758             else
21759                 $ls -1 $xxx > $$.tmp;
21760                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21761                     known_extensions="$known_extensions $this_ext";
21762                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21763                     known_extensions="$known_extensions $this_ext";
21764                 elif $test -d $xxx; then
21765                     nonxs_extensions="$nonxs_extensions $this_ext";
21766                 fi;
21767                 $rm -f $$.tmp;
21768             fi
21769             ;;
21770         esac;
21771     done'
21772 tdir=`pwd`
21773 cd "$rsrc/cpan"
21774 set X
21775 shift
21776 eval $find_extensions
21777 cd "$rsrc/dist"
21778 set X
21779 shift
21780 eval $find_extensions
21781 cd "$rsrc/ext"
21782 set X
21783 shift
21784 eval $find_extensions
21785 if $test -d File-Glob; then
21786     : All ext/ flattened
21787 else
21788     # Special case:  Add in modules that nest beyond the first level.
21789     # Currently threads/shared and Hash/Util/FieldHash, since they are
21790     # not picked up by the recursive find above (and adding in general
21791     # recursive finding breaks SDBM_File/sdbm).
21792     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21793     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21794 fi
21795 set X $known_extensions
21796 shift
21797 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21798 set X $nonxs_extensions
21799 shift
21800 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21801 cd "$tdir"
21802
21803 : Now see which are supported on this system.
21804 avail_ext=''
21805 for xxx in $known_extensions ; do
21806         case "$xxx" in
21807         DB_File|db_file)
21808                 case "$i_db" in
21809                 $define) avail_ext="$avail_ext $xxx" ;;
21810                 esac
21811                 ;;
21812         GDBM_File|gdbm_fil)
21813                 case "$i_gdbm" in
21814                 $define) avail_ext="$avail_ext $xxx" ;;
21815                 esac
21816                 ;;
21817         I18N/Langinfo|i18n_lan)
21818                 case "$i_langinfo$d_nl_langinfo" in
21819                 $define$define) avail_ext="$avail_ext $xxx" ;;
21820                 esac
21821                 ;;
21822         IPC/SysV|ipc/sysv)
21823                 : XXX Do we need a useipcsysv variable here
21824                 case "${d_msg}${d_sem}${d_shm}" in
21825                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21826                 esac
21827                 ;;
21828         NDBM_File|ndbm_fil)
21829                 case "$d_ndbm" in
21830                 $define)
21831                     case "$osname-$use64bitint" in
21832                     hpux-define)
21833                         case "$libs" in
21834                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21835                         esac
21836                         ;;
21837                     *) avail_ext="$avail_ext $xxx" ;;
21838                     esac
21839                     ;;
21840                 esac
21841                 ;;
21842         ODBM_File|odbm_fil)
21843                 case "${i_dbm}${i_rpcsvcdbm}" in
21844                 *"${define}"*)
21845                     case "$d_cplusplus" in
21846                     define) ;; # delete as a function name will not work
21847                     *)  case "$osname-$use64bitint" in
21848                         hpux-define)
21849                             case "$libs" in
21850                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21851                             esac
21852                             ;;
21853                         *) avail_ext="$avail_ext $xxx" ;;
21854                         esac
21855                         ;;
21856                     esac
21857                     ;;
21858                 esac
21859                 ;;
21860         Opcode|opcode)
21861                 case "$useopcode" in
21862                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21863                 esac
21864                 ;;
21865         POSIX|posix)
21866                 case "$useposix" in
21867                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21868                 esac
21869                 ;;
21870         Socket|socket)
21871                 case "$d_socket" in
21872                 true|$define|y)
21873                     case "$osname" in
21874                     beos) ;; # not unless BONE
21875                     *) avail_ext="$avail_ext $xxx" ;;
21876                     esac
21877                     ;;
21878                 esac
21879                 ;;
21880         Sys/Syslog|sys/syslog)
21881                 : XXX syslog requires socket
21882                 case "$d_socket" in
21883                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21884                 esac
21885                 ;;
21886         Thread|thread)
21887                 case "$usethreads" in
21888                 true|$define|y)
21889                         case "$use5005threads" in
21890                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21891                         esac
21892                 esac
21893                 ;;
21894         threads|threads/shared)
21895                 # threads and threads::shared are special cases.
21896                 # To stop people from asking "Perl 5.8.0 was supposed
21897                 # to have this new fancy threads implementation but my
21898                 # perl doesn't have it" and from people trying to
21899                 # (re)install the threads module using CPAN.pm and
21900                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21901                 # the threads.pm and threads/shared.pm will always be
21902                 # there, croaking informatively ("you need to rebuild
21903                 # all of Perl with threads, sorry") when threads haven't
21904                 # been compiled in.
21905                 # --jhi
21906                 avail_ext="$avail_ext $xxx"
21907                 ;;
21908         VMS*)
21909                 ;;
21910         Win32*)
21911                 case "$osname" in
21912                 cygwin) avail_ext="$avail_ext $xxx" ;;
21913                 esac
21914                 ;;
21915         XS/APItest|xs/apitest)
21916                 # This is just for testing.  Skip it unless we have dynamic loading.
21917
21918                 case "$usedl" in
21919                 $define) avail_ext="$avail_ext $xxx" ;;
21920                 esac
21921                 ;;
21922         XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
21923                 # This is just for testing.  Skip it unless we have dynamic loading.
21924
21925                 case "$usedl" in
21926                 $define) avail_ext="$avail_ext $xxx" ;;
21927                 esac
21928                 ;;
21929         XS/Typemap|xs/typemap)
21930                 # This is just for testing.  Skip it unless we have dynamic loading.
21931                 case "$usedl" in
21932                 $define) avail_ext="$avail_ext $xxx" ;;
21933                 esac
21934                 ;;
21935         *)      avail_ext="$avail_ext $xxx"
21936                 ;;
21937         esac
21938 done
21939
21940 set X $avail_ext
21941 shift
21942 avail_ext="$*"
21943
21944 case "$onlyextensions" in
21945 '') ;;
21946 *)  keepextensions=''
21947     echo "You have requested that only certains extensions be included..." >&4
21948     for i in $onlyextensions; do
21949         case " $avail_ext " in
21950         *" $i "*)
21951             echo "Keeping extension $i."
21952             keepextensions="$keepextensions $i"
21953             ;;
21954         *) echo "Ignoring extension $i." ;;
21955         esac
21956     done
21957     avail_ext="$keepextensions"
21958     ;;
21959 esac
21960
21961 case "$noextensions" in
21962 '') ;;
21963 *)  keepextensions=''
21964     echo "You have requested that certain extensions be ignored..." >&4
21965     for i in $avail_ext; do
21966         case " $noextensions " in
21967         *" $i "*) echo "Ignoring extension $i." ;;
21968         *) echo "Keeping extension $i.";
21969            keepextensions="$keepextensions $i"
21970            ;;
21971         esac
21972     done
21973     avail_ext="$keepextensions"
21974     ;;
21975 esac
21976
21977 : Now see which nonxs extensions are supported on this system.
21978 : For now assume all are.
21979 nonxs_ext=''
21980 for xxx in $nonxs_extensions ; do
21981         case "$xxx" in
21982         *)      nonxs_ext="$nonxs_ext $xxx"
21983                 ;;
21984         esac
21985 done
21986
21987 set X $nonxs_ext
21988 shift
21989 nonxs_ext="$*"
21990
21991 case $usedl in
21992 $define)
21993         $cat <<EOM
21994 A number of extensions are supplied with $package.  You may choose to
21995 compile these extensions for dynamic loading (the default), compile
21996 them into the $package executable (static loading), or not include
21997 them at all.  Answer "none" to include no extensions.
21998 Note that DynaLoader is always built and need not be mentioned here.
21999
22000 EOM
22001         case "$dynamic_ext" in
22002         '')
22003                 : Exclude those listed in static_ext
22004                 dflt=''
22005                 for xxx in $avail_ext; do
22006                         case " $static_ext " in
22007                         *" $xxx "*) ;;
22008                         *) dflt="$dflt $xxx" ;;
22009                         esac
22010                 done
22011                 set X $dflt
22012                 shift
22013                 dflt="$*"
22014                 ;;
22015         *)      dflt="$dynamic_ext"
22016                 # Perhaps we are reusing an old out-of-date config.sh.
22017                 case "$hint" in
22018                 previous)
22019                         if test X"$dynamic_ext" != X"$avail_ext"; then
22020                                 $cat <<EOM
22021 NOTICE:  Your previous config.sh list may be incorrect.
22022 The extensions now available to you are
22023         ${avail_ext}
22024 but the default list from your previous config.sh is
22025         ${dynamic_ext}
22026
22027 EOM
22028                         fi
22029                         ;;
22030                 esac
22031                 ;;
22032         esac
22033         case "$dflt" in
22034         '')     dflt=none;;
22035         esac
22036         rp="What extensions do you wish to load dynamically?"
22037         . ./myread
22038         case "$ans" in
22039         none) dynamic_ext=' ' ;;
22040         *) dynamic_ext="$ans" ;;
22041         esac
22042
22043         case "$static_ext" in
22044         '')
22045                 : Exclude those already listed in dynamic linking
22046                 dflt=''
22047                 for xxx in $avail_ext; do
22048                         case " $dynamic_ext " in
22049                         *" $xxx "*) ;;
22050                         *) dflt="$dflt $xxx" ;;
22051                         esac
22052                 done
22053                 set X $dflt
22054                 shift
22055                 dflt="$*"
22056                 ;;
22057         *)  dflt="$static_ext"
22058                 ;;
22059         esac
22060
22061         case "$dflt" in
22062         '')     dflt=none;;
22063         esac
22064         rp="What extensions do you wish to load statically?"
22065         . ./myread
22066         case "$ans" in
22067         none) static_ext=' ' ;;
22068         *) static_ext="$ans" ;;
22069         esac
22070         ;;
22071 *)
22072         $cat <<EOM
22073 A number of extensions are supplied with $package.  Answer "none"
22074 to include no extensions.
22075 Note that DynaLoader is always built and need not be mentioned here.
22076
22077 EOM
22078         case "$static_ext" in
22079         '') dflt="$avail_ext" ;;
22080         *)      dflt="$static_ext"
22081                 # Perhaps we are reusing an old out-of-date config.sh.
22082                 case "$hint" in
22083                 previous)
22084                         if test X"$static_ext" != X"$avail_ext"; then
22085                                 $cat <<EOM
22086 NOTICE:  Your previous config.sh list may be incorrect.
22087 The extensions now available to you are
22088         ${avail_ext}
22089 but the default list from your previous config.sh is
22090         ${static_ext}
22091
22092 EOM
22093                         fi
22094                         ;;
22095                 esac
22096                 ;;
22097         esac
22098         : Exclude those that are not xs extensions
22099         case "$dflt" in
22100         '')     dflt=none;;
22101         esac
22102         rp="What extensions do you wish to include?"
22103         . ./myread
22104         case "$ans" in
22105         none) static_ext=' ' ;;
22106         *) static_ext="$ans" ;;
22107         esac
22108         ;;
22109 esac
22110 #
22111 # Encode is a special case.  If we are building Encode as a static
22112 # extension, we need to explicitly list its subextensions as well.
22113 # For other nested extensions, this is handled automatically by
22114 # the appropriate Makefile.PL.
22115 case " $static_ext " in
22116         *" Encode "*) # Add the subextensions of Encode
22117         cd "$rsrc/ext"
22118         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22119                 static_ext="$static_ext Encode/$xxx"
22120         done
22121         cd "$tdir"
22122         ;;
22123 esac
22124
22125 set X $dynamic_ext $static_ext $nonxs_ext
22126 shift
22127 extensions="$*"
22128
22129 # Sanity check:  We require an extension suitable for use with
22130 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22131 # should show up as failures in the test suite, but it's helpful to
22132 # catch them now.) The 'extensions' list is normally sorted
22133 # alphabetically, so we need to accept either
22134 #    DB_File ... Fcntl ... IO  ....
22135 # or something like
22136 #    Fcntl ... NDBM_File ... IO  ....
22137 case " $extensions"  in
22138 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22139 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22140 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22141 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22142    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22143    ;;
22144 esac
22145
22146 : Remove libraries needed only for extensions
22147 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22148 : The exception is SunOS 4.x, which needs them.
22149 case "${osname}X${osvers}" in
22150 sunos*X4*)
22151     perllibs="$libs"
22152     ;;
22153 *) case "$usedl" in
22154     $define|true|[yY]*)
22155             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22156             shift
22157             perllibs="$*"
22158             ;;
22159     *)  perllibs="$libs"
22160             ;;
22161     esac
22162     ;;
22163 esac
22164
22165 : Remove build directory name from cppstdin so it can be used from
22166 : either the present location or the final installed location.
22167 echo " "
22168 : Get out of the UU directory to get correct path name.
22169 cd ..
22170 case "$cppstdin" in
22171 `pwd`/cppstdin)
22172         echo "Stripping down cppstdin path name"
22173         cppstdin=cppstdin
22174         ;;
22175 esac
22176 cd UU
22177
22178 : end of configuration questions
22179 echo " "
22180 echo "End of configuration questions."
22181 echo " "
22182
22183 : back to where it started
22184 if test -d ../UU; then
22185         cd ..
22186 fi
22187
22188 : configuration may be unconditionally patched via a 'config.arch' file
22189 if $test -f config.arch; then
22190         echo "I see a config.arch file, loading it." >&4
22191         . ./config.arch
22192 fi
22193
22194 : configuration may be patched via a 'config.over' file
22195 if $test -f config.over; then
22196         echo " "
22197         dflt=y
22198         rp='I see a config.over file.  Do you wish to load it?'
22199         . UU/myread
22200         case "$ans" in
22201         n*) echo "OK, I'll ignore it.";;
22202         *)      . ./config.over
22203                 echo "Configuration override changes have been loaded."
22204                 ;;
22205         esac
22206 fi
22207
22208 : in case they want portability, strip down executable paths
22209 case "$d_portable" in
22210 "$define")
22211         echo " "
22212         echo "Stripping down executable paths..." >&4
22213         for file in $loclist $trylist; do
22214                 eval temp=\$$file
22215                 eval $file=`basename $temp`
22216         done
22217         ;;
22218 esac
22219
22220 : create config.sh file
22221 echo " "
22222 echo "Creating config.sh..." >&4
22223 $spitshell <<EOT >config.sh
22224 $startsh
22225 #
22226 # This file was produced by running the Configure script. It holds all the
22227 # definitions figured out by Configure. Should you modify one of these values,
22228 # do not forget to propagate your changes by running "Configure -der". You may
22229 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22230 #
22231
22232 # Package name      : $package
22233 # Source directory  : $src
22234 # Configuration time: $cf_time
22235 # Configured by     : $cf_by
22236 # Target system     : $myuname
22237
22238 EOT
22239 : Add in command line options if available
22240 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22241
22242 $spitshell <<EOT >>config.sh
22243
22244 Author='$Author'
22245 Date='$Date'
22246 Header='$Header'
22247 Id='$Id'
22248 Locker='$Locker'
22249 Log='$Log'
22250 RCSfile='$RCSfile'
22251 Revision='$Revision'
22252 Source='$Source'
22253 State='$State'
22254 _a='$_a'
22255 _exe='$_exe'
22256 _o='$_o'
22257 afs='$afs'
22258 afsroot='$afsroot'
22259 alignbytes='$alignbytes'
22260 ansi2knr='$ansi2knr'
22261 aphostname='$aphostname'
22262 api_revision='$api_revision'
22263 api_subversion='$api_subversion'
22264 api_version='$api_version'
22265 api_versionstring='$api_versionstring'
22266 ar='$ar'
22267 archlib='$archlib'
22268 archlibexp='$archlibexp'
22269 archname64='$archname64'
22270 archname='$archname'
22271 archobjs='$archobjs'
22272 asctime_r_proto='$asctime_r_proto'
22273 awk='$awk'
22274 baserev='$baserev'
22275 bash='$bash'
22276 bin='$bin'
22277 bin_ELF='$bin_ELF'
22278 binexp='$binexp'
22279 bison='$bison'
22280 byacc='$byacc'
22281 byteorder='$byteorder'
22282 c='$c'
22283 castflags='$castflags'
22284 cat='$cat'
22285 cc='$cc'
22286 cccdlflags='$cccdlflags'
22287 ccdlflags='$ccdlflags'
22288 ccflags='$ccflags'
22289 ccflags_uselargefiles='$ccflags_uselargefiles'
22290 ccname='$ccname'
22291 ccsymbols='$ccsymbols'
22292 ccversion='$ccversion'
22293 cf_by='$cf_by'
22294 cf_email='$cf_email'
22295 cf_time='$cf_time'
22296 charbits='$charbits'
22297 charsize='$charsize'
22298 chgrp='$chgrp'
22299 chmod='$chmod'
22300 chown='$chown'
22301 clocktype='$clocktype'
22302 comm='$comm'
22303 compress='$compress'
22304 contains='$contains'
22305 cp='$cp'
22306 cpio='$cpio'
22307 cpp='$cpp'
22308 cpp_stuff='$cpp_stuff'
22309 cppccsymbols='$cppccsymbols'
22310 cppflags='$cppflags'
22311 cpplast='$cpplast'
22312 cppminus='$cppminus'
22313 cpprun='$cpprun'
22314 cppstdin='$cppstdin'
22315 cppsymbols='$cppsymbols'
22316 crypt_r_proto='$crypt_r_proto'
22317 cryptlib='$cryptlib'
22318 csh='$csh'
22319 ctermid_r_proto='$ctermid_r_proto'
22320 ctime_r_proto='$ctime_r_proto'
22321 d_Gconvert='$d_Gconvert'
22322 d_PRIEUldbl='$d_PRIEUldbl'
22323 d_PRIFUldbl='$d_PRIFUldbl'
22324 d_PRIGUldbl='$d_PRIGUldbl'
22325 d_PRIXU64='$d_PRIXU64'
22326 d_PRId64='$d_PRId64'
22327 d_PRIeldbl='$d_PRIeldbl'
22328 d_PRIfldbl='$d_PRIfldbl'
22329 d_PRIgldbl='$d_PRIgldbl'
22330 d_PRIi64='$d_PRIi64'
22331 d_PRIo64='$d_PRIo64'
22332 d_PRIu64='$d_PRIu64'
22333 d_PRIx64='$d_PRIx64'
22334 d_SCNfldbl='$d_SCNfldbl'
22335 d__fwalk='$d__fwalk'
22336 d_access='$d_access'
22337 d_accessx='$d_accessx'
22338 d_aintl='$d_aintl'
22339 d_alarm='$d_alarm'
22340 d_archlib='$d_archlib'
22341 d_asctime64='$d_asctime64'
22342 d_asctime_r='$d_asctime_r'
22343 d_atolf='$d_atolf'
22344 d_atoll='$d_atoll'
22345 d_attribute_deprecated='$d_attribute_deprecated'
22346 d_attribute_format='$d_attribute_format'
22347 d_attribute_malloc='$d_attribute_malloc'
22348 d_attribute_nonnull='$d_attribute_nonnull'
22349 d_attribute_noreturn='$d_attribute_noreturn'
22350 d_attribute_pure='$d_attribute_pure'
22351 d_attribute_unused='$d_attribute_unused'
22352 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22353 d_bcmp='$d_bcmp'
22354 d_bcopy='$d_bcopy'
22355 d_bsd='$d_bsd'
22356 d_bsdgetpgrp='$d_bsdgetpgrp'
22357 d_bsdsetpgrp='$d_bsdsetpgrp'
22358 d_builtin_choose_expr='$d_builtin_choose_expr'
22359 d_builtin_expect='$d_builtin_expect'
22360 d_bzero='$d_bzero'
22361 d_c99_variadic_macros='$d_c99_variadic_macros'
22362 d_casti32='$d_casti32'
22363 d_castneg='$d_castneg'
22364 d_charvspr='$d_charvspr'
22365 d_chown='$d_chown'
22366 d_chroot='$d_chroot'
22367 d_chsize='$d_chsize'
22368 d_class='$d_class'
22369 d_clearenv='$d_clearenv'
22370 d_closedir='$d_closedir'
22371 d_cmsghdr_s='$d_cmsghdr_s'
22372 d_const='$d_const'
22373 d_copysignl='$d_copysignl'
22374 d_cplusplus='$d_cplusplus'
22375 d_crypt='$d_crypt'
22376 d_crypt_r='$d_crypt_r'
22377 d_csh='$d_csh'
22378 d_ctermid='$d_ctermid'
22379 d_ctermid_r='$d_ctermid_r'
22380 d_ctime64='$d_ctime64'
22381 d_ctime_r='$d_ctime_r'
22382 d_cuserid='$d_cuserid'
22383 d_dbl_dig='$d_dbl_dig'
22384 d_dbminitproto='$d_dbminitproto'
22385 d_difftime64='$d_difftime64'
22386 d_difftime='$d_difftime'
22387 d_dir_dd_fd='$d_dir_dd_fd'
22388 d_dirfd='$d_dirfd'
22389 d_dirnamlen='$d_dirnamlen'
22390 d_dlerror='$d_dlerror'
22391 d_dlopen='$d_dlopen'
22392 d_dlsymun='$d_dlsymun'
22393 d_dosuid='$d_dosuid'
22394 d_drand48_r='$d_drand48_r'
22395 d_drand48proto='$d_drand48proto'
22396 d_dup2='$d_dup2'
22397 d_eaccess='$d_eaccess'
22398 d_endgrent='$d_endgrent'
22399 d_endgrent_r='$d_endgrent_r'
22400 d_endhent='$d_endhent'
22401 d_endhostent_r='$d_endhostent_r'
22402 d_endnent='$d_endnent'
22403 d_endnetent_r='$d_endnetent_r'
22404 d_endpent='$d_endpent'
22405 d_endprotoent_r='$d_endprotoent_r'
22406 d_endpwent='$d_endpwent'
22407 d_endpwent_r='$d_endpwent_r'
22408 d_endsent='$d_endsent'
22409 d_endservent_r='$d_endservent_r'
22410 d_eofnblk='$d_eofnblk'
22411 d_eunice='$d_eunice'
22412 d_faststdio='$d_faststdio'
22413 d_fchdir='$d_fchdir'
22414 d_fchmod='$d_fchmod'
22415 d_fchown='$d_fchown'
22416 d_fcntl='$d_fcntl'
22417 d_fcntl_can_lock='$d_fcntl_can_lock'
22418 d_fd_macros='$d_fd_macros'
22419 d_fd_set='$d_fd_set'
22420 d_fds_bits='$d_fds_bits'
22421 d_fgetpos='$d_fgetpos'
22422 d_finite='$d_finite'
22423 d_finitel='$d_finitel'
22424 d_flexfnam='$d_flexfnam'
22425 d_flock='$d_flock'
22426 d_flockproto='$d_flockproto'
22427 d_fork='$d_fork'
22428 d_fp_class='$d_fp_class'
22429 d_fpathconf='$d_fpathconf'
22430 d_fpclass='$d_fpclass'
22431 d_fpclassify='$d_fpclassify'
22432 d_fpclassl='$d_fpclassl'
22433 d_fpos64_t='$d_fpos64_t'
22434 d_frexpl='$d_frexpl'
22435 d_fs_data_s='$d_fs_data_s'
22436 d_fseeko='$d_fseeko'
22437 d_fsetpos='$d_fsetpos'
22438 d_fstatfs='$d_fstatfs'
22439 d_fstatvfs='$d_fstatvfs'
22440 d_fsync='$d_fsync'
22441 d_ftello='$d_ftello'
22442 d_ftime='$d_ftime'
22443 d_futimes='$d_futimes'
22444 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22445 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22446 d_getaddrinfo='$d_getaddrinfo'
22447 d_getcwd='$d_getcwd'
22448 d_getespwnam='$d_getespwnam'
22449 d_getfsstat='$d_getfsstat'
22450 d_getgrent='$d_getgrent'
22451 d_getgrent_r='$d_getgrent_r'
22452 d_getgrgid_r='$d_getgrgid_r'
22453 d_getgrnam_r='$d_getgrnam_r'
22454 d_getgrps='$d_getgrps'
22455 d_gethbyaddr='$d_gethbyaddr'
22456 d_gethbyname='$d_gethbyname'
22457 d_gethent='$d_gethent'
22458 d_gethname='$d_gethname'
22459 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22460 d_gethostbyname_r='$d_gethostbyname_r'
22461 d_gethostent_r='$d_gethostent_r'
22462 d_gethostprotos='$d_gethostprotos'
22463 d_getitimer='$d_getitimer'
22464 d_getlogin='$d_getlogin'
22465 d_getlogin_r='$d_getlogin_r'
22466 d_getmnt='$d_getmnt'
22467 d_getmntent='$d_getmntent'
22468 d_getnameinfo='$d_getnameinfo'
22469 d_getnbyaddr='$d_getnbyaddr'
22470 d_getnbyname='$d_getnbyname'
22471 d_getnent='$d_getnent'
22472 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22473 d_getnetbyname_r='$d_getnetbyname_r'
22474 d_getnetent_r='$d_getnetent_r'
22475 d_getnetprotos='$d_getnetprotos'
22476 d_getpagsz='$d_getpagsz'
22477 d_getpbyname='$d_getpbyname'
22478 d_getpbynumber='$d_getpbynumber'
22479 d_getpent='$d_getpent'
22480 d_getpgid='$d_getpgid'
22481 d_getpgrp2='$d_getpgrp2'
22482 d_getpgrp='$d_getpgrp'
22483 d_getppid='$d_getppid'
22484 d_getprior='$d_getprior'
22485 d_getprotobyname_r='$d_getprotobyname_r'
22486 d_getprotobynumber_r='$d_getprotobynumber_r'
22487 d_getprotoent_r='$d_getprotoent_r'
22488 d_getprotoprotos='$d_getprotoprotos'
22489 d_getprpwnam='$d_getprpwnam'
22490 d_getpwent='$d_getpwent'
22491 d_getpwent_r='$d_getpwent_r'
22492 d_getpwnam_r='$d_getpwnam_r'
22493 d_getpwuid_r='$d_getpwuid_r'
22494 d_getsbyname='$d_getsbyname'
22495 d_getsbyport='$d_getsbyport'
22496 d_getsent='$d_getsent'
22497 d_getservbyname_r='$d_getservbyname_r'
22498 d_getservbyport_r='$d_getservbyport_r'
22499 d_getservent_r='$d_getservent_r'
22500 d_getservprotos='$d_getservprotos'
22501 d_getspnam='$d_getspnam'
22502 d_getspnam_r='$d_getspnam_r'
22503 d_gettimeod='$d_gettimeod'
22504 d_gmtime64='$d_gmtime64'
22505 d_gmtime_r='$d_gmtime_r'
22506 d_gnulibc='$d_gnulibc'
22507 d_grpasswd='$d_grpasswd'
22508 d_hasmntopt='$d_hasmntopt'
22509 d_htonl='$d_htonl'
22510 d_ilogbl='$d_ilogbl'
22511 d_inc_version_list='$d_inc_version_list'
22512 d_index='$d_index'
22513 d_inetaton='$d_inetaton'
22514 d_inetntop='$d_inetntop'
22515 d_inetpton='$d_inetpton'
22516 d_int64_t='$d_int64_t'
22517 d_isascii='$d_isascii'
22518 d_isfinite='$d_isfinite'
22519 d_isinf='$d_isinf'
22520 d_isnan='$d_isnan'
22521 d_isnanl='$d_isnanl'
22522 d_killpg='$d_killpg'
22523 d_lchown='$d_lchown'
22524 d_ldbl_dig='$d_ldbl_dig'
22525 d_libm_lib_version='$d_libm_lib_version'
22526 d_link='$d_link'
22527 d_localtime64='$d_localtime64'
22528 d_localtime_r='$d_localtime_r'
22529 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22530 d_locconv='$d_locconv'
22531 d_lockf='$d_lockf'
22532 d_longdbl='$d_longdbl'
22533 d_longlong='$d_longlong'
22534 d_lseekproto='$d_lseekproto'
22535 d_lstat='$d_lstat'
22536 d_madvise='$d_madvise'
22537 d_malloc_good_size='$d_malloc_good_size'
22538 d_malloc_size='$d_malloc_size'
22539 d_mblen='$d_mblen'
22540 d_mbstowcs='$d_mbstowcs'
22541 d_mbtowc='$d_mbtowc'
22542 d_memchr='$d_memchr'
22543 d_memcmp='$d_memcmp'
22544 d_memcpy='$d_memcpy'
22545 d_memmove='$d_memmove'
22546 d_memset='$d_memset'
22547 d_mkdir='$d_mkdir'
22548 d_mkdtemp='$d_mkdtemp'
22549 d_mkfifo='$d_mkfifo'
22550 d_mkstemp='$d_mkstemp'
22551 d_mkstemps='$d_mkstemps'
22552 d_mktime64='$d_mktime64'
22553 d_mktime='$d_mktime'
22554 d_mmap='$d_mmap'
22555 d_modfl='$d_modfl'
22556 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22557 d_modflproto='$d_modflproto'
22558 d_mprotect='$d_mprotect'
22559 d_msg='$d_msg'
22560 d_msg_ctrunc='$d_msg_ctrunc'
22561 d_msg_dontroute='$d_msg_dontroute'
22562 d_msg_oob='$d_msg_oob'
22563 d_msg_peek='$d_msg_peek'
22564 d_msg_proxy='$d_msg_proxy'
22565 d_msgctl='$d_msgctl'
22566 d_msgget='$d_msgget'
22567 d_msghdr_s='$d_msghdr_s'
22568 d_msgrcv='$d_msgrcv'
22569 d_msgsnd='$d_msgsnd'
22570 d_msync='$d_msync'
22571 d_munmap='$d_munmap'
22572 d_mymalloc='$d_mymalloc'
22573 d_ndbm='$d_ndbm'
22574 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22575 d_nice='$d_nice'
22576 d_nl_langinfo='$d_nl_langinfo'
22577 d_nv_preserves_uv='$d_nv_preserves_uv'
22578 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22579 d_off64_t='$d_off64_t'
22580 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22581 d_oldpthreads='$d_oldpthreads'
22582 d_oldsock='$d_oldsock'
22583 d_open3='$d_open3'
22584 d_pathconf='$d_pathconf'
22585 d_pause='$d_pause'
22586 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22587 d_phostname='$d_phostname'
22588 d_pipe='$d_pipe'
22589 d_poll='$d_poll'
22590 d_portable='$d_portable'
22591 d_printf_format_null='$d_printf_format_null'
22592 d_procselfexe='$d_procselfexe'
22593 d_pseudofork='$d_pseudofork'
22594 d_pthread_atfork='$d_pthread_atfork'
22595 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22596 d_pthread_yield='$d_pthread_yield'
22597 d_pwage='$d_pwage'
22598 d_pwchange='$d_pwchange'
22599 d_pwclass='$d_pwclass'
22600 d_pwcomment='$d_pwcomment'
22601 d_pwexpire='$d_pwexpire'
22602 d_pwgecos='$d_pwgecos'
22603 d_pwpasswd='$d_pwpasswd'
22604 d_pwquota='$d_pwquota'
22605 d_qgcvt='$d_qgcvt'
22606 d_quad='$d_quad'
22607 d_random_r='$d_random_r'
22608 d_readdir64_r='$d_readdir64_r'
22609 d_readdir='$d_readdir'
22610 d_readdir_r='$d_readdir_r'
22611 d_readlink='$d_readlink'
22612 d_readv='$d_readv'
22613 d_recvmsg='$d_recvmsg'
22614 d_rename='$d_rename'
22615 d_rewinddir='$d_rewinddir'
22616 d_rmdir='$d_rmdir'
22617 d_safebcpy='$d_safebcpy'
22618 d_safemcpy='$d_safemcpy'
22619 d_sanemcmp='$d_sanemcmp'
22620 d_sbrkproto='$d_sbrkproto'
22621 d_scalbnl='$d_scalbnl'
22622 d_sched_yield='$d_sched_yield'
22623 d_scm_rights='$d_scm_rights'
22624 d_seekdir='$d_seekdir'
22625 d_select='$d_select'
22626 d_sem='$d_sem'
22627 d_semctl='$d_semctl'
22628 d_semctl_semid_ds='$d_semctl_semid_ds'
22629 d_semctl_semun='$d_semctl_semun'
22630 d_semget='$d_semget'
22631 d_semop='$d_semop'
22632 d_sendmsg='$d_sendmsg'
22633 d_setegid='$d_setegid'
22634 d_seteuid='$d_seteuid'
22635 d_setgrent='$d_setgrent'
22636 d_setgrent_r='$d_setgrent_r'
22637 d_setgrps='$d_setgrps'
22638 d_sethent='$d_sethent'
22639 d_sethostent_r='$d_sethostent_r'
22640 d_setitimer='$d_setitimer'
22641 d_setlinebuf='$d_setlinebuf'
22642 d_setlocale='$d_setlocale'
22643 d_setlocale_r='$d_setlocale_r'
22644 d_setnent='$d_setnent'
22645 d_setnetent_r='$d_setnetent_r'
22646 d_setpent='$d_setpent'
22647 d_setpgid='$d_setpgid'
22648 d_setpgrp2='$d_setpgrp2'
22649 d_setpgrp='$d_setpgrp'
22650 d_setprior='$d_setprior'
22651 d_setproctitle='$d_setproctitle'
22652 d_setprotoent_r='$d_setprotoent_r'
22653 d_setpwent='$d_setpwent'
22654 d_setpwent_r='$d_setpwent_r'
22655 d_setregid='$d_setregid'
22656 d_setresgid='$d_setresgid'
22657 d_setresuid='$d_setresuid'
22658 d_setreuid='$d_setreuid'
22659 d_setrgid='$d_setrgid'
22660 d_setruid='$d_setruid'
22661 d_setsent='$d_setsent'
22662 d_setservent_r='$d_setservent_r'
22663 d_setsid='$d_setsid'
22664 d_setvbuf='$d_setvbuf'
22665 d_sfio='$d_sfio'
22666 d_shm='$d_shm'
22667 d_shmat='$d_shmat'
22668 d_shmatprototype='$d_shmatprototype'
22669 d_shmctl='$d_shmctl'
22670 d_shmdt='$d_shmdt'
22671 d_shmget='$d_shmget'
22672 d_sigaction='$d_sigaction'
22673 d_signbit='$d_signbit'
22674 d_sigprocmask='$d_sigprocmask'
22675 d_sigsetjmp='$d_sigsetjmp'
22676 d_sitearch='$d_sitearch'
22677 d_snprintf='$d_snprintf'
22678 d_sockatmark='$d_sockatmark'
22679 d_sockatmarkproto='$d_sockatmarkproto'
22680 d_socket='$d_socket'
22681 d_socklen_t='$d_socklen_t'
22682 d_sockpair='$d_sockpair'
22683 d_socks5_init='$d_socks5_init'
22684 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22685 d_sqrtl='$d_sqrtl'
22686 d_srand48_r='$d_srand48_r'
22687 d_srandom_r='$d_srandom_r'
22688 d_sresgproto='$d_sresgproto'
22689 d_sresuproto='$d_sresuproto'
22690 d_statblks='$d_statblks'
22691 d_statfs_f_flags='$d_statfs_f_flags'
22692 d_statfs_s='$d_statfs_s'
22693 d_statvfs='$d_statvfs'
22694 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22695 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22696 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22697 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22698 d_stdio_stream_array='$d_stdio_stream_array'
22699 d_stdiobase='$d_stdiobase'
22700 d_stdstdio='$d_stdstdio'
22701 d_strchr='$d_strchr'
22702 d_strcoll='$d_strcoll'
22703 d_strctcpy='$d_strctcpy'
22704 d_strerrm='$d_strerrm'
22705 d_strerror='$d_strerror'
22706 d_strerror_r='$d_strerror_r'
22707 d_strftime='$d_strftime'
22708 d_strlcat='$d_strlcat'
22709 d_strlcpy='$d_strlcpy'
22710 d_strtod='$d_strtod'
22711 d_strtol='$d_strtol'
22712 d_strtold='$d_strtold'
22713 d_strtoll='$d_strtoll'
22714 d_strtoq='$d_strtoq'
22715 d_strtoul='$d_strtoul'
22716 d_strtoull='$d_strtoull'
22717 d_strtouq='$d_strtouq'
22718 d_strxfrm='$d_strxfrm'
22719 d_suidsafe='$d_suidsafe'
22720 d_symlink='$d_symlink'
22721 d_syscall='$d_syscall'
22722 d_syscallproto='$d_syscallproto'
22723 d_sysconf='$d_sysconf'
22724 d_sysernlst='$d_sysernlst'
22725 d_syserrlst='$d_syserrlst'
22726 d_system='$d_system'
22727 d_tcgetpgrp='$d_tcgetpgrp'
22728 d_tcsetpgrp='$d_tcsetpgrp'
22729 d_telldir='$d_telldir'
22730 d_telldirproto='$d_telldirproto'
22731 d_time='$d_time'
22732 d_timegm='$d_timegm'
22733 d_times='$d_times'
22734 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22735 d_tm_tm_zone='$d_tm_tm_zone'
22736 d_tmpnam_r='$d_tmpnam_r'
22737 d_truncate='$d_truncate'
22738 d_ttyname_r='$d_ttyname_r'
22739 d_tzname='$d_tzname'
22740 d_u32align='$d_u32align'
22741 d_ualarm='$d_ualarm'
22742 d_umask='$d_umask'
22743 d_uname='$d_uname'
22744 d_union_semun='$d_union_semun'
22745 d_unordered='$d_unordered'
22746 d_unsetenv='$d_unsetenv'
22747 d_usleep='$d_usleep'
22748 d_usleepproto='$d_usleepproto'
22749 d_ustat='$d_ustat'
22750 d_vendorarch='$d_vendorarch'
22751 d_vendorbin='$d_vendorbin'
22752 d_vendorlib='$d_vendorlib'
22753 d_vendorscript='$d_vendorscript'
22754 d_vfork='$d_vfork'
22755 d_void_closedir='$d_void_closedir'
22756 d_voidsig='$d_voidsig'
22757 d_voidtty='$d_voidtty'
22758 d_volatile='$d_volatile'
22759 d_vprintf='$d_vprintf'
22760 d_vsnprintf='$d_vsnprintf'
22761 d_wait4='$d_wait4'
22762 d_waitpid='$d_waitpid'
22763 d_wcstombs='$d_wcstombs'
22764 d_wctomb='$d_wctomb'
22765 d_writev='$d_writev'
22766 d_xenix='$d_xenix'
22767 date='$date'
22768 db_hashtype='$db_hashtype'
22769 db_prefixtype='$db_prefixtype'
22770 db_version_major='$db_version_major'
22771 db_version_minor='$db_version_minor'
22772 db_version_patch='$db_version_patch'
22773 defvoidused='$defvoidused'
22774 direntrytype='$direntrytype'
22775 dlext='$dlext'
22776 dlsrc='$dlsrc'
22777 doublesize='$doublesize'
22778 drand01='$drand01'
22779 drand48_r_proto='$drand48_r_proto'
22780 dtrace='$dtrace'
22781 dynamic_ext='$dynamic_ext'
22782 eagain='$eagain'
22783 ebcdic='$ebcdic'
22784 echo='$echo'
22785 egrep='$egrep'
22786 emacs='$emacs'
22787 endgrent_r_proto='$endgrent_r_proto'
22788 endhostent_r_proto='$endhostent_r_proto'
22789 endnetent_r_proto='$endnetent_r_proto'
22790 endprotoent_r_proto='$endprotoent_r_proto'
22791 endpwent_r_proto='$endpwent_r_proto'
22792 endservent_r_proto='$endservent_r_proto'
22793 eunicefix='$eunicefix'
22794 exe_ext='$exe_ext'
22795 expr='$expr'
22796 extensions='$extensions'
22797 extern_C='$extern_C'
22798 extras='$extras'
22799 fflushNULL='$fflushNULL'
22800 fflushall='$fflushall'
22801 find='$find'
22802 firstmakefile='$firstmakefile'
22803 flex='$flex'
22804 fpossize='$fpossize'
22805 fpostype='$fpostype'
22806 freetype='$freetype'
22807 from='$from'
22808 full_ar='$full_ar'
22809 full_csh='$full_csh'
22810 full_sed='$full_sed'
22811 gccansipedantic='$gccansipedantic'
22812 gccosandvers='$gccosandvers'
22813 gccversion='$gccversion'
22814 getgrent_r_proto='$getgrent_r_proto'
22815 getgrgid_r_proto='$getgrgid_r_proto'
22816 getgrnam_r_proto='$getgrnam_r_proto'
22817 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22818 gethostbyname_r_proto='$gethostbyname_r_proto'
22819 gethostent_r_proto='$gethostent_r_proto'
22820 getlogin_r_proto='$getlogin_r_proto'
22821 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22822 getnetbyname_r_proto='$getnetbyname_r_proto'
22823 getnetent_r_proto='$getnetent_r_proto'
22824 getprotobyname_r_proto='$getprotobyname_r_proto'
22825 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22826 getprotoent_r_proto='$getprotoent_r_proto'
22827 getpwent_r_proto='$getpwent_r_proto'
22828 getpwnam_r_proto='$getpwnam_r_proto'
22829 getpwuid_r_proto='$getpwuid_r_proto'
22830 getservbyname_r_proto='$getservbyname_r_proto'
22831 getservbyport_r_proto='$getservbyport_r_proto'
22832 getservent_r_proto='$getservent_r_proto'
22833 getspnam_r_proto='$getspnam_r_proto'
22834 gidformat='$gidformat'
22835 gidsign='$gidsign'
22836 gidsize='$gidsize'
22837 gidtype='$gidtype'
22838 glibpth='$glibpth'
22839 gmake='$gmake'
22840 gmtime_r_proto='$gmtime_r_proto'
22841 gnulibc_version='$gnulibc_version'
22842 grep='$grep'
22843 groupcat='$groupcat'
22844 groupstype='$groupstype'
22845 gzip='$gzip'
22846 h_fcntl='$h_fcntl'
22847 h_sysfile='$h_sysfile'
22848 hint='$hint'
22849 hostcat='$hostcat'
22850 html1dir='$html1dir'
22851 html1direxp='$html1direxp'
22852 html3dir='$html3dir'
22853 html3direxp='$html3direxp'
22854 i16size='$i16size'
22855 i16type='$i16type'
22856 i32size='$i32size'
22857 i32type='$i32type'
22858 i64size='$i64size'
22859 i64type='$i64type'
22860 i8size='$i8size'
22861 i8type='$i8type'
22862 i_arpainet='$i_arpainet'
22863 i_assert='$i_assert'
22864 i_bsdioctl='$i_bsdioctl'
22865 i_crypt='$i_crypt'
22866 i_db='$i_db'
22867 i_dbm='$i_dbm'
22868 i_dirent='$i_dirent'
22869 i_dld='$i_dld'
22870 i_dlfcn='$i_dlfcn'
22871 i_fcntl='$i_fcntl'
22872 i_float='$i_float'
22873 i_fp='$i_fp'
22874 i_fp_class='$i_fp_class'
22875 i_gdbm='$i_gdbm'
22876 i_gdbm_ndbm='$i_gdbm_ndbm'
22877 i_gdbmndbm='$i_gdbmndbm'
22878 i_grp='$i_grp'
22879 i_ieeefp='$i_ieeefp'
22880 i_inttypes='$i_inttypes'
22881 i_langinfo='$i_langinfo'
22882 i_libutil='$i_libutil'
22883 i_limits='$i_limits'
22884 i_locale='$i_locale'
22885 i_machcthr='$i_machcthr'
22886 i_malloc='$i_malloc'
22887 i_mallocmalloc='$i_mallocmalloc'
22888 i_math='$i_math'
22889 i_memory='$i_memory'
22890 i_mntent='$i_mntent'
22891 i_ndbm='$i_ndbm'
22892 i_netdb='$i_netdb'
22893 i_neterrno='$i_neterrno'
22894 i_netinettcp='$i_netinettcp'
22895 i_niin='$i_niin'
22896 i_poll='$i_poll'
22897 i_prot='$i_prot'
22898 i_pthread='$i_pthread'
22899 i_pwd='$i_pwd'
22900 i_rpcsvcdbm='$i_rpcsvcdbm'
22901 i_sfio='$i_sfio'
22902 i_sgtty='$i_sgtty'
22903 i_shadow='$i_shadow'
22904 i_socks='$i_socks'
22905 i_stdarg='$i_stdarg'
22906 i_stddef='$i_stddef'
22907 i_stdlib='$i_stdlib'
22908 i_string='$i_string'
22909 i_sunmath='$i_sunmath'
22910 i_sysaccess='$i_sysaccess'
22911 i_sysdir='$i_sysdir'
22912 i_sysfile='$i_sysfile'
22913 i_sysfilio='$i_sysfilio'
22914 i_sysin='$i_sysin'
22915 i_sysioctl='$i_sysioctl'
22916 i_syslog='$i_syslog'
22917 i_sysmman='$i_sysmman'
22918 i_sysmode='$i_sysmode'
22919 i_sysmount='$i_sysmount'
22920 i_sysndir='$i_sysndir'
22921 i_sysparam='$i_sysparam'
22922 i_syspoll='$i_syspoll'
22923 i_sysresrc='$i_sysresrc'
22924 i_syssecrt='$i_syssecrt'
22925 i_sysselct='$i_sysselct'
22926 i_syssockio='$i_syssockio'
22927 i_sysstat='$i_sysstat'
22928 i_sysstatfs='$i_sysstatfs'
22929 i_sysstatvfs='$i_sysstatvfs'
22930 i_systime='$i_systime'
22931 i_systimek='$i_systimek'
22932 i_systimes='$i_systimes'
22933 i_systypes='$i_systypes'
22934 i_sysuio='$i_sysuio'
22935 i_sysun='$i_sysun'
22936 i_sysutsname='$i_sysutsname'
22937 i_sysvfs='$i_sysvfs'
22938 i_syswait='$i_syswait'
22939 i_termio='$i_termio'
22940 i_termios='$i_termios'
22941 i_time='$i_time'
22942 i_unistd='$i_unistd'
22943 i_ustat='$i_ustat'
22944 i_utime='$i_utime'
22945 i_values='$i_values'
22946 i_varargs='$i_varargs'
22947 i_varhdr='$i_varhdr'
22948 i_vfork='$i_vfork'
22949 ignore_versioned_solibs='$ignore_versioned_solibs'
22950 inc_version_list='$inc_version_list'
22951 inc_version_list_init='$inc_version_list_init'
22952 incpath='$incpath'
22953 inews='$inews'
22954 initialinstalllocation='$initialinstalllocation'
22955 installarchlib='$installarchlib'
22956 installbin='$installbin'
22957 installhtml1dir='$installhtml1dir'
22958 installhtml3dir='$installhtml3dir'
22959 installman1dir='$installman1dir'
22960 installman3dir='$installman3dir'
22961 installprefix='$installprefix'
22962 installprefixexp='$installprefixexp'
22963 installprivlib='$installprivlib'
22964 installscript='$installscript'
22965 installsitearch='$installsitearch'
22966 installsitebin='$installsitebin'
22967 installsitehtml1dir='$installsitehtml1dir'
22968 installsitehtml3dir='$installsitehtml3dir'
22969 installsitelib='$installsitelib'
22970 installsiteman1dir='$installsiteman1dir'
22971 installsiteman3dir='$installsiteman3dir'
22972 installsitescript='$installsitescript'
22973 installstyle='$installstyle'
22974 installusrbinperl='$installusrbinperl'
22975 installvendorarch='$installvendorarch'
22976 installvendorbin='$installvendorbin'
22977 installvendorhtml1dir='$installvendorhtml1dir'
22978 installvendorhtml3dir='$installvendorhtml3dir'
22979 installvendorlib='$installvendorlib'
22980 installvendorman1dir='$installvendorman1dir'
22981 installvendorman3dir='$installvendorman3dir'
22982 installvendorscript='$installvendorscript'
22983 intsize='$intsize'
22984 issymlink='$issymlink'
22985 ivdformat='$ivdformat'
22986 ivsize='$ivsize'
22987 ivtype='$ivtype'
22988 known_extensions='$known_extensions'
22989 ksh='$ksh'
22990 ld='$ld'
22991 lddlflags='$lddlflags'
22992 ldflags='$ldflags'
22993 ldflags_uselargefiles='$ldflags_uselargefiles'
22994 ldlibpthname='$ldlibpthname'
22995 less='$less'
22996 lib_ext='$lib_ext'
22997 libc='$libc'
22998 libperl='$libperl'
22999 libpth='$libpth'
23000 libs='$libs'
23001 libsdirs='$libsdirs'
23002 libsfiles='$libsfiles'
23003 libsfound='$libsfound'
23004 libspath='$libspath'
23005 libswanted='$libswanted'
23006 libswanted_uselargefiles='$libswanted_uselargefiles'
23007 line='$line'
23008 lint='$lint'
23009 lkflags='$lkflags'
23010 ln='$ln'
23011 lns='$lns'
23012 localtime_r_proto='$localtime_r_proto'
23013 locincpth='$locincpth'
23014 loclibpth='$loclibpth'
23015 longdblsize='$longdblsize'
23016 longlongsize='$longlongsize'
23017 longsize='$longsize'
23018 lp='$lp'
23019 lpr='$lpr'
23020 ls='$ls'
23021 lseeksize='$lseeksize'
23022 lseektype='$lseektype'
23023 mad='$mad'
23024 madlyh='$madlyh'
23025 madlyobj='$madlyobj'
23026 madlysrc='$madlysrc'
23027 mail='$mail'
23028 mailx='$mailx'
23029 make='$make'
23030 make_set_make='$make_set_make'
23031 mallocobj='$mallocobj'
23032 mallocsrc='$mallocsrc'
23033 malloctype='$malloctype'
23034 man1dir='$man1dir'
23035 man1direxp='$man1direxp'
23036 man1ext='$man1ext'
23037 man3dir='$man3dir'
23038 man3direxp='$man3direxp'
23039 man3ext='$man3ext'
23040 mips_type='$mips_type'
23041 mistrustnm='$mistrustnm'
23042 mkdir='$mkdir'
23043 mmaptype='$mmaptype'
23044 modetype='$modetype'
23045 more='$more'
23046 multiarch='$multiarch'
23047 mv='$mv'
23048 myarchname='$myarchname'
23049 mydomain='$mydomain'
23050 myhostname='$myhostname'
23051 myuname='$myuname'
23052 n='$n'
23053 need_va_copy='$need_va_copy'
23054 netdb_hlen_type='$netdb_hlen_type'
23055 netdb_host_type='$netdb_host_type'
23056 netdb_name_type='$netdb_name_type'
23057 netdb_net_type='$netdb_net_type'
23058 nm='$nm'
23059 nm_opt='$nm_opt'
23060 nm_so_opt='$nm_so_opt'
23061 nonxs_ext='$nonxs_ext'
23062 nroff='$nroff'
23063 nvEUformat='$nvEUformat'
23064 nvFUformat='$nvFUformat'
23065 nvGUformat='$nvGUformat'
23066 nv_overflows_integers_at='$nv_overflows_integers_at'
23067 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23068 nveformat='$nveformat'
23069 nvfformat='$nvfformat'
23070 nvgformat='$nvgformat'
23071 nvsize='$nvsize'
23072 nvtype='$nvtype'
23073 o_nonblock='$o_nonblock'
23074 obj_ext='$obj_ext'
23075 old_pthread_create_joinable='$old_pthread_create_joinable'
23076 optimize='$optimize'
23077 orderlib='$orderlib'
23078 osname='$osname'
23079 osvers='$osvers'
23080 otherlibdirs='$otherlibdirs'
23081 package='$package'
23082 pager='$pager'
23083 passcat='$passcat'
23084 patchlevel='$patchlevel'
23085 path_sep='$path_sep'
23086 perl5='$perl5'
23087 perl='$perl'
23088 perl_patchlevel='$perl_patchlevel'
23089 perladmin='$perladmin'
23090 perllibs='$perllibs'
23091 perlpath='$perlpath'
23092 pg='$pg'
23093 phostname='$phostname'
23094 pidtype='$pidtype'
23095 plibpth='$plibpth'
23096 pmake='$pmake'
23097 pr='$pr'
23098 prefix='$prefix'
23099 prefixexp='$prefixexp'
23100 privlib='$privlib'
23101 privlibexp='$privlibexp'
23102 procselfexe='$procselfexe'
23103 prototype='$prototype'
23104 ptrsize='$ptrsize'
23105 quadkind='$quadkind'
23106 quadtype='$quadtype'
23107 randbits='$randbits'
23108 randfunc='$randfunc'
23109 random_r_proto='$random_r_proto'
23110 randseedtype='$randseedtype'
23111 ranlib='$ranlib'
23112 rd_nodata='$rd_nodata'
23113 readdir64_r_proto='$readdir64_r_proto'
23114 readdir_r_proto='$readdir_r_proto'
23115 revision='$revision'
23116 rm='$rm'
23117 rm_try='$rm_try'
23118 rmail='$rmail'
23119 run='$run'
23120 runnm='$runnm'
23121 sGMTIME_max='$sGMTIME_max'
23122 sGMTIME_min='$sGMTIME_min'
23123 sLOCALTIME_max='$sLOCALTIME_max'
23124 sLOCALTIME_min='$sLOCALTIME_min'
23125 sPRIEUldbl='$sPRIEUldbl'
23126 sPRIFUldbl='$sPRIFUldbl'
23127 sPRIGUldbl='$sPRIGUldbl'
23128 sPRIXU64='$sPRIXU64'
23129 sPRId64='$sPRId64'
23130 sPRIeldbl='$sPRIeldbl'
23131 sPRIfldbl='$sPRIfldbl'
23132 sPRIgldbl='$sPRIgldbl'
23133 sPRIi64='$sPRIi64'
23134 sPRIo64='$sPRIo64'
23135 sPRIu64='$sPRIu64'
23136 sPRIx64='$sPRIx64'
23137 sSCNfldbl='$sSCNfldbl'
23138 sched_yield='$sched_yield'
23139 scriptdir='$scriptdir'
23140 scriptdirexp='$scriptdirexp'
23141 sed='$sed'
23142 seedfunc='$seedfunc'
23143 selectminbits='$selectminbits'
23144 selecttype='$selecttype'
23145 sendmail='$sendmail'
23146 setgrent_r_proto='$setgrent_r_proto'
23147 sethostent_r_proto='$sethostent_r_proto'
23148 setlocale_r_proto='$setlocale_r_proto'
23149 setnetent_r_proto='$setnetent_r_proto'
23150 setprotoent_r_proto='$setprotoent_r_proto'
23151 setpwent_r_proto='$setpwent_r_proto'
23152 setservent_r_proto='$setservent_r_proto'
23153 sh='$sh'
23154 shar='$shar'
23155 sharpbang='$sharpbang'
23156 shmattype='$shmattype'
23157 shortsize='$shortsize'
23158 shrpenv='$shrpenv'
23159 shsharp='$shsharp'
23160 sig_count='$sig_count'
23161 sig_name='$sig_name'
23162 sig_name_init='$sig_name_init'
23163 sig_num='$sig_num'
23164 sig_num_init='$sig_num_init'
23165 sig_size='$sig_size'
23166 signal_t='$signal_t'
23167 sitearch='$sitearch'
23168 sitearchexp='$sitearchexp'
23169 sitebin='$sitebin'
23170 sitebinexp='$sitebinexp'
23171 sitehtml1dir='$sitehtml1dir'
23172 sitehtml1direxp='$sitehtml1direxp'
23173 sitehtml3dir='$sitehtml3dir'
23174 sitehtml3direxp='$sitehtml3direxp'
23175 sitelib='$sitelib'
23176 sitelib_stem='$sitelib_stem'
23177 sitelibexp='$sitelibexp'
23178 siteman1dir='$siteman1dir'
23179 siteman1direxp='$siteman1direxp'
23180 siteman3dir='$siteman3dir'
23181 siteman3direxp='$siteman3direxp'
23182 siteprefix='$siteprefix'
23183 siteprefixexp='$siteprefixexp'
23184 sitescript='$sitescript'
23185 sitescriptexp='$sitescriptexp'
23186 sizesize='$sizesize'
23187 sizetype='$sizetype'
23188 sleep='$sleep'
23189 smail='$smail'
23190 so='$so'
23191 sockethdr='$sockethdr'
23192 socketlib='$socketlib'
23193 socksizetype='$socksizetype'
23194 sort='$sort'
23195 spackage='$spackage'
23196 spitshell='$spitshell'
23197 srand48_r_proto='$srand48_r_proto'
23198 srandom_r_proto='$srandom_r_proto'
23199 src='$src'
23200 ssizetype='$ssizetype'
23201 startperl='$startperl'
23202 startsh='$startsh'
23203 static_ext='$static_ext'
23204 stdchar='$stdchar'
23205 stdio_base='$stdio_base'
23206 stdio_bufsiz='$stdio_bufsiz'
23207 stdio_cnt='$stdio_cnt'
23208 stdio_filbuf='$stdio_filbuf'
23209 stdio_ptr='$stdio_ptr'
23210 stdio_stream_array='$stdio_stream_array'
23211 strerror_r_proto='$strerror_r_proto'
23212 strings='$strings'
23213 submit='$submit'
23214 subversion='$subversion'
23215 sysman='$sysman'
23216 tail='$tail'
23217 tar='$tar'
23218 targetarch='$targetarch'
23219 tbl='$tbl'
23220 tee='$tee'
23221 test='$test'
23222 timeincl='$timeincl'
23223 timetype='$timetype'
23224 tmpnam_r_proto='$tmpnam_r_proto'
23225 to='$to'
23226 touch='$touch'
23227 tr='$tr'
23228 trnl='$trnl'
23229 troff='$troff'
23230 ttyname_r_proto='$ttyname_r_proto'
23231 u16size='$u16size'
23232 u16type='$u16type'
23233 u32size='$u32size'
23234 u32type='$u32type'
23235 u64size='$u64size'
23236 u64type='$u64type'
23237 u8size='$u8size'
23238 u8type='$u8type'
23239 uidformat='$uidformat'
23240 uidsign='$uidsign'
23241 uidsize='$uidsize'
23242 uidtype='$uidtype'
23243 uname='$uname'
23244 uniq='$uniq'
23245 uquadtype='$uquadtype'
23246 use5005threads='$use5005threads'
23247 use64bitall='$use64bitall'
23248 use64bitint='$use64bitint'
23249 usecrosscompile='$usecrosscompile'
23250 usedevel='$usedevel'
23251 usedl='$usedl'
23252 usedtrace='$usedtrace'
23253 usefaststdio='$usefaststdio'
23254 useithreads='$useithreads'
23255 uselargefiles='$uselargefiles'
23256 uselongdouble='$uselongdouble'
23257 usemallocwrap='$usemallocwrap'
23258 usemorebits='$usemorebits'
23259 usemultiplicity='$usemultiplicity'
23260 usemymalloc='$usemymalloc'
23261 usenm='$usenm'
23262 useopcode='$useopcode'
23263 useperlio='$useperlio'
23264 useposix='$useposix'
23265 usereentrant='$usereentrant'
23266 userelocatableinc='$userelocatableinc'
23267 usesfio='$usesfio'
23268 useshrplib='$useshrplib'
23269 usesitecustomize='$usesitecustomize'
23270 usesocks='$usesocks'
23271 usethreads='$usethreads'
23272 usevendorprefix='$usevendorprefix'
23273 usevfork='$usevfork'
23274 usrinc='$usrinc'
23275 uuname='$uuname'
23276 uvXUformat='$uvXUformat'
23277 uvoformat='$uvoformat'
23278 uvsize='$uvsize'
23279 uvtype='$uvtype'
23280 uvuformat='$uvuformat'
23281 uvxformat='$uvxformat'
23282 vendorarch='$vendorarch'
23283 vendorarchexp='$vendorarchexp'
23284 vendorbin='$vendorbin'
23285 vendorbinexp='$vendorbinexp'
23286 vendorhtml1dir='$vendorhtml1dir'
23287 vendorhtml1direxp='$vendorhtml1direxp'
23288 vendorhtml3dir='$vendorhtml3dir'
23289 vendorhtml3direxp='$vendorhtml3direxp'
23290 vendorlib='$vendorlib'
23291 vendorlib_stem='$vendorlib_stem'
23292 vendorlibexp='$vendorlibexp'
23293 vendorman1dir='$vendorman1dir'
23294 vendorman1direxp='$vendorman1direxp'
23295 vendorman3dir='$vendorman3dir'
23296 vendorman3direxp='$vendorman3direxp'
23297 vendorprefix='$vendorprefix'
23298 vendorprefixexp='$vendorprefixexp'
23299 vendorscript='$vendorscript'
23300 vendorscriptexp='$vendorscriptexp'
23301 version='$version'
23302 version_patchlevel_string='$version_patchlevel_string'
23303 versiononly='$versiononly'
23304 vi='$vi'
23305 voidflags='$voidflags'
23306 xlibpth='$xlibpth'
23307 yacc='$yacc'
23308 yaccflags='$yaccflags'
23309 zcat='$zcat'
23310 zip='$zip'
23311 EOT
23312
23313 : add special variables
23314 $test -f $src/patchlevel.h && \
23315 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23316 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23317 echo "PERL_CONFIG_SH=true" >>config.sh
23318
23319 : propagate old symbols
23320 if $test -f UU/config.sh; then
23321         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23322         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23323                 config.sh config.sh UU/oldconfig.sh |\
23324                 $sort | $uniq -u >UU/oldsyms
23325         set X `cat UU/oldsyms`
23326         shift
23327         case $# in
23328         0) ;;
23329         *)
23330                 cat <<EOM
23331 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23332 EOM
23333                 echo ": Variables propagated from previous config.sh file." >>config.sh
23334                 for sym in `cat UU/oldsyms`; do
23335                         echo "    Propagating $hint variable "'$'"$sym..."
23336                         eval 'tmp="$'"${sym}"'"'
23337                         echo "$tmp" | \
23338                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23339                 done
23340                 ;;
23341         esac
23342 fi
23343
23344 : Finish up by extracting the .SH files
23345 case "$alldone" in
23346 exit)
23347         $rm -rf UU
23348         echo "Extraction done."
23349         exit 0
23350         ;;
23351 cont)
23352         ;;
23353 '')
23354         dflt=''
23355         nostick=true
23356         $cat <<EOM
23357
23358 If you'd like to make any changes to the config.sh file before I begin
23359 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23360
23361 EOM
23362         rp="Press return or use a shell escape to edit config.sh:"
23363         . UU/myread
23364         nostick=''
23365         case "$ans" in
23366         '') ;;
23367         *) : in case they cannot read
23368                 sh 1>&4 -c "$ans";;
23369         esac
23370         ;;
23371 esac
23372
23373 : if this fails, just run all the .SH files by hand
23374 . ./config.sh
23375
23376 echo " "
23377 exec 1>&4
23378 pwd=`pwd`
23379 . ./UU/extract
23380 cd "$pwd"
23381
23382 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23383         dflt=y
23384         case "$silent" in
23385         true) ;;
23386         *)
23387                 $cat <<EOM
23388
23389 Now you need to generate make dependencies by running "$make depend".
23390 You might prefer to run it in background: "$make depend > makedepend.out &"
23391 It can take a while, so you might not want to run it right now.
23392
23393 EOM
23394                 ;;
23395         esac
23396         rp="Run $make depend now?"
23397         . UU/myread
23398         case "$ans" in
23399         y*)
23400                 $make depend && echo "Now you must run '$make'."
23401                 ;;
23402         *)
23403                 echo "You must run '$make depend' then '$make'."
23404                 ;;
23405         esac
23406 elif test -f [Mm]akefile; then
23407         echo " "
23408         echo "Now you must run a $make."
23409 else
23410         echo "Configure done."
23411 fi
23412
23413 if $test -f Policy.sh; then
23414     $cat <<EOM
23415
23416 If you compile $package on a different machine or from a different object
23417 directory, copy the Policy.sh file from this object directory to the
23418 new one before you run Configure -- this will help you with most of
23419 the policy defaults.
23420
23421 EOM
23422 fi
23423 if $test -f config.msg; then
23424     echo "Hmm.  I also noted the following information while running:"
23425     echo " "
23426     $cat config.msg >&4
23427     $rm -f config.msg
23428 fi
23429 $rm -f kit*isdone ark*isdone
23430 $rm -rf UU
23431
23432 : End of Configure
23433