This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Thread.xs doesn't need magic sig anymore
[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-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Apr 25 10:10:54 CEST 2007 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 if test ! -c /dev/null ; then
69         cat >&4 <<EOF
70 ***
71 *** I'm sorry, but /dev/null appears to be a file rather than a device.
72 *** Please consult your operating sytem's notes for making a device
73 *** in /dev.
74 *** Cannot continue, aborting.
75 ***
76 EOF
77         exit 1
78 fi
79
80 : compute my invocation name
81 me=$0
82 case "$0" in
83 */*)
84         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85         test "$me" || me=$0
86         ;;
87 esac
88
89 : Proper separator for the PATH environment variable
90 p_=:
91 : On OS/2 this directory should exist if this is not floppy only system :-]
92 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
93     if test -n "$OS2_SHELL"; then
94                 p_=\;
95                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
97                 is_os2=yes
98         elif test -n "$DJGPP"; then
99                 case "X${MACHTYPE:-nonesuchmach}" in
100                 *cygwin) ;;
101                 *) p_=\; ;;
102                 esac
103         fi
104 fi
105
106 : Proper PATH setting
107 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
108 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
109 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
110 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
111 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
112 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
113 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114 paths="$paths /sbin /usr/sbin /usr/libexec"
115 paths="$paths /system/gnu_library/bin"
116
117 for p in $paths
118 do
119         case "$p_$PATH$p_" in
120         *$p_$p$p_*) ;;
121         *) test -d $p && PATH=$PATH$p_$p ;;
122         esac
123 done
124
125 PATH=.$p_$PATH
126 export PATH
127
128 : shall we be using ksh?
129 inksh=''
130 needksh=''
131 avoidksh=''
132 newsh=/bin/ksh
133 changesh=''
134 if (PATH=.; alias -x) >/dev/null 2>&1; then
135                 inksh=true
136 fi
137 if test -f /hp-ux -a -f /bin/ksh; then
138         needksh='to avoid sh bug in "here document" expansion'
139 fi
140 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141         if test X`/usr/bin/uname -v` = X4; then
142                 avoidksh="to avoid AIX 4's /bin/sh"
143                 newsh=/usr/bin/bsh
144         fi
145 fi
146 if test -f /osf_boot -a -f /usr/sbin/setld; then
147         if test X`/usr/bin/uname -s` = XOSF1; then
148                 avoidksh="to avoid Digital UNIX' ksh"
149                 newsh=/bin/sh
150                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151         fi
152 fi
153 case "$inksh/$needksh" in
154 /[a-z]*)
155                 ENV=''
156                 changesh=true
157                 reason="$needksh"
158         ;;
159 esac
160 case "$inksh/$avoidksh" in
161 true/[a-z]*)
162         changesh=true
163         reason="$avoidksh"
164         ;;
165 esac
166 case "$inksh/$needksh-$avoidksh-" in
167 true/--)
168                 cat <<EOM
169 (I see you are using the Korn shell.  Some ksh's blow up on $me,
170 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
171 EOM
172         ;;
173 esac
174 case "$changesh" in
175 true)
176         export newsh
177         echo "(Feeding myself to $newsh $reason.)"
178         case "$0" in
179         Configure|*/Configure) exec $newsh $0 "$@";;
180         *) exec $newsh Configure "$@";;
181         esac
182         ;;
183 esac
184
185 : if needed set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *)              CDPATH='' ;;
192         esac
193         ;;
194 esac
195 : Configure runs within the UU subdirectory
196 test -d UU || mkdir UU
197 cd UU && rm -f ./*
198
199 ccname=''
200 ccversion=''
201 ccsymbols=''
202 cppccsymbols=''
203 cppsymbols=''
204 from=''
205 run=''
206 targetarch=''
207 to=''
208 usecrosscompile=''
209 mistrustnm=''
210 perllibs=''
211 dynamic_ext=''
212 extensions=''
213 known_extensions=''
214 nonxs_ext=''
215 static_ext=''
216 useopcode=''
217 useposix=''
218 extras=''
219 d_bsd=''
220 d_eunice=''
221 d_xenix=''
222 eunicefix=''
223 Mcc=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 charsize=''
350 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_math=''
873 i_memory=''
874 i_mntent=''
875 i_ndbm=''
876 i_netdb=''
877 i_neterrno=''
878 i_netinettcp=''
879 i_niin=''
880 i_sysin=''
881 i_poll=''
882 i_prot=''
883 i_pthread=''
884 d_pwage=''
885 d_pwchange=''
886 d_pwclass=''
887 d_pwcomment=''
888 d_pwexpire=''
889 d_pwgecos=''
890 d_pwpasswd=''
891 d_pwquota=''
892 i_pwd=''
893 i_sfio=''
894 i_shadow=''
895 i_socks=''
896 i_stddef=''
897 i_stdlib=''
898 i_string=''
899 strings=''
900 i_sunmath=''
901 i_sysaccess=''
902 i_sysdir=''
903 i_sysfile=''
904 d_voidtty=''
905 i_bsdioctl=''
906 i_sysfilio=''
907 i_sysioctl=''
908 i_syssockio=''
909 i_syslog=''
910 i_sysmman=''
911 i_sysmode=''
912 i_sysmount=''
913 i_sysndir=''
914 i_sysparam=''
915 i_sysresrc=''
916 i_syssecrt=''
917 i_sysselct=''
918 i_sysstat=''
919 i_sysstatfs=''
920 i_sysstatvfs=''
921 i_systimes=''
922 i_systypes=''
923 i_sysuio=''
924 i_sysun=''
925 i_sysutsname=''
926 i_sysvfs=''
927 i_syswait=''
928 i_sgtty=''
929 i_termio=''
930 i_termios=''
931 d_tm_tm_gmtoff=''
932 d_tm_tm_zone=''
933 i_systime=''
934 i_systimek=''
935 i_time=''
936 timeincl=''
937 i_unistd=''
938 i_ustat=''
939 i_utime=''
940 i_values=''
941 i_stdarg=''
942 i_varargs=''
943 i_varhdr=''
944 i_vfork=''
945 d_inc_version_list=''
946 inc_version_list=''
947 inc_version_list_init=''
948 installprefix=''
949 installprefixexp=''
950 installstyle=''
951 installusrbinperl=''
952 intsize=''
953 longsize=''
954 shortsize=''
955 issymlink=''
956 libc=''
957 ldlibpthname=''
958 libperl=''
959 shrpenv=''
960 useshrplib=''
961 glibpth=''
962 libpth=''
963 loclibpth=''
964 plibpth=''
965 xlibpth=''
966 ignore_versioned_solibs=''
967 libs=''
968 libsdirs=''
969 libsfiles=''
970 libsfound=''
971 libspath=''
972 lns=''
973 d_PRIEUldbl=''
974 d_PRIFUldbl=''
975 d_PRIGUldbl=''
976 d_PRIeldbl=''
977 d_PRIfldbl=''
978 d_PRIgldbl=''
979 d_SCNfldbl=''
980 sPRIEUldbl=''
981 sPRIFUldbl=''
982 sPRIGUldbl=''
983 sPRIeldbl=''
984 sPRIfldbl=''
985 sPRIgldbl=''
986 sSCNfldbl=''
987 lseeksize=''
988 lseektype=''
989 mad=''
990 madlyh=''
991 madlyobj=''
992 madlysrc=''
993 make_set_make=''
994 d_mymalloc=''
995 freetype=''
996 mallocobj=''
997 mallocsrc=''
998 malloctype=''
999 usemallocwrap=''
1000 usemymalloc=''
1001 installman1dir=''
1002 man1dir=''
1003 man1direxp=''
1004 man1ext=''
1005 installman3dir=''
1006 man3dir=''
1007 man3direxp=''
1008 man3ext=''
1009 modetype=''
1010 multiarch=''
1011 mydomain=''
1012 myhostname=''
1013 phostname=''
1014 c=''
1015 n=''
1016 d_eofnblk=''
1017 eagain=''
1018 o_nonblock=''
1019 rd_nodata=''
1020 need_va_copy=''
1021 netdb_hlen_type=''
1022 netdb_host_type=''
1023 netdb_name_type=''
1024 netdb_net_type=''
1025 groupcat=''
1026 hostcat=''
1027 passcat=''
1028 orderlib=''
1029 ranlib=''
1030 d_perl_otherlibdirs=''
1031 otherlibdirs=''
1032 package=''
1033 spackage=''
1034 pager=''
1035 api_revision=''
1036 api_subversion=''
1037 api_version=''
1038 api_versionstring=''
1039 patchlevel=''
1040 perl_patchlevel=''
1041 revision=''
1042 subversion=''
1043 version=''
1044 version_patchlevel_string=''
1045 perl5=''
1046 perladmin=''
1047 perlpath=''
1048 d_nv_preserves_uv=''
1049 d_nv_zero_is_allbits_zero=''
1050 i16size=''
1051 i16type=''
1052 i32size=''
1053 i32type=''
1054 i64size=''
1055 i64type=''
1056 i8size=''
1057 i8type=''
1058 ivsize=''
1059 ivtype=''
1060 nv_preserves_uv_bits=''
1061 nvsize=''
1062 nvtype=''
1063 u16size=''
1064 u16type=''
1065 u32size=''
1066 u32type=''
1067 u64size=''
1068 u64type=''
1069 u8size=''
1070 u8type=''
1071 uvsize=''
1072 uvtype=''
1073 ivdformat=''
1074 nvEUformat=''
1075 nvFUformat=''
1076 nvGUformat=''
1077 nveformat=''
1078 nvfformat=''
1079 nvgformat=''
1080 uvXUformat=''
1081 uvoformat=''
1082 uvuformat=''
1083 uvxformat=''
1084 pidtype=''
1085 prefix=''
1086 prefixexp=''
1087 installprivlib=''
1088 privlib=''
1089 privlibexp=''
1090 prototype=''
1091 ptrsize=''
1092 d_PRIXU64=''
1093 d_PRId64=''
1094 d_PRIi64=''
1095 d_PRIo64=''
1096 d_PRIu64=''
1097 d_PRIx64=''
1098 sPRIXU64=''
1099 sPRId64=''
1100 sPRIi64=''
1101 sPRIo64=''
1102 sPRIu64=''
1103 sPRIx64=''
1104 d_quad=''
1105 quadkind=''
1106 quadtype=''
1107 uquadtype=''
1108 drand01=''
1109 randbits=''
1110 randfunc=''
1111 randseedtype=''
1112 seedfunc=''
1113 installscript=''
1114 scriptdir=''
1115 scriptdirexp=''
1116 selectminbits=''
1117 selecttype=''
1118 sh=''
1119 sig_count=''
1120 sig_name=''
1121 sig_name_init=''
1122 sig_num=''
1123 sig_num_init=''
1124 sig_size=''
1125 d_sitearch=''
1126 installsitearch=''
1127 sitearch=''
1128 sitearchexp=''
1129 installsitebin=''
1130 sitebin=''
1131 sitebinexp=''
1132 installsitehtml1dir=''
1133 sitehtml1dir=''
1134 sitehtml1direxp=''
1135 installsitehtml3dir=''
1136 sitehtml3dir=''
1137 sitehtml3direxp=''
1138 installsitelib=''
1139 sitelib=''
1140 sitelib_stem=''
1141 sitelibexp=''
1142 installsiteman1dir=''
1143 siteman1dir=''
1144 siteman1direxp=''
1145 installsiteman3dir=''
1146 siteman3dir=''
1147 siteman3direxp=''
1148 siteprefix=''
1149 siteprefixexp=''
1150 installsitescript=''
1151 sitescript=''
1152 sitescriptexp=''
1153 sizesize=''
1154 sizetype=''
1155 so=''
1156 socksizetype=''
1157 sharpbang=''
1158 shsharp=''
1159 spitshell=''
1160 src=''
1161 ssizetype=''
1162 startperl=''
1163 startsh=''
1164 stdchar=''
1165 d_stdio_stream_array=''
1166 stdio_stream_array=''
1167 sysman=''
1168 trnl=''
1169 uidformat=''
1170 uidsign=''
1171 uidsize=''
1172 uidtype=''
1173 archname64=''
1174 use64bitall=''
1175 use64bitint=''
1176 usefaststdio=''
1177 ccflags_uselargefiles=''
1178 ldflags_uselargefiles=''
1179 libswanted_uselargefiles=''
1180 uselargefiles=''
1181 uselongdouble=''
1182 usemorebits=''
1183 usemultiplicity=''
1184 nm_opt=''
1185 nm_so_opt=''
1186 runnm=''
1187 usenm=''
1188 useperlio=''
1189 usesocks=''
1190 d_oldpthreads=''
1191 use5005threads=''
1192 useithreads=''
1193 usereentrant=''
1194 usethreads=''
1195 incpath=''
1196 mips_type=''
1197 usrinc=''
1198 d_vendorarch=''
1199 installvendorarch=''
1200 vendorarch=''
1201 vendorarchexp=''
1202 d_vendorbin=''
1203 installvendorbin=''
1204 vendorbin=''
1205 vendorbinexp=''
1206 installvendorhtml1dir=''
1207 vendorhtml1dir=''
1208 vendorhtml1direxp=''
1209 installvendorhtml3dir=''
1210 vendorhtml3dir=''
1211 vendorhtml3direxp=''
1212 d_vendorlib=''
1213 installvendorlib=''
1214 vendorlib=''
1215 vendorlib_stem=''
1216 vendorlibexp=''
1217 installvendorman1dir=''
1218 vendorman1dir=''
1219 vendorman1direxp=''
1220 installvendorman3dir=''
1221 vendorman3dir=''
1222 vendorman3direxp=''
1223 usevendorprefix=''
1224 vendorprefix=''
1225 vendorprefixexp=''
1226 d_vendorscript=''
1227 installvendorscript=''
1228 vendorscript=''
1229 vendorscriptexp=''
1230 versiononly=''
1231 defvoidused=''
1232 voidflags=''
1233 yacc=''
1234 yaccflags=''
1235 CONFIG=''
1236
1237 define='define'
1238 undef='undef'
1239 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1240 rmlist=''
1241
1242 : We must find out about Eunice early
1243 eunicefix=':'
1244 if test -f /etc/unixtovms; then
1245         eunicefix=/etc/unixtovms
1246 fi
1247 if test -f /etc/unixtovms.exe; then
1248         eunicefix=/etc/unixtovms.exe
1249 fi
1250
1251 : Set executable suffix now -- needed before hints available
1252 if test -f "/libs/version.library"; then
1253 : Amiga OS
1254     _exe=""
1255 elif test -f "/system/gnu_library/bin/ar.pm"; then
1256 : Stratus VOS
1257     _exe=".pm"
1258 elif test -n "$DJGPP"; then
1259 : DOS DJGPP
1260     _exe=".exe"
1261 elif test -d c:/. -o -n "$is_os2" ; then
1262 : OS/2 or cygwin
1263     _exe=".exe"
1264 fi
1265
1266 i_whoami=''
1267 : Trailing extension.  Override this in a hint file, if needed.
1268 : Extra object files, if any, needed on this platform.
1269 archobjs=''
1270 archname=''
1271 groupstype=''
1272 libnames=''
1273 : change the next line if compiling for Xenix/286 on Xenix/386
1274 xlibpth='/usr/lib/386 /lib/386'
1275 : Possible local library directories to search.
1276 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279 : general looking path for locating libraries
1280 glibpth="/lib /usr/lib $xlibpth"
1281 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1282 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1284 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1285
1286 : Private path used by Configure to find libraries.  Its value
1287 : is prepended to libpth. This variable takes care of special
1288 : machines, like the mips.  Usually, it should be empty.
1289 plibpth=''
1290
1291 : default library list
1292 libswanted=''
1293 : some systems want to use only the non-versioned libso:s
1294 ignore_versioned_solibs=''
1295 siteman1dir=''
1296 siteman3dir=''
1297 sitescript=''
1298 : set usethreads on the Configure command line to enable threads.
1299 usereentrant='undef'
1300 : full support for void wanted by default
1301 defvoidused=15
1302
1303 : Possible local include directories to search.
1304 : Set locincpth to "" in a hint file to defeat local include searches.
1305 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1306 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1307 :
1308 : no include file wanted by default
1309 inclwanted=''
1310
1311 : Enable -DEBUGGING and -DDEBUGGING from the command line
1312 EBUGGING=''
1313 DEBUGGING=old
1314
1315 ccname=''
1316 ccversion=''
1317 perllibs=''
1318 : set useposix=false in your hint file to disable the POSIX extension.
1319 useposix=true
1320 : set useopcode=false in your hint file to disable the Opcode extension.
1321 useopcode=true
1322 archname64=''
1323 ccflags_uselargefiles=''
1324 ldflags_uselargefiles=''
1325 libswanted_uselargefiles=''
1326 : set usemultiplicity on the Configure command line to enable multiplicity.
1327 : set usesocks on the Configure command line to enable socks.
1328 : List of libraries we want.
1329 : If anyone needs extra -lxxx, put those in a hint file.
1330 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1331 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1332 : We probably want to search /usr/shlib before most other libraries.
1333 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1334 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1335 glibpth="/usr/shlib $glibpth"
1336 : Do not use vfork unless overridden by a hint file.
1337 usevfork=false
1338
1339 : Find the basic shell for Bourne shell scripts
1340 case "$sh" in
1341 '')
1342         case "$SYSTYPE" in
1343         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1344         *) xxx='/bin/sh';;
1345         esac
1346         if test -f "$xxx"; then
1347                 sh="$xxx"
1348         else
1349                 : Build up a list and do a single loop so we can 'break' out.
1350                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1351                 for xxx in sh bash ksh pdksh ash; do
1352                         for p in $pth; do
1353                                 try="$try ${p}/${xxx}"
1354                         done
1355                 done
1356                 for xxx in $try; do
1357                         if test -f "$xxx"; then
1358                                 sh="$xxx";
1359                                 break
1360                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test -f "$xxx.exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         fi
1367                 done
1368         fi
1369         ;;
1370 esac
1371
1372 case "$sh" in
1373 '')     cat >&2 <<EOM
1374 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1375
1376 Usually it's in /bin/sh.  How did you even get this far?
1377 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1378 we'll try to straighten this all out.
1379 EOM
1380         exit 1
1381         ;;
1382 esac
1383
1384 : see if sh knows # comments
1385 if `$sh -c '#' >/dev/null 2>&1`; then
1386         shsharp=true
1387         spitshell=cat
1388         xcat=/bin/cat
1389         test -f $xcat$_exe || xcat=/usr/bin/cat
1390         if test ! -f $xcat$_exe; then
1391                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1392                         if test -f $p/cat$_exe; then
1393                                 xcat=$p/cat
1394                                 break
1395                         fi
1396                 done
1397                 if test ! -f $xcat$_exe; then
1398                         echo "Can't find cat anywhere!"
1399                         exit 1
1400                 fi
1401         fi
1402         echo "#!$xcat" >sharp
1403         $eunicefix sharp
1404         chmod +x sharp
1405         ./sharp > today
1406         if test -s today; then
1407                 sharpbang='#!'
1408         else
1409                 echo "#! $xcat" > sharp
1410                 $eunicefix sharp
1411                 chmod +x sharp
1412                 ./sharp > today
1413                 if test -s today; then
1414                         sharpbang='#! '
1415                 else
1416                         sharpbang=': use '
1417                 fi
1418         fi
1419 else
1420         echo " "
1421         echo "Your $sh doesn't grok # comments--I will strip them later on."
1422         shsharp=false
1423         cd ..
1424         echo "exec grep -v '^[  ]*#'" >spitshell
1425         chmod +x spitshell
1426         $eunicefix spitshell
1427         spitshell=`pwd`/spitshell
1428         cd UU
1429         echo "I presume that if # doesn't work, #! won't work either!"
1430         sharpbang=': use '
1431 fi
1432 rm -f sharp today
1433
1434 : figure out how to guarantee sh startup
1435 case "$startsh" in
1436 '') startsh=${sharpbang}${sh} ;;
1437 *)
1438 esac
1439 cat >sharp <<EOSS
1440 $startsh
1441 set abc
1442 test "$?abc" != 1
1443 EOSS
1444
1445 chmod +x sharp
1446 $eunicefix sharp
1447 if ./sharp; then
1448         : echo "Yup, it does."
1449 else
1450         echo "Hmm... '$startsh' does not guarantee sh startup..."
1451         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1452 fi
1453 rm -f sharp
1454
1455
1456 : Save command line options in file UU/cmdline.opt for later use in
1457 : generating config.sh.
1458 cat > cmdline.opt <<EOSH
1459 # Configure command line arguments.
1460 config_arg0='$0'
1461 config_args='$*'
1462 config_argc=$#
1463 EOSH
1464 argn=1
1465 args_exp=''
1466 args_sep=''
1467 for arg in "$@"; do
1468         cat >>cmdline.opt <<EOSH
1469 config_arg$argn='$arg'
1470 EOSH
1471         # Extreme backslashitis: replace each ' by '"'"'
1472         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473 $arg
1474 EOC
1475         arg_exp=`cat cmdl.opt`
1476         args_exp="$args_exp$args_sep'$arg_exp'"
1477         argn=`expr $argn + 1`
1478         args_sep=' '
1479 done
1480 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1481 # used by ./hints/os2.sh
1482 rm -f cmdl.opt
1483
1484 : produce awk script to parse command line options
1485 cat >options.awk <<'EOF'
1486 BEGIN {
1487         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1488
1489         len = length(optstr);
1490         for (i = 1; i <= len; i++) {
1491                 c = substr(optstr, i, 1);
1492                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493                 if (a == ":") {
1494                         arg[c] = 1;
1495                         i++;
1496                 }
1497                 opt[c] = 1;
1498         }
1499 }
1500 {
1501         expect = 0;
1502         str = $0;
1503         if (substr(str, 1, 1) != "-") {
1504                 printf("'%s'\n", str);
1505                 next;
1506         }
1507         len = length($0);
1508         for (i = 2; i <= len; i++) {
1509                 c = substr(str, i, 1);
1510                 if (!opt[c]) {
1511                         printf("-%s\n", substr(str, i));
1512                         next;
1513                 }
1514                 printf("-%s\n", c);
1515                 if (arg[c]) {
1516                         if (i < len)
1517                                 printf("'%s'\n", substr(str, i + 1));
1518                         else
1519                                 expect = 1;
1520                         next;
1521                 }
1522         }
1523 }
1524 END {
1525         if (expect)
1526                 print "?";
1527 }
1528 EOF
1529
1530 : process the command line options
1531 set X `for arg in "$@"; do echo "X$arg"; done |
1532         sed -e s/X// | awk -f options.awk`
1533 eval "set $*"
1534 shift
1535 rm -f options.awk
1536
1537 : set up default values
1538 fastread=''
1539 reuseval=false
1540 config_sh=''
1541 alldone=''
1542 error=''
1543 silent=''
1544 extractsh=''
1545 override=''
1546 knowitall=''
1547 rm -f optdef.sh posthint.sh
1548 cat >optdef.sh <<EOS
1549 $startsh
1550 EOS
1551
1552
1553 : option parsing
1554 while test $# -gt 0; do
1555         case "$1" in
1556         -d) shift; fastread=yes;;
1557         -e) shift; alldone=cont;;
1558         -f)
1559                 shift
1560                 cd ..
1561                 if test -r "$1"; then
1562                         config_sh="$1"
1563                 else
1564                         echo "$me: cannot read config file $1." >&2
1565                         error=true
1566                 fi
1567                 cd UU
1568                 shift;;
1569         -h) shift; error=true;;
1570         -r) shift; reuseval=true;;
1571         -s) shift; silent=true; realsilent=true;;
1572         -E) shift; alldone=exit;;
1573         -K) shift; knowitall=true;;
1574         -O) shift; override=true;;
1575         -S) shift; silent=true; extractsh=true;;
1576         -D)
1577                 shift
1578                 case "$1" in
1579                 *=)
1580                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1581                         echo "$me: ignoring -D $1" >&2
1582                         ;;
1583                 *=*) echo "$1" | \
1584                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1585                 *) echo "$1='define'" >> optdef.sh;;
1586                 esac
1587                 shift
1588                 ;;
1589         -U)
1590                 shift
1591                 case "$1" in
1592                 *=) echo "$1" >> optdef.sh;;
1593                 *=*)
1594                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1595                         echo "$me: ignoring -U $1" >&2
1596                         ;;
1597                 *) echo "$1='undef'" >> optdef.sh;;
1598                 esac
1599                 shift
1600                 ;;
1601         -A)
1602             shift
1603             xxx=''
1604             yyy="$1"
1605             zzz=''
1606             uuu=undef
1607             case "$yyy" in
1608             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1609                  case "$zzz" in
1610                  *:*) zzz='' ;;
1611                  *)   xxx=append
1612                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1613                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1614                  esac
1615                  ;;
1616             esac
1617             case "$xxx" in
1618             '')  case "$yyy" in
1619                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1620                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1621                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1622                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1623                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1624                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1625                  esac
1626                  ;;       
1627             esac
1628             case "$xxx" in
1629             append)
1630                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1631             clear)
1632                 echo "$yyy=''"                  >> posthint.sh ;;
1633             define)
1634                 case "$zzz" in
1635                 '') zzz=define ;;
1636                 esac
1637                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1638             eval)
1639                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1640             prepend)
1641                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1642             undef)
1643                 case "$zzz" in
1644                 '') zzz="$uuu" ;;
1645                 esac
1646                 echo "$yyy=$zzz"                >> posthint.sh ;;
1647             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1648             esac
1649             shift
1650             ;;
1651         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1652             exit 0;;
1653         --) break;;
1654         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1655         *) break;;
1656         esac
1657 done
1658
1659 case "$error" in
1660 true)
1661         cat >&2 <<EOM
1662 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1663                  [-U symbol] [-U symbol=] [-A command:symbol...]
1664   -d : use defaults for all answers.
1665   -e : go on without questioning past the production of config.sh.
1666   -f : specify an alternate default configuration file.
1667   -h : print this help message and exit (with an error status).
1668   -r : reuse C symbols value if possible (skips costly nm extraction).
1669   -s : silent mode, only echoes questions and essential information.
1670   -D : define symbol to have some value:
1671          -D symbol         symbol gets the value 'define'
1672          -D symbol=value   symbol gets the value 'value'
1673   -E : stop at the end of questions, after having produced config.sh.
1674   -K : do not use unless you know what you are doing.
1675   -O : let -D and -U override definitions from loaded configuration file.
1676   -S : perform variable substitutions on all .SH files (can mix with -f)
1677   -U : undefine symbol:
1678          -U symbol    symbol gets the value 'undef'
1679          -U symbol=   symbol gets completely empty
1680   -A : manipulate symbol after the platform specific hints have been applied:
1681          -A symbol=value                append " "value to symbol
1682          -A append:symbol=value         append value to symbol
1683          -A define:symbol=value         define symbol to have value
1684          -A clear:symbol                define symbol to be ''
1685          -A define:symbol               define symbol to be 'define'
1686          -A eval:symbol=value           define symbol to be eval of value
1687          -A prepend:symbol=value        prepend value to symbol
1688          -A undef:symbol                define symbol to be 'undef'
1689          -A undef:symbol=               define symbol to be ''
1690   -V : print version number and exit (with a zero status).
1691 EOM
1692         exit 1
1693         ;;
1694 esac
1695
1696 : Sanity checks
1697 case "$fastread$alldone" in
1698 yescont|yesexit) ;;
1699 *)
1700         case "$extractsh" in
1701         true) ;;
1702         *)
1703                 if test ! -t 0; then
1704                         echo "Say 'sh Configure', not 'sh <Configure'"
1705                         exit 1
1706                 fi
1707                 ;;
1708         esac
1709         ;;
1710 esac
1711
1712 exec 4>&1
1713 case "$silent" in
1714 true) exec 1>/dev/null;;
1715 esac
1716
1717 : run the defines and the undefines, if any, but leave the file out there...
1718 touch optdef.sh
1719 . ./optdef.sh
1720 : create the posthint manipulation script and leave the file out there...
1721 touch posthint.sh
1722
1723 : set package name
1724 package=perl5
1725 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1726 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1727 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1728 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1729 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1730 esac
1731
1732 : Some greps do not return status, grrr.
1733 echo "grimblepritz" >grimble
1734 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1735         contains=contains
1736 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1737         contains=grep
1738 else
1739         contains=contains
1740 fi
1741 rm -f grimble
1742 : the following should work in any shell
1743 case "$contains" in
1744 contains*)
1745         echo " "
1746         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1747         cat >contains <<'EOSS'
1748 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1749 EOSS
1750 chmod +x contains
1751 esac
1752
1753 : Find the path to the source tree
1754 case "$src" in
1755 '') case "$0" in
1756     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1757          case "$src" in
1758          /*)    ;;
1759          .)     ;;
1760          *)     src=`cd ../$src && pwd` ;;
1761          esac
1762          ;;
1763     *)   src='.';;
1764     esac;;
1765 esac
1766 case "$src" in
1767 '')     src=/
1768         rsrc=/
1769         ;;
1770 /*) rsrc="$src";;
1771 *) rsrc="../$src";;
1772 esac
1773 if test -f $rsrc/Configure && \
1774         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1775 then
1776    : found it, so we are ok.
1777 else
1778         rsrc=''
1779         for src in . .. ../.. ../../.. ../../../..; do
1780                 if test -f ../$src/Configure && \
1781                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1782                 then
1783                         rsrc=../$src
1784                         break
1785                 fi
1786         done
1787 fi
1788 case "$rsrc" in
1789 '')
1790         cat <<EOM >&4
1791
1792 Sorry, I can't seem to locate the source dir for $package.  Please start
1793 Configure with an explicit path -- i.e. /some/path/Configure.
1794
1795 EOM
1796         exit 1
1797         ;;
1798 ../.)   rsrc='..';;
1799 *)
1800         echo " "
1801         echo "Sources for $package found in \"$src\"." >&4
1802         ;;
1803 esac
1804
1805 : script used to extract .SH files with variable substitutions
1806 cat >extract <<'EOS'
1807 PERL_CONFIG_SH=true
1808 echo "Doing variable substitutions on .SH files..."
1809 if test -f MANIFEST; then
1810         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1811 else
1812         echo "(Looking for .SH files under the source directory.)"
1813         set x `(cd "$src"; find . -name "*.SH" -print)`
1814 fi
1815 shift
1816 case $# in
1817 0) set x `(cd "$src"; echo *.SH)`; shift;;
1818 esac
1819 if test ! -f "$src/$1"; then
1820         shift
1821 fi
1822 mkdir_p='
1823 name=$1;
1824 create="";
1825 while test $name; do
1826         if test ! -d "$name"; then
1827                 create="$name $create";
1828                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1829                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1830         else
1831                 name="";
1832         fi;
1833 done;
1834 for file in $create; do
1835         mkdir $file;
1836 done
1837 '
1838 for file in $*; do
1839         case "$src" in
1840         ".")
1841                 case "$file" in
1842                 */*)
1843                         dir=`expr X$file : 'X\(.*\)/'`
1844                         file=`expr X$file : 'X.*/\(.*\)'`
1845                         (cd "$dir" && . ./$file)
1846                         ;;
1847                 *)
1848                         . ./$file
1849                         ;;
1850                 esac
1851                 ;;
1852         *)
1853                 case "$file" in
1854                 */*)
1855                         dir=`expr X$file : 'X\(.*\)/'`
1856                         file=`expr X$file : 'X.*/\(.*\)'`
1857                         (set x $dir; shift; eval $mkdir_p)
1858                         sh <"$src/$dir/$file"
1859                         ;;
1860                 *)
1861                         sh <"$src/$file"
1862                         ;;
1863                 esac
1864                 ;;
1865         esac
1866 done
1867 if test -f "$src/config_h.SH"; then
1868         if test ! -f config.h; then
1869         : oops, they left it out of MANIFEST, probably, so do it anyway.
1870         . "$src/config_h.SH"
1871         fi
1872 fi
1873 EOS
1874
1875 : extract files and exit if asked to do so
1876 case "$extractsh" in
1877 true)
1878         case "$realsilent" in
1879         true) ;;
1880         *) exec 1>&4;;
1881         esac
1882         case "$config_sh" in
1883         '') config_sh='config.sh';;
1884         esac
1885         echo " "
1886         echo "Fetching answers from $config_sh..."
1887         cd ..
1888         . $config_sh
1889         test "$override" && . ./optdef.sh
1890         echo " "
1891         . UU/extract
1892         rm -rf UU
1893         echo "Extraction done."
1894         exit 0
1895         ;;
1896 esac
1897
1898 : Eunice requires " " instead of "", can you believe it
1899 echo " "
1900 : Here we go...
1901 echo "Beginning of configuration questions for $package."
1902
1903 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1904
1905 : first determine how to suppress newline on echo command
1906 echo " "
1907 echo "Checking echo to see how to suppress newlines..."
1908 (echo "hi there\c" ; echo " ") >.echotmp
1909 if $contains c .echotmp >/dev/null 2>&1 ; then
1910         echo "...using -n."
1911         n='-n'
1912         c=''
1913 else
1914         cat <<'EOM'
1915 ...using \c
1916 EOM
1917         n=''
1918         c='\c'
1919 fi
1920 echo $n "The star should be here-->$c"
1921 echo '*'
1922 rm -f .echotmp
1923
1924 : Now test for existence of everything in MANIFEST
1925 echo " "
1926 if test -f "$rsrc/MANIFEST"; then
1927         echo "First let's make sure your kit is complete.  Checking..." >&4
1928         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1929         rm -f missing
1930         tmppwd=`pwd`
1931         for filelist in x??; do
1932                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1933         done
1934         if test -s missing; then
1935                 cat missing >&4
1936                 cat >&4 <<'EOM'
1937
1938 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1939
1940 You have the option of continuing the configuration process, despite the
1941 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1942 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1943 and contact the author (perlbug@perl.org).
1944
1945 EOM
1946                 echo $n "Continue? [n] $c" >&4
1947                 read ans
1948                 case "$ans" in
1949                 y*)
1950                         echo "Continuing..." >&4
1951                         rm -f missing
1952                         ;;
1953                 *)
1954                         echo "ABORTING..." >&4
1955                         kill $$
1956                         ;;
1957                 esac
1958         else
1959                 echo "Looks good..."
1960         fi
1961 else
1962         echo "There is no MANIFEST file.  I hope your kit is complete !"
1963 fi
1964 rm -f missing x??
1965
1966 echo " "
1967 : Find the appropriate value for a newline for tr
1968 if test -n "$DJGPP"; then
1969        trnl='\012'
1970 fi
1971 if test X"$trnl" = X; then
1972         case "`echo foo|tr '\n' x 2>/dev/null`" in
1973         foox) trnl='\n' ;;
1974         esac
1975 fi
1976 if test X"$trnl" = X; then
1977         case "`echo foo|tr '\012' x 2>/dev/null`" in
1978         foox) trnl='\012' ;;
1979         esac
1980 fi
1981 if test X"$trnl" = X; then
1982        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1983        fooxy) trnl='\n\r' ;;
1984        esac
1985 fi
1986 if test X"$trnl" = X; then
1987         cat <<EOM >&2
1988
1989 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1990
1991 EOM
1992         exit 1
1993 fi
1994
1995 : compute the number of columns on the terminal for proper question formatting
1996 case "$COLUMNS" in
1997 '') COLUMNS='80';;
1998 esac
1999
2000 : set up the echo used in my read
2001 myecho="case \"\$xxxm\" in
2002 '') echo $n \"\$rp $c\" >&4;;
2003 *) case \"\$rp\" in
2004         '') echo $n \"[\$xxxm] $c\";;
2005         *)
2006                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2007                         echo \"\$rp\" >&4
2008                         echo $n \"[\$xxxm] $c\" >&4
2009                 else
2010                         echo $n \"\$rp [\$xxxm] $c\" >&4
2011                 fi
2012                 ;;
2013         esac;;
2014 esac"
2015
2016 : now set up to do reads with possible shell escape and default assignment
2017 cat <<EOSC >myread
2018 $startsh
2019 xxxm=\$dflt
2020 $myecho
2021 ans='!'
2022 case "\$fastread" in
2023 yes) case "\$dflt" in
2024         '') ;;
2025         *) ans='';
2026                 case "\$silent-\$rp" in
2027                 true-) ;;
2028                 *) echo " " >&4;;
2029                 esac;;
2030         esac;;
2031 *) case "\$silent" in
2032         true) case "\$rp" in
2033                 '') ans='';;
2034                 esac;;
2035         esac;;
2036 esac
2037 while expr "X\$ans" : "X!" >/dev/null; do
2038         read answ
2039         set x \$xxxm
2040         shift
2041         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2042         case  "\$answ" in
2043         "!")
2044                 sh 1>&4
2045                 echo " "
2046                 $myecho
2047                 ;;
2048         !*)
2049                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2050                 shift
2051                 sh 1>&4 -c "\$*"
2052                 echo " "
2053                 $myecho
2054                 ;;
2055         "\$ans")
2056                 case "\$ans" in
2057                 \\&*)
2058                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2059                         shift
2060                         case "\$1" in
2061                         -d)
2062                                 fastread=yes
2063                                 echo "(OK, I'll run with -d after this question.)" >&4
2064                                 ;;
2065                         -*)
2066                                 echo "*** Sorry, \$1 not supported yet." >&4
2067                                 ;;
2068                         esac
2069                         $myecho
2070                         ans=!
2071                         ;;
2072                 esac;;
2073         *)
2074                 case "\$aok" in
2075                 y)
2076                         echo "*** Substitution done -- please confirm."
2077                         xxxm="\$ans"
2078                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2079                         xxxm="\$ans"
2080                         ans=!
2081                         ;;
2082                 *)
2083                         echo "*** Error -- try again."
2084                         ans=!
2085                         ;;
2086                 esac
2087                 $myecho
2088                 ;;
2089         esac
2090         case "\$ans\$xxxm\$nostick" in
2091         '')
2092                 ans=!
2093                 $myecho
2094                 ;;
2095         esac
2096 done
2097 case "\$ans" in
2098 '') ans="\$xxxm";;
2099 esac
2100 EOSC
2101
2102 : create .config dir to save info across Configure sessions
2103 test -d ../.config || mkdir ../.config
2104 cat >../.config/README <<EOF
2105 This directory created by Configure to save information that should
2106 persist across sessions for $package.
2107
2108 You may safely delete it if you wish.
2109 EOF
2110
2111 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2112 case "$usedevel" in
2113 $define|true|[yY]*) ;;
2114 *) case "$xversion" in
2115    *[13579])
2116         cat >&4 <<EOH
2117 *** WHOA THERE!!! ***
2118
2119     This is an UNSTABLE DEVELOPMENT release.
2120     The version of this $package distribution is $xversion, that is, odd,
2121     (as opposed to even) and that signifies a development release.
2122     If you want a maintenance release, you want an even-numbered version.
2123
2124     Do ***NOT*** install this into production use.
2125     Data corruption and crashes are possible.
2126
2127     It is most seriously suggested that you do not continue any further
2128     unless you want to help in developing and debugging Perl.
2129
2130     If you *still* want to build perl, you can answer 'y' now,
2131     or pass -Dusedevel to Configure.
2132
2133 EOH
2134         rp='Do you really want to continue?'
2135         dflt='n'
2136         . ./myread
2137         case "$ans" in
2138         [yY]) echo >&4 "Okay, continuing."
2139               usedevel="$define" ;;
2140         *) echo >&4 "Okay, bye."
2141            exit 1
2142            ;;
2143         esac
2144         ;;
2145     esac
2146     ;;
2147 esac
2148 case "$usedevel" in
2149 $define|true|[yY]*)
2150         case "$versiononly" in
2151         '') versiononly="$define" ;;
2152         esac
2153         case "$installusrbinperl" in
2154         '') installusrbinperl="$undef" ;;
2155         esac
2156         ;;
2157 esac
2158
2159 : general instructions
2160 needman=true
2161 firsttime=true
2162 user=`(logname) 2>/dev/null`
2163 case "$user" in
2164 '') user=`whoami 2>&1`;;
2165 esac
2166 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2167         firsttime=false
2168         echo " "
2169         rp='Would you like to see the instructions?'
2170         dflt=n
2171         . ./myread
2172         case "$ans" in
2173         [yY]*) ;;
2174         *) needman=false;;
2175         esac
2176 fi
2177 if $needman; then
2178         cat <<EOH
2179
2180 This installation shell script will examine your system and ask you questions
2181 to determine how the perl5 package should be installed. If you get
2182 stuck on a question, you may use a ! shell escape to start a subshell or
2183 execute a command.  Many of the questions will have default answers in square
2184 brackets; typing carriage return will give you the default.
2185
2186 On some of the questions which ask for file or directory names you are allowed
2187 to use the ~name construct to specify the login directory belonging to "name",
2188 even if you don't have a shell which knows about that.  Questions where this is
2189 allowed will be marked "(~name ok)".
2190
2191 EOH
2192         rp=''
2193         dflt='Type carriage return to continue'
2194         . ./myread
2195         cat <<'EOH'
2196
2197 The prompter used in this script allows you to use shell variables and
2198 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2199 in the default answer, as if the default line was a set of arguments given to a
2200 script shell.  This means you may also use $* to repeat the whole default line,
2201 so you do not have to re-type everything to add something to the default.
2202
2203 Everytime there is a substitution, you will have to confirm.  If there is an
2204 error (e.g. an unmatched backtick), the default answer will remain unchanged
2205 and you will be prompted again.
2206
2207 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2208 the questions and use the computed defaults (or the previous answers if there
2209 was already a config.sh file). Type 'Configure -h' for a list of options.
2210 You may also start interactively and then answer '& -d' at any prompt to turn
2211 on the non-interactive behaviour for the remainder of the execution.
2212
2213 EOH
2214         . ./myread
2215         cat <<EOH
2216
2217 Much effort has been expended to ensure that this shell script will run on any
2218 Unix system.  If despite that it blows up on yours, your best bet is to edit
2219 Configure and run it again.  If you can't run Configure for some reason,
2220 you'll have to generate a config.sh file by hand.  Whatever problems you
2221 have, let me (perlbug@perl.org) know how I blew it.
2222
2223 This installation script affects things in two ways:
2224
2225 1) it may do direct variable substitutions on some of the files included
2226    in this kit.
2227 2) it builds a config.h file for inclusion in C programs.  You may edit
2228    any of these files as the need arises after running this script.
2229
2230 If you make a mistake on a question, there is no easy way to back up to it
2231 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2232 files.  Configure will offer to let you do this before it runs the SH files.
2233
2234 EOH
2235         dflt='Type carriage return to continue'
2236         . ./myread
2237         case "$firsttime" in
2238         true) echo $user >>../.config/instruct;;
2239         esac
2240 fi
2241
2242 : find out where common programs are
2243 echo " "
2244 echo "Locating common programs..." >&4
2245 cat <<EOSC >loc
2246 $startsh
2247 case \$# in
2248 0) exit 1;;
2249 esac
2250 thing=\$1
2251 shift
2252 dflt=\$1
2253 shift
2254 for dir in \$*; do
2255         case "\$thing" in
2256         .)
2257         if test -d \$dir/\$thing; then
2258                 echo \$dir
2259                 exit 0
2260         fi
2261         ;;
2262         *)
2263         for thisthing in \$dir/\$thing; do
2264                 : just loop through to pick last item
2265         done
2266         if test -f \$thisthing; then
2267                 echo \$thisthing
2268                 exit 0
2269         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2270                 echo \$thisthing
2271                 exit 0
2272         elif test -f \$dir/\$thing.exe; then
2273                 if test -n "$DJGPP"; then
2274                         echo \$dir/\$thing.exe
2275                 elif test "$eunicefix" != ":"; then
2276                         : on Eunice apparently
2277                         echo \$dir/\$thing
2278                         exit 0
2279                 fi
2280                 exit 0
2281         fi
2282         ;;
2283         esac
2284 done
2285 echo \$dflt
2286 exit 1
2287 EOSC
2288 chmod +x loc
2289 $eunicefix loc
2290 loclist="
2291 awk
2292 cat
2293 chmod
2294 comm
2295 cp
2296 echo
2297 expr
2298 grep
2299 ls
2300 mkdir
2301 rm
2302 sed
2303 sort
2304 touch
2305 tr
2306 uniq
2307 "
2308 trylist="
2309 Mcc
2310 ar
2311 bison
2312 byacc
2313 cpp
2314 csh
2315 date
2316 egrep
2317 gmake
2318 gzip
2319 less
2320 ln
2321 make
2322 more
2323 nm
2324 nroff
2325 pg
2326 test
2327 uname
2328 zip
2329 "
2330 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2331 pth="$pth /lib /usr/lib"
2332 for file in $loclist; do
2333         eval xxx=\$$file
2334         case "$xxx" in
2335         /*|?:[\\/]*)
2336                 if test -f "$xxx"; then
2337                         : ok
2338                 else
2339                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2340                         xxx=`./loc $file $file $pth`
2341                 fi
2342                 ;;
2343         '') xxx=`./loc $file $file $pth`;;
2344         *) xxx=`./loc $xxx $xxx $pth`;;
2345         esac
2346         eval $file=$xxx$_exe
2347         eval _$file=$xxx
2348         case "$xxx" in
2349         /*)
2350                 echo $file is in $xxx.
2351                 ;;
2352         ?:[\\/]*)
2353                 echo $file is in $xxx.
2354                 ;;
2355         *)
2356                 echo "I don't know where '$file' is, and my life depends on it." >&4
2357                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2358                 exit 1
2359                 ;;
2360         esac
2361 done
2362 echo " "
2363 echo "Don't worry if any of the following aren't found..."
2364 say=offhand
2365 for file in $trylist; do
2366         eval xxx=\$$file
2367         case "$xxx" in
2368         /*|?:[\\/]*)
2369                 if test -f "$xxx"; then
2370                         : ok
2371                 else
2372                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2373                         xxx=`./loc $file $file $pth`
2374                 fi
2375                 ;;
2376         '') xxx=`./loc $file $file $pth`;;
2377         *) xxx=`./loc $xxx $xxx $pth`;;
2378         esac
2379         eval $file=$xxx$_exe
2380         eval _$file=$xxx
2381         case "$xxx" in
2382         /*)
2383                 echo $file is in $xxx.
2384                 ;;
2385         ?:[\\/]*)
2386                 echo $file is in $xxx.
2387                 ;;
2388         *)
2389                 echo "I don't see $file out there, $say."
2390                 say=either
2391                 ;;
2392         esac
2393 done
2394 case "$egrep" in
2395 egrep)
2396         echo "Substituting grep for egrep."
2397         egrep=$grep
2398         _egrep=$grep
2399         ;;
2400 esac
2401 case "$ln" in
2402 ln)
2403         echo "Substituting cp for ln."
2404         ln=$cp
2405         _ln=$cp
2406         ;;
2407 esac
2408 case "$make" in
2409 make)   
2410         case "$gmake" in
2411         gmake)
2412         echo "I can't find make or gmake, and my life depends on it." >&4
2413         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2414         exit 1
2415         ;;
2416         esac
2417         ;;
2418 esac    
2419 case "$gmake" in
2420 gmake)  ;;
2421 *)      # We can't have osname yet.
2422         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2423                 # Assume that gmake, if found, is definitely GNU make
2424                 # and prefer it over the system make.
2425                 echo "Substituting gmake for make."
2426                 make=$gmake
2427                 _make=$gmake
2428         fi
2429         ;;
2430 esac
2431 case "$test" in
2432 test)
2433         echo "Hopefully test is built into your sh."
2434         ;;
2435 *)
2436         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2437                 echo "Using the test built into your sh."
2438                 test=test
2439                 _test=test
2440         fi
2441         ;;
2442 esac
2443 case "$echo" in
2444 echo)
2445         echo "Hopefully echo is built into your sh."
2446         ;;
2447 '') ;;
2448 *)
2449         echo " "
2450 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2451         $echo $n "hi there$c" >foo1
2452         echo $n "hi there$c" >foo2
2453         if cmp foo1 foo2 >/dev/null 2>&1; then
2454                 echo "They are compatible.  In fact, they may be identical."
2455         else
2456                 case "$n" in
2457                 '-n') n='' c='\c';;
2458                 *) n='-n' c='';;
2459                 esac
2460                 cat <<FOO
2461 They are not compatible!  You are probably running ksh on a non-USG system.
2462 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2463 have echo built in and we may have to run some Bourne shell scripts.  That
2464 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2465
2466 FOO
2467                 $echo $n "The star should be here-->$c"
2468                 $echo "*"
2469         fi
2470         $rm -f foo1 foo2
2471         ;;
2472 esac
2473
2474 cat <<EOS >trygcc
2475 $startsh
2476 EOS
2477 cat <<'EOSC' >>trygcc
2478 case "$cc" in
2479 '') ;;
2480 *)  $rm -f try try.*
2481     $cat >try.c <<EOM
2482 int main(int argc, char *argv[]) {
2483   return 0;
2484 }
2485 EOM
2486     if $cc -o try $ccflags $ldflags try.c; then
2487        :
2488     else
2489         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2490         despair=yes
2491         trygcc=yes
2492         case "$cc" in
2493         *gcc*) trygcc=no ;;
2494         esac
2495         case "`$cc -v -c try.c 2>&1`" in
2496         *gcc*) trygcc=no ;;
2497         esac
2498         if $test X"$trygcc" = Xyes; then
2499             if gcc -o try -c try.c; then
2500                 echo " "
2501                 echo "You seem to have a working gcc, though." >&4
2502                 rp="Would you like to use it?"
2503                 dflt=y
2504                 if $test -f myread; then
2505                     . ./myread
2506                 else
2507                     if $test -f UU/myread; then
2508                         . ./UU/myread
2509                     else
2510                         echo "Cannot find myread, sorry.  Aborting." >&2
2511                         exit 1
2512                     fi
2513                 fi  
2514                 case "$ans" in
2515                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2516                        if $test -f usethreads.cbu; then
2517                            $cat >&4 <<EOM 
2518
2519 *** However, any setting of the C compiler flags (e.g. for thread support)
2520 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2521 *** (together with e.g. -Dusethreads).
2522
2523 EOM
2524                        fi;;
2525                 esac
2526             fi
2527         fi
2528     fi
2529     $rm -f try try.*
2530     ;;
2531 esac
2532 EOSC
2533
2534 cat <<EOS >checkcc
2535 $startsh
2536 EOS
2537 cat <<'EOSC' >>checkcc
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         if $test X"$despair" = Xyes; then
2550            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2551         fi
2552         $cat >&4 <<EOM         
2553 You need to find a working C compiler.
2554 Either (purchase and) install the C compiler supplied by your OS vendor,
2555 or for a free C compiler try http://gcc.gnu.org/
2556 I cannot continue any further, aborting.
2557 EOM
2558         exit 1
2559     fi
2560     $rm -f try try.*
2561     ;;
2562 esac
2563 EOSC
2564
2565 : determine whether symbolic links are supported
2566 echo " "
2567 $touch blurfl
2568 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2569         echo "Symbolic links are supported." >&4
2570         lns="$ln -s"
2571 else
2572         echo "Symbolic links are NOT supported." >&4
2573         lns="$ln"
2574 fi
2575 $rm -f blurfl sym
2576
2577 : determine whether symbolic links are supported
2578 echo " "
2579 case "$lns" in
2580 *"ln"*" -s")
2581         echo "Checking how to test for symbolic links..." >&4
2582         $lns blurfl sym
2583         if $test "X$issymlink" = X; then
2584                 case "$newsh" in
2585                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2586                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2587                 esac
2588                 if test $? = 0; then
2589                         issymlink="test -h"
2590                 else
2591                         echo "Your builtin 'test -h' may be broken." >&4
2592                         case "$test" in
2593                         /*)     ;;
2594                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2595                                 for p in $pth
2596                                 do
2597                                         if test -f "$p/$test"; then
2598                                                 test="$p/$test"
2599                                                 break
2600                                         fi
2601                                 done
2602                                 ;;
2603                         esac
2604                         case "$test" in
2605                         /*)
2606                                 echo "Trying external '$test -h'." >&4
2607                                 issymlink="$test -h"
2608                                 if $test ! -h sym >/dev/null 2>&1; then
2609                                         echo "External '$test -h' is broken, too." >&4
2610                                         issymlink=''
2611                                 fi
2612                                 ;;
2613                         *)      issymlink='' ;;
2614                         esac
2615                 fi              
2616         fi
2617         if $test "X$issymlink" = X; then
2618                 if $test -L sym 2>/dev/null; then
2619                         issymlink="$test -L"
2620                         echo "The builtin '$test -L' worked." >&4
2621                 fi
2622         fi
2623         if $test "X$issymlink" != X; then
2624                 echo "You can test for symbolic links with '$issymlink'." >&4
2625         else
2626                 echo "I do not know how you can test for symbolic links." >&4
2627         fi
2628         $rm -f blurfl sym
2629         ;;
2630 *)      echo "No symbolic links, so not testing for their testing..." >&4
2631         ;;
2632 esac
2633 echo " "
2634
2635
2636 case "$mksymlinks" in
2637 $define|true|[yY]*)
2638         case "$src" in
2639         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2640                 exit 1
2641                 ;;
2642         *)      case "$lns:$issymlink" in
2643                 *"ln"*" -s:"*"test -"?)
2644                         echo "Creating the symbolic links..." >&4
2645                         echo "(First creating the subdirectories...)" >&4
2646                         cd ..
2647                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2648                                 read directory
2649                                 test -z "$directory" && break
2650                                 mkdir -p $directory
2651                         done
2652                         # Sanity check 1.
2653                         if test ! -d t/base; then
2654                                 echo "Failed to create the subdirectories.  Aborting." >&4
2655                                 exit 1
2656                         fi
2657                         echo "(Then creating the symlinks...)" >&4
2658                         awk '{print $1}' $src/MANIFEST | while true; do
2659                                 read filename
2660                                 test -z "$filename" && break
2661                                 if test -f $filename; then
2662                                         if $issymlink $filename; then
2663                                                 rm -f $filename
2664                                         fi
2665                                 fi
2666                                 if test -f $filename; then
2667                                         echo "$filename already exists, not symlinking."
2668                                 else
2669                                         ln -s $src/$filename $filename
2670                                 fi
2671                         done
2672                         # Sanity check 2.
2673                         if test ! -f t/base/lex.t; then
2674                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2675                                 exit 1
2676                         fi
2677                         cd UU
2678                         ;;
2679                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2680                         ;;
2681                 esac
2682                 ;;
2683         esac
2684         ;;
2685 esac
2686
2687
2688 case "$usecrosscompile" in
2689 $define|true|[yY]*)
2690         $echo "Cross-compiling..."
2691         croak=''
2692         case "$cc" in
2693         *-*-gcc) # A cross-compiling gcc, probably.
2694             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2695             ar=$targetarch-ar
2696             # leave out ld, choosing it is more complex
2697             nm=$targetarch-nm
2698             ranlib=$targetarch-ranlib
2699             $echo 'extern int foo;' > try.c
2700             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2701             shift
2702             if $test $# -gt 0; then
2703                 incpth="$incpth $*"
2704                 incpth="`$echo $incpth|$sed 's/^ //'`"
2705                 echo "Guessing incpth '$incpth'." >&4
2706                 for i in $*; do
2707                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2708                     if $test -d $j; then
2709                         libpth="$libpth $j"
2710                     fi
2711                 done   
2712                 libpth="`$echo $libpth|$sed 's/^ //'`"
2713                 echo "Guessing libpth '$libpth'." >&4
2714             fi
2715             $rm -f try.c
2716             ;;
2717         esac
2718         case "$targetarch" in
2719         '') echo "Targetarch not defined." >&4; croak=y ;;
2720         *)  echo "Using targetarch $targetarch." >&4 ;;
2721         esac
2722         case "$incpth" in
2723         '') echo "Incpth not defined." >&4; croak=y ;;
2724         *)  echo "Using incpth '$incpth'." >&4 ;;
2725         esac
2726         case "$libpth" in
2727         '') echo "Libpth not defined." >&4; croak=y ;;
2728         *)  echo "Using libpth '$libpth'." >&4 ;;
2729         esac
2730         case "$usrinc" in
2731         '') for i in $incpth; do
2732                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2733                     usrinc=$i
2734                     echo "Guessing usrinc $usrinc." >&4
2735                     break
2736                 fi
2737             done
2738             case "$usrinc" in
2739             '') echo "Usrinc not defined." >&4; croak=y ;;
2740             esac
2741             ;;
2742         *)  echo "Using usrinc $usrinc." >&4 ;;
2743         esac
2744         case "$targethost" in
2745         '') echo "Targethost not defined." >&4; croak=y ;;
2746         *)  echo "Using targethost $targethost." >&4
2747         esac
2748         locincpth=' '
2749         loclibpth=' '
2750         case "$croak" in
2751         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2752         esac
2753         case "$src" in
2754         /*) run=$src/Cross/run
2755             targetmkdir=$src/Cross/mkdir
2756             to=$src/Cross/to
2757             from=$src/Cross/from
2758             ;;
2759         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2760             run=$pwd/Cross/run
2761             targetmkdir=$pwd/Cross/mkdir
2762             to=$pwd/Cross/to
2763             from=$pwd/Cross/from
2764             ;;
2765         esac
2766         case "$targetrun" in
2767         '') targetrun=ssh ;;
2768         esac
2769         case "$targetto" in
2770         '') targetto=scp ;;
2771         esac
2772         case "$targetfrom" in
2773         '') targetfrom=scp ;;
2774         esac
2775         run=$run-$targetrun
2776         to=$to-$targetto
2777         from=$from-$targetfrom
2778         case "$targetdir" in
2779         '')  targetdir=/tmp
2780              echo "Guessing targetdir $targetdir." >&4
2781              ;;
2782         esac
2783         case "$targetuser" in
2784         '')  targetuser=root
2785              echo "Guessing targetuser $targetuser." >&4
2786              ;;
2787         esac
2788         case "$targetfrom" in
2789         scp)    q=-q ;;
2790         *)      q='' ;;
2791         esac
2792         case "$targetrun" in
2793         ssh|rsh)
2794             cat >$run <<EOF
2795 #!/bin/sh
2796 case "\$1" in
2797 -cwd)
2798   shift
2799   cwd=\$1
2800   shift
2801   ;;
2802 esac
2803 case "\$cwd" in
2804 '') cwd=$targetdir ;;
2805 esac
2806 exe=\$1
2807 shift
2808 if $test ! -f \$exe.xok; then
2809   $to \$exe
2810   $touch \$exe.xok
2811 fi
2812 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2813 EOF
2814             ;;
2815         *)  echo "Unknown targetrun '$targetrun'" >&4
2816             exit 1
2817             ;;
2818         esac
2819         case "$targetmkdir" in
2820         */Cross/mkdir)
2821             cat >$targetmkdir <<EOF
2822 #!/bin/sh
2823 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2824 EOF
2825             $chmod a+rx $targetmkdir
2826             ;;
2827         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2828             exit 1
2829             ;;
2830         esac
2831         case "$targetto" in
2832         scp|rcp)
2833             cat >$to <<EOF
2834 #!/bin/sh
2835 for f in \$@
2836 do
2837   case "\$f" in
2838   /*)
2839     $targetmkdir \`dirname \$f\`
2840     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2841     ;;
2842   *)
2843     $targetmkdir $targetdir/\`dirname \$f\`
2844     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2845     ;;
2846   esac
2847 done
2848 exit 0
2849 EOF
2850             ;;
2851         cp) cat >$to <<EOF
2852 #!/bin/sh
2853 for f in \$@
2854 do
2855   case "\$f" in
2856   /*)
2857     $mkdir -p $targetdir/\`dirname \$f\`
2858     $cp \$f $targetdir/\$f || exit 1
2859     ;;
2860   *)
2861     $targetmkdir $targetdir/\`dirname \$f\`
2862     $cp \$f $targetdir/\$f || exit 1
2863     ;;
2864   esac
2865 done
2866 exit 0
2867 EOF
2868             ;;
2869         *)  echo "Unknown targetto '$targetto'" >&4
2870             exit 1
2871             ;;
2872         esac
2873         case "$targetfrom" in
2874         scp|rcp)
2875           cat >$from <<EOF
2876 #!/bin/sh
2877 for f in \$@
2878 do
2879   $rm -f \$f
2880   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2881 done
2882 exit 0
2883 EOF
2884             ;;
2885         cp) cat >$from <<EOF
2886 #!/bin/sh
2887 for f in \$@
2888 do
2889   $rm -f \$f
2890   cp $targetdir/\$f . || exit 1
2891 done
2892 exit 0
2893 EOF
2894             ;;
2895         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2896             exit 1
2897             ;;
2898         esac
2899         if $test ! -f $run; then
2900             echo "Target 'run' script '$run' not found." >&4
2901         else
2902             $chmod a+rx $run
2903         fi
2904         if $test ! -f $to; then
2905             echo "Target 'to' script '$to' not found." >&4
2906         else
2907             $chmod a+rx $to
2908         fi
2909         if $test ! -f $from; then
2910             echo "Target 'from' script '$from' not found." >&4
2911         else
2912             $chmod a+rx $from
2913         fi
2914         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2915             exit 1
2916         fi
2917         cat >&4 <<EOF
2918 Using '$run' for remote execution,
2919 and '$from' and '$to'
2920 for remote file transfer.
2921 EOF
2922         ;;
2923 *)      run=''
2924         to=:
2925         from=:
2926         usecrosscompile='undef'
2927         targetarch=''
2928         ;;
2929 esac
2930
2931 : see whether [:lower:] and [:upper:] are supported character classes
2932 echo " "
2933 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2934 ABYZ)
2935         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2936         up='[:upper:]'
2937         low='[:lower:]'
2938         ;;
2939 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2940         # (0xd9 and 0xe2), therefore that is a nice testing point.
2941         if test "X$up" = X -o "X$low" = X; then
2942             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2943             rs) up='[A-Z]'
2944                 low='[a-z]'
2945                 ;;
2946             esac
2947         fi
2948         if test "X$up" = X -o "X$low" = X; then
2949             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2950             rs) up='A-Z'
2951                 low='a-z'
2952                 ;;
2953             esac
2954         fi
2955         if test "X$up" = X -o "X$low" = X; then
2956             case "`echo RS | od -x 2>/dev/null`" in
2957             *D9E2*|*d9e2*)
2958                 echo "Hey, this might be EBCDIC." >&4
2959                 if test "X$up" = X -o "X$low" = X; then
2960                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2961                     rs) up='[A-IJ-RS-Z]'
2962                         low='[a-ij-rs-z]'
2963                         ;;
2964                     esac
2965                 fi
2966                 if test "X$up" = X -o "X$low" = X; then
2967                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2968                     rs) up='A-IJ-RS-Z'
2969                         low='a-ij-rs-z'
2970                         ;;
2971                     esac
2972                 fi
2973                 ;;
2974             esac
2975         fi
2976 esac
2977 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2978 rs)
2979     echo "Using $up and $low to convert case." >&4
2980     ;;
2981 *)
2982     echo "I don't know how to translate letters from upper to lower case." >&4
2983     echo "Your tr is not acting any way I know of." >&4
2984     exit 1
2985     ;;
2986 esac
2987 : set up the translation script tr, must be called with ./tr of course
2988 cat >tr <<EOSC
2989 $startsh
2990 case "\$1\$2" in
2991 '[A-Z][a-z]') exec $tr '$up' '$low';;
2992 '[a-z][A-Z]') exec $tr '$low' '$up';;
2993 esac
2994 exec $tr "\$@"
2995 EOSC
2996 chmod +x tr
2997 $eunicefix tr
2998
2999 : Try to determine whether config.sh was made on this system
3000 case "$config_sh" in
3001 '')
3002 myuname=`$uname -a 2>/dev/null`
3003 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3004 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3005 # because the A-Z/a-z are not consecutive.
3006 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3007         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3008 newmyuname="$myuname"
3009 dflt=n
3010 case "$knowitall" in
3011 '')
3012         if test -f ../config.sh; then
3013                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3014                         eval "`grep myuname= ../config.sh`"
3015                 fi
3016                 if test "X$myuname" = "X$newmyuname"; then
3017                         dflt=y
3018                 fi
3019         fi
3020         ;;
3021 *) dflt=y;;
3022 esac
3023
3024 : Get old answers from old config file if Configure was run on the
3025 : same system, otherwise use the hints.
3026 hint=default
3027 cd ..
3028 if test -f config.sh; then
3029         echo " "
3030         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3031         . UU/myread
3032         case "$ans" in
3033         n*|N*) echo "OK, I'll ignore it."
3034                 mv config.sh config.sh.old
3035                 myuname="$newmyuname"
3036                 ;;
3037         *)  echo "Fetching default answers from your old config.sh file..." >&4
3038                 tmp_n="$n"
3039                 tmp_c="$c"
3040                 tmp_sh="$sh"
3041                 . ./config.sh
3042                 cp config.sh UU
3043                 n="$tmp_n"
3044                 c="$tmp_c"
3045                 : Older versions did not always set $sh.  Catch re-use of such
3046                 : an old config.sh.
3047                 case "$sh" in
3048                 '') sh="$tmp_sh" ;;
3049                 esac
3050                 hint=previous
3051                 ;;
3052         esac
3053 fi
3054 . ./UU/checkcc
3055 if test ! -f config.sh; then
3056         $cat <<EOM
3057
3058 First time through, eh?  I have some defaults handy for some systems
3059 that need some extra help getting the Configure answers right:
3060
3061 EOM
3062         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3063         dflt=''
3064         : Half the following guesses are probably wrong... If you have better
3065         : tests or hints, please send them to perlbug@perl.org
3066         : The metaconfig authors would also appreciate a copy...
3067         $test -f /irix && osname=irix
3068         $test -f /xenix && osname=sco_xenix
3069         $test -f /dynix && osname=dynix
3070         $test -f /dnix && osname=dnix
3071         $test -f /lynx.os && osname=lynxos
3072         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3073         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3074         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3075         $test -f /bin/mips && /bin/mips && osname=mips
3076         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3077                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3078         $test -d /usr/apollo/bin && osname=apollo
3079         $test -f /etc/saf/_sactab && osname=svr4
3080         $test -d /usr/include/minix && osname=minix
3081         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3082         if $test -d /MachTen -o -d /MachTen_Folder; then
3083                 osname=machten
3084                 if $test -x /sbin/version; then
3085                         osvers=`/sbin/version | $awk '{print $2}' |
3086                         $sed -e 's/[A-Za-z]$//'`
3087                 elif $test -x /usr/etc/version; then
3088                         osvers=`/usr/etc/version | $awk '{print $2}' |
3089                         $sed -e 's/[A-Za-z]$//'`
3090                 else
3091                         osvers="$2.$3"
3092                 fi
3093         fi
3094
3095         $test -f /sys/posix.dll &&
3096                 $test -f /usr/bin/what &&
3097                 set X `/usr/bin/what /sys/posix.dll` &&
3098                 $test "$3" = UWIN &&
3099                 osname=uwin &&
3100                 osvers="$5"
3101
3102         if $test -f $uname; then
3103                 set X $myuname
3104                 shift
3105
3106                 case "$5" in
3107                 fps*) osname=fps ;;
3108                 mips*)
3109                         case "$4" in
3110                         umips) osname=umips ;;
3111                         *) osname=mips ;;
3112                         esac;;
3113                 [23]100) osname=mips ;;
3114                 next*) osname=next ;;
3115                 i386*)
3116                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3117                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3118                                 osname='sco'
3119                                 osvers=$tmp
3120                         elif $test -f /etc/kconfig; then
3121                                 osname=isc
3122                                 if test "$lns" = "$ln -s"; then
3123                                         osvers=4
3124                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3125                                         osvers=3
3126                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3127                                         osvers=2
3128                                 fi
3129                         fi
3130                         tmp=''
3131                         ;;
3132                 pc*)
3133                         if test -n "$DJGPP"; then
3134                                 osname=dos
3135                                 osvers=djgpp
3136                         fi
3137                         ;;
3138                 esac
3139
3140                 case "$1" in
3141                 aix) osname=aix
3142                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3143                         case "$tmp" in
3144                         # oslevel can fail with:
3145                         # oslevel: Unable to acquire lock.
3146                         *not\ found) osvers="$4"."$3" ;;
3147                         '<3240'|'<>3240') osvers=3.2.0 ;;
3148                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3149                         '=3250'|'>3250') osvers=3.2.5 ;;
3150                         *) osvers=$tmp;;
3151                         esac
3152                         ;;
3153                 bsd386) osname=bsd386
3154                         osvers=`$uname -r`
3155                         ;;
3156                 cygwin*) osname=cygwin
3157                         osvers="$3"
3158                         ;;
3159                 *dc.osx) osname=dcosx
3160                         osvers="$3"
3161                         ;;
3162                 dnix) osname=dnix
3163                         osvers="$3"
3164                         ;;
3165                 domainos) osname=apollo
3166                         osvers="$3"
3167                         ;;
3168                 dgux)   osname=dgux
3169                         osvers="$3"
3170                         ;;
3171                 dragonfly) osname=dragonfly
3172                         osvers="$3"
3173                         ;;
3174                 dynixptx*) osname=dynixptx
3175                         osvers=`echo "$4"|sed 's/^v//'`
3176                         ;;
3177                 freebsd) osname=freebsd
3178                         osvers="$3" ;;
3179                 genix)  osname=genix ;;
3180                 gnu)    osname=gnu
3181                         osvers="$3" ;;
3182                 hp*)    osname=hpux
3183                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3184                         ;;
3185                 irix*)  osname=irix
3186                         case "$3" in
3187                         4*) osvers=4 ;;
3188                         5*) osvers=5 ;;
3189                         *)      osvers="$3" ;;
3190                         esac
3191                         ;;
3192                 linux)  osname=linux
3193                         case "$3" in
3194                         *)      osvers="$3" ;;
3195                         esac
3196                         ;;
3197                 MiNT)   osname=mint
3198                         ;;
3199                 netbsd*) osname=netbsd
3200                         osvers="$3"
3201                         ;;
3202                 news-os) osvers="$3"
3203                         case "$3" in
3204                         4*) osname=newsos4 ;;
3205                         *) osname=newsos ;;
3206                         esac
3207                         ;;
3208                 next*) osname=next ;;
3209                 nonstop-ux) osname=nonstopux ;;
3210                 openbsd) osname=openbsd
3211                         osvers="$3"
3212                         ;;
3213                 os2)    osname=os2
3214                         osvers="$4"
3215                         ;;
3216                 POSIX-BC | posix-bc ) osname=posix-bc
3217                         osvers="$3"
3218                         ;;
3219                 powerux | power_ux | powermax_os | powermaxos | \
3220                 powerunix | power_unix) osname=powerux
3221                         osvers="$3"
3222                         ;;
3223                 qnx) osname=qnx
3224                         osvers="$4"
3225                         ;;
3226                 solaris) osname=solaris
3227                         case "$3" in
3228                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3229                         *)      osvers="$3" ;;
3230                         esac
3231                         ;;
3232                 sunos) osname=sunos
3233                         case "$3" in
3234                         5*) osname=solaris
3235                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3236                         *)      osvers="$3" ;;
3237                         esac
3238                         ;;
3239                 titanos) osname=titanos
3240                         case "$3" in
3241                         1*) osvers=1 ;;
3242                         2*) osvers=2 ;;
3243                         3*) osvers=3 ;;
3244                         4*) osvers=4 ;;
3245                         *)      osvers="$3" ;;
3246                         esac
3247                         ;;
3248                 ultrix) osname=ultrix
3249                         osvers="$3"
3250                         ;;
3251                 osf1|mls+)      case "$5" in
3252                                 alpha)
3253                                         osname=dec_osf
3254                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3255                                         case "$osvers" in
3256                                         [1-9].[0-9]*) ;;
3257                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3258                                         esac
3259                                         ;;
3260                         hp*)    osname=hp_osf1  ;;
3261                         mips)   osname=mips_osf1 ;;
3262                         esac
3263                         ;;
3264                 # UnixWare 7.1.2 is known as Open UNIX 8
3265                 openunix|unixware) osname=svr5
3266                         osvers="$4"
3267                         ;;
3268                 uts)    osname=uts
3269                         osvers="$3"
3270                         ;;
3271                 vos) osvers="$3"
3272                         ;;
3273                 $2) case "$osname" in
3274                         *isc*) ;;
3275                         *freebsd*) ;;
3276                         svr*)
3277                                 : svr4.x or possibly later
3278                                 case "svr$3" in
3279                                 ${osname}*)
3280                                         osname=svr$3
3281                                         osvers=$4
3282                                         ;;
3283                                 esac
3284                                 case "$osname" in
3285                                 svr4.0)
3286                                         : Check for ESIX
3287                                         if test -f /stand/boot ; then
3288                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3289                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3290                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3291                                                         if test -n "$isesix"; then
3292                                                                 osname=esix4
3293                                                         fi
3294                                                 fi
3295                                         fi
3296                                         ;;
3297                                 esac
3298                                 ;;
3299                         *)      if test -f /etc/systemid; then
3300                                         osname=sco
3301                                         set `echo $3 | $sed 's/\./ /g'` $4
3302                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3303                                                 osvers=$1.$2.$3
3304                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3305                                                 osvers=$1.$2
3306                                         elif $test -f $src/hints/sco_$1.sh; then
3307                                                 osvers=$1
3308                                         fi
3309                                 else
3310                                         case "$osname" in
3311                                         '') : Still unknown.  Probably a generic Sys V.
3312                                                 osname="sysv"
3313                                                 osvers="$3"
3314                                                 ;;
3315                                         esac
3316                                 fi
3317                                 ;;
3318                         esac
3319                         ;;
3320                 *)      case "$osname" in
3321                         '') : Still unknown.  Probably a generic BSD.
3322                                 osname="$1"
3323                                 osvers="$3"
3324                                 ;;
3325                         esac
3326                         ;;
3327                 esac
3328         else
3329                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3330                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3331                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3332                                 osname=news_os
3333                         fi
3334                         $rm -f UU/kernel.what
3335                 elif test -d c:/. -o -n "$is_os2" ; then
3336                         set X $myuname
3337                         osname=os2
3338                         osvers="$5"
3339                 fi
3340         fi
3341
3342         case "$targetarch" in
3343         '') ;;
3344         *)  hostarch=$osname
3345             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3346             osvers=''
3347             ;;
3348         esac
3349
3350         : Now look for a hint file osname_osvers, unless one has been
3351         : specified already.
3352         case "$hintfile" in
3353         ''|' ')
3354                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3355                 : Also try without trailing minor version numbers.
3356                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3357                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3358                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3359                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3360                 case "$file" in
3361                 '') dflt=none ;;
3362                 *)  case "$osvers" in
3363                         '') dflt=$file
3364                                 ;;
3365                         *)  if $test -f $src/hints/$file.sh ; then
3366                                         dflt=$file
3367                                 elif $test -f $src/hints/$xfile.sh ; then
3368                                         dflt=$xfile
3369                                 elif $test -f $src/hints/$xxfile.sh ; then
3370                                         dflt=$xxfile
3371                                 elif $test -f $src/hints/$xxxfile.sh ; then
3372                                         dflt=$xxxfile
3373                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3374                                         dflt=$xxxxfile
3375                                 elif $test -f "$src/hints/${osname}.sh" ; then
3376                                         dflt="${osname}"
3377                                 else
3378                                         dflt=none
3379                                 fi
3380                                 ;;
3381                         esac
3382                         ;;
3383                 esac
3384                 if $test -f Policy.sh ; then
3385                         case "$dflt" in
3386                         *Policy*) ;;
3387                         none) dflt="Policy" ;;
3388                         *) dflt="Policy $dflt" ;;
3389                         esac
3390                 fi
3391                 ;;
3392         *)
3393                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3394                 ;;
3395         esac
3396
3397         if $test -f Policy.sh ; then
3398                 $cat <<EOM
3399
3400 There's also a Policy hint file available, which should make the
3401 site-specific (policy) questions easier to answer.
3402 EOM
3403
3404         fi
3405
3406         $cat <<EOM
3407
3408 You may give one or more space-separated answers, or "none" if appropriate.
3409 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3410 previous run of Configure, you may specify it as well as or instead of
3411 OS-specific hints.  If hints are provided for your OS, you should use them:
3412 although Perl can probably be built without hints on many platforms, using
3413 hints often improve performance and may enable features that Configure can't
3414 set up on its own. If there are no hints that match your OS, specify "none";
3415 DO NOT give a wrong version or a wrong OS.
3416
3417 EOM
3418
3419         rp="Which of these apply, if any?"
3420         . UU/myread
3421         tans=$ans
3422         for file in $tans; do
3423                 if $test X$file = XPolicy -a -f Policy.sh; then
3424                         . Policy.sh
3425                         $cat Policy.sh >> UU/config.sh
3426                 elif $test -f $src/hints/$file.sh; then
3427                         . $src/hints/$file.sh
3428                         $cat $src/hints/$file.sh >> UU/config.sh
3429                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3430                         : nothing
3431                 else
3432                         : Give one chance to correct a possible typo.
3433                         echo "$file.sh does not exist"
3434                         dflt=$file
3435                         rp="hint to use instead?"
3436                         . UU/myread
3437                         for file in $ans; do
3438                                 if $test -f "$src/hints/$file.sh"; then
3439                                         . $src/hints/$file.sh
3440                                         $cat $src/hints/$file.sh >> UU/config.sh
3441                                 elif $test X$ans = X -o X$ans = Xnone ; then
3442                                         : nothing
3443                                 else
3444                                         echo "$file.sh does not exist -- ignored."
3445                                 fi
3446                         done
3447                 fi
3448         done
3449
3450         hint=recommended
3451         : Remember our hint file for later.
3452         if $test -f "$src/hints/$file.sh" ; then
3453                 hintfile="$file"
3454         else
3455                 hintfile=''
3456         fi
3457 fi
3458 cd UU
3459 ;;
3460 *)
3461         echo " "
3462         echo "Fetching default answers from $config_sh..." >&4
3463         tmp_n="$n"
3464         tmp_c="$c"
3465         cd ..
3466         cp $config_sh config.sh 2>/dev/null
3467         chmod +w config.sh
3468         . ./config.sh
3469         cd UU
3470         cp ../config.sh .
3471         n="$tmp_n"
3472         c="$tmp_c"
3473         hint=previous
3474         ;;
3475 esac
3476 test "$override" && . ./optdef.sh
3477
3478 : Restore computed paths
3479 for file in $loclist $trylist; do
3480         eval $file="\$_$file"
3481 done
3482
3483 cat << EOM
3484
3485 Configure uses the operating system name and version to set some defaults.
3486 The default value is probably right if the name rings a bell. Otherwise,
3487 since spelling matters for me, either accept the default or answer "none"
3488 to leave it blank.
3489
3490 EOM
3491 case "$osname" in
3492         ''|' ')
3493                 case "$hintfile" in
3494                 ''|' '|none) dflt=none ;;
3495                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3496                 esac
3497                 ;;
3498         *) dflt="$osname" ;;
3499 esac
3500 rp="Operating system name?"
3501 . ./myread
3502 case "$ans" in
3503 none)  osname='' ;;
3504 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3505 esac
3506 echo " "
3507 case "$osvers" in
3508         ''|' ')
3509                 case "$hintfile" in
3510                 ''|' '|none) dflt=none ;;
3511                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3512                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3513                         case "$dflt" in
3514                         ''|' ') dflt=none ;;
3515                         esac
3516                         ;;
3517                 esac
3518                 ;;
3519         *) dflt="$osvers" ;;
3520 esac
3521 rp="Operating system version?"
3522 . ./myread
3523 case "$ans" in
3524 none)  osvers='' ;;
3525 *) osvers="$ans" ;;
3526 esac
3527
3528
3529 . ./posthint.sh
3530
3531 : who configured the system
3532 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3533 case "$cf_by" in
3534 "")
3535         cf_by=`(logname) 2>/dev/null`
3536         case "$cf_by" in
3537         "")
3538                 cf_by=`(whoami) 2>/dev/null`
3539                 case "$cf_by" in
3540                 "") cf_by=unknown ;;
3541                 esac ;;
3542         esac ;;
3543 esac
3544
3545 : decide how portable to be.  Allow command line overrides.
3546 case "$d_portable" in
3547 "$undef") ;;
3548 *)      d_portable="$define" ;;
3549 esac
3550
3551 : set up shell script to do ~ expansion
3552 cat >filexp <<EOSS
3553 $startsh
3554 : expand filename
3555 case "\$1" in
3556  ~/*|~)
3557         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3558         ;;
3559  ~*)
3560         if $test -f /bin/csh; then
3561                 /bin/csh -f -c "glob \$1"
3562                 failed=\$?
3563                 echo ""
3564                 exit \$failed
3565         else
3566                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3567                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3568                 if $test ! -d "\$dir"; then
3569                         me=\`basename \$0\`
3570                         echo "\$me: can't locate home directory for: \$name" >&2
3571                         exit 1
3572                 fi
3573                 case "\$1" in
3574                 */*)
3575                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3576                         ;;
3577                 *)
3578                         echo \$dir
3579                         ;;
3580                 esac
3581         fi
3582         ;;
3583 *)
3584         echo \$1
3585         ;;
3586 esac
3587 EOSS
3588 chmod +x filexp
3589 $eunicefix filexp
3590
3591 : now set up to get a file name
3592 cat <<EOS >getfile
3593 $startsh
3594 EOS
3595 cat <<'EOSC' >>getfile
3596 tilde=''
3597 fullpath=''
3598 already=''
3599 skip=''
3600 none_ok=''
3601 exp_file=''
3602 nopath_ok=''
3603 orig_rp="$rp"
3604 orig_dflt="$dflt"
3605 case "$gfpth" in
3606 '') gfpth='.' ;;
3607 esac
3608
3609 case "$fn" in
3610 *\(*)
3611         : getfile will accept an answer from the comma-separated list
3612         : enclosed in parentheses even if it does not meet other criteria.
3613         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3614         fn=`echo $fn | sed 's/(.*)//'`
3615         ;;
3616 esac
3617
3618 case "$fn" in
3619 *:*)
3620         loc_file=`expr $fn : '.*:\(.*\)'`
3621         fn=`expr $fn : '\(.*\):.*'`
3622         ;;
3623 esac
3624
3625 case "$fn" in
3626 *~*) tilde=true;;
3627 esac
3628 case "$fn" in
3629 */*) fullpath=true;;
3630 esac
3631 case "$fn" in
3632 *+*) skip=true;;
3633 esac
3634 case "$fn" in
3635 *n*) none_ok=true;;
3636 esac
3637 case "$fn" in
3638 *e*) exp_file=true;;
3639 esac
3640 case "$fn" in
3641 *p*) nopath_ok=true;;
3642 esac
3643
3644 case "$fn" in
3645 *f*) type='File';;
3646 *d*) type='Directory';;
3647 *l*) type='Locate';;
3648 esac
3649
3650 what="$type"
3651 case "$what" in
3652 Locate) what='File';;
3653 esac
3654
3655 case "$exp_file" in
3656 '')
3657         case "$d_portable" in
3658         "$define") ;;
3659         *) exp_file=true;;
3660         esac
3661         ;;
3662 esac
3663
3664 cd ..
3665 while test "$type"; do
3666         redo=''
3667         rp="$orig_rp"
3668         dflt="$orig_dflt"
3669         case "$tilde" in
3670         true) rp="$rp (~name ok)";;
3671         esac
3672         . UU/myread
3673         if test -f UU/getfile.ok && \
3674                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3675         then
3676                 value="$ans"
3677                 ansexp="$ans"
3678                 break
3679         fi
3680         case "$ans" in
3681         none)
3682                 value=''
3683                 ansexp=''
3684                 case "$none_ok" in
3685                 true) type='';;
3686                 esac
3687                 ;;
3688         *)
3689                 case "$tilde" in
3690                 '') value="$ans"
3691                         ansexp="$ans";;
3692                 *)
3693                         value=`UU/filexp $ans`
3694                         case $? in
3695                         0)
3696                                 if test "$ans" != "$value"; then
3697                                         echo "(That expands to $value on this system.)"
3698                                 fi
3699                                 ;;
3700                         *) value="$ans";;
3701                         esac
3702                         ansexp="$value"
3703                         case "$exp_file" in
3704                         '') value="$ans";;
3705                         esac
3706                         ;;
3707                 esac
3708                 case "$fullpath" in
3709                 true)
3710                         case "$ansexp" in
3711                         /*) value="$ansexp" ;;
3712                         [a-zA-Z]:/*) value="$ansexp" ;;
3713                         *)
3714                                 redo=true
3715                                 case "$already" in
3716                                 true)
3717                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3718                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3719                                         ;;
3720                                 *)
3721                                 echo "Please give a full path name, starting with slash." >&4
3722                                         case "$tilde" in
3723                                         true)
3724                                 echo "Note that using ~name is ok provided it expands well." >&4
3725                                                 already=true
3726                                                 ;;
3727                                         esac
3728                                 esac
3729                                 ;;
3730                         esac
3731                         ;;
3732                 esac
3733                 case "$redo" in
3734                 '')
3735                         case "$type" in
3736                         File)
3737                                 for fp in $gfpth; do
3738                                         if test "X$fp" = X.; then
3739                                             pf="$ansexp"
3740                                         else    
3741                                             pf="$fp/$ansexp"
3742                                         fi
3743                                         if test -f "$pf"; then
3744                                                 type=''
3745                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3746                                         then
3747                                                 echo "($value is not a plain file, but that's ok.)"
3748                                                 type=''
3749                                         fi
3750                                         if test X"$type" = X; then
3751                                             value="$pf"
3752                                             break
3753                                         fi
3754                                 done
3755                                 ;;
3756                         Directory)
3757                                 for fp in $gfpth; do
3758                                         if test "X$fp" = X.; then
3759                                             dir="$ans"
3760                                             direxp="$ansexp"
3761                                         else    
3762                                             dir="$fp/$ansexp"
3763                                             direxp="$fp/$ansexp"
3764                                         fi
3765                                         if test -d "$direxp"; then
3766                                                 type=''
3767                                                 value="$dir"
3768                                                 break
3769                                         fi
3770                                 done
3771                                 ;;
3772                         Locate)
3773                                 if test -d "$ansexp"; then
3774                                         echo "(Looking for $loc_file in directory $value.)"
3775                                         value="$value/$loc_file"
3776                                         ansexp="$ansexp/$loc_file"
3777                                 fi
3778                                 if test -f "$ansexp"; then
3779                                         type=''
3780                                 fi
3781                                 case "$nopath_ok" in
3782                                 true)   case "$value" in
3783                                         */*) ;;
3784                                         *)      echo "Assuming $value will be in people's path."
3785                                                 type=''
3786                                                 ;;
3787                                         esac
3788                                         ;;
3789                                 esac
3790                                 ;;
3791                         esac
3792
3793                         case "$skip" in
3794                         true) type='';
3795                         esac
3796
3797                         case "$type" in
3798                         '') ;;
3799                         *)
3800                                 if test "$fastread" = yes; then
3801                                         dflt=y
3802                                 else
3803                                         dflt=n
3804                                 fi
3805                                 rp="$what $value doesn't exist.  Use that name anyway?"
3806                                 . UU/myread
3807                                 dflt=''
3808                                 case "$ans" in
3809                                 y*) type='';;
3810                                 *) echo " ";;
3811                                 esac
3812                                 ;;
3813                         esac
3814                         ;;
3815                 esac
3816                 ;;
3817         esac
3818 done
3819 cd UU
3820 ans="$value"
3821 rp="$orig_rp"
3822 dflt="$orig_dflt"
3823 rm -f getfile.ok
3824 test "X$gfpthkeep" != Xy && gfpth=""
3825 EOSC
3826
3827 : determine root of directory hierarchy where package will be installed.
3828 case "$prefix" in
3829 '')
3830         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3831         ;;
3832 *?/)
3833         dflt=`echo "$prefix" | sed 's/.$//'`
3834         ;;
3835 *)
3836         dflt="$prefix"
3837         ;;
3838 esac
3839 $cat <<EOM
3840
3841 By default, $package will be installed in $dflt/bin, manual pages
3842 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3843 installation directories. Typically this is something like /usr/local.
3844 If you wish to have binaries under /usr/bin but other parts of the
3845 installation under /usr/local, that's ok: you will be prompted
3846 separately for each of the installation directories, the prefix being
3847 only used to set the defaults.
3848
3849 EOM
3850 fn=d~
3851 rp='Installation prefix to use?'
3852 . ./getfile
3853 oldprefix=''
3854 case "$prefix" in
3855 '') ;;
3856 *)
3857         case "$ans" in
3858         "$prefix") ;;
3859         *) oldprefix="$prefix";;
3860         esac
3861         ;;
3862 esac
3863 prefix="$ans"
3864 prefixexp="$ansexp"
3865
3866 case "$afsroot" in
3867 '')     afsroot=/afs ;;
3868 *)      afsroot=$afsroot ;;
3869 esac
3870
3871 : is AFS running?
3872 echo " "
3873 case "$afs" in
3874 $define|true)   afs=true ;;
3875 $undef|false)   afs=false ;;
3876 *)      if test -d $afsroot; then
3877                 afs=true
3878         else
3879                 afs=false
3880         fi
3881         ;;
3882 esac
3883 if $afs; then
3884         echo "AFS may be running... I'll be extra cautious then..." >&4
3885 else
3886         echo "AFS does not seem to be running..." >&4
3887 fi
3888
3889 : determine installation prefix for where package is to be installed.
3890 if $afs; then 
3891 $cat <<EOM
3892
3893 Since you are running AFS, I need to distinguish the directory in which
3894 files will reside from the directory in which they are installed (and from
3895 which they are presumably copied to the former directory by occult means).
3896
3897 EOM
3898         case "$installprefix" in
3899         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3900         *) dflt="$installprefix";;
3901         esac
3902 else
3903 $cat <<EOM
3904
3905 In some special cases, particularly when building $package for distribution,
3906 it is convenient to distinguish the directory in which files should be
3907 installed from the directory ($prefix) in which they will
3908 eventually reside.  For most users, these two directories are the same.
3909
3910 EOM
3911         case "$installprefix" in
3912         '') dflt=$prefix ;;
3913         *) dflt=$installprefix;;
3914         esac
3915 fi
3916 fn=d~
3917 rp='What installation prefix should I use for installing files?'
3918 . ./getfile
3919 installprefix="$ans"
3920 installprefixexp="$ansexp"
3921
3922 : Perform the prefixexp/installprefixexp correction if necessary
3923 cat <<EOS >installprefix
3924 $startsh
3925 EOS
3926 cat <<'EOSC' >>installprefix
3927 : Change installation prefix, if necessary.
3928 if $test X"$prefix" != X"$installprefix"; then
3929     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3930 else
3931     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3932 fi
3933 EOSC
3934 chmod +x installprefix
3935 $eunicefix installprefix
3936
3937 : Set variables such as privlib and privlibexp from the output of ./getfile
3938 : performing the prefixexp/installprefixexp correction if necessary.
3939 cat <<EOS >setprefixvar
3940 $startsh
3941 EOS
3942 cat <<'EOSC' >>setprefixvar
3943 eval "${prefixvar}=\"\$ans\""
3944 eval "${prefixvar}exp=\"\$ansexp\""
3945 . ./installprefix
3946 EOSC
3947 chmod +x setprefixvar
3948 $eunicefix setprefixvar
3949
3950 : set up the script used to warn in case of inconsistency
3951 cat <<EOS >whoa
3952 $startsh
3953 EOS
3954 cat <<'EOSC' >>whoa
3955 dflt=y
3956 case "$hint" in
3957     recommended)
3958         case "$hintfile" in
3959         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3960                 ;;
3961         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3962                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3963                 ;;
3964         esac
3965         ;;
3966     *)  echo " "
3967         echo "*** WHOA THERE!!! ***" >&4
3968         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3969         ;;
3970 esac
3971 rp="    Keep the $hint value?"
3972 . ./myread
3973 case "$ans" in
3974 y) td=$was; tu=$was;;
3975 esac
3976 EOSC
3977
3978 : function used to set $1 to $val
3979 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3980 case "$val$was" in
3981 $define$undef) . ./whoa; eval "$var=\$td";;
3982 $undef$define) . ./whoa; eval "$var=\$tu";;
3983 *) eval "$var=$val";;
3984 esac'
3985
3986 case "$usesocks" in
3987 $define|true|[yY]*)     dflt='y';;
3988 *) dflt='n';;
3989 esac
3990 cat <<EOM
3991
3992 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3993 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3994 to use the PerlIO abstraction layer, this will be implicitly selected.
3995
3996 If this doesn't make any sense to you, just accept the default '$dflt'.
3997 EOM
3998 rp='Build Perl for SOCKS?'
3999 . ./myread
4000 case "$ans" in
4001 y|Y)    val="$define" ;;     
4002 *)      val="$undef" ;;
4003 esac
4004 set usesocks
4005 eval $setvar
4006
4007 case "$usesocks" in
4008 $define|true|[yY]*) useperlio="$define";;
4009 esac
4010
4011 case "$useperlio" in
4012 $define|true|[yY]*|'')  dflt='y';;
4013 *) dflt='n';;
4014 esac
4015 cat <<EOM
4016
4017 Previous version of $package used the standard IO mechanisms as
4018 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4019 alternate IO mechanisms via the PerlIO abstraction layer, but the
4020 stdio mechanism is still available if needed.  The abstraction layer
4021 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4022 Using PerlIO with sfio may cause problems with some extension modules.
4023
4024 If this doesn't make any sense to you, just accept the default '$dflt'.
4025 EOM
4026 rp='Use the PerlIO abstraction layer?'
4027 . ./myread
4028 case "$ans" in
4029 y|Y) 
4030         val="$define"
4031         ;;
4032 *)      
4033         echo "Ok, doing things the stdio way."
4034         val="$undef"
4035         ;;
4036 esac
4037 set useperlio
4038 eval $setvar 
4039
4040 case "$usesocks" in
4041 $define|true|[yY]*)
4042         case "$useperlio" in
4043         $define|true|[yY]*) ;;
4044         *)      cat >&4 <<EOM
4045
4046 You are using the SOCKS proxy protocol library which means that you
4047 should also use the PerlIO layer.  You may be headed for trouble.
4048
4049 EOM
4050                 ;;
4051         esac
4052         ;;
4053 esac
4054
4055         
4056 : get the patchlevel
4057 echo " "
4058 echo "Getting the current patchlevel..." >&4
4059 if $test -r $rsrc/patchlevel.h;then
4060         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4061         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4062         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4063         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4064         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4065         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4066         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4067 else
4068         revision=0
4069         patchlevel=0
4070         subversion=0
4071         api_revision=0
4072         api_version=0
4073         api_subversion=0
4074         perl_patchlevel=0
4075         $echo "(You do not have patchlevel.h.  Eek.)"
4076 fi
4077 if $test -r $rsrc/.patch ; then
4078         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4079                 perl_patchlevel=`cat $rsrc/.patch`
4080         fi
4081 fi
4082 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4083 version_patchlevel_string="version $patchlevel subversion $subversion"
4084 case "$perl_patchlevel" in
4085 0|'') ;;
4086 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4087 esac
4088
4089 $echo "(You have $package $version_patchlevel_string.)"
4090
4091 case "$osname" in
4092 dos|vms)
4093         : XXX Should be a Configure test for double-dots in filenames.
4094         version=`echo $revision $patchlevel $subversion | \
4095                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4096         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4097                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4098         ;;
4099 *)
4100         version=`echo $revision $patchlevel $subversion | \
4101                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4102         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4103                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4104         ;;
4105 esac
4106 : Special case the 5.005_xx maintenance series, which used 5.005
4107 : without any subversion label as a subdirectory in $sitelib
4108 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4109         api_versionstring='5.005'
4110 fi
4111
4112 case "$usethreads" in
4113 $define|true|[yY]*)     dflt='y';;
4114 *)     # Catch case where user specified ithreads or 5005threads but
4115        # forgot -Dusethreads (A.D. 4/2002)
4116        case "$useithreads$use5005threads" in
4117        *$define*)      
4118                 case "$useperlio" in
4119                 "$define")      dflt='y' ;;
4120                 *)              dflt='n' ;;
4121                 esac
4122                 ;;
4123        *)       dflt='n';;
4124        esac
4125        ;;
4126 esac
4127 cat <<EOM
4128
4129 Perl can be built to take advantage of threads on some systems.
4130 To do so, Configure can be run with -Dusethreads.
4131
4132 Note that Perl built with threading support runs slightly slower
4133 and uses more memory than plain Perl. The current implementation
4134 is believed to be stable, but it is fairly new, and so should be
4135 treated with caution.
4136
4137 If this doesn't make any sense to you, just accept the default '$dflt'.
4138 EOM
4139 rp='Build a threading Perl?'
4140 . ./myread
4141 case "$ans" in
4142 y|Y)    val="$define" ;;
4143 *)      val="$undef" ;;
4144 esac
4145 set usethreads
4146 eval $setvar
4147
4148 if $test $patchlevel -lt 9; then
4149     case "$usethreads" in
4150     $define)
4151         $cat <<EOM
4152
4153 Since release 5.6, Perl has had two different threading implementations,
4154 the newer interpreter-based version (ithreads) with one interpreter per
4155 thread, and the older 5.005 version (5005threads).
4156 The 5005threads version is effectively unmaintained and will probably be
4157 removed in Perl 5.10, so there should be no need to build a Perl using it
4158 unless needed for backwards compatibility with some existing 5.005threads
4159 code.
4160
4161 EOM
4162         : Default to ithreads unless overridden on command line or with
4163         : old config.sh
4164         dflt='y'
4165         case "$use5005threads" in
4166                 $define|true|[yY]*) dflt='n';;
4167         esac
4168         case "$useithreads" in
4169                 $undef|false|[nN]*) dflt='n';;
4170         esac
4171         rp='Use the newer interpreter-based ithreads?'
4172         . ./myread
4173         case "$ans" in
4174         y|Y)    val="$define" ;;
4175         *)      val="$undef" ;;
4176         esac
4177         set useithreads
4178         eval $setvar
4179         : Now set use5005threads to the opposite value.
4180         case "$useithreads" in
4181         $define) val="$undef" ;;
4182         *) val="$define" ;;
4183         esac
4184         set use5005threads
4185         eval $setvar
4186         ;;
4187     *)
4188         useithreads="$undef"
4189         use5005threads="$undef"
4190         ;;
4191     esac
4192
4193     case "$useithreads$use5005threads" in
4194     "$define$define")
4195         $cat >&4 <<EOM
4196
4197 You cannot have both the ithreads and the 5.005 threads enabled
4198 at the same time.  Disabling the 5.005 threads since they are
4199 much less stable than the ithreads.
4200
4201 EOM
4202         use5005threads="$undef"
4203         ;;
4204     esac
4205
4206 else
4207 : perl-5.9.x and later
4208
4209     use5005threads="$undef"
4210     case "$usethreads" in
4211     $define)
4212         : Default to ithreads unless overridden on command line or with
4213         : old config.sh
4214         dflt='y'
4215         case "$useithreads" in
4216                 $undef|false|[nN]*) dflt='n';;
4217         esac
4218         rp='Use the newer interpreter-based ithreads?'
4219         . ./myread
4220         case "$ans" in
4221         y|Y)    val="$define" ;;
4222         *)      val="$undef" ;;
4223         esac
4224         set useithreads
4225         eval $setvar
4226         ;;
4227     *)
4228         useithreads="$undef"
4229         ;;
4230     esac
4231
4232 fi
4233
4234 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4235         cat >&4 <<EOF
4236 ***
4237 *** To build with ithreads you must also use the PerlIO layer.
4238 *** Cannot continue, aborting.
4239 ***
4240 EOF
4241         exit 1
4242 fi
4243
4244 case "$d_oldpthreads" in
4245 '')     : Configure tests would be welcome here.  For now, assume undef.
4246         val="$undef" ;;
4247 *)      val="$d_oldpthreads" ;;
4248 esac
4249 set d_oldpthreads
4250 eval $setvar
4251
4252
4253 : Look for a hint-file generated 'call-back-unit'.  If the
4254 : user has specified that a threading perl is to be built,
4255 : we may need to set or change some other defaults.
4256 if $test -f usethreads.cbu; then
4257     echo "Your platform has some specific hints regarding threaded builds, using them..."
4258     . ./usethreads.cbu
4259 else
4260     case "$usethreads" in
4261         "$define"|true|[yY]*)
4262                 $cat <<EOM
4263 (Your platform does not have any specific hints for threaded builds.
4264  Assuming POSIX threads, then.)
4265 EOM
4266         ;;
4267     esac
4268 fi
4269
4270 cat <<EOM
4271
4272 Perl can be built so that multiple Perl interpreters can coexist
4273 within the same Perl executable.
4274 EOM
4275
4276 case "$useithreads" in
4277 $define)
4278         cat <<EOM
4279 This multiple interpreter support is required for interpreter-based threads.
4280 EOM
4281         val="$define"
4282         ;;
4283 *)      case "$usemultiplicity" in
4284         $define|true|[yY]*)     dflt='y';;
4285         *) dflt='n';;
4286         esac
4287         echo " "
4288         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4289         rp='Build Perl for multiplicity?'
4290         . ./myread
4291         case "$ans" in
4292         y|Y)    val="$define" ;;
4293         *)      val="$undef" ;;
4294         esac
4295         ;;
4296 esac
4297 set usemultiplicity
4298 eval $setvar
4299
4300
4301 case "$usemorebits" in
4302 "$define"|true|[yY]*)
4303         use64bitint="$define"
4304         uselongdouble="$define"
4305         usemorebits="$define"
4306         ;;
4307 *)      usemorebits="$undef"
4308         ;;
4309 esac
4310
4311 : make some quick guesses about what we are up against
4312 echo " "
4313 $echo $n "Hmm...  $c"
4314 echo exit 1 >bsd
4315 echo exit 1 >usg
4316 echo exit 1 >v7
4317 echo exit 1 >osf1
4318 echo exit 1 >eunice
4319 echo exit 1 >xenix
4320 echo exit 1 >venix
4321 echo exit 1 >os2
4322 d_bsd="$undef"
4323 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4324 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4325 then
4326         echo "Looks kind of like an OSF/1 system, but we'll see..."
4327         echo exit 0 >osf1
4328 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4329         xxx=`./loc addbib blurfl $pth`
4330         if $test -f $xxx; then
4331         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4332                 echo exit 0 >bsd
4333                 echo exit 0 >usg
4334         else
4335                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4336                         echo "Looks kind of like an extended USG system, but we'll see..."
4337                 else
4338                         echo "Looks kind of like a USG system, but we'll see..."
4339                 fi
4340                 echo exit 0 >usg
4341         fi
4342 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4343         echo "Looks kind of like a BSD system, but we'll see..."
4344         d_bsd="$define"
4345         echo exit 0 >bsd
4346 else
4347         echo "Looks kind of like a Version 7 system, but we'll see..."
4348         echo exit 0 >v7
4349 fi
4350 case "$eunicefix" in
4351 *unixtovms*)
4352         $cat <<'EOI'
4353 There is, however, a strange, musty smell in the air that reminds me of
4354 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4355 EOI
4356         echo exit 0 >eunice
4357         d_eunice="$define"
4358 : it so happens the Eunice I know will not run shell scripts in Unix format
4359         ;;
4360 *)
4361         echo " "
4362         echo "Congratulations.  You aren't running Eunice."
4363         d_eunice="$undef"
4364         ;;
4365 esac
4366 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4367 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4368 : semicolon as a patch separator
4369 case "$p_" in
4370 :) ;;
4371 *)
4372         $cat <<'EOI'
4373 I have the feeling something is not exactly right, however...don't tell me...
4374 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4375 (Or you may be running DOS with DJGPP.)
4376 EOI
4377         echo exit 0 >os2
4378         ;;
4379 esac
4380 if test -f /xenix; then
4381         echo "Actually, this looks more like a XENIX system..."
4382         echo exit 0 >xenix
4383         d_xenix="$define"
4384 else
4385         echo " "
4386         echo "It's not Xenix..."
4387         d_xenix="$undef"
4388 fi
4389 chmod +x xenix
4390 $eunicefix xenix
4391 if test -f /venix; then
4392         echo "Actually, this looks more like a VENIX system..."
4393         echo exit 0 >venix
4394 else
4395         echo " "
4396         if ./xenix; then
4397                 : null
4398         else
4399                 echo "Nor is it Venix..."
4400         fi
4401 fi
4402 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4403 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4404 $rm -f foo
4405
4406 case "$cc" in
4407 '') dflt=cc;;
4408 *) dflt="$cc";;
4409 esac
4410 rp="Use which C compiler?"
4411 . ./myread
4412 cc="$ans"
4413
4414 : See if they have not cc but they do have gcc
4415 . ./trygcc
4416 : Look for a hint-file generated 'call-back-unit'.  Now that the
4417 : user has specified the compiler, we may need to set or change some
4418 : other defaults.
4419 if $test -f cc.cbu; then
4420     . ./cc.cbu
4421 fi
4422 . ./checkcc
4423
4424 echo " "
4425 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4426 $cat >try.c <<EOM
4427 #include <stdio.h>
4428 int main() {
4429 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4430 #ifdef __VERSION__
4431         printf("%s\n", __VERSION__);
4432 #else
4433         printf("%s\n", "1");
4434 #endif
4435 #endif
4436         return(0);
4437 }
4438 EOM
4439 if $cc -o try $ccflags $ldflags try.c; then
4440         gccversion=`$run ./try`
4441         case "$gccversion" in
4442         '') echo "You are not using GNU cc." ;;
4443         *)  echo "You are using GNU cc $gccversion."
4444             ccname=gcc
4445             ;;
4446         esac
4447 else
4448         echo " "
4449         echo "*** WHOA THERE!!! ***" >&4
4450         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4451         case "$knowitall" in
4452         '')
4453         echo "    You'd better start hunting for one and let me know about it." >&4
4454                 exit 1
4455                 ;;
4456         esac
4457 fi
4458 $rm -f try try.*
4459 case "$gccversion" in
4460 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4461 esac
4462 case "$gccversion" in
4463 '') gccosandvers='' ;;
4464 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4465    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4466    gccshortvers=''
4467    case "$gccosandvers" in
4468    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4469    $osname$osvers) ;; # looking good
4470    $osname*) cat <<EOM >&4
4471
4472 *** WHOA THERE!!! ***
4473
4474     Your gcc has not been compiled for the exact release of
4475     your operating system ($gccosandvers versus $osname$osvers).
4476
4477     In general it is a good idea to keep gcc synchronized with
4478     the operating system because otherwise serious problems
4479     may ensue when trying to compile software, like Perl.
4480
4481     I'm trying to be optimistic here, though, and will continue.
4482     If later during the configuration and build icky compilation
4483     problems appear (headerfile conflicts being the most common
4484     manifestation), I suggest reinstalling the gcc to match
4485     your operating system release.
4486
4487 EOM
4488       ;;
4489    *) gccosandvers='' ;; # failed to parse, better be silent
4490    esac
4491    ;;
4492 esac
4493 case "$ccname" in
4494 '') ccname="$cc" ;;
4495 esac
4496
4497 # gcc 3.* complain about adding -Idirectories that they already know about,
4498 # so we will take those off from locincpth.
4499 case "$gccversion" in
4500 3*)
4501     echo "main(){}">try.c
4502     for incdir in $locincpth; do
4503        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4504              grep '^c[cp]p*[01]: warning: changing search order '`
4505        if test "X$warn" != X; then
4506            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4507        fi
4508     done
4509     $rm -f try try.*
4510 esac
4511
4512 : What should the include directory be ?
4513 echo " "
4514 $echo $n "Hmm...  $c"
4515 dflt='/usr/include'
4516 incpath=''
4517 mips_type=''
4518 if $test -f /bin/mips && /bin/mips; then
4519         echo "Looks like a MIPS system..."
4520         $cat >usr.c <<'EOCP'
4521 #ifdef SYSTYPE_BSD43
4522 /bsd43
4523 #endif
4524 EOCP
4525         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4526                 dflt='/bsd43/usr/include'
4527                 incpath='/bsd43'
4528                 mips_type='BSD 4.3'
4529         else
4530                 mips_type='System V'
4531         fi
4532         $rm -f usr.c usr.out
4533         echo "and you're compiling with the $mips_type compiler and libraries."
4534         xxx_prompt=y
4535         echo "exit 0" >mips
4536 else
4537         echo "Doesn't look like a MIPS system."
4538         xxx_prompt=n
4539         echo "exit 1" >mips
4540 fi
4541 chmod +x mips
4542 $eunicefix mips
4543 case "$usrinc" in
4544 '') ;;
4545 *) dflt="$usrinc";;
4546 esac
4547 case "$xxx_prompt" in
4548 y)      fn=d/
4549         echo " "
4550         rp='Where are the include files you want to use?'
4551         . ./getfile
4552         usrinc="$ans"
4553         ;;
4554 *)      usrinc="$dflt"
4555         ;;
4556 esac
4557
4558 : see how we invoke the C preprocessor
4559 echo " "
4560 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4561 cat <<'EOT' >testcpp.c
4562 #define ABC abc
4563 #define XYZ xyz
4564 ABC.XYZ
4565 EOT
4566 cd ..
4567 if test ! -f cppstdin; then
4568         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4569                 # AIX cc -E doesn't show the absolute headerfile
4570                 # locations but we'll cheat by using the -M flag.
4571                 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
4572         else
4573                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4574         fi
4575 else
4576         echo "Keeping your $hint cppstdin wrapper."
4577 fi
4578 chmod 755 cppstdin
4579 wrapper=`pwd`/cppstdin
4580 ok='false'
4581 cd UU
4582
4583 if $test "X$cppstdin" != "X" && \
4584         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4585         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4586 then
4587         echo "You used to use $cppstdin $cppminus so we'll use that again."
4588         case "$cpprun" in
4589         '') echo "But let's see if we can live without a wrapper..." ;;
4590         *)
4591                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4592                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4593                 then
4594                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4595                         ok='true'
4596                 else
4597                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4598                 fi
4599                 ;;
4600         esac
4601 else
4602         case "$cppstdin" in
4603         '') ;;
4604         *)
4605                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4606                 ;;
4607         esac
4608 fi
4609
4610 if $ok; then
4611         : nothing
4612 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4613         $cc -E <testcpp.c >testcpp.out 2>&1; \
4614         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4615         echo "Yup, it does."
4616         x_cpp="$cc -E"
4617         x_minus='';
4618 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4619         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4620         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4621         echo "Yup, it does."
4622         x_cpp="$cc -E"
4623         x_minus='-';
4624 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4625         $cc -P <testcpp.c >testcpp.out 2>&1; \
4626         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4627         echo "Yipee, that works!"
4628         x_cpp="$cc -P"
4629         x_minus='';
4630 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4631         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4632         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4633         echo "At long last!"
4634         x_cpp="$cc -P"
4635         x_minus='-';
4636 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4637         $cpp <testcpp.c >testcpp.out 2>&1; \
4638         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4639         echo "It works!"
4640         x_cpp="$cpp"
4641         x_minus='';
4642 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4643         $cpp - <testcpp.c >testcpp.out 2>&1; \
4644         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4645         echo "Hooray, it works!  I was beginning to wonder."
4646         x_cpp="$cpp"
4647         x_minus='-';
4648 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4649         $wrapper <testcpp.c >testcpp.out 2>&1; \
4650         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4651         x_cpp="$wrapper"
4652         x_minus=''
4653         echo "Eureka!"
4654 else
4655         dflt=''
4656         rp="No dice.  I can't find a C preprocessor.  Name one:"
4657         . ./myread
4658         x_cpp="$ans"
4659         x_minus=''
4660         $x_cpp <testcpp.c >testcpp.out 2>&1
4661         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662                 echo "OK, that will do." >&4
4663         else
4664 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4665                 exit 1
4666         fi
4667 fi
4668
4669 case "$ok" in
4670 false)
4671         cppstdin="$x_cpp"
4672         cppminus="$x_minus"
4673         cpprun="$x_cpp"
4674         cpplast="$x_minus"
4675         set X $x_cpp
4676         shift
4677         case "$1" in
4678         "$cpp")
4679                 echo "Perhaps can we force $cc -E using a wrapper..."
4680                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4681                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4682                 then
4683                         echo "Yup, we can."
4684                         cppstdin="$wrapper"
4685                         cppminus='';
4686                 else
4687                         echo "Nope, we'll have to live without it..."
4688                 fi
4689                 ;;
4690         esac
4691         case "$cpprun" in
4692         "$wrapper")
4693                 cpprun=''
4694                 cpplast=''
4695                 ;;
4696         esac
4697         ;;
4698 esac
4699
4700 case "$cppstdin" in
4701 "$wrapper"|'cppstdin') ;;
4702 *) $rm -f $wrapper;;
4703 esac
4704 $rm -f testcpp.c testcpp.out
4705
4706 : Set private lib path
4707 case "$plibpth" in
4708 '') if ./mips; then
4709                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4710         fi;;
4711 esac
4712 case "$libpth" in
4713 ' ') dlist='';;
4714 '') dlist="$loclibpth $plibpth $glibpth";;
4715 *) dlist="$libpth";;
4716 esac
4717
4718 : Now check and see which directories actually exist, avoiding duplicates
4719 libpth=''
4720 for xxx in $dlist
4721 do
4722     if $test -d $xxx; then
4723                 case " $libpth " in
4724                 *" $xxx "*) ;;
4725                 *) libpth="$libpth $xxx";;
4726                 esac
4727     fi
4728 done
4729 $cat <<'EOM'
4730
4731 Some systems have incompatible or broken versions of libraries.  Among
4732 the directories listed in the question below, please remove any you
4733 know not to be holding relevant libraries, and add any that are needed.
4734 Say "none" for none.
4735
4736 EOM
4737 case "$libpth" in
4738 '') dflt='none';;
4739 *)
4740         set X $libpth
4741         shift
4742         dflt=${1+"$@"}
4743         ;;
4744 esac
4745 rp="Directories to use for library searches?"
4746 . ./myread
4747 case "$ans" in
4748 none) libpth=' ';;
4749 *) libpth="$ans";;
4750 esac
4751
4752 : compute shared library extension
4753 case "$so" in
4754 '')
4755         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4756                 dflt='sl'
4757         else
4758                 dflt='so'
4759         fi
4760         ;;
4761 *) dflt="$so";;
4762 esac
4763 $cat <<EOM
4764
4765 On some systems, shared libraries may be available.  Answer 'none' if
4766 you want to suppress searching of shared libraries for the remainder
4767 of this configuration.
4768
4769 EOM
4770 rp='What is the file extension used for shared libraries?'
4771 . ./myread
4772 so="$ans"
4773
4774 : Define several unixisms.
4775 : Hints files or command line option can be used to override them.
4776 : The convoluted testing is in case hints files set either the old
4777 : or the new name.
4778 case "$_exe" in
4779 '')     case "$exe_ext" in
4780         '')     ;;
4781         *)      _exe="$exe_ext" ;;
4782         esac
4783         ;;
4784 esac
4785 case "$_a" in
4786 '')     case "$lib_ext" in
4787     '') _a='.a';;
4788         *)      _a="$lib_ext" ;;
4789         esac
4790         ;;
4791 esac
4792 case "$_o" in
4793 '') case "$obj_ext" in
4794         '')     _o='.o';;
4795         *)      _o="$obj_ext";;
4796         esac
4797         ;;
4798 esac
4799 case "$p_" in
4800 '') case "$path_sep" in
4801         '')     p_=':';;
4802         *)      p_="$path_sep";;
4803         esac
4804         ;;
4805 esac
4806 exe_ext=$_exe
4807 lib_ext=$_a
4808 obj_ext=$_o
4809 path_sep=$p_
4810
4811 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4812
4813 : Which makefile gets called first.  This is used by make depend.
4814 case "$firstmakefile" in
4815 '') firstmakefile='makefile';;
4816 esac
4817
4818 case "$ccflags" in
4819 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4820 esac
4821
4822 case "$uselongdouble" in
4823 $define|true|[yY]*)     dflt='y';;
4824 *) dflt='n';;
4825 esac
4826 cat <<EOM
4827
4828 Perl can be built to take advantage of long doubles which
4829 (if available) may give more accuracy and range for floating point numbers.
4830
4831 If this doesn't make any sense to you, just accept the default '$dflt'.
4832 EOM
4833 rp='Try to use long doubles if available?'
4834 . ./myread
4835 case "$ans" in
4836 y|Y)    val="$define"   ;;
4837 *)      val="$undef"    ;;
4838 esac
4839 set uselongdouble
4840 eval $setvar
4841
4842 case "$uselongdouble" in
4843 true|[yY]*) uselongdouble="$define" ;;
4844 esac
4845
4846 : Look for a hint-file generated 'call-back-unit'.  If the
4847 : user has specified that long doubles should be used,
4848 : we may need to set or change some other defaults.
4849 if $test -f uselongdouble.cbu; then
4850     echo "Your platform has some specific hints regarding long doubles, using them..."
4851     . ./uselongdouble.cbu
4852 else
4853     case "$uselongdouble" in
4854         $define)
4855                 $cat <<EOM
4856 (Your platform does not have any specific hints for long doubles.)
4857 EOM
4858         ;;
4859     esac
4860 fi
4861
4862 : Looking for optional libraries
4863 echo " "
4864 echo "Checking for optional libraries..." >&4
4865 case "$libs" in
4866 ' '|'') dflt='';;
4867 *) dflt="$libs";;
4868 esac
4869 case "$libswanted" in
4870 '') libswanted='c_s';;
4871 esac
4872 case "$usesocks" in
4873 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4874 esac
4875 libsfound=''
4876 libsfiles=''
4877 libsdirs=''
4878 libspath=''
4879 for thisdir in $libpth $xlibpth; do
4880   test -d $thisdir && libspath="$libspath $thisdir"
4881 done
4882 for thislib in $libswanted; do
4883         for thisdir in $libspath; do
4884             xxx=''
4885             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4886                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4887                 $test -f "$xxx" && eval $libscheck
4888                 $test -f "$xxx" && libstyle=shared
4889             fi
4890             if test ! -f "$xxx"; then
4891                 xxx=$thisdir/lib$thislib.$so
4892                 $test -f "$xxx" && eval $libscheck
4893                 $test -f "$xxx" && libstyle=shared
4894             fi  
4895             if test ! -f "$xxx"; then
4896                 xxx=$thisdir/lib$thislib$_a
4897                 $test -f "$xxx" && eval $libscheck
4898                 $test -f "$xxx" && libstyle=static
4899             fi
4900             if test ! -f "$xxx"; then
4901                 xxx=$thisdir/$thislib$_a
4902                 $test -f "$xxx" && eval $libscheck
4903                 $test -f "$xxx" && libstyle=static
4904             fi
4905             if test ! -f "$xxx"; then
4906                 xxx=$thisdir/lib${thislib}_s$_a
4907                 $test -f "$xxx" && eval $libscheck
4908                 $test -f "$xxx" && libstyle=static
4909                 $test -f "$xxx" && thislib=${thislib}_s
4910             fi
4911             if test ! -f "$xxx"; then
4912                 xxx=$thisdir/Slib$thislib$_a
4913                 $test -f "$xxx" && eval $libscheck
4914                 $test -f "$xxx" && libstyle=static
4915             fi
4916             if $test -f "$xxx"; then
4917                 case "$libstyle" in
4918                 shared) echo "Found -l$thislib (shared)." ;;
4919                 static) echo "Found -l$thislib." ;;
4920                 *)      echo "Found -l$thislib ($libstyle)." ;;
4921                 esac
4922                 case " $dflt " in
4923                 *"-l$thislib "*);;
4924                 *) dflt="$dflt -l$thislib"
4925                    libsfound="$libsfound $xxx"
4926                    yyy=`basename $xxx`
4927                    libsfiles="$libsfiles $yyy"
4928                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4929                    case " $libsdirs " in
4930                    *" $yyy "*) ;;
4931                    *) libsdirs="$libsdirs $yyy" ;;
4932                    esac
4933                    ;;
4934                 esac
4935                 break
4936             fi  
4937         done
4938         if $test ! -f "$xxx"; then
4939             echo "No -l$thislib."
4940         fi
4941 done
4942 set X $dflt
4943 shift
4944 dflt="$*"
4945 case "$libs" in
4946 '') dflt="$dflt";;
4947 *) dflt="$libs";;
4948 esac
4949 case "$dflt" in
4950 ' '|'') dflt='none';;
4951 esac
4952
4953 $cat <<EOM
4954
4955 In order to compile $package on your machine, a number of libraries
4956 are usually needed.  Include any other special libraries here as well.
4957 Say "none" for none.  The default list is almost always right.
4958 EOM
4959
4960 echo " "
4961 rp="What libraries to use?"
4962 . ./myread
4963 case "$ans" in
4964 none) libs=' ';;
4965 *) libs="$ans";;
4966 esac
4967
4968 : determine optimization, if desired, or use for debug flag also
4969 case "$optimize" in
4970 ' '|$undef) dflt='none';;
4971 '') dflt='-O';;
4972 *) dflt="$optimize";;
4973 esac
4974 $cat <<EOH
4975
4976 By default, $package compiles with the -O flag to use the optimizer.
4977 Alternately, you might want to use the symbolic debugger, which uses
4978 the -g flag (on traditional Unix systems).  Either flag can be
4979 specified here.  To use neither flag, specify the word "none".
4980
4981 EOH
4982 rp="What optimizer/debugger flag should be used?"
4983 . ./myread
4984 optimize="$ans"
4985 case "$optimize" in
4986 'none') optimize=" ";;
4987 esac
4988
4989 : Check what DEBUGGING is required from the command line
4990 : -DEBUGGING      or -DDEBUGGING or
4991 : -DEBUGGING=both                       = -g + -DDEBUGGING
4992 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4993 : -DEBUGGING=none or -UDEBUGGING        =
4994 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4995 case "$EBUGGING" in
4996 '')     ;;
4997 *)      DEBUGGING=$EBUGGING ;;
4998 esac
4999
5000 case "$DEBUGGING" in
5001 -g|both|$define)
5002     case "$optimize" in
5003         *-g*) ;;
5004         *)    optimize="$optimize -g" ;;
5005     esac ;;
5006 none|$undef)
5007     case "$optimize" in
5008         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5009                 shift
5010                 optimize="$*"
5011                 ;;
5012     esac ;;
5013 esac
5014
5015 dflt=''
5016 case "$DEBUGGING" in
5017 both|$define) dflt='-DDEBUGGING'
5018 esac
5019
5020 : We will not override a previous value, but we might want to
5021 : augment a hint file
5022 case "$hint" in
5023 default|recommended)
5024         case "$gccversion" in
5025         1*) dflt="$dflt -fpcc-struct-return" ;;
5026         esac
5027         case "$optimize:$DEBUGGING" in
5028         *-g*:old) dflt="$dflt -DDEBUGGING";;
5029         esac
5030         case "$gccversion" in
5031         2*) if test -d /etc/conf/kconfig.d &&
5032                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5033                 then
5034                         # Interactive Systems (ISC) POSIX mode.
5035                         dflt="$dflt -posix"
5036                 fi
5037                 ;;
5038         esac
5039         case "$gccversion" in
5040         1*) ;;
5041         2.[0-8]*) ;;
5042         ?*)     echo " "
5043                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5044                 echo 'int main(void) { return 0; }' > gcctest.c
5045                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5046                         echo "Yes, it does." 2>&1
5047                         case "$ccflags" in
5048                         *strict-aliasing*)
5049                                 echo "Leaving current flags $ccflags alone." 2>&1
5050                                 ;;
5051                         *) dflt="$dflt -fno-strict-aliasing" ;;
5052                         esac
5053                 else
5054                         echo "Nope, it doesn't, but that's ok." 2>&1
5055                 fi
5056                 ;;
5057         esac
5058         # For gcc, adding -pipe speeds up compilations for some, but apparently
5059         # some assemblers can't read from stdin.  (It also slows down compilations
5060         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5061         case "$gccversion" in
5062         ?*)     echo " "
5063                 echo "Checking if your compiler accepts -pipe" 2>&1
5064                 echo 'int main(void) { return 0; }' > gcctest.c
5065                 if $cc -pipe -o gcctest gcctest.c; then
5066                         echo "Yes, it does." 2>&1
5067                         case "$ccflags" in
5068                         *-pipe*)
5069                                 echo "Leaving current flags $ccflags alone." 2>&1
5070                                 ;;
5071                         *) dflt="$dflt -pipe" ;;
5072                         esac
5073                 else
5074                         echo "Nope, it doesn't, but that's ok." 2>&1
5075                 fi
5076                 ;;
5077         esac
5078         ;;
5079 esac
5080
5081 case "$mips_type" in
5082 *BSD*|'') inclwanted="$locincpth $usrinc";;
5083 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5084 esac
5085 for thisincl in $inclwanted; do
5086         if $test -d $thisincl; then
5087                 if $test x$thisincl != x$usrinc; then
5088                         case "$dflt" in
5089                         *" -I$thisincl "*);;
5090                         *) dflt="$dflt -I$thisincl ";;
5091                         esac
5092                 fi
5093         fi
5094 done
5095
5096 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5097         xxx=true;
5098 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5099         xxx=true;
5100 else
5101         xxx=false;
5102 fi;
5103 if $xxx; then
5104         case "$dflt" in
5105         *$2*);;
5106         *) dflt="$dflt -D$2";;
5107         esac;
5108 fi'
5109
5110 set signal.h LANGUAGE_C; eval $inctest
5111
5112 case "$usesocks" in
5113 $define)
5114         ccflags="$ccflags -DSOCKS"
5115         ;;
5116 esac
5117
5118 case "$hint" in
5119 default|recommended) dflt="$ccflags $dflt" ;;
5120 *) dflt="$ccflags";;
5121 esac
5122
5123 case "$dflt" in
5124 ''|' ') dflt=none;;
5125 esac
5126
5127 $cat <<EOH
5128
5129 Your C compiler may want other flags.  For this question you should include
5130 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5131 but you should NOT include libraries or ld flags like -lwhatever.  If you
5132 want $package to honor its debug switch, you should include -DDEBUGGING here.
5133 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5134
5135 To use no flags, specify the word "none".
5136
5137 EOH
5138 set X $dflt
5139 shift
5140 dflt=${1+"$@"}
5141 rp="Any additional cc flags?"
5142 . ./myread
5143 case "$ans" in
5144 none) ccflags='';;
5145 *) ccflags="$ans";;
5146 esac
5147
5148 : the following weeds options from ccflags that are of no interest to cpp
5149 case "$cppflags" in
5150 '') cppflags="$ccflags" ;;
5151 *)  cppflags="$cppflags $ccflags" ;;
5152 esac
5153 case "$gccversion" in
5154 1*) cppflags="$cppflags -D__GNUC__"
5155 esac
5156 case "$mips_type" in
5157 '');;
5158 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5159 esac
5160 case "$cppflags" in
5161 '');;
5162 *)
5163         echo " "
5164         echo "Let me guess what the preprocessor flags are..." >&4
5165         set X $cppflags
5166         shift
5167         cppflags=''
5168         $cat >cpp.c <<'EOM'
5169 #define BLURFL foo
5170
5171 BLURFL xx LFRULB
5172 EOM
5173         previous=''
5174         for flag in $*
5175         do
5176                 case "$flag" in
5177                 -*) ftry="$flag";;
5178                 *) ftry="$previous $flag";;
5179                 esac
5180                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5181                         >cpp1.out 2>/dev/null && \
5182                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5183                         >cpp2.out 2>/dev/null && \
5184                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5185                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5186                 then
5187                         cppflags="$cppflags $ftry"
5188                         previous=''
5189                 else
5190                         previous="$flag"
5191                 fi
5192         done
5193         set X $cppflags
5194         shift
5195         cppflags=${1+"$@"}
5196         case "$cppflags" in
5197         *-*)  echo "They appear to be: $cppflags";;
5198         esac
5199         $rm -f cpp.c cpp?.out
5200         ;;
5201 esac
5202
5203 : flags used in final linking phase
5204 case "$ldflags" in
5205 '') if ./venix; then
5206                 dflt='-i -z'
5207         else
5208                 dflt=''
5209         fi
5210         case "$ccflags" in
5211         *-posix*) dflt="$dflt -posix" ;;
5212         esac
5213         ;;
5214 *) dflt="$ldflags";;
5215 esac
5216
5217 : Try to guess additional flags to pick up local libraries.
5218 for thislibdir in $libpth; do
5219         case " $loclibpth " in
5220         *" $thislibdir "*)
5221                 case "$dflt " in
5222                 *"-L$thislibdir "*) ;;
5223                 *)  dflt="$dflt -L$thislibdir" ;;
5224                 esac
5225                 ;;
5226         esac
5227 done
5228
5229 case "$dflt" in
5230 '') dflt='none' ;;
5231 esac
5232
5233 $cat <<EOH
5234
5235 Your C linker may need flags.  For this question you should
5236 include -L/whatever and any other flags used by the C linker, but you
5237 should NOT include libraries like -lwhatever.
5238
5239 Make sure you include the appropriate -L/path flags if your C linker
5240 does not normally search all of the directories you specified above,
5241 namely
5242         $libpth
5243 To use no flags, specify the word "none".
5244
5245 EOH
5246
5247 rp="Any additional ld flags (NOT including libraries)?"
5248 . ./myread
5249 case "$ans" in
5250 none) ldflags='';;
5251 *) ldflags="$ans";;
5252 esac
5253 rmlist="$rmlist pdp11"
5254
5255 : coherency check
5256 echo " "
5257 echo "Checking your choice of C compiler and flags for coherency..." >&4
5258 $cat > try.c <<'EOF'
5259 #include <stdio.h>
5260 int main() { printf("Ok\n"); return(0); }
5261 EOF
5262 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5263 shift
5264 $cat >try.msg <<'EOM'
5265 I've tried to compile and run the following simple program:
5266
5267 EOM
5268 $cat try.c >> try.msg
5269
5270 $cat >> try.msg <<EOM
5271
5272 I used the command:
5273
5274         $*
5275         $run ./try
5276
5277 and I got the following output:
5278
5279 EOM
5280 dflt=y
5281 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5282         if $sh -c "$run ./try" >>try.msg 2>&1; then
5283                 xxx=`$run ./try`
5284                 case "$xxx" in
5285                 "Ok") dflt=n ;;
5286                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5287                         case " $libs " in
5288                         *" -lsfio "*)
5289                                 cat >> try.msg <<'EOQS'
5290 If $libs contains -lsfio, and sfio is mis-configured, then it
5291 sometimes (apparently) runs and exits with a 0 status, but with no
5292 output!  It may have to do with sfio's use of _exit vs. exit.
5293
5294 EOQS
5295                                 rp="You have a big problem.  Shall I abort Configure"
5296                                 dflt=y
5297                                 ;;
5298                         esac
5299                         ;;
5300                 esac
5301         else
5302                 echo "The program compiled OK, but exited with status $?." >>try.msg
5303                 rp="You have a problem.  Shall I abort Configure"
5304                 dflt=y
5305         fi
5306 else
5307         echo "I can't compile the test program." >>try.msg
5308         rp="You have a BIG problem.  Shall I abort Configure"
5309         dflt=y
5310 fi
5311 case "$dflt" in
5312 y)
5313         $cat try.msg >&4
5314         case "$knowitall" in
5315         '')
5316                 echo "(The supplied flags or libraries might be incorrect.)"
5317                 ;;
5318         *) dflt=n;;
5319         esac
5320         echo " "
5321         . ./myread
5322         case "$ans" in
5323         n*|N*) ;;
5324         *)      echo "Ok.  Stopping Configure." >&4
5325                 exit 1
5326                 ;;
5327         esac
5328         ;;
5329 n) echo "OK, that should do.";;
5330 esac
5331 $rm_try
5332
5333 : define a shorthand compile call
5334 compile='
5335 mc_file=$1;
5336 shift;
5337 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5338 : define a shorthand compile call for compilations that should be ok.
5339 compile_ok='
5340 mc_file=$1;
5341 shift;
5342 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5343
5344 : determine filename position in cpp output
5345 echo " "
5346 echo "Computing filename position in cpp output for #include directives..." >&4
5347 case "$osname" in
5348 vos) testaccess=-e ;;
5349 *)   testaccess=-r ;;
5350 esac
5351 echo '#include <stdio.h>' > foo.c
5352 $cat >fieldn <<EOF
5353 $startsh
5354 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5355 $grep '^[       ]*#.*stdio\.h' | \
5356 while read cline; do
5357         pos=1
5358         set \$cline
5359         while $test \$# -gt 0; do
5360                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5361                         echo "\$pos"
5362                         exit 0
5363                 fi
5364                 shift
5365                 pos=\`expr \$pos + 1\`
5366         done
5367 done
5368 EOF
5369 chmod +x fieldn
5370 fieldn=`./fieldn`
5371 $rm -f foo.c fieldn
5372 case $fieldn in
5373 '') pos='???';;
5374 1) pos=first;;
5375 2) pos=second;;
5376 3) pos=third;;
5377 *) pos="${fieldn}th";;
5378 esac
5379 echo "Your cpp writes the filename in the $pos field of the line."
5380
5381 case "$osname" in
5382 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5383 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5384 *)   cppfilter='' ;;
5385 esac
5386 : locate header file
5387 $cat >findhdr <<EOF
5388 $startsh
5389 wanted=\$1
5390 name=''
5391 for usrincdir in $usrinc
5392 do
5393         if test -f \$usrincdir/\$wanted; then
5394                 echo "\$usrincdir/\$wanted"
5395                 exit 0
5396         fi
5397 done
5398 awkprg='{ print \$$fieldn }'
5399 echo "#include <\$wanted>" > foo\$\$.c
5400 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5401 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5402 while read cline; do
5403         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5404         case "\$name" in
5405         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5406         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5407         *) exit 2;;
5408         esac;
5409 done;
5410 #
5411 # status = 0: grep returned 0 lines, case statement not executed
5412 # status = 1: headerfile found
5413 # status = 2: while loop executed, no headerfile found
5414 #
5415 status=\$?
5416 $rm -f foo\$\$.c;
5417 if test \$status -eq 1; then
5418         exit 0;
5419 fi
5420 exit 1
5421 EOF
5422 chmod +x findhdr
5423
5424 : define an alternate in-header-list? function
5425 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5426 cont=true; xxf="echo \"<\$1> found.\" >&4";
5427 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5428 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5429 esac;
5430 case $# in 4) instead=instead;; *) instead="at last";; esac;
5431 while $test "$cont"; do
5432         xxx=`./findhdr $1`
5433         var=$2; eval "was=\$$2";
5434         if $test "$xxx" && $test -r "$xxx";
5435         then eval $xxf;
5436         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5437                 cont="";
5438         else eval $xxnf;
5439         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5440         set $yyy; shift; shift; yyy=$@;
5441         case $# in 0) cont="";;
5442         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5443                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5444         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5445                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5446         esac;
5447 done;
5448 while $test "$yyy";
5449 do set $yyy; var=$2; eval "was=\$$2";
5450         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5451         set $yyy; shift; shift; yyy=$@;
5452 done'
5453
5454 : see if stdlib is available
5455 set stdlib.h i_stdlib
5456 eval $inhdr
5457
5458 : check for lengths of integral types
5459 echo " "
5460 case "$intsize" in
5461 '')
5462         echo "Checking to see how big your integers are..." >&4
5463         $cat >try.c <<EOCP
5464 #include <stdio.h>
5465 #$i_stdlib I_STDLIB
5466 #ifdef I_STDLIB
5467 #include <stdlib.h>
5468 #endif
5469 int main()
5470 {
5471         printf("intsize=%d;\n", (int)sizeof(int));
5472         printf("longsize=%d;\n", (int)sizeof(long));
5473         printf("shortsize=%d;\n", (int)sizeof(short));
5474         exit(0);
5475 }
5476 EOCP
5477         set try
5478         if eval $compile_ok && $run ./try > /dev/null; then
5479                 eval `$run ./try`
5480                 echo "Your integers are $intsize bytes long."
5481                 echo "Your long integers are $longsize bytes long."
5482                 echo "Your short integers are $shortsize bytes long."
5483         else
5484                 $cat >&4 <<EOM
5485 !
5486 Help! I can't compile and run the intsize test program: please enlighten me!
5487 (This is probably a misconfiguration in your system or libraries, and
5488 you really ought to fix it.  Still, I'll try anyway.)
5489 !
5490 EOM
5491                 dflt=4
5492                 rp="What is the size of an integer (in bytes)?"
5493                 . ./myread
5494                 intsize="$ans"
5495                 dflt=$intsize
5496                 rp="What is the size of a long integer (in bytes)?"
5497                 . ./myread
5498                 longsize="$ans"
5499                 dflt=2
5500                 rp="What is the size of a short integer (in bytes)?"
5501                 . ./myread
5502                 shortsize="$ans"
5503         fi
5504         ;;
5505 esac
5506 $rm_try
5507
5508 : check for long long
5509 echo " "
5510 echo "Checking to see if you have long long..." >&4
5511 echo 'int main() { long long x = 7; return 0; }' > try.c
5512 set try
5513 if eval $compile; then
5514         val="$define"
5515         echo "You have long long."
5516 else
5517         val="$undef"
5518         echo "You do not have long long."
5519 fi
5520 $rm_try
5521 set d_longlong
5522 eval $setvar
5523
5524 : check for length of long long
5525 case "${d_longlong}${longlongsize}" in
5526 $define)
5527         echo " "
5528         echo "Checking to see how big your long longs are..." >&4
5529         $cat >try.c <<'EOCP'
5530 #include <stdio.h>
5531 int main()
5532 {
5533     printf("%d\n", (int)sizeof(long long));
5534     return(0);
5535 }
5536 EOCP
5537         set try
5538         if eval $compile_ok; then
5539                 longlongsize=`$run ./try`
5540                 echo "Your long longs are $longlongsize bytes long."
5541         else
5542                 dflt='8'
5543                 echo " "
5544                 echo "(I can't seem to compile the test program.  Guessing...)"
5545                 rp="What is the size of a long long (in bytes)?"
5546                 . ./myread
5547                 longlongsize="$ans"
5548         fi
5549         if $test "X$longsize" = "X$longlongsize"; then
5550                 echo "(That isn't any different from an ordinary long.)"
5551         fi
5552         ;;
5553 esac
5554 $rm_try
5555
5556 : see if inttypes.h is available
5557 : we want a real compile instead of Inhdr because some systems
5558 : have an inttypes.h which includes non-existent headers
5559 echo " "
5560 $cat >try.c <<EOCP
5561 #include <inttypes.h>
5562 int main() {
5563         static int32_t foo32 = 0x12345678;
5564 }
5565 EOCP
5566 set try
5567 if eval $compile; then
5568         echo "<inttypes.h> found." >&4
5569         val="$define"
5570 else
5571         echo "<inttypes.h> NOT found." >&4
5572         val="$undef"
5573 fi
5574 $rm_try
5575 set i_inttypes
5576 eval $setvar
5577
5578 : check for int64_t
5579 echo " "
5580 echo "Checking to see if you have int64_t..." >&4
5581 $cat >try.c <<EOCP
5582 #include <sys/types.h>
5583 #$i_inttypes I_INTTYPES
5584 #ifdef I_INTTYPES
5585 #include <inttypes.h>
5586 #endif
5587 int main() { int64_t x = 7; }
5588 EOCP
5589 set try
5590 if eval $compile; then
5591         val="$define"
5592         echo "You have int64_t."
5593 else
5594         val="$undef"
5595         echo "You do not have int64_t."
5596 fi
5597 $rm_try
5598 set d_int64_t
5599 eval $setvar
5600
5601
5602 echo " "
5603 echo "Checking which 64-bit integer type we could use..." >&4
5604
5605 case "$intsize" in
5606 8) val=int
5607    set quadtype
5608    eval $setvar
5609    val='"unsigned int"'
5610    set uquadtype
5611    eval $setvar
5612    quadkind=1
5613    ;;
5614 *) case "$longsize" in
5615    8) val=long
5616       set quadtype
5617       eval $setvar
5618       val='"unsigned long"'
5619       set uquadtype
5620       eval $setvar
5621       quadkind=2
5622       ;;
5623    *) case "$d_longlong:$longlongsize" in
5624       define:8)
5625         val='"long long"'
5626         set quadtype
5627         eval $setvar
5628         val='"unsigned long long"'
5629         set uquadtype
5630         eval $setvar
5631         quadkind=3
5632         ;;
5633       *) case "$d_int64_t" in
5634          define)
5635            val=int64_t
5636            set quadtype
5637            eval $setvar
5638            val=uint64_t
5639            set uquadtype
5640            eval $setvar
5641            quadkind=4
5642            ;;
5643          esac
5644          ;;
5645       esac
5646       ;;
5647    esac
5648    ;;
5649 esac
5650
5651 case "$quadtype" in
5652 '')     echo "Alas, no 64-bit integer types in sight." >&4
5653         d_quad="$undef"
5654         ;;
5655 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5656         d_quad="$define"
5657         ;;
5658 esac
5659
5660
5661 case "$uselonglong" in
5662 "$define"|true|[yY]*)
5663         cat <<EOM >&4
5664
5665 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5666 EOM
5667         use64bitint="$define"
5668         ;;
5669 esac                          
5670 case "$use64bits" in
5671 "$define"|true|[yY]*)
5672         cat <<EOM >&4
5673
5674 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5675 EOM
5676         use64bitint="$define"
5677         ;;
5678 esac                          
5679 case "$use64bitints" in
5680 "$define"|true|[yY]*)
5681         cat <<EOM >&4
5682
5683 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5684 EOM
5685         use64bitint="$define"
5686         ;;
5687 esac                          
5688 case "$use64bitsint" in
5689 "$define"|true|[yY]*)
5690         cat <<EOM >&4
5691
5692 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5693 EOM
5694         use64bitint="$define"
5695         ;;
5696 esac                          
5697 case "$uselonglongs" in
5698 "$define"|true|[yY]*)
5699         cat <<EOM >&4
5700
5701 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5702 EOM
5703         use64bitint="$define"
5704         ;;
5705 esac                          
5706 case "$use64bitsall" in
5707 "$define"|true|[yY]*)
5708         cat <<EOM >&4
5709
5710 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5711 EOM
5712         use64bitall="$define"
5713         ;;
5714 esac                          
5715
5716 case "$ccflags" in
5717 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5718 esac
5719 case "$use64bitall" in
5720 "$define"|true|[yY]*) use64bitint="$define" ;;
5721 esac
5722
5723 case "$longsize" in
5724 8) cat <<EOM
5725
5726 You have natively 64-bit long integers.
5727 EOM
5728    val="$define"
5729    ;;
5730 *) case "$use64bitint" in
5731    "$define"|true|[yY]*) dflt='y';;
5732    *) dflt='n';;
5733    esac
5734    case "$d_quad" in
5735    "$define") ;;
5736    *) dflt='n' ;;
5737    esac
5738    cat <<EOM
5739
5740 Perl can be built to take advantage of 64-bit integer types
5741 on some systems.  To do so, Configure can be run with -Duse64bitint.
5742 Choosing this option will most probably introduce binary incompatibilities.
5743
5744 If this doesn't make any sense to you, just accept the default '$dflt'.
5745 (The default has been chosen based on your configuration.)
5746 EOM
5747    rp='Try to use 64-bit integers, if available?'
5748    . ./myread
5749    case "$ans" in
5750    [yY]*) val="$define" ;;
5751    *)     val="$undef"  ;;
5752    esac
5753    ;;
5754 esac
5755 set use64bitint
5756 eval $setvar
5757
5758 case "$use64bitall" in
5759 "$define"|true|[yY]*) dflt='y' ;;
5760 *) case "$longsize" in
5761    8) dflt='y' ;;
5762    *) dflt='n' ;;
5763    esac
5764    ;;
5765 esac    
5766 cat <<EOM
5767
5768 You may also choose to try maximal 64-bitness.  It means using as much
5769 64-bitness as possible on the platform.  This in turn means even more
5770 binary incompatibilities.  On the other hand, your platform may not
5771 have any more 64-bitness available than what you already have chosen.
5772
5773 If this doesn't make any sense to you, just accept the default '$dflt'.
5774 (The default has been chosen based on your configuration.)
5775 EOM
5776 rp='Try to use maximal 64-bit support, if available?'
5777 . ./myread
5778 case "$ans" in
5779 [yY]*) val="$define" ;;
5780 *)     val="$undef"  ;;
5781 esac
5782 set use64bitall
5783 eval $setvar
5784 case "$use64bitall" in
5785 "$define")
5786         case "$use64bitint" in
5787         "$undef")
5788                 cat <<EOM
5789
5790 Since you have chosen a maximally 64-bit build, I'm also turning on
5791 the use of 64-bit integers.
5792 EOM
5793                 use64bitint="$define" ;;
5794         esac
5795         ;;
5796 esac
5797
5798 : Look for a hint-file generated 'call-back-unit'.  If the
5799 : user has specified that a 64-bit perl is to be built,
5800 : we may need to set or change some other defaults.
5801 if $test -f use64bitint.cbu; then
5802         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5803         . ./use64bitint.cbu
5804 fi
5805 case "$use64bitint" in
5806 "$define"|true|[yY]*)
5807         case "$longsize" in
5808         4) case "$archname64" in
5809            '') archname64=64int ;;
5810            esac
5811            ;;
5812         esac
5813         ;;
5814 esac
5815
5816 : Look for a hint-file generated 'call-back-unit'.  If the
5817 : user has specified that a maximally 64-bit perl is to be built,
5818 : we may need to set or change some other defaults.
5819 if $test -f use64bitall.cbu; then
5820         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5821         . ./use64bitall.cbu
5822 fi
5823 case "$use64bitall" in
5824 "$define"|true|[yY]*)
5825         case "$longsize" in
5826         4) case "$archname64" in
5827            ''|64int) archname64=64all ;;
5828            esac
5829            ;;
5830         esac
5831         ;;
5832 esac
5833
5834 case "$d_quad:$use64bitint" in
5835 $undef:$define)
5836         cat >&4 <<EOF
5837
5838 *** You have chosen to use 64-bit integers,
5839 *** but none can be found.
5840 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5841 *** Cannot continue, aborting.
5842
5843 EOF
5844         exit 1
5845         ;;
5846 esac
5847
5848 : check for length of double
5849 echo " "
5850 case "$doublesize" in
5851 '')
5852         echo "Checking to see how big your double precision numbers are..." >&4
5853         $cat >try.c <<EOCP
5854 #include <stdio.h>
5855 #$i_stdlib I_STDLIB
5856 #ifdef I_STDLIB
5857 #include <stdlib.h>
5858 #endif
5859 int main()
5860 {
5861     printf("%d\n", (int)sizeof(double));
5862     exit(0);
5863 }
5864 EOCP
5865         set try
5866         if eval $compile_ok; then
5867                 doublesize=`$run ./try`
5868                 echo "Your double is $doublesize bytes long."
5869         else
5870                 dflt='8'
5871                 echo "(I can't seem to compile the test program.  Guessing...)"
5872                 rp="What is the size of a double precision number (in bytes)?"
5873                 . ./myread
5874                 doublesize="$ans"
5875         fi
5876         ;;
5877 esac
5878 $rm_try
5879
5880 : check for long doubles
5881 echo " "
5882 echo "Checking to see if you have long double..." >&4
5883 echo 'int main() { long double x = 7.0; }' > try.c
5884 set try
5885 if eval $compile; then
5886         val="$define"
5887         echo "You have long double."
5888 else
5889         val="$undef"
5890         echo "You do not have long double."
5891 fi
5892 $rm_try
5893 set d_longdbl
5894 eval $setvar
5895
5896 : check for length of long double
5897 case "${d_longdbl}${longdblsize}" in
5898 $define)
5899         echo " "
5900         echo "Checking to see how big your long doubles are..." >&4
5901         $cat >try.c <<'EOCP'
5902 #include <stdio.h>
5903 int main()
5904 {
5905         printf("%d\n", sizeof(long double));
5906 }
5907 EOCP
5908         set try
5909         set try
5910         if eval $compile; then
5911                 longdblsize=`$run ./try`
5912                 echo "Your long doubles are $longdblsize bytes long."
5913         else
5914                 dflt='8'
5915                 echo " "
5916                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5917                 rp="What is the size of a long double (in bytes)?"
5918                 . ./myread
5919                 longdblsize="$ans"
5920         fi
5921         if $test "X$doublesize" = "X$longdblsize"; then
5922                 echo "That isn't any different from an ordinary double."
5923                 echo "I'll keep your setting anyway, but you may see some"
5924                 echo "harmless compilation warnings."
5925         fi
5926         ;;
5927 esac
5928 $rm_try
5929
5930 : determine the architecture name
5931 echo " "
5932 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5933         tarch=`arch`"-$osname"
5934 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5935         if uname -m > tmparch 2>&1 ; then
5936                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5937                         -e 's/$/'"-$osname/" tmparch`
5938         else
5939                 tarch="$osname"
5940         fi
5941         $rm -f tmparch
5942 else
5943         tarch="$osname"
5944 fi
5945 case "$myarchname" in
5946 ''|"$tarch") ;;
5947 *)
5948         echo "(Your architecture name used to be $myarchname.)"
5949         archname=''
5950         ;;
5951 esac
5952 case "$targetarch" in
5953 '') ;;
5954 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5955 esac
5956 myarchname="$tarch"
5957 case "$archname" in
5958 '') dflt="$tarch";;
5959 *) dflt="$archname";;
5960 esac
5961 rp='What is your architecture name'
5962 . ./myread
5963 archname="$ans"
5964 case "$usethreads" in
5965 $define)
5966         echo "Threads selected." >&4
5967         case "$archname" in
5968         *-thread*) echo "...and architecture name already has -thread." >&4
5969                 ;;
5970         *)      archname="$archname-thread"
5971                 echo "...setting architecture name to $archname." >&4
5972                 ;;
5973         esac
5974         ;;
5975 esac
5976 case "$usemultiplicity" in
5977 $define)
5978         echo "Multiplicity selected." >&4
5979         case "$archname" in
5980         *-multi*) echo "...and architecture name already has -multi." >&4
5981                 ;;
5982         *)      archname="$archname-multi"
5983                 echo "...setting architecture name to $archname." >&4
5984                 ;;
5985         esac
5986         ;;
5987 esac
5988 case "$use64bitint$use64bitall" in
5989 *"$define"*)
5990         case "$archname64" in
5991         '')
5992                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5993                 ;;
5994         *)
5995                 case "$use64bitint" in
5996                 "$define") echo "64 bit integers selected." >&4 ;;
5997                 esac
5998                 case "$use64bitall" in
5999                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6000                 esac
6001                 case "$archname" in
6002                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6003                         ;;
6004                 *)      archname="$archname-$archname64"
6005                         echo "...setting architecture name to $archname." >&4
6006                         ;;
6007                 esac
6008                 ;;
6009         esac
6010 esac
6011 case "$uselongdouble" in
6012 $define)
6013         echo "Long doubles selected." >&4
6014         case "$longdblsize" in
6015         $doublesize)
6016                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6017                 ;;
6018         *)
6019                 case "$archname" in
6020                 *-ld*) echo "...and architecture name already has -ld." >&4
6021                         ;;
6022                 *)      archname="$archname-ld"
6023                         echo "...setting architecture name to $archname." >&4
6024                         ;;
6025                 esac
6026                 ;;
6027         esac
6028         ;;
6029 esac
6030 case "$useperlio" in
6031 $define)
6032         echo "Perlio selected." >&4
6033         ;;
6034 *)
6035         echo "Perlio not selected, using stdio." >&4
6036         case "$archname" in
6037         *-stdio*) echo "...and architecture name already has -stdio." >&4
6038                 ;;
6039         *)      archname="$archname-stdio"
6040                 echo "...setting architecture name to $archname." >&4
6041                 ;;
6042         esac
6043         ;;
6044 esac
6045 if $test -f archname.cbu; then
6046         echo "Your platform has some specific hints for architecture name, using them..."
6047         . ./archname.cbu
6048 fi
6049
6050 : set the prefixit variable, to compute a suitable default value
6051 prefixit='case "$3" in
6052 ""|none)
6053         case "$oldprefix" in
6054         "") eval "$1=\"\$$2\"";;
6055         *)
6056                 case "$3" in
6057                 "") eval "$1=";;
6058                 none)
6059                         eval "tp=\"\$$2\"";
6060                         case "$tp" in
6061                         ""|" ") eval "$1=\"\$$2\"";;
6062                         *) eval "$1=";;
6063                         esac;;
6064                 esac;;
6065         esac;;
6066 *)
6067         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6068         case "$tp" in
6069         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6070         /*-$oldprefix/*|\~*-$oldprefix/*)
6071                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6072         *) eval "$1=\"\$$2\"";;
6073         esac;;
6074 esac'
6075
6076 : determine installation style
6077 : For now, try to deduce it from prefix unless it is already set.
6078 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6079 case "$installstyle" in
6080 '')     case "$prefix" in
6081                 *perl*) dflt='lib';;
6082                 *) dflt='lib/perl5' ;;
6083         esac
6084         ;;
6085 *)      dflt="$installstyle" ;;
6086 esac
6087 : Probably not worth prompting for this since we prompt for all
6088 : the directories individually, and the prompt would be too long and
6089 : confusing anyway.
6090 installstyle=$dflt
6091
6092 : determine where public executables go
6093 echo " "
6094 set dflt bin bin
6095 eval $prefixit
6096 fn=d~
6097 rp='Pathname where the public executables will reside?'
6098 . ./getfile
6099 if $test "X$ansexp" != "X$binexp"; then
6100         installbin=''
6101 fi
6102 prefixvar=bin
6103 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6104 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6105 :     this via initialinstalllocation
6106 . ./setprefixvar
6107
6108 case "$userelocatableinc" in
6109 $define|true|[yY]*)     dflt='y' ;;
6110 *)                      dflt='n' ;;
6111 esac
6112 cat <<EOM
6113
6114 Would you like to build Perl so that the installation is relocatable, so that
6115 library paths in @INC are determined relative to the path of the perl binary?
6116 This is not advised for system Perl installs, or if you need to run setid
6117 scripts or scripts under taint mode.
6118
6119 If this doesn't make any sense to you, just accept the default '$dflt'.
6120 EOM
6121 rp='Use relocatable @INC?'
6122 . ./myread
6123 case "$ans" in
6124 y|Y)    val="$define" ;;
6125 *)      val="$undef"  ;;
6126 esac
6127 set userelocatableinc
6128 eval $setvar
6129
6130 initialinstalllocation="$binexp"
6131 : Default prefix is now "up one level from where the binaries are"
6132 case "$userelocatableinc" in
6133 $define|true|[yY]*)
6134     bin=".../"
6135     binexp=".../"
6136     prefix=".../.."
6137     prefixexp=".../.."
6138     installprefixexp=".../.."
6139     ;;
6140 esac
6141
6142 : determine where private library files go
6143 : Usual default is /usr/local/lib/perl5/$version.
6144 : Also allow things like /opt/perl/lib/$version, since
6145 : /opt/perl/lib/perl5... would be redundant.
6146 : The default "style" setting is made in installstyle.U
6147 case "$installstyle" in
6148 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6149 *)       set dflt privlib lib/$version ;;
6150 esac
6151 eval $prefixit
6152 $cat <<EOM
6153
6154 There are some auxiliary files for $package that need to be put into a
6155 private library directory that is accessible by everyone.
6156
6157 EOM
6158 fn=$binexp
6159 fn=d~+
6160 rp='Pathname where the private library files will reside?'
6161 . ./getfile
6162 prefixvar=privlib
6163 . ./setprefixvar
6164
6165 : set the prefixup variable, to restore leading tilda escape
6166 prefixup='case "$prefixexp" in
6167 "$prefix") ;;
6168 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6169 esac'
6170
6171 : determine where public architecture dependent libraries go
6172 set archlib archlib
6173 eval $prefixit
6174 : privlib default is /usr/local/lib/$package/$version
6175 : archlib default is /usr/local/lib/$package/$version/$archname
6176 : privlib may have an optional trailing /share.
6177 tdflt=`echo $privlib | $sed 's,/share$,,'`
6178 tdflt=$tdflt/$archname
6179 case "$archlib" in
6180 '')     dflt=$tdflt
6181         ;;
6182 *)      dflt="$archlib"
6183     ;;
6184 esac
6185 $cat <<EOM
6186
6187 $spackage contains architecture-dependent library files.  If you are
6188 sharing libraries in a heterogeneous environment, you might store
6189 these files in a separate location.  Otherwise, you can just include
6190 them with the rest of the public library files.
6191
6192 EOM
6193 fn=$binexp
6194 fn=d+~
6195 rp='Where do you want to put the public architecture-dependent libraries?'
6196 . ./getfile
6197 prefixvar=archlib
6198 . ./setprefixvar
6199 if $test X"$archlib" = X"$privlib"; then
6200         d_archlib="$undef"
6201 else
6202         d_archlib="$define"
6203 fi
6204
6205 : see if setuid scripts can be secure
6206 $cat <<EOM
6207
6208 Some kernels have a bug that prevents setuid #! scripts from being
6209 secure.  Some sites have disabled setuid #! scripts because of this.
6210
6211 First let's decide if your kernel supports secure setuid #! scripts.
6212 (If setuid #! scripts would be secure but have been disabled anyway,
6213 don't say that they are secure if asked.)
6214
6215 EOM
6216
6217 val="$undef"
6218 if $test -d /dev/fd; then
6219         echo "#!$ls" >reflect
6220         chmod +x,u+s reflect
6221         ./reflect >flect 2>&1
6222         if $contains "/dev/fd" flect >/dev/null; then
6223                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6224                 val="$define"
6225         else
6226                 $cat <<EOM
6227 If you are not sure if they are secure, I can check but I'll need a
6228 username and password different from the one you are using right now.
6229 If you don't have such a username or don't want me to test, simply
6230 enter 'none'.
6231
6232 EOM
6233                 rp='Other username to test security of setuid scripts with?'
6234                 dflt='none'
6235                 . ./myread
6236                 case "$ans" in
6237                 n|none)
6238                         case "$d_suidsafe" in
6239                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6240                                 dflt=n;;
6241                         "$undef")
6242                                 echo "Well, the $hint value is *not* secure." >&4
6243                                 dflt=n;;
6244                         *)      echo "Well, the $hint value *is* secure." >&4
6245                                 dflt=y;;
6246                         esac
6247                         ;;
6248                 *)
6249                         $rm -f reflect flect
6250                         echo "#!$ls" >reflect
6251                         chmod +x,u+s reflect
6252                         echo >flect
6253                         chmod a+w flect
6254                         echo '"su" will (probably) prompt you for '"$ans's password."
6255                         su $ans -c './reflect >flect'
6256                         if $contains "/dev/fd" flect >/dev/null; then
6257                                 echo "Okay, it looks like setuid scripts are secure." >&4
6258                                 dflt=y
6259                         else
6260                                 echo "I don't think setuid scripts are secure." >&4
6261                                 dflt=n
6262                         fi
6263                         ;;
6264                 esac
6265                 rp='Does your kernel have *secure* setuid scripts?'
6266                 . ./myread
6267                 case "$ans" in
6268                 [yY]*)  val="$define";;
6269                 *)      val="$undef";;
6270                 esac
6271         fi
6272 else
6273         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6274         echo "(That's for file descriptors, not floppy disks.)"
6275         val="$undef"
6276 fi
6277 set d_suidsafe
6278 eval $setvar
6279
6280 $rm -f reflect flect
6281
6282 : now see if they want to do setuid emulation
6283 echo " "
6284 val="$undef"
6285 case "$d_suidsafe" in
6286 "$define")
6287         val="$undef"
6288         echo "No need to emulate SUID scripts since they are secure here." >&4
6289         ;;
6290 *)
6291         $cat <<EOM
6292 Some systems have disabled setuid scripts, especially systems where
6293 setuid scripts cannot be secure.  On systems where setuid scripts have
6294 been disabled, the setuid/setgid bits on scripts are currently
6295 useless.  It is possible for $package to detect those bits and emulate
6296 setuid/setgid in a secure fashion.  This emulation will only work if
6297 setuid scripts have been disabled in your kernel.
6298
6299 EOM
6300         case "$d_dosuid" in
6301         "$define") dflt=y ;;
6302         *) dflt=n ;;
6303         esac
6304         rp="Do you want to do setuid/setgid emulation?"
6305         . ./myread
6306         case "$ans" in
6307         [yY]*)  val="$define";;
6308         *)      val="$undef";;
6309         esac
6310         ;;
6311 esac
6312 set d_dosuid
6313 eval $setvar
6314
6315 : Find perl5.005 or later.
6316 echo "Looking for a previously installed perl5.005 or later... "
6317 case "$perl5" in
6318 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6319                 : Check if this perl is recent and can load a simple module
6320                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6321                         perl5=$tdir/perl
6322                         break;
6323                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6324                         perl5=$tdir/perl5
6325                         break;
6326                 fi
6327         done
6328         ;;
6329 *)      perl5="$perl5"
6330         ;;
6331 esac
6332 case "$perl5" in
6333 '')     echo "None found.  That's ok.";;
6334 *)      echo "Using $perl5." ;;
6335 esac
6336
6337 $cat <<EOM
6338
6339 After $package is installed, you may wish to install various
6340 add-on modules and utilities.  Typically, these add-ons will
6341 be installed under $prefix with the rest
6342 of this package.  However, you may wish to install such add-ons
6343 elsewhere under a different prefix.
6344
6345 If you do not wish to put everything under a single prefix, that's
6346 ok.  You will be prompted for the individual locations; this siteprefix
6347 is only used to suggest the defaults.
6348
6349 The default should be fine for most people.
6350
6351 EOM
6352 fn=d~+
6353 rp='Installation prefix to use for add-on modules and utilities?'
6354 : XXX Here might be another good place for an installstyle setting.
6355 case "$siteprefix" in
6356 '') dflt=$prefix ;;
6357 *)  dflt=$siteprefix ;;
6358 esac
6359 . ./getfile
6360 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6361 oldsiteprefix=''
6362 case "$siteprefix" in
6363 '') ;;
6364 *)      case "$ans" in
6365         "$prefix") ;;
6366         *) oldsiteprefix="$prefix";;
6367         esac
6368         ;;
6369 esac
6370 siteprefix="$ans"
6371 siteprefixexp="$ansexp"
6372
6373 : determine where site specific libraries go.
6374 : Usual default is /usr/local/lib/perl5/site_perl/$version
6375 : The default "style" setting is made in installstyle.U
6376 : XXX No longer works with Prefixit stuff.
6377 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6378 case "$sitelib" in
6379 '') case "$installstyle" in
6380         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6381         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6382         esac
6383         ;;
6384 *)      dflt="$sitelib"
6385         ;;
6386 esac
6387 $cat <<EOM
6388
6389 The installation process will create a directory for
6390 site-specific extensions and modules.  Most users find it convenient
6391 to place all site-specific files in this directory rather than in the
6392 main distribution directory.
6393
6394 EOM
6395 fn=d~+
6396 rp='Pathname for the site-specific library files?'
6397 . ./getfile
6398 prefixvar=sitelib
6399 . ./setprefixvar
6400 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6401
6402 : Determine list of previous versions to include in @INC
6403 $cat > getverlist <<EOPL
6404 #!$perl5 -w
6405 use File::Basename;
6406 \$api_versionstring = "$api_versionstring";
6407 \$version = "$version";
6408 \$stem = "$sitelib_stem";
6409 \$archname = "$archname";
6410 EOPL
6411         $cat >> getverlist <<'EOPL'
6412 # The list found is store twice for each entry: the original name, and
6413 # the binary broken down version as pack "sss", so sorting is easy and
6414 # unambiguous. This will work for all versions that have a maximum of
6415 # three digit groups, separate by '.'s or '_'s. Names are extended with
6416 # ".0.0" to ensure at least three elements for the pack.
6417 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6418
6419 # Can't have leading @ because metaconfig interprets it as a command!
6420 ;@inc_version_list=();
6421 # XXX Redo to do opendir/readdir?
6422 if (-d $stem) {
6423     chdir($stem);
6424     ;@candidates = map {
6425         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6426 }
6427 else {
6428     ;@candidates = ();
6429 }
6430
6431 ($pversion, $aversion, $vsn5005) = map {
6432     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6433 foreach $d (@candidates) {
6434     if ($d->[1] lt $pversion) {
6435         if ($d->[1] ge $aversion) {
6436             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6437         }
6438         elsif ($d->[1] ge $vsn5005) {
6439             unshift(@inc_version_list, grep { -d } $d->[0]);
6440         }
6441     }
6442     else {
6443         # Skip newer version.  I.e. don't look in
6444         # 5.7.0 if we're installing 5.6.1.
6445     }
6446 }
6447
6448 if (@inc_version_list) {
6449     print join(' ', @inc_version_list);
6450 }
6451 else {
6452     # Blank space to preserve value for next Configure run.
6453     print " ";
6454 }
6455 EOPL
6456 chmod +x getverlist
6457 case "$inc_version_list" in
6458 '')     if test -x "$perl5$exe_ext"; then
6459                 dflt=`$perl5 getverlist`
6460         else
6461                 dflt='none'
6462         fi
6463         ;;
6464 $undef) dflt='none' ;;
6465 *)  eval dflt=\"$inc_version_list\" ;;
6466 esac
6467 case "$dflt" in
6468 ''|' ') dflt=none ;;
6469 esac
6470 case "$dflt" in
6471 5.005) dflt=none ;;
6472 esac
6473 $cat <<EOM
6474
6475 In order to ease the process of upgrading, this version of perl
6476 can be configured to use modules built and installed with earlier
6477 versions of perl that were installed under $prefix.  Specify here
6478 the list of earlier versions that this version of perl should check.
6479 If Configure detected no earlier versions of perl installed under
6480 $prefix, then the list will be empty.  Answer 'none' to tell perl
6481 to not search earlier versions.
6482
6483 The default should almost always be sensible, so if you're not sure,
6484 just accept the default.
6485 EOM
6486
6487 rp='List of earlier versions to include in @INC?'
6488 . ./myread
6489 case "$ans" in
6490 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6491 *) inc_version_list="$ans" ;;
6492 esac
6493 case "$inc_version_list" in
6494 ''|' ')
6495         inc_version_list_init='0'
6496         d_inc_version_list="$undef"
6497         ;;
6498 *)      inc_version_list_init=`echo $inc_version_list |
6499                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6500         d_inc_version_list="$define"
6501         ;;
6502 esac
6503 $rm -f getverlist
6504
6505 : see if this is a malloc.h system
6506 : we want a real compile instead of Inhdr because some systems have a
6507 : malloc.h that just gives a compile error saying to use stdlib.h instead
6508 echo " "
6509 $cat >try.c <<EOCP
6510 #include <stdlib.h>
6511 #include <malloc.h>
6512 int main () { return 0; }
6513 EOCP
6514 set try
6515 if eval $compile; then
6516     echo "<malloc.h> found." >&4
6517     val="$define"
6518 else
6519     echo "<malloc.h> NOT found." >&4
6520     val="$undef"
6521 fi
6522 $rm_try
6523 set i_malloc
6524 eval $setvar
6525
6526 : check for void type
6527 echo " "
6528 echo "Checking to see how well your C compiler groks the void type..." >&4
6529 case "$voidflags" in
6530 '')
6531         $cat >try.c <<EOCP
6532 #$i_stdlib I_STDLIB
6533 #ifdef I_STDLIB
6534 #include <stdlib.h>
6535 #endif
6536 #if TRY & 1
6537 void sub() {
6538 #else
6539 sub() {
6540 #endif
6541         extern void moo();      /* function returning void */
6542         void (*goo)();          /* ptr to func returning void */
6543 #if TRY & 8
6544         void *hue;              /* generic ptr */
6545 #endif
6546 #if TRY & 2
6547         void (*foo[10])();
6548 #endif
6549
6550 #if TRY & 4
6551         if(goo == moo) {
6552                 exit(0);
6553         }
6554 #endif
6555         exit(0);
6556 }
6557 int main() { sub(); }
6558 EOCP
6559         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6560                 voidflags=$defvoidused
6561         echo "Good.  It appears to support void to the level $package wants.">&4
6562                 if $contains warning .out >/dev/null 2>&1; then
6563                         echo "However, you might get some warnings that look like this:"
6564                         $cat .out
6565                 fi
6566         else
6567 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6568                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6569                         echo "It supports 1..."
6570                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6571                                 echo "It also supports 2..."
6572                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6573                                         voidflags=7
6574                                         echo "And it supports 4 but not 8 definitely."
6575                                 else
6576                                         echo "It doesn't support 4..."
6577                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6578                                                 voidflags=11
6579                                                 echo "But it supports 8."
6580                                         else
6581                                                 voidflags=3
6582                                                 echo "Neither does it support 8."
6583                                         fi
6584                                 fi
6585                         else
6586                                 echo "It does not support 2..."
6587                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6588                                         voidflags=13
6589                                         echo "But it supports 4 and 8."
6590                                 else
6591                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6592                                                 voidflags=5
6593                                                 echo "And it supports 4 but has not heard about 8."
6594                                         else
6595                                                 echo "However it supports 8 but not 4."
6596                                         fi
6597                                 fi
6598                         fi
6599                 else
6600                         echo "There is no support at all for void."
6601                         voidflags=0
6602                 fi
6603         fi
6604 esac
6605 case "$voidflags" in
6606 "$defvoidused") ;;
6607 *)      $cat >&4 <<'EOM'
6608   Support flag bits are:
6609     1: basic void declarations.
6610     2: arrays of pointers to functions returning void.
6611     4: operations between pointers to and addresses of void functions.
6612     8: generic void pointers.
6613 EOM
6614         dflt="$voidflags";
6615         rp="Your void support flags add up to what?"
6616         . ./myread
6617         voidflags="$ans"
6618         ;;
6619 esac
6620 $rm_try
6621
6622 : check for length of pointer
6623 echo " "
6624 case "$ptrsize" in
6625 '')
6626         echo "Checking to see how big your pointers are..." >&4
6627         if test "$voidflags" -gt 7; then
6628                 echo '#define VOID_PTR char *' > try.c
6629         else
6630                 echo '#define VOID_PTR void *' > try.c
6631         fi
6632         $cat >>try.c <<EOCP
6633 #include <stdio.h>
6634 #$i_stdlib I_STDLIB
6635 #ifdef I_STDLIB
6636 #include <stdlib.h>
6637 #endif
6638 int main()
6639 {
6640     printf("%d\n", (int)sizeof(VOID_PTR));
6641     exit(0);
6642 }
6643 EOCP
6644         set try
6645         if eval $compile_ok; then
6646                 ptrsize=`$run ./try`
6647                 echo "Your pointers are $ptrsize bytes long."
6648         else
6649                 dflt='4'
6650                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6651                 rp="What is the size of a pointer (in bytes)?"
6652                 . ./myread
6653                 ptrsize="$ans"
6654         fi
6655         ;;
6656 esac
6657 $rm_try
6658 case "$use64bitall" in
6659 "$define"|true|[yY]*)
6660         case "$ptrsize" in
6661         4)      cat <<EOM >&4
6662
6663 *** You have chosen a maximally 64-bit build,
6664 *** but your pointers are only 4 bytes wide.
6665 *** Please rerun Configure without -Duse64bitall.
6666 EOM
6667                 case "$d_quad" in
6668                 define)
6669                         cat <<EOM >&4
6670 *** Since you have quads, you could possibly try with -Duse64bitint.
6671 EOM
6672                         ;;
6673                 esac
6674                 cat <<EOM >&4
6675 *** Cannot continue, aborting.
6676
6677 EOM
6678
6679                 exit 1
6680                 ;;
6681         esac
6682         ;;
6683 esac
6684
6685
6686 : determine whether to use malloc wrapping
6687 echo " "
6688 case "$usemallocwrap" in
6689 [yY]*|true|$define)     dflt='y' ;;
6690 [nN]*|false|$undef)     dflt='n' ;;
6691 *)      case "$usedevel" in
6692         [yY]*|true|$define)     dflt='y' ;;
6693         *) dflt='n' ;;
6694         esac
6695         ;;
6696 esac
6697 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6698 . ./myread
6699 usemallocwrap="$ans"
6700 case "$ans" in
6701 y*|true)
6702         usemallocwrap="$define" ;;
6703 *)
6704         usemallocwrap="$undef" ;;
6705 esac
6706
6707 : determine which malloc to compile in
6708 echo " "
6709 case "$usemymalloc" in
6710 [yY]*|true|$define)     dflt='y' ;;
6711 [nN]*|false|$undef)     dflt='n' ;;
6712 *)      case "$ptrsize" in
6713         4) dflt='y' ;;
6714         *) dflt='n' ;;
6715         esac
6716         ;;
6717 esac
6718 rp="Do you wish to attempt to use the malloc that comes with $package?"
6719 . ./myread
6720 usemymalloc="$ans"
6721 case "$ans" in
6722 y*|true)
6723         usemymalloc='y'
6724         mallocsrc='malloc.c'
6725         mallocobj="malloc$_o"
6726         d_mymalloc="$define"
6727         case "$libs" in
6728         *-lmalloc*)
6729                 : Remove malloc from list of libraries to use
6730                 echo "Removing unneeded -lmalloc from library list" >&4
6731                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6732                 shift
6733                 libs="$*"
6734                 echo "libs = $libs" >&4
6735                 ;;
6736         esac
6737         ;;
6738 *)
6739         usemymalloc='n'
6740         mallocsrc=''
6741         mallocobj=''
6742         d_mymalloc="$undef"
6743         ;;
6744 esac
6745
6746 : compute the return types of malloc and free
6747 echo " "
6748 $cat >malloc.c <<END
6749 #$i_malloc I_MALLOC
6750 #$i_stdlib I_STDLIB
6751 #include <stdio.h>
6752 #include <sys/types.h>
6753 #ifdef I_MALLOC
6754 #include <malloc.h>
6755 #endif
6756 #ifdef I_STDLIB
6757 #include <stdlib.h>
6758 #endif
6759 #ifdef TRY_MALLOC
6760 void *malloc();
6761 #endif
6762 #ifdef TRY_FREE
6763 void free();
6764 #endif
6765 END
6766 case "$malloctype" in
6767 '')
6768         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6769                 malloctype='void *'
6770         else
6771                 malloctype='char *'
6772         fi
6773         ;;
6774 esac
6775 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6776
6777 case "$freetype" in
6778 '')
6779         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6780                 freetype='void'
6781         else
6782                 freetype='int'
6783         fi
6784         ;;
6785 esac
6786 echo "Your system uses $freetype free(), it would seem." >&4
6787 $rm -f malloc.[co]
6788 : determine where site specific architecture-dependent libraries go.
6789 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6790 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6791 : sitelib may have an optional trailing /share.
6792 case "$sitearch" in
6793 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6794         dflt="$dflt/$archname"
6795         ;;
6796 *)      dflt="$sitearch"
6797         ;;
6798 esac
6799 set sitearch sitearch none
6800 eval $prefixit
6801 $cat <<EOM
6802
6803 The installation process will also create a directory for
6804 architecture-dependent site-specific extensions and modules.
6805
6806 EOM
6807 fn=d~+
6808 rp='Pathname for the site-specific architecture-dependent library files?'
6809 . ./getfile
6810 prefixvar=sitearch
6811 . ./setprefixvar
6812 if $test X"$sitearch" = X"$sitelib"; then
6813         d_sitearch="$undef"
6814 else
6815         d_sitearch="$define"
6816 fi
6817
6818 $cat <<EOM
6819
6820 The installation process will also create a directory for
6821 vendor-supplied add-ons.  Vendors who supply perl with their system
6822 may find it convenient to place all vendor-supplied files in this
6823 directory rather than in the main distribution directory.  This will
6824 ease upgrades between binary-compatible maintenance versions of perl.
6825
6826 Of course you may also use these directories in whatever way you see
6827 fit.  For example, you might use them to access modules shared over a
6828 company-wide network.
6829
6830 The default answer should be fine for most people.
6831 This causes further questions about vendor add-ons to be skipped
6832 and no vendor-specific directories will be configured for perl.
6833
6834 EOM
6835 rp='Do you want to configure vendor-specific add-on directories?'
6836 case "$usevendorprefix" in
6837 define|true|[yY]*) dflt=y ;;
6838 *)      : User may have set vendorprefix directly on Configure command line.
6839         case "$vendorprefix" in
6840         ''|' ') dflt=n ;;
6841         *)      dflt=y ;;
6842         esac
6843         ;;
6844 esac
6845 . ./myread
6846 case "$ans" in
6847 [yY]*)  fn=d~+
6848         rp='Installation prefix to use for vendor-supplied add-ons?'
6849         case "$vendorprefix" in
6850         '') dflt='' ;;
6851         *)  dflt=$vendorprefix ;;
6852         esac
6853         . ./getfile
6854         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6855         oldvendorprefix=''
6856         case "$vendorprefix" in
6857         '') ;;
6858         *)      case "$ans" in
6859                 "$prefix") ;;
6860                 *) oldvendorprefix="$prefix";;
6861                 esac
6862                 ;;
6863         esac
6864         usevendorprefix="$define"
6865         vendorprefix="$ans"
6866         vendorprefixexp="$ansexp"
6867         ;;
6868 *)      usevendorprefix="$undef"
6869         vendorprefix=''
6870         vendorprefixexp=''
6871         ;;
6872 esac
6873
6874 case "$vendorprefix" in
6875 '')     d_vendorlib="$undef"
6876         vendorlib=''
6877         vendorlibexp=''
6878         ;;
6879 *)      d_vendorlib="$define"
6880         : determine where vendor-supplied modules go.
6881         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6882         case "$vendorlib" in
6883         '')
6884                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6885                 case "$installstyle" in
6886                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6887                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6888                 esac
6889                 ;;
6890         *)      dflt="$vendorlib"
6891                 ;;
6892         esac
6893         fn=d~+
6894         rp='Pathname for the vendor-supplied library files?'
6895         . ./getfile
6896         vendorlib="$ans"
6897         vendorlibexp="$ansexp"
6898         ;;
6899 esac
6900 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6901 prefixvar=vendorlib
6902 . ./installprefix
6903
6904 case "$vendorprefix" in
6905 '')     d_vendorarch="$undef"
6906         vendorarch=''
6907         vendorarchexp=''
6908         ;;
6909 *)      d_vendorarch="$define"
6910         : determine where vendor-supplied architecture-dependent libraries go.
6911         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6912         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6913         : vendorlib may have an optional trailing /share.
6914         case "$vendorarch" in
6915         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6916                 dflt="$dflt/$archname"
6917                 ;;
6918         *)      dflt="$vendorarch" ;;
6919         esac
6920         fn=d~+
6921         rp='Pathname for vendor-supplied architecture-dependent files?'
6922         . ./getfile
6923         vendorarch="$ans"
6924         vendorarchexp="$ansexp"
6925         ;;
6926 esac
6927 prefixvar=vendorarch
6928 . ./installprefix
6929
6930 : Final catch-all directories to search
6931 $cat <<EOM
6932
6933 Lastly, you can have perl look in other directories for extensions and
6934 modules in addition to those already specified.
6935 These directories will be searched after 
6936         $sitearch 
6937         $sitelib 
6938 EOM
6939 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6940 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6941 echo ' '
6942 case "$otherlibdirs" in
6943 ''|' ') dflt='none' ;;
6944 *)      dflt="$otherlibdirs" ;;
6945 esac
6946 $cat <<EOM
6947 Enter a colon-separated set of extra paths to include in perl's @INC
6948 search path, or enter 'none' for no extra paths.
6949
6950 EOM
6951
6952 rp='Colon-separated list of additional directories for perl to search?'
6953 . ./myread
6954 case "$ans" in
6955 ' '|''|none)    otherlibdirs=' ' ;;     
6956 *)      otherlibdirs="$ans" ;;
6957 esac
6958 case "$otherlibdirs" in
6959 ' ') val=$undef ;;
6960 *)      val=$define ;;
6961 esac
6962 set d_perl_otherlibdirs
6963 eval $setvar
6964
6965 : Cruising for prototypes
6966 echo " "
6967 echo "Checking out function prototypes..." >&4
6968 $cat >prototype.c <<EOCP
6969 #$i_stdlib I_STDLIB
6970 #ifdef I_STDLIB
6971 #include <stdlib.h>
6972 #endif
6973 int main(int argc, char *argv[]) {
6974         exit(0);}
6975 EOCP
6976 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6977         echo "Your C compiler appears to support function prototypes."
6978         val="$define"
6979 else
6980         echo "Your C compiler doesn't seem to understand function prototypes."
6981         val="$undef"
6982 fi
6983 set prototype
6984 eval $setvar
6985 $rm -f prototype*
6986
6987 case "$prototype" in
6988 "$define") ;;
6989 *)      ansi2knr='ansi2knr'
6990         echo " "
6991         cat <<EOM >&4
6992
6993 $me:  FATAL ERROR:
6994 This version of $package can only be compiled by a compiler that 
6995 understands function prototypes.  Unfortunately, your C compiler 
6996         $cc $ccflags
6997 doesn't seem to understand them.  Sorry about that.
6998
6999 If GNU cc is available for your system, perhaps you could try that instead.  
7000
7001 Eventually, we hope to support building Perl with pre-ANSI compilers.
7002 If you would like to help in that effort, please contact <perlbug@perl.org>.
7003
7004 Aborting Configure now.
7005 EOM
7006         exit 2
7007         ;;
7008 esac
7009
7010 echo " "
7011 case "$extras" in
7012 '') dflt='n';;
7013 *) dflt='y';;
7014 esac
7015 cat <<EOM
7016 Perl can be built with extra modules or bundles of modules which
7017 will be fetched from the CPAN and installed alongside Perl.
7018
7019 Notice that you will need access to the CPAN; either via the Internet,
7020 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7021 be asked later to configure the CPAN.pm module which will in turn do
7022 the installation of the rest of the extra modules or bundles.)
7023
7024 Notice also that if the modules require any external software such as
7025 libraries and headers (the libz library and the zlib.h header for the
7026 Compress::Zlib module, for example) you MUST have any such software
7027 already installed, this configuration process will NOT install such
7028 things for you.
7029
7030 If this doesn't make any sense to you, just accept the default '$dflt'.
7031 EOM
7032 rp='Install any extra modules (y or n)?'
7033 . ./myread
7034 case "$ans" in
7035 y|Y)
7036         cat <<EOM
7037
7038 Please list any extra modules or bundles to be installed from CPAN,
7039 with spaces between the names.  The names can be in any format the
7040 'install' command of CPAN.pm will understand.  (Answer 'none',
7041 without the quotes, to install no extra modules or bundles.)
7042 EOM
7043         rp='Extras?'
7044         dflt="$extras"
7045         . ./myread
7046         extras="$ans"
7047 esac
7048 case "$extras" in
7049 ''|'none')
7050         val=''
7051         $rm -f ../extras.lst
7052         ;;
7053 *)      echo "(Saving the list of extras for later...)"
7054         echo "$extras" > ../extras.lst
7055         val="'$extras'"
7056         ;;
7057 esac
7058 set extras
7059 eval $setvar
7060 echo " "
7061
7062 : determine where html pages for programs go
7063 set html1dir html1dir none
7064 eval $prefixit
7065 $cat <<EOM
7066
7067 If you wish to install html files for programs in $spackage, indicate
7068 the appropriate directory here.  To skip installing html files,
7069 answer "none".
7070 EOM
7071 case "$html1dir" in
7072 ''|none|$undef|' ') dflt=none ;;
7073 *) dflt=$html1dir ;;
7074 esac
7075 fn=dn+~
7076 rp="Directory for the main $spackage html pages?"
7077 . ./getfile
7078 prefixvar=html1dir
7079 . ./setprefixvar
7080 : Use ' ' for none so value is preserved next time through Configure
7081 $test X"$html1dir" = "X" && html1dir=' '
7082
7083 : determine where html pages for libraries and modules go
7084 set html3dir html3dir none
7085 eval $prefixit
7086 $cat <<EOM
7087
7088 If you wish to install html files for modules associated with $spackage,
7089 indicate the appropriate directory here.  To skip installing html files,
7090 answer "none".
7091 EOM
7092 : There is no obvious default.  If they have specified html1dir, then
7093 : try to key off that, possibly changing .../html1 into .../html3.
7094 case "$html3dir" in
7095 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7096 *) dflt=$html3dir ;;
7097 esac
7098 fn=dn+~
7099 rp="Directory for the $spackage module html pages?"
7100 . ./getfile
7101 prefixvar=html3dir
7102 . ./setprefixvar
7103 : Use ' ' for none so value is preserved next time through Configure
7104 $test X"$html3dir" = "X" && html3dir=' '
7105
7106 : determine whether to install perl also as /usr/bin/perl
7107
7108 echo " "
7109 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7110         $cat <<EOM
7111 Many scripts expect perl to be installed as /usr/bin/perl.
7112
7113 If you want to, I can install the perl you are about to compile
7114 as /usr/bin/perl (in addition to $bin/perl).
7115 EOM
7116         if test -f /usr/bin/perl; then
7117             $cat <<EOM
7118
7119 However, please note that because you already have a /usr/bin/perl,
7120 overwriting that with a new Perl would very probably cause problems.
7121 Therefore I'm assuming you don't want to do that (unless you insist).
7122
7123 EOM
7124             case "$installusrbinperl" in
7125             "$define"|[yY]*)    dflt='y';;
7126             *)                  dflt='n';;
7127             esac
7128         else
7129             $cat <<EOM
7130
7131 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7132
7133 EOM
7134             case "$installusrbinperl" in
7135             "$undef"|[nN]*)     dflt='n';;
7136             *)                  dflt='y';;
7137             esac
7138         fi
7139         rp="Do you want to install perl as /usr/bin/perl?"
7140         . ./myread
7141         case "$ans" in
7142         [yY]*)  val="$define";;
7143         *)      val="$undef" ;;
7144         esac
7145 else
7146         val="$undef"
7147 fi
7148 set installusrbinperl
7149 eval $setvar
7150
7151 echo " "
7152 echo "Checking for GNU C Library..." >&4
7153 cat >try.c <<'EOCP'
7154 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7155    alone are insufficient to distinguish different versions, such as
7156    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7157    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7158 */
7159 #include <stdio.h>
7160 int main(void)
7161 {
7162 #ifdef __GLIBC__
7163 #   ifdef __GLIBC_MINOR__
7164 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7165 #           include <gnu/libc-version.h>
7166             printf("%s\n",  gnu_get_libc_version());
7167 #       else
7168             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7169 #       endif
7170 #   else
7171         printf("%d\n",  __GLIBC__);
7172 #   endif
7173     return 0;
7174 #else
7175     return 1;
7176 #endif
7177 }
7178 EOCP
7179 set try
7180 if eval $compile_ok && $run ./try > glibc.ver; then
7181         val="$define"
7182         gnulibc_version=`$cat glibc.ver`
7183         echo "You are using the GNU C Library version $gnulibc_version"
7184 else
7185         val="$undef"
7186         gnulibc_version=''
7187         echo "You are not using the GNU C Library"
7188 fi
7189 $rm_try glibc.ver
7190 set d_gnulibc
7191 eval $setvar
7192
7193 : see if nm is to be used to determine whether a symbol is defined or not
7194 case "$usenm" in
7195 '')
7196         dflt=''
7197         case "$d_gnulibc" in
7198         "$define")
7199                 echo " "
7200                 echo "nm probably won't work on the GNU C Library." >&4
7201                 dflt=n
7202                 ;;
7203         esac
7204         case "$dflt" in
7205         '') 
7206                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7207                         echo " "
7208                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7209                         echo "'nm' won't be sufficient on this sytem." >&4
7210                         dflt=n
7211                 fi
7212                 ;;
7213         esac
7214         case "$dflt" in
7215         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7216                 if $test $dflt -gt 20; then
7217                         dflt=y
7218                 else
7219                         dflt=n
7220                 fi
7221                 ;;
7222         esac
7223         ;;
7224 *)
7225         case "$usenm" in
7226         true|$define) dflt=y;;
7227         *) dflt=n;;
7228         esac
7229         ;;
7230 esac
7231 $cat <<EOM
7232
7233 I can use $nm to extract the symbols from your C libraries. This
7234 is a time consuming task which may generate huge output on the disk (up
7235 to 3 megabytes) but that should make the symbols extraction faster. The
7236 alternative is to skip the 'nm' extraction part and to compile a small
7237 test program instead to determine whether each symbol is present. If
7238 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7239 this may be the best solution.
7240
7241 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7242
7243 EOM
7244 rp="Shall I use $nm to extract C symbols from the libraries?"
7245 . ./myread
7246 case "$ans" in
7247 [Nn]*) usenm=false;;
7248 *) usenm=true;;
7249 esac
7250
7251 runnm=$usenm
7252 case "$reuseval" in
7253 true) runnm=false;;
7254 esac
7255
7256 : nm options which may be necessary
7257 case "$nm_opt" in
7258 '') if $test -f /mach_boot; then
7259                 nm_opt=''       # Mach
7260         elif $test -d /usr/ccs/lib; then
7261                 nm_opt='-p'     # Solaris (and SunOS?)
7262         elif $test -f /dgux; then
7263                 nm_opt='-p'     # DG-UX
7264         elif $test -f /lib64/rld; then
7265                 nm_opt='-p'     # 64-bit Irix
7266         else
7267                 nm_opt=''
7268         fi;;
7269 esac
7270
7271 : nm options which may be necessary for shared libraries but illegal
7272 : for archive libraries.  Thank you, Linux.
7273 case "$nm_so_opt" in
7274 '')     case "$myuname" in
7275         *linux*|gnu*)
7276                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7277                         nm_so_opt='--dynamic'
7278                 fi
7279                 ;;
7280         esac
7281         ;;
7282 esac
7283
7284 case "$runnm" in
7285 true)
7286 : get list of predefined functions in a handy place
7287 echo " "
7288 case "$libc" in
7289 '') libc=unknown
7290         case "$libs" in
7291         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7292         esac
7293         ;;
7294 esac
7295 case "$libs" in
7296 '') ;;
7297 *)  for thislib in $libs; do
7298         case "$thislib" in
7299         -lc|-lc_s)
7300                 : Handle C library specially below.
7301                 ;;
7302         -l*)
7303                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7304                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7305                         :
7306                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7307                         :
7308                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7309                         :
7310                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7311                         :
7312                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7313                         :
7314                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7315                         :
7316                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7317                         :
7318                 else
7319                         try=''
7320                 fi
7321                 libnames="$libnames $try"
7322                 ;;
7323         *) libnames="$libnames $thislib" ;;
7324         esac
7325         done
7326         ;;
7327 esac
7328 xxx=normal
7329 case "$libc" in
7330 unknown)
7331         set /lib/libc.$so
7332         for xxx in $libpth; do
7333                 $test -r $1 || set $xxx/libc.$so
7334                 : The messy sed command sorts on library version numbers.
7335                 $test -r $1 || \
7336                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7337                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7338                                 h
7339                                 s/[0-9][0-9]*/0000&/g
7340                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7341                                 G
7342                                 s/\n/ /' | \
7343                          $sort | $sed -e 's/^.* //'`
7344                 eval set \$$#
7345         done
7346         $test -r $1 || set /usr/ccs/lib/libc.$so
7347         $test -r $1 || set /lib/libsys_s$_a
7348         ;;
7349 *)
7350         set blurfl
7351         ;;
7352 esac
7353 if $test -r "$1"; then
7354         echo "Your (shared) C library seems to be in $1."
7355         libc="$1"
7356 elif $test -r /lib/libc && $test -r /lib/clib; then
7357         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7358         xxx=apollo
7359         libc='/lib/clib /lib/libc'
7360         if $test -r /lib/syslib; then
7361                 echo "(Your math library is in /lib/syslib.)"
7362                 libc="$libc /lib/syslib"
7363         fi
7364 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7365         echo "Your C library seems to be in $libc, as you said before."
7366 elif $test -r $incpath/usr/lib/libc$_a; then
7367         libc=$incpath/usr/lib/libc$_a;
7368         echo "Your C library seems to be in $libc.  That's fine."
7369 elif $test -r /lib/libc$_a; then
7370         libc=/lib/libc$_a;
7371         echo "Your C library seems to be in $libc.  You're normal."
7372 else
7373         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7374                 :
7375         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7376                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7377         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7378                 :
7379         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7380                 :
7381         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7382                 :
7383         else
7384                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7385         fi
7386         if $test -r "$tans"; then
7387                 echo "Your C library seems to be in $tans, of all places."
7388                 libc=$tans
7389         else
7390                 libc='blurfl'
7391         fi
7392 fi
7393 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7394         dflt="$libc"
7395         cat <<EOM
7396
7397 If the guess above is wrong (which it might be if you're using a strange
7398 compiler, or your machine supports multiple models), you can override it here.
7399
7400 EOM
7401 else
7402         dflt=''
7403         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7404         cat >&4 <<EOM
7405 I can't seem to find your C library.  I've looked in the following places:
7406
7407 EOM
7408         $sed 's/^/      /' libpath
7409         cat <<EOM
7410
7411 None of these seems to contain your C library. I need to get its name...
7412
7413 EOM
7414 fi
7415 fn=f
7416 rp='Where is your C library?'
7417 . ./getfile
7418 libc="$ans"
7419
7420 echo " "
7421 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7422 set X `cat libnames`
7423 shift
7424 xxx=files
7425 case $# in 1) xxx=file; esac
7426 echo "Extracting names from the following $xxx for later perusal:" >&4
7427 echo " "
7428 $sed 's/^/      /' libnames >&4
7429 echo " "
7430 $echo $n "This may take a while...$c" >&4
7431
7432 for file in $*; do
7433         case $file in
7434         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7435         *) $nm $nm_opt $file 2>/dev/null;;
7436         esac
7437 done >libc.tmp
7438
7439 $echo $n ".$c"
7440 $grep fprintf libc.tmp > libc.ptf
7441 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7442 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7443 xxx='[ADTSIW]'
7444 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7445         eval $xscan;\
7446         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7447                 eval $xrun
7448 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7449         eval $xscan;\
7450         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7451                 eval $xrun
7452 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7453         eval $xscan;\
7454         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7455                 eval $xrun
7456 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7457         eval $xscan;\
7458         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7459                 eval $xrun
7460 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7461         eval $xscan;\
7462         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7463                 eval $xrun
7464 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7465         eval $xscan;\
7466         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7467                 eval $xrun
7468 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7469                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7470         eval $xscan;\
7471         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7472                 eval $xrun
7473 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7474         eval $xscan;\
7475         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7476                 eval $xrun
7477 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7478         eval $xscan;\
7479         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7480                 eval $xrun
7481 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7482         eval $xscan;\
7483         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7484                 eval $xrun
7485 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7486         eval $xscan;\
7487         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7488                 eval $xrun
7489 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7490         eval $xscan;\
7491         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7492                 eval $xrun
7493 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7494         eval $xscan;\
7495         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7496                 eval $xrun
7497 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7498         eval $xscan;\
7499         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7500                 eval $xrun
7501 else
7502         $nm -p $* 2>/dev/null >libc.tmp
7503         $grep fprintf libc.tmp > libc.ptf
7504         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7505                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7506         then
7507                 nm_opt='-p'
7508                 eval $xrun
7509         else
7510                 echo " "
7511                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7512                 com=''
7513                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7514                         for thisname in $libnames $libc; do
7515                                 $ar t $thisname >>libc.tmp
7516                         done
7517                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7518                         echo "Ok." >&4
7519                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7520                         # Repeat libc to extract forwarders to DLL entries too
7521                         for thisname in $libnames $libc; do
7522                                 $ar tv $thisname >>libc.tmp
7523                                 # Revision 50 of EMX has bug in $ar.
7524                                 # it will not extract forwarders to DLL entries
7525                                 # Use emximp which will extract exactly them.
7526                                 emximp -o tmp.imp $thisname \
7527                                     2>/dev/null && \
7528                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7529                                     < tmp.imp >>libc.tmp
7530                                 $rm tmp.imp
7531                         done
7532                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7533                         echo "Ok." >&4
7534                 else
7535                         echo "$ar didn't seem to work right." >&4
7536                         echo "Maybe this is a Cray...trying bld instead..." >&4
7537                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7538                         then
7539                                 for thisname in $libnames; do
7540                                         bld t $libnames | \
7541                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7542                                         $ar t $thisname >>libc.tmp
7543                                 done
7544                                 echo "Ok." >&4
7545                         else
7546                                 echo "That didn't work either.  Giving up." >&4
7547                                 exit 1
7548                         fi
7549                 fi
7550         fi
7551 fi
7552 nm_extract="$com"
7553 case "$PASE" in
7554 define)
7555     echo " "
7556     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7557     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7558     ;;
7559 *)  if $test -f /lib/syscalls.exp; then
7560         echo " "
7561         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7562         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7563     fi
7564     ;;
7565 esac
7566 ;;
7567 esac
7568 $rm -f libnames libpath
7569
7570 : see if dld is available
7571 set dld.h i_dld
7572 eval $inhdr
7573
7574
7575 echo " "
7576 echo "Checking for C++..." >&4
7577 cat >try.c <<'EOCP'
7578 #include <stdio.h>
7579 int main(void)
7580 {
7581 #ifdef __cplusplus
7582     printf("define\n");
7583 #else
7584     printf("undef\n");
7585 #endif
7586     return 0;
7587 }
7588 EOCP
7589 set try
7590 if eval $compile_ok && $run ./try >cplusplus$$; then
7591         val=`$cat cplusplus$$`
7592         echo "You are using a C++ compiler."
7593 else
7594         val="$undef"
7595         echo "You are not using a C++ compiler."
7596 fi
7597 $rm_try cplusplus$$
7598 set d_cplusplus
7599 eval $setvar
7600
7601 : is a C symbol defined?
7602 csym='tlook=$1;
7603 case "$3" in
7604 -v) tf=libc.tmp; tdc="";;
7605 -a) tf=libc.tmp; tdc="[]";;
7606 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7607 esac;
7608 tx=yes;
7609 case "$reuseval-$4" in
7610 true-) ;;
7611 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7612 esac;
7613 case "$tx" in
7614 yes)
7615         tval=false;
7616         case "$d_cplusplus" in
7617                 $define) extern_C=\"C\";;
7618         esac;
7619         if $test "$runnm" = true; then
7620                 if $contains $tlook $tf >/dev/null 2>&1; then
7621                         tval=true;
7622                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7623                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7624                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7625                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7626                         $rm_try;
7627                 fi;
7628         else
7629                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7630                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7631                 $rm_try;
7632         fi;
7633         ;;
7634 *)
7635         case "$tval" in
7636         $define) tval=true;;
7637         *) tval=false;;
7638         esac;
7639         ;;
7640 esac;
7641 eval "$2=$tval"'
7642
7643 : define an is-in-libc? function
7644 inlibc='echo " "; td=$define; tu=$undef;
7645 sym=$1; var=$2; eval "was=\$$2";
7646 tx=yes;
7647 case "$reuseval$was" in
7648 true) ;;
7649 true*) tx=no;;
7650 esac;
7651 case "$tx" in
7652 yes)
7653         set $sym tres -f;
7654         eval $csym;
7655         case "$tres" in
7656         true)
7657                 echo "$sym() found." >&4;
7658                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7659         *)
7660                 echo "$sym() NOT found." >&4;
7661                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7662         esac;;
7663 *)
7664         case "$was" in
7665         $define) echo "$sym() found." >&4;;
7666         *) echo "$sym() NOT found." >&4;;
7667         esac;;
7668 esac'
7669
7670 : see if dlopen exists
7671 xxx_runnm="$runnm"
7672 xxx_ccflags="$ccflags"
7673 runnm=false
7674 : with g++ one needs -shared to get is-in-libc to work for dlopen
7675 case "$gccversion" in
7676 '')     ;;
7677 *)      case "$d_cplusplus" in
7678         "$define") ccflags="$ccflags -shared" ;;
7679         esac
7680         ;;
7681 esac
7682 set dlopen d_dlopen
7683 eval $inlibc
7684 runnm="$xxx_runnm"
7685 ccflags="$xxx_ccflags"
7686
7687 : see if this is a unistd.h system
7688 set unistd.h i_unistd
7689 eval $inhdr
7690
7691 : determine which dynamic loading, if any, to compile in
7692 echo " "
7693 dldir="ext/DynaLoader"
7694 case "$usedl" in
7695 $define|y|true)
7696         dflt='y'
7697         usedl="$define"
7698         ;;
7699 $undef|n|false)
7700         dflt='n'
7701         usedl="$undef"
7702         ;;
7703 *)
7704         dflt='n'
7705         case "$d_dlopen" in
7706             $define) dflt='y' ;;
7707         esac
7708         case "$i_dld" in
7709             $define) dflt='y' ;;
7710         esac
7711         : Does a dl_xxx.xs file exist for this operating system
7712         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7713         ;;
7714 esac
7715 rp="Do you wish to use dynamic loading?"
7716 . ./myread
7717 usedl="$ans"
7718 case "$ans" in
7719 y*) usedl="$define"
7720         case "$dlsrc" in
7721         '')
7722                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7723                         dflt="$dldir/dl_${osname}.xs"
7724                 elif $test "$d_dlopen" = "$define" ; then
7725                         dflt="$dldir/dl_dlopen.xs"
7726                 elif $test "$i_dld" = "$define" ; then
7727                         dflt="$dldir/dl_dld.xs"
7728                 else
7729                         dflt=''
7730                 fi
7731                 ;;
7732         *)      dflt="$dldir/$dlsrc"
7733                 ;;
7734         esac
7735     echo "The following dynamic loading files are available:"
7736         : Can not go over to $dldir because getfile has path hard-coded in.
7737         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7738         rp="Source file to use for dynamic loading"
7739         fn="fne"
7740         gfpth="$src"
7741         . ./getfile
7742         usedl="$define"
7743         : emulate basename
7744         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7745
7746         $cat << EOM
7747
7748 Some systems may require passing special flags to $cc -c to
7749 compile modules that will be used to create a shared library.
7750 To use no flags, say "none".
7751
7752 EOM
7753     case "$cccdlflags" in
7754     '') case "$gccversion" in
7755                 '') case "$osname" in
7756                         hpux)   dflt='+z' ;;
7757                         next)   dflt='none' ;;
7758                         irix*)  dflt='-KPIC' ;;
7759                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7760                         sunos)  dflt='-pic' ;;
7761                         *)      dflt='none' ;;
7762                     esac
7763                         ;;
7764                 *)  case "$osname" in
7765                         darwin) dflt='none' ;;
7766                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7767                         *)      dflt='-fpic' ;;
7768                     esac ;;
7769             esac ;;
7770         ' ') dflt='none' ;;
7771     *)  dflt="$cccdlflags" ;;
7772     esac
7773     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7774     . ./myread
7775     case "$ans" in
7776     none) cccdlflags=' ' ;;
7777     *) cccdlflags="$ans" ;;
7778     esac
7779
7780     cat << EOM
7781
7782 Some systems use ld to create libraries that can be dynamically loaded,
7783 while other systems (such as those using ELF) use $cc.
7784
7785 EOM
7786         case "$ld" in
7787         '')     $cat >try.c <<EOM
7788 /* Test for whether ELF binaries are produced */
7789 #include <fcntl.h>
7790 #$i_stdlib I_STDLIB
7791 #ifdef I_STDLIB
7792 #include <stdlib.h>
7793 #endif
7794 #$i_unistd I_UNISTD
7795 #ifdef I_UNISTD
7796 #include <unistd.h>
7797 #endif
7798 int main() {
7799         char b[4];
7800         int i = open("a.out",O_RDONLY);
7801         if(i == -1)
7802                 exit(1); /* fail */
7803         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7804                 exit(0); /* succeed (yes, it's ELF) */
7805         else
7806                 exit(1); /* fail */
7807 }
7808 EOM
7809                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7810                         cat <<EOM
7811 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7812 EOM
7813                         dflt="$cc"
7814                 else
7815                         echo "I'll use ld to build dynamic libraries."
7816                         dflt='ld'
7817                 fi
7818                 $rm_try
7819                 ;;
7820         *)      dflt="$ld"
7821                 ;;
7822         esac
7823
7824     rp="What command should be used to create dynamic libraries?"
7825     . ./myread
7826         ld="$ans"
7827
7828     cat << EOM
7829
7830 Some systems may require passing special flags to $ld to create a
7831 library that can be dynamically loaded.  If your ld flags include
7832 -L/other/path options to locate libraries outside your loader's normal
7833 search path, you may need to specify those -L options here as well.  To
7834 use no flags, say "none".
7835
7836 EOM
7837     case "$lddlflags" in
7838     '') case "$osname" in
7839                         beos) dflt='-nostart' ;;
7840                         hpux) dflt='-b';
7841                               case "$gccversion" in
7842                               '') dflt="$dflt +vnocompatwarnings" ;;
7843                               esac
7844                               ;;
7845                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7846                         next)  dflt='none' ;;
7847                         solaris) dflt='-G' ;;
7848                         sunos) dflt='-assert nodefinitions' ;;
7849                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7850                 *)     dflt='none' ;;
7851                         esac
7852                         ;;
7853     *) dflt="$lddlflags" ;;
7854     esac
7855
7856         : Try to guess additional flags to pick up local libraries.
7857         : Be careful not to append to a plain 'none'
7858         case "$dflt" in
7859         none) dflt='' ;;
7860         esac
7861         for thisflag in $ldflags; do
7862                 case "$thisflag" in
7863                 -L*|-R*|-Wl,-R*)
7864                         case " $dflt " in
7865                         *" $thisflag "*) ;;
7866                         *) dflt="$dflt $thisflag" ;;
7867                         esac
7868                         ;;
7869                 esac
7870         done
7871
7872         case "$dflt" in
7873         ''|' ') dflt='none' ;;
7874         esac
7875
7876     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7877     . ./myread
7878     case "$ans" in
7879     none) lddlflags=' ' ;;
7880     *) lddlflags="$ans" ;;
7881     esac
7882
7883         cat <<EOM
7884
7885 Some systems may require passing special flags to $cc to indicate that
7886 the resulting executable will use dynamic linking.  To use no flags,
7887 say "none".
7888
7889 EOM
7890     case "$ccdlflags" in
7891     '') case "$osname" in
7892             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7893             next|sunos) dflt='none' ;;
7894             *)          dflt='none' ;;
7895             esac ;;
7896     ' ')  dflt='none' ;;
7897     *)  dflt="$ccdlflags" ;;
7898     esac
7899     rp="Any special flags to pass to $cc to use dynamic linking?"
7900     . ./myread
7901     case "$ans" in
7902     none) ccdlflags=' ' ;;
7903     *) ccdlflags="$ans" ;;
7904     esac
7905     ;;
7906 *)  usedl="$undef"
7907         ld='ld'
7908     dlsrc='dl_none.xs'
7909     lddlflags=''
7910     ccdlflags=''
7911     ;;
7912 esac
7913
7914 also=''
7915 case "$usedl" in
7916 $undef)
7917         # No dynamic loading being used, so don't bother even to prompt.
7918         useshrplib='false'
7919         ;;
7920 *)      case "$useshrplib" in
7921         '')     case "$osname" in
7922                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7923                         dflt=y
7924                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7925                         ;;
7926                 next*)
7927                         case "$osvers" in
7928                         4*)     dflt=y
7929                                 also='Building a shared libperl is needed for MAB support.'
7930                                 ;;
7931                         *)      dflt=n
7932                                 ;;
7933                         esac
7934                         ;;
7935                 *)      dflt=n
7936                         ;;
7937                 esac
7938                 ;;
7939         $define|true|[Yy]*)
7940                 dflt=y
7941                 ;;
7942         *)      dflt=n
7943                 ;;
7944         esac
7945         $cat << EOM
7946
7947 The perl executable is normally obtained by linking perlmain.c with
7948 libperl${_a}, any static extensions (usually just DynaLoader), and
7949 any other libraries needed on this system (such as -lm, etc.).  Since
7950 your system supports dynamic loading, it is probably possible to build
7951 a shared libperl.$so.  If you will have more than one executable linked
7952 to libperl.$so, this will significantly reduce the size of each
7953 executable, but it may have a noticeable effect on performance.  The
7954 default is probably sensible for your system.
7955 $also
7956
7957 EOM
7958         rp="Build a shared libperl.$so (y/n)"
7959         . ./myread
7960         case "$ans" in
7961         true|$define|[Yy]*)
7962                 useshrplib='true'  ;;
7963         *)      useshrplib='false' ;;
7964         esac
7965         ;;
7966 esac
7967
7968 case "$useshrplib" in
7969 true)
7970         case "$libperl" in
7971         '')
7972                 # Figure out a good name for libperl.so.  Since it gets stored in
7973                 # a version-specific architecture-dependent library, the version
7974                 # number isn't really that important, except for making cc/ld happy.
7975                 #
7976                 # A name such as libperl.so.3.1
7977                 majmin="libperl.$so.$patchlevel.$subversion"
7978                 # A name such as libperl.so.301
7979                 majonly=`echo $patchlevel $subversion |
7980                         $awk '{printf "%d%02d", $1, $2}'`
7981                 majonly=libperl.$so.$majonly
7982                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7983                 # rely on figuring it out from the naming of libc.
7984                 case "${osname}${osvers}" in
7985                 next4*)
7986                         dflt=libperl.5.$so
7987                         # XXX How handle the --version stuff for MAB?
7988                         ;;
7989                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7990                         dflt=libperl.$so
7991                         ;;
7992                 cygwin*) # ld links against an importlib
7993                         dflt=libperl$lib_ext
7994                         ;;
7995                 *)      # Try to guess based on whether libc has major.minor.
7996                         case "$libc" in
7997                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7998                         *libc.$so.[0-9]*) dflt=$majonly ;;
7999                         *)      dflt=libperl.$so ;;
8000                         esac
8001                         ;;
8002                 esac
8003                 ;;
8004         *)      dflt=$libperl
8005                 ;;
8006         esac
8007         cat << EOM
8008
8009 I need to select a good name for the shared libperl.  If your system uses
8010 library names with major and minor numbers, then you might want something
8011 like $majmin.  Alternatively, if your system uses a single version
8012 number for shared libraries, then you might want to use $majonly.
8013 Or, your system might be quite happy with a simple libperl.$so.
8014
8015 Since the shared libperl will get installed into a version-specific
8016 architecture-dependent directory, the version number of the shared perl
8017 library probably isn't important, so the default should be o.k.
8018
8019 EOM
8020         rp='What name do you want to give to the shared libperl?'
8021         . ./myread
8022         libperl=$ans
8023         echo "Ok, I'll use $libperl"
8024         ;;
8025 *)
8026         libperl="libperl${_a}"
8027         ;;
8028 esac
8029
8030 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8031 case "$shrpdir" in
8032 '') ;;
8033 *)      $cat >&4 <<EOM
8034 WARNING:  Use of the shrpdir variable for the installation location of
8035 the shared $libperl is not supported.  It was never documented and
8036 will not work in this version.  Let me (perlbug@perl.org)
8037 know of any problems this may cause.
8038
8039 EOM
8040         case "$shrpdir" in
8041         "$archlibexp/CORE")
8042                 $cat >&4 <<EOM
8043 But your current setting of $shrpdir is
8044 the default anyway, so it's harmless.
8045 EOM
8046                 ;;
8047         *)
8048                 $cat >&4 <<EOM
8049 Further, your current attempted setting of $shrpdir
8050 conflicts with the value of $archlibexp/CORE
8051 that installperl will use.
8052 EOM
8053                 ;;
8054         esac
8055         ;;
8056 esac
8057
8058 # How will the perl executable find the installed shared $libperl?
8059 # Add $xxx to ccdlflags.
8060 # If we can't figure out a command-line option, use $shrpenv to
8061 # set env LD_RUN_PATH.  The main perl makefile uses this.
8062 shrpdir=$archlibexp/CORE
8063 xxx=''
8064 tmp_shrpenv=''
8065 if "$useshrplib"; then
8066     case "$osname" in 
8067         aix)
8068                 # We'll set it in Makefile.SH...
8069                 ;;
8070         solaris)
8071                 xxx="-R $shrpdir"
8072                 ;;
8073         freebsd|netbsd|openbsd|interix|dragonfly)
8074                 xxx="-Wl,-R$shrpdir"
8075                 ;;
8076         bsdos|linux|irix*|dec_osf|gnu*)
8077                 xxx="-Wl,-rpath,$shrpdir"
8078                 ;;
8079         next)
8080                 # next doesn't like the default...
8081                 ;;
8082         beos)
8083                 # beos doesn't like the default, either.
8084                 ;;
8085         hpux*)
8086                 # hpux doesn't like the default, either.
8087                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8088                 ;;
8089         *)
8090                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8091                 ;;
8092         esac
8093         case "$xxx" in
8094         '') ;;
8095         *)      
8096                 # Only add $xxx if it isn't already in ccdlflags.
8097                 case " $ccdlflags " in
8098                 *" $xxx "*)     ;;
8099                 *)      ccdlflags="$ccdlflags $xxx"
8100                         cat <<EOM >&4
8101
8102 Adding $xxx to the flags
8103 passed to $ld so that the perl executable will find the 
8104 installed shared $libperl.
8105
8106 EOM
8107                         ;;
8108                 esac
8109                 ;;
8110         esac
8111 fi
8112 # Fix ccdlflags in AIX for building external extensions.
8113 # (For building Perl itself bare -bE:perl.exp is needed,
8114 #  Makefile.SH takes care of this.)
8115 case "$osname" in
8116 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8117 esac
8118 # Respect a hint or command-line value.
8119 case "$shrpenv" in
8120 '') shrpenv="$tmp_shrpenv" ;;
8121 esac
8122 case "$ldlibpthname" in
8123 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8124 none)   ldlibpthname='' ;;
8125 esac
8126
8127 : determine where manual pages are on this system
8128 echo " "
8129 case "$sysman" in
8130 '') 
8131         syspath='/usr/share/man/man1 /usr/man/man1'
8132         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8133         syspath="$syspath /usr/man/u_man/man1"
8134         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8135         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8136         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8137         sysman=`./loc . /usr/man/man1 $syspath`
8138         ;;
8139 esac
8140 if $test -d "$sysman"; then
8141         echo "System manual is in $sysman." >&4
8142 else
8143         echo "Could not find manual pages in source form." >&4
8144 fi
8145
8146 : determine where manual pages go
8147 set man1dir man1dir none
8148 eval $prefixit
8149 $cat <<EOM
8150
8151 $spackage has manual pages available in source form.
8152 EOM
8153 case "$nroff" in
8154 nroff)
8155         echo "However, you don't have nroff, so they're probably useless to you."
8156         case "$man1dir" in
8157         '') man1dir="none";;
8158         esac;;
8159 esac
8160 echo "If you don't want the manual sources installed, answer 'none'."
8161 case "$man1dir" in
8162 ' ') dflt=none
8163         ;;
8164 '')
8165         lookpath="$prefixexp/share/man/man1"
8166         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8167         lookpath="$lookpath $prefixexp/man/p_man/man1"
8168         lookpath="$lookpath $prefixexp/man/u_man/man1"
8169         lookpath="$lookpath $prefixexp/man/man.1"
8170         case "$sysman" in
8171         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8172         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8173         esac
8174         set dflt
8175         eval $prefixup
8176         ;;
8177 *)  dflt="$man1dir"
8178         ;;
8179 esac
8180 echo " "
8181 fn=dn+~
8182 rp="Where do the main $spackage manual pages (source) go?"
8183 . ./getfile
8184 if $test "X$man1direxp" != "X$ansexp"; then
8185         installman1dir=''
8186 fi
8187 prefixvar=man1dir
8188 . ./setprefixvar
8189
8190 case "$man1dir" in
8191 '')     man1dir=' '
8192         installman1dir='';;
8193 esac
8194
8195 : What suffix to use on installed man pages
8196
8197 case "$man1dir" in
8198 ' ')
8199         man1ext='0'
8200         ;;
8201 *)
8202         rp="What suffix should be used for the main $spackage man pages?"
8203         case "$man1ext" in
8204         '')     case "$man1dir" in
8205                 *1)  dflt=1 ;;
8206                 *1p) dflt=1p ;;
8207                 *1pm) dflt=1pm ;;
8208                 *l) dflt=l;;
8209                 *n) dflt=n;;
8210                 *o) dflt=o;;
8211                 *p) dflt=p;;
8212                 *C) dflt=C;;
8213                 *L) dflt=L;;
8214                 *L1) dflt=L1;;
8215                 *) dflt=1;;
8216                 esac
8217                 ;;
8218         *)      dflt="$man1ext";;
8219         esac
8220         . ./myread
8221         man1ext="$ans"
8222         ;;
8223 esac
8224
8225 : see if we can have long filenames
8226 echo " "
8227 first=123456789abcdef
8228 $rm -f $first
8229 if (echo hi >$first) 2>/dev/null; then
8230         if $test -f 123456789abcde; then
8231                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8232                 val="$undef"
8233         else
8234                 echo 'You can have filenames longer than 14 characters.'>&4
8235                 val="$define"
8236         fi
8237 else
8238         $cat <<'EOM'
8239 You can't have filenames longer than 14 chars.
8240 You can't even think about them!
8241 EOM
8242         val="$undef"
8243 fi 
8244 set d_flexfnam
8245 eval $setvar
8246 $rm -rf 123456789abcde*
8247
8248 : determine where library module manual pages go
8249 set man3dir man3dir none
8250 eval $prefixit
8251 $cat <<EOM
8252
8253 $spackage has manual pages for many of the library modules.
8254 EOM
8255
8256 case "$nroff" in
8257 nroff)
8258         $cat <<'EOM'
8259 However, you don't have nroff, so they're probably useless to you.
8260 EOM
8261         case "$man3dir" in
8262         '') man3dir="none";;
8263         esac;;
8264 esac
8265
8266 case "$d_flexfnam" in
8267 undef)
8268         $cat <<'EOM'
8269 However, your system can't handle the long file names like File::Basename.3.
8270 EOM
8271         case "$man3dir" in
8272         '') man3dir="none";;
8273         esac;;
8274 esac
8275
8276 echo "If you don't want the manual sources installed, answer 'none'."
8277 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8278 case "$man3dir" in
8279 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8280         if $test -d "$privlib/man/man3"; then
8281                 cat <<EOM >&4
8282
8283 WARNING:  Previous versions of perl installed man3 pages into
8284 $privlib/man/man3.  This version will suggest a
8285 new default of $dflt.
8286 EOM
8287                 tdflt=$dflt
8288                 dflt='n'
8289                 rp='Do you wish to preserve the old behavior?(y/n)'
8290                 . ./myread
8291                 case "$ans" in
8292                 y*) dflt="$privlib/man/man3" ;;
8293                 *)  dflt=$tdflt ;;
8294                 esac
8295     fi
8296         ;;
8297 *)      dflt="$man3dir" ;;
8298 esac
8299 case "$dflt" in
8300 ' ') dflt=none ;;
8301 esac
8302 echo " "
8303 fn=dn+~
8304 rp="Where do the $package library man pages (source) go?"
8305 . ./getfile
8306 prefixvar=man3dir
8307 . ./setprefixvar
8308
8309 case "$man3dir" in
8310 '')     man3dir=' '
8311         installman3dir='';;
8312 esac
8313
8314 : What suffix to use on installed man pages
8315 case "$man3dir" in
8316 ' ')
8317         man3ext='0'
8318         ;;
8319 *)
8320         rp="What suffix should be used for the $package library man pages?"
8321         case "$man3ext" in
8322         '')     case "$man3dir" in
8323                 *3)  dflt=3 ;;
8324                 *3p) dflt=3p ;;
8325                 *3pm) dflt=3pm ;;
8326                 *l) dflt=l;;
8327                 *n) dflt=n;;
8328                 *o) dflt=o;;
8329                 *p) dflt=p;;
8330                 *C) dflt=C;;
8331                 *L) dflt=L;;
8332                 *L3) dflt=L3;;
8333                 *) dflt=3;;
8334                 esac
8335                 ;;
8336         *)      dflt="$man3ext";;
8337         esac
8338         . ./myread
8339         man3ext="$ans"
8340         ;;
8341 esac
8342
8343 : see if we have to deal with yellow pages, now NIS.
8344 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8345         if $test -f /usr/etc/nibindd; then
8346                 echo " "
8347                 echo "I'm fairly confident you're on a NeXT."
8348                 echo " "
8349                 rp='Do you get the hosts file via NetInfo?'
8350                 dflt=y
8351                 case "$hostcat" in
8352                 nidump*) ;;
8353                 '') ;;
8354                 *) dflt=n;;
8355                 esac
8356                 . ./myread
8357                 case "$ans" in
8358                 y*) hostcat='nidump hosts .';;
8359                 *)      case "$hostcat" in
8360                         nidump*) hostcat='';;
8361                         esac
8362                         ;;
8363                 esac
8364         fi
8365         case "$hostcat" in
8366         nidump*) ;;
8367         *)
8368                 case "$hostcat" in
8369                 *ypcat*) dflt=y;;
8370                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8371                                 dflt=y
8372                         else
8373                                 dflt=n
8374                         fi;;
8375                 *) dflt=n;;
8376                 esac
8377                 echo " "
8378                 rp='Are you getting the hosts file via yellow pages?'
8379                 . ./myread
8380                 case "$ans" in
8381                 y*) hostcat='ypcat hosts';;
8382                 *) hostcat='cat /etc/hosts';;
8383                 esac
8384                 ;;
8385         esac
8386 fi
8387 case "$hostcat" in
8388 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8389 esac
8390 case "$groupcat" in
8391 '') test -f /etc/group && groupcat='cat /etc/group';;
8392 esac
8393 case "$passcat" in
8394 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8395 esac
8396
8397 : now get the host name
8398 echo " "
8399 echo "Figuring out host name..." >&4
8400 case "$myhostname" in
8401 '') cont=true
8402         echo 'Maybe "hostname" will work...'
8403         if tans=`sh -c hostname 2>&1` ; then
8404                 myhostname=$tans
8405                 phostname=hostname
8406                 cont=''
8407         fi
8408         ;;
8409 *) cont='';;
8410 esac
8411 if $test "$cont"; then
8412         if ./xenix; then
8413                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8414                 if tans=`cat /etc/systemid 2>&1` ; then
8415                         myhostname=$tans
8416                         phostname='cat /etc/systemid'
8417                         echo "Whadyaknow.  Xenix always was a bit strange..."
8418                         cont=''
8419                 fi
8420         elif $test -r /etc/systemid; then
8421                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8422         fi
8423 fi
8424 if $test "$cont"; then
8425         echo 'No, maybe "uuname -l" will work...'
8426         if tans=`sh -c 'uuname -l' 2>&1` ; then
8427                 myhostname=$tans
8428                 phostname='uuname -l'
8429         else
8430                 echo 'Strange.  Maybe "uname -n" will work...'
8431                 if tans=`sh -c 'uname -n' 2>&1` ; then
8432                         myhostname=$tans
8433                         phostname='uname -n'
8434                 else
8435                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8436                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8437                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8438                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8439                         else
8440                                 case "$myhostname" in
8441                                 '') echo "Does this machine have an identity crisis or something?"
8442                                         phostname='';;
8443                                 *)
8444                                         echo "Well, you said $myhostname before..."
8445                                         phostname='echo $myhostname';;
8446                                 esac
8447                         fi
8448                 fi
8449         fi
8450 fi
8451 case "$myhostname" in
8452 '') myhostname=noname ;;
8453 esac
8454 : you do not want to know about this
8455 set $myhostname
8456 myhostname=$1
8457
8458 : verify guess
8459 if $test "$myhostname" ; then
8460         dflt=y
8461         rp='Your host name appears to be "'$myhostname'".'" Right?"
8462         . ./myread
8463         case "$ans" in
8464         y*) ;;
8465         *) myhostname='';;
8466         esac
8467 fi
8468
8469 : bad guess or no guess
8470 while $test "X$myhostname" = X ; do
8471         dflt=''
8472         rp="Please type the (one word) name of your host:"
8473         . ./myread
8474         myhostname="$ans"
8475 done
8476
8477 : translate upper to lower if necessary
8478 case "$myhostname" in
8479 *[A-Z]*)
8480         echo "(Normalizing case in your host name)"
8481         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8482         ;;
8483 esac
8484
8485 case "$myhostname" in
8486 *.*)
8487         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8488         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8489         echo "(Trimming domain name from host name--host name is now $myhostname)"
8490         ;;
8491 *) case "$mydomain" in
8492         '')
8493                 {
8494                         test "X$hostcat" = "Xypcat hosts" &&
8495                         ypmatch "$myhostname" hosts 2>/dev/null |\
8496                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8497                         $test -s hosts
8498                 } || {
8499                         test "X$hostcat" != "X" &&
8500                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8501                                         /[       ]$myhostname[  . ]/p" > hosts
8502                 }
8503                 tmp_re="[       . ]"
8504                 if $test -f hosts; then
8505                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8506                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8507                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8508                                 hosts | $sort | $uniq | \
8509                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8510                         case `$echo X$dflt` in
8511                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8512                                 dflt=.
8513                                 ;;
8514                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8515                                 ;;
8516                         esac
8517                 else
8518                         echo "(I cannot locate a hosts database anywhere)"
8519                         dflt=.
8520                 fi
8521                 case "$dflt" in
8522                 .)
8523                         tans=`./loc resolv.conf X /etc /usr/etc`
8524                         if $test -f "$tans"; then
8525                                 echo "(Attempting domain name extraction from $tans)"
8526                                 dflt=.`$sed -n -e 's/   / /g' \
8527                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8528                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8529                                 case "$dflt" in
8530                                 .) dflt=.`$sed -n -e 's/        / /g' \
8531                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8532                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8533                                         ;;
8534                                 esac
8535                         fi
8536                         ;;
8537                 esac
8538                 case "$dflt" in
8539                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8540                         dflt=.`sh -c domainname 2>/dev/null`
8541                         case "$dflt" in
8542                         '') dflt='.';;
8543                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8544                         esac
8545                         ;;
8546                 esac
8547                 case "$dflt$osname" in
8548                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8549                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8550                         ;;
8551                 esac
8552                 case "$dflt" in
8553                 .) echo "(Lost all hope -- silly guess then)"
8554                         dflt='.nonet'
8555                         ;;
8556                 esac
8557                 $rm -f hosts
8558                 ;;
8559         *) dflt="$mydomain";;
8560         esac;;
8561 esac
8562 echo " "
8563 rp="What is your domain name?"
8564 . ./myread
8565 tans="$ans"
8566 case "$ans" in
8567 '') ;;
8568 .*) ;;
8569 *) tans=".$tans";;
8570 esac
8571 mydomain="$tans"
8572
8573 : translate upper to lower if necessary
8574 case "$mydomain" in
8575 *[A-Z]*)
8576         echo "(Normalizing case in your domain name)"
8577         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8578         ;;
8579 esac
8580
8581 : a little sanity check here
8582 case "$phostname" in
8583 '') ;;
8584 *)
8585         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8586         $myhostname$mydomain|$myhostname) ;;
8587         *)
8588                 case "$phostname" in
8589                 sed*)
8590                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8591                         ;;
8592                 *)
8593                         echo "(That doesn't agree with your $phostname command, by the way.)"
8594                         ;;
8595                 esac
8596         ;;
8597         esac
8598         ;;
8599 esac
8600
8601 $cat <<EOM
8602
8603 I need to get your e-mail address in Internet format if possible, i.e.
8604 something like user@host.domain. Please answer accurately since I have
8605 no easy means to double check it. The default value provided below
8606 is most probably close to reality but may not be valid from outside
8607 your organization...
8608
8609 EOM
8610 cont=x
8611 while test "$cont"; do
8612         case "$cf_email" in
8613         '') dflt="$cf_by@$myhostname$mydomain";;
8614         *) dflt="$cf_email";;
8615         esac
8616         rp='What is your e-mail address?'
8617         . ./myread
8618         cf_email="$ans"
8619         case "$cf_email" in
8620         *@*.*) cont='' ;;
8621         *)
8622                 rp='Address does not look like an Internet one.  Use it anyway?'
8623                 case "$fastread" in
8624                 yes) dflt=y ;;
8625                 *) dflt=n ;;
8626                 esac
8627                 . ./myread
8628                 case "$ans" in
8629                 y*) cont='' ;;
8630                 *) echo " " ;;
8631                 esac
8632                 ;;
8633         esac
8634 done
8635
8636 $cat <<EOM
8637
8638 If you or somebody else will be maintaining perl at your site, please
8639 fill in the correct e-mail address here so that they may be contacted
8640 if necessary. Currently, the "perlbug" program included with perl
8641 will send mail to this address in addition to perlbug@perl.org. You may
8642 enter "none" for no administrator.
8643
8644 EOM
8645 case "$perladmin" in
8646 '') dflt="$cf_email";;
8647 *) dflt="$perladmin";;
8648 esac
8649 rp='Perl administrator e-mail address'
8650 . ./myread
8651 perladmin="$ans"
8652
8653 : determine whether to only install version-specific parts.
8654 echo " "
8655 $cat <<EOM
8656 Do you want to install only the version-specific parts of the perl
8657 distribution?  Usually you do *not* want to do this.
8658 EOM
8659 case "$versiononly" in
8660 "$define"|[Yy]*|true) dflt='y' ;;
8661 *) dflt='n';
8662 esac
8663 rp="Do you want to install only the version-specific parts of perl?"
8664 . ./myread
8665 case "$ans" in
8666 [yY]*)  val="$define";;
8667 *)      val="$undef" ;;
8668 esac
8669 set versiononly
8670 eval $setvar
8671
8672 case "$versiononly" in
8673 "$define") inc_version_list=''
8674            inc_version_list_init=0
8675            ;;
8676 esac
8677
8678 : figure out how to guarantee perl startup
8679 : XXX Note that this currently takes advantage of the bug that binexp ignores
8680 :     the Configure -Dinstallprefix setting, which in turn means that under
8681 :     relocatable @INC, initialinstalllocation is what binexp started as.
8682 case "$startperl" in
8683 '')
8684         case "$sharpbang" in
8685         *!)
8686                 $cat <<EOH
8687
8688 I can use the #! construct to start perl on your system. This will
8689 make startup of perl scripts faster, but may cause problems if you
8690 want to share those scripts and perl is not in a standard place
8691 ($initialinstalllocation/perl) on all your platforms. The alternative
8692 is to force a shell by starting the script with a single ':' character.
8693
8694 EOH
8695                 case "$versiononly" in
8696                 "$define")      dflt="$initialinstalllocation/perl$version";;
8697                 *)              dflt="$initialinstalllocation/perl";;
8698                 esac
8699                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8700                 . ./myread
8701                 case "$ans" in
8702                 none)   startperl=": # use perl";;
8703                 *)      startperl="#!$ans"
8704                         if $test 30 -lt `echo "$ans" | wc -c`; then
8705                                 $cat >&4 <<EOM
8706
8707 WARNING:  Some systems limit the #! command to 32 characters.
8708 If you experience difficulty running Perl scripts with #!, try
8709 installing Perl in a directory with a shorter pathname.
8710
8711 EOM
8712                         fi ;;
8713                 esac
8714                 ;;
8715         *) startperl=": # use perl"
8716                 ;;
8717         esac
8718         ;;
8719 esac
8720 echo "I'll use $startperl to start perl scripts."
8721
8722 : figure best path for perl in scripts
8723 case "$perlpath" in
8724 '')
8725         case "$versiononly" in
8726         "$define")      perlpath="$initialinstalllocation/perl$version";;
8727         *)              perlpath="$initialinstalllocation/perl";;
8728         esac
8729         case "$startperl" in
8730         *!*) ;;
8731         *)
8732                 $cat <<EOH
8733
8734 I will use the "eval 'exec'" idiom to start Perl on your system.
8735 I can use the full path of your Perl binary for this purpose, but
8736 doing so may cause problems if you want to share those scripts and
8737 Perl is not always in a standard place ($initialinstalllocation/perl).
8738
8739 EOH
8740                 dflt="$initialinstalllocation/perl"
8741                 rp="What path shall I use in \"eval 'exec'\"?"
8742                 . ./myread
8743                 perlpath="$ans"
8744                 ;;
8745         esac
8746         ;;
8747 esac
8748 case "$startperl" in
8749 *!*)    ;;
8750 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8751 esac
8752
8753 : determine where public executable scripts go
8754 set scriptdir scriptdir
8755 eval $prefixit
8756 case "$scriptdir" in
8757 '')
8758         dflt="$bin"
8759         : guess some guesses
8760         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8761         $test -d /usr/share/bin     && dflt=/usr/share/bin
8762         $test -d /usr/local/script  && dflt=/usr/local/script
8763         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8764         $test -d $prefixexp/script  && dflt=$prefixexp/script
8765         set dflt
8766         eval $prefixup
8767         ;;
8768 *)  dflt="$scriptdir"
8769         ;;
8770 esac
8771 $cat <<EOM
8772
8773 Some installations have a separate directory just for executable scripts so
8774 that they can mount it across multiple architectures but keep the scripts in
8775 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8776 Or you might just lump your scripts in with all your other executables.
8777
8778 EOM
8779 fn=d~
8780 rp='Where do you keep publicly executable scripts?'
8781 . ./getfile
8782 if $test "X$ansexp" != "X$scriptdirexp"; then
8783         installscript=''
8784 fi
8785 installscriptdir=''
8786 prefixvar=scriptdir
8787 . ./setprefixvar
8788 : A little fix up for an irregularly named variable.
8789 installscript="$installscriptdir"
8790
8791 : determine where add-on public executables go
8792 case "$sitebin" in
8793 '')     dflt=$siteprefix/bin ;;
8794 *)      dflt=$sitebin ;;
8795 esac
8796 fn=d~
8797 rp='Pathname where the add-on public executables should be installed?'
8798 . ./getfile
8799 prefixvar=sitebin
8800 . ./setprefixvar
8801
8802 : determine where add-on html pages go
8803 : There is no standard location, so try to copy the previously-selected
8804 : directory structure for the core html pages.
8805 case "$sitehtml1dir" in
8806 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8807 *)     dflt=$sitehtml1dir ;;
8808 esac
8809 case "$dflt" in
8810 ''|' ') dflt=none ;;
8811 esac
8812 fn=dn+~
8813 rp='Pathname where the site-specific html pages should be installed?'
8814 . ./getfile
8815 prefixvar=sitehtml1dir
8816 . ./setprefixvar
8817
8818 : determine where add-on library html pages go
8819 : There is no standard location, so try to copy the previously-selected
8820 : directory structure for the core html pages.
8821 case "$sitehtml3dir" in
8822 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8823 *)     dflt=$sitehtml3dir ;;
8824 esac
8825 case "$dflt" in
8826 ''|' ') dflt=none ;;
8827 esac
8828 fn=dn+~
8829 rp='Pathname where the site-specific library html pages should be installed?'
8830 . ./getfile
8831 prefixvar=sitehtml3dir
8832 . ./setprefixvar
8833
8834 : determine where add-on manual pages go
8835 case "$siteman1dir" in
8836 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8837 *)      dflt=$siteman1dir ;;
8838 esac
8839 case "$dflt" in
8840 ''|' ') dflt=none ;;
8841 esac
8842 fn=dn+~
8843 rp='Pathname where the site-specific manual pages should be installed?'
8844 . ./getfile
8845 prefixvar=siteman1dir
8846 . ./setprefixvar
8847
8848 : determine where add-on library man pages go
8849 case "$siteman3dir" in
8850 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8851 *)      dflt=$siteman3dir ;;
8852 esac
8853 case "$dflt" in
8854 ''|' ') dflt=none ;;
8855 esac
8856 fn=dn+~
8857 rp='Pathname where the site-specific library manual pages should be installed?'
8858 . ./getfile
8859 prefixvar=siteman3dir
8860 . ./setprefixvar
8861
8862 : determine where add-on public executable scripts go
8863 case "$sitescript" in
8864 '')     dflt=$siteprefix/script
8865         $test -d $dflt || dflt=$sitebin ;;
8866 *)  dflt="$sitescript" ;;
8867 esac
8868 fn=d~+
8869 rp='Pathname where add-on public executable scripts should be installed?'
8870 . ./getfile
8871 prefixvar=sitescript
8872 . ./setprefixvar
8873
8874 case "$usefaststdio" in
8875 $define|true|[yY]*|'')
8876         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8877         case "$xversion" in
8878         [68])   dflt='y' ;;
8879         *)      dflt='n' ;;
8880         esac
8881         ;;
8882 *) dflt='n';;
8883 esac
8884 cat <<EOM
8885
8886 Perl can be built to use 'fast stdio', which means using the stdio
8887 library but also directly manipulating the stdio buffers to enable
8888 faster I/O.  Using stdio is better for backward compatibility (especially
8889 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8890 interface has been preferred instead of stdio.
8891
8892 If this doesn't make any sense to you, just accept the default '$dflt'.
8893 EOM
8894 rp='Use the "fast stdio" if available?'
8895 . ./myread
8896 case "$ans" in
8897 y|Y)    val="$define" ;;     
8898 *)      val="$undef" ;;
8899 esac
8900 set usefaststdio
8901 eval $setvar
8902
8903
8904 : define an is-a-typedef? function
8905 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8906 case "$inclist" in
8907 "") inclist="sys/types.h";;
8908 esac;
8909 eval "varval=\$$var";
8910 case "$varval" in
8911 "")
8912         $rm -f temp.c;
8913         for inc in $inclist; do
8914                 echo "#include <$inc>" >>temp.c;
8915         done;
8916         echo "#ifdef $type" >> temp.c;
8917         echo "printf(\"We have $type\");" >> temp.c;
8918         echo "#endif" >> temp.c;
8919         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8920         if $contains $type temp.E >/dev/null 2>&1; then
8921                 eval "$var=\$type";
8922         else
8923                 eval "$var=\$def";
8924         fi;
8925         $rm -f temp.?;;
8926 *) eval "$var=\$varval";;
8927 esac'
8928
8929 : define an is-a-typedef? function that prompts if the type is not available.
8930 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8931 case "$inclist" in
8932 "") inclist="sys/types.h";;
8933 esac;
8934 eval "varval=\$$var";
8935 case "$varval" in
8936 "")
8937         $rm -f temp.c;
8938         for inc in $inclist; do
8939                 echo "#include <$inc>" >>temp.c;
8940         done;
8941         echo "#ifdef $type" >> temp.c;
8942         echo "printf(\"We have $type\");" >> temp.c;
8943         echo "#endif" >> temp.c;
8944         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8945         echo " " ;
8946         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8947         if $contains $type temp.E >/dev/null 2>&1; then
8948                 echo "$type found." >&4;
8949                 eval "$var=\$type";
8950         else
8951                 echo "$type NOT found." >&4;
8952                 dflt="$def";
8953                 . ./myread ;
8954                 eval "$var=\$ans";
8955         fi;
8956         $rm -f temp.?;;
8957 *) eval "$var=\$varval";;
8958 esac'
8959
8960 : see what type lseek is declared as in the kernel
8961 rp="What is the type used for lseek's offset on this system?"
8962 set off_t lseektype long stdio.h sys/types.h
8963 eval $typedef_ask
8964
8965 echo " "
8966 echo "Checking to see how big your file offsets are..." >&4
8967 $cat >try.c <<EOCP
8968 #include <sys/types.h>
8969 #include <stdio.h>
8970 int main()
8971 {
8972     printf("%d\n", (int)sizeof($lseektype));
8973     return(0);
8974 }
8975 EOCP
8976 set try
8977 if eval $compile_ok; then
8978         lseeksize=`$run ./try`
8979         echo "Your file offsets are $lseeksize bytes long."
8980 else
8981         dflt=$longsize
8982         echo " "
8983         echo "(I can't seem to compile the test program.  Guessing...)"
8984         rp="What is the size of your file offsets (in bytes)?"
8985         . ./myread
8986         lseeksize="$ans"
8987 fi
8988 $rm_try
8989
8990 : see what type file positions are declared as in the library
8991 rp="What is the type for file position used by fsetpos()?"
8992 set fpos_t fpostype long stdio.h sys/types.h
8993 eval $typedef_ask
8994
8995 echo " "
8996 case "$fpostype" in
8997 *_t) zzz="$fpostype"    ;;
8998 *)   zzz="fpos_t"       ;;
8999 esac
9000 echo "Checking the size of $zzz..." >&4 
9001 cat > try.c <<EOCP
9002 #include <sys/types.h>
9003 #include <stdio.h>
9004 #$i_stdlib I_STDLIB
9005 #ifdef I_STDLIB
9006 #include <stdlib.h>
9007 #endif
9008 int main() {
9009     printf("%d\n", (int)sizeof($fpostype));
9010     exit(0);
9011 }
9012 EOCP
9013 set try
9014 if eval $compile_ok; then
9015         yyy=`$run ./try`
9016         case "$yyy" in
9017         '')     fpossize=4
9018                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9019                 ;;
9020         *)      fpossize=$yyy
9021                 echo "Your $zzz is $fpossize bytes long."
9022                 ;;
9023         esac
9024 else
9025         dflt="$longsize"
9026         echo " " >&4
9027         echo "(I can't compile the test program.  Guessing...)" >&4
9028         rp="What is the size of your file positions (in bytes)?"
9029         . ./myread
9030         fpossize="$ans"
9031 fi
9032
9033 # Backward compatibility (uselfs is deprecated).
9034 case "$uselfs" in
9035 "$define"|true|[yY]*)
9036         cat <<EOM >&4
9037
9038 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9039 EOM
9040         uselargefiles="$define"
9041         ;;
9042 esac
9043
9044 case "$lseeksize:$fpossize" in
9045 8:8) cat <<EOM
9046
9047 You can have files larger than 2 gigabytes.
9048 EOM
9049    val="$define" ;;
9050 *)    case "$uselargefiles" in
9051    "$undef"|false|[nN]*) dflt='n' ;;
9052    *)   dflt='y' ;;
9053    esac
9054    cat <<EOM
9055
9056 Perl can be built to understand large files (files larger than 2 gigabytes)
9057 on some systems.  To do so, Configure can be run with -Duselargefiles.
9058
9059 If this doesn't make any sense to you, just accept the default '$dflt'.
9060 EOM
9061    rp='Try to understand large files, if available?'
9062    . ./myread
9063    case "$ans" in
9064    y|Y)         val="$define" ;;
9065    *)           val="$undef"  ;;
9066    esac
9067    ;;
9068 esac
9069 set uselargefiles
9070 eval $setvar
9071 : Look for a hint-file generated 'call-back-unit'.  If the
9072 : user has specified that a large files perl is to be built,
9073 : we may need to set or change some other defaults.
9074 if $test -f uselargefiles.cbu; then
9075         echo "Your platform has some specific hints regarding large file builds, using them..."
9076         . ./uselargefiles.cbu
9077 fi
9078 case "$uselargefiles" in
9079 "$define")
9080         if $test -f uselargefiles.cbu; then
9081                 echo " "
9082                 echo "Rechecking to see how big your file offsets are..." >&4
9083                 $cat >try.c <<EOCP
9084 #include <sys/types.h>
9085 #include <stdio.h>
9086 int main()
9087 {
9088     printf("%d\n", (int)sizeof($lseektype));
9089     return(0);
9090 }
9091 EOCP
9092                 set try
9093                 if eval $compile_ok; then
9094                         lseeksize=`$run ./try`
9095                         $echo "Your file offsets are now $lseeksize bytes long."
9096                 else
9097                         dflt="$lseeksize"
9098                         echo " "
9099                         echo "(I can't seem to compile the test program.  Guessing...)"
9100                         rp="What is the size of your file offsets (in bytes)?"
9101                         . ./myread
9102                         lseeksize="$ans"
9103                 fi
9104                 case "$fpostype" in
9105                 *_t) zzz="$fpostype"    ;;
9106                 *)   zzz="fpos_t"       ;;
9107                 esac
9108                 $echo $n "Rechecking the size of $zzz...$c" >&4
9109                 $cat > try.c <<EOCP
9110 #include <sys/types.h>
9111 #include <stdio.h>
9112 #$i_stdlib I_STDLIB
9113 #ifdef I_STDLIB
9114 #include <stdlib.h>
9115 #endif
9116 int main() {
9117     printf("%d\n", (int)sizeof($fpostype));
9118     return(0);
9119 }
9120 EOCP
9121                 set try
9122                 if eval $compile_ok; then
9123                         yyy=`$run ./try`
9124                         dflt="$lseeksize"
9125                         case "$yyy" in
9126                         '')     echo " "
9127                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9128                                 ;;
9129                         *)      fpossize=$yyy
9130                                 echo " $fpossize bytes." >&4
9131                                 ;;
9132                         esac
9133                 else
9134                         dflt="$fpossize"
9135                         echo " "
9136                         echo "(I can't compile the test program.  Guessing...)" >&4
9137                         rp="What is the size of your file positions (in bytes)?"
9138                         . ./myread
9139                         fpossize="$ans"
9140                 fi
9141                 $rm_try
9142         fi
9143         ;;
9144 esac
9145
9146 case "$vendorprefix" in
9147 '')     d_vendorbin="$undef"
9148         vendorbin=''
9149         vendorbinexp=''
9150         ;;
9151 *)      d_vendorbin="$define"
9152         : determine where vendor-supplied executables go.
9153         case "$vendorbin" in
9154         '') dflt=$vendorprefix/bin ;;
9155         *)      dflt="$vendorbin" ;;
9156         esac
9157         fn=d~+
9158         rp='Pathname for the vendor-supplied executables directory?'
9159         . ./getfile
9160         vendorbin="$ans"
9161         vendorbinexp="$ansexp"
9162         ;;
9163 esac
9164 prefixvar=vendorbin
9165 . ./installprefix
9166
9167 case "$vendorprefix" in
9168 '')     vendorhtml1dir=''
9169         vendorhtml1direxp=''
9170         ;;
9171 *)      : determine where vendor-supplied html pages go.
9172         : There is no standard location, so try to copy the previously-selected
9173         : directory structure for the core html pages.
9174         : XXX Better default suggestions would be welcome.
9175         case "$vendorhtml1dir" in
9176         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9177         *)      dflt=$vendorhtml1dir ;;
9178         esac
9179         case "$dflt" in
9180         ''|' ') dflt=none ;;
9181         esac
9182         fn=dn+~
9183         rp='Pathname for the vendor-supplied html pages?'
9184         . ./getfile
9185         vendorhtml1dir="$ans"
9186         vendorhtml1direxp="$ansexp"
9187         ;;
9188 esac
9189 : Use ' ' for none so value is preserved next time through Configure
9190 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9191 prefixvar=vendorhtml1dir
9192 . ./installprefix
9193
9194 case "$vendorprefix" in
9195 '')     vendorhtml3dir=''
9196         vendorhtml3direxp=''
9197         ;;
9198 *)      : determine where vendor-supplied module html pages go.
9199         : There is no standard location, so try to copy the previously-selected
9200         : directory structure for the core html pages.
9201         : XXX Better default suggestions would be welcome.
9202         case "$vendorhtml3dir" in
9203         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9204         *)      dflt=$vendorhtml3dir ;;
9205         esac
9206         case "$dflt" in
9207         ''|' ') dflt=none ;;
9208         esac
9209         fn=dn+~
9210         rp='Pathname for the vendor-supplied html pages?'
9211         . ./getfile
9212         vendorhtml3dir="$ans"
9213         vendorhtml3direxp="$ansexp"
9214         ;;
9215 esac
9216 : Use ' ' for none so value is preserved next time through Configure
9217 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9218 prefixvar=vendorhtml3dir
9219 . ./installprefix
9220
9221 case "$vendorprefix" in
9222 '')     vendorman1dir=''
9223         vendorman1direxp=''
9224         ;;
9225 *)      : determine where vendor-supplied manual pages go.
9226         case "$vendorman1dir" in
9227         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9228         *)      dflt=$vendorman1dir ;;
9229         esac
9230         case "$dflt" in
9231         ''|' ') dflt=none ;;
9232         esac
9233         fn=nd~+
9234         rp='Pathname for the vendor-supplied manual section 1 pages?'
9235         . ./getfile
9236         vendorman1dir="$ans"
9237         vendorman1direxp="$ansexp"
9238         ;;
9239 esac
9240 : Use ' ' for none so value is preserved next time through Configure
9241 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9242 prefixvar=vendorman1dir
9243 . ./installprefix
9244
9245 case "$vendorprefix" in
9246 '')     vendorman3dir=''
9247         vendorman3direxp=''
9248         ;;
9249 *)      : determine where vendor-supplied module manual pages go.
9250         case "$vendorman3dir" in
9251         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9252         *)      dflt=$vendorman3dir ;;
9253         esac
9254         case "$dflt" in
9255         ''|' ') dflt=none ;;
9256         esac
9257         fn=nd~+
9258         rp='Pathname for the vendor-supplied manual section 3 pages?'
9259         . ./getfile
9260         vendorman3dir="$ans"
9261         vendorman3direxp="$ansexp"
9262         ;;
9263 esac
9264 : Use ' ' for none so value is preserved next time through Configure
9265 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9266 prefixvar=vendorman3dir
9267 . ./installprefix
9268
9269 case "$vendorprefix" in
9270 '')     d_vendorscript="$undef"
9271         vendorscript=''
9272         vendorscriptexp=''
9273         ;;
9274 *)      d_vendorscript="$define"
9275         : determine where vendor-supplied scripts go.
9276         case "$vendorscript" in
9277         '')     dflt=$vendorprefix/script
9278                 $test -d $dflt || dflt=$vendorbin ;;
9279         *)  dflt="$vendorscript" ;;
9280         esac
9281         $cat <<EOM
9282
9283 The installation process will create a directory for
9284 vendor-supplied scripts.
9285
9286 EOM
9287         fn=d~+
9288         rp='Pathname for the vendor-supplied scripts directory?'
9289         . ./getfile
9290         vendorscript="$ans"
9291         vendorscriptexp="$ansexp"
9292         ;;
9293 esac
9294 prefixvar=vendorscript
9295 . ./installprefix
9296
9297 : see if qgcvt exists
9298 set qgcvt d_qgcvt
9299 eval $inlibc
9300
9301 echo " "
9302
9303 if $test X"$d_longdbl" = X"$define"; then
9304
9305 echo "Checking how to print long doubles..." >&4
9306
9307 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9308         $cat >try.c <<'EOCP'
9309 #include <sys/types.h>
9310 #include <stdio.h>
9311 int main() {
9312   double d = 123.456;
9313   printf("%.3f\n", d);
9314 }
9315 EOCP
9316         set try
9317         if eval $compile; then
9318                 yyy=`$run ./try`
9319                 case "$yyy" in
9320                 123.456)
9321                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9322                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9323                         echo "We will use %f."
9324                         ;;
9325                 esac
9326         fi
9327 fi
9328
9329 if $test X"$sPRIfldbl" = X; then
9330         $cat >try.c <<'EOCP'
9331 #include <sys/types.h>
9332 #include <stdio.h>
9333 int main() {
9334   long double d = 123.456;
9335   printf("%.3Lf\n", d);
9336 }
9337 EOCP
9338         set try
9339         if eval $compile; then
9340                 yyy=`$run ./try`
9341                 case "$yyy" in
9342                 123.456)
9343                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9344                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9345                         echo "We will use %Lf."
9346                         ;;
9347                 esac
9348         fi
9349 fi
9350
9351 if $test X"$sPRIfldbl" = X; then
9352         $cat >try.c <<'EOCP'
9353 #include <sys/types.h>
9354 #include <stdio.h>
9355 int main() {
9356   long double d = 123.456;
9357   printf("%.3llf\n", d);
9358 }
9359 EOCP
9360         set try
9361         if eval $compile; then
9362                 yyy=`$run ./try`
9363                 case "$yyy" in
9364                 123.456)
9365                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9366                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9367                         echo "We will use %llf."
9368                         ;;
9369                 esac
9370         fi
9371 fi
9372
9373 if $test X"$sPRIfldbl" = X; then
9374         $cat >try.c <<'EOCP'
9375 #include <sys/types.h>
9376 #include <stdio.h>
9377 int main() {
9378   long double d = 123.456;
9379   printf("%.3lf\n", d);
9380 }
9381 EOCP
9382         set try
9383         if eval $compile; then
9384                 yyy=`$run ./try`
9385                 case "$yyy" in
9386                 123.456)
9387                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9388                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9389                         echo "We will use %lf."
9390                         ;;
9391                 esac
9392         fi
9393 fi
9394
9395 if $test X"$sPRIfldbl" = X; then
9396         echo "Cannot figure out how to print long doubles." >&4
9397 else
9398         sSCNfldbl=$sPRIfldbl    # expect consistency
9399 fi
9400
9401 $rm_try
9402
9403 fi # d_longdbl
9404
9405 case "$sPRIfldbl" in
9406 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9407         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9408         d_SCNfldbl="$undef";
9409         ;;
9410 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9411         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9412         d_SCNfldbl="$define";
9413         ;;
9414 esac
9415
9416 : Check how to convert floats to strings.
9417
9418 if test "X$d_Gconvert" = X; then
9419
9420 echo " "
9421 echo "Checking for an efficient way to convert floats to strings."
9422 echo " " > try.c
9423 case "$uselongdouble" in
9424 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9425 esac
9426 case "$d_longdbl" in
9427 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9428 esac
9429 case "$d_PRIgldbl" in
9430 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9431 esac
9432 $cat >>try.c <<EOP
9433 #ifdef TRY_gconvert
9434 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9435 char *myname = "gconvert";
9436 #endif
9437 #ifdef TRY_gcvt
9438 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9439 char *myname = "gcvt";
9440 #endif
9441 #ifdef TRY_qgcvt
9442 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9443 char *myname = "qgcvt";
9444 #define DOUBLETYPE long double
9445 #endif
9446 #ifdef TRY_sprintf
9447 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9448 #ifdef HAS_PRIgldbl
9449 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9450 #else
9451 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9452 #endif
9453 #else
9454 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9455 #endif
9456 char *myname = "sprintf";
9457 #endif
9458
9459 #ifndef DOUBLETYPE
9460 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9461 #define DOUBLETYPE long double
9462 #else
9463 #define DOUBLETYPE double
9464 #endif
9465 #endif
9466
9467 #include <stdio.h>
9468
9469 #define I_STDLIB $i_stdlib
9470 #ifdef I_STDLIB
9471 #include <stdlib.h>
9472 #endif
9473
9474 int
9475 checkit(expect, got)
9476 char *expect;
9477 char *got;
9478 {
9479     if (strcmp(expect, got)) {
9480                 printf("%s oddity:  Expected %s, got %s\n",
9481                         myname, expect, got);
9482                 exit(1);
9483         }
9484 }
9485
9486 int main()
9487 {
9488         char buf[64];
9489         buf[63] = '\0';
9490
9491         /* This must be 1st test on (which?) platform */
9492         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9493         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9494         checkit("0.1", buf);
9495
9496         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9497         checkit("0.01", buf);
9498
9499         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9500         checkit("0.001", buf);
9501
9502         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9503         checkit("0.0001", buf);
9504
9505         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9506         if (strlen(buf) > 5)
9507             checkit("9e-005", buf); /* for Microsoft ?? */
9508         else
9509             checkit("9e-05", buf);
9510
9511         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9512         checkit("1", buf);
9513
9514         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9515         checkit("1.1", buf);
9516
9517         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9518         checkit("1.01", buf);
9519
9520         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9521         checkit("1.001", buf);
9522
9523         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9524         checkit("1.0001", buf);
9525
9526         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9527         checkit("1.00001", buf);
9528
9529         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9530         checkit("1.000001", buf);
9531
9532         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9533         checkit("0", buf);
9534
9535         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9536         checkit("-1", buf);
9537
9538         /* Some Linux gcvt's give 1.e+5 here. */
9539         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9540         checkit("100000", buf);
9541
9542         /* Some Linux gcvt's give -1.e+5 here. */
9543         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9544         checkit("-100000", buf);
9545
9546         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9547         checkit("123.456", buf);
9548
9549         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9550         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9551         /* 34 should be enough to scare even long double
9552          * places into using the e notation. */
9553         if (strlen(buf) > 5)
9554             checkit("1e+034", buf); /* for Microsoft */
9555         else
9556             checkit("1e+34", buf);
9557
9558         /* For Perl, if you add additional tests here, also add them to
9559          * t/base/num.t for benefit of platforms not using Configure or
9560          * overriding d_Gconvert */
9561
9562         exit(0);
9563 }
9564 EOP
9565 : first add preferred functions to our list
9566 xxx_list=""
9567 for xxx_convert in $gconvert_preference; do
9568     case $xxx_convert in
9569     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9570     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9571     esac
9572 done
9573 : then add any others
9574 for xxx_convert in gconvert gcvt sprintf; do
9575     case "$xxx_list" in
9576     *$xxx_convert*) ;;
9577     *) xxx_list="$xxx_list $xxx_convert" ;;
9578     esac
9579 done
9580
9581 case "$d_longdbl$uselongdouble" in
9582 "$define$define")
9583     : again, add prefered functions to our list first
9584     xxx_ld_list=""
9585     for xxx_convert in $gconvert_ld_preference; do
9586         case $xxx_convert in
9587         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9588         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9589         esac
9590     done
9591     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9592     for xxx_convert in qgcvt sprintf $xxx_list; do
9593         case "$xxx_ld_list" in
9594         $xxx_convert*|*" $xxx_convert"*) ;;
9595         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9596         esac
9597     done
9598     : if sprintf cannot do long doubles, move it to the end
9599     if test "$d_PRIgldbl" != "$define"; then
9600         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9601     fi
9602     : if no qgcvt, remove it
9603     if test "$d_qgcvt" != "$define"; then
9604         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9605     fi
9606     : use the ld_list
9607     xxx_list="$xxx_ld_list"
9608     ;;
9609 esac
9610
9611 for xxx_convert in $xxx_list; do
9612         echo "Trying $xxx_convert..."
9613         $rm -f try try$_o core
9614         set try -DTRY_$xxx_convert
9615         if eval $compile; then
9616                 echo "$xxx_convert() found." >&4
9617                 if $run ./try; then
9618                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9619                         break;
9620                 else
9621                         echo "...But $xxx_convert didn't work as I expected."
9622                         xxx_convert=''
9623                 fi
9624         else
9625                 echo "$xxx_convert NOT found." >&4
9626         fi
9627 done
9628
9629 if test X$xxx_convert = X; then
9630     echo "*** WHOA THERE!!! ***" >&4
9631     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9632     xxx_convert=sprintf
9633 fi
9634
9635 case "$xxx_convert" in
9636 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9637 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9638 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9639 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9640    "$define$define$define")
9641       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9642    "$define$define$undef")
9643       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9644    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9645    esac
9646    ;;
9647 esac
9648
9649 fi
9650 $rm_try
9651
9652 : see if _fwalk exists
9653 set fwalk d__fwalk
9654 eval $inlibc
9655
9656 : Initialize h_fcntl
9657 h_fcntl=false
9658
9659 : Initialize h_sysfile
9660 h_sysfile=false
9661
9662 : access call always available on UNIX
9663 set access d_access
9664 eval $inlibc
9665
9666 : locate the flags for 'access()'
9667 case "$d_access" in
9668 "$define")
9669         echo " "
9670         $cat >access.c <<EOCP
9671 #include <sys/types.h>
9672 #ifdef I_FCNTL
9673 #include <fcntl.h>
9674 #endif
9675 #ifdef I_SYS_FILE
9676 #include <sys/file.h>
9677 #endif
9678 #ifdef I_UNISTD
9679 #include <unistd.h>
9680 #endif
9681 #$i_stdlib I_STDLIB
9682 #ifdef I_STDLIB
9683 #include <stdlib.h>
9684 #endif
9685 int main() {
9686         exit(R_OK);
9687 }
9688 EOCP
9689         : check sys/file.h first, no particular reason here
9690         if $test `./findhdr sys/file.h` && \
9691                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9692                 h_sysfile=true;
9693                 echo "<sys/file.h> defines the *_OK access constants." >&4
9694         elif $test `./findhdr fcntl.h` && \
9695                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9696                 h_fcntl=true;
9697                 echo "<fcntl.h> defines the *_OK access constants." >&4
9698         elif $test `./findhdr unistd.h` && \
9699                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9700                 echo "<unistd.h> defines the *_OK access constants." >&4
9701         else
9702                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9703         fi
9704         ;;
9705 esac
9706 $rm -f access*
9707
9708 : see if accessx exists
9709 set accessx d_accessx
9710 eval $inlibc
9711
9712 : see if aintl exists
9713 set aintl d_aintl
9714 eval $inlibc
9715
9716 : see if alarm exists
9717 set alarm d_alarm
9718 eval $inlibc
9719
9720 : see if POSIX threads are available
9721 set pthread.h i_pthread
9722 eval $inhdr
9723
9724 : define a fucntion to check prototypes
9725 $cat > protochk <<EOSH
9726 $startsh
9727 cc="$cc"
9728 optimize="$optimize"
9729 ccflags="$ccflags"
9730 prototype="$prototype"
9731 define="$define"
9732 rm_try="$rm_try"
9733 usethreads=$usethreads
9734 i_pthread=$i_pthread
9735 pthread_h_first=$pthread_h_first
9736 EOSH
9737
9738 $cat >> protochk <<'EOSH'
9739
9740 $rm_try
9741 foo="$1"
9742 shift
9743 while test $# -ge 2; do
9744         case "$1" in
9745                 $define) echo "#include <$2>" >> try.c ;;
9746                 literal) echo "$2" >> try.c ;;
9747         esac
9748     # Extra magic for the benefit of systems that need pthread.h
9749     # to be included early to correctly detect threadsafe functions.
9750     # Such functions must guarantee themselves, though, that the usethreads
9751     # and i_pthread have been defined, before calling protochk.
9752     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9753         echo "#include <pthread.h>" >> try.c
9754         pthread_h_done=yes
9755     fi
9756     shift 2
9757 done
9758 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9759 cat >> try.c <<'EOCP'
9760 #ifdef CAN_PROTOTYPE
9761 #define _(args) args
9762 #else
9763 #define _(args) ()
9764 #endif
9765 EOCP
9766 echo "$foo" >> try.c
9767 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9768 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9769 status=$?
9770 $rm_try
9771 exit $status
9772 EOSH
9773 chmod +x protochk
9774 $eunicefix protochk
9775
9776 hasproto='varname=$1; func=$2; shift; shift;
9777 while $test $# -ge 2; do
9778         case "$1" in
9779         $define) echo "#include <$2>";;
9780         esac ;
9781     shift 2;
9782 done > try.c;
9783 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9784 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9785         echo "$func() prototype found.";
9786         val="$define";
9787 else
9788         echo "$func() prototype NOT found.";
9789         val="$undef";
9790 fi;
9791 set $varname;
9792 eval $setvar;
9793 $rm_try tryout.c'
9794
9795 : see if sys/types.h has to be included
9796 set sys/types.h i_systypes
9797 eval $inhdr
9798
9799 : see if sys/select.h has to be included
9800 set sys/select.h i_sysselct
9801 eval $inhdr
9802
9803 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9804 while $test $# -ge 2; do
9805         case "$1" in
9806         $define) echo "#include <$2>";;
9807         esac ;
9808     shift 2;
9809 done > try.c;
9810 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9811 set try;
9812 if eval $compile; then
9813         val="$define";
9814 else
9815         val="$undef";
9816 fi;
9817 set $varname;
9818 eval $setvar;
9819 $rm_try'
9820
9821 : see if we should include time.h, sys/time.h, or both
9822 echo " "
9823 if test "X$timeincl" = X; then
9824         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9825         $echo $n "I'm now running the test program...$c"
9826         $cat >try.c <<EOCP
9827 #include <sys/types.h>
9828 #ifdef I_TIME
9829 #include <time.h>
9830 #endif
9831 #ifdef I_SYSTIME
9832 #ifdef SYSTIMEKERNEL
9833 #define KERNEL
9834 #endif
9835 #include <sys/time.h>
9836 #endif
9837 #ifdef I_SYSSELECT
9838 #include <sys/select.h>
9839 #endif
9840 #$i_stdlib I_STDLIB
9841 #ifdef I_STDLIB
9842 #include <stdlib.h>
9843 #endif
9844 int main()
9845 {
9846         struct tm foo;
9847 #ifdef S_TIMEVAL
9848         struct timeval bar;
9849 #endif
9850 #ifdef S_TIMEZONE
9851         struct timezone tzp;
9852 #endif
9853         if (foo.tm_sec == foo.tm_sec)
9854                 exit(0);
9855 #ifdef S_TIMEVAL
9856         if (bar.tv_sec == bar.tv_sec)
9857                 exit(0);
9858 #endif
9859         exit(1);
9860 }
9861 EOCP
9862         flags=''
9863         for s_timezone in '-DS_TIMEZONE' ''; do
9864         sysselect=''
9865         for s_timeval in '-DS_TIMEVAL' ''; do
9866         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9867         for i_time in '' '-DI_TIME'; do
9868         for i_systime in '-DI_SYSTIME' ''; do
9869                 case "$flags" in
9870                 '') $echo $n ".$c"
9871                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9872                         if eval $compile; then
9873                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9874                                 shift
9875                                 flags="$*"
9876                                 echo " "
9877                                 $echo $n "Succeeded with $flags$c"
9878                         fi
9879                         ;;
9880                 esac
9881         done
9882         done
9883         done
9884         done
9885         done
9886         timeincl=''
9887         echo " "
9888         case "$flags" in
9889         *SYSTIMEKERNEL*) i_systimek="$define"
9890                 timeincl=`./findhdr sys/time.h`
9891                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9892         *) i_systimek="$undef";;
9893         esac
9894         case "$flags" in
9895         *I_TIME*) i_time="$define"
9896                 timeincl=`./findhdr time.h`" $timeincl"
9897                 echo "We'll include <time.h>." >&4;;
9898         *) i_time="$undef";;
9899         esac
9900         case "$flags" in
9901         *I_SYSTIME*) i_systime="$define"
9902                 timeincl=`./findhdr sys/time.h`" $timeincl"
9903                 echo "We'll include <sys/time.h>." >&4;;
9904         *) i_systime="$undef";;
9905         esac
9906         $rm_try
9907 fi
9908 : see if struct tm knows about tm_zone
9909 case "$i_systime$i_time" in
9910 *$define*)
9911         echo " "
9912         echo "Checking to see if your struct tm has tm_zone field..." >&4
9913         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9914         eval $hasfield
9915         ;;
9916 *)      val="$undef"
9917         set d_tm_tm_zone
9918         eval $setvar
9919         ;;
9920 esac
9921 case "$d_tm_tm_zone" in
9922 "$define")      echo "Yes, it does."   ;;
9923 *)              echo "No, it doesn't." ;;
9924 esac
9925 : see if struct tm knows about tm_gmtoff
9926 case "$i_systime$i_time" in
9927 *$define*)
9928         echo " "
9929         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9930         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9931         eval $hasfield
9932         ;;
9933 *)      val="$undef"
9934         set d_tm_tm_gmtoff
9935         eval $setvar
9936         ;;
9937 esac
9938 case "$d_tm_tm_gmtoff" in
9939 "$define")      echo "Yes, it does."   ;;
9940 *)              echo "No, it doesn't." ;;
9941 esac
9942
9943 : see if asctime_r exists
9944 set asctime_r d_asctime_r
9945 eval $inlibc
9946 case "$d_asctime_r" in
9947 "$define")
9948         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9949         case "$d_asctime_r_proto:$usethreads" in
9950         ":define")      d_asctime_r_proto=define
9951                 set d_asctime_r_proto asctime_r $hdrs
9952                 eval $hasproto ;;
9953         *)      ;;
9954         esac
9955         case "$d_asctime_r_proto" in
9956         define)
9957         case "$asctime_r_proto" in
9958         ''|0) try='char* asctime_r(const struct tm*, char*);'
9959         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9960         esac
9961         case "$asctime_r_proto" in
9962         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9963         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9964         esac
9965         case "$asctime_r_proto" in
9966         ''|0) try='int asctime_r(const struct tm*, char*);'
9967         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9968         esac
9969         case "$asctime_r_proto" in
9970         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9971         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9972         esac
9973         case "$asctime_r_proto" in
9974         ''|0)   d_asctime_r=undef
9975                 asctime_r_proto=0
9976                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9977         * )     case "$asctime_r_proto" in
9978                 REENTRANT_PROTO*) ;;
9979                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9980                 esac
9981                 echo "Prototype: $try" ;;
9982         esac
9983         ;;
9984         *)      case "$usethreads" in
9985                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9986                 esac
9987                 d_asctime_r=undef
9988                 asctime_r_proto=0
9989                 ;;
9990         esac
9991         ;;
9992 *)      asctime_r_proto=0
9993         ;;
9994 esac
9995
9996 : see if atolf exists
9997 set atolf d_atolf
9998 eval $inlibc
9999
10000 : see if atoll exists
10001 set atoll d_atoll
10002 eval $inlibc
10003
10004 : Look for GCC-style attribute format
10005 case "$d_attribute_format" in
10006 '')
10007 echo " "
10008 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10009 $cat >attrib.c <<'EOCP'
10010 #include <stdio.h>
10011 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10012 EOCP
10013 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10014         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10015                 echo "Your C compiler doesn't support __attribute__((format))."
10016                 val="$undef"
10017         else
10018                 echo "Your C compiler supports __attribute__((format))."
10019                 val="$define"
10020         fi
10021 else
10022         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10023         val="$undef"
10024 fi
10025 ;;
10026 *) val="$d_attribute_format" ;;
10027 esac
10028 set d_attribute_format
10029 eval $setvar
10030 $rm -f attrib*
10031
10032 : Look for GCC-style attribute format with null format allowed
10033 case "$d_printf_format_null" in
10034 '') case "$d_attribute_format" in
10035     $define)
10036         echo " "
10037         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10038 $cat >attrib.c <<EOCP
10039 #include <stdio.h>
10040 #$i_stdlib I_STDLIB
10041 #ifdef I_STDLIB
10042 #include <stdlib.h>
10043 #endif
10044 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10045 int null_printf (char* pat,...) { return (int)pat; }
10046 int main () { exit(null_printf(NULL)); }
10047 EOCP
10048         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10049             : run the executable in case it produces a run-time warning
10050             if $run ./attrib >>attrib.out 2>&1; then
10051                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10052                     echo "Your C compiler doesn't allow __printf__ format to be null."
10053                     val="$undef"
10054                 else
10055                     echo "Your C compiler allows __printf__ format to be null."
10056                     val="$define"
10057                 fi
10058             else
10059             echo "Your C compiler executable failed with __printf__ format null."
10060             val="$undef"
10061         fi
10062     else
10063         echo "Your C compiler fails with __printf__ format null."
10064         val="$undef"
10065     fi
10066     ;;
10067     *)  val="$undef" ;;
10068     esac
10069 ;;
10070 *)  val="$d_printf_format_null" ;;
10071 esac
10072 set d_printf_format_null
10073 eval $setvar
10074 $rm -f attrib*
10075
10076 : Look for GCC-style attribute malloc
10077 case "$d_attribute_malloc" in
10078 '')
10079 echo " "
10080 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10081 $cat >attrib.c <<'EOCP'
10082 #include <stdio.h>
10083 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10084 EOCP
10085 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10086         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10087                 echo "Your C compiler doesn't support __attribute__((malloc))."
10088                 val="$undef"
10089         else
10090                 echo "Your C compiler supports __attribute__((malloc))."
10091                 val="$define"
10092         fi
10093 else
10094         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10095         val="$undef"
10096 fi
10097 ;;
10098 *) val="$d_attribute_malloc" ;;
10099 esac
10100 set d_attribute_malloc
10101 eval $setvar
10102 $rm -f attrib*
10103
10104 : Look for GCC-style attribute nonnull
10105 case "$d_attribute_nonnull" in
10106 '')
10107 echo " "
10108 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10109 $cat >attrib.c <<'EOCP'
10110 #include <stdio.h>
10111 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10112 EOCP
10113 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10114         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10115                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10116                 val="$undef"
10117         else
10118                 echo "Your C compiler supports __attribute__((nonnull))."
10119                 val="$define"
10120         fi
10121 else
10122         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10123         val="$undef"
10124 fi
10125 ;;
10126 *) val="$d_attribute_nonnull" ;;
10127 esac
10128 set d_attribute_nonnull
10129 eval $setvar
10130 $rm -f attrib*
10131
10132 : Look for GCC-style attribute noreturn
10133 case "$d_attribute_noreturn" in
10134 '')
10135 echo " "
10136 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10137 $cat >attrib.c <<'EOCP'
10138 #include <stdio.h>
10139 void fall_over_dead( void ) __attribute__((noreturn));
10140 EOCP
10141 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10142         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10143                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10144                 val="$undef"
10145         else
10146                 echo "Your C compiler supports __attribute__((noreturn))."
10147                 val="$define"
10148         fi
10149 else
10150         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10151         val="$undef"
10152 fi
10153 ;;
10154 *) val="$d_attribute_noreturn" ;;
10155 esac
10156 set d_attribute_noreturn
10157 eval $setvar
10158 $rm -f attrib*
10159
10160 : Look for GCC-style attribute pure
10161 case "$d_attribute_pure" in
10162 '')
10163 echo " "
10164 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10165 $cat >attrib.c <<'EOCP'
10166 #include <stdio.h>
10167 int square( int n ) __attribute__((pure));
10168 EOCP
10169 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10170         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10171                 echo "Your C compiler doesn't support __attribute__((pure))."
10172                 val="$undef"
10173         else
10174                 echo "Your C compiler supports __attribute__((pure))."
10175                 val="$define"
10176         fi
10177 else
10178         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10179         val="$undef"
10180 fi
10181 ;;
10182 *) val="$d_attribute_pure" ;;
10183 esac
10184 set d_attribute_pure
10185 eval $setvar
10186 $rm -f attrib*
10187
10188 : Look for GCC-style attribute unused
10189 case "$d_attribute_unused" in
10190 '')
10191 echo " "
10192 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10193 $cat >attrib.c <<'EOCP'
10194 #include <stdio.h>
10195 int do_something( int dummy __attribute__((unused)), int n );
10196 EOCP
10197 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10198         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10199                 echo "Your C compiler doesn't support __attribute__((unused))."
10200                 val="$undef"
10201         else
10202                 echo "Your C compiler supports __attribute__((unused))."
10203                 val="$define"
10204         fi
10205 else
10206         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10207         val="$undef"
10208 fi
10209 ;;
10210 *) val="$d_attribute_unused" ;;
10211 esac
10212 set d_attribute_unused
10213 eval $setvar
10214 $rm -f attrib*
10215
10216 : Look for GCC-style attribute warn_unused_result
10217 case "$d_attribute_warn_unused_result" in
10218 '')
10219 echo " "
10220 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10221 $cat >attrib.c <<'EOCP'
10222 #include <stdio.h>
10223 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10224 EOCP
10225 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10226         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10227                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10228                 val="$undef"
10229         else
10230                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10231                 val="$define"
10232         fi
10233 else
10234         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10235         val="$undef"
10236 fi
10237 ;;
10238 *) val="$d_attribute_warn_unused_result" ;;
10239 esac
10240 set d_attribute_warn_unused_result
10241 eval $setvar
10242 $rm -f attrib*
10243
10244 : see if bcmp exists
10245 set bcmp d_bcmp
10246 eval $inlibc
10247
10248 : see if bcopy exists
10249 set bcopy d_bcopy
10250 eval $inlibc
10251
10252 : see if getpgrp exists
10253 set getpgrp d_getpgrp
10254 eval $inlibc
10255
10256 case "$d_getpgrp" in
10257 "$define")
10258         echo " "
10259         echo "Checking to see which flavor of getpgrp is in use..."
10260         $cat >try.c <<EOP
10261 #$i_unistd I_UNISTD
10262 #include <sys/types.h>
10263 #ifdef I_UNISTD
10264 #  include <unistd.h>
10265 #endif
10266 #$i_stdlib I_STDLIB
10267 #ifdef I_STDLIB
10268 #include <stdlib.h>
10269 #endif
10270 int main()
10271 {
10272         if (getuid() == 0) {
10273                 printf("(I see you are running Configure as super-user...)\n");
10274                 setuid(1);
10275         }
10276 #ifdef TRY_BSD_PGRP
10277         if (getpgrp(1) == 0)
10278                 exit(0);
10279 #else
10280         if (getpgrp() > 0)
10281                 exit(0);
10282 #endif
10283         exit(1);
10284 }
10285 EOP
10286         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10287                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10288                 val="$define"
10289         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10290                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10291                 val="$undef"
10292         else
10293                 echo "I can't seem to compile and run the test program."
10294                 if ./usg; then
10295                         xxx="a USG one, i.e. you use getpgrp()."
10296                 else
10297                         # SVR4 systems can appear rather BSD-ish.
10298                         case "$i_unistd" in
10299                         $undef)
10300                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10301                                 val="$define"
10302                                 ;;
10303                         $define)
10304                                 xxx="probably a USG one, i.e. you use getpgrp()."
10305                                 val="$undef"
10306                                 ;;
10307                         esac
10308                 fi
10309                 echo "Assuming your getpgrp is $xxx" >&4
10310         fi
10311         ;;
10312 *) val="$undef";;
10313 esac
10314 set d_bsdgetpgrp
10315 eval $setvar
10316 $rm_try
10317
10318 : see if setpgrp exists
10319 set setpgrp d_setpgrp
10320 eval $inlibc
10321
10322 case "$d_setpgrp" in
10323 "$define")
10324         echo " "
10325         echo "Checking to see which flavor of setpgrp is in use..."
10326         $cat >try.c <<EOP
10327 #$i_unistd I_UNISTD
10328 #include <sys/types.h>
10329 #ifdef I_UNISTD
10330 #  include <unistd.h>
10331 #endif
10332 #$i_stdlib I_STDLIB
10333 #ifdef I_STDLIB
10334 #include <stdlib.h>
10335 #endif
10336 int main()
10337 {
10338         if (getuid() == 0) {
10339                 printf("(I see you are running Configure as super-user...)\n");
10340                 setuid(1);
10341         }
10342 #ifdef TRY_BSD_PGRP
10343         if (-1 == setpgrp(1, 1))
10344                 exit(0);
10345 #else
10346         if (setpgrp() != -1)
10347                 exit(0);
10348 #endif
10349         exit(1);
10350 }
10351 EOP
10352         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10353                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10354                 val="$define"
10355         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10356                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10357                 val="$undef"
10358         else
10359                 echo "(I can't seem to compile and run the test program.)"
10360                 if ./usg; then
10361                         xxx="a USG one, i.e. you use setpgrp()."
10362                 else
10363                         # SVR4 systems can appear rather BSD-ish.
10364                         case "$i_unistd" in
10365                         $undef)
10366                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10367                                 val="$define"
10368                                 ;;
10369                         $define)
10370                                 xxx="probably a USG one, i.e. you use setpgrp()."
10371                                 val="$undef"
10372                                 ;;
10373                         esac
10374                 fi
10375                 echo "Assuming your setpgrp is $xxx" >&4
10376         fi
10377         ;;
10378 *) val="$undef";;
10379 esac
10380 set d_bsdsetpgrp
10381 eval $setvar
10382 $rm_try
10383
10384 : Look for GCC-style __builtin_choose_expr
10385 case "$d_builtin_choose_expr" in
10386 '')
10387     echo " "
10388     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10389     $cat >try.c <<'EOCP'
10390 #include <assert.h>
10391 #include <stdlib.h>
10392 #include <stdio.h>
10393
10394 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10395
10396 int main(void) {
10397     assert( SYRINX(1) == 2112 );
10398     assert( SYRINX(1) != 5150 );
10399     assert( SYRINX(0) == 5150 );
10400     assert( SYRINX(0) != 2112 );
10401     puts( "All good!" );
10402     exit(0);
10403 }
10404
10405 EOCP
10406     set try
10407     if eval $compile; then
10408         echo "Your C compiler supports __builtin_choose_expr."
10409         val="$define"
10410     else
10411         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10412         val="$undef"
10413     fi
10414 ;;
10415 *) val="$d_builtin_choose_expr" ;;
10416 esac
10417
10418 set d_builtin_choose_expr
10419 eval $setvar
10420 $rm_try
10421
10422 : Look for GCC-style __builtin_expect
10423 case "$d_builtin_expect" in
10424 '')
10425     echo " "
10426     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10427     $cat >builtin.c <<'EOCP'
10428 int main(void) {
10429     int n = 50;
10430     if ( __builtin_expect(n, 0) ) n = 1;
10431 }
10432 EOCP
10433     set try
10434     if eval $compile; then
10435         echo "Your C compiler supports __builtin_choose_expr."
10436         val="$define"
10437     else
10438         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10439         val="$undef"
10440     fi
10441     ;;
10442 *) val="$d_builtin_expect" ;;
10443 esac
10444
10445 set d_builtin_expect
10446 eval $setvar
10447 $rm_try
10448
10449 : see if bzero exists
10450 set bzero d_bzero
10451 eval $inlibc
10452
10453 : see if stdarg is available
10454 echo " "
10455 if $test `./findhdr stdarg.h`; then
10456         echo "<stdarg.h> found." >&4
10457         valstd="$define"
10458 else
10459         echo "<stdarg.h> NOT found." >&4
10460         valstd="$undef"
10461 fi
10462
10463 : see if varags is available
10464 echo " "
10465 if $test `./findhdr varargs.h`; then
10466         echo "<varargs.h> found." >&4
10467 else
10468         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10469 fi
10470
10471 : set up the varargs testing programs
10472 $cat > varargs.c <<EOP
10473 #ifdef I_STDARG
10474 #include <stdarg.h>
10475 #endif
10476 #ifdef I_VARARGS
10477 #include <varargs.h>
10478 #endif
10479
10480 #ifdef I_STDARG
10481 int f(char *p, ...)
10482 #else
10483 int f(va_alist)
10484 va_dcl
10485 #endif
10486 {
10487         va_list ap;
10488 #ifndef I_STDARG
10489         char *p;
10490 #endif
10491 #ifdef I_STDARG
10492         va_start(ap,p);
10493 #else
10494         va_start(ap);
10495         p = va_arg(ap, char *);
10496 #endif
10497         va_end(ap);
10498         return 0;
10499 }
10500 EOP
10501 $cat > varargs <<EOP
10502 $startsh
10503 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10504         echo "true"
10505 else
10506         echo "false"
10507 fi
10508 $rm -f varargs$_o
10509 EOP
10510 chmod +x varargs
10511
10512 : now check which varargs header should be included
10513 echo " "
10514 i_varhdr=''
10515 case "$valstd" in
10516 "$define")
10517         if `./varargs I_STDARG`; then
10518                 val='stdarg.h'
10519         elif `./varargs I_VARARGS`; then
10520                 val='varargs.h'
10521         fi
10522         ;;
10523 *)
10524         if `./varargs I_VARARGS`; then
10525                 val='varargs.h'
10526         fi
10527         ;;
10528 esac
10529 case "$val" in
10530 '')
10531 echo "I could not find the definition for va_dcl... You have problems..." >&4
10532         val="$undef"; set i_stdarg; eval $setvar
10533         val="$undef"; set i_varargs; eval $setvar
10534         ;;
10535 *) 
10536         set i_varhdr
10537         eval $setvar
10538         case "$i_varhdr" in
10539         stdarg.h)
10540                 val="$define"; set i_stdarg; eval $setvar
10541                 val="$undef"; set i_varargs; eval $setvar
10542                 ;;
10543         varargs.h)
10544                 val="$undef"; set i_stdarg; eval $setvar
10545                 val="$define"; set i_varargs; eval $setvar
10546                 ;;
10547         esac
10548         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10549 esac
10550 $rm -f varargs*
10551
10552 : see if the Compiler supports C99 variadic macros
10553 case "$i_stdarg$i_stdlib" in
10554     "$define$define")
10555     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10556     $cat >try.c <<EOCP
10557 #include <stdio.h>
10558 #include <stdarg.h>
10559
10560 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10561
10562 int main() {
10563   char buf[20];
10564   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10565   puts(buf);
10566   return 0;
10567 }
10568 EOCP
10569     set try
10570     if eval $compile && $run ./try 2>&1 >/dev/null; then
10571         case "`$run ./try`" in
10572             "123 456 789")
10573             echo "You have C99 variadic macros." >&4
10574             d_c99_variadic_macros="$define"
10575             ;;
10576             *)
10577             echo "You don't have functional C99 variadic macros." >&4
10578             d_c99_variadic_macros="$undef"
10579             ;;
10580         esac
10581     else
10582         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10583         d_c99_variadic_macros="$undef"
10584     fi
10585     $rm_try
10586     ;;
10587     *)
10588     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10589     d_c99_variadic_macros="$undef"
10590     ;;
10591 esac
10592
10593 : see if signal is declared as pointer to function returning int or void
10594 echo " "
10595 xxx=`./findhdr signal.h`
10596 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10597 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10598         echo "You have int (*signal())() instead of void." >&4
10599         val="$undef"
10600 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10601         echo "You have void (*signal())()." >&4
10602         val="$define"
10603 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10604         echo "You have int (*signal())() instead of void." >&4
10605         val="$undef"
10606 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10607         echo "You have void (*signal())()." >&4
10608         val="$define"
10609 else
10610         case "$d_voidsig" in
10611         '')
10612         echo "I can't determine whether signal handler returns void or int..." >&4
10613                 dflt=void
10614                 rp="What type does your signal handler return?"
10615                 . ./myread
10616                 case "$ans" in
10617                 v*) val="$define";;
10618                 *) val="$undef";;
10619                 esac;;
10620         "$define")
10621                 echo "As you already told me, signal handler returns void." >&4
10622                 val="$define"
10623                 ;;
10624         *)      echo "As you already told me, signal handler returns int." >&4
10625                 val="$undef"
10626                 ;;
10627         esac
10628 fi
10629 set d_voidsig
10630 eval $setvar
10631 case "$d_voidsig" in
10632 "$define") signal_t="void";;
10633 *) signal_t="int";;
10634 esac
10635 $rm -f $$.tmp
10636
10637 : check for ability to cast large floats to 32-bit ints.
10638 echo " "
10639 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10640 if $test "$intsize" -ge 4; then
10641         xxx=int
10642 else
10643         xxx=long
10644 fi
10645 $cat >try.c <<EOCP
10646 #include <stdio.h>
10647 #$i_stdlib I_STDLIB
10648 #ifdef I_STDLIB
10649 #include <stdlib.h>
10650 #endif
10651 #include <sys/types.h>
10652 #include <signal.h>
10653 $signal_t blech(int s) { exit(3); }
10654 int main()
10655 {
10656         $xxx i32;
10657         double f, g;
10658         int result = 0;
10659         char str[16];
10660         signal(SIGFPE, blech);
10661
10662         /* Don't let compiler optimize the test away.  Store the number
10663            in a writable string for gcc to pass to sscanf under HP/UX.
10664         */
10665         sprintf(str, "2147483647");
10666         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10667         g = 10 * f;
10668         i32  = ($xxx) g;
10669
10670         /* x86 processors will probably give 0x8000 0000, which is a
10671            sign change.  We don't want that.  We want to mimic SPARC
10672            behavior here, which is to preserve the sign and give
10673            back 0x7fff ffff.
10674         */
10675         if (i32 != ($xxx) f)
10676                 result |= 1;
10677         exit(result);
10678 }
10679 EOCP
10680 set try
10681 if eval $compile_ok; then
10682         $run ./try
10683         yyy=$?
10684 else
10685         echo "(I can't seem to compile the test program--assuming it can't)"
10686         yyy=1
10687 fi
10688 case "$yyy" in
10689 0)      val="$define"
10690         echo "Yup, it can."
10691         ;;
10692 *)      val="$undef"
10693         echo "Nope, it can't."
10694         ;;
10695 esac
10696 set d_casti32
10697 eval $setvar
10698 $rm_try
10699
10700 : check for ability to cast negative floats to unsigned
10701 echo " "
10702 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10703 $cat >try.c <<EOCP
10704 #include <stdio.h>
10705 #$i_stdlib I_STDLIB
10706 #ifdef I_STDLIB
10707 #include <stdlib.h>
10708 #endif
10709 #include <sys/types.h>
10710 #include <signal.h>
10711 $signal_t blech(int s) { exit(7); }
10712 $signal_t blech_in_list(int s) { exit(4); }
10713 unsigned long dummy_long(unsigned long p) { return p; }
10714 unsigned int dummy_int(unsigned int p) { return p; }
10715 unsigned short dummy_short(unsigned short p) { return p; }
10716 int main()
10717 {
10718         double f;
10719         unsigned long along;
10720         unsigned int aint;
10721         unsigned short ashort;
10722         int result = 0;
10723         char str[16];
10724
10725         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10726            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10727            optimized the whole file away
10728         */
10729         /* Store the number in a writable string for gcc to pass to
10730            sscanf under HP/UX.
10731         */
10732         sprintf(str, "-123");
10733         sscanf(str, "%lf", &f);  /* f = -123.; */
10734
10735         signal(SIGFPE, blech);
10736         along = (unsigned long)f;
10737         aint = (unsigned int)f;
10738         ashort = (unsigned short)f;
10739         if (along != (unsigned long)-123)
10740                 result |= 1;
10741         if (aint != (unsigned int)-123)
10742                 result |= 1;
10743         if (ashort != (unsigned short)-123)
10744                 result |= 1;
10745         sprintf(str, "1073741824.");
10746         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10747         f = f + f;
10748         along = 0;
10749         along = (unsigned long)f;
10750         if (along != 0x80000000)
10751                 result |= 2;
10752         f -= 1.;
10753         along = 0;
10754         along = (unsigned long)f;
10755         if (along != 0x7fffffff)
10756                 result |= 1;
10757         f += 2.;
10758         along = 0;
10759         along = (unsigned long)f;
10760         if (along != 0x80000001)
10761                 result |= 2;
10762         if (result)
10763                 exit(result);
10764         signal(SIGFPE, blech_in_list);
10765         sprintf(str, "123.");
10766         sscanf(str, "%lf", &f);  /* f = 123.; */
10767         along = dummy_long((unsigned long)f);
10768         aint = dummy_int((unsigned int)f);
10769         ashort = dummy_short((unsigned short)f);
10770         if (along != (unsigned long)123)
10771                 result |= 4;
10772         if (aint != (unsigned int)123)
10773                 result |= 4;
10774         if (ashort != (unsigned short)123)
10775                 result |= 4;
10776         exit(result);
10777
10778 }
10779 EOCP
10780 set try
10781 if eval $compile_ok; then
10782         $run ./try
10783         castflags=$?
10784 else
10785         echo "(I can't seem to compile the test program--assuming it can't)"
10786         castflags=7
10787 fi
10788 case "$castflags" in
10789 0)      val="$define"
10790         echo "Yup, it can."
10791         ;;
10792 *)      val="$undef"
10793         echo "Nope, it can't."
10794         ;;
10795 esac
10796 set d_castneg
10797 eval $setvar
10798 $rm_try
10799
10800 : see if vprintf exists
10801 echo " "
10802 if set vprintf val -f d_vprintf; eval $csym; $val; then
10803         echo 'vprintf() found.' >&4
10804         val="$define"
10805         $cat >try.c <<EOF
10806 #include <varargs.h>
10807 #$i_stdlib I_STDLIB
10808 #ifdef I_STDLIB
10809 #include <stdlib.h>
10810 #endif
10811
10812 int main() { xxx("foo"); }
10813
10814 xxx(va_alist)
10815 va_dcl
10816 {
10817         va_list args;
10818         char buf[10];
10819
10820         va_start(args);
10821         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10822 }
10823 EOF
10824         set try
10825         if eval $compile && $run ./try; then
10826                 echo "Your vsprintf() returns (int)." >&4
10827                 val2="$undef"
10828         else
10829                 echo "Your vsprintf() returns (char*)." >&4
10830                 val2="$define"
10831         fi
10832 else
10833         echo 'vprintf() NOT found.' >&4
10834                 val="$undef"
10835                 val2="$undef"
10836 fi
10837 $rm_try
10838 set d_vprintf
10839 eval $setvar
10840 val=$val2
10841 set d_charvspr
10842 eval $setvar
10843
10844 : see if chown exists
10845 set chown d_chown
10846 eval $inlibc
10847
10848 : see if chroot exists
10849 set chroot d_chroot
10850 eval $inlibc
10851
10852 : see if chsize exists
10853 set chsize d_chsize
10854 eval $inlibc
10855
10856 : see if class exists
10857 set class d_class
10858 eval $inlibc
10859
10860 : see if clearenv exists
10861 set clearenv d_clearenv
10862 eval $inlibc
10863
10864 hasstruct='varname=$1; struct=$2; shift; shift;
10865 while $test $# -ge 2; do
10866         case "$1" in
10867         $define) echo "#include <$2>";;
10868         esac ;
10869     shift 2;
10870 done > try.c;
10871 echo "int main () { struct $struct foo; }" >> try.c;
10872 set try;
10873 if eval $compile; then
10874         val="$define";
10875 else
10876         val="$undef";
10877 fi;
10878 set $varname;
10879 eval $setvar;
10880 $rm_try'
10881
10882 socketlib=''
10883 sockethdr=''
10884 : see whether socket exists
10885 echo " "
10886 $echo $n "Hmm... $c" >&4
10887 if set socket val -f d_socket; eval $csym; $val; then
10888         echo "Looks like you have Berkeley networking support." >&4
10889         d_socket="$define"
10890         if set setsockopt val -f; eval $csym; $val; then
10891                 d_oldsock="$undef"
10892         else
10893                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10894                 d_oldsock="$define"
10895         fi
10896 else
10897         if $contains socklib libc.list >/dev/null 2>&1; then
10898                 echo "Looks like you have Berkeley networking support." >&4
10899                 d_socket="$define"
10900                 : we will have to assume that it supports the 4.2 BSD interface
10901                 d_oldsock="$undef"
10902         else
10903                 echo "You don't have Berkeley networking in libc$_a..." >&4
10904                 if test "X$d_socket" = "X$define"; then
10905                    echo "...but you seem to believe that you have sockets." >&4
10906                 else
10907                         for net in net socket
10908                         do
10909                                 if test -f /usr/lib/lib$net$_a; then
10910                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10911                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10912                                         if $contains socket libc.list >/dev/null 2>&1; then
10913                                                 d_socket="$define"
10914                                                 socketlib="-l$net"
10915                                                 case "$net" in
10916                                                 net)
10917                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10918                                                         sockethdr="-I/usr/netinclude"
10919                                                         ;;
10920                                                 esac
10921                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10922                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10923                                                         d_oldsock="$undef"
10924                                                 else
10925                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10926                                                         d_oldsock="$define"
10927                                                 fi
10928                                                 break
10929                                         fi
10930                                 fi
10931                         done
10932                         if test "X$d_socket" != "X$define"; then
10933                            echo "or anywhere else I see." >&4
10934                            d_socket="$undef"
10935                            d_oldsock="$undef"
10936                         fi
10937                 fi
10938         fi
10939 fi
10940
10941 : see if socketpair exists
10942 set socketpair d_sockpair
10943 eval $inlibc
10944
10945
10946 echo " "
10947 echo "Checking the availability of certain socket constants..." >&4
10948 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10949         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10950         $cat >try.c <<EOF
10951 #include <sys/types.h>
10952 #include <sys/socket.h>
10953 int main() {
10954     int i = $ENUM;
10955 }
10956 EOF
10957         val="$undef"
10958         set try; if eval $compile; then
10959                 val="$define"
10960         fi
10961         set d_${enum}; eval $setvar
10962         $rm_try
10963 done
10964
10965 : see if this is a sys/uio.h system
10966 set sys/uio.h i_sysuio
10967 eval $inhdr
10968
10969
10970 echo " "
10971 echo "Checking to see if your system supports struct cmsghdr..." >&4
10972 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10973 eval $hasstruct
10974 case "$d_cmsghdr_s" in
10975 "$define")      echo "Yes, it does."   ;;
10976 *)              echo "No, it doesn't." ;;
10977 esac
10978
10979
10980 : check for const keyword
10981 echo " "
10982 echo 'Checking to see if your C compiler knows about "const"...' >&4
10983 $cat >const.c <<'EOCP'
10984 typedef struct spug { int drokk; } spug;
10985 int main()
10986 {
10987         const char *foo;
10988         const spug y = { 0 };
10989 }
10990 EOCP
10991 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10992         val="$define"
10993         echo "Yup, it does."
10994 else
10995         val="$undef"
10996         echo "Nope, it doesn't."
10997 fi
10998 set d_const
10999 eval $setvar
11000
11001 : see if copysignl exists
11002 set copysignl d_copysignl
11003 eval $inlibc
11004
11005 : see if crypt exists
11006 echo " "
11007 set crypt d_crypt
11008 eval $inlibc
11009 case "$d_crypt" in
11010 $define) cryptlib='' ;;
11011 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11012                 echo 'crypt() found.' >&4
11013                 val="$define"
11014                 cryptlib=''
11015         else
11016                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11017                 if $test -z "$cryptlib"; then
11018                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11019                 else
11020                         cryptlib=-lcrypt
11021                 fi
11022                 if $test -z "$cryptlib"; then
11023                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11024                 else
11025                         cryptlib=-lcrypt
11026                 fi
11027                 if $test -z "$cryptlib"; then
11028                         cryptlib=`./loc libcrypt$_a "" $libpth`
11029                 else
11030                         cryptlib=-lcrypt
11031                 fi
11032                 if $test -z "$cryptlib"; then
11033                         echo 'crypt() NOT found.' >&4
11034                         val="$undef"
11035                 else
11036                         val="$define"
11037                 fi
11038         fi
11039         set d_crypt
11040         eval $setvar
11041         ;;
11042 esac
11043
11044 : see if this is a crypt.h system
11045 set crypt.h i_crypt
11046 eval $inhdr
11047
11048 : see if crypt_r exists
11049 set crypt_r d_crypt_r
11050 eval $inlibc
11051 case "$d_crypt_r" in
11052 "$define")
11053         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11054         case "$d_crypt_r_proto:$usethreads" in
11055         ":define")      d_crypt_r_proto=define
11056                 set d_crypt_r_proto crypt_r $hdrs
11057                 eval $hasproto ;;
11058         *)      ;;
11059         esac
11060         case "$d_crypt_r_proto" in
11061         define)
11062         case "$crypt_r_proto" in
11063         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11064         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11065         esac
11066         case "$crypt_r_proto" in
11067         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11068         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11069         esac
11070         case "$crypt_r_proto" in
11071         ''|0)   d_crypt_r=undef
11072                 crypt_r_proto=0
11073                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11074         * )     case "$crypt_r_proto" in
11075                 REENTRANT_PROTO*) ;;
11076                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11077                 esac
11078                 echo "Prototype: $try" ;;
11079         esac
11080         ;;
11081         *)      case "$usethreads" in
11082                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11083                 esac
11084                 d_crypt_r=undef
11085                 crypt_r_proto=0
11086                 ;;
11087         esac
11088         ;;
11089 *)      crypt_r_proto=0
11090         ;;
11091 esac
11092
11093 : get csh whereabouts
11094 case "$csh" in
11095 'csh') val="$undef" ;;
11096 *) val="$define" ;;
11097 esac
11098 set d_csh
11099 eval $setvar
11100 : Respect a hint or command line value for full_csh.
11101 case "$full_csh" in
11102 '') full_csh=$csh ;;
11103 esac
11104
11105 : see if ctermid exists
11106 set ctermid d_ctermid
11107 eval $inlibc
11108
11109 : see if ctermid_r exists
11110 set ctermid_r d_ctermid_r
11111 eval $inlibc
11112 case "$d_ctermid_r" in
11113 "$define")
11114         hdrs="$i_systypes sys/types.h define stdio.h "
11115         case "$d_ctermid_r_proto:$usethreads" in
11116         ":define")      d_ctermid_r_proto=define
11117                 set d_ctermid_r_proto ctermid_r $hdrs
11118                 eval $hasproto ;;
11119         *)      ;;
11120         esac
11121         case "$d_ctermid_r_proto" in
11122         define)
11123         case "$ctermid_r_proto" in
11124         ''|0) try='char* ctermid_r(char*);'
11125         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11126         esac
11127         case "$ctermid_r_proto" in
11128         ''|0)   d_ctermid_r=undef
11129                 ctermid_r_proto=0
11130                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11131         * )     case "$ctermid_r_proto" in
11132                 REENTRANT_PROTO*) ;;
11133                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11134                 esac
11135                 echo "Prototype: $try" ;;
11136         esac
11137         ;;
11138         *)      case "$usethreads" in
11139                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11140                 esac
11141                 d_ctermid_r=undef
11142                 ctermid_r_proto=0
11143                 ;;
11144         esac
11145         ;;
11146 *)      ctermid_r_proto=0
11147         ;;
11148 esac
11149
11150 : see if ctime_r exists
11151 set ctime_r d_ctime_r
11152 eval $inlibc
11153 case "$d_ctime_r" in
11154 "$define")
11155         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11156         case "$d_ctime_r_proto:$usethreads" in
11157         ":define")      d_ctime_r_proto=define
11158                 set d_ctime_r_proto ctime_r $hdrs
11159                 eval $hasproto ;;
11160         *)      ;;
11161         esac
11162         case "$d_ctime_r_proto" in
11163         define)
11164         case "$ctime_r_proto" in
11165         ''|0) try='char* ctime_r(const time_t*, char*);'
11166         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11167         esac
11168         case "$ctime_r_proto" in
11169         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11170         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11171         esac
11172         case "$ctime_r_proto" in
11173         ''|0) try='int ctime_r(const time_t*, char*);'
11174         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11175         esac
11176         case "$ctime_r_proto" in
11177         ''|0) try='int ctime_r(const time_t*, char*, int);'
11178         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11179         esac
11180         case "$ctime_r_proto" in
11181         ''|0)   d_ctime_r=undef
11182                 ctime_r_proto=0
11183                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11184         * )     case "$ctime_r_proto" in
11185                 REENTRANT_PROTO*) ;;
11186                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11187                 esac
11188                 echo "Prototype: $try" ;;
11189         esac
11190         ;;
11191         *)      case "$usethreads" in
11192                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11193                 esac
11194                 d_ctime_r=undef
11195                 ctime_r_proto=0
11196                 ;;
11197         esac
11198         ;;
11199 *)      ctime_r_proto=0
11200         ;;
11201 esac
11202
11203 : see if cuserid exists
11204 set cuserid d_cuserid
11205 eval $inlibc
11206
11207 : see if this is a limits.h system
11208 set limits.h i_limits
11209 eval $inhdr
11210
11211 : see if this is a float.h system
11212 set float.h i_float
11213 eval $inhdr
11214
11215 : See if number of significant digits in a double precision number is known
11216 echo " "
11217 $cat >dbl_dig.c <<EOM
11218 #$i_limits I_LIMITS
11219 #$i_float I_FLOAT
11220 #ifdef I_LIMITS
11221 #include <limits.h>
11222 #endif
11223 #ifdef I_FLOAT
11224 #include <float.h>
11225 #endif
11226 #ifdef DBL_DIG
11227 printf("Contains DBL_DIG");
11228 #endif
11229 EOM
11230 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11231 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11232         echo "DBL_DIG found." >&4
11233         val="$define"
11234 else
11235         echo "DBL_DIG NOT found." >&4
11236         val="$undef"
11237 fi
11238 $rm -f dbl_dig.?
11239 set d_dbl_dig
11240 eval $setvar
11241
11242 : see if dbm.h is available
11243 : see if dbmclose exists
11244 set dbmclose d_dbmclose
11245 eval $inlibc
11246
11247 case "$d_dbmclose" in
11248 $define)
11249         set dbm.h i_dbm
11250         eval $inhdr
11251         case "$i_dbm" in
11252         $define)
11253                 val="$undef"
11254                 set i_rpcsvcdbm
11255                 eval $setvar
11256                 ;;
11257         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11258                 eval $inhdr
11259                 ;;
11260         esac
11261         ;;
11262 *)      echo "We won't be including <dbm.h>"
11263         val="$undef"
11264         set i_dbm
11265         eval $setvar
11266         val="$undef"
11267         set i_rpcsvcdbm
11268         eval $setvar
11269         ;;
11270 esac
11271
11272 : see if prototype for dbminit is available
11273 echo " "
11274 set d_dbminitproto dbminit $i_dbm dbm.h
11275 eval $hasproto
11276
11277 : see if difftime exists
11278 set difftime d_difftime
11279 eval $inlibc
11280
11281 : see if this is a dirent system
11282 echo " "
11283 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11284         val="$define"
11285         echo "<dirent.h> found." >&4
11286 else
11287         val="$undef"
11288         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11289                 echo "<sys/dir.h> found." >&4
11290                 echo " "
11291         else
11292                 xinc=`./findhdr sys/ndir.h`
11293         fi
11294         echo "<dirent.h> NOT found." >&4
11295 fi
11296 set i_dirent
11297 eval $setvar
11298
11299 : Look for type of directory structure.
11300 echo " "
11301 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11302
11303 case "$direntrytype" in
11304 ''|' ')
11305         case "$i_dirent" in
11306         $define) guess1='struct dirent' ;;
11307         *) guess1='struct direct'  ;;
11308         esac
11309         ;;
11310 *)      guess1="$direntrytype"
11311         ;;
11312 esac
11313
11314 case "$guess1" in
11315 'struct dirent') guess2='struct direct' ;;
11316 *) guess2='struct dirent' ;;
11317 esac
11318
11319 if $contains "$guess1" try.c >/dev/null 2>&1; then
11320         direntrytype="$guess1"
11321         echo "Your directory entries are $direntrytype." >&4
11322 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11323         direntrytype="$guess2"
11324         echo "Your directory entries seem to be $direntrytype." >&4
11325 else
11326         echo "I don't recognize your system's directory entries." >&4
11327         rp="What type is used for directory entries on this system?"
11328         dflt="$guess1"
11329         . ./myread
11330         direntrytype="$ans"
11331 fi
11332 $rm_try
11333
11334 : see if the directory entry stores field length
11335 echo " "
11336 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11337 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11338         echo "Good, your directory entry keeps length information in d_namlen." >&4
11339         val="$define"
11340 else
11341         echo "Your directory entry does not know about the d_namlen field." >&4
11342         val="$undef"
11343 fi
11344 set d_dirnamlen
11345 eval $setvar
11346 $rm_try
11347
11348 : Look for DIR.dd_fd
11349 case "$i_dirent" in
11350 "$define")
11351     echo "Checking to see if DIR has a dd_fd member variable" >&4
11352     $cat >try.c <<EOCP
11353 #$i_stdlib I_STDLIB
11354 #ifdef I_STDLIB
11355 #include <stdlib.h>
11356 #endif
11357 #include <dirent.h>
11358
11359 int main() {
11360     DIR dir;
11361     dir.dd_fd = 1;
11362     return 0;
11363 }
11364 EOCP
11365     val=$undef
11366     set try
11367     if eval $compile; then
11368         echo "Yes, it does."
11369         val="$define"
11370     else
11371         echo "No, it does not."
11372         val="$undef"
11373     fi
11374     ;;
11375 *)
11376     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11377     val="$undef"
11378     ;;
11379 esac
11380 set d_dir_dd_fd
11381 eval $setvar
11382 $rm_try
11383
11384 : see if this is an sysdir system
11385 set sys/dir.h i_sysdir
11386 eval $inhdr
11387
11388 : see if this is an sysndir system
11389 set sys/ndir.h i_sysndir
11390 eval $inhdr
11391
11392 : Look for dirfd
11393 echo " "
11394 $cat >dirfd.c <<EOM
11395 #include <stdio.h>
11396 #$i_stdlib I_STDLIB
11397 #ifdef I_STDLIB
11398 #include <stdlib.h>
11399 #endif
11400 #$i_dirent I_DIRENT             /**/
11401 #$i_sysdir I_SYS_DIR            /**/
11402 #$i_sysndir I_SYS_NDIR          /**/
11403 #$i_systypes I_SYS_TYPES        /**/
11404 #if defined(I_SYS_TYPES)
11405 #include <sys/types.h>
11406 #endif
11407 #if defined(I_DIRENT)
11408 #include <dirent.h>
11409 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11410 #include <sys/dir.h>
11411 #endif
11412 #else
11413 #ifdef I_SYS_NDIR
11414 #include <sys/ndir.h>
11415 #else
11416 #ifdef I_SYS_DIR
11417 #ifdef hp9000s500
11418 #include <ndir.h>       /* may be wrong in the future */
11419 #else
11420 #include <sys/dir.h>
11421 #endif
11422 #endif
11423 #endif
11424 #endif 
11425 int main() {
11426         DIR *dirp = opendir(".");
11427         if (dirfd(dirp) >= 0)
11428                 exit(0);
11429         else
11430                 exit(1);
11431 }
11432 EOM
11433 val=$undef
11434 set dirfd
11435 if eval $compile; then
11436         val="$define"
11437 fi
11438 case "$val" in
11439 $define)        echo "dirfd() found." >&4       ;;
11440 *)              echo "dirfd() NOT found." >&4   ;;
11441 esac
11442 set d_dirfd
11443 eval $setvar
11444 $rm -f dirfd*
11445
11446 : see if dlerror exists
11447 xxx_runnm="$runnm"
11448 runnm=false
11449 set dlerror d_dlerror
11450 eval $inlibc
11451 runnm="$xxx_runnm"
11452
11453 : see if dlfcn is available
11454 set dlfcn.h i_dlfcn
11455 eval $inhdr
11456
11457 case "$usedl" in
11458 $define|y|true)
11459         $cat << EOM
11460
11461 On a few systems, the dynamically loaded modules that perl generates and uses
11462 will need a different extension than shared libs. The default will probably
11463 be appropriate.
11464
11465 EOM
11466         case "$dlext" in
11467         '')     dflt="$so" ;;
11468         *)      dflt="$dlext" ;;
11469         esac
11470         rp='What is the extension of dynamically loaded modules'
11471         . ./myread
11472         dlext="$ans"
11473         ;;
11474 *)
11475         dlext="none"
11476         ;;
11477 esac
11478
11479 : Check if dlsym need a leading underscore
11480 echo " "
11481 val="$undef"
11482
11483 case "$dlsrc" in
11484 dl_dlopen.xs)
11485         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11486         $cat >dyna.c <<'EOM'
11487 fred () { }
11488 EOM
11489
11490 $cat >fred.c<<EOM
11491
11492 #include <stdio.h>
11493 #$i_stdlib I_STDLIB
11494 #ifdef I_STDLIB
11495 #include <stdlib.h>
11496 #endif
11497 #$i_dlfcn I_DLFCN
11498 #ifdef I_DLFCN
11499 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11500 #else
11501 #include <sys/types.h>
11502 #include <nlist.h>
11503 #include <link.h>
11504 #endif
11505
11506 extern int fred() ;
11507
11508 int main()
11509 {
11510     void * handle ;
11511     void * symbol ;
11512 #ifndef RTLD_LAZY
11513     int mode = 1 ;
11514 #else
11515     int mode = RTLD_LAZY ;
11516 #endif
11517     handle = dlopen("./dyna.$dlext", mode) ;
11518     if (handle == NULL) {
11519         printf ("1\n") ;
11520         fflush (stdout) ;
11521         exit(0);
11522     }
11523     symbol = dlsym(handle, "fred") ;
11524     if (symbol == NULL) {
11525         /* try putting a leading underscore */
11526         symbol = dlsym(handle, "_fred") ;
11527         if (symbol == NULL) {
11528             printf ("2\n") ;
11529             fflush (stdout) ;
11530             exit(0);
11531         }
11532         printf ("3\n") ;
11533     }
11534     else
11535         printf ("4\n") ;
11536     fflush (stdout) ;
11537     exit(0);
11538 }
11539 EOM
11540         : Call the object file tmp-dyna.o in case dlext=o.
11541         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11542                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11543                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11544                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11545                 xxx=`$run ./fred`
11546                 case $xxx in
11547                 1)      echo "Test program failed using dlopen." >&4
11548                         echo "Perhaps you should not use dynamic loading." >&4;;
11549                 2)      echo "Test program failed using dlsym." >&4
11550                         echo "Perhaps you should not use dynamic loading." >&4;;
11551                 3)      echo "dlsym needs a leading underscore" >&4
11552                         val="$define" ;;
11553                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11554                 esac
11555         else
11556                 echo "I can't compile and run the test program." >&4
11557                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11558         fi
11559         ;;
11560 esac
11561                 
11562 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11563
11564 set d_dlsymun
11565 eval $setvar
11566
11567 : see if drand48_r exists
11568 set drand48_r d_drand48_r
11569 eval $inlibc
11570 case "$d_drand48_r" in
11571 "$define")
11572         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11573         case "$d_drand48_r_proto:$usethreads" in
11574         ":define")      d_drand48_r_proto=define
11575                 set d_drand48_r_proto drand48_r $hdrs
11576                 eval $hasproto ;;
11577         *)      ;;
11578         esac
11579         case "$d_drand48_r_proto" in
11580         define)
11581         case "$drand48_r_proto" in
11582         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11583         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11584         esac
11585         case "$drand48_r_proto" in
11586         ''|0)   d_drand48_r=undef
11587                 drand48_r_proto=0
11588                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11589         * )     case "$drand48_r_proto" in
11590                 REENTRANT_PROTO*) ;;
11591                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11592                 esac
11593                 echo "Prototype: $try" ;;
11594         esac
11595         ;;
11596         *)      case "$usethreads" in
11597                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11598                 esac
11599                 d_drand48_r=undef
11600                 drand48_r_proto=0
11601                 ;;
11602         esac
11603         ;;
11604 *)      drand48_r_proto=0
11605         ;;
11606 esac
11607
11608 : see if prototype for drand48 is available
11609 echo " "
11610 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11611 eval $hasproto
11612
11613 : see if dup2 exists
11614 set dup2 d_dup2
11615 eval $inlibc
11616
11617 : see if eaccess exists
11618 set eaccess d_eaccess
11619 eval $inlibc
11620
11621 : see if endgrent exists
11622 set endgrent d_endgrent
11623 eval $inlibc
11624
11625 : see if this is an grp system
11626 set grp.h i_grp
11627 eval $inhdr
11628
11629 case "$i_grp" in
11630 $define)
11631         xxx=`./findhdr grp.h`
11632         $cppstdin $cppflags $cppminus < $xxx >$$.h
11633
11634         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11635                 val="$define"
11636         else
11637                 val="$undef"
11638         fi
11639         set d_grpasswd
11640         eval $setvar
11641
11642         $rm -f $$.h
11643         ;;
11644 *)
11645         val="$undef";
11646         set d_grpasswd; eval $setvar
11647         ;;
11648 esac
11649
11650 : see if endgrent_r exists
11651 set endgrent_r d_endgrent_r
11652 eval $inlibc
11653 case "$d_endgrent_r" in
11654 "$define")
11655         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11656         case "$d_endgrent_r_proto:$usethreads" in
11657         ":define")      d_endgrent_r_proto=define
11658                 set d_endgrent_r_proto endgrent_r $hdrs
11659                 eval $hasproto ;;
11660         *)      ;;
11661         esac
11662         case "$d_endgrent_r_proto" in
11663         define)
11664         case "$endgrent_r_proto" in
11665         ''|0) try='int endgrent_r(FILE**);'
11666         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11667         esac
11668         case "$endgrent_r_proto" in
11669         ''|0) try='void endgrent_r(FILE**);'
11670         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11671         esac
11672         case "$endgrent_r_proto" in
11673         ''|0)   d_endgrent_r=undef
11674                 endgrent_r_proto=0
11675                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11676         * )     case "$endgrent_r_proto" in
11677                 REENTRANT_PROTO*) ;;
11678                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11679                 esac
11680                 echo "Prototype: $try" ;;
11681         esac
11682         ;;
11683         *)      case "$usethreads" in
11684                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11685                 esac
11686                 d_endgrent_r=undef
11687                 endgrent_r_proto=0
11688                 ;;
11689         esac
11690         ;;
11691 *)      endgrent_r_proto=0
11692         ;;
11693 esac
11694
11695 : see if endhostent exists
11696 set endhostent d_endhent
11697 eval $inlibc
11698
11699 : see if this is a netdb.h system
11700 set netdb.h i_netdb
11701 eval $inhdr
11702
11703 : see if endhostent_r exists
11704 set endhostent_r d_endhostent_r
11705 eval $inlibc
11706 case "$d_endhostent_r" in
11707 "$define")
11708         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11709         case "$d_endhostent_r_proto:$usethreads" in
11710         ":define")      d_endhostent_r_proto=define
11711                 set d_endhostent_r_proto endhostent_r $hdrs
11712                 eval $hasproto ;;
11713         *)      ;;
11714         esac
11715         case "$d_endhostent_r_proto" in
11716         define)
11717         case "$endhostent_r_proto" in
11718         ''|0) try='int endhostent_r(struct hostent_data*);'
11719         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11720         esac
11721         case "$endhostent_r_proto" in
11722         ''|0) try='void endhostent_r(struct hostent_data*);'
11723         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11724         esac
11725         case "$endhostent_r_proto" in
11726         ''|0)   d_endhostent_r=undef
11727                 endhostent_r_proto=0
11728                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11729         * )     case "$endhostent_r_proto" in
11730                 REENTRANT_PROTO*) ;;
11731                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11732                 esac
11733                 echo "Prototype: $try" ;;
11734         esac
11735         ;;
11736         *)      case "$usethreads" in
11737                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11738                 esac
11739                 d_endhostent_r=undef
11740                 endhostent_r_proto=0
11741                 ;;
11742         esac
11743         ;;
11744 *)      endhostent_r_proto=0
11745         ;;
11746 esac
11747
11748 : see if endnetent exists
11749 set endnetent d_endnent
11750 eval $inlibc
11751
11752 : see if endnetent_r exists
11753 set endnetent_r d_endnetent_r
11754 eval $inlibc
11755 case "$d_endnetent_r" in
11756 "$define")
11757         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11758         case "$d_endnetent_r_proto:$usethreads" in
11759         ":define")      d_endnetent_r_proto=define
11760                 set d_endnetent_r_proto endnetent_r $hdrs
11761                 eval $hasproto ;;
11762         *)      ;;
11763         esac
11764         case "$d_endnetent_r_proto" in
11765         define)
11766         case "$endnetent_r_proto" in
11767         ''|0) try='int endnetent_r(struct netent_data*);'
11768         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11769         esac
11770         case "$endnetent_r_proto" in
11771         ''|0) try='void endnetent_r(struct netent_data*);'
11772         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11773         esac
11774         case "$endnetent_r_proto" in
11775         ''|0)   d_endnetent_r=undef
11776                 endnetent_r_proto=0
11777                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11778         * )     case "$endnetent_r_proto" in
11779                 REENTRANT_PROTO*) ;;
11780                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11781                 esac
11782                 echo "Prototype: $try" ;;
11783         esac
11784         ;;
11785         *)      case "$usethreads" in
11786                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11787                 esac
11788                 d_endnetent_r=undef
11789                 endnetent_r_proto=0
11790                 ;;
11791         esac
11792         ;;
11793 *)      endnetent_r_proto=0
11794         ;;
11795 esac
11796
11797 : see if endprotoent exists
11798 set endprotoent d_endpent
11799 eval $inlibc
11800
11801 : see if endprotoent_r exists
11802 set endprotoent_r d_endprotoent_r
11803 eval $inlibc
11804 case "$d_endprotoent_r" in
11805 "$define")
11806         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11807         case "$d_endprotoent_r_proto:$usethreads" in
11808         ":define")      d_endprotoent_r_proto=define
11809                 set d_endprotoent_r_proto endprotoent_r $hdrs
11810                 eval $hasproto ;;
11811         *)      ;;
11812         esac
11813         case "$d_endprotoent_r_proto" in
11814         define)
11815         case "$endprotoent_r_proto" in
11816         ''|0) try='int endprotoent_r(struct protoent_data*);'
11817         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11818         esac
11819         case "$endprotoent_r_proto" in
11820         ''|0) try='void endprotoent_r(struct protoent_data*);'
11821         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11822         esac
11823         case "$endprotoent_r_proto" in
11824         ''|0)   d_endprotoent_r=undef
11825                 endprotoent_r_proto=0
11826                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11827         * )     case "$endprotoent_r_proto" in
11828                 REENTRANT_PROTO*) ;;
11829                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11830                 esac
11831                 echo "Prototype: $try" ;;
11832         esac
11833         ;;
11834         *)      case "$usethreads" in
11835                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11836                 esac
11837                 d_endprotoent_r=undef
11838                 endprotoent_r_proto=0
11839                 ;;
11840         esac
11841         ;;
11842 *)      endprotoent_r_proto=0
11843         ;;
11844 esac
11845
11846 : see if endpwent exists
11847 set endpwent d_endpwent
11848 eval $inlibc
11849
11850 : see if this is a pwd.h system
11851 set pwd.h i_pwd
11852 eval $inhdr
11853
11854 case "$i_pwd" in
11855 $define)
11856         xxx=`./findhdr pwd.h`
11857         $cppstdin $cppflags $cppminus < $xxx >$$.h
11858
11859         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11860                 val="$define"
11861         else
11862                 val="$undef"
11863         fi
11864         set d_pwquota
11865         eval $setvar
11866
11867         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11868                 val="$define"
11869         else
11870                 val="$undef"
11871         fi
11872         set d_pwage
11873         eval $setvar
11874
11875         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11876                 val="$define"
11877         else
11878                 val="$undef"
11879         fi
11880         set d_pwchange
11881         eval $setvar
11882
11883         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11884                 val="$define"
11885         else
11886                 val="$undef"
11887         fi
11888         set d_pwclass
11889         eval $setvar
11890
11891         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11892                 val="$define"
11893         else
11894                 val="$undef"
11895         fi
11896         set d_pwexpire
11897         eval $setvar
11898
11899         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11900                 val="$define"
11901         else
11902                 val="$undef"
11903         fi
11904         set d_pwcomment
11905         eval $setvar
11906
11907         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11908                 val="$define"
11909         else
11910                 val="$undef"
11911         fi
11912         set d_pwgecos
11913         eval $setvar
11914
11915         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11916                 val="$define"
11917         else
11918                 val="$undef"
11919         fi
11920         set d_pwpasswd
11921         eval $setvar
11922
11923         $rm -f $$.h
11924         ;;
11925 *)
11926         val="$undef"; 
11927         set d_pwquota; eval $setvar
11928         set d_pwage; eval $setvar
11929         set d_pwchange; eval $setvar
11930         set d_pwclass; eval $setvar
11931         set d_pwexpire; eval $setvar
11932         set d_pwcomment; eval $setvar
11933         set d_pwgecos; eval $setvar
11934         set d_pwpasswd; eval $setvar
11935         ;;
11936 esac
11937
11938 : see if endpwent_r exists
11939 set endpwent_r d_endpwent_r
11940 eval $inlibc
11941 case "$d_endpwent_r" in
11942 "$define")
11943         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11944         case "$d_endpwent_r_proto:$usethreads" in
11945         ":define")      d_endpwent_r_proto=define
11946                 set d_endpwent_r_proto endpwent_r $hdrs
11947                 eval $hasproto ;;
11948         *)      ;;
11949         esac
11950         case "$d_endpwent_r_proto" in
11951         define)
11952         case "$endpwent_r_proto" in
11953         ''|0) try='int endpwent_r(FILE**);'
11954         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11955         esac
11956         case "$endpwent_r_proto" in
11957         ''|0) try='void endpwent_r(FILE**);'
11958         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11959         esac
11960         case "$endpwent_r_proto" in
11961         ''|0)   d_endpwent_r=undef
11962                 endpwent_r_proto=0
11963                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11964         * )     case "$endpwent_r_proto" in
11965                 REENTRANT_PROTO*) ;;
11966                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11967                 esac
11968                 echo "Prototype: $try" ;;
11969         esac
11970         ;;
11971         *)      case "$usethreads" in
11972                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11973                 esac
11974                 d_endpwent_r=undef
11975                 endpwent_r_proto=0
11976                 ;;
11977         esac
11978         ;;
11979 *)      endpwent_r_proto=0
11980         ;;
11981 esac
11982
11983 : see if endservent exists
11984 set endservent d_endsent
11985 eval $inlibc
11986
11987 : see if endservent_r exists
11988 set endservent_r d_endservent_r
11989 eval $inlibc
11990 case "$d_endservent_r" in
11991 "$define")
11992         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11993         case "$d_endservent_r_proto:$usethreads" in
11994         ":define")      d_endservent_r_proto=define
11995                 set d_endservent_r_proto endservent_r $hdrs
11996                 eval $hasproto ;;
11997         *)      ;;
11998         esac
11999         case "$d_endservent_r_proto" in
12000         define)
12001         case "$endservent_r_proto" in
12002         ''|0) try='int endservent_r(struct servent_data*);'
12003         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12004         esac
12005         case "$endservent_r_proto" in
12006         ''|0) try='void endservent_r(struct servent_data*);'
12007         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12008         esac
12009         case "$endservent_r_proto" in
12010         ''|0)   d_endservent_r=undef
12011                 endservent_r_proto=0
12012                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12013         * )     case "$endservent_r_proto" in
12014                 REENTRANT_PROTO*) ;;
12015                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12016                 esac
12017                 echo "Prototype: $try" ;;
12018         esac
12019         ;;
12020         *)      case "$usethreads" in
12021                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12022                 esac
12023                 d_endservent_r=undef
12024                 endservent_r_proto=0
12025                 ;;
12026         esac
12027         ;;
12028 *)      endservent_r_proto=0
12029         ;;
12030 esac
12031
12032 : Locate the flags for 'open()'
12033 echo " "
12034 $cat >try.c <<EOCP
12035 #include <sys/types.h>
12036 #ifdef I_FCNTL
12037 #include <fcntl.h>
12038 #endif
12039 #ifdef I_SYS_FILE
12040 #include <sys/file.h>
12041 #endif
12042 #$i_stdlib I_STDLIB
12043 #ifdef I_STDLIB
12044 #include <stdlib.h>
12045 #endif
12046 int main() {
12047         if(O_RDONLY);
12048 #ifdef O_TRUNC
12049         exit(0);
12050 #else
12051         exit(1);
12052 #endif
12053 }
12054 EOCP
12055 : check sys/file.h first to get FREAD on Sun
12056 if $test `./findhdr sys/file.h` && \
12057                 set try -DI_SYS_FILE && eval $compile; then
12058         h_sysfile=true;
12059         echo "<sys/file.h> defines the O_* constants..." >&4
12060         if $run ./try; then
12061                 echo "and you have the 3 argument form of open()." >&4
12062                 val="$define"
12063         else
12064                 echo "but not the 3 argument form of open().  Oh, well." >&4
12065                 val="$undef"
12066         fi
12067 elif $test `./findhdr fcntl.h` && \
12068                 set try -DI_FCNTL && eval $compile; then
12069         h_fcntl=true;
12070         echo "<fcntl.h> defines the O_* constants..." >&4
12071         if $run ./try; then
12072                 echo "and you have the 3 argument form of open()." >&4
12073                 val="$define"
12074         else
12075                 echo "but not the 3 argument form of open().  Oh, well." >&4
12076                 val="$undef"
12077         fi
12078 else
12079         val="$undef"
12080         echo "I can't find the O_* constant definitions!  You got problems." >&4
12081 fi
12082 set d_open3
12083 eval $setvar
12084 $rm_try
12085
12086 : see which of string.h or strings.h is needed
12087 echo " "
12088 strings=`./findhdr string.h`
12089 if $test "$strings" && $test -r "$strings"; then
12090         echo "Using <string.h> instead of <strings.h>." >&4
12091         val="$define"
12092 else
12093         val="$undef"
12094         strings=`./findhdr strings.h`
12095         if $test "$strings" && $test -r "$strings"; then
12096                 echo "Using <strings.h> instead of <string.h>." >&4
12097         else
12098                 echo "No string header found -- You'll surely have problems." >&4
12099         fi
12100 fi
12101 set i_string
12102 eval $setvar
12103 case "$i_string" in
12104 "$undef") strings=`./findhdr strings.h`;;
12105 *)        strings=`./findhdr string.h`;;
12106 esac
12107
12108 : see if this is a sys/file.h system
12109 val=''
12110 set sys/file.h val
12111 eval $inhdr
12112
12113 : do we need to include sys/file.h ?
12114 case "$val" in
12115 "$define")
12116         echo " "
12117         if $h_sysfile; then
12118                 val="$define"
12119                 echo "We'll be including <sys/file.h>." >&4
12120         else
12121                 val="$undef"
12122                 echo "We won't be including <sys/file.h>." >&4
12123         fi
12124         ;;
12125 *)
12126         h_sysfile=false
12127         ;;
12128 esac
12129 set i_sysfile
12130 eval $setvar
12131
12132 : see if fcntl.h is there
12133 val=''
12134 set fcntl.h val
12135 eval $inhdr
12136
12137 : see if we can include fcntl.h
12138 case "$val" in
12139 "$define")
12140         echo " "
12141         if $h_fcntl; then
12142                 val="$define"
12143                 echo "We'll be including <fcntl.h>." >&4
12144         else
12145                 val="$undef"
12146                 if $h_sysfile; then
12147         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12148                 else
12149                         echo "We won't be including <fcntl.h>." >&4
12150                 fi
12151         fi
12152         ;;
12153 *)
12154         h_fcntl=false
12155         val="$undef"
12156         ;;
12157 esac
12158 set i_fcntl
12159 eval $setvar
12160
12161 : check for non-blocking I/O stuff
12162 case "$h_sysfile" in
12163 true) echo "#include <sys/file.h>" > head.c;;
12164 *)
12165        case "$h_fcntl" in
12166        true) echo "#include <fcntl.h>" > head.c;;
12167        *) echo "#include <sys/fcntl.h>" > head.c;;
12168        esac
12169        ;;
12170 esac
12171 echo " "
12172 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12173 case "$o_nonblock" in
12174 '')
12175         $cat head.c > try.c
12176         $cat >>try.c <<EOCP
12177 #include <stdio.h>
12178 #$i_stdlib I_STDLIB
12179 #ifdef I_STDLIB
12180 #include <stdlib.h>
12181 #endif
12182 #$i_fcntl I_FCNTL
12183 #ifdef I_FCNTL
12184 #include <fcntl.h>
12185 #endif
12186 int main() {
12187 #ifdef O_NONBLOCK
12188         printf("O_NONBLOCK\n");
12189         exit(0);
12190 #endif
12191 #ifdef O_NDELAY
12192         printf("O_NDELAY\n");
12193         exit(0);
12194 #endif
12195 #ifdef FNDELAY
12196         printf("FNDELAY\n");
12197         exit(0);
12198 #endif
12199         exit(0);
12200 }
12201 EOCP
12202         set try
12203         if eval $compile_ok; then
12204                 o_nonblock=`$run ./try`
12205                 case "$o_nonblock" in
12206                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12207                 *) echo "Seems like we can use $o_nonblock.";;
12208                 esac
12209         else
12210                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12211         fi
12212         ;;
12213 *) echo "Using $hint value $o_nonblock.";;
12214 esac
12215 $rm_try
12216
12217 echo " "
12218 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12219 case "$eagain" in
12220 '')
12221         $cat head.c > try.c
12222         $cat >>try.c <<EOCP
12223 #include <errno.h>
12224 #include <sys/types.h>
12225 #include <signal.h>
12226 #include <stdio.h>
12227 #$i_stdlib I_STDLIB
12228 #ifdef I_STDLIB
12229 #include <stdlib.h>
12230 #endif
12231 #$i_fcntl I_FCNTL
12232 #ifdef I_FCNTL
12233 #include <fcntl.h>
12234 #endif
12235 #define MY_O_NONBLOCK $o_nonblock
12236 #ifndef errno  /* XXX need better Configure test */
12237 extern int errno;
12238 #endif
12239 #$i_unistd I_UNISTD
12240 #ifdef I_UNISTD
12241 #include <unistd.h>
12242 #endif
12243 #$i_string I_STRING
12244 #ifdef I_STRING
12245 #include <string.h>
12246 #else
12247 #include <strings.h>
12248 #endif
12249 $signal_t blech(int x) { exit(3); }
12250 EOCP
12251         $cat >> try.c <<'EOCP'
12252 int main()
12253 {
12254         int pd[2];
12255         int pu[2];
12256         char buf[1];
12257         char string[100];
12258
12259         pipe(pd);       /* Down: child -> parent */
12260         pipe(pu);       /* Up: parent -> child */
12261         if (0 != fork()) {
12262                 int ret;
12263                 close(pd[1]);   /* Parent reads from pd[0] */
12264                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12265 #ifdef F_SETFL
12266                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12267                         exit(1);
12268 #else
12269                 exit(4);
12270 #endif
12271                 signal(SIGALRM, blech);
12272                 alarm(5);
12273                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12274                         exit(2);
12275                 sprintf(string, "%d\n", ret);
12276                 write(2, string, strlen(string));
12277                 alarm(0);
12278 #ifdef EAGAIN
12279                 if (errno == EAGAIN) {
12280                         printf("EAGAIN\n");
12281                         goto ok;
12282                 }
12283 #endif
12284 #ifdef EWOULDBLOCK
12285                 if (errno == EWOULDBLOCK)
12286                         printf("EWOULDBLOCK\n");
12287 #endif
12288         ok:
12289                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12290                 sleep(2);                               /* Give it time to close our pipe */
12291                 alarm(5);
12292                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12293                 alarm(0);
12294                 sprintf(string, "%d\n", ret);
12295                 write(4, string, strlen(string));
12296                 exit(0);
12297         }
12298
12299         close(pd[0]);                   /* We write to pd[1] */
12300         close(pu[1]);                   /* We read from pu[0] */
12301         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12302         close(pd[1]);                   /* Pipe pd is now fully closed! */
12303         exit(0);                                /* Bye bye, thank you for playing! */
12304 }
12305 EOCP
12306         set try
12307         if eval $compile_ok; then
12308                 echo "$startsh" >mtry
12309                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12310                 chmod +x mtry
12311                 ./mtry >/dev/null 2>&1
12312                 case $? in
12313                 0) eagain=`$cat try.out`;;
12314                 1) echo "Could not perform non-blocking setting!";;
12315                 2) echo "I did a successful read() for something that was not there!";;
12316                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12317                 4) echo "Could not find F_SETFL!";;
12318                 *) echo "Something terribly wrong happened during testing.";;
12319                 esac
12320                 rd_nodata=`$cat try.ret`
12321                 echo "A read() system call with no data present returns $rd_nodata."
12322                 case "$rd_nodata" in
12323                 0|-1) ;;
12324                 *)
12325                         echo "(That's peculiar, fixing that to be -1.)"
12326                         rd_nodata=-1
12327                         ;;
12328                 esac
12329                 case "$eagain" in
12330                 '')
12331                         echo "Forcing errno EAGAIN on read() with no data available."
12332                         eagain=EAGAIN
12333                         ;;
12334                 *)
12335                         echo "Your read() sets errno to $eagain when no data is available."
12336                         ;;
12337                 esac
12338                 status=`$cat try.err`
12339                 case "$status" in
12340                 0) echo "And it correctly returns 0 to signal EOF.";;
12341                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12342                 *) echo "However, your read() returns '$status' on EOF??";;
12343                 esac
12344                 val="$define"
12345                 if test "$status" = "$rd_nodata"; then
12346                         echo "WARNING: you can't distinguish between EOF and no data!"
12347                         val="$undef"
12348                 fi
12349         else
12350                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12351                 eagain=EAGAIN
12352         fi
12353         set d_eofnblk
12354         eval $setvar
12355         ;;
12356 *)
12357         echo "Using $hint value $eagain."
12358         echo "Your read() returns $rd_nodata when no data is present."
12359         case "$d_eofnblk" in
12360         "$define") echo "And you can see EOF because read() returns 0.";;
12361         "$undef") echo "But you can't see EOF status from read() returned value.";;
12362         *)
12363                 echo "(Assuming you can't see EOF status from read anyway.)"
12364                 d_eofnblk=$undef
12365                 ;;
12366         esac
12367         ;;
12368 esac
12369 $rm_try head.c mtry
12370
12371 : see if _ptr and _cnt from stdio act std
12372 echo " "
12373
12374 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12375         echo "(Looks like you have stdio.h from BSD.)"
12376         case "$stdio_ptr" in
12377         '') stdio_ptr='((fp)->_p)'
12378                 ptr_lval=$define
12379                 ;;
12380         *)      ptr_lval=$d_stdio_ptr_lval;;
12381         esac
12382         case "$stdio_cnt" in
12383         '') stdio_cnt='((fp)->_r)'
12384                 cnt_lval=$define
12385                 ;;
12386         *)      cnt_lval=$d_stdio_cnt_lval;;
12387         esac
12388         case "$stdio_base" in
12389         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12390         esac
12391         case "$stdio_bufsiz" in
12392         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12393         esac
12394 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12395         echo "(Looks like you have stdio.h from Linux.)"
12396         case "$stdio_ptr" in
12397         '') stdio_ptr='((fp)->_IO_read_ptr)'
12398                 ptr_lval=$define
12399                 ;;
12400         *)      ptr_lval=$d_stdio_ptr_lval;;
12401         esac
12402         case "$stdio_cnt" in
12403         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12404                 cnt_lval=$undef
12405                 ;;
12406         *)      cnt_lval=$d_stdio_cnt_lval;;
12407         esac
12408         case "$stdio_base" in
12409         '') stdio_base='((fp)->_IO_read_base)';;
12410         esac
12411         case "$stdio_bufsiz" in
12412         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12413         esac
12414 else
12415         case "$stdio_ptr" in
12416         '') stdio_ptr='((fp)->_ptr)'
12417                 ptr_lval=$define
12418                 ;;
12419         *)      ptr_lval=$d_stdio_ptr_lval;;
12420         esac
12421         case "$stdio_cnt" in
12422         '') stdio_cnt='((fp)->_cnt)'
12423                 cnt_lval=$define
12424                 ;;
12425         *)      cnt_lval=$d_stdio_cnt_lval;;
12426         esac
12427         case "$stdio_base" in
12428         '') stdio_base='((fp)->_base)';;
12429         esac
12430         case "$stdio_bufsiz" in
12431         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12432         esac
12433 fi
12434
12435 : test whether _ptr and _cnt really work
12436 echo "Checking how std your stdio is..." >&4
12437 $cat >try.c <<EOP
12438 #include <stdio.h>
12439 #$i_stdlib I_STDLIB
12440 #ifdef I_STDLIB
12441 #include <stdlib.h>
12442 #endif
12443 #define FILE_ptr(fp)    $stdio_ptr
12444 #define FILE_cnt(fp)    $stdio_cnt
12445 int main() {
12446         FILE *fp = fopen("try.c", "r");
12447         char c = getc(fp);
12448         if (
12449                 18 <= FILE_cnt(fp) &&
12450                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12451         )
12452                 exit(0);
12453         exit(1);
12454 }
12455 EOP
12456 val="$undef"
12457 set try
12458 if eval $compile && $to try.c; then
12459         if $run ./try; then
12460                 echo "Your stdio acts pretty std."
12461                 val="$define"
12462         else
12463                 echo "Your stdio isn't very std."
12464         fi
12465 else
12466         echo "Your stdio doesn't appear very std."
12467 fi
12468 $rm_try
12469
12470 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12471 # direct buffer manipulation no longer works.  The Configure tests
12472 # should be changed to correctly detect this, but until then,
12473 # the following check should at least let perl compile and run.
12474 # (This quick fix should be updated before 5.8.1.)
12475 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12476 # A. Dougherty, June 3, 2002.
12477 case "$d_gnulibc" in
12478 $define)
12479         case "$gnulibc_version" in
12480         2.[01]*)  ;;
12481         2.2) ;;
12482         2.2.[0-9]) ;;
12483         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12484                 val="$undef"
12485                 ;;
12486         esac
12487         ;;
12488 esac
12489 set d_stdstdio
12490 eval $setvar
12491
12492 : Can _ptr be used as an lvalue?
12493 case "$d_stdstdio$ptr_lval" in
12494 $define$define) val=$define ;;
12495 *) val=$undef ;;
12496 esac
12497 set d_stdio_ptr_lval
12498 eval $setvar
12499
12500 : Can _cnt be used as an lvalue?
12501 case "$d_stdstdio$cnt_lval" in
12502 $define$define) val=$define ;;
12503 *) val=$undef ;;
12504 esac
12505 set d_stdio_cnt_lval
12506 eval $setvar
12507
12508
12509 : test whether setting _ptr sets _cnt as a side effect
12510 d_stdio_ptr_lval_sets_cnt="$undef"
12511 d_stdio_ptr_lval_nochange_cnt="$undef"
12512 case "$d_stdio_ptr_lval$d_stdstdio" in
12513 $define$define)
12514         echo "Checking to see what happens if we set the stdio ptr..." >&4
12515 $cat >try.c <<EOP
12516 #include <stdio.h>
12517 /* Can we scream? */
12518 /* Eat dust sed :-) */
12519 /* In the buffer space, no one can hear you scream. */
12520 #$i_stdlib I_STDLIB
12521 #ifdef I_STDLIB
12522 #include <stdlib.h>
12523 #endif
12524 #define FILE_ptr(fp)    $stdio_ptr
12525 #define FILE_cnt(fp)    $stdio_cnt
12526 #include <sys/types.h>
12527 int main() {
12528         FILE *fp = fopen("try.c", "r");
12529         int c;
12530         char *ptr;
12531         size_t cnt;
12532         if (!fp) {
12533             puts("Fail even to read");
12534             exit(1);
12535         }
12536         c = getc(fp); /* Read away the first # */
12537         if (c == EOF) {
12538             puts("Fail even to read");
12539             exit(1);
12540         }
12541         if (!(
12542                 18 <= FILE_cnt(fp) &&
12543                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12544         )) {
12545                 puts("Fail even to read");
12546                 exit (1);
12547         }
12548         ptr = (char*) FILE_ptr(fp);
12549         cnt = (size_t)FILE_cnt(fp);
12550
12551         FILE_ptr(fp) += 42;
12552
12553         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12554                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12555                 exit (1);
12556         }
12557         if (FILE_cnt(fp) <= 20) {
12558                 printf ("Fail (<20 chars to test)");
12559                 exit (1);
12560         }
12561         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12562                 puts("Fail compare");
12563                 exit (1);
12564         }
12565         if (cnt == FILE_cnt(fp)) {
12566                 puts("Pass_unchanged");
12567                 exit (0);
12568         }
12569         if (FILE_cnt(fp) == (cnt - 42)) {
12570                 puts("Pass_changed");
12571                 exit (0);
12572         }
12573         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12574         return 1;
12575
12576 }
12577 EOP
12578         set try
12579         if eval $compile && $to try.c; then
12580                 case `$run ./try` in
12581                 Pass_changed)
12582                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12583                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12584                 Pass_unchanged)
12585                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12586                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12587                 Fail*)
12588                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12589                 *)
12590                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12591         esac
12592         else
12593                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12594         fi
12595         $rm_try
12596         ;;
12597 esac
12598
12599 : see if _base is also standard
12600 val="$undef"
12601 case "$d_stdstdio" in
12602 $define)
12603         $cat >try.c <<EOP
12604 #include <stdio.h>
12605 #$i_stdlib I_STDLIB
12606 #ifdef I_STDLIB
12607 #include <stdlib.h>
12608 #endif
12609 #define FILE_base(fp)   $stdio_base
12610 #define FILE_bufsiz(fp) $stdio_bufsiz
12611 int main() {
12612         FILE *fp = fopen("try.c", "r");
12613         char c = getc(fp);
12614         if (
12615                 19 <= FILE_bufsiz(fp) &&
12616                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12617         )
12618                 exit(0);
12619         exit(1);
12620 }
12621 EOP
12622         set try
12623         if eval $compile && $to try.c; then
12624                 if $run ./try; then
12625                         echo "And its _base field acts std."
12626                         val="$define"
12627                 else
12628                         echo "But its _base field isn't std."
12629                 fi
12630         else
12631                 echo "However, it seems to be lacking the _base field."
12632         fi
12633         $rm_try
12634         ;;
12635 esac
12636 set d_stdiobase
12637 eval $setvar
12638
12639 : see if fast_stdio exists
12640 val="$undef"
12641 case "$d_stdstdio:$d_stdio_ptr_lval" in
12642 "$define:$define")
12643         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12644         *$define*)
12645                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12646                 val="$define"
12647                 ;;
12648         esac
12649         ;;
12650 esac
12651 set d_faststdio
12652 eval $setvar
12653
12654
12655
12656 : see if fchdir exists
12657 set fchdir d_fchdir
12658 eval $inlibc
12659
12660 : see if fchmod exists
12661 set fchmod d_fchmod
12662 eval $inlibc
12663
12664 : see if fchown exists
12665 set fchown d_fchown
12666 eval $inlibc
12667
12668 : see if this is an fcntl system
12669 set fcntl d_fcntl
12670 eval $inlibc
12671
12672 echo " "
12673 : See if fcntl-based locking works.
12674 $cat >try.c <<EOCP
12675 #$i_stdlib I_STDLIB
12676 #ifdef I_STDLIB
12677 #include <stdlib.h>
12678 #endif
12679 #include <unistd.h>
12680 #include <fcntl.h>
12681 #include <signal.h>
12682 $signal_t blech(int x) { exit(3); }
12683 int main() {
12684 #if defined(F_SETLK) && defined(F_SETLKW)
12685      struct flock flock;
12686      int retval, fd;
12687      fd = open("try.c", O_RDONLY);
12688      flock.l_type = F_RDLCK;
12689      flock.l_whence = SEEK_SET;
12690      flock.l_start = flock.l_len = 0;
12691      signal(SIGALRM, blech);
12692      alarm(10);
12693      retval = fcntl(fd, F_SETLK, &flock);
12694      close(fd);
12695      (retval < 0 ? exit(2) : exit(0));
12696 #else
12697      exit(2);
12698 #endif
12699 }
12700 EOCP
12701 echo "Checking if fcntl-based file locking works... "
12702 case "$d_fcntl" in
12703 "$define")
12704         set try
12705         if eval $compile_ok; then
12706                 if $run ./try; then
12707                         echo "Yes, it seems to work."
12708                         val="$define"
12709                 else
12710                         echo "Nope, it didn't work."
12711                         val="$undef"
12712                         case "$?" in
12713                         3) $cat >&4 <<EOM
12714 ***
12715 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12716 *** This is (almost) impossible.
12717 *** If your NFS lock daemons are not feeling well, something like
12718 *** this may happen, please investigate.  Cannot continue, aborting.
12719 ***
12720 EOM
12721                                 exit 1
12722                                 ;;
12723                         esac
12724                 fi
12725         else
12726                 echo "I'm unable to compile the test program, so I'll assume not."
12727                 val="$undef"
12728         fi
12729         ;;
12730 *) val="$undef";
12731         echo "Nope, since you don't even have fcntl()."
12732         ;;
12733 esac
12734 set d_fcntl_can_lock
12735 eval $setvar
12736 $rm_try
12737
12738 : check for fd_set items
12739 $cat <<EOM
12740
12741 Checking to see how well your C compiler handles fd_set and friends ...
12742 EOM
12743 $cat >try.c <<EOCP
12744 #$i_stdlib I_STDLIB
12745 #ifdef I_STDLIB
12746 #include <stdlib.h>
12747 #endif
12748 #$i_systime I_SYS_TIME
12749 #$i_sysselct I_SYS_SELECT
12750 #$d_socket HAS_SOCKET
12751 #include <sys/types.h>
12752 #ifdef HAS_SOCKET
12753 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12754 #endif
12755 #ifdef I_SYS_TIME
12756 #include <sys/time.h>
12757 #endif
12758 #ifdef I_SYS_SELECT
12759 #include <sys/select.h>
12760 #endif
12761 int main() {
12762         fd_set fds;
12763
12764 #ifdef TRYBITS
12765         if(fds.fds_bits);
12766 #endif
12767
12768 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12769         exit(0);
12770 #else
12771         exit(1);
12772 #endif
12773 }
12774 EOCP
12775 set try -DTRYBITS
12776 if eval $compile; then
12777         d_fds_bits="$define"
12778         d_fd_set="$define"
12779         echo "Well, your system knows about the normal fd_set typedef..." >&4
12780         if $run ./try; then
12781                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12782                 d_fd_macros="$define"
12783         else
12784                 $cat >&4 <<'EOM'
12785 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12786 EOM
12787                 d_fd_macros="$undef"
12788         fi
12789 else
12790         $cat <<'EOM'
12791 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12792 EOM
12793         set try
12794         if eval $compile; then
12795                 d_fds_bits="$undef"
12796                 d_fd_set="$define"
12797                 echo "Well, your system has some sort of fd_set available..." >&4
12798                 if $run ./try; then
12799                         echo "and you have the normal fd_set macros." >&4
12800                         d_fd_macros="$define"
12801                 else
12802                         $cat <<'EOM'
12803 but not the normal fd_set macros!  Gross!  More work for me...
12804 EOM
12805                         d_fd_macros="$undef"
12806                 fi
12807         else
12808         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12809                 d_fd_set="$undef"
12810                 d_fds_bits="$undef"
12811                 d_fd_macros="$undef"
12812         fi
12813 fi
12814 $rm_try
12815
12816 : see if fgetpos exists
12817 set fgetpos d_fgetpos
12818 eval $inlibc
12819
12820 : see if finite exists
12821 set finite d_finite
12822 eval $inlibc
12823
12824 : see if finitel exists
12825 set finitel d_finitel
12826 eval $inlibc
12827
12828 : see if flock exists
12829 set flock d_flock
12830 eval $inlibc
12831
12832 : see if prototype for flock is available
12833 echo " "
12834 set d_flockproto flock $i_sysfile sys/file.h
12835 eval $hasproto
12836
12837 : see if fork exists
12838 set fork d_fork
12839 eval $inlibc
12840
12841 : see if fp_class exists
12842 set fp_class d_fp_class
12843 eval $inlibc
12844
12845 : see if pathconf exists
12846 set pathconf d_pathconf
12847 eval $inlibc
12848
12849 : see if fpathconf exists
12850 set fpathconf d_fpathconf
12851 eval $inlibc
12852
12853 : see if fpclass exists
12854 set fpclass d_fpclass
12855 eval $inlibc
12856
12857 : see if fpclassify exists
12858 set fpclassify d_fpclassify
12859 eval $inlibc
12860
12861 : see if fpclassl exists
12862 set fpclassl d_fpclassl
12863 eval $inlibc
12864
12865
12866 : check for fpos64_t
12867 echo " "
12868 echo "Checking to see if you have fpos64_t..." >&4
12869 $cat >try.c <<EOCP
12870 #include <stdio.h>
12871 int main() { fpos64_t x = 7; }
12872 EOCP
12873 set try
12874 if eval $compile; then
12875         val="$define"
12876         echo "You have fpos64_t."
12877 else
12878         val="$undef"
12879         echo "You do not have fpos64_t."
12880         case "$fpossize" in
12881         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12882         esac
12883 fi
12884 $rm_try
12885 set d_fpos64_t
12886 eval $setvar
12887
12888 : see if frexpl exists
12889 set frexpl d_frexpl
12890 eval $inlibc
12891
12892 : see if this is a sys/param system
12893 set sys/param.h i_sysparam
12894 eval $inhdr
12895
12896 : see if this is a sys/mount.h system
12897 set sys/mount.h i_sysmount
12898 eval $inhdr
12899
12900
12901 echo " "
12902 echo "Checking to see if your system supports struct fs_data..." >&4
12903 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12904 eval $hasstruct
12905 case "$d_fs_data_s" in
12906 "$define")      echo "Yes, it does."   ;;
12907 *)              echo "No, it doesn't." ;;
12908 esac
12909
12910 : see if fseeko exists
12911 set fseeko d_fseeko
12912 eval $inlibc
12913 case "$longsize" in
12914 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12915 esac
12916
12917 : see if fsetpos exists
12918 set fsetpos d_fsetpos
12919 eval $inlibc
12920
12921
12922 : see if fstatfs exists
12923 set fstatfs d_fstatfs
12924 eval $inlibc
12925
12926
12927 : see if statvfs exists
12928 set statvfs d_statvfs
12929 eval $inlibc
12930
12931 : see if fstatvfs exists
12932 set fstatvfs d_fstatvfs
12933 eval $inlibc
12934
12935
12936 : see if fsync exists
12937 set fsync d_fsync
12938 eval $inlibc
12939
12940 : see if ftello exists
12941 set ftello d_ftello
12942 eval $inlibc
12943 case "$longsize" in
12944 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12945 esac
12946
12947 d_futimes="$undef"
12948 : check for a working futimes
12949 echo " "
12950 echo "Checking if you have a working futimes()" >&4
12951 $cat >try.c <<EOCP
12952 #include <stdio.h>
12953 #include <sys/time.h>
12954 #include <errno.h>
12955 #include <fcntl.h>
12956
12957 int main ()
12958 {
12959     int fd, rv;
12960     fd = open ("try.c", O_RDWR);
12961     if (-1 == fd) exit (1);
12962     rv = futimes (fd, NULL);
12963     exit (rv == -1 ? errno : 0);
12964 }
12965 EOCP
12966 set try
12967 if eval $compile; then
12968     `$run ./try`
12969     rc=$?
12970     case "$rc" in
12971         0)  echo "Yes, you have" >&4
12972             d_futimes="$define"
12973             ;;
12974         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
12975             ;;
12976     esac
12977 else
12978     echo "No, it does not (probably harmless)" >&4
12979 fi
12980 $rm_try
12981
12982 : see if getcwd exists
12983 set getcwd d_getcwd
12984 eval $inlibc
12985
12986 : see if getespwnam exists
12987 set getespwnam d_getespwnam
12988 eval $inlibc
12989
12990
12991 : see if getfsstat exists
12992 set getfsstat d_getfsstat
12993 eval $inlibc
12994
12995 : see if getgrent exists
12996 set getgrent d_getgrent
12997 eval $inlibc
12998
12999 : see if getgrent_r exists
13000 set getgrent_r d_getgrent_r
13001 eval $inlibc
13002 case "$d_getgrent_r" in
13003 "$define")
13004         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13005         case "$d_getgrent_r_proto:$usethreads" in
13006         ":define")      d_getgrent_r_proto=define
13007                 set d_getgrent_r_proto getgrent_r $hdrs
13008                 eval $hasproto ;;
13009         *)      ;;
13010         esac
13011         case "$d_getgrent_r_proto" in
13012         define)
13013         case "$getgrent_r_proto" in
13014         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13015         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13016         esac
13017         case "$getgrent_r_proto" in
13018         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13019         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13020         esac
13021         case "$getgrent_r_proto" in
13022         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13023         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13024         esac
13025         case "$getgrent_r_proto" in
13026         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13027         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13028         esac
13029         case "$getgrent_r_proto" in
13030         ''|0) try='int getgrent_r(struct group*, char*, int);'
13031         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13032         esac
13033         case "$getgrent_r_proto" in
13034         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13035         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13036         esac
13037         case "$getgrent_r_proto" in
13038         ''|0)   d_getgrent_r=undef
13039                 getgrent_r_proto=0
13040                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13041         * )     case "$getgrent_r_proto" in
13042                 REENTRANT_PROTO*) ;;
13043                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13044                 esac
13045                 echo "Prototype: $try" ;;
13046         esac
13047         ;;
13048         *)      case "$usethreads" in
13049                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13050                 esac
13051                 d_getgrent_r=undef
13052                 getgrent_r_proto=0
13053                 ;;
13054         esac
13055         ;;
13056 *)      getgrent_r_proto=0
13057         ;;
13058 esac
13059
13060 : see if getgrgid_r exists
13061 set getgrgid_r d_getgrgid_r
13062 eval $inlibc
13063 case "$d_getgrgid_r" in
13064 "$define")
13065         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13066         case "$d_getgrgid_r_proto:$usethreads" in
13067         ":define")      d_getgrgid_r_proto=define
13068                 set d_getgrgid_r_proto getgrgid_r $hdrs
13069                 eval $hasproto ;;
13070         *)      ;;
13071         esac
13072         case "$d_getgrgid_r_proto" in
13073         define)
13074         case "$getgrgid_r_proto" in
13075         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13076         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13077         esac
13078         case "$getgrgid_r_proto" in
13079         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13080         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13081         esac
13082         case "$getgrgid_r_proto" in
13083         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13084         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13085         esac
13086         case "$getgrgid_r_proto" in
13087         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13088         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13089         esac
13090         case "$getgrgid_r_proto" in
13091         ''|0)   d_getgrgid_r=undef
13092                 getgrgid_r_proto=0
13093                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13094         * )     case "$getgrgid_r_proto" in
13095                 REENTRANT_PROTO*) ;;
13096                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13097                 esac
13098                 echo "Prototype: $try" ;;
13099         esac
13100         ;;
13101         *)      case "$usethreads" in
13102                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13103                 esac
13104                 d_getgrgid_r=undef
13105                 getgrgid_r_proto=0
13106                 ;;
13107         esac
13108         ;;
13109 *)      getgrgid_r_proto=0
13110         ;;
13111 esac
13112
13113 : see if getgrnam_r exists
13114 set getgrnam_r d_getgrnam_r
13115 eval $inlibc
13116 case "$d_getgrnam_r" in
13117 "$define")
13118         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13119         case "$d_getgrnam_r_proto:$usethreads" in
13120         ":define")      d_getgrnam_r_proto=define
13121                 set d_getgrnam_r_proto getgrnam_r $hdrs
13122                 eval $hasproto ;;
13123         *)      ;;
13124         esac
13125         case "$d_getgrnam_r_proto" in
13126         define)
13127         case "$getgrnam_r_proto" in
13128         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13129         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13130         esac
13131         case "$getgrnam_r_proto" in
13132         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13133         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13134         esac
13135         case "$getgrnam_r_proto" in
13136         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13137         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13138         esac
13139         case "$getgrnam_r_proto" in
13140         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13141         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13142         esac
13143         case "$getgrnam_r_proto" in
13144         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13145         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13146         esac
13147         case "$getgrnam_r_proto" in
13148         ''|0)   d_getgrnam_r=undef
13149                 getgrnam_r_proto=0
13150                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13151         * )     case "$getgrnam_r_proto" in
13152                 REENTRANT_PROTO*) ;;
13153                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13154                 esac
13155                 echo "Prototype: $try" ;;
13156         esac
13157         ;;
13158         *)      case "$usethreads" in
13159                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13160                 esac
13161                 d_getgrnam_r=undef
13162                 getgrnam_r_proto=0
13163                 ;;
13164         esac
13165         ;;
13166 *)      getgrnam_r_proto=0
13167         ;;
13168 esac
13169
13170 : see if gethostbyaddr exists
13171 set gethostbyaddr d_gethbyaddr
13172 eval $inlibc
13173
13174 : see if gethostbyname exists
13175 set gethostbyname d_gethbyname
13176 eval $inlibc
13177
13178 : see if gethostent exists
13179 set gethostent d_gethent
13180 eval $inlibc
13181
13182 : see how we will look up host name
13183 echo " "
13184 call=''
13185 if set gethostname val -f d_gethname; eval $csym; $val; then
13186         echo 'gethostname() found.' >&4
13187         d_gethname="$define"
13188         call=gethostname
13189 fi
13190 if set uname val -f d_uname; eval $csym; $val; then
13191         if ./xenix; then
13192                 $cat <<'EOM'
13193 uname() was found, but you're running xenix, and older versions of xenix
13194 have a broken uname(). If you don't really know whether your xenix is old
13195 enough to have a broken system call, use the default answer.
13196
13197 EOM
13198                 dflt=y
13199                 case "$d_uname" in
13200                 "$define") dflt=n;;
13201                 esac
13202                 rp='Is your uname() broken?'
13203                 . ./myread
13204                 case "$ans" in
13205                 n*) d_uname="$define"; call=uname;;
13206                 esac
13207         else
13208                 echo 'uname() found.' >&4
13209                 d_uname="$define"
13210                 case "$call" in
13211                 '') call=uname ;;
13212                 esac
13213         fi
13214 fi
13215 case "$d_gethname" in
13216 '') d_gethname="$undef";;
13217 esac
13218 case "$d_uname" in
13219 '') d_uname="$undef";;
13220 esac
13221 case "$d_uname$d_gethname" in
13222 *define*)
13223         dflt=n
13224         cat <<EOM
13225  
13226 Every now and then someone has a $call() that lies about the hostname
13227 but can't be fixed for political or economic reasons.  If you wish, I can
13228 pretend $call() isn't there and maybe compute hostname at run-time
13229 thanks to the '$phostname' command.
13230
13231 EOM
13232         rp="Shall I ignore $call() from now on?"
13233         . ./myread
13234         case "$ans" in
13235         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13236         esac;;
13237 esac
13238 case "$phostname" in
13239 '') aphostname='';;
13240 *) case "$aphostname" in
13241         /*) ;;
13242         *) set X $phostname
13243                 shift
13244                 file=$1
13245                 shift
13246                 file=`./loc $file $file $pth`
13247                 aphostname=`echo $file $*`
13248                 ;;
13249         esac
13250         ;;
13251 esac
13252 case "$d_uname$d_gethname" in
13253 *define*) ;;
13254 *)
13255         case "$phostname" in
13256         '')
13257                 echo "There will be no way for $package to get your hostname." >&4;;
13258         *)
13259         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13260                 ;;
13261         esac;;
13262 esac
13263 case "$d_phostname" in
13264 '') d_phostname="$undef";;
13265 esac
13266
13267 : see if gethostbyaddr_r exists
13268 set gethostbyaddr_r d_gethostbyaddr_r
13269 eval $inlibc
13270 case "$d_gethostbyaddr_r" in
13271 "$define")
13272         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13273         case "$d_gethostbyaddr_r_proto:$usethreads" in
13274         ":define")      d_gethostbyaddr_r_proto=define
13275                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13276                 eval $hasproto ;;
13277         *)      ;;
13278         esac
13279         case "$d_gethostbyaddr_r_proto" in
13280         define)
13281         case "$gethostbyaddr_r_proto" in
13282         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13283         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13284         esac
13285         case "$gethostbyaddr_r_proto" in
13286         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13287         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13288         esac
13289         case "$gethostbyaddr_r_proto" in
13290         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13291         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13292         esac
13293         case "$gethostbyaddr_r_proto" in
13294         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13295         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13296         esac
13297         case "$gethostbyaddr_r_proto" in
13298         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13299         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13300         esac
13301         case "$gethostbyaddr_r_proto" in
13302         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13303         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13304         esac
13305         case "$gethostbyaddr_r_proto" in
13306         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13307         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13308         esac
13309         case "$gethostbyaddr_r_proto" in
13310         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13311         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13312         esac
13313         case "$gethostbyaddr_r_proto" in
13314         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13315         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13316         esac
13317         case "$gethostbyaddr_r_proto" in
13318         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13319         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13320         esac
13321         case "$gethostbyaddr_r_proto" in
13322         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13323         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13324         esac
13325         case "$gethostbyaddr_r_proto" in
13326         ''|0)   d_gethostbyaddr_r=undef
13327                 gethostbyaddr_r_proto=0
13328                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13329         * )     case "$gethostbyaddr_r_proto" in
13330                 REENTRANT_PROTO*) ;;
13331                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13332                 esac
13333                 echo "Prototype: $try" ;;
13334         esac
13335         ;;
13336         *)      case "$usethreads" in
13337                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13338                 esac
13339                 d_gethostbyaddr_r=undef
13340                 gethostbyaddr_r_proto=0
13341                 ;;
13342         esac
13343         ;;
13344 *)      gethostbyaddr_r_proto=0
13345         ;;
13346 esac
13347
13348 : see if gethostbyname_r exists
13349 set gethostbyname_r d_gethostbyname_r
13350 eval $inlibc
13351 case "$d_gethostbyname_r" in
13352 "$define")
13353         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13354         case "$d_gethostbyname_r_proto:$usethreads" in
13355         ":define")      d_gethostbyname_r_proto=define
13356                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13357                 eval $hasproto ;;
13358         *)      ;;
13359         esac
13360         case "$d_gethostbyname_r_proto" in
13361         define)
13362         case "$gethostbyname_r_proto" in
13363         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13364         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13365         esac
13366         case "$gethostbyname_r_proto" in
13367         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13368         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13369         esac
13370         case "$gethostbyname_r_proto" in
13371         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13372         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13373         esac
13374         case "$gethostbyname_r_proto" in
13375         ''|0)   d_gethostbyname_r=undef
13376                 gethostbyname_r_proto=0
13377                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13378         * )     case "$gethostbyname_r_proto" in
13379                 REENTRANT_PROTO*) ;;
13380                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13381                 esac
13382                 echo "Prototype: $try" ;;
13383         esac
13384         ;;
13385         *)      case "$usethreads" in
13386                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13387                 esac
13388                 d_gethostbyname_r=undef
13389                 gethostbyname_r_proto=0
13390                 ;;
13391         esac
13392         ;;
13393 *)      gethostbyname_r_proto=0
13394         ;;
13395 esac
13396
13397 : see if gethostent_r exists
13398 set gethostent_r d_gethostent_r
13399 eval $inlibc
13400 case "$d_gethostent_r" in
13401 "$define")
13402         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13403         case "$d_gethostent_r_proto:$usethreads" in
13404         ":define")      d_gethostent_r_proto=define
13405                 set d_gethostent_r_proto gethostent_r $hdrs
13406                 eval $hasproto ;;
13407         *)      ;;
13408         esac
13409         case "$d_gethostent_r_proto" in
13410         define)
13411         case "$gethostent_r_proto" in
13412         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13413         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13414         esac
13415         case "$gethostent_r_proto" in
13416         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13417         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13418         esac
13419         case "$gethostent_r_proto" in
13420         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13421         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13422         esac
13423         case "$gethostent_r_proto" in
13424         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13425         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13426         esac
13427         case "$gethostent_r_proto" in
13428         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13429         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13430         esac
13431         case "$gethostent_r_proto" in
13432         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13433         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13434         esac
13435         case "$gethostent_r_proto" in
13436         ''|0)   d_gethostent_r=undef
13437                 gethostent_r_proto=0
13438                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13439         * )     case "$gethostent_r_proto" in
13440                 REENTRANT_PROTO*) ;;
13441                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13442                 esac
13443                 echo "Prototype: $try" ;;
13444         esac
13445         ;;
13446         *)      case "$usethreads" in
13447                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13448                 esac
13449                 d_gethostent_r=undef
13450                 gethostent_r_proto=0
13451                 ;;
13452         esac
13453         ;;
13454 *)      gethostent_r_proto=0
13455         ;;
13456 esac
13457
13458 : see if prototypes for various gethostxxx netdb.h functions are available
13459 echo " "
13460 set d_gethostprotos gethostent $i_netdb netdb.h
13461 eval $hasproto
13462
13463 : see if getitimer exists
13464 set getitimer d_getitimer
13465 eval $inlibc
13466
13467 : see if getlogin exists
13468 set getlogin d_getlogin
13469 eval $inlibc
13470
13471 : see if getlogin_r exists
13472 set getlogin_r d_getlogin_r
13473 eval $inlibc
13474 case "$d_getlogin_r" in
13475 "$define")
13476         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13477         case "$d_getlogin_r_proto:$usethreads" in
13478         ":define")      d_getlogin_r_proto=define
13479                 set d_getlogin_r_proto getlogin_r $hdrs
13480                 eval $hasproto ;;
13481         *)      ;;
13482         esac
13483         case "$d_getlogin_r_proto" in
13484         define)
13485         case "$getlogin_r_proto" in
13486         ''|0) try='int getlogin_r(char*, size_t);'
13487         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13488         esac
13489         case "$getlogin_r_proto" in
13490         ''|0) try='int getlogin_r(char*, int);'
13491         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13492         esac
13493         case "$getlogin_r_proto" in
13494         ''|0) try='char* getlogin_r(char*, size_t);'
13495         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13496         esac
13497         case "$getlogin_r_proto" in
13498         ''|0) try='char* getlogin_r(char*, int);'
13499         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13500         esac
13501         case "$getlogin_r_proto" in
13502         ''|0)   d_getlogin_r=undef
13503                 getlogin_r_proto=0
13504                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13505         * )     case "$getlogin_r_proto" in
13506                 REENTRANT_PROTO*) ;;
13507                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13508                 esac
13509                 echo "Prototype: $try" ;;
13510         esac
13511         ;;
13512         *)      case "$usethreads" in
13513                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13514                 esac
13515                 d_getlogin_r=undef
13516                 getlogin_r_proto=0
13517                 ;;
13518         esac
13519         ;;
13520 *)      getlogin_r_proto=0
13521         ;;
13522 esac
13523
13524 : see if getmnt exists
13525 set getmnt d_getmnt
13526 eval $inlibc
13527
13528 : see if getmntent exists
13529 set getmntent d_getmntent
13530 eval $inlibc
13531
13532 : see if getnetbyaddr exists
13533 set getnetbyaddr d_getnbyaddr
13534 eval $inlibc
13535
13536 : see if getnetbyname exists
13537 set getnetbyname d_getnbyname
13538 eval $inlibc
13539
13540 : see if getnetent exists
13541 set getnetent d_getnent
13542 eval $inlibc
13543
13544 : see if getnetbyaddr_r exists
13545 set getnetbyaddr_r d_getnetbyaddr_r
13546 eval $inlibc
13547 case "$d_getnetbyaddr_r" in
13548 "$define")
13549         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13550         case "$d_getnetbyaddr_r_proto:$usethreads" in
13551         ":define")      d_getnetbyaddr_r_proto=define
13552                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13553                 eval $hasproto ;;
13554         *)      ;;
13555         esac
13556         case "$d_getnetbyaddr_r_proto" in
13557         define)
13558         case "$getnetbyaddr_r_proto" in
13559         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13560         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13561         esac
13562         case "$getnetbyaddr_r_proto" in
13563         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13564         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13565         esac
13566         case "$getnetbyaddr_r_proto" in
13567         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13568         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13569         esac
13570         case "$getnetbyaddr_r_proto" in
13571         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13572         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13573         esac
13574         case "$getnetbyaddr_r_proto" in
13575         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13576         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13577         esac
13578         case "$getnetbyaddr_r_proto" in
13579         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13580         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13581         esac
13582         case "$getnetbyaddr_r_proto" in
13583         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13584         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13585         esac
13586         case "$getnetbyaddr_r_proto" in
13587         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13588         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13589         esac
13590         case "$getnetbyaddr_r_proto" in
13591         ''|0)   d_getnetbyaddr_r=undef
13592                 getnetbyaddr_r_proto=0
13593                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13594         * )     case "$getnetbyaddr_r_proto" in
13595                 REENTRANT_PROTO*) ;;
13596                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13597                 esac
13598                 echo "Prototype: $try" ;;
13599         esac
13600         ;;
13601         *)      case "$usethreads" in
13602                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13603                 esac
13604                 d_getnetbyaddr_r=undef
13605                 getnetbyaddr_r_proto=0
13606                 ;;
13607         esac
13608         ;;
13609 *)      getnetbyaddr_r_proto=0
13610         ;;
13611 esac
13612
13613 : see if getnetbyname_r exists
13614 set getnetbyname_r d_getnetbyname_r
13615 eval $inlibc
13616 case "$d_getnetbyname_r" in
13617 "$define")
13618         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13619         case "$d_getnetbyname_r_proto:$usethreads" in
13620         ":define")      d_getnetbyname_r_proto=define
13621                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13622                 eval $hasproto ;;
13623         *)      ;;
13624         esac
13625         case "$d_getnetbyname_r_proto" in
13626         define)
13627         case "$getnetbyname_r_proto" in
13628         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13629         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13630         esac
13631         case "$getnetbyname_r_proto" in
13632         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13633         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13634         esac
13635         case "$getnetbyname_r_proto" in
13636         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13637         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13638         esac
13639         case "$getnetbyname_r_proto" in
13640         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13641         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13642         esac
13643         case "$getnetbyname_r_proto" in
13644         ''|0)   d_getnetbyname_r=undef
13645                 getnetbyname_r_proto=0
13646                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13647         * )     case "$getnetbyname_r_proto" in
13648                 REENTRANT_PROTO*) ;;
13649                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13650                 esac
13651                 echo "Prototype: $try" ;;
13652         esac
13653         ;;
13654         *)      case "$usethreads" in
13655                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13656                 esac
13657                 d_getnetbyname_r=undef
13658                 getnetbyname_r_proto=0
13659                 ;;
13660         esac
13661         ;;
13662 *)      getnetbyname_r_proto=0
13663         ;;
13664 esac
13665
13666 : see if getnetent_r exists
13667 set getnetent_r d_getnetent_r
13668 eval $inlibc
13669 case "$d_getnetent_r" in
13670 "$define")
13671         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13672         case "$d_getnetent_r_proto:$usethreads" in
13673         ":define")      d_getnetent_r_proto=define
13674                 set d_getnetent_r_proto getnetent_r $hdrs
13675                 eval $hasproto ;;
13676         *)      ;;
13677         esac
13678         case "$d_getnetent_r_proto" in
13679         define)
13680         case "$getnetent_r_proto" in
13681         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13682         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13683         esac
13684         case "$getnetent_r_proto" in
13685         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13686         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13687         esac
13688         case "$getnetent_r_proto" in
13689         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13690         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13691         esac
13692         case "$getnetent_r_proto" in
13693         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13694         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13695         esac
13696         case "$getnetent_r_proto" in
13697         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13698         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13699         esac
13700         case "$getnetent_r_proto" in
13701         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13702         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13703         esac
13704         case "$getnetent_r_proto" in
13705         ''|0)   d_getnetent_r=undef
13706                 getnetent_r_proto=0
13707                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13708         * )     case "$getnetent_r_proto" in
13709                 REENTRANT_PROTO*) ;;
13710                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13711                 esac
13712                 echo "Prototype: $try" ;;
13713         esac
13714         ;;
13715         *)      case "$usethreads" in
13716                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13717                 esac
13718                 d_getnetent_r=undef
13719                 getnetent_r_proto=0
13720                 ;;
13721         esac
13722         ;;
13723 *)      getnetent_r_proto=0
13724         ;;
13725 esac
13726
13727 : see if prototypes for various getnetxxx netdb.h functions are available
13728 echo " "
13729 set d_getnetprotos getnetent $i_netdb netdb.h
13730 eval $hasproto
13731
13732 : see if getpagesize exists
13733 set getpagesize d_getpagsz
13734 eval $inlibc
13735
13736
13737 : see if getprotobyname exists
13738 set getprotobyname d_getpbyname
13739 eval $inlibc
13740
13741 : see if getprotobynumber exists
13742 set getprotobynumber d_getpbynumber
13743 eval $inlibc
13744
13745 : see if getprotoent exists
13746 set getprotoent d_getpent
13747 eval $inlibc
13748
13749 : see if getpgid exists
13750 set getpgid d_getpgid
13751 eval $inlibc
13752
13753 : see if getpgrp2 exists
13754 set getpgrp2 d_getpgrp2
13755 eval $inlibc
13756
13757 : see if getppid exists
13758 set getppid d_getppid
13759 eval $inlibc
13760
13761 : see if getpriority exists
13762 set getpriority d_getprior
13763 eval $inlibc
13764
13765 : see if getprotobyname_r exists
13766 set getprotobyname_r d_getprotobyname_r
13767 eval $inlibc
13768 case "$d_getprotobyname_r" in
13769 "$define")
13770         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13771         case "$d_getprotobyname_r_proto:$usethreads" in
13772         ":define")      d_getprotobyname_r_proto=define
13773                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13774                 eval $hasproto ;;
13775         *)      ;;
13776         esac
13777         case "$d_getprotobyname_r_proto" in
13778         define)
13779         case "$getprotobyname_r_proto" in
13780         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13781         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13782         esac
13783         case "$getprotobyname_r_proto" in
13784         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13785         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13786         esac
13787         case "$getprotobyname_r_proto" in
13788         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13789         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13790         esac
13791         case "$getprotobyname_r_proto" in
13792         ''|0)   d_getprotobyname_r=undef
13793                 getprotobyname_r_proto=0
13794                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13795         * )     case "$getprotobyname_r_proto" in
13796                 REENTRANT_PROTO*) ;;
13797                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13798                 esac
13799                 echo "Prototype: $try" ;;
13800         esac
13801         ;;
13802         *)      case "$usethreads" in
13803                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13804                 esac
13805                 d_getprotobyname_r=undef
13806                 getprotobyname_r_proto=0
13807                 ;;
13808         esac
13809         ;;
13810 *)      getprotobyname_r_proto=0
13811         ;;
13812 esac
13813
13814 : see if getprotobynumber_r exists
13815 set getprotobynumber_r d_getprotobynumber_r
13816 eval $inlibc
13817 case "$d_getprotobynumber_r" in
13818 "$define")
13819         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13820         case "$d_getprotobynumber_r_proto:$usethreads" in
13821         ":define")      d_getprotobynumber_r_proto=define
13822                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13823                 eval $hasproto ;;
13824         *)      ;;
13825         esac
13826         case "$d_getprotobynumber_r_proto" in
13827         define)
13828         case "$getprotobynumber_r_proto" in
13829         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13830         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13831         esac
13832         case "$getprotobynumber_r_proto" in
13833         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13834         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13835         esac
13836         case "$getprotobynumber_r_proto" in
13837         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13838         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13839         esac
13840         case "$getprotobynumber_r_proto" in
13841         ''|0)   d_getprotobynumber_r=undef
13842                 getprotobynumber_r_proto=0
13843                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13844         * )     case "$getprotobynumber_r_proto" in
13845                 REENTRANT_PROTO*) ;;
13846                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13847                 esac
13848                 echo "Prototype: $try" ;;
13849         esac
13850         ;;
13851         *)      case "$usethreads" in
13852                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13853                 esac
13854                 d_getprotobynumber_r=undef
13855                 getprotobynumber_r_proto=0
13856                 ;;
13857         esac
13858         ;;
13859 *)      getprotobynumber_r_proto=0
13860         ;;
13861 esac
13862
13863 : see if getprotoent_r exists
13864 set getprotoent_r d_getprotoent_r
13865 eval $inlibc
13866 case "$d_getprotoent_r" in
13867 "$define")
13868         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13869         case "$d_getprotoent_r_proto:$usethreads" in
13870         ":define")      d_getprotoent_r_proto=define
13871                 set d_getprotoent_r_proto getprotoent_r $hdrs
13872                 eval $hasproto ;;
13873         *)      ;;
13874         esac
13875         case "$d_getprotoent_r_proto" in
13876         define)
13877         case "$getprotoent_r_proto" in
13878         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13879         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13880         esac
13881         case "$getprotoent_r_proto" in
13882         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13883         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13884         esac
13885         case "$getprotoent_r_proto" in
13886         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13887         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13888         esac
13889         case "$getprotoent_r_proto" in
13890         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13891         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13892         esac
13893         case "$getprotoent_r_proto" in
13894         ''|0)   d_getprotoent_r=undef
13895                 getprotoent_r_proto=0
13896                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13897         * )     case "$getprotoent_r_proto" in
13898                 REENTRANT_PROTO*) ;;
13899                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13900                 esac
13901                 echo "Prototype: $try" ;;
13902         esac
13903         ;;
13904         *)      case "$usethreads" in
13905                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13906                 esac
13907                 d_getprotoent_r=undef
13908                 getprotoent_r_proto=0
13909                 ;;
13910         esac
13911         ;;
13912 *)      getprotoent_r_proto=0
13913         ;;
13914 esac
13915
13916 : see if prototypes for various getprotoxxx netdb.h functions are available
13917 echo " "
13918 set d_getprotoprotos getprotoent $i_netdb netdb.h
13919 eval $hasproto
13920
13921 : see if getprpwnam exists
13922 set getprpwnam d_getprpwnam
13923 eval $inlibc
13924
13925 : see if getpwent exists
13926 set getpwent d_getpwent
13927 eval $inlibc
13928
13929 : see if getpwent_r exists
13930 set getpwent_r d_getpwent_r
13931 eval $inlibc
13932 case "$d_getpwent_r" in
13933 "$define")
13934         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13935         case "$d_getpwent_r_proto:$usethreads" in
13936         ":define")      d_getpwent_r_proto=define
13937                 set d_getpwent_r_proto getpwent_r $hdrs
13938                 eval $hasproto ;;
13939         *)      ;;
13940         esac
13941         case "$d_getpwent_r_proto" in
13942         define)
13943         case "$getpwent_r_proto" in
13944         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13945         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13946         esac
13947         case "$getpwent_r_proto" in
13948         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13949         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13950         esac
13951         case "$getpwent_r_proto" in
13952         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13953         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13954         esac
13955         case "$getpwent_r_proto" in
13956         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13957         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13958         esac
13959         case "$getpwent_r_proto" in
13960         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13961         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13962         esac
13963         case "$getpwent_r_proto" in
13964         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13965         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13966         esac
13967         case "$getpwent_r_proto" in
13968         ''|0)   d_getpwent_r=undef
13969                 getpwent_r_proto=0
13970                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13971         * )     case "$getpwent_r_proto" in
13972                 REENTRANT_PROTO*) ;;
13973                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13974                 esac
13975                 echo "Prototype: $try" ;;
13976         esac
13977         ;;
13978         *)      case "$usethreads" in
13979                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13980                 esac
13981                 d_getpwent_r=undef
13982                 getpwent_r_proto=0
13983                 ;;
13984         esac
13985         ;;
13986 *)      getpwent_r_proto=0
13987         ;;
13988 esac
13989
13990 : see if getpwnam_r exists
13991 set getpwnam_r d_getpwnam_r
13992 eval $inlibc
13993 case "$d_getpwnam_r" in
13994 "$define")
13995         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13996         case "$d_getpwnam_r_proto:$usethreads" in
13997         ":define")      d_getpwnam_r_proto=define
13998                 set d_getpwnam_r_proto getpwnam_r $hdrs
13999                 eval $hasproto ;;
14000         *)      ;;
14001         esac
14002         case "$d_getpwnam_r_proto" in
14003         define)
14004         case "$getpwnam_r_proto" in
14005         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14006         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14007         esac
14008         case "$getpwnam_r_proto" in
14009         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14010         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14011         esac
14012         case "$getpwnam_r_proto" in
14013         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14014         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14015         esac
14016         case "$getpwnam_r_proto" in
14017         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14018         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14019         esac
14020         case "$getpwnam_r_proto" in
14021         ''|0)   d_getpwnam_r=undef
14022                 getpwnam_r_proto=0
14023                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14024         * )     case "$getpwnam_r_proto" in
14025                 REENTRANT_PROTO*) ;;
14026                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14027                 esac
14028                 echo "Prototype: $try" ;;
14029         esac
14030         ;;
14031         *)      case "$usethreads" in
14032                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14033                 esac
14034                 d_getpwnam_r=undef
14035                 getpwnam_r_proto=0
14036                 ;;
14037         esac
14038         ;;
14039 *)      getpwnam_r_proto=0
14040         ;;
14041 esac
14042
14043 : see if getpwuid_r exists
14044 set getpwuid_r d_getpwuid_r
14045 eval $inlibc
14046 case "$d_getpwuid_r" in
14047 "$define")
14048         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14049         case "$d_getpwuid_r_proto:$usethreads" in
14050         ":define")      d_getpwuid_r_proto=define
14051                 set d_getpwuid_r_proto getpwuid_r $hdrs
14052                 eval $hasproto ;;
14053         *)      ;;
14054         esac
14055         case "$d_getpwuid_r_proto" in
14056         define)
14057         case "$getpwuid_r_proto" in
14058         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14059         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14060         esac
14061         case "$getpwuid_r_proto" in
14062         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14063         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14064         esac
14065         case "$getpwuid_r_proto" in
14066         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14067         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14068         esac
14069         case "$getpwuid_r_proto" in
14070         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14071         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14072         esac
14073         case "$getpwuid_r_proto" in
14074         ''|0)   d_getpwuid_r=undef
14075                 getpwuid_r_proto=0
14076                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14077         * )     case "$getpwuid_r_proto" in
14078                 REENTRANT_PROTO*) ;;
14079                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14080                 esac
14081                 echo "Prototype: $try" ;;
14082         esac
14083         ;;
14084         *)      case "$usethreads" in
14085                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14086                 esac
14087                 d_getpwuid_r=undef
14088                 getpwuid_r_proto=0
14089                 ;;
14090         esac
14091         ;;
14092 *)      getpwuid_r_proto=0
14093         ;;
14094 esac
14095
14096
14097 : see if getservbyname exists
14098 set getservbyname d_getsbyname
14099 eval $inlibc
14100
14101 : see if getservbyport exists
14102 set getservbyport d_getsbyport
14103 eval $inlibc
14104
14105 : see if getservent exists
14106 set getservent d_getsent
14107 eval $inlibc
14108
14109 : see if getservbyname_r exists
14110 set getservbyname_r d_getservbyname_r
14111 eval $inlibc
14112 case "$d_getservbyname_r" in
14113 "$define")
14114         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14115         case "$d_getservbyname_r_proto:$usethreads" in
14116         ":define")      d_getservbyname_r_proto=define
14117                 set d_getservbyname_r_proto getservbyname_r $hdrs
14118                 eval $hasproto ;;
14119         *)      ;;
14120         esac
14121         case "$d_getservbyname_r_proto" in
14122         define)
14123         case "$getservbyname_r_proto" in
14124         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14125         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14126         esac
14127         case "$getservbyname_r_proto" in
14128         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14129         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14130         esac
14131         case "$getservbyname_r_proto" in
14132         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14133         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14134         esac
14135         case "$getservbyname_r_proto" in
14136         ''|0)   d_getservbyname_r=undef
14137                 getservbyname_r_proto=0
14138                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14139         * )     case "$getservbyname_r_proto" in
14140                 REENTRANT_PROTO*) ;;
14141                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14142                 esac
14143                 echo "Prototype: $try" ;;
14144         esac
14145         ;;
14146         *)      case "$usethreads" in
14147                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14148                 esac
14149                 d_getservbyname_r=undef
14150                 getservbyname_r_proto=0
14151                 ;;
14152         esac
14153         ;;
14154 *)      getservbyname_r_proto=0
14155         ;;
14156 esac
14157
14158 : see if getservbyport_r exists
14159 set getservbyport_r d_getservbyport_r
14160 eval $inlibc
14161 case "$d_getservbyport_r" in
14162 "$define")
14163         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14164         case "$d_getservbyport_r_proto:$usethreads" in
14165         ":define")      d_getservbyport_r_proto=define
14166                 set d_getservbyport_r_proto getservbyport_r $hdrs
14167                 eval $hasproto ;;
14168         *)      ;;
14169         esac
14170         case "$d_getservbyport_r_proto" in
14171         define)
14172         case "$getservbyport_r_proto" in
14173         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14174         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14175         esac
14176         case "$getservbyport_r_proto" in
14177         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14178         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14179         esac
14180         case "$getservbyport_r_proto" in
14181         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14182         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14183         esac
14184         case "$getservbyport_r_proto" in
14185         ''|0)   d_getservbyport_r=undef
14186                 getservbyport_r_proto=0
14187                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14188         * )     case "$getservbyport_r_proto" in
14189                 REENTRANT_PROTO*) ;;
14190                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14191                 esac
14192                 echo "Prototype: $try" ;;
14193         esac
14194         ;;
14195         *)      case "$usethreads" in
14196                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14197                 esac
14198                 d_getservbyport_r=undef
14199                 getservbyport_r_proto=0
14200                 ;;
14201         esac
14202         ;;
14203 *)      getservbyport_r_proto=0
14204         ;;
14205 esac
14206
14207 : see if getservent_r exists
14208 set getservent_r d_getservent_r
14209 eval $inlibc
14210 case "$d_getservent_r" in
14211 "$define")
14212         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14213         case "$d_getservent_r_proto:$usethreads" in
14214         ":define")      d_getservent_r_proto=define
14215                 set d_getservent_r_proto getservent_r $hdrs
14216                 eval $hasproto ;;
14217         *)      ;;
14218         esac
14219         case "$d_getservent_r_proto" in
14220         define)
14221         case "$getservent_r_proto" in
14222         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14223         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14224         esac
14225         case "$getservent_r_proto" in
14226         ''|0) try='int getservent_r(struct servent*, char*, int);'
14227         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14228         esac
14229         case "$getservent_r_proto" in
14230         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14231         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14232         esac
14233         case "$getservent_r_proto" in
14234         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14235         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14236         esac
14237         case "$getservent_r_proto" in
14238         ''|0)   d_getservent_r=undef
14239                 getservent_r_proto=0
14240                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14241         * )     case "$getservent_r_proto" in
14242                 REENTRANT_PROTO*) ;;
14243                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14244                 esac
14245                 echo "Prototype: $try" ;;
14246         esac
14247         ;;
14248         *)      case "$usethreads" in
14249                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14250                 esac
14251                 d_getservent_r=undef
14252                 getservent_r_proto=0
14253                 ;;
14254         esac
14255         ;;
14256 *)      getservent_r_proto=0
14257         ;;
14258 esac
14259
14260 : see if prototypes for various getservxxx netdb.h functions are available
14261 echo " "
14262 set d_getservprotos getservent $i_netdb netdb.h
14263 eval $hasproto
14264
14265 : see if getspnam exists
14266 set getspnam d_getspnam
14267 eval $inlibc
14268
14269 : see if this is a shadow.h system
14270 set shadow.h i_shadow
14271 eval $inhdr
14272
14273 : see if getspnam_r exists
14274 set getspnam_r d_getspnam_r
14275 eval $inlibc
14276 case "$d_getspnam_r" in
14277 "$define")
14278         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14279         case "$d_getspnam_r_proto:$usethreads" in
14280         ":define")      d_getspnam_r_proto=define
14281                 set d_getspnam_r_proto getspnam_r $hdrs
14282                 eval $hasproto ;;
14283         *)      ;;
14284         esac
14285         case "$d_getspnam_r_proto" in
14286         define)
14287         case "$getspnam_r_proto" in
14288         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14289         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14290         esac
14291         case "$getspnam_r_proto" in
14292         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14293         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14294         esac
14295         case "$getspnam_r_proto" in
14296         ''|0)   d_getspnam_r=undef
14297                 getspnam_r_proto=0
14298                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14299         * )     case "$getspnam_r_proto" in
14300                 REENTRANT_PROTO*) ;;
14301                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14302                 esac
14303                 echo "Prototype: $try" ;;
14304         esac
14305         ;;
14306         *)      case "$usethreads" in
14307                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14308                 esac
14309                 d_getspnam_r=undef
14310                 getspnam_r_proto=0
14311                 ;;
14312         esac
14313         ;;
14314 *)      getspnam_r_proto=0
14315         ;;
14316 esac
14317
14318 : see if gettimeofday or ftime exists
14319 set gettimeofday d_gettimeod
14320 eval $inlibc
14321 case "$d_gettimeod" in
14322 "$undef")
14323         set ftime d_ftime 
14324         eval $inlibc
14325         ;;
14326 *)
14327         val="$undef"; set d_ftime; eval $setvar
14328         ;;
14329 esac
14330 case "$d_gettimeod$d_ftime" in
14331 "$undef$undef")
14332         echo " "
14333         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14334         ;;
14335 esac
14336
14337 : see if gmtime_r exists
14338 set gmtime_r d_gmtime_r
14339 eval $inlibc
14340 case "$d_gmtime_r" in
14341 "$define")
14342         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14343         case "$d_gmtime_r_proto:$usethreads" in
14344         ":define")      d_gmtime_r_proto=define
14345                 set d_gmtime_r_proto gmtime_r $hdrs
14346                 eval $hasproto ;;
14347         *)      ;;
14348         esac
14349         case "$d_gmtime_r_proto" in
14350         define)
14351         case "$gmtime_r_proto" in
14352         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14353         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14354         esac
14355         case "$gmtime_r_proto" in
14356         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14357         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14358         esac
14359         case "$gmtime_r_proto" in
14360         ''|0)   d_gmtime_r=undef
14361                 gmtime_r_proto=0
14362                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14363         * )     case "$gmtime_r_proto" in
14364                 REENTRANT_PROTO*) ;;
14365                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14366                 esac
14367                 echo "Prototype: $try" ;;
14368         esac
14369         ;;
14370         *)      case "$usethreads" in
14371                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14372                 esac
14373                 d_gmtime_r=undef
14374                 gmtime_r_proto=0
14375                 ;;
14376         esac
14377         ;;
14378 *)      gmtime_r_proto=0
14379         ;;
14380 esac
14381
14382 : see if hasmntopt exists
14383 set hasmntopt d_hasmntopt
14384 eval $inlibc
14385
14386 : see if this is a netinet/in.h or sys/in.h system
14387 set netinet/in.h i_niin sys/in.h i_sysin
14388 eval $inhdr
14389
14390 : see if arpa/inet.h has to be included
14391 set arpa/inet.h i_arpainet
14392 eval $inhdr
14393
14394 : see if htonl --and friends-- exists
14395 val=''
14396 set htonl val
14397 eval $inlibc
14398
14399 : Maybe they are macros.
14400 case "$val" in
14401 $undef)
14402         $cat >htonl.c <<EOM
14403 #include <stdio.h>
14404 #include <sys/types.h>
14405 #$i_niin I_NETINET_IN
14406 #$i_sysin I_SYS_IN
14407 #$i_arpainet I_ARPA_INET
14408 #ifdef I_NETINET_IN
14409 #include <netinet/in.h>
14410 #endif
14411 #ifdef I_SYS_IN
14412 #include <sys/in.h>
14413 #endif
14414 #ifdef I_ARPA_INET
14415 #include <arpa/inet.h>
14416 #endif
14417 #ifdef htonl
14418 printf("Defined as a macro.");
14419 #endif
14420 EOM
14421         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14422         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14423                 val="$define"
14424                 echo "But it seems to be defined as a macro." >&4
14425         fi
14426         $rm -f htonl.?
14427         ;;
14428 esac
14429 set d_htonl
14430 eval $setvar
14431
14432 : see if ilogbl exists
14433 set ilogbl d_ilogbl
14434 eval $inlibc
14435
14436 : index or strchr
14437 echo " "
14438 if set index val -f; eval $csym; $val; then
14439         if set strchr val -f d_strchr; eval $csym; $val; then
14440                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14441                         val="$define"
14442                         vali="$undef"
14443                         echo "strchr() found." >&4
14444                 else
14445                         val="$undef"
14446                         vali="$define"
14447                         echo "index() found." >&4
14448                 fi
14449         else
14450                 val="$undef"
14451                 vali="$define"
14452                 echo "index() found." >&4
14453         fi
14454 else
14455         if set strchr val -f d_strchr; eval $csym; $val; then
14456                 val="$define"
14457                 vali="$undef"
14458                 echo "strchr() found." >&4
14459         else
14460                 echo "No index() or strchr() found!" >&4
14461                 val="$undef"
14462                 vali="$undef"
14463         fi
14464 fi
14465 set d_strchr; eval $setvar
14466 val="$vali"
14467 set d_index; eval $setvar
14468
14469 : check whether inet_aton exists
14470 set inet_aton d_inetaton
14471 eval $inlibc
14472
14473 : Look for isascii
14474 echo " "
14475 $cat >isascii.c <<EOCP
14476 #include <stdio.h>
14477 #include <ctype.h>
14478 #$i_stdlib I_STDLIB
14479 #ifdef I_STDLIB
14480 #include <stdlib.h>
14481 #endif
14482 int main() {
14483         int c = 'A';
14484         if (isascii(c))
14485                 exit(0);
14486         else
14487                 exit(1);
14488 }
14489 EOCP
14490 set isascii
14491 if eval $compile; then
14492         echo "isascii() found." >&4
14493         val="$define"
14494 else
14495         echo "isascii() NOT found." >&4
14496         val="$undef"
14497 fi
14498 set d_isascii
14499 eval $setvar
14500 $rm -f isascii*
14501
14502 : see if isfinite exists
14503 set isfinite d_isfinite
14504 eval $inlibc
14505
14506 : see if isinf exists
14507 set isinf d_isinf
14508 eval $inlibc
14509
14510 : see if isnan exists
14511 set isnan d_isnan
14512 eval $inlibc
14513
14514 : see if isnanl exists
14515 set isnanl d_isnanl
14516 eval $inlibc
14517
14518 : see if killpg exists
14519 set killpg d_killpg
14520 eval $inlibc
14521
14522 : see if lchown exists
14523 echo " "
14524 $cat > try.c <<'EOCP'
14525 /* System header to define __stub macros and hopefully few prototypes,
14526     which can conflict with char lchown(); below.  */
14527 #include <assert.h>
14528 /* Override any gcc2 internal prototype to avoid an error.  */
14529 /* We use char because int might match the return type of a gcc2
14530    builtin and then its argument prototype would still apply.  */
14531 char lchown();
14532 int main() {
14533     /*  The GNU C library defines this for functions which it implements
14534         to always fail with ENOSYS.  Some functions are actually named
14535         something starting with __ and the normal name is an alias.  */
14536 #if defined (__stub_lchown) || defined (__stub___lchown)
14537 choke me
14538 #else
14539 lchown();
14540 #endif
14541 ; return 0; }
14542 EOCP
14543 set try
14544 if eval $compile; then
14545     $echo "lchown() found." >&4
14546     val="$define"
14547 else
14548     $echo "lchown() NOT found." >&4
14549     val="$undef"
14550 fi
14551 set d_lchown
14552 eval $setvar
14553
14554 : See if number of significant digits in a double precision number is known
14555 echo " "
14556 $cat >ldbl_dig.c <<EOM
14557 #$i_limits I_LIMITS
14558 #$i_float I_FLOAT
14559 #ifdef I_LIMITS
14560 #include <limits.h>
14561 #endif
14562 #ifdef I_FLOAT
14563 #include <float.h>
14564 #endif
14565 #ifdef LDBL_DIG
14566 printf("Contains LDBL_DIG");
14567 #endif
14568 EOM
14569 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14570 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14571         echo "LDBL_DIG found." >&4
14572         val="$define"
14573 else
14574         echo "LDBL_DIG NOT found." >&4
14575         val="$undef"
14576 fi
14577 $rm -f ldbl_dig.?
14578 set d_ldbl_dig
14579 eval $setvar
14580
14581 : see if this is a math.h system
14582 set math.h i_math
14583 eval $inhdr
14584
14585 d_libm_lib_version="$undef"
14586 case $i_math in
14587     $define)
14588         : check to see if math.h defines _LIB_VERSION
14589         echo " "
14590         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14591         $cat >try.c <<EOCP
14592 #include <unistd.h>
14593 #include <math.h>
14594 int main (int argc, char *argv[])
14595 {
14596     printf ("%d\n", _LIB_VERSION);
14597     return (0);
14598     } /* main */
14599 EOCP
14600         set try
14601         if eval $compile; then
14602             foo=`$run ./try`
14603             echo "Yes, it does ($foo)" >&4
14604             d_libm_lib_version="$define"
14605         else
14606             echo "No, it does not (probably harmless)\n" >&4
14607             fi
14608         $rm_try
14609         ;;
14610
14611     esac
14612
14613 : see if link exists
14614 set link d_link
14615 eval $inlibc
14616
14617 : see if localtime_r exists
14618 set localtime_r d_localtime_r
14619 eval $inlibc
14620 case "$d_localtime_r" in
14621 "$define")
14622         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14623         case "$d_localtime_r_proto:$usethreads" in
14624         ":define")      d_localtime_r_proto=define
14625                 set d_localtime_r_proto localtime_r $hdrs
14626                 eval $hasproto ;;
14627         *)      ;;
14628         esac
14629         case "$d_localtime_r_proto" in
14630         define)
14631         case "$localtime_r_proto" in
14632         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14633         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14634         esac
14635         case "$localtime_r_proto" in
14636         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14637         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14638         esac
14639         case "$localtime_r_proto" in
14640         ''|0)   d_localtime_r=undef
14641                 localtime_r_proto=0
14642                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14643         * )     case "$localtime_r_proto" in
14644                 REENTRANT_PROTO*) ;;
14645                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14646                 esac
14647                 echo "Prototype: $try" ;;
14648         esac
14649         ;;
14650         *)      case "$usethreads" in
14651                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14652                 esac
14653                 d_localtime_r=undef
14654                 localtime_r_proto=0
14655                 ;;
14656         esac
14657         ;;
14658 *)      localtime_r_proto=0
14659         ;;
14660 esac
14661
14662 : see if localtime_r calls tzset
14663 case "$localtime_r_proto" in
14664 REENTRANT_PROTO*)
14665         $cat >try.c <<EOCP
14666 /*  Does our libc's localtime_r call tzset ?
14667  *  return 0 if so, 1 otherwise.
14668  */
14669 #include <sys/types.h>
14670 #include <unistd.h>
14671 #include <time.h>
14672 #include <string.h>
14673 #include <malloc.h>
14674 int main()
14675 {
14676     time_t t = time(0L);
14677     char w_tz[]="TZ" "=GMT+5",
14678          e_tz[]="TZ" "=GMT-5",
14679         *tz_e = (char*)malloc(16),
14680         *tz_w = (char*)malloc(16);
14681     struct tm tm_e, tm_w;
14682     memset(&tm_e,'\0',sizeof(struct tm));
14683     memset(&tm_w,'\0',sizeof(struct tm));
14684     strcpy(tz_e,e_tz);
14685     strcpy(tz_w,w_tz);
14686
14687     putenv(tz_e);
14688     localtime_r(&t, &tm_e);
14689
14690     putenv(tz_w);
14691     localtime_r(&t, &tm_w);
14692
14693     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14694         return 1;
14695     return 0;
14696 }
14697 EOCP
14698         set try
14699         if eval $compile; then
14700             if $run ./try; then
14701                 d_localtime_r_needs_tzset=undef;
14702             else
14703                 d_localtime_r_needs_tzset=define;
14704             fi;
14705         else
14706             d_localtime_r_needs_tzset=undef;
14707         fi;
14708      ;;
14709   *)
14710      d_localtime_r_needs_tzset=undef;
14711      ;;
14712 esac
14713 $rm_try
14714
14715 : see if localeconv exists
14716 set localeconv d_locconv
14717 eval $inlibc
14718
14719 : see if lockf exists
14720 set lockf d_lockf
14721 eval $inlibc
14722
14723 : see if prototype for lseek is available
14724 echo " "
14725 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14726 eval $hasproto
14727
14728 : see if lstat exists
14729 set lstat d_lstat
14730 eval $inlibc
14731
14732 : see if madvise exists
14733 set madvise d_madvise
14734 eval $inlibc
14735
14736 : see if malloc_size exists
14737 set malloc_size d_malloc_size
14738 eval $inlibc
14739
14740 : see if malloc_size_good exists
14741 set malloc_good_size d_malloc_good_size
14742 eval $inlibc
14743
14744 : see if mblen exists
14745 set mblen d_mblen
14746 eval $inlibc
14747
14748 : see if mbstowcs exists
14749 set mbstowcs d_mbstowcs
14750 eval $inlibc
14751
14752 : see if mbtowc exists
14753 set mbtowc d_mbtowc
14754 eval $inlibc
14755
14756 : see if memchr exists
14757 set memchr d_memchr
14758 eval $inlibc
14759
14760 : see if memcmp exists
14761 set memcmp d_memcmp
14762 eval $inlibc
14763
14764 : see if memcpy exists
14765 set memcpy d_memcpy
14766 eval $inlibc
14767
14768 : see if memmove exists
14769 set memmove d_memmove
14770 eval $inlibc
14771
14772 : see if memset exists
14773 set memset d_memset
14774 eval $inlibc
14775
14776 : see if mkdir exists
14777 set mkdir d_mkdir
14778 eval $inlibc
14779
14780 : see if mkdtemp exists
14781 set mkdtemp d_mkdtemp
14782 eval $inlibc
14783
14784 : see if mkfifo exists
14785 set mkfifo d_mkfifo
14786 eval $inlibc
14787
14788 : see if mkstemp exists
14789 set mkstemp d_mkstemp
14790 eval $inlibc
14791
14792 : see if mkstemps exists
14793 set mkstemps d_mkstemps
14794 eval $inlibc
14795
14796 : see if mktime exists
14797 set mktime d_mktime
14798 eval $inlibc
14799
14800 : see if this is a sys/mman.h system
14801 set sys/mman.h i_sysmman
14802 eval $inhdr
14803
14804 : see if mmap exists
14805 set mmap d_mmap
14806 eval $inlibc
14807 : see what shmat returns
14808 : default to something harmless
14809 mmaptype='void *'
14810 case "$i_sysmman$d_mmap" in
14811 "$define$define")
14812         $cat >mmap.c <<'END'
14813 #include <sys/mman.h>
14814 void *mmap();
14815 END
14816         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14817                 mmaptype='void *'
14818         else
14819                 mmaptype='caddr_t'
14820         fi
14821         echo "and it returns ($mmaptype)." >&4
14822         ;;
14823 esac
14824
14825
14826
14827 : see if sqrtl exists
14828 set sqrtl d_sqrtl
14829 eval $inlibc
14830
14831 : see if scalbnl exists
14832 set scalbnl d_scalbnl
14833 eval $inlibc
14834
14835 : see if modfl exists
14836 set modfl d_modfl
14837 eval $inlibc
14838
14839 : see if prototype for modfl is available
14840 echo " "
14841 set d_modflproto modfl $i_math math.h
14842 eval $hasproto
14843
14844 d_modfl_pow32_bug="$undef"
14845
14846 case "$d_longdbl$d_modfl" in
14847 $define$define)
14848         $cat <<EOM
14849 Checking to see whether your modfl() is okay for large values...
14850 EOM
14851 $cat >try.c <<EOCP
14852 #include <math.h>
14853 #include <stdio.h>
14854 EOCP
14855 if $test "X$d_modflproto" != "X$define"; then
14856         $cat >>try.c <<EOCP
14857 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14858 long double modfl (long double, long double *);
14859 EOCP
14860 fi
14861 $cat >>try.c <<EOCP
14862 int main() {
14863     long double nv = 4294967303.15;
14864     long double v, w;
14865     v = modfl(nv, &w);
14866 #ifdef __GLIBC__
14867     printf("glibc");
14868 #endif
14869     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14870     return 0;
14871 }
14872 EOCP
14873         case "$osname:$gccversion" in
14874         aix:)   saveccflags="$ccflags"
14875                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14876         esac
14877         set try
14878         if eval $compile; then
14879                 foo=`$run ./try`
14880                 case "$foo" in
14881                 *" 4294967303.150000 1.150000 4294967302.000000")
14882                         echo >&4 "Your modfl() is broken for large values."
14883                         d_modfl_pow32_bug="$define"
14884                         case "$foo" in
14885                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14886                         ;;
14887                         esac
14888                         ;;
14889                 *" 4294967303.150000 0.150000 4294967303.000000")
14890                         echo >&4 "Your modfl() seems okay for large values."
14891                         ;;
14892                 *)      echo >&4 "I don't understand your modfl() at all."
14893                         d_modfl="$undef"
14894                         ;;
14895                 esac
14896                 $rm_try
14897         else
14898                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14899                 d_modfl="$undef"
14900         fi
14901         case "$osname:$gccversion" in
14902         aix:)   ccflags="$saveccflags" ;; # restore
14903         esac
14904         ;;
14905 esac
14906
14907 if $test "$uselongdouble" = "$define"; then
14908     message=""
14909     if $test "$d_sqrtl" != "$define"; then
14910         message="$message sqrtl"
14911     fi
14912     if $test "$d_modfl" != "$define"; then
14913         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14914             echo "You have both aintl and copysignl, so I can emulate modfl."
14915         else
14916             message="$message modfl"
14917         fi
14918     fi
14919     if $test "$d_frexpl" != "$define"; then
14920         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14921             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14922         else
14923             message="$message frexpl"
14924         fi
14925     fi
14926
14927     if $test "$message" != ""; then
14928         $cat <<EOM >&4
14929
14930 *** You requested the use of long doubles but you do not seem to have
14931 *** the following mathematical functions needed for long double support:
14932 ***    $message
14933 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14934 *** Cannot continue, aborting.
14935
14936 EOM
14937
14938         exit 1
14939     fi
14940 fi
14941
14942 : see if mprotect exists
14943 set mprotect d_mprotect
14944 eval $inlibc
14945
14946 : see if msgctl exists
14947 set msgctl d_msgctl
14948 eval $inlibc
14949
14950 : see if msgget exists
14951 set msgget d_msgget
14952 eval $inlibc
14953
14954 : see if msgsnd exists
14955 set msgsnd d_msgsnd
14956 eval $inlibc
14957
14958 : see if msgrcv exists
14959 set msgrcv d_msgrcv
14960 eval $inlibc
14961
14962 : see how much of the 'msg*(2)' library is present.
14963 h_msg=true
14964 echo " "
14965 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14966 *"$undef"*) h_msg=false;;
14967 esac
14968 case "$osname" in
14969 freebsd)
14970     case "`ipcs 2>&1`" in
14971     "SVID messages"*"not configured"*)
14972         echo "Your $osname does not have the msg*(2) configured." >&4
14973         h_msg=false
14974         val="$undef"
14975         set msgctl d_msgctl
14976         eval $setvar
14977         set msgget d_msgget
14978         eval $setvar
14979         set msgsnd d_msgsnd
14980         eval $setvar
14981         set msgrcv d_msgrcv
14982         eval $setvar
14983         ;;
14984     esac
14985     ;;
14986 esac
14987 : we could also check for sys/ipc.h ...
14988 if $h_msg && $test `./findhdr sys/msg.h`; then
14989         echo "You have the full msg*(2) library." >&4
14990         val="$define"
14991 else
14992         echo "You don't have the full msg*(2) library." >&4
14993         val="$undef"
14994 fi
14995 set d_msg
14996 eval $setvar
14997
14998
14999 echo " "
15000 echo "Checking to see if your system supports struct msghdr..." >&4
15001 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15002 eval $hasstruct
15003 case "$d_msghdr_s" in
15004 "$define")      echo "Yes, it does."   ;;
15005 *)              echo "No, it doesn't." ;;
15006 esac
15007
15008
15009 : see if msync exists
15010 set msync d_msync
15011 eval $inlibc
15012
15013 : see if munmap exists
15014 set munmap d_munmap
15015 eval $inlibc
15016
15017 : see if nice exists
15018 set nice d_nice
15019 eval $inlibc
15020
15021 : see if this is a langinfo.h system
15022 set langinfo.h i_langinfo
15023 eval $inhdr
15024
15025 : see if nl_langinfo exists
15026 set nl_langinfo d_nl_langinfo
15027 eval $inlibc
15028
15029 : check for length of character
15030 echo " "
15031 case "$charsize" in
15032 '')
15033         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15034         $cat >try.c <<EOCP
15035 #include <stdio.h>
15036 #$i_stdlib I_STDLIB
15037 #ifdef I_STDLIB
15038 #include <stdlib.h>
15039 #endif
15040 int main()
15041 {
15042     printf("%d\n", (int)sizeof(char));
15043     exit(0);
15044 }
15045 EOCP
15046         set try
15047         if eval $compile_ok; then
15048                 dflt=`$run ./try`
15049         else
15050                 dflt='1'
15051                 echo "(I can't seem to compile the test program.  Guessing...)"
15052         fi
15053         ;;
15054 *)
15055         dflt="$charsize"
15056         ;;
15057 esac
15058 rp="What is the size of a character (in bytes)?"
15059 . ./myread
15060 charsize="$ans"
15061 $rm_try
15062
15063 : check for volatile keyword
15064 echo " "
15065 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15066 $cat >try.c <<'EOCP'
15067 int main()
15068 {
15069         typedef struct _goo_struct goo_struct;
15070         goo_struct * volatile goo = ((goo_struct *)0);
15071         struct _goo_struct {
15072                 long long_int;
15073                 int reg_int;
15074                 char char_var;
15075         };
15076         typedef unsigned short foo_t;
15077         char *volatile foo;
15078         volatile int bar;
15079         volatile foo_t blech;
15080         foo = foo;
15081 }
15082 EOCP
15083 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15084         val="$define"
15085         echo "Yup, it does."
15086 else
15087         val="$undef"
15088         echo "Nope, it doesn't."
15089 fi
15090 set d_volatile
15091 eval $setvar
15092 $rm_try
15093
15094
15095 echo " "
15096 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15097
15098 case "$use64bitint:$d_quad:$quadtype" in
15099 define:define:?*)
15100         ivtype="$quadtype"
15101         uvtype="$uquadtype"
15102         ivsize=8
15103         uvsize=8
15104         ;;
15105 *)      ivtype="long"
15106         uvtype="unsigned long"
15107         ivsize=$longsize
15108         uvsize=$longsize
15109         ;;
15110 esac
15111
15112 case "$uselongdouble:$d_longdbl" in
15113 define:define)
15114         nvtype="long double"
15115         nvsize=$longdblsize
15116         ;;
15117 *)      nvtype=double
15118         nvsize=$doublesize
15119         ;;
15120 esac
15121
15122 $echo "(IV will be "$ivtype", $ivsize bytes)"
15123 $echo "(UV will be "$uvtype", $uvsize bytes)"
15124 $echo "(NV will be "$nvtype", $nvsize bytes)"
15125
15126 $cat >try.c <<EOCP
15127 #$i_inttypes I_INTTYPES
15128 #ifdef I_INTTYPES
15129 #include <inttypes.h>
15130 #endif
15131 #include <stdio.h>
15132 int main() {
15133 #ifdef INT8
15134    int8_t i =  INT8_MAX;
15135   uint8_t u = UINT8_MAX;
15136   printf("int8_t\n");
15137 #endif
15138 #ifdef INT16
15139    int16_t i =  INT16_MAX;
15140   uint16_t i = UINT16_MAX;
15141   printf("int16_t\n");
15142 #endif
15143 #ifdef INT32
15144    int32_t i =  INT32_MAX;
15145   uint32_t u = UINT32_MAX;
15146   printf("int32_t\n");
15147 #endif
15148 }
15149 EOCP
15150
15151 case "$i8type" in
15152 '')     case "$charsize" in
15153         1)      i8type=char
15154                 u8type="unsigned char"
15155                 i8size=$charsize
15156                 u8size=$charsize
15157                 ;;
15158         esac
15159         ;;
15160 esac
15161 case "$i8type" in
15162 '')     set try -DINT8
15163         if eval $compile; then
15164                 case "`$run ./try`" in
15165                 int8_t) i8type=int8_t
15166                         u8type=uint8_t
15167                         i8size=1
15168                         u8size=1
15169                         ;;
15170                 esac
15171         fi
15172         ;;
15173 esac
15174 case "$i8type" in
15175 '')     if $test $charsize -ge 1; then
15176                 i8type=char
15177                 u8type="unsigned char"
15178                 i8size=$charsize
15179                 u8size=$charsize
15180         fi
15181         ;;
15182 esac
15183
15184 case "$i16type" in
15185 '')     case "$shortsize" in
15186         2)      i16type=short
15187                 u16type="unsigned short"
15188                 i16size=$shortsize
15189                 u16size=$shortsize
15190                 ;;
15191         esac
15192         ;;
15193 esac
15194 case "$i16type" in
15195 '')     set try -DINT16
15196         if eval $compile; then
15197                 case "`$run ./try`" in
15198                 int16_t)
15199                         i16type=int16_t
15200                         u16type=uint16_t
15201                         i16size=2
15202                         u16size=2
15203                         ;;
15204                 esac
15205         fi
15206         ;;
15207 esac
15208 case "$i16type" in
15209 '')     if $test $shortsize -ge 2; then
15210                 i16type=short
15211                 u16type="unsigned short"
15212                 i16size=$shortsize
15213                 u16size=$shortsize
15214         fi
15215         ;;
15216 esac
15217
15218 case "$i32type" in
15219 '')     case "$longsize" in
15220         4)      i32type=long
15221                 u32type="unsigned long"
15222                 i32size=$longsize
15223                 u32size=$longsize
15224                 ;;
15225         *)      case "$intsize" in
15226                 4)      i32type=int
15227                         u32type="unsigned int"
15228                         i32size=$intsize
15229                         u32size=$intsize
15230                         ;;
15231                 esac
15232                 ;;
15233         esac
15234         ;;
15235 esac
15236 case "$i32type" in
15237 '')     set try -DINT32
15238         if eval $compile; then
15239                 case "`$run ./try`" in
15240                 int32_t)
15241                         i32type=int32_t
15242                         u32type=uint32_t
15243                         i32size=4
15244                         u32size=4
15245                         ;;
15246                 esac
15247         fi
15248         ;;
15249 esac
15250 case "$i32type" in
15251 '')     if $test $intsize -ge 4; then
15252                 i32type=int
15253                 u32type="unsigned int"
15254                 i32size=$intsize
15255                 u32size=$intsize
15256         fi
15257         ;;
15258 esac
15259
15260 case "$i64type" in
15261 '')     case "$d_quad:$quadtype" in
15262         define:?*)
15263                 i64type="$quadtype"
15264                 u64type="$uquadtype"
15265                 i64size=8
15266                 u64size=8
15267                 ;;
15268         esac
15269         ;;
15270 esac
15271
15272 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15273 : volatile so that the compiler has to store it out to memory.
15274 if test X"$d_volatile" = X"$define"; then
15275         volatile=volatile
15276 fi
15277 $cat <<EOP >try.c
15278 #include <stdio.h>
15279 #$i_stdlib I_STDLIB
15280 #ifdef I_STDLIB
15281 #include <stdlib.h>
15282 #endif
15283 #include <sys/types.h>
15284 #include <signal.h>
15285 #ifdef SIGFPE
15286 $volatile int bletched = 0;
15287 $signal_t blech(int s) { bletched = 1; }
15288 #endif
15289 int main() {
15290     $uvtype u = 0;
15291     $nvtype d;
15292     int     n = 8 * $uvsize;
15293     int     i;
15294 #ifdef SIGFPE
15295     signal(SIGFPE, blech);
15296 #endif
15297
15298     for (i = 0; i < n; i++) {
15299       u = u << 1 | ($uvtype)1;
15300       d = ($nvtype)u;
15301       if (($uvtype)d != u)
15302         break;
15303       if (d <= 0)
15304         break;
15305       d = ($nvtype)(u - 1);
15306       if (($uvtype)d != (u - 1))
15307         break;
15308 #ifdef SIGFPE
15309       if (bletched)
15310         break;
15311 #endif
15312     }
15313     printf("%d\n", ((i == n) ? -n : i));
15314     exit(0);
15315 }
15316 EOP
15317 set try
15318
15319 d_nv_preserves_uv="$undef"
15320 if eval $compile; then
15321         nv_preserves_uv_bits="`$run ./try`"
15322 fi
15323 case "$nv_preserves_uv_bits" in
15324 \-[1-9]*)
15325         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15326         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15327         d_nv_preserves_uv="$define"
15328         ;;
15329 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15330         d_nv_preserves_uv="$undef" ;;
15331 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15332         nv_preserves_uv_bits="0" ;;
15333 esac
15334 $rm_try
15335
15336 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15337 : volatile so that the compiler has to store it out to memory.
15338 if test X"$d_volatile" = X"$define"; then
15339         volatile=volatile
15340 fi
15341 $cat <<EOP >try.c
15342 #include <stdio.h>
15343 #$i_stdlib I_STDLIB
15344 #ifdef I_STDLIB
15345 #include <stdlib.h>
15346 #endif
15347 #$i_string I_STRING
15348 #ifdef I_STRING
15349 #  include <string.h>
15350 #else
15351 #  include <strings.h>
15352 #endif
15353 #include <sys/types.h>
15354 #include <signal.h>
15355 #ifdef SIGFPE
15356 $volatile int bletched = 0;
15357 $signal_t blech(int s) { bletched = 1; }
15358 #endif
15359
15360 int checkit($nvtype d, char *where) {
15361     unsigned char *p = (char *)&d;
15362     unsigned char *end = p + sizeof(d);
15363     int fail = 0;
15364
15365     while (p < end)
15366         fail += *p++;
15367
15368     if (!fail)
15369         return 0;
15370
15371     p = (char *)&d;
15372     printf("No - %s: 0x", where);
15373     while (p < end)
15374         printf ("%02X", *p++);
15375     printf("\n");
15376     return 1;
15377 }
15378
15379 int main(int argc, char **argv) {
15380     $nvtype d = 0.0;
15381     int fail = 0;
15382     fail += checkit(d, "0.0");
15383
15384     /* The compiler shouldn't be assuming that bletched is 0  */
15385     d = bletched;
15386
15387     fail += checkit(d, "bleched");
15388
15389 #ifdef SIGFPE
15390     signal(SIGFPE, blech);
15391 #endif
15392
15393     /* Paranoia - the compiler should have no way of knowing that ANSI says
15394        that argv[argc] will always be NULL.  Actually, if it did assume this it
15395        would be buggy, as this is C and main() can be called from elsewhere in
15396        the program.  */
15397     d = argv[argc] ? 1 : 0;
15398
15399     if (d) {
15400         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15401     }
15402
15403     fail += checkit(d, "ternary");
15404
15405     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15406
15407     if (d != 0.0) {
15408         printf("No - memset doesn't give 0.0\n");
15409         /* This might just blow up:  */
15410         printf("(gives %g)\n", d);
15411         return 1;
15412     }
15413
15414 #ifdef SIGFPE
15415     if (bletched) {
15416         printf("No - something bleched\n");
15417         return 1;
15418     }
15419 #endif
15420     if (fail) {
15421       printf("No - %d fail(s)\n", fail);
15422       return 1;
15423     }
15424     printf("Yes\n");
15425     return 0;
15426 }
15427 EOP
15428 set try
15429
15430 d_nv_zero_is_allbits_zero="$undef"
15431 if eval $compile; then
15432     xxx="`$run ./try`"
15433     case "$?" in
15434         0)
15435             case "$xxx" in
15436                 Yes)  cat >&4 <<EOM
15437 0.0 is represented as all bits zero in memory
15438 EOM
15439                     d_nv_zero_is_allbits_zero="$define"
15440                     ;;
15441                 *)  cat >&4 <<EOM
15442 0.0 is not represented as all bits zero in memory
15443 EOM
15444                     d_nv_zero_is_allbits_zero="$undef"
15445                     ;;
15446             esac
15447             ;;
15448         *)  cat >&4 <<EOM
15449 0.0 is not represented as all bits zero in memory
15450 EOM
15451             d_nv_zero_is_allbits_zero="$undef"
15452             ;;
15453     esac
15454 fi
15455 $rm_try
15456
15457 : check for off64_t
15458 echo " "
15459 echo "Checking to see if you have off64_t..." >&4
15460 $cat >try.c <<EOCP
15461 #include <sys/types.h>
15462 #include <unistd.h>
15463 int main() { off64_t x = 7; }
15464 EOCP
15465 set try
15466 if eval $compile; then
15467         val="$define"
15468         echo "You have off64_t."
15469 else
15470         val="$undef"
15471         echo "You do not have off64_t."
15472         case "$lseeksize" in
15473         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15474         esac
15475 fi
15476 $rm_try
15477 set d_off64_t
15478 eval $setvar
15479
15480 : how to create joinable pthreads
15481 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15482         echo " "
15483         echo "Checking what constant to use for creating joinable pthreads..." >&4
15484         $cat >try.c <<'EOCP'
15485 #include <pthread.h>
15486 int main() {
15487     int detachstate = JOINABLE;
15488 }
15489 EOCP
15490         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15491         if eval $compile; then
15492                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15493                 val="$undef" # Yes, undef.
15494                 set d_old_pthread_create_joinable
15495                 eval $setvar
15496                 val=""
15497                 set old_pthread_create_joinable
15498                 eval $setvar
15499         else
15500                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15501                 if eval $compile; then
15502                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15503                         val="$define"
15504                         set d_old_pthread_create_joinable
15505                         eval $setvar
15506                         val=PTHREAD_CREATE_UNDETACHED
15507                         set old_pthread_create_joinable
15508                         eval $setvar
15509                 else
15510                         set try -DJOINABLE=__UNDETACHED
15511                         if eval $compile; then
15512                                 echo "You seem to use __UNDETACHED." >&4
15513                                 val="$define"
15514                                 set d_old_pthread_create_joinable
15515                                 eval $setvar
15516                                 val=__UNDETACHED
15517                                 set old_pthread_create_joinable
15518                                 eval $setvar
15519                         else
15520                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15521                                 val="$define"
15522                                 set d_old_pthread_create_joinable
15523                                 eval $setvar
15524                                 val=0
15525                                 set old_pthread_create_joinable
15526                                 eval $setvar
15527                         fi
15528                 fi
15529         fi
15530         $rm_try
15531 else
15532     d_old_pthread_create_joinable="$undef"
15533     old_pthread_create_joinable=""
15534 fi
15535
15536 : see if pause exists
15537 set pause d_pause
15538 eval $inlibc
15539
15540 : see if pipe exists
15541 set pipe d_pipe
15542 eval $inlibc
15543
15544 : see if poll exists
15545 set poll d_poll
15546 eval $inlibc
15547
15548 : see if readlink exists
15549 set readlink d_readlink
15550 eval $inlibc
15551
15552 echo " "
15553 procselfexe=''
15554 val="$undef"
15555 case "$d_readlink" in
15556 "$define")
15557         if $issymlink /proc/self/exe ; then
15558                 $ls -l /proc/self/exe > reflect
15559                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15560                         echo "You have Linux-like /proc/self/exe."
15561                         procselfexe='"/proc/self/exe"'
15562                         val="$define"
15563                 fi
15564         fi
15565         if $issymlink /proc/curproc/file ; then
15566                 $ls -l /proc/curproc/file > reflect
15567                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15568                         echo "You have BSD-like /proc/curproc/file."
15569                         procselfexe='"/proc/curproc/file"'
15570                         val="$define"
15571                 fi
15572         fi
15573         ;;
15574 esac
15575 $rm -f reflect
15576 set d_procselfexe
15577 eval $setvar
15578
15579 : backward compatibility for d_hvfork
15580 if test X$d_hvfork != X; then
15581         d_vfork="$d_hvfork"
15582         d_hvfork=''
15583 fi
15584 : see if there is a vfork
15585 val=''
15586 set vfork val
15587 eval $inlibc
15588
15589 d_pseudofork=$undef
15590
15591 : Ok, but do we want to use it. vfork is reportedly unreliable in
15592 : perl on Solaris 2.x, and probably elsewhere.
15593 case "$val" in
15594 $define)
15595         echo " "
15596         case "$usevfork" in
15597         false) dflt='n';;
15598         *) dflt='y';;
15599         esac
15600         cat <<'EOM'
15601
15602 Perl can only use a vfork() that doesn't suffer from strict
15603 restrictions on calling functions or modifying global data in
15604 the child.  For example, glibc-2.1 contains such a vfork()
15605 that is unsuitable.  If your system provides a proper fork()
15606 call, chances are that you do NOT want perl to use vfork().
15607
15608 EOM
15609         rp="Do you still want to use vfork()?"
15610         . ./myread
15611         case "$ans" in
15612         y|Y) ;;
15613         *)
15614                 echo "Ok, we won't use vfork()."
15615                 val="$undef"
15616                 ;;
15617         esac
15618         ;;
15619 esac
15620 set d_vfork
15621 eval $setvar
15622 case "$d_vfork" in
15623 $define) usevfork='true';;
15624 *) usevfork='false';;
15625 esac
15626
15627 : see whether the pthread_atfork exists
15628 $cat >try.c <<EOP
15629 #include <pthread.h>
15630 #include <stdio.h>
15631 int main() {
15632 #ifdef  PTHREAD_ATFORK
15633         pthread_atfork(NULL,NULL,NULL);
15634 #endif
15635 }
15636 EOP
15637
15638 : see if pthread_atfork exists
15639 set try -DPTHREAD_ATFORK
15640 if eval $compile; then
15641     val="$define"
15642 else
15643     val="$undef"
15644 fi
15645 case "$usethreads" in
15646 $define)
15647         case "$val" in
15648         $define) echo 'pthread_atfork found.' >&4        ;;
15649         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15650         esac
15651 esac
15652 set d_pthread_atfork
15653 eval $setvar
15654
15655 : see if pthread_attr_setscope exists
15656 set pthread_attr_setscope d_pthread_attr_setscope
15657 eval $inlibc
15658
15659
15660 : see whether the various POSIXish _yields exist
15661 $cat >try.c <<EOP
15662 #include <pthread.h>
15663 #include <stdio.h>
15664 int main() {
15665 #ifdef SCHED_YIELD
15666         sched_yield();
15667 #else
15668 #ifdef PTHREAD_YIELD
15669         pthread_yield();
15670 #else
15671 #ifdef PTHREAD_YIELD_NULL
15672         pthread_yield(NULL);
15673 #endif
15674 #endif
15675 #endif
15676 }
15677 EOP
15678 : see if sched_yield exists
15679 set try -DSCHED_YIELD
15680 if eval $compile; then
15681     val="$define"
15682     sched_yield='sched_yield()'
15683 else
15684     val="$undef"
15685 fi
15686 case "$usethreads" in
15687 $define)
15688         case "$val" in
15689         $define) echo 'sched_yield() found.' >&4        ;;
15690         *)       echo 'sched_yield() NOT found.' >&4    ;;
15691         esac
15692 esac
15693 set d_sched_yield
15694 eval $setvar
15695
15696 : see if pthread_yield exists
15697 set try -DPTHREAD_YIELD
15698 if eval $compile; then
15699     val="$define"
15700     case "$sched_yield" in
15701     '') sched_yield='pthread_yield()' ;;
15702     esac
15703 else
15704     set try -DPTHREAD_YIELD_NULL
15705     if eval $compile; then
15706         val="$define"
15707         case "$sched_yield" in
15708         '') sched_yield='pthread_yield(NULL)' ;;
15709         esac
15710     else
15711         val="$undef"
15712     fi
15713 fi
15714 case "$usethreads" in
15715 $define)
15716         case "$val" in
15717         $define) echo 'pthread_yield() found.' >&4      ;;
15718         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15719         esac
15720         ;;
15721 esac
15722 set d_pthread_yield
15723 eval $setvar
15724 case "$sched_yield" in
15725 '') sched_yield=undef ;;
15726 esac
15727 $rm_try
15728
15729 : see if random_r exists
15730 set random_r d_random_r
15731 eval $inlibc
15732 case "$d_random_r" in
15733 "$define")
15734         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15735         case "$d_random_r_proto:$usethreads" in
15736         ":define")      d_random_r_proto=define
15737                 set d_random_r_proto random_r $hdrs
15738                 eval $hasproto ;;
15739         *)      ;;
15740         esac
15741         case "$d_random_r_proto" in
15742         define)
15743         case "$random_r_proto" in
15744         ''|0) try='int random_r(int*, struct random_data*);'
15745         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15746         esac
15747         case "$random_r_proto" in
15748         ''|0) try='int random_r(long*, struct random_data*);'
15749         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15750         esac
15751         case "$random_r_proto" in
15752         ''|0) try='int random_r(struct random_data*, int32_t*);'
15753         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15754         esac
15755         case "$random_r_proto" in
15756         ''|0)   d_random_r=undef
15757                 random_r_proto=0
15758                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15759         * )     case "$random_r_proto" in
15760                 REENTRANT_PROTO*) ;;
15761                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15762                 esac
15763                 echo "Prototype: $try" ;;
15764         esac
15765         ;;
15766         *)      case "$usethreads" in
15767                 define) echo "random_r has no prototype, not using it." >&4 ;;
15768                 esac
15769                 d_random_r=undef
15770                 random_r_proto=0
15771                 ;;
15772         esac
15773         ;;
15774 *)      random_r_proto=0
15775         ;;
15776 esac
15777
15778 : see if readdir and friends exist
15779 set readdir d_readdir
15780 eval $inlibc
15781 set seekdir d_seekdir
15782 eval $inlibc
15783 set telldir d_telldir
15784 eval $inlibc
15785 set rewinddir d_rewinddir
15786 eval $inlibc
15787
15788 : see if readdir64_r exists
15789 set readdir64_r d_readdir64_r
15790 eval $inlibc
15791 case "$d_readdir64_r" in
15792 "$define")
15793         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15794         case "$d_readdir64_r_proto:$usethreads" in
15795         ":define")      d_readdir64_r_proto=define
15796                 set d_readdir64_r_proto readdir64_r $hdrs
15797                 eval $hasproto ;;
15798         *)      ;;
15799         esac
15800         case "$d_readdir64_r_proto" in
15801         define)
15802         case "$readdir64_r_proto" in
15803         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15804         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15805         esac
15806         case "$readdir64_r_proto" in
15807         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15808         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15809         esac
15810         case "$readdir64_r_proto" in
15811         ''|0)   d_readdir64_r=undef
15812                 readdir64_r_proto=0
15813                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15814         * )     case "$readdir64_r_proto" in
15815                 REENTRANT_PROTO*) ;;
15816                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15817                 esac
15818                 echo "Prototype: $try" ;;
15819         esac
15820         ;;
15821         *)      case "$usethreads" in
15822                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15823                 esac
15824                 d_readdir64_r=undef
15825                 readdir64_r_proto=0
15826                 ;;
15827         esac
15828         ;;
15829 *)      readdir64_r_proto=0
15830         ;;
15831 esac
15832
15833 : see if readdir_r exists
15834 set readdir_r d_readdir_r
15835 eval $inlibc
15836 case "$d_readdir_r" in
15837 "$define")
15838         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15839         case "$d_readdir_r_proto:$usethreads" in
15840         ":define")      d_readdir_r_proto=define
15841                 set d_readdir_r_proto readdir_r $hdrs
15842                 eval $hasproto ;;
15843         *)      ;;
15844         esac
15845         case "$d_readdir_r_proto" in
15846         define)
15847         case "$readdir_r_proto" in
15848         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15849         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15850         esac
15851         case "$readdir_r_proto" in
15852         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15853         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15854         esac
15855         case "$readdir_r_proto" in
15856         ''|0)   d_readdir_r=undef
15857                 readdir_r_proto=0
15858                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15859         * )     case "$readdir_r_proto" in
15860                 REENTRANT_PROTO*) ;;
15861                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15862                 esac
15863                 echo "Prototype: $try" ;;
15864         esac
15865         ;;
15866         *)      case "$usethreads" in
15867                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15868                 esac
15869                 d_readdir_r=undef
15870                 readdir_r_proto=0
15871                 ;;
15872         esac
15873         ;;
15874 *)      readdir_r_proto=0
15875         ;;
15876 esac
15877
15878 : see if readv exists
15879 set readv d_readv
15880 eval $inlibc
15881
15882 : see if recvmsg exists
15883 set recvmsg d_recvmsg
15884 eval $inlibc
15885
15886 : see if rename exists
15887 set rename d_rename
15888 eval $inlibc
15889
15890 : see if rmdir exists
15891 set rmdir d_rmdir
15892 eval $inlibc
15893
15894 : see if memory.h is available.
15895 val=''
15896 set memory.h val
15897 eval $inhdr
15898
15899 : See if it conflicts with string.h
15900 case "$val" in
15901 $define)
15902         case "$strings" in
15903         '') ;;
15904         *)
15905                 $cppstdin $cppflags $cppminus < $strings > mem.h
15906                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15907                         echo " "
15908                         echo "We won't be including <memory.h>."
15909                         val="$undef"
15910                 fi
15911                 $rm -f mem.h
15912                 ;;
15913         esac
15914 esac
15915 set i_memory
15916 eval $setvar
15917
15918 : can bcopy handle overlapping blocks?
15919 echo " "
15920 val="$undef"
15921 case "$d_memmove" in
15922 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15923 *)      case "$d_bcopy" in
15924         "$define")
15925                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15926                 $cat >try.c <<EOCP
15927 #$i_memory I_MEMORY
15928 #$i_stdlib I_STDLIB
15929 #$i_string I_STRING
15930 #$i_unistd I_UNISTD
15931 EOCP
15932         $cat >>try.c <<'EOCP'
15933 #include <stdio.h>
15934 #ifdef I_MEMORY
15935 #  include <memory.h>
15936 #endif
15937 #ifdef I_STDLIB
15938 #  include <stdlib.h>
15939 #endif
15940 #ifdef I_STRING
15941 #  include <string.h>
15942 #else
15943 #  include <strings.h>
15944 #endif
15945 #ifdef I_UNISTD
15946 #  include <unistd.h>  /* Needed for NetBSD */
15947 #endif
15948 int main()
15949 {
15950 char buf[128], abc[128];
15951 char *b;
15952 int len;
15953 int off;
15954 int align;
15955
15956 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15957    try to store the string in read-only memory. */
15958 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15959
15960 for (align = 7; align >= 0; align--) {
15961         for (len = 36; len; len--) {
15962                 b = buf+align;
15963                 bcopy(abc, b, len);
15964                 for (off = 1; off <= len; off++) {
15965                         bcopy(b, b+off, len);
15966                         bcopy(b+off, b, len);
15967                         if (bcmp(b, abc, len))
15968                                 exit(1);
15969                 }
15970         }
15971 }
15972 exit(0);
15973 }
15974 EOCP
15975                 set try
15976                 if eval $compile_ok; then
15977                         if $run ./try 2>/dev/null; then
15978                                 echo "Yes, it can."
15979                                 val="$define"
15980                         else
15981                                 echo "It can't, sorry."
15982                         fi
15983                 else
15984                         echo "(I can't compile the test program, so we'll assume not...)"
15985                 fi
15986                 ;;
15987         esac
15988         $rm_try
15989         ;;
15990 esac
15991 set d_safebcpy
15992 eval $setvar
15993
15994 : can memcpy handle overlapping blocks?
15995 echo " "
15996 val="$undef"
15997 case "$d_memmove" in
15998 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15999 *)      case "$d_memcpy" in
16000         "$define")
16001                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16002                 $cat >try.c <<EOCP
16003 #$i_memory I_MEMORY
16004 #$i_stdlib I_STDLIB
16005 #$i_string I_STRING
16006 #$i_unistd I_UNISTD
16007 EOCP
16008         $cat >>try.c <<'EOCP'
16009 #include <stdio.h>
16010 #ifdef I_MEMORY
16011 #  include <memory.h>
16012 #endif
16013 #ifdef I_STDLIB
16014 #  include <stdlib.h>
16015 #endif
16016 #ifdef I_STRING
16017 #  include <string.h>
16018 #else
16019 #  include <strings.h>
16020 #endif
16021 #ifdef I_UNISTD
16022 #  include <unistd.h>  /* Needed for NetBSD */
16023 #endif
16024 int main()
16025 {
16026 char buf[128], abc[128];
16027 char *b;
16028 int len;
16029 int off;
16030 int align;
16031
16032 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16033    try to store the string in read-only memory. */
16034 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16035
16036 for (align = 7; align >= 0; align--) {
16037         for (len = 36; len; len--) {
16038                 b = buf+align;
16039                 memcpy(b, abc, len);
16040                 for (off = 1; off <= len; off++) {
16041                         memcpy(b+off, b, len);
16042                         memcpy(b, b+off, len);
16043                         if (memcmp(b, abc, len))
16044                                 exit(1);
16045                 }
16046         }
16047 }
16048 exit(0);
16049 }
16050 EOCP
16051                 set try
16052                 if eval $compile_ok; then
16053                         if $run ./try 2>/dev/null; then
16054                                 echo "Yes, it can."
16055                                 val="$define"
16056                         else
16057                                 echo "It can't, sorry."
16058                         fi
16059                 else
16060                         echo "(I can't compile the test program, so we'll assume not...)"
16061                 fi
16062                 ;;
16063         esac
16064         $rm_try
16065         ;;
16066 esac
16067 set d_safemcpy
16068 eval $setvar
16069
16070 : can memcmp be trusted to compare relative magnitude?
16071 val="$undef"
16072 case "$d_memcmp" in
16073 "$define")
16074         echo " "
16075         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16076         $cat >try.c <<EOCP
16077 #$i_memory I_MEMORY
16078 #$i_stdlib I_STDLIB
16079 #$i_string I_STRING
16080 #$i_unistd I_UNISTD
16081 EOCP
16082         $cat >>try.c <<'EOCP'
16083 #include <stdio.h>
16084 #ifdef I_MEMORY
16085 #  include <memory.h>
16086 #endif
16087 #ifdef I_STDLIB
16088 #  include <stdlib.h>
16089 #endif
16090 #ifdef I_STRING
16091 #  include <string.h>
16092 #else
16093 #  include <strings.h>
16094 #endif
16095 #ifdef I_UNISTD
16096 #  include <unistd.h>  /* Needed for NetBSD */
16097 #endif
16098 int main()
16099 {
16100 char a = -1;
16101 char b = 0;
16102 if ((a < b) && memcmp(&a, &b, 1) < 0)
16103         exit(1);
16104 exit(0);
16105 }
16106 EOCP
16107         set try
16108         if eval $compile_ok; then
16109                 if $run ./try 2>/dev/null; then
16110                         echo "Yes, it can."
16111                         val="$define"
16112                 else
16113                         echo "No, it can't (it uses signed chars)."
16114                 fi
16115         else
16116                 echo "(I can't compile the test program, so we'll assume not...)"
16117         fi
16118         ;;
16119 esac
16120 $rm_try
16121 set d_sanemcmp
16122 eval $setvar
16123
16124 : see if prototype for sbrk is available
16125 echo " "
16126 set d_sbrkproto sbrk $i_unistd unistd.h
16127 eval $hasproto
16128
16129 : see if select exists
16130 set select d_select
16131 eval $inlibc
16132
16133 : see if semctl exists
16134 set semctl d_semctl
16135 eval $inlibc
16136
16137 : see if semget exists
16138 set semget d_semget
16139 eval $inlibc
16140
16141 : see if semop exists
16142 set semop d_semop
16143 eval $inlibc
16144
16145 : see how much of the 'sem*(2)' library is present.
16146 h_sem=true
16147 echo " "
16148 case "$d_semctl$d_semget$d_semop" in
16149 *"$undef"*) h_sem=false;;
16150 esac
16151 case "$osname" in
16152 freebsd)
16153     case "`ipcs 2>&1`" in
16154     "SVID messages"*"not configured"*)
16155         echo "Your $osname does not have the sem*(2) configured." >&4
16156         h_sem=false
16157         val="$undef"
16158         set semctl d_semctl
16159         eval $setvar
16160         set semget d_semget
16161         eval $setvar
16162         set semop d_semop
16163         eval $setvar
16164         ;;
16165     esac
16166     ;;
16167 esac
16168 : we could also check for sys/ipc.h ...
16169 if $h_sem && $test `./findhdr sys/sem.h`; then
16170         echo "You have the full sem*(2) library." >&4
16171         val="$define"
16172 else
16173         echo "You don't have the full sem*(2) library." >&4
16174         val="$undef"
16175 fi
16176 set d_sem
16177 eval $setvar
16178
16179 : see whether sys/sem.h defines union semun
16180 echo " "
16181 $cat > try.c <<'END'
16182 #include <sys/types.h>
16183 #include <sys/ipc.h>
16184 #include <sys/sem.h>
16185 int main () { union semun semun; semun.buf = 0; }
16186 END
16187 set try
16188 if eval $compile; then
16189     echo "You have union semun in <sys/sem.h>." >&4
16190     val="$define"
16191 else
16192     echo "You do not have union semun in <sys/sem.h>." >&4
16193     val="$undef"
16194 fi
16195 $rm_try
16196 set d_union_semun
16197 eval $setvar
16198
16199 : see how to do semctl IPC_STAT
16200 case "$d_sem" in
16201 $define)
16202     echo " "
16203     $cat > tryh.h <<END
16204 #ifndef S_IRUSR
16205 #   ifdef S_IREAD
16206 #       define S_IRUSR S_IREAD
16207 #       define S_IWUSR S_IWRITE
16208 #       define S_IXUSR S_IEXEC
16209 #   else
16210 #       define S_IRUSR 0400
16211 #       define S_IWUSR 0200
16212 #       define S_IXUSR 0100
16213 #   endif
16214 #   define S_IRGRP (S_IRUSR>>3)
16215 #   define S_IWGRP (S_IWUSR>>3)
16216 #   define S_IXGRP (S_IXUSR>>3)
16217 #   define S_IROTH (S_IRUSR>>6)
16218 #   define S_IWOTH (S_IWUSR>>6)
16219 #   define S_IXOTH (S_IXUSR>>6)
16220 #endif
16221 #ifndef S_IRWXU
16222 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16223 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16224 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16225 #endif
16226 END
16227     : see whether semctl IPC_STAT can use union semun
16228     case "$d_semctl_semun" in
16229     '')
16230       val="$undef"
16231       $cat > try.c <<END
16232 #include <sys/types.h>
16233 #include <sys/ipc.h>
16234 #include <sys/sem.h>
16235 #include <sys/stat.h>
16236 #include <stdio.h>
16237 #include <errno.h>
16238 #include "tryh.h"
16239 #ifndef errno
16240 extern int errno;
16241 #endif
16242 #$d_union_semun HAS_UNION_SEMUN
16243 int main() {
16244     union semun
16245 #ifndef HAS_UNION_SEMUN
16246     {
16247         int val;
16248         struct semid_ds *buf;
16249         unsigned short *array;
16250     }
16251 #endif
16252     arg;
16253     int sem, st;
16254
16255 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16256     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16257     if (sem > -1) {
16258         struct semid_ds argbuf;
16259         arg.buf = &argbuf;
16260 #       ifdef IPC_STAT
16261         st = semctl(sem, 0, IPC_STAT, arg);
16262         if (st == 0)
16263             printf("semun\n");
16264         else
16265 #       endif /* IPC_STAT */
16266             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16267 #       ifdef IPC_RMID
16268         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16269 #       endif /* IPC_RMID */
16270             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16271     } else
16272 #endif /* IPC_PRIVATE && ... */
16273         printf("semget failed: errno = %d\n", errno);
16274   return 0;
16275 }
16276 END
16277       set try
16278       if eval $compile; then
16279           xxx=`$run ./try`
16280           case "$xxx" in
16281           semun) val="$define" ;;
16282           esac
16283       fi
16284       $rm_try
16285       set d_semctl_semun
16286       eval $setvar
16287       ;;
16288     esac
16289     case "$d_semctl_semun" in
16290     $define)
16291         echo "You can use union semun for semctl IPC_STAT." >&4
16292         also='also'
16293         ;;
16294     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16295         also=''
16296         ;;
16297     esac
16298
16299     : see whether semctl IPC_STAT can use struct semid_ds pointer
16300     case "$d_semctl_semid_ds" in
16301     '')
16302       val="$undef"
16303       $cat > try.c <<'END'
16304 #include <sys/types.h>
16305 #include <sys/ipc.h>
16306 #include <sys/sem.h>
16307 #include <sys/stat.h>
16308 #include "tryh.h"
16309 #include <stdio.h>
16310 #include <errno.h>
16311 #ifndef errno
16312 extern int errno;
16313 #endif
16314 int main() {
16315     struct semid_ds arg;
16316     int sem, st;
16317
16318 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16319     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16320     if (sem > -1) {
16321 #       ifdef IPC_STAT
16322         st = semctl(sem, 0, IPC_STAT, &arg);
16323         if (st == 0)
16324             printf("semid_ds\n");
16325         else
16326 #       endif /* IPC_STAT */
16327             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16328 #       ifdef IPC_RMID
16329         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16330 #       endif /* IPC_RMID */
16331             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16332     } else
16333 #endif /* IPC_PRIVATE && ... */
16334         printf("semget failed: errno = %d\n", errno);
16335
16336     return 0;
16337 }
16338 END
16339       set try
16340       if eval $compile; then
16341           xxx=`$run ./try`
16342           case "$xxx" in
16343           semid_ds) val="$define" ;;
16344           esac
16345       fi
16346       $rm_try
16347       set d_semctl_semid_ds
16348       eval $setvar
16349       ;;
16350     esac
16351     case "$d_semctl_semid_ds" in
16352     $define)
16353         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16354         ;;
16355     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16356         ;;
16357     esac
16358     ;;
16359 *)  val="$undef"
16360
16361     # We do not have the full sem*(2) library, so assume we can not
16362     # use either.
16363
16364     set d_semctl_semun
16365     eval $setvar
16366
16367     set d_semctl_semid_ds
16368     eval $setvar
16369     ;;
16370 esac
16371 $rm_try tryh.h
16372
16373 : see if sendmsg exists
16374 set sendmsg d_sendmsg
16375 eval $inlibc
16376
16377 : see if setegid exists
16378 set setegid d_setegid
16379 eval $inlibc
16380
16381 : see if seteuid exists
16382 set seteuid d_seteuid
16383 eval $inlibc
16384
16385 : see if setgrent exists
16386 set setgrent d_setgrent
16387 eval $inlibc
16388
16389 : see if setgrent_r exists
16390 set setgrent_r d_setgrent_r
16391 eval $inlibc
16392 case "$d_setgrent_r" in
16393 "$define")
16394         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16395         case "$d_setgrent_r_proto:$usethreads" in
16396         ":define")      d_setgrent_r_proto=define
16397                 set d_setgrent_r_proto setgrent_r $hdrs
16398                 eval $hasproto ;;
16399         *)      ;;
16400         esac
16401         case "$d_setgrent_r_proto" in
16402         define)
16403         case "$setgrent_r_proto" in
16404         ''|0) try='int setgrent_r(FILE**);'
16405         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16406         esac
16407         case "$setgrent_r_proto" in
16408         ''|0) try='void setgrent_r(FILE**);'
16409         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16410         esac
16411         case "$setgrent_r_proto" in
16412         ''|0)   d_setgrent_r=undef
16413                 setgrent_r_proto=0
16414                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16415         * )     case "$setgrent_r_proto" in
16416                 REENTRANT_PROTO*) ;;
16417                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16418                 esac
16419                 echo "Prototype: $try" ;;
16420         esac
16421         ;;
16422         *)      case "$usethreads" in
16423                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16424                 esac
16425                 d_setgrent_r=undef
16426                 setgrent_r_proto=0
16427                 ;;
16428         esac
16429         ;;
16430 *)      setgrent_r_proto=0
16431         ;;
16432 esac
16433
16434 : see if sethostent exists
16435 set sethostent d_sethent
16436 eval $inlibc
16437
16438 : see if sethostent_r exists
16439 set sethostent_r d_sethostent_r
16440 eval $inlibc
16441 case "$d_sethostent_r" in
16442 "$define")
16443         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16444         case "$d_sethostent_r_proto:$usethreads" in
16445         ":define")      d_sethostent_r_proto=define
16446                 set d_sethostent_r_proto sethostent_r $hdrs
16447                 eval $hasproto ;;
16448         *)      ;;
16449         esac
16450         case "$d_sethostent_r_proto" in
16451         define)
16452         case "$sethostent_r_proto" in
16453         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16454         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16455         esac
16456         case "$sethostent_r_proto" in
16457         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16458         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16459         esac
16460         case "$sethostent_r_proto" in
16461         ''|0)   d_sethostent_r=undef
16462                 sethostent_r_proto=0
16463                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16464         * )     case "$sethostent_r_proto" in
16465                 REENTRANT_PROTO*) ;;
16466                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16467                 esac
16468                 echo "Prototype: $try" ;;
16469         esac
16470         ;;
16471         *)      case "$usethreads" in
16472                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16473                 esac
16474                 d_sethostent_r=undef
16475                 sethostent_r_proto=0
16476                 ;;
16477         esac
16478         ;;
16479 *)      sethostent_r_proto=0
16480         ;;
16481 esac
16482
16483 : see if setitimer exists
16484 set setitimer d_setitimer
16485 eval $inlibc
16486
16487 : see if setlinebuf exists
16488 set setlinebuf d_setlinebuf
16489 eval $inlibc
16490
16491 : see if setlocale exists
16492 set setlocale d_setlocale
16493 eval $inlibc
16494
16495 : see if locale.h is available
16496 set locale.h i_locale
16497 eval $inhdr
16498
16499 : see if setlocale_r exists
16500 set setlocale_r d_setlocale_r
16501 eval $inlibc
16502 case "$d_setlocale_r" in
16503 "$define")
16504         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16505         case "$d_setlocale_r_proto:$usethreads" in
16506         ":define")      d_setlocale_r_proto=define
16507                 set d_setlocale_r_proto setlocale_r $hdrs
16508                 eval $hasproto ;;
16509         *)      ;;
16510         esac
16511         case "$d_setlocale_r_proto" in
16512         define)
16513         case "$setlocale_r_proto" in
16514         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16515         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16516         esac
16517         case "$setlocale_r_proto" in
16518         ''|0)   d_setlocale_r=undef
16519                 setlocale_r_proto=0
16520                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16521         * )     case "$setlocale_r_proto" in
16522                 REENTRANT_PROTO*) ;;
16523                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16524                 esac
16525                 echo "Prototype: $try" ;;
16526         esac
16527         ;;
16528         *)      case "$usethreads" in
16529                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16530                 esac
16531                 d_setlocale_r=undef
16532                 setlocale_r_proto=0
16533                 ;;
16534         esac
16535         ;;
16536 *)      setlocale_r_proto=0
16537         ;;
16538 esac
16539
16540 : see if setnetent exists
16541 set setnetent d_setnent
16542 eval $inlibc
16543
16544 : see if setnetent_r exists
16545 set setnetent_r d_setnetent_r
16546 eval $inlibc
16547 case "$d_setnetent_r" in
16548 "$define")
16549         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16550         case "$d_setnetent_r_proto:$usethreads" in
16551         ":define")      d_setnetent_r_proto=define
16552                 set d_setnetent_r_proto setnetent_r $hdrs
16553                 eval $hasproto ;;
16554         *)      ;;
16555         esac
16556         case "$d_setnetent_r_proto" in
16557         define)
16558         case "$setnetent_r_proto" in
16559         ''|0) try='int setnetent_r(int, struct netent_data*);'
16560         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16561         esac
16562         case "$setnetent_r_proto" in
16563         ''|0) try='void setnetent_r(int, struct netent_data*);'
16564         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16565         esac
16566         case "$setnetent_r_proto" in
16567         ''|0)   d_setnetent_r=undef
16568                 setnetent_r_proto=0
16569                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16570         * )     case "$setnetent_r_proto" in
16571                 REENTRANT_PROTO*) ;;
16572                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16573                 esac
16574                 echo "Prototype: $try" ;;
16575         esac
16576         ;;
16577         *)      case "$usethreads" in
16578                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16579                 esac
16580                 d_setnetent_r=undef
16581                 setnetent_r_proto=0
16582                 ;;
16583         esac
16584         ;;
16585 *)      setnetent_r_proto=0
16586         ;;
16587 esac
16588
16589 : see if setprotoent exists
16590 set setprotoent d_setpent
16591 eval $inlibc
16592
16593 : see if setpgid exists
16594 set setpgid d_setpgid
16595 eval $inlibc
16596
16597 : see if setpgrp2 exists
16598 set setpgrp2 d_setpgrp2
16599 eval $inlibc
16600
16601 : see if setpriority exists
16602 set setpriority d_setprior
16603 eval $inlibc
16604
16605 : see if setproctitle exists
16606 set setproctitle d_setproctitle
16607 eval $inlibc
16608
16609 : see if setprotoent_r exists
16610 set setprotoent_r d_setprotoent_r
16611 eval $inlibc
16612 case "$d_setprotoent_r" in
16613 "$define")
16614         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16615         case "$d_setprotoent_r_proto:$usethreads" in
16616         ":define")      d_setprotoent_r_proto=define
16617                 set d_setprotoent_r_proto setprotoent_r $hdrs
16618                 eval $hasproto ;;
16619         *)      ;;
16620         esac
16621         case "$d_setprotoent_r_proto" in
16622         define)
16623         case "$setprotoent_r_proto" in
16624         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16625         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16626         esac
16627         case "$setprotoent_r_proto" in
16628         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16629         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16630         esac
16631         case "$setprotoent_r_proto" in
16632         ''|0)   d_setprotoent_r=undef
16633                 setprotoent_r_proto=0
16634                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16635         * )     case "$setprotoent_r_proto" in
16636                 REENTRANT_PROTO*) ;;
16637                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16638                 esac
16639                 echo "Prototype: $try" ;;
16640         esac
16641         ;;
16642         *)      case "$usethreads" in
16643                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16644                 esac
16645                 d_setprotoent_r=undef
16646                 setprotoent_r_proto=0
16647                 ;;
16648         esac
16649         ;;
16650 *)      setprotoent_r_proto=0
16651         ;;
16652 esac
16653
16654 : see if setpwent exists
16655 set setpwent d_setpwent
16656 eval $inlibc
16657
16658 : see if setpwent_r exists
16659 set setpwent_r d_setpwent_r
16660 eval $inlibc
16661 case "$d_setpwent_r" in
16662 "$define")
16663         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16664         case "$d_setpwent_r_proto:$usethreads" in
16665         ":define")      d_setpwent_r_proto=define
16666                 set d_setpwent_r_proto setpwent_r $hdrs
16667                 eval $hasproto ;;
16668         *)      ;;
16669         esac
16670         case "$d_setpwent_r_proto" in
16671         define)
16672         case "$setpwent_r_proto" in
16673         ''|0) try='int setpwent_r(FILE**);'
16674         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16675         esac
16676         case "$setpwent_r_proto" in
16677         ''|0) try='void setpwent_r(FILE**);'
16678         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16679         esac
16680         case "$setpwent_r_proto" in
16681         ''|0)   d_setpwent_r=undef
16682                 setpwent_r_proto=0
16683                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16684         * )     case "$setpwent_r_proto" in
16685                 REENTRANT_PROTO*) ;;
16686                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16687                 esac
16688                 echo "Prototype: $try" ;;
16689         esac
16690         ;;
16691         *)      case "$usethreads" in
16692                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16693                 esac
16694                 d_setpwent_r=undef
16695                 setpwent_r_proto=0
16696                 ;;
16697         esac
16698         ;;
16699 *)      setpwent_r_proto=0
16700         ;;
16701 esac
16702
16703 : see if setregid exists
16704 set setregid d_setregid
16705 eval $inlibc
16706 set setresgid d_setresgid
16707 eval $inlibc
16708
16709 : see if setreuid exists
16710 set setreuid d_setreuid
16711 eval $inlibc
16712 set setresuid d_setresuid
16713 eval $inlibc
16714
16715 : see if setrgid exists
16716 set setrgid d_setrgid
16717 eval $inlibc
16718
16719 : see if setruid exists
16720 set setruid d_setruid
16721 eval $inlibc
16722
16723 : see if setservent exists
16724 set setservent d_setsent
16725 eval $inlibc
16726
16727 : see if setservent_r exists
16728 set setservent_r d_setservent_r
16729 eval $inlibc
16730 case "$d_setservent_r" in
16731 "$define")
16732         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16733         case "$d_setservent_r_proto:$usethreads" in
16734         ":define")      d_setservent_r_proto=define
16735                 set d_setservent_r_proto setservent_r $hdrs
16736                 eval $hasproto ;;
16737         *)      ;;
16738         esac
16739         case "$d_setservent_r_proto" in
16740         define)
16741         case "$setservent_r_proto" in
16742         ''|0) try='int setservent_r(int, struct servent_data*);'
16743         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16744         esac
16745         case "$setservent_r_proto" in
16746         ''|0) try='void setservent_r(int, struct servent_data*);'
16747         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16748         esac
16749         case "$setservent_r_proto" in
16750         ''|0)   d_setservent_r=undef
16751                 setservent_r_proto=0
16752                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16753         * )     case "$setservent_r_proto" in
16754                 REENTRANT_PROTO*) ;;
16755                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16756                 esac
16757                 echo "Prototype: $try" ;;
16758         esac
16759         ;;
16760         *)      case "$usethreads" in
16761                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16762                 esac
16763                 d_setservent_r=undef
16764                 setservent_r_proto=0
16765                 ;;
16766         esac
16767         ;;
16768 *)      setservent_r_proto=0
16769         ;;
16770 esac
16771
16772 : see if setsid exists
16773 set setsid d_setsid
16774 eval $inlibc
16775
16776 : see if setvbuf exists
16777 set setvbuf d_setvbuf
16778 eval $inlibc
16779
16780 : see if sfio.h is available
16781 set sfio.h i_sfio
16782 eval $inhdr
16783
16784
16785 : see if sfio library is available
16786 case "$i_sfio" in
16787 $define)
16788         val=''
16789         set sfreserve val
16790         eval $inlibc
16791         ;;
16792 *)
16793         val="$undef"
16794         ;;
16795 esac
16796 : Ok, but do we want to use it.
16797 case "$val" in
16798 $define)
16799         case "$usesfio" in
16800         true|$define|[yY]*) dflt='y';;
16801         *) dflt='n';;
16802         esac
16803         echo "$package can use the sfio library, but it is experimental."
16804         case "$useperlio" in
16805         "$undef")
16806             echo "For sfio also the PerlIO abstraction layer is needed."
16807             echo "Earlier you said you wouldn't want that."
16808             ;;
16809         esac
16810         rp="You seem to have sfio available, do you want to try using it?"
16811         . ./myread
16812         case "$ans" in
16813         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16814                 useperlio="$define"
16815                 val="$define"
16816                 ;;
16817         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16818                 val="$undef"
16819                 ;;
16820         esac
16821         ;;
16822 *)      case "$usesfio" in
16823         true|$define|[yY]*)
16824                 echo "Sorry, cannot find sfio on this machine." >&4
16825                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16826                 val="$undef"
16827                 ;;
16828         esac
16829         ;;
16830 esac
16831 set d_sfio
16832 eval $setvar
16833 case "$d_sfio" in
16834 $define) usesfio='true';;
16835 *) usesfio='false';;
16836 esac
16837 case "$d_sfio" in
16838 $define) ;;
16839 *)      : Remove sfio from list of libraries to use
16840         case "$libs" in
16841         *-lsfio*)
16842                 echo "Removing unneeded -lsfio from library list" >&4
16843                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16844                 shift
16845                 libs="$*"
16846                 echo "libs = $libs" >&4
16847                 ;;
16848         esac
16849 ;;
16850 esac
16851
16852
16853 : see if shmctl exists
16854 set shmctl d_shmctl
16855 eval $inlibc
16856
16857 : see if shmget exists
16858 set shmget d_shmget
16859 eval $inlibc
16860
16861 : see if shmat exists
16862 set shmat d_shmat
16863 eval $inlibc
16864 : see what shmat returns
16865 case "$d_shmat" in
16866 "$define")
16867         $cat >shmat.c <<'END'
16868 #include <sys/shm.h>
16869 void *shmat();
16870 END
16871         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16872                 shmattype='void *'
16873         else
16874                 shmattype='char *'
16875         fi
16876         echo "and it returns ($shmattype)." >&4
16877         : see if a prototype for shmat is available
16878         xxx=`./findhdr sys/shm.h`
16879         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16880         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16881                 val="$define"
16882         else
16883                 val="$undef"
16884         fi
16885         $rm -f shmat.[co]
16886         ;;
16887 *)
16888         val="$undef"
16889         ;;
16890 esac
16891 set d_shmatprototype
16892 eval $setvar
16893
16894 : see if shmdt exists
16895 set shmdt d_shmdt
16896 eval $inlibc
16897
16898 : see how much of the 'shm*(2)' library is present.
16899 h_shm=true
16900 echo " "
16901 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16902 *"$undef"*) h_shm=false;;
16903 esac
16904 case "$osname" in
16905 freebsd)
16906     case "`ipcs 2>&1`" in
16907     "SVID shared memory"*"not configured"*)
16908         echo "Your $osname does not have the shm*(2) configured." >&4
16909         h_shm=false
16910         val="$undef"
16911         set shmctl d_shmctl
16912         evat $setvar
16913         set shmget d_shmget
16914         evat $setvar
16915         set shmat d_shmat
16916         evat $setvar
16917         set shmdt d_shmdt
16918         evat $setvar
16919         ;;
16920     esac
16921     ;;
16922 esac
16923 : we could also check for sys/ipc.h ...
16924 if $h_shm && $test `./findhdr sys/shm.h`; then
16925         echo "You have the full shm*(2) library." >&4
16926         val="$define"
16927 else
16928         echo "You don't have the full shm*(2) library." >&4
16929         val="$undef"
16930 fi
16931 set d_shm
16932 eval $setvar
16933
16934 echo " "
16935 : see if we have sigaction
16936 if set sigaction val -f d_sigaction; eval $csym; $val; then
16937         echo 'sigaction() found.' >&4
16938         $cat > try.c <<EOP
16939 #include <stdio.h>
16940 #include <sys/types.h>
16941 #include <signal.h>
16942 #$i_stdlib I_STDLIB
16943 #ifdef I_STDLIB
16944 #include <stdlib.h>
16945 #endif
16946 int main()
16947 {
16948     struct sigaction act, oact;
16949     act.sa_flags = 0;
16950     oact.sa_handler = 0;
16951     /* so that act and oact are used */
16952     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16953 }
16954 EOP
16955         set try
16956         if eval $compile_ok; then
16957                 val="$define"
16958         else
16959                 echo "But you don't seem to have a useable struct sigaction." >&4
16960                 val="$undef"
16961         fi
16962 else
16963         echo 'sigaction NOT found.' >&4
16964         val="$undef"
16965 fi
16966 set d_sigaction; eval $setvar
16967 $rm_try
16968
16969 : see if this is a sunmath.h system
16970 set sunmath.h i_sunmath
16971 eval $inhdr
16972
16973 : see if signbit exists
16974 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16975 $cat >try.c <<EOCP
16976 #$i_math I_MATH
16977 #$i_sunmath I_SUNMATH
16978 #ifdef I_MATH
16979 #  include <math.h>
16980 #endif
16981 #ifdef I_SUNMATH  /* Solaris special math library */
16982 #  include <sunmath.h>
16983 #endif
16984 #define NV $nvtype
16985 int main(int argc, char **argv)
16986 {
16987     NV x = 0.0;
16988     NV y = -0.0;
16989     if ((signbit(x) == 0) && (signbit(y) != 0))
16990         return 0;
16991     else
16992         return 1;
16993 }
16994 EOCP
16995 val="$undef"
16996 set try
16997 if eval $compile; then
16998     if $run ./try; then
16999         $echo "Yes." >&4
17000         val="$define"
17001     else
17002         $echo "Signbit seems to be available, but doesn't work as I expected."
17003         $echo "I won't use it." >&4
17004         val="$undef"
17005     fi
17006 else
17007     $echo "Nope." >&4
17008     dflt="$undef"
17009 fi
17010 set d_signbit
17011 eval $setvar
17012 $rm_try
17013
17014 : see if sigprocmask exists
17015 set sigprocmask d_sigprocmask
17016 eval $inlibc
17017
17018 : see if sigsetjmp exists
17019 echo " "
17020 case "$d_sigsetjmp" in
17021 '')
17022         $cat >try.c <<EOP
17023 #include <setjmp.h>
17024 #$i_stdlib I_STDLIB
17025 #ifdef I_STDLIB
17026 #include <stdlib.h>
17027 #endif
17028 sigjmp_buf env;
17029 int set = 1;
17030 int main()
17031 {
17032         if (sigsetjmp(env,1))
17033                 exit(set);
17034         set = 0;
17035         siglongjmp(env, 1);
17036         exit(1);
17037 }
17038 EOP
17039         set try
17040         if eval $compile; then
17041                 if $run ./try >/dev/null 2>&1; then
17042                         echo "POSIX sigsetjmp found." >&4
17043                         val="$define"
17044                 else
17045                         $cat >&4 <<EOM
17046 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17047 I'll ignore them.
17048 EOM
17049                         val="$undef"
17050                 fi
17051         else
17052                 echo "sigsetjmp not found." >&4
17053                 val="$undef"
17054         fi
17055         ;;
17056 *) val="$d_sigsetjmp"
17057         case "$d_sigsetjmp" in
17058         $define) echo "POSIX sigsetjmp found." >&4;;
17059         $undef) echo "sigsetjmp not found." >&4;;
17060         esac
17061         ;;
17062 esac
17063 set d_sigsetjmp
17064 eval $setvar
17065 $rm_try
17066
17067 : see if snprintf exists
17068 set snprintf d_snprintf
17069 eval $inlibc
17070
17071 : see if vsnprintf exists
17072 set vsnprintf d_vsnprintf
17073 eval $inlibc
17074
17075 case "$d_snprintf-$d_vsnprintf" in
17076 "$define-$define")
17077     $cat <<EOM
17078 Checking whether your snprintf() and vsnprintf() work okay...
17079 EOM
17080     $cat >try.c <<'EOCP'
17081 /* v?snprintf testing logic courtesy of Russ Allbery.
17082  * According to C99:
17083  * - if the buffer is too short it still must be \0-terminated
17084  * - if the buffer is too short the potentially required length
17085  *   must be returned and not -1
17086  * - if the buffer is NULL the potentially required length
17087  *   must be returned and not -1 or core dump
17088  */
17089 #include <stdio.h>
17090 #include <stdarg.h>
17091
17092 char buf[2];
17093
17094 int test (char *format, ...)
17095 {
17096     va_list args;
17097     int count;
17098
17099     va_start (args, format);
17100     count = vsnprintf (buf, sizeof buf, format, args);
17101     va_end (args);
17102     return count;
17103 }
17104
17105 int main ()
17106 {
17107     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17108              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17109 }
17110 EOCP
17111     set try
17112     if eval $compile; then
17113         `$run ./try`
17114         case "$?" in
17115         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17116         *) cat <<EOM >&4
17117 Your snprintf() and snprintf() don't seem to be working okay.
17118 EOM
17119            d_snprintf="$undef"
17120            d_vsnprintf="$undef"
17121            ;;
17122         esac
17123     else
17124         echo "(I can't seem to compile the test program--assuming they don't)"
17125         d_snprintf="$undef"
17126         d_vsnprintf="$undef"
17127     fi
17128     $rm_try
17129     ;;
17130 esac
17131
17132 : see if sockatmark exists
17133 set sockatmark d_sockatmark
17134 eval $inlibc
17135
17136 : see if prototype for sockatmark is available
17137 echo " "
17138 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17139 eval $hasproto
17140
17141 : see if socks5_init exists
17142 set socks5_init d_socks5_init
17143 eval $inlibc
17144
17145 : see if sprintf returns the length of the string in the buffer as per ANSI
17146 $echo "Checking whether sprintf returns the length of the string..." >&4
17147 $cat <<EOP >try.c
17148 #include <stdio.h>
17149 #$i_stdlib I_STDLIB
17150 #ifdef I_STDLIB
17151 #include <stdlib.h>
17152 #endif
17153 #$i_string I_STRING
17154 #ifdef I_STRING
17155 #  include <string.h>
17156 #else
17157 #  include <strings.h>
17158 #endif
17159 #$i_math I_MATH
17160 #ifdef I_MATH
17161 #include <math.h>
17162 #endif
17163
17164 char buffer[256];
17165
17166 int check (size_t expect, int test) {
17167   size_t got = strlen(buffer);
17168   if (expect == got)
17169     return 0;
17170
17171   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17172        test, buffer);
17173   exit (test);
17174 }
17175
17176 int main(int argc, char **argv) {
17177   int test = 0;
17178
17179   check(sprintf(buffer, ""), ++test);
17180   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17181   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17182
17183   return 0;
17184 }
17185 EOP
17186 set try
17187
17188 d_sprintf_returns_strlen="$undef"
17189 if eval $compile; then
17190     xxx="`$run ./try`"
17191     case "$?" in
17192         0) cat >&4 <<EOM
17193 sprintf returns the length of the string (as ANSI says it should)
17194 EOM
17195         d_sprintf_returns_strlen="$define"
17196         ;;
17197         *) cat >&4 <<EOM
17198 sprintf does not return the length of the string (how old is this system?)
17199 EOM
17200         d_sprintf_returns_strlen="$undef"
17201         ;;
17202     esac
17203 fi
17204 $rm_try
17205
17206 : see if srand48_r exists
17207 set srand48_r d_srand48_r
17208 eval $inlibc
17209 case "$d_srand48_r" in
17210 "$define")
17211         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17212         case "$d_srand48_r_proto:$usethreads" in
17213         ":define")      d_srand48_r_proto=define
17214                 set d_srand48_r_proto srand48_r $hdrs
17215                 eval $hasproto ;;
17216         *)      ;;
17217         esac
17218         case "$d_srand48_r_proto" in
17219         define)
17220         case "$srand48_r_proto" in
17221         ''|0) try='int srand48_r(long, struct drand48_data*);'
17222         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17223         esac
17224         case "$srand48_r_proto" in
17225         ''|0)   d_srand48_r=undef
17226                 srand48_r_proto=0
17227                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17228         * )     case "$srand48_r_proto" in
17229                 REENTRANT_PROTO*) ;;
17230                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17231                 esac
17232                 echo "Prototype: $try" ;;
17233         esac
17234         ;;
17235         *)      case "$usethreads" in
17236                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17237                 esac
17238                 d_srand48_r=undef
17239                 srand48_r_proto=0
17240                 ;;
17241         esac
17242         ;;
17243 *)      srand48_r_proto=0
17244         ;;
17245 esac
17246
17247 : see if srandom_r exists
17248 set srandom_r d_srandom_r
17249 eval $inlibc
17250 case "$d_srandom_r" in
17251 "$define")
17252         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17253         case "$d_srandom_r_proto:$usethreads" in
17254         ":define")      d_srandom_r_proto=define
17255                 set d_srandom_r_proto srandom_r $hdrs
17256                 eval $hasproto ;;
17257         *)      ;;
17258         esac
17259         case "$d_srandom_r_proto" in
17260         define)
17261         case "$srandom_r_proto" in
17262         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17263         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17264         esac
17265         case "$srandom_r_proto" in
17266         ''|0)   d_srandom_r=undef
17267                 srandom_r_proto=0
17268                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17269         * )     case "$srandom_r_proto" in
17270                 REENTRANT_PROTO*) ;;
17271                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17272                 esac
17273                 echo "Prototype: $try" ;;
17274         esac
17275         ;;
17276         *)      case "$usethreads" in
17277                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17278                 esac
17279                 d_srandom_r=undef
17280                 srandom_r_proto=0
17281                 ;;
17282         esac
17283         ;;
17284 *)      srandom_r_proto=0
17285         ;;
17286 esac
17287
17288 : see if prototype for setresgid is available
17289 echo " "
17290 set d_sresgproto setresgid $i_unistd unistd.h
17291 eval $hasproto
17292
17293 : see if prototype for setresuid is available
17294 echo " "
17295 set d_sresuproto setresuid $i_unistd unistd.h
17296 eval $hasproto
17297
17298 : see if sys/stat.h is available
17299 set sys/stat.h i_sysstat
17300 eval $inhdr
17301
17302
17303 : see if stat knows about block sizes
17304 echo " "
17305 echo "Checking to see if your struct stat has st_blocks field..." >&4
17306 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17307 eval $hasfield
17308
17309
17310 : see if this is a sys/vfs.h system
17311 set sys/vfs.h i_sysvfs
17312 eval $inhdr
17313
17314
17315 : see if this is a sys/statfs.h system
17316 set sys/statfs.h i_sysstatfs
17317 eval $inhdr
17318
17319
17320 echo " "
17321 echo "Checking to see if your system supports struct statfs..." >&4
17322 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
17323 eval $hasstruct
17324 case "$d_statfs_s" in
17325 "$define")      echo "Yes, it does."   ;;
17326 *)              echo "No, it doesn't." ;;
17327 esac
17328
17329
17330
17331 : see if struct statfs knows about f_flags
17332 case "$d_statfs_s" in
17333 define) 
17334         echo " "
17335         echo "Checking to see if your struct statfs has f_flags field..." >&4
17336         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
17337         eval $hasfield
17338         ;;
17339 *)      val="$undef"
17340         set d_statfs_f_flags
17341         eval $setvar
17342         ;;
17343 esac
17344 case "$d_statfs_f_flags" in
17345 "$define")      echo "Yes, it does."   ;;
17346 *)              echo "No, it doesn't." ;;
17347 esac
17348
17349 $cat >&4 <<EOM
17350 Checking how to access stdio streams by file descriptor number...
17351 EOM
17352 case "$stdio_stream_array" in
17353 '')     $cat >try.c <<EOCP
17354 #include <stdio.h>
17355 int main() {
17356   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17357     printf("yes\n");
17358 }
17359 EOCP
17360         for s in _iob __iob __sF
17361         do
17362                 set try -DSTDIO_STREAM_ARRAY=$s
17363                 if eval $compile; then
17364                         case "`$run ./try`" in
17365                         yes)    stdio_stream_array=$s; break ;;
17366                         esac
17367                 fi
17368         done
17369         $rm_try
17370 esac
17371 case "$stdio_stream_array" in
17372 '')     $cat >&4 <<EOM
17373 I can't figure out how to access stdio streams by file descriptor number.
17374 EOM
17375         d_stdio_stream_array="$undef"
17376         ;;
17377 *)      $cat >&4 <<EOM
17378 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17379 EOM
17380         d_stdio_stream_array="$define"
17381         ;;
17382 esac
17383
17384 : see if strcoll exists
17385 set strcoll d_strcoll
17386 eval $inlibc
17387
17388 : check for structure copying
17389 echo " "
17390 echo "Checking to see if your C compiler can copy structs..." >&4
17391 $cat >try.c <<'EOCP'
17392 int main()
17393 {
17394         struct blurfl {
17395                 int dyick;
17396         } foo, bar;
17397
17398         foo = bar;
17399 }
17400 EOCP
17401 if $cc -c try.c >/dev/null 2>&1 ; then
17402         val="$define"
17403         echo "Yup, it can."
17404 else
17405         val="$undef"
17406         echo "Nope, it can't."
17407 fi
17408 set d_strctcpy
17409 eval $setvar
17410 $rm_try
17411
17412 : see if strerror and/or sys_errlist[] exist
17413 echo " "
17414 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17415     if set strerror val -f d_strerror; eval $csym; $val; then
17416                 echo 'strerror() found.' >&4
17417                 d_strerror="$define"
17418                 d_strerrm='strerror(e)'
17419                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17420                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17421                         d_syserrlst="$define"
17422                 else
17423                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17424                         d_syserrlst="$undef"
17425                 fi
17426     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17427                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17428                 echo 'strerror() found in string header.' >&4
17429                 d_strerror="$define"
17430                 d_strerrm='strerror(e)'
17431                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17432                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17433                                 d_syserrlst="$define"
17434                 else
17435                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17436                         d_syserrlst="$undef"
17437                 fi
17438     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17439                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17440                 d_strerror="$undef"
17441                 d_syserrlst="$define"
17442                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17443     else
17444                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17445                 d_strerror="$undef"
17446                 d_syserrlst="$undef"
17447                 d_strerrm='"unknown"'
17448     fi
17449 fi
17450
17451 : see if strerror_r exists
17452 set strerror_r d_strerror_r
17453 eval $inlibc
17454 case "$d_strerror_r" in
17455 "$define")
17456         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17457         case "$d_strerror_r_proto:$usethreads" in
17458         ":define")      d_strerror_r_proto=define
17459                 set d_strerror_r_proto strerror_r $hdrs
17460                 eval $hasproto ;;
17461         *)      ;;
17462         esac
17463         case "$d_strerror_r_proto" in
17464         define)
17465         case "$strerror_r_proto" in
17466         ''|0) try='int strerror_r(int, char*, size_t);'
17467         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17468         esac
17469         case "$strerror_r_proto" in
17470         ''|0) try='int strerror_r(int, char*, int);'
17471         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17472         esac
17473         case "$strerror_r_proto" in
17474         ''|0) try='char* strerror_r(int, char*, size_t);'
17475         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17476         esac
17477         case "$strerror_r_proto" in
17478         ''|0)   d_strerror_r=undef
17479                 strerror_r_proto=0
17480                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17481         * )     case "$strerror_r_proto" in
17482                 REENTRANT_PROTO*) ;;
17483                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17484                 esac
17485                 echo "Prototype: $try" ;;
17486         esac
17487         ;;
17488         *)      case "$usethreads" in
17489                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17490                 esac
17491                 d_strerror_r=undef
17492                 strerror_r_proto=0
17493                 ;;
17494         esac
17495         ;;
17496 *)      strerror_r_proto=0
17497         ;;
17498 esac
17499
17500 : see if strftime exists
17501 set strftime d_strftime
17502 eval $inlibc
17503
17504 : see if strlcat exists
17505 set strlcat d_strlcat
17506 eval $inlibc
17507
17508 : see if strlcpy exists
17509 set strlcpy d_strlcpy
17510 eval $inlibc
17511
17512 : see if strtod exists
17513 set strtod d_strtod
17514 eval $inlibc
17515
17516 : see if strtol exists
17517 set strtol d_strtol
17518 eval $inlibc
17519
17520 : see if strtold exists
17521 set strtold d_strtold
17522 eval $inlibc
17523
17524 : see if strtoll exists
17525 set strtoll d_strtoll
17526 eval $inlibc
17527
17528 case "$d_longlong-$d_strtoll" in
17529 "$define-$define")
17530         $cat <<EOM
17531 Checking whether your strtoll() works okay...
17532 EOM
17533         $cat >try.c <<'EOCP'
17534 #include <errno.h>
17535 #ifdef __hpux
17536 #define strtoll __strtoll
17537 #endif
17538 #ifdef __EMX__
17539 #define strtoll _strtoll
17540 #endif
17541 #include <stdio.h>
17542 extern long long int strtoll(char *s, char **, int); 
17543 static int bad = 0;
17544 int check(char *s, long long ell, int een) {
17545         long long gll;
17546         errno = 0;
17547         gll = strtoll(s, 0, 10);
17548         if (!((gll == ell) && (errno == een)))
17549                 bad++;
17550 }
17551 int main() {
17552         check(" 1",                                      1LL, 0);
17553         check(" 0",                                      0LL, 0);
17554         check("-1",                                     -1LL, 0);
17555         check("-9223372036854775808", -9223372036854775808LL, 0);
17556         check("-9223372036854775808", -9223372036854775808LL, 0);
17557         check(" 9223372036854775807",  9223372036854775807LL, 0);
17558         check("-9223372036854775808", -9223372036854775808LL, 0);
17559         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17560         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17561         if (!bad)
17562                 printf("ok\n");
17563 }
17564 EOCP
17565         set try
17566         if eval $compile; then
17567                 yyy=`$run ./try`
17568                 case "$yyy" in
17569                 ok) echo "Your strtoll() seems to be working okay." ;;
17570                 *) cat <<EOM >&4
17571 Your strtoll() doesn't seem to be working okay.
17572 EOM
17573                    d_strtoll="$undef"
17574                    ;;
17575                 esac
17576         else
17577                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17578                 d_strtoll="$undef"
17579         fi
17580         ;;
17581 esac
17582
17583 : see if strtoq exists
17584 set strtoq d_strtoq
17585 eval $inlibc
17586
17587 : see if strtoul exists
17588 set strtoul d_strtoul
17589 eval $inlibc
17590
17591 case "$d_strtoul" in
17592 "$define")
17593         $cat <<EOM
17594 Checking whether your strtoul() works okay...
17595 EOM
17596         $cat >try.c <<'EOCP'
17597 #include <errno.h>
17598 #include <stdio.h>
17599 extern unsigned long int strtoul(char *s, char **, int); 
17600 static int bad = 0;
17601 void check(char *s, unsigned long eul, int een) {
17602         unsigned long gul;
17603         errno = 0;
17604         gul = strtoul(s, 0, 10);
17605         if (!((gul == eul) && (errno == een)))
17606                 bad++;
17607 }
17608 int main() {
17609         check(" 1", 1L, 0);
17610         check(" 0", 0L, 0);
17611 EOCP
17612         case "$longsize" in
17613         8)
17614             $cat >>try.c <<'EOCP'
17615         check("18446744073709551615", 18446744073709551615UL, 0);
17616         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17617 #if 0 /* strtoul() for /^-/ strings is undefined. */
17618         check("-1", 18446744073709551615UL, 0);
17619         check("-18446744073709551614", 2, 0);
17620         check("-18446744073709551615", 1, 0);
17621         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17622         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17623 #endif
17624 EOCP
17625                 ;;
17626         4)
17627                     $cat >>try.c <<'EOCP'
17628         check("4294967295", 4294967295UL, 0);
17629         check("4294967296", 4294967295UL, ERANGE);
17630 #if 0 /* strtoul() for /^-/ strings is undefined. */
17631         check("-1", 4294967295UL, 0);
17632         check("-4294967294", 2, 0);
17633         check("-4294967295", 1, 0);
17634         check("-4294967296", 4294967295UL, ERANGE);
17635         check("-4294967297", 4294967295UL, ERANGE);
17636 #endif
17637 EOCP
17638                 ;;
17639         *)
17640 : Should we write these tests to be more portable by sprintf-ing
17641 : ~0 and then manipulating that char string as input for strtol?
17642                 ;;
17643         esac
17644         $cat >>try.c <<'EOCP'
17645         if (!bad)
17646                 printf("ok\n");
17647         return 0;
17648 }
17649 EOCP
17650         set try
17651         if eval $compile; then
17652                 case "`$run ./try`" in
17653                 ok) echo "Your strtoul() seems to be working okay." ;;
17654                 *) cat <<EOM >&4
17655 Your strtoul() doesn't seem to be working okay.
17656 EOM
17657                    d_strtoul="$undef"
17658                    ;;
17659                 esac
17660         else
17661                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17662                 d_strtoul="$undef"
17663         fi
17664         ;;
17665 esac
17666
17667 : see if strtoull exists
17668 set strtoull d_strtoull
17669 eval $inlibc
17670
17671 case "$d_longlong-$d_strtoull" in
17672 "$define-$define")
17673         $cat <<EOM
17674 Checking whether your strtoull() works okay...
17675 EOM
17676         $cat >try.c <<'EOCP'
17677 #include <errno.h>
17678 #ifdef __hpux
17679 #define strtoull __strtoull
17680 #endif
17681 #include <stdio.h>
17682 extern unsigned long long int strtoull(char *s, char **, int); 
17683 static int bad = 0;
17684 int check(char *s, long long eull, int een) {
17685         long long gull;
17686         errno = 0;
17687         gull = strtoull(s, 0, 10);
17688         if (!((gull == eull) && (errno == een)))
17689                 bad++;
17690 }
17691 int main() {
17692         check(" 1",                                        1LL, 0);
17693         check(" 0",                                        0LL, 0);
17694         check("18446744073709551615",  18446744073709551615ULL, 0);
17695         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17696 #if 0 /* strtoull() for /^-/ strings is undefined. */
17697         check("-1",                    18446744073709551615ULL, 0);
17698         check("-18446744073709551614",                     2LL, 0);
17699         check("-18446744073709551615",                     1LL, 0);
17700         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17701         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17702 #endif
17703         if (!bad)
17704                 printf("ok\n");
17705 }
17706 EOCP
17707         set try
17708         if eval $compile; then
17709                 case "`$run ./try`" in
17710                 ok) echo "Your strtoull() seems to be working okay." ;;
17711                 *) cat <<EOM >&4
17712 Your strtoull() doesn't seem to be working okay.
17713 EOM
17714                    d_strtoull="$undef"
17715                    ;;
17716                 esac
17717         else
17718                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17719                 d_strtoull="$undef"
17720         fi
17721         ;;
17722 esac
17723
17724 : see if strtouq exists
17725 set strtouq d_strtouq
17726 eval $inlibc
17727
17728 case "$d_strtouq" in
17729 "$define")
17730         $cat <<EOM
17731 Checking whether your strtouq() works okay...
17732 EOM
17733         $cat >try.c <<'EOCP'
17734 #include <errno.h>
17735 #include <stdio.h>
17736 extern unsigned long long int strtouq(char *s, char **, int); 
17737 static int bad = 0;
17738 void check(char *s, unsigned long long eull, int een) {
17739         unsigned long long gull;
17740         errno = 0;
17741         gull = strtouq(s, 0, 10);
17742         if (!((gull == eull) && (errno == een)))
17743                 bad++;
17744 }
17745 int main() {
17746         check(" 1",                                        1LL, 0);
17747         check(" 0",                                        0LL, 0);
17748         check("18446744073709551615",  18446744073709551615ULL, 0);
17749         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17750 #if 0 /* strtouq() for /^-/ strings is undefined. */
17751         check("-1",                    18446744073709551615ULL, 0);
17752         check("-18446744073709551614",                     2LL, 0);
17753         check("-18446744073709551615",                     1LL, 0);
17754         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17755         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17756 #endif
17757         if (!bad)
17758                 printf("ok\n");
17759         return 0;
17760 }
17761 EOCP
17762         set try
17763         if eval $compile; then
17764                 case "`$run ./try`" in
17765                 ok) echo "Your strtouq() seems to be working okay." ;;
17766                 *) cat <<EOM >&4
17767 Your strtouq() doesn't seem to be working okay.
17768 EOM
17769                    d_strtouq="$undef"
17770                    ;;
17771                 esac
17772         else
17773                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17774                 d_strtouq="$undef"
17775         fi
17776         ;;
17777 esac
17778
17779 : see if strxfrm exists
17780 set strxfrm d_strxfrm
17781 eval $inlibc
17782
17783 : see if symlink exists
17784 set symlink d_symlink
17785 eval $inlibc
17786
17787 : see if syscall exists
17788 set syscall d_syscall
17789 eval $inlibc
17790
17791 : see if prototype for syscall is available
17792 echo " "
17793 set d_syscallproto syscall $i_unistd unistd.h
17794 eval $hasproto
17795
17796 : see if sysconf exists
17797 set sysconf d_sysconf
17798 eval $inlibc
17799
17800 : see if system exists
17801 set system d_system
17802 eval $inlibc
17803
17804 : see if tcgetpgrp exists
17805 set tcgetpgrp d_tcgetpgrp
17806 eval $inlibc
17807
17808 : see if tcsetpgrp exists
17809 set tcsetpgrp d_tcsetpgrp
17810 eval $inlibc
17811
17812 : see if prototype for telldir is available
17813 echo " "
17814 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17815 eval $hasproto
17816
17817 : see if time exists
17818 echo " "
17819 if test "X$d_time" = X -o X"$timetype" = X; then
17820     if set time val -f d_time; eval $csym; $val; then
17821                 echo 'time() found.' >&4
17822                 val="$define"
17823                 rp="What is the type returned by time() on this system?"
17824                 set time_t timetype long stdio.h sys/types.h
17825                 eval $typedef_ask
17826     else
17827                 echo 'time() not found, hope that will do.' >&4
17828                 val="$undef"
17829                 timetype='int';
17830     fi
17831     set d_time
17832     eval $setvar
17833 fi
17834
17835 : see if this is a sys/times.h system
17836 set sys/times.h i_systimes
17837 eval $inhdr
17838
17839 : see if times exists
17840 echo " "
17841 if set times val -f d_times; eval $csym; $val; then
17842         echo 'times() found.' >&4
17843         d_times="$define"
17844         inc=''
17845         case "$i_systimes" in
17846         "$define") inc='sys/times.h';;
17847         esac
17848         rp="What is the type returned by times() on this system?"
17849         set clock_t clocktype long stdio.h sys/types.h $inc
17850         eval $typedef_ask
17851 else
17852         echo 'times() NOT found, hope that will do.' >&4
17853         d_times="$undef"
17854         clocktype='int'
17855 fi
17856
17857 : see if tmpnam_r exists
17858 set tmpnam_r d_tmpnam_r
17859 eval $inlibc
17860 case "$d_tmpnam_r" in
17861 "$define")
17862         hdrs="$i_systypes sys/types.h define stdio.h "
17863         case "$d_tmpnam_r_proto:$usethreads" in
17864         ":define")      d_tmpnam_r_proto=define
17865                 set d_tmpnam_r_proto tmpnam_r $hdrs
17866                 eval $hasproto ;;
17867         *)      ;;
17868         esac
17869         case "$d_tmpnam_r_proto" in
17870         define)
17871         case "$tmpnam_r_proto" in
17872         ''|0) try='char* tmpnam_r(char*);'
17873         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17874         esac
17875         case "$tmpnam_r_proto" in
17876         ''|0)   d_tmpnam_r=undef
17877                 tmpnam_r_proto=0
17878                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17879         * )     case "$tmpnam_r_proto" in
17880                 REENTRANT_PROTO*) ;;
17881                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17882                 esac
17883                 echo "Prototype: $try" ;;
17884         esac
17885         ;;
17886         *)      case "$usethreads" in
17887                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17888                 esac
17889                 d_tmpnam_r=undef
17890                 tmpnam_r_proto=0
17891                 ;;
17892         esac
17893         ;;
17894 *)      tmpnam_r_proto=0
17895         ;;
17896 esac
17897
17898 : see if truncate exists
17899 set truncate d_truncate
17900 eval $inlibc
17901
17902 : see if ttyname_r exists
17903 set ttyname_r d_ttyname_r
17904 eval $inlibc
17905 case "$d_ttyname_r" in
17906 "$define")
17907         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17908         case "$d_ttyname_r_proto:$usethreads" in
17909         ":define")      d_ttyname_r_proto=define
17910                 set d_ttyname_r_proto ttyname_r $hdrs
17911                 eval $hasproto ;;
17912         *)      ;;
17913         esac
17914         case "$d_ttyname_r_proto" in
17915         define)
17916         case "$ttyname_r_proto" in
17917         ''|0) try='int ttyname_r(int, char*, size_t);'
17918         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17919         esac
17920         case "$ttyname_r_proto" in
17921         ''|0) try='int ttyname_r(int, char*, int);'
17922         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17923         esac
17924         case "$ttyname_r_proto" in
17925         ''|0) try='char* ttyname_r(int, char*, int);'
17926         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17927         esac
17928         case "$ttyname_r_proto" in
17929         ''|0)   d_ttyname_r=undef
17930                 ttyname_r_proto=0
17931                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17932         * )     case "$ttyname_r_proto" in
17933                 REENTRANT_PROTO*) ;;
17934                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17935                 esac
17936                 echo "Prototype: $try" ;;
17937         esac
17938         ;;
17939         *)      case "$usethreads" in
17940                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17941                 esac
17942                 d_ttyname_r=undef
17943                 ttyname_r_proto=0
17944                 ;;
17945         esac
17946         ;;
17947 *)      ttyname_r_proto=0
17948         ;;
17949 esac
17950
17951 : see if tzname[] exists
17952 echo " "
17953 if set tzname val -a d_tzname; eval $csym; $val; then
17954         val="$define"
17955         echo 'tzname[] found.' >&4
17956 else
17957         val="$undef"
17958         echo 'tzname[] NOT found.' >&4
17959 fi
17960 set d_tzname
17961 eval $setvar
17962
17963 case "$osname" in
17964 next|rhapsody|darwin) multiarch="$define" ;;
17965 esac
17966 case "$multiarch" in
17967 ''|[nN]*) multiarch="$undef" ;;
17968 esac
17969
17970 : check for ordering of bytes in a UV
17971 echo " "
17972 case "$usecrosscompile$multiarch" in
17973 *$define*)
17974         $cat <<EOM
17975 You seem to be either cross-compiling or doing a multiarchitecture build,
17976 skipping the byteorder check.
17977
17978 EOM
17979         byteorder='ffff'
17980         ;;
17981 *)
17982         case "$byteorder" in
17983         '')
17984                 $cat <<'EOM'
17985 In the following, larger digits indicate more significance.  A big-endian
17986 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17987 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17988 machines may have weird orders like 3412.  A Cray will report 87654321,
17989 an Alpha will report 12345678. If the test program works the default is
17990 probably right.
17991 I'm now running the test program...
17992 EOM
17993                 $cat >try.c <<EOCP
17994 #include <stdio.h>
17995 #$i_stdlib I_STDLIB
17996 #ifdef I_STDLIB
17997 #include <stdlib.h>
17998 #endif
17999 #include <sys/types.h>
18000 typedef $uvtype UV;
18001 int main()
18002 {
18003         int i;
18004         union {
18005                 UV l;
18006                 char c[$uvsize];
18007         } u;
18008
18009         if ($uvsize > 4)
18010                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18011         else
18012                 u.l = (UV)0x04030201;
18013         for (i = 0; i < $uvsize; i++)
18014                 printf("%c", u.c[i]+'0');
18015         printf("\n");
18016         exit(0);
18017 }
18018 EOCP
18019                 xxx_prompt=y
18020                 set try
18021                 if eval $compile && $run ./try > /dev/null; then
18022                         dflt=`$run ./try`
18023                         case "$dflt" in
18024                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18025                                 echo "(The test program ran ok.)"
18026                                 echo "byteorder=$dflt"
18027                                 xxx_prompt=n
18028                         ;;
18029                         ????|????????) echo "(The test program ran ok.)" ;;
18030                         *) echo "(The test program didn't run right for some reason.)" ;;
18031                         esac
18032                 else
18033                         dflt='4321'
18034                         cat <<'EOM'
18035 (I can't seem to compile the test program.  Guessing big-endian...)
18036 EOM
18037                 fi
18038                 case "$xxx_prompt" in
18039                 y)
18040                         rp="What is the order of bytes in $uvtype?"
18041                         . ./myread
18042                         byteorder="$ans"
18043                         ;;
18044                 *)      byteorder=$dflt
18045                         ;;
18046                 esac
18047                 ;;
18048         esac
18049         $rm_try
18050         ;;
18051 esac
18052
18053 $cat <<EOM
18054
18055 Checking to see whether you can access character data unalignedly...
18056 EOM
18057 case "$d_u32align" in
18058 '')   $cat >try.c <<EOCP
18059 #include <stdio.h>
18060 #$i_stdlib I_STDLIB
18061 #ifdef I_STDLIB
18062 #include <stdlib.h>
18063 #endif
18064 #define U32 $u32type
18065 #define BYTEORDER 0x$byteorder
18066 #define U8 $u8type
18067 #include <signal.h>
18068 #ifdef SIGBUS
18069 $signal_t bletch(int s) { exit(4); }
18070 #endif
18071 int main() {
18072 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18073     U8 buf[8];
18074     U32 *up;
18075     int i;
18076
18077     if (sizeof(U32) != 4) {
18078         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18079         exit(1);
18080     }
18081
18082     fflush(stdout);
18083
18084 #ifdef SIGBUS
18085     signal(SIGBUS, bletch);
18086 #endif
18087
18088     buf[0] = 0;
18089     buf[1] = 0;
18090     buf[2] = 0;
18091     buf[3] = 1;
18092     buf[4] = 0;
18093     buf[5] = 0;
18094     buf[6] = 0;
18095     buf[7] = 1;
18096
18097     for (i = 0; i < 4; i++) {
18098         up = (U32*)(buf + i);
18099         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18100                (*up == 1 << (8*(3-i)))  /* little-endian */
18101               )
18102            )
18103         {
18104             printf("read failed (%x)\n", *up);
18105             exit(2);
18106         }
18107     }
18108
18109     /* write test */
18110     for (i = 0; i < 4; i++) {
18111         up = (U32*)(buf + i);
18112         *up = 0xBeef;
18113         if (*up != 0xBeef) {
18114             printf("write failed (%x)\n", *up);
18115             exit(3);
18116         }
18117     }
18118
18119     exit(0);
18120 #else
18121     printf("1\n");
18122     exit(1);
18123 #endif
18124     return 0;
18125 }
18126 EOCP
18127 set try
18128 if eval $compile_ok; then
18129         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18130         $run ./try 2>&1 >/dev/null
18131         case "$?" in
18132         0)      cat >&4 <<EOM
18133 You can access character data pretty unalignedly.
18134 EOM
18135                 d_u32align="$undef"
18136                 ;;
18137         *)      cat >&4 <<EOM
18138 It seems that you must access character data in an aligned manner.
18139 EOM
18140                 d_u32align="$define"
18141                 ;;
18142         esac
18143 else
18144         rp='Can you access character data at unaligned addresses?'
18145         dflt='n'
18146         . ./myread
18147         case "$ans" in
18148         [yY]*)  d_u32align="$undef"  ;;
18149         *)      d_u32align="$define" ;;
18150         esac
18151 fi
18152 $rm_try
18153 ;;
18154 esac
18155
18156 : see if ualarm exists
18157 set ualarm d_ualarm
18158 eval $inlibc
18159
18160 : see if umask exists
18161 set umask d_umask
18162 eval $inlibc
18163
18164 : see if unordered exists
18165 set unordered d_unordered
18166 eval $inlibc
18167
18168 : see if unsetenv exists
18169 set unsetenv d_unsetenv
18170 eval $inlibc
18171
18172 : see if usleep exists
18173 set usleep d_usleep
18174 eval $inlibc
18175
18176 : see if prototype for usleep is available
18177 echo " "
18178 set d_usleepproto usleep $i_unistd unistd.h
18179 eval $hasproto
18180
18181 : see if ustat exists
18182 set ustat d_ustat
18183 eval $inlibc
18184
18185 : see if closedir exists
18186 set closedir d_closedir
18187 eval $inlibc
18188
18189 case "$d_closedir" in
18190 "$define")
18191         echo " "
18192         echo "Checking whether closedir() returns a status..." >&4
18193         cat > try.c <<EOM
18194 #$i_dirent I_DIRENT             /**/
18195 #$i_sysdir I_SYS_DIR            /**/
18196 #$i_sysndir I_SYS_NDIR          /**/
18197 #$i_systypes I_SYS_TYPES        /**/
18198
18199 #if defined(I_SYS_TYPES)
18200 #include <sys/types.h>
18201 #endif
18202 #if defined(I_DIRENT)
18203 #include <dirent.h>
18204 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18205 #include <sys/dir.h>
18206 #endif
18207 #else
18208 #ifdef I_SYS_NDIR
18209 #include <sys/ndir.h>
18210 #else
18211 #ifdef I_SYS_DIR
18212 #ifdef hp9000s500
18213 #include <ndir.h>       /* may be wrong in the future */
18214 #else
18215 #include <sys/dir.h>
18216 #endif
18217 #endif
18218 #endif
18219 #endif
18220 int main() { return closedir(opendir(".")); }
18221 EOM
18222         set try
18223         if eval $compile_ok; then
18224                 if $run ./try > /dev/null 2>&1 ; then
18225                         echo "Yes, it does."
18226                         val="$undef"
18227                 else
18228                         echo "No, it doesn't."
18229                         val="$define"
18230                 fi
18231         else
18232                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18233                 val="$define"
18234         fi
18235         ;;
18236 *)
18237         val="$undef";
18238         ;;
18239 esac
18240 set d_void_closedir
18241 eval $setvar
18242 $rm_try
18243
18244 : see if there is a wait4
18245 set wait4 d_wait4
18246 eval $inlibc
18247
18248 : see if waitpid exists
18249 set waitpid d_waitpid
18250 eval $inlibc
18251
18252 : see if wcstombs exists
18253 set wcstombs d_wcstombs
18254 eval $inlibc
18255
18256 : see if wctomb exists
18257 set wctomb d_wctomb
18258 eval $inlibc
18259
18260 : see if writev exists
18261 set writev d_writev
18262 eval $inlibc
18263
18264 : preserve RCS keywords in files with variable substitution, grrr
18265 Date='$Date'
18266 Id='$Id'
18267 Log='$Log'
18268 RCSfile='$RCSfile'
18269 Revision='$Revision'
18270
18271 : check for alignment requirements
18272 echo " "
18273 case "$usecrosscompile$multiarch" in
18274 *$define*)
18275         $cat <<EOM
18276 You seem to be either cross-compiling or doing a multiarchitecture build,
18277 skipping the memory alignment check.
18278
18279 EOM
18280         case "$alignbytes" in
18281         '') alignbytes=8 ;;
18282         esac
18283         ;;
18284 *)
18285         case "$alignbytes" in
18286         '') echo "Checking alignment constraints..." >&4
18287                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18288                         $cat >try.c <<'EOCP'
18289 typedef long double NV;
18290 EOCP
18291                 else
18292                         $cat >try.c <<'EOCP'
18293 typedef double NV;
18294 EOCP
18295                 fi
18296                 $cat >>try.c <<'EOCP'
18297 #include <stdio.h>
18298 struct foobar {
18299         char foo;
18300         NV bar;
18301 } try_algn;
18302 int main()
18303 {
18304     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18305     return(0);
18306 }
18307 EOCP
18308                 set try
18309                 if eval $compile_ok; then
18310                         dflt=`$run ./try`
18311                 else
18312                         dflt='8'
18313                         echo "(I can't seem to compile the test program...)"
18314                 fi
18315                 ;;
18316         *) dflt="$alignbytes"
18317                 ;;
18318         esac
18319         rp="Doubles must be aligned on a how-many-byte boundary?"
18320         . ./myread
18321         alignbytes="$ans"
18322         $rm_try
18323         ;;
18324 esac
18325
18326
18327 : set the base revision
18328 baserev=5.0
18329
18330 : how do we concatenate cpp tokens here?
18331 echo " "
18332 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18333 $cat >cpp_stuff.c <<'EOCP'
18334 #define RCAT(a,b)a/**/b
18335 #define ACAT(a,b)a ## b
18336 RCAT(Rei,ser)
18337 ACAT(Cir,cus)
18338 EOCP
18339 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18340 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18341         echo "Oh!  Smells like ANSI's been here." >&4
18342         echo "We can catify or stringify, separately or together!"
18343         cpp_stuff=42
18344 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18345         echo "Ah, yes!  The good old days!" >&4
18346         echo "However, in the good old days we don't know how to stringify and"
18347         echo "catify at the same time."
18348         cpp_stuff=1
18349 else
18350         $cat >&4 <<EOM
18351 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18352 You're going to have to edit the values of CAT[2-5] in config.h...
18353 EOM
18354         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18355 fi
18356 $rm -f cpp_stuff.*
18357
18358 : see if this is a db.h system
18359 set db.h i_db
18360 eval $inhdr
18361
18362 case "$i_db" in
18363 $define)
18364         : Check db version.
18365         echo " "
18366         echo "Checking Berkeley DB version ..." >&4
18367         $cat >try.c <<EOCP
18368 #$d_const HASCONST
18369 #ifndef HASCONST
18370 #define const
18371 #endif
18372 #include <sys/types.h>
18373 #include <stdio.h>
18374 #$i_stdlib I_STDLIB
18375 #ifdef I_STDLIB
18376 #include <stdlib.h>
18377 #endif
18378 #include <db.h>
18379 int main(int argc, char *argv[])
18380 {
18381 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18382     int Major, Minor, Patch ;
18383     unsigned long Version ;
18384     (void)db_version(&Major, &Minor, &Patch) ;
18385     if (argc == 2) {
18386         printf("%d %d %d %d %d %d\n",
18387                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18388                Major, Minor, Patch);
18389         exit(0);
18390     }
18391     printf("You have Berkeley DB Version 2 or greater.\n");
18392
18393     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18394                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18395     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18396                 Major, Minor, Patch) ;
18397
18398     /* check that db.h & libdb are compatible */
18399     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18400         printf("db.h and libdb are incompatible.\n") ;
18401         exit(3);
18402     }
18403
18404     printf("db.h and libdb are compatible.\n") ;
18405
18406     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18407                 + DB_VERSION_PATCH ;
18408
18409     /* needs to be >= 2.3.4 */
18410     if (Version < 2003004) {
18411     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18412         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18413         exit(2);
18414     }
18415
18416     exit(0);
18417 #else
18418 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18419     if (argc == 2) {
18420         printf("1 0 0\n");
18421         exit(0);
18422     }
18423     printf("You have Berkeley DB Version 1.\n");
18424     exit(0);    /* DB version < 2: the coast is clear. */
18425 #else
18426     exit(1);    /* <db.h> not Berkeley DB? */
18427 #endif
18428 #endif
18429 }
18430 EOCP
18431         set try
18432         if eval $compile_ok && $run ./try; then
18433                 echo 'Looks OK.' >&4
18434                 set `$run ./try 1`
18435                 db_version_major=$1
18436                 db_version_minor=$2
18437                 db_version_patch=$3
18438         else
18439                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18440                 i_db=$undef
18441                 case " $libs " in
18442                 *"-ldb "*)
18443                         : Remove db from list of libraries to use
18444                         echo "Removing unusable -ldb from library list" >&4
18445                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18446                         shift
18447                         libs="$*"
18448                         echo "libs = $libs" >&4
18449                         ;;
18450                 esac
18451         fi
18452         $rm_try
18453         ;;
18454 esac
18455
18456 case "$i_db" in
18457 define)
18458         : Check the return type needed for hash
18459         echo " "
18460         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18461         $cat >try.c <<EOCP
18462 #$d_const HASCONST
18463 #ifndef HASCONST
18464 #define const
18465 #endif
18466 #include <sys/types.h>
18467 #include <db.h>
18468
18469 #ifndef DB_VERSION_MAJOR
18470 u_int32_t hash_cb (ptr, size)
18471 const void *ptr;
18472 size_t size;
18473 {
18474 }
18475 HASHINFO info;
18476 int main()
18477 {
18478         info.hash = hash_cb;
18479 }
18480 #endif
18481 EOCP
18482         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18483                 if $contains warning try.out >>/dev/null 2>&1 ; then
18484                         db_hashtype='int'
18485                 else
18486                         db_hashtype='u_int32_t'
18487                 fi
18488         else
18489                 : XXX Maybe we should just give up here.
18490                 db_hashtype=u_int32_t
18491                 $cat try.out >&4
18492                 echo "Help:  I can't seem to compile the db test program." >&4
18493                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18494         fi
18495         $rm_try
18496         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18497         ;;
18498 *)      db_hashtype=u_int32_t
18499         ;;
18500 esac
18501 case "$i_db" in
18502 define)
18503         : Check the return type needed for prefix
18504         echo " "
18505         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18506         cat >try.c <<EOCP
18507 #$d_const HASCONST
18508 #ifndef HASCONST
18509 #define const
18510 #endif
18511 #include <sys/types.h>
18512 #include <db.h>
18513
18514 #ifndef DB_VERSION_MAJOR
18515 size_t prefix_cb (key1, key2)
18516 const DBT *key1;
18517 const DBT *key2;
18518 {
18519 }
18520 BTREEINFO info;
18521 int main()
18522 {
18523         info.prefix = prefix_cb;
18524 }
18525 #endif
18526 EOCP
18527         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18528                 if $contains warning try.out >>/dev/null 2>&1 ; then
18529                         db_prefixtype='int'
18530                 else
18531                         db_prefixtype='size_t'
18532                 fi
18533         else
18534                 db_prefixtype='size_t'
18535                 : XXX Maybe we should just give up here.
18536                 $cat try.out >&4
18537                 echo "Help:  I can't seem to compile the db test program." >&4
18538                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18539         fi
18540         $rm_try
18541         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18542         ;;
18543 *)      db_prefixtype='size_t'
18544         ;;
18545 esac
18546
18547 : How can we generate normalized random numbers ?
18548 echo " "
18549 echo "Looking for a random number function..." >&4
18550 case "$randfunc" in
18551 '')
18552         if set drand48 val -f; eval $csym; $val; then
18553                 dflt="drand48"
18554                 echo "Good, found drand48()." >&4
18555         elif set random val -f; eval $csym; $val; then
18556                 dflt="random"
18557                 echo "OK, found random()." >&4
18558         else
18559                 dflt="rand"
18560                 echo "Yick, looks like I have to use rand()." >&4
18561         fi
18562         echo " "
18563         ;;
18564 *)
18565         dflt="$randfunc"
18566         ;;
18567 esac
18568 cont=true
18569
18570 case "$ccflags" in
18571 *-Dmy_rand=*|*-Dmy_srand=*)
18572         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18573         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18574         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18575         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18576         ;;
18577 esac
18578
18579 while $test "$cont"; do
18580         rp="Use which function to generate random numbers?"
18581         . ./myread
18582         if $test "$ans" = "$dflt"; then
18583                 : null
18584         else
18585                 randbits=''
18586         fi
18587         randfunc="$ans"
18588         if set $ans val -f; eval $csym; $val; then
18589                 cont=''
18590         else
18591                 dflt=y
18592                 rp="I cannot find function $ans. Use that name anyway?"
18593                 . ./myread
18594                 dflt=rand
18595                 case "$ans" in
18596                         [yY]*) cont='';;
18597                 esac
18598         fi
18599         case "$cont" in
18600         '')
18601                 case "$randfunc" in
18602                 drand48)
18603                         drand01="drand48()"
18604                         seedfunc="srand48"
18605                         randbits=48
18606                         randseedtype=long
18607                         ;;
18608                 rand|random)
18609                         case "$randbits" in
18610                         '')
18611 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18612                                 $cat >try.c <<EOCP
18613 #$i_unistd I_UNISTD
18614 #$i_stdlib I_STDLIB
18615 #include <stdio.h>
18616 #ifdef I_UNISTD
18617 #  include <unistd.h>
18618 #endif
18619 #ifdef I_STDLIB
18620 #  include <stdlib.h>
18621 #endif
18622 int main()
18623 {
18624         register int i;
18625         register unsigned long tmp;
18626         register unsigned long max = 0L;
18627
18628         for (i = 1000; i; i--) {
18629                 tmp = (unsigned long) $randfunc();
18630                 if (tmp > max) max = tmp;
18631         }
18632         for (i = 0; max; i++)
18633                 max /= 2;
18634         printf("%d\n",i);
18635 }
18636 EOCP
18637                                 set try
18638                                 if eval $compile_ok; then
18639                                         dflt=`try`
18640                                 else
18641                                         dflt='?'
18642                                         echo "(I can't seem to compile the test program...)"
18643                                 fi
18644                                 ;;
18645                         *)
18646                                 dflt="$randbits"
18647                                 ;;
18648                         esac
18649                         rp="How many bits does your $randfunc() function produce?"
18650                         . ./myread
18651                         randbits="$ans"
18652                         $rm_try
18653                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18654                         seedfunc="s$randfunc"
18655                         randseedtype=unsigned
18656                         ;;
18657                 *)
18658                         dflt="31"
18659                         rp="How many bits does your $randfunc() function produce?"
18660                         . ./myread
18661                         randbits="$ans"
18662                         seedfunc="s$randfunc"
18663                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18664                         if set $seedfunc val -f; eval $csym; $val; then
18665                                 echo "(Using $seedfunc() to seed random generator)"
18666                         else
18667                                 echo "(Warning: no $seedfunc() to seed random generator)"
18668                                 seedfunc=rand
18669                         fi
18670                         randseedtype=unsigned
18671                         ;;
18672                 esac
18673                 ;;
18674         esac
18675 done
18676
18677 echo " "
18678 echo "Determining whether or not we are on an EBCDIC system..." >&4
18679 $cat >try.c <<'EOM'
18680 int main()
18681 {
18682   if ('M'==0xd4) return 0;
18683   return 1;
18684 }
18685 EOM
18686
18687 val=$undef
18688 set try
18689 if eval $compile_ok; then
18690         if $run ./try; then
18691                 echo "You seem to speak EBCDIC." >&4
18692                 val="$define"
18693         else
18694                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18695         fi
18696 else
18697         echo "I'm unable to compile the test program." >&4
18698         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18699 fi
18700 $rm_try
18701 set ebcdic
18702 eval $setvar
18703
18704 echo " "
18705 $cat >&4 <<EOM
18706 Checking how to flush all pending stdio output...
18707 EOM
18708 # I only know how to find the first 32 possibly open files on SunOS.
18709 # See also hints/sunos_4_1.sh and util.c  --AD
18710 case "$osname" in
18711 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18712 esac
18713 $cat >>try.c <<EOCP
18714 #include <stdio.h>
18715 #$i_stdlib I_STDLIB
18716 #ifdef I_STDLIB
18717 #include <stdlib.h>
18718 #endif
18719 #$i_unistd I_UNISTD
18720 #ifdef I_UNISTD
18721 # include <unistd.h>
18722 #endif
18723 #$d_sysconf HAS_SYSCONF
18724 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18725 #ifdef HAS_STDIO_STREAM_ARRAY
18726 # define STDIO_STREAM_ARRAY $stdio_stream_array
18727 #endif
18728 int main() {
18729   FILE* p;
18730   unlink("try.out");
18731   p = fopen("try.out", "w");
18732 #ifdef TRY_FPUTC
18733   fputc('x', p);
18734 #else
18735 # ifdef TRY_FPRINTF
18736   fprintf(p, "x");
18737 # endif
18738 #endif
18739 #ifdef TRY_FFLUSH_NULL
18740   fflush(NULL);
18741 #endif
18742 #ifdef TRY_FFLUSH_ALL
18743   {
18744     long open_max = -1;
18745 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18746     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18747 # else
18748 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18749     open_max = sysconf(_SC_OPEN_MAX);
18750 #  else
18751 #   ifdef FOPEN_MAX
18752     open_max = FOPEN_MAX;
18753 #   else
18754 #    ifdef OPEN_MAX
18755     open_max = OPEN_MAX;
18756 #    else
18757 #     ifdef _NFILE
18758     open_max = _NFILE;
18759 #     endif
18760 #    endif
18761 #   endif
18762 #  endif
18763 # endif
18764 # ifdef HAS_STDIO_STREAM_ARRAY
18765     if (open_max > 0) {
18766       long i;
18767       for (i = 0; i < open_max; i++)
18768             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18769                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18770                 STDIO_STREAM_ARRAY[i]._flag)
18771                 fflush(&STDIO_STREAM_ARRAY[i]);
18772     }
18773   }
18774 # endif
18775 #endif
18776   _exit(42);
18777 }
18778 EOCP
18779 : first we have to find out how _not_ to flush
18780 $to try.c
18781 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18782     output=''
18783     set try -DTRY_FPUTC
18784     if eval $compile; then
18785             $run ./try 2>/dev/null
18786             code="$?"
18787             $from try.out
18788             if $test ! -s try.out -a "X$code" = X42; then
18789                 output=-DTRY_FPUTC
18790             fi
18791     fi
18792     case "$output" in
18793     '')
18794             set try -DTRY_FPRINTF
18795             if eval $compile; then
18796                     $run ./try 2>/dev/null
18797                     code="$?"
18798                     $from try.out
18799                     if $test ! -s try.out -a "X$code" = X42; then
18800                         output=-DTRY_FPRINTF
18801                     fi
18802             fi
18803         ;;
18804     esac
18805 fi
18806 : check for fflush NULL behaviour
18807 case "$fflushNULL" in
18808 '')     set try -DTRY_FFLUSH_NULL $output
18809         if eval $compile; then
18810                 $run ./try 2>/dev/null
18811                 code="$?"
18812                 $from try.out
18813                 if $test -s try.out -a "X$code" = X42; then
18814                         fflushNULL="`$cat try.out`"
18815                 else
18816                         if $test "X$code" != X42; then
18817                                 $cat >&4 <<EOM
18818 (If this test failed, don't worry, we'll try another method shortly.)
18819 EOM
18820                         fi
18821                 fi
18822         fi
18823         $rm_try
18824         case "$fflushNULL" in
18825         x)      $cat >&4 <<EOM
18826 Your fflush(NULL) works okay for output streams.
18827 Let's see if it clobbers input pipes...
18828 EOM
18829 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18830 # bug that improperly flushes the input end of pipes.  So we avoid the
18831 # autoflush on fork/system/exec support for now. :-(
18832 $cat >tryp.c <<EOCP
18833 #include <stdio.h>
18834 int
18835 main(int argc, char **argv)
18836 {
18837     char buf[1024];
18838     int i;
18839     char *bp = buf;
18840     while (1) {
18841         while ((i = getc(stdin)) != -1
18842                && (*bp++ = i) != '\n'
18843                && bp < &buf[1024])
18844         /* DO NOTHING */ ;
18845         *bp = '\0';
18846         fprintf(stdout, "%s", buf);
18847         fflush(NULL);
18848         if (i == -1)
18849             return 0;
18850         bp = buf;
18851     }
18852 }
18853 EOCP
18854                 fflushNULL="$define"
18855                 set tryp
18856                 if eval $compile; then
18857                     $rm -f tryp.out
18858                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18859                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18860                        $cat >&4 <<EOM
18861 fflush(NULL) seems to behave okay with input streams.
18862 EOM
18863                         fflushNULL="$define"
18864                     else
18865                         $cat >&4 <<EOM
18866 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18867 EOM
18868                         fflushNULL="$undef"
18869                     fi
18870                 fi
18871                 $rm -f core tryp.c tryp.core core.tryp.*
18872                 ;;
18873         '')     $cat >&4 <<EOM
18874 Your fflush(NULL) isn't working (contrary to ANSI C).
18875 EOM
18876                 fflushNULL="$undef"
18877                 ;;
18878         *)      $cat >&4 <<EOM
18879 Cannot figure out whether your fflush(NULL) works or not.
18880 I'm assuming it doesn't (contrary to ANSI C).
18881 EOM
18882                 fflushNULL="$undef"
18883                 ;;
18884         esac
18885         ;;
18886 $define|true|[yY]*)
18887         fflushNULL="$define"
18888         ;;
18889 *)
18890         fflushNULL="$undef"
18891         ;;
18892 esac
18893 : check explicit looping only if NULL did not work, and if the pipe
18894 : bug does not show up on an explicit flush too
18895 case "$fflushNULL" in
18896 "$undef")
18897         $cat >tryp.c <<EOCP
18898 #include <stdio.h>
18899 int
18900 main(int argc, char **argv)
18901 {
18902     char buf[1024];
18903     int i;
18904     char *bp = buf;
18905     while (1) {
18906         while ((i = getc(stdin)) != -1
18907                && (*bp++ = i) != '\n'
18908                && bp < &buf[1024])
18909         /* DO NOTHING */ ;
18910         *bp = '\0';
18911         fprintf(stdout, "%s", buf);
18912         fflush(stdin);
18913         if (i == -1)
18914             return 0;
18915         bp = buf;
18916     }
18917 }
18918 EOCP
18919         set tryp
18920         if eval $compile; then
18921             $rm -f tryp.out
18922             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18923             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18924                $cat >&4 <<EOM
18925 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18926 EOM
18927                 : now check for fflushall behaviour
18928                 case "$fflushall" in
18929                 '')     set try -DTRY_FFLUSH_ALL $output
18930                         if eval $compile; then
18931                                 $cat >&4 <<EOM
18932 (Now testing the other method--but note that this also may fail.)
18933 EOM
18934                                 $run ./try 2>/dev/null
18935                                 code=$?
18936                                 $from try.out
18937                                 if $test -s try.out -a "X$code" = X42; then
18938                                         fflushall="`$cat try.out`"
18939                                 fi
18940                         fi
18941                         $rm_try
18942                         case "$fflushall" in
18943                         x)      $cat >&4 <<EOM
18944 Whew. Flushing explicitly all the stdio streams works.
18945 EOM
18946                                 fflushall="$define"
18947                                 ;;
18948                         '')     $cat >&4 <<EOM
18949 Sigh. Flushing explicitly all the stdio streams doesn't work.
18950 EOM
18951                                 fflushall="$undef"
18952                                 ;;
18953                         *)      $cat >&4 <<EOM
18954 Cannot figure out whether flushing stdio streams explicitly works or not.
18955 I'm assuming it doesn't.
18956 EOM
18957                                 fflushall="$undef"
18958                                 ;;
18959                         esac
18960                         ;;
18961                 "$define"|true|[yY]*)
18962                         fflushall="$define"
18963                         ;;
18964                 *)
18965                         fflushall="$undef"
18966                         ;;
18967                 esac
18968             else
18969                 $cat >&4 <<EOM
18970 All is futile.  Even fflush(stdin) clobbers input pipes!
18971 EOM
18972                 fflushall="$undef"
18973             fi
18974         else
18975             fflushall="$undef"
18976         fi
18977         $rm -f core tryp.c tryp.core core.tryp.*
18978         ;;
18979 *)      fflushall="$undef"
18980         ;;
18981 esac
18982
18983 case "$fflushNULL$fflushall" in
18984 undefundef)
18985         $cat <<EOM
18986 OK, I give up.  I cannot figure out how to flush pending stdio output.
18987 We won't be flushing handles at all before fork/exec/popen.
18988 EOM
18989         ;;
18990 esac
18991 $rm_try
18992
18993 : Store the full pathname to the ar program for use in the C program
18994 : Respect a hint or command line value for full_ar.
18995 case "$full_ar" in
18996 '') full_ar=$ar ;;
18997 esac
18998
18999 : Store the full pathname to the sed program for use in the C program
19000 full_sed=$sed
19001
19002 : see what type gids are declared as in the kernel
19003 echo " "
19004 echo "Looking for the type for group ids returned by getgid()."
19005 set gid_t gidtype xxx stdio.h sys/types.h
19006 eval $typedef
19007 case "$gidtype" in
19008 xxx)
19009         xxx=`./findhdr sys/user.h`
19010         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19011         case $1 in
19012         unsigned) dflt="$1 $2" ;;
19013         *) dflt="$1" ;;
19014         esac
19015         ;;
19016 *) dflt="$gidtype";;
19017 esac
19018 case "$gidtype" in
19019 gid_t) echo "gid_t found." ;;
19020 *)      rp="What is the type for group ids returned by getgid()?"
19021         . ./myread
19022         gidtype="$ans"
19023         ;;
19024 esac
19025
19026 echo " "
19027 case "$gidtype" in
19028 *_t) zzz="$gidtype"     ;;
19029 *)   zzz="gid"          ;;
19030 esac
19031 echo "Checking the size of $zzz..." >&4 
19032 cat > try.c <<EOCP
19033 #include <sys/types.h>
19034 #include <stdio.h>
19035 #$i_stdlib I_STDLIB
19036 #ifdef I_STDLIB
19037 #include <stdlib.h>
19038 #endif
19039 int main() {
19040     printf("%d\n", (int)sizeof($gidtype));
19041     exit(0);
19042 }
19043 EOCP
19044 set try
19045 if eval $compile_ok; then
19046         yyy=`$run ./try`
19047         case "$yyy" in
19048         '')     gidsize=4
19049                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19050                 ;;
19051         *)      gidsize=$yyy
19052                 echo "Your $zzz is $gidsize bytes long."
19053                 ;;
19054         esac
19055 else
19056         gidsize=4
19057         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19058 fi
19059
19060
19061 echo " "
19062 case "$gidtype" in
19063 *_t) zzz="$gidtype"     ;;
19064 *)   zzz="gid"          ;;
19065 esac
19066 echo "Checking the sign of $zzz..." >&4 
19067 cat > try.c <<EOCP
19068 #include <sys/types.h>
19069 #include <stdio.h>
19070 int main() {
19071         $gidtype foo = -1;
19072         if (foo < 0)
19073                 printf("-1\n");
19074         else
19075                 printf("1\n");
19076 }
19077 EOCP
19078 set try
19079 if eval $compile; then
19080         yyy=`$run ./try`
19081         case "$yyy" in
19082         '')     gidsign=1
19083                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19084                 ;;
19085         *)      gidsign=$yyy
19086                 case "$gidsign" in
19087                  1) echo "Your $zzz is unsigned." ;;
19088                 -1) echo "Your $zzz is signed."   ;;
19089                 esac
19090                 ;;
19091         esac
19092 else
19093         gidsign=1
19094         echo "(I can't compile the test program--guessing unsigned.)" >&4
19095 fi
19096
19097
19098 echo " "
19099
19100 if $test X"$quadtype" != X; then
19101
19102 echo "Checking how to print 64-bit integers..." >&4
19103
19104 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19105         $cat >try.c <<'EOCP'
19106 #include <sys/types.h>
19107 #include <stdio.h>
19108 int main() {
19109   int q = 12345678901;
19110   printf("%ld\n", q);
19111 }
19112 EOCP
19113         set try
19114         if eval $compile; then
19115                 yyy=`$run ./try`
19116                 case "$yyy" in
19117                 12345678901)
19118                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19119                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19120                         echo "We will use %d."
19121                         ;;
19122                 esac
19123         fi
19124 fi
19125
19126 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19127         $cat >try.c <<'EOCP'
19128 #include <sys/types.h>
19129 #include <stdio.h>
19130 int main() {
19131   long q = 12345678901;
19132   printf("%ld\n", q);
19133 }
19134 EOCP
19135         set try
19136         if eval $compile; then
19137                 yyy=`$run ./try`
19138                 case "$yyy" in
19139                 12345678901)
19140                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19141                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19142                         echo "We will use %ld."
19143                         ;;
19144                 esac
19145         fi
19146 fi
19147
19148 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19149         $cat >try.c <<'EOCP'
19150 #include <sys/types.h>
19151 #include <inttypes.h>
19152 #include <stdio.h>
19153 int main() {
19154   int64_t q = 12345678901;
19155   printf("%" PRId64 "\n", q);
19156 }
19157 EOCP
19158         set try
19159         if eval $compile; then
19160                 yyy=`$run ./try`
19161                 case "$yyy" in
19162                 12345678901)
19163                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19164                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19165                         echo "We will use the C9X style."
19166                         ;;
19167                 esac
19168         fi
19169 fi
19170
19171 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19172         $cat >try.c <<EOCP
19173 #include <sys/types.h>
19174 #include <stdio.h>
19175 int main() {
19176   $quadtype q = 12345678901;
19177   printf("%Ld\n", q);
19178 }
19179 EOCP
19180         set try
19181         if eval $compile; then
19182                 yyy=`$run ./try`
19183                 case "$yyy" in
19184                 12345678901)
19185                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19186                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19187                         echo "We will use %Ld."
19188                         ;;
19189                 esac
19190         fi
19191 fi
19192
19193 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19194         $cat >try.c <<'EOCP'
19195 #include <sys/types.h>
19196 #include <stdio.h>
19197 int main() {
19198   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19199   printf("%lld\n", q);
19200 }
19201 EOCP
19202         set try
19203         if eval $compile; then
19204                 yyy=`$run ./try`
19205                 case "$yyy" in
19206                 12345678901)
19207                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19208                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19209                         echo "We will use the %lld style."
19210                         ;;
19211                 esac
19212         fi
19213 fi
19214
19215 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19216         $cat >try.c <<EOCP
19217 #include <sys/types.h>
19218 #include <stdio.h>
19219 int main() {
19220   $quadtype q = 12345678901;
19221   printf("%qd\n", q);
19222 }
19223 EOCP
19224         set try
19225         if eval $compile; then
19226                 yyy=`$run ./try`
19227                 case "$yyy" in
19228                 12345678901)
19229                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19230                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19231                         echo "We will use %qd."
19232                         ;;
19233                 esac
19234         fi
19235 fi
19236
19237 if $test X"$sPRId64" = X; then
19238         echo "Cannot figure out how to print 64-bit integers." >&4
19239 fi
19240 $rm_try
19241
19242 fi
19243
19244 case "$sPRId64" in
19245 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19246         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19247         ;;
19248 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19249         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19250         ;;
19251 esac
19252
19253
19254 echo " "
19255 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19256
19257 if $test X"$ivsize" = X8; then
19258         ivdformat="$sPRId64"
19259         uvuformat="$sPRIu64"
19260         uvoformat="$sPRIo64"
19261         uvxformat="$sPRIx64"
19262         uvXUformat="$sPRIXU64"
19263 else
19264         if $test X"$ivsize" = X"$longsize"; then
19265                 ivdformat='"ld"'
19266                 uvuformat='"lu"'
19267                 uvoformat='"lo"'
19268                 uvxformat='"lx"'
19269                 uvXUformat='"lX"'
19270         else
19271                 if $test X"$ivsize" = X"$intsize"; then
19272                         ivdformat='"d"'
19273                         uvuformat='"u"'
19274                         uvoformat='"o"'
19275                         uvxformat='"x"'
19276                         uvXUformat='"X"'
19277                 else
19278                         : far out
19279                         if $test X"$ivsize" = X"$shortsize"; then
19280                                 ivdformat='"hd"'
19281                                 uvuformat='"hu"'
19282                                 uvoformat='"ho"'
19283                                 uvxformat='"hx"'
19284                                 uvXUformat='"hX"'
19285                         fi
19286                 fi
19287         fi
19288 fi
19289
19290 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19291         nveformat="$sPRIeldbl"
19292         nvfformat="$sPRIfldbl"
19293         nvgformat="$sPRIgldbl"
19294         nvEUformat="$sPRIEUldbl"
19295         nvFUformat="$sPRIFUldbl"
19296         nvGUformat="$sPRIGUldbl"
19297 else
19298         nveformat='"e"'
19299         nvfformat='"f"'
19300         nvgformat='"g"'
19301         nvEUformat='"E"'
19302         nvFUformat='"F"'
19303         nvGUformat='"G"'
19304 fi
19305
19306 case "$ivdformat" in
19307 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19308     exit 1
19309     ;;
19310 esac
19311
19312
19313 echo " "
19314 $echo "Checking the format string to be used for gids..." >&4
19315
19316 case "$gidsign" in
19317 -1)     if $test X"$gidsize" = X"$ivsize"; then
19318                 gidformat="$ivdformat"
19319         else
19320                 if $test X"$gidsize" = X"$longsize"; then
19321                         gidformat='"ld"'
19322                 else
19323                         if $test X"$gidsize" = X"$intsize"; then
19324                                 gidformat='"d"'
19325                         else
19326                                 if $test X"$gidsize" = X"$shortsize"; then
19327                                         gidformat='"hd"'
19328                                 fi
19329                         fi
19330                 fi
19331         fi
19332         ;;
19333 *)      if $test X"$gidsize" = X"$uvsize"; then
19334                 gidformat="$uvuformat"
19335         else
19336                 if $test X"$gidsize" = X"$longsize"; then
19337                         gidformat='"lu"'
19338                 else
19339                         if $test X"$gidsize" = X"$intsize"; then
19340                                 gidformat='"u"'
19341                         else
19342                                 if $test X"$gidsize" = X"$shortsize"; then
19343                                         gidformat='"hu"'
19344                                 fi
19345                         fi
19346                 fi
19347         fi
19348         ;;
19349 esac
19350
19351 : see if getgroups exists
19352 set getgroups d_getgrps
19353 eval $inlibc
19354
19355 : see if setgroups exists
19356 set setgroups d_setgrps
19357 eval $inlibc
19358
19359
19360 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19361 echo " "
19362 case "$d_getgrps$d_setgrps" in
19363 *define*)
19364         case "$groupstype" in
19365         '') dflt="$gidtype" ;;
19366         *)  dflt="$groupstype" ;;
19367         esac
19368         $cat <<EOM
19369 What type of pointer is the second argument to getgroups() and setgroups()?
19370 Usually this is the same as group ids, $gidtype, but not always.
19371
19372 EOM
19373         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19374         . ./myread
19375         groupstype="$ans"
19376         ;;
19377 *)  groupstype="$gidtype";;
19378 esac
19379
19380
19381 if $test $patchlevel -lt 9; then
19382 : MAD is not available in 5.8.x or earlier.
19383     ans=n;
19384 else
19385     case "$mad" in
19386     $define|true|[yY]*) dflt='y' ;;
19387     *)                  dflt='n' ;;
19388     esac
19389     cat <<EOM
19390
19391 Would you like to build with Misc Attribute Decoration? This is development
19392 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19393 overhead on the interpreter.
19394
19395 If this doesn't make any sense to you, just accept the default '$dflt'.
19396 EOM
19397     rp='Build Perl with MAD?'
19398     . ./myread
19399 fi
19400 case "$ans" in
19401 y|Y)    val="$define"
19402         madlyh='madly.h madly.act madly.tab'
19403         madlysrc='madly.c'
19404         madlyobj="madly$_o" ;;
19405 *)      val="$undef"
19406         madlyh=''
19407         madlysrc=''
19408         madlyobj='' ;;
19409 esac
19410 set mad
19411 eval $setvar
19412
19413 echo " "
19414 echo "Checking if your $make program sets \$(MAKE)..." >&4
19415 case "$make_set_make" in
19416 '')
19417         $sed 's/^X //' > testmake.mak << 'EOF'
19418 Xall:
19419 X       @echo 'maketemp="$(MAKE)"'
19420 EOF
19421         case "`$make -f testmake.mak 2>/dev/null`" in
19422         *maketemp=*) make_set_make='#' ;;
19423         *)      make_set_make="MAKE=$make" ;;
19424         esac
19425         $rm -f testmake.mak
19426         ;;
19427 esac
19428 case "$make_set_make" in
19429 '#') echo "Yup, it does.";;
19430 *) echo "Nope, it doesn't.";;
19431 esac
19432
19433 : see what type is used for mode_t
19434 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19435 set mode_t modetype int stdio.h sys/types.h
19436 eval $typedef_ask
19437
19438 : see if we need va_copy
19439 echo " "
19440 case "$i_stdarg" in
19441 "$define")
19442         $cat >try.c <<EOCP
19443 #include <stdarg.h>
19444 #include <stdio.h>
19445 #$i_stdlib I_STDLIB
19446 #ifdef I_STDLIB
19447 #include <stdlib.h>
19448 #endif
19449 #include <signal.h>
19450
19451 int
19452 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19453 {
19454   return vfprintf(f, fmt, *valp);
19455 }
19456
19457 int
19458 myvfprintf(FILE *f, const  char *fmt, va_list val)
19459 {
19460   return ivfprintf(f, fmt, &val);
19461 }
19462
19463 int
19464 myprintf(char *fmt, ...)
19465 {
19466   va_list val;
19467   va_start(val, fmt);
19468   return myvfprintf(stdout, fmt, val);
19469 }
19470
19471 int
19472 main(int ac, char **av)
19473 {
19474   signal(SIGSEGV, exit);
19475
19476   myprintf("%s%cs all right, then\n", "that", '\'');
19477   exit(0);
19478 }
19479 EOCP
19480         set try
19481         if eval $compile && $run ./try 2>&1 >/dev/null; then
19482                 case "`$run ./try`" in
19483                 "that's all right, then")
19484                         okay=yes
19485                         ;;
19486                 esac
19487         fi
19488         case "$okay" in
19489         yes)    echo "It seems that you don't need va_copy()." >&4
19490                 need_va_copy="$undef"
19491                 ;;
19492         *)      echo "It seems that va_copy() or similar will be needed." >&4
19493                 need_va_copy="$define"
19494                 ;;
19495         esac
19496         $rm_try
19497         ;;
19498 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19499         ;;
19500 esac
19501
19502 : see what type is used for size_t
19503 rp="What is the type used for the length parameter for string functions?"
19504 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19505 eval $typedef_ask
19506
19507 : check for type of arguments to gethostbyaddr. 
19508 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19509         case "$d_gethbyaddr" in
19510         $define)
19511                 $cat <<EOM
19512
19513 Checking to see what type of arguments are accepted by gethostbyaddr().
19514 EOM
19515                 hdrs="$define sys/types.h
19516                         $d_socket sys/socket.h 
19517                         $i_niin netinet/in.h 
19518                         $i_netdb netdb.h
19519                         $i_unistd unistd.h"
19520                 : The first arg can 'char *' or 'void *'
19521                 : The second arg is some of integral type
19522                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19523                         for yyy in size_t long int; do
19524                                 case "$netdb_host_type" in
19525                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19526                                         if ./protochk "$try" $hdrs; then
19527                                                 echo "Your system accepts $xxx for the first arg."
19528                                                 echo "...and $yyy for the second arg."
19529                                                 netdb_host_type="$xxx"
19530                                                 netdb_hlen_type="$yyy"
19531                                         fi
19532                                         ;;
19533                                 esac
19534                         done
19535                 done
19536                 : In case none of those worked, prompt the user.
19537                 case "$netdb_host_type" in
19538                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19539                         dflt='char *'
19540                         . ./myread
19541                         netdb_host_type=$ans
19542                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19543                         dflt="$sizetype"
19544                         . ./myread
19545                         netdb_hlen_type=$ans
19546                         ;;
19547                 esac
19548                 ;;
19549         *)      : no gethostbyaddr, so pick harmless defaults
19550                 netdb_host_type='char *'
19551                 netdb_hlen_type="$sizetype"
19552                 ;;
19553         esac
19554         # Remove the "const" if needed. -- but then we'll have a 
19555         # prototype clash!
19556         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19557 fi
19558
19559 : check for type of argument to gethostbyname. 
19560 if test "X$netdb_name_type" = X ; then
19561         case "$d_gethbyname" in
19562         $define)
19563                 $cat <<EOM
19564
19565 Checking to see what type of argument is accepted by gethostbyname().
19566 EOM
19567                 hdrs="$define sys/types.h
19568                         $d_socket sys/socket.h 
19569                         $i_niin netinet/in.h 
19570                         $i_netdb netdb.h
19571                         $i_unistd unistd.h"
19572                 for xxx in "const char *" "char *"; do
19573                         case "$netdb_name_type" in
19574                         '')     try="extern struct hostent *gethostbyname($xxx);"
19575                                 if ./protochk "$try" $hdrs; then
19576                                         echo "Your system accepts $xxx."
19577                                         netdb_name_type="$xxx"
19578                                 fi
19579                                 ;;
19580                         esac
19581                 done
19582                 : In case none of those worked, prompt the user.
19583                 case "$netdb_name_type" in
19584                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19585                         dflt='char *'
19586                         . ./myread
19587                         netdb_name_type=$ans
19588                         ;;
19589                 esac
19590                 ;;
19591         *)      : no gethostbyname, so pick harmless default
19592                 netdb_name_type='char *'
19593                 ;;
19594         esac
19595 fi
19596
19597 : check for type of 1st argument to getnetbyaddr. 
19598 if test "X$netdb_net_type" = X ; then
19599         case "$d_getnbyaddr" in
19600         $define)
19601                 $cat <<EOM
19602
19603 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19604 EOM
19605                 hdrs="$define sys/types.h
19606                         $d_socket sys/socket.h 
19607                         $i_niin netinet/in.h 
19608                         $i_netdb netdb.h
19609                         $i_unistd unistd.h"
19610                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19611                         case "$netdb_net_type" in
19612                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19613                                 if ./protochk "$try" $hdrs; then
19614                                         echo "Your system accepts $xxx."
19615                                         netdb_net_type="$xxx"
19616                                 fi
19617                                 ;;
19618                         esac
19619                 done
19620                 : In case none of those worked, prompt the user.
19621                 case "$netdb_net_type" in
19622                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19623                         dflt='long'
19624                         . ./myread
19625                         netdb_net_type=$ans
19626                         ;;
19627                 esac
19628                 ;;
19629         *)      : no getnetbyaddr, so pick harmless default
19630                 netdb_net_type='long'
19631                 ;;
19632         esac
19633 fi
19634 : locate the preferred pager for this system
19635 fn=f/
19636 case "$pager" in
19637 '')
19638         dflt=''
19639         case "$pg" in
19640         /*) dflt=$pg;;
19641         [a-zA-Z]:/*) dflt=$pg;;
19642         esac
19643         case "$more" in
19644         /*) dflt=$more;;
19645         [a-zA-Z]:/*) dflt=$more;;
19646         esac
19647         case "$less" in
19648         /*) dflt=$less;;
19649         [a-zA-Z]:/*) dflt=$less;;
19650         esac
19651         case "$dflt" in
19652         '') dflt=/usr/ucb/more;;
19653         esac
19654         ;;
19655 *)      dflt="$pager"
19656         : Instruct ./getfile to trust the hinted or previous pager value,
19657         : even if it does not begin with a slash.  For example, on os2,
19658         : pager might be cmd /c more.  See comments in UU/getfile.
19659         fn="f/($pager)"
19660         ;;
19661 esac
19662 echo " "
19663 rp='What pager is used on your system?'
19664 . ./getfile
19665 pager="$ans"
19666
19667 : see what type pids are declared as in the kernel
19668 rp="What is the type of process ids on this system?"
19669 set pid_t pidtype int stdio.h sys/types.h
19670 eval $typedef_ask
19671
19672 : see if ar generates random libraries by itself
19673 echo " "
19674 echo "Checking how to generate random libraries on your machine..." >&4
19675 echo 'int bar1() { return bar2(); }' > bar1.c
19676 echo 'int bar2() { return 2; }' > bar2.c
19677 $cat > foo.c <<EOP
19678 #$i_stdlib I_STDLIB
19679 #ifdef I_STDLIB
19680 #include <stdlib.h>
19681 #endif
19682 int main() { printf("%d\n", bar1()); exit(0); }
19683 EOP
19684 $cc $ccflags -c bar1.c >/dev/null 2>&1
19685 $cc $ccflags -c bar2.c >/dev/null 2>&1
19686 $cc $ccflags -c foo.c >/dev/null 2>&1
19687 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19688 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19689         $run ./foobar >/dev/null 2>&1; then
19690         echo "$ar appears to generate random libraries itself."
19691         orderlib=false
19692         if [ "X$ranlib" = "X" ]; then
19693             ranlib=":"
19694         fi
19695 elif $ar s bar$_a >/dev/null 2>&1 &&
19696         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19697         $run ./foobar >/dev/null 2>&1; then
19698                 echo "a table of contents needs to be added with '$ar s'."
19699                 orderlib=false
19700                 ranlib="$ar s"
19701 elif $ar ts bar$_a >/dev/null 2>&1 &&
19702         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19703         $run ./foobar >/dev/null 2>&1; then
19704                 echo "a table of contents needs to be added with '$ar ts'."
19705                 orderlib=false
19706                 ranlib="$ar ts"
19707 else
19708         case "$ranlib" in
19709         :) ranlib='';;
19710         '')
19711                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19712                 $test -f $ranlib || ranlib=''
19713                 ;;
19714         esac
19715         if $test -n "$ranlib"; then
19716                 echo "your system has '$ranlib'; we'll use that."
19717                 orderlib=false
19718         else
19719                 echo "your system doesn't seem to support random libraries"
19720                 echo "so we'll use lorder and tsort to order the libraries."
19721                 orderlib=true
19722                 ranlib=":"
19723         fi
19724 fi
19725 $rm -f foo* bar*
19726
19727 : check for type of arguments to select. 
19728 case "$selecttype" in
19729 '') case "$d_select" in
19730         $define)
19731                 echo " "
19732                 $cat <<EOM
19733 Checking to see what type of arguments are accepted by select().
19734 EOM
19735                 hdrs="$define sys/types.h
19736                         $i_systime sys/time.h 
19737                         $i_sysselct sys/select.h
19738                         $d_socket sys/socket.h"
19739                 : The first arg can be int, unsigned, or size_t
19740                 : The last arg may or may not be 'const'
19741                 val=''
19742                 : void pointer has been seen but using that
19743                 : breaks the selectminbits test
19744                 for xxx in 'fd_set *' 'int *'; do
19745                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19746                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19747                                         case "$val" in
19748                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19749                                                 if ./protochk "$try" $hdrs; then
19750                                                         echo "Your system accepts $xxx."
19751                                                         val="$xxx"
19752                                                 fi
19753                                                 ;;
19754                                         esac
19755                                 done
19756                         done
19757                 done
19758                 case "$val" in
19759                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19760                         case "$d_fd_set" in
19761                                 $define) dflt="fd_set *" ;;
19762                                 *)              dflt="int *" ;;
19763                         esac
19764                         . ./myread
19765                         val=$ans
19766                         ;;
19767                 esac
19768                 selecttype="$val"
19769                 ;;
19770         *)      : no select, so pick a harmless default
19771                 selecttype='int *'
19772                 ;;
19773         esac
19774         ;;
19775 esac
19776
19777 : check for the select 'width'
19778 case "$selectminbits" in
19779 '') safebits=`expr $ptrsize \* 8`
19780     case "$d_select" in
19781         $define)
19782                 $cat <<EOM
19783
19784 Checking to see on how many bits at a time your select() operates...
19785 EOM
19786                 $cat >try.c <<EOCP
19787 #include <sys/types.h>
19788 #$i_time I_TIME
19789 #$i_systime I_SYS_TIME
19790 #$i_systimek I_SYS_TIME_KERNEL
19791 #ifdef I_TIME
19792 #   include <time.h>
19793 #endif
19794 #ifdef I_SYS_TIME
19795 #   ifdef I_SYS_TIME_KERNEL
19796 #       define KERNEL
19797 #   endif
19798 #   include <sys/time.h>
19799 #   ifdef I_SYS_TIME_KERNEL
19800 #       undef KERNEL
19801 #   endif
19802 #endif
19803 #$i_sysselct I_SYS_SELECT
19804 #ifdef I_SYS_SELECT
19805 #include <sys/select.h>
19806 #endif
19807 #$d_socket HAS_SOCKET
19808 #ifdef HAS_SOCKET
19809 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19810 #endif
19811 #include <stdio.h>
19812 #$i_stdlib I_STDLIB
19813 #ifdef I_STDLIB
19814 #include <stdlib.h>
19815 #endif
19816 $selecttype b;
19817 #define S sizeof(*(b))
19818 #define MINBITS 64
19819 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19820 #define NBITS  (NBYTES * 8)
19821 int main() {
19822     char *s = (char *)malloc(NBYTES);
19823     struct timeval t;
19824     int i;
19825     FILE* fp;
19826     int fd;
19827
19828     if (!s)
19829         exit(1);
19830     fclose(stdin);
19831     fp = fopen("try.c", "r");
19832     if (fp == 0)
19833       exit(2);
19834     fd = fileno(fp);
19835     if (fd < 0)
19836       exit(3);
19837     b = ($selecttype)s;
19838     for (i = 0; i < NBITS; i++)
19839         FD_SET(i, b);
19840     t.tv_sec  = 0;
19841     t.tv_usec = 0;
19842     select(fd + 1, b, 0, 0, &t);
19843     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19844     free(s);
19845     printf("%d\n", i + 1);
19846     return 0;
19847 }
19848 EOCP
19849                 set try
19850                 if eval $compile_ok; then
19851                         selectminbits=`$run ./try`
19852                         case "$selectminbits" in
19853                         '')     cat >&4 <<EOM
19854 Cannot figure out on how many bits at a time your select() operates.
19855 I'll play safe and guess it is $safebits bits.
19856 EOM
19857                                 selectminbits=$safebits
19858                                 bits="$safebits bits"
19859                                 ;;
19860                         1)      bits="1 bit" ;;
19861                         *)      bits="$selectminbits bits" ;;
19862                         esac
19863                         echo "Your select() operates on $bits at a time." >&4
19864                 else
19865                         rp='What is the minimum number of bits your select() operates on?'
19866                         case "$byteorder" in
19867                         12345678)       dflt=64 ;;
19868                         1234)           dflt=32 ;;
19869                         *)              dflt=1  ;;
19870                         esac
19871                         . ./myread
19872                         val=$ans
19873                         selectminbits="$val"
19874                 fi
19875                 $rm_try
19876                 ;;
19877         *)      : no select, so pick a harmless default
19878                 selectminbits=$safebits
19879                 ;;
19880         esac
19881         ;;
19882 esac
19883
19884 : Trace out the files included by signal.h, then look for SIGxxx names.
19885 : Remove SIGARRAYSIZE used by HPUX.
19886 : Remove SIGSTKSIZE used by Linux.
19887 : Remove SIGSTKSZ used by Posix.
19888 : Remove SIGTYP void lines used by OS2.
19889 : Some cpps, like os390, dont give the file name anywhere
19890 if [ "X$fieldn" = X ]; then
19891         : Just make some guesses.  We check them later.
19892         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19893 else
19894         xxx=`echo '#include <signal.h>' |
19895         $cppstdin $cppminus $cppflags 2>/dev/null |
19896         $grep '^[       ]*#.*include' | 
19897         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19898 fi
19899 : Check this list of files to be sure we have parsed the cpp output ok.
19900 : This will also avoid potentially non-existent files, such 
19901 : as ../foo/bar.h
19902 xxxfiles=''
19903 for xx in $xxx /dev/null ; do
19904         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19905 done
19906 : If we have found no files, at least try signal.h
19907 case "$xxxfiles" in
19908 '')     xxxfiles=`./findhdr signal.h` ;;
19909 esac
19910 xxx=`awk '
19911 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19912         print substr($2, 4, 20)
19913 }
19914 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19915         print substr($3, 4, 20)
19916 }' $xxxfiles`
19917 : Append some common names just in case the awk scan failed.
19918 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19919 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19920 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19921 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19922 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19923
19924 : generate a few handy files for later
19925 $cat > signal.c <<EOCP
19926 #include <sys/types.h>
19927 #include <signal.h>
19928 #$i_stdlib I_STDLIB
19929 #ifdef I_STDLIB
19930 #include <stdlib.h>
19931 #endif
19932 #include <stdio.h>
19933 int main() {
19934
19935 /* Strange style to avoid deeply-nested #if/#else/#endif */
19936 #ifndef NSIG
19937 #  ifdef _NSIG
19938 #    define NSIG (_NSIG)
19939 #  endif
19940 #endif
19941
19942 #ifndef NSIG
19943 #  ifdef SIGMAX
19944 #    define NSIG (SIGMAX+1)
19945 #  endif
19946 #endif
19947
19948 #ifndef NSIG
19949 #  ifdef SIG_MAX
19950 #    define NSIG (SIG_MAX+1)
19951 #  endif
19952 #endif
19953
19954 #ifndef NSIG
19955 #  ifdef _SIG_MAX
19956 #    define NSIG (_SIG_MAX+1)
19957 #  endif
19958 #endif
19959
19960 #ifndef NSIG
19961 #  ifdef MAXSIG
19962 #    define NSIG (MAXSIG+1)
19963 #  endif
19964 #endif
19965
19966 #ifndef NSIG
19967 #  ifdef MAX_SIG
19968 #    define NSIG (MAX_SIG+1)
19969 #  endif
19970 #endif
19971
19972 #ifndef NSIG
19973 #  ifdef SIGARRAYSIZE
19974 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19975 #  endif
19976 #endif
19977
19978 #ifndef NSIG
19979 #  ifdef _sys_nsig
19980 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19981 #  endif
19982 #endif
19983
19984 /* Default to some arbitrary number that's big enough to get most
19985    of the common signals.
19986 */
19987 #ifndef NSIG
19988 #    define NSIG 50
19989 #endif
19990
19991 printf("NSIG %d\n", NSIG);
19992
19993 #ifndef JUST_NSIG
19994
19995 EOCP
19996
19997 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19998 {
19999         printf "#ifdef SIG"; printf $1; printf "\n"
20000         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20001         printf $1; printf ");\n"
20002         printf "#endif\n"
20003 }
20004 END {
20005         printf "#endif /* JUST_NSIG */\n";
20006         printf "exit(0);\n}\n";
20007 }
20008 ' >>signal.c
20009 $cat >signal.awk <<'EOP'
20010 BEGIN { ndups = 0 }
20011 $1 ~ /^NSIG$/ { nsig = $2 }
20012 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20013     if ($2 > maxsig) { maxsig = $2 }
20014     if (sig_name[$2]) {
20015         dup_name[ndups] = $1
20016         dup_num[ndups] = $2
20017         ndups++ 
20018     }
20019     else {
20020         sig_name[$2] = $1
20021         sig_num[$2] = $2
20022     }
20023 }
20024 END { 
20025     if (nsig == 0) {
20026         nsig = maxsig + 1
20027     }
20028     printf("NSIG %d\n", nsig);
20029     for (n = 1; n < nsig; n++) {
20030         if (sig_name[n]) {
20031             printf("%s %d\n", sig_name[n], sig_num[n])
20032         }
20033         else {
20034             printf("NUM%d %d\n", n, n) 
20035         }
20036     }
20037     for (n = 0; n < ndups; n++) {
20038         printf("%s %d\n", dup_name[n], dup_num[n])
20039     }
20040 }
20041 EOP
20042 $cat >signal_cmd <<EOS
20043 $startsh
20044 if $test -s signal.lst; then
20045     echo "Using your existing signal.lst file"
20046         exit 0
20047 fi
20048 xxx="$xxx"
20049 EOS
20050 $cat >>signal_cmd <<'EOS'
20051
20052 set signal
20053 if eval $compile_ok; then
20054         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20055 else
20056         echo "(I can't seem be able to compile the whole test program)" >&4
20057         echo "(I'll try it in little pieces.)" >&4
20058         set signal -DJUST_NSIG
20059         if eval $compile_ok; then
20060                 $run ./signal$_exe > signal.nsg
20061                 $cat signal.nsg
20062         else
20063                 echo "I can't seem to figure out how many signals you have." >&4
20064                 echo "Guessing 50." >&4
20065                 echo 'NSIG 50' > signal.nsg
20066         fi
20067         : Now look at all the signal names, one at a time.
20068         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20069                 $cat > signal.c <<EOCP
20070 #include <sys/types.h>
20071 #include <signal.h>
20072 #include <stdio.h>
20073 int main() {
20074 printf("$xx %d\n", SIG${xx});
20075 return 0;
20076 }
20077 EOCP
20078                 set signal
20079                 if eval $compile; then
20080                         echo "SIG${xx} found."
20081                         $run ./signal$_exe  >> signal.ls1
20082                 else
20083                         echo "SIG${xx} NOT found."
20084                 fi
20085         done
20086         if $test -s signal.ls1; then
20087                 $cat signal.nsg signal.ls1 |
20088                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20089         fi
20090
20091 fi
20092 if $test -s signal.lst; then
20093         :
20094 else
20095         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20096         echo 'kill -l' >signal
20097         set X `csh -f <signal`
20098         $rm -f signal
20099         shift
20100         case $# in
20101         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20102         esac
20103         echo $@ | $tr ' ' $trnl | \
20104             $awk '{ printf "%s %d\n", $1, ++s; }
20105                   END { printf "NSIG %d\n", ++s }' >signal.lst
20106 fi
20107 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20108 EOS
20109 chmod a+x signal_cmd
20110 $eunicefix signal_cmd
20111
20112 : generate list of signal names
20113 echo " "
20114 case "$sig_name_init" in
20115 '') doinit=yes ;;
20116 *)  case "$sig_num_init" in
20117     ''|*,*) doinit=yes ;;
20118     esac ;;
20119 esac
20120 case "$doinit" in
20121 yes)
20122         echo "Generating a list of signal names and numbers..." >&4
20123         . ./signal_cmd
20124         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20125         sig_name=`$awk 'BEGIN { printf "ZERO " }
20126                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20127         sig_num=`$awk  'BEGIN { printf "0 " }
20128                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20129         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20130                              !/^NSIG/   { printf "\"%s\", ", $1 }
20131                              END        { printf "0\n" }' signal.lst`
20132         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20133                              !/^NSIG/   { printf "%d, ", $2}
20134                              END        { printf "0\n"}' signal.lst`
20135         ;;
20136 esac
20137 echo "The following $sig_count signals are available:"
20138 echo " "
20139 echo $sig_name | $awk \
20140 'BEGIN { linelen = 0 }
20141 {
20142         for (i = 1; i <= NF; i++) {
20143                 name = "SIG" $i " "
20144                 linelen = linelen + length(name)
20145                 if (linelen > 70) {
20146                         printf "\n"
20147                         linelen = length(name)
20148                 }
20149                 printf "%s", name
20150         }
20151         printf "\n"
20152 }'
20153 sig_size=`echo $sig_name | awk '{print NF}'`
20154 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20155
20156 echo " "
20157 case "$sizetype" in
20158 *_t) zzz="$sizetype"    ;;
20159 *)   zzz="filesize"     ;;
20160 esac
20161 echo "Checking the size of $zzz..." >&4 
20162 cat > try.c <<EOCP
20163 #include <sys/types.h>
20164 #include <stdio.h>
20165 #$i_stdlib I_STDLIB
20166 #ifdef I_STDLIB
20167 #include <stdlib.h>
20168 #endif
20169 int main() {
20170     printf("%d\n", (int)sizeof($sizetype));
20171     exit(0);
20172 }
20173 EOCP
20174 set try
20175 if eval $compile_ok; then
20176         yyy=`$run ./try`
20177         case "$yyy" in
20178         '')     sizesize=4
20179                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20180                 ;;
20181         *)      sizesize=$yyy
20182                 echo "Your $zzz size is $sizesize bytes."
20183                 ;;
20184         esac
20185 else
20186         sizesize=4
20187         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20188 fi
20189
20190
20191 : check for socklen_t
20192 echo " "
20193 echo "Checking to see if you have socklen_t..." >&4
20194 $cat >try.c <<EOCP
20195 #include <sys/types.h>
20196 #$d_socket HAS_SOCKET
20197 #ifdef HAS_SOCKET
20198 #include <sys/socket.h>
20199 #endif
20200 int main() { socklen_t x = 16; }
20201 EOCP
20202 set try
20203 if eval $compile; then
20204         val="$define"
20205         echo "You have socklen_t."
20206 else
20207         val="$undef"
20208         echo "You do not have socklen_t."
20209         case "$sizetype" in
20210         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20211         esac
20212 fi
20213 $rm_try
20214 set d_socklen_t
20215 eval $setvar
20216
20217 : see if this is a socks.h system
20218 set socks.h i_socks
20219 eval $inhdr
20220
20221 : check for type of the size argument to socket calls
20222 case "$d_socket" in
20223 "$define")
20224         $cat <<EOM
20225
20226 Checking to see what type is the last argument of accept().
20227 EOM
20228         yyy=''
20229         case "$d_socklen_t" in
20230         "$define") yyy="$yyy socklen_t"
20231         esac
20232         yyy="$yyy $sizetype int long unsigned"
20233         for xxx in $yyy; do
20234                 case "$socksizetype" in
20235                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20236                         case "$usesocks" in
20237                         "$define")
20238                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20239                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20240                                         socksizetype="$xxx"
20241                                 fi
20242                                 ;;
20243                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20244                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20245                                         socksizetype="$xxx"
20246                                 fi
20247                                 ;;
20248                         esac
20249                         ;;
20250                 esac
20251         done
20252 : In case none of those worked, prompt the user.
20253         case "$socksizetype" in
20254         '')     rp='What is the type for socket address structure sizes?'
20255                 dflt='int'
20256                 . ./myread
20257                 socksizetype=$ans
20258                 ;;
20259         esac
20260         ;;
20261 *)      : no sockets, so pick relatively harmless default
20262         socksizetype='int'
20263         ;;
20264 esac
20265
20266 : see what type is used for signed size_t
20267 set ssize_t ssizetype int stdio.h sys/types.h
20268 eval $typedef
20269 dflt="$ssizetype"
20270 $cat > try.c <<EOM
20271 #include <stdio.h>
20272 #$i_stdlib I_STDLIB
20273 #ifdef I_STDLIB
20274 #include <stdlib.h>
20275 #endif
20276 #include <sys/types.h>
20277 #define Size_t $sizetype
20278 #define SSize_t $dflt
20279 int main()
20280 {
20281         if (sizeof(Size_t) == sizeof(SSize_t))
20282                 printf("$dflt\n");
20283         else if (sizeof(Size_t) == sizeof(int))
20284                 printf("int\n");
20285         else
20286                 printf("long\n");
20287         exit(0);
20288 }
20289 EOM
20290 echo " "
20291 set try
20292 if eval $compile_ok && $run ./try > /dev/null; then
20293         ssizetype=`$run ./try`
20294         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20295 else
20296         $cat >&4 <<EOM
20297 Help! I can't compile and run the ssize_t test program: please enlighten me!
20298 (This is probably a misconfiguration in your system or libraries, and
20299 you really ought to fix it.  Still, I'll try anyway.)
20300
20301 I need a type that is the same size as $sizetype, but is guaranteed to
20302 be signed.  Common values are ssize_t, int and long.
20303
20304 EOM
20305         rp="What signed type is the same size as $sizetype?"
20306         . ./myread
20307         ssizetype="$ans"
20308 fi
20309 $rm_try
20310
20311 : see what type of char stdio uses.
20312 echo " "
20313 echo '#include <stdio.h>' > stdio.c
20314 $cppstdin $cppminus < stdio.c > stdioh
20315 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20316         echo "Your stdio uses unsigned chars." >&4
20317         stdchar="unsigned char"
20318 else
20319         echo "Your stdio uses signed chars." >&4
20320         stdchar="char"
20321 fi
20322 $rm -f stdio.* stdioh
20323
20324 : see what type uids are declared as in the kernel
20325 echo " "
20326 echo "Looking for the type for user ids returned by getuid()."
20327 set uid_t uidtype xxx stdio.h sys/types.h
20328 eval $typedef
20329 case "$uidtype" in
20330 xxx)
20331         xxx=`./findhdr sys/user.h`
20332         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20333         case $1 in
20334         unsigned) dflt="$1 $2" ;;
20335         *) dflt="$1" ;;
20336         esac
20337         ;;
20338 *) dflt="$uidtype";;
20339 esac
20340 case "$uidtype" in
20341 uid_t)  echo "uid_t found." ;;
20342 *)      rp="What is the type for user ids returned by getuid()?"
20343         . ./myread
20344         uidtype="$ans"
20345         ;;
20346 esac
20347
20348 echo " "
20349 case "$uidtype" in
20350 *_t) zzz="$uidtype"     ;;
20351 *)   zzz="uid"          ;;
20352 esac
20353 echo "Checking the size of $zzz..." >&4 
20354 cat > try.c <<EOCP
20355 #include <sys/types.h>
20356 #include <stdio.h>
20357 #$i_stdlib I_STDLIB
20358 #ifdef I_STDLIB
20359 #include <stdlib.h>
20360 #endif
20361 int main() {
20362     printf("%d\n", (int)sizeof($uidtype));
20363     exit(0);
20364 }
20365 EOCP
20366 set try
20367 if eval $compile_ok; then
20368         yyy=`$run ./try`
20369         case "$yyy" in
20370         '')     uidsize=4
20371                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20372                 ;;
20373         *)      uidsize=$yyy
20374                 echo "Your $zzz is $uidsize bytes long."
20375                 ;;
20376         esac
20377 else
20378         uidsize=4
20379         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20380 fi
20381
20382 echo " "
20383 case "$uidtype" in
20384 *_t) zzz="$uidtype"     ;;
20385 *)   zzz="uid"          ;;
20386 esac
20387 echo "Checking the sign of $zzz..." >&4
20388 cat > try.c <<EOCP
20389 #include <sys/types.h>
20390 #include <stdio.h>
20391 int main() {
20392         $uidtype foo = -1;
20393         if (foo < 0)
20394                 printf("-1\n");
20395         else
20396                 printf("1\n");
20397 }
20398 EOCP
20399 set try
20400 if eval $compile; then
20401         yyy=`$run ./try`
20402         case "$yyy" in
20403         '')     uidsign=1
20404                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20405                 ;;
20406         *)      uidsign=$yyy
20407                 case "$uidsign" in
20408                  1) echo "Your $zzz is unsigned." ;;
20409                 -1) echo "Your $zzz is signed."   ;;
20410                 esac
20411                 ;;
20412         esac
20413 else
20414         uidsign=1
20415         echo "(I can't compile the test program--guessing unsigned.)" >&4
20416 fi
20417
20418
20419
20420 echo " "
20421 $echo "Checking the format string to be used for uids..." >&4
20422
20423 case "$uidsign" in
20424 -1)     if $test X"$uidsize" = X"$ivsize"; then
20425                 uidformat="$ivdformat"
20426         else
20427                 if $test X"$uidsize" = X"$longsize"; then
20428                         uidformat='"ld"'
20429                 else
20430                         if $test X"$uidsize" = X"$intsize"; then
20431                                 uidformat='"d"'
20432                         else
20433                                 if $test X"$uidsize" = X"$shortsize"; then
20434                                         uidformat='"hd"'
20435                                 fi
20436                         fi
20437                 fi
20438         fi
20439         ;;
20440 *)      if $test X"$uidsize" = X"$uvsize"; then
20441                 uidformat="$uvuformat"
20442         else
20443                 if $test X"$uidsize" = X"$longsize"; then
20444                         uidformat='"lu"'
20445                 else
20446                         if $test X"$uidsize" = X"$intsize"; then
20447                                 uidformat='"u"'
20448                         else
20449                                 if $test X"$uidsize" = X"$shortsize"; then
20450                                         uidformat='"hu"'
20451                                 fi
20452                         fi
20453                 fi
20454         fi
20455         ;;
20456 esac
20457
20458
20459 case "$usesitecustomize" in
20460     $define|true|[Yy]*)
20461         usesitecustomize="$define"
20462         ;;
20463     *)
20464         usesitecustomize="$undef"
20465         ;;
20466     esac
20467
20468 : determine compiler compiler
20469 case "$yacc" in
20470 '')
20471         dflt=yacc;;
20472 *)
20473         dflt="$yacc";;
20474 esac
20475 echo " "
20476 comp='yacc'
20477 if $test -f "$byacc$_exe"; then
20478         dflt="$byacc"
20479         comp="byacc or $comp"
20480 fi
20481 if $test -f "$bison$_exe"; then
20482         comp="$comp or bison -y"
20483 fi
20484 rp="Which compiler compiler ($comp) shall I use?"
20485 . ./myread
20486 yacc="$ans"
20487 case "$yacc" in
20488 *bis*)
20489         case "$yacc" in
20490         *-y*) ;;
20491         *)
20492                 yacc="$yacc -y"
20493                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20494                 ;;
20495         esac
20496         ;;
20497 esac
20498
20499 : see if this is a fp.h system
20500 set fp.h i_fp
20501 eval $inhdr
20502
20503 : see if this is a fp_class.h system
20504 set fp_class.h i_fp_class
20505 eval $inhdr
20506
20507 : see if gdbm.h is available
20508 set gdbm.h t_gdbm
20509 eval $inhdr
20510 case "$t_gdbm" in
20511 $define)
20512         : see if gdbm_open exists
20513         set gdbm_open d_gdbm_open
20514         eval $inlibc
20515         case "$d_gdbm_open" in
20516         $undef)
20517                 t_gdbm="$undef"
20518                 echo "We won't be including <gdbm.h>"
20519                 ;;
20520         esac
20521         ;;
20522 esac
20523 val="$t_gdbm"
20524 set i_gdbm
20525 eval $setvar
20526
20527 : see if this is a ieeefp.h system
20528 case "$i_ieeefp" in
20529 '' ) set ieeefp.h i_ieeefp
20530      eval $inhdr
20531      ;;
20532 esac
20533
20534 : see if this is a libutil.h system
20535 set libutil.h i_libutil
20536 eval $inhdr
20537
20538 : see if mach cthreads are available
20539 if test "X$usethreads" = "X$define"; then
20540         set mach/cthreads.h i_machcthr
20541         eval $inhdr
20542 else
20543         i_machcthr="$undef"
20544 fi
20545
20546
20547
20548 : see if this is a mntent.h system
20549 set mntent.h i_mntent
20550 eval $inhdr
20551
20552 : see if ndbm.h is available
20553 set ndbm.h t_ndbm
20554 eval $inhdr
20555
20556 case "$t_ndbm" in
20557 $undef)
20558     # Some Linux distributions such as RedHat 7.1 put the
20559     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20560     if $test -f /usr/include/gdbm/ndbm.h; then
20561         echo '<gdbm/ndbm.h> found.'
20562         ccflags="$ccflags -I/usr/include/gdbm"
20563         cppflags="$cppflags -I/usr/include/gdbm"
20564         t_ndbm=$define
20565     fi
20566     ;;
20567 esac
20568
20569 case "$t_ndbm" in
20570 $define)
20571         : see if dbm_open exists
20572         set dbm_open d_dbm_open
20573         eval $inlibc
20574         case "$d_dbm_open" in
20575         $undef)
20576                 t_ndbm="$undef"
20577                 echo "We won't be including <ndbm.h>"
20578                 ;;
20579         esac
20580         ;;
20581 esac
20582 val="$t_ndbm"
20583 set i_ndbm
20584 eval $setvar
20585
20586 : see if net/errno.h is available
20587 val=''
20588 set net/errno.h val
20589 eval $inhdr
20590
20591 : Unfortunately, it causes problems on some systems.  Arrgh.
20592 case "$val" in
20593 $define)
20594         cat > try.c <<'EOM'
20595 #include <stdio.h>
20596 #include <errno.h>
20597 #include <net/errno.h>
20598 int func()
20599 {
20600         return ENOTSOCK;
20601 }
20602 EOM
20603         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20604                 echo "We'll be including <net/errno.h>." >&4
20605         else
20606                 echo "We won't be including <net/errno.h>." >&4
20607                 val="$undef"
20608         fi
20609         $rm_try
20610         ;;
20611 esac
20612 set i_neterrno
20613 eval $setvar
20614
20615 : see if netinet/tcp.h is available
20616 set netinet/tcp.h i_netinettcp
20617 eval $inhdr
20618
20619 : see if this is a poll.h system
20620 set poll.h i_poll
20621 eval $inhdr
20622
20623 : see if this is a prot.h system
20624 set prot.h i_prot
20625 eval $inhdr
20626
20627 echo " "
20628 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20629 $cat <<'EOSH' > Cppsym.know
20630 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20631 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20632 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20633 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20634 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20635 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20636 bull c cadmus clipper CMU COFF COMPILER_VERSION
20637 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20638 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20639 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20640 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20641 GLIBC GLIBC_MINOR
20642 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20643 H3050R H3050RX hbullx20 hcx host_mips
20644 hp200 hp300 hp700 HP700 hp800 hp9000
20645 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20646 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20647 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20648 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20649 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20650 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20651 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20652 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20653 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20654 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20655 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20656 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20657 MATH_HAS_NO_SIDE_EFFECTS
20658 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20659 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20660 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20661 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20662 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20663 NetBSD news1500 news1700 news1800 news1900 news3700
20664 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20665 ns32016 ns32332 ns32k nsc32000
20666 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20667 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20668 pc532 pdp11 PGC PIC plexus PORTAR posix
20669 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20670 POSIX_C_SOURCE POSIX_SOURCE POWER
20671 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20672 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20673 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20674 sony sony_news sonyrisc sparc sparclite spectrum
20675 stardent stdc STDC_EXT stratos sun sun3 sun386
20676 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20677 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20678 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20679 sysV68 sysV88 Tek4132 Tek4300 titan
20680 TM3200 TM5400 TM5600
20681 tower tower32 tower32_200 tower32_600 tower32_700
20682 tower32_800 tower32_850 tss
20683 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20684 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20685 unix UNIX95 UNIX99 unixpc unos
20686 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20687 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20688 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20689 USGr4 USGr4_2
20690 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20691 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20692 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20693 z8000
20694 EOSH
20695 # Maybe put other stuff here too.
20696 cat <<EOSH >>Cppsym.know
20697 $osname
20698 EOSH
20699 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20700 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20701 $cat Cppsym.know > Cppsym.c
20702 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20703 $rm -f Cppsym.a Cppsym.b Cppsym.c
20704 cat <<EOSH > Cppsym
20705 $startsh
20706 if $test \$# -gt 0; then
20707     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20708     if $test -s Cppsym.got; then
20709         $rm -f Cppsym.got
20710         exit 0
20711     fi
20712     $rm -f Cppsym.got
20713     exit 1
20714 else
20715     $tr " " "$trnl" | ./Cppsym.try
20716     exit 0
20717 fi
20718 EOSH
20719 chmod +x Cppsym
20720 $eunicefix Cppsym
20721 cat <<EOSH > Cppsym.try
20722 $startsh
20723 cat <<'EOCP' > try.c
20724 #include <stdio.h>
20725 #if cpp_stuff == 1
20726 #define STRINGIFY(a)    "a"
20727 #endif
20728 #if cpp_stuff == 42
20729 #define StGiFy(a)  #a
20730 #define STRINGIFY(a)    StGiFy(a)
20731 #endif
20732 #if $cpp_stuff != 1 && $cpp_stuff != 42
20733 #   include "Bletch: How does this C preprocessor stringify macros?"
20734 #endif
20735 int main() {
20736 EOCP
20737 $awk \\
20738 EOSH
20739 cat <<'EOSH' >> Cppsym.try
20740 'length($1) > 0 {
20741     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20742     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20743     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20744     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20745 }'       >> try.c
20746 echo 'return 0;}' >> try.c
20747 EOSH
20748 cat <<EOSH >> Cppsym.try
20749 ccflags="$ccflags"
20750 case "$osname-$gccversion" in
20751 irix-) ccflags="\$ccflags -woff 1178" ;;
20752 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20753 esac
20754 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20755 EOSH
20756 chmod +x Cppsym.try
20757 $eunicefix Cppsym.try
20758 ./Cppsym < Cppsym.know > Cppsym.true
20759 : Add in any linux cpp "predefined macros":
20760 case "$osname::$gccversion" in
20761   *linux*::*.*)
20762     tHdrH=_tmpHdr
20763     rm -f $tHdrH'.h' $tHdrH
20764     touch $tHdrH'.h'
20765     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20766        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20767        if [ -s $tHdrH'_cppsym.real' ]; then
20768           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20769        fi
20770     fi
20771     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20772   ;;
20773 esac
20774 : now check the C compiler for additional symbols
20775 postprocess_cc_v=''
20776 case "$osname" in
20777 aix) postprocess_cc_v="|$tr , ' '" ;;
20778 esac
20779 $cat >ccsym <<EOS
20780 $startsh
20781 $cat >tmp.c <<EOF
20782 extern int foo;
20783 EOF
20784 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20785 do
20786         case "\$i" in
20787         -D*) echo "\$i" | $sed 's/^-D//';;
20788         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20789         esac
20790 done
20791 $rm_try
20792 EOS
20793 postprocess_cc_v=''
20794 chmod +x ccsym
20795 $eunicefix ccsym
20796 ./ccsym > ccsym1.raw
20797 if $test -s ccsym1.raw; then
20798        $sort ccsym1.raw | $uniq >ccsym.raw
20799 else
20800        mv ccsym1.raw ccsym.raw
20801 fi
20802
20803 $awk '/\=/ { print $0; next }
20804         { print $0"=1" }' ccsym.raw >ccsym.list
20805 $comm -13 Cppsym.true ccsym.list >ccsym.own
20806 $comm -12 Cppsym.true ccsym.list >ccsym.com
20807 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20808 also=''
20809 if $test -z ccsym.raw; then
20810         echo "Your C compiler doesn't seem to define any symbols!" >&4
20811         echo " "
20812         echo "However, your C preprocessor defines the following symbols:"
20813         $cat Cppsym.true
20814         ccsymbols=''
20815         cppsymbols=`$cat Cppsym.true`
20816         cppsymbols=`echo $cppsymbols`
20817         cppccsymbols="$cppsymbols"
20818 else
20819         if $test -s ccsym.com; then
20820                 echo "Your C compiler and pre-processor define these symbols:"
20821                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20822                 also='also '
20823                 symbols='ones'
20824                 cppccsymbols=`$cat ccsym.com`
20825                 cppccsymbols=`echo $cppccsymbols`
20826                 $test "$silent" || sleep 1
20827         fi
20828         if $test -s ccsym.cpp; then
20829                 $test "$also" && echo " "
20830                 echo "Your C pre-processor ${also}defines the following symbols:"
20831                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20832                 also='further '
20833                 cppsymbols=`$cat ccsym.cpp`
20834                 cppsymbols=`echo $cppsymbols`
20835                 $test "$silent" || sleep 1
20836         fi
20837         if $test -s ccsym.own; then
20838                 $test "$also" && echo " "
20839                 echo "Your C compiler ${also}defines the following cpp symbols:"
20840                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20841                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20842                 ccsymbols=`$cat ccsym.own`
20843                 ccsymbols=`echo $ccsymbols`
20844                 $test "$silent" || sleep 1
20845         fi
20846 fi
20847
20848 : see if this is a termio system
20849 val="$undef"
20850 val2="$undef"
20851 val3="$undef"
20852 if $test `./findhdr termios.h`; then
20853         set tcsetattr i_termios
20854         eval $inlibc
20855         val3="$i_termios"
20856 fi
20857 echo " "
20858 case "$val3" in
20859 "$define") echo "You have POSIX termios.h... good!" >&4;;
20860 *) if ./Cppsym pyr; then
20861                 case "`/bin/universe`" in
20862                 ucb) if $test `./findhdr sgtty.h`; then
20863                                 val2="$define"
20864                                 echo "<sgtty.h> found." >&4
20865                         else
20866                                 echo "System is pyramid with BSD universe."
20867                                 echo "<sgtty.h> not found--you could have problems." >&4
20868                         fi;;
20869                 *) if $test `./findhdr termio.h`; then
20870                                 val="$define"
20871                                 echo "<termio.h> found." >&4
20872                         else
20873                                 echo "System is pyramid with USG universe."
20874                                 echo "<termio.h> not found--you could have problems." >&4
20875                         fi;;
20876                 esac
20877         elif ./usg; then
20878                 if $test `./findhdr termio.h`; then
20879                         echo "<termio.h> found." >&4
20880                         val="$define"
20881                 elif $test `./findhdr sgtty.h`; then
20882                         echo "<sgtty.h> found." >&4
20883                         val2="$define"
20884                 else
20885 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20886                 fi
20887         else
20888                 if $test `./findhdr sgtty.h`; then
20889                         echo "<sgtty.h> found." >&4
20890                         val2="$define"
20891                 elif $test `./findhdr termio.h`; then
20892                         echo "<termio.h> found." >&4
20893                         val="$define"
20894                 else
20895 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20896                 fi
20897         fi;;
20898 esac
20899 set i_termio; eval $setvar
20900 val=$val2; set i_sgtty; eval $setvar
20901 val=$val3; set i_termios; eval $setvar
20902
20903 : see if stddef is available
20904 set stddef.h i_stddef
20905 eval $inhdr
20906
20907 : see if sys/access.h is available
20908 set sys/access.h i_sysaccess
20909 eval $inhdr
20910
20911 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20912 set sys/filio.h i_sysfilio
20913 eval $inhdr
20914 echo " "
20915 if $test `./findhdr sys/ioctl.h`; then
20916         val="$define"
20917         echo '<sys/ioctl.h> found.' >&4
20918 else
20919         val="$undef"
20920         if $test $i_sysfilio = "$define"; then
20921             echo '<sys/ioctl.h> NOT found.' >&4
20922         else
20923                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20924                 $test $i_termio = "$define" && xxx="termio.h"
20925                 $test $i_termios = "$define" && xxx="termios.h"
20926 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20927         fi
20928 fi
20929 set i_sysioctl
20930 eval $setvar
20931
20932 : see if socket ioctl defs are in sys/sockio.h
20933 echo " "
20934 xxx=`./findhdr sys/sockio.h`
20935 if $test "$xxx"; then
20936         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20937                 val="$define"
20938                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20939         else
20940                 val="$undef"
20941                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20942         fi
20943 else
20944         val="$undef"
20945         $cat <<EOM
20946 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20947 EOM
20948 fi
20949 set i_syssockio
20950 eval $setvar
20951
20952
20953 : see if this is a syslog.h system
20954 set syslog.h i_syslog
20955 eval $inhdr
20956
20957
20958 : see if this is a sys/mode.h system
20959 set sys/mode.h i_sysmode
20960 eval $inhdr
20961
20962 : see if sys/resource.h has to be included
20963 set sys/resource.h i_sysresrc
20964 eval $inhdr
20965
20966 : see if sys/security.h is available
20967 set sys/security.h i_syssecrt
20968 eval $inhdr
20969
20970 : see if this is a sys/statvfs.h system
20971 set sys/statvfs.h i_sysstatvfs
20972 eval $inhdr
20973
20974 : see if this is a sys/un.h system
20975 set sys/un.h i_sysun
20976 eval $inhdr
20977
20978
20979 : see if this is a sys/utsname.h system
20980 set sys/utsname.h i_sysutsname
20981 eval $inhdr
20982
20983 : see if this is a syswait system
20984 set sys/wait.h i_syswait
20985 eval $inhdr
20986
20987 : see if this is a ustat.h system
20988 set ustat.h i_ustat
20989 eval $inhdr
20990
20991 : see if this is an utime system
20992 set utime.h i_utime
20993 eval $inhdr
20994
20995 : see if this is a values.h system
20996 set values.h i_values
20997 eval $inhdr
20998
20999 : see if this is a vfork system
21000 case "$d_vfork" in
21001 "$define")
21002         set vfork.h i_vfork
21003         eval $inhdr
21004         ;;
21005 *)
21006         i_vfork="$undef"
21007         ;;
21008 esac
21009
21010 echo " "
21011 echo "Looking for extensions..." >&4
21012 : If we are using the old config.sh, known_extensions may contain
21013 : old or inaccurate or duplicate values.
21014 known_extensions=''
21015 nonxs_extensions=''
21016 : We do not use find because it might not be available.
21017 : We do not just use MANIFEST because the user may have dropped
21018 : some additional extensions into the source tree and expect them
21019 : to be built.
21020
21021 : Function to recursively find available extensions, ignoring DynaLoader
21022 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21023 find_extensions='
21024     for xxx in *; do
21025         case "$xxx" in
21026             DynaLoader|dynaload) ;;
21027             *)
21028             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21029                 known_extensions="$known_extensions $1$xxx";
21030             elif $test -f $xxx/Makefile.PL; then
21031                 nonxs_extensions="$nonxs_extensions $1$xxx";
21032             else
21033                 if $test -d $xxx -a $# -lt 10; then
21034                     set $1$xxx/ $*;
21035                     cd "$xxx";
21036                     eval $find_extensions;
21037                     cd ..;
21038                     shift;
21039                 fi;
21040             fi
21041             ;;
21042         esac;
21043     done'
21044 tdir=`pwd`
21045 cd "$rsrc/ext"
21046 set X
21047 shift
21048 eval $find_extensions
21049 # Special case:  Add in threads/shared since it is not picked up by the
21050 # recursive find above (and adding in general recursive finding breaks
21051 # SDBM_File/sdbm).  A.D.  10/25/2001.
21052 known_extensions="$known_extensions threads/shared"
21053 set X $known_extensions
21054 shift
21055 known_extensions="$*"
21056 #  Ditto for IO/Compress/Base and IO/Compress/Zlib
21057 nonxs_extensions="$nonxs_extensions IO/Compress/Base IO/Compress/Zlib"
21058 set X $nonxs_extensions
21059 shift
21060 nonxs_extensions="$*"
21061 cd "$tdir"
21062
21063 : Now see which are supported on this system.
21064 avail_ext=''
21065 for xxx in $known_extensions ; do
21066         case "$xxx" in
21067         DB_File|db_file)
21068                 case "$i_db" in
21069                 $define) avail_ext="$avail_ext $xxx" ;;
21070                 esac
21071                 ;;
21072         GDBM_File|gdbm_fil)
21073                 case "$i_gdbm" in
21074                 $define) avail_ext="$avail_ext $xxx" ;;
21075                 esac
21076                 ;;
21077         I18N/Langinfo|i18n_lan)
21078                 case "$i_langinfo$d_nl_langinfo" in
21079                 $define$define) avail_ext="$avail_ext $xxx" ;;
21080                 esac
21081                 ;;
21082         NDBM_File|ndbm_fil)
21083                 case "$i_ndbm" in
21084                 $define)
21085                     case "$osname-$use64bitint" in
21086                     hpux-define)
21087                         case "$libs" in
21088                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21089                         esac
21090                         ;;
21091                     *) avail_ext="$avail_ext $xxx" ;;
21092                     esac
21093                     ;;
21094                 esac
21095                 ;;
21096         ODBM_File|odbm_fil)
21097                 case "${i_dbm}${i_rpcsvcdbm}" in
21098                 *"${define}"*)
21099                     case "$osname-$use64bitint" in
21100                     hpux-define)
21101                         case "$libs" in
21102                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21103                         esac
21104                         ;;
21105                     *) avail_ext="$avail_ext $xxx" ;;
21106                     esac
21107                     ;;
21108                 esac
21109                 ;;
21110         POSIX|posix)
21111                 case "$useposix" in
21112                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21113                 esac
21114                 ;;
21115         Opcode|opcode)
21116                 case "$useopcode" in
21117                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21118                 esac
21119                 ;;
21120         Socket|socket)
21121                 case "$d_socket" in
21122                 true|$define|y)
21123                     case "$osname" in
21124                     beos) ;; # not unless BONE
21125                     *) avail_ext="$avail_ext $xxx" ;;
21126                     esac
21127                     ;;
21128                 esac
21129                 ;;
21130         Sys/Syslog|sys/syslog)
21131                 : XXX syslog requires socket
21132                 case "$d_socket" in
21133                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21134                 esac
21135                 ;;
21136         Thread|thread)
21137                 case "$usethreads" in
21138                 true|$define|y)
21139                         case "$useithreads" in
21140                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21141                         esac
21142                 esac
21143                 ;;
21144         Win32*)
21145                 case "$osname" in
21146                 cygwin) avail_ext="$avail_ext $xxx" ;;
21147                 esac
21148                 ;;
21149         XS/APItest|xs/apitest)
21150                 # This is just for testing.  Skip it unless we have dynamic loading.
21151
21152                 case "$usedl" in
21153                 $define) avail_ext="$avail_ext $xxx" ;;
21154                 esac
21155                 ;;
21156         XS/Typemap|xs/typemap)
21157                 # This is just for testing.  Skip it unless we have dynamic loading.
21158                 case "$usedl" in
21159                 $define) avail_ext="$avail_ext $xxx" ;;
21160                 esac
21161                 ;;
21162         threads|threads/shared)
21163                 # threads and threads::shared are special cases.
21164                 # To stop people from asking "Perl 5.8.0 was supposed
21165                 # to have this new fancy threads implementation but my
21166                 # perl doesn't have it" and from people trying to
21167                 # (re)install the threads module using CPAN.pm and
21168                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21169                 # the threads.pm and threads/shared.pm will always be
21170                 # there, croaking informatively ("you need to rebuild
21171                 # all of Perl with threads, sorry") when threads haven't
21172                 # been compiled in.
21173                 # --jhi
21174                 avail_ext="$avail_ext $xxx"
21175                 ;;
21176         IPC/SysV|ipc/sysv)
21177                 : XXX Do we need a useipcsysv variable here
21178                 case "${d_msg}${d_sem}${d_shm}" in
21179                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21180                 esac
21181                 ;;
21182         *)      avail_ext="$avail_ext $xxx"
21183                 ;;
21184         esac
21185 done
21186
21187 set X $avail_ext
21188 shift
21189 avail_ext="$*"
21190
21191 case "$onlyextensions" in
21192 '') ;;
21193 *)  keepextensions=''
21194     echo "You have requested that only certains extensions be included..." >&4
21195     for i in $onlyextensions; do
21196         case " $avail_ext " in
21197         *" $i "*)
21198             echo "Keeping extension $i."
21199             keepextensions="$keepextensions $i"
21200             ;;
21201         *) echo "Ignoring extension $i." ;;
21202         esac
21203     done
21204     avail_ext="$keepextensions"
21205     ;;
21206 esac
21207
21208 case "$noextensions" in
21209 '') ;;
21210 *)  keepextensions=''
21211     echo "You have requested that certain extensions be ignored..." >&4
21212     for i in $avail_ext; do
21213         case " $noextensions " in
21214         *" $i "*) echo "Ignoring extension $i." ;;
21215         *) echo "Keeping extension $i.";
21216            keepextensions="$keepextensions $i"
21217            ;;
21218         esac
21219     done
21220     avail_ext="$keepextensions"
21221     ;;
21222 esac
21223
21224 : Now see which nonxs extensions are supported on this system.
21225 : For now assume all are.
21226 nonxs_ext=''
21227 for xxx in $nonxs_extensions ; do
21228         case "$xxx" in
21229         *)      nonxs_ext="$nonxs_ext $xxx"
21230                 ;;
21231         esac
21232 done
21233
21234 set X $nonxs_ext
21235 shift
21236 nonxs_ext="$*"
21237
21238 case $usedl in
21239 $define)
21240         $cat <<EOM
21241 A number of extensions are supplied with $package.  You may choose to
21242 compile these extensions for dynamic loading (the default), compile
21243 them into the $package executable (static loading), or not include
21244 them at all.  Answer "none" to include no extensions.
21245 Note that DynaLoader is always built and need not be mentioned here.
21246
21247 EOM
21248         case "$dynamic_ext" in
21249         '')
21250                 : Exclude those listed in static_ext
21251                 dflt=''
21252                 for xxx in $avail_ext; do
21253                         case " $static_ext " in
21254                         *" $xxx "*) ;;
21255                         *) dflt="$dflt $xxx" ;;
21256                         esac
21257                 done
21258                 set X $dflt
21259                 shift
21260                 dflt="$*"
21261                 ;;
21262         *)      dflt="$dynamic_ext"
21263                 # Perhaps we are reusing an old out-of-date config.sh.
21264                 case "$hint" in
21265                 previous)
21266                         if test X"$dynamic_ext" != X"$avail_ext"; then
21267                                 $cat <<EOM
21268 NOTICE:  Your previous config.sh list may be incorrect.
21269 The extensions now available to you are
21270         ${avail_ext}
21271 but the default list from your previous config.sh is
21272         ${dynamic_ext}
21273
21274 EOM
21275                         fi
21276                         ;;
21277                 esac
21278                 ;;
21279         esac
21280         case "$dflt" in
21281         '')     dflt=none;;
21282         esac
21283         rp="What extensions do you wish to load dynamically?"
21284         . ./myread
21285         case "$ans" in
21286         none) dynamic_ext=' ' ;;
21287         *) dynamic_ext="$ans" ;;
21288         esac
21289
21290         case "$static_ext" in
21291         '')
21292                 : Exclude those already listed in dynamic linking
21293                 dflt=''
21294                 for xxx in $avail_ext; do
21295                         case " $dynamic_ext " in
21296                         *" $xxx "*) ;;
21297                         *) dflt="$dflt $xxx" ;;
21298                         esac
21299                 done
21300                 set X $dflt
21301                 shift
21302                 dflt="$*"
21303                 ;;
21304         *)  dflt="$static_ext"
21305                 ;;
21306         esac
21307
21308         case "$dflt" in
21309         '')     dflt=none;;
21310         esac
21311         rp="What extensions do you wish to load statically?"
21312         . ./myread
21313         case "$ans" in
21314         none) static_ext=' ' ;;
21315         *) static_ext="$ans" ;;
21316         esac
21317         ;;
21318 *)
21319         $cat <<EOM
21320 A number of extensions are supplied with $package.  Answer "none"
21321 to include no extensions.
21322 Note that DynaLoader is always built and need not be mentioned here.
21323
21324 EOM
21325         case "$static_ext" in
21326         '') dflt="$avail_ext" ;;
21327         *)      dflt="$static_ext"
21328                 # Perhaps we are reusing an old out-of-date config.sh.
21329                 case "$hint" in
21330                 previous)
21331                         if test X"$static_ext" != X"$avail_ext"; then
21332                                 $cat <<EOM
21333 NOTICE:  Your previous config.sh list may be incorrect.
21334 The extensions now available to you are
21335         ${avail_ext}
21336 but the default list from your previous config.sh is
21337         ${static_ext}
21338
21339 EOM
21340                         fi
21341                         ;;
21342                 esac
21343                 ;;
21344         esac
21345         : Exclude those that are not xs extensions
21346         case "$dflt" in
21347         '')     dflt=none;;
21348         esac
21349         rp="What extensions do you wish to include?"
21350         . ./myread
21351         case "$ans" in
21352         none) static_ext=' ' ;;
21353         *) static_ext="$ans" ;;
21354         esac
21355         ;;
21356 esac
21357 #
21358 # Encode is a special case.  If we are building Encode as a static
21359 # extension, we need to explicitly list its subextensions as well.
21360 # For other nested extensions, this is handled automatically by
21361 # the appropriate Makefile.PL.
21362 case " $static_ext " in
21363         *" Encode "*) # Add the subextensions of Encode
21364         cd "$rsrc/ext"
21365         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21366                 static_ext="$static_ext Encode/$xxx"
21367         done
21368         cd "$tdir"
21369         ;;
21370 esac
21371
21372 set X $dynamic_ext $static_ext $nonxs_ext
21373 shift
21374 extensions="$*"
21375
21376 # Sanity check:  We require an extension suitable for use with
21377 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21378 # should show up as failures in the test suite, but it's helpful to
21379 # catch them now.) The 'extensions' list is normally sorted
21380 # alphabetically, so we need to accept either
21381 #    DB_File ... Fcntl ... IO  ....
21382 # or something like
21383 #    Fcntl ... NDBM_File ... IO  ....
21384 case " $extensions"  in
21385 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21386 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21387 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21388 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21389    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21390    ;;
21391 esac
21392
21393 : Remove libraries needed only for extensions
21394 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21395 : The exception is SunOS 4.x, which needs them.
21396 case "${osname}X${osvers}" in
21397 sunos*X4*)
21398     perllibs="$libs"
21399     ;;
21400 *) case "$usedl" in
21401     $define|true|[yY]*)
21402             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21403             shift
21404             perllibs="$*"
21405             ;;
21406     *)  perllibs="$libs"
21407             ;;
21408     esac
21409     ;;
21410 esac
21411
21412 : Remove build directory name from cppstdin so it can be used from
21413 : either the present location or the final installed location.
21414 echo " "
21415 : Get out of the UU directory to get correct path name.
21416 cd ..
21417 case "$cppstdin" in
21418 `pwd`/cppstdin)
21419         echo "Stripping down cppstdin path name"
21420         cppstdin=cppstdin
21421         ;;
21422 esac
21423 cd UU
21424
21425 : end of configuration questions
21426 echo " "
21427 echo "End of configuration questions."
21428 echo " "
21429
21430 : back to where it started
21431 if test -d ../UU; then
21432         cd ..
21433 fi
21434
21435 : configuration may be patched via a 'config.arch' file
21436 if $test -f config.arch; then
21437         echo "I see a config.arch file, loading it."
21438         . ./config.arch
21439 fi
21440
21441 : configuration may be patched via a 'config.over' file
21442 if $test -f config.over; then
21443         echo " "
21444         dflt=y
21445         rp='I see a config.over file.  Do you wish to load it?'
21446         . UU/myread
21447         case "$ans" in
21448         n*) echo "OK, I'll ignore it.";;
21449         *)      . ./config.over
21450                 echo "Configuration override changes have been loaded."
21451                 ;;
21452         esac
21453 fi
21454
21455 : in case they want portability, strip down executable paths
21456 case "$d_portable" in
21457 "$define")
21458         echo " "
21459         echo "Stripping down executable paths..." >&4
21460         for file in $loclist $trylist; do
21461                 eval temp=\$$file
21462                 eval $file=`basename $temp`
21463         done
21464         ;;
21465 esac
21466
21467 : create config.sh file
21468 echo " "
21469 echo "Creating config.sh..." >&4
21470 $spitshell <<EOT >config.sh
21471 $startsh
21472 #
21473 # This file was produced by running the Configure script. It holds all the
21474 # definitions figured out by Configure. Should you modify one of these values,
21475 # do not forget to propagate your changes by running "Configure -der". You may
21476 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21477 #
21478
21479 # Package name      : $package
21480 # Source directory  : $src
21481 # Configuration time: $cf_time
21482 # Configured by     : $cf_by
21483 # Target system     : $myuname
21484
21485 Author='$Author'
21486 Date='$Date'
21487 Header='$Header'
21488 Id='$Id'
21489 Locker='$Locker'
21490 Log='$Log'
21491 Mcc='$Mcc'
21492 RCSfile='$RCSfile'
21493 Revision='$Revision'
21494 Source='$Source'
21495 State='$State'
21496 _a='$_a'
21497 _exe='$_exe'
21498 _o='$_o'
21499 afs='$afs'
21500 afsroot='$afsroot'
21501 alignbytes='$alignbytes'
21502 ansi2knr='$ansi2knr'
21503 aphostname='$aphostname'
21504 api_revision='$api_revision'
21505 api_subversion='$api_subversion'
21506 api_version='$api_version'
21507 api_versionstring='$api_versionstring'
21508 ar='$ar'
21509 archlib='$archlib'
21510 archlibexp='$archlibexp'
21511 archname64='$archname64'
21512 archname='$archname'
21513 archobjs='$archobjs'
21514 asctime_r_proto='$asctime_r_proto'
21515 awk='$awk'
21516 baserev='$baserev'
21517 bash='$bash'
21518 bin='$bin'
21519 binexp='$binexp'
21520 bison='$bison'
21521 byacc='$byacc'
21522 byteorder='$byteorder'
21523 c='$c'
21524 castflags='$castflags'
21525 cat='$cat'
21526 cc='$cc'
21527 cccdlflags='$cccdlflags'
21528 ccdlflags='$ccdlflags'
21529 ccflags='$ccflags'
21530 ccflags_uselargefiles='$ccflags_uselargefiles'
21531 ccname='$ccname'
21532 ccsymbols='$ccsymbols'
21533 ccversion='$ccversion'
21534 cf_by='$cf_by'
21535 cf_email='$cf_email'
21536 cf_time='$cf_time'
21537 charsize='$charsize'
21538 chgrp='$chgrp'
21539 chmod='$chmod'
21540 chown='$chown'
21541 clocktype='$clocktype'
21542 comm='$comm'
21543 compress='$compress'
21544 contains='$contains'
21545 cp='$cp'
21546 cpio='$cpio'
21547 cpp='$cpp'
21548 cpp_stuff='$cpp_stuff'
21549 cppccsymbols='$cppccsymbols'
21550 cppflags='$cppflags'
21551 cpplast='$cpplast'
21552 cppminus='$cppminus'
21553 cpprun='$cpprun'
21554 cppstdin='$cppstdin'
21555 cppsymbols='$cppsymbols'
21556 crypt_r_proto='$crypt_r_proto'
21557 cryptlib='$cryptlib'
21558 csh='$csh'
21559 ctermid_r_proto='$ctermid_r_proto'
21560 ctime_r_proto='$ctime_r_proto'
21561 d_Gconvert='$d_Gconvert'
21562 d_PRIEUldbl='$d_PRIEUldbl'
21563 d_PRIFUldbl='$d_PRIFUldbl'
21564 d_PRIGUldbl='$d_PRIGUldbl'
21565 d_PRIXU64='$d_PRIXU64'
21566 d_PRId64='$d_PRId64'
21567 d_PRIeldbl='$d_PRIeldbl'
21568 d_PRIfldbl='$d_PRIfldbl'
21569 d_PRIgldbl='$d_PRIgldbl'
21570 d_PRIi64='$d_PRIi64'
21571 d_PRIo64='$d_PRIo64'
21572 d_PRIu64='$d_PRIu64'
21573 d_PRIx64='$d_PRIx64'
21574 d_SCNfldbl='$d_SCNfldbl'
21575 d__fwalk='$d__fwalk'
21576 d_access='$d_access'
21577 d_accessx='$d_accessx'
21578 d_aintl='$d_aintl'
21579 d_alarm='$d_alarm'
21580 d_archlib='$d_archlib'
21581 d_asctime_r='$d_asctime_r'
21582 d_atolf='$d_atolf'
21583 d_atoll='$d_atoll'
21584 d_attribute_format='$d_attribute_format'
21585 d_attribute_malloc='$d_attribute_malloc'
21586 d_attribute_nonnull='$d_attribute_nonnull'
21587 d_attribute_noreturn='$d_attribute_noreturn'
21588 d_attribute_pure='$d_attribute_pure'
21589 d_attribute_unused='$d_attribute_unused'
21590 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21591 d_bcmp='$d_bcmp'
21592 d_bcopy='$d_bcopy'
21593 d_bsd='$d_bsd'
21594 d_bsdgetpgrp='$d_bsdgetpgrp'
21595 d_bsdsetpgrp='$d_bsdsetpgrp'
21596 d_builtin_choose_expr='$d_builtin_choose_expr'
21597 d_builtin_expect='$d_builtin_expect'
21598 d_bzero='$d_bzero'
21599 d_c99_variadic_macros='$d_c99_variadic_macros'
21600 d_casti32='$d_casti32'
21601 d_castneg='$d_castneg'
21602 d_charvspr='$d_charvspr'
21603 d_chown='$d_chown'
21604 d_chroot='$d_chroot'
21605 d_chsize='$d_chsize'
21606 d_class='$d_class'
21607 d_clearenv='$d_clearenv'
21608 d_closedir='$d_closedir'
21609 d_cmsghdr_s='$d_cmsghdr_s'
21610 d_const='$d_const'
21611 d_copysignl='$d_copysignl'
21612 d_cplusplus='$d_cplusplus'
21613 d_crypt='$d_crypt'
21614 d_crypt_r='$d_crypt_r'
21615 d_csh='$d_csh'
21616 d_ctermid='$d_ctermid'
21617 d_ctermid_r='$d_ctermid_r'
21618 d_ctime_r='$d_ctime_r'
21619 d_cuserid='$d_cuserid'
21620 d_dbl_dig='$d_dbl_dig'
21621 d_dbminitproto='$d_dbminitproto'
21622 d_difftime='$d_difftime'
21623 d_dir_dd_fd='$d_dir_dd_fd'
21624 d_dirfd='$d_dirfd'
21625 d_dirnamlen='$d_dirnamlen'
21626 d_dlerror='$d_dlerror'
21627 d_dlopen='$d_dlopen'
21628 d_dlsymun='$d_dlsymun'
21629 d_dosuid='$d_dosuid'
21630 d_drand48_r='$d_drand48_r'
21631 d_drand48proto='$d_drand48proto'
21632 d_dup2='$d_dup2'
21633 d_eaccess='$d_eaccess'
21634 d_endgrent='$d_endgrent'
21635 d_endgrent_r='$d_endgrent_r'
21636 d_endhent='$d_endhent'
21637 d_endhostent_r='$d_endhostent_r'
21638 d_endnent='$d_endnent'
21639 d_endnetent_r='$d_endnetent_r'
21640 d_endpent='$d_endpent'
21641 d_endprotoent_r='$d_endprotoent_r'
21642 d_endpwent='$d_endpwent'
21643 d_endpwent_r='$d_endpwent_r'
21644 d_endsent='$d_endsent'
21645 d_endservent_r='$d_endservent_r'
21646 d_eofnblk='$d_eofnblk'
21647 d_eunice='$d_eunice'
21648 d_faststdio='$d_faststdio'
21649 d_fchdir='$d_fchdir'
21650 d_fchmod='$d_fchmod'
21651 d_fchown='$d_fchown'
21652 d_fcntl='$d_fcntl'
21653 d_fcntl_can_lock='$d_fcntl_can_lock'
21654 d_fd_macros='$d_fd_macros'
21655 d_fd_set='$d_fd_set'
21656 d_fds_bits='$d_fds_bits'
21657 d_fgetpos='$d_fgetpos'
21658 d_finite='$d_finite'
21659 d_finitel='$d_finitel'
21660 d_flexfnam='$d_flexfnam'
21661 d_flock='$d_flock'
21662 d_flockproto='$d_flockproto'
21663 d_fork='$d_fork'
21664 d_fp_class='$d_fp_class'
21665 d_fpathconf='$d_fpathconf'
21666 d_fpclass='$d_fpclass'
21667 d_fpclassify='$d_fpclassify'
21668 d_fpclassl='$d_fpclassl'
21669 d_fpos64_t='$d_fpos64_t'
21670 d_frexpl='$d_frexpl'
21671 d_fs_data_s='$d_fs_data_s'
21672 d_fseeko='$d_fseeko'
21673 d_fsetpos='$d_fsetpos'
21674 d_fstatfs='$d_fstatfs'
21675 d_fstatvfs='$d_fstatvfs'
21676 d_fsync='$d_fsync'
21677 d_ftello='$d_ftello'
21678 d_ftime='$d_ftime'
21679 d_futimes='$d_futimes'
21680 d_getcwd='$d_getcwd'
21681 d_getespwnam='$d_getespwnam'
21682 d_getfsstat='$d_getfsstat'
21683 d_getgrent='$d_getgrent'
21684 d_getgrent_r='$d_getgrent_r'
21685 d_getgrgid_r='$d_getgrgid_r'
21686 d_getgrnam_r='$d_getgrnam_r'
21687 d_getgrps='$d_getgrps'
21688 d_gethbyaddr='$d_gethbyaddr'
21689 d_gethbyname='$d_gethbyname'
21690 d_gethent='$d_gethent'
21691 d_gethname='$d_gethname'
21692 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21693 d_gethostbyname_r='$d_gethostbyname_r'
21694 d_gethostent_r='$d_gethostent_r'
21695 d_gethostprotos='$d_gethostprotos'
21696 d_getitimer='$d_getitimer'
21697 d_getlogin='$d_getlogin'
21698 d_getlogin_r='$d_getlogin_r'
21699 d_getmnt='$d_getmnt'
21700 d_getmntent='$d_getmntent'
21701 d_getnbyaddr='$d_getnbyaddr'
21702 d_getnbyname='$d_getnbyname'
21703 d_getnent='$d_getnent'
21704 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21705 d_getnetbyname_r='$d_getnetbyname_r'
21706 d_getnetent_r='$d_getnetent_r'
21707 d_getnetprotos='$d_getnetprotos'
21708 d_getpagsz='$d_getpagsz'
21709 d_getpbyname='$d_getpbyname'
21710 d_getpbynumber='$d_getpbynumber'
21711 d_getpent='$d_getpent'
21712 d_getpgid='$d_getpgid'
21713 d_getpgrp2='$d_getpgrp2'
21714 d_getpgrp='$d_getpgrp'
21715 d_getppid='$d_getppid'
21716 d_getprior='$d_getprior'
21717 d_getprotobyname_r='$d_getprotobyname_r'
21718 d_getprotobynumber_r='$d_getprotobynumber_r'
21719 d_getprotoent_r='$d_getprotoent_r'
21720 d_getprotoprotos='$d_getprotoprotos'
21721 d_getprpwnam='$d_getprpwnam'
21722 d_getpwent='$d_getpwent'
21723 d_getpwent_r='$d_getpwent_r'
21724 d_getpwnam_r='$d_getpwnam_r'
21725 d_getpwuid_r='$d_getpwuid_r'
21726 d_getsbyname='$d_getsbyname'
21727 d_getsbyport='$d_getsbyport'
21728 d_getsent='$d_getsent'
21729 d_getservbyname_r='$d_getservbyname_r'
21730 d_getservbyport_r='$d_getservbyport_r'
21731 d_getservent_r='$d_getservent_r'
21732 d_getservprotos='$d_getservprotos'
21733 d_getspnam='$d_getspnam'
21734 d_getspnam_r='$d_getspnam_r'
21735 d_gettimeod='$d_gettimeod'
21736 d_gmtime_r='$d_gmtime_r'
21737 d_gnulibc='$d_gnulibc'
21738 d_grpasswd='$d_grpasswd'
21739 d_hasmntopt='$d_hasmntopt'
21740 d_htonl='$d_htonl'
21741 d_ilogbl='$d_ilogbl'
21742 d_inc_version_list='$d_inc_version_list'
21743 d_index='$d_index'
21744 d_inetaton='$d_inetaton'
21745 d_int64_t='$d_int64_t'
21746 d_isascii='$d_isascii'
21747 d_isfinite='$d_isfinite'
21748 d_isinf='$d_isinf'
21749 d_isnan='$d_isnan'
21750 d_isnanl='$d_isnanl'
21751 d_killpg='$d_killpg'
21752 d_lchown='$d_lchown'
21753 d_ldbl_dig='$d_ldbl_dig'
21754 d_libm_lib_version='$d_libm_lib_version'
21755 d_link='$d_link'
21756 d_localtime_r='$d_localtime_r'
21757 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21758 d_locconv='$d_locconv'
21759 d_lockf='$d_lockf'
21760 d_longdbl='$d_longdbl'
21761 d_longlong='$d_longlong'
21762 d_lseekproto='$d_lseekproto'
21763 d_lstat='$d_lstat'
21764 d_madvise='$d_madvise'
21765 d_malloc_good_size='$d_malloc_good_size'
21766 d_malloc_size='$d_malloc_size'
21767 d_mblen='$d_mblen'
21768 d_mbstowcs='$d_mbstowcs'
21769 d_mbtowc='$d_mbtowc'
21770 d_memchr='$d_memchr'
21771 d_memcmp='$d_memcmp'
21772 d_memcpy='$d_memcpy'
21773 d_memmove='$d_memmove'
21774 d_memset='$d_memset'
21775 d_mkdir='$d_mkdir'
21776 d_mkdtemp='$d_mkdtemp'
21777 d_mkfifo='$d_mkfifo'
21778 d_mkstemp='$d_mkstemp'
21779 d_mkstemps='$d_mkstemps'
21780 d_mktime='$d_mktime'
21781 d_mmap='$d_mmap'
21782 d_modfl='$d_modfl'
21783 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21784 d_modflproto='$d_modflproto'
21785 d_mprotect='$d_mprotect'
21786 d_msg='$d_msg'
21787 d_msg_ctrunc='$d_msg_ctrunc'
21788 d_msg_dontroute='$d_msg_dontroute'
21789 d_msg_oob='$d_msg_oob'
21790 d_msg_peek='$d_msg_peek'
21791 d_msg_proxy='$d_msg_proxy'
21792 d_msgctl='$d_msgctl'
21793 d_msgget='$d_msgget'
21794 d_msghdr_s='$d_msghdr_s'
21795 d_msgrcv='$d_msgrcv'
21796 d_msgsnd='$d_msgsnd'
21797 d_msync='$d_msync'
21798 d_munmap='$d_munmap'
21799 d_mymalloc='$d_mymalloc'
21800 d_nice='$d_nice'
21801 d_nl_langinfo='$d_nl_langinfo'
21802 d_nv_preserves_uv='$d_nv_preserves_uv'
21803 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21804 d_off64_t='$d_off64_t'
21805 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21806 d_oldpthreads='$d_oldpthreads'
21807 d_oldsock='$d_oldsock'
21808 d_open3='$d_open3'
21809 d_pathconf='$d_pathconf'
21810 d_pause='$d_pause'
21811 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21812 d_phostname='$d_phostname'
21813 d_pipe='$d_pipe'
21814 d_poll='$d_poll'
21815 d_portable='$d_portable'
21816 d_printf_format_null='$d_printf_format_null'
21817 d_procselfexe='$d_procselfexe'
21818 d_pseudofork='$d_pseudofork'
21819 d_pthread_atfork='$d_pthread_atfork'
21820 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21821 d_pthread_yield='$d_pthread_yield'
21822 d_pwage='$d_pwage'
21823 d_pwchange='$d_pwchange'
21824 d_pwclass='$d_pwclass'
21825 d_pwcomment='$d_pwcomment'
21826 d_pwexpire='$d_pwexpire'
21827 d_pwgecos='$d_pwgecos'
21828 d_pwpasswd='$d_pwpasswd'
21829 d_pwquota='$d_pwquota'
21830 d_qgcvt='$d_qgcvt'
21831 d_quad='$d_quad'
21832 d_random_r='$d_random_r'
21833 d_readdir64_r='$d_readdir64_r'
21834 d_readdir='$d_readdir'
21835 d_readdir_r='$d_readdir_r'
21836 d_readlink='$d_readlink'
21837 d_readv='$d_readv'
21838 d_recvmsg='$d_recvmsg'
21839 d_rename='$d_rename'
21840 d_rewinddir='$d_rewinddir'
21841 d_rmdir='$d_rmdir'
21842 d_safebcpy='$d_safebcpy'
21843 d_safemcpy='$d_safemcpy'
21844 d_sanemcmp='$d_sanemcmp'
21845 d_sbrkproto='$d_sbrkproto'
21846 d_scalbnl='$d_scalbnl'
21847 d_sched_yield='$d_sched_yield'
21848 d_scm_rights='$d_scm_rights'
21849 d_seekdir='$d_seekdir'
21850 d_select='$d_select'
21851 d_sem='$d_sem'
21852 d_semctl='$d_semctl'
21853 d_semctl_semid_ds='$d_semctl_semid_ds'
21854 d_semctl_semun='$d_semctl_semun'
21855 d_semget='$d_semget'
21856 d_semop='$d_semop'
21857 d_sendmsg='$d_sendmsg'
21858 d_setegid='$d_setegid'
21859 d_seteuid='$d_seteuid'
21860 d_setgrent='$d_setgrent'
21861 d_setgrent_r='$d_setgrent_r'
21862 d_setgrps='$d_setgrps'
21863 d_sethent='$d_sethent'
21864 d_sethostent_r='$d_sethostent_r'
21865 d_setitimer='$d_setitimer'
21866 d_setlinebuf='$d_setlinebuf'
21867 d_setlocale='$d_setlocale'
21868 d_setlocale_r='$d_setlocale_r'
21869 d_setnent='$d_setnent'
21870 d_setnetent_r='$d_setnetent_r'
21871 d_setpent='$d_setpent'
21872 d_setpgid='$d_setpgid'
21873 d_setpgrp2='$d_setpgrp2'
21874 d_setpgrp='$d_setpgrp'
21875 d_setprior='$d_setprior'
21876 d_setproctitle='$d_setproctitle'
21877 d_setprotoent_r='$d_setprotoent_r'
21878 d_setpwent='$d_setpwent'
21879 d_setpwent_r='$d_setpwent_r'
21880 d_setregid='$d_setregid'
21881 d_setresgid='$d_setresgid'
21882 d_setresuid='$d_setresuid'
21883 d_setreuid='$d_setreuid'
21884 d_setrgid='$d_setrgid'
21885 d_setruid='$d_setruid'
21886 d_setsent='$d_setsent'
21887 d_setservent_r='$d_setservent_r'
21888 d_setsid='$d_setsid'
21889 d_setvbuf='$d_setvbuf'
21890 d_sfio='$d_sfio'
21891 d_shm='$d_shm'
21892 d_shmat='$d_shmat'
21893 d_shmatprototype='$d_shmatprototype'
21894 d_shmctl='$d_shmctl'
21895 d_shmdt='$d_shmdt'
21896 d_shmget='$d_shmget'
21897 d_sigaction='$d_sigaction'
21898 d_signbit='$d_signbit'
21899 d_sigprocmask='$d_sigprocmask'
21900 d_sigsetjmp='$d_sigsetjmp'
21901 d_sitearch='$d_sitearch'
21902 d_snprintf='$d_snprintf'
21903 d_sockatmark='$d_sockatmark'
21904 d_sockatmarkproto='$d_sockatmarkproto'
21905 d_socket='$d_socket'
21906 d_socklen_t='$d_socklen_t'
21907 d_sockpair='$d_sockpair'
21908 d_socks5_init='$d_socks5_init'
21909 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21910 d_sqrtl='$d_sqrtl'
21911 d_srand48_r='$d_srand48_r'
21912 d_srandom_r='$d_srandom_r'
21913 d_sresgproto='$d_sresgproto'
21914 d_sresuproto='$d_sresuproto'
21915 d_statblks='$d_statblks'
21916 d_statfs_f_flags='$d_statfs_f_flags'
21917 d_statfs_s='$d_statfs_s'
21918 d_statvfs='$d_statvfs'
21919 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21920 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21921 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21922 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21923 d_stdio_stream_array='$d_stdio_stream_array'
21924 d_stdiobase='$d_stdiobase'
21925 d_stdstdio='$d_stdstdio'
21926 d_strchr='$d_strchr'
21927 d_strcoll='$d_strcoll'
21928 d_strctcpy='$d_strctcpy'
21929 d_strerrm='$d_strerrm'
21930 d_strerror='$d_strerror'
21931 d_strerror_r='$d_strerror_r'
21932 d_strftime='$d_strftime'
21933 d_strlcat='$d_strlcat'
21934 d_strlcpy='$d_strlcpy'
21935 d_strtod='$d_strtod'
21936 d_strtol='$d_strtol'
21937 d_strtold='$d_strtold'
21938 d_strtoll='$d_strtoll'
21939 d_strtoq='$d_strtoq'
21940 d_strtoul='$d_strtoul'
21941 d_strtoull='$d_strtoull'
21942 d_strtouq='$d_strtouq'
21943 d_strxfrm='$d_strxfrm'
21944 d_suidsafe='$d_suidsafe'
21945 d_symlink='$d_symlink'
21946 d_syscall='$d_syscall'
21947 d_syscallproto='$d_syscallproto'
21948 d_sysconf='$d_sysconf'
21949 d_sysernlst='$d_sysernlst'
21950 d_syserrlst='$d_syserrlst'
21951 d_system='$d_system'
21952 d_tcgetpgrp='$d_tcgetpgrp'
21953 d_tcsetpgrp='$d_tcsetpgrp'
21954 d_telldir='$d_telldir'
21955 d_telldirproto='$d_telldirproto'
21956 d_time='$d_time'
21957 d_times='$d_times'
21958 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21959 d_tm_tm_zone='$d_tm_tm_zone'
21960 d_tmpnam_r='$d_tmpnam_r'
21961 d_truncate='$d_truncate'
21962 d_ttyname_r='$d_ttyname_r'
21963 d_tzname='$d_tzname'
21964 d_u32align='$d_u32align'
21965 d_ualarm='$d_ualarm'
21966 d_umask='$d_umask'
21967 d_uname='$d_uname'
21968 d_union_semun='$d_union_semun'
21969 d_unordered='$d_unordered'
21970 d_unsetenv='$d_unsetenv'
21971 d_usleep='$d_usleep'
21972 d_usleepproto='$d_usleepproto'
21973 d_ustat='$d_ustat'
21974 d_vendorarch='$d_vendorarch'
21975 d_vendorbin='$d_vendorbin'
21976 d_vendorlib='$d_vendorlib'
21977 d_vendorscript='$d_vendorscript'
21978 d_vfork='$d_vfork'
21979 d_void_closedir='$d_void_closedir'
21980 d_voidsig='$d_voidsig'
21981 d_voidtty='$d_voidtty'
21982 d_volatile='$d_volatile'
21983 d_vprintf='$d_vprintf'
21984 d_vsnprintf='$d_vsnprintf'
21985 d_wait4='$d_wait4'
21986 d_waitpid='$d_waitpid'
21987 d_wcstombs='$d_wcstombs'
21988 d_wctomb='$d_wctomb'
21989 d_writev='$d_writev'
21990 d_xenix='$d_xenix'
21991 date='$date'
21992 db_hashtype='$db_hashtype'
21993 db_prefixtype='$db_prefixtype'
21994 db_version_major='$db_version_major'
21995 db_version_minor='$db_version_minor'
21996 db_version_patch='$db_version_patch'
21997 defvoidused='$defvoidused'
21998 direntrytype='$direntrytype'
21999 dlext='$dlext'
22000 dlsrc='$dlsrc'
22001 doublesize='$doublesize'
22002 drand01='$drand01'
22003 drand48_r_proto='$drand48_r_proto'
22004 dynamic_ext='$dynamic_ext'
22005 eagain='$eagain'
22006 ebcdic='$ebcdic'
22007 echo='$echo'
22008 egrep='$egrep'
22009 emacs='$emacs'
22010 endgrent_r_proto='$endgrent_r_proto'
22011 endhostent_r_proto='$endhostent_r_proto'
22012 endnetent_r_proto='$endnetent_r_proto'
22013 endprotoent_r_proto='$endprotoent_r_proto'
22014 endpwent_r_proto='$endpwent_r_proto'
22015 endservent_r_proto='$endservent_r_proto'
22016 eunicefix='$eunicefix'
22017 exe_ext='$exe_ext'
22018 expr='$expr'
22019 extensions='$extensions'
22020 extras='$extras'
22021 fflushNULL='$fflushNULL'
22022 fflushall='$fflushall'
22023 find='$find'
22024 firstmakefile='$firstmakefile'
22025 flex='$flex'
22026 fpossize='$fpossize'
22027 fpostype='$fpostype'
22028 freetype='$freetype'
22029 from='$from'
22030 full_ar='$full_ar'
22031 full_csh='$full_csh'
22032 full_sed='$full_sed'
22033 gccansipedantic='$gccansipedantic'
22034 gccosandvers='$gccosandvers'
22035 gccversion='$gccversion'
22036 getgrent_r_proto='$getgrent_r_proto'
22037 getgrgid_r_proto='$getgrgid_r_proto'
22038 getgrnam_r_proto='$getgrnam_r_proto'
22039 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22040 gethostbyname_r_proto='$gethostbyname_r_proto'
22041 gethostent_r_proto='$gethostent_r_proto'
22042 getlogin_r_proto='$getlogin_r_proto'
22043 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22044 getnetbyname_r_proto='$getnetbyname_r_proto'
22045 getnetent_r_proto='$getnetent_r_proto'
22046 getprotobyname_r_proto='$getprotobyname_r_proto'
22047 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22048 getprotoent_r_proto='$getprotoent_r_proto'
22049 getpwent_r_proto='$getpwent_r_proto'
22050 getpwnam_r_proto='$getpwnam_r_proto'
22051 getpwuid_r_proto='$getpwuid_r_proto'
22052 getservbyname_r_proto='$getservbyname_r_proto'
22053 getservbyport_r_proto='$getservbyport_r_proto'
22054 getservent_r_proto='$getservent_r_proto'
22055 getspnam_r_proto='$getspnam_r_proto'
22056 gidformat='$gidformat'
22057 gidsign='$gidsign'
22058 gidsize='$gidsize'
22059 gidtype='$gidtype'
22060 glibpth='$glibpth'
22061 gmake='$gmake'
22062 gmtime_r_proto='$gmtime_r_proto'
22063 gnulibc_version='$gnulibc_version'
22064 grep='$grep'
22065 groupcat='$groupcat'
22066 groupstype='$groupstype'
22067 gzip='$gzip'
22068 h_fcntl='$h_fcntl'
22069 h_sysfile='$h_sysfile'
22070 hint='$hint'
22071 hostcat='$hostcat'
22072 html1dir='$html1dir'
22073 html1direxp='$html1direxp'
22074 html3dir='$html3dir'
22075 html3direxp='$html3direxp'
22076 i16size='$i16size'
22077 i16type='$i16type'
22078 i32size='$i32size'
22079 i32type='$i32type'
22080 i64size='$i64size'
22081 i64type='$i64type'
22082 i8size='$i8size'
22083 i8type='$i8type'
22084 i_arpainet='$i_arpainet'
22085 i_bsdioctl='$i_bsdioctl'
22086 i_crypt='$i_crypt'
22087 i_db='$i_db'
22088 i_dbm='$i_dbm'
22089 i_dirent='$i_dirent'
22090 i_dld='$i_dld'
22091 i_dlfcn='$i_dlfcn'
22092 i_fcntl='$i_fcntl'
22093 i_float='$i_float'
22094 i_fp='$i_fp'
22095 i_fp_class='$i_fp_class'
22096 i_gdbm='$i_gdbm'
22097 i_grp='$i_grp'
22098 i_ieeefp='$i_ieeefp'
22099 i_inttypes='$i_inttypes'
22100 i_langinfo='$i_langinfo'
22101 i_libutil='$i_libutil'
22102 i_limits='$i_limits'
22103 i_locale='$i_locale'
22104 i_machcthr='$i_machcthr'
22105 i_malloc='$i_malloc'
22106 i_math='$i_math'
22107 i_memory='$i_memory'
22108 i_mntent='$i_mntent'
22109 i_ndbm='$i_ndbm'
22110 i_netdb='$i_netdb'
22111 i_neterrno='$i_neterrno'
22112 i_netinettcp='$i_netinettcp'
22113 i_niin='$i_niin'
22114 i_poll='$i_poll'
22115 i_prot='$i_prot'
22116 i_pthread='$i_pthread'
22117 i_pwd='$i_pwd'
22118 i_rpcsvcdbm='$i_rpcsvcdbm'
22119 i_sfio='$i_sfio'
22120 i_sgtty='$i_sgtty'
22121 i_shadow='$i_shadow'
22122 i_socks='$i_socks'
22123 i_stdarg='$i_stdarg'
22124 i_stddef='$i_stddef'
22125 i_stdlib='$i_stdlib'
22126 i_string='$i_string'
22127 i_sunmath='$i_sunmath'
22128 i_sysaccess='$i_sysaccess'
22129 i_sysdir='$i_sysdir'
22130 i_sysfile='$i_sysfile'
22131 i_sysfilio='$i_sysfilio'
22132 i_sysin='$i_sysin'
22133 i_sysioctl='$i_sysioctl'
22134 i_syslog='$i_syslog'
22135 i_sysmman='$i_sysmman'
22136 i_sysmode='$i_sysmode'
22137 i_sysmount='$i_sysmount'
22138 i_sysndir='$i_sysndir'
22139 i_sysparam='$i_sysparam'
22140 i_sysresrc='$i_sysresrc'
22141 i_syssecrt='$i_syssecrt'
22142 i_sysselct='$i_sysselct'
22143 i_syssockio='$i_syssockio'
22144 i_sysstat='$i_sysstat'
22145 i_sysstatfs='$i_sysstatfs'
22146 i_sysstatvfs='$i_sysstatvfs'
22147 i_systime='$i_systime'
22148 i_systimek='$i_systimek'
22149 i_systimes='$i_systimes'
22150 i_systypes='$i_systypes'
22151 i_sysuio='$i_sysuio'
22152 i_sysun='$i_sysun'
22153 i_sysutsname='$i_sysutsname'
22154 i_sysvfs='$i_sysvfs'
22155 i_syswait='$i_syswait'
22156 i_termio='$i_termio'
22157 i_termios='$i_termios'
22158 i_time='$i_time'
22159 i_unistd='$i_unistd'
22160 i_ustat='$i_ustat'
22161 i_utime='$i_utime'
22162 i_values='$i_values'
22163 i_varargs='$i_varargs'
22164 i_varhdr='$i_varhdr'
22165 i_vfork='$i_vfork'
22166 ignore_versioned_solibs='$ignore_versioned_solibs'
22167 inc_version_list='$inc_version_list'
22168 inc_version_list_init='$inc_version_list_init'
22169 incpath='$incpath'
22170 inews='$inews'
22171 initialinstalllocation='$initialinstalllocation'
22172 installarchlib='$installarchlib'
22173 installbin='$installbin'
22174 installhtml1dir='$installhtml1dir'
22175 installhtml3dir='$installhtml3dir'
22176 installman1dir='$installman1dir'
22177 installman3dir='$installman3dir'
22178 installprefix='$installprefix'
22179 installprefixexp='$installprefixexp'
22180 installprivlib='$installprivlib'
22181 installscript='$installscript'
22182 installsitearch='$installsitearch'
22183 installsitebin='$installsitebin'
22184 installsitehtml1dir='$installsitehtml1dir'
22185 installsitehtml3dir='$installsitehtml3dir'
22186 installsitelib='$installsitelib'
22187 installsiteman1dir='$installsiteman1dir'
22188 installsiteman3dir='$installsiteman3dir'
22189 installsitescript='$installsitescript'
22190 installstyle='$installstyle'
22191 installusrbinperl='$installusrbinperl'
22192 installvendorarch='$installvendorarch'
22193 installvendorbin='$installvendorbin'
22194 installvendorhtml1dir='$installvendorhtml1dir'
22195 installvendorhtml3dir='$installvendorhtml3dir'
22196 installvendorlib='$installvendorlib'
22197 installvendorman1dir='$installvendorman1dir'
22198 installvendorman3dir='$installvendorman3dir'
22199 installvendorscript='$installvendorscript'
22200 intsize='$intsize'
22201 issymlink='$issymlink'
22202 ivdformat='$ivdformat'
22203 ivsize='$ivsize'
22204 ivtype='$ivtype'
22205 known_extensions='$known_extensions'
22206 ksh='$ksh'
22207 ld='$ld'
22208 lddlflags='$lddlflags'
22209 ldflags='$ldflags'
22210 ldflags_uselargefiles='$ldflags_uselargefiles'
22211 ldlibpthname='$ldlibpthname'
22212 less='$less'
22213 lib_ext='$lib_ext'
22214 libc='$libc'
22215 libperl='$libperl'
22216 libpth='$libpth'
22217 libs='$libs'
22218 libsdirs='$libsdirs'
22219 libsfiles='$libsfiles'
22220 libsfound='$libsfound'
22221 libspath='$libspath'
22222 libswanted='$libswanted'
22223 libswanted_uselargefiles='$libswanted_uselargefiles'
22224 line='$line'
22225 lint='$lint'
22226 lkflags='$lkflags'
22227 ln='$ln'
22228 lns='$lns'
22229 localtime_r_proto='$localtime_r_proto'
22230 locincpth='$locincpth'
22231 loclibpth='$loclibpth'
22232 longdblsize='$longdblsize'
22233 longlongsize='$longlongsize'
22234 longsize='$longsize'
22235 lp='$lp'
22236 lpr='$lpr'
22237 ls='$ls'
22238 lseeksize='$lseeksize'
22239 lseektype='$lseektype'
22240 mad='$mad'
22241 madlyh='$madlyh'
22242 madlyobj='$madlyobj'
22243 madlysrc='$madlysrc'
22244 mail='$mail'
22245 mailx='$mailx'
22246 make='$make'
22247 make_set_make='$make_set_make'
22248 mallocobj='$mallocobj'
22249 mallocsrc='$mallocsrc'
22250 malloctype='$malloctype'
22251 man1dir='$man1dir'
22252 man1direxp='$man1direxp'
22253 man1ext='$man1ext'
22254 man3dir='$man3dir'
22255 man3direxp='$man3direxp'
22256 man3ext='$man3ext'
22257 mips_type='$mips_type'
22258 mistrustnm='$mistrustnm'
22259 mkdir='$mkdir'
22260 mmaptype='$mmaptype'
22261 modetype='$modetype'
22262 more='$more'
22263 multiarch='$multiarch'
22264 mv='$mv'
22265 myarchname='$myarchname'
22266 mydomain='$mydomain'
22267 myhostname='$myhostname'
22268 myuname='$myuname'
22269 n='$n'
22270 need_va_copy='$need_va_copy'
22271 netdb_hlen_type='$netdb_hlen_type'
22272 netdb_host_type='$netdb_host_type'
22273 netdb_name_type='$netdb_name_type'
22274 netdb_net_type='$netdb_net_type'
22275 nm='$nm'
22276 nm_opt='$nm_opt'
22277 nm_so_opt='$nm_so_opt'
22278 nonxs_ext='$nonxs_ext'
22279 nroff='$nroff'
22280 nvEUformat='$nvEUformat'
22281 nvFUformat='$nvFUformat'
22282 nvGUformat='$nvGUformat'
22283 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22284 nveformat='$nveformat'
22285 nvfformat='$nvfformat'
22286 nvgformat='$nvgformat'
22287 nvsize='$nvsize'
22288 nvtype='$nvtype'
22289 o_nonblock='$o_nonblock'
22290 obj_ext='$obj_ext'
22291 old_pthread_create_joinable='$old_pthread_create_joinable'
22292 optimize='$optimize'
22293 orderlib='$orderlib'
22294 osname='$osname'
22295 osvers='$osvers'
22296 otherlibdirs='$otherlibdirs'
22297 package='$package'
22298 pager='$pager'
22299 passcat='$passcat'
22300 patchlevel='$patchlevel'
22301 path_sep='$path_sep'
22302 perl5='$perl5'
22303 perl='$perl'
22304 perl_patchlevel='$perl_patchlevel'
22305 perladmin='$perladmin'
22306 perllibs='$perllibs'
22307 perlpath='$perlpath'
22308 pg='$pg'
22309 phostname='$phostname'
22310 pidtype='$pidtype'
22311 plibpth='$plibpth'
22312 pmake='$pmake'
22313 pr='$pr'
22314 prefix='$prefix'
22315 prefixexp='$prefixexp'
22316 privlib='$privlib'
22317 privlibexp='$privlibexp'
22318 procselfexe='$procselfexe'
22319 prototype='$prototype'
22320 ptrsize='$ptrsize'
22321 quadkind='$quadkind'
22322 quadtype='$quadtype'
22323 randbits='$randbits'
22324 randfunc='$randfunc'
22325 random_r_proto='$random_r_proto'
22326 randseedtype='$randseedtype'
22327 ranlib='$ranlib'
22328 rd_nodata='$rd_nodata'
22329 readdir64_r_proto='$readdir64_r_proto'
22330 readdir_r_proto='$readdir_r_proto'
22331 revision='$revision'
22332 rm='$rm'
22333 rm_try='$rm_try'
22334 rmail='$rmail'
22335 run='$run'
22336 runnm='$runnm'
22337 sPRIEUldbl='$sPRIEUldbl'
22338 sPRIFUldbl='$sPRIFUldbl'
22339 sPRIGUldbl='$sPRIGUldbl'
22340 sPRIXU64='$sPRIXU64'
22341 sPRId64='$sPRId64'
22342 sPRIeldbl='$sPRIeldbl'
22343 sPRIfldbl='$sPRIfldbl'
22344 sPRIgldbl='$sPRIgldbl'
22345 sPRIi64='$sPRIi64'
22346 sPRIo64='$sPRIo64'
22347 sPRIu64='$sPRIu64'
22348 sPRIx64='$sPRIx64'
22349 sSCNfldbl='$sSCNfldbl'
22350 sched_yield='$sched_yield'
22351 scriptdir='$scriptdir'
22352 scriptdirexp='$scriptdirexp'
22353 sed='$sed'
22354 seedfunc='$seedfunc'
22355 selectminbits='$selectminbits'
22356 selecttype='$selecttype'
22357 sendmail='$sendmail'
22358 setgrent_r_proto='$setgrent_r_proto'
22359 sethostent_r_proto='$sethostent_r_proto'
22360 setlocale_r_proto='$setlocale_r_proto'
22361 setnetent_r_proto='$setnetent_r_proto'
22362 setprotoent_r_proto='$setprotoent_r_proto'
22363 setpwent_r_proto='$setpwent_r_proto'
22364 setservent_r_proto='$setservent_r_proto'
22365 sh='$sh'
22366 shar='$shar'
22367 sharpbang='$sharpbang'
22368 shmattype='$shmattype'
22369 shortsize='$shortsize'
22370 shrpenv='$shrpenv'
22371 shsharp='$shsharp'
22372 sig_count='$sig_count'
22373 sig_name='$sig_name'
22374 sig_name_init='$sig_name_init'
22375 sig_num='$sig_num'
22376 sig_num_init='$sig_num_init'
22377 sig_size='$sig_size'
22378 signal_t='$signal_t'
22379 sitearch='$sitearch'
22380 sitearchexp='$sitearchexp'
22381 sitebin='$sitebin'
22382 sitebinexp='$sitebinexp'
22383 sitehtml1dir='$sitehtml1dir'
22384 sitehtml1direxp='$sitehtml1direxp'
22385 sitehtml3dir='$sitehtml3dir'
22386 sitehtml3direxp='$sitehtml3direxp'
22387 sitelib='$sitelib'
22388 sitelib_stem='$sitelib_stem'
22389 sitelibexp='$sitelibexp'
22390 siteman1dir='$siteman1dir'
22391 siteman1direxp='$siteman1direxp'
22392 siteman3dir='$siteman3dir'
22393 siteman3direxp='$siteman3direxp'
22394 siteprefix='$siteprefix'
22395 siteprefixexp='$siteprefixexp'
22396 sitescript='$sitescript'
22397 sitescriptexp='$sitescriptexp'
22398 sizesize='$sizesize'
22399 sizetype='$sizetype'
22400 sleep='$sleep'
22401 smail='$smail'
22402 so='$so'
22403 sockethdr='$sockethdr'
22404 socketlib='$socketlib'
22405 socksizetype='$socksizetype'
22406 sort='$sort'
22407 spackage='$spackage'
22408 spitshell='$spitshell'
22409 srand48_r_proto='$srand48_r_proto'
22410 srandom_r_proto='$srandom_r_proto'
22411 src='$src'
22412 ssizetype='$ssizetype'
22413 startperl='$startperl'
22414 startsh='$startsh'
22415 static_ext='$static_ext'
22416 stdchar='$stdchar'
22417 stdio_base='$stdio_base'
22418 stdio_bufsiz='$stdio_bufsiz'
22419 stdio_cnt='$stdio_cnt'
22420 stdio_filbuf='$stdio_filbuf'
22421 stdio_ptr='$stdio_ptr'
22422 stdio_stream_array='$stdio_stream_array'
22423 strerror_r_proto='$strerror_r_proto'
22424 strings='$strings'
22425 submit='$submit'
22426 subversion='$subversion'
22427 sysman='$sysman'
22428 tail='$tail'
22429 tar='$tar'
22430 targetarch='$targetarch'
22431 tbl='$tbl'
22432 tee='$tee'
22433 test='$test'
22434 timeincl='$timeincl'
22435 timetype='$timetype'
22436 tmpnam_r_proto='$tmpnam_r_proto'
22437 to='$to'
22438 touch='$touch'
22439 tr='$tr'
22440 trnl='$trnl'
22441 troff='$troff'
22442 ttyname_r_proto='$ttyname_r_proto'
22443 u16size='$u16size'
22444 u16type='$u16type'
22445 u32size='$u32size'
22446 u32type='$u32type'
22447 u64size='$u64size'
22448 u64type='$u64type'
22449 u8size='$u8size'
22450 u8type='$u8type'
22451 uidformat='$uidformat'
22452 uidsign='$uidsign'
22453 uidsize='$uidsize'
22454 uidtype='$uidtype'
22455 uname='$uname'
22456 uniq='$uniq'
22457 uquadtype='$uquadtype'
22458 use5005threads='$use5005threads'
22459 use64bitall='$use64bitall'
22460 use64bitint='$use64bitint'
22461 usecrosscompile='$usecrosscompile'
22462 usedl='$usedl'
22463 usefaststdio='$usefaststdio'
22464 useithreads='$useithreads'
22465 uselargefiles='$uselargefiles'
22466 uselongdouble='$uselongdouble'
22467 usemallocwrap='$usemallocwrap'
22468 usemorebits='$usemorebits'
22469 usemultiplicity='$usemultiplicity'
22470 usemymalloc='$usemymalloc'
22471 usenm='$usenm'
22472 useopcode='$useopcode'
22473 useperlio='$useperlio'
22474 useposix='$useposix'
22475 usereentrant='$usereentrant'
22476 userelocatableinc='$userelocatableinc'
22477 usesfio='$usesfio'
22478 useshrplib='$useshrplib'
22479 usesitecustomize='$usesitecustomize'
22480 usesocks='$usesocks'
22481 usethreads='$usethreads'
22482 usevendorprefix='$usevendorprefix'
22483 usevfork='$usevfork'
22484 usrinc='$usrinc'
22485 uuname='$uuname'
22486 uvXUformat='$uvXUformat'
22487 uvoformat='$uvoformat'
22488 uvsize='$uvsize'
22489 uvtype='$uvtype'
22490 uvuformat='$uvuformat'
22491 uvxformat='$uvxformat'
22492 vendorarch='$vendorarch'
22493 vendorarchexp='$vendorarchexp'
22494 vendorbin='$vendorbin'
22495 vendorbinexp='$vendorbinexp'
22496 vendorhtml1dir='$vendorhtml1dir'
22497 vendorhtml1direxp='$vendorhtml1direxp'
22498 vendorhtml3dir='$vendorhtml3dir'
22499 vendorhtml3direxp='$vendorhtml3direxp'
22500 vendorlib='$vendorlib'
22501 vendorlib_stem='$vendorlib_stem'
22502 vendorlibexp='$vendorlibexp'
22503 vendorman1dir='$vendorman1dir'
22504 vendorman1direxp='$vendorman1direxp'
22505 vendorman3dir='$vendorman3dir'
22506 vendorman3direxp='$vendorman3direxp'
22507 vendorprefix='$vendorprefix'
22508 vendorprefixexp='$vendorprefixexp'
22509 vendorscript='$vendorscript'
22510 vendorscriptexp='$vendorscriptexp'
22511 version='$version'
22512 version_patchlevel_string='$version_patchlevel_string'
22513 versiononly='$versiononly'
22514 vi='$vi'
22515 voidflags='$voidflags'
22516 xlibpth='$xlibpth'
22517 yacc='$yacc'
22518 yaccflags='$yaccflags'
22519 zcat='$zcat'
22520 zip='$zip'
22521 EOT
22522
22523 : Add in command line options if available
22524 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22525
22526 : add special variables
22527 $test -f $src/patchlevel.h && \
22528 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22529 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22530 echo "PERL_CONFIG_SH=true" >>config.sh
22531
22532 : propagate old symbols
22533 if $test -f UU/config.sh; then
22534         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22535         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22536         $sort | $uniq -u >UU/oldsyms
22537         set X `cat UU/oldsyms`
22538         shift
22539         case $# in
22540         0) ;;
22541         *)
22542                 cat <<EOM
22543 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22544 EOM
22545                 echo "# Variables propagated from previous config.sh file." >>config.sh
22546                 for sym in `cat UU/oldsyms`; do
22547                         echo "    Propagating $hint variable "'$'"$sym..."
22548                         eval 'tmp="$'"${sym}"'"'
22549                         echo "$tmp" | \
22550                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22551                 done
22552                 ;;
22553         esac
22554 fi
22555
22556 : Finish up by extracting the .SH files
22557 case "$alldone" in
22558 exit)
22559         $rm -rf UU
22560         echo "Extraction done."
22561         exit 0
22562         ;;
22563 cont)
22564         ;;
22565 '')
22566         dflt=''
22567         nostick=true
22568         $cat <<EOM
22569
22570 If you'd like to make any changes to the config.sh file before I begin
22571 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22572
22573 EOM
22574         rp="Press return or use a shell escape to edit config.sh:"
22575         . UU/myread
22576         nostick=''
22577         case "$ans" in
22578         '') ;;
22579         *) : in case they cannot read
22580                 sh 1>&4 -c "$ans";;
22581         esac
22582         ;;
22583 esac
22584
22585 : if this fails, just run all the .SH files by hand
22586 . ./config.sh
22587
22588 echo " "
22589 exec 1>&4
22590 pwd=`pwd`
22591 . ./UU/extract
22592 cd "$pwd"
22593
22594 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22595         dflt=y
22596         case "$silent" in
22597         true) ;;
22598         *)
22599                 $cat <<EOM
22600
22601 Now you need to generate make dependencies by running "$make depend".
22602 You might prefer to run it in background: "$make depend > makedepend.out &"
22603 It can take a while, so you might not want to run it right now.
22604
22605 EOM
22606                 ;;
22607         esac
22608         rp="Run $make depend now?"
22609         . UU/myread
22610         case "$ans" in
22611         y*)
22612                 $make depend && echo "Now you must run '$make'."
22613                 ;;
22614         *)
22615                 echo "You must run '$make depend' then '$make'."
22616                 ;;
22617         esac
22618 elif test -f [Mm]akefile; then
22619         echo " "
22620         echo "Now you must run a $make."
22621 else
22622         echo "Configure done."
22623 fi
22624
22625 if $test -f Policy.sh; then
22626     $cat <<EOM
22627
22628 If you compile $package on a different machine or from a different object
22629 directory, copy the Policy.sh file from this object directory to the
22630 new one before you run Configure -- this will help you with most of
22631 the policy defaults.
22632
22633 EOM
22634 fi
22635 if $test -f config.msg; then
22636     echo "Hmm.  I also noted the following information while running:"
22637     echo " "
22638     $cat config.msg >&4
22639     $rm -f config.msg
22640 fi
22641 $rm -f kit*isdone ark*isdone
22642 $rm -rf UU
22643
22644 : End of Configure
22645