638ec5b52875cf985ea37d0233fe1b7e07b2e9bb
[p5sagit/p5-mst-13.2.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 Thu Jul 19 15:56:52 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 test -x "${newsh}" || unset newsh
185
186 : if needed set CDPATH to a harmless value that is not chatty
187 : avoid bash 2.02 problems with empty CDPATH.
188 case "$CDPATH" in
189 '')     ;;
190 *)      case "$SHELL" in
191         *bash*) CDPATH='.' ;;
192         *)              CDPATH='' ;;
193         esac
194         ;;
195 esac
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 Mcc=''
225 ar=''
226 awk=''
227 bash=''
228 bison=''
229 byacc=''
230 cat=''
231 chgrp=''
232 chmod=''
233 chown=''
234 comm=''
235 compress=''
236 cp=''
237 cpio=''
238 cpp=''
239 csh=''
240 date=''
241 echo=''
242 egrep=''
243 emacs=''
244 expr=''
245 find=''
246 flex=''
247 gmake=''
248 grep=''
249 gzip=''
250 inews=''
251 ksh=''
252 less=''
253 line=''
254 lint=''
255 ln=''
256 lp=''
257 lpr=''
258 ls=''
259 mail=''
260 mailx=''
261 make=''
262 mkdir=''
263 more=''
264 mv=''
265 nm=''
266 nroff=''
267 perl=''
268 pg=''
269 pmake=''
270 pr=''
271 rm=''
272 rmail=''
273 sed=''
274 sendmail=''
275 shar=''
276 sleep=''
277 smail=''
278 sort=''
279 submit=''
280 tail=''
281 tar=''
282 tbl=''
283 tee=''
284 test=''
285 touch=''
286 tr=''
287 troff=''
288 uname=''
289 uniq=''
290 uuname=''
291 vi=''
292 zcat=''
293 zip=''
294 full_ar=''
295 full_sed=''
296 libswanted=''
297 hint=''
298 myuname=''
299 osname=''
300 osvers=''
301 Author=''
302 Date=''
303 Header=''
304 Id=''
305 Locker=''
306 Log=''
307 RCSfile=''
308 Revision=''
309 Source=''
310 State=''
311 _a=''
312 _exe=''
313 _o=''
314 archobjs=''
315 exe_ext=''
316 firstmakefile=''
317 lib_ext=''
318 obj_ext=''
319 path_sep=''
320 rm_try=''
321 afs=''
322 afsroot=''
323 alignbytes=''
324 ansi2knr=''
325 archlib=''
326 archlibexp=''
327 d_archlib=''
328 installarchlib=''
329 archname=''
330 myarchname=''
331 d_atolf=''
332 d_atoll=''
333 baserev=''
334 bin=''
335 binexp=''
336 initialinstalllocation=''
337 installbin=''
338 userelocatableinc=''
339 byteorder=''
340 cc=''
341 ccflags=''
342 cppflags=''
343 ldflags=''
344 lkflags=''
345 locincpth=''
346 optimize=''
347 cf_email=''
348 cf_by=''
349 cf_time=''
350 charsize=''
351 contains=''
352 cpp_stuff=''
353 cpplast=''
354 cppminus=''
355 cpprun=''
356 cppstdin=''
357 d__fwalk=''
358 d_access=''
359 d_accessx=''
360 d_aintl=''
361 d_alarm=''
362 asctime_r_proto=''
363 d_asctime_r=''
364 d_attribute_format=''
365 d_attribute_malloc=''
366 d_attribute_nonnull=''
367 d_attribute_noreturn=''
368 d_attribute_pure=''
369 d_attribute_unused=''
370 d_attribute_warn_unused_result=''
371 d_printf_format_null=''
372 d_bcmp=''
373 d_bcopy=''
374 d_builtin_choose_expr=''
375 d_builtin_expect=''
376 d_bzero=''
377 d_c99_variadic_macros=''
378 d_casti32=''
379 castflags=''
380 d_castneg=''
381 d_chown=''
382 d_chroot=''
383 d_chsize=''
384 d_class=''
385 d_clearenv=''
386 d_closedir=''
387 d_void_closedir=''
388 d_cmsghdr_s=''
389 d_const=''
390 d_copysignl=''
391 d_cplusplus=''
392 cryptlib=''
393 d_crypt=''
394 crypt_r_proto=''
395 d_crypt_r=''
396 d_csh=''
397 full_csh=''
398 d_ctermid=''
399 ctermid_r_proto=''
400 d_ctermid_r=''
401 ctime_r_proto=''
402 d_ctime_r=''
403 d_cuserid=''
404 d_dbl_dig=''
405 d_dbminitproto=''
406 d_difftime=''
407 d_dir_dd_fd=''
408 d_dirfd=''
409 d_dlerror=''
410 d_dlopen=''
411 d_dlsymun=''
412 d_dosuid=''
413 d_suidsafe=''
414 d_drand48_r=''
415 drand48_r_proto=''
416 d_drand48proto=''
417 d_dup2=''
418 d_eaccess=''
419 d_endgrent=''
420 d_endgrent_r=''
421 endgrent_r_proto=''
422 d_endhent=''
423 d_endhostent_r=''
424 endhostent_r_proto=''
425 d_endnent=''
426 d_endnetent_r=''
427 endnetent_r_proto=''
428 d_endpent=''
429 d_endprotoent_r=''
430 endprotoent_r_proto=''
431 d_endpwent=''
432 d_endpwent_r=''
433 endpwent_r_proto=''
434 d_endsent=''
435 d_endservent_r=''
436 endservent_r_proto=''
437 d_faststdio=''
438 d_fchdir=''
439 d_fchmod=''
440 d_fchown=''
441 d_fcntl=''
442 d_fcntl_can_lock=''
443 d_fd_macros=''
444 d_fd_set=''
445 d_fds_bits=''
446 d_fgetpos=''
447 d_finite=''
448 d_finitel=''
449 d_flexfnam=''
450 d_flock=''
451 d_flockproto=''
452 d_fork=''
453 d_fp_class=''
454 d_fpclass=''
455 d_fpclassify=''
456 d_fpclassl=''
457 d_fpos64_t=''
458 d_frexpl=''
459 d_fs_data_s=''
460 d_fseeko=''
461 d_fsetpos=''
462 d_fstatfs=''
463 d_fsync=''
464 d_ftello=''
465 d_ftime=''
466 d_gettimeod=''
467 d_futimes=''
468 d_Gconvert=''
469 d_getcwd=''
470 d_getespwnam=''
471 d_getfsstat=''
472 d_getgrent=''
473 d_getgrent_r=''
474 getgrent_r_proto=''
475 d_getgrgid_r=''
476 getgrgid_r_proto=''
477 d_getgrnam_r=''
478 getgrnam_r_proto=''
479 d_getgrps=''
480 d_gethbyaddr=''
481 d_gethbyname=''
482 d_gethent=''
483 aphostname=''
484 d_gethname=''
485 d_phostname=''
486 d_uname=''
487 d_gethostbyaddr_r=''
488 gethostbyaddr_r_proto=''
489 d_gethostbyname_r=''
490 gethostbyname_r_proto=''
491 d_gethostent_r=''
492 gethostent_r_proto=''
493 d_gethostprotos=''
494 d_getitimer=''
495 d_getlogin=''
496 d_getlogin_r=''
497 getlogin_r_proto=''
498 d_getmnt=''
499 d_getmntent=''
500 d_getnbyaddr=''
501 d_getnbyname=''
502 d_getnent=''
503 d_getnetbyaddr_r=''
504 getnetbyaddr_r_proto=''
505 d_getnetbyname_r=''
506 getnetbyname_r_proto=''
507 d_getnetent_r=''
508 getnetent_r_proto=''
509 d_getnetprotos=''
510 d_getpagsz=''
511 d_getpent=''
512 d_getpgid=''
513 d_getpgrp2=''
514 d_bsdgetpgrp=''
515 d_getpgrp=''
516 d_getppid=''
517 d_getprior=''
518 d_getpbyname=''
519 d_getpbynumber=''
520 d_getprotobyname_r=''
521 getprotobyname_r_proto=''
522 d_getprotobynumber_r=''
523 getprotobynumber_r_proto=''
524 d_getprotoent_r=''
525 getprotoent_r_proto=''
526 d_getprotoprotos=''
527 d_getprpwnam=''
528 d_getpwent=''
529 d_getpwent_r=''
530 getpwent_r_proto=''
531 d_getpwnam_r=''
532 getpwnam_r_proto=''
533 d_getpwuid_r=''
534 getpwuid_r_proto=''
535 d_getsent=''
536 d_getservbyname_r=''
537 getservbyname_r_proto=''
538 d_getservbyport_r=''
539 getservbyport_r_proto=''
540 d_getservent_r=''
541 getservent_r_proto=''
542 d_getservprotos=''
543 d_getspnam=''
544 d_getspnam_r=''
545 getspnam_r_proto=''
546 d_getsbyname=''
547 d_getsbyport=''
548 d_gmtime_r=''
549 gmtime_r_proto=''
550 d_gnulibc=''
551 gnulibc_version=''
552 d_hasmntopt=''
553 d_htonl=''
554 d_ilogbl=''
555 d_inetaton=''
556 d_int64_t=''
557 d_isascii=''
558 d_isfinite=''
559 d_isinf=''
560 d_isnan=''
561 d_isnanl=''
562 d_killpg=''
563 d_lchown=''
564 d_ldbl_dig=''
565 d_libm_lib_version=''
566 d_link=''
567 d_localtime_r=''
568 d_localtime_r_needs_tzset=''
569 localtime_r_proto=''
570 d_locconv=''
571 d_lockf=''
572 d_longdbl=''
573 longdblsize=''
574 d_longlong=''
575 longlongsize=''
576 d_lseekproto=''
577 d_lstat=''
578 d_madvise=''
579 d_malloc_good_size=''
580 d_malloc_size=''
581 d_mblen=''
582 d_mbstowcs=''
583 d_mbtowc=''
584 d_memchr=''
585 d_memcmp=''
586 d_memcpy=''
587 d_memmove=''
588 d_memset=''
589 d_mkdir=''
590 d_mkdtemp=''
591 d_mkfifo=''
592 d_mkstemp=''
593 d_mkstemps=''
594 d_mktime=''
595 d_mmap=''
596 mmaptype=''
597 d_modfl=''
598 d_modfl_pow32_bug=''
599 d_modflproto=''
600 d_mprotect=''
601 d_msg=''
602 d_msgctl=''
603 d_msgget=''
604 d_msghdr_s=''
605 d_msgrcv=''
606 d_msgsnd=''
607 d_msync=''
608 d_munmap=''
609 d_nice=''
610 d_nl_langinfo=''
611 d_off64_t=''
612 d_open3=''
613 d_fpathconf=''
614 d_pathconf=''
615 d_pause=''
616 d_pipe=''
617 d_poll=''
618 d_portable=''
619 d_procselfexe=''
620 procselfexe=''
621 d_old_pthread_create_joinable=''
622 old_pthread_create_joinable=''
623 d_pthread_atfork=''
624 d_pthread_attr_setscope=''
625 d_pthread_yield=''
626 d_sched_yield=''
627 sched_yield=''
628 d_qgcvt=''
629 d_random_r=''
630 random_r_proto=''
631 d_readdir64_r=''
632 readdir64_r_proto=''
633 d_readdir=''
634 d_rewinddir=''
635 d_seekdir=''
636 d_telldir=''
637 d_readdir_r=''
638 readdir_r_proto=''
639 d_readlink=''
640 d_readv=''
641 d_recvmsg=''
642 d_rename=''
643 d_rmdir=''
644 d_safebcpy=''
645 d_safemcpy=''
646 d_sanemcmp=''
647 d_sbrkproto=''
648 d_scalbnl=''
649 d_select=''
650 d_sem=''
651 d_semctl=''
652 d_semget=''
653 d_semop=''
654 d_sendmsg=''
655 d_setegid=''
656 d_seteuid=''
657 d_setgrent=''
658 d_setgrent_r=''
659 setgrent_r_proto=''
660 d_setgrps=''
661 d_sethent=''
662 d_sethostent_r=''
663 sethostent_r_proto=''
664 d_setitimer=''
665 d_setlinebuf=''
666 d_setlocale=''
667 d_setlocale_r=''
668 setlocale_r_proto=''
669 d_setnent=''
670 d_setnetent_r=''
671 setnetent_r_proto=''
672 d_setpent=''
673 d_setpgid=''
674 d_setpgrp2=''
675 d_bsdsetpgrp=''
676 d_setpgrp=''
677 d_setprior=''
678 d_setproctitle=''
679 d_setprotoent_r=''
680 setprotoent_r_proto=''
681 d_setpwent=''
682 d_setpwent_r=''
683 setpwent_r_proto=''
684 d_setregid=''
685 d_setresgid=''
686 d_setresuid=''
687 d_setreuid=''
688 d_setrgid=''
689 d_setruid=''
690 d_setsent=''
691 d_setservent_r=''
692 setservent_r_proto=''
693 d_setsid=''
694 d_setvbuf=''
695 d_sfio=''
696 usesfio=''
697 d_shm=''
698 d_shmat=''
699 d_shmatprototype=''
700 shmattype=''
701 d_shmctl=''
702 d_shmdt=''
703 d_shmget=''
704 d_sigaction=''
705 d_signbit=''
706 d_sigprocmask=''
707 d_sigsetjmp=''
708 usesitecustomize=''
709 d_snprintf=''
710 d_vsnprintf=''
711 d_sockatmark=''
712 d_sockatmarkproto=''
713 d_msg_ctrunc=''
714 d_msg_dontroute=''
715 d_msg_oob=''
716 d_msg_peek=''
717 d_msg_proxy=''
718 d_oldsock=''
719 d_scm_rights=''
720 d_socket=''
721 d_sockpair=''
722 sockethdr=''
723 socketlib=''
724 d_socklen_t=''
725 d_socks5_init=''
726 d_sprintf_returns_strlen=''
727 d_sqrtl=''
728 d_srand48_r=''
729 srand48_r_proto=''
730 d_srandom_r=''
731 srandom_r_proto=''
732 d_sresgproto=''
733 d_sresuproto=''
734 d_statblks=''
735 d_statfs_f_flags=''
736 d_statfs_s=''
737 d_fstatvfs=''
738 d_statvfs=''
739 d_stdio_cnt_lval=''
740 d_stdio_ptr_lval=''
741 d_stdio_ptr_lval_nochange_cnt=''
742 d_stdio_ptr_lval_sets_cnt=''
743 d_stdiobase=''
744 d_stdstdio=''
745 stdio_base=''
746 stdio_bufsiz=''
747 stdio_cnt=''
748 stdio_filbuf=''
749 stdio_ptr=''
750 d_index=''
751 d_strchr=''
752 d_strcoll=''
753 d_strctcpy=''
754 d_strerrm=''
755 d_strerror=''
756 d_sysernlst=''
757 d_syserrlst=''
758 d_strerror_r=''
759 strerror_r_proto=''
760 d_strftime=''
761 d_strlcat=''
762 d_strlcpy=''
763 d_strtod=''
764 d_strtol=''
765 d_strtold=''
766 d_strtoll=''
767 d_strtoq=''
768 d_strtoul=''
769 d_strtoull=''
770 d_strtouq=''
771 d_strxfrm=''
772 d_symlink=''
773 d_syscall=''
774 d_syscallproto=''
775 d_sysconf=''
776 d_system=''
777 d_tcgetpgrp=''
778 d_tcsetpgrp=''
779 d_telldirproto=''
780 d_time=''
781 timetype=''
782 clocktype=''
783 d_times=''
784 d_tmpnam_r=''
785 tmpnam_r_proto=''
786 d_truncate=''
787 d_ttyname_r=''
788 ttyname_r_proto=''
789 d_tzname=''
790 d_u32align=''
791 d_ualarm=''
792 d_umask=''
793 d_semctl_semid_ds=''
794 d_semctl_semun=''
795 d_union_semun=''
796 d_unordered=''
797 d_unsetenv=''
798 d_usleep=''
799 d_usleepproto=''
800 d_ustat=''
801 d_pseudofork=''
802 d_vfork=''
803 usevfork=''
804 d_voidsig=''
805 signal_t=''
806 d_volatile=''
807 d_charvspr=''
808 d_vprintf=''
809 d_wait4=''
810 d_waitpid=''
811 d_wcstombs=''
812 d_wctomb=''
813 d_writev=''
814 dlext=''
815 cccdlflags=''
816 ccdlflags=''
817 dlsrc=''
818 ld=''
819 lddlflags=''
820 usedl=''
821 doublesize=''
822 ebcdic=''
823 fflushNULL=''
824 fflushall=''
825 fpossize=''
826 fpostype=''
827 gccansipedantic=''
828 gccosandvers=''
829 gccversion=''
830 gidformat=''
831 gidsign=''
832 gidsize=''
833 gidtype=''
834 groupstype=''
835 h_fcntl=''
836 h_sysfile=''
837 html1dir=''
838 html1direxp=''
839 installhtml1dir=''
840 html3dir=''
841 html3direxp=''
842 installhtml3dir=''
843 i_arpainet=''
844 i_crypt=''
845 db_hashtype=''
846 db_prefixtype=''
847 db_version_major=''
848 db_version_minor=''
849 db_version_patch=''
850 i_db=''
851 i_dbm=''
852 i_rpcsvcdbm=''
853 d_dirnamlen=''
854 direntrytype=''
855 i_dirent=''
856 i_dld=''
857 i_dlfcn=''
858 i_fcntl=''
859 i_float=''
860 i_fp=''
861 i_fp_class=''
862 i_gdbm=''
863 d_grpasswd=''
864 i_grp=''
865 i_ieeefp=''
866 i_inttypes=''
867 i_langinfo=''
868 i_libutil=''
869 i_limits=''
870 i_locale=''
871 i_machcthr=''
872 i_malloc=''
873 i_math=''
874 i_memory=''
875 i_mntent=''
876 i_ndbm=''
877 i_netdb=''
878 i_neterrno=''
879 i_netinettcp=''
880 i_niin=''
881 i_sysin=''
882 i_poll=''
883 i_prot=''
884 i_pthread=''
885 d_pwage=''
886 d_pwchange=''
887 d_pwclass=''
888 d_pwcomment=''
889 d_pwexpire=''
890 d_pwgecos=''
891 d_pwpasswd=''
892 d_pwquota=''
893 i_pwd=''
894 i_sfio=''
895 i_shadow=''
896 i_socks=''
897 i_stddef=''
898 i_stdlib=''
899 i_string=''
900 strings=''
901 i_sunmath=''
902 i_sysaccess=''
903 i_sysdir=''
904 i_sysfile=''
905 d_voidtty=''
906 i_bsdioctl=''
907 i_sysfilio=''
908 i_sysioctl=''
909 i_syssockio=''
910 i_syslog=''
911 i_sysmman=''
912 i_sysmode=''
913 i_sysmount=''
914 i_sysndir=''
915 i_sysparam=''
916 i_sysresrc=''
917 i_syssecrt=''
918 i_sysselct=''
919 i_sysstat=''
920 i_sysstatfs=''
921 i_sysstatvfs=''
922 i_systimes=''
923 i_systypes=''
924 i_sysuio=''
925 i_sysun=''
926 i_sysutsname=''
927 i_sysvfs=''
928 i_syswait=''
929 i_sgtty=''
930 i_termio=''
931 i_termios=''
932 d_tm_tm_gmtoff=''
933 d_tm_tm_zone=''
934 i_systime=''
935 i_systimek=''
936 i_time=''
937 timeincl=''
938 i_unistd=''
939 i_ustat=''
940 i_utime=''
941 i_values=''
942 i_stdarg=''
943 i_varargs=''
944 i_varhdr=''
945 i_vfork=''
946 d_inc_version_list=''
947 inc_version_list=''
948 inc_version_list_init=''
949 installprefix=''
950 installprefixexp=''
951 installstyle=''
952 installusrbinperl=''
953 intsize=''
954 longsize=''
955 shortsize=''
956 issymlink=''
957 libc=''
958 ldlibpthname=''
959 libperl=''
960 shrpenv=''
961 useshrplib=''
962 glibpth=''
963 libpth=''
964 loclibpth=''
965 plibpth=''
966 xlibpth=''
967 ignore_versioned_solibs=''
968 libs=''
969 libsdirs=''
970 libsfiles=''
971 libsfound=''
972 libspath=''
973 lns=''
974 d_PRIEUldbl=''
975 d_PRIFUldbl=''
976 d_PRIGUldbl=''
977 d_PRIeldbl=''
978 d_PRIfldbl=''
979 d_PRIgldbl=''
980 d_SCNfldbl=''
981 sPRIEUldbl=''
982 sPRIFUldbl=''
983 sPRIGUldbl=''
984 sPRIeldbl=''
985 sPRIfldbl=''
986 sPRIgldbl=''
987 sSCNfldbl=''
988 lseeksize=''
989 lseektype=''
990 mad=''
991 madlyh=''
992 madlyobj=''
993 madlysrc=''
994 make_set_make=''
995 d_mymalloc=''
996 freetype=''
997 mallocobj=''
998 mallocsrc=''
999 malloctype=''
1000 usemallocwrap=''
1001 usemymalloc=''
1002 installman1dir=''
1003 man1dir=''
1004 man1direxp=''
1005 man1ext=''
1006 installman3dir=''
1007 man3dir=''
1008 man3direxp=''
1009 man3ext=''
1010 modetype=''
1011 multiarch=''
1012 mydomain=''
1013 myhostname=''
1014 phostname=''
1015 c=''
1016 n=''
1017 d_eofnblk=''
1018 eagain=''
1019 o_nonblock=''
1020 rd_nodata=''
1021 need_va_copy=''
1022 netdb_hlen_type=''
1023 netdb_host_type=''
1024 netdb_name_type=''
1025 netdb_net_type=''
1026 groupcat=''
1027 hostcat=''
1028 passcat=''
1029 orderlib=''
1030 ranlib=''
1031 d_perl_otherlibdirs=''
1032 otherlibdirs=''
1033 package=''
1034 spackage=''
1035 pager=''
1036 api_revision=''
1037 api_subversion=''
1038 api_version=''
1039 api_versionstring=''
1040 patchlevel=''
1041 perl_patchlevel=''
1042 revision=''
1043 subversion=''
1044 version=''
1045 version_patchlevel_string=''
1046 perl5=''
1047 perladmin=''
1048 perlpath=''
1049 d_nv_preserves_uv=''
1050 d_nv_zero_is_allbits_zero=''
1051 i16size=''
1052 i16type=''
1053 i32size=''
1054 i32type=''
1055 i64size=''
1056 i64type=''
1057 i8size=''
1058 i8type=''
1059 ivsize=''
1060 ivtype=''
1061 nv_preserves_uv_bits=''
1062 nvsize=''
1063 nvtype=''
1064 u16size=''
1065 u16type=''
1066 u32size=''
1067 u32type=''
1068 u64size=''
1069 u64type=''
1070 u8size=''
1071 u8type=''
1072 uvsize=''
1073 uvtype=''
1074 ivdformat=''
1075 nvEUformat=''
1076 nvFUformat=''
1077 nvGUformat=''
1078 nveformat=''
1079 nvfformat=''
1080 nvgformat=''
1081 uvXUformat=''
1082 uvoformat=''
1083 uvuformat=''
1084 uvxformat=''
1085 pidtype=''
1086 prefix=''
1087 prefixexp=''
1088 installprivlib=''
1089 privlib=''
1090 privlibexp=''
1091 prototype=''
1092 ptrsize=''
1093 d_PRIXU64=''
1094 d_PRId64=''
1095 d_PRIi64=''
1096 d_PRIo64=''
1097 d_PRIu64=''
1098 d_PRIx64=''
1099 sPRIXU64=''
1100 sPRId64=''
1101 sPRIi64=''
1102 sPRIo64=''
1103 sPRIu64=''
1104 sPRIx64=''
1105 d_quad=''
1106 quadkind=''
1107 quadtype=''
1108 uquadtype=''
1109 drand01=''
1110 randbits=''
1111 randfunc=''
1112 randseedtype=''
1113 seedfunc=''
1114 installscript=''
1115 scriptdir=''
1116 scriptdirexp=''
1117 selectminbits=''
1118 selecttype=''
1119 sh=''
1120 sig_count=''
1121 sig_name=''
1122 sig_name_init=''
1123 sig_num=''
1124 sig_num_init=''
1125 sig_size=''
1126 d_sitearch=''
1127 installsitearch=''
1128 sitearch=''
1129 sitearchexp=''
1130 installsitebin=''
1131 sitebin=''
1132 sitebinexp=''
1133 installsitehtml1dir=''
1134 sitehtml1dir=''
1135 sitehtml1direxp=''
1136 installsitehtml3dir=''
1137 sitehtml3dir=''
1138 sitehtml3direxp=''
1139 installsitelib=''
1140 sitelib=''
1141 sitelib_stem=''
1142 sitelibexp=''
1143 installsiteman1dir=''
1144 siteman1dir=''
1145 siteman1direxp=''
1146 installsiteman3dir=''
1147 siteman3dir=''
1148 siteman3direxp=''
1149 siteprefix=''
1150 siteprefixexp=''
1151 installsitescript=''
1152 sitescript=''
1153 sitescriptexp=''
1154 sizesize=''
1155 sizetype=''
1156 so=''
1157 socksizetype=''
1158 sharpbang=''
1159 shsharp=''
1160 spitshell=''
1161 src=''
1162 ssizetype=''
1163 startperl=''
1164 startsh=''
1165 stdchar=''
1166 d_stdio_stream_array=''
1167 stdio_stream_array=''
1168 sysman=''
1169 trnl=''
1170 uidformat=''
1171 uidsign=''
1172 uidsize=''
1173 uidtype=''
1174 archname64=''
1175 use64bitall=''
1176 use64bitint=''
1177 usefaststdio=''
1178 ccflags_uselargefiles=''
1179 ldflags_uselargefiles=''
1180 libswanted_uselargefiles=''
1181 uselargefiles=''
1182 uselongdouble=''
1183 usemorebits=''
1184 usemultiplicity=''
1185 nm_opt=''
1186 nm_so_opt=''
1187 runnm=''
1188 usenm=''
1189 useperlio=''
1190 usesocks=''
1191 d_oldpthreads=''
1192 use5005threads=''
1193 useithreads=''
1194 usereentrant=''
1195 usethreads=''
1196 incpath=''
1197 mips_type=''
1198 usrinc=''
1199 d_vendorarch=''
1200 installvendorarch=''
1201 vendorarch=''
1202 vendorarchexp=''
1203 d_vendorbin=''
1204 installvendorbin=''
1205 vendorbin=''
1206 vendorbinexp=''
1207 installvendorhtml1dir=''
1208 vendorhtml1dir=''
1209 vendorhtml1direxp=''
1210 installvendorhtml3dir=''
1211 vendorhtml3dir=''
1212 vendorhtml3direxp=''
1213 d_vendorlib=''
1214 installvendorlib=''
1215 vendorlib=''
1216 vendorlib_stem=''
1217 vendorlibexp=''
1218 installvendorman1dir=''
1219 vendorman1dir=''
1220 vendorman1direxp=''
1221 installvendorman3dir=''
1222 vendorman3dir=''
1223 vendorman3direxp=''
1224 usevendorprefix=''
1225 vendorprefix=''
1226 vendorprefixexp=''
1227 d_vendorscript=''
1228 installvendorscript=''
1229 vendorscript=''
1230 vendorscriptexp=''
1231 versiononly=''
1232 defvoidused=''
1233 voidflags=''
1234 yacc=''
1235 yaccflags=''
1236 CONFIG=''
1237
1238 define='define'
1239 undef='undef'
1240 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1241 rmlist=''
1242
1243 : We must find out about Eunice early
1244 eunicefix=':'
1245 if test -f /etc/unixtovms; then
1246         eunicefix=/etc/unixtovms
1247 fi
1248 if test -f /etc/unixtovms.exe; then
1249         eunicefix=/etc/unixtovms.exe
1250 fi
1251
1252 : Set executable suffix now -- needed before hints available
1253 if test -f "/libs/version.library"; then
1254 : Amiga OS
1255     _exe=""
1256 elif test -f "/system/gnu_library/bin/ar.pm"; then
1257 : Stratus VOS
1258     _exe=".pm"
1259 elif test -n "$DJGPP"; then
1260 : DOS DJGPP
1261     _exe=".exe"
1262 elif test -d c:/. -o -n "$is_os2" ; then
1263 : OS/2 or cygwin
1264     _exe=".exe"
1265 fi
1266
1267 i_whoami=''
1268 : Trailing extension.  Override this in a hint file, if needed.
1269 : Extra object files, if any, needed on this platform.
1270 archobjs=''
1271 archname=''
1272 groupstype=''
1273 libnames=''
1274 : change the next line if compiling for Xenix/286 on Xenix/386
1275 xlibpth='/usr/lib/386 /lib/386'
1276 : Possible local library directories to search.
1277 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1278 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1279
1280 : general looking path for locating libraries
1281 glibpth="/lib /usr/lib $xlibpth"
1282 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1283 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1284 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1285 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1286
1287 : Private path used by Configure to find libraries.  Its value
1288 : is prepended to libpth. This variable takes care of special
1289 : machines, like the mips.  Usually, it should be empty.
1290 plibpth=''
1291
1292 : default library list
1293 libswanted=''
1294 : some systems want to use only the non-versioned libso:s
1295 ignore_versioned_solibs=''
1296 siteman1dir=''
1297 siteman3dir=''
1298 sitescript=''
1299 : set usethreads on the Configure command line to enable threads.
1300 usereentrant='undef'
1301 : full support for void wanted by default
1302 defvoidused=15
1303
1304 : Possible local include directories to search.
1305 : Set locincpth to "" in a hint file to defeat local include searches.
1306 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1307 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1308 :
1309 : no include file wanted by default
1310 inclwanted=''
1311
1312 : Enable -DEBUGGING and -DDEBUGGING from the command line
1313 EBUGGING=''
1314 DEBUGGING=old
1315
1316 ccname=''
1317 ccversion=''
1318 perllibs=''
1319 : set useposix=false in your hint file to disable the POSIX extension.
1320 useposix=true
1321 : set useopcode=false in your hint file to disable the Opcode extension.
1322 useopcode=true
1323 archname64=''
1324 ccflags_uselargefiles=''
1325 ldflags_uselargefiles=''
1326 libswanted_uselargefiles=''
1327 : set usemultiplicity on the Configure command line to enable multiplicity.
1328 : set usesocks on the Configure command line to enable socks.
1329 : List of libraries we want.
1330 : If anyone needs extra -lxxx, put those in a hint file.
1331 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1332 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1333 : We probably want to search /usr/shlib before most other libraries.
1334 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1335 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1336 glibpth="/usr/shlib $glibpth"
1337 : Do not use vfork unless overridden by a hint file.
1338 usevfork=false
1339
1340 : Find the basic shell for Bourne shell scripts
1341 case "$sh" in
1342 '')
1343         case "$SYSTYPE" in
1344         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1345         *) xxx='/bin/sh';;
1346         esac
1347         if test -f "$xxx"; then
1348                 sh="$xxx"
1349         else
1350                 : Build up a list and do a single loop so we can 'break' out.
1351                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1352                 for xxx in sh bash ksh pdksh ash; do
1353                         for p in $pth; do
1354                                 try="$try ${p}/${xxx}"
1355                         done
1356                 done
1357                 for xxx in $try; do
1358                         if test -f "$xxx"; then
1359                                 sh="$xxx";
1360                                 break
1361                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1362                                 sh="$xxx";
1363                                 break
1364                         elif test -f "$xxx.exe"; then
1365                                 sh="$xxx";
1366                                 break
1367                         fi
1368                 done
1369         fi
1370         ;;
1371 esac
1372
1373 case "$sh" in
1374 '')     cat >&2 <<EOM
1375 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1376
1377 Usually it's in /bin/sh.  How did you even get this far?
1378 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1379 we'll try to straighten this all out.
1380 EOM
1381         exit 1
1382         ;;
1383 esac
1384
1385 : see if sh knows # comments
1386 if `$sh -c '#' >/dev/null 2>&1`; then
1387         shsharp=true
1388         spitshell=cat
1389         xcat=/bin/cat
1390         test -f $xcat$_exe || xcat=/usr/bin/cat
1391         if test ! -f $xcat$_exe; then
1392                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1393                         if test -f $p/cat$_exe; then
1394                                 xcat=$p/cat
1395                                 break
1396                         fi
1397                 done
1398                 if test ! -f $xcat$_exe; then
1399                         echo "Can't find cat anywhere!"
1400                         exit 1
1401                 fi
1402         fi
1403         echo "#!$xcat" >sharp
1404         $eunicefix sharp
1405         chmod +x sharp
1406         ./sharp > today
1407         if test -s today; then
1408                 sharpbang='#!'
1409         else
1410                 echo "#! $xcat" > sharp
1411                 $eunicefix sharp
1412                 chmod +x sharp
1413                 ./sharp > today
1414                 if test -s today; then
1415                         sharpbang='#! '
1416                 else
1417                         sharpbang=': use '
1418                 fi
1419         fi
1420 else
1421         echo " "
1422         echo "Your $sh doesn't grok # comments--I will strip them later on."
1423         shsharp=false
1424         cd ..
1425         echo "exec grep -v '^[  ]*#'" >spitshell
1426         chmod +x spitshell
1427         $eunicefix spitshell
1428         spitshell=`pwd`/spitshell
1429         cd UU
1430         echo "I presume that if # doesn't work, #! won't work either!"
1431         sharpbang=': use '
1432 fi
1433 rm -f sharp today
1434
1435 : figure out how to guarantee sh startup
1436 case "$startsh" in
1437 '') startsh=${sharpbang}${sh} ;;
1438 *)
1439 esac
1440 cat >sharp <<EOSS
1441 $startsh
1442 set abc
1443 test "$?abc" != 1
1444 EOSS
1445
1446 chmod +x sharp
1447 $eunicefix sharp
1448 if ./sharp; then
1449         : echo "Yup, it does."
1450 else
1451         echo "Hmm... '$startsh' does not guarantee sh startup..."
1452         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1453 fi
1454 rm -f sharp
1455
1456
1457 : Save command line options in file UU/cmdline.opt for later use in
1458 : generating config.sh.
1459 cat > cmdline.opt <<EOSH
1460 # Configure command line arguments.
1461 config_arg0='$0'
1462 config_args='$*'
1463 config_argc=$#
1464 EOSH
1465 argn=1
1466 args_exp=''
1467 args_sep=''
1468 for arg in "$@"; do
1469         cat >>cmdline.opt <<EOSH
1470 config_arg$argn='$arg'
1471 EOSH
1472         # Extreme backslashitis: replace each ' by '"'"'
1473         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1474 $arg
1475 EOC
1476         arg_exp=`cat cmdl.opt`
1477         args_exp="$args_exp$args_sep'$arg_exp'"
1478         argn=`expr $argn + 1`
1479         args_sep=' '
1480 done
1481 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1482 # used by ./hints/os2.sh
1483 rm -f cmdl.opt
1484
1485 : produce awk script to parse command line options
1486 cat >options.awk <<'EOF'
1487 BEGIN {
1488         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1489
1490         len = length(optstr);
1491         for (i = 1; i <= len; i++) {
1492                 c = substr(optstr, i, 1);
1493                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1494                 if (a == ":") {
1495                         arg[c] = 1;
1496                         i++;
1497                 }
1498                 opt[c] = 1;
1499         }
1500 }
1501 {
1502         expect = 0;
1503         str = $0;
1504         if (substr(str, 1, 1) != "-") {
1505                 printf("'%s'\n", str);
1506                 next;
1507         }
1508         len = length($0);
1509         for (i = 2; i <= len; i++) {
1510                 c = substr(str, i, 1);
1511                 if (!opt[c]) {
1512                         printf("-%s\n", substr(str, i));
1513                         next;
1514                 }
1515                 printf("-%s\n", c);
1516                 if (arg[c]) {
1517                         if (i < len)
1518                                 printf("'%s'\n", substr(str, i + 1));
1519                         else
1520                                 expect = 1;
1521                         next;
1522                 }
1523         }
1524 }
1525 END {
1526         if (expect)
1527                 print "?";
1528 }
1529 EOF
1530
1531 : process the command line options
1532 set X `for arg in "$@"; do echo "X$arg"; done |
1533         sed -e s/X// | awk -f options.awk`
1534 eval "set $*"
1535 shift
1536 rm -f options.awk
1537
1538 : set up default values
1539 fastread=''
1540 reuseval=false
1541 config_sh=''
1542 alldone=''
1543 error=''
1544 silent=''
1545 extractsh=''
1546 override=''
1547 knowitall=''
1548 rm -f optdef.sh posthint.sh
1549 cat >optdef.sh <<EOS
1550 $startsh
1551 EOS
1552
1553
1554 : option parsing
1555 while test $# -gt 0; do
1556         case "$1" in
1557         -d) shift; fastread=yes;;
1558         -e) shift; alldone=cont;;
1559         -f)
1560                 shift
1561                 cd ..
1562                 if test -r "$1"; then
1563                         config_sh="$1"
1564                 else
1565                         echo "$me: cannot read config file $1." >&2
1566                         error=true
1567                 fi
1568                 cd UU
1569                 shift;;
1570         --help|\
1571         -h) shift; error=true;;
1572         -r) shift; reuseval=true;;
1573         -s) shift; silent=true; realsilent=true;;
1574         -E) shift; alldone=exit;;
1575         -K) shift; knowitall=true;;
1576         -O) shift; override=true;;
1577         -S) shift; silent=true; extractsh=true;;
1578         -D)
1579                 shift
1580                 case "$1" in
1581                 *=)
1582                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1583                         echo "$me: ignoring -D $1" >&2
1584                         ;;
1585                 *=*) echo "$1" | \
1586                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1587                 *) echo "$1='define'" >> optdef.sh;;
1588                 esac
1589                 shift
1590                 ;;
1591         -U)
1592                 shift
1593                 case "$1" in
1594                 *=) echo "$1" >> optdef.sh;;
1595                 *=*)
1596                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1597                         echo "$me: ignoring -U $1" >&2
1598                         ;;
1599                 *) echo "$1='undef'" >> optdef.sh;;
1600                 esac
1601                 shift
1602                 ;;
1603         -A)
1604             shift
1605             xxx=''
1606             yyy="$1"
1607             zzz=''
1608             uuu=undef
1609             case "$yyy" in
1610             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1611                  case "$zzz" in
1612                  *:*) zzz='' ;;
1613                  *)   xxx=append
1614                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1615                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1616                  esac
1617                  ;;
1618             esac
1619             case "$xxx" in
1620             '')  case "$yyy" in
1621                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1622                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1623                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1624                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1625                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1626                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1627                  esac
1628                  ;;       
1629             esac
1630             case "$xxx" in
1631             append)
1632                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1633             clear)
1634                 echo "$yyy=''"                  >> posthint.sh ;;
1635             define)
1636                 case "$zzz" in
1637                 '') zzz=define ;;
1638                 esac
1639                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1640             eval)
1641                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1642             prepend)
1643                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1644             undef)
1645                 case "$zzz" in
1646                 '') zzz="$uuu" ;;
1647                 esac
1648                 echo "$yyy=$zzz"                >> posthint.sh ;;
1649             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1650             esac
1651             shift
1652             ;;
1653         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1654             exit 0;;
1655         --) break;;
1656         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1657         *) break;;
1658         esac
1659 done
1660
1661 case "$error" in
1662 true)
1663         cat >&2 <<EOM
1664 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1665                  [-U symbol] [-U symbol=] [-A command:symbol...]
1666   -d : use defaults for all answers.
1667   -e : go on without questioning past the production of config.sh.
1668   -f : specify an alternate default configuration file.
1669   -h : print this help message and exit (with an error status).
1670   -r : reuse C symbols value if possible (skips costly nm extraction).
1671   -s : silent mode, only echoes questions and essential information.
1672   -D : define symbol to have some value:
1673          -D symbol         symbol gets the value 'define'
1674          -D symbol=value   symbol gets the value 'value'
1675        common used examples (see INSTALL for more info):
1676          -Duse64bitint            use 64bit integers
1677          -Duse64bitall            use 64bit integers and pointers
1678          -Dusethreads             use thread support
1679          -Dinc_version_list=none  do not include older perl trees in @INC
1680          -DEBUGGING=none          DEBUGGING options
1681          -Dcc=gcc                 choose your compiler
1682          -Dprefix=/opt/perl5      choose your destination
1683   -E : stop at the end of questions, after having produced config.sh.
1684   -K : do not use unless you know what you are doing.
1685   -O : let -D and -U override definitions from loaded configuration file.
1686   -S : perform variable substitutions on all .SH files (can mix with -f)
1687   -U : undefine symbol:
1688          -U symbol    symbol gets the value 'undef'
1689          -U symbol=   symbol gets completely empty
1690        e.g.:  -Uversiononly
1691   -A : manipulate symbol after the platform specific hints have been applied:
1692          -A append:symbol=value   append value to symbol
1693          -A symbol=value          like append:, but with a separating space
1694          -A define:symbol=value   define symbol to have value
1695          -A clear:symbol          define symbol to be ''
1696          -A define:symbol         define symbol to be 'define'
1697          -A eval:symbol=value     define symbol to be eval of value
1698          -A prepend:symbol=value  prepend value to symbol
1699          -A undef:symbol          define symbol to be 'undef'
1700          -A undef:symbol=         define symbol to be ''
1701        e.g.:  -A prepend:libswanted='cl pthread '
1702               -A ccflags=-DSOME_MACRO
1703   -V : print version number and exit (with a zero status).
1704 EOM
1705         exit 1
1706         ;;
1707 esac
1708
1709 : Sanity checks
1710 case "$fastread$alldone" in
1711 yescont|yesexit) ;;
1712 *)
1713         case "$extractsh" in
1714         true) ;;
1715         *)
1716                 if test ! -t 0; then
1717                         echo "Say 'sh Configure', not 'sh <Configure'"
1718                         exit 1
1719                 fi
1720                 ;;
1721         esac
1722         ;;
1723 esac
1724
1725 exec 4>&1
1726 case "$silent" in
1727 true) exec 1>/dev/null;;
1728 esac
1729
1730 : run the defines and the undefines, if any, but leave the file out there...
1731 touch optdef.sh
1732 . ./optdef.sh
1733 : create the posthint manipulation script and leave the file out there...
1734 touch posthint.sh
1735
1736 : set package name
1737 package=perl5
1738 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1739 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1740 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1741 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1742 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1743 esac
1744
1745 : Some greps do not return status, grrr.
1746 echo "grimblepritz" >grimble
1747 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1748         contains=contains
1749 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1750         contains=grep
1751 else
1752         contains=contains
1753 fi
1754 rm -f grimble
1755 : the following should work in any shell
1756 case "$contains" in
1757 contains*)
1758         echo " "
1759         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1760         cat >contains <<'EOSS'
1761 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1762 EOSS
1763 chmod +x contains
1764 esac
1765
1766 : Find the path to the source tree
1767 case "$src" in
1768 '') case "$0" in
1769     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1770          case "$src" in
1771          /*)    ;;
1772          .)     ;;
1773          *)     src=`cd ../$src && pwd` ;;
1774          esac
1775          ;;
1776     *)   src='.';;
1777     esac;;
1778 esac
1779 case "$src" in
1780 '')     src=/
1781         rsrc=/
1782         ;;
1783 /*) rsrc="$src";;
1784 *) rsrc="../$src";;
1785 esac
1786 if test -f $rsrc/Configure && \
1787         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1788 then
1789    : found it, so we are ok.
1790 else
1791         rsrc=''
1792         for src in . .. ../.. ../../.. ../../../..; do
1793                 if test -f ../$src/Configure && \
1794                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1795                 then
1796                         rsrc=../$src
1797                         break
1798                 fi
1799         done
1800 fi
1801 case "$rsrc" in
1802 '')
1803         cat <<EOM >&4
1804
1805 Sorry, I can't seem to locate the source dir for $package.  Please start
1806 Configure with an explicit path -- i.e. /some/path/Configure.
1807
1808 EOM
1809         exit 1
1810         ;;
1811 ../.)   rsrc='..';;
1812 *)
1813         echo " "
1814         echo "Sources for $package found in \"$src\"." >&4
1815         ;;
1816 esac
1817
1818 : script used to extract .SH files with variable substitutions
1819 cat >extract <<'EOS'
1820 PERL_CONFIG_SH=true
1821 echo "Doing variable substitutions on .SH files..."
1822 if test -f MANIFEST; then
1823         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1824 else
1825         echo "(Looking for .SH files under the source directory.)"
1826         set x `(cd "$src"; find . -name "*.SH" -print)`
1827 fi
1828 shift
1829 case $# in
1830 0) set x `(cd "$src"; echo *.SH)`; shift;;
1831 esac
1832 if test ! -f "$src/$1"; then
1833         shift
1834 fi
1835 mkdir_p='
1836 name=$1;
1837 create="";
1838 while test $name; do
1839         if test ! -d "$name"; then
1840                 create="$name $create";
1841                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1842                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1843         else
1844                 name="";
1845         fi;
1846 done;
1847 for file in $create; do
1848         mkdir $file;
1849 done
1850 '
1851 for file in $*; do
1852         case "$src" in
1853         ".")
1854                 case "$file" in
1855                 */*)
1856                         dir=`expr X$file : 'X\(.*\)/'`
1857                         file=`expr X$file : 'X.*/\(.*\)'`
1858                         (cd "$dir" && . ./$file)
1859                         ;;
1860                 *)
1861                         . ./$file
1862                         ;;
1863                 esac
1864                 ;;
1865         *)
1866                 case "$file" in
1867                 */*)
1868                         dir=`expr X$file : 'X\(.*\)/'`
1869                         file=`expr X$file : 'X.*/\(.*\)'`
1870                         (set x $dir; shift; eval $mkdir_p)
1871                         sh <"$src/$dir/$file"
1872                         ;;
1873                 *)
1874                         sh <"$src/$file"
1875                         ;;
1876                 esac
1877                 ;;
1878         esac
1879 done
1880 if test -f "$src/config_h.SH"; then
1881         if test ! -f config.h; then
1882         : oops, they left it out of MANIFEST, probably, so do it anyway.
1883         . "$src/config_h.SH"
1884         fi
1885 fi
1886 EOS
1887
1888 : extract files and exit if asked to do so
1889 case "$extractsh" in
1890 true)
1891         case "$realsilent" in
1892         true) ;;
1893         *) exec 1>&4;;
1894         esac
1895         case "$config_sh" in
1896         '') config_sh='config.sh';;
1897         esac
1898         echo " "
1899         echo "Fetching answers from $config_sh..."
1900         cd ..
1901         . $config_sh
1902         test "$override" && . ./optdef.sh
1903         echo " "
1904         . UU/extract
1905         rm -rf UU
1906         echo "Extraction done."
1907         exit 0
1908         ;;
1909 esac
1910
1911 : Eunice requires " " instead of "", can you believe it
1912 echo " "
1913 : Here we go...
1914 echo "Beginning of configuration questions for $package."
1915
1916 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1917
1918 : first determine how to suppress newline on echo command
1919 echo " "
1920 echo "Checking echo to see how to suppress newlines..."
1921 (echo "hi there\c" ; echo " ") >.echotmp
1922 if $contains c .echotmp >/dev/null 2>&1 ; then
1923         echo "...using -n."
1924         n='-n'
1925         c=''
1926 else
1927         cat <<'EOM'
1928 ...using \c
1929 EOM
1930         n=''
1931         c='\c'
1932 fi
1933 echo $n "The star should be here-->$c"
1934 echo '*'
1935 rm -f .echotmp
1936
1937 : Now test for existence of everything in MANIFEST
1938 echo " "
1939 if test -f "$rsrc/MANIFEST"; then
1940         echo "First let's make sure your kit is complete.  Checking..." >&4
1941         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1942         rm -f missing
1943         tmppwd=`pwd`
1944         for filelist in x??; do
1945                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1946         done
1947         if test -s missing; then
1948                 cat missing >&4
1949                 cat >&4 <<'EOM'
1950
1951 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1952
1953 You have the option of continuing the configuration process, despite the
1954 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1955 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1956 and contact the author (perlbug@perl.org).
1957
1958 EOM
1959                 echo $n "Continue? [n] $c" >&4
1960                 read ans
1961                 case "$ans" in
1962                 y*)
1963                         echo "Continuing..." >&4
1964                         rm -f missing
1965                         ;;
1966                 *)
1967                         echo "ABORTING..." >&4
1968                         kill $$
1969                         ;;
1970                 esac
1971         else
1972                 echo "Looks good..."
1973         fi
1974 else
1975         echo "There is no MANIFEST file.  I hope your kit is complete !"
1976 fi
1977 rm -f missing x??
1978
1979 echo " "
1980 : Find the appropriate value for a newline for tr
1981 if test -n "$DJGPP"; then
1982        trnl='\012'
1983 fi
1984 if test X"$trnl" = X; then
1985         case "`echo foo|tr '\n' x 2>/dev/null`" in
1986         foox) trnl='\n' ;;
1987         esac
1988 fi
1989 if test X"$trnl" = X; then
1990         case "`echo foo|tr '\012' x 2>/dev/null`" in
1991         foox) trnl='\012' ;;
1992         esac
1993 fi
1994 if test X"$trnl" = X; then
1995        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1996        fooxy) trnl='\n\r' ;;
1997        esac
1998 fi
1999 if test X"$trnl" = X; then
2000         cat <<EOM >&2
2001
2002 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2003
2004 EOM
2005         exit 1
2006 fi
2007
2008 : compute the number of columns on the terminal for proper question formatting
2009 case "$COLUMNS" in
2010 '') COLUMNS='80';;
2011 esac
2012
2013 : set up the echo used in my read
2014 myecho="case \"\$xxxm\" in
2015 '') echo $n \"\$rp $c\" >&4;;
2016 *) case \"\$rp\" in
2017         '') echo $n \"[\$xxxm] $c\";;
2018         *)
2019                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2020                         echo \"\$rp\" >&4
2021                         echo $n \"[\$xxxm] $c\" >&4
2022                 else
2023                         echo $n \"\$rp [\$xxxm] $c\" >&4
2024                 fi
2025                 ;;
2026         esac;;
2027 esac"
2028
2029 : now set up to do reads with possible shell escape and default assignment
2030 cat <<EOSC >myread
2031 $startsh
2032 xxxm=\$dflt
2033 $myecho
2034 ans='!'
2035 case "\$fastread" in
2036 yes) case "\$dflt" in
2037         '') ;;
2038         *) ans='';
2039                 case "\$silent-\$rp" in
2040                 true-) ;;
2041                 *) echo " " >&4;;
2042                 esac;;
2043         esac;;
2044 *) case "\$silent" in
2045         true) case "\$rp" in
2046                 '') ans='';;
2047                 esac;;
2048         esac;;
2049 esac
2050 while expr "X\$ans" : "X!" >/dev/null; do
2051         read answ
2052         set x \$xxxm
2053         shift
2054         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2055         case  "\$answ" in
2056         "!")
2057                 sh 1>&4
2058                 echo " "
2059                 $myecho
2060                 ;;
2061         !*)
2062                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2063                 shift
2064                 sh 1>&4 -c "\$*"
2065                 echo " "
2066                 $myecho
2067                 ;;
2068         "\$ans")
2069                 case "\$ans" in
2070                 \\&*)
2071                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2072                         shift
2073                         case "\$1" in
2074                         -d)
2075                                 fastread=yes
2076                                 echo "(OK, I'll run with -d after this question.)" >&4
2077                                 ;;
2078                         -*)
2079                                 echo "*** Sorry, \$1 not supported yet." >&4
2080                                 ;;
2081                         esac
2082                         $myecho
2083                         ans=!
2084                         ;;
2085                 esac;;
2086         *)
2087                 case "\$aok" in
2088                 y)
2089                         echo "*** Substitution done -- please confirm."
2090                         xxxm="\$ans"
2091                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2092                         xxxm="\$ans"
2093                         ans=!
2094                         ;;
2095                 *)
2096                         echo "*** Error -- try again."
2097                         ans=!
2098                         ;;
2099                 esac
2100                 $myecho
2101                 ;;
2102         esac
2103         case "\$ans\$xxxm\$nostick" in
2104         '')
2105                 ans=!
2106                 $myecho
2107                 ;;
2108         esac
2109 done
2110 case "\$ans" in
2111 '') ans="\$xxxm";;
2112 esac
2113 EOSC
2114
2115 : create .config dir to save info across Configure sessions
2116 test -d ../.config || mkdir ../.config
2117 cat >../.config/README <<EOF
2118 This directory created by Configure to save information that should
2119 persist across sessions for $package.
2120
2121 You may safely delete it if you wish.
2122 EOF
2123
2124 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2125 case "$usedevel" in
2126 $define|true|[yY]*) ;;
2127 *) case "$xversion" in
2128    *[13579])
2129         cat >&4 <<EOH
2130 *** WHOA THERE!!! ***
2131
2132     This is an UNSTABLE DEVELOPMENT release.
2133     The version of this $package distribution is $xversion, that is, odd,
2134     (as opposed to even) and that signifies a development release.
2135     If you want a maintenance release, you want an even-numbered version.
2136
2137     Do ***NOT*** install this into production use.
2138     Data corruption and crashes are possible.
2139
2140     It is most seriously suggested that you do not continue any further
2141     unless you want to help in developing and debugging Perl.
2142
2143     If you *still* want to build perl, you can answer 'y' now,
2144     or pass -Dusedevel to Configure.
2145
2146 EOH
2147         rp='Do you really want to continue?'
2148         dflt='n'
2149         . ./myread
2150         case "$ans" in
2151         [yY]) echo >&4 "Okay, continuing."
2152               usedevel="$define" ;;
2153         *) echo >&4 "Okay, bye."
2154            exit 1
2155            ;;
2156         esac
2157         ;;
2158     esac
2159     ;;
2160 esac
2161 case "$usedevel" in
2162 $define|true|[yY]*)
2163         case "$versiononly" in
2164         '') versiononly="$define" ;;
2165         esac
2166         case "$installusrbinperl" in
2167         '') installusrbinperl="$undef" ;;
2168         esac
2169         ;;
2170 esac
2171
2172 : general instructions
2173 needman=true
2174 firsttime=true
2175 user=`(logname) 2>/dev/null`
2176 case "$user" in
2177 '') user=`whoami 2>&1`;;
2178 esac
2179 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2180         firsttime=false
2181         echo " "
2182         rp='Would you like to see the instructions?'
2183         dflt=n
2184         . ./myread
2185         case "$ans" in
2186         [yY]*) ;;
2187         *) needman=false;;
2188         esac
2189 fi
2190 if $needman; then
2191         cat <<EOH
2192
2193 This installation shell script will examine your system and ask you questions
2194 to determine how the perl5 package should be installed. If you get
2195 stuck on a question, you may use a ! shell escape to start a subshell or
2196 execute a command.  Many of the questions will have default answers in square
2197 brackets; typing carriage return will give you the default.
2198
2199 On some of the questions which ask for file or directory names you are allowed
2200 to use the ~name construct to specify the login directory belonging to "name",
2201 even if you don't have a shell which knows about that.  Questions where this is
2202 allowed will be marked "(~name ok)".
2203
2204 EOH
2205         rp=''
2206         dflt='Type carriage return to continue'
2207         . ./myread
2208         cat <<'EOH'
2209
2210 The prompter used in this script allows you to use shell variables and
2211 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2212 in the default answer, as if the default line was a set of arguments given to a
2213 script shell.  This means you may also use $* to repeat the whole default line,
2214 so you do not have to re-type everything to add something to the default.
2215
2216 Everytime there is a substitution, you will have to confirm.  If there is an
2217 error (e.g. an unmatched backtick), the default answer will remain unchanged
2218 and you will be prompted again.
2219
2220 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2221 the questions and use the computed defaults (or the previous answers if there
2222 was already a config.sh file). Type 'Configure -h' for a list of options.
2223 You may also start interactively and then answer '& -d' at any prompt to turn
2224 on the non-interactive behaviour for the remainder of the execution.
2225
2226 EOH
2227         . ./myread
2228         cat <<EOH
2229
2230 Much effort has been expended to ensure that this shell script will run on any
2231 Unix system.  If despite that it blows up on yours, your best bet is to edit
2232 Configure and run it again.  If you can't run Configure for some reason,
2233 you'll have to generate a config.sh file by hand.  Whatever problems you
2234 have, let me (perlbug@perl.org) know how I blew it.
2235
2236 This installation script affects things in two ways:
2237
2238 1) it may do direct variable substitutions on some of the files included
2239    in this kit.
2240 2) it builds a config.h file for inclusion in C programs.  You may edit
2241    any of these files as the need arises after running this script.
2242
2243 If you make a mistake on a question, there is no easy way to back up to it
2244 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2245 files.  Configure will offer to let you do this before it runs the SH files.
2246
2247 EOH
2248         dflt='Type carriage return to continue'
2249         . ./myread
2250         case "$firsttime" in
2251         true) echo $user >>../.config/instruct;;
2252         esac
2253 fi
2254
2255 : find out where common programs are
2256 echo " "
2257 echo "Locating common programs..." >&4
2258 cat <<EOSC >loc
2259 $startsh
2260 case \$# in
2261 0) exit 1;;
2262 esac
2263 thing=\$1
2264 shift
2265 dflt=\$1
2266 shift
2267 for dir in \$*; do
2268         case "\$thing" in
2269         .)
2270         if test -d \$dir/\$thing; then
2271                 echo \$dir
2272                 exit 0
2273         fi
2274         ;;
2275         *)
2276         for thisthing in \$dir/\$thing; do
2277                 : just loop through to pick last item
2278         done
2279         if test -f \$thisthing; then
2280                 echo \$thisthing
2281                 exit 0
2282         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2283                 echo \$thisthing
2284                 exit 0
2285         elif test -f \$dir/\$thing.exe; then
2286                 if test -n "$DJGPP"; then
2287                         echo \$dir/\$thing.exe
2288                 elif test "$eunicefix" != ":"; then
2289                         : on Eunice apparently
2290                         echo \$dir/\$thing
2291                         exit 0
2292                 fi
2293                 exit 0
2294         fi
2295         ;;
2296         esac
2297 done
2298 echo \$dflt
2299 exit 1
2300 EOSC
2301 chmod +x loc
2302 $eunicefix loc
2303 loclist="
2304 awk
2305 cat
2306 chmod
2307 comm
2308 cp
2309 echo
2310 expr
2311 grep
2312 ls
2313 mkdir
2314 rm
2315 sed
2316 sort
2317 touch
2318 tr
2319 uniq
2320 "
2321 trylist="
2322 Mcc
2323 ar
2324 bison
2325 byacc
2326 cpp
2327 csh
2328 date
2329 egrep
2330 gmake
2331 gzip
2332 less
2333 ln
2334 make
2335 more
2336 nm
2337 nroff
2338 pg
2339 test
2340 uname
2341 zip
2342 "
2343 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2344 pth="$pth /lib /usr/lib"
2345 for file in $loclist; do
2346         eval xxx=\$$file
2347         case "$xxx" in
2348         /*|?:[\\/]*)
2349                 if test -f "$xxx"; then
2350                         : ok
2351                 else
2352                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2353                         xxx=`./loc $file $file $pth`
2354                 fi
2355                 ;;
2356         '') xxx=`./loc $file $file $pth`;;
2357         *) xxx=`./loc $xxx $xxx $pth`;;
2358         esac
2359         eval $file=$xxx$_exe
2360         eval _$file=$xxx
2361         case "$xxx" in
2362         /*)
2363                 echo $file is in $xxx.
2364                 ;;
2365         ?:[\\/]*)
2366                 echo $file is in $xxx.
2367                 ;;
2368         *)
2369                 echo "I don't know where '$file' is, and my life depends on it." >&4
2370                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2371                 exit 1
2372                 ;;
2373         esac
2374 done
2375 echo " "
2376 echo "Don't worry if any of the following aren't found..."
2377 say=offhand
2378 for file in $trylist; do
2379         eval xxx=\$$file
2380         case "$xxx" in
2381         /*|?:[\\/]*)
2382                 if test -f "$xxx"; then
2383                         : ok
2384                 else
2385                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2386                         xxx=`./loc $file $file $pth`
2387                 fi
2388                 ;;
2389         '') xxx=`./loc $file $file $pth`;;
2390         *) xxx=`./loc $xxx $xxx $pth`;;
2391         esac
2392         eval $file=$xxx$_exe
2393         eval _$file=$xxx
2394         case "$xxx" in
2395         /*)
2396                 echo $file is in $xxx.
2397                 ;;
2398         ?:[\\/]*)
2399                 echo $file is in $xxx.
2400                 ;;
2401         *)
2402                 echo "I don't see $file out there, $say."
2403                 say=either
2404                 ;;
2405         esac
2406 done
2407 case "$egrep" in
2408 egrep)
2409         echo "Substituting grep for egrep."
2410         egrep=$grep
2411         _egrep=$grep
2412         ;;
2413 esac
2414 case "$ln" in
2415 ln)
2416         echo "Substituting cp for ln."
2417         ln=$cp
2418         _ln=$cp
2419         ;;
2420 esac
2421 case "$make" in
2422 make)   
2423         case "$gmake" in
2424         gmake)
2425         echo "I can't find make or gmake, and my life depends on it." >&4
2426         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2427         exit 1
2428         ;;
2429         esac
2430         ;;
2431 esac    
2432 case "$gmake" in
2433 gmake)  ;;
2434 *)      # We can't have osname yet.
2435         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2436                 # Assume that gmake, if found, is definitely GNU make
2437                 # and prefer it over the system make.
2438                 echo "Substituting gmake for make."
2439                 make=$gmake
2440                 _make=$gmake
2441         fi
2442         ;;
2443 esac
2444 case "$test" in
2445 test)
2446         echo "Hopefully test is built into your sh."
2447         ;;
2448 *)
2449         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2450                 echo "Using the test built into your sh."
2451                 test=test
2452                 _test=test
2453         fi
2454         ;;
2455 esac
2456 case "$echo" in
2457 echo)
2458         echo "Hopefully echo is built into your sh."
2459         ;;
2460 '') ;;
2461 *)
2462         echo " "
2463 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2464         $echo $n "hi there$c" >foo1
2465         echo $n "hi there$c" >foo2
2466         if cmp foo1 foo2 >/dev/null 2>&1; then
2467                 echo "They are compatible.  In fact, they may be identical."
2468         else
2469                 case "$n" in
2470                 '-n') n='' c='\c';;
2471                 *) n='-n' c='';;
2472                 esac
2473                 cat <<FOO
2474 They are not compatible!  You are probably running ksh on a non-USG system.
2475 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2476 have echo built in and we may have to run some Bourne shell scripts.  That
2477 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2478
2479 FOO
2480                 $echo $n "The star should be here-->$c"
2481                 $echo "*"
2482         fi
2483         $rm -f foo1 foo2
2484         ;;
2485 esac
2486
2487 cat <<EOS >trygcc
2488 $startsh
2489 EOS
2490 cat <<'EOSC' >>trygcc
2491 case "$cc" in
2492 '') ;;
2493 *)  $rm -f try try.*
2494     $cat >try.c <<EOM
2495 int main(int argc, char *argv[]) {
2496   return 0;
2497 }
2498 EOM
2499     if $cc -o try $ccflags $ldflags try.c; then
2500        :
2501     else
2502         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2503         despair=yes
2504         trygcc=yes
2505         case "$cc" in
2506         *gcc*) trygcc=no ;;
2507         esac
2508         # Skip this test because it gives a false match on output like:
2509         #    ./trygcc: line 23: cc: command not found
2510         # case "`$cc -v -c try.c 2>&1`" in
2511         # *gcc*) trygcc=no ;;
2512         # esac
2513         if $test X"$trygcc" = Xyes; then
2514             if gcc -o try -c try.c; then
2515                 echo " "
2516                 echo "You seem to have a working gcc, though." >&4
2517                 # Switching compilers may undo the work of hints files.
2518                 # The most common problem is -D_REENTRANT for threads.
2519                 # This heuristic catches that case, but gets false positives
2520                 # if -Dusethreads was not actually specified.  Better to
2521                 # bail out here with a useful message than fail 
2522                 # mysteriously later. Should we perhaps just try to
2523                 # re-invoke Configure -Dcc=gcc config_args ?
2524                 if $test -f usethreads.cbu; then
2525                         $cat >&4 <<EOM 
2526
2527 *** However, any setting of the C compiler flags (e.g. for thread support)
2528 *** will be lost.  It may be necessary for you to restart Configure and
2529 *** add -Dcc=gcc to your Configure command line.
2530
2531 EOM
2532                         rp="Would you like to go ahead and try gcc anyway?"
2533                         dflt=n
2534                 else
2535                         rp="Would you like to use it?"
2536                         dflt=y
2537                 fi
2538                 if $test -f myread; then
2539                     . ./myread
2540                 else
2541                     if $test -f UU/myread; then
2542                         . ./UU/myread
2543                     else
2544                         echo "Cannot find myread, sorry.  Aborting." >&2
2545                         exit 1
2546                     fi
2547                 fi  
2548                 case "$ans" in
2549                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2550                 esac
2551             fi
2552         fi
2553     fi
2554     $rm -f try try.*
2555     ;;
2556 esac
2557 EOSC
2558
2559 cat <<EOS >checkcc
2560 $startsh
2561 EOS
2562 cat <<'EOSC' >>checkcc
2563 case "$cc" in        
2564 '') ;;
2565 *)  $rm -f try try.*              
2566     $cat >try.c <<EOM
2567 int main(int argc, char *argv[]) {
2568   return 0;
2569 }
2570 EOM
2571     if $cc -o try $ccflags $ldflags try.c; then
2572        :
2573     else
2574         if $test X"$despair" = Xyes; then
2575            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2576         fi
2577         $cat >&4 <<EOM         
2578 You need to find a working C compiler.
2579 Either (purchase and) install the C compiler supplied by your OS vendor,
2580 or for a free C compiler try http://gcc.gnu.org/
2581 I cannot continue any further, aborting.
2582 EOM
2583         exit 1
2584     fi
2585     $rm -f try try.*
2586     ;;
2587 esac
2588 EOSC
2589
2590 : determine whether symbolic links are supported
2591 echo " "
2592 $touch blurfl
2593 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2594         echo "Symbolic links are supported." >&4
2595         lns="$ln -s"
2596 else
2597         echo "Symbolic links are NOT supported." >&4
2598         lns="$ln"
2599 fi
2600 $rm -f blurfl sym
2601
2602 : determine whether symbolic links are supported
2603 echo " "
2604 case "$lns" in
2605 *"ln"*" -s")
2606         echo "Checking how to test for symbolic links..." >&4
2607         $lns blurfl sym
2608         if $test "X$issymlink" = X; then
2609                 case "$newsh" in
2610                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2611                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2612                 esac
2613                 if test $? = 0; then
2614                         issymlink="test -h"
2615                 else
2616                         echo "Your builtin 'test -h' may be broken." >&4
2617                         case "$test" in
2618                         /*)     ;;
2619                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2620                                 for p in $pth
2621                                 do
2622                                         if test -f "$p/$test"; then
2623                                                 test="$p/$test"
2624                                                 break
2625                                         fi
2626                                 done
2627                                 ;;
2628                         esac
2629                         case "$test" in
2630                         /*)
2631                                 echo "Trying external '$test -h'." >&4
2632                                 issymlink="$test -h"
2633                                 if $test ! -h sym >/dev/null 2>&1; then
2634                                         echo "External '$test -h' is broken, too." >&4
2635                                         issymlink=''
2636                                 fi
2637                                 ;;
2638                         *)      issymlink='' ;;
2639                         esac
2640                 fi              
2641         fi
2642         if $test "X$issymlink" = X; then
2643                 if $test -L sym 2>/dev/null; then
2644                         issymlink="$test -L"
2645                         echo "The builtin '$test -L' worked." >&4
2646                 fi
2647         fi
2648         if $test "X$issymlink" != X; then
2649                 echo "You can test for symbolic links with '$issymlink'." >&4
2650         else
2651                 echo "I do not know how you can test for symbolic links." >&4
2652         fi
2653         $rm -f blurfl sym
2654         ;;
2655 *)      echo "No symbolic links, so not testing for their testing..." >&4
2656         ;;
2657 esac
2658 echo " "
2659
2660
2661 case "$mksymlinks" in
2662 $define|true|[yY]*)
2663         case "$src" in
2664         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2665                 exit 1
2666                 ;;
2667         *)      case "$lns:$issymlink" in
2668                 *"ln"*" -s:"*"test -"?)
2669                         echo "Creating the symbolic links..." >&4
2670                         echo "(First creating the subdirectories...)" >&4
2671                         cd ..
2672                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2673                                 read directory
2674                                 test -z "$directory" && break
2675                                 mkdir -p $directory
2676                         done
2677                         # Sanity check 1.
2678                         if test ! -d t/base; then
2679                                 echo "Failed to create the subdirectories.  Aborting." >&4
2680                                 exit 1
2681                         fi
2682                         echo "(Then creating the symlinks...)" >&4
2683                         awk '{print $1}' $src/MANIFEST | while true; do
2684                                 read filename
2685                                 test -z "$filename" && break
2686                                 if test -f $filename; then
2687                                         if $issymlink $filename; then
2688                                                 rm -f $filename
2689                                         fi
2690                                 fi
2691                                 if test -f $filename; then
2692                                         echo "$filename already exists, not symlinking."
2693                                 else
2694                                         ln -s $src/$filename $filename
2695                                 fi
2696                         done
2697                         # Sanity check 2.
2698                         if test ! -f t/base/lex.t; then
2699                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2700                                 exit 1
2701                         fi
2702                         cd UU
2703                         ;;
2704                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2705                         ;;
2706                 esac
2707                 ;;
2708         esac
2709         ;;
2710 esac
2711
2712
2713 case "$usecrosscompile" in
2714 $define|true|[yY]*)
2715         $echo "Cross-compiling..."
2716         croak=''
2717         case "$cc" in
2718         *-*-gcc) # A cross-compiling gcc, probably.
2719             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2720             ar=$targetarch-ar
2721             # leave out ld, choosing it is more complex
2722             nm=$targetarch-nm
2723             ranlib=$targetarch-ranlib
2724             $echo 'extern int foo;' > try.c
2725             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2726             shift
2727             if $test $# -gt 0; then
2728                 incpth="$incpth $*"
2729                 incpth="`$echo $incpth|$sed 's/^ //'`"
2730                 echo "Guessing incpth '$incpth'." >&4
2731                 for i in $*; do
2732                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2733                     if $test -d $j; then
2734                         libpth="$libpth $j"
2735                     fi
2736                 done   
2737                 libpth="`$echo $libpth|$sed 's/^ //'`"
2738                 echo "Guessing libpth '$libpth'." >&4
2739             fi
2740             $rm -f try.c
2741             ;;
2742         esac
2743         case "$targetarch" in
2744         '') echo "Targetarch not defined." >&4; croak=y ;;
2745         *)  echo "Using targetarch $targetarch." >&4 ;;
2746         esac
2747         case "$incpth" in
2748         '') echo "Incpth not defined." >&4; croak=y ;;
2749         *)  echo "Using incpth '$incpth'." >&4 ;;
2750         esac
2751         case "$libpth" in
2752         '') echo "Libpth not defined." >&4; croak=y ;;
2753         *)  echo "Using libpth '$libpth'." >&4 ;;
2754         esac
2755         case "$usrinc" in
2756         '') for i in $incpth; do
2757                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2758                     usrinc=$i
2759                     echo "Guessing usrinc $usrinc." >&4
2760                     break
2761                 fi
2762             done
2763             case "$usrinc" in
2764             '') echo "Usrinc not defined." >&4; croak=y ;;
2765             esac
2766             ;;
2767         *)  echo "Using usrinc $usrinc." >&4 ;;
2768         esac
2769         case "$targethost" in
2770         '') echo "Targethost not defined." >&4; croak=y ;;
2771         *)  echo "Using targethost $targethost." >&4
2772         esac
2773         locincpth=' '
2774         loclibpth=' '
2775         case "$croak" in
2776         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2777         esac
2778         case "$src" in
2779         /*) run=$src/Cross/run
2780             targetmkdir=$src/Cross/mkdir
2781             to=$src/Cross/to
2782             from=$src/Cross/from
2783             ;;
2784         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2785             run=$pwd/Cross/run
2786             targetmkdir=$pwd/Cross/mkdir
2787             to=$pwd/Cross/to
2788             from=$pwd/Cross/from
2789             ;;
2790         esac
2791         case "$targetrun" in
2792         '') targetrun=ssh ;;
2793         esac
2794         case "$targetto" in
2795         '') targetto=scp ;;
2796         esac
2797         case "$targetfrom" in
2798         '') targetfrom=scp ;;
2799         esac
2800         run=$run-$targetrun
2801         to=$to-$targetto
2802         from=$from-$targetfrom
2803         case "$targetdir" in
2804         '')  targetdir=/tmp
2805              echo "Guessing targetdir $targetdir." >&4
2806              ;;
2807         esac
2808         case "$targetuser" in
2809         '')  targetuser=root
2810              echo "Guessing targetuser $targetuser." >&4
2811              ;;
2812         esac
2813         case "$targetfrom" in
2814         scp)    q=-q ;;
2815         *)      q='' ;;
2816         esac
2817         case "$targetrun" in
2818         ssh|rsh)
2819             cat >$run <<EOF
2820 #!/bin/sh
2821 case "\$1" in
2822 -cwd)
2823   shift
2824   cwd=\$1
2825   shift
2826   ;;
2827 esac
2828 case "\$cwd" in
2829 '') cwd=$targetdir ;;
2830 esac
2831 exe=\$1
2832 shift
2833 if $test ! -f \$exe.xok; then
2834   $to \$exe
2835   $touch \$exe.xok
2836 fi
2837 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2838 EOF
2839             ;;
2840         *)  echo "Unknown targetrun '$targetrun'" >&4
2841             exit 1
2842             ;;
2843         esac
2844         case "$targetmkdir" in
2845         */Cross/mkdir)
2846             cat >$targetmkdir <<EOF
2847 #!/bin/sh
2848 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2849 EOF
2850             $chmod a+rx $targetmkdir
2851             ;;
2852         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2853             exit 1
2854             ;;
2855         esac
2856         case "$targetto" in
2857         scp|rcp)
2858             cat >$to <<EOF
2859 #!/bin/sh
2860 for f in \$@
2861 do
2862   case "\$f" in
2863   /*)
2864     $targetmkdir \`dirname \$f\`
2865     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2866     ;;
2867   *)
2868     $targetmkdir $targetdir/\`dirname \$f\`
2869     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2870     ;;
2871   esac
2872 done
2873 exit 0
2874 EOF
2875             ;;
2876         cp) cat >$to <<EOF
2877 #!/bin/sh
2878 for f in \$@
2879 do
2880   case "\$f" in
2881   /*)
2882     $mkdir -p $targetdir/\`dirname \$f\`
2883     $cp \$f $targetdir/\$f || exit 1
2884     ;;
2885   *)
2886     $targetmkdir $targetdir/\`dirname \$f\`
2887     $cp \$f $targetdir/\$f || exit 1
2888     ;;
2889   esac
2890 done
2891 exit 0
2892 EOF
2893             ;;
2894         *)  echo "Unknown targetto '$targetto'" >&4
2895             exit 1
2896             ;;
2897         esac
2898         case "$targetfrom" in
2899         scp|rcp)
2900           cat >$from <<EOF
2901 #!/bin/sh
2902 for f in \$@
2903 do
2904   $rm -f \$f
2905   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2906 done
2907 exit 0
2908 EOF
2909             ;;
2910         cp) cat >$from <<EOF
2911 #!/bin/sh
2912 for f in \$@
2913 do
2914   $rm -f \$f
2915   cp $targetdir/\$f . || exit 1
2916 done
2917 exit 0
2918 EOF
2919             ;;
2920         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2921             exit 1
2922             ;;
2923         esac
2924         if $test ! -f $run; then
2925             echo "Target 'run' script '$run' not found." >&4
2926         else
2927             $chmod a+rx $run
2928         fi
2929         if $test ! -f $to; then
2930             echo "Target 'to' script '$to' not found." >&4
2931         else
2932             $chmod a+rx $to
2933         fi
2934         if $test ! -f $from; then
2935             echo "Target 'from' script '$from' not found." >&4
2936         else
2937             $chmod a+rx $from
2938         fi
2939         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2940             exit 1
2941         fi
2942         cat >&4 <<EOF
2943 Using '$run' for remote execution,
2944 and '$from' and '$to'
2945 for remote file transfer.
2946 EOF
2947         ;;
2948 *)      run=''
2949         to=:
2950         from=:
2951         usecrosscompile='undef'
2952         targetarch=''
2953         ;;
2954 esac
2955
2956 : see whether [:lower:] and [:upper:] are supported character classes
2957 echo " "
2958 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2959 ABYZ)
2960         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2961         up='[:upper:]'
2962         low='[:lower:]'
2963         ;;
2964 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2965         # (0xd9 and 0xe2), therefore that is a nice testing point.
2966         if test "X$up" = X -o "X$low" = X; then
2967             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2968             rs) up='[A-Z]'
2969                 low='[a-z]'
2970                 ;;
2971             esac
2972         fi
2973         if test "X$up" = X -o "X$low" = X; then
2974             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2975             rs) up='A-Z'
2976                 low='a-z'
2977                 ;;
2978             esac
2979         fi
2980         if test "X$up" = X -o "X$low" = X; then
2981             case "`echo RS | od -x 2>/dev/null`" in
2982             *D9E2*|*d9e2*)
2983                 echo "Hey, this might be EBCDIC." >&4
2984                 if test "X$up" = X -o "X$low" = X; then
2985                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2986                     rs) up='[A-IJ-RS-Z]'
2987                         low='[a-ij-rs-z]'
2988                         ;;
2989                     esac
2990                 fi
2991                 if test "X$up" = X -o "X$low" = X; then
2992                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2993                     rs) up='A-IJ-RS-Z'
2994                         low='a-ij-rs-z'
2995                         ;;
2996                     esac
2997                 fi
2998                 ;;
2999             esac
3000         fi
3001 esac
3002 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3003 rs)
3004     echo "Using $up and $low to convert case." >&4
3005     ;;
3006 *)
3007     echo "I don't know how to translate letters from upper to lower case." >&4
3008     echo "Your tr is not acting any way I know of." >&4
3009     exit 1
3010     ;;
3011 esac
3012 : set up the translation script tr, must be called with ./tr of course
3013 cat >tr <<EOSC
3014 $startsh
3015 case "\$1\$2" in
3016 '[A-Z][a-z]') exec $tr '$up' '$low';;
3017 '[a-z][A-Z]') exec $tr '$low' '$up';;
3018 esac
3019 exec $tr "\$@"
3020 EOSC
3021 chmod +x tr
3022 $eunicefix tr
3023
3024 : Try to determine whether config.sh was made on this system
3025 case "$config_sh" in
3026 '')
3027 myuname=`$uname -a 2>/dev/null`
3028 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3029 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3030 # because the A-Z/a-z are not consecutive.
3031 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3032         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3033 newmyuname="$myuname"
3034 dflt=n
3035 case "$knowitall" in
3036 '')
3037         if test -f ../config.sh; then
3038                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3039                         eval "`grep myuname= ../config.sh`"
3040                 fi
3041                 if test "X$myuname" = "X$newmyuname"; then
3042                         dflt=y
3043                 fi
3044         fi
3045         ;;
3046 *) dflt=y;;
3047 esac
3048
3049 : Get old answers from old config file if Configure was run on the
3050 : same system, otherwise use the hints.
3051 hint=default
3052 cd ..
3053 if test -f config.sh; then
3054         echo " "
3055         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3056         . UU/myread
3057         case "$ans" in
3058         n*|N*) echo "OK, I'll ignore it."
3059                 mv config.sh config.sh.old
3060                 myuname="$newmyuname"
3061                 ;;
3062         *)  echo "Fetching default answers from your old config.sh file..." >&4
3063                 tmp_n="$n"
3064                 tmp_c="$c"
3065                 tmp_sh="$sh"
3066                 . ./config.sh
3067                 cp config.sh UU
3068                 n="$tmp_n"
3069                 c="$tmp_c"
3070                 : Older versions did not always set $sh.  Catch re-use of such
3071                 : an old config.sh.
3072                 case "$sh" in
3073                 '') sh="$tmp_sh" ;;
3074                 esac
3075                 hint=previous
3076                 ;;
3077         esac
3078 fi
3079 . ./UU/checkcc
3080 if test ! -f config.sh; then
3081         $cat <<EOM
3082
3083 First time through, eh?  I have some defaults handy for some systems
3084 that need some extra help getting the Configure answers right:
3085
3086 EOM
3087         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3088         dflt=''
3089         : Half the following guesses are probably wrong... If you have better
3090         : tests or hints, please send them to perlbug@perl.org
3091         : The metaconfig authors would also appreciate a copy...
3092         $test -f /irix && osname=irix
3093         $test -f /xenix && osname=sco_xenix
3094         $test -f /dynix && osname=dynix
3095         $test -f /dnix && osname=dnix
3096         $test -f /lynx.os && osname=lynxos
3097         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3098         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3099         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3100         $test -f /bin/mips && /bin/mips && osname=mips
3101         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3102                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3103         $test -d /usr/apollo/bin && osname=apollo
3104         $test -f /etc/saf/_sactab && osname=svr4
3105         $test -d /usr/include/minix && osname=minix
3106         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3107         if $test -d /MachTen -o -d /MachTen_Folder; then
3108                 osname=machten
3109                 if $test -x /sbin/version; then
3110                         osvers=`/sbin/version | $awk '{print $2}' |
3111                         $sed -e 's/[A-Za-z]$//'`
3112                 elif $test -x /usr/etc/version; then
3113                         osvers=`/usr/etc/version | $awk '{print $2}' |
3114                         $sed -e 's/[A-Za-z]$//'`
3115                 else
3116                         osvers="$2.$3"
3117                 fi
3118         fi
3119
3120         $test -f /sys/posix.dll &&
3121                 $test -f /usr/bin/what &&
3122                 set X `/usr/bin/what /sys/posix.dll` &&
3123                 $test "$3" = UWIN &&
3124                 osname=uwin &&
3125                 osvers="$5"
3126
3127         if $test -f $uname; then
3128                 set X $myuname
3129                 shift
3130
3131                 case "$5" in
3132                 fps*) osname=fps ;;
3133                 mips*)
3134                         case "$4" in
3135                         umips) osname=umips ;;
3136                         *) osname=mips ;;
3137                         esac;;
3138                 [23]100) osname=mips ;;
3139                 next*) osname=next ;;
3140                 i386*)
3141                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3142                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3143                                 osname='sco'
3144                                 osvers=$tmp
3145                         elif $test -f /etc/kconfig; then
3146                                 osname=isc
3147                                 if test "$lns" = "$ln -s"; then
3148                                         osvers=4
3149                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3150                                         osvers=3
3151                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3152                                         osvers=2
3153                                 fi
3154                         fi
3155                         tmp=''
3156                         ;;
3157                 pc*)
3158                         if test -n "$DJGPP"; then
3159                                 osname=dos
3160                                 osvers=djgpp
3161                         fi
3162                         ;;
3163                 esac
3164
3165                 case "$1" in
3166                 aix) osname=aix
3167                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3168                         case "$tmp" in
3169                         # oslevel can fail with:
3170                         # oslevel: Unable to acquire lock.
3171                         *not\ found) osvers="$4"."$3" ;;
3172                         '<3240'|'<>3240') osvers=3.2.0 ;;
3173                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3174                         '=3250'|'>3250') osvers=3.2.5 ;;
3175                         *) osvers=$tmp;;
3176                         esac
3177                         ;;
3178                 bsd386) osname=bsd386
3179                         osvers=`$uname -r`
3180                         ;;
3181                 cygwin*) osname=cygwin
3182                         osvers="$3"
3183                         ;;
3184                 *dc.osx) osname=dcosx
3185                         osvers="$3"
3186                         ;;
3187                 dnix) osname=dnix
3188                         osvers="$3"
3189                         ;;
3190                 domainos) osname=apollo
3191                         osvers="$3"
3192                         ;;
3193                 dgux)   osname=dgux
3194                         osvers="$3"
3195                         ;;
3196                 dragonfly) osname=dragonfly
3197                         osvers="$3"
3198                         ;;
3199                 dynixptx*) osname=dynixptx
3200                         osvers=`echo "$4"|sed 's/^v//'`
3201                         ;;
3202                 freebsd) osname=freebsd
3203                         osvers="$3" ;;
3204                 genix)  osname=genix ;;
3205                 gnu)    osname=gnu
3206                         osvers="$3" ;;
3207                 hp*)    osname=hpux
3208                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3209                         ;;
3210                 irix*)  osname=irix
3211                         case "$3" in
3212                         4*) osvers=4 ;;
3213                         5*) osvers=5 ;;
3214                         *)      osvers="$3" ;;
3215                         esac
3216                         ;;
3217                 linux)  osname=linux
3218                         case "$3" in
3219                         *)      osvers="$3" ;;
3220                         esac
3221                         ;;
3222                 MiNT)   osname=mint
3223                         ;;
3224                 netbsd*) osname=netbsd
3225                         osvers="$3"
3226                         ;;
3227                 news-os) osvers="$3"
3228                         case "$3" in
3229                         4*) osname=newsos4 ;;
3230                         *) osname=newsos ;;
3231                         esac
3232                         ;;
3233                 next*) osname=next ;;
3234                 nonstop-ux) osname=nonstopux ;;
3235                 openbsd) osname=openbsd
3236                         osvers="$3"
3237                         ;;
3238                 os2)    osname=os2
3239                         osvers="$4"
3240                         ;;
3241                 POSIX-BC | posix-bc ) osname=posix-bc
3242                         osvers="$3"
3243                         ;;
3244                 powerux | power_ux | powermax_os | powermaxos | \
3245                 powerunix | power_unix) osname=powerux
3246                         osvers="$3"
3247                         ;;
3248                 qnx) osname=qnx
3249                         osvers="$4"
3250                         ;;
3251                 solaris) osname=solaris
3252                         case "$3" in
3253                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3254                         *)      osvers="$3" ;;
3255                         esac
3256                         ;;
3257                 sunos) osname=sunos
3258                         case "$3" in
3259                         5*) osname=solaris
3260                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3261                         *)      osvers="$3" ;;
3262                         esac
3263                         ;;
3264                 titanos) osname=titanos
3265                         case "$3" in
3266                         1*) osvers=1 ;;
3267                         2*) osvers=2 ;;
3268                         3*) osvers=3 ;;
3269                         4*) osvers=4 ;;
3270                         *)      osvers="$3" ;;
3271                         esac
3272                         ;;
3273                 ultrix) osname=ultrix
3274                         osvers="$3"
3275                         ;;
3276                 osf1|mls+)      case "$5" in
3277                                 alpha)
3278                                         osname=dec_osf
3279                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3280                                         case "$osvers" in
3281                                         [1-9].[0-9]*) ;;
3282                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3283                                         esac
3284                                         ;;
3285                         hp*)    osname=hp_osf1  ;;
3286                         mips)   osname=mips_osf1 ;;
3287                         esac
3288                         ;;
3289                 # UnixWare 7.1.2 is known as Open UNIX 8
3290                 openunix|unixware) osname=svr5
3291                         osvers="$4"
3292                         ;;
3293                 uts)    osname=uts
3294                         osvers="$3"
3295                         ;;
3296                 vos) osvers="$3"
3297                         ;;
3298                 $2) case "$osname" in
3299                         *isc*) ;;
3300                         *freebsd*) ;;
3301                         svr*)
3302                                 : svr4.x or possibly later
3303                                 case "svr$3" in
3304                                 ${osname}*)
3305                                         osname=svr$3
3306                                         osvers=$4
3307                                         ;;
3308                                 esac
3309                                 case "$osname" in
3310                                 svr4.0)
3311                                         : Check for ESIX
3312                                         if test -f /stand/boot ; then
3313                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3314                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3315                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3316                                                         if test -n "$isesix"; then
3317                                                                 osname=esix4
3318                                                         fi
3319                                                 fi
3320                                         fi
3321                                         ;;
3322                                 esac
3323                                 ;;
3324                         *)      if test -f /etc/systemid; then
3325                                         osname=sco
3326                                         set `echo $3 | $sed 's/\./ /g'` $4
3327                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3328                                                 osvers=$1.$2.$3
3329                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3330                                                 osvers=$1.$2
3331                                         elif $test -f $src/hints/sco_$1.sh; then
3332                                                 osvers=$1
3333                                         fi
3334                                 else
3335                                         case "$osname" in
3336                                         '') : Still unknown.  Probably a generic Sys V.
3337                                                 osname="sysv"
3338                                                 osvers="$3"
3339                                                 ;;
3340                                         esac
3341                                 fi
3342                                 ;;
3343                         esac
3344                         ;;
3345                 *)      case "$osname" in
3346                         '') : Still unknown.  Probably a generic BSD.
3347                                 osname="$1"
3348                                 osvers="$3"
3349                                 ;;
3350                         esac
3351                         ;;
3352                 esac
3353         else
3354                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3355                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3356                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3357                                 osname=news_os
3358                         fi
3359                         $rm -f UU/kernel.what
3360                 elif test -d c:/. -o -n "$is_os2" ; then
3361                         set X $myuname
3362                         osname=os2
3363                         osvers="$5"
3364                 fi
3365         fi
3366
3367         case "$targetarch" in
3368         '') ;;
3369         *)  hostarch=$osname
3370             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3371             osvers=''
3372             ;;
3373         esac
3374
3375         : Now look for a hint file osname_osvers, unless one has been
3376         : specified already.
3377         case "$hintfile" in
3378         ''|' ')
3379                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3380                 : Also try without trailing minor version numbers.
3381                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3382                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3383                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3384                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3385                 case "$file" in
3386                 '') dflt=none ;;
3387                 *)  case "$osvers" in
3388                         '') dflt=$file
3389                                 ;;
3390                         *)  if $test -f $src/hints/$file.sh ; then
3391                                         dflt=$file
3392                                 elif $test -f $src/hints/$xfile.sh ; then
3393                                         dflt=$xfile
3394                                 elif $test -f $src/hints/$xxfile.sh ; then
3395                                         dflt=$xxfile
3396                                 elif $test -f $src/hints/$xxxfile.sh ; then
3397                                         dflt=$xxxfile
3398                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3399                                         dflt=$xxxxfile
3400                                 elif $test -f "$src/hints/${osname}.sh" ; then
3401                                         dflt="${osname}"
3402                                 else
3403                                         dflt=none
3404                                 fi
3405                                 ;;
3406                         esac
3407                         ;;
3408                 esac
3409                 if $test -f Policy.sh ; then
3410                         case "$dflt" in
3411                         *Policy*) ;;
3412                         none) dflt="Policy" ;;
3413                         *) dflt="Policy $dflt" ;;
3414                         esac
3415                 fi
3416                 ;;
3417         *)
3418                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3419                 ;;
3420         esac
3421
3422         if $test -f Policy.sh ; then
3423                 $cat <<EOM
3424
3425 There's also a Policy hint file available, which should make the
3426 site-specific (policy) questions easier to answer.
3427 EOM
3428
3429         fi
3430
3431         $cat <<EOM
3432
3433 You may give one or more space-separated answers, or "none" if appropriate.
3434 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3435 previous run of Configure, you may specify it as well as or instead of
3436 OS-specific hints.  If hints are provided for your OS, you should use them:
3437 although Perl can probably be built without hints on many platforms, using
3438 hints often improve performance and may enable features that Configure can't
3439 set up on its own. If there are no hints that match your OS, specify "none";
3440 DO NOT give a wrong version or a wrong OS.
3441
3442 EOM
3443
3444         rp="Which of these apply, if any?"
3445         . UU/myread
3446         tans=$ans
3447         for file in $tans; do
3448                 if $test X$file = XPolicy -a -f Policy.sh; then
3449                         . Policy.sh
3450                         $cat Policy.sh >> UU/config.sh
3451                 elif $test -f $src/hints/$file.sh; then
3452                         . $src/hints/$file.sh
3453                         $cat $src/hints/$file.sh >> UU/config.sh
3454                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3455                         : nothing
3456                 else
3457                         : Give one chance to correct a possible typo.
3458                         echo "$file.sh does not exist"
3459                         dflt=$file
3460                         rp="hint to use instead?"
3461                         . UU/myread
3462                         for file in $ans; do
3463                                 if $test -f "$src/hints/$file.sh"; then
3464                                         . $src/hints/$file.sh
3465                                         $cat $src/hints/$file.sh >> UU/config.sh
3466                                 elif $test X$ans = X -o X$ans = Xnone ; then
3467                                         : nothing
3468                                 else
3469                                         echo "$file.sh does not exist -- ignored."
3470                                 fi
3471                         done
3472                 fi
3473         done
3474
3475         hint=recommended
3476         : Remember our hint file for later.
3477         if $test -f "$src/hints/$file.sh" ; then
3478                 hintfile="$file"
3479         else
3480                 hintfile=''
3481         fi
3482 fi
3483 cd UU
3484 ;;
3485 *)
3486         echo " "
3487         echo "Fetching default answers from $config_sh..." >&4
3488         tmp_n="$n"
3489         tmp_c="$c"
3490         cd ..
3491         cp $config_sh config.sh 2>/dev/null
3492         chmod +w config.sh
3493         . ./config.sh
3494         cd UU
3495         cp ../config.sh .
3496         n="$tmp_n"
3497         c="$tmp_c"
3498         hint=previous
3499         ;;
3500 esac
3501 test "$override" && . ./optdef.sh
3502
3503 : Restore computed paths
3504 for file in $loclist $trylist; do
3505         eval $file="\$_$file"
3506 done
3507
3508 cat << EOM
3509
3510 Configure uses the operating system name and version to set some defaults.
3511 The default value is probably right if the name rings a bell. Otherwise,
3512 since spelling matters for me, either accept the default or answer "none"
3513 to leave it blank.
3514
3515 EOM
3516 case "$osname" in
3517         ''|' ')
3518                 case "$hintfile" in
3519                 ''|' '|none) dflt=none ;;
3520                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3521                 esac
3522                 ;;
3523         *) dflt="$osname" ;;
3524 esac
3525 rp="Operating system name?"
3526 . ./myread
3527 case "$ans" in
3528 none)  osname='' ;;
3529 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3530 esac
3531 echo " "
3532 case "$osvers" in
3533         ''|' ')
3534                 case "$hintfile" in
3535                 ''|' '|none) dflt=none ;;
3536                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3537                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3538                         case "$dflt" in
3539                         ''|' ') dflt=none ;;
3540                         esac
3541                         ;;
3542                 esac
3543                 ;;
3544         *) dflt="$osvers" ;;
3545 esac
3546 rp="Operating system version?"
3547 . ./myread
3548 case "$ans" in
3549 none)  osvers='' ;;
3550 *) osvers="$ans" ;;
3551 esac
3552
3553
3554 . ./posthint.sh
3555
3556 : who configured the system
3557 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3558 case "$cf_by" in
3559 "")
3560         cf_by=`(logname) 2>/dev/null`
3561         case "$cf_by" in
3562         "")
3563                 cf_by=`(whoami) 2>/dev/null`
3564                 case "$cf_by" in
3565                 "") cf_by=unknown ;;
3566                 esac ;;
3567         esac ;;
3568 esac
3569
3570 : decide how portable to be.  Allow command line overrides.
3571 case "$d_portable" in
3572 "$undef") ;;
3573 *)      d_portable="$define" ;;
3574 esac
3575
3576 : set up shell script to do ~ expansion
3577 cat >filexp <<EOSS
3578 $startsh
3579 : expand filename
3580 case "\$1" in
3581  ~/*|~)
3582         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3583         ;;
3584  ~*)
3585         if $test -f /bin/csh; then
3586                 /bin/csh -f -c "glob \$1"
3587                 failed=\$?
3588                 echo ""
3589                 exit \$failed
3590         else
3591                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3592                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3593                 if $test ! -d "\$dir"; then
3594                         me=\`basename \$0\`
3595                         echo "\$me: can't locate home directory for: \$name" >&2
3596                         exit 1
3597                 fi
3598                 case "\$1" in
3599                 */*)
3600                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3601                         ;;
3602                 *)
3603                         echo \$dir
3604                         ;;
3605                 esac
3606         fi
3607         ;;
3608 *)
3609         echo \$1
3610         ;;
3611 esac
3612 EOSS
3613 chmod +x filexp
3614 $eunicefix filexp
3615
3616 : now set up to get a file name
3617 cat <<EOS >getfile
3618 $startsh
3619 EOS
3620 cat <<'EOSC' >>getfile
3621 tilde=''
3622 fullpath=''
3623 already=''
3624 skip=''
3625 none_ok=''
3626 exp_file=''
3627 nopath_ok=''
3628 orig_rp="$rp"
3629 orig_dflt="$dflt"
3630 case "$gfpth" in
3631 '') gfpth='.' ;;
3632 esac
3633
3634 case "$fn" in
3635 *\(*)
3636         : getfile will accept an answer from the comma-separated list
3637         : enclosed in parentheses even if it does not meet other criteria.
3638         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3639         fn=`echo $fn | sed 's/(.*)//'`
3640         ;;
3641 esac
3642
3643 case "$fn" in
3644 *:*)
3645         loc_file=`expr $fn : '.*:\(.*\)'`
3646         fn=`expr $fn : '\(.*\):.*'`
3647         ;;
3648 esac
3649
3650 case "$fn" in
3651 *~*) tilde=true;;
3652 esac
3653 case "$fn" in
3654 */*) fullpath=true;;
3655 esac
3656 case "$fn" in
3657 *+*) skip=true;;
3658 esac
3659 case "$fn" in
3660 *n*) none_ok=true;;
3661 esac
3662 case "$fn" in
3663 *e*) exp_file=true;;
3664 esac
3665 case "$fn" in
3666 *p*) nopath_ok=true;;
3667 esac
3668
3669 case "$fn" in
3670 *f*) type='File';;
3671 *d*) type='Directory';;
3672 *l*) type='Locate';;
3673 esac
3674
3675 what="$type"
3676 case "$what" in
3677 Locate) what='File';;
3678 esac
3679
3680 case "$exp_file" in
3681 '')
3682         case "$d_portable" in
3683         "$define") ;;
3684         *) exp_file=true;;
3685         esac
3686         ;;
3687 esac
3688
3689 cd ..
3690 while test "$type"; do
3691         redo=''
3692         rp="$orig_rp"
3693         dflt="$orig_dflt"
3694         case "$tilde" in
3695         true) rp="$rp (~name ok)";;
3696         esac
3697         . UU/myread
3698         if test -f UU/getfile.ok && \
3699                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3700         then
3701                 value="$ans"
3702                 ansexp="$ans"
3703                 break
3704         fi
3705         case "$ans" in
3706         none)
3707                 value=''
3708                 ansexp=''
3709                 case "$none_ok" in
3710                 true) type='';;
3711                 esac
3712                 ;;
3713         *)
3714                 case "$tilde" in
3715                 '') value="$ans"
3716                         ansexp="$ans";;
3717                 *)
3718                         value=`UU/filexp $ans`
3719                         case $? in
3720                         0)
3721                                 if test "$ans" != "$value"; then
3722                                         echo "(That expands to $value on this system.)"
3723                                 fi
3724                                 ;;
3725                         *) value="$ans";;
3726                         esac
3727                         ansexp="$value"
3728                         case "$exp_file" in
3729                         '') value="$ans";;
3730                         esac
3731                         ;;
3732                 esac
3733                 case "$fullpath" in
3734                 true)
3735                         case "$ansexp" in
3736                         /*) value="$ansexp" ;;
3737                         [a-zA-Z]:/*) value="$ansexp" ;;
3738                         *)
3739                                 redo=true
3740                                 case "$already" in
3741                                 true)
3742                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3743                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3744                                         ;;
3745                                 *)
3746                                 echo "Please give a full path name, starting with slash." >&4
3747                                         case "$tilde" in
3748                                         true)
3749                                 echo "Note that using ~name is ok provided it expands well." >&4
3750                                                 already=true
3751                                                 ;;
3752                                         esac
3753                                 esac
3754                                 ;;
3755                         esac
3756                         ;;
3757                 esac
3758                 case "$redo" in
3759                 '')
3760                         case "$type" in
3761                         File)
3762                                 for fp in $gfpth; do
3763                                         if test "X$fp" = X.; then
3764                                             pf="$ansexp"
3765                                         else    
3766                                             pf="$fp/$ansexp"
3767                                         fi
3768                                         if test -f "$pf"; then
3769                                                 type=''
3770                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3771                                         then
3772                                                 echo "($value is not a plain file, but that's ok.)"
3773                                                 type=''
3774                                         fi
3775                                         if test X"$type" = X; then
3776                                             value="$pf"
3777                                             break
3778                                         fi
3779                                 done
3780                                 ;;
3781                         Directory)
3782                                 for fp in $gfpth; do
3783                                         if test "X$fp" = X.; then
3784                                             dir="$ans"
3785                                             direxp="$ansexp"
3786                                         else    
3787                                             dir="$fp/$ansexp"
3788                                             direxp="$fp/$ansexp"
3789                                         fi
3790                                         if test -d "$direxp"; then
3791                                                 type=''
3792                                                 value="$dir"
3793                                                 break
3794                                         fi
3795                                 done
3796                                 ;;
3797                         Locate)
3798                                 if test -d "$ansexp"; then
3799                                         echo "(Looking for $loc_file in directory $value.)"
3800                                         value="$value/$loc_file"
3801                                         ansexp="$ansexp/$loc_file"
3802                                 fi
3803                                 if test -f "$ansexp"; then
3804                                         type=''
3805                                 fi
3806                                 case "$nopath_ok" in
3807                                 true)   case "$value" in
3808                                         */*) ;;
3809                                         *)      echo "Assuming $value will be in people's path."
3810                                                 type=''
3811                                                 ;;
3812                                         esac
3813                                         ;;
3814                                 esac
3815                                 ;;
3816                         esac
3817
3818                         case "$skip" in
3819                         true) type='';
3820                         esac
3821
3822                         case "$type" in
3823                         '') ;;
3824                         *)
3825                                 if test "$fastread" = yes; then
3826                                         dflt=y
3827                                 else
3828                                         dflt=n
3829                                 fi
3830                                 rp="$what $value doesn't exist.  Use that name anyway?"
3831                                 . UU/myread
3832                                 dflt=''
3833                                 case "$ans" in
3834                                 y*) type='';;
3835                                 *) echo " ";;
3836                                 esac
3837                                 ;;
3838                         esac
3839                         ;;
3840                 esac
3841                 ;;
3842         esac
3843 done
3844 cd UU
3845 ans="$value"
3846 rp="$orig_rp"
3847 dflt="$orig_dflt"
3848 rm -f getfile.ok
3849 test "X$gfpthkeep" != Xy && gfpth=""
3850 EOSC
3851
3852 : determine root of directory hierarchy where package will be installed.
3853 case "$prefix" in
3854 '')
3855         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3856         ;;
3857 *?/)
3858         dflt=`echo "$prefix" | sed 's/.$//'`
3859         ;;
3860 *)
3861         dflt="$prefix"
3862         ;;
3863 esac
3864 $cat <<EOM
3865
3866 By default, $package will be installed in $dflt/bin, manual pages
3867 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3868 installation directories. Typically this is something like /usr/local.
3869 If you wish to have binaries under /usr/bin but other parts of the
3870 installation under /usr/local, that's ok: you will be prompted
3871 separately for each of the installation directories, the prefix being
3872 only used to set the defaults.
3873
3874 EOM
3875 fn=d~
3876 rp='Installation prefix to use?'
3877 . ./getfile
3878 oldprefix=''
3879 case "$prefix" in
3880 '') ;;
3881 *)
3882         case "$ans" in
3883         "$prefix") ;;
3884         *) oldprefix="$prefix";;
3885         esac
3886         ;;
3887 esac
3888 prefix="$ans"
3889 prefixexp="$ansexp"
3890
3891 case "$afsroot" in
3892 '')     afsroot=/afs ;;
3893 *)      afsroot=$afsroot ;;
3894 esac
3895
3896 : is AFS running?
3897 echo " "
3898 case "$afs" in
3899 $define|true)   afs=true ;;
3900 $undef|false)   afs=false ;;
3901 *)      if test -d $afsroot; then
3902                 afs=true
3903         else
3904                 afs=false
3905         fi
3906         ;;
3907 esac
3908 if $afs; then
3909         echo "AFS may be running... I'll be extra cautious then..." >&4
3910 else
3911         echo "AFS does not seem to be running..." >&4
3912 fi
3913
3914 : determine installation prefix for where package is to be installed.
3915 if $afs; then 
3916 $cat <<EOM
3917
3918 Since you are running AFS, I need to distinguish the directory in which
3919 files will reside from the directory in which they are installed (and from
3920 which they are presumably copied to the former directory by occult means).
3921
3922 EOM
3923         case "$installprefix" in
3924         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3925         *) dflt="$installprefix";;
3926         esac
3927 else
3928 $cat <<EOM
3929
3930 In some special cases, particularly when building $package for distribution,
3931 it is convenient to distinguish the directory in which files should be
3932 installed from the directory ($prefix) in which they will
3933 eventually reside.  For most users, these two directories are the same.
3934
3935 EOM
3936         case "$installprefix" in
3937         '') dflt=$prefix ;;
3938         *) dflt=$installprefix;;
3939         esac
3940 fi
3941 fn=d~
3942 rp='What installation prefix should I use for installing files?'
3943 . ./getfile
3944 installprefix="$ans"
3945 installprefixexp="$ansexp"
3946
3947 : Perform the prefixexp/installprefixexp correction if necessary
3948 cat <<EOS >installprefix
3949 $startsh
3950 EOS
3951 cat <<'EOSC' >>installprefix
3952 : Change installation prefix, if necessary.
3953 if $test X"$prefix" != X"$installprefix"; then
3954     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3955 else
3956     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3957 fi
3958 EOSC
3959 chmod +x installprefix
3960 $eunicefix installprefix
3961
3962 : Set variables such as privlib and privlibexp from the output of ./getfile
3963 : performing the prefixexp/installprefixexp correction if necessary.
3964 cat <<EOS >setprefixvar
3965 $startsh
3966 EOS
3967 cat <<'EOSC' >>setprefixvar
3968 eval "${prefixvar}=\"\$ans\""
3969 eval "${prefixvar}exp=\"\$ansexp\""
3970 . ./installprefix
3971 EOSC
3972 chmod +x setprefixvar
3973 $eunicefix setprefixvar
3974
3975 : set up the script used to warn in case of inconsistency
3976 cat <<EOS >whoa
3977 $startsh
3978 EOS
3979 cat <<'EOSC' >>whoa
3980 dflt=y
3981 case "$hint" in
3982     recommended)
3983         case "$hintfile" in
3984         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3985                 ;;
3986         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3987                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3988                 ;;
3989         esac
3990         ;;
3991     *)  echo " "
3992         echo "*** WHOA THERE!!! ***" >&4
3993         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3994         ;;
3995 esac
3996 rp="    Keep the $hint value?"
3997 . ./myread
3998 case "$ans" in
3999 y) td=$was; tu=$was;;
4000 esac
4001 EOSC
4002
4003 : function used to set $1 to $val
4004 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4005 case "$val$was" in
4006 $define$undef) . ./whoa; eval "$var=\$td";;
4007 $undef$define) . ./whoa; eval "$var=\$tu";;
4008 *) eval "$var=$val";;
4009 esac'
4010
4011 case "$usesocks" in
4012 $define|true|[yY]*)     dflt='y';;
4013 *) dflt='n';;
4014 esac
4015 cat <<EOM
4016
4017 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4018 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4019 to use the PerlIO abstraction layer, this will be implicitly selected.
4020
4021 If this doesn't make any sense to you, just accept the default '$dflt'.
4022 EOM
4023 rp='Build Perl for SOCKS?'
4024 . ./myread
4025 case "$ans" in
4026 y|Y)    val="$define" ;;     
4027 *)      val="$undef" ;;
4028 esac
4029 set usesocks
4030 eval $setvar
4031
4032 case "$usesocks" in
4033 $define|true|[yY]*) useperlio="$define";;
4034 esac
4035
4036 case "$useperlio" in
4037 $define|true|[yY]*|'')  dflt='y';;
4038 *) dflt='n';;
4039 esac
4040 cat <<EOM
4041
4042 Previous version of $package used the standard IO mechanisms as
4043 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4044 alternate IO mechanisms via the PerlIO abstraction layer, but the
4045 stdio mechanism is still available if needed.  The abstraction layer
4046 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4047 Using PerlIO with sfio may cause problems with some extension modules.
4048
4049 If this doesn't make any sense to you, just accept the default '$dflt'.
4050 EOM
4051 rp='Use the PerlIO abstraction layer?'
4052 . ./myread
4053 case "$ans" in
4054 y|Y) 
4055         val="$define"
4056         ;;
4057 *)      
4058         echo "Ok, doing things the stdio way."
4059         val="$undef"
4060         ;;
4061 esac
4062 set useperlio
4063 eval $setvar 
4064
4065 case "$usesocks" in
4066 $define|true|[yY]*)
4067         case "$useperlio" in
4068         $define|true|[yY]*) ;;
4069         *)      cat >&4 <<EOM
4070
4071 You are using the SOCKS proxy protocol library which means that you
4072 should also use the PerlIO layer.  You may be headed for trouble.
4073
4074 EOM
4075                 ;;
4076         esac
4077         ;;
4078 esac
4079
4080         
4081 : get the patchlevel
4082 echo " "
4083 echo "Getting the current patchlevel..." >&4
4084 if $test -r $rsrc/patchlevel.h;then
4085         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4086         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4087         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4088         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4089         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4090         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4091         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4092 else
4093         revision=0
4094         patchlevel=0
4095         subversion=0
4096         api_revision=0
4097         api_version=0
4098         api_subversion=0
4099         perl_patchlevel=0
4100         $echo "(You do not have patchlevel.h.  Eek.)"
4101 fi
4102 if $test -r $rsrc/.patch ; then
4103         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4104                 perl_patchlevel=`cat $rsrc/.patch`
4105         fi
4106 fi
4107 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4108 version_patchlevel_string="version $patchlevel subversion $subversion"
4109 case "$perl_patchlevel" in
4110 0|'') ;;
4111 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4112 esac
4113
4114 $echo "(You have $package $version_patchlevel_string.)"
4115
4116 case "$osname" in
4117 dos|vms)
4118         : XXX Should be a Configure test for double-dots in filenames.
4119         version=`echo $revision $patchlevel $subversion | \
4120                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4121         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4122                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4123         ;;
4124 *)
4125         version=`echo $revision $patchlevel $subversion | \
4126                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4127         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4128                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4129         ;;
4130 esac
4131 : Special case the 5.005_xx maintenance series, which used 5.005
4132 : without any subversion label as a subdirectory in $sitelib
4133 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4134         api_versionstring='5.005'
4135 fi
4136
4137 case "$usethreads" in
4138 $define|true|[yY]*)     dflt='y';;
4139 *)     # Catch case where user specified ithreads or 5005threads but
4140        # forgot -Dusethreads (A.D. 4/2002)
4141        case "$useithreads$use5005threads" in
4142        *$define*)      
4143                 case "$useperlio" in
4144                 "$define")      dflt='y' ;;
4145                 *)              dflt='n' ;;
4146                 esac
4147                 ;;
4148        *)       dflt='n';;
4149        esac
4150        ;;
4151 esac
4152 cat <<EOM
4153
4154 Perl can be built to take advantage of threads on some systems.
4155 To do so, Configure can be run with -Dusethreads.
4156
4157 Note that Perl built with threading support runs slightly slower
4158 and uses more memory than plain Perl. The current implementation
4159 is believed to be stable, but it is fairly new, and so should be
4160 treated with caution.
4161
4162 If this doesn't make any sense to you, just accept the default '$dflt'.
4163 EOM
4164 rp='Build a threading Perl?'
4165 . ./myread
4166 case "$ans" in
4167 y|Y)    val="$define" ;;
4168 *)      val="$undef" ;;
4169 esac
4170 set usethreads
4171 eval $setvar
4172
4173 if $test $patchlevel -lt 9; then
4174     case "$usethreads" in
4175     $define)
4176         $cat <<EOM
4177
4178 Since release 5.6, Perl has had two different threading implementations,
4179 the newer interpreter-based version (ithreads) with one interpreter per
4180 thread, and the older 5.005 version (5005threads).
4181 The 5005threads version is effectively unmaintained and will probably be
4182 removed in Perl 5.10, so there should be no need to build a Perl using it
4183 unless needed for backwards compatibility with some existing 5.005threads
4184 code.
4185
4186 EOM
4187         : Default to ithreads unless overridden on command line or with
4188         : old config.sh
4189         dflt='y'
4190         case "$use5005threads" in
4191                 $define|true|[yY]*) dflt='n';;
4192         esac
4193         case "$useithreads" in
4194                 $undef|false|[nN]*) dflt='n';;
4195         esac
4196         rp='Use the newer interpreter-based ithreads?'
4197         . ./myread
4198         case "$ans" in
4199         y|Y)    val="$define" ;;
4200         *)      val="$undef" ;;
4201         esac
4202         set useithreads
4203         eval $setvar
4204         : Now set use5005threads to the opposite value.
4205         case "$useithreads" in
4206         $define) val="$undef" ;;
4207         *) val="$define" ;;
4208         esac
4209         set use5005threads
4210         eval $setvar
4211         ;;
4212     *)
4213         useithreads="$undef"
4214         use5005threads="$undef"
4215         ;;
4216     esac
4217
4218     case "$useithreads$use5005threads" in
4219     "$define$define")
4220         $cat >&4 <<EOM
4221
4222 You cannot have both the ithreads and the 5.005 threads enabled
4223 at the same time.  Disabling the 5.005 threads since they are
4224 much less stable than the ithreads.
4225
4226 EOM
4227         use5005threads="$undef"
4228         ;;
4229     esac
4230
4231 else
4232 : perl-5.9.x and later
4233
4234     if test X"$usethreads" = "X$define"; then
4235         case "$use5005threads" in
4236             $define|true|[yY]*)
4237                 $cat >&4 <<EOM
4238
4239 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4240
4241 EOM
4242             ;;
4243         esac
4244     fi
4245
4246     use5005threads="$undef"
4247     useithreads="$usethreads"
4248 fi
4249
4250 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4251         cat >&4 <<EOF
4252 ***
4253 *** To build with ithreads you must also use the PerlIO layer.
4254 *** Cannot continue, aborting.
4255 ***
4256 EOF
4257         exit 1
4258 fi
4259
4260 case "$d_oldpthreads" in
4261 '')     : Configure tests would be welcome here.  For now, assume undef.
4262         val="$undef" ;;
4263 *)      val="$d_oldpthreads" ;;
4264 esac
4265 set d_oldpthreads
4266 eval $setvar
4267
4268
4269 : Look for a hint-file generated 'call-back-unit'.  If the
4270 : user has specified that a threading perl is to be built,
4271 : we may need to set or change some other defaults.
4272 if $test -f usethreads.cbu; then
4273     echo "Your platform has some specific hints regarding threaded builds, using them..."
4274     . ./usethreads.cbu
4275 else
4276     case "$usethreads" in
4277         "$define"|true|[yY]*)
4278                 $cat <<EOM
4279 (Your platform does not have any specific hints for threaded builds.
4280  Assuming POSIX threads, then.)
4281 EOM
4282         ;;
4283     esac
4284 fi
4285
4286 cat <<EOM
4287
4288 Perl can be built so that multiple Perl interpreters can coexist
4289 within the same Perl executable.
4290 EOM
4291
4292 case "$useithreads" in
4293 $define)
4294         cat <<EOM
4295 This multiple interpreter support is required for interpreter-based threads.
4296 EOM
4297         val="$define"
4298         ;;
4299 *)      case "$usemultiplicity" in
4300         $define|true|[yY]*)     dflt='y';;
4301         *) dflt='n';;
4302         esac
4303         echo " "
4304         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4305         rp='Build Perl for multiplicity?'
4306         . ./myread
4307         case "$ans" in
4308         y|Y)    val="$define" ;;
4309         *)      val="$undef" ;;
4310         esac
4311         ;;
4312 esac
4313 set usemultiplicity
4314 eval $setvar
4315
4316
4317 case "$usemorebits" in
4318 "$define"|true|[yY]*)
4319         use64bitint="$define"
4320         uselongdouble="$define"
4321         usemorebits="$define"
4322         ;;
4323 *)      usemorebits="$undef"
4324         ;;
4325 esac
4326
4327 : make some quick guesses about what we are up against
4328 echo " "
4329 $echo $n "Hmm...  $c"
4330 echo exit 1 >bsd
4331 echo exit 1 >usg
4332 echo exit 1 >v7
4333 echo exit 1 >osf1
4334 echo exit 1 >eunice
4335 echo exit 1 >xenix
4336 echo exit 1 >venix
4337 echo exit 1 >os2
4338 d_bsd="$undef"
4339 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4340 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4341 then
4342         echo "Looks kind of like an OSF/1 system, but we'll see..."
4343         echo exit 0 >osf1
4344 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4345         xxx=`./loc addbib blurfl $pth`
4346         if $test -f $xxx; then
4347         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4348                 echo exit 0 >bsd
4349                 echo exit 0 >usg
4350         else
4351                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4352                         echo "Looks kind of like an extended USG system, but we'll see..."
4353                 else
4354                         echo "Looks kind of like a USG system, but we'll see..."
4355                 fi
4356                 echo exit 0 >usg
4357         fi
4358 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4359         echo "Looks kind of like a BSD system, but we'll see..."
4360         d_bsd="$define"
4361         echo exit 0 >bsd
4362 else
4363         echo "Looks kind of like a Version 7 system, but we'll see..."
4364         echo exit 0 >v7
4365 fi
4366 case "$eunicefix" in
4367 *unixtovms*)
4368         $cat <<'EOI'
4369 There is, however, a strange, musty smell in the air that reminds me of
4370 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4371 EOI
4372         echo exit 0 >eunice
4373         d_eunice="$define"
4374 : it so happens the Eunice I know will not run shell scripts in Unix format
4375         ;;
4376 *)
4377         echo " "
4378         echo "Congratulations.  You aren't running Eunice."
4379         d_eunice="$undef"
4380         ;;
4381 esac
4382 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4383 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4384 : semicolon as a patch separator
4385 case "$p_" in
4386 :) ;;
4387 *)
4388         $cat <<'EOI'
4389 I have the feeling something is not exactly right, however...don't tell me...
4390 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4391 (Or you may be running DOS with DJGPP.)
4392 EOI
4393         echo exit 0 >os2
4394         ;;
4395 esac
4396 if test -f /xenix; then
4397         echo "Actually, this looks more like a XENIX system..."
4398         echo exit 0 >xenix
4399         d_xenix="$define"
4400 else
4401         echo " "
4402         echo "It's not Xenix..."
4403         d_xenix="$undef"
4404 fi
4405 chmod +x xenix
4406 $eunicefix xenix
4407 if test -f /venix; then
4408         echo "Actually, this looks more like a VENIX system..."
4409         echo exit 0 >venix
4410 else
4411         echo " "
4412         if ./xenix; then
4413                 : null
4414         else
4415                 echo "Nor is it Venix..."
4416         fi
4417 fi
4418 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4419 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4420 $rm -f foo
4421
4422 case "$cc" in
4423 '') dflt=cc;;
4424 *) dflt="$cc";;
4425 esac
4426 rp="Use which C compiler?"
4427 . ./myread
4428 cc="$ans"
4429
4430 : See if they have not cc but they do have gcc
4431 . ./trygcc
4432 : Look for a hint-file generated 'call-back-unit'.  Now that the
4433 : user has specified the compiler, we may need to set or change some
4434 : other defaults.
4435 if $test -f cc.cbu; then
4436     . ./cc.cbu
4437 fi
4438 . ./checkcc
4439
4440 echo " "
4441 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4442 $cat >try.c <<EOM
4443 #include <stdio.h>
4444 int main() {
4445 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4446 #ifdef __VERSION__
4447         printf("%s\n", __VERSION__);
4448 #else
4449         printf("%s\n", "1");
4450 #endif
4451 #endif
4452         return(0);
4453 }
4454 EOM
4455 if $cc -o try $ccflags $ldflags try.c; then
4456         gccversion=`$run ./try`
4457         case "$gccversion" in
4458         '') echo "You are not using GNU cc." ;;
4459         *)  echo "You are using GNU cc $gccversion."
4460             ccname=gcc
4461             ;;
4462         esac
4463 else
4464         echo " "
4465         echo "*** WHOA THERE!!! ***" >&4
4466         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4467         case "$knowitall" in
4468         '')
4469         echo "    You'd better start hunting for one and let me know about it." >&4
4470                 exit 1
4471                 ;;
4472         esac
4473 fi
4474 $rm -f try try.*
4475 case "$gccversion" in
4476 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4477 esac
4478 case "$gccversion" in
4479 '') gccosandvers='' ;;
4480 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4481    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4482    gccshortvers=''
4483    case "$gccosandvers" in
4484    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4485    $osname$osvers) ;; # looking good
4486    $osname*) cat <<EOM >&4
4487
4488 *** WHOA THERE!!! ***
4489
4490     Your gcc has not been compiled for the exact release of
4491     your operating system ($gccosandvers versus $osname$osvers).
4492
4493     In general it is a good idea to keep gcc synchronized with
4494     the operating system because otherwise serious problems
4495     may ensue when trying to compile software, like Perl.
4496
4497     I'm trying to be optimistic here, though, and will continue.
4498     If later during the configuration and build icky compilation
4499     problems appear (headerfile conflicts being the most common
4500     manifestation), I suggest reinstalling the gcc to match
4501     your operating system release.
4502
4503 EOM
4504       ;;
4505    *) gccosandvers='' ;; # failed to parse, better be silent
4506    esac
4507    ;;
4508 esac
4509 case "$ccname" in
4510 '') ccname="$cc" ;;
4511 esac
4512
4513 # gcc 3.* complain about adding -Idirectories that they already know about,
4514 # so we will take those off from locincpth.
4515 case "$gccversion" in
4516 3*)
4517     echo "main(){}">try.c
4518     for incdir in $locincpth; do
4519        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4520              grep '^c[cp]p*[01]: warning: changing search order '`
4521        if test "X$warn" != X; then
4522            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4523        fi
4524     done
4525     $rm -f try try.*
4526 esac
4527
4528 : What should the include directory be ?
4529 echo " "
4530 $echo $n "Hmm...  $c"
4531 dflt='/usr/include'
4532 incpath=''
4533 mips_type=''
4534 if $test -f /bin/mips && /bin/mips; then
4535         echo "Looks like a MIPS system..."
4536         $cat >usr.c <<'EOCP'
4537 #ifdef SYSTYPE_BSD43
4538 /bsd43
4539 #endif
4540 EOCP
4541         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4542                 dflt='/bsd43/usr/include'
4543                 incpath='/bsd43'
4544                 mips_type='BSD 4.3'
4545         else
4546                 mips_type='System V'
4547         fi
4548         $rm -f usr.c usr.out
4549         echo "and you're compiling with the $mips_type compiler and libraries."
4550         xxx_prompt=y
4551         echo "exit 0" >mips
4552 else
4553         echo "Doesn't look like a MIPS system."
4554         xxx_prompt=n
4555         echo "exit 1" >mips
4556 fi
4557 chmod +x mips
4558 $eunicefix mips
4559 case "$usrinc" in
4560 '') ;;
4561 *) dflt="$usrinc";;
4562 esac
4563 case "$xxx_prompt" in
4564 y)      fn=d/
4565         echo " "
4566         rp='Where are the include files you want to use?'
4567         . ./getfile
4568         usrinc="$ans"
4569         ;;
4570 *)      usrinc="$dflt"
4571         ;;
4572 esac
4573
4574 : see how we invoke the C preprocessor
4575 echo " "
4576 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4577 cat <<'EOT' >testcpp.c
4578 #define ABC abc
4579 #define XYZ xyz
4580 ABC.XYZ
4581 EOT
4582 cd ..
4583 if test ! -f cppstdin; then
4584         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4585                 # AIX cc -E doesn't show the absolute headerfile
4586                 # locations but we'll cheat by using the -M flag.
4587                 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
4588         else
4589                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4590         fi
4591 else
4592         echo "Keeping your $hint cppstdin wrapper."
4593 fi
4594 chmod 755 cppstdin
4595 wrapper=`pwd`/cppstdin
4596 ok='false'
4597 cd UU
4598
4599 if $test "X$cppstdin" != "X" && \
4600         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4601         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4602 then
4603         echo "You used to use $cppstdin $cppminus so we'll use that again."
4604         case "$cpprun" in
4605         '') echo "But let's see if we can live without a wrapper..." ;;
4606         *)
4607                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4608                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4609                 then
4610                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4611                         ok='true'
4612                 else
4613                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4614                 fi
4615                 ;;
4616         esac
4617 else
4618         case "$cppstdin" in
4619         '') ;;
4620         *)
4621                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4622                 ;;
4623         esac
4624 fi
4625
4626 if $ok; then
4627         : nothing
4628 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4629         $cc -E <testcpp.c >testcpp.out 2>&1; \
4630         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4631         echo "Yup, it does."
4632         x_cpp="$cc -E"
4633         x_minus='';
4634 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4635         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4636         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4637         echo "Yup, it does."
4638         x_cpp="$cc -E"
4639         x_minus='-';
4640 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4641         $cc -P <testcpp.c >testcpp.out 2>&1; \
4642         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643         echo "Yipee, that works!"
4644         x_cpp="$cc -P"
4645         x_minus='';
4646 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4647         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4648         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649         echo "At long last!"
4650         x_cpp="$cc -P"
4651         x_minus='-';
4652 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4653         $cpp <testcpp.c >testcpp.out 2>&1; \
4654         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4655         echo "It works!"
4656         x_cpp="$cpp"
4657         x_minus='';
4658 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4659         $cpp - <testcpp.c >testcpp.out 2>&1; \
4660         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661         echo "Hooray, it works!  I was beginning to wonder."
4662         x_cpp="$cpp"
4663         x_minus='-';
4664 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4665         $wrapper <testcpp.c >testcpp.out 2>&1; \
4666         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4667         x_cpp="$wrapper"
4668         x_minus=''
4669         echo "Eureka!"
4670 else
4671         dflt=''
4672         rp="No dice.  I can't find a C preprocessor.  Name one:"
4673         . ./myread
4674         x_cpp="$ans"
4675         x_minus=''
4676         $x_cpp <testcpp.c >testcpp.out 2>&1
4677         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4678                 echo "OK, that will do." >&4
4679         else
4680 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4681                 exit 1
4682         fi
4683 fi
4684
4685 case "$ok" in
4686 false)
4687         cppstdin="$x_cpp"
4688         cppminus="$x_minus"
4689         cpprun="$x_cpp"
4690         cpplast="$x_minus"
4691         set X $x_cpp
4692         shift
4693         case "$1" in
4694         "$cpp")
4695                 echo "Perhaps can we force $cc -E using a wrapper..."
4696                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4697                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4698                 then
4699                         echo "Yup, we can."
4700                         cppstdin="$wrapper"
4701                         cppminus='';
4702                 else
4703                         echo "Nope, we'll have to live without it..."
4704                 fi
4705                 ;;
4706         esac
4707         case "$cpprun" in
4708         "$wrapper")
4709                 cpprun=''
4710                 cpplast=''
4711                 ;;
4712         esac
4713         ;;
4714 esac
4715
4716 case "$cppstdin" in
4717 "$wrapper"|'cppstdin') ;;
4718 *) $rm -f $wrapper;;
4719 esac
4720 $rm -f testcpp.c testcpp.out
4721
4722 : Set private lib path
4723 case "$plibpth" in
4724 '') if ./mips; then
4725                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4726         fi;;
4727 esac
4728 case "$libpth" in
4729 ' ') dlist='';;
4730 '') dlist="$loclibpth $plibpth $glibpth";;
4731 *) dlist="$libpth";;
4732 esac
4733
4734 : Now check and see which directories actually exist, avoiding duplicates
4735 libpth=''
4736 for xxx in $dlist
4737 do
4738     if $test -d $xxx; then
4739                 case " $libpth " in
4740                 *" $xxx "*) ;;
4741                 *) libpth="$libpth $xxx";;
4742                 esac
4743     fi
4744 done
4745 $cat <<'EOM'
4746
4747 Some systems have incompatible or broken versions of libraries.  Among
4748 the directories listed in the question below, please remove any you
4749 know not to be holding relevant libraries, and add any that are needed.
4750 Say "none" for none.
4751
4752 EOM
4753 case "$libpth" in
4754 '') dflt='none';;
4755 *)
4756         set X $libpth
4757         shift
4758         dflt=${1+"$@"}
4759         ;;
4760 esac
4761 rp="Directories to use for library searches?"
4762 . ./myread
4763 case "$ans" in
4764 none) libpth=' ';;
4765 *) libpth="$ans";;
4766 esac
4767
4768 : compute shared library extension
4769 case "$so" in
4770 '')
4771         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4772                 dflt='sl'
4773         else
4774                 dflt='so'
4775         fi
4776         ;;
4777 *) dflt="$so";;
4778 esac
4779 $cat <<EOM
4780
4781 On some systems, shared libraries may be available.  Answer 'none' if
4782 you want to suppress searching of shared libraries for the remainder
4783 of this configuration.
4784
4785 EOM
4786 rp='What is the file extension used for shared libraries?'
4787 . ./myread
4788 so="$ans"
4789
4790 : Define several unixisms.
4791 : Hints files or command line option can be used to override them.
4792 : The convoluted testing is in case hints files set either the old
4793 : or the new name.
4794 case "$_exe" in
4795 '')     case "$exe_ext" in
4796         '')     ;;
4797         *)      _exe="$exe_ext" ;;
4798         esac
4799         ;;
4800 esac
4801 case "$_a" in
4802 '')     case "$lib_ext" in
4803     '') _a='.a';;
4804         *)      _a="$lib_ext" ;;
4805         esac
4806         ;;
4807 esac
4808 case "$_o" in
4809 '') case "$obj_ext" in
4810         '')     _o='.o';;
4811         *)      _o="$obj_ext";;
4812         esac
4813         ;;
4814 esac
4815 case "$p_" in
4816 '') case "$path_sep" in
4817         '')     p_=':';;
4818         *)      p_="$path_sep";;
4819         esac
4820         ;;
4821 esac
4822 exe_ext=$_exe
4823 lib_ext=$_a
4824 obj_ext=$_o
4825 path_sep=$p_
4826
4827 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4828
4829 : Which makefile gets called first.  This is used by make depend.
4830 case "$firstmakefile" in
4831 '') firstmakefile='makefile';;
4832 esac
4833
4834 case "$ccflags" in
4835 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4836 esac
4837
4838 case "$uselongdouble" in
4839 $define|true|[yY]*)     dflt='y';;
4840 *) dflt='n';;
4841 esac
4842 cat <<EOM
4843
4844 Perl can be built to take advantage of long doubles which
4845 (if available) may give more accuracy and range for floating point numbers.
4846
4847 If this doesn't make any sense to you, just accept the default '$dflt'.
4848 EOM
4849 rp='Try to use long doubles if available?'
4850 . ./myread
4851 case "$ans" in
4852 y|Y)    val="$define"   ;;
4853 *)      val="$undef"    ;;
4854 esac
4855 set uselongdouble
4856 eval $setvar
4857
4858 case "$uselongdouble" in
4859 true|[yY]*) uselongdouble="$define" ;;
4860 esac
4861
4862 : Look for a hint-file generated 'call-back-unit'.  If the
4863 : user has specified that long doubles should be used,
4864 : we may need to set or change some other defaults.
4865 if $test -f uselongdouble.cbu; then
4866     echo "Your platform has some specific hints regarding long doubles, using them..."
4867     . ./uselongdouble.cbu
4868 else
4869     case "$uselongdouble" in
4870         $define)
4871                 $cat <<EOM
4872 (Your platform does not have any specific hints for long doubles.)
4873 EOM
4874         ;;
4875     esac
4876 fi
4877
4878 : Looking for optional libraries
4879 echo " "
4880 echo "Checking for optional libraries..." >&4
4881 case "$libs" in
4882 ' '|'') dflt='';;
4883 *) dflt="$libs";;
4884 esac
4885 case "$libswanted" in
4886 '') libswanted='c_s';;
4887 esac
4888 case "$usesocks" in
4889 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4890 esac
4891 libsfound=''
4892 libsfiles=''
4893 libsdirs=''
4894 libspath=''
4895 for thisdir in $libpth $xlibpth; do
4896   test -d $thisdir && libspath="$libspath $thisdir"
4897 done
4898 for thislib in $libswanted; do
4899         for thisdir in $libspath; do
4900             xxx=''
4901             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4902                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4903                 $test -f "$xxx" && eval $libscheck
4904                 $test -f "$xxx" && libstyle=shared
4905             fi
4906             if test ! -f "$xxx"; then
4907                 xxx=$thisdir/lib$thislib.$so
4908                 $test -f "$xxx" && eval $libscheck
4909                 $test -f "$xxx" && libstyle=shared
4910             fi  
4911             if test ! -f "$xxx"; then
4912                 xxx=$thisdir/lib$thislib$_a
4913                 $test -f "$xxx" && eval $libscheck
4914                 $test -f "$xxx" && libstyle=static
4915             fi
4916             if test ! -f "$xxx"; then
4917                 xxx=$thisdir/$thislib$_a
4918                 $test -f "$xxx" && eval $libscheck
4919                 $test -f "$xxx" && libstyle=static
4920             fi
4921             if test ! -f "$xxx"; then
4922                 xxx=$thisdir/lib${thislib}_s$_a
4923                 $test -f "$xxx" && eval $libscheck
4924                 $test -f "$xxx" && libstyle=static
4925                 $test -f "$xxx" && thislib=${thislib}_s
4926             fi
4927             if test ! -f "$xxx"; then
4928                 xxx=$thisdir/Slib$thislib$_a
4929                 $test -f "$xxx" && eval $libscheck
4930                 $test -f "$xxx" && libstyle=static
4931             fi
4932             if $test -f "$xxx"; then
4933                 case "$libstyle" in
4934                 shared) echo "Found -l$thislib (shared)." ;;
4935                 static) echo "Found -l$thislib." ;;
4936                 *)      echo "Found -l$thislib ($libstyle)." ;;
4937                 esac
4938                 case " $dflt " in
4939                 *"-l$thislib "*);;
4940                 *) dflt="$dflt -l$thislib"
4941                    libsfound="$libsfound $xxx"
4942                    yyy=`basename $xxx`
4943                    libsfiles="$libsfiles $yyy"
4944                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4945                    case " $libsdirs " in
4946                    *" $yyy "*) ;;
4947                    *) libsdirs="$libsdirs $yyy" ;;
4948                    esac
4949                    ;;
4950                 esac
4951                 break
4952             fi  
4953         done
4954         if $test ! -f "$xxx"; then
4955             echo "No -l$thislib."
4956         fi
4957 done
4958 set X $dflt
4959 shift
4960 dflt="$*"
4961 case "$libs" in
4962 '') dflt="$dflt";;
4963 *) dflt="$libs";;
4964 esac
4965 case "$dflt" in
4966 ' '|'') dflt='none';;
4967 esac
4968
4969 $cat <<EOM
4970
4971 In order to compile $package on your machine, a number of libraries
4972 are usually needed.  Include any other special libraries here as well.
4973 Say "none" for none.  The default list is almost always right.
4974 EOM
4975
4976 echo " "
4977 rp="What libraries to use?"
4978 . ./myread
4979 case "$ans" in
4980 none) libs=' ';;
4981 *) libs="$ans";;
4982 esac
4983
4984 : determine optimization, if desired, or use for debug flag also
4985 case "$optimize" in
4986 ' '|$undef) dflt='none';;
4987 '') dflt='-O';;
4988 *) dflt="$optimize";;
4989 esac
4990 $cat <<EOH
4991
4992 By default, $package compiles with the -O flag to use the optimizer.
4993 Alternately, you might want to use the symbolic debugger, which uses
4994 the -g flag (on traditional Unix systems).  Either flag can be
4995 specified here.  To use neither flag, specify the word "none".
4996
4997 EOH
4998 rp="What optimizer/debugger flag should be used?"
4999 . ./myread
5000 optimize="$ans"
5001 case "$optimize" in
5002 'none') optimize=" ";;
5003 esac
5004
5005 : Check what DEBUGGING is required from the command line
5006 : -DEBUGGING      or -DDEBUGGING or
5007 : -DEBUGGING=both                       = -g + -DDEBUGGING
5008 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5009 : -DEBUGGING=none or -UDEBUGGING        =
5010 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5011 case "$EBUGGING" in
5012 '')     ;;
5013 *)      DEBUGGING=$EBUGGING ;;
5014 esac
5015
5016 case "$DEBUGGING" in
5017 -g|both|$define)
5018     case "$optimize" in
5019         *-g*) ;;
5020         *)    optimize="$optimize -g" ;;
5021     esac ;;
5022 none|$undef)
5023     case "$optimize" in
5024         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5025                 shift
5026                 optimize="$*"
5027                 ;;
5028     esac ;;
5029 esac
5030
5031 dflt=''
5032 case "$DEBUGGING" in
5033 both|$define) dflt='-DDEBUGGING'
5034 esac
5035
5036 : We will not override a previous value, but we might want to
5037 : augment a hint file
5038 case "$hint" in
5039 default|recommended)
5040         case "$gccversion" in
5041         1*) dflt="$dflt -fpcc-struct-return" ;;
5042         esac
5043         case "$optimize:$DEBUGGING" in
5044         *-g*:old) dflt="$dflt -DDEBUGGING";;
5045         esac
5046         case "$gccversion" in
5047         2*) if test -d /etc/conf/kconfig.d &&
5048                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5049                 then
5050                         # Interactive Systems (ISC) POSIX mode.
5051                         dflt="$dflt -posix"
5052                 fi
5053                 ;;
5054         esac
5055         case "$gccversion" in
5056         1*) ;;
5057         2.[0-8]*) ;;
5058         ?*)     echo " "
5059                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5060                 echo 'int main(void) { return 0; }' > gcctest.c
5061                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5062                         echo "Yes, it does." 2>&1
5063                         case "$ccflags" in
5064                         *strict-aliasing*)
5065                                 echo "Leaving current flags $ccflags alone." 2>&1
5066                                 ;;
5067                         *) dflt="$dflt -fno-strict-aliasing" ;;
5068                         esac
5069                 else
5070                         echo "Nope, it doesn't, but that's ok." 2>&1
5071                 fi
5072                 ;;
5073         esac
5074         # For gcc, adding -pipe speeds up compilations for some, but apparently
5075         # some assemblers can't read from stdin.  (It also slows down compilations
5076         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5077         case "$gccversion" in
5078         ?*)     echo " "
5079                 echo "Checking if your compiler accepts -pipe" 2>&1
5080                 echo 'int main(void) { return 0; }' > gcctest.c
5081                 if $cc -pipe -o gcctest gcctest.c; then
5082                         echo "Yes, it does." 2>&1
5083                         case "$ccflags" in
5084                         *-pipe*)
5085                                 echo "Leaving current flags $ccflags alone." 2>&1
5086                                 ;;
5087                         *) dflt="$dflt -pipe" ;;
5088                         esac
5089                 else
5090                         echo "Nope, it doesn't, but that's ok." 2>&1
5091                 fi
5092                 ;;
5093         esac
5094         ;;
5095 esac
5096
5097 case "$mips_type" in
5098 *BSD*|'') inclwanted="$locincpth $usrinc";;
5099 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5100 esac
5101 for thisincl in $inclwanted; do
5102         if $test -d $thisincl; then
5103                 if $test x$thisincl != x$usrinc; then
5104                         case "$dflt" in
5105                         *" -I$thisincl "*);;
5106                         *) dflt="$dflt -I$thisincl ";;
5107                         esac
5108                 fi
5109         fi
5110 done
5111
5112 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5113         xxx=true;
5114 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5115         xxx=true;
5116 else
5117         xxx=false;
5118 fi;
5119 if $xxx; then
5120         case "$dflt" in
5121         *$2*);;
5122         *) dflt="$dflt -D$2";;
5123         esac;
5124 fi'
5125
5126 set signal.h LANGUAGE_C; eval $inctest
5127
5128 case "$usesocks" in
5129 $define)
5130         ccflags="$ccflags -DSOCKS"
5131         ;;
5132 esac
5133
5134 case "$hint" in
5135 default|recommended) dflt="$ccflags $dflt" ;;
5136 *) dflt="$ccflags";;
5137 esac
5138
5139 case "$dflt" in
5140 ''|' ') dflt=none;;
5141 esac
5142
5143 $cat <<EOH
5144
5145 Your C compiler may want other flags.  For this question you should include
5146 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5147 but you should NOT include libraries or ld flags like -lwhatever.  If you
5148 want $package to honor its debug switch, you should include -DDEBUGGING here.
5149 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5150
5151 To use no flags, specify the word "none".
5152
5153 EOH
5154 set X $dflt
5155 shift
5156 dflt=${1+"$@"}
5157 rp="Any additional cc flags?"
5158 . ./myread
5159 case "$ans" in
5160 none) ccflags='';;
5161 *) ccflags="$ans";;
5162 esac
5163
5164 : the following weeds options from ccflags that are of no interest to cpp
5165 case "$cppflags" in
5166 '') cppflags="$ccflags" ;;
5167 *)  cppflags="$cppflags $ccflags" ;;
5168 esac
5169 case "$gccversion" in
5170 1*) cppflags="$cppflags -D__GNUC__"
5171 esac
5172 case "$mips_type" in
5173 '');;
5174 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5175 esac
5176 case "$cppflags" in
5177 '');;
5178 *)
5179         echo " "
5180         echo "Let me guess what the preprocessor flags are..." >&4
5181         set X $cppflags
5182         shift
5183         cppflags=''
5184         $cat >cpp.c <<'EOM'
5185 #define BLURFL foo
5186
5187 BLURFL xx LFRULB
5188 EOM
5189         previous=''
5190         for flag in $*
5191         do
5192                 case "$flag" in
5193                 -*) ftry="$flag";;
5194                 *) ftry="$previous $flag";;
5195                 esac
5196                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5197                         >cpp1.out 2>/dev/null && \
5198                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5199                         >cpp2.out 2>/dev/null && \
5200                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5201                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5202                 then
5203                         cppflags="$cppflags $ftry"
5204                         previous=''
5205                 else
5206                         previous="$flag"
5207                 fi
5208         done
5209         set X $cppflags
5210         shift
5211         cppflags=${1+"$@"}
5212         case "$cppflags" in
5213         *-*)  echo "They appear to be: $cppflags";;
5214         esac
5215         $rm -f cpp.c cpp?.out
5216         ;;
5217 esac
5218
5219 : flags used in final linking phase
5220 case "$ldflags" in
5221 '') if ./venix; then
5222                 dflt='-i -z'
5223         else
5224                 dflt=''
5225         fi
5226         case "$ccflags" in
5227         *-posix*) dflt="$dflt -posix" ;;
5228         esac
5229         ;;
5230 *) dflt="$ldflags";;
5231 esac
5232
5233 : Try to guess additional flags to pick up local libraries.
5234 for thislibdir in $libpth; do
5235         case " $loclibpth " in
5236         *" $thislibdir "*)
5237                 case "$dflt " in
5238                 *"-L$thislibdir "*) ;;
5239                 *)  dflt="$dflt -L$thislibdir" ;;
5240                 esac
5241                 ;;
5242         esac
5243 done
5244
5245 case "$dflt" in
5246 '') dflt='none' ;;
5247 esac
5248
5249 $cat <<EOH
5250
5251 Your C linker may need flags.  For this question you should
5252 include -L/whatever and any other flags used by the C linker, but you
5253 should NOT include libraries like -lwhatever.
5254
5255 Make sure you include the appropriate -L/path flags if your C linker
5256 does not normally search all of the directories you specified above,
5257 namely
5258         $libpth
5259 To use no flags, specify the word "none".
5260
5261 EOH
5262
5263 rp="Any additional ld flags (NOT including libraries)?"
5264 . ./myread
5265 case "$ans" in
5266 none) ldflags='';;
5267 *) ldflags="$ans";;
5268 esac
5269 rmlist="$rmlist pdp11"
5270
5271 : coherency check
5272 echo " "
5273 echo "Checking your choice of C compiler and flags for coherency..." >&4
5274 $cat > try.c <<'EOF'
5275 #include <stdio.h>
5276 int main() { printf("Ok\n"); return(0); }
5277 EOF
5278 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5279 shift
5280 $cat >try.msg <<'EOM'
5281 I've tried to compile and run the following simple program:
5282
5283 EOM
5284 $cat try.c >> try.msg
5285
5286 $cat >> try.msg <<EOM
5287
5288 I used the command:
5289
5290         $*
5291         $run ./try
5292
5293 and I got the following output:
5294
5295 EOM
5296 dflt=y
5297 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5298         if $sh -c "$run ./try" >>try.msg 2>&1; then
5299                 xxx=`$run ./try`
5300                 case "$xxx" in
5301                 "Ok") dflt=n ;;
5302                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5303                         case " $libs " in
5304                         *" -lsfio "*)
5305                                 cat >> try.msg <<'EOQS'
5306 If $libs contains -lsfio, and sfio is mis-configured, then it
5307 sometimes (apparently) runs and exits with a 0 status, but with no
5308 output!  It may have to do with sfio's use of _exit vs. exit.
5309
5310 EOQS
5311                                 rp="You have a big problem.  Shall I abort Configure"
5312                                 dflt=y
5313                                 ;;
5314                         esac
5315                         ;;
5316                 esac
5317         else
5318                 echo "The program compiled OK, but exited with status $?." >>try.msg
5319                 rp="You have a problem.  Shall I abort Configure"
5320                 dflt=y
5321         fi
5322 else
5323         echo "I can't compile the test program." >>try.msg
5324         rp="You have a BIG problem.  Shall I abort Configure"
5325         dflt=y
5326 fi
5327 case "$dflt" in
5328 y)
5329         $cat try.msg >&4
5330         case "$knowitall" in
5331         '')
5332                 echo "(The supplied flags or libraries might be incorrect.)"
5333                 ;;
5334         *) dflt=n;;
5335         esac
5336         echo " "
5337         . ./myread
5338         case "$ans" in
5339         n*|N*) ;;
5340         *)      echo "Ok.  Stopping Configure." >&4
5341                 exit 1
5342                 ;;
5343         esac
5344         ;;
5345 n) echo "OK, that should do.";;
5346 esac
5347 $rm_try
5348
5349 : define a shorthand compile call
5350 compile='
5351 mc_file=$1;
5352 shift;
5353 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5354 : define a shorthand compile call for compilations that should be ok.
5355 compile_ok='
5356 mc_file=$1;
5357 shift;
5358 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5359
5360 : determine filename position in cpp output
5361 echo " "
5362 echo "Computing filename position in cpp output for #include directives..." >&4
5363 case "$osname" in
5364 vos) testaccess=-e ;;
5365 *)   testaccess=-r ;;
5366 esac
5367 echo '#include <stdio.h>' > foo.c
5368 $cat >fieldn <<EOF
5369 $startsh
5370 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5371 $grep '^[       ]*#.*stdio\.h' | \
5372 while read cline; do
5373         pos=1
5374         set \$cline
5375         while $test \$# -gt 0; do
5376                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5377                         echo "\$pos"
5378                         exit 0
5379                 fi
5380                 shift
5381                 pos=\`expr \$pos + 1\`
5382         done
5383 done
5384 EOF
5385 chmod +x fieldn
5386 fieldn=`./fieldn`
5387 $rm -f foo.c fieldn
5388 case $fieldn in
5389 '') pos='???';;
5390 1) pos=first;;
5391 2) pos=second;;
5392 3) pos=third;;
5393 *) pos="${fieldn}th";;
5394 esac
5395 echo "Your cpp writes the filename in the $pos field of the line."
5396
5397 case "$osname" in
5398 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5399 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5400 *)   cppfilter='' ;;
5401 esac
5402 : locate header file
5403 $cat >findhdr <<EOF
5404 $startsh
5405 wanted=\$1
5406 name=''
5407 for usrincdir in $usrinc
5408 do
5409         if test -f \$usrincdir/\$wanted; then
5410                 echo "\$usrincdir/\$wanted"
5411                 exit 0
5412         fi
5413 done
5414 awkprg='{ print \$$fieldn }'
5415 echo "#include <\$wanted>" > foo\$\$.c
5416 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5417 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5418 while read cline; do
5419         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5420         case "\$name" in
5421         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5422         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5423         *) exit 2;;
5424         esac;
5425 done;
5426 #
5427 # status = 0: grep returned 0 lines, case statement not executed
5428 # status = 1: headerfile found
5429 # status = 2: while loop executed, no headerfile found
5430 #
5431 status=\$?
5432 $rm -f foo\$\$.c;
5433 if test \$status -eq 1; then
5434         exit 0;
5435 fi
5436 exit 1
5437 EOF
5438 chmod +x findhdr
5439
5440 : define an alternate in-header-list? function
5441 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5442 cont=true; xxf="echo \"<\$1> found.\" >&4";
5443 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5444 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5445 esac;
5446 case $# in 4) instead=instead;; *) instead="at last";; esac;
5447 while $test "$cont"; do
5448         xxx=`./findhdr $1`
5449         var=$2; eval "was=\$$2";
5450         if $test "$xxx" && $test -r "$xxx";
5451         then eval $xxf;
5452         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5453                 cont="";
5454         else eval $xxnf;
5455         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5456         set $yyy; shift; shift; yyy=$@;
5457         case $# in 0) cont="";;
5458         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5459                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5460         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5461                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5462         esac;
5463 done;
5464 while $test "$yyy";
5465 do set $yyy; var=$2; eval "was=\$$2";
5466         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5467         set $yyy; shift; shift; yyy=$@;
5468 done'
5469
5470 : see if stdlib is available
5471 set stdlib.h i_stdlib
5472 eval $inhdr
5473
5474 : check for lengths of integral types
5475 echo " "
5476 case "$intsize" in
5477 '')
5478         echo "Checking to see how big your integers are..." >&4
5479         $cat >try.c <<EOCP
5480 #include <stdio.h>
5481 #$i_stdlib I_STDLIB
5482 #ifdef I_STDLIB
5483 #include <stdlib.h>
5484 #endif
5485 int main()
5486 {
5487         printf("intsize=%d;\n", (int)sizeof(int));
5488         printf("longsize=%d;\n", (int)sizeof(long));
5489         printf("shortsize=%d;\n", (int)sizeof(short));
5490         exit(0);
5491 }
5492 EOCP
5493         set try
5494         if eval $compile_ok && $run ./try > /dev/null; then
5495                 eval `$run ./try`
5496                 echo "Your integers are $intsize bytes long."
5497                 echo "Your long integers are $longsize bytes long."
5498                 echo "Your short integers are $shortsize bytes long."
5499         else
5500                 $cat >&4 <<EOM
5501 !
5502 Help! I can't compile and run the intsize test program: please enlighten me!
5503 (This is probably a misconfiguration in your system or libraries, and
5504 you really ought to fix it.  Still, I'll try anyway.)
5505 !
5506 EOM
5507                 dflt=4
5508                 rp="What is the size of an integer (in bytes)?"
5509                 . ./myread
5510                 intsize="$ans"
5511                 dflt=$intsize
5512                 rp="What is the size of a long integer (in bytes)?"
5513                 . ./myread
5514                 longsize="$ans"
5515                 dflt=2
5516                 rp="What is the size of a short integer (in bytes)?"
5517                 . ./myread
5518                 shortsize="$ans"
5519         fi
5520         ;;
5521 esac
5522 $rm_try
5523
5524 : check for long long
5525 echo " "
5526 echo "Checking to see if you have long long..." >&4
5527 echo 'int main() { long long x = 7; return 0; }' > try.c
5528 set try
5529 if eval $compile; then
5530         val="$define"
5531         echo "You have long long."
5532 else
5533         val="$undef"
5534         echo "You do not have long long."
5535 fi
5536 $rm_try
5537 set d_longlong
5538 eval $setvar
5539
5540 : check for length of long long
5541 case "${d_longlong}${longlongsize}" in
5542 $define)
5543         echo " "
5544         echo "Checking to see how big your long longs are..." >&4
5545         $cat >try.c <<'EOCP'
5546 #include <stdio.h>
5547 int main()
5548 {
5549     printf("%d\n", (int)sizeof(long long));
5550     return(0);
5551 }
5552 EOCP
5553         set try
5554         if eval $compile_ok; then
5555                 longlongsize=`$run ./try`
5556                 echo "Your long longs are $longlongsize bytes long."
5557         else
5558                 dflt='8'
5559                 echo " "
5560                 echo "(I can't seem to compile the test program.  Guessing...)"
5561                 rp="What is the size of a long long (in bytes)?"
5562                 . ./myread
5563                 longlongsize="$ans"
5564         fi
5565         if $test "X$longsize" = "X$longlongsize"; then
5566                 echo "(That isn't any different from an ordinary long.)"
5567         fi
5568         ;;
5569 esac
5570 $rm_try
5571
5572 : see if inttypes.h is available
5573 : we want a real compile instead of Inhdr because some systems
5574 : have an inttypes.h which includes non-existent headers
5575 echo " "
5576 $cat >try.c <<EOCP
5577 #include <inttypes.h>
5578 int main() {
5579         static int32_t foo32 = 0x12345678;
5580 }
5581 EOCP
5582 set try
5583 if eval $compile; then
5584         echo "<inttypes.h> found." >&4
5585         val="$define"
5586 else
5587         echo "<inttypes.h> NOT found." >&4
5588         val="$undef"
5589 fi
5590 $rm_try
5591 set i_inttypes
5592 eval $setvar
5593
5594 : check for int64_t
5595 echo " "
5596 echo "Checking to see if you have int64_t..." >&4
5597 $cat >try.c <<EOCP
5598 #include <sys/types.h>
5599 #$i_inttypes I_INTTYPES
5600 #ifdef I_INTTYPES
5601 #include <inttypes.h>
5602 #endif
5603 int main() { int64_t x = 7; }
5604 EOCP
5605 set try
5606 if eval $compile; then
5607         val="$define"
5608         echo "You have int64_t."
5609 else
5610         val="$undef"
5611         echo "You do not have int64_t."
5612 fi
5613 $rm_try
5614 set d_int64_t
5615 eval $setvar
5616
5617
5618 echo " "
5619 echo "Checking which 64-bit integer type we could use..." >&4
5620
5621 case "$intsize" in
5622 8) val=int
5623    set quadtype
5624    eval $setvar
5625    val='"unsigned int"'
5626    set uquadtype
5627    eval $setvar
5628    quadkind=1
5629    ;;
5630 *) case "$longsize" in
5631    8) val=long
5632       set quadtype
5633       eval $setvar
5634       val='"unsigned long"'
5635       set uquadtype
5636       eval $setvar
5637       quadkind=2
5638       ;;
5639    *) case "$d_longlong:$longlongsize" in
5640       define:8)
5641         val='"long long"'
5642         set quadtype
5643         eval $setvar
5644         val='"unsigned long long"'
5645         set uquadtype
5646         eval $setvar
5647         quadkind=3
5648         ;;
5649       *) case "$d_int64_t" in
5650          define)
5651            val=int64_t
5652            set quadtype
5653            eval $setvar
5654            val=uint64_t
5655            set uquadtype
5656            eval $setvar
5657            quadkind=4
5658            ;;
5659          esac
5660          ;;
5661       esac
5662       ;;
5663    esac
5664    ;;
5665 esac
5666
5667 case "$quadtype" in
5668 '')     echo "Alas, no 64-bit integer types in sight." >&4
5669         d_quad="$undef"
5670         ;;
5671 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5672         d_quad="$define"
5673         ;;
5674 esac
5675
5676
5677 case "$uselonglong" in
5678 "$define"|true|[yY]*)
5679         cat <<EOM >&4
5680
5681 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5682 EOM
5683         use64bitint="$define"
5684         ;;
5685 esac                          
5686 case "$use64bits" in
5687 "$define"|true|[yY]*)
5688         cat <<EOM >&4
5689
5690 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5691 EOM
5692         use64bitint="$define"
5693         ;;
5694 esac                          
5695 case "$use64bitints" in
5696 "$define"|true|[yY]*)
5697         cat <<EOM >&4
5698
5699 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5700 EOM
5701         use64bitint="$define"
5702         ;;
5703 esac                          
5704 case "$use64bitsint" in
5705 "$define"|true|[yY]*)
5706         cat <<EOM >&4
5707
5708 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5709 EOM
5710         use64bitint="$define"
5711         ;;
5712 esac                          
5713 case "$uselonglongs" in
5714 "$define"|true|[yY]*)
5715         cat <<EOM >&4
5716
5717 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5718 EOM
5719         use64bitint="$define"
5720         ;;
5721 esac                          
5722 case "$use64bitsall" in
5723 "$define"|true|[yY]*)
5724         cat <<EOM >&4
5725
5726 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5727 EOM
5728         use64bitall="$define"
5729         ;;
5730 esac                          
5731
5732 case "$ccflags" in
5733 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5734 esac
5735 case "$use64bitall" in
5736 "$define"|true|[yY]*) use64bitint="$define" ;;
5737 esac
5738
5739 case "$longsize" in
5740 8) cat <<EOM
5741
5742 You have natively 64-bit long integers.
5743 EOM
5744    val="$define"
5745    ;;
5746 *) case "$use64bitint" in
5747    "$define"|true|[yY]*) dflt='y';;
5748    *) dflt='n';;
5749    esac
5750    case "$d_quad" in
5751    "$define") ;;
5752    *) dflt='n' ;;
5753    esac
5754    cat <<EOM
5755
5756 Perl can be built to take advantage of 64-bit integer types
5757 on some systems.  To do so, Configure can be run with -Duse64bitint.
5758 Choosing this option will most probably introduce binary incompatibilities.
5759
5760 If this doesn't make any sense to you, just accept the default '$dflt'.
5761 (The default has been chosen based on your configuration.)
5762 EOM
5763    rp='Try to use 64-bit integers, if available?'
5764    . ./myread
5765    case "$ans" in
5766    [yY]*) val="$define" ;;
5767    *)     val="$undef"  ;;
5768    esac
5769    ;;
5770 esac
5771 set use64bitint
5772 eval $setvar
5773
5774 case "$use64bitall" in
5775 "$define"|true|[yY]*) dflt='y' ;;
5776 *) case "$longsize" in
5777    8) dflt='y' ;;
5778    *) dflt='n' ;;
5779    esac
5780    ;;
5781 esac    
5782 cat <<EOM
5783
5784 You may also choose to try maximal 64-bitness.  It means using as much
5785 64-bitness as possible on the platform.  This in turn means even more
5786 binary incompatibilities.  On the other hand, your platform may not
5787 have any more 64-bitness available than what you already have chosen.
5788
5789 If this doesn't make any sense to you, just accept the default '$dflt'.
5790 (The default has been chosen based on your configuration.)
5791 EOM
5792 rp='Try to use maximal 64-bit support, if available?'
5793 . ./myread
5794 case "$ans" in
5795 [yY]*) val="$define" ;;
5796 *)     val="$undef"  ;;
5797 esac
5798 set use64bitall
5799 eval $setvar
5800 case "$use64bitall" in
5801 "$define")
5802         case "$use64bitint" in
5803         "$undef")
5804                 cat <<EOM
5805
5806 Since you have chosen a maximally 64-bit build, I'm also turning on
5807 the use of 64-bit integers.
5808 EOM
5809                 use64bitint="$define" ;;
5810         esac
5811         ;;
5812 esac
5813
5814 : Look for a hint-file generated 'call-back-unit'.  If the
5815 : user has specified that a 64-bit perl is to be built,
5816 : we may need to set or change some other defaults.
5817 if $test -f use64bitint.cbu; then
5818         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5819         . ./use64bitint.cbu
5820 fi
5821 case "$use64bitint" in
5822 "$define"|true|[yY]*)
5823         case "$longsize" in
5824         4) case "$archname64" in
5825            '') archname64=64int ;;
5826            esac
5827            ;;
5828         esac
5829         ;;
5830 esac
5831
5832 : Look for a hint-file generated 'call-back-unit'.  If the
5833 : user has specified that a maximally 64-bit perl is to be built,
5834 : we may need to set or change some other defaults.
5835 if $test -f use64bitall.cbu; then
5836         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5837         . ./use64bitall.cbu
5838 fi
5839 case "$use64bitall" in
5840 "$define"|true|[yY]*)
5841         case "$longsize" in
5842         4) case "$archname64" in
5843            ''|64int) archname64=64all ;;
5844            esac
5845            ;;
5846         esac
5847         ;;
5848 esac
5849
5850 case "$d_quad:$use64bitint" in
5851 $undef:$define)
5852         cat >&4 <<EOF
5853
5854 *** You have chosen to use 64-bit integers,
5855 *** but none can be found.
5856 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5857 *** Cannot continue, aborting.
5858
5859 EOF
5860         exit 1
5861         ;;
5862 esac
5863
5864 : check for length of double
5865 echo " "
5866 case "$doublesize" in
5867 '')
5868         echo "Checking to see how big your double precision numbers are..." >&4
5869         $cat >try.c <<EOCP
5870 #include <stdio.h>
5871 #$i_stdlib I_STDLIB
5872 #ifdef I_STDLIB
5873 #include <stdlib.h>
5874 #endif
5875 int main()
5876 {
5877     printf("%d\n", (int)sizeof(double));
5878     exit(0);
5879 }
5880 EOCP
5881         set try
5882         if eval $compile_ok; then
5883                 doublesize=`$run ./try`
5884                 echo "Your double is $doublesize bytes long."
5885         else
5886                 dflt='8'
5887                 echo "(I can't seem to compile the test program.  Guessing...)"
5888                 rp="What is the size of a double precision number (in bytes)?"
5889                 . ./myread
5890                 doublesize="$ans"
5891         fi
5892         ;;
5893 esac
5894 $rm_try
5895
5896 : check for long doubles
5897 echo " "
5898 echo "Checking to see if you have long double..." >&4
5899 echo 'int main() { long double x = 7.0; }' > try.c
5900 set try
5901 if eval $compile; then
5902         val="$define"
5903         echo "You have long double."
5904 else
5905         val="$undef"
5906         echo "You do not have long double."
5907 fi
5908 $rm_try
5909 set d_longdbl
5910 eval $setvar
5911
5912 : check for length of long double
5913 case "${d_longdbl}${longdblsize}" in
5914 $define)
5915         echo " "
5916         echo "Checking to see how big your long doubles are..." >&4
5917         $cat >try.c <<'EOCP'
5918 #include <stdio.h>
5919 int main()
5920 {
5921         printf("%d\n", sizeof(long double));
5922 }
5923 EOCP
5924         set try
5925         set try
5926         if eval $compile; then
5927                 longdblsize=`$run ./try`
5928                 echo "Your long doubles are $longdblsize bytes long."
5929         else
5930                 dflt='8'
5931                 echo " "
5932                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5933                 rp="What is the size of a long double (in bytes)?"
5934                 . ./myread
5935                 longdblsize="$ans"
5936         fi
5937         if $test "X$doublesize" = "X$longdblsize"; then
5938                 echo "That isn't any different from an ordinary double."
5939                 echo "I'll keep your setting anyway, but you may see some"
5940                 echo "harmless compilation warnings."
5941         fi
5942         ;;
5943 esac
5944 $rm_try
5945
5946 : determine the architecture name
5947 echo " "
5948 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5949         tarch=`arch`"-$osname"
5950 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5951         if uname -m > tmparch 2>&1 ; then
5952                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5953                         -e 's/$/'"-$osname/" tmparch`
5954         else
5955                 tarch="$osname"
5956         fi
5957         $rm -f tmparch
5958 else
5959         tarch="$osname"
5960 fi
5961 case "$myarchname" in
5962 ''|"$tarch") ;;
5963 *)
5964         echo "(Your architecture name used to be $myarchname.)"
5965         archname=''
5966         ;;
5967 esac
5968 case "$targetarch" in
5969 '') ;;
5970 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5971 esac
5972 myarchname="$tarch"
5973 case "$archname" in
5974 '') dflt="$tarch";;
5975 *) dflt="$archname";;
5976 esac
5977 rp='What is your architecture name'
5978 . ./myread
5979 archname="$ans"
5980 case "$usethreads" in
5981 $define)
5982         echo "Threads selected." >&4
5983         case "$archname" in
5984         *-thread*) echo "...and architecture name already has -thread." >&4
5985                 ;;
5986         *)      archname="$archname-thread"
5987                 echo "...setting architecture name to $archname." >&4
5988                 ;;
5989         esac
5990         ;;
5991 esac
5992 case "$usemultiplicity" in
5993 $define)
5994         echo "Multiplicity selected." >&4
5995         case "$archname" in
5996         *-multi*) echo "...and architecture name already has -multi." >&4
5997                 ;;
5998         *)      archname="$archname-multi"
5999                 echo "...setting architecture name to $archname." >&4
6000                 ;;
6001         esac
6002         ;;
6003 esac
6004 case "$use64bitint$use64bitall" in
6005 *"$define"*)
6006         case "$archname64" in
6007         '')
6008                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6009                 ;;
6010         *)
6011                 case "$use64bitint" in
6012                 "$define") echo "64 bit integers selected." >&4 ;;
6013                 esac
6014                 case "$use64bitall" in
6015                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6016                 esac
6017                 case "$archname" in
6018                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6019                         ;;
6020                 *)      archname="$archname-$archname64"
6021                         echo "...setting architecture name to $archname." >&4
6022                         ;;
6023                 esac
6024                 ;;
6025         esac
6026 esac
6027 case "$uselongdouble" in
6028 $define)
6029         echo "Long doubles selected." >&4
6030         case "$longdblsize" in
6031         $doublesize)
6032                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6033                 ;;
6034         *)
6035                 case "$archname" in
6036                 *-ld*) echo "...and architecture name already has -ld." >&4
6037                         ;;
6038                 *)      archname="$archname-ld"
6039                         echo "...setting architecture name to $archname." >&4
6040                         ;;
6041                 esac
6042                 ;;
6043         esac
6044         ;;
6045 esac
6046 case "$useperlio" in
6047 $define)
6048         echo "Perlio selected." >&4
6049         ;;
6050 *)
6051         echo "Perlio not selected, using stdio." >&4
6052         case "$archname" in
6053         *-stdio*) echo "...and architecture name already has -stdio." >&4
6054                 ;;
6055         *)      archname="$archname-stdio"
6056                 echo "...setting architecture name to $archname." >&4
6057                 ;;
6058         esac
6059         ;;
6060 esac
6061 if $test -f archname.cbu; then
6062         echo "Your platform has some specific hints for architecture name, using them..."
6063         . ./archname.cbu
6064 fi
6065
6066 : set the prefixit variable, to compute a suitable default value
6067 prefixit='case "$3" in
6068 ""|none)
6069         case "$oldprefix" in
6070         "") eval "$1=\"\$$2\"";;
6071         *)
6072                 case "$3" in
6073                 "") eval "$1=";;
6074                 none)
6075                         eval "tp=\"\$$2\"";
6076                         case "$tp" in
6077                         ""|" ") eval "$1=\"\$$2\"";;
6078                         *) eval "$1=";;
6079                         esac;;
6080                 esac;;
6081         esac;;
6082 *)
6083         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6084         case "$tp" in
6085         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6086         /*-$oldprefix/*|\~*-$oldprefix/*)
6087                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6088         *) eval "$1=\"\$$2\"";;
6089         esac;;
6090 esac'
6091
6092 : determine installation style
6093 : For now, try to deduce it from prefix unless it is already set.
6094 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6095 case "$installstyle" in
6096 '')     case "$prefix" in
6097                 *perl*) dflt='lib';;
6098                 *) dflt='lib/perl5' ;;
6099         esac
6100         ;;
6101 *)      dflt="$installstyle" ;;
6102 esac
6103 : Probably not worth prompting for this since we prompt for all
6104 : the directories individually, and the prompt would be too long and
6105 : confusing anyway.
6106 installstyle=$dflt
6107
6108 : determine where public executables go
6109 echo " "
6110 set dflt bin bin
6111 eval $prefixit
6112 fn=d~
6113 rp='Pathname where the public executables will reside?'
6114 . ./getfile
6115 if $test "X$ansexp" != "X$binexp"; then
6116         installbin=''
6117 fi
6118 prefixvar=bin
6119 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6120 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6121 :     this via initialinstalllocation
6122 . ./setprefixvar
6123
6124 case "$userelocatableinc" in
6125 $define|true|[yY]*)     dflt='y' ;;
6126 *)                      dflt='n' ;;
6127 esac
6128 cat <<EOM
6129
6130 Would you like to build Perl so that the installation is relocatable, so that
6131 library paths in @INC are determined relative to the path of the perl binary?
6132 This is not advised for system Perl installs, or if you need to run setid
6133 scripts or scripts under taint mode.
6134
6135 If this doesn't make any sense to you, just accept the default '$dflt'.
6136 EOM
6137 rp='Use relocatable @INC?'
6138 . ./myread
6139 case "$ans" in
6140 y|Y)    val="$define" ;;
6141 *)      val="$undef"  ;;
6142 esac
6143 set userelocatableinc
6144 eval $setvar
6145
6146 initialinstalllocation="$binexp"
6147 : Default prefix is now "up one level from where the binaries are"
6148 case "$userelocatableinc" in
6149 $define|true|[yY]*)
6150     bin=".../"
6151     binexp=".../"
6152     prefix=".../.."
6153     prefixexp=".../.."
6154     installprefixexp=".../.."
6155     ;;
6156 esac
6157
6158 : determine where private library files go
6159 : Usual default is /usr/local/lib/perl5/$version.
6160 : Also allow things like /opt/perl/lib/$version, since
6161 : /opt/perl/lib/perl5... would be redundant.
6162 : The default "style" setting is made in installstyle.U
6163 case "$installstyle" in
6164 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6165 *)       set dflt privlib lib/$version ;;
6166 esac
6167 eval $prefixit
6168 $cat <<EOM
6169
6170 There are some auxiliary files for $package that need to be put into a
6171 private library directory that is accessible by everyone.
6172
6173 EOM
6174 fn=$binexp
6175 fn=d~+
6176 rp='Pathname where the private library files will reside?'
6177 . ./getfile
6178 prefixvar=privlib
6179 . ./setprefixvar
6180
6181 : set the prefixup variable, to restore leading tilda escape
6182 prefixup='case "$prefixexp" in
6183 "$prefix") ;;
6184 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6185 esac'
6186
6187 : determine where public architecture dependent libraries go
6188 set archlib archlib
6189 eval $prefixit
6190 : privlib default is /usr/local/lib/$package/$version
6191 : archlib default is /usr/local/lib/$package/$version/$archname
6192 : privlib may have an optional trailing /share.
6193 tdflt=`echo $privlib | $sed 's,/share$,,'`
6194 tdflt=$tdflt/$archname
6195 case "$archlib" in
6196 '')     dflt=$tdflt
6197         ;;
6198 *)      dflt="$archlib"
6199     ;;
6200 esac
6201 $cat <<EOM
6202
6203 $spackage contains architecture-dependent library files.  If you are
6204 sharing libraries in a heterogeneous environment, you might store
6205 these files in a separate location.  Otherwise, you can just include
6206 them with the rest of the public library files.
6207
6208 EOM
6209 fn=$binexp
6210 fn=d+~
6211 rp='Where do you want to put the public architecture-dependent libraries?'
6212 . ./getfile
6213 prefixvar=archlib
6214 . ./setprefixvar
6215 if $test X"$archlib" = X"$privlib"; then
6216         d_archlib="$undef"
6217 else
6218         d_archlib="$define"
6219 fi
6220
6221 : see if setuid scripts can be secure
6222 $cat <<EOM
6223
6224 Some kernels have a bug that prevents setuid #! scripts from being
6225 secure.  Some sites have disabled setuid #! scripts because of this.
6226
6227 First let's decide if your kernel supports secure setuid #! scripts.
6228 (If setuid #! scripts would be secure but have been disabled anyway,
6229 don't say that they are secure if asked.)
6230
6231 EOM
6232
6233 val="$undef"
6234 if $test -d /dev/fd; then
6235         echo "#!$ls" >reflect
6236         chmod +x,u+s reflect
6237         ./reflect >flect 2>&1
6238         if $contains "/dev/fd" flect >/dev/null; then
6239                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6240                 val="$define"
6241         else
6242                 $cat <<EOM
6243 If you are not sure if they are secure, I can check but I'll need a
6244 username and password different from the one you are using right now.
6245 If you don't have such a username or don't want me to test, simply
6246 enter 'none'.
6247
6248 EOM
6249                 rp='Other username to test security of setuid scripts with?'
6250                 dflt='none'
6251                 . ./myread
6252                 case "$ans" in
6253                 n|none)
6254                         case "$d_suidsafe" in
6255                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6256                                 dflt=n;;
6257                         "$undef")
6258                                 echo "Well, the $hint value is *not* secure." >&4
6259                                 dflt=n;;
6260                         *)      echo "Well, the $hint value *is* secure." >&4
6261                                 dflt=y;;
6262                         esac
6263                         ;;
6264                 *)
6265                         $rm -f reflect flect
6266                         echo "#!$ls" >reflect
6267                         chmod +x,u+s reflect
6268                         echo >flect
6269                         chmod a+w flect
6270                         echo '"su" will (probably) prompt you for '"$ans's password."
6271                         su $ans -c './reflect >flect'
6272                         if $contains "/dev/fd" flect >/dev/null; then
6273                                 echo "Okay, it looks like setuid scripts are secure." >&4
6274                                 dflt=y
6275                         else
6276                                 echo "I don't think setuid scripts are secure." >&4
6277                                 dflt=n
6278                         fi
6279                         ;;
6280                 esac
6281                 rp='Does your kernel have *secure* setuid scripts?'
6282                 . ./myread
6283                 case "$ans" in
6284                 [yY]*)  val="$define";;
6285                 *)      val="$undef";;
6286                 esac
6287         fi
6288 else
6289         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6290         echo "(That's for file descriptors, not floppy disks.)"
6291         val="$undef"
6292 fi
6293 set d_suidsafe
6294 eval $setvar
6295
6296 $rm -f reflect flect
6297
6298 : now see if they want to do setuid emulation
6299 echo " "
6300 val="$undef"
6301 case "$d_suidsafe" in
6302 "$define")
6303         val="$undef"
6304         echo "No need to emulate SUID scripts since they are secure here." >&4
6305         ;;
6306 *)
6307         $cat <<EOM
6308 Some systems have disabled setuid scripts, especially systems where
6309 setuid scripts cannot be secure.  On systems where setuid scripts have
6310 been disabled, the setuid/setgid bits on scripts are currently
6311 useless.  It is possible for $package to detect those bits and emulate
6312 setuid/setgid in a secure fashion.  This emulation will only work if
6313 setuid scripts have been disabled in your kernel.
6314
6315 EOM
6316         case "$d_dosuid" in
6317         "$define") dflt=y ;;
6318         *) dflt=n ;;
6319         esac
6320         rp="Do you want to do setuid/setgid emulation?"
6321         . ./myread
6322         case "$ans" in
6323         [yY]*)  val="$define";;
6324         *)      val="$undef";;
6325         esac
6326         ;;
6327 esac
6328 set d_dosuid
6329 eval $setvar
6330
6331 : Find perl5.005 or later.
6332 echo "Looking for a previously installed perl5.005 or later... "
6333 case "$perl5" in
6334 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6335                 : Check if this perl is recent and can load a simple module
6336                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6337                         perl5=$tdir/perl
6338                         break;
6339                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6340                         perl5=$tdir/perl5
6341                         break;
6342                 fi
6343         done
6344         ;;
6345 *)      perl5="$perl5"
6346         ;;
6347 esac
6348 case "$perl5" in
6349 '')     echo "None found.  That's ok.";;
6350 *)      echo "Using $perl5." ;;
6351 esac
6352
6353 $cat <<EOM
6354
6355 After $package is installed, you may wish to install various
6356 add-on modules and utilities.  Typically, these add-ons will
6357 be installed under $prefix with the rest
6358 of this package.  However, you may wish to install such add-ons
6359 elsewhere under a different prefix.
6360
6361 If you do not wish to put everything under a single prefix, that's
6362 ok.  You will be prompted for the individual locations; this siteprefix
6363 is only used to suggest the defaults.
6364
6365 The default should be fine for most people.
6366
6367 EOM
6368 fn=d~+
6369 rp='Installation prefix to use for add-on modules and utilities?'
6370 : XXX Here might be another good place for an installstyle setting.
6371 case "$siteprefix" in
6372 '') dflt=$prefix ;;
6373 *)  dflt=$siteprefix ;;
6374 esac
6375 . ./getfile
6376 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6377 oldsiteprefix=''
6378 case "$siteprefix" in
6379 '') ;;
6380 *)      case "$ans" in
6381         "$prefix") ;;
6382         *) oldsiteprefix="$prefix";;
6383         esac
6384         ;;
6385 esac
6386 siteprefix="$ans"
6387 siteprefixexp="$ansexp"
6388
6389 : determine where site specific libraries go.
6390 : Usual default is /usr/local/lib/perl5/site_perl/$version
6391 : The default "style" setting is made in installstyle.U
6392 : XXX No longer works with Prefixit stuff.
6393 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6394 case "$sitelib" in
6395 '') case "$installstyle" in
6396         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6397         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6398         esac
6399         ;;
6400 *)      dflt="$sitelib"
6401         ;;
6402 esac
6403 $cat <<EOM
6404
6405 The installation process will create a directory for
6406 site-specific extensions and modules.  Most users find it convenient
6407 to place all site-specific files in this directory rather than in the
6408 main distribution directory.
6409
6410 EOM
6411 fn=d~+
6412 rp='Pathname for the site-specific library files?'
6413 . ./getfile
6414 prefixvar=sitelib
6415 . ./setprefixvar
6416 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6417
6418 : Determine list of previous versions to include in @INC
6419 $cat > getverlist <<EOPL
6420 #!$perl5 -w
6421 use File::Basename;
6422 \$api_versionstring = "$api_versionstring";
6423 \$version = "$version";
6424 \$stem = "$sitelib_stem";
6425 \$archname = "$archname";
6426 EOPL
6427         $cat >> getverlist <<'EOPL'
6428 # The list found is store twice for each entry: the original name, and
6429 # the binary broken down version as pack "sss", so sorting is easy and
6430 # unambiguous. This will work for all versions that have a maximum of
6431 # three digit groups, separate by '.'s or '_'s. Names are extended with
6432 # ".0.0" to ensure at least three elements for the pack.
6433 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6434
6435 # Can't have leading @ because metaconfig interprets it as a command!
6436 ;@inc_version_list=();
6437 # XXX Redo to do opendir/readdir?
6438 if (-d $stem) {
6439     chdir($stem);
6440     ;@candidates = map {
6441         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6442 }
6443 else {
6444     ;@candidates = ();
6445 }
6446
6447 ($pversion, $aversion, $vsn5005) = map {
6448     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6449 foreach $d (@candidates) {
6450     if ($d->[1] lt $pversion) {
6451         if ($d->[1] ge $aversion) {
6452             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6453         }
6454         elsif ($d->[1] ge $vsn5005) {
6455             unshift(@inc_version_list, grep { -d } $d->[0]);
6456         }
6457     }
6458     else {
6459         # Skip newer version.  I.e. don't look in
6460         # 5.7.0 if we're installing 5.6.1.
6461     }
6462 }
6463
6464 if (@inc_version_list) {
6465     print join(' ', @inc_version_list);
6466 }
6467 else {
6468     # Blank space to preserve value for next Configure run.
6469     print " ";
6470 }
6471 EOPL
6472 chmod +x getverlist
6473 case "$inc_version_list" in
6474 '')     if test -x "$perl5$exe_ext"; then
6475                 dflt=`$perl5 getverlist`
6476         else
6477                 dflt='none'
6478         fi
6479         ;;
6480 $undef) dflt='none' ;;
6481 *)  eval dflt=\"$inc_version_list\" ;;
6482 esac
6483 case "$dflt" in
6484 ''|' ') dflt=none ;;
6485 esac
6486 case "$dflt" in
6487 5.005) dflt=none ;;
6488 esac
6489 $cat <<EOM
6490
6491 In order to ease the process of upgrading, this version of perl
6492 can be configured to use modules built and installed with earlier
6493 versions of perl that were installed under $prefix.  Specify here
6494 the list of earlier versions that this version of perl should check.
6495 If Configure detected no earlier versions of perl installed under
6496 $prefix, then the list will be empty.  Answer 'none' to tell perl
6497 to not search earlier versions.
6498
6499 The default should almost always be sensible, so if you're not sure,
6500 just accept the default.
6501 EOM
6502
6503 rp='List of earlier versions to include in @INC?'
6504 . ./myread
6505 case "$ans" in
6506 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6507 *) inc_version_list="$ans" ;;
6508 esac
6509 case "$inc_version_list" in
6510 ''|' ')
6511         inc_version_list_init='0'
6512         d_inc_version_list="$undef"
6513         ;;
6514 *)      inc_version_list_init=`echo $inc_version_list |
6515                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6516         d_inc_version_list="$define"
6517         ;;
6518 esac
6519 $rm -f getverlist
6520
6521 : see if this is a malloc.h system
6522 : we want a real compile instead of Inhdr because some systems have a
6523 : malloc.h that just gives a compile error saying to use stdlib.h instead
6524 echo " "
6525 $cat >try.c <<EOCP
6526 #include <stdlib.h>
6527 #include <malloc.h>
6528 int main () { return 0; }
6529 EOCP
6530 set try
6531 if eval $compile; then
6532     echo "<malloc.h> found." >&4
6533     val="$define"
6534 else
6535     echo "<malloc.h> NOT found." >&4
6536     val="$undef"
6537 fi
6538 $rm_try
6539 set i_malloc
6540 eval $setvar
6541
6542 : check for void type
6543 echo " "
6544 echo "Checking to see how well your C compiler groks the void type..." >&4
6545 case "$voidflags" in
6546 '')
6547         $cat >try.c <<EOCP
6548 #$i_stdlib I_STDLIB
6549 #ifdef I_STDLIB
6550 #include <stdlib.h>
6551 #endif
6552 #if TRY & 1
6553 void sub() {
6554 #else
6555 sub() {
6556 #endif
6557         extern void moo();      /* function returning void */
6558         void (*goo)();          /* ptr to func returning void */
6559 #if TRY & 8
6560         void *hue;              /* generic ptr */
6561 #endif
6562 #if TRY & 2
6563         void (*foo[10])();
6564 #endif
6565
6566 #if TRY & 4
6567         if(goo == moo) {
6568                 exit(0);
6569         }
6570 #endif
6571         exit(0);
6572 }
6573 int main() { sub(); }
6574 EOCP
6575         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6576                 voidflags=$defvoidused
6577         echo "Good.  It appears to support void to the level $package wants.">&4
6578                 if $contains warning .out >/dev/null 2>&1; then
6579                         echo "However, you might get some warnings that look like this:"
6580                         $cat .out
6581                 fi
6582         else
6583 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6584                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6585                         echo "It supports 1..."
6586                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6587                                 echo "It also supports 2..."
6588                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6589                                         voidflags=7
6590                                         echo "And it supports 4 but not 8 definitely."
6591                                 else
6592                                         echo "It doesn't support 4..."
6593                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6594                                                 voidflags=11
6595                                                 echo "But it supports 8."
6596                                         else
6597                                                 voidflags=3
6598                                                 echo "Neither does it support 8."
6599                                         fi
6600                                 fi
6601                         else
6602                                 echo "It does not support 2..."
6603                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6604                                         voidflags=13
6605                                         echo "But it supports 4 and 8."
6606                                 else
6607                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6608                                                 voidflags=5
6609                                                 echo "And it supports 4 but has not heard about 8."
6610                                         else
6611                                                 echo "However it supports 8 but not 4."
6612                                         fi
6613                                 fi
6614                         fi
6615                 else
6616                         echo "There is no support at all for void."
6617                         voidflags=0
6618                 fi
6619         fi
6620 esac
6621 case "$voidflags" in
6622 "$defvoidused") ;;
6623 *)      $cat >&4 <<'EOM'
6624   Support flag bits are:
6625     1: basic void declarations.
6626     2: arrays of pointers to functions returning void.
6627     4: operations between pointers to and addresses of void functions.
6628     8: generic void pointers.
6629 EOM
6630         dflt="$voidflags";
6631         rp="Your void support flags add up to what?"
6632         . ./myread
6633         voidflags="$ans"
6634         ;;
6635 esac
6636 $rm_try
6637
6638 : check for length of pointer
6639 echo " "
6640 case "$ptrsize" in
6641 '')
6642         echo "Checking to see how big your pointers are..." >&4
6643         if test "$voidflags" -gt 7; then
6644                 echo '#define VOID_PTR char *' > try.c
6645         else
6646                 echo '#define VOID_PTR void *' > try.c
6647         fi
6648         $cat >>try.c <<EOCP
6649 #include <stdio.h>
6650 #$i_stdlib I_STDLIB
6651 #ifdef I_STDLIB
6652 #include <stdlib.h>
6653 #endif
6654 int main()
6655 {
6656     printf("%d\n", (int)sizeof(VOID_PTR));
6657     exit(0);
6658 }
6659 EOCP
6660         set try
6661         if eval $compile_ok; then
6662                 ptrsize=`$run ./try`
6663                 echo "Your pointers are $ptrsize bytes long."
6664         else
6665                 dflt='4'
6666                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6667                 rp="What is the size of a pointer (in bytes)?"
6668                 . ./myread
6669                 ptrsize="$ans"
6670         fi
6671         ;;
6672 esac
6673 $rm_try
6674 case "$use64bitall" in
6675 "$define"|true|[yY]*)
6676         case "$ptrsize" in
6677         4)      cat <<EOM >&4
6678
6679 *** You have chosen a maximally 64-bit build,
6680 *** but your pointers are only 4 bytes wide.
6681 *** Please rerun Configure without -Duse64bitall.
6682 EOM
6683                 case "$d_quad" in
6684                 define)
6685                         cat <<EOM >&4
6686 *** Since you have quads, you could possibly try with -Duse64bitint.
6687 EOM
6688                         ;;
6689                 esac
6690                 cat <<EOM >&4
6691 *** Cannot continue, aborting.
6692
6693 EOM
6694
6695                 exit 1
6696                 ;;
6697         esac
6698         ;;
6699 esac
6700
6701
6702 : determine whether to use malloc wrapping
6703 echo " "
6704 case "$usemallocwrap" in
6705 [yY]*|true|$define)     dflt='y' ;;
6706 [nN]*|false|$undef)     dflt='n' ;;
6707 *)      case "$usedevel" in
6708         [yY]*|true|$define)     dflt='y' ;;
6709         *) dflt='n' ;;
6710         esac
6711         ;;
6712 esac
6713 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6714 . ./myread
6715 usemallocwrap="$ans"
6716 case "$ans" in
6717 y*|true)
6718         usemallocwrap="$define" ;;
6719 *)
6720         usemallocwrap="$undef" ;;
6721 esac
6722
6723 : determine which malloc to compile in
6724 echo " "
6725 case "$usemymalloc" in
6726 [yY]*|true|$define)     dflt='y' ;;
6727 [nN]*|false|$undef)     dflt='n' ;;
6728 *)      case "$ptrsize" in
6729         4) dflt='y' ;;
6730         *) dflt='n' ;;
6731         esac
6732         ;;
6733 esac
6734 rp="Do you wish to attempt to use the malloc that comes with $package?"
6735 . ./myread
6736 usemymalloc="$ans"
6737 case "$ans" in
6738 y*|true)
6739         usemymalloc='y'
6740         mallocsrc='malloc.c'
6741         mallocobj="malloc$_o"
6742         d_mymalloc="$define"
6743         case "$libs" in
6744         *-lmalloc*)
6745                 : Remove malloc from list of libraries to use
6746                 echo "Removing unneeded -lmalloc from library list" >&4
6747                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6748                 shift
6749                 libs="$*"
6750                 echo "libs = $libs" >&4
6751                 ;;
6752         esac
6753         ;;
6754 *)
6755         usemymalloc='n'
6756         mallocsrc=''
6757         mallocobj=''
6758         d_mymalloc="$undef"
6759         ;;
6760 esac
6761
6762 : compute the return types of malloc and free
6763 echo " "
6764 $cat >malloc.c <<END
6765 #$i_malloc I_MALLOC
6766 #$i_stdlib I_STDLIB
6767 #include <stdio.h>
6768 #include <sys/types.h>
6769 #ifdef I_MALLOC
6770 #include <malloc.h>
6771 #endif
6772 #ifdef I_STDLIB
6773 #include <stdlib.h>
6774 #endif
6775 #ifdef TRY_MALLOC
6776 void *malloc();
6777 #endif
6778 #ifdef TRY_FREE
6779 void free();
6780 #endif
6781 END
6782 case "$malloctype" in
6783 '')
6784         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6785                 malloctype='void *'
6786         else
6787                 malloctype='char *'
6788         fi
6789         ;;
6790 esac
6791 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6792
6793 case "$freetype" in
6794 '')
6795         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6796                 freetype='void'
6797         else
6798                 freetype='int'
6799         fi
6800         ;;
6801 esac
6802 echo "Your system uses $freetype free(), it would seem." >&4
6803 $rm -f malloc.[co]
6804 : determine where site specific architecture-dependent libraries go.
6805 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6806 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6807 : sitelib may have an optional trailing /share.
6808 case "$sitearch" in
6809 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6810         dflt="$dflt/$archname"
6811         ;;
6812 *)      dflt="$sitearch"
6813         ;;
6814 esac
6815 set sitearch sitearch none
6816 eval $prefixit
6817 $cat <<EOM
6818
6819 The installation process will also create a directory for
6820 architecture-dependent site-specific extensions and modules.
6821
6822 EOM
6823 fn=d~+
6824 rp='Pathname for the site-specific architecture-dependent library files?'
6825 . ./getfile
6826 prefixvar=sitearch
6827 . ./setprefixvar
6828 if $test X"$sitearch" = X"$sitelib"; then
6829         d_sitearch="$undef"
6830 else
6831         d_sitearch="$define"
6832 fi
6833
6834 $cat <<EOM
6835
6836 The installation process will also create a directory for
6837 vendor-supplied add-ons.  Vendors who supply perl with their system
6838 may find it convenient to place all vendor-supplied files in this
6839 directory rather than in the main distribution directory.  This will
6840 ease upgrades between binary-compatible maintenance versions of perl.
6841
6842 Of course you may also use these directories in whatever way you see
6843 fit.  For example, you might use them to access modules shared over a
6844 company-wide network.
6845
6846 The default answer should be fine for most people.
6847 This causes further questions about vendor add-ons to be skipped
6848 and no vendor-specific directories will be configured for perl.
6849
6850 EOM
6851 rp='Do you want to configure vendor-specific add-on directories?'
6852 case "$usevendorprefix" in
6853 define|true|[yY]*) dflt=y ;;
6854 *)      : User may have set vendorprefix directly on Configure command line.
6855         case "$vendorprefix" in
6856         ''|' ') dflt=n ;;
6857         *)      dflt=y ;;
6858         esac
6859         ;;
6860 esac
6861 . ./myread
6862 case "$ans" in
6863 [yY]*)  fn=d~+
6864         rp='Installation prefix to use for vendor-supplied add-ons?'
6865         case "$vendorprefix" in
6866         '') dflt='' ;;
6867         *)  dflt=$vendorprefix ;;
6868         esac
6869         . ./getfile
6870         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6871         oldvendorprefix=''
6872         case "$vendorprefix" in
6873         '') ;;
6874         *)      case "$ans" in
6875                 "$prefix") ;;
6876                 *) oldvendorprefix="$prefix";;
6877                 esac
6878                 ;;
6879         esac
6880         usevendorprefix="$define"
6881         vendorprefix="$ans"
6882         vendorprefixexp="$ansexp"
6883         ;;
6884 *)      usevendorprefix="$undef"
6885         vendorprefix=''
6886         vendorprefixexp=''
6887         ;;
6888 esac
6889
6890 case "$vendorprefix" in
6891 '')     d_vendorlib="$undef"
6892         vendorlib=''
6893         vendorlibexp=''
6894         ;;
6895 *)      d_vendorlib="$define"
6896         : determine where vendor-supplied modules go.
6897         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6898         case "$vendorlib" in
6899         '')
6900                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6901                 case "$installstyle" in
6902                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6903                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6904                 esac
6905                 ;;
6906         *)      dflt="$vendorlib"
6907                 ;;
6908         esac
6909         fn=d~+
6910         rp='Pathname for the vendor-supplied library files?'
6911         . ./getfile
6912         vendorlib="$ans"
6913         vendorlibexp="$ansexp"
6914         ;;
6915 esac
6916 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6917 prefixvar=vendorlib
6918 . ./installprefix
6919
6920 case "$vendorprefix" in
6921 '')     d_vendorarch="$undef"
6922         vendorarch=''
6923         vendorarchexp=''
6924         ;;
6925 *)      d_vendorarch="$define"
6926         : determine where vendor-supplied architecture-dependent libraries go.
6927         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6928         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6929         : vendorlib may have an optional trailing /share.
6930         case "$vendorarch" in
6931         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6932                 dflt="$dflt/$archname"
6933                 ;;
6934         *)      dflt="$vendorarch" ;;
6935         esac
6936         fn=d~+
6937         rp='Pathname for vendor-supplied architecture-dependent files?'
6938         . ./getfile
6939         vendorarch="$ans"
6940         vendorarchexp="$ansexp"
6941         ;;
6942 esac
6943 prefixvar=vendorarch
6944 . ./installprefix
6945
6946 : Final catch-all directories to search
6947 $cat <<EOM
6948
6949 Lastly, you can have perl look in other directories for extensions and
6950 modules in addition to those already specified.
6951 These directories will be searched after 
6952         $sitearch 
6953         $sitelib 
6954 EOM
6955 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6956 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6957 echo ' '
6958 case "$otherlibdirs" in
6959 ''|' ') dflt='none' ;;
6960 *)      dflt="$otherlibdirs" ;;
6961 esac
6962 $cat <<EOM
6963 Enter a colon-separated set of extra paths to include in perl's @INC
6964 search path, or enter 'none' for no extra paths.
6965
6966 EOM
6967
6968 rp='Colon-separated list of additional directories for perl to search?'
6969 . ./myread
6970 case "$ans" in
6971 ' '|''|none)    otherlibdirs=' ' ;;     
6972 *)      otherlibdirs="$ans" ;;
6973 esac
6974 case "$otherlibdirs" in
6975 ' ') val=$undef ;;
6976 *)      val=$define ;;
6977 esac
6978 set d_perl_otherlibdirs
6979 eval $setvar
6980
6981 : Cruising for prototypes
6982 echo " "
6983 echo "Checking out function prototypes..." >&4
6984 $cat >prototype.c <<EOCP
6985 #$i_stdlib I_STDLIB
6986 #ifdef I_STDLIB
6987 #include <stdlib.h>
6988 #endif
6989 int main(int argc, char *argv[]) {
6990         exit(0);}
6991 EOCP
6992 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6993         echo "Your C compiler appears to support function prototypes."
6994         val="$define"
6995 else
6996         echo "Your C compiler doesn't seem to understand function prototypes."
6997         val="$undef"
6998 fi
6999 set prototype
7000 eval $setvar
7001 $rm -f prototype*
7002
7003 case "$prototype" in
7004 "$define") ;;
7005 *)      ansi2knr='ansi2knr'
7006         echo " "
7007         cat <<EOM >&4
7008
7009 $me:  FATAL ERROR:
7010 This version of $package can only be compiled by a compiler that 
7011 understands function prototypes.  Unfortunately, your C compiler 
7012         $cc $ccflags
7013 doesn't seem to understand them.  Sorry about that.
7014
7015 If GNU cc is available for your system, perhaps you could try that instead.  
7016
7017 Eventually, we hope to support building Perl with pre-ANSI compilers.
7018 If you would like to help in that effort, please contact <perlbug@perl.org>.
7019
7020 Aborting Configure now.
7021 EOM
7022         exit 2
7023         ;;
7024 esac
7025
7026 echo " "
7027 case "$extras" in
7028 '') dflt='n';;
7029 *) dflt='y';;
7030 esac
7031 cat <<EOM
7032 Perl can be built with extra modules or bundles of modules which
7033 will be fetched from the CPAN and installed alongside Perl.
7034
7035 Notice that you will need access to the CPAN; either via the Internet,
7036 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7037 be asked later to configure the CPAN.pm module which will in turn do
7038 the installation of the rest of the extra modules or bundles.)
7039
7040 Notice also that if the modules require any external software such as
7041 libraries and headers (the libz library and the zlib.h header for the
7042 Compress::Zlib module, for example) you MUST have any such software
7043 already installed, this configuration process will NOT install such
7044 things for you.
7045
7046 If this doesn't make any sense to you, just accept the default '$dflt'.
7047 EOM
7048 rp='Install any extra modules (y or n)?'
7049 . ./myread
7050 case "$ans" in
7051 y|Y)
7052         cat <<EOM
7053
7054 Please list any extra modules or bundles to be installed from CPAN,
7055 with spaces between the names.  The names can be in any format the
7056 'install' command of CPAN.pm will understand.  (Answer 'none',
7057 without the quotes, to install no extra modules or bundles.)
7058 EOM
7059         rp='Extras?'
7060         dflt="$extras"
7061         . ./myread
7062         extras="$ans"
7063 esac
7064 case "$extras" in
7065 ''|'none')
7066         val=''
7067         $rm -f ../extras.lst
7068         ;;
7069 *)      echo "(Saving the list of extras for later...)"
7070         echo "$extras" > ../extras.lst
7071         val="'$extras'"
7072         ;;
7073 esac
7074 set extras
7075 eval $setvar
7076 echo " "
7077
7078 : determine where html pages for programs go
7079 set html1dir html1dir none
7080 eval $prefixit
7081 $cat <<EOM
7082
7083 If you wish to install html files for programs in $spackage, indicate
7084 the appropriate directory here.  To skip installing html files,
7085 answer "none".
7086 EOM
7087 case "$html1dir" in
7088 ''|none|$undef|' ') dflt=none ;;
7089 *) dflt=$html1dir ;;
7090 esac
7091 fn=dn+~
7092 rp="Directory for the main $spackage html pages?"
7093 . ./getfile
7094 prefixvar=html1dir
7095 . ./setprefixvar
7096 : Use ' ' for none so value is preserved next time through Configure
7097 $test X"$html1dir" = "X" && html1dir=' '
7098
7099 : determine where html pages for libraries and modules go
7100 set html3dir html3dir none
7101 eval $prefixit
7102 $cat <<EOM
7103
7104 If you wish to install html files for modules associated with $spackage,
7105 indicate the appropriate directory here.  To skip installing html files,
7106 answer "none".
7107 EOM
7108 : There is no obvious default.  If they have specified html1dir, then
7109 : try to key off that, possibly changing .../html1 into .../html3.
7110 case "$html3dir" in
7111 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7112 *) dflt=$html3dir ;;
7113 esac
7114 fn=dn+~
7115 rp="Directory for the $spackage module html pages?"
7116 . ./getfile
7117 prefixvar=html3dir
7118 . ./setprefixvar
7119 : Use ' ' for none so value is preserved next time through Configure
7120 $test X"$html3dir" = "X" && html3dir=' '
7121
7122 : determine whether to install perl also as /usr/bin/perl
7123
7124 echo " "
7125 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7126         $cat <<EOM
7127 Many scripts expect perl to be installed as /usr/bin/perl.
7128
7129 If you want to, I can install the perl you are about to compile
7130 as /usr/bin/perl (in addition to $bin/perl).
7131 EOM
7132         if test -f /usr/bin/perl; then
7133             $cat <<EOM
7134
7135 However, please note that because you already have a /usr/bin/perl,
7136 overwriting that with a new Perl would very probably cause problems.
7137 Therefore I'm assuming you don't want to do that (unless you insist).
7138
7139 EOM
7140             case "$installusrbinperl" in
7141             "$define"|[yY]*)    dflt='y';;
7142             *)                  dflt='n';;
7143             esac
7144         else
7145             $cat <<EOM
7146
7147 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7148
7149 EOM
7150             case "$installusrbinperl" in
7151             "$undef"|[nN]*)     dflt='n';;
7152             *)                  dflt='y';;
7153             esac
7154         fi
7155         rp="Do you want to install perl as /usr/bin/perl?"
7156         . ./myread
7157         case "$ans" in
7158         [yY]*)  val="$define";;
7159         *)      val="$undef" ;;
7160         esac
7161 else
7162         val="$undef"
7163 fi
7164 set installusrbinperl
7165 eval $setvar
7166
7167 echo " "
7168 echo "Checking for GNU C Library..." >&4
7169 cat >try.c <<'EOCP'
7170 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7171    alone are insufficient to distinguish different versions, such as
7172    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7173    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7174 */
7175 #include <stdio.h>
7176 int main(void)
7177 {
7178 #ifdef __GLIBC__
7179 #   ifdef __GLIBC_MINOR__
7180 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7181 #           include <gnu/libc-version.h>
7182             printf("%s\n",  gnu_get_libc_version());
7183 #       else
7184             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7185 #       endif
7186 #   else
7187         printf("%d\n",  __GLIBC__);
7188 #   endif
7189     return 0;
7190 #else
7191     return 1;
7192 #endif
7193 }
7194 EOCP
7195 set try
7196 if eval $compile_ok && $run ./try > glibc.ver; then
7197         val="$define"
7198         gnulibc_version=`$cat glibc.ver`
7199         echo "You are using the GNU C Library version $gnulibc_version"
7200 else
7201         val="$undef"
7202         gnulibc_version=''
7203         echo "You are not using the GNU C Library"
7204 fi
7205 $rm_try glibc.ver
7206 set d_gnulibc
7207 eval $setvar
7208
7209 : see if nm is to be used to determine whether a symbol is defined or not
7210 case "$usenm" in
7211 '')
7212         dflt=''
7213         case "$d_gnulibc" in
7214         "$define")
7215                 echo " "
7216                 echo "nm probably won't work on the GNU C Library." >&4
7217                 dflt=n
7218                 ;;
7219         esac
7220         case "$dflt" in
7221         '') 
7222                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7223                         echo " "
7224                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7225                         echo "'nm' won't be sufficient on this sytem." >&4
7226                         dflt=n
7227                 fi
7228                 ;;
7229         esac
7230         case "$dflt" in
7231         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7232                 if $test $dflt -gt 20; then
7233                         dflt=y
7234                 else
7235                         dflt=n
7236                 fi
7237                 ;;
7238         esac
7239         ;;
7240 *)
7241         case "$usenm" in
7242         true|$define) dflt=y;;
7243         *) dflt=n;;
7244         esac
7245         ;;
7246 esac
7247 $cat <<EOM
7248
7249 I can use $nm to extract the symbols from your C libraries. This
7250 is a time consuming task which may generate huge output on the disk (up
7251 to 3 megabytes) but that should make the symbols extraction faster. The
7252 alternative is to skip the 'nm' extraction part and to compile a small
7253 test program instead to determine whether each symbol is present. If
7254 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7255 this may be the best solution.
7256
7257 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7258
7259 EOM
7260 rp="Shall I use $nm to extract C symbols from the libraries?"
7261 . ./myread
7262 case "$ans" in
7263 [Nn]*) usenm=false;;
7264 *) usenm=true;;
7265 esac
7266
7267 runnm=$usenm
7268 case "$reuseval" in
7269 true) runnm=false;;
7270 esac
7271
7272 : nm options which may be necessary
7273 case "$nm_opt" in
7274 '') if $test -f /mach_boot; then
7275                 nm_opt=''       # Mach
7276         elif $test -d /usr/ccs/lib; then
7277                 nm_opt='-p'     # Solaris (and SunOS?)
7278         elif $test -f /dgux; then
7279                 nm_opt='-p'     # DG-UX
7280         elif $test -f /lib64/rld; then
7281                 nm_opt='-p'     # 64-bit Irix
7282         else
7283                 nm_opt=''
7284         fi;;
7285 esac
7286
7287 : nm options which may be necessary for shared libraries but illegal
7288 : for archive libraries.  Thank you, Linux.
7289 case "$nm_so_opt" in
7290 '')     case "$myuname" in
7291         *linux*|gnu*)
7292                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7293                         nm_so_opt='--dynamic'
7294                 fi
7295                 ;;
7296         esac
7297         ;;
7298 esac
7299
7300 case "$runnm" in
7301 true)
7302 : get list of predefined functions in a handy place
7303 echo " "
7304 case "$libc" in
7305 '') libc=unknown
7306         case "$libs" in
7307         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7308         esac
7309         ;;
7310 esac
7311 case "$libs" in
7312 '') ;;
7313 *)  for thislib in $libs; do
7314         case "$thislib" in
7315         -lc|-lc_s)
7316                 : Handle C library specially below.
7317                 ;;
7318         -l*)
7319                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7320                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7321                         :
7322                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7323                         :
7324                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7325                         :
7326                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7327                         :
7328                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7329                         :
7330                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7331                         :
7332                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7333                         :
7334                 else
7335                         try=''
7336                 fi
7337                 libnames="$libnames $try"
7338                 ;;
7339         *) libnames="$libnames $thislib" ;;
7340         esac
7341         done
7342         ;;
7343 esac
7344 xxx=normal
7345 case "$libc" in
7346 unknown)
7347         set /lib/libc.$so
7348         for xxx in $libpth; do
7349                 $test -r $1 || set $xxx/libc.$so
7350                 : The messy sed command sorts on library version numbers.
7351                 $test -r $1 || \
7352                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7353                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7354                                 h
7355                                 s/[0-9][0-9]*/0000&/g
7356                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7357                                 G
7358                                 s/\n/ /' | \
7359                          $sort | $sed -e 's/^.* //'`
7360                 eval set \$$#
7361         done
7362         $test -r $1 || set /usr/ccs/lib/libc.$so
7363         $test -r $1 || set /lib/libsys_s$_a
7364         ;;
7365 *)
7366         set blurfl
7367         ;;
7368 esac
7369 if $test -r "$1"; then
7370         echo "Your (shared) C library seems to be in $1."
7371         libc="$1"
7372 elif $test -r /lib/libc && $test -r /lib/clib; then
7373         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7374         xxx=apollo
7375         libc='/lib/clib /lib/libc'
7376         if $test -r /lib/syslib; then
7377                 echo "(Your math library is in /lib/syslib.)"
7378                 libc="$libc /lib/syslib"
7379         fi
7380 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7381         echo "Your C library seems to be in $libc, as you said before."
7382 elif $test -r $incpath/usr/lib/libc$_a; then
7383         libc=$incpath/usr/lib/libc$_a;
7384         echo "Your C library seems to be in $libc.  That's fine."
7385 elif $test -r /lib/libc$_a; then
7386         libc=/lib/libc$_a;
7387         echo "Your C library seems to be in $libc.  You're normal."
7388 else
7389         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7390                 :
7391         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7392                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7393         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7394                 :
7395         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7396                 :
7397         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7398                 :
7399         else
7400                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7401         fi
7402         if $test -r "$tans"; then
7403                 echo "Your C library seems to be in $tans, of all places."
7404                 libc=$tans
7405         else
7406                 libc='blurfl'
7407         fi
7408 fi
7409 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7410         dflt="$libc"
7411         cat <<EOM
7412
7413 If the guess above is wrong (which it might be if you're using a strange
7414 compiler, or your machine supports multiple models), you can override it here.
7415
7416 EOM
7417 else
7418         dflt=''
7419         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7420         cat >&4 <<EOM
7421 I can't seem to find your C library.  I've looked in the following places:
7422
7423 EOM
7424         $sed 's/^/      /' libpath
7425         cat <<EOM
7426
7427 None of these seems to contain your C library. I need to get its name...
7428
7429 EOM
7430 fi
7431 fn=f
7432 rp='Where is your C library?'
7433 . ./getfile
7434 libc="$ans"
7435
7436 echo " "
7437 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7438 set X `cat libnames`
7439 shift
7440 xxx=files
7441 case $# in 1) xxx=file; esac
7442 echo "Extracting names from the following $xxx for later perusal:" >&4
7443 echo " "
7444 $sed 's/^/      /' libnames >&4
7445 echo " "
7446 $echo $n "This may take a while...$c" >&4
7447
7448 for file in $*; do
7449         case $file in
7450         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7451         *) $nm $nm_opt $file 2>/dev/null;;
7452         esac
7453 done >libc.tmp
7454
7455 $echo $n ".$c"
7456 $grep fprintf libc.tmp > libc.ptf
7457 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7458 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7459 xxx='[ADTSIW]'
7460 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7461         eval $xscan;\
7462         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7463                 eval $xrun
7464 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7465         eval $xscan;\
7466         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7467                 eval $xrun
7468 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7469         eval $xscan;\
7470         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7471                 eval $xrun
7472 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7473         eval $xscan;\
7474         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7475                 eval $xrun
7476 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7477         eval $xscan;\
7478         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7479                 eval $xrun
7480 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7481         eval $xscan;\
7482         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7483                 eval $xrun
7484 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7485                                 -e '/ file/d' -e '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/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7490         eval $xscan;\
7491         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7492                 eval $xrun
7493 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7494         eval $xscan;\
7495         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7496                 eval $xrun
7497 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7498         eval $xscan;\
7499         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7500                 eval $xrun
7501 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7502         eval $xscan;\
7503         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7504                 eval $xrun
7505 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7506         eval $xscan;\
7507         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7508                 eval $xrun
7509 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7510         eval $xscan;\
7511         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7512                 eval $xrun
7513 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7514         eval $xscan;\
7515         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7516                 eval $xrun
7517 else
7518         $nm -p $* 2>/dev/null >libc.tmp
7519         $grep fprintf libc.tmp > libc.ptf
7520         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7521                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7522         then
7523                 nm_opt='-p'
7524                 eval $xrun
7525         else
7526                 echo " "
7527                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7528                 com=''
7529                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7530                         for thisname in $libnames $libc; do
7531                                 $ar t $thisname >>libc.tmp
7532                         done
7533                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7534                         echo "Ok." >&4
7535                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7536                         # Repeat libc to extract forwarders to DLL entries too
7537                         for thisname in $libnames $libc; do
7538                                 $ar tv $thisname >>libc.tmp
7539                                 # Revision 50 of EMX has bug in $ar.
7540                                 # it will not extract forwarders to DLL entries
7541                                 # Use emximp which will extract exactly them.
7542                                 emximp -o tmp.imp $thisname \
7543                                     2>/dev/null && \
7544                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7545                                     < tmp.imp >>libc.tmp
7546                                 $rm tmp.imp
7547                         done
7548                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7549                         echo "Ok." >&4
7550                 else
7551                         echo "$ar didn't seem to work right." >&4
7552                         echo "Maybe this is a Cray...trying bld instead..." >&4
7553                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7554                         then
7555                                 for thisname in $libnames; do
7556                                         bld t $libnames | \
7557                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7558                                         $ar t $thisname >>libc.tmp
7559                                 done
7560                                 echo "Ok." >&4
7561                         else
7562                                 echo "That didn't work either.  Giving up." >&4
7563                                 exit 1
7564                         fi
7565                 fi
7566         fi
7567 fi
7568 nm_extract="$com"
7569 case "$PASE" in
7570 define)
7571     echo " "
7572     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7573     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7574     ;;
7575 *)  if $test -f /lib/syscalls.exp; then
7576         echo " "
7577         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7578         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7579     fi
7580     ;;
7581 esac
7582 ;;
7583 esac
7584 $rm -f libnames libpath
7585
7586 : see if dld is available
7587 set dld.h i_dld
7588 eval $inhdr
7589
7590
7591 echo " "
7592 echo "Checking for C++..." >&4
7593 $cat >try.c <<'EOCP'
7594 #include <stdio.h>
7595 int main(void)
7596 {
7597 #ifdef __cplusplus
7598     return 0;
7599 #else
7600     return 1;
7601 #endif
7602 }
7603 EOCP
7604 set try
7605 if eval $compile_ok && $run ./try; then
7606         val="$define"
7607         echo "You are using a C++ compiler."
7608 else
7609         val="$undef"
7610         echo "You are not using a C++ compiler."
7611 fi
7612 $rm_try cplusplus$$
7613 set d_cplusplus
7614 eval $setvar
7615
7616 : is a C symbol defined?
7617 csym='tlook=$1;
7618 case "$3" in
7619 -v) tf=libc.tmp; tdc="";;
7620 -a) tf=libc.tmp; tdc="[]";;
7621 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7622 esac;
7623 tx=yes;
7624 case "$reuseval-$4" in
7625 true-) ;;
7626 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7627 esac;
7628 case "$tx" in
7629 yes)
7630         tval=false;
7631         case "$d_cplusplus" in
7632                 $define) extern_C=\"C\";;
7633         esac;
7634         if $test "$runnm" = true; then
7635                 if $contains $tlook $tf >/dev/null 2>&1; then
7636                         tval=true;
7637                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7638                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7639                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7640                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7641                         $rm_try;
7642                 fi;
7643         else
7644                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7645                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7646                 $rm_try;
7647         fi;
7648         ;;
7649 *)
7650         case "$tval" in
7651         $define) tval=true;;
7652         *) tval=false;;
7653         esac;
7654         ;;
7655 esac;
7656 eval "$2=$tval"'
7657
7658 : define an is-in-libc? function
7659 inlibc='echo " "; td=$define; tu=$undef;
7660 sym=$1; var=$2; eval "was=\$$2";
7661 tx=yes;
7662 case "$reuseval$was" in
7663 true) ;;
7664 true*) tx=no;;
7665 esac;
7666 case "$tx" in
7667 yes)
7668         set $sym tres -f;
7669         eval $csym;
7670         case "$tres" in
7671         true)
7672                 echo "$sym() found." >&4;
7673                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7674         *)
7675                 echo "$sym() NOT found." >&4;
7676                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7677         esac;;
7678 *)
7679         case "$was" in
7680         $define) echo "$sym() found." >&4;;
7681         *) echo "$sym() NOT found." >&4;;
7682         esac;;
7683 esac'
7684
7685 : see if dlopen exists
7686 xxx_runnm="$runnm"
7687 xxx_ccflags="$ccflags"
7688 runnm=false
7689 : with g++ one needs -shared to get is-in-libc to work for dlopen
7690 case "$gccversion" in
7691 '')     ;;
7692 *)      case "$d_cplusplus" in
7693         "$define") ccflags="$ccflags -shared" ;;
7694         esac
7695         ;;
7696 esac
7697 set dlopen d_dlopen
7698 eval $inlibc
7699 runnm="$xxx_runnm"
7700 ccflags="$xxx_ccflags"
7701
7702 : see if this is a unistd.h system
7703 set unistd.h i_unistd
7704 eval $inhdr
7705
7706 : determine which dynamic loading, if any, to compile in
7707 echo " "
7708 dldir="ext/DynaLoader"
7709 case "$usedl" in
7710 $define|y|true)
7711         dflt='y'
7712         usedl="$define"
7713         ;;
7714 $undef|n|false)
7715         dflt='n'
7716         usedl="$undef"
7717         ;;
7718 *)
7719         dflt='n'
7720         case "$d_dlopen" in
7721             $define) dflt='y' ;;
7722         esac
7723         case "$i_dld" in
7724             $define) dflt='y' ;;
7725         esac
7726         : Does a dl_xxx.xs file exist for this operating system
7727         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7728         ;;
7729 esac
7730 rp="Do you wish to use dynamic loading?"
7731 . ./myread
7732 usedl="$ans"
7733 case "$ans" in
7734 y*) usedl="$define"
7735         case "$dlsrc" in
7736         '')
7737                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7738                         dflt="$dldir/dl_${osname}.xs"
7739                 elif $test "$d_dlopen" = "$define" ; then
7740                         dflt="$dldir/dl_dlopen.xs"
7741                 elif $test "$i_dld" = "$define" ; then
7742                         dflt="$dldir/dl_dld.xs"
7743                 else
7744                         dflt=''
7745                 fi
7746                 ;;
7747         *)      dflt="$dldir/$dlsrc"
7748                 ;;
7749         esac
7750     echo "The following dynamic loading files are available:"
7751         : Can not go over to $dldir because getfile has path hard-coded in.
7752         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7753         rp="Source file to use for dynamic loading"
7754         fn="fne"
7755         gfpth="$src"
7756         . ./getfile
7757         usedl="$define"
7758         : emulate basename
7759         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7760
7761         $cat << EOM
7762
7763 Some systems may require passing special flags to $cc -c to
7764 compile modules that will be used to create a shared library.
7765 To use no flags, say "none".
7766
7767 EOM
7768     case "$cccdlflags" in
7769     '') case "$gccversion" in
7770                 '') case "$osname" in
7771                         hpux)   dflt='+z' ;;
7772                         next)   dflt='none' ;;
7773                         irix*)  dflt='-KPIC' ;;
7774                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7775                         sunos)  dflt='-pic' ;;
7776                         *)      dflt='none' ;;
7777                     esac
7778                         ;;
7779                 *)  case "$osname" in
7780                         darwin) dflt='none' ;;
7781                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7782                         *)      dflt='-fpic' ;;
7783                     esac ;;
7784             esac ;;
7785         ' ') dflt='none' ;;
7786     *)  dflt="$cccdlflags" ;;
7787     esac
7788     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7789     . ./myread
7790     case "$ans" in
7791     none) cccdlflags=' ' ;;
7792     *) cccdlflags="$ans" ;;
7793     esac
7794
7795     cat << EOM
7796
7797 Some systems use ld to create libraries that can be dynamically loaded,
7798 while other systems (such as those using ELF) use $cc.
7799
7800 EOM
7801         case "$ld" in
7802         '')     $cat >try.c <<EOM
7803 /* Test for whether ELF binaries are produced */
7804 #include <fcntl.h>
7805 #$i_stdlib I_STDLIB
7806 #ifdef I_STDLIB
7807 #include <stdlib.h>
7808 #endif
7809 #$i_unistd I_UNISTD
7810 #ifdef I_UNISTD
7811 #include <unistd.h>
7812 #endif
7813 int main() {
7814         char b[4];
7815         int i = open("a.out",O_RDONLY);
7816         if(i == -1)
7817                 exit(1); /* fail */
7818         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7819                 exit(0); /* succeed (yes, it's ELF) */
7820         else
7821                 exit(1); /* fail */
7822 }
7823 EOM
7824                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7825                         cat <<EOM
7826 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7827 EOM
7828                         dflt="$cc"
7829                 else
7830                         echo "I'll use ld to build dynamic libraries."
7831                         dflt='ld'
7832                 fi
7833                 $rm_try
7834                 ;;
7835         *)      dflt="$ld"
7836                 ;;
7837         esac
7838
7839     rp="What command should be used to create dynamic libraries?"
7840     . ./myread
7841         ld="$ans"
7842
7843     cat << EOM
7844
7845 Some systems may require passing special flags to $ld to create a
7846 library that can be dynamically loaded.  If your ld flags include
7847 -L/other/path options to locate libraries outside your loader's normal
7848 search path, you may need to specify those -L options here as well.  To
7849 use no flags, say "none".
7850
7851 EOM
7852     case "$lddlflags" in
7853     '') case "$osname" in
7854                         beos) dflt='-nostart' ;;
7855                         hpux) dflt='-b';
7856                               case "$gccversion" in
7857                               '') dflt="$dflt +vnocompatwarnings" ;;
7858                               esac
7859                               ;;
7860                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7861                         next)  dflt='none' ;;
7862                         solaris) dflt='-G' ;;
7863                         sunos) dflt='-assert nodefinitions' ;;
7864                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7865                 *)     dflt='none' ;;
7866                         esac
7867                         ;;
7868     *) dflt="$lddlflags" ;;
7869     esac
7870
7871         : Try to guess additional flags to pick up local libraries.
7872         : Be careful not to append to a plain 'none'
7873         case "$dflt" in
7874         none) dflt='' ;;
7875         esac
7876         for thisflag in $ldflags; do
7877                 case "$thisflag" in
7878                 -L*|-R*|-Wl,-R*)
7879                         case " $dflt " in
7880                         *" $thisflag "*) ;;
7881                         *) dflt="$dflt $thisflag" ;;
7882                         esac
7883                         ;;
7884                 esac
7885         done
7886
7887         case "$dflt" in
7888         ''|' ') dflt='none' ;;
7889         esac
7890
7891     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7892     . ./myread
7893     case "$ans" in
7894     none) lddlflags=' ' ;;
7895     *) lddlflags="$ans" ;;
7896     esac
7897
7898         cat <<EOM
7899
7900 Some systems may require passing special flags to $cc to indicate that
7901 the resulting executable will use dynamic linking.  To use no flags,
7902 say "none".
7903
7904 EOM
7905     case "$ccdlflags" in
7906     '') case "$osname" in
7907             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7908             next|sunos) dflt='none' ;;
7909             *)          dflt='none' ;;
7910             esac ;;
7911     ' ')  dflt='none' ;;
7912     *)  dflt="$ccdlflags" ;;
7913     esac
7914     rp="Any special flags to pass to $cc to use dynamic linking?"
7915     . ./myread
7916     case "$ans" in
7917     none) ccdlflags=' ' ;;
7918     *) ccdlflags="$ans" ;;
7919     esac
7920     ;;
7921 *)  usedl="$undef"
7922         ld='ld'
7923     dlsrc='dl_none.xs'
7924     lddlflags=''
7925     ccdlflags=''
7926     ;;
7927 esac
7928
7929 also=''
7930 case "$usedl" in
7931 $undef)
7932         # No dynamic loading being used, so don't bother even to prompt.
7933         useshrplib='false'
7934         ;;
7935 *)      case "$useshrplib" in
7936         '')     case "$osname" in
7937                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7938                         dflt=y
7939                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7940                         ;;
7941                 next*)
7942                         case "$osvers" in
7943                         4*)     dflt=y
7944                                 also='Building a shared libperl is needed for MAB support.'
7945                                 ;;
7946                         *)      dflt=n
7947                                 ;;
7948                         esac
7949                         ;;
7950                 *)      dflt=n
7951                         ;;
7952                 esac
7953                 ;;
7954         $define|true|[Yy]*)
7955                 dflt=y
7956                 ;;
7957         *)      dflt=n
7958                 ;;
7959         esac
7960         $cat << EOM
7961
7962 The perl executable is normally obtained by linking perlmain.c with
7963 libperl${_a}, any static extensions (usually just DynaLoader), and
7964 any other libraries needed on this system (such as -lm, etc.).  Since
7965 your system supports dynamic loading, it is probably possible to build
7966 a shared libperl.$so.  If you will have more than one executable linked
7967 to libperl.$so, this will significantly reduce the size of each
7968 executable, but it may have a noticeable effect on performance.  The
7969 default is probably sensible for your system.
7970 $also
7971
7972 EOM
7973         rp="Build a shared libperl.$so (y/n)"
7974         . ./myread
7975         case "$ans" in
7976         true|$define|[Yy]*)
7977                 useshrplib='true'  ;;
7978         *)      useshrplib='false' ;;
7979         esac
7980         ;;
7981 esac
7982
7983 case "$useshrplib" in
7984 true)
7985         case "$libperl" in
7986         '')
7987                 # Figure out a good name for libperl.so.  Since it gets stored in
7988                 # a version-specific architecture-dependent library, the version
7989                 # number isn't really that important, except for making cc/ld happy.
7990                 #
7991                 # A name such as libperl.so.3.1
7992                 majmin="libperl.$so.$patchlevel.$subversion"
7993                 # A name such as libperl.so.301
7994                 majonly=`echo $patchlevel $subversion |
7995                         $awk '{printf "%d%02d", $1, $2}'`
7996                 majonly=libperl.$so.$majonly
7997                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7998                 # rely on figuring it out from the naming of libc.
7999                 case "${osname}${osvers}" in
8000                 next4*)
8001                         dflt=libperl.5.$so
8002                         # XXX How handle the --version stuff for MAB?
8003                         ;;
8004                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8005                         dflt=libperl.$so
8006                         ;;
8007                 cygwin*) # ld links against an importlib
8008                         dflt=libperl$lib_ext
8009                         ;;
8010                 *)      # Try to guess based on whether libc has major.minor.
8011                         case "$libc" in
8012                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8013                         *libc.$so.[0-9]*) dflt=$majonly ;;
8014                         *)      dflt=libperl.$so ;;
8015                         esac
8016                         ;;
8017                 esac
8018                 ;;
8019         *)      dflt=$libperl
8020                 ;;
8021         esac
8022         cat << EOM
8023
8024 I need to select a good name for the shared libperl.  If your system uses
8025 library names with major and minor numbers, then you might want something
8026 like $majmin.  Alternatively, if your system uses a single version
8027 number for shared libraries, then you might want to use $majonly.
8028 Or, your system might be quite happy with a simple libperl.$so.
8029
8030 Since the shared libperl will get installed into a version-specific
8031 architecture-dependent directory, the version number of the shared perl
8032 library probably isn't important, so the default should be o.k.
8033
8034 EOM
8035         rp='What name do you want to give to the shared libperl?'
8036         . ./myread
8037         libperl=$ans
8038         echo "Ok, I'll use $libperl"
8039         ;;
8040 *)
8041         libperl="libperl${_a}"
8042         ;;
8043 esac
8044
8045 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8046 case "$shrpdir" in
8047 '') ;;
8048 *)      $cat >&4 <<EOM
8049 WARNING:  Use of the shrpdir variable for the installation location of
8050 the shared $libperl is not supported.  It was never documented and
8051 will not work in this version.  Let me (perlbug@perl.org)
8052 know of any problems this may cause.
8053
8054 EOM
8055         case "$shrpdir" in
8056         "$archlibexp/CORE")
8057                 $cat >&4 <<EOM
8058 But your current setting of $shrpdir is
8059 the default anyway, so it's harmless.
8060 EOM
8061                 ;;
8062         *)
8063                 $cat >&4 <<EOM
8064 Further, your current attempted setting of $shrpdir
8065 conflicts with the value of $archlibexp/CORE
8066 that installperl will use.
8067 EOM
8068                 ;;
8069         esac
8070         ;;
8071 esac
8072
8073 # How will the perl executable find the installed shared $libperl?
8074 # Add $xxx to ccdlflags.
8075 # If we can't figure out a command-line option, use $shrpenv to
8076 # set env LD_RUN_PATH.  The main perl makefile uses this.
8077 shrpdir=$archlibexp/CORE
8078 xxx=''
8079 tmp_shrpenv=''
8080 if "$useshrplib"; then
8081     case "$osname" in 
8082         aix)
8083                 # We'll set it in Makefile.SH...
8084                 ;;
8085         solaris)
8086                 xxx="-R $shrpdir"
8087                 ;;
8088         freebsd|netbsd|openbsd|interix|dragonfly)
8089                 xxx="-Wl,-R$shrpdir"
8090                 ;;
8091         bsdos|linux|irix*|dec_osf|gnu*)
8092                 xxx="-Wl,-rpath,$shrpdir"
8093                 ;;
8094         next)
8095                 # next doesn't like the default...
8096                 ;;
8097         beos)
8098                 # beos doesn't like the default, either.
8099                 ;;
8100         hpux*)
8101                 # hpux doesn't like the default, either.
8102                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8103                 ;;
8104         *)
8105                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8106                 ;;
8107         esac
8108         case "$xxx" in
8109         '') ;;
8110         *)      
8111                 # Only add $xxx if it isn't already in ccdlflags.
8112                 case " $ccdlflags " in
8113                 *" $xxx "*)     ;;
8114                 *)      ccdlflags="$ccdlflags $xxx"
8115                         cat <<EOM >&4
8116
8117 Adding $xxx to the flags
8118 passed to $ld so that the perl executable will find the 
8119 installed shared $libperl.
8120
8121 EOM
8122                         ;;
8123                 esac
8124                 ;;
8125         esac
8126 fi
8127 # Fix ccdlflags in AIX for building external extensions.
8128 # (For building Perl itself bare -bE:perl.exp is needed,
8129 #  Makefile.SH takes care of this.)
8130 case "$osname" in
8131 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8132 esac
8133 # Respect a hint or command-line value.
8134 case "$shrpenv" in
8135 '') shrpenv="$tmp_shrpenv" ;;
8136 esac
8137 case "$ldlibpthname" in
8138 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8139 none)   ldlibpthname='' ;;
8140 esac
8141
8142 : determine where manual pages are on this system
8143 echo " "
8144 case "$sysman" in
8145 '') 
8146         syspath='/usr/share/man/man1 /usr/man/man1'
8147         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8148         syspath="$syspath /usr/man/u_man/man1"
8149         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8150         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8151         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8152         sysman=`./loc . /usr/man/man1 $syspath`
8153         ;;
8154 esac
8155 if $test -d "$sysman"; then
8156         echo "System manual is in $sysman." >&4
8157 else
8158         echo "Could not find manual pages in source form." >&4
8159 fi
8160
8161 : determine where manual pages go
8162 set man1dir man1dir none
8163 eval $prefixit
8164 $cat <<EOM
8165
8166 $spackage has manual pages available in source form.
8167 EOM
8168 case "$nroff" in
8169 nroff)
8170         echo "However, you don't have nroff, so they're probably useless to you."
8171         case "$man1dir" in
8172         '') man1dir="none";;
8173         esac;;
8174 esac
8175 echo "If you don't want the manual sources installed, answer 'none'."
8176 case "$man1dir" in
8177 ' ') dflt=none
8178         ;;
8179 '')
8180         lookpath="$prefixexp/share/man/man1"
8181         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8182         lookpath="$lookpath $prefixexp/man/p_man/man1"
8183         lookpath="$lookpath $prefixexp/man/u_man/man1"
8184         lookpath="$lookpath $prefixexp/man/man.1"
8185         case "$sysman" in
8186         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8187         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8188         esac
8189         set dflt
8190         eval $prefixup
8191         ;;
8192 *)  dflt="$man1dir"
8193         ;;
8194 esac
8195 echo " "
8196 fn=dn+~
8197 rp="Where do the main $spackage manual pages (source) go?"
8198 . ./getfile
8199 if $test "X$man1direxp" != "X$ansexp"; then
8200         installman1dir=''
8201 fi
8202 prefixvar=man1dir
8203 . ./setprefixvar
8204
8205 case "$man1dir" in
8206 '')     man1dir=' '
8207         installman1dir='';;
8208 esac
8209
8210 : What suffix to use on installed man pages
8211
8212 case "$man1dir" in
8213 ' ')
8214         man1ext='0'
8215         ;;
8216 *)
8217         rp="What suffix should be used for the main $spackage man pages?"
8218         case "$man1ext" in
8219         '')     case "$man1dir" in
8220                 *1)  dflt=1 ;;
8221                 *1p) dflt=1p ;;
8222                 *1pm) dflt=1pm ;;
8223                 *l) dflt=l;;
8224                 *n) dflt=n;;
8225                 *o) dflt=o;;
8226                 *p) dflt=p;;
8227                 *C) dflt=C;;
8228                 *L) dflt=L;;
8229                 *L1) dflt=L1;;
8230                 *) dflt=1;;
8231                 esac
8232                 ;;
8233         *)      dflt="$man1ext";;
8234         esac
8235         . ./myread
8236         man1ext="$ans"
8237         ;;
8238 esac
8239
8240 : see if we can have long filenames
8241 echo " "
8242 first=123456789abcdef
8243 $rm -f $first
8244 if (echo hi >$first) 2>/dev/null; then
8245         if $test -f 123456789abcde; then
8246                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8247                 val="$undef"
8248         else
8249                 echo 'You can have filenames longer than 14 characters.'>&4
8250                 val="$define"
8251         fi
8252 else
8253         $cat <<'EOM'
8254 You can't have filenames longer than 14 chars.
8255 You can't even think about them!
8256 EOM
8257         val="$undef"
8258 fi 
8259 set d_flexfnam
8260 eval $setvar
8261 $rm -rf 123456789abcde*
8262
8263 : determine where library module manual pages go
8264 set man3dir man3dir none
8265 eval $prefixit
8266 $cat <<EOM
8267
8268 $spackage has manual pages for many of the library modules.
8269 EOM
8270
8271 case "$nroff" in
8272 nroff)
8273         $cat <<'EOM'
8274 However, you don't have nroff, so they're probably useless to you.
8275 EOM
8276         case "$man3dir" in
8277         '') man3dir="none";;
8278         esac;;
8279 esac
8280
8281 case "$d_flexfnam" in
8282 undef)
8283         $cat <<'EOM'
8284 However, your system can't handle the long file names like File::Basename.3.
8285 EOM
8286         case "$man3dir" in
8287         '') man3dir="none";;
8288         esac;;
8289 esac
8290
8291 echo "If you don't want the manual sources installed, answer 'none'."
8292 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8293 case "$man3dir" in
8294 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8295         if $test -d "$privlib/man/man3"; then
8296                 cat <<EOM >&4
8297
8298 WARNING:  Previous versions of perl installed man3 pages into
8299 $privlib/man/man3.  This version will suggest a
8300 new default of $dflt.
8301 EOM
8302                 tdflt=$dflt
8303                 dflt='n'
8304                 rp='Do you wish to preserve the old behavior?(y/n)'
8305                 . ./myread
8306                 case "$ans" in
8307                 y*) dflt="$privlib/man/man3" ;;
8308                 *)  dflt=$tdflt ;;
8309                 esac
8310     fi
8311         ;;
8312 *)      dflt="$man3dir" ;;
8313 esac
8314 case "$dflt" in
8315 ' ') dflt=none ;;
8316 esac
8317 echo " "
8318 fn=dn+~
8319 rp="Where do the $package library man pages (source) go?"
8320 . ./getfile
8321 prefixvar=man3dir
8322 . ./setprefixvar
8323
8324 case "$man3dir" in
8325 '')     man3dir=' '
8326         installman3dir='';;
8327 esac
8328
8329 : What suffix to use on installed man pages
8330 case "$man3dir" in
8331 ' ')
8332         man3ext='0'
8333         ;;
8334 *)
8335         rp="What suffix should be used for the $package library man pages?"
8336         case "$man3ext" in
8337         '')     case "$man3dir" in
8338                 *3)  dflt=3 ;;
8339                 *3p) dflt=3p ;;
8340                 *3pm) dflt=3pm ;;
8341                 *l) dflt=l;;
8342                 *n) dflt=n;;
8343                 *o) dflt=o;;
8344                 *p) dflt=p;;
8345                 *C) dflt=C;;
8346                 *L) dflt=L;;
8347                 *L3) dflt=L3;;
8348                 *) dflt=3;;
8349                 esac
8350                 ;;
8351         *)      dflt="$man3ext";;
8352         esac
8353         . ./myread
8354         man3ext="$ans"
8355         ;;
8356 esac
8357
8358 : see if we have to deal with yellow pages, now NIS.
8359 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8360         if $test -f /usr/etc/nibindd; then
8361                 echo " "
8362                 echo "I'm fairly confident you're on a NeXT."
8363                 echo " "
8364                 rp='Do you get the hosts file via NetInfo?'
8365                 dflt=y
8366                 case "$hostcat" in
8367                 nidump*) ;;
8368                 '') ;;
8369                 *) dflt=n;;
8370                 esac
8371                 . ./myread
8372                 case "$ans" in
8373                 y*) hostcat='nidump hosts .';;
8374                 *)      case "$hostcat" in
8375                         nidump*) hostcat='';;
8376                         esac
8377                         ;;
8378                 esac
8379         fi
8380         case "$hostcat" in
8381         nidump*) ;;
8382         *)
8383                 case "$hostcat" in
8384                 *ypcat*) dflt=y;;
8385                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8386                                 dflt=y
8387                         else
8388                                 dflt=n
8389                         fi;;
8390                 *) dflt=n;;
8391                 esac
8392                 echo " "
8393                 rp='Are you getting the hosts file via yellow pages?'
8394                 . ./myread
8395                 case "$ans" in
8396                 y*) hostcat='ypcat hosts';;
8397                 *) hostcat='cat /etc/hosts';;
8398                 esac
8399                 ;;
8400         esac
8401 fi
8402 case "$hostcat" in
8403 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8404 esac
8405 case "$groupcat" in
8406 '') test -f /etc/group && groupcat='cat /etc/group';;
8407 esac
8408 case "$passcat" in
8409 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8410 esac
8411
8412 : now get the host name
8413 echo " "
8414 echo "Figuring out host name..." >&4
8415 case "$myhostname" in
8416 '') cont=true
8417         echo 'Maybe "hostname" will work...'
8418         if tans=`sh -c hostname 2>&1` ; then
8419                 myhostname=$tans
8420                 phostname=hostname
8421                 cont=''
8422         fi
8423         ;;
8424 *) cont='';;
8425 esac
8426 if $test "$cont"; then
8427         if ./xenix; then
8428                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8429                 if tans=`cat /etc/systemid 2>&1` ; then
8430                         myhostname=$tans
8431                         phostname='cat /etc/systemid'
8432                         echo "Whadyaknow.  Xenix always was a bit strange..."
8433                         cont=''
8434                 fi
8435         elif $test -r /etc/systemid; then
8436                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8437         fi
8438 fi
8439 if $test "$cont"; then
8440         echo 'No, maybe "uuname -l" will work...'
8441         if tans=`sh -c 'uuname -l' 2>&1` ; then
8442                 myhostname=$tans
8443                 phostname='uuname -l'
8444         else
8445                 echo 'Strange.  Maybe "uname -n" will work...'
8446                 if tans=`sh -c 'uname -n' 2>&1` ; then
8447                         myhostname=$tans
8448                         phostname='uname -n'
8449                 else
8450                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8451                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8452                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8453                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8454                         else
8455                                 case "$myhostname" in
8456                                 '') echo "Does this machine have an identity crisis or something?"
8457                                         phostname='';;
8458                                 *)
8459                                         echo "Well, you said $myhostname before..."
8460                                         phostname='echo $myhostname';;
8461                                 esac
8462                         fi
8463                 fi
8464         fi
8465 fi
8466 case "$myhostname" in
8467 '') myhostname=noname ;;
8468 esac
8469 : you do not want to know about this
8470 set $myhostname
8471 myhostname=$1
8472
8473 : verify guess
8474 if $test "$myhostname" ; then
8475         dflt=y
8476         rp='Your host name appears to be "'$myhostname'".'" Right?"
8477         . ./myread
8478         case "$ans" in
8479         y*) ;;
8480         *) myhostname='';;
8481         esac
8482 fi
8483
8484 : bad guess or no guess
8485 while $test "X$myhostname" = X ; do
8486         dflt=''
8487         rp="Please type the (one word) name of your host:"
8488         . ./myread
8489         myhostname="$ans"
8490 done
8491
8492 : translate upper to lower if necessary
8493 case "$myhostname" in
8494 *[A-Z]*)
8495         echo "(Normalizing case in your host name)"
8496         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8497         ;;
8498 esac
8499
8500 case "$myhostname" in
8501 *.*)
8502         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8503         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8504         echo "(Trimming domain name from host name--host name is now $myhostname)"
8505         ;;
8506 *) case "$mydomain" in
8507         '')
8508                 {
8509                         test "X$hostcat" = "Xypcat hosts" &&
8510                         ypmatch "$myhostname" hosts 2>/dev/null |\
8511                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8512                         $test -s hosts
8513                 } || {
8514                         test "X$hostcat" != "X" &&
8515                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8516                                         /[       ]$myhostname[  . ]/p" > hosts
8517                 }
8518                 tmp_re="[       . ]"
8519                 if $test -f hosts; then
8520                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8521                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8522                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8523                                 hosts | $sort | $uniq | \
8524                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8525                         case `$echo X$dflt` in
8526                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8527                                 dflt=.
8528                                 ;;
8529                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8530                                 ;;
8531                         esac
8532                 else
8533                         echo "(I cannot locate a hosts database anywhere)"
8534                         dflt=.
8535                 fi
8536                 case "$dflt" in
8537                 .)
8538                         tans=`./loc resolv.conf X /etc /usr/etc`
8539                         if $test -f "$tans"; then
8540                                 echo "(Attempting domain name extraction from $tans)"
8541                                 dflt=.`$sed -n -e 's/   / /g' \
8542                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8543                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8544                                 case "$dflt" in
8545                                 .) dflt=.`$sed -n -e 's/        / /g' \
8546                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8547                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8548                                         ;;
8549                                 esac
8550                         fi
8551                         ;;
8552                 esac
8553                 case "$dflt" in
8554                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8555                         dflt=.`sh -c domainname 2>/dev/null`
8556                         case "$dflt" in
8557                         '') dflt='.';;
8558                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8559                         esac
8560                         ;;
8561                 esac
8562                 case "$dflt$osname" in
8563                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8564                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8565                         ;;
8566                 esac
8567                 case "$dflt" in
8568                 .) echo "(Lost all hope -- silly guess then)"
8569                         dflt='.nonet'
8570                         ;;
8571                 esac
8572                 $rm -f hosts
8573                 ;;
8574         *) dflt="$mydomain";;
8575         esac;;
8576 esac
8577 echo " "
8578 rp="What is your domain name?"
8579 . ./myread
8580 tans="$ans"
8581 case "$ans" in
8582 '') ;;
8583 .*) ;;
8584 *) tans=".$tans";;
8585 esac
8586 mydomain="$tans"
8587
8588 : translate upper to lower if necessary
8589 case "$mydomain" in
8590 *[A-Z]*)
8591         echo "(Normalizing case in your domain name)"
8592         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8593         ;;
8594 esac
8595
8596 : a little sanity check here
8597 case "$phostname" in
8598 '') ;;
8599 *)
8600         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8601         $myhostname$mydomain|$myhostname) ;;
8602         *)
8603                 case "$phostname" in
8604                 sed*)
8605                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8606                         ;;
8607                 *)
8608                         echo "(That doesn't agree with your $phostname command, by the way.)"
8609                         ;;
8610                 esac
8611         ;;
8612         esac
8613         ;;
8614 esac
8615
8616 $cat <<EOM
8617
8618 I need to get your e-mail address in Internet format if possible, i.e.
8619 something like user@host.domain. Please answer accurately since I have
8620 no easy means to double check it. The default value provided below
8621 is most probably close to reality but may not be valid from outside
8622 your organization...
8623
8624 EOM
8625 cont=x
8626 while test "$cont"; do
8627         case "$cf_email" in
8628         '') dflt="$cf_by@$myhostname$mydomain";;
8629         *) dflt="$cf_email";;
8630         esac
8631         rp='What is your e-mail address?'
8632         . ./myread
8633         cf_email="$ans"
8634         case "$cf_email" in
8635         *@*.*) cont='' ;;
8636         *)
8637                 rp='Address does not look like an Internet one.  Use it anyway?'
8638                 case "$fastread" in
8639                 yes) dflt=y ;;
8640                 *) dflt=n ;;
8641                 esac
8642                 . ./myread
8643                 case "$ans" in
8644                 y*) cont='' ;;
8645                 *) echo " " ;;
8646                 esac
8647                 ;;
8648         esac
8649 done
8650
8651 $cat <<EOM
8652
8653 If you or somebody else will be maintaining perl at your site, please
8654 fill in the correct e-mail address here so that they may be contacted
8655 if necessary. Currently, the "perlbug" program included with perl
8656 will send mail to this address in addition to perlbug@perl.org. You may
8657 enter "none" for no administrator.
8658
8659 EOM
8660 case "$perladmin" in
8661 '') dflt="$cf_email";;
8662 *) dflt="$perladmin";;
8663 esac
8664 rp='Perl administrator e-mail address'
8665 . ./myread
8666 perladmin="$ans"
8667
8668 : determine whether to only install version-specific parts.
8669 echo " "
8670 $cat <<EOM
8671 Do you want to install only the version-specific parts of the perl
8672 distribution?  Usually you do *not* want to do this.
8673 EOM
8674 case "$versiononly" in
8675 "$define"|[Yy]*|true) dflt='y' ;;
8676 *) dflt='n';
8677 esac
8678 rp="Do you want to install only the version-specific parts of perl?"
8679 . ./myread
8680 case "$ans" in
8681 [yY]*)  val="$define";;
8682 *)      val="$undef" ;;
8683 esac
8684 set versiononly
8685 eval $setvar
8686
8687 case "$versiononly" in
8688 "$define") inc_version_list=''
8689            inc_version_list_init=0
8690            ;;
8691 esac
8692
8693 : figure out how to guarantee perl startup
8694 : XXX Note that this currently takes advantage of the bug that binexp ignores
8695 :     the Configure -Dinstallprefix setting, which in turn means that under
8696 :     relocatable @INC, initialinstalllocation is what binexp started as.
8697 case "$startperl" in
8698 '')
8699         case "$sharpbang" in
8700         *!)
8701                 $cat <<EOH
8702
8703 I can use the #! construct to start perl on your system. This will
8704 make startup of perl scripts faster, but may cause problems if you
8705 want to share those scripts and perl is not in a standard place
8706 ($initialinstalllocation/perl) on all your platforms. The alternative
8707 is to force a shell by starting the script with a single ':' character.
8708
8709 EOH
8710                 case "$versiononly" in
8711                 "$define")      dflt="$initialinstalllocation/perl$version";;
8712                 *)              dflt="$initialinstalllocation/perl";;
8713                 esac
8714                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8715                 . ./myread
8716                 case "$ans" in
8717                 none)   startperl=": # use perl";;
8718                 *)      startperl="#!$ans"
8719                         if $test 30 -lt `echo "$ans" | wc -c`; then
8720                                 $cat >&4 <<EOM
8721
8722 WARNING:  Some systems limit the #! command to 32 characters.
8723 If you experience difficulty running Perl scripts with #!, try
8724 installing Perl in a directory with a shorter pathname.
8725
8726 EOM
8727                         fi ;;
8728                 esac
8729                 ;;
8730         *) startperl=": # use perl"
8731                 ;;
8732         esac
8733         ;;
8734 esac
8735 echo "I'll use $startperl to start perl scripts."
8736
8737 : figure best path for perl in scripts
8738 case "$perlpath" in
8739 '')
8740         case "$versiononly" in
8741         "$define")      perlpath="$initialinstalllocation/perl$version";;
8742         *)              perlpath="$initialinstalllocation/perl";;
8743         esac
8744         case "$startperl" in
8745         *!*) ;;
8746         *)
8747                 $cat <<EOH
8748
8749 I will use the "eval 'exec'" idiom to start Perl on your system.
8750 I can use the full path of your Perl binary for this purpose, but
8751 doing so may cause problems if you want to share those scripts and
8752 Perl is not always in a standard place ($initialinstalllocation/perl).
8753
8754 EOH
8755                 dflt="$initialinstalllocation/perl"
8756                 rp="What path shall I use in \"eval 'exec'\"?"
8757                 . ./myread
8758                 perlpath="$ans"
8759                 ;;
8760         esac
8761         ;;
8762 esac
8763 case "$startperl" in
8764 *!*)    ;;
8765 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8766 esac
8767
8768 : determine where public executable scripts go
8769 set scriptdir scriptdir
8770 eval $prefixit
8771 case "$scriptdir" in
8772 '')
8773         dflt="$bin"
8774         : guess some guesses
8775         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8776         $test -d /usr/share/bin     && dflt=/usr/share/bin
8777         $test -d /usr/local/script  && dflt=/usr/local/script
8778         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8779         $test -d $prefixexp/script  && dflt=$prefixexp/script
8780         set dflt
8781         eval $prefixup
8782         ;;
8783 *)  dflt="$scriptdir"
8784         ;;
8785 esac
8786 $cat <<EOM
8787
8788 Some installations have a separate directory just for executable scripts so
8789 that they can mount it across multiple architectures but keep the scripts in
8790 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8791 Or you might just lump your scripts in with all your other executables.
8792
8793 EOM
8794 fn=d~
8795 rp='Where do you keep publicly executable scripts?'
8796 . ./getfile
8797 if $test "X$ansexp" != "X$scriptdirexp"; then
8798         installscript=''
8799 fi
8800 installscriptdir=''
8801 prefixvar=scriptdir
8802 . ./setprefixvar
8803 : A little fix up for an irregularly named variable.
8804 installscript="$installscriptdir"
8805
8806 : determine where add-on public executables go
8807 case "$sitebin" in
8808 '')     dflt=$siteprefix/bin ;;
8809 *)      dflt=$sitebin ;;
8810 esac
8811 fn=d~
8812 rp='Pathname where the add-on public executables should be installed?'
8813 . ./getfile
8814 prefixvar=sitebin
8815 . ./setprefixvar
8816
8817 : determine where add-on html pages go
8818 : There is no standard location, so try to copy the previously-selected
8819 : directory structure for the core html pages.
8820 case "$sitehtml1dir" in
8821 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8822 *)     dflt=$sitehtml1dir ;;
8823 esac
8824 case "$dflt" in
8825 ''|' ') dflt=none ;;
8826 esac
8827 fn=dn+~
8828 rp='Pathname where the site-specific html pages should be installed?'
8829 . ./getfile
8830 prefixvar=sitehtml1dir
8831 . ./setprefixvar
8832
8833 : determine where add-on library html pages go
8834 : There is no standard location, so try to copy the previously-selected
8835 : directory structure for the core html pages.
8836 case "$sitehtml3dir" in
8837 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8838 *)     dflt=$sitehtml3dir ;;
8839 esac
8840 case "$dflt" in
8841 ''|' ') dflt=none ;;
8842 esac
8843 fn=dn+~
8844 rp='Pathname where the site-specific library html pages should be installed?'
8845 . ./getfile
8846 prefixvar=sitehtml3dir
8847 . ./setprefixvar
8848
8849 : determine where add-on manual pages go
8850 case "$siteman1dir" in
8851 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8852 *)      dflt=$siteman1dir ;;
8853 esac
8854 case "$dflt" in
8855 ''|' ') dflt=none ;;
8856 esac
8857 fn=dn+~
8858 rp='Pathname where the site-specific manual pages should be installed?'
8859 . ./getfile
8860 prefixvar=siteman1dir
8861 . ./setprefixvar
8862
8863 : determine where add-on library man pages go
8864 case "$siteman3dir" in
8865 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8866 *)      dflt=$siteman3dir ;;
8867 esac
8868 case "$dflt" in
8869 ''|' ') dflt=none ;;
8870 esac
8871 fn=dn+~
8872 rp='Pathname where the site-specific library manual pages should be installed?'
8873 . ./getfile
8874 prefixvar=siteman3dir
8875 . ./setprefixvar
8876
8877 : determine where add-on public executable scripts go
8878 case "$sitescript" in
8879 '')     dflt=$siteprefix/script
8880         $test -d $dflt || dflt=$sitebin ;;
8881 *)  dflt="$sitescript" ;;
8882 esac
8883 fn=d~+
8884 rp='Pathname where add-on public executable scripts should be installed?'
8885 . ./getfile
8886 prefixvar=sitescript
8887 . ./setprefixvar
8888
8889 case "$usefaststdio" in
8890 $define|true|[yY]*|'')
8891         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8892         case "$xversion" in
8893         [68])   dflt='y' ;;
8894         *)      dflt='n' ;;
8895         esac
8896         ;;
8897 *) dflt='n';;
8898 esac
8899 cat <<EOM
8900
8901 Perl can be built to use 'fast stdio', which means using the stdio
8902 library but also directly manipulating the stdio buffers to enable
8903 faster I/O.  Using stdio is better for backward compatibility (especially
8904 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8905 interface has been preferred instead of stdio.
8906
8907 If this doesn't make any sense to you, just accept the default '$dflt'.
8908 EOM
8909 rp='Use the "fast stdio" if available?'
8910 . ./myread
8911 case "$ans" in
8912 y|Y)    val="$define" ;;     
8913 *)      val="$undef" ;;
8914 esac
8915 set usefaststdio
8916 eval $setvar
8917
8918
8919 : define an is-a-typedef? function
8920 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8921 case "$inclist" in
8922 "") inclist="sys/types.h";;
8923 esac;
8924 eval "varval=\$$var";
8925 case "$varval" in
8926 "")
8927         $rm -f temp.c;
8928         for inc in $inclist; do
8929                 echo "#include <$inc>" >>temp.c;
8930         done;
8931         echo "#ifdef $type" >> temp.c;
8932         echo "printf(\"We have $type\");" >> temp.c;
8933         echo "#endif" >> temp.c;
8934         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8935         if $contains $type temp.E >/dev/null 2>&1; then
8936                 eval "$var=\$type";
8937         else
8938                 eval "$var=\$def";
8939         fi;
8940         $rm -f temp.?;;
8941 *) eval "$var=\$varval";;
8942 esac'
8943
8944 : define an is-a-typedef? function that prompts if the type is not available.
8945 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8946 case "$inclist" in
8947 "") inclist="sys/types.h";;
8948 esac;
8949 eval "varval=\$$var";
8950 case "$varval" in
8951 "")
8952         $rm -f temp.c;
8953         for inc in $inclist; do
8954                 echo "#include <$inc>" >>temp.c;
8955         done;
8956         echo "#ifdef $type" >> temp.c;
8957         echo "printf(\"We have $type\");" >> temp.c;
8958         echo "#endif" >> temp.c;
8959         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8960         echo " " ;
8961         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8962         if $contains $type temp.E >/dev/null 2>&1; then
8963                 echo "$type found." >&4;
8964                 eval "$var=\$type";
8965         else
8966                 echo "$type NOT found." >&4;
8967                 dflt="$def";
8968                 . ./myread ;
8969                 eval "$var=\$ans";
8970         fi;
8971         $rm -f temp.?;;
8972 *) eval "$var=\$varval";;
8973 esac'
8974
8975 : see what type lseek is declared as in the kernel
8976 rp="What is the type used for lseek's offset on this system?"
8977 set off_t lseektype long stdio.h sys/types.h
8978 eval $typedef_ask
8979
8980 echo " "
8981 echo "Checking to see how big your file offsets are..." >&4
8982 $cat >try.c <<EOCP
8983 #include <sys/types.h>
8984 #include <stdio.h>
8985 int main()
8986 {
8987     printf("%d\n", (int)sizeof($lseektype));
8988     return(0);
8989 }
8990 EOCP
8991 set try
8992 if eval $compile_ok; then
8993         lseeksize=`$run ./try`
8994         echo "Your file offsets are $lseeksize bytes long."
8995 else
8996         dflt=$longsize
8997         echo " "
8998         echo "(I can't seem to compile the test program.  Guessing...)"
8999         rp="What is the size of your file offsets (in bytes)?"
9000         . ./myread
9001         lseeksize="$ans"
9002 fi
9003 $rm_try
9004
9005 : see what type file positions are declared as in the library
9006 rp="What is the type for file position used by fsetpos()?"
9007 set fpos_t fpostype long stdio.h sys/types.h
9008 eval $typedef_ask
9009
9010 echo " "
9011 case "$fpostype" in
9012 *_t) zzz="$fpostype"    ;;
9013 *)   zzz="fpos_t"       ;;
9014 esac
9015 echo "Checking the size of $zzz..." >&4 
9016 cat > try.c <<EOCP
9017 #include <sys/types.h>
9018 #include <stdio.h>
9019 #$i_stdlib I_STDLIB
9020 #ifdef I_STDLIB
9021 #include <stdlib.h>
9022 #endif
9023 int main() {
9024     printf("%d\n", (int)sizeof($fpostype));
9025     exit(0);
9026 }
9027 EOCP
9028 set try
9029 if eval $compile_ok; then
9030         yyy=`$run ./try`
9031         case "$yyy" in
9032         '')     fpossize=4
9033                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9034                 ;;
9035         *)      fpossize=$yyy
9036                 echo "Your $zzz is $fpossize bytes long."
9037                 ;;
9038         esac
9039 else
9040         dflt="$longsize"
9041         echo " " >&4
9042         echo "(I can't compile the test program.  Guessing...)" >&4
9043         rp="What is the size of your file positions (in bytes)?"
9044         . ./myread
9045         fpossize="$ans"
9046 fi
9047
9048 # Backward compatibility (uselfs is deprecated).
9049 case "$uselfs" in
9050 "$define"|true|[yY]*)
9051         cat <<EOM >&4
9052
9053 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9054 EOM
9055         uselargefiles="$define"
9056         ;;
9057 esac
9058
9059 case "$lseeksize:$fpossize" in
9060 8:8) cat <<EOM
9061
9062 You can have files larger than 2 gigabytes.
9063 EOM
9064    val="$define" ;;
9065 *)    case "$uselargefiles" in
9066    "$undef"|false|[nN]*) dflt='n' ;;
9067    *)   dflt='y' ;;
9068    esac
9069    cat <<EOM
9070
9071 Perl can be built to understand large files (files larger than 2 gigabytes)
9072 on some systems.  To do so, Configure can be run with -Duselargefiles.
9073
9074 If this doesn't make any sense to you, just accept the default '$dflt'.
9075 EOM
9076    rp='Try to understand large files, if available?'
9077    . ./myread
9078    case "$ans" in
9079    y|Y)         val="$define" ;;
9080    *)           val="$undef"  ;;
9081    esac
9082    ;;
9083 esac
9084 set uselargefiles
9085 eval $setvar
9086 : Look for a hint-file generated 'call-back-unit'.  If the
9087 : user has specified that a large files perl is to be built,
9088 : we may need to set or change some other defaults.
9089 if $test -f uselargefiles.cbu; then
9090         echo "Your platform has some specific hints regarding large file builds, using them..."
9091         . ./uselargefiles.cbu
9092 fi
9093 case "$uselargefiles" in
9094 "$define")
9095         if $test -f uselargefiles.cbu; then
9096                 echo " "
9097                 echo "Rechecking to see how big your file offsets are..." >&4
9098                 $cat >try.c <<EOCP
9099 #include <sys/types.h>
9100 #include <stdio.h>
9101 int main()
9102 {
9103     printf("%d\n", (int)sizeof($lseektype));
9104     return(0);
9105 }
9106 EOCP
9107                 set try
9108                 if eval $compile_ok; then
9109                         lseeksize=`$run ./try`
9110                         $echo "Your file offsets are now $lseeksize bytes long."
9111                 else
9112                         dflt="$lseeksize"
9113                         echo " "
9114                         echo "(I can't seem to compile the test program.  Guessing...)"
9115                         rp="What is the size of your file offsets (in bytes)?"
9116                         . ./myread
9117                         lseeksize="$ans"
9118                 fi
9119                 case "$fpostype" in
9120                 *_t) zzz="$fpostype"    ;;
9121                 *)   zzz="fpos_t"       ;;
9122                 esac
9123                 $echo $n "Rechecking the size of $zzz...$c" >&4
9124                 $cat > try.c <<EOCP
9125 #include <sys/types.h>
9126 #include <stdio.h>
9127 #$i_stdlib I_STDLIB
9128 #ifdef I_STDLIB
9129 #include <stdlib.h>
9130 #endif
9131 int main() {
9132     printf("%d\n", (int)sizeof($fpostype));
9133     return(0);
9134 }
9135 EOCP
9136                 set try
9137                 if eval $compile_ok; then
9138                         yyy=`$run ./try`
9139                         dflt="$lseeksize"
9140                         case "$yyy" in
9141                         '')     echo " "
9142                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9143                                 ;;
9144                         *)      fpossize=$yyy
9145                                 echo " $fpossize bytes." >&4
9146                                 ;;
9147                         esac
9148                 else
9149                         dflt="$fpossize"
9150                         echo " "
9151                         echo "(I can't compile the test program.  Guessing...)" >&4
9152                         rp="What is the size of your file positions (in bytes)?"
9153                         . ./myread
9154                         fpossize="$ans"
9155                 fi
9156                 $rm_try
9157         fi
9158         ;;
9159 esac
9160
9161 case "$vendorprefix" in
9162 '')     d_vendorbin="$undef"
9163         vendorbin=''
9164         vendorbinexp=''
9165         ;;
9166 *)      d_vendorbin="$define"
9167         : determine where vendor-supplied executables go.
9168         case "$vendorbin" in
9169         '') dflt=$vendorprefix/bin ;;
9170         *)      dflt="$vendorbin" ;;
9171         esac
9172         fn=d~+
9173         rp='Pathname for the vendor-supplied executables directory?'
9174         . ./getfile
9175         vendorbin="$ans"
9176         vendorbinexp="$ansexp"
9177         ;;
9178 esac
9179 prefixvar=vendorbin
9180 . ./installprefix
9181
9182 case "$vendorprefix" in
9183 '')     vendorhtml1dir=''
9184         vendorhtml1direxp=''
9185         ;;
9186 *)      : determine where vendor-supplied html pages go.
9187         : There is no standard location, so try to copy the previously-selected
9188         : directory structure for the core html pages.
9189         : XXX Better default suggestions would be welcome.
9190         case "$vendorhtml1dir" in
9191         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9192         *)      dflt=$vendorhtml1dir ;;
9193         esac
9194         case "$dflt" in
9195         ''|' ') dflt=none ;;
9196         esac
9197         fn=dn+~
9198         rp='Pathname for the vendor-supplied html pages?'
9199         . ./getfile
9200         vendorhtml1dir="$ans"
9201         vendorhtml1direxp="$ansexp"
9202         ;;
9203 esac
9204 : Use ' ' for none so value is preserved next time through Configure
9205 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9206 prefixvar=vendorhtml1dir
9207 . ./installprefix
9208
9209 case "$vendorprefix" in
9210 '')     vendorhtml3dir=''
9211         vendorhtml3direxp=''
9212         ;;
9213 *)      : determine where vendor-supplied module html pages go.
9214         : There is no standard location, so try to copy the previously-selected
9215         : directory structure for the core html pages.
9216         : XXX Better default suggestions would be welcome.
9217         case "$vendorhtml3dir" in
9218         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9219         *)      dflt=$vendorhtml3dir ;;
9220         esac
9221         case "$dflt" in
9222         ''|' ') dflt=none ;;
9223         esac
9224         fn=dn+~
9225         rp='Pathname for the vendor-supplied html pages?'
9226         . ./getfile
9227         vendorhtml3dir="$ans"
9228         vendorhtml3direxp="$ansexp"
9229         ;;
9230 esac
9231 : Use ' ' for none so value is preserved next time through Configure
9232 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9233 prefixvar=vendorhtml3dir
9234 . ./installprefix
9235
9236 case "$vendorprefix" in
9237 '')     vendorman1dir=''
9238         vendorman1direxp=''
9239         ;;
9240 *)      : determine where vendor-supplied manual pages go.
9241         case "$vendorman1dir" in
9242         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9243         *)      dflt=$vendorman1dir ;;
9244         esac
9245         case "$dflt" in
9246         ''|' ') dflt=none ;;
9247         esac
9248         fn=nd~+
9249         rp='Pathname for the vendor-supplied manual section 1 pages?'
9250         . ./getfile
9251         vendorman1dir="$ans"
9252         vendorman1direxp="$ansexp"
9253         ;;
9254 esac
9255 : Use ' ' for none so value is preserved next time through Configure
9256 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9257 prefixvar=vendorman1dir
9258 . ./installprefix
9259
9260 case "$vendorprefix" in
9261 '')     vendorman3dir=''
9262         vendorman3direxp=''
9263         ;;
9264 *)      : determine where vendor-supplied module manual pages go.
9265         case "$vendorman3dir" in
9266         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9267         *)      dflt=$vendorman3dir ;;
9268         esac
9269         case "$dflt" in
9270         ''|' ') dflt=none ;;
9271         esac
9272         fn=nd~+
9273         rp='Pathname for the vendor-supplied manual section 3 pages?'
9274         . ./getfile
9275         vendorman3dir="$ans"
9276         vendorman3direxp="$ansexp"
9277         ;;
9278 esac
9279 : Use ' ' for none so value is preserved next time through Configure
9280 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9281 prefixvar=vendorman3dir
9282 . ./installprefix
9283
9284 case "$vendorprefix" in
9285 '')     d_vendorscript="$undef"
9286         vendorscript=''
9287         vendorscriptexp=''
9288         ;;
9289 *)      d_vendorscript="$define"
9290         : determine where vendor-supplied scripts go.
9291         case "$vendorscript" in
9292         '')     dflt=$vendorprefix/script
9293                 $test -d $dflt || dflt=$vendorbin ;;
9294         *)  dflt="$vendorscript" ;;
9295         esac
9296         $cat <<EOM
9297
9298 The installation process will create a directory for
9299 vendor-supplied scripts.
9300
9301 EOM
9302         fn=d~+
9303         rp='Pathname for the vendor-supplied scripts directory?'
9304         . ./getfile
9305         vendorscript="$ans"
9306         vendorscriptexp="$ansexp"
9307         ;;
9308 esac
9309 prefixvar=vendorscript
9310 . ./installprefix
9311
9312 : see if qgcvt exists
9313 set qgcvt d_qgcvt
9314 eval $inlibc
9315
9316 echo " "
9317
9318 if $test X"$d_longdbl" = X"$define"; then
9319
9320 echo "Checking how to print long doubles..." >&4
9321
9322 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9323         $cat >try.c <<'EOCP'
9324 #include <sys/types.h>
9325 #include <stdio.h>
9326 int main() {
9327   double d = 123.456;
9328   printf("%.3f\n", d);
9329 }
9330 EOCP
9331         set try
9332         if eval $compile; then
9333                 yyy=`$run ./try`
9334                 case "$yyy" in
9335                 123.456)
9336                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9337                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9338                         echo "We will use %f."
9339                         ;;
9340                 esac
9341         fi
9342 fi
9343
9344 if $test X"$sPRIfldbl" = X; then
9345         $cat >try.c <<'EOCP'
9346 #include <sys/types.h>
9347 #include <stdio.h>
9348 int main() {
9349   long double d = 123.456;
9350   printf("%.3Lf\n", d);
9351 }
9352 EOCP
9353         set try
9354         if eval $compile; then
9355                 yyy=`$run ./try`
9356                 case "$yyy" in
9357                 123.456)
9358                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9359                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9360                         echo "We will use %Lf."
9361                         ;;
9362                 esac
9363         fi
9364 fi
9365
9366 if $test X"$sPRIfldbl" = X; then
9367         $cat >try.c <<'EOCP'
9368 #include <sys/types.h>
9369 #include <stdio.h>
9370 int main() {
9371   long double d = 123.456;
9372   printf("%.3llf\n", d);
9373 }
9374 EOCP
9375         set try
9376         if eval $compile; then
9377                 yyy=`$run ./try`
9378                 case "$yyy" in
9379                 123.456)
9380                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9381                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9382                         echo "We will use %llf."
9383                         ;;
9384                 esac
9385         fi
9386 fi
9387
9388 if $test X"$sPRIfldbl" = X; then
9389         $cat >try.c <<'EOCP'
9390 #include <sys/types.h>
9391 #include <stdio.h>
9392 int main() {
9393   long double d = 123.456;
9394   printf("%.3lf\n", d);
9395 }
9396 EOCP
9397         set try
9398         if eval $compile; then
9399                 yyy=`$run ./try`
9400                 case "$yyy" in
9401                 123.456)
9402                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9403                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9404                         echo "We will use %lf."
9405                         ;;
9406                 esac
9407         fi
9408 fi
9409
9410 if $test X"$sPRIfldbl" = X; then
9411         echo "Cannot figure out how to print long doubles." >&4
9412 else
9413         sSCNfldbl=$sPRIfldbl    # expect consistency
9414 fi
9415
9416 $rm_try
9417
9418 fi # d_longdbl
9419
9420 case "$sPRIfldbl" in
9421 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9422         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9423         d_SCNfldbl="$undef";
9424         ;;
9425 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9426         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9427         d_SCNfldbl="$define";
9428         ;;
9429 esac
9430
9431 : Check how to convert floats to strings.
9432
9433 if test "X$d_Gconvert" = X; then
9434
9435 echo " "
9436 echo "Checking for an efficient way to convert floats to strings."
9437 echo " " > try.c
9438 case "$uselongdouble" in
9439 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9440 esac
9441 case "$d_longdbl" in
9442 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9443 esac
9444 case "$d_PRIgldbl" in
9445 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9446 esac
9447 $cat >>try.c <<EOP
9448 #ifdef TRY_gconvert
9449 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9450 char *myname = "gconvert";
9451 #endif
9452 #ifdef TRY_gcvt
9453 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9454 char *myname = "gcvt";
9455 #endif
9456 #ifdef TRY_qgcvt
9457 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9458 char *myname = "qgcvt";
9459 #define DOUBLETYPE long double
9460 #endif
9461 #ifdef TRY_sprintf
9462 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9463 #ifdef HAS_PRIgldbl
9464 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9465 #else
9466 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9467 #endif
9468 #else
9469 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9470 #endif
9471 char *myname = "sprintf";
9472 #endif
9473
9474 #ifndef DOUBLETYPE
9475 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9476 #define DOUBLETYPE long double
9477 #else
9478 #define DOUBLETYPE double
9479 #endif
9480 #endif
9481
9482 #include <stdio.h>
9483
9484 #define I_STDLIB $i_stdlib
9485 #ifdef I_STDLIB
9486 #include <stdlib.h>
9487 #endif
9488
9489 int
9490 checkit(expect, got)
9491 char *expect;
9492 char *got;
9493 {
9494     if (strcmp(expect, got)) {
9495                 printf("%s oddity:  Expected %s, got %s\n",
9496                         myname, expect, got);
9497                 exit(1);
9498         }
9499 }
9500
9501 int main()
9502 {
9503         char buf[64];
9504         buf[63] = '\0';
9505
9506         /* This must be 1st test on (which?) platform */
9507         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9508         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9509         checkit("0.1", buf);
9510
9511         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9512         checkit("0.01", buf);
9513
9514         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9515         checkit("0.001", buf);
9516
9517         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9518         checkit("0.0001", buf);
9519
9520         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9521         if (strlen(buf) > 5)
9522             checkit("9e-005", buf); /* for Microsoft ?? */
9523         else
9524             checkit("9e-05", buf);
9525
9526         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9527         checkit("1", buf);
9528
9529         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9530         checkit("1.1", buf);
9531
9532         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9533         checkit("1.01", buf);
9534
9535         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9536         checkit("1.001", buf);
9537
9538         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9539         checkit("1.0001", buf);
9540
9541         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9542         checkit("1.00001", buf);
9543
9544         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9545         checkit("1.000001", buf);
9546
9547         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9548         checkit("0", buf);
9549
9550         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9551         checkit("-1", buf);
9552
9553         /* Some Linux gcvt's give 1.e+5 here. */
9554         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9555         checkit("100000", buf);
9556
9557         /* Some Linux gcvt's give -1.e+5 here. */
9558         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9559         checkit("-100000", buf);
9560
9561         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9562         checkit("123.456", buf);
9563
9564         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9565         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9566         /* 34 should be enough to scare even long double
9567          * places into using the e notation. */
9568         if (strlen(buf) > 5)
9569             checkit("1e+034", buf); /* for Microsoft */
9570         else
9571             checkit("1e+34", buf);
9572
9573         /* For Perl, if you add additional tests here, also add them to
9574          * t/base/num.t for benefit of platforms not using Configure or
9575          * overriding d_Gconvert */
9576
9577         exit(0);
9578 }
9579 EOP
9580 : first add preferred functions to our list
9581 xxx_list=""
9582 for xxx_convert in $gconvert_preference; do
9583     case $xxx_convert in
9584     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9585     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9586     esac
9587 done
9588 : then add any others
9589 for xxx_convert in gconvert gcvt sprintf; do
9590     case "$xxx_list" in
9591     *$xxx_convert*) ;;
9592     *) xxx_list="$xxx_list $xxx_convert" ;;
9593     esac
9594 done
9595
9596 case "$d_longdbl$uselongdouble" in
9597 "$define$define")
9598     : again, add prefered functions to our list first
9599     xxx_ld_list=""
9600     for xxx_convert in $gconvert_ld_preference; do
9601         case $xxx_convert in
9602         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9603         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9604         esac
9605     done
9606     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9607     for xxx_convert in qgcvt sprintf $xxx_list; do
9608         case "$xxx_ld_list" in
9609         $xxx_convert*|*" $xxx_convert"*) ;;
9610         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9611         esac
9612     done
9613     : if sprintf cannot do long doubles, move it to the end
9614     if test "$d_PRIgldbl" != "$define"; then
9615         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9616     fi
9617     : if no qgcvt, remove it
9618     if test "$d_qgcvt" != "$define"; then
9619         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9620     fi
9621     : use the ld_list
9622     xxx_list="$xxx_ld_list"
9623     ;;
9624 esac
9625
9626 for xxx_convert in $xxx_list; do
9627         echo "Trying $xxx_convert..."
9628         $rm -f try try$_o core
9629         set try -DTRY_$xxx_convert
9630         if eval $compile; then
9631                 echo "$xxx_convert() found." >&4
9632                 if $run ./try; then
9633                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9634                         break;
9635                 else
9636                         echo "...But $xxx_convert didn't work as I expected."
9637                         xxx_convert=''
9638                 fi
9639         else
9640                 echo "$xxx_convert NOT found." >&4
9641         fi
9642 done
9643
9644 if test X$xxx_convert = X; then
9645     echo "*** WHOA THERE!!! ***" >&4
9646     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9647     xxx_convert=sprintf
9648 fi
9649
9650 case "$xxx_convert" in
9651 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9652 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9653 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9654 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9655    "$define$define$define")
9656       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9657    "$define$define$undef")
9658       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9659    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9660    esac
9661    ;;
9662 esac
9663
9664 fi
9665 $rm_try
9666
9667 : see if _fwalk exists
9668 set fwalk d__fwalk
9669 eval $inlibc
9670
9671 : Initialize h_fcntl
9672 h_fcntl=false
9673
9674 : Initialize h_sysfile
9675 h_sysfile=false
9676
9677 : access call always available on UNIX
9678 set access d_access
9679 eval $inlibc
9680
9681 : locate the flags for 'access()'
9682 case "$d_access" in
9683 "$define")
9684         echo " "
9685         $cat >access.c <<EOCP
9686 #include <sys/types.h>
9687 #ifdef I_FCNTL
9688 #include <fcntl.h>
9689 #endif
9690 #ifdef I_SYS_FILE
9691 #include <sys/file.h>
9692 #endif
9693 #ifdef I_UNISTD
9694 #include <unistd.h>
9695 #endif
9696 #$i_stdlib I_STDLIB
9697 #ifdef I_STDLIB
9698 #include <stdlib.h>
9699 #endif
9700 int main() {
9701         exit(R_OK);
9702 }
9703 EOCP
9704         : check sys/file.h first, no particular reason here
9705         if $test `./findhdr sys/file.h` && \
9706                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9707                 h_sysfile=true;
9708                 echo "<sys/file.h> defines the *_OK access constants." >&4
9709         elif $test `./findhdr fcntl.h` && \
9710                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9711                 h_fcntl=true;
9712                 echo "<fcntl.h> defines the *_OK access constants." >&4
9713         elif $test `./findhdr unistd.h` && \
9714                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9715                 echo "<unistd.h> defines the *_OK access constants." >&4
9716         else
9717                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9718         fi
9719         ;;
9720 esac
9721 $rm -f access*
9722
9723 : see if accessx exists
9724 set accessx d_accessx
9725 eval $inlibc
9726
9727 : see if aintl exists
9728 set aintl d_aintl
9729 eval $inlibc
9730
9731 : see if alarm exists
9732 set alarm d_alarm
9733 eval $inlibc
9734
9735 : see if POSIX threads are available
9736 set pthread.h i_pthread
9737 eval $inhdr
9738
9739 : define a fucntion to check prototypes
9740 $cat > protochk <<EOSH
9741 $startsh
9742 cc="$cc"
9743 optimize="$optimize"
9744 ccflags="$ccflags"
9745 prototype="$prototype"
9746 define="$define"
9747 rm_try="$rm_try"
9748 usethreads=$usethreads
9749 i_pthread=$i_pthread
9750 pthread_h_first=$pthread_h_first
9751 EOSH
9752
9753 $cat >> protochk <<'EOSH'
9754
9755 $rm_try
9756 foo="$1"
9757 shift
9758 while test $# -ge 2; do
9759         case "$1" in
9760                 $define) echo "#include <$2>" >> try.c ;;
9761                 literal) echo "$2" >> try.c ;;
9762         esac
9763     # Extra magic for the benefit of systems that need pthread.h
9764     # to be included early to correctly detect threadsafe functions.
9765     # Such functions must guarantee themselves, though, that the usethreads
9766     # and i_pthread have been defined, before calling protochk.
9767     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9768         echo "#include <pthread.h>" >> try.c
9769         pthread_h_done=yes
9770     fi
9771     shift 2
9772 done
9773 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9774 cat >> try.c <<'EOCP'
9775 #ifdef CAN_PROTOTYPE
9776 #define _(args) args
9777 #else
9778 #define _(args) ()
9779 #endif
9780 EOCP
9781 echo "$foo" >> try.c
9782 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9783 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9784 status=$?
9785 $rm_try
9786 exit $status
9787 EOSH
9788 chmod +x protochk
9789 $eunicefix protochk
9790
9791 hasproto='varname=$1; func=$2; shift; shift;
9792 while $test $# -ge 2; do
9793         case "$1" in
9794         $define) echo "#include <$2>";;
9795         esac ;
9796     shift 2;
9797 done > try.c;
9798 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9799 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9800         echo "$func() prototype found.";
9801         val="$define";
9802 else
9803         echo "$func() prototype NOT found.";
9804         val="$undef";
9805 fi;
9806 set $varname;
9807 eval $setvar;
9808 $rm_try tryout.c'
9809
9810 : see if sys/types.h has to be included
9811 set sys/types.h i_systypes
9812 eval $inhdr
9813
9814 : see if sys/select.h has to be included
9815 set sys/select.h i_sysselct
9816 eval $inhdr
9817
9818 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9819 while $test $# -ge 2; do
9820         case "$1" in
9821         $define) echo "#include <$2>";;
9822         esac ;
9823     shift 2;
9824 done > try.c;
9825 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9826 set try;
9827 if eval $compile; then
9828         val="$define";
9829 else
9830         val="$undef";
9831 fi;
9832 set $varname;
9833 eval $setvar;
9834 $rm_try'
9835
9836 : see if we should include time.h, sys/time.h, or both
9837 echo " "
9838 if test "X$timeincl" = X; then
9839         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9840         $echo $n "I'm now running the test program...$c"
9841         $cat >try.c <<EOCP
9842 #include <sys/types.h>
9843 #ifdef I_TIME
9844 #include <time.h>
9845 #endif
9846 #ifdef I_SYSTIME
9847 #ifdef SYSTIMEKERNEL
9848 #define KERNEL
9849 #endif
9850 #include <sys/time.h>
9851 #endif
9852 #ifdef I_SYSSELECT
9853 #include <sys/select.h>
9854 #endif
9855 #$i_stdlib I_STDLIB
9856 #ifdef I_STDLIB
9857 #include <stdlib.h>
9858 #endif
9859 int main()
9860 {
9861         struct tm foo;
9862 #ifdef S_TIMEVAL
9863         struct timeval bar;
9864 #endif
9865 #ifdef S_TIMEZONE
9866         struct timezone tzp;
9867 #endif
9868         if (foo.tm_sec == foo.tm_sec)
9869                 exit(0);
9870 #ifdef S_TIMEVAL
9871         if (bar.tv_sec == bar.tv_sec)
9872                 exit(0);
9873 #endif
9874         exit(1);
9875 }
9876 EOCP
9877         flags=''
9878         for s_timezone in '-DS_TIMEZONE' ''; do
9879         sysselect=''
9880         for s_timeval in '-DS_TIMEVAL' ''; do
9881         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9882         for i_time in '' '-DI_TIME'; do
9883         for i_systime in '-DI_SYSTIME' ''; do
9884                 case "$flags" in
9885                 '') $echo $n ".$c"
9886                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9887                         if eval $compile; then
9888                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9889                                 shift
9890                                 flags="$*"
9891                                 echo " "
9892                                 $echo $n "Succeeded with $flags$c"
9893                         fi
9894                         ;;
9895                 esac
9896         done
9897         done
9898         done
9899         done
9900         done
9901         timeincl=''
9902         echo " "
9903         case "$flags" in
9904         *SYSTIMEKERNEL*) i_systimek="$define"
9905                 timeincl=`./findhdr sys/time.h`
9906                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9907         *) i_systimek="$undef";;
9908         esac
9909         case "$flags" in
9910         *I_TIME*) i_time="$define"
9911                 timeincl=`./findhdr time.h`" $timeincl"
9912                 echo "We'll include <time.h>." >&4;;
9913         *) i_time="$undef";;
9914         esac
9915         case "$flags" in
9916         *I_SYSTIME*) i_systime="$define"
9917                 timeincl=`./findhdr sys/time.h`" $timeincl"
9918                 echo "We'll include <sys/time.h>." >&4;;
9919         *) i_systime="$undef";;
9920         esac
9921         $rm_try
9922 fi
9923 : see if struct tm knows about tm_zone
9924 case "$i_systime$i_time" in
9925 *$define*)
9926         echo " "
9927         echo "Checking to see if your struct tm has tm_zone field..." >&4
9928         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9929         eval $hasfield
9930         ;;
9931 *)      val="$undef"
9932         set d_tm_tm_zone
9933         eval $setvar
9934         ;;
9935 esac
9936 case "$d_tm_tm_zone" in
9937 "$define")      echo "Yes, it does."   ;;
9938 *)              echo "No, it doesn't." ;;
9939 esac
9940 : see if struct tm knows about tm_gmtoff
9941 case "$i_systime$i_time" in
9942 *$define*)
9943         echo " "
9944         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9945         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9946         eval $hasfield
9947         ;;
9948 *)      val="$undef"
9949         set d_tm_tm_gmtoff
9950         eval $setvar
9951         ;;
9952 esac
9953 case "$d_tm_tm_gmtoff" in
9954 "$define")      echo "Yes, it does."   ;;
9955 *)              echo "No, it doesn't." ;;
9956 esac
9957
9958 : see if asctime_r exists
9959 set asctime_r d_asctime_r
9960 eval $inlibc
9961 case "$d_asctime_r" in
9962 "$define")
9963         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9964         case "$d_asctime_r_proto:$usethreads" in
9965         ":define")      d_asctime_r_proto=define
9966                 set d_asctime_r_proto asctime_r $hdrs
9967                 eval $hasproto ;;
9968         *)      ;;
9969         esac
9970         case "$d_asctime_r_proto" in
9971         define)
9972         case "$asctime_r_proto" in
9973         ''|0) try='char* asctime_r(const struct tm*, char*);'
9974         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9975         esac
9976         case "$asctime_r_proto" in
9977         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9978         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9979         esac
9980         case "$asctime_r_proto" in
9981         ''|0) try='int asctime_r(const struct tm*, char*);'
9982         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9983         esac
9984         case "$asctime_r_proto" in
9985         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9986         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9987         esac
9988         case "$asctime_r_proto" in
9989         ''|0)   d_asctime_r=undef
9990                 asctime_r_proto=0
9991                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9992         * )     case "$asctime_r_proto" in
9993                 REENTRANT_PROTO*) ;;
9994                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9995                 esac
9996                 echo "Prototype: $try" ;;
9997         esac
9998         ;;
9999         *)      case "$usethreads" in
10000                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10001                 esac
10002                 d_asctime_r=undef
10003                 asctime_r_proto=0
10004                 ;;
10005         esac
10006         ;;
10007 *)      asctime_r_proto=0
10008         ;;
10009 esac
10010
10011 : see if atolf exists
10012 set atolf d_atolf
10013 eval $inlibc
10014
10015 : see if atoll exists
10016 set atoll d_atoll
10017 eval $inlibc
10018
10019 : Look for GCC-style attribute format
10020 case "$d_attribute_format" in
10021 '')
10022 echo " "
10023 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10024 $cat >attrib.c <<'EOCP'
10025 #include <stdio.h>
10026 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10027 EOCP
10028 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10029         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10030                 echo "Your C compiler doesn't support __attribute__((format))."
10031                 val="$undef"
10032         else
10033                 echo "Your C compiler supports __attribute__((format))."
10034                 val="$define"
10035         fi
10036 else
10037         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10038         val="$undef"
10039 fi
10040 ;;
10041 *) val="$d_attribute_format" ;;
10042 esac
10043 set d_attribute_format
10044 eval $setvar
10045 $rm -f attrib*
10046
10047 : Look for GCC-style attribute format with null format allowed
10048 case "$d_printf_format_null" in
10049 '') case "$d_attribute_format" in
10050     $define)
10051         echo " "
10052         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10053 $cat >attrib.c <<EOCP
10054 #include <stdio.h>
10055 #$i_stdlib I_STDLIB
10056 #ifdef I_STDLIB
10057 #include <stdlib.h>
10058 #endif
10059 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10060 int null_printf (char* pat,...) { return (int)pat; }
10061 int main () { exit(null_printf(NULL)); }
10062 EOCP
10063         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10064             : run the executable in case it produces a run-time warning
10065             if $run ./attrib >>attrib.out 2>&1; then
10066                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10067                     echo "Your C compiler doesn't allow __printf__ format to be null."
10068                     val="$undef"
10069                 else
10070                     echo "Your C compiler allows __printf__ format to be null."
10071                     val="$define"
10072                 fi
10073             else
10074             echo "Your C compiler executable failed with __printf__ format null."
10075             val="$undef"
10076         fi
10077     else
10078         echo "Your C compiler fails with __printf__ format null."
10079         val="$undef"
10080     fi
10081     ;;
10082     *)  val="$undef" ;;
10083     esac
10084 ;;
10085 *)  val="$d_printf_format_null" ;;
10086 esac
10087 set d_printf_format_null
10088 eval $setvar
10089 $rm -f attrib*
10090
10091 : Look for GCC-style attribute malloc
10092 case "$d_attribute_malloc" in
10093 '')
10094 echo " "
10095 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10096 $cat >attrib.c <<'EOCP'
10097 #include <stdio.h>
10098 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10099 EOCP
10100 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10101         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10102                 echo "Your C compiler doesn't support __attribute__((malloc))."
10103                 val="$undef"
10104         else
10105                 echo "Your C compiler supports __attribute__((malloc))."
10106                 val="$define"
10107         fi
10108 else
10109         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10110         val="$undef"
10111 fi
10112 ;;
10113 *) val="$d_attribute_malloc" ;;
10114 esac
10115 set d_attribute_malloc
10116 eval $setvar
10117 $rm -f attrib*
10118
10119 : Look for GCC-style attribute nonnull
10120 case "$d_attribute_nonnull" in
10121 '')
10122 echo " "
10123 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10124 $cat >attrib.c <<'EOCP'
10125 #include <stdio.h>
10126 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10127 EOCP
10128 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10129         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10130                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10131                 val="$undef"
10132         else
10133                 echo "Your C compiler supports __attribute__((nonnull))."
10134                 val="$define"
10135         fi
10136 else
10137         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10138         val="$undef"
10139 fi
10140 ;;
10141 *) val="$d_attribute_nonnull" ;;
10142 esac
10143 set d_attribute_nonnull
10144 eval $setvar
10145 $rm -f attrib*
10146
10147 : Look for GCC-style attribute noreturn
10148 case "$d_attribute_noreturn" in
10149 '')
10150 echo " "
10151 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10152 $cat >attrib.c <<'EOCP'
10153 #include <stdio.h>
10154 void fall_over_dead( void ) __attribute__((noreturn));
10155 EOCP
10156 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10157         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10158                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10159                 val="$undef"
10160         else
10161                 echo "Your C compiler supports __attribute__((noreturn))."
10162                 val="$define"
10163         fi
10164 else
10165         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10166         val="$undef"
10167 fi
10168 ;;
10169 *) val="$d_attribute_noreturn" ;;
10170 esac
10171 set d_attribute_noreturn
10172 eval $setvar
10173 $rm -f attrib*
10174
10175 : Look for GCC-style attribute pure
10176 case "$d_attribute_pure" in
10177 '')
10178 echo " "
10179 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10180 $cat >attrib.c <<'EOCP'
10181 #include <stdio.h>
10182 int square( int n ) __attribute__((pure));
10183 EOCP
10184 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10185         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10186                 echo "Your C compiler doesn't support __attribute__((pure))."
10187                 val="$undef"
10188         else
10189                 echo "Your C compiler supports __attribute__((pure))."
10190                 val="$define"
10191         fi
10192 else
10193         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10194         val="$undef"
10195 fi
10196 ;;
10197 *) val="$d_attribute_pure" ;;
10198 esac
10199 set d_attribute_pure
10200 eval $setvar
10201 $rm -f attrib*
10202
10203 : Look for GCC-style attribute unused
10204 case "$d_attribute_unused" in
10205 '')
10206 echo " "
10207 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10208 $cat >attrib.c <<'EOCP'
10209 #include <stdio.h>
10210 int do_something( int dummy __attribute__((unused)), int n );
10211 EOCP
10212 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10213         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10214                 echo "Your C compiler doesn't support __attribute__((unused))."
10215                 val="$undef"
10216         else
10217                 echo "Your C compiler supports __attribute__((unused))."
10218                 val="$define"
10219         fi
10220 else
10221         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10222         val="$undef"
10223 fi
10224 ;;
10225 *) val="$d_attribute_unused" ;;
10226 esac
10227 set d_attribute_unused
10228 eval $setvar
10229 $rm -f attrib*
10230
10231 : Look for GCC-style attribute warn_unused_result
10232 case "$d_attribute_warn_unused_result" in
10233 '')
10234 echo " "
10235 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10236 $cat >attrib.c <<'EOCP'
10237 #include <stdio.h>
10238 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10239 EOCP
10240 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10241         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10242                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10243                 val="$undef"
10244         else
10245                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10246                 val="$define"
10247         fi
10248 else
10249         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10250         val="$undef"
10251 fi
10252 ;;
10253 *) val="$d_attribute_warn_unused_result" ;;
10254 esac
10255 set d_attribute_warn_unused_result
10256 eval $setvar
10257 $rm -f attrib*
10258
10259 : see if bcmp exists
10260 set bcmp d_bcmp
10261 eval $inlibc
10262
10263 : see if bcopy exists
10264 set bcopy d_bcopy
10265 eval $inlibc
10266
10267 : see if getpgrp exists
10268 set getpgrp d_getpgrp
10269 eval $inlibc
10270
10271 case "$d_getpgrp" in
10272 "$define")
10273         echo " "
10274         echo "Checking to see which flavor of getpgrp is in use..."
10275         $cat >try.c <<EOP
10276 #$i_unistd I_UNISTD
10277 #include <sys/types.h>
10278 #ifdef I_UNISTD
10279 #  include <unistd.h>
10280 #endif
10281 #$i_stdlib I_STDLIB
10282 #ifdef I_STDLIB
10283 #include <stdlib.h>
10284 #endif
10285 int main()
10286 {
10287         if (getuid() == 0) {
10288                 printf("(I see you are running Configure as super-user...)\n");
10289                 setuid(1);
10290         }
10291 #ifdef TRY_BSD_PGRP
10292         if (getpgrp(1) == 0)
10293                 exit(0);
10294 #else
10295         if (getpgrp() > 0)
10296                 exit(0);
10297 #endif
10298         exit(1);
10299 }
10300 EOP
10301         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10302                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10303                 val="$define"
10304         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10305                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10306                 val="$undef"
10307         else
10308                 echo "I can't seem to compile and run the test program."
10309                 if ./usg; then
10310                         xxx="a USG one, i.e. you use getpgrp()."
10311                 else
10312                         # SVR4 systems can appear rather BSD-ish.
10313                         case "$i_unistd" in
10314                         $undef)
10315                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10316                                 val="$define"
10317                                 ;;
10318                         $define)
10319                                 xxx="probably a USG one, i.e. you use getpgrp()."
10320                                 val="$undef"
10321                                 ;;
10322                         esac
10323                 fi
10324                 echo "Assuming your getpgrp is $xxx" >&4
10325         fi
10326         ;;
10327 *) val="$undef";;
10328 esac
10329 set d_bsdgetpgrp
10330 eval $setvar
10331 $rm_try
10332
10333 : see if setpgrp exists
10334 set setpgrp d_setpgrp
10335 eval $inlibc
10336
10337 case "$d_setpgrp" in
10338 "$define")
10339         echo " "
10340         echo "Checking to see which flavor of setpgrp is in use..."
10341         $cat >try.c <<EOP
10342 #$i_unistd I_UNISTD
10343 #include <sys/types.h>
10344 #ifdef I_UNISTD
10345 #  include <unistd.h>
10346 #endif
10347 #$i_stdlib I_STDLIB
10348 #ifdef I_STDLIB
10349 #include <stdlib.h>
10350 #endif
10351 int main()
10352 {
10353         if (getuid() == 0) {
10354                 printf("(I see you are running Configure as super-user...)\n");
10355                 setuid(1);
10356         }
10357 #ifdef TRY_BSD_PGRP
10358         if (-1 == setpgrp(1, 1))
10359                 exit(0);
10360 #else
10361         if (setpgrp() != -1)
10362                 exit(0);
10363 #endif
10364         exit(1);
10365 }
10366 EOP
10367         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10368                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10369                 val="$define"
10370         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10371                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10372                 val="$undef"
10373         else
10374                 echo "(I can't seem to compile and run the test program.)"
10375                 if ./usg; then
10376                         xxx="a USG one, i.e. you use setpgrp()."
10377                 else
10378                         # SVR4 systems can appear rather BSD-ish.
10379                         case "$i_unistd" in
10380                         $undef)
10381                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10382                                 val="$define"
10383                                 ;;
10384                         $define)
10385                                 xxx="probably a USG one, i.e. you use setpgrp()."
10386                                 val="$undef"
10387                                 ;;
10388                         esac
10389                 fi
10390                 echo "Assuming your setpgrp is $xxx" >&4
10391         fi
10392         ;;
10393 *) val="$undef";;
10394 esac
10395 set d_bsdsetpgrp
10396 eval $setvar
10397 $rm_try
10398
10399 : Look for GCC-style __builtin_choose_expr
10400 case "$d_builtin_choose_expr" in
10401 '')
10402     echo " "
10403     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10404     $cat >try.c <<'EOCP'
10405 #include <assert.h>
10406 #include <stdlib.h>
10407 #include <stdio.h>
10408
10409 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10410
10411 int main(void) {
10412     assert( SYRINX(1) == 2112 );
10413     assert( SYRINX(1) != 5150 );
10414     assert( SYRINX(0) == 5150 );
10415     assert( SYRINX(0) != 2112 );
10416     puts( "All good!" );
10417     exit(0);
10418 }
10419
10420 EOCP
10421     set try
10422     if eval $compile; then
10423         echo "Your C compiler supports __builtin_choose_expr."
10424         val="$define"
10425     else
10426         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10427         val="$undef"
10428     fi
10429 ;;
10430 *) val="$d_builtin_choose_expr" ;;
10431 esac
10432
10433 set d_builtin_choose_expr
10434 eval $setvar
10435 $rm_try
10436
10437 : Look for GCC-style __builtin_expect
10438 case "$d_builtin_expect" in
10439 '')
10440     echo " "
10441     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10442     $cat >builtin.c <<'EOCP'
10443 int main(void) {
10444     int n = 50;
10445     if ( __builtin_expect(n, 0) ) n = 1;
10446 }
10447 EOCP
10448     set try
10449     if eval $compile; then
10450         echo "Your C compiler supports __builtin_choose_expr."
10451         val="$define"
10452     else
10453         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10454         val="$undef"
10455     fi
10456     ;;
10457 *) val="$d_builtin_expect" ;;
10458 esac
10459
10460 set d_builtin_expect
10461 eval $setvar
10462 $rm_try
10463
10464 : see if bzero exists
10465 set bzero d_bzero
10466 eval $inlibc
10467
10468 : see if stdarg is available
10469 echo " "
10470 if $test `./findhdr stdarg.h`; then
10471         echo "<stdarg.h> found." >&4
10472         valstd="$define"
10473 else
10474         echo "<stdarg.h> NOT found." >&4
10475         valstd="$undef"
10476 fi
10477
10478 : see if varags is available
10479 echo " "
10480 if $test `./findhdr varargs.h`; then
10481         echo "<varargs.h> found." >&4
10482 else
10483         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10484 fi
10485
10486 : set up the varargs testing programs
10487 $cat > varargs.c <<EOP
10488 #ifdef I_STDARG
10489 #include <stdarg.h>
10490 #endif
10491 #ifdef I_VARARGS
10492 #include <varargs.h>
10493 #endif
10494
10495 #ifdef I_STDARG
10496 int f(char *p, ...)
10497 #else
10498 int f(va_alist)
10499 va_dcl
10500 #endif
10501 {
10502         va_list ap;
10503 #ifndef I_STDARG
10504         char *p;
10505 #endif
10506 #ifdef I_STDARG
10507         va_start(ap,p);
10508 #else
10509         va_start(ap);
10510         p = va_arg(ap, char *);
10511 #endif
10512         va_end(ap);
10513         return 0;
10514 }
10515 EOP
10516 $cat > varargs <<EOP
10517 $startsh
10518 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10519         echo "true"
10520 else
10521         echo "false"
10522 fi
10523 $rm -f varargs$_o
10524 EOP
10525 chmod +x varargs
10526
10527 : now check which varargs header should be included
10528 echo " "
10529 i_varhdr=''
10530 case "$valstd" in
10531 "$define")
10532         if `./varargs I_STDARG`; then
10533                 val='stdarg.h'
10534         elif `./varargs I_VARARGS`; then
10535                 val='varargs.h'
10536         fi
10537         ;;
10538 *)
10539         if `./varargs I_VARARGS`; then
10540                 val='varargs.h'
10541         fi
10542         ;;
10543 esac
10544 case "$val" in
10545 '')
10546 echo "I could not find the definition for va_dcl... You have problems..." >&4
10547         val="$undef"; set i_stdarg; eval $setvar
10548         val="$undef"; set i_varargs; eval $setvar
10549         ;;
10550 *) 
10551         set i_varhdr
10552         eval $setvar
10553         case "$i_varhdr" in
10554         stdarg.h)
10555                 val="$define"; set i_stdarg; eval $setvar
10556                 val="$undef"; set i_varargs; eval $setvar
10557                 ;;
10558         varargs.h)
10559                 val="$undef"; set i_stdarg; eval $setvar
10560                 val="$define"; set i_varargs; eval $setvar
10561                 ;;
10562         esac
10563         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10564 esac
10565 $rm -f varargs*
10566
10567 : see if the Compiler supports C99 variadic macros
10568 case "$i_stdarg$i_stdlib" in
10569     "$define$define")
10570     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10571     $cat >try.c <<EOCP
10572 #include <stdio.h>
10573 #include <stdarg.h>
10574
10575 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10576
10577 int main() {
10578   char buf[20];
10579   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10580   puts(buf);
10581   return 0;
10582 }
10583 EOCP
10584     set try
10585     if eval $compile && $run ./try 2>&1 >/dev/null; then
10586         case "`$run ./try`" in
10587             "123 456 789")
10588             echo "You have C99 variadic macros." >&4
10589             d_c99_variadic_macros="$define"
10590             ;;
10591             *)
10592             echo "You don't have functional C99 variadic macros." >&4
10593             d_c99_variadic_macros="$undef"
10594             ;;
10595         esac
10596     else
10597         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10598         d_c99_variadic_macros="$undef"
10599     fi
10600     $rm_try
10601     ;;
10602     *)
10603     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10604     d_c99_variadic_macros="$undef"
10605     ;;
10606 esac
10607
10608 : see if signal is declared as pointer to function returning int or void
10609 echo " "
10610 xxx=`./findhdr signal.h`
10611 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10612 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10613         echo "You have int (*signal())() instead of void." >&4
10614         val="$undef"
10615 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10616         echo "You have void (*signal())()." >&4
10617         val="$define"
10618 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10619         echo "You have int (*signal())() instead of void." >&4
10620         val="$undef"
10621 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10622         echo "You have void (*signal())()." >&4
10623         val="$define"
10624 else
10625         case "$d_voidsig" in
10626         '')
10627         echo "I can't determine whether signal handler returns void or int..." >&4
10628                 dflt=void
10629                 rp="What type does your signal handler return?"
10630                 . ./myread
10631                 case "$ans" in
10632                 v*) val="$define";;
10633                 *) val="$undef";;
10634                 esac;;
10635         "$define")
10636                 echo "As you already told me, signal handler returns void." >&4
10637                 val="$define"
10638                 ;;
10639         *)      echo "As you already told me, signal handler returns int." >&4
10640                 val="$undef"
10641                 ;;
10642         esac
10643 fi
10644 set d_voidsig
10645 eval $setvar
10646 case "$d_voidsig" in
10647 "$define") signal_t="void";;
10648 *) signal_t="int";;
10649 esac
10650 $rm -f $$.tmp
10651
10652 : check for ability to cast large floats to 32-bit ints.
10653 echo " "
10654 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10655 if $test "$intsize" -ge 4; then
10656         xxx=int
10657 else
10658         xxx=long
10659 fi
10660 $cat >try.c <<EOCP
10661 #include <stdio.h>
10662 #$i_stdlib I_STDLIB
10663 #ifdef I_STDLIB
10664 #include <stdlib.h>
10665 #endif
10666 #include <sys/types.h>
10667 #include <signal.h>
10668 $signal_t blech(int s) { exit(3); }
10669 int main()
10670 {
10671         $xxx i32;
10672         double f, g;
10673         int result = 0;
10674         char str[16];
10675         signal(SIGFPE, blech);
10676
10677         /* Don't let compiler optimize the test away.  Store the number
10678            in a writable string for gcc to pass to sscanf under HP/UX.
10679         */
10680         sprintf(str, "2147483647");
10681         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10682         g = 10 * f;
10683         i32  = ($xxx) g;
10684
10685         /* x86 processors will probably give 0x8000 0000, which is a
10686            sign change.  We don't want that.  We want to mimic SPARC
10687            behavior here, which is to preserve the sign and give
10688            back 0x7fff ffff.
10689         */
10690         if (i32 != ($xxx) f)
10691                 result |= 1;
10692         exit(result);
10693 }
10694 EOCP
10695 set try
10696 if eval $compile_ok; then
10697         $run ./try
10698         yyy=$?
10699 else
10700         echo "(I can't seem to compile the test program--assuming it can't)"
10701         yyy=1
10702 fi
10703 case "$yyy" in
10704 0)      val="$define"
10705         echo "Yup, it can."
10706         ;;
10707 *)      val="$undef"
10708         echo "Nope, it can't."
10709         ;;
10710 esac
10711 set d_casti32
10712 eval $setvar
10713 $rm_try
10714
10715 : check for ability to cast negative floats to unsigned
10716 echo " "
10717 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10718 $cat >try.c <<EOCP
10719 #include <stdio.h>
10720 #$i_stdlib I_STDLIB
10721 #ifdef I_STDLIB
10722 #include <stdlib.h>
10723 #endif
10724 #include <sys/types.h>
10725 #include <signal.h>
10726 $signal_t blech(int s) { exit(7); }
10727 $signal_t blech_in_list(int s) { exit(4); }
10728 unsigned long dummy_long(unsigned long p) { return p; }
10729 unsigned int dummy_int(unsigned int p) { return p; }
10730 unsigned short dummy_short(unsigned short p) { return p; }
10731 int main()
10732 {
10733         double f;
10734         unsigned long along;
10735         unsigned int aint;
10736         unsigned short ashort;
10737         int result = 0;
10738         char str[16];
10739
10740         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10741            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10742            optimized the whole file away
10743         */
10744         /* Store the number in a writable string for gcc to pass to
10745            sscanf under HP/UX.
10746         */
10747         sprintf(str, "-123");
10748         sscanf(str, "%lf", &f);  /* f = -123.; */
10749
10750         signal(SIGFPE, blech);
10751         along = (unsigned long)f;
10752         aint = (unsigned int)f;
10753         ashort = (unsigned short)f;
10754         if (along != (unsigned long)-123)
10755                 result |= 1;
10756         if (aint != (unsigned int)-123)
10757                 result |= 1;
10758         if (ashort != (unsigned short)-123)
10759                 result |= 1;
10760         sprintf(str, "1073741824.");
10761         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10762         f = f + f;
10763         along = 0;
10764         along = (unsigned long)f;
10765         if (along != 0x80000000)
10766                 result |= 2;
10767         f -= 1.;
10768         along = 0;
10769         along = (unsigned long)f;
10770         if (along != 0x7fffffff)
10771                 result |= 1;
10772         f += 2.;
10773         along = 0;
10774         along = (unsigned long)f;
10775         if (along != 0x80000001)
10776                 result |= 2;
10777         if (result)
10778                 exit(result);
10779         signal(SIGFPE, blech_in_list);
10780         sprintf(str, "123.");
10781         sscanf(str, "%lf", &f);  /* f = 123.; */
10782         along = dummy_long((unsigned long)f);
10783         aint = dummy_int((unsigned int)f);
10784         ashort = dummy_short((unsigned short)f);
10785         if (along != (unsigned long)123)
10786                 result |= 4;
10787         if (aint != (unsigned int)123)
10788                 result |= 4;
10789         if (ashort != (unsigned short)123)
10790                 result |= 4;
10791         exit(result);
10792
10793 }
10794 EOCP
10795 set try
10796 if eval $compile_ok; then
10797         $run ./try
10798         castflags=$?
10799 else
10800         echo "(I can't seem to compile the test program--assuming it can't)"
10801         castflags=7
10802 fi
10803 case "$castflags" in
10804 0)      val="$define"
10805         echo "Yup, it can."
10806         ;;
10807 *)      val="$undef"
10808         echo "Nope, it can't."
10809         ;;
10810 esac
10811 set d_castneg
10812 eval $setvar
10813 $rm_try
10814
10815 : see if vprintf exists
10816 echo " "
10817 if set vprintf val -f d_vprintf; eval $csym; $val; then
10818         echo 'vprintf() found.' >&4
10819         val="$define"
10820         $cat >try.c <<EOF
10821 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10822 #$i_varargs I_VARARGS
10823
10824 #$i_stdlib I_STDLIB
10825 #$i_unistd I_UNISTD
10826
10827 #ifdef I_STDARG
10828 #  include <stdarg.h>
10829 #else /* I_VARARGS */
10830 #  include <varargs.h>
10831 #endif
10832
10833 #ifdef I_UNISTD
10834 #  include <unistd.h>
10835 #endif
10836
10837 #ifdef I_STDLIB
10838 #  include <stdlib.h>
10839 #endif
10840
10841 #include <stdio.h> /* vsprintf prototype */
10842
10843 #ifdef I_STDARG
10844 void xxx(int n, ...)
10845 {
10846     va_list args;
10847     char buf[10];
10848     va_start(args, n);
10849     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10850 }
10851 int main() { xxx(1, "foo"); }
10852
10853 #else /* I_VARARGS */
10854
10855 xxx(va_alist)
10856 va_dcl
10857 {
10858     va_list args;
10859     char buf[10];
10860     va_start(args);
10861     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10862 }
10863 int main() { xxx("foo"); }
10864
10865 #endif
10866
10867 EOF
10868         set try
10869         if eval $compile_ok; then
10870                 if $run ./try; then
10871                         echo "Your vsprintf() returns (int)." >&4
10872                         val2="$undef"
10873                 else
10874                         echo "Your vsprintf() returns (char*)." >&4
10875                         val2="$define"
10876                 fi
10877         else
10878                 echo 'I am unable to compile the vsprintf() test program.' >&4
10879                 # We shouldn't get here.  If we do, assume the standard signature,
10880                 # not the old BSD one.
10881                 echo 'Guessing that vsprintf() returns (int).' >&4
10882                 val2="$undef"
10883         fi
10884 else
10885         echo 'vprintf() NOT found.' >&4
10886         val="$undef"
10887         val2="$undef"
10888 fi
10889 $rm_try
10890 set d_vprintf
10891 eval $setvar
10892 val=$val2
10893 set d_charvspr
10894 eval $setvar
10895
10896 : see if chown exists
10897 set chown d_chown
10898 eval $inlibc
10899
10900 : see if chroot exists
10901 set chroot d_chroot
10902 eval $inlibc
10903
10904 : see if chsize exists
10905 set chsize d_chsize
10906 eval $inlibc
10907
10908 : see if class exists
10909 set class d_class
10910 eval $inlibc
10911
10912 : see if clearenv exists
10913 set clearenv d_clearenv
10914 eval $inlibc
10915
10916 hasstruct='varname=$1; struct=$2; shift; shift;
10917 while $test $# -ge 2; do
10918         case "$1" in
10919         $define) echo "#include <$2>";;
10920         esac ;
10921     shift 2;
10922 done > try.c;
10923 echo "int main () { struct $struct foo; }" >> try.c;
10924 set try;
10925 if eval $compile; then
10926         val="$define";
10927 else
10928         val="$undef";
10929 fi;
10930 set $varname;
10931 eval $setvar;
10932 $rm_try'
10933
10934 socketlib=''
10935 sockethdr=''
10936 : see whether socket exists
10937 echo " "
10938 $echo $n "Hmm... $c" >&4
10939 if set socket val -f d_socket; eval $csym; $val; then
10940         echo "Looks like you have Berkeley networking support." >&4
10941         d_socket="$define"
10942         if set setsockopt val -f; eval $csym; $val; then
10943                 d_oldsock="$undef"
10944         else
10945                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10946                 d_oldsock="$define"
10947         fi
10948 else
10949         if $contains socklib libc.list >/dev/null 2>&1; then
10950                 echo "Looks like you have Berkeley networking support." >&4
10951                 d_socket="$define"
10952                 : we will have to assume that it supports the 4.2 BSD interface
10953                 d_oldsock="$undef"
10954         else
10955                 echo "You don't have Berkeley networking in libc$_a..." >&4
10956                 if test "X$d_socket" = "X$define"; then
10957                    echo "...but you seem to believe that you have sockets." >&4
10958                 else
10959                         for net in net socket
10960                         do
10961                                 if test -f /usr/lib/lib$net$_a; then
10962                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10963                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10964                                         if $contains socket libc.list >/dev/null 2>&1; then
10965                                                 d_socket="$define"
10966                                                 socketlib="-l$net"
10967                                                 case "$net" in
10968                                                 net)
10969                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10970                                                         sockethdr="-I/usr/netinclude"
10971                                                         ;;
10972                                                 esac
10973                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10974                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10975                                                         d_oldsock="$undef"
10976                                                 else
10977                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10978                                                         d_oldsock="$define"
10979                                                 fi
10980                                                 break
10981                                         fi
10982                                 fi
10983                         done
10984                         if test "X$d_socket" != "X$define"; then
10985                            echo "or anywhere else I see." >&4
10986                            d_socket="$undef"
10987                            d_oldsock="$undef"
10988                         fi
10989                 fi
10990         fi
10991 fi
10992
10993 : see if socketpair exists
10994 set socketpair d_sockpair
10995 eval $inlibc
10996
10997
10998 echo " "
10999 echo "Checking the availability of certain socket constants..." >&4
11000 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11001         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11002         $cat >try.c <<EOF
11003 #include <sys/types.h>
11004 #include <sys/socket.h>
11005 int main() {
11006     int i = $ENUM;
11007 }
11008 EOF
11009         val="$undef"
11010         set try; if eval $compile; then
11011                 val="$define"
11012         fi
11013         set d_${enum}; eval $setvar
11014         $rm_try
11015 done
11016
11017 : see if this is a sys/uio.h system
11018 set sys/uio.h i_sysuio
11019 eval $inhdr
11020
11021
11022 echo " "
11023 echo "Checking to see if your system supports struct cmsghdr..." >&4
11024 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11025 eval $hasstruct
11026 case "$d_cmsghdr_s" in
11027 "$define")      echo "Yes, it does."   ;;
11028 *)              echo "No, it doesn't." ;;
11029 esac
11030
11031
11032 : check for const keyword
11033 echo " "
11034 echo 'Checking to see if your C compiler knows about "const"...' >&4
11035 $cat >const.c <<'EOCP'
11036 typedef struct spug { int drokk; } spug;
11037 int main()
11038 {
11039         const char *foo;
11040         const spug y = { 0 };
11041 }
11042 EOCP
11043 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11044         val="$define"
11045         echo "Yup, it does."
11046 else
11047         val="$undef"
11048         echo "Nope, it doesn't."
11049 fi
11050 set d_const
11051 eval $setvar
11052
11053 : see if copysignl exists
11054 set copysignl d_copysignl
11055 eval $inlibc
11056
11057 : see if crypt exists
11058 echo " "
11059 set crypt d_crypt
11060 eval $inlibc
11061 case "$d_crypt" in
11062 $define) cryptlib='' ;;
11063 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11064                 echo 'crypt() found.' >&4
11065                 val="$define"
11066                 cryptlib=''
11067         else
11068                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11069                 if $test -z "$cryptlib"; then
11070                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11071                 else
11072                         cryptlib=-lcrypt
11073                 fi
11074                 if $test -z "$cryptlib"; then
11075                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11076                 else
11077                         cryptlib=-lcrypt
11078                 fi
11079                 if $test -z "$cryptlib"; then
11080                         cryptlib=`./loc libcrypt$_a "" $libpth`
11081                 else
11082                         cryptlib=-lcrypt
11083                 fi
11084                 if $test -z "$cryptlib"; then
11085                         echo 'crypt() NOT found.' >&4
11086                         val="$undef"
11087                 else
11088                         val="$define"
11089                 fi
11090         fi
11091         set d_crypt
11092         eval $setvar
11093         ;;
11094 esac
11095
11096 : see if this is a crypt.h system
11097 set crypt.h i_crypt
11098 eval $inhdr
11099
11100 : see if crypt_r exists
11101 set crypt_r d_crypt_r
11102 eval $inlibc
11103 case "$d_crypt_r" in
11104 "$define")
11105         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11106         case "$d_crypt_r_proto:$usethreads" in
11107         ":define")      d_crypt_r_proto=define
11108                 set d_crypt_r_proto crypt_r $hdrs
11109                 eval $hasproto ;;
11110         *)      ;;
11111         esac
11112         case "$d_crypt_r_proto" in
11113         define)
11114         case "$crypt_r_proto" in
11115         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11116         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11117         esac
11118         case "$crypt_r_proto" in
11119         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11120         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11121         esac
11122         case "$crypt_r_proto" in
11123         ''|0)   d_crypt_r=undef
11124                 crypt_r_proto=0
11125                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11126         * )     case "$crypt_r_proto" in
11127                 REENTRANT_PROTO*) ;;
11128                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11129                 esac
11130                 echo "Prototype: $try" ;;
11131         esac
11132         ;;
11133         *)      case "$usethreads" in
11134                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11135                 esac
11136                 d_crypt_r=undef
11137                 crypt_r_proto=0
11138                 ;;
11139         esac
11140         ;;
11141 *)      crypt_r_proto=0
11142         ;;
11143 esac
11144
11145 : get csh whereabouts
11146 case "$csh" in
11147 'csh') val="$undef" ;;
11148 *) val="$define" ;;
11149 esac
11150 set d_csh
11151 eval $setvar
11152 : Respect a hint or command line value for full_csh.
11153 case "$full_csh" in
11154 '') full_csh=$csh ;;
11155 esac
11156
11157 : see if ctermid exists
11158 set ctermid d_ctermid
11159 eval $inlibc
11160
11161 : see if ctermid_r exists
11162 set ctermid_r d_ctermid_r
11163 eval $inlibc
11164 case "$d_ctermid_r" in
11165 "$define")
11166         hdrs="$i_systypes sys/types.h define stdio.h "
11167         case "$d_ctermid_r_proto:$usethreads" in
11168         ":define")      d_ctermid_r_proto=define
11169                 set d_ctermid_r_proto ctermid_r $hdrs
11170                 eval $hasproto ;;
11171         *)      ;;
11172         esac
11173         case "$d_ctermid_r_proto" in
11174         define)
11175         case "$ctermid_r_proto" in
11176         ''|0) try='char* ctermid_r(char*);'
11177         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11178         esac
11179         case "$ctermid_r_proto" in
11180         ''|0)   d_ctermid_r=undef
11181                 ctermid_r_proto=0
11182                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11183         * )     case "$ctermid_r_proto" in
11184                 REENTRANT_PROTO*) ;;
11185                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11186                 esac
11187                 echo "Prototype: $try" ;;
11188         esac
11189         ;;
11190         *)      case "$usethreads" in
11191                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11192                 esac
11193                 d_ctermid_r=undef
11194                 ctermid_r_proto=0
11195                 ;;
11196         esac
11197         ;;
11198 *)      ctermid_r_proto=0
11199         ;;
11200 esac
11201
11202 : see if ctime_r exists
11203 set ctime_r d_ctime_r
11204 eval $inlibc
11205 case "$d_ctime_r" in
11206 "$define")
11207         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11208         case "$d_ctime_r_proto:$usethreads" in
11209         ":define")      d_ctime_r_proto=define
11210                 set d_ctime_r_proto ctime_r $hdrs
11211                 eval $hasproto ;;
11212         *)      ;;
11213         esac
11214         case "$d_ctime_r_proto" in
11215         define)
11216         case "$ctime_r_proto" in
11217         ''|0) try='char* ctime_r(const time_t*, char*);'
11218         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11219         esac
11220         case "$ctime_r_proto" in
11221         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11222         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11223         esac
11224         case "$ctime_r_proto" in
11225         ''|0) try='int ctime_r(const time_t*, char*);'
11226         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11227         esac
11228         case "$ctime_r_proto" in
11229         ''|0) try='int ctime_r(const time_t*, char*, int);'
11230         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11231         esac
11232         case "$ctime_r_proto" in
11233         ''|0)   d_ctime_r=undef
11234                 ctime_r_proto=0
11235                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11236         * )     case "$ctime_r_proto" in
11237                 REENTRANT_PROTO*) ;;
11238                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11239                 esac
11240                 echo "Prototype: $try" ;;
11241         esac
11242         ;;
11243         *)      case "$usethreads" in
11244                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11245                 esac
11246                 d_ctime_r=undef
11247                 ctime_r_proto=0
11248                 ;;
11249         esac
11250         ;;
11251 *)      ctime_r_proto=0
11252         ;;
11253 esac
11254
11255 : see if cuserid exists
11256 set cuserid d_cuserid
11257 eval $inlibc
11258
11259 : see if this is a limits.h system
11260 set limits.h i_limits
11261 eval $inhdr
11262
11263 : see if this is a float.h system
11264 set float.h i_float
11265 eval $inhdr
11266
11267 : See if number of significant digits in a double precision number is known
11268 echo " "
11269 $cat >dbl_dig.c <<EOM
11270 #$i_limits I_LIMITS
11271 #$i_float I_FLOAT
11272 #ifdef I_LIMITS
11273 #include <limits.h>
11274 #endif
11275 #ifdef I_FLOAT
11276 #include <float.h>
11277 #endif
11278 #ifdef DBL_DIG
11279 printf("Contains DBL_DIG");
11280 #endif
11281 EOM
11282 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11283 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11284         echo "DBL_DIG found." >&4
11285         val="$define"
11286 else
11287         echo "DBL_DIG NOT found." >&4
11288         val="$undef"
11289 fi
11290 $rm -f dbl_dig.?
11291 set d_dbl_dig
11292 eval $setvar
11293
11294 : see if dbm.h is available
11295 : see if dbmclose exists
11296 set dbmclose d_dbmclose
11297 eval $inlibc
11298
11299 case "$d_dbmclose" in
11300 $define)
11301         set dbm.h i_dbm
11302         eval $inhdr
11303         case "$i_dbm" in
11304         $define)
11305                 val="$undef"
11306                 set i_rpcsvcdbm
11307                 eval $setvar
11308                 ;;
11309         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11310                 eval $inhdr
11311                 ;;
11312         esac
11313         ;;
11314 *)      echo "We won't be including <dbm.h>"
11315         val="$undef"
11316         set i_dbm
11317         eval $setvar
11318         val="$undef"
11319         set i_rpcsvcdbm
11320         eval $setvar
11321         ;;
11322 esac
11323
11324 : see if prototype for dbminit is available
11325 echo " "
11326 set d_dbminitproto dbminit $i_dbm dbm.h
11327 eval $hasproto
11328
11329 : see if difftime exists
11330 set difftime d_difftime
11331 eval $inlibc
11332
11333 : see if this is a dirent system
11334 echo " "
11335 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11336         val="$define"
11337         echo "<dirent.h> found." >&4
11338 else
11339         val="$undef"
11340         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11341                 echo "<sys/dir.h> found." >&4
11342                 echo " "
11343         else
11344                 xinc=`./findhdr sys/ndir.h`
11345         fi
11346         echo "<dirent.h> NOT found." >&4
11347 fi
11348 set i_dirent
11349 eval $setvar
11350
11351 : Look for type of directory structure.
11352 echo " "
11353 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11354
11355 case "$direntrytype" in
11356 ''|' ')
11357         case "$i_dirent" in
11358         $define) guess1='struct dirent' ;;
11359         *) guess1='struct direct'  ;;
11360         esac
11361         ;;
11362 *)      guess1="$direntrytype"
11363         ;;
11364 esac
11365
11366 case "$guess1" in
11367 'struct dirent') guess2='struct direct' ;;
11368 *) guess2='struct dirent' ;;
11369 esac
11370
11371 if $contains "$guess1" try.c >/dev/null 2>&1; then
11372         direntrytype="$guess1"
11373         echo "Your directory entries are $direntrytype." >&4
11374 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11375         direntrytype="$guess2"
11376         echo "Your directory entries seem to be $direntrytype." >&4
11377 else
11378         echo "I don't recognize your system's directory entries." >&4
11379         rp="What type is used for directory entries on this system?"
11380         dflt="$guess1"
11381         . ./myread
11382         direntrytype="$ans"
11383 fi
11384 $rm_try
11385
11386 : see if the directory entry stores field length
11387 echo " "
11388 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11389 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11390         echo "Good, your directory entry keeps length information in d_namlen." >&4
11391         val="$define"
11392 else
11393         echo "Your directory entry does not know about the d_namlen field." >&4
11394         val="$undef"
11395 fi
11396 set d_dirnamlen
11397 eval $setvar
11398 $rm_try
11399
11400 : Look for DIR.dd_fd
11401 case "$i_dirent" in
11402 "$define")
11403     echo "Checking to see if DIR has a dd_fd member variable" >&4
11404     $cat >try.c <<EOCP
11405 #$i_stdlib I_STDLIB
11406 #ifdef I_STDLIB
11407 #include <stdlib.h>
11408 #endif
11409 #include <dirent.h>
11410
11411 int main() {
11412     DIR dir;
11413     dir.dd_fd = 1;
11414     return 0;
11415 }
11416 EOCP
11417     val=$undef
11418     set try
11419     if eval $compile; then
11420         echo "Yes, it does."
11421         val="$define"
11422     else
11423         echo "No, it does not."
11424         val="$undef"
11425     fi
11426     ;;
11427 *)
11428     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11429     val="$undef"
11430     ;;
11431 esac
11432 set d_dir_dd_fd
11433 eval $setvar
11434 $rm_try
11435
11436 : see if this is an sysdir system
11437 set sys/dir.h i_sysdir
11438 eval $inhdr
11439
11440 : see if this is an sysndir system
11441 set sys/ndir.h i_sysndir
11442 eval $inhdr
11443
11444 : Look for dirfd
11445 echo " "
11446 $cat >dirfd.c <<EOM
11447 #include <stdio.h>
11448 #$i_stdlib I_STDLIB
11449 #ifdef I_STDLIB
11450 #include <stdlib.h>
11451 #endif
11452 #$i_dirent I_DIRENT             /**/
11453 #$i_sysdir I_SYS_DIR            /**/
11454 #$i_sysndir I_SYS_NDIR          /**/
11455 #$i_systypes I_SYS_TYPES        /**/
11456 #if defined(I_SYS_TYPES)
11457 #include <sys/types.h>
11458 #endif
11459 #if defined(I_DIRENT)
11460 #include <dirent.h>
11461 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11462 #include <sys/dir.h>
11463 #endif
11464 #else
11465 #ifdef I_SYS_NDIR
11466 #include <sys/ndir.h>
11467 #else
11468 #ifdef I_SYS_DIR
11469 #ifdef hp9000s500
11470 #include <ndir.h>       /* may be wrong in the future */
11471 #else
11472 #include <sys/dir.h>
11473 #endif
11474 #endif
11475 #endif
11476 #endif 
11477 int main() {
11478         DIR *dirp = opendir(".");
11479         if (dirfd(dirp) >= 0)
11480                 exit(0);
11481         else
11482                 exit(1);
11483 }
11484 EOM
11485 val=$undef
11486 set dirfd
11487 if eval $compile; then
11488         val="$define"
11489 fi
11490 case "$val" in
11491 $define)        echo "dirfd() found." >&4       ;;
11492 *)              echo "dirfd() NOT found." >&4   ;;
11493 esac
11494 set d_dirfd
11495 eval $setvar
11496 $rm -f dirfd*
11497
11498 : see if dlerror exists
11499 xxx_runnm="$runnm"
11500 runnm=false
11501 set dlerror d_dlerror
11502 eval $inlibc
11503 runnm="$xxx_runnm"
11504
11505 : see if dlfcn is available
11506 set dlfcn.h i_dlfcn
11507 eval $inhdr
11508
11509 case "$usedl" in
11510 $define|y|true)
11511         $cat << EOM
11512
11513 On a few systems, the dynamically loaded modules that perl generates and uses
11514 will need a different extension than shared libs. The default will probably
11515 be appropriate.
11516
11517 EOM
11518         case "$dlext" in
11519         '')     dflt="$so" ;;
11520         *)      dflt="$dlext" ;;
11521         esac
11522         rp='What is the extension of dynamically loaded modules'
11523         . ./myread
11524         dlext="$ans"
11525         ;;
11526 *)
11527         dlext="none"
11528         ;;
11529 esac
11530
11531 : Check if dlsym need a leading underscore
11532 echo " "
11533 val="$undef"
11534
11535 case "$dlsrc" in
11536 dl_dlopen.xs)
11537         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11538         $cat >dyna.c <<'EOM'
11539 fred () { }
11540 EOM
11541
11542 $cat >fred.c<<EOM
11543
11544 #include <stdio.h>
11545 #$i_stdlib I_STDLIB
11546 #ifdef I_STDLIB
11547 #include <stdlib.h>
11548 #endif
11549 #$i_dlfcn I_DLFCN
11550 #ifdef I_DLFCN
11551 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11552 #else
11553 #include <sys/types.h>
11554 #include <nlist.h>
11555 #include <link.h>
11556 #endif
11557
11558 extern int fred() ;
11559
11560 int main()
11561 {
11562     void * handle ;
11563     void * symbol ;
11564 #ifndef RTLD_LAZY
11565     int mode = 1 ;
11566 #else
11567     int mode = RTLD_LAZY ;
11568 #endif
11569     handle = dlopen("./dyna.$dlext", mode) ;
11570     if (handle == NULL) {
11571         printf ("1\n") ;
11572         fflush (stdout) ;
11573         exit(0);
11574     }
11575     symbol = dlsym(handle, "fred") ;
11576     if (symbol == NULL) {
11577         /* try putting a leading underscore */
11578         symbol = dlsym(handle, "_fred") ;
11579         if (symbol == NULL) {
11580             printf ("2\n") ;
11581             fflush (stdout) ;
11582             exit(0);
11583         }
11584         printf ("3\n") ;
11585     }
11586     else
11587         printf ("4\n") ;
11588     fflush (stdout) ;
11589     exit(0);
11590 }
11591 EOM
11592         : Call the object file tmp-dyna.o in case dlext=o.
11593         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11594                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11595                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11596                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11597                 xxx=`$run ./fred`
11598                 case $xxx in
11599                 1)      echo "Test program failed using dlopen." >&4
11600                         echo "Perhaps you should not use dynamic loading." >&4;;
11601                 2)      echo "Test program failed using dlsym." >&4
11602                         echo "Perhaps you should not use dynamic loading." >&4;;
11603                 3)      echo "dlsym needs a leading underscore" >&4
11604                         val="$define" ;;
11605                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11606                 esac
11607         else
11608                 echo "I can't compile and run the test program." >&4
11609                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11610         fi
11611         ;;
11612 esac
11613                 
11614 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11615
11616 set d_dlsymun
11617 eval $setvar
11618
11619 : see if drand48_r exists
11620 set drand48_r d_drand48_r
11621 eval $inlibc
11622 case "$d_drand48_r" in
11623 "$define")
11624         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11625         case "$d_drand48_r_proto:$usethreads" in
11626         ":define")      d_drand48_r_proto=define
11627                 set d_drand48_r_proto drand48_r $hdrs
11628                 eval $hasproto ;;
11629         *)      ;;
11630         esac
11631         case "$d_drand48_r_proto" in
11632         define)
11633         case "$drand48_r_proto" in
11634         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11635         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11636         esac
11637         case "$drand48_r_proto" in
11638         ''|0)   d_drand48_r=undef
11639                 drand48_r_proto=0
11640                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11641         * )     case "$drand48_r_proto" in
11642                 REENTRANT_PROTO*) ;;
11643                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11644                 esac
11645                 echo "Prototype: $try" ;;
11646         esac
11647         ;;
11648         *)      case "$usethreads" in
11649                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11650                 esac
11651                 d_drand48_r=undef
11652                 drand48_r_proto=0
11653                 ;;
11654         esac
11655         ;;
11656 *)      drand48_r_proto=0
11657         ;;
11658 esac
11659
11660 : see if prototype for drand48 is available
11661 echo " "
11662 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11663 eval $hasproto
11664
11665 : see if dup2 exists
11666 set dup2 d_dup2
11667 eval $inlibc
11668
11669 : see if eaccess exists
11670 set eaccess d_eaccess
11671 eval $inlibc
11672
11673 : see if endgrent exists
11674 set endgrent d_endgrent
11675 eval $inlibc
11676
11677 : see if this is an grp system
11678 set grp.h i_grp
11679 eval $inhdr
11680
11681 case "$i_grp" in
11682 $define)
11683         xxx=`./findhdr grp.h`
11684         $cppstdin $cppflags $cppminus < $xxx >$$.h
11685
11686         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11687                 val="$define"
11688         else
11689                 val="$undef"
11690         fi
11691         set d_grpasswd
11692         eval $setvar
11693
11694         $rm -f $$.h
11695         ;;
11696 *)
11697         val="$undef";
11698         set d_grpasswd; eval $setvar
11699         ;;
11700 esac
11701
11702 : see if endgrent_r exists
11703 set endgrent_r d_endgrent_r
11704 eval $inlibc
11705 case "$d_endgrent_r" in
11706 "$define")
11707         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11708         case "$d_endgrent_r_proto:$usethreads" in
11709         ":define")      d_endgrent_r_proto=define
11710                 set d_endgrent_r_proto endgrent_r $hdrs
11711                 eval $hasproto ;;
11712         *)      ;;
11713         esac
11714         case "$d_endgrent_r_proto" in
11715         define)
11716         case "$endgrent_r_proto" in
11717         ''|0) try='int endgrent_r(FILE**);'
11718         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11719         esac
11720         case "$endgrent_r_proto" in
11721         ''|0) try='void endgrent_r(FILE**);'
11722         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11723         esac
11724         case "$endgrent_r_proto" in
11725         ''|0)   d_endgrent_r=undef
11726                 endgrent_r_proto=0
11727                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11728         * )     case "$endgrent_r_proto" in
11729                 REENTRANT_PROTO*) ;;
11730                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11731                 esac
11732                 echo "Prototype: $try" ;;
11733         esac
11734         ;;
11735         *)      case "$usethreads" in
11736                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11737                 esac
11738                 d_endgrent_r=undef
11739                 endgrent_r_proto=0
11740                 ;;
11741         esac
11742         ;;
11743 *)      endgrent_r_proto=0
11744         ;;
11745 esac
11746
11747 : see if endhostent exists
11748 set endhostent d_endhent
11749 eval $inlibc
11750
11751 : see if this is a netdb.h system
11752 set netdb.h i_netdb
11753 eval $inhdr
11754
11755 : see if endhostent_r exists
11756 set endhostent_r d_endhostent_r
11757 eval $inlibc
11758 case "$d_endhostent_r" in
11759 "$define")
11760         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11761         case "$d_endhostent_r_proto:$usethreads" in
11762         ":define")      d_endhostent_r_proto=define
11763                 set d_endhostent_r_proto endhostent_r $hdrs
11764                 eval $hasproto ;;
11765         *)      ;;
11766         esac
11767         case "$d_endhostent_r_proto" in
11768         define)
11769         case "$endhostent_r_proto" in
11770         ''|0) try='int endhostent_r(struct hostent_data*);'
11771         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11772         esac
11773         case "$endhostent_r_proto" in
11774         ''|0) try='void endhostent_r(struct hostent_data*);'
11775         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11776         esac
11777         case "$endhostent_r_proto" in
11778         ''|0)   d_endhostent_r=undef
11779                 endhostent_r_proto=0
11780                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11781         * )     case "$endhostent_r_proto" in
11782                 REENTRANT_PROTO*) ;;
11783                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11784                 esac
11785                 echo "Prototype: $try" ;;
11786         esac
11787         ;;
11788         *)      case "$usethreads" in
11789                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11790                 esac
11791                 d_endhostent_r=undef
11792                 endhostent_r_proto=0
11793                 ;;
11794         esac
11795         ;;
11796 *)      endhostent_r_proto=0
11797         ;;
11798 esac
11799
11800 : see if endnetent exists
11801 set endnetent d_endnent
11802 eval $inlibc
11803
11804 : see if endnetent_r exists
11805 set endnetent_r d_endnetent_r
11806 eval $inlibc
11807 case "$d_endnetent_r" in
11808 "$define")
11809         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11810         case "$d_endnetent_r_proto:$usethreads" in
11811         ":define")      d_endnetent_r_proto=define
11812                 set d_endnetent_r_proto endnetent_r $hdrs
11813                 eval $hasproto ;;
11814         *)      ;;
11815         esac
11816         case "$d_endnetent_r_proto" in
11817         define)
11818         case "$endnetent_r_proto" in
11819         ''|0) try='int endnetent_r(struct netent_data*);'
11820         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11821         esac
11822         case "$endnetent_r_proto" in
11823         ''|0) try='void endnetent_r(struct netent_data*);'
11824         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11825         esac
11826         case "$endnetent_r_proto" in
11827         ''|0)   d_endnetent_r=undef
11828                 endnetent_r_proto=0
11829                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11830         * )     case "$endnetent_r_proto" in
11831                 REENTRANT_PROTO*) ;;
11832                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11833                 esac
11834                 echo "Prototype: $try" ;;
11835         esac
11836         ;;
11837         *)      case "$usethreads" in
11838                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11839                 esac
11840                 d_endnetent_r=undef
11841                 endnetent_r_proto=0
11842                 ;;
11843         esac
11844         ;;
11845 *)      endnetent_r_proto=0
11846         ;;
11847 esac
11848
11849 : see if endprotoent exists
11850 set endprotoent d_endpent
11851 eval $inlibc
11852
11853 : see if endprotoent_r exists
11854 set endprotoent_r d_endprotoent_r
11855 eval $inlibc
11856 case "$d_endprotoent_r" in
11857 "$define")
11858         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11859         case "$d_endprotoent_r_proto:$usethreads" in
11860         ":define")      d_endprotoent_r_proto=define
11861                 set d_endprotoent_r_proto endprotoent_r $hdrs
11862                 eval $hasproto ;;
11863         *)      ;;
11864         esac
11865         case "$d_endprotoent_r_proto" in
11866         define)
11867         case "$endprotoent_r_proto" in
11868         ''|0) try='int endprotoent_r(struct protoent_data*);'
11869         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11870         esac
11871         case "$endprotoent_r_proto" in
11872         ''|0) try='void endprotoent_r(struct protoent_data*);'
11873         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11874         esac
11875         case "$endprotoent_r_proto" in
11876         ''|0)   d_endprotoent_r=undef
11877                 endprotoent_r_proto=0
11878                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11879         * )     case "$endprotoent_r_proto" in
11880                 REENTRANT_PROTO*) ;;
11881                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11882                 esac
11883                 echo "Prototype: $try" ;;
11884         esac
11885         ;;
11886         *)      case "$usethreads" in
11887                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11888                 esac
11889                 d_endprotoent_r=undef
11890                 endprotoent_r_proto=0
11891                 ;;
11892         esac
11893         ;;
11894 *)      endprotoent_r_proto=0
11895         ;;
11896 esac
11897
11898 : see if endpwent exists
11899 set endpwent d_endpwent
11900 eval $inlibc
11901
11902 : see if this is a pwd.h system
11903 set pwd.h i_pwd
11904 eval $inhdr
11905
11906 case "$i_pwd" in
11907 $define)
11908         xxx=`./findhdr pwd.h`
11909         $cppstdin $cppflags $cppminus < $xxx >$$.h
11910
11911         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11912                 val="$define"
11913         else
11914                 val="$undef"
11915         fi
11916         set d_pwquota
11917         eval $setvar
11918
11919         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11920                 val="$define"
11921         else
11922                 val="$undef"
11923         fi
11924         set d_pwage
11925         eval $setvar
11926
11927         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11928                 val="$define"
11929         else
11930                 val="$undef"
11931         fi
11932         set d_pwchange
11933         eval $setvar
11934
11935         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11936                 val="$define"
11937         else
11938                 val="$undef"
11939         fi
11940         set d_pwclass
11941         eval $setvar
11942
11943         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11944                 val="$define"
11945         else
11946                 val="$undef"
11947         fi
11948         set d_pwexpire
11949         eval $setvar
11950
11951         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11952                 val="$define"
11953         else
11954                 val="$undef"
11955         fi
11956         set d_pwcomment
11957         eval $setvar
11958
11959         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11960                 val="$define"
11961         else
11962                 val="$undef"
11963         fi
11964         set d_pwgecos
11965         eval $setvar
11966
11967         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11968                 val="$define"
11969         else
11970                 val="$undef"
11971         fi
11972         set d_pwpasswd
11973         eval $setvar
11974
11975         $rm -f $$.h
11976         ;;
11977 *)
11978         val="$undef"; 
11979         set d_pwquota; eval $setvar
11980         set d_pwage; eval $setvar
11981         set d_pwchange; eval $setvar
11982         set d_pwclass; eval $setvar
11983         set d_pwexpire; eval $setvar
11984         set d_pwcomment; eval $setvar
11985         set d_pwgecos; eval $setvar
11986         set d_pwpasswd; eval $setvar
11987         ;;
11988 esac
11989
11990 : see if endpwent_r exists
11991 set endpwent_r d_endpwent_r
11992 eval $inlibc
11993 case "$d_endpwent_r" in
11994 "$define")
11995         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11996         case "$d_endpwent_r_proto:$usethreads" in
11997         ":define")      d_endpwent_r_proto=define
11998                 set d_endpwent_r_proto endpwent_r $hdrs
11999                 eval $hasproto ;;
12000         *)      ;;
12001         esac
12002         case "$d_endpwent_r_proto" in
12003         define)
12004         case "$endpwent_r_proto" in
12005         ''|0) try='int endpwent_r(FILE**);'
12006         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12007         esac
12008         case "$endpwent_r_proto" in
12009         ''|0) try='void endpwent_r(FILE**);'
12010         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12011         esac
12012         case "$endpwent_r_proto" in
12013         ''|0)   d_endpwent_r=undef
12014                 endpwent_r_proto=0
12015                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12016         * )     case "$endpwent_r_proto" in
12017                 REENTRANT_PROTO*) ;;
12018                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12019                 esac
12020                 echo "Prototype: $try" ;;
12021         esac
12022         ;;
12023         *)      case "$usethreads" in
12024                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12025                 esac
12026                 d_endpwent_r=undef
12027                 endpwent_r_proto=0
12028                 ;;
12029         esac
12030         ;;
12031 *)      endpwent_r_proto=0
12032         ;;
12033 esac
12034
12035 : see if endservent exists
12036 set endservent d_endsent
12037 eval $inlibc
12038
12039 : see if endservent_r exists
12040 set endservent_r d_endservent_r
12041 eval $inlibc
12042 case "$d_endservent_r" in
12043 "$define")
12044         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12045         case "$d_endservent_r_proto:$usethreads" in
12046         ":define")      d_endservent_r_proto=define
12047                 set d_endservent_r_proto endservent_r $hdrs
12048                 eval $hasproto ;;
12049         *)      ;;
12050         esac
12051         case "$d_endservent_r_proto" in
12052         define)
12053         case "$endservent_r_proto" in
12054         ''|0) try='int endservent_r(struct servent_data*);'
12055         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12056         esac
12057         case "$endservent_r_proto" in
12058         ''|0) try='void endservent_r(struct servent_data*);'
12059         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12060         esac
12061         case "$endservent_r_proto" in
12062         ''|0)   d_endservent_r=undef
12063                 endservent_r_proto=0
12064                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12065         * )     case "$endservent_r_proto" in
12066                 REENTRANT_PROTO*) ;;
12067                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12068                 esac
12069                 echo "Prototype: $try" ;;
12070         esac
12071         ;;
12072         *)      case "$usethreads" in
12073                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12074                 esac
12075                 d_endservent_r=undef
12076                 endservent_r_proto=0
12077                 ;;
12078         esac
12079         ;;
12080 *)      endservent_r_proto=0
12081         ;;
12082 esac
12083
12084 : Locate the flags for 'open()'
12085 echo " "
12086 $cat >try.c <<EOCP
12087 #include <sys/types.h>
12088 #ifdef I_FCNTL
12089 #include <fcntl.h>
12090 #endif
12091 #ifdef I_SYS_FILE
12092 #include <sys/file.h>
12093 #endif
12094 #$i_stdlib I_STDLIB
12095 #ifdef I_STDLIB
12096 #include <stdlib.h>
12097 #endif
12098 int main() {
12099         if(O_RDONLY);
12100 #ifdef O_TRUNC
12101         exit(0);
12102 #else
12103         exit(1);
12104 #endif
12105 }
12106 EOCP
12107 : check sys/file.h first to get FREAD on Sun
12108 if $test `./findhdr sys/file.h` && \
12109                 set try -DI_SYS_FILE && eval $compile; then
12110         h_sysfile=true;
12111         echo "<sys/file.h> defines the O_* constants..." >&4
12112         if $run ./try; then
12113                 echo "and you have the 3 argument form of open()." >&4
12114                 val="$define"
12115         else
12116                 echo "but not the 3 argument form of open().  Oh, well." >&4
12117                 val="$undef"
12118         fi
12119 elif $test `./findhdr fcntl.h` && \
12120                 set try -DI_FCNTL && eval $compile; then
12121         h_fcntl=true;
12122         echo "<fcntl.h> defines the O_* constants..." >&4
12123         if $run ./try; then
12124                 echo "and you have the 3 argument form of open()." >&4
12125                 val="$define"
12126         else
12127                 echo "but not the 3 argument form of open().  Oh, well." >&4
12128                 val="$undef"
12129         fi
12130 else
12131         val="$undef"
12132         echo "I can't find the O_* constant definitions!  You got problems." >&4
12133 fi
12134 set d_open3
12135 eval $setvar
12136 $rm_try
12137
12138 : see which of string.h or strings.h is needed
12139 echo " "
12140 strings=`./findhdr string.h`
12141 if $test "$strings" && $test -r "$strings"; then
12142         echo "Using <string.h> instead of <strings.h>." >&4
12143         val="$define"
12144 else
12145         val="$undef"
12146         strings=`./findhdr strings.h`
12147         if $test "$strings" && $test -r "$strings"; then
12148                 echo "Using <strings.h> instead of <string.h>." >&4
12149         else
12150                 echo "No string header found -- You'll surely have problems." >&4
12151         fi
12152 fi
12153 set i_string
12154 eval $setvar
12155 case "$i_string" in
12156 "$undef") strings=`./findhdr strings.h`;;
12157 *)        strings=`./findhdr string.h`;;
12158 esac
12159
12160 : see if this is a sys/file.h system
12161 val=''
12162 set sys/file.h val
12163 eval $inhdr
12164
12165 : do we need to include sys/file.h ?
12166 case "$val" in
12167 "$define")
12168         echo " "
12169         if $h_sysfile; then
12170                 val="$define"
12171                 echo "We'll be including <sys/file.h>." >&4
12172         else
12173                 val="$undef"
12174                 echo "We won't be including <sys/file.h>." >&4
12175         fi
12176         ;;
12177 *)
12178         h_sysfile=false
12179         ;;
12180 esac
12181 set i_sysfile
12182 eval $setvar
12183
12184 : see if fcntl.h is there
12185 val=''
12186 set fcntl.h val
12187 eval $inhdr
12188
12189 : see if we can include fcntl.h
12190 case "$val" in
12191 "$define")
12192         echo " "
12193         if $h_fcntl; then
12194                 val="$define"
12195                 echo "We'll be including <fcntl.h>." >&4
12196         else
12197                 val="$undef"
12198                 if $h_sysfile; then
12199         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12200                 else
12201                         echo "We won't be including <fcntl.h>." >&4
12202                 fi
12203         fi
12204         ;;
12205 *)
12206         h_fcntl=false
12207         val="$undef"
12208         ;;
12209 esac
12210 set i_fcntl
12211 eval $setvar
12212
12213 : see if fork exists
12214 set fork d_fork
12215 eval $inlibc
12216
12217 : see if pipe exists
12218 set pipe d_pipe
12219 eval $inlibc
12220
12221 : check for non-blocking I/O stuff
12222 case "$h_sysfile" in
12223 true) echo "#include <sys/file.h>" > head.c;;
12224 *)
12225        case "$h_fcntl" in
12226        true) echo "#include <fcntl.h>" > head.c;;
12227        *) echo "#include <sys/fcntl.h>" > head.c;;
12228        esac
12229        ;;
12230 esac
12231 echo " "
12232 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12233 case "$o_nonblock" in
12234 '')
12235         $cat head.c > try.c
12236         $cat >>try.c <<EOCP
12237 #include <stdio.h>
12238 #$i_stdlib I_STDLIB
12239 #ifdef I_STDLIB
12240 #include <stdlib.h>
12241 #endif
12242 #$i_fcntl I_FCNTL
12243 #ifdef I_FCNTL
12244 #include <fcntl.h>
12245 #endif
12246 int main() {
12247 #ifdef O_NONBLOCK
12248         printf("O_NONBLOCK\n");
12249         exit(0);
12250 #endif
12251 #ifdef O_NDELAY
12252         printf("O_NDELAY\n");
12253         exit(0);
12254 #endif
12255 #ifdef FNDELAY
12256         printf("FNDELAY\n");
12257         exit(0);
12258 #endif
12259         exit(0);
12260 }
12261 EOCP
12262         set try
12263         if eval $compile_ok; then
12264                 o_nonblock=`$run ./try`
12265                 case "$o_nonblock" in
12266                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12267                 *) echo "Seems like we can use $o_nonblock.";;
12268                 esac
12269         else
12270                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12271         fi
12272         ;;
12273 *) echo "Using $hint value $o_nonblock.";;
12274 esac
12275 $rm_try
12276
12277 echo " "
12278 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12279 case "$eagain" in
12280 '')
12281         case "$d_fork:$d_pipe" in
12282         define:define)
12283         $cat head.c > try.c
12284         $cat >>try.c <<EOCP
12285 #include <errno.h>
12286 #include <sys/types.h>
12287 #include <signal.h>
12288 #include <stdio.h>
12289 #$i_stdlib I_STDLIB
12290 #ifdef I_STDLIB
12291 #include <stdlib.h>
12292 #endif
12293 #$i_fcntl I_FCNTL
12294 #ifdef I_FCNTL
12295 #include <fcntl.h>
12296 #endif
12297 #define MY_O_NONBLOCK $o_nonblock
12298 #ifndef errno  /* XXX need better Configure test */
12299 extern int errno;
12300 #endif
12301 #$i_unistd I_UNISTD
12302 #ifdef I_UNISTD
12303 #include <unistd.h>
12304 #endif
12305 #$i_string I_STRING
12306 #ifdef I_STRING
12307 #include <string.h>
12308 #else
12309 #include <strings.h>
12310 #endif
12311 $signal_t blech(int x) { exit(3); }
12312 EOCP
12313         $cat >> try.c <<'EOCP'
12314 int main()
12315 {
12316         int pd[2];
12317         int pu[2];
12318         char buf[1];
12319         char string[100];
12320
12321         pipe(pd);       /* Down: child -> parent */
12322         pipe(pu);       /* Up: parent -> child */
12323         if (0 != fork()) {
12324                 int ret;
12325                 close(pd[1]);   /* Parent reads from pd[0] */
12326                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12327 #ifdef F_SETFL
12328                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12329                         exit(1);
12330 #else
12331                 exit(4);
12332 #endif
12333                 signal(SIGALRM, blech);
12334                 alarm(5);
12335                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12336                         exit(2);
12337                 sprintf(string, "%d\n", ret);
12338                 write(2, string, strlen(string));
12339                 alarm(0);
12340 #ifdef EAGAIN
12341                 if (errno == EAGAIN) {
12342                         printf("EAGAIN\n");
12343                         goto ok;
12344                 }
12345 #endif
12346 #ifdef EWOULDBLOCK
12347                 if (errno == EWOULDBLOCK)
12348                         printf("EWOULDBLOCK\n");
12349 #endif
12350         ok:
12351                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12352                 sleep(2);                               /* Give it time to close our pipe */
12353                 alarm(5);
12354                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12355                 alarm(0);
12356                 sprintf(string, "%d\n", ret);
12357                 write(4, string, strlen(string));
12358                 exit(0);
12359         }
12360
12361         close(pd[0]);                   /* We write to pd[1] */
12362         close(pu[1]);                   /* We read from pu[0] */
12363         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12364         close(pd[1]);                   /* Pipe pd is now fully closed! */
12365         exit(0);                                /* Bye bye, thank you for playing! */
12366 }
12367 EOCP
12368         set try
12369         if eval $compile_ok; then
12370                 echo "$startsh" >mtry
12371                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12372                 chmod +x mtry
12373                 ./mtry >/dev/null 2>&1
12374                 case $? in
12375                 0) eagain=`$cat try.out`;;
12376                 1) echo "Could not perform non-blocking setting!";;
12377                 2) echo "I did a successful read() for something that was not there!";;
12378                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12379                 4) echo "Could not find F_SETFL!";;
12380                 *) echo "Something terribly wrong happened during testing.";;
12381                 esac
12382                 rd_nodata=`$cat try.ret`
12383                 echo "A read() system call with no data present returns $rd_nodata."
12384                 case "$rd_nodata" in
12385                 0|-1) ;;
12386                 *)
12387                         echo "(That's peculiar, fixing that to be -1.)"
12388                         rd_nodata=-1
12389                         ;;
12390                 esac
12391                 case "$eagain" in
12392                 '')
12393                         echo "Forcing errno EAGAIN on read() with no data available."
12394                         eagain=EAGAIN
12395                         ;;
12396                 *)
12397                         echo "Your read() sets errno to $eagain when no data is available."
12398                         ;;
12399                 esac
12400                 status=`$cat try.err`
12401                 case "$status" in
12402                 0) echo "And it correctly returns 0 to signal EOF.";;
12403                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12404                 *) echo "However, your read() returns '$status' on EOF??";;
12405                 esac
12406                 val="$define"
12407                 if test "$status" = "$rd_nodata"; then
12408                         echo "WARNING: you can't distinguish between EOF and no data!"
12409                         val="$undef"
12410                 fi
12411         else
12412                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12413                 eagain=EAGAIN
12414         fi
12415         ;;
12416         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12417                 eagain=EAGAIN
12418                 val="$define"
12419                 ;;
12420         esac
12421         set d_eofnblk
12422         eval $setvar
12423         ;;
12424 *)
12425         echo "Using $hint value $eagain."
12426         echo "Your read() returns $rd_nodata when no data is present."
12427         case "$d_eofnblk" in
12428         "$define") echo "And you can see EOF because read() returns 0.";;
12429         "$undef") echo "But you can't see EOF status from read() returned value.";;
12430         *)
12431                 echo "(Assuming you can't see EOF status from read anyway.)"
12432                 d_eofnblk=$undef
12433                 ;;
12434         esac
12435         ;;
12436 esac
12437 $rm_try head.c mtry
12438
12439 : see if _ptr and _cnt from stdio act std
12440 echo " "
12441
12442 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12443         echo "(Looks like you have stdio.h from BSD.)"
12444         case "$stdio_ptr" in
12445         '') stdio_ptr='((fp)->_p)'
12446                 ptr_lval=$define
12447                 ;;
12448         *)      ptr_lval=$d_stdio_ptr_lval;;
12449         esac
12450         case "$stdio_cnt" in
12451         '') stdio_cnt='((fp)->_r)'
12452                 cnt_lval=$define
12453                 ;;
12454         *)      cnt_lval=$d_stdio_cnt_lval;;
12455         esac
12456         case "$stdio_base" in
12457         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12458         esac
12459         case "$stdio_bufsiz" in
12460         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12461         esac
12462 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12463         echo "(Looks like you have stdio.h from Linux.)"
12464         case "$stdio_ptr" in
12465         '') stdio_ptr='((fp)->_IO_read_ptr)'
12466                 ptr_lval=$define
12467                 ;;
12468         *)      ptr_lval=$d_stdio_ptr_lval;;
12469         esac
12470         case "$stdio_cnt" in
12471         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12472                 cnt_lval=$undef
12473                 ;;
12474         *)      cnt_lval=$d_stdio_cnt_lval;;
12475         esac
12476         case "$stdio_base" in
12477         '') stdio_base='((fp)->_IO_read_base)';;
12478         esac
12479         case "$stdio_bufsiz" in
12480         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12481         esac
12482 else
12483         case "$stdio_ptr" in
12484         '') stdio_ptr='((fp)->_ptr)'
12485                 ptr_lval=$define
12486                 ;;
12487         *)      ptr_lval=$d_stdio_ptr_lval;;
12488         esac
12489         case "$stdio_cnt" in
12490         '') stdio_cnt='((fp)->_cnt)'
12491                 cnt_lval=$define
12492                 ;;
12493         *)      cnt_lval=$d_stdio_cnt_lval;;
12494         esac
12495         case "$stdio_base" in
12496         '') stdio_base='((fp)->_base)';;
12497         esac
12498         case "$stdio_bufsiz" in
12499         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12500         esac
12501 fi
12502
12503 : test whether _ptr and _cnt really work
12504 echo "Checking how std your stdio is..." >&4
12505 $cat >try.c <<EOP
12506 #include <stdio.h>
12507 #$i_stdlib I_STDLIB
12508 #ifdef I_STDLIB
12509 #include <stdlib.h>
12510 #endif
12511 #define FILE_ptr(fp)    $stdio_ptr
12512 #define FILE_cnt(fp)    $stdio_cnt
12513 int main() {
12514         FILE *fp = fopen("try.c", "r");
12515         char c = getc(fp);
12516         if (
12517                 18 <= FILE_cnt(fp) &&
12518                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12519         )
12520                 exit(0);
12521         exit(1);
12522 }
12523 EOP
12524 val="$undef"
12525 set try
12526 if eval $compile && $to try.c; then
12527         if $run ./try; then
12528                 echo "Your stdio acts pretty std."
12529                 val="$define"
12530         else
12531                 echo "Your stdio isn't very std."
12532         fi
12533 else
12534         echo "Your stdio doesn't appear very std."
12535 fi
12536 $rm_try
12537
12538 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12539 # direct buffer manipulation no longer works.  The Configure tests
12540 # should be changed to correctly detect this, but until then,
12541 # the following check should at least let perl compile and run.
12542 # (This quick fix should be updated before 5.8.1.)
12543 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12544 # A. Dougherty, June 3, 2002.
12545 case "$d_gnulibc" in
12546 $define)
12547         case "$gnulibc_version" in
12548         2.[01]*)  ;;
12549         2.2) ;;
12550         2.2.[0-9]) ;;
12551         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12552                 val="$undef"
12553                 ;;
12554         esac
12555         ;;
12556 esac
12557 set d_stdstdio
12558 eval $setvar
12559
12560 : Can _ptr be used as an lvalue?
12561 case "$d_stdstdio$ptr_lval" in
12562 $define$define) val=$define ;;
12563 *) val=$undef ;;
12564 esac
12565 set d_stdio_ptr_lval
12566 eval $setvar
12567
12568 : Can _cnt be used as an lvalue?
12569 case "$d_stdstdio$cnt_lval" in
12570 $define$define) val=$define ;;
12571 *) val=$undef ;;
12572 esac
12573 set d_stdio_cnt_lval
12574 eval $setvar
12575
12576
12577 : test whether setting _ptr sets _cnt as a side effect
12578 d_stdio_ptr_lval_sets_cnt="$undef"
12579 d_stdio_ptr_lval_nochange_cnt="$undef"
12580 case "$d_stdio_ptr_lval$d_stdstdio" in
12581 $define$define)
12582         echo "Checking to see what happens if we set the stdio ptr..." >&4
12583 $cat >try.c <<EOP
12584 #include <stdio.h>
12585 /* Can we scream? */
12586 /* Eat dust sed :-) */
12587 /* In the buffer space, no one can hear you scream. */
12588 #$i_stdlib I_STDLIB
12589 #ifdef I_STDLIB
12590 #include <stdlib.h>
12591 #endif
12592 #define FILE_ptr(fp)    $stdio_ptr
12593 #define FILE_cnt(fp)    $stdio_cnt
12594 #include <sys/types.h>
12595 int main() {
12596         FILE *fp = fopen("try.c", "r");
12597         int c;
12598         char *ptr;
12599         size_t cnt;
12600         if (!fp) {
12601             puts("Fail even to read");
12602             exit(1);
12603         }
12604         c = getc(fp); /* Read away the first # */
12605         if (c == EOF) {
12606             puts("Fail even to read");
12607             exit(1);
12608         }
12609         if (!(
12610                 18 <= FILE_cnt(fp) &&
12611                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12612         )) {
12613                 puts("Fail even to read");
12614                 exit (1);
12615         }
12616         ptr = (char*) FILE_ptr(fp);
12617         cnt = (size_t)FILE_cnt(fp);
12618
12619         FILE_ptr(fp) += 42;
12620
12621         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12622                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12623                 exit (1);
12624         }
12625         if (FILE_cnt(fp) <= 20) {
12626                 printf ("Fail (<20 chars to test)");
12627                 exit (1);
12628         }
12629         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12630                 puts("Fail compare");
12631                 exit (1);
12632         }
12633         if (cnt == FILE_cnt(fp)) {
12634                 puts("Pass_unchanged");
12635                 exit (0);
12636         }
12637         if (FILE_cnt(fp) == (cnt - 42)) {
12638                 puts("Pass_changed");
12639                 exit (0);
12640         }
12641         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12642         return 1;
12643
12644 }
12645 EOP
12646         set try
12647         if eval $compile && $to try.c; then
12648                 case `$run ./try` in
12649                 Pass_changed)
12650                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12651                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12652                 Pass_unchanged)
12653                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12654                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12655                 Fail*)
12656                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12657                 *)
12658                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12659         esac
12660         else
12661                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12662         fi
12663         $rm_try
12664         ;;
12665 esac
12666
12667 : see if _base is also standard
12668 val="$undef"
12669 case "$d_stdstdio" in
12670 $define)
12671         $cat >try.c <<EOP
12672 #include <stdio.h>
12673 #$i_stdlib I_STDLIB
12674 #ifdef I_STDLIB
12675 #include <stdlib.h>
12676 #endif
12677 #define FILE_base(fp)   $stdio_base
12678 #define FILE_bufsiz(fp) $stdio_bufsiz
12679 int main() {
12680         FILE *fp = fopen("try.c", "r");
12681         char c = getc(fp);
12682         if (
12683                 19 <= FILE_bufsiz(fp) &&
12684                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12685         )
12686                 exit(0);
12687         exit(1);
12688 }
12689 EOP
12690         set try
12691         if eval $compile && $to try.c; then
12692                 if $run ./try; then
12693                         echo "And its _base field acts std."
12694                         val="$define"
12695                 else
12696                         echo "But its _base field isn't std."
12697                 fi
12698         else
12699                 echo "However, it seems to be lacking the _base field."
12700         fi
12701         $rm_try
12702         ;;
12703 esac
12704 set d_stdiobase
12705 eval $setvar
12706
12707 : see if fast_stdio exists
12708 val="$undef"
12709 case "$d_stdstdio:$d_stdio_ptr_lval" in
12710 "$define:$define")
12711         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12712         *$define*)
12713                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12714                 val="$define"
12715                 ;;
12716         esac
12717         ;;
12718 esac
12719 set d_faststdio
12720 eval $setvar
12721
12722
12723
12724 : see if fchdir exists
12725 set fchdir d_fchdir
12726 eval $inlibc
12727
12728 : see if fchmod exists
12729 set fchmod d_fchmod
12730 eval $inlibc
12731
12732 : see if fchown exists
12733 set fchown d_fchown
12734 eval $inlibc
12735
12736 : see if this is an fcntl system
12737 set fcntl d_fcntl
12738 eval $inlibc
12739
12740 echo " "
12741 : See if fcntl-based locking works.
12742 $cat >try.c <<EOCP
12743 #$i_stdlib I_STDLIB
12744 #ifdef I_STDLIB
12745 #include <stdlib.h>
12746 #endif
12747 #include <unistd.h>
12748 #include <fcntl.h>
12749 #include <signal.h>
12750 $signal_t blech(int x) { exit(3); }
12751 int main() {
12752 #if defined(F_SETLK) && defined(F_SETLKW)
12753      struct flock flock;
12754      int retval, fd;
12755      fd = open("try.c", O_RDONLY);
12756      flock.l_type = F_RDLCK;
12757      flock.l_whence = SEEK_SET;
12758      flock.l_start = flock.l_len = 0;
12759      signal(SIGALRM, blech);
12760      alarm(10);
12761      retval = fcntl(fd, F_SETLK, &flock);
12762      close(fd);
12763      (retval < 0 ? exit(2) : exit(0));
12764 #else
12765      exit(2);
12766 #endif
12767 }
12768 EOCP
12769 echo "Checking if fcntl-based file locking works... "
12770 case "$d_fcntl" in
12771 "$define")
12772         set try
12773         if eval $compile_ok; then
12774                 if $run ./try; then
12775                         echo "Yes, it seems to work."
12776                         val="$define"
12777                 else
12778                         echo "Nope, it didn't work."
12779                         val="$undef"
12780                         case "$?" in
12781                         3) $cat >&4 <<EOM
12782 ***
12783 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12784 *** This is (almost) impossible.
12785 *** If your NFS lock daemons are not feeling well, something like
12786 *** this may happen, please investigate.  Cannot continue, aborting.
12787 ***
12788 EOM
12789                                 exit 1
12790                                 ;;
12791                         esac
12792                 fi
12793         else
12794                 echo "I'm unable to compile the test program, so I'll assume not."
12795                 val="$undef"
12796         fi
12797         ;;
12798 *) val="$undef";
12799         echo "Nope, since you don't even have fcntl()."
12800         ;;
12801 esac
12802 set d_fcntl_can_lock
12803 eval $setvar
12804 $rm_try
12805
12806 : check for fd_set items
12807 $cat <<EOM
12808
12809 Checking to see how well your C compiler handles fd_set and friends ...
12810 EOM
12811 $cat >try.c <<EOCP
12812 #$i_stdlib I_STDLIB
12813 #ifdef I_STDLIB
12814 #include <stdlib.h>
12815 #endif
12816 #$i_systime I_SYS_TIME
12817 #$i_sysselct I_SYS_SELECT
12818 #$d_socket HAS_SOCKET
12819 #include <sys/types.h>
12820 #ifdef HAS_SOCKET
12821 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12822 #endif
12823 #ifdef I_SYS_TIME
12824 #include <sys/time.h>
12825 #endif
12826 #ifdef I_SYS_SELECT
12827 #include <sys/select.h>
12828 #endif
12829 int main() {
12830         fd_set fds;
12831
12832 #ifdef TRYBITS
12833         if(fds.fds_bits);
12834 #endif
12835
12836 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12837         exit(0);
12838 #else
12839         exit(1);
12840 #endif
12841 }
12842 EOCP
12843 set try -DTRYBITS
12844 if eval $compile; then
12845         d_fds_bits="$define"
12846         d_fd_set="$define"
12847         echo "Well, your system knows about the normal fd_set typedef..." >&4
12848         if $run ./try; then
12849                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12850                 d_fd_macros="$define"
12851         else
12852                 $cat >&4 <<'EOM'
12853 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12854 EOM
12855                 d_fd_macros="$undef"
12856         fi
12857 else
12858         $cat <<'EOM'
12859 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12860 EOM
12861         set try
12862         if eval $compile; then
12863                 d_fds_bits="$undef"
12864                 d_fd_set="$define"
12865                 echo "Well, your system has some sort of fd_set available..." >&4
12866                 if $run ./try; then
12867                         echo "and you have the normal fd_set macros." >&4
12868                         d_fd_macros="$define"
12869                 else
12870                         $cat <<'EOM'
12871 but not the normal fd_set macros!  Gross!  More work for me...
12872 EOM
12873                         d_fd_macros="$undef"
12874                 fi
12875         else
12876         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12877                 d_fd_set="$undef"
12878                 d_fds_bits="$undef"
12879                 d_fd_macros="$undef"
12880         fi
12881 fi
12882 $rm_try
12883
12884 : see if fgetpos exists
12885 set fgetpos d_fgetpos
12886 eval $inlibc
12887
12888 : see if finite exists
12889 set finite d_finite
12890 eval $inlibc
12891
12892 : see if finitel exists
12893 set finitel d_finitel
12894 eval $inlibc
12895
12896 : see if flock exists
12897 set flock d_flock
12898 eval $inlibc
12899
12900 : see if prototype for flock is available
12901 echo " "
12902 set d_flockproto flock $i_sysfile sys/file.h
12903 eval $hasproto
12904
12905 : see if fp_class exists
12906 set fp_class d_fp_class
12907 eval $inlibc
12908
12909 : see if pathconf exists
12910 set pathconf d_pathconf
12911 eval $inlibc
12912
12913 : see if fpathconf exists
12914 set fpathconf d_fpathconf
12915 eval $inlibc
12916
12917 : see if fpclass exists
12918 set fpclass d_fpclass
12919 eval $inlibc
12920
12921 : see if fpclassify exists
12922 set fpclassify d_fpclassify
12923 eval $inlibc
12924
12925 : see if fpclassl exists
12926 set fpclassl d_fpclassl
12927 eval $inlibc
12928
12929
12930 : check for fpos64_t
12931 echo " "
12932 echo "Checking to see if you have fpos64_t..." >&4
12933 $cat >try.c <<EOCP
12934 #include <stdio.h>
12935 int main() { fpos64_t x = 7; }
12936 EOCP
12937 set try
12938 if eval $compile; then
12939         val="$define"
12940         echo "You have fpos64_t."
12941 else
12942         val="$undef"
12943         echo "You do not have fpos64_t."
12944         case "$fpossize" in
12945         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12946         esac
12947 fi
12948 $rm_try
12949 set d_fpos64_t
12950 eval $setvar
12951
12952 : see if frexpl exists
12953 set frexpl d_frexpl
12954 eval $inlibc
12955
12956 : see if this is a sys/param system
12957 set sys/param.h i_sysparam
12958 eval $inhdr
12959
12960 : see if this is a sys/mount.h system
12961 set sys/mount.h i_sysmount
12962 eval $inhdr
12963
12964
12965 echo " "
12966 echo "Checking to see if your system supports struct fs_data..." >&4
12967 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12968 eval $hasstruct
12969 case "$d_fs_data_s" in
12970 "$define")      echo "Yes, it does."   ;;
12971 *)              echo "No, it doesn't." ;;
12972 esac
12973
12974 : see if fseeko exists
12975 set fseeko d_fseeko
12976 eval $inlibc
12977 case "$longsize" in
12978 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12979 esac
12980
12981 : see if fsetpos exists
12982 set fsetpos d_fsetpos
12983 eval $inlibc
12984
12985
12986 : see if fstatfs exists
12987 set fstatfs d_fstatfs
12988 eval $inlibc
12989
12990
12991 : see if statvfs exists
12992 set statvfs d_statvfs
12993 eval $inlibc
12994
12995 : see if fstatvfs exists
12996 set fstatvfs d_fstatvfs
12997 eval $inlibc
12998
12999
13000 : see if fsync exists
13001 set fsync d_fsync
13002 eval $inlibc
13003
13004 : see if ftello exists
13005 set ftello d_ftello
13006 eval $inlibc
13007 case "$longsize" in
13008 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13009 esac
13010
13011 d_futimes="$undef"
13012 : check for a working futimes
13013 echo " "
13014 echo "Checking if you have a working futimes()" >&4
13015 $cat >try.c <<EOCP
13016 #include <stdio.h>
13017 #include <sys/time.h>
13018 #include <errno.h>
13019 #include <fcntl.h>
13020
13021 int main ()
13022 {
13023     int fd, rv;
13024     fd = open ("try.c", O_RDWR);
13025     if (-1 == fd) exit (1);
13026     rv = futimes (fd, NULL);
13027     exit (rv == -1 ? errno : 0);
13028 }
13029 EOCP
13030 set try
13031 if eval $compile; then
13032     `$run ./try`
13033     rc=$?
13034     case "$rc" in
13035         0)  echo "Yes, you have" >&4
13036             d_futimes="$define"
13037             ;;
13038         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13039             ;;
13040     esac
13041 else
13042     echo "No, it does not (probably harmless)" >&4
13043 fi
13044 $rm_try
13045
13046 : see if getcwd exists
13047 set getcwd d_getcwd
13048 eval $inlibc
13049
13050 : see if getespwnam exists
13051 set getespwnam d_getespwnam
13052 eval $inlibc
13053
13054
13055 : see if getfsstat exists
13056 set getfsstat d_getfsstat
13057 eval $inlibc
13058
13059 : see if getgrent exists
13060 set getgrent d_getgrent
13061 eval $inlibc
13062
13063 : see if getgrent_r exists
13064 set getgrent_r d_getgrent_r
13065 eval $inlibc
13066 case "$d_getgrent_r" in
13067 "$define")
13068         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13069         case "$d_getgrent_r_proto:$usethreads" in
13070         ":define")      d_getgrent_r_proto=define
13071                 set d_getgrent_r_proto getgrent_r $hdrs
13072                 eval $hasproto ;;
13073         *)      ;;
13074         esac
13075         case "$d_getgrent_r_proto" in
13076         define)
13077         case "$getgrent_r_proto" in
13078         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13079         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13080         esac
13081         case "$getgrent_r_proto" in
13082         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13083         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13084         esac
13085         case "$getgrent_r_proto" in
13086         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13087         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13088         esac
13089         case "$getgrent_r_proto" in
13090         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13091         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13092         esac
13093         case "$getgrent_r_proto" in
13094         ''|0) try='int getgrent_r(struct group*, char*, int);'
13095         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13096         esac
13097         case "$getgrent_r_proto" in
13098         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13099         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13100         esac
13101         case "$getgrent_r_proto" in
13102         ''|0)   d_getgrent_r=undef
13103                 getgrent_r_proto=0
13104                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13105         * )     case "$getgrent_r_proto" in
13106                 REENTRANT_PROTO*) ;;
13107                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13108                 esac
13109                 echo "Prototype: $try" ;;
13110         esac
13111         ;;
13112         *)      case "$usethreads" in
13113                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13114                 esac
13115                 d_getgrent_r=undef
13116                 getgrent_r_proto=0
13117                 ;;
13118         esac
13119         ;;
13120 *)      getgrent_r_proto=0
13121         ;;
13122 esac
13123
13124 : see if getgrgid_r exists
13125 set getgrgid_r d_getgrgid_r
13126 eval $inlibc
13127 case "$d_getgrgid_r" in
13128 "$define")
13129         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13130         case "$d_getgrgid_r_proto:$usethreads" in
13131         ":define")      d_getgrgid_r_proto=define
13132                 set d_getgrgid_r_proto getgrgid_r $hdrs
13133                 eval $hasproto ;;
13134         *)      ;;
13135         esac
13136         case "$d_getgrgid_r_proto" in
13137         define)
13138         case "$getgrgid_r_proto" in
13139         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13140         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13141         esac
13142         case "$getgrgid_r_proto" in
13143         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13144         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13145         esac
13146         case "$getgrgid_r_proto" in
13147         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13148         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13149         esac
13150         case "$getgrgid_r_proto" in
13151         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13152         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13153         esac
13154         case "$getgrgid_r_proto" in
13155         ''|0)   d_getgrgid_r=undef
13156                 getgrgid_r_proto=0
13157                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13158         * )     case "$getgrgid_r_proto" in
13159                 REENTRANT_PROTO*) ;;
13160                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13161                 esac
13162                 echo "Prototype: $try" ;;
13163         esac
13164         ;;
13165         *)      case "$usethreads" in
13166                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13167                 esac
13168                 d_getgrgid_r=undef
13169                 getgrgid_r_proto=0
13170                 ;;
13171         esac
13172         ;;
13173 *)      getgrgid_r_proto=0
13174         ;;
13175 esac
13176
13177 : see if getgrnam_r exists
13178 set getgrnam_r d_getgrnam_r
13179 eval $inlibc
13180 case "$d_getgrnam_r" in
13181 "$define")
13182         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13183         case "$d_getgrnam_r_proto:$usethreads" in
13184         ":define")      d_getgrnam_r_proto=define
13185                 set d_getgrnam_r_proto getgrnam_r $hdrs
13186                 eval $hasproto ;;
13187         *)      ;;
13188         esac
13189         case "$d_getgrnam_r_proto" in
13190         define)
13191         case "$getgrnam_r_proto" in
13192         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13193         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13194         esac
13195         case "$getgrnam_r_proto" in
13196         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13197         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13198         esac
13199         case "$getgrnam_r_proto" in
13200         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13201         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13202         esac
13203         case "$getgrnam_r_proto" in
13204         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13205         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13206         esac
13207         case "$getgrnam_r_proto" in
13208         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13209         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13210         esac
13211         case "$getgrnam_r_proto" in
13212         ''|0)   d_getgrnam_r=undef
13213                 getgrnam_r_proto=0
13214                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13215         * )     case "$getgrnam_r_proto" in
13216                 REENTRANT_PROTO*) ;;
13217                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13218                 esac
13219                 echo "Prototype: $try" ;;
13220         esac
13221         ;;
13222         *)      case "$usethreads" in
13223                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13224                 esac
13225                 d_getgrnam_r=undef
13226                 getgrnam_r_proto=0
13227                 ;;
13228         esac
13229         ;;
13230 *)      getgrnam_r_proto=0
13231         ;;
13232 esac
13233
13234 : see if gethostbyaddr exists
13235 set gethostbyaddr d_gethbyaddr
13236 eval $inlibc
13237
13238 : see if gethostbyname exists
13239 set gethostbyname d_gethbyname
13240 eval $inlibc
13241
13242 : see if gethostent exists
13243 set gethostent d_gethent
13244 eval $inlibc
13245
13246 : see how we will look up host name
13247 echo " "
13248 call=''
13249 if set gethostname val -f d_gethname; eval $csym; $val; then
13250         echo 'gethostname() found.' >&4
13251         d_gethname="$define"
13252         call=gethostname
13253 fi
13254 if set uname val -f d_uname; eval $csym; $val; then
13255         if ./xenix; then
13256                 $cat <<'EOM'
13257 uname() was found, but you're running xenix, and older versions of xenix
13258 have a broken uname(). If you don't really know whether your xenix is old
13259 enough to have a broken system call, use the default answer.
13260
13261 EOM
13262                 dflt=y
13263                 case "$d_uname" in
13264                 "$define") dflt=n;;
13265                 esac
13266                 rp='Is your uname() broken?'
13267                 . ./myread
13268                 case "$ans" in
13269                 n*) d_uname="$define"; call=uname;;
13270                 esac
13271         else
13272                 echo 'uname() found.' >&4
13273                 d_uname="$define"
13274                 case "$call" in
13275                 '') call=uname ;;
13276                 esac
13277         fi
13278 fi
13279 case "$d_gethname" in
13280 '') d_gethname="$undef";;
13281 esac
13282 case "$d_uname" in
13283 '') d_uname="$undef";;
13284 esac
13285 case "$d_uname$d_gethname" in
13286 *define*)
13287         dflt=n
13288         cat <<EOM
13289  
13290 Every now and then someone has a $call() that lies about the hostname
13291 but can't be fixed for political or economic reasons.  If you wish, I can
13292 pretend $call() isn't there and maybe compute hostname at run-time
13293 thanks to the '$phostname' command.
13294
13295 EOM
13296         rp="Shall I ignore $call() from now on?"
13297         . ./myread
13298         case "$ans" in
13299         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13300         esac;;
13301 esac
13302 case "$phostname" in
13303 '') aphostname='';;
13304 *) case "$aphostname" in
13305         /*) ;;
13306         *) set X $phostname
13307                 shift
13308                 file=$1
13309                 shift
13310                 file=`./loc $file $file $pth`
13311                 aphostname=`echo $file $*`
13312                 ;;
13313         esac
13314         ;;
13315 esac
13316 case "$d_uname$d_gethname" in
13317 *define*) ;;
13318 *)
13319         case "$phostname" in
13320         '')
13321                 echo "There will be no way for $package to get your hostname." >&4;;
13322         *)
13323         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13324                 ;;
13325         esac;;
13326 esac
13327 case "$d_phostname" in
13328 '') d_phostname="$undef";;
13329 esac
13330
13331 : see if gethostbyaddr_r exists
13332 set gethostbyaddr_r d_gethostbyaddr_r
13333 eval $inlibc
13334 case "$d_gethostbyaddr_r" in
13335 "$define")
13336         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13337         case "$d_gethostbyaddr_r_proto:$usethreads" in
13338         ":define")      d_gethostbyaddr_r_proto=define
13339                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13340                 eval $hasproto ;;
13341         *)      ;;
13342         esac
13343         case "$d_gethostbyaddr_r_proto" in
13344         define)
13345         case "$gethostbyaddr_r_proto" in
13346         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13347         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13348         esac
13349         case "$gethostbyaddr_r_proto" in
13350         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13351         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13352         esac
13353         case "$gethostbyaddr_r_proto" in
13354         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13355         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13356         esac
13357         case "$gethostbyaddr_r_proto" in
13358         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13359         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13360         esac
13361         case "$gethostbyaddr_r_proto" in
13362         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13363         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13364         esac
13365         case "$gethostbyaddr_r_proto" in
13366         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13367         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13368         esac
13369         case "$gethostbyaddr_r_proto" in
13370         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13371         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13372         esac
13373         case "$gethostbyaddr_r_proto" in
13374         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13375         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13376         esac
13377         case "$gethostbyaddr_r_proto" in
13378         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13379         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13380         esac
13381         case "$gethostbyaddr_r_proto" in
13382         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13383         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13384         esac
13385         case "$gethostbyaddr_r_proto" in
13386         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13387         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13388         esac
13389         case "$gethostbyaddr_r_proto" in
13390         ''|0)   d_gethostbyaddr_r=undef
13391                 gethostbyaddr_r_proto=0
13392                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13393         * )     case "$gethostbyaddr_r_proto" in
13394                 REENTRANT_PROTO*) ;;
13395                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13396                 esac
13397                 echo "Prototype: $try" ;;
13398         esac
13399         ;;
13400         *)      case "$usethreads" in
13401                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13402                 esac
13403                 d_gethostbyaddr_r=undef
13404                 gethostbyaddr_r_proto=0
13405                 ;;
13406         esac
13407         ;;
13408 *)      gethostbyaddr_r_proto=0
13409         ;;
13410 esac
13411
13412 : see if gethostbyname_r exists
13413 set gethostbyname_r d_gethostbyname_r
13414 eval $inlibc
13415 case "$d_gethostbyname_r" in
13416 "$define")
13417         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13418         case "$d_gethostbyname_r_proto:$usethreads" in
13419         ":define")      d_gethostbyname_r_proto=define
13420                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13421                 eval $hasproto ;;
13422         *)      ;;
13423         esac
13424         case "$d_gethostbyname_r_proto" in
13425         define)
13426         case "$gethostbyname_r_proto" in
13427         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13428         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13429         esac
13430         case "$gethostbyname_r_proto" in
13431         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13432         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13433         esac
13434         case "$gethostbyname_r_proto" in
13435         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13436         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13437         esac
13438         case "$gethostbyname_r_proto" in
13439         ''|0)   d_gethostbyname_r=undef
13440                 gethostbyname_r_proto=0
13441                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13442         * )     case "$gethostbyname_r_proto" in
13443                 REENTRANT_PROTO*) ;;
13444                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13445                 esac
13446                 echo "Prototype: $try" ;;
13447         esac
13448         ;;
13449         *)      case "$usethreads" in
13450                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13451                 esac
13452                 d_gethostbyname_r=undef
13453                 gethostbyname_r_proto=0
13454                 ;;
13455         esac
13456         ;;
13457 *)      gethostbyname_r_proto=0
13458         ;;
13459 esac
13460
13461 : see if gethostent_r exists
13462 set gethostent_r d_gethostent_r
13463 eval $inlibc
13464 case "$d_gethostent_r" in
13465 "$define")
13466         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13467         case "$d_gethostent_r_proto:$usethreads" in
13468         ":define")      d_gethostent_r_proto=define
13469                 set d_gethostent_r_proto gethostent_r $hdrs
13470                 eval $hasproto ;;
13471         *)      ;;
13472         esac
13473         case "$d_gethostent_r_proto" in
13474         define)
13475         case "$gethostent_r_proto" in
13476         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13477         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13478         esac
13479         case "$gethostent_r_proto" in
13480         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13481         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13482         esac
13483         case "$gethostent_r_proto" in
13484         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13485         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13486         esac
13487         case "$gethostent_r_proto" in
13488         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13489         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13490         esac
13491         case "$gethostent_r_proto" in
13492         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13493         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13494         esac
13495         case "$gethostent_r_proto" in
13496         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13497         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13498         esac
13499         case "$gethostent_r_proto" in
13500         ''|0)   d_gethostent_r=undef
13501                 gethostent_r_proto=0
13502                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13503         * )     case "$gethostent_r_proto" in
13504                 REENTRANT_PROTO*) ;;
13505                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13506                 esac
13507                 echo "Prototype: $try" ;;
13508         esac
13509         ;;
13510         *)      case "$usethreads" in
13511                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13512                 esac
13513                 d_gethostent_r=undef
13514                 gethostent_r_proto=0
13515                 ;;
13516         esac
13517         ;;
13518 *)      gethostent_r_proto=0
13519         ;;
13520 esac
13521
13522 : see if prototypes for various gethostxxx netdb.h functions are available
13523 echo " "
13524 set d_gethostprotos gethostent $i_netdb netdb.h
13525 eval $hasproto
13526
13527 : see if getitimer exists
13528 set getitimer d_getitimer
13529 eval $inlibc
13530
13531 : see if getlogin exists
13532 set getlogin d_getlogin
13533 eval $inlibc
13534
13535 : see if getlogin_r exists
13536 set getlogin_r d_getlogin_r
13537 eval $inlibc
13538 case "$d_getlogin_r" in
13539 "$define")
13540         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13541         case "$d_getlogin_r_proto:$usethreads" in
13542         ":define")      d_getlogin_r_proto=define
13543                 set d_getlogin_r_proto getlogin_r $hdrs
13544                 eval $hasproto ;;
13545         *)      ;;
13546         esac
13547         case "$d_getlogin_r_proto" in
13548         define)
13549         case "$getlogin_r_proto" in
13550         ''|0) try='int getlogin_r(char*, size_t);'
13551         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13552         esac
13553         case "$getlogin_r_proto" in
13554         ''|0) try='int getlogin_r(char*, int);'
13555         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13556         esac
13557         case "$getlogin_r_proto" in
13558         ''|0) try='char* getlogin_r(char*, size_t);'
13559         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13560         esac
13561         case "$getlogin_r_proto" in
13562         ''|0) try='char* getlogin_r(char*, int);'
13563         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13564         esac
13565         case "$getlogin_r_proto" in
13566         ''|0)   d_getlogin_r=undef
13567                 getlogin_r_proto=0
13568                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13569         * )     case "$getlogin_r_proto" in
13570                 REENTRANT_PROTO*) ;;
13571                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13572                 esac
13573                 echo "Prototype: $try" ;;
13574         esac
13575         ;;
13576         *)      case "$usethreads" in
13577                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13578                 esac
13579                 d_getlogin_r=undef
13580                 getlogin_r_proto=0
13581                 ;;
13582         esac
13583         ;;
13584 *)      getlogin_r_proto=0
13585         ;;
13586 esac
13587
13588 : see if getmnt exists
13589 set getmnt d_getmnt
13590 eval $inlibc
13591
13592 : see if getmntent exists
13593 set getmntent d_getmntent
13594 eval $inlibc
13595
13596 : see if getnetbyaddr exists
13597 set getnetbyaddr d_getnbyaddr
13598 eval $inlibc
13599
13600 : see if getnetbyname exists
13601 set getnetbyname d_getnbyname
13602 eval $inlibc
13603
13604 : see if getnetent exists
13605 set getnetent d_getnent
13606 eval $inlibc
13607
13608 : see if getnetbyaddr_r exists
13609 set getnetbyaddr_r d_getnetbyaddr_r
13610 eval $inlibc
13611 case "$d_getnetbyaddr_r" in
13612 "$define")
13613         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13614         case "$d_getnetbyaddr_r_proto:$usethreads" in
13615         ":define")      d_getnetbyaddr_r_proto=define
13616                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13617                 eval $hasproto ;;
13618         *)      ;;
13619         esac
13620         case "$d_getnetbyaddr_r_proto" in
13621         define)
13622         case "$getnetbyaddr_r_proto" in
13623         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13624         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13625         esac
13626         case "$getnetbyaddr_r_proto" in
13627         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13628         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13629         esac
13630         case "$getnetbyaddr_r_proto" in
13631         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13632         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13633         esac
13634         case "$getnetbyaddr_r_proto" in
13635         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13636         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13637         esac
13638         case "$getnetbyaddr_r_proto" in
13639         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13640         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13641         esac
13642         case "$getnetbyaddr_r_proto" in
13643         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13644         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13645         esac
13646         case "$getnetbyaddr_r_proto" in
13647         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13648         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13649         esac
13650         case "$getnetbyaddr_r_proto" in
13651         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13652         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13653         esac
13654         case "$getnetbyaddr_r_proto" in
13655         ''|0)   d_getnetbyaddr_r=undef
13656                 getnetbyaddr_r_proto=0
13657                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13658         * )     case "$getnetbyaddr_r_proto" in
13659                 REENTRANT_PROTO*) ;;
13660                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13661                 esac
13662                 echo "Prototype: $try" ;;
13663         esac
13664         ;;
13665         *)      case "$usethreads" in
13666                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13667                 esac
13668                 d_getnetbyaddr_r=undef
13669                 getnetbyaddr_r_proto=0
13670                 ;;
13671         esac
13672         ;;
13673 *)      getnetbyaddr_r_proto=0
13674         ;;
13675 esac
13676
13677 : see if getnetbyname_r exists
13678 set getnetbyname_r d_getnetbyname_r
13679 eval $inlibc
13680 case "$d_getnetbyname_r" in
13681 "$define")
13682         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13683         case "$d_getnetbyname_r_proto:$usethreads" in
13684         ":define")      d_getnetbyname_r_proto=define
13685                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13686                 eval $hasproto ;;
13687         *)      ;;
13688         esac
13689         case "$d_getnetbyname_r_proto" in
13690         define)
13691         case "$getnetbyname_r_proto" in
13692         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13693         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13694         esac
13695         case "$getnetbyname_r_proto" in
13696         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13697         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13698         esac
13699         case "$getnetbyname_r_proto" in
13700         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13701         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13702         esac
13703         case "$getnetbyname_r_proto" in
13704         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13705         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13706         esac
13707         case "$getnetbyname_r_proto" in
13708         ''|0)   d_getnetbyname_r=undef
13709                 getnetbyname_r_proto=0
13710                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13711         * )     case "$getnetbyname_r_proto" in
13712                 REENTRANT_PROTO*) ;;
13713                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13714                 esac
13715                 echo "Prototype: $try" ;;
13716         esac
13717         ;;
13718         *)      case "$usethreads" in
13719                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13720                 esac
13721                 d_getnetbyname_r=undef
13722                 getnetbyname_r_proto=0
13723                 ;;
13724         esac
13725         ;;
13726 *)      getnetbyname_r_proto=0
13727         ;;
13728 esac
13729
13730 : see if getnetent_r exists
13731 set getnetent_r d_getnetent_r
13732 eval $inlibc
13733 case "$d_getnetent_r" in
13734 "$define")
13735         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13736         case "$d_getnetent_r_proto:$usethreads" in
13737         ":define")      d_getnetent_r_proto=define
13738                 set d_getnetent_r_proto getnetent_r $hdrs
13739                 eval $hasproto ;;
13740         *)      ;;
13741         esac
13742         case "$d_getnetent_r_proto" in
13743         define)
13744         case "$getnetent_r_proto" in
13745         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13746         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13747         esac
13748         case "$getnetent_r_proto" in
13749         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13750         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13751         esac
13752         case "$getnetent_r_proto" in
13753         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13754         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13755         esac
13756         case "$getnetent_r_proto" in
13757         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13758         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13759         esac
13760         case "$getnetent_r_proto" in
13761         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13762         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13763         esac
13764         case "$getnetent_r_proto" in
13765         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13766         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13767         esac
13768         case "$getnetent_r_proto" in
13769         ''|0)   d_getnetent_r=undef
13770                 getnetent_r_proto=0
13771                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13772         * )     case "$getnetent_r_proto" in
13773                 REENTRANT_PROTO*) ;;
13774                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13775                 esac
13776                 echo "Prototype: $try" ;;
13777         esac
13778         ;;
13779         *)      case "$usethreads" in
13780                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13781                 esac
13782                 d_getnetent_r=undef
13783                 getnetent_r_proto=0
13784                 ;;
13785         esac
13786         ;;
13787 *)      getnetent_r_proto=0
13788         ;;
13789 esac
13790
13791 : see if prototypes for various getnetxxx netdb.h functions are available
13792 echo " "
13793 set d_getnetprotos getnetent $i_netdb netdb.h
13794 eval $hasproto
13795
13796 : see if getpagesize exists
13797 set getpagesize d_getpagsz
13798 eval $inlibc
13799
13800
13801 : see if getprotobyname exists
13802 set getprotobyname d_getpbyname
13803 eval $inlibc
13804
13805 : see if getprotobynumber exists
13806 set getprotobynumber d_getpbynumber
13807 eval $inlibc
13808
13809 : see if getprotoent exists
13810 set getprotoent d_getpent
13811 eval $inlibc
13812
13813 : see if getpgid exists
13814 set getpgid d_getpgid
13815 eval $inlibc
13816
13817 : see if getpgrp2 exists
13818 set getpgrp2 d_getpgrp2
13819 eval $inlibc
13820
13821 : see if getppid exists
13822 set getppid d_getppid
13823 eval $inlibc
13824
13825 : see if getpriority exists
13826 set getpriority d_getprior
13827 eval $inlibc
13828
13829 : see if getprotobyname_r exists
13830 set getprotobyname_r d_getprotobyname_r
13831 eval $inlibc
13832 case "$d_getprotobyname_r" in
13833 "$define")
13834         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13835         case "$d_getprotobyname_r_proto:$usethreads" in
13836         ":define")      d_getprotobyname_r_proto=define
13837                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13838                 eval $hasproto ;;
13839         *)      ;;
13840         esac
13841         case "$d_getprotobyname_r_proto" in
13842         define)
13843         case "$getprotobyname_r_proto" in
13844         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13845         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13846         esac
13847         case "$getprotobyname_r_proto" in
13848         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13849         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13850         esac
13851         case "$getprotobyname_r_proto" in
13852         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13853         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13854         esac
13855         case "$getprotobyname_r_proto" in
13856         ''|0)   d_getprotobyname_r=undef
13857                 getprotobyname_r_proto=0
13858                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13859         * )     case "$getprotobyname_r_proto" in
13860                 REENTRANT_PROTO*) ;;
13861                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13862                 esac
13863                 echo "Prototype: $try" ;;
13864         esac
13865         ;;
13866         *)      case "$usethreads" in
13867                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13868                 esac
13869                 d_getprotobyname_r=undef
13870                 getprotobyname_r_proto=0
13871                 ;;
13872         esac
13873         ;;
13874 *)      getprotobyname_r_proto=0
13875         ;;
13876 esac
13877
13878 : see if getprotobynumber_r exists
13879 set getprotobynumber_r d_getprotobynumber_r
13880 eval $inlibc
13881 case "$d_getprotobynumber_r" in
13882 "$define")
13883         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13884         case "$d_getprotobynumber_r_proto:$usethreads" in
13885         ":define")      d_getprotobynumber_r_proto=define
13886                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13887                 eval $hasproto ;;
13888         *)      ;;
13889         esac
13890         case "$d_getprotobynumber_r_proto" in
13891         define)
13892         case "$getprotobynumber_r_proto" in
13893         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13894         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13895         esac
13896         case "$getprotobynumber_r_proto" in
13897         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13898         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13899         esac
13900         case "$getprotobynumber_r_proto" in
13901         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13902         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13903         esac
13904         case "$getprotobynumber_r_proto" in
13905         ''|0)   d_getprotobynumber_r=undef
13906                 getprotobynumber_r_proto=0
13907                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13908         * )     case "$getprotobynumber_r_proto" in
13909                 REENTRANT_PROTO*) ;;
13910                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13911                 esac
13912                 echo "Prototype: $try" ;;
13913         esac
13914         ;;
13915         *)      case "$usethreads" in
13916                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13917                 esac
13918                 d_getprotobynumber_r=undef
13919                 getprotobynumber_r_proto=0
13920                 ;;
13921         esac
13922         ;;
13923 *)      getprotobynumber_r_proto=0
13924         ;;
13925 esac
13926
13927 : see if getprotoent_r exists
13928 set getprotoent_r d_getprotoent_r
13929 eval $inlibc
13930 case "$d_getprotoent_r" in
13931 "$define")
13932         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13933         case "$d_getprotoent_r_proto:$usethreads" in
13934         ":define")      d_getprotoent_r_proto=define
13935                 set d_getprotoent_r_proto getprotoent_r $hdrs
13936                 eval $hasproto ;;
13937         *)      ;;
13938         esac
13939         case "$d_getprotoent_r_proto" in
13940         define)
13941         case "$getprotoent_r_proto" in
13942         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13943         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13944         esac
13945         case "$getprotoent_r_proto" in
13946         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13947         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13948         esac
13949         case "$getprotoent_r_proto" in
13950         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13951         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13952         esac
13953         case "$getprotoent_r_proto" in
13954         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13955         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13956         esac
13957         case "$getprotoent_r_proto" in
13958         ''|0)   d_getprotoent_r=undef
13959                 getprotoent_r_proto=0
13960                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13961         * )     case "$getprotoent_r_proto" in
13962                 REENTRANT_PROTO*) ;;
13963                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13964                 esac
13965                 echo "Prototype: $try" ;;
13966         esac
13967         ;;
13968         *)      case "$usethreads" in
13969                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13970                 esac
13971                 d_getprotoent_r=undef
13972                 getprotoent_r_proto=0
13973                 ;;
13974         esac
13975         ;;
13976 *)      getprotoent_r_proto=0
13977         ;;
13978 esac
13979
13980 : see if prototypes for various getprotoxxx netdb.h functions are available
13981 echo " "
13982 set d_getprotoprotos getprotoent $i_netdb netdb.h
13983 eval $hasproto
13984
13985 : see if getprpwnam exists
13986 set getprpwnam d_getprpwnam
13987 eval $inlibc
13988
13989 : see if getpwent exists
13990 set getpwent d_getpwent
13991 eval $inlibc
13992
13993 : see if getpwent_r exists
13994 set getpwent_r d_getpwent_r
13995 eval $inlibc
13996 case "$d_getpwent_r" in
13997 "$define")
13998         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13999         case "$d_getpwent_r_proto:$usethreads" in
14000         ":define")      d_getpwent_r_proto=define
14001                 set d_getpwent_r_proto getpwent_r $hdrs
14002                 eval $hasproto ;;
14003         *)      ;;
14004         esac
14005         case "$d_getpwent_r_proto" in
14006         define)
14007         case "$getpwent_r_proto" in
14008         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14009         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14010         esac
14011         case "$getpwent_r_proto" in
14012         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14013         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14014         esac
14015         case "$getpwent_r_proto" in
14016         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14017         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14018         esac
14019         case "$getpwent_r_proto" in
14020         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14021         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14022         esac
14023         case "$getpwent_r_proto" in
14024         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14025         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14026         esac
14027         case "$getpwent_r_proto" in
14028         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14029         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14030         esac
14031         case "$getpwent_r_proto" in
14032         ''|0)   d_getpwent_r=undef
14033                 getpwent_r_proto=0
14034                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14035         * )     case "$getpwent_r_proto" in
14036                 REENTRANT_PROTO*) ;;
14037                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14038                 esac
14039                 echo "Prototype: $try" ;;
14040         esac
14041         ;;
14042         *)      case "$usethreads" in
14043                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14044                 esac
14045                 d_getpwent_r=undef
14046                 getpwent_r_proto=0
14047                 ;;
14048         esac
14049         ;;
14050 *)      getpwent_r_proto=0
14051         ;;
14052 esac
14053
14054 : see if getpwnam_r exists
14055 set getpwnam_r d_getpwnam_r
14056 eval $inlibc
14057 case "$d_getpwnam_r" in
14058 "$define")
14059         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14060         case "$d_getpwnam_r_proto:$usethreads" in
14061         ":define")      d_getpwnam_r_proto=define
14062                 set d_getpwnam_r_proto getpwnam_r $hdrs
14063                 eval $hasproto ;;
14064         *)      ;;
14065         esac
14066         case "$d_getpwnam_r_proto" in
14067         define)
14068         case "$getpwnam_r_proto" in
14069         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14070         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14071         esac
14072         case "$getpwnam_r_proto" in
14073         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14074         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14075         esac
14076         case "$getpwnam_r_proto" in
14077         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14078         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14079         esac
14080         case "$getpwnam_r_proto" in
14081         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14082         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14083         esac
14084         case "$getpwnam_r_proto" in
14085         ''|0)   d_getpwnam_r=undef
14086                 getpwnam_r_proto=0
14087                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14088         * )     case "$getpwnam_r_proto" in
14089                 REENTRANT_PROTO*) ;;
14090                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14091                 esac
14092                 echo "Prototype: $try" ;;
14093         esac
14094         ;;
14095         *)      case "$usethreads" in
14096                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14097                 esac
14098                 d_getpwnam_r=undef
14099                 getpwnam_r_proto=0
14100                 ;;
14101         esac
14102         ;;
14103 *)      getpwnam_r_proto=0
14104         ;;
14105 esac
14106
14107 : see if getpwuid_r exists
14108 set getpwuid_r d_getpwuid_r
14109 eval $inlibc
14110 case "$d_getpwuid_r" in
14111 "$define")
14112         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14113         case "$d_getpwuid_r_proto:$usethreads" in
14114         ":define")      d_getpwuid_r_proto=define
14115                 set d_getpwuid_r_proto getpwuid_r $hdrs
14116                 eval $hasproto ;;
14117         *)      ;;
14118         esac
14119         case "$d_getpwuid_r_proto" in
14120         define)
14121         case "$getpwuid_r_proto" in
14122         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14123         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14124         esac
14125         case "$getpwuid_r_proto" in
14126         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14127         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14128         esac
14129         case "$getpwuid_r_proto" in
14130         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14131         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14132         esac
14133         case "$getpwuid_r_proto" in
14134         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14135         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14136         esac
14137         case "$getpwuid_r_proto" in
14138         ''|0)   d_getpwuid_r=undef
14139                 getpwuid_r_proto=0
14140                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14141         * )     case "$getpwuid_r_proto" in
14142                 REENTRANT_PROTO*) ;;
14143                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14144                 esac
14145                 echo "Prototype: $try" ;;
14146         esac
14147         ;;
14148         *)      case "$usethreads" in
14149                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14150                 esac
14151                 d_getpwuid_r=undef
14152                 getpwuid_r_proto=0
14153                 ;;
14154         esac
14155         ;;
14156 *)      getpwuid_r_proto=0
14157         ;;
14158 esac
14159
14160
14161 : see if getservbyname exists
14162 set getservbyname d_getsbyname
14163 eval $inlibc
14164
14165 : see if getservbyport exists
14166 set getservbyport d_getsbyport
14167 eval $inlibc
14168
14169 : see if getservent exists
14170 set getservent d_getsent
14171 eval $inlibc
14172
14173 : see if getservbyname_r exists
14174 set getservbyname_r d_getservbyname_r
14175 eval $inlibc
14176 case "$d_getservbyname_r" in
14177 "$define")
14178         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14179         case "$d_getservbyname_r_proto:$usethreads" in
14180         ":define")      d_getservbyname_r_proto=define
14181                 set d_getservbyname_r_proto getservbyname_r $hdrs
14182                 eval $hasproto ;;
14183         *)      ;;
14184         esac
14185         case "$d_getservbyname_r_proto" in
14186         define)
14187         case "$getservbyname_r_proto" in
14188         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14189         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14190         esac
14191         case "$getservbyname_r_proto" in
14192         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14193         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14194         esac
14195         case "$getservbyname_r_proto" in
14196         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14197         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14198         esac
14199         case "$getservbyname_r_proto" in
14200         ''|0)   d_getservbyname_r=undef
14201                 getservbyname_r_proto=0
14202                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14203         * )     case "$getservbyname_r_proto" in
14204                 REENTRANT_PROTO*) ;;
14205                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14206                 esac
14207                 echo "Prototype: $try" ;;
14208         esac
14209         ;;
14210         *)      case "$usethreads" in
14211                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14212                 esac
14213                 d_getservbyname_r=undef
14214                 getservbyname_r_proto=0
14215                 ;;
14216         esac
14217         ;;
14218 *)      getservbyname_r_proto=0
14219         ;;
14220 esac
14221
14222 : see if getservbyport_r exists
14223 set getservbyport_r d_getservbyport_r
14224 eval $inlibc
14225 case "$d_getservbyport_r" in
14226 "$define")
14227         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14228         case "$d_getservbyport_r_proto:$usethreads" in
14229         ":define")      d_getservbyport_r_proto=define
14230                 set d_getservbyport_r_proto getservbyport_r $hdrs
14231                 eval $hasproto ;;
14232         *)      ;;
14233         esac
14234         case "$d_getservbyport_r_proto" in
14235         define)
14236         case "$getservbyport_r_proto" in
14237         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14238         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14239         esac
14240         case "$getservbyport_r_proto" in
14241         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14242         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14243         esac
14244         case "$getservbyport_r_proto" in
14245         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14246         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14247         esac
14248         case "$getservbyport_r_proto" in
14249         ''|0)   d_getservbyport_r=undef
14250                 getservbyport_r_proto=0
14251                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14252         * )     case "$getservbyport_r_proto" in
14253                 REENTRANT_PROTO*) ;;
14254                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14255                 esac
14256                 echo "Prototype: $try" ;;
14257         esac
14258         ;;
14259         *)      case "$usethreads" in
14260                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14261                 esac
14262                 d_getservbyport_r=undef
14263                 getservbyport_r_proto=0
14264                 ;;
14265         esac
14266         ;;
14267 *)      getservbyport_r_proto=0
14268         ;;
14269 esac
14270
14271 : see if getservent_r exists
14272 set getservent_r d_getservent_r
14273 eval $inlibc
14274 case "$d_getservent_r" in
14275 "$define")
14276         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14277         case "$d_getservent_r_proto:$usethreads" in
14278         ":define")      d_getservent_r_proto=define
14279                 set d_getservent_r_proto getservent_r $hdrs
14280                 eval $hasproto ;;
14281         *)      ;;
14282         esac
14283         case "$d_getservent_r_proto" in
14284         define)
14285         case "$getservent_r_proto" in
14286         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14287         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14288         esac
14289         case "$getservent_r_proto" in
14290         ''|0) try='int getservent_r(struct servent*, char*, int);'
14291         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14292         esac
14293         case "$getservent_r_proto" in
14294         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14295         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14296         esac
14297         case "$getservent_r_proto" in
14298         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14299         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14300         esac
14301         case "$getservent_r_proto" in
14302         ''|0)   d_getservent_r=undef
14303                 getservent_r_proto=0
14304                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14305         * )     case "$getservent_r_proto" in
14306                 REENTRANT_PROTO*) ;;
14307                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14308                 esac
14309                 echo "Prototype: $try" ;;
14310         esac
14311         ;;
14312         *)      case "$usethreads" in
14313                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14314                 esac
14315                 d_getservent_r=undef
14316                 getservent_r_proto=0
14317                 ;;
14318         esac
14319         ;;
14320 *)      getservent_r_proto=0
14321         ;;
14322 esac
14323
14324 : see if prototypes for various getservxxx netdb.h functions are available
14325 echo " "
14326 set d_getservprotos getservent $i_netdb netdb.h
14327 eval $hasproto
14328
14329 : see if getspnam exists
14330 set getspnam d_getspnam
14331 eval $inlibc
14332
14333 : see if this is a shadow.h system
14334 set shadow.h i_shadow
14335 eval $inhdr
14336
14337 : see if getspnam_r exists
14338 set getspnam_r d_getspnam_r
14339 eval $inlibc
14340 case "$d_getspnam_r" in
14341 "$define")
14342         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14343         case "$d_getspnam_r_proto:$usethreads" in
14344         ":define")      d_getspnam_r_proto=define
14345                 set d_getspnam_r_proto getspnam_r $hdrs
14346                 eval $hasproto ;;
14347         *)      ;;
14348         esac
14349         case "$d_getspnam_r_proto" in
14350         define)
14351         case "$getspnam_r_proto" in
14352         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14353         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14354         esac
14355         case "$getspnam_r_proto" in
14356         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14357         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14358         esac
14359         case "$getspnam_r_proto" in
14360         ''|0)   d_getspnam_r=undef
14361                 getspnam_r_proto=0
14362                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14363         * )     case "$getspnam_r_proto" in
14364                 REENTRANT_PROTO*) ;;
14365                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14366                 esac
14367                 echo "Prototype: $try" ;;
14368         esac
14369         ;;
14370         *)      case "$usethreads" in
14371                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14372                 esac
14373                 d_getspnam_r=undef
14374                 getspnam_r_proto=0
14375                 ;;
14376         esac
14377         ;;
14378 *)      getspnam_r_proto=0
14379         ;;
14380 esac
14381
14382 : see if gettimeofday or ftime exists
14383 set gettimeofday d_gettimeod
14384 eval $inlibc
14385 case "$d_gettimeod" in
14386 "$undef")
14387         set ftime d_ftime 
14388         eval $inlibc
14389         ;;
14390 *)
14391         val="$undef"; set d_ftime; eval $setvar
14392         ;;
14393 esac
14394 case "$d_gettimeod$d_ftime" in
14395 "$undef$undef")
14396         echo " "
14397         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14398         ;;
14399 esac
14400
14401 : see if gmtime_r exists
14402 set gmtime_r d_gmtime_r
14403 eval $inlibc
14404 case "$d_gmtime_r" in
14405 "$define")
14406         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14407         case "$d_gmtime_r_proto:$usethreads" in
14408         ":define")      d_gmtime_r_proto=define
14409                 set d_gmtime_r_proto gmtime_r $hdrs
14410                 eval $hasproto ;;
14411         *)      ;;
14412         esac
14413         case "$d_gmtime_r_proto" in
14414         define)
14415         case "$gmtime_r_proto" in
14416         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14417         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14418         esac
14419         case "$gmtime_r_proto" in
14420         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14421         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14422         esac
14423         case "$gmtime_r_proto" in
14424         ''|0)   d_gmtime_r=undef
14425                 gmtime_r_proto=0
14426                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14427         * )     case "$gmtime_r_proto" in
14428                 REENTRANT_PROTO*) ;;
14429                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14430                 esac
14431                 echo "Prototype: $try" ;;
14432         esac
14433         ;;
14434         *)      case "$usethreads" in
14435                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14436                 esac
14437                 d_gmtime_r=undef
14438                 gmtime_r_proto=0
14439                 ;;
14440         esac
14441         ;;
14442 *)      gmtime_r_proto=0
14443         ;;
14444 esac
14445
14446 : see if hasmntopt exists
14447 set hasmntopt d_hasmntopt
14448 eval $inlibc
14449
14450 : see if this is a netinet/in.h or sys/in.h system
14451 set netinet/in.h i_niin sys/in.h i_sysin
14452 eval $inhdr
14453
14454 : see if arpa/inet.h has to be included
14455 set arpa/inet.h i_arpainet
14456 eval $inhdr
14457
14458 : see if htonl --and friends-- exists
14459 val=''
14460 set htonl val
14461 eval $inlibc
14462
14463 : Maybe they are macros.
14464 case "$val" in
14465 $undef)
14466         $cat >htonl.c <<EOM
14467 #include <stdio.h>
14468 #include <sys/types.h>
14469 #$i_niin I_NETINET_IN
14470 #$i_sysin I_SYS_IN
14471 #$i_arpainet I_ARPA_INET
14472 #ifdef I_NETINET_IN
14473 #include <netinet/in.h>
14474 #endif
14475 #ifdef I_SYS_IN
14476 #include <sys/in.h>
14477 #endif
14478 #ifdef I_ARPA_INET
14479 #include <arpa/inet.h>
14480 #endif
14481 #ifdef htonl
14482 printf("Defined as a macro.");
14483 #endif
14484 EOM
14485         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14486         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14487                 val="$define"
14488                 echo "But it seems to be defined as a macro." >&4
14489         fi
14490         $rm -f htonl.?
14491         ;;
14492 esac
14493 set d_htonl
14494 eval $setvar
14495
14496 : see if ilogbl exists
14497 set ilogbl d_ilogbl
14498 eval $inlibc
14499
14500 : index or strchr
14501 echo " "
14502 if set index val -f; eval $csym; $val; then
14503         if set strchr val -f d_strchr; eval $csym; $val; then
14504                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14505                         val="$define"
14506                         vali="$undef"
14507                         echo "strchr() found." >&4
14508                 else
14509                         val="$undef"
14510                         vali="$define"
14511                         echo "index() found." >&4
14512                 fi
14513         else
14514                 val="$undef"
14515                 vali="$define"
14516                 echo "index() found." >&4
14517         fi
14518 else
14519         if set strchr val -f d_strchr; eval $csym; $val; then
14520                 val="$define"
14521                 vali="$undef"
14522                 echo "strchr() found." >&4
14523         else
14524                 echo "No index() or strchr() found!" >&4
14525                 val="$undef"
14526                 vali="$undef"
14527         fi
14528 fi
14529 set d_strchr; eval $setvar
14530 val="$vali"
14531 set d_index; eval $setvar
14532
14533 : check whether inet_aton exists
14534 set inet_aton d_inetaton
14535 eval $inlibc
14536
14537 : Look for isascii
14538 echo " "
14539 $cat >isascii.c <<EOCP
14540 #include <stdio.h>
14541 #include <ctype.h>
14542 #$i_stdlib I_STDLIB
14543 #ifdef I_STDLIB
14544 #include <stdlib.h>
14545 #endif
14546 int main() {
14547         int c = 'A';
14548         if (isascii(c))
14549                 exit(0);
14550         else
14551                 exit(1);
14552 }
14553 EOCP
14554 set isascii
14555 if eval $compile; then
14556         echo "isascii() found." >&4
14557         val="$define"
14558 else
14559         echo "isascii() NOT found." >&4
14560         val="$undef"
14561 fi
14562 set d_isascii
14563 eval $setvar
14564 $rm -f isascii*
14565
14566 : see if isfinite exists
14567 set isfinite d_isfinite
14568 eval $inlibc
14569
14570 : see if isinf exists
14571 set isinf d_isinf
14572 eval $inlibc
14573
14574 : see if isnan exists
14575 set isnan d_isnan
14576 eval $inlibc
14577
14578 : see if isnanl exists
14579 set isnanl d_isnanl
14580 eval $inlibc
14581
14582 : see if killpg exists
14583 set killpg d_killpg
14584 eval $inlibc
14585
14586 : see if lchown exists
14587 echo " "
14588 $cat > try.c <<'EOCP'
14589 /* System header to define __stub macros and hopefully few prototypes,
14590     which can conflict with char lchown(); below.  */
14591 #include <assert.h>
14592 /* Override any gcc2 internal prototype to avoid an error.  */
14593 /* We use char because int might match the return type of a gcc2
14594    builtin and then its argument prototype would still apply.  */
14595 char lchown();
14596 int main() {
14597     /*  The GNU C library defines this for functions which it implements
14598         to always fail with ENOSYS.  Some functions are actually named
14599         something starting with __ and the normal name is an alias.  */
14600 #if defined (__stub_lchown) || defined (__stub___lchown)
14601 choke me
14602 #else
14603 lchown();
14604 #endif
14605 ; return 0; }
14606 EOCP
14607 set try
14608 if eval $compile; then
14609     $echo "lchown() found." >&4
14610     val="$define"
14611 else
14612     $echo "lchown() NOT found." >&4
14613     val="$undef"
14614 fi
14615 set d_lchown
14616 eval $setvar
14617
14618 : See if number of significant digits in a double precision number is known
14619 echo " "
14620 $cat >ldbl_dig.c <<EOM
14621 #$i_limits I_LIMITS
14622 #$i_float I_FLOAT
14623 #ifdef I_LIMITS
14624 #include <limits.h>
14625 #endif
14626 #ifdef I_FLOAT
14627 #include <float.h>
14628 #endif
14629 #ifdef LDBL_DIG
14630 printf("Contains LDBL_DIG");
14631 #endif
14632 EOM
14633 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14634 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14635         echo "LDBL_DIG found." >&4
14636         val="$define"
14637 else
14638         echo "LDBL_DIG NOT found." >&4
14639         val="$undef"
14640 fi
14641 $rm -f ldbl_dig.?
14642 set d_ldbl_dig
14643 eval $setvar
14644
14645 : see if this is a math.h system
14646 set math.h i_math
14647 eval $inhdr
14648
14649 d_libm_lib_version="$undef"
14650 case $i_math in
14651     $define)
14652         : check to see if math.h defines _LIB_VERSION
14653         echo " "
14654         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14655         $cat >try.c <<EOCP
14656 #include <unistd.h>
14657 #include <math.h>
14658 int main (int argc, char *argv[])
14659 {
14660     printf ("%d\n", _LIB_VERSION);
14661     return (0);
14662     } /* main */
14663 EOCP
14664         set try
14665         if eval $compile; then
14666             foo=`$run ./try`
14667             echo "Yes, it does ($foo)" >&4
14668             d_libm_lib_version="$define"
14669         else
14670             echo "No, it does not (probably harmless)" >&4
14671             fi
14672         $rm_try
14673         ;;
14674
14675     esac
14676
14677 : see if link exists
14678 set link d_link
14679 eval $inlibc
14680
14681 : see if localtime_r exists
14682 set localtime_r d_localtime_r
14683 eval $inlibc
14684 case "$d_localtime_r" in
14685 "$define")
14686         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14687         case "$d_localtime_r_proto:$usethreads" in
14688         ":define")      d_localtime_r_proto=define
14689                 set d_localtime_r_proto localtime_r $hdrs
14690                 eval $hasproto ;;
14691         *)      ;;
14692         esac
14693         case "$d_localtime_r_proto" in
14694         define)
14695         case "$localtime_r_proto" in
14696         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14697         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14698         esac
14699         case "$localtime_r_proto" in
14700         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14701         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14702         esac
14703         case "$localtime_r_proto" in
14704         ''|0)   d_localtime_r=undef
14705                 localtime_r_proto=0
14706                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14707         * )     case "$localtime_r_proto" in
14708                 REENTRANT_PROTO*) ;;
14709                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14710                 esac
14711                 echo "Prototype: $try" ;;
14712         esac
14713         ;;
14714         *)      case "$usethreads" in
14715                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14716                 esac
14717                 d_localtime_r=undef
14718                 localtime_r_proto=0
14719                 ;;
14720         esac
14721         ;;
14722 *)      localtime_r_proto=0
14723         ;;
14724 esac
14725
14726 : see if localtime_r calls tzset
14727 case "$localtime_r_proto" in
14728 REENTRANT_PROTO*)
14729         $cat >try.c <<EOCP
14730 /*  Does our libc's localtime_r call tzset ?
14731  *  return 0 if so, 1 otherwise.
14732  */
14733 #include <sys/types.h>
14734 #include <unistd.h>
14735 #include <time.h>
14736 #include <string.h>
14737 #include <malloc.h>
14738 int main()
14739 {
14740     time_t t = time(0L);
14741     char w_tz[]="TZ" "=GMT+5",
14742          e_tz[]="TZ" "=GMT-5",
14743         *tz_e = (char*)malloc(16),
14744         *tz_w = (char*)malloc(16);
14745     struct tm tm_e, tm_w;
14746     memset(&tm_e,'\0',sizeof(struct tm));
14747     memset(&tm_w,'\0',sizeof(struct tm));
14748     strcpy(tz_e,e_tz);
14749     strcpy(tz_w,w_tz);
14750
14751     putenv(tz_e);
14752     localtime_r(&t, &tm_e);
14753
14754     putenv(tz_w);
14755     localtime_r(&t, &tm_w);
14756
14757     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14758         return 1;
14759     return 0;
14760 }
14761 EOCP
14762         set try
14763         if eval $compile; then
14764             if $run ./try; then
14765                 d_localtime_r_needs_tzset=undef;
14766             else
14767                 d_localtime_r_needs_tzset=define;
14768             fi;
14769         else
14770             d_localtime_r_needs_tzset=undef;
14771         fi;
14772      ;;
14773   *)
14774      d_localtime_r_needs_tzset=undef;
14775      ;;
14776 esac
14777 $rm_try
14778
14779 : see if localeconv exists
14780 set localeconv d_locconv
14781 eval $inlibc
14782
14783 : see if lockf exists
14784 set lockf d_lockf
14785 eval $inlibc
14786
14787 : see if prototype for lseek is available
14788 echo " "
14789 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14790 eval $hasproto
14791
14792 : see if lstat exists
14793 set lstat d_lstat
14794 eval $inlibc
14795
14796 : see if madvise exists
14797 set madvise d_madvise
14798 eval $inlibc
14799
14800 : see if malloc_size exists
14801 set malloc_size d_malloc_size
14802 eval $inlibc
14803
14804 : see if malloc_size_good exists
14805 set malloc_good_size d_malloc_good_size
14806 eval $inlibc
14807
14808 : see if mblen exists
14809 set mblen d_mblen
14810 eval $inlibc
14811
14812 : see if mbstowcs exists
14813 set mbstowcs d_mbstowcs
14814 eval $inlibc
14815
14816 : see if mbtowc exists
14817 set mbtowc d_mbtowc
14818 eval $inlibc
14819
14820 : see if memchr exists
14821 set memchr d_memchr
14822 eval $inlibc
14823
14824 : see if memcmp exists
14825 set memcmp d_memcmp
14826 eval $inlibc
14827
14828 : see if memcpy exists
14829 set memcpy d_memcpy
14830 eval $inlibc
14831
14832 : see if memmove exists
14833 set memmove d_memmove
14834 eval $inlibc
14835
14836 : see if memset exists
14837 set memset d_memset
14838 eval $inlibc
14839
14840 : see if mkdir exists
14841 set mkdir d_mkdir
14842 eval $inlibc
14843
14844 : see if mkdtemp exists
14845 set mkdtemp d_mkdtemp
14846 eval $inlibc
14847
14848 : see if mkfifo exists
14849 set mkfifo d_mkfifo
14850 eval $inlibc
14851
14852 : see if mkstemp exists
14853 set mkstemp d_mkstemp
14854 eval $inlibc
14855
14856 : see if mkstemps exists
14857 set mkstemps d_mkstemps
14858 eval $inlibc
14859
14860 : see if mktime exists
14861 set mktime d_mktime
14862 eval $inlibc
14863
14864 : see if this is a sys/mman.h system
14865 set sys/mman.h i_sysmman
14866 eval $inhdr
14867
14868 : see if mmap exists
14869 set mmap d_mmap
14870 eval $inlibc
14871 : see what shmat returns
14872 : default to something harmless
14873 mmaptype='void *'
14874 case "$i_sysmman$d_mmap" in
14875 "$define$define")
14876         $cat >mmap.c <<'END'
14877 #include <sys/mman.h>
14878 void *mmap();
14879 END
14880         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14881                 mmaptype='void *'
14882         else
14883                 mmaptype='caddr_t'
14884         fi
14885         echo "and it returns ($mmaptype)." >&4
14886         ;;
14887 esac
14888
14889
14890
14891 : see if sqrtl exists
14892 set sqrtl d_sqrtl
14893 eval $inlibc
14894
14895 : see if scalbnl exists
14896 set scalbnl d_scalbnl
14897 eval $inlibc
14898
14899 : see if modfl exists
14900 set modfl d_modfl
14901 eval $inlibc
14902
14903 : see if prototype for modfl is available
14904 echo " "
14905 set d_modflproto modfl $i_math math.h
14906 eval $hasproto
14907
14908 d_modfl_pow32_bug="$undef"
14909
14910 case "$d_longdbl$d_modfl" in
14911 $define$define)
14912         $cat <<EOM
14913 Checking to see whether your modfl() is okay for large values...
14914 EOM
14915 $cat >try.c <<EOCP
14916 #include <math.h>
14917 #include <stdio.h>
14918 EOCP
14919 if $test "X$d_modflproto" != "X$define"; then
14920         $cat >>try.c <<EOCP
14921 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14922 long double modfl (long double, long double *);
14923 EOCP
14924 fi
14925 $cat >>try.c <<EOCP
14926 int main() {
14927     long double nv = 4294967303.15;
14928     long double v, w;
14929     v = modfl(nv, &w);
14930 #ifdef __GLIBC__
14931     printf("glibc");
14932 #endif
14933     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14934     return 0;
14935 }
14936 EOCP
14937         case "$osname:$gccversion" in
14938         aix:)   saveccflags="$ccflags"
14939                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14940         esac
14941         set try
14942         if eval $compile; then
14943                 foo=`$run ./try`
14944                 case "$foo" in
14945                 *" 4294967303.150000 1.150000 4294967302.000000")
14946                         echo >&4 "Your modfl() is broken for large values."
14947                         d_modfl_pow32_bug="$define"
14948                         case "$foo" in
14949                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14950                         ;;
14951                         esac
14952                         ;;
14953                 *" 4294967303.150000 0.150000 4294967303.000000")
14954                         echo >&4 "Your modfl() seems okay for large values."
14955                         ;;
14956                 *)      echo >&4 "I don't understand your modfl() at all."
14957                         d_modfl="$undef"
14958                         ;;
14959                 esac
14960                 $rm_try
14961         else
14962                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14963                 d_modfl="$undef"
14964         fi
14965         case "$osname:$gccversion" in
14966         aix:)   ccflags="$saveccflags" ;; # restore
14967         esac
14968         ;;
14969 esac
14970
14971 if $test "$uselongdouble" = "$define"; then
14972     message=""
14973     if $test "$d_sqrtl" != "$define"; then
14974         message="$message sqrtl"
14975     fi
14976     if $test "$d_modfl" != "$define"; then
14977         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14978             echo "You have both aintl and copysignl, so I can emulate modfl."
14979         else
14980             message="$message modfl"
14981         fi
14982     fi
14983     if $test "$d_frexpl" != "$define"; then
14984         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14985             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14986         else
14987             message="$message frexpl"
14988         fi
14989     fi
14990
14991     if $test "$message" != ""; then
14992         $cat <<EOM >&4
14993
14994 *** You requested the use of long doubles but you do not seem to have
14995 *** the following mathematical functions needed for long double support:
14996 ***    $message
14997 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14998 *** Cannot continue, aborting.
14999
15000 EOM
15001
15002         exit 1
15003     fi
15004 fi
15005
15006 : see if mprotect exists
15007 set mprotect d_mprotect
15008 eval $inlibc
15009
15010 : see if msgctl exists
15011 set msgctl d_msgctl
15012 eval $inlibc
15013
15014 : see if msgget exists
15015 set msgget d_msgget
15016 eval $inlibc
15017
15018 : see if msgsnd exists
15019 set msgsnd d_msgsnd
15020 eval $inlibc
15021
15022 : see if msgrcv exists
15023 set msgrcv d_msgrcv
15024 eval $inlibc
15025
15026 : see how much of the 'msg*(2)' library is present.
15027 h_msg=true
15028 echo " "
15029 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15030 *"$undef"*) h_msg=false;;
15031 esac
15032 case "$osname" in
15033 freebsd)
15034     case "`ipcs 2>&1`" in
15035     "SVID messages"*"not configured"*)
15036         echo "Your $osname does not have the msg*(2) configured." >&4
15037         h_msg=false
15038         val="$undef"
15039         set msgctl d_msgctl
15040         eval $setvar
15041         set msgget d_msgget
15042         eval $setvar
15043         set msgsnd d_msgsnd
15044         eval $setvar
15045         set msgrcv d_msgrcv
15046         eval $setvar
15047         ;;
15048     esac
15049     ;;
15050 esac
15051 : we could also check for sys/ipc.h ...
15052 if $h_msg && $test `./findhdr sys/msg.h`; then
15053         echo "You have the full msg*(2) library." >&4
15054         val="$define"
15055 else
15056         echo "You don't have the full msg*(2) library." >&4
15057         val="$undef"
15058 fi
15059 set d_msg
15060 eval $setvar
15061
15062
15063 echo " "
15064 echo "Checking to see if your system supports struct msghdr..." >&4
15065 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15066 eval $hasstruct
15067 case "$d_msghdr_s" in
15068 "$define")      echo "Yes, it does."   ;;
15069 *)              echo "No, it doesn't." ;;
15070 esac
15071
15072
15073 : see if msync exists
15074 set msync d_msync
15075 eval $inlibc
15076
15077 : see if munmap exists
15078 set munmap d_munmap
15079 eval $inlibc
15080
15081 : see if nice exists
15082 set nice d_nice
15083 eval $inlibc
15084
15085 : see if this is a langinfo.h system
15086 set langinfo.h i_langinfo
15087 eval $inhdr
15088
15089 : see if nl_langinfo exists
15090 set nl_langinfo d_nl_langinfo
15091 eval $inlibc
15092
15093 : check for length of character
15094 echo " "
15095 case "$charsize" in
15096 '')
15097         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15098         $cat >try.c <<EOCP
15099 #include <stdio.h>
15100 #$i_stdlib I_STDLIB
15101 #ifdef I_STDLIB
15102 #include <stdlib.h>
15103 #endif
15104 int main()
15105 {
15106     printf("%d\n", (int)sizeof(char));
15107     exit(0);
15108 }
15109 EOCP
15110         set try
15111         if eval $compile_ok; then
15112                 dflt=`$run ./try`
15113         else
15114                 dflt='1'
15115                 echo "(I can't seem to compile the test program.  Guessing...)"
15116         fi
15117         ;;
15118 *)
15119         dflt="$charsize"
15120         ;;
15121 esac
15122 rp="What is the size of a character (in bytes)?"
15123 . ./myread
15124 charsize="$ans"
15125 $rm_try
15126
15127 : check for volatile keyword
15128 echo " "
15129 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15130 $cat >try.c <<'EOCP'
15131 int main()
15132 {
15133         typedef struct _goo_struct goo_struct;
15134         goo_struct * volatile goo = ((goo_struct *)0);
15135         struct _goo_struct {
15136                 long long_int;
15137                 int reg_int;
15138                 char char_var;
15139         };
15140         typedef unsigned short foo_t;
15141         char *volatile foo;
15142         volatile int bar;
15143         volatile foo_t blech;
15144         foo = foo;
15145 }
15146 EOCP
15147 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15148         val="$define"
15149         echo "Yup, it does."
15150 else
15151         val="$undef"
15152         echo "Nope, it doesn't."
15153 fi
15154 set d_volatile
15155 eval $setvar
15156 $rm_try
15157
15158
15159 echo " "
15160 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15161
15162 case "$use64bitint:$d_quad:$quadtype" in
15163 define:define:?*)
15164         ivtype="$quadtype"
15165         uvtype="$uquadtype"
15166         ivsize=8
15167         uvsize=8
15168         ;;
15169 *)      ivtype="long"
15170         uvtype="unsigned long"
15171         ivsize=$longsize
15172         uvsize=$longsize
15173         ;;
15174 esac
15175
15176 case "$uselongdouble:$d_longdbl" in
15177 define:define)
15178         nvtype="long double"
15179         nvsize=$longdblsize
15180         ;;
15181 *)      nvtype=double
15182         nvsize=$doublesize
15183         ;;
15184 esac
15185
15186 $echo "(IV will be "$ivtype", $ivsize bytes)"
15187 $echo "(UV will be "$uvtype", $uvsize bytes)"
15188 $echo "(NV will be "$nvtype", $nvsize bytes)"
15189
15190 $cat >try.c <<EOCP
15191 #$i_inttypes I_INTTYPES
15192 #ifdef I_INTTYPES
15193 #include <inttypes.h>
15194 #endif
15195 #include <stdio.h>
15196 int main() {
15197 #ifdef INT8
15198    int8_t i =  INT8_MAX;
15199   uint8_t u = UINT8_MAX;
15200   printf("int8_t\n");
15201 #endif
15202 #ifdef INT16
15203    int16_t i =  INT16_MAX;
15204   uint16_t i = UINT16_MAX;
15205   printf("int16_t\n");
15206 #endif
15207 #ifdef INT32
15208    int32_t i =  INT32_MAX;
15209   uint32_t u = UINT32_MAX;
15210   printf("int32_t\n");
15211 #endif
15212 }
15213 EOCP
15214
15215 case "$i8type" in
15216 '')     case "$charsize" in
15217         1)      i8type=char
15218                 u8type="unsigned char"
15219                 i8size=$charsize
15220                 u8size=$charsize
15221                 ;;
15222         esac
15223         ;;
15224 esac
15225 case "$i8type" in
15226 '')     set try -DINT8
15227         if eval $compile; then
15228                 case "`$run ./try`" in
15229                 int8_t) i8type=int8_t
15230                         u8type=uint8_t
15231                         i8size=1
15232                         u8size=1
15233                         ;;
15234                 esac
15235         fi
15236         ;;
15237 esac
15238 case "$i8type" in
15239 '')     if $test $charsize -ge 1; then
15240                 i8type=char
15241                 u8type="unsigned char"
15242                 i8size=$charsize
15243                 u8size=$charsize
15244         fi
15245         ;;
15246 esac
15247
15248 case "$i16type" in
15249 '')     case "$shortsize" in
15250         2)      i16type=short
15251                 u16type="unsigned short"
15252                 i16size=$shortsize
15253                 u16size=$shortsize
15254                 ;;
15255         esac
15256         ;;
15257 esac
15258 case "$i16type" in
15259 '')     set try -DINT16
15260         if eval $compile; then
15261                 case "`$run ./try`" in
15262                 int16_t)
15263                         i16type=int16_t
15264                         u16type=uint16_t
15265                         i16size=2
15266                         u16size=2
15267                         ;;
15268                 esac
15269         fi
15270         ;;
15271 esac
15272 case "$i16type" in
15273 '')     if $test $shortsize -ge 2; then
15274                 i16type=short
15275                 u16type="unsigned short"
15276                 i16size=$shortsize
15277                 u16size=$shortsize
15278         fi
15279         ;;
15280 esac
15281
15282 case "$i32type" in
15283 '')     case "$longsize" in
15284         4)      i32type=long
15285                 u32type="unsigned long"
15286                 i32size=$longsize
15287                 u32size=$longsize
15288                 ;;
15289         *)      case "$intsize" in
15290                 4)      i32type=int
15291                         u32type="unsigned int"
15292                         i32size=$intsize
15293                         u32size=$intsize
15294                         ;;
15295                 esac
15296                 ;;
15297         esac
15298         ;;
15299 esac
15300 case "$i32type" in
15301 '')     set try -DINT32
15302         if eval $compile; then
15303                 case "`$run ./try`" in
15304                 int32_t)
15305                         i32type=int32_t
15306                         u32type=uint32_t
15307                         i32size=4
15308                         u32size=4
15309                         ;;
15310                 esac
15311         fi
15312         ;;
15313 esac
15314 case "$i32type" in
15315 '')     if $test $intsize -ge 4; then
15316                 i32type=int
15317                 u32type="unsigned int"
15318                 i32size=$intsize
15319                 u32size=$intsize
15320         fi
15321         ;;
15322 esac
15323
15324 case "$i64type" in
15325 '')     case "$d_quad:$quadtype" in
15326         define:?*)
15327                 i64type="$quadtype"
15328                 u64type="$uquadtype"
15329                 i64size=8
15330                 u64size=8
15331                 ;;
15332         esac
15333         ;;
15334 esac
15335
15336 $echo "Checking how many bits of your UVs your NVs can preserve..." >&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 #include <sys/types.h>
15348 #include <signal.h>
15349 #ifdef SIGFPE
15350 $volatile int bletched = 0;
15351 $signal_t blech(int s) { bletched = 1; }
15352 #endif
15353 int main() {
15354     $uvtype u = 0;
15355     $nvtype d;
15356     int     n = 8 * $uvsize;
15357     int     i;
15358 #ifdef SIGFPE
15359     signal(SIGFPE, blech);
15360 #endif
15361
15362     for (i = 0; i < n; i++) {
15363       u = u << 1 | ($uvtype)1;
15364       d = ($nvtype)u;
15365       if (($uvtype)d != u)
15366         break;
15367       if (d <= 0)
15368         break;
15369       d = ($nvtype)(u - 1);
15370       if (($uvtype)d != (u - 1))
15371         break;
15372 #ifdef SIGFPE
15373       if (bletched)
15374         break;
15375 #endif
15376     }
15377     printf("%d\n", ((i == n) ? -n : i));
15378     exit(0);
15379 }
15380 EOP
15381 set try
15382
15383 d_nv_preserves_uv="$undef"
15384 if eval $compile; then
15385         nv_preserves_uv_bits="`$run ./try`"
15386 fi
15387 case "$nv_preserves_uv_bits" in
15388 \-[1-9]*)
15389         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15390         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15391         d_nv_preserves_uv="$define"
15392         ;;
15393 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15394         d_nv_preserves_uv="$undef" ;;
15395 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15396         nv_preserves_uv_bits="0" ;;
15397 esac
15398 $rm_try
15399
15400 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15401 : volatile so that the compiler has to store it out to memory.
15402 if test X"$d_volatile" = X"$define"; then
15403         volatile=volatile
15404 fi
15405 $cat <<EOP >try.c
15406 #include <stdio.h>
15407 #$i_stdlib I_STDLIB
15408 #ifdef I_STDLIB
15409 #include <stdlib.h>
15410 #endif
15411 #$i_string I_STRING
15412 #ifdef I_STRING
15413 #  include <string.h>
15414 #else
15415 #  include <strings.h>
15416 #endif
15417 #include <sys/types.h>
15418 #include <signal.h>
15419 #ifdef SIGFPE
15420 $volatile int bletched = 0;
15421 $signal_t blech(int s) { bletched = 1; }
15422 #endif
15423
15424 int checkit($nvtype d, char *where) {
15425     unsigned char *p = (char *)&d;
15426     unsigned char *end = p + sizeof(d);
15427     int fail = 0;
15428
15429     while (p < end)
15430         fail += *p++;
15431
15432     if (!fail)
15433         return 0;
15434
15435     p = (char *)&d;
15436     printf("No - %s: 0x", where);
15437     while (p < end)
15438         printf ("%02X", *p++);
15439     printf("\n");
15440     return 1;
15441 }
15442
15443 int main(int argc, char **argv) {
15444     $nvtype d = 0.0;
15445     int fail = 0;
15446     fail += checkit(d, "0.0");
15447
15448     /* The compiler shouldn't be assuming that bletched is 0  */
15449     d = bletched;
15450
15451     fail += checkit(d, "bleched");
15452
15453 #ifdef SIGFPE
15454     signal(SIGFPE, blech);
15455 #endif
15456
15457     /* Paranoia - the compiler should have no way of knowing that ANSI says
15458        that argv[argc] will always be NULL.  Actually, if it did assume this it
15459        would be buggy, as this is C and main() can be called from elsewhere in
15460        the program.  */
15461     d = argv[argc] ? 1 : 0;
15462
15463     if (d) {
15464         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15465     }
15466
15467     fail += checkit(d, "ternary");
15468
15469     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15470
15471     if (d != 0.0) {
15472         printf("No - memset doesn't give 0.0\n");
15473         /* This might just blow up:  */
15474         printf("(gives %g)\n", d);
15475         return 1;
15476     }
15477
15478 #ifdef SIGFPE
15479     if (bletched) {
15480         printf("No - something bleched\n");
15481         return 1;
15482     }
15483 #endif
15484     if (fail) {
15485       printf("No - %d fail(s)\n", fail);
15486       return 1;
15487     }
15488     printf("Yes\n");
15489     return 0;
15490 }
15491 EOP
15492 set try
15493
15494 d_nv_zero_is_allbits_zero="$undef"
15495 if eval $compile; then
15496     xxx="`$run ./try`"
15497     case "$?" in
15498         0)
15499             case "$xxx" in
15500                 Yes)  cat >&4 <<EOM
15501 0.0 is represented as all bits zero in memory
15502 EOM
15503                     d_nv_zero_is_allbits_zero="$define"
15504                     ;;
15505                 *)  cat >&4 <<EOM
15506 0.0 is not represented as all bits zero in memory
15507 EOM
15508                     d_nv_zero_is_allbits_zero="$undef"
15509                     ;;
15510             esac
15511             ;;
15512         *)  cat >&4 <<EOM
15513 0.0 is not represented as all bits zero in memory
15514 EOM
15515             d_nv_zero_is_allbits_zero="$undef"
15516             ;;
15517     esac
15518 fi
15519 $rm_try
15520
15521 : check for off64_t
15522 echo " "
15523 echo "Checking to see if you have off64_t..." >&4
15524 $cat >try.c <<EOCP
15525 #include <sys/types.h>
15526 #include <unistd.h>
15527 int main() { off64_t x = 7; }
15528 EOCP
15529 set try
15530 if eval $compile; then
15531         val="$define"
15532         echo "You have off64_t."
15533 else
15534         val="$undef"
15535         echo "You do not have off64_t."
15536         case "$lseeksize" in
15537         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15538         esac
15539 fi
15540 $rm_try
15541 set d_off64_t
15542 eval $setvar
15543
15544 : how to create joinable pthreads
15545 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15546         echo " "
15547         echo "Checking what constant to use for creating joinable pthreads..." >&4
15548         $cat >try.c <<'EOCP'
15549 #include <pthread.h>
15550 int main() {
15551     int detachstate = JOINABLE;
15552 }
15553 EOCP
15554         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15555         if eval $compile; then
15556                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15557                 val="$undef" # Yes, undef.
15558                 set d_old_pthread_create_joinable
15559                 eval $setvar
15560                 val=""
15561                 set old_pthread_create_joinable
15562                 eval $setvar
15563         else
15564                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15565                 if eval $compile; then
15566                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15567                         val="$define"
15568                         set d_old_pthread_create_joinable
15569                         eval $setvar
15570                         val=PTHREAD_CREATE_UNDETACHED
15571                         set old_pthread_create_joinable
15572                         eval $setvar
15573                 else
15574                         set try -DJOINABLE=__UNDETACHED
15575                         if eval $compile; then
15576                                 echo "You seem to use __UNDETACHED." >&4
15577                                 val="$define"
15578                                 set d_old_pthread_create_joinable
15579                                 eval $setvar
15580                                 val=__UNDETACHED
15581                                 set old_pthread_create_joinable
15582                                 eval $setvar
15583                         else
15584                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15585                                 val="$define"
15586                                 set d_old_pthread_create_joinable
15587                                 eval $setvar
15588                                 val=0
15589                                 set old_pthread_create_joinable
15590                                 eval $setvar
15591                         fi
15592                 fi
15593         fi
15594         $rm_try
15595 else
15596     d_old_pthread_create_joinable="$undef"
15597     old_pthread_create_joinable=""
15598 fi
15599
15600 : see if pause exists
15601 set pause d_pause
15602 eval $inlibc
15603
15604 : see if poll exists
15605 set poll d_poll
15606 eval $inlibc
15607
15608 : see if readlink exists
15609 set readlink d_readlink
15610 eval $inlibc
15611
15612 echo " "
15613 procselfexe=''
15614 val="$undef"
15615 case "$d_readlink" in
15616 "$define")
15617         if $issymlink /proc/self/exe ; then
15618                 $ls -l /proc/self/exe > reflect
15619                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15620                         echo "You have Linux-like /proc/self/exe."
15621                         procselfexe='"/proc/self/exe"'
15622                         val="$define"
15623                 fi
15624         fi
15625         if $issymlink /proc/curproc/file ; then
15626                 $ls -l /proc/curproc/file > reflect
15627                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15628                         echo "You have BSD-like /proc/curproc/file."
15629                         procselfexe='"/proc/curproc/file"'
15630                         val="$define"
15631                 fi
15632         fi
15633         ;;
15634 esac
15635 $rm -f reflect
15636 set d_procselfexe
15637 eval $setvar
15638
15639 : backward compatibility for d_hvfork
15640 if test X$d_hvfork != X; then
15641         d_vfork="$d_hvfork"
15642         d_hvfork=''
15643 fi
15644 : see if there is a vfork
15645 val=''
15646 set vfork val
15647 eval $inlibc
15648
15649 d_pseudofork=$undef
15650
15651 : Ok, but do we want to use it. vfork is reportedly unreliable in
15652 : perl on Solaris 2.x, and probably elsewhere.
15653 case "$val" in
15654 $define)
15655         echo " "
15656         case "$usevfork" in
15657         false) dflt='n';;
15658         *) dflt='y';;
15659         esac
15660         cat <<'EOM'
15661
15662 Perl can only use a vfork() that doesn't suffer from strict
15663 restrictions on calling functions or modifying global data in
15664 the child.  For example, glibc-2.1 contains such a vfork()
15665 that is unsuitable.  If your system provides a proper fork()
15666 call, chances are that you do NOT want perl to use vfork().
15667
15668 EOM
15669         rp="Do you still want to use vfork()?"
15670         . ./myread
15671         case "$ans" in
15672         y|Y) ;;
15673         *)
15674                 echo "Ok, we won't use vfork()."
15675                 val="$undef"
15676                 ;;
15677         esac
15678         ;;
15679 esac
15680 set d_vfork
15681 eval $setvar
15682 case "$d_vfork" in
15683 $define) usevfork='true';;
15684 *) usevfork='false';;
15685 esac
15686
15687 : see whether the pthread_atfork exists
15688 $cat >try.c <<EOP
15689 #include <pthread.h>
15690 #include <stdio.h>
15691 int main() {
15692 #ifdef  PTHREAD_ATFORK
15693         pthread_atfork(NULL,NULL,NULL);
15694 #endif
15695 }
15696 EOP
15697
15698 : see if pthread_atfork exists
15699 set try -DPTHREAD_ATFORK
15700 if eval $compile; then
15701     val="$define"
15702 else
15703     val="$undef"
15704 fi
15705 case "$usethreads" in
15706 $define)
15707         case "$val" in
15708         $define) echo 'pthread_atfork found.' >&4        ;;
15709         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15710         esac
15711 esac
15712 set d_pthread_atfork
15713 eval $setvar
15714
15715 : see if pthread_attr_setscope exists
15716 set pthread_attr_setscope d_pthread_attr_setscope
15717 eval $inlibc
15718
15719
15720 : see whether the various POSIXish _yields exist
15721 $cat >try.c <<EOP
15722 #include <pthread.h>
15723 #include <stdio.h>
15724 int main() {
15725 #ifdef SCHED_YIELD
15726         sched_yield();
15727 #else
15728 #ifdef PTHREAD_YIELD
15729         pthread_yield();
15730 #else
15731 #ifdef PTHREAD_YIELD_NULL
15732         pthread_yield(NULL);
15733 #endif
15734 #endif
15735 #endif
15736 }
15737 EOP
15738 : see if sched_yield exists
15739 set try -DSCHED_YIELD
15740 if eval $compile; then
15741     val="$define"
15742     sched_yield='sched_yield()'
15743 else
15744     val="$undef"
15745 fi
15746 case "$usethreads" in
15747 $define)
15748         case "$val" in
15749         $define) echo 'sched_yield() found.' >&4        ;;
15750         *)       echo 'sched_yield() NOT found.' >&4    ;;
15751         esac
15752 esac
15753 set d_sched_yield
15754 eval $setvar
15755
15756 : see if pthread_yield exists
15757 set try -DPTHREAD_YIELD
15758 if eval $compile; then
15759     val="$define"
15760     case "$sched_yield" in
15761     '') sched_yield='pthread_yield()' ;;
15762     esac
15763 else
15764     set try -DPTHREAD_YIELD_NULL
15765     if eval $compile; then
15766         val="$define"
15767         case "$sched_yield" in
15768         '') sched_yield='pthread_yield(NULL)' ;;
15769         esac
15770     else
15771         val="$undef"
15772     fi
15773 fi
15774 case "$usethreads" in
15775 $define)
15776         case "$val" in
15777         $define) echo 'pthread_yield() found.' >&4      ;;
15778         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15779         esac
15780         ;;
15781 esac
15782 set d_pthread_yield
15783 eval $setvar
15784 case "$sched_yield" in
15785 '') sched_yield=undef ;;
15786 esac
15787 $rm_try
15788
15789 : see if random_r exists
15790 set random_r d_random_r
15791 eval $inlibc
15792 case "$d_random_r" in
15793 "$define")
15794         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15795         case "$d_random_r_proto:$usethreads" in
15796         ":define")      d_random_r_proto=define
15797                 set d_random_r_proto random_r $hdrs
15798                 eval $hasproto ;;
15799         *)      ;;
15800         esac
15801         case "$d_random_r_proto" in
15802         define)
15803         case "$random_r_proto" in
15804         ''|0) try='int random_r(int*, struct random_data*);'
15805         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15806         esac
15807         case "$random_r_proto" in
15808         ''|0) try='int random_r(long*, struct random_data*);'
15809         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15810         esac
15811         case "$random_r_proto" in
15812         ''|0) try='int random_r(struct random_data*, int32_t*);'
15813         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15814         esac
15815         case "$random_r_proto" in
15816         ''|0)   d_random_r=undef
15817                 random_r_proto=0
15818                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15819         * )     case "$random_r_proto" in
15820                 REENTRANT_PROTO*) ;;
15821                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15822                 esac
15823                 echo "Prototype: $try" ;;
15824         esac
15825         ;;
15826         *)      case "$usethreads" in
15827                 define) echo "random_r has no prototype, not using it." >&4 ;;
15828                 esac
15829                 d_random_r=undef
15830                 random_r_proto=0
15831                 ;;
15832         esac
15833         ;;
15834 *)      random_r_proto=0
15835         ;;
15836 esac
15837
15838 : see if readdir and friends exist
15839 set readdir d_readdir
15840 eval $inlibc
15841 set seekdir d_seekdir
15842 eval $inlibc
15843 set telldir d_telldir
15844 eval $inlibc
15845 set rewinddir d_rewinddir
15846 eval $inlibc
15847
15848 : see if readdir64_r exists
15849 set readdir64_r d_readdir64_r
15850 eval $inlibc
15851 case "$d_readdir64_r" in
15852 "$define")
15853         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15854         case "$d_readdir64_r_proto:$usethreads" in
15855         ":define")      d_readdir64_r_proto=define
15856                 set d_readdir64_r_proto readdir64_r $hdrs
15857                 eval $hasproto ;;
15858         *)      ;;
15859         esac
15860         case "$d_readdir64_r_proto" in
15861         define)
15862         case "$readdir64_r_proto" in
15863         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15864         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15865         esac
15866         case "$readdir64_r_proto" in
15867         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15868         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15869         esac
15870         case "$readdir64_r_proto" in
15871         ''|0)   d_readdir64_r=undef
15872                 readdir64_r_proto=0
15873                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15874         * )     case "$readdir64_r_proto" in
15875                 REENTRANT_PROTO*) ;;
15876                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15877                 esac
15878                 echo "Prototype: $try" ;;
15879         esac
15880         ;;
15881         *)      case "$usethreads" in
15882                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15883                 esac
15884                 d_readdir64_r=undef
15885                 readdir64_r_proto=0
15886                 ;;
15887         esac
15888         ;;
15889 *)      readdir64_r_proto=0
15890         ;;
15891 esac
15892
15893 : see if readdir_r exists
15894 set readdir_r d_readdir_r
15895 eval $inlibc
15896 case "$d_readdir_r" in
15897 "$define")
15898         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15899         case "$d_readdir_r_proto:$usethreads" in
15900         ":define")      d_readdir_r_proto=define
15901                 set d_readdir_r_proto readdir_r $hdrs
15902                 eval $hasproto ;;
15903         *)      ;;
15904         esac
15905         case "$d_readdir_r_proto" in
15906         define)
15907         case "$readdir_r_proto" in
15908         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15909         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15910         esac
15911         case "$readdir_r_proto" in
15912         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15913         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15914         esac
15915         case "$readdir_r_proto" in
15916         ''|0)   d_readdir_r=undef
15917                 readdir_r_proto=0
15918                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15919         * )     case "$readdir_r_proto" in
15920                 REENTRANT_PROTO*) ;;
15921                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15922                 esac
15923                 echo "Prototype: $try" ;;
15924         esac
15925         ;;
15926         *)      case "$usethreads" in
15927                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15928                 esac
15929                 d_readdir_r=undef
15930                 readdir_r_proto=0
15931                 ;;
15932         esac
15933         ;;
15934 *)      readdir_r_proto=0
15935         ;;
15936 esac
15937
15938 : see if readv exists
15939 set readv d_readv
15940 eval $inlibc
15941
15942 : see if recvmsg exists
15943 set recvmsg d_recvmsg
15944 eval $inlibc
15945
15946 : see if rename exists
15947 set rename d_rename
15948 eval $inlibc
15949
15950 : see if rmdir exists
15951 set rmdir d_rmdir
15952 eval $inlibc
15953
15954 : see if memory.h is available.
15955 val=''
15956 set memory.h val
15957 eval $inhdr
15958
15959 : See if it conflicts with string.h
15960 case "$val" in
15961 $define)
15962         case "$strings" in
15963         '') ;;
15964         *)
15965                 $cppstdin $cppflags $cppminus < $strings > mem.h
15966                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15967                         echo " "
15968                         echo "We won't be including <memory.h>."
15969                         val="$undef"
15970                 fi
15971                 $rm -f mem.h
15972                 ;;
15973         esac
15974 esac
15975 set i_memory
15976 eval $setvar
15977
15978 : can bcopy handle overlapping blocks?
15979 echo " "
15980 val="$undef"
15981 case "$d_memmove" in
15982 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15983 *)      case "$d_bcopy" in
15984         "$define")
15985                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15986                 $cat >try.c <<EOCP
15987 #$i_memory I_MEMORY
15988 #$i_stdlib I_STDLIB
15989 #$i_string I_STRING
15990 #$i_unistd I_UNISTD
15991 EOCP
15992         $cat >>try.c <<'EOCP'
15993 #include <stdio.h>
15994 #ifdef I_MEMORY
15995 #  include <memory.h>
15996 #endif
15997 #ifdef I_STDLIB
15998 #  include <stdlib.h>
15999 #endif
16000 #ifdef I_STRING
16001 #  include <string.h>
16002 #else
16003 #  include <strings.h>
16004 #endif
16005 #ifdef I_UNISTD
16006 #  include <unistd.h>  /* Needed for NetBSD */
16007 #endif
16008 int main()
16009 {
16010 char buf[128], abc[128];
16011 char *b;
16012 int len;
16013 int off;
16014 int align;
16015
16016 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16017    try to store the string in read-only memory. */
16018 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16019
16020 for (align = 7; align >= 0; align--) {
16021         for (len = 36; len; len--) {
16022                 b = buf+align;
16023                 bcopy(abc, b, len);
16024                 for (off = 1; off <= len; off++) {
16025                         bcopy(b, b+off, len);
16026                         bcopy(b+off, b, len);
16027                         if (bcmp(b, abc, len))
16028                                 exit(1);
16029                 }
16030         }
16031 }
16032 exit(0);
16033 }
16034 EOCP
16035                 set try
16036                 if eval $compile_ok; then
16037                         if $run ./try 2>/dev/null; then
16038                                 echo "Yes, it can."
16039                                 val="$define"
16040                         else
16041                                 echo "It can't, sorry."
16042                         fi
16043                 else
16044                         echo "(I can't compile the test program, so we'll assume not...)"
16045                 fi
16046                 ;;
16047         esac
16048         $rm_try
16049         ;;
16050 esac
16051 set d_safebcpy
16052 eval $setvar
16053
16054 : can memcpy handle overlapping blocks?
16055 echo " "
16056 val="$undef"
16057 case "$d_memmove" in
16058 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16059 *)      case "$d_memcpy" in
16060         "$define")
16061                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16062                 $cat >try.c <<EOCP
16063 #$i_memory I_MEMORY
16064 #$i_stdlib I_STDLIB
16065 #$i_string I_STRING
16066 #$i_unistd I_UNISTD
16067 EOCP
16068         $cat >>try.c <<'EOCP'
16069 #include <stdio.h>
16070 #ifdef I_MEMORY
16071 #  include <memory.h>
16072 #endif
16073 #ifdef I_STDLIB
16074 #  include <stdlib.h>
16075 #endif
16076 #ifdef I_STRING
16077 #  include <string.h>
16078 #else
16079 #  include <strings.h>
16080 #endif
16081 #ifdef I_UNISTD
16082 #  include <unistd.h>  /* Needed for NetBSD */
16083 #endif
16084 int main()
16085 {
16086 char buf[128], abc[128];
16087 char *b;
16088 int len;
16089 int off;
16090 int align;
16091
16092 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16093    try to store the string in read-only memory. */
16094 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16095
16096 for (align = 7; align >= 0; align--) {
16097         for (len = 36; len; len--) {
16098                 b = buf+align;
16099                 memcpy(b, abc, len);
16100                 for (off = 1; off <= len; off++) {
16101                         memcpy(b+off, b, len);
16102                         memcpy(b, b+off, len);
16103                         if (memcmp(b, abc, len))
16104                                 exit(1);
16105                 }
16106         }
16107 }
16108 exit(0);
16109 }
16110 EOCP
16111                 set try
16112                 if eval $compile_ok; then
16113                         if $run ./try 2>/dev/null; then
16114                                 echo "Yes, it can."
16115                                 val="$define"
16116                         else
16117                                 echo "It can't, sorry."
16118                         fi
16119                 else
16120                         echo "(I can't compile the test program, so we'll assume not...)"
16121                 fi
16122                 ;;
16123         esac
16124         $rm_try
16125         ;;
16126 esac
16127 set d_safemcpy
16128 eval $setvar
16129
16130 : can memcmp be trusted to compare relative magnitude?
16131 val="$undef"
16132 case "$d_memcmp" in
16133 "$define")
16134         echo " "
16135         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16136         $cat >try.c <<EOCP
16137 #$i_memory I_MEMORY
16138 #$i_stdlib I_STDLIB
16139 #$i_string I_STRING
16140 #$i_unistd I_UNISTD
16141 EOCP
16142         $cat >>try.c <<'EOCP'
16143 #include <stdio.h>
16144 #ifdef I_MEMORY
16145 #  include <memory.h>
16146 #endif
16147 #ifdef I_STDLIB
16148 #  include <stdlib.h>
16149 #endif
16150 #ifdef I_STRING
16151 #  include <string.h>
16152 #else
16153 #  include <strings.h>
16154 #endif
16155 #ifdef I_UNISTD
16156 #  include <unistd.h>  /* Needed for NetBSD */
16157 #endif
16158 int main()
16159 {
16160 char a = -1;
16161 char b = 0;
16162 if ((a < b) && memcmp(&a, &b, 1) < 0)
16163         exit(1);
16164 exit(0);
16165 }
16166 EOCP
16167         set try
16168         if eval $compile_ok; then
16169                 if $run ./try 2>/dev/null; then
16170                         echo "Yes, it can."
16171                         val="$define"
16172                 else
16173                         echo "No, it can't (it uses signed chars)."
16174                 fi
16175         else
16176                 echo "(I can't compile the test program, so we'll assume not...)"
16177         fi
16178         ;;
16179 esac
16180 $rm_try
16181 set d_sanemcmp
16182 eval $setvar
16183
16184 : see if prototype for sbrk is available
16185 echo " "
16186 set d_sbrkproto sbrk $i_unistd unistd.h
16187 eval $hasproto
16188
16189 : see if select exists
16190 set select d_select
16191 eval $inlibc
16192
16193 : see if semctl exists
16194 set semctl d_semctl
16195 eval $inlibc
16196
16197 : see if semget exists
16198 set semget d_semget
16199 eval $inlibc
16200
16201 : see if semop exists
16202 set semop d_semop
16203 eval $inlibc
16204
16205 : see how much of the 'sem*(2)' library is present.
16206 h_sem=true
16207 echo " "
16208 case "$d_semctl$d_semget$d_semop" in
16209 *"$undef"*) h_sem=false;;
16210 esac
16211 case "$osname" in
16212 freebsd)
16213     case "`ipcs 2>&1`" in
16214     "SVID messages"*"not configured"*)
16215         echo "Your $osname does not have the sem*(2) configured." >&4
16216         h_sem=false
16217         val="$undef"
16218         set semctl d_semctl
16219         eval $setvar
16220         set semget d_semget
16221         eval $setvar
16222         set semop d_semop
16223         eval $setvar
16224         ;;
16225     esac
16226     ;;
16227 esac
16228 : we could also check for sys/ipc.h ...
16229 if $h_sem && $test `./findhdr sys/sem.h`; then
16230         echo "You have the full sem*(2) library." >&4
16231         val="$define"
16232 else
16233         echo "You don't have the full sem*(2) library." >&4
16234         val="$undef"
16235 fi
16236 set d_sem
16237 eval $setvar
16238
16239 : see whether sys/sem.h defines union semun
16240 echo " "
16241 $cat > try.c <<'END'
16242 #include <sys/types.h>
16243 #include <sys/ipc.h>
16244 #include <sys/sem.h>
16245 int main () { union semun semun; semun.buf = 0; }
16246 END
16247 set try
16248 if eval $compile; then
16249     echo "You have union semun in <sys/sem.h>." >&4
16250     val="$define"
16251 else
16252     echo "You do not have union semun in <sys/sem.h>." >&4
16253     val="$undef"
16254 fi
16255 $rm_try
16256 set d_union_semun
16257 eval $setvar
16258
16259 : see how to do semctl IPC_STAT
16260 case "$d_sem" in
16261 $define)
16262     echo " "
16263     $cat > tryh.h <<END
16264 #ifndef S_IRUSR
16265 #   ifdef S_IREAD
16266 #       define S_IRUSR S_IREAD
16267 #       define S_IWUSR S_IWRITE
16268 #       define S_IXUSR S_IEXEC
16269 #   else
16270 #       define S_IRUSR 0400
16271 #       define S_IWUSR 0200
16272 #       define S_IXUSR 0100
16273 #   endif
16274 #   define S_IRGRP (S_IRUSR>>3)
16275 #   define S_IWGRP (S_IWUSR>>3)
16276 #   define S_IXGRP (S_IXUSR>>3)
16277 #   define S_IROTH (S_IRUSR>>6)
16278 #   define S_IWOTH (S_IWUSR>>6)
16279 #   define S_IXOTH (S_IXUSR>>6)
16280 #endif
16281 #ifndef S_IRWXU
16282 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16283 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16284 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16285 #endif
16286 END
16287     : see whether semctl IPC_STAT can use union semun
16288     case "$d_semctl_semun" in
16289     '')
16290       val="$undef"
16291       $cat > try.c <<END
16292 #include <sys/types.h>
16293 #include <sys/ipc.h>
16294 #include <sys/sem.h>
16295 #include <sys/stat.h>
16296 #include <stdio.h>
16297 #include <errno.h>
16298 #include "tryh.h"
16299 #ifndef errno
16300 extern int errno;
16301 #endif
16302 #$d_union_semun HAS_UNION_SEMUN
16303 int main() {
16304     union semun
16305 #ifndef HAS_UNION_SEMUN
16306     {
16307         int val;
16308         struct semid_ds *buf;
16309         unsigned short *array;
16310     }
16311 #endif
16312     arg;
16313     int sem, st;
16314
16315 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16316     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16317     if (sem > -1) {
16318         struct semid_ds argbuf;
16319         arg.buf = &argbuf;
16320 #       ifdef IPC_STAT
16321         st = semctl(sem, 0, IPC_STAT, arg);
16322         if (st == 0)
16323             printf("semun\n");
16324         else
16325 #       endif /* IPC_STAT */
16326             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16327 #       ifdef IPC_RMID
16328         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16329 #       endif /* IPC_RMID */
16330             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16331     } else
16332 #endif /* IPC_PRIVATE && ... */
16333         printf("semget failed: errno = %d\n", errno);
16334   return 0;
16335 }
16336 END
16337       set try
16338       if eval $compile; then
16339           xxx=`$run ./try`
16340           case "$xxx" in
16341           semun) val="$define" ;;
16342           esac
16343       fi
16344       $rm_try
16345       set d_semctl_semun
16346       eval $setvar
16347       ;;
16348     esac
16349     case "$d_semctl_semun" in
16350     $define)
16351         echo "You can use union semun for semctl IPC_STAT." >&4
16352         also='also'
16353         ;;
16354     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16355         also=''
16356         ;;
16357     esac
16358
16359     : see whether semctl IPC_STAT can use struct semid_ds pointer
16360     case "$d_semctl_semid_ds" in
16361     '')
16362       val="$undef"
16363       $cat > try.c <<'END'
16364 #include <sys/types.h>
16365 #include <sys/ipc.h>
16366 #include <sys/sem.h>
16367 #include <sys/stat.h>
16368 #include "tryh.h"
16369 #include <stdio.h>
16370 #include <errno.h>
16371 #ifndef errno
16372 extern int errno;
16373 #endif
16374 int main() {
16375     struct semid_ds arg;
16376     int sem, st;
16377
16378 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16379     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16380     if (sem > -1) {
16381 #       ifdef IPC_STAT
16382         st = semctl(sem, 0, IPC_STAT, &arg);
16383         if (st == 0)
16384             printf("semid_ds\n");
16385         else
16386 #       endif /* IPC_STAT */
16387             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16388 #       ifdef IPC_RMID
16389         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16390 #       endif /* IPC_RMID */
16391             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16392     } else
16393 #endif /* IPC_PRIVATE && ... */
16394         printf("semget failed: errno = %d\n", errno);
16395
16396     return 0;
16397 }
16398 END
16399       set try
16400       if eval $compile; then
16401           xxx=`$run ./try`
16402           case "$xxx" in
16403           semid_ds) val="$define" ;;
16404           esac
16405       fi
16406       $rm_try
16407       set d_semctl_semid_ds
16408       eval $setvar
16409       ;;
16410     esac
16411     case "$d_semctl_semid_ds" in
16412     $define)
16413         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16414         ;;
16415     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16416         ;;
16417     esac
16418     ;;
16419 *)  val="$undef"
16420
16421     # We do not have the full sem*(2) library, so assume we can not
16422     # use either.
16423
16424     set d_semctl_semun
16425     eval $setvar
16426
16427     set d_semctl_semid_ds
16428     eval $setvar
16429     ;;
16430 esac
16431 $rm_try tryh.h
16432
16433 : see if sendmsg exists
16434 set sendmsg d_sendmsg
16435 eval $inlibc
16436
16437 : see if setegid exists
16438 set setegid d_setegid
16439 eval $inlibc
16440
16441 : see if seteuid exists
16442 set seteuid d_seteuid
16443 eval $inlibc
16444
16445 : see if setgrent exists
16446 set setgrent d_setgrent
16447 eval $inlibc
16448
16449 : see if setgrent_r exists
16450 set setgrent_r d_setgrent_r
16451 eval $inlibc
16452 case "$d_setgrent_r" in
16453 "$define")
16454         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16455         case "$d_setgrent_r_proto:$usethreads" in
16456         ":define")      d_setgrent_r_proto=define
16457                 set d_setgrent_r_proto setgrent_r $hdrs
16458                 eval $hasproto ;;
16459         *)      ;;
16460         esac
16461         case "$d_setgrent_r_proto" in
16462         define)
16463         case "$setgrent_r_proto" in
16464         ''|0) try='int setgrent_r(FILE**);'
16465         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16466         esac
16467         case "$setgrent_r_proto" in
16468         ''|0) try='void setgrent_r(FILE**);'
16469         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16470         esac
16471         case "$setgrent_r_proto" in
16472         ''|0)   d_setgrent_r=undef
16473                 setgrent_r_proto=0
16474                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16475         * )     case "$setgrent_r_proto" in
16476                 REENTRANT_PROTO*) ;;
16477                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16478                 esac
16479                 echo "Prototype: $try" ;;
16480         esac
16481         ;;
16482         *)      case "$usethreads" in
16483                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16484                 esac
16485                 d_setgrent_r=undef
16486                 setgrent_r_proto=0
16487                 ;;
16488         esac
16489         ;;
16490 *)      setgrent_r_proto=0
16491         ;;
16492 esac
16493
16494 : see if sethostent exists
16495 set sethostent d_sethent
16496 eval $inlibc
16497
16498 : see if sethostent_r exists
16499 set sethostent_r d_sethostent_r
16500 eval $inlibc
16501 case "$d_sethostent_r" in
16502 "$define")
16503         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16504         case "$d_sethostent_r_proto:$usethreads" in
16505         ":define")      d_sethostent_r_proto=define
16506                 set d_sethostent_r_proto sethostent_r $hdrs
16507                 eval $hasproto ;;
16508         *)      ;;
16509         esac
16510         case "$d_sethostent_r_proto" in
16511         define)
16512         case "$sethostent_r_proto" in
16513         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16514         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16515         esac
16516         case "$sethostent_r_proto" in
16517         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16518         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16519         esac
16520         case "$sethostent_r_proto" in
16521         ''|0)   d_sethostent_r=undef
16522                 sethostent_r_proto=0
16523                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16524         * )     case "$sethostent_r_proto" in
16525                 REENTRANT_PROTO*) ;;
16526                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16527                 esac
16528                 echo "Prototype: $try" ;;
16529         esac
16530         ;;
16531         *)      case "$usethreads" in
16532                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16533                 esac
16534                 d_sethostent_r=undef
16535                 sethostent_r_proto=0
16536                 ;;
16537         esac
16538         ;;
16539 *)      sethostent_r_proto=0
16540         ;;
16541 esac
16542
16543 : see if setitimer exists
16544 set setitimer d_setitimer
16545 eval $inlibc
16546
16547 : see if setlinebuf exists
16548 set setlinebuf d_setlinebuf
16549 eval $inlibc
16550
16551 : see if setlocale exists
16552 set setlocale d_setlocale
16553 eval $inlibc
16554
16555 : see if locale.h is available
16556 set locale.h i_locale
16557 eval $inhdr
16558
16559 : see if setlocale_r exists
16560 set setlocale_r d_setlocale_r
16561 eval $inlibc
16562 case "$d_setlocale_r" in
16563 "$define")
16564         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16565         case "$d_setlocale_r_proto:$usethreads" in
16566         ":define")      d_setlocale_r_proto=define
16567                 set d_setlocale_r_proto setlocale_r $hdrs
16568                 eval $hasproto ;;
16569         *)      ;;
16570         esac
16571         case "$d_setlocale_r_proto" in
16572         define)
16573         case "$setlocale_r_proto" in
16574         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16575         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16576         esac
16577         case "$setlocale_r_proto" in
16578         ''|0)   d_setlocale_r=undef
16579                 setlocale_r_proto=0
16580                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16581         * )     case "$setlocale_r_proto" in
16582                 REENTRANT_PROTO*) ;;
16583                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16584                 esac
16585                 echo "Prototype: $try" ;;
16586         esac
16587         ;;
16588         *)      case "$usethreads" in
16589                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16590                 esac
16591                 d_setlocale_r=undef
16592                 setlocale_r_proto=0
16593                 ;;
16594         esac
16595         ;;
16596 *)      setlocale_r_proto=0
16597         ;;
16598 esac
16599
16600 : see if setnetent exists
16601 set setnetent d_setnent
16602 eval $inlibc
16603
16604 : see if setnetent_r exists
16605 set setnetent_r d_setnetent_r
16606 eval $inlibc
16607 case "$d_setnetent_r" in
16608 "$define")
16609         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16610         case "$d_setnetent_r_proto:$usethreads" in
16611         ":define")      d_setnetent_r_proto=define
16612                 set d_setnetent_r_proto setnetent_r $hdrs
16613                 eval $hasproto ;;
16614         *)      ;;
16615         esac
16616         case "$d_setnetent_r_proto" in
16617         define)
16618         case "$setnetent_r_proto" in
16619         ''|0) try='int setnetent_r(int, struct netent_data*);'
16620         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16621         esac
16622         case "$setnetent_r_proto" in
16623         ''|0) try='void setnetent_r(int, struct netent_data*);'
16624         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16625         esac
16626         case "$setnetent_r_proto" in
16627         ''|0)   d_setnetent_r=undef
16628                 setnetent_r_proto=0
16629                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16630         * )     case "$setnetent_r_proto" in
16631                 REENTRANT_PROTO*) ;;
16632                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16633                 esac
16634                 echo "Prototype: $try" ;;
16635         esac
16636         ;;
16637         *)      case "$usethreads" in
16638                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16639                 esac
16640                 d_setnetent_r=undef
16641                 setnetent_r_proto=0
16642                 ;;
16643         esac
16644         ;;
16645 *)      setnetent_r_proto=0
16646         ;;
16647 esac
16648
16649 : see if setprotoent exists
16650 set setprotoent d_setpent
16651 eval $inlibc
16652
16653 : see if setpgid exists
16654 set setpgid d_setpgid
16655 eval $inlibc
16656
16657 : see if setpgrp2 exists
16658 set setpgrp2 d_setpgrp2
16659 eval $inlibc
16660
16661 : see if setpriority exists
16662 set setpriority d_setprior
16663 eval $inlibc
16664
16665 : see if setproctitle exists
16666 set setproctitle d_setproctitle
16667 eval $inlibc
16668
16669 : see if setprotoent_r exists
16670 set setprotoent_r d_setprotoent_r
16671 eval $inlibc
16672 case "$d_setprotoent_r" in
16673 "$define")
16674         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16675         case "$d_setprotoent_r_proto:$usethreads" in
16676         ":define")      d_setprotoent_r_proto=define
16677                 set d_setprotoent_r_proto setprotoent_r $hdrs
16678                 eval $hasproto ;;
16679         *)      ;;
16680         esac
16681         case "$d_setprotoent_r_proto" in
16682         define)
16683         case "$setprotoent_r_proto" in
16684         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16685         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16686         esac
16687         case "$setprotoent_r_proto" in
16688         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16689         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16690         esac
16691         case "$setprotoent_r_proto" in
16692         ''|0)   d_setprotoent_r=undef
16693                 setprotoent_r_proto=0
16694                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16695         * )     case "$setprotoent_r_proto" in
16696                 REENTRANT_PROTO*) ;;
16697                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16698                 esac
16699                 echo "Prototype: $try" ;;
16700         esac
16701         ;;
16702         *)      case "$usethreads" in
16703                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16704                 esac
16705                 d_setprotoent_r=undef
16706                 setprotoent_r_proto=0
16707                 ;;
16708         esac
16709         ;;
16710 *)      setprotoent_r_proto=0
16711         ;;
16712 esac
16713
16714 : see if setpwent exists
16715 set setpwent d_setpwent
16716 eval $inlibc
16717
16718 : see if setpwent_r exists
16719 set setpwent_r d_setpwent_r
16720 eval $inlibc
16721 case "$d_setpwent_r" in
16722 "$define")
16723         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16724         case "$d_setpwent_r_proto:$usethreads" in
16725         ":define")      d_setpwent_r_proto=define
16726                 set d_setpwent_r_proto setpwent_r $hdrs
16727                 eval $hasproto ;;
16728         *)      ;;
16729         esac
16730         case "$d_setpwent_r_proto" in
16731         define)
16732         case "$setpwent_r_proto" in
16733         ''|0) try='int setpwent_r(FILE**);'
16734         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16735         esac
16736         case "$setpwent_r_proto" in
16737         ''|0) try='void setpwent_r(FILE**);'
16738         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16739         esac
16740         case "$setpwent_r_proto" in
16741         ''|0)   d_setpwent_r=undef
16742                 setpwent_r_proto=0
16743                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16744         * )     case "$setpwent_r_proto" in
16745                 REENTRANT_PROTO*) ;;
16746                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16747                 esac
16748                 echo "Prototype: $try" ;;
16749         esac
16750         ;;
16751         *)      case "$usethreads" in
16752                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16753                 esac
16754                 d_setpwent_r=undef
16755                 setpwent_r_proto=0
16756                 ;;
16757         esac
16758         ;;
16759 *)      setpwent_r_proto=0
16760         ;;
16761 esac
16762
16763 : see if setregid exists
16764 set setregid d_setregid
16765 eval $inlibc
16766 set setresgid d_setresgid
16767 eval $inlibc
16768
16769 : see if setreuid exists
16770 set setreuid d_setreuid
16771 eval $inlibc
16772 set setresuid d_setresuid
16773 eval $inlibc
16774
16775 : see if setrgid exists
16776 set setrgid d_setrgid
16777 eval $inlibc
16778
16779 : see if setruid exists
16780 set setruid d_setruid
16781 eval $inlibc
16782
16783 : see if setservent exists
16784 set setservent d_setsent
16785 eval $inlibc
16786
16787 : see if setservent_r exists
16788 set setservent_r d_setservent_r
16789 eval $inlibc
16790 case "$d_setservent_r" in
16791 "$define")
16792         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16793         case "$d_setservent_r_proto:$usethreads" in
16794         ":define")      d_setservent_r_proto=define
16795                 set d_setservent_r_proto setservent_r $hdrs
16796                 eval $hasproto ;;
16797         *)      ;;
16798         esac
16799         case "$d_setservent_r_proto" in
16800         define)
16801         case "$setservent_r_proto" in
16802         ''|0) try='int setservent_r(int, struct servent_data*);'
16803         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16804         esac
16805         case "$setservent_r_proto" in
16806         ''|0) try='void setservent_r(int, struct servent_data*);'
16807         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16808         esac
16809         case "$setservent_r_proto" in
16810         ''|0)   d_setservent_r=undef
16811                 setservent_r_proto=0
16812                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16813         * )     case "$setservent_r_proto" in
16814                 REENTRANT_PROTO*) ;;
16815                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16816                 esac
16817                 echo "Prototype: $try" ;;
16818         esac
16819         ;;
16820         *)      case "$usethreads" in
16821                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16822                 esac
16823                 d_setservent_r=undef
16824                 setservent_r_proto=0
16825                 ;;
16826         esac
16827         ;;
16828 *)      setservent_r_proto=0
16829         ;;
16830 esac
16831
16832 : see if setsid exists
16833 set setsid d_setsid
16834 eval $inlibc
16835
16836 : see if setvbuf exists
16837 set setvbuf d_setvbuf
16838 eval $inlibc
16839
16840 : see if sfio.h is available
16841 set sfio.h i_sfio
16842 eval $inhdr
16843
16844
16845 : see if sfio library is available
16846 case "$i_sfio" in
16847 $define)
16848         val=''
16849         set sfreserve val
16850         eval $inlibc
16851         ;;
16852 *)
16853         val="$undef"
16854         ;;
16855 esac
16856 : Ok, but do we want to use it.
16857 case "$val" in
16858 $define)
16859         case "$usesfio" in
16860         true|$define|[yY]*) dflt='y';;
16861         *) dflt='n';;
16862         esac
16863         echo "$package can use the sfio library, but it is experimental."
16864         case "$useperlio" in
16865         "$undef")
16866             echo "For sfio also the PerlIO abstraction layer is needed."
16867             echo "Earlier you said you wouldn't want that."
16868             ;;
16869         esac
16870         rp="You seem to have sfio available, do you want to try using it?"
16871         . ./myread
16872         case "$ans" in
16873         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16874                 useperlio="$define"
16875                 val="$define"
16876                 ;;
16877         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16878                 val="$undef"
16879                 ;;
16880         esac
16881         ;;
16882 *)      case "$usesfio" in
16883         true|$define|[yY]*)
16884                 echo "Sorry, cannot find sfio on this machine." >&4
16885                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16886                 val="$undef"
16887                 ;;
16888         esac
16889         ;;
16890 esac
16891 set d_sfio
16892 eval $setvar
16893 case "$d_sfio" in
16894 $define) usesfio='true';;
16895 *) usesfio='false';;
16896 esac
16897 case "$d_sfio" in
16898 $define) ;;
16899 *)      : Remove sfio from list of libraries to use
16900         case "$libs" in
16901         *-lsfio*)
16902                 echo "Removing unneeded -lsfio from library list" >&4
16903                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16904                 shift
16905                 libs="$*"
16906                 echo "libs = $libs" >&4
16907                 ;;
16908         esac
16909 ;;
16910 esac
16911
16912
16913 : see if shmctl exists
16914 set shmctl d_shmctl
16915 eval $inlibc
16916
16917 : see if shmget exists
16918 set shmget d_shmget
16919 eval $inlibc
16920
16921 : see if shmat exists
16922 set shmat d_shmat
16923 eval $inlibc
16924 : see what shmat returns
16925 case "$d_shmat" in
16926 "$define")
16927         $cat >shmat.c <<'END'
16928 #include <sys/shm.h>
16929 void *shmat();
16930 END
16931         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16932                 shmattype='void *'
16933         else
16934                 shmattype='char *'
16935         fi
16936         echo "and it returns ($shmattype)." >&4
16937         : see if a prototype for shmat is available
16938         xxx=`./findhdr sys/shm.h`
16939         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16940         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16941                 val="$define"
16942         else
16943                 val="$undef"
16944         fi
16945         $rm -f shmat.[co]
16946         ;;
16947 *)
16948         val="$undef"
16949         ;;
16950 esac
16951 set d_shmatprototype
16952 eval $setvar
16953
16954 : see if shmdt exists
16955 set shmdt d_shmdt
16956 eval $inlibc
16957
16958 : see how much of the 'shm*(2)' library is present.
16959 h_shm=true
16960 echo " "
16961 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16962 *"$undef"*) h_shm=false;;
16963 esac
16964 case "$osname" in
16965 freebsd)
16966     case "`ipcs 2>&1`" in
16967     "SVID shared memory"*"not configured"*)
16968         echo "Your $osname does not have the shm*(2) configured." >&4
16969         h_shm=false
16970         val="$undef"
16971         set shmctl d_shmctl
16972         evat $setvar
16973         set shmget d_shmget
16974         evat $setvar
16975         set shmat d_shmat
16976         evat $setvar
16977         set shmdt d_shmdt
16978         evat $setvar
16979         ;;
16980     esac
16981     ;;
16982 esac
16983 : we could also check for sys/ipc.h ...
16984 if $h_shm && $test `./findhdr sys/shm.h`; then
16985         echo "You have the full shm*(2) library." >&4
16986         val="$define"
16987 else
16988         echo "You don't have the full shm*(2) library." >&4
16989         val="$undef"
16990 fi
16991 set d_shm
16992 eval $setvar
16993
16994 echo " "
16995 : see if we have sigaction
16996 if set sigaction val -f d_sigaction; eval $csym; $val; then
16997         echo 'sigaction() found.' >&4
16998         $cat > try.c <<EOP
16999 #include <stdio.h>
17000 #include <sys/types.h>
17001 #include <signal.h>
17002 #$i_stdlib I_STDLIB
17003 #ifdef I_STDLIB
17004 #include <stdlib.h>
17005 #endif
17006 int main()
17007 {
17008     struct sigaction act, oact;
17009     act.sa_flags = 0;
17010     oact.sa_handler = 0;
17011     /* so that act and oact are used */
17012     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17013 }
17014 EOP
17015         set try
17016         if eval $compile_ok; then
17017                 val="$define"
17018         else
17019                 echo "But you don't seem to have a useable struct sigaction." >&4
17020                 val="$undef"
17021         fi
17022 else
17023         echo 'sigaction NOT found.' >&4
17024         val="$undef"
17025 fi
17026 set d_sigaction; eval $setvar
17027 $rm_try
17028
17029 : see if this is a sunmath.h system
17030 set sunmath.h i_sunmath
17031 eval $inhdr
17032
17033 : see if signbit exists
17034 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17035 $cat >try.c <<EOCP
17036 #$i_math I_MATH
17037 #$i_sunmath I_SUNMATH
17038 #ifdef I_MATH
17039 #  include <math.h>
17040 #endif
17041 #ifdef I_SUNMATH  /* Solaris special math library */
17042 #  include <sunmath.h>
17043 #endif
17044 #define NV $nvtype
17045 int main(int argc, char **argv)
17046 {
17047     NV x = 0.0;
17048     NV y = -0.0;
17049     if ((signbit(x) == 0) && (signbit(y) != 0))
17050         return 0;
17051     else
17052         return 1;
17053 }
17054 EOCP
17055 val="$undef"
17056 set try
17057 if eval $compile; then
17058     if $run ./try; then
17059         $echo "Yes." >&4
17060         val="$define"
17061     else
17062         $echo "Signbit seems to be available, but doesn't work as I expected."
17063         $echo "I won't use it." >&4
17064         val="$undef"
17065     fi
17066 else
17067     $echo "Nope." >&4
17068     dflt="$undef"
17069 fi
17070 set d_signbit
17071 eval $setvar
17072 $rm_try
17073
17074 : see if sigprocmask exists
17075 set sigprocmask d_sigprocmask
17076 eval $inlibc
17077
17078 : see if sigsetjmp exists
17079 echo " "
17080 case "$d_sigsetjmp" in
17081 '')
17082         $cat >try.c <<EOP
17083 #include <setjmp.h>
17084 #$i_stdlib I_STDLIB
17085 #ifdef I_STDLIB
17086 #include <stdlib.h>
17087 #endif
17088 sigjmp_buf env;
17089 int set = 1;
17090 int main()
17091 {
17092         if (sigsetjmp(env,1))
17093                 exit(set);
17094         set = 0;
17095         siglongjmp(env, 1);
17096         exit(1);
17097 }
17098 EOP
17099         set try
17100         if eval $compile; then
17101                 if $run ./try >/dev/null 2>&1; then
17102                         echo "POSIX sigsetjmp found." >&4
17103                         val="$define"
17104                 else
17105                         $cat >&4 <<EOM
17106 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17107 I'll ignore them.
17108 EOM
17109                         val="$undef"
17110                 fi
17111         else
17112                 echo "sigsetjmp not found." >&4
17113                 val="$undef"
17114         fi
17115         ;;
17116 *) val="$d_sigsetjmp"
17117         case "$d_sigsetjmp" in
17118         $define) echo "POSIX sigsetjmp found." >&4;;
17119         $undef) echo "sigsetjmp not found." >&4;;
17120         esac
17121         ;;
17122 esac
17123 set d_sigsetjmp
17124 eval $setvar
17125 $rm_try
17126
17127 : see if snprintf exists
17128 set snprintf d_snprintf
17129 eval $inlibc
17130
17131 : see if vsnprintf exists
17132 set vsnprintf d_vsnprintf
17133 eval $inlibc
17134
17135 case "$d_snprintf-$d_vsnprintf" in
17136 "$define-$define")
17137     $cat <<EOM
17138 Checking whether your snprintf() and vsnprintf() work okay...
17139 EOM
17140     $cat >try.c <<'EOCP'
17141 /* v?snprintf testing logic courtesy of Russ Allbery.
17142  * According to C99:
17143  * - if the buffer is too short it still must be \0-terminated
17144  * - if the buffer is too short the potentially required length
17145  *   must be returned and not -1
17146  * - if the buffer is NULL the potentially required length
17147  *   must be returned and not -1 or core dump
17148  */
17149 #include <stdio.h>
17150 #include <stdarg.h>
17151
17152 char buf[2];
17153
17154 int test (char *format, ...)
17155 {
17156     va_list args;
17157     int count;
17158
17159     va_start (args, format);
17160     count = vsnprintf (buf, sizeof buf, format, args);
17161     va_end (args);
17162     return count;
17163 }
17164
17165 int main ()
17166 {
17167     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17168              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17169 }
17170 EOCP
17171     set try
17172     if eval $compile; then
17173         `$run ./try`
17174         case "$?" in
17175         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17176         *) cat <<EOM >&4
17177 Your snprintf() and snprintf() don't seem to be working okay.
17178 EOM
17179            d_snprintf="$undef"
17180            d_vsnprintf="$undef"
17181            ;;
17182         esac
17183     else
17184         echo "(I can't seem to compile the test program--assuming they don't)"
17185         d_snprintf="$undef"
17186         d_vsnprintf="$undef"
17187     fi
17188     $rm_try
17189     ;;
17190 esac
17191
17192 : see if sockatmark exists
17193 set sockatmark d_sockatmark
17194 eval $inlibc
17195
17196 : see if prototype for sockatmark is available
17197 echo " "
17198 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17199 eval $hasproto
17200
17201 : see if socks5_init exists
17202 set socks5_init d_socks5_init
17203 eval $inlibc
17204
17205 : see if sprintf returns the length of the string in the buffer as per ANSI
17206 $echo "Checking whether sprintf returns the length of the string..." >&4
17207 $cat <<EOP >try.c
17208 #include <stdio.h>
17209 #$i_stdlib I_STDLIB
17210 #ifdef I_STDLIB
17211 #include <stdlib.h>
17212 #endif
17213 #$i_string I_STRING
17214 #ifdef I_STRING
17215 #  include <string.h>
17216 #else
17217 #  include <strings.h>
17218 #endif
17219 #$i_math I_MATH
17220 #ifdef I_MATH
17221 #include <math.h>
17222 #endif
17223
17224 char buffer[256];
17225
17226 int check (size_t expect, int test) {
17227   size_t got = strlen(buffer);
17228   if (expect == got)
17229     return 0;
17230
17231   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17232        test, buffer);
17233   exit (test);
17234 }
17235
17236 int main(int argc, char **argv) {
17237   int test = 0;
17238
17239   check(sprintf(buffer, ""), ++test);
17240   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17241   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17242
17243   return 0;
17244 }
17245 EOP
17246 set try
17247
17248 d_sprintf_returns_strlen="$undef"
17249 if eval $compile; then
17250     xxx="`$run ./try`"
17251     case "$?" in
17252         0) cat >&4 <<EOM
17253 sprintf returns the length of the string (as ANSI says it should)
17254 EOM
17255         d_sprintf_returns_strlen="$define"
17256         ;;
17257         *) cat >&4 <<EOM
17258 sprintf does not return the length of the string (how old is this system?)
17259 EOM
17260         d_sprintf_returns_strlen="$undef"
17261         ;;
17262     esac
17263 fi
17264 $rm_try
17265
17266 : see if srand48_r exists
17267 set srand48_r d_srand48_r
17268 eval $inlibc
17269 case "$d_srand48_r" in
17270 "$define")
17271         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17272         case "$d_srand48_r_proto:$usethreads" in
17273         ":define")      d_srand48_r_proto=define
17274                 set d_srand48_r_proto srand48_r $hdrs
17275                 eval $hasproto ;;
17276         *)      ;;
17277         esac
17278         case "$d_srand48_r_proto" in
17279         define)
17280         case "$srand48_r_proto" in
17281         ''|0) try='int srand48_r(long, struct drand48_data*);'
17282         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17283         esac
17284         case "$srand48_r_proto" in
17285         ''|0)   d_srand48_r=undef
17286                 srand48_r_proto=0
17287                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17288         * )     case "$srand48_r_proto" in
17289                 REENTRANT_PROTO*) ;;
17290                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17291                 esac
17292                 echo "Prototype: $try" ;;
17293         esac
17294         ;;
17295         *)      case "$usethreads" in
17296                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17297                 esac
17298                 d_srand48_r=undef
17299                 srand48_r_proto=0
17300                 ;;
17301         esac
17302         ;;
17303 *)      srand48_r_proto=0
17304         ;;
17305 esac
17306
17307 : see if srandom_r exists
17308 set srandom_r d_srandom_r
17309 eval $inlibc
17310 case "$d_srandom_r" in
17311 "$define")
17312         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17313         case "$d_srandom_r_proto:$usethreads" in
17314         ":define")      d_srandom_r_proto=define
17315                 set d_srandom_r_proto srandom_r $hdrs
17316                 eval $hasproto ;;
17317         *)      ;;
17318         esac
17319         case "$d_srandom_r_proto" in
17320         define)
17321         case "$srandom_r_proto" in
17322         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17323         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17324         esac
17325         case "$srandom_r_proto" in
17326         ''|0)   d_srandom_r=undef
17327                 srandom_r_proto=0
17328                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17329         * )     case "$srandom_r_proto" in
17330                 REENTRANT_PROTO*) ;;
17331                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17332                 esac
17333                 echo "Prototype: $try" ;;
17334         esac
17335         ;;
17336         *)      case "$usethreads" in
17337                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17338                 esac
17339                 d_srandom_r=undef
17340                 srandom_r_proto=0
17341                 ;;
17342         esac
17343         ;;
17344 *)      srandom_r_proto=0
17345         ;;
17346 esac
17347
17348 : see if prototype for setresgid is available
17349 echo " "
17350 set d_sresgproto setresgid $i_unistd unistd.h
17351 eval $hasproto
17352
17353 : see if prototype for setresuid is available
17354 echo " "
17355 set d_sresuproto setresuid $i_unistd unistd.h
17356 eval $hasproto
17357
17358 : see if sys/stat.h is available
17359 set sys/stat.h i_sysstat
17360 eval $inhdr
17361
17362
17363 : see if stat knows about block sizes
17364 echo " "
17365 echo "Checking to see if your struct stat has st_blocks field..." >&4
17366 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17367 eval $hasfield
17368
17369
17370 : see if this is a sys/vfs.h system
17371 set sys/vfs.h i_sysvfs
17372 eval $inhdr
17373
17374
17375 : see if this is a sys/statfs.h system
17376 set sys/statfs.h i_sysstatfs
17377 eval $inhdr
17378
17379
17380 echo " "
17381 echo "Checking to see if your system supports struct statfs..." >&4
17382 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
17383 eval $hasstruct
17384 case "$d_statfs_s" in
17385 "$define")      echo "Yes, it does."   ;;
17386 *)              echo "No, it doesn't." ;;
17387 esac
17388
17389
17390
17391 : see if struct statfs knows about f_flags
17392 case "$d_statfs_s" in
17393 define) 
17394         echo " "
17395         echo "Checking to see if your struct statfs has f_flags field..." >&4
17396         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
17397         eval $hasfield
17398         ;;
17399 *)      val="$undef"
17400         set d_statfs_f_flags
17401         eval $setvar
17402         ;;
17403 esac
17404 case "$d_statfs_f_flags" in
17405 "$define")      echo "Yes, it does."   ;;
17406 *)              echo "No, it doesn't." ;;
17407 esac
17408
17409 $cat >&4 <<EOM
17410 Checking how to access stdio streams by file descriptor number...
17411 EOM
17412 case "$stdio_stream_array" in
17413 '')     $cat >try.c <<EOCP
17414 #include <stdio.h>
17415 int main() {
17416   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17417     printf("yes\n");
17418 }
17419 EOCP
17420         for s in _iob __iob __sF
17421         do
17422                 set try -DSTDIO_STREAM_ARRAY=$s
17423                 if eval $compile; then
17424                         case "`$run ./try`" in
17425                         yes)    stdio_stream_array=$s; break ;;
17426                         esac
17427                 fi
17428         done
17429         $rm_try
17430 esac
17431 case "$stdio_stream_array" in
17432 '')     $cat >&4 <<EOM
17433 I can't figure out how to access stdio streams by file descriptor number.
17434 EOM
17435         d_stdio_stream_array="$undef"
17436         ;;
17437 *)      $cat >&4 <<EOM
17438 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17439 EOM
17440         d_stdio_stream_array="$define"
17441         ;;
17442 esac
17443
17444 : see if strcoll exists
17445 set strcoll d_strcoll
17446 eval $inlibc
17447
17448 : check for structure copying
17449 echo " "
17450 echo "Checking to see if your C compiler can copy structs..." >&4
17451 $cat >try.c <<'EOCP'
17452 int main()
17453 {
17454         struct blurfl {
17455                 int dyick;
17456         } foo, bar;
17457
17458         foo = bar;
17459 }
17460 EOCP
17461 if $cc -c try.c >/dev/null 2>&1 ; then
17462         val="$define"
17463         echo "Yup, it can."
17464 else
17465         val="$undef"
17466         echo "Nope, it can't."
17467 fi
17468 set d_strctcpy
17469 eval $setvar
17470 $rm_try
17471
17472 : see if strerror and/or sys_errlist[] exist
17473 echo " "
17474 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17475     if set strerror val -f d_strerror; eval $csym; $val; then
17476                 echo 'strerror() found.' >&4
17477                 d_strerror="$define"
17478                 d_strerrm='strerror(e)'
17479                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17480                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17481                         d_syserrlst="$define"
17482                 else
17483                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17484                         d_syserrlst="$undef"
17485                 fi
17486     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17487                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17488                 echo 'strerror() found in string header.' >&4
17489                 d_strerror="$define"
17490                 d_strerrm='strerror(e)'
17491                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17492                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17493                                 d_syserrlst="$define"
17494                 else
17495                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17496                         d_syserrlst="$undef"
17497                 fi
17498     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17499                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17500                 d_strerror="$undef"
17501                 d_syserrlst="$define"
17502                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17503     else
17504                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17505                 d_strerror="$undef"
17506                 d_syserrlst="$undef"
17507                 d_strerrm='"unknown"'
17508     fi
17509 fi
17510
17511 : see if strerror_r exists
17512 set strerror_r d_strerror_r
17513 eval $inlibc
17514 case "$d_strerror_r" in
17515 "$define")
17516         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17517         case "$d_strerror_r_proto:$usethreads" in
17518         ":define")      d_strerror_r_proto=define
17519                 set d_strerror_r_proto strerror_r $hdrs
17520                 eval $hasproto ;;
17521         *)      ;;
17522         esac
17523         case "$d_strerror_r_proto" in
17524         define)
17525         case "$strerror_r_proto" in
17526         ''|0) try='int strerror_r(int, char*, size_t);'
17527         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17528         esac
17529         case "$strerror_r_proto" in
17530         ''|0) try='int strerror_r(int, char*, int);'
17531         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17532         esac
17533         case "$strerror_r_proto" in
17534         ''|0) try='char* strerror_r(int, char*, size_t);'
17535         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17536         esac
17537         case "$strerror_r_proto" in
17538         ''|0)   d_strerror_r=undef
17539                 strerror_r_proto=0
17540                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17541         * )     case "$strerror_r_proto" in
17542                 REENTRANT_PROTO*) ;;
17543                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17544                 esac
17545                 echo "Prototype: $try" ;;
17546         esac
17547         ;;
17548         *)      case "$usethreads" in
17549                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17550                 esac
17551                 d_strerror_r=undef
17552                 strerror_r_proto=0
17553                 ;;
17554         esac
17555         ;;
17556 *)      strerror_r_proto=0
17557         ;;
17558 esac
17559
17560 : see if strftime exists
17561 set strftime d_strftime
17562 eval $inlibc
17563
17564 : see if strlcat exists
17565 set strlcat d_strlcat
17566 eval $inlibc
17567
17568 : see if strlcpy exists
17569 set strlcpy d_strlcpy
17570 eval $inlibc
17571
17572 : see if strtod exists
17573 set strtod d_strtod
17574 eval $inlibc
17575
17576 : see if strtol exists
17577 set strtol d_strtol
17578 eval $inlibc
17579
17580 : see if strtold exists
17581 set strtold d_strtold
17582 eval $inlibc
17583
17584 : see if strtoll exists
17585 set strtoll d_strtoll
17586 eval $inlibc
17587
17588 case "$d_longlong-$d_strtoll" in
17589 "$define-$define")
17590         $cat <<EOM
17591 Checking whether your strtoll() works okay...
17592 EOM
17593         $cat >try.c <<'EOCP'
17594 #include <errno.h>
17595 #ifdef __hpux
17596 #define strtoll __strtoll
17597 #endif
17598 #ifdef __EMX__
17599 #define strtoll _strtoll
17600 #endif
17601 #include <stdio.h>
17602 extern long long int strtoll(char *s, char **, int); 
17603 static int bad = 0;
17604 int check(char *s, long long ell, int een) {
17605         long long gll;
17606         errno = 0;
17607         gll = strtoll(s, 0, 10);
17608         if (!((gll == ell) && (errno == een)))
17609                 bad++;
17610 }
17611 int main() {
17612         check(" 1",                                      1LL, 0);
17613         check(" 0",                                      0LL, 0);
17614         check("-1",                                     -1LL, 0);
17615         check("-9223372036854775808", -9223372036854775808LL, 0);
17616         check("-9223372036854775808", -9223372036854775808LL, 0);
17617         check(" 9223372036854775807",  9223372036854775807LL, 0);
17618         check("-9223372036854775808", -9223372036854775808LL, 0);
17619         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17620         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17621         if (!bad)
17622                 printf("ok\n");
17623 }
17624 EOCP
17625         set try
17626         if eval $compile; then
17627                 yyy=`$run ./try`
17628                 case "$yyy" in
17629                 ok) echo "Your strtoll() seems to be working okay." ;;
17630                 *) cat <<EOM >&4
17631 Your strtoll() doesn't seem to be working okay.
17632 EOM
17633                    d_strtoll="$undef"
17634                    ;;
17635                 esac
17636         else
17637                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17638                 d_strtoll="$undef"
17639         fi
17640         ;;
17641 esac
17642
17643 : see if strtoq exists
17644 set strtoq d_strtoq
17645 eval $inlibc
17646
17647 : see if strtoul exists
17648 set strtoul d_strtoul
17649 eval $inlibc
17650
17651 case "$d_strtoul" in
17652 "$define")
17653         $cat <<EOM
17654 Checking whether your strtoul() works okay...
17655 EOM
17656         $cat >try.c <<'EOCP'
17657 #include <errno.h>
17658 #include <stdio.h>
17659 extern unsigned long int strtoul(char *s, char **, int); 
17660 static int bad = 0;
17661 void check(char *s, unsigned long eul, int een) {
17662         unsigned long gul;
17663         errno = 0;
17664         gul = strtoul(s, 0, 10);
17665         if (!((gul == eul) && (errno == een)))
17666                 bad++;
17667 }
17668 int main() {
17669         check(" 1", 1L, 0);
17670         check(" 0", 0L, 0);
17671 EOCP
17672         case "$longsize" in
17673         8)
17674             $cat >>try.c <<'EOCP'
17675         check("18446744073709551615", 18446744073709551615UL, 0);
17676         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17677 #if 0 /* strtoul() for /^-/ strings is undefined. */
17678         check("-1", 18446744073709551615UL, 0);
17679         check("-18446744073709551614", 2, 0);
17680         check("-18446744073709551615", 1, 0);
17681         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17682         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17683 #endif
17684 EOCP
17685                 ;;
17686         4)
17687                     $cat >>try.c <<'EOCP'
17688         check("4294967295", 4294967295UL, 0);
17689         check("4294967296", 4294967295UL, ERANGE);
17690 #if 0 /* strtoul() for /^-/ strings is undefined. */
17691         check("-1", 4294967295UL, 0);
17692         check("-4294967294", 2, 0);
17693         check("-4294967295", 1, 0);
17694         check("-4294967296", 4294967295UL, ERANGE);
17695         check("-4294967297", 4294967295UL, ERANGE);
17696 #endif
17697 EOCP
17698                 ;;
17699         *)
17700 : Should we write these tests to be more portable by sprintf-ing
17701 : ~0 and then manipulating that char string as input for strtol?
17702                 ;;
17703         esac
17704         $cat >>try.c <<'EOCP'
17705         if (!bad)
17706                 printf("ok\n");
17707         return 0;
17708 }
17709 EOCP
17710         set try
17711         if eval $compile; then
17712                 case "`$run ./try`" in
17713                 ok) echo "Your strtoul() seems to be working okay." ;;
17714                 *) cat <<EOM >&4
17715 Your strtoul() doesn't seem to be working okay.
17716 EOM
17717                    d_strtoul="$undef"
17718                    ;;
17719                 esac
17720         else
17721                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17722                 d_strtoul="$undef"
17723         fi
17724         ;;
17725 esac
17726
17727 : see if strtoull exists
17728 set strtoull d_strtoull
17729 eval $inlibc
17730
17731 case "$d_longlong-$d_strtoull" in
17732 "$define-$define")
17733         $cat <<EOM
17734 Checking whether your strtoull() works okay...
17735 EOM
17736         $cat >try.c <<'EOCP'
17737 #include <errno.h>
17738 #ifdef __hpux
17739 #define strtoull __strtoull
17740 #endif
17741 #include <stdio.h>
17742 extern unsigned long long int strtoull(char *s, char **, int); 
17743 static int bad = 0;
17744 int check(char *s, long long eull, int een) {
17745         long long gull;
17746         errno = 0;
17747         gull = strtoull(s, 0, 10);
17748         if (!((gull == eull) && (errno == een)))
17749                 bad++;
17750 }
17751 int main() {
17752         check(" 1",                                        1LL, 0);
17753         check(" 0",                                        0LL, 0);
17754         check("18446744073709551615",  18446744073709551615ULL, 0);
17755         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17756 #if 0 /* strtoull() for /^-/ strings is undefined. */
17757         check("-1",                    18446744073709551615ULL, 0);
17758         check("-18446744073709551614",                     2LL, 0);
17759         check("-18446744073709551615",                     1LL, 0);
17760         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17761         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17762 #endif
17763         if (!bad)
17764                 printf("ok\n");
17765 }
17766 EOCP
17767         set try
17768         if eval $compile; then
17769                 case "`$run ./try`" in
17770                 ok) echo "Your strtoull() seems to be working okay." ;;
17771                 *) cat <<EOM >&4
17772 Your strtoull() doesn't seem to be working okay.
17773 EOM
17774                    d_strtoull="$undef"
17775                    ;;
17776                 esac
17777         else
17778                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17779                 d_strtoull="$undef"
17780         fi
17781         ;;
17782 esac
17783
17784 : see if strtouq exists
17785 set strtouq d_strtouq
17786 eval $inlibc
17787
17788 case "$d_strtouq" in
17789 "$define")
17790         $cat <<EOM
17791 Checking whether your strtouq() works okay...
17792 EOM
17793         $cat >try.c <<'EOCP'
17794 #include <errno.h>
17795 #include <stdio.h>
17796 extern unsigned long long int strtouq(char *s, char **, int); 
17797 static int bad = 0;
17798 void check(char *s, unsigned long long eull, int een) {
17799         unsigned long long gull;
17800         errno = 0;
17801         gull = strtouq(s, 0, 10);
17802         if (!((gull == eull) && (errno == een)))
17803                 bad++;
17804 }
17805 int main() {
17806         check(" 1",                                        1LL, 0);
17807         check(" 0",                                        0LL, 0);
17808         check("18446744073709551615",  18446744073709551615ULL, 0);
17809         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17810 #if 0 /* strtouq() for /^-/ strings is undefined. */
17811         check("-1",                    18446744073709551615ULL, 0);
17812         check("-18446744073709551614",                     2LL, 0);
17813         check("-18446744073709551615",                     1LL, 0);
17814         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17815         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17816 #endif
17817         if (!bad)
17818                 printf("ok\n");
17819         return 0;
17820 }
17821 EOCP
17822         set try
17823         if eval $compile; then
17824                 case "`$run ./try`" in
17825                 ok) echo "Your strtouq() seems to be working okay." ;;
17826                 *) cat <<EOM >&4
17827 Your strtouq() doesn't seem to be working okay.
17828 EOM
17829                    d_strtouq="$undef"
17830                    ;;
17831                 esac
17832         else
17833                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17834                 d_strtouq="$undef"
17835         fi
17836         ;;
17837 esac
17838
17839 : see if strxfrm exists
17840 set strxfrm d_strxfrm
17841 eval $inlibc
17842
17843 : see if symlink exists
17844 set symlink d_symlink
17845 eval $inlibc
17846
17847 : see if syscall exists
17848 set syscall d_syscall
17849 eval $inlibc
17850
17851 : see if prototype for syscall is available
17852 echo " "
17853 set d_syscallproto syscall $i_unistd unistd.h
17854 eval $hasproto
17855
17856 : see if sysconf exists
17857 set sysconf d_sysconf
17858 eval $inlibc
17859
17860 : see if system exists
17861 set system d_system
17862 eval $inlibc
17863
17864 : see if tcgetpgrp exists
17865 set tcgetpgrp d_tcgetpgrp
17866 eval $inlibc
17867
17868 : see if tcsetpgrp exists
17869 set tcsetpgrp d_tcsetpgrp
17870 eval $inlibc
17871
17872 : see if prototype for telldir is available
17873 echo " "
17874 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17875 eval $hasproto
17876
17877 : see if time exists
17878 echo " "
17879 if test "X$d_time" = X -o X"$timetype" = X; then
17880     if set time val -f d_time; eval $csym; $val; then
17881                 echo 'time() found.' >&4
17882                 val="$define"
17883                 rp="What is the type returned by time() on this system?"
17884                 set time_t timetype long stdio.h sys/types.h
17885                 eval $typedef_ask
17886     else
17887                 echo 'time() not found, hope that will do.' >&4
17888                 val="$undef"
17889                 timetype='int';
17890     fi
17891     set d_time
17892     eval $setvar
17893 fi
17894
17895 : see if this is a sys/times.h system
17896 set sys/times.h i_systimes
17897 eval $inhdr
17898
17899 : see if times exists
17900 echo " "
17901 if set times val -f d_times; eval $csym; $val; then
17902         echo 'times() found.' >&4
17903         d_times="$define"
17904         inc=''
17905         case "$i_systimes" in
17906         "$define") inc='sys/times.h';;
17907         esac
17908         rp="What is the type returned by times() on this system?"
17909         set clock_t clocktype long stdio.h sys/types.h $inc
17910         eval $typedef_ask
17911 else
17912         echo 'times() NOT found, hope that will do.' >&4
17913         d_times="$undef"
17914         clocktype='int'
17915 fi
17916
17917 : see if tmpnam_r exists
17918 set tmpnam_r d_tmpnam_r
17919 eval $inlibc
17920 case "$d_tmpnam_r" in
17921 "$define")
17922         hdrs="$i_systypes sys/types.h define stdio.h "
17923         case "$d_tmpnam_r_proto:$usethreads" in
17924         ":define")      d_tmpnam_r_proto=define
17925                 set d_tmpnam_r_proto tmpnam_r $hdrs
17926                 eval $hasproto ;;
17927         *)      ;;
17928         esac
17929         case "$d_tmpnam_r_proto" in
17930         define)
17931         case "$tmpnam_r_proto" in
17932         ''|0) try='char* tmpnam_r(char*);'
17933         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17934         esac
17935         case "$tmpnam_r_proto" in
17936         ''|0)   d_tmpnam_r=undef
17937                 tmpnam_r_proto=0
17938                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17939         * )     case "$tmpnam_r_proto" in
17940                 REENTRANT_PROTO*) ;;
17941                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17942                 esac
17943                 echo "Prototype: $try" ;;
17944         esac
17945         ;;
17946         *)      case "$usethreads" in
17947                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17948                 esac
17949                 d_tmpnam_r=undef
17950                 tmpnam_r_proto=0
17951                 ;;
17952         esac
17953         ;;
17954 *)      tmpnam_r_proto=0
17955         ;;
17956 esac
17957
17958 : see if truncate exists
17959 set truncate d_truncate
17960 eval $inlibc
17961
17962 : see if ttyname_r exists
17963 set ttyname_r d_ttyname_r
17964 eval $inlibc
17965 case "$d_ttyname_r" in
17966 "$define")
17967         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17968         case "$d_ttyname_r_proto:$usethreads" in
17969         ":define")      d_ttyname_r_proto=define
17970                 set d_ttyname_r_proto ttyname_r $hdrs
17971                 eval $hasproto ;;
17972         *)      ;;
17973         esac
17974         case "$d_ttyname_r_proto" in
17975         define)
17976         case "$ttyname_r_proto" in
17977         ''|0) try='int ttyname_r(int, char*, size_t);'
17978         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17979         esac
17980         case "$ttyname_r_proto" in
17981         ''|0) try='int ttyname_r(int, char*, int);'
17982         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17983         esac
17984         case "$ttyname_r_proto" in
17985         ''|0) try='char* ttyname_r(int, char*, int);'
17986         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17987         esac
17988         case "$ttyname_r_proto" in
17989         ''|0)   d_ttyname_r=undef
17990                 ttyname_r_proto=0
17991                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17992         * )     case "$ttyname_r_proto" in
17993                 REENTRANT_PROTO*) ;;
17994                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17995                 esac
17996                 echo "Prototype: $try" ;;
17997         esac
17998         ;;
17999         *)      case "$usethreads" in
18000                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18001                 esac
18002                 d_ttyname_r=undef
18003                 ttyname_r_proto=0
18004                 ;;
18005         esac
18006         ;;
18007 *)      ttyname_r_proto=0
18008         ;;
18009 esac
18010
18011 : see if tzname[] exists
18012 echo " "
18013 if set tzname val -a d_tzname; eval $csym; $val; then
18014         val="$define"
18015         echo 'tzname[] found.' >&4
18016 else
18017         val="$undef"
18018         echo 'tzname[] NOT found.' >&4
18019 fi
18020 set d_tzname
18021 eval $setvar
18022
18023 case "$osname" in
18024 next|rhapsody|darwin) multiarch="$define" ;;
18025 esac
18026 case "$multiarch" in
18027 ''|[nN]*) multiarch="$undef" ;;
18028 esac
18029
18030 : check for ordering of bytes in a UV
18031 echo " "
18032 case "$usecrosscompile$multiarch" in
18033 *$define*)
18034         $cat <<EOM
18035 You seem to be either cross-compiling or doing a multiarchitecture build,
18036 skipping the byteorder check.
18037
18038 EOM
18039         byteorder='ffff'
18040         ;;
18041 *)
18042         case "$byteorder" in
18043         '')
18044                 $cat <<'EOM'
18045 In the following, larger digits indicate more significance.  A big-endian
18046 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18047 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18048 machines may have weird orders like 3412.  A Cray will report 87654321,
18049 an Alpha will report 12345678. If the test program works the default is
18050 probably right.
18051 I'm now running the test program...
18052 EOM
18053                 $cat >try.c <<EOCP
18054 #include <stdio.h>
18055 #$i_stdlib I_STDLIB
18056 #ifdef I_STDLIB
18057 #include <stdlib.h>
18058 #endif
18059 #include <sys/types.h>
18060 typedef $uvtype UV;
18061 int main()
18062 {
18063         int i;
18064         union {
18065                 UV l;
18066                 char c[$uvsize];
18067         } u;
18068
18069         if ($uvsize > 4)
18070                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18071         else
18072                 u.l = (UV)0x04030201;
18073         for (i = 0; i < $uvsize; i++)
18074                 printf("%c", u.c[i]+'0');
18075         printf("\n");
18076         exit(0);
18077 }
18078 EOCP
18079                 xxx_prompt=y
18080                 set try
18081                 if eval $compile && $run ./try > /dev/null; then
18082                         dflt=`$run ./try`
18083                         case "$dflt" in
18084                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18085                                 echo "(The test program ran ok.)"
18086                                 echo "byteorder=$dflt"
18087                                 xxx_prompt=n
18088                         ;;
18089                         ????|????????) echo "(The test program ran ok.)" ;;
18090                         *) echo "(The test program didn't run right for some reason.)" ;;
18091                         esac
18092                 else
18093                         dflt='4321'
18094                         cat <<'EOM'
18095 (I can't seem to compile the test program.  Guessing big-endian...)
18096 EOM
18097                 fi
18098                 case "$xxx_prompt" in
18099                 y)
18100                         rp="What is the order of bytes in $uvtype?"
18101                         . ./myread
18102                         byteorder="$ans"
18103                         ;;
18104                 *)      byteorder=$dflt
18105                         ;;
18106                 esac
18107                 ;;
18108         esac
18109         $rm_try
18110         ;;
18111 esac
18112
18113 $cat <<EOM
18114
18115 Checking to see whether you can access character data unalignedly...
18116 EOM
18117 case "$d_u32align" in
18118 '')   $cat >try.c <<EOCP
18119 #include <stdio.h>
18120 #$i_stdlib I_STDLIB
18121 #ifdef I_STDLIB
18122 #include <stdlib.h>
18123 #endif
18124 #define U32 $u32type
18125 #define BYTEORDER 0x$byteorder
18126 #define U8 $u8type
18127 #include <signal.h>
18128 #ifdef SIGBUS
18129 $signal_t bletch(int s) { exit(4); }
18130 #endif
18131 int main() {
18132 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18133     U8 buf[8];
18134     U32 *up;
18135     int i;
18136
18137     if (sizeof(U32) != 4) {
18138         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18139         exit(1);
18140     }
18141
18142     fflush(stdout);
18143
18144 #ifdef SIGBUS
18145     signal(SIGBUS, bletch);
18146 #endif
18147
18148     buf[0] = 0;
18149     buf[1] = 0;
18150     buf[2] = 0;
18151     buf[3] = 1;
18152     buf[4] = 0;
18153     buf[5] = 0;
18154     buf[6] = 0;
18155     buf[7] = 1;
18156
18157     for (i = 0; i < 4; i++) {
18158         up = (U32*)(buf + i);
18159         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18160                (*up == 1 << (8*(3-i)))  /* little-endian */
18161               )
18162            )
18163         {
18164             printf("read failed (%x)\n", *up);
18165             exit(2);
18166         }
18167     }
18168
18169     /* write test */
18170     for (i = 0; i < 4; i++) {
18171         up = (U32*)(buf + i);
18172         *up = 0xBeef;
18173         if (*up != 0xBeef) {
18174             printf("write failed (%x)\n", *up);
18175             exit(3);
18176         }
18177     }
18178
18179     exit(0);
18180 #else
18181     printf("1\n");
18182     exit(1);
18183 #endif
18184     return 0;
18185 }
18186 EOCP
18187 set try
18188 if eval $compile_ok; then
18189         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18190         $run ./try 2>&1 >/dev/null
18191         case "$?" in
18192         0)      cat >&4 <<EOM
18193 You can access character data pretty unalignedly.
18194 EOM
18195                 d_u32align="$undef"
18196                 ;;
18197         *)      cat >&4 <<EOM
18198 It seems that you must access character data in an aligned manner.
18199 EOM
18200                 d_u32align="$define"
18201                 ;;
18202         esac
18203 else
18204         rp='Can you access character data at unaligned addresses?'
18205         dflt='n'
18206         . ./myread
18207         case "$ans" in
18208         [yY]*)  d_u32align="$undef"  ;;
18209         *)      d_u32align="$define" ;;
18210         esac
18211 fi
18212 $rm_try
18213 ;;
18214 esac
18215
18216 : see if ualarm exists
18217 set ualarm d_ualarm
18218 eval $inlibc
18219
18220 : see if umask exists
18221 set umask d_umask
18222 eval $inlibc
18223
18224 : see if unordered exists
18225 set unordered d_unordered
18226 eval $inlibc
18227
18228 : see if unsetenv exists
18229 set unsetenv d_unsetenv
18230 eval $inlibc
18231
18232 : see if usleep exists
18233 set usleep d_usleep
18234 eval $inlibc
18235
18236 : see if prototype for usleep is available
18237 echo " "
18238 set d_usleepproto usleep $i_unistd unistd.h
18239 eval $hasproto
18240
18241 : see if ustat exists
18242 set ustat d_ustat
18243 eval $inlibc
18244
18245 : see if closedir exists
18246 set closedir d_closedir
18247 eval $inlibc
18248
18249 case "$d_closedir" in
18250 "$define")
18251         echo " "
18252         echo "Checking whether closedir() returns a status..." >&4
18253         cat > try.c <<EOM
18254 #$i_dirent I_DIRENT             /**/
18255 #$i_sysdir I_SYS_DIR            /**/
18256 #$i_sysndir I_SYS_NDIR          /**/
18257 #$i_systypes I_SYS_TYPES        /**/
18258
18259 #if defined(I_SYS_TYPES)
18260 #include <sys/types.h>
18261 #endif
18262 #if defined(I_DIRENT)
18263 #include <dirent.h>
18264 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18265 #include <sys/dir.h>
18266 #endif
18267 #else
18268 #ifdef I_SYS_NDIR
18269 #include <sys/ndir.h>
18270 #else
18271 #ifdef I_SYS_DIR
18272 #ifdef hp9000s500
18273 #include <ndir.h>       /* may be wrong in the future */
18274 #else
18275 #include <sys/dir.h>
18276 #endif
18277 #endif
18278 #endif
18279 #endif
18280 int main() { return closedir(opendir(".")); }
18281 EOM
18282         set try
18283         if eval $compile_ok; then
18284                 if $run ./try > /dev/null 2>&1 ; then
18285                         echo "Yes, it does."
18286                         val="$undef"
18287                 else
18288                         echo "No, it doesn't."
18289                         val="$define"
18290                 fi
18291         else
18292                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18293                 val="$define"
18294         fi
18295         ;;
18296 *)
18297         val="$undef";
18298         ;;
18299 esac
18300 set d_void_closedir
18301 eval $setvar
18302 $rm_try
18303
18304 : see if there is a wait4
18305 set wait4 d_wait4
18306 eval $inlibc
18307
18308 : see if waitpid exists
18309 set waitpid d_waitpid
18310 eval $inlibc
18311
18312 : see if wcstombs exists
18313 set wcstombs d_wcstombs
18314 eval $inlibc
18315
18316 : see if wctomb exists
18317 set wctomb d_wctomb
18318 eval $inlibc
18319
18320 : see if writev exists
18321 set writev d_writev
18322 eval $inlibc
18323
18324 : preserve RCS keywords in files with variable substitution, grrr
18325 Date='$Date'
18326 Id='$Id'
18327 Log='$Log'
18328 RCSfile='$RCSfile'
18329 Revision='$Revision'
18330
18331 : check for alignment requirements
18332 echo " "
18333 case "$usecrosscompile$multiarch" in
18334 *$define*)
18335         $cat <<EOM
18336 You seem to be either cross-compiling or doing a multiarchitecture build,
18337 skipping the memory alignment check.
18338
18339 EOM
18340         case "$alignbytes" in
18341         '') alignbytes=8 ;;
18342         esac
18343         ;;
18344 *)
18345         case "$alignbytes" in
18346         '') echo "Checking alignment constraints..." >&4
18347                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18348                         $cat >try.c <<'EOCP'
18349 typedef long double NV;
18350 EOCP
18351                 else
18352                         $cat >try.c <<'EOCP'
18353 typedef double NV;
18354 EOCP
18355                 fi
18356                 $cat >>try.c <<'EOCP'
18357 #include <stdio.h>
18358 struct foobar {
18359         char foo;
18360         NV bar;
18361 } try_algn;
18362 int main()
18363 {
18364     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18365     return(0);
18366 }
18367 EOCP
18368                 set try
18369                 if eval $compile_ok; then
18370                         dflt=`$run ./try`
18371                 else
18372                         dflt='8'
18373                         echo "(I can't seem to compile the test program...)"
18374                 fi
18375                 ;;
18376         *) dflt="$alignbytes"
18377                 ;;
18378         esac
18379         rp="Doubles must be aligned on a how-many-byte boundary?"
18380         . ./myread
18381         alignbytes="$ans"
18382         $rm_try
18383         ;;
18384 esac
18385
18386
18387 : set the base revision
18388 baserev=5.0
18389
18390 : how do we concatenate cpp tokens here?
18391 echo " "
18392 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18393 $cat >cpp_stuff.c <<'EOCP'
18394 #define RCAT(a,b)a/**/b
18395 #define ACAT(a,b)a ## b
18396 RCAT(Rei,ser)
18397 ACAT(Cir,cus)
18398 EOCP
18399 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18400 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18401         echo "Oh!  Smells like ANSI's been here." >&4
18402         echo "We can catify or stringify, separately or together!"
18403         cpp_stuff=42
18404 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18405         echo "Ah, yes!  The good old days!" >&4
18406         echo "However, in the good old days we don't know how to stringify and"
18407         echo "catify at the same time."
18408         cpp_stuff=1
18409 else
18410         $cat >&4 <<EOM
18411 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18412 You're going to have to edit the values of CAT[2-5] in config.h...
18413 EOM
18414         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18415 fi
18416 $rm -f cpp_stuff.*
18417
18418 : see if this is a db.h system
18419 set db.h i_db
18420 eval $inhdr
18421
18422 case "$i_db" in
18423 $define)
18424         : Check db version.
18425         echo " "
18426         echo "Checking Berkeley DB version ..." >&4
18427         $cat >try.c <<EOCP
18428 #$d_const HASCONST
18429 #ifndef HASCONST
18430 #define const
18431 #endif
18432 #include <sys/types.h>
18433 #include <stdio.h>
18434 #$i_stdlib I_STDLIB
18435 #ifdef I_STDLIB
18436 #include <stdlib.h>
18437 #endif
18438 #include <db.h>
18439 int main(int argc, char *argv[])
18440 {
18441 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18442     int Major, Minor, Patch ;
18443     unsigned long Version ;
18444     (void)db_version(&Major, &Minor, &Patch) ;
18445     if (argc == 2) {
18446         printf("%d %d %d %d %d %d\n",
18447                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18448                Major, Minor, Patch);
18449         exit(0);
18450     }
18451     printf("You have Berkeley DB Version 2 or greater.\n");
18452
18453     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18454                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18455     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18456                 Major, Minor, Patch) ;
18457
18458     /* check that db.h & libdb are compatible */
18459     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18460         printf("db.h and libdb are incompatible.\n") ;
18461         exit(3);
18462     }
18463
18464     printf("db.h and libdb are compatible.\n") ;
18465
18466     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18467                 + DB_VERSION_PATCH ;
18468
18469     /* needs to be >= 2.3.4 */
18470     if (Version < 2003004) {
18471     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18472         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18473         exit(2);
18474     }
18475
18476     exit(0);
18477 #else
18478 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18479     if (argc == 2) {
18480         printf("1 0 0\n");
18481         exit(0);
18482     }
18483     printf("You have Berkeley DB Version 1.\n");
18484     exit(0);    /* DB version < 2: the coast is clear. */
18485 #else
18486     exit(1);    /* <db.h> not Berkeley DB? */
18487 #endif
18488 #endif
18489 }
18490 EOCP
18491         set try
18492         if eval $compile_ok && $run ./try; then
18493                 echo 'Looks OK.' >&4
18494                 set `$run ./try 1`
18495                 db_version_major=$1
18496                 db_version_minor=$2
18497                 db_version_patch=$3
18498         else
18499                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18500                 i_db=$undef
18501                 case " $libs " in
18502                 *"-ldb "*)
18503                         : Remove db from list of libraries to use
18504                         echo "Removing unusable -ldb from library list" >&4
18505                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18506                         shift
18507                         libs="$*"
18508                         echo "libs = $libs" >&4
18509                         ;;
18510                 esac
18511         fi
18512         $rm_try
18513         ;;
18514 esac
18515
18516 case "$i_db" in
18517 define)
18518         : Check the return type needed for hash
18519         echo " "
18520         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18521         $cat >try.c <<EOCP
18522 #$d_const HASCONST
18523 #ifndef HASCONST
18524 #define const
18525 #endif
18526 #include <sys/types.h>
18527 #include <db.h>
18528
18529 #ifndef DB_VERSION_MAJOR
18530 u_int32_t hash_cb (ptr, size)
18531 const void *ptr;
18532 size_t size;
18533 {
18534 }
18535 HASHINFO info;
18536 int main()
18537 {
18538         info.hash = hash_cb;
18539 }
18540 #endif
18541 EOCP
18542         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18543                 if $contains warning try.out >>/dev/null 2>&1 ; then
18544                         db_hashtype='int'
18545                 else
18546                         db_hashtype='u_int32_t'
18547                 fi
18548         else
18549                 : XXX Maybe we should just give up here.
18550                 db_hashtype=u_int32_t
18551                 $cat try.out >&4
18552                 echo "Help:  I can't seem to compile the db test program." >&4
18553                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18554         fi
18555         $rm_try
18556         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18557         ;;
18558 *)      db_hashtype=u_int32_t
18559         ;;
18560 esac
18561 case "$i_db" in
18562 define)
18563         : Check the return type needed for prefix
18564         echo " "
18565         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18566         cat >try.c <<EOCP
18567 #$d_const HASCONST
18568 #ifndef HASCONST
18569 #define const
18570 #endif
18571 #include <sys/types.h>
18572 #include <db.h>
18573
18574 #ifndef DB_VERSION_MAJOR
18575 size_t prefix_cb (key1, key2)
18576 const DBT *key1;
18577 const DBT *key2;
18578 {
18579 }
18580 BTREEINFO info;
18581 int main()
18582 {
18583         info.prefix = prefix_cb;
18584 }
18585 #endif
18586 EOCP
18587         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18588                 if $contains warning try.out >>/dev/null 2>&1 ; then
18589                         db_prefixtype='int'
18590                 else
18591                         db_prefixtype='size_t'
18592                 fi
18593         else
18594                 db_prefixtype='size_t'
18595                 : XXX Maybe we should just give up here.
18596                 $cat try.out >&4
18597                 echo "Help:  I can't seem to compile the db test program." >&4
18598                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18599         fi
18600         $rm_try
18601         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18602         ;;
18603 *)      db_prefixtype='size_t'
18604         ;;
18605 esac
18606
18607 : How can we generate normalized random numbers ?
18608 echo " "
18609 echo "Looking for a random number function..." >&4
18610 case "$randfunc" in
18611 '')
18612         if set drand48 val -f; eval $csym; $val; then
18613                 dflt="drand48"
18614                 echo "Good, found drand48()." >&4
18615         elif set random val -f; eval $csym; $val; then
18616                 dflt="random"
18617                 echo "OK, found random()." >&4
18618         else
18619                 dflt="rand"
18620                 echo "Yick, looks like I have to use rand()." >&4
18621         fi
18622         echo " "
18623         ;;
18624 *)
18625         dflt="$randfunc"
18626         ;;
18627 esac
18628 cont=true
18629
18630 case "$ccflags" in
18631 *-Dmy_rand=*|*-Dmy_srand=*)
18632         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18633         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18634         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18635         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18636         ;;
18637 esac
18638
18639 while $test "$cont"; do
18640         rp="Use which function to generate random numbers?"
18641         . ./myread
18642         if $test "$ans" = "$dflt"; then
18643                 : null
18644         else
18645                 randbits=''
18646         fi
18647         randfunc="$ans"
18648         if set $ans val -f; eval $csym; $val; then
18649                 cont=''
18650         else
18651                 dflt=y
18652                 rp="I cannot find function $ans. Use that name anyway?"
18653                 . ./myread
18654                 dflt=rand
18655                 case "$ans" in
18656                         [yY]*) cont='';;
18657                 esac
18658         fi
18659         case "$cont" in
18660         '')
18661                 case "$randfunc" in
18662                 drand48)
18663                         drand01="drand48()"
18664                         seedfunc="srand48"
18665                         randbits=48
18666                         randseedtype=long
18667                         ;;
18668                 rand|random)
18669                         case "$randbits" in
18670                         '')
18671 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18672                                 $cat >try.c <<EOCP
18673 #$i_unistd I_UNISTD
18674 #$i_stdlib I_STDLIB
18675 #include <stdio.h>
18676 #ifdef I_UNISTD
18677 #  include <unistd.h>
18678 #endif
18679 #ifdef I_STDLIB
18680 #  include <stdlib.h>
18681 #endif
18682 int main()
18683 {
18684         register int i;
18685         register unsigned long tmp;
18686         register unsigned long max = 0L;
18687
18688         for (i = 1000; i; i--) {
18689                 tmp = (unsigned long) $randfunc();
18690                 if (tmp > max) max = tmp;
18691         }
18692         for (i = 0; max; i++)
18693                 max /= 2;
18694         printf("%d\n",i);
18695 }
18696 EOCP
18697                                 set try
18698                                 if eval $compile_ok; then
18699                                         dflt=`try`
18700                                 else
18701                                         dflt='?'
18702                                         echo "(I can't seem to compile the test program...)"
18703                                 fi
18704                                 ;;
18705                         *)
18706                                 dflt="$randbits"
18707                                 ;;
18708                         esac
18709                         rp="How many bits does your $randfunc() function produce?"
18710                         . ./myread
18711                         randbits="$ans"
18712                         $rm_try
18713                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18714                         seedfunc="s$randfunc"
18715                         randseedtype=unsigned
18716                         ;;
18717                 *)
18718                         dflt="31"
18719                         rp="How many bits does your $randfunc() function produce?"
18720                         . ./myread
18721                         randbits="$ans"
18722                         seedfunc="s$randfunc"
18723                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18724                         if set $seedfunc val -f; eval $csym; $val; then
18725                                 echo "(Using $seedfunc() to seed random generator)"
18726                         else
18727                                 echo "(Warning: no $seedfunc() to seed random generator)"
18728                                 seedfunc=rand
18729                         fi
18730                         randseedtype=unsigned
18731                         ;;
18732                 esac
18733                 ;;
18734         esac
18735 done
18736
18737 echo " "
18738 echo "Determining whether or not we are on an EBCDIC system..." >&4
18739 $cat >try.c <<'EOM'
18740 int main()
18741 {
18742   if ('M'==0xd4) return 0;
18743   return 1;
18744 }
18745 EOM
18746
18747 val=$undef
18748 set try
18749 if eval $compile_ok; then
18750         if $run ./try; then
18751                 echo "You seem to speak EBCDIC." >&4
18752                 val="$define"
18753         else
18754                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18755         fi
18756 else
18757         echo "I'm unable to compile the test program." >&4
18758         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18759 fi
18760 $rm_try
18761 set ebcdic
18762 eval $setvar
18763
18764 echo " "
18765 $cat >&4 <<EOM
18766 Checking how to flush all pending stdio output...
18767 EOM
18768 # I only know how to find the first 32 possibly open files on SunOS.
18769 # See also hints/sunos_4_1.sh and util.c  --AD
18770 case "$osname" in
18771 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18772 esac
18773 $cat >>try.c <<EOCP
18774 #include <stdio.h>
18775 #$i_stdlib I_STDLIB
18776 #ifdef I_STDLIB
18777 #include <stdlib.h>
18778 #endif
18779 #$i_unistd I_UNISTD
18780 #ifdef I_UNISTD
18781 # include <unistd.h>
18782 #endif
18783 #$d_sysconf HAS_SYSCONF
18784 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18785 #ifdef HAS_STDIO_STREAM_ARRAY
18786 # define STDIO_STREAM_ARRAY $stdio_stream_array
18787 #endif
18788 int main() {
18789   FILE* p;
18790   unlink("try.out");
18791   p = fopen("try.out", "w");
18792 #ifdef TRY_FPUTC
18793   fputc('x', p);
18794 #else
18795 # ifdef TRY_FPRINTF
18796   fprintf(p, "x");
18797 # endif
18798 #endif
18799 #ifdef TRY_FFLUSH_NULL
18800   fflush(NULL);
18801 #endif
18802 #ifdef TRY_FFLUSH_ALL
18803   {
18804     long open_max = -1;
18805 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18806     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18807 # else
18808 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18809     open_max = sysconf(_SC_OPEN_MAX);
18810 #  else
18811 #   ifdef FOPEN_MAX
18812     open_max = FOPEN_MAX;
18813 #   else
18814 #    ifdef OPEN_MAX
18815     open_max = OPEN_MAX;
18816 #    else
18817 #     ifdef _NFILE
18818     open_max = _NFILE;
18819 #     endif
18820 #    endif
18821 #   endif
18822 #  endif
18823 # endif
18824 # ifdef HAS_STDIO_STREAM_ARRAY
18825     if (open_max > 0) {
18826       long i;
18827       for (i = 0; i < open_max; i++)
18828             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18829                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18830                 STDIO_STREAM_ARRAY[i]._flag)
18831                 fflush(&STDIO_STREAM_ARRAY[i]);
18832     }
18833   }
18834 # endif
18835 #endif
18836   _exit(42);
18837 }
18838 EOCP
18839 : first we have to find out how _not_ to flush
18840 $to try.c
18841 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18842     output=''
18843     set try -DTRY_FPUTC
18844     if eval $compile; then
18845             $run ./try 2>/dev/null
18846             code="$?"
18847             $from try.out
18848             if $test ! -s try.out -a "X$code" = X42; then
18849                 output=-DTRY_FPUTC
18850             fi
18851     fi
18852     case "$output" in
18853     '')
18854             set try -DTRY_FPRINTF
18855             if eval $compile; then
18856                     $run ./try 2>/dev/null
18857                     code="$?"
18858                     $from try.out
18859                     if $test ! -s try.out -a "X$code" = X42; then
18860                         output=-DTRY_FPRINTF
18861                     fi
18862             fi
18863         ;;
18864     esac
18865 fi
18866 : check for fflush NULL behaviour
18867 case "$fflushNULL" in
18868 '')     set try -DTRY_FFLUSH_NULL $output
18869         if eval $compile; then
18870                 $run ./try 2>/dev/null
18871                 code="$?"
18872                 $from try.out
18873                 if $test -s try.out -a "X$code" = X42; then
18874                         fflushNULL="`$cat try.out`"
18875                 else
18876                         if $test "X$code" != X42; then
18877                                 $cat >&4 <<EOM
18878 (If this test failed, don't worry, we'll try another method shortly.)
18879 EOM
18880                         fi
18881                 fi
18882         fi
18883         $rm_try
18884         case "$fflushNULL" in
18885         x)      $cat >&4 <<EOM
18886 Your fflush(NULL) works okay for output streams.
18887 Let's see if it clobbers input pipes...
18888 EOM
18889 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18890 # bug that improperly flushes the input end of pipes.  So we avoid the
18891 # autoflush on fork/system/exec support for now. :-(
18892 $cat >tryp.c <<EOCP
18893 #include <stdio.h>
18894 int
18895 main(int argc, char **argv)
18896 {
18897     char buf[1024];
18898     int i;
18899     char *bp = buf;
18900     while (1) {
18901         while ((i = getc(stdin)) != -1
18902                && (*bp++ = i) != '\n'
18903                && bp < &buf[1024])
18904         /* DO NOTHING */ ;
18905         *bp = '\0';
18906         fprintf(stdout, "%s", buf);
18907         fflush(NULL);
18908         if (i == -1)
18909             return 0;
18910         bp = buf;
18911     }
18912 }
18913 EOCP
18914                 fflushNULL="$define"
18915                 set tryp
18916                 if eval $compile; then
18917                     $rm -f tryp.out
18918                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18919                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18920                        $cat >&4 <<EOM
18921 fflush(NULL) seems to behave okay with input streams.
18922 EOM
18923                         fflushNULL="$define"
18924                     else
18925                         $cat >&4 <<EOM
18926 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18927 EOM
18928                         fflushNULL="$undef"
18929                     fi
18930                 fi
18931                 $rm -f core tryp.c tryp.core core.tryp.*
18932                 ;;
18933         '')     $cat >&4 <<EOM
18934 Your fflush(NULL) isn't working (contrary to ANSI C).
18935 EOM
18936                 fflushNULL="$undef"
18937                 ;;
18938         *)      $cat >&4 <<EOM
18939 Cannot figure out whether your fflush(NULL) works or not.
18940 I'm assuming it doesn't (contrary to ANSI C).
18941 EOM
18942                 fflushNULL="$undef"
18943                 ;;
18944         esac
18945         ;;
18946 $define|true|[yY]*)
18947         fflushNULL="$define"
18948         ;;
18949 *)
18950         fflushNULL="$undef"
18951         ;;
18952 esac
18953 : check explicit looping only if NULL did not work, and if the pipe
18954 : bug does not show up on an explicit flush too
18955 case "$fflushNULL" in
18956 "$undef")
18957         $cat >tryp.c <<EOCP
18958 #include <stdio.h>
18959 int
18960 main(int argc, char **argv)
18961 {
18962     char buf[1024];
18963     int i;
18964     char *bp = buf;
18965     while (1) {
18966         while ((i = getc(stdin)) != -1
18967                && (*bp++ = i) != '\n'
18968                && bp < &buf[1024])
18969         /* DO NOTHING */ ;
18970         *bp = '\0';
18971         fprintf(stdout, "%s", buf);
18972         fflush(stdin);
18973         if (i == -1)
18974             return 0;
18975         bp = buf;
18976     }
18977 }
18978 EOCP
18979         set tryp
18980         if eval $compile; then
18981             $rm -f tryp.out
18982             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18983             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18984                $cat >&4 <<EOM
18985 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18986 EOM
18987                 : now check for fflushall behaviour
18988                 case "$fflushall" in
18989                 '')     set try -DTRY_FFLUSH_ALL $output
18990                         if eval $compile; then
18991                                 $cat >&4 <<EOM
18992 (Now testing the other method--but note that this also may fail.)
18993 EOM
18994                                 $run ./try 2>/dev/null
18995                                 code=$?
18996                                 $from try.out
18997                                 if $test -s try.out -a "X$code" = X42; then
18998                                         fflushall="`$cat try.out`"
18999                                 fi
19000                         fi
19001                         $rm_try
19002                         case "$fflushall" in
19003                         x)      $cat >&4 <<EOM
19004 Whew. Flushing explicitly all the stdio streams works.
19005 EOM
19006                                 fflushall="$define"
19007                                 ;;
19008                         '')     $cat >&4 <<EOM
19009 Sigh. Flushing explicitly all the stdio streams doesn't work.
19010 EOM
19011                                 fflushall="$undef"
19012                                 ;;
19013                         *)      $cat >&4 <<EOM
19014 Cannot figure out whether flushing stdio streams explicitly works or not.
19015 I'm assuming it doesn't.
19016 EOM
19017                                 fflushall="$undef"
19018                                 ;;
19019                         esac
19020                         ;;
19021                 "$define"|true|[yY]*)
19022                         fflushall="$define"
19023                         ;;
19024                 *)
19025                         fflushall="$undef"
19026                         ;;
19027                 esac
19028             else
19029                 $cat >&4 <<EOM
19030 All is futile.  Even fflush(stdin) clobbers input pipes!
19031 EOM
19032                 fflushall="$undef"
19033             fi
19034         else
19035             fflushall="$undef"
19036         fi
19037         $rm -f core tryp.c tryp.core core.tryp.*
19038         ;;
19039 *)      fflushall="$undef"
19040         ;;
19041 esac
19042
19043 case "$fflushNULL$fflushall" in
19044 undefundef)
19045         $cat <<EOM
19046 OK, I give up.  I cannot figure out how to flush pending stdio output.
19047 We won't be flushing handles at all before fork/exec/popen.
19048 EOM
19049         ;;
19050 esac
19051 $rm_try
19052
19053 : Store the full pathname to the ar program for use in the C program
19054 : Respect a hint or command line value for full_ar.
19055 case "$full_ar" in
19056 '') full_ar=$ar ;;
19057 esac
19058
19059 : Store the full pathname to the sed program for use in the C program
19060 full_sed=$sed
19061
19062 : see what type gids are declared as in the kernel
19063 echo " "
19064 echo "Looking for the type for group ids returned by getgid()."
19065 set gid_t gidtype xxx stdio.h sys/types.h
19066 eval $typedef
19067 case "$gidtype" in
19068 xxx)
19069         xxx=`./findhdr sys/user.h`
19070         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19071         case $1 in
19072         unsigned) dflt="$1 $2" ;;
19073         *) dflt="$1" ;;
19074         esac
19075         ;;
19076 *) dflt="$gidtype";;
19077 esac
19078 case "$gidtype" in
19079 gid_t) echo "gid_t found." ;;
19080 *)      rp="What is the type for group ids returned by getgid()?"
19081         . ./myread
19082         gidtype="$ans"
19083         ;;
19084 esac
19085
19086 echo " "
19087 case "$gidtype" in
19088 *_t) zzz="$gidtype"     ;;
19089 *)   zzz="gid"          ;;
19090 esac
19091 echo "Checking the size of $zzz..." >&4 
19092 cat > try.c <<EOCP
19093 #include <sys/types.h>
19094 #include <stdio.h>
19095 #$i_stdlib I_STDLIB
19096 #ifdef I_STDLIB
19097 #include <stdlib.h>
19098 #endif
19099 int main() {
19100     printf("%d\n", (int)sizeof($gidtype));
19101     exit(0);
19102 }
19103 EOCP
19104 set try
19105 if eval $compile_ok; then
19106         yyy=`$run ./try`
19107         case "$yyy" in
19108         '')     gidsize=4
19109                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19110                 ;;
19111         *)      gidsize=$yyy
19112                 echo "Your $zzz is $gidsize bytes long."
19113                 ;;
19114         esac
19115 else
19116         gidsize=4
19117         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19118 fi
19119
19120
19121 echo " "
19122 case "$gidtype" in
19123 *_t) zzz="$gidtype"     ;;
19124 *)   zzz="gid"          ;;
19125 esac
19126 echo "Checking the sign of $zzz..." >&4 
19127 cat > try.c <<EOCP
19128 #include <sys/types.h>
19129 #include <stdio.h>
19130 int main() {
19131         $gidtype foo = -1;
19132         if (foo < 0)
19133                 printf("-1\n");
19134         else
19135                 printf("1\n");
19136 }
19137 EOCP
19138 set try
19139 if eval $compile; then
19140         yyy=`$run ./try`
19141         case "$yyy" in
19142         '')     gidsign=1
19143                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19144                 ;;
19145         *)      gidsign=$yyy
19146                 case "$gidsign" in
19147                  1) echo "Your $zzz is unsigned." ;;
19148                 -1) echo "Your $zzz is signed."   ;;
19149                 esac
19150                 ;;
19151         esac
19152 else
19153         gidsign=1
19154         echo "(I can't compile the test program--guessing unsigned.)" >&4
19155 fi
19156
19157
19158 echo " "
19159
19160 if $test X"$quadtype" != X; then
19161
19162 echo "Checking how to print 64-bit integers..." >&4
19163
19164 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19165         $cat >try.c <<'EOCP'
19166 #include <sys/types.h>
19167 #include <stdio.h>
19168 int main() {
19169   int q = 12345678901;
19170   printf("%ld\n", q);
19171 }
19172 EOCP
19173         set try
19174         if eval $compile; then
19175                 yyy=`$run ./try`
19176                 case "$yyy" in
19177                 12345678901)
19178                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19179                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19180                         echo "We will use %d."
19181                         ;;
19182                 esac
19183         fi
19184 fi
19185
19186 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19187         $cat >try.c <<'EOCP'
19188 #include <sys/types.h>
19189 #include <stdio.h>
19190 int main() {
19191   long q = 12345678901;
19192   printf("%ld\n", q);
19193 }
19194 EOCP
19195         set try
19196         if eval $compile; then
19197                 yyy=`$run ./try`
19198                 case "$yyy" in
19199                 12345678901)
19200                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19201                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19202                         echo "We will use %ld."
19203                         ;;
19204                 esac
19205         fi
19206 fi
19207
19208 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19209         $cat >try.c <<'EOCP'
19210 #include <sys/types.h>
19211 #include <inttypes.h>
19212 #include <stdio.h>
19213 int main() {
19214   int64_t q = 12345678901;
19215   printf("%" PRId64 "\n", q);
19216 }
19217 EOCP
19218         set try
19219         if eval $compile; then
19220                 yyy=`$run ./try`
19221                 case "$yyy" in
19222                 12345678901)
19223                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19224                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19225                         echo "We will use the C9X style."
19226                         ;;
19227                 esac
19228         fi
19229 fi
19230
19231 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19232         $cat >try.c <<EOCP
19233 #include <sys/types.h>
19234 #include <stdio.h>
19235 int main() {
19236   $quadtype q = 12345678901;
19237   printf("%Ld\n", q);
19238 }
19239 EOCP
19240         set try
19241         if eval $compile; then
19242                 yyy=`$run ./try`
19243                 case "$yyy" in
19244                 12345678901)
19245                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19246                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19247                         echo "We will use %Ld."
19248                         ;;
19249                 esac
19250         fi
19251 fi
19252
19253 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19254         $cat >try.c <<'EOCP'
19255 #include <sys/types.h>
19256 #include <stdio.h>
19257 int main() {
19258   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19259   printf("%lld\n", q);
19260 }
19261 EOCP
19262         set try
19263         if eval $compile; then
19264                 yyy=`$run ./try`
19265                 case "$yyy" in
19266                 12345678901)
19267                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19268                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19269                         echo "We will use the %lld style."
19270                         ;;
19271                 esac
19272         fi
19273 fi
19274
19275 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19276         $cat >try.c <<EOCP
19277 #include <sys/types.h>
19278 #include <stdio.h>
19279 int main() {
19280   $quadtype q = 12345678901;
19281   printf("%qd\n", q);
19282 }
19283 EOCP
19284         set try
19285         if eval $compile; then
19286                 yyy=`$run ./try`
19287                 case "$yyy" in
19288                 12345678901)
19289                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19290                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19291                         echo "We will use %qd."
19292                         ;;
19293                 esac
19294         fi
19295 fi
19296
19297 if $test X"$sPRId64" = X; then
19298         echo "Cannot figure out how to print 64-bit integers." >&4
19299 fi
19300 $rm_try
19301
19302 fi
19303
19304 case "$sPRId64" in
19305 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19306         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19307         ;;
19308 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19309         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19310         ;;
19311 esac
19312
19313
19314 echo " "
19315 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19316
19317 if $test X"$ivsize" = X8; then
19318         ivdformat="$sPRId64"
19319         uvuformat="$sPRIu64"
19320         uvoformat="$sPRIo64"
19321         uvxformat="$sPRIx64"
19322         uvXUformat="$sPRIXU64"
19323 else
19324         if $test X"$ivsize" = X"$longsize"; then
19325                 ivdformat='"ld"'
19326                 uvuformat='"lu"'
19327                 uvoformat='"lo"'
19328                 uvxformat='"lx"'
19329                 uvXUformat='"lX"'
19330         else
19331                 if $test X"$ivsize" = X"$intsize"; then
19332                         ivdformat='"d"'
19333                         uvuformat='"u"'
19334                         uvoformat='"o"'
19335                         uvxformat='"x"'
19336                         uvXUformat='"X"'
19337                 else
19338                         : far out
19339                         if $test X"$ivsize" = X"$shortsize"; then
19340                                 ivdformat='"hd"'
19341                                 uvuformat='"hu"'
19342                                 uvoformat='"ho"'
19343                                 uvxformat='"hx"'
19344                                 uvXUformat='"hX"'
19345                         fi
19346                 fi
19347         fi
19348 fi
19349
19350 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19351         nveformat="$sPRIeldbl"
19352         nvfformat="$sPRIfldbl"
19353         nvgformat="$sPRIgldbl"
19354         nvEUformat="$sPRIEUldbl"
19355         nvFUformat="$sPRIFUldbl"
19356         nvGUformat="$sPRIGUldbl"
19357 else
19358         nveformat='"e"'
19359         nvfformat='"f"'
19360         nvgformat='"g"'
19361         nvEUformat='"E"'
19362         nvFUformat='"F"'
19363         nvGUformat='"G"'
19364 fi
19365
19366 case "$ivdformat" in
19367 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19368     exit 1
19369     ;;
19370 esac
19371
19372
19373 echo " "
19374 $echo "Checking the format string to be used for gids..." >&4
19375
19376 case "$gidsign" in
19377 -1)     if $test X"$gidsize" = X"$ivsize"; then
19378                 gidformat="$ivdformat"
19379         else
19380                 if $test X"$gidsize" = X"$longsize"; then
19381                         gidformat='"ld"'
19382                 else
19383                         if $test X"$gidsize" = X"$intsize"; then
19384                                 gidformat='"d"'
19385                         else
19386                                 if $test X"$gidsize" = X"$shortsize"; then
19387                                         gidformat='"hd"'
19388                                 fi
19389                         fi
19390                 fi
19391         fi
19392         ;;
19393 *)      if $test X"$gidsize" = X"$uvsize"; then
19394                 gidformat="$uvuformat"
19395         else
19396                 if $test X"$gidsize" = X"$longsize"; then
19397                         gidformat='"lu"'
19398                 else
19399                         if $test X"$gidsize" = X"$intsize"; then
19400                                 gidformat='"u"'
19401                         else
19402                                 if $test X"$gidsize" = X"$shortsize"; then
19403                                         gidformat='"hu"'
19404                                 fi
19405                         fi
19406                 fi
19407         fi
19408         ;;
19409 esac
19410
19411 : see if getgroups exists
19412 set getgroups d_getgrps
19413 eval $inlibc
19414
19415 : see if setgroups exists
19416 set setgroups d_setgrps
19417 eval $inlibc
19418
19419
19420 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19421 echo " "
19422 case "$d_getgrps$d_setgrps" in
19423 *define*)
19424         case "$groupstype" in
19425         '') dflt="$gidtype" ;;
19426         *)  dflt="$groupstype" ;;
19427         esac
19428         $cat <<EOM
19429 What type of pointer is the second argument to getgroups() and setgroups()?
19430 Usually this is the same as group ids, $gidtype, but not always.
19431
19432 EOM
19433         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19434         . ./myread
19435         groupstype="$ans"
19436         ;;
19437 *)  groupstype="$gidtype";;
19438 esac
19439
19440
19441 if $test $patchlevel -lt 9; then
19442 : MAD is not available in 5.8.x or earlier.
19443     ans=n;
19444 else
19445     case "$mad" in
19446     $define|true|[yY]*) dflt='y' ;;
19447     *)                  dflt='n' ;;
19448     esac
19449     cat <<EOM
19450
19451 Would you like to build with Misc Attribute Decoration? This is development
19452 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19453 overhead on the interpreter.
19454
19455 If this doesn't make any sense to you, just accept the default '$dflt'.
19456 EOM
19457     rp='Build Perl with MAD?'
19458     . ./myread
19459 fi
19460 case "$ans" in
19461 y|Y)    val="$define"
19462         madlyh='madly.h madly.act madly.tab'
19463         madlysrc='madly.c'
19464         madlyobj="madly$_o" ;;
19465 *)      val="$undef"
19466         madlyh=''
19467         madlysrc=''
19468         madlyobj='' ;;
19469 esac
19470 set mad
19471 eval $setvar
19472
19473 echo " "
19474 echo "Checking if your $make program sets \$(MAKE)..." >&4
19475 case "$make_set_make" in
19476 '')
19477         $sed 's/^X //' > testmake.mak << 'EOF'
19478 Xall:
19479 X       @echo 'maketemp="$(MAKE)"'
19480 EOF
19481         case "`$make -f testmake.mak 2>/dev/null`" in
19482         *maketemp=*) make_set_make='#' ;;
19483         *)      make_set_make="MAKE=$make" ;;
19484         esac
19485         $rm -f testmake.mak
19486         ;;
19487 esac
19488 case "$make_set_make" in
19489 '#') echo "Yup, it does.";;
19490 *) echo "Nope, it doesn't.";;
19491 esac
19492
19493 : see what type is used for mode_t
19494 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19495 set mode_t modetype int stdio.h sys/types.h
19496 eval $typedef_ask
19497
19498 : see if we need va_copy
19499 echo " "
19500 case "$i_stdarg" in
19501 "$define")
19502         $cat >try.c <<EOCP
19503 #include <stdarg.h>
19504 #include <stdio.h>
19505 #$i_stdlib I_STDLIB
19506 #ifdef I_STDLIB
19507 #include <stdlib.h>
19508 #endif
19509 #include <signal.h>
19510
19511 int
19512 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19513 {
19514   return vfprintf(f, fmt, *valp);
19515 }
19516
19517 int
19518 myvfprintf(FILE *f, const  char *fmt, va_list val)
19519 {
19520   return ivfprintf(f, fmt, &val);
19521 }
19522
19523 int
19524 myprintf(char *fmt, ...)
19525 {
19526   va_list val;
19527   va_start(val, fmt);
19528   return myvfprintf(stdout, fmt, val);
19529 }
19530
19531 int
19532 main(int ac, char **av)
19533 {
19534   signal(SIGSEGV, exit);
19535
19536   myprintf("%s%cs all right, then\n", "that", '\'');
19537   exit(0);
19538 }
19539 EOCP
19540         set try
19541         if eval $compile && $run ./try 2>&1 >/dev/null; then
19542                 case "`$run ./try`" in
19543                 "that's all right, then")
19544                         okay=yes
19545                         ;;
19546                 esac
19547         fi
19548         case "$okay" in
19549         yes)    echo "It seems that you don't need va_copy()." >&4
19550                 need_va_copy="$undef"
19551                 ;;
19552         *)      echo "It seems that va_copy() or similar will be needed." >&4
19553                 need_va_copy="$define"
19554                 ;;
19555         esac
19556         $rm_try
19557         ;;
19558 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19559         ;;
19560 esac
19561
19562 : see what type is used for size_t
19563 rp="What is the type used for the length parameter for string functions?"
19564 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19565 eval $typedef_ask
19566
19567 : check for type of arguments to gethostbyaddr. 
19568 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19569         case "$d_gethbyaddr" in
19570         $define)
19571                 $cat <<EOM
19572
19573 Checking to see what type of arguments are accepted by gethostbyaddr().
19574 EOM
19575                 hdrs="$define sys/types.h
19576                         $d_socket sys/socket.h 
19577                         $i_niin netinet/in.h 
19578                         $i_netdb netdb.h
19579                         $i_unistd unistd.h"
19580                 : The first arg can 'char *' or 'void *'
19581                 : The second arg is some of integral type
19582                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19583                         for yyy in size_t long int; do
19584                                 case "$netdb_host_type" in
19585                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19586                                         if ./protochk "$try" $hdrs; then
19587                                                 echo "Your system accepts $xxx for the first arg."
19588                                                 echo "...and $yyy for the second arg."
19589                                                 netdb_host_type="$xxx"
19590                                                 netdb_hlen_type="$yyy"
19591                                         fi
19592                                         ;;
19593                                 esac
19594                         done
19595                 done
19596                 : In case none of those worked, prompt the user.
19597                 case "$netdb_host_type" in
19598                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19599                         dflt='char *'
19600                         . ./myread
19601                         netdb_host_type=$ans
19602                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19603                         dflt="$sizetype"
19604                         . ./myread
19605                         netdb_hlen_type=$ans
19606                         ;;
19607                 esac
19608                 ;;
19609         *)      : no gethostbyaddr, so pick harmless defaults
19610                 netdb_host_type='char *'
19611                 netdb_hlen_type="$sizetype"
19612                 ;;
19613         esac
19614         # Remove the "const" if needed. -- but then we'll have a 
19615         # prototype clash!
19616         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19617 fi
19618
19619 : check for type of argument to gethostbyname. 
19620 if test "X$netdb_name_type" = X ; then
19621         case "$d_gethbyname" in
19622         $define)
19623                 $cat <<EOM
19624
19625 Checking to see what type of argument is accepted by gethostbyname().
19626 EOM
19627                 hdrs="$define sys/types.h
19628                         $d_socket sys/socket.h 
19629                         $i_niin netinet/in.h 
19630                         $i_netdb netdb.h
19631                         $i_unistd unistd.h"
19632                 for xxx in "const char *" "char *"; do
19633                         case "$netdb_name_type" in
19634                         '')     try="extern struct hostent *gethostbyname($xxx);"
19635                                 if ./protochk "$try" $hdrs; then
19636                                         echo "Your system accepts $xxx."
19637                                         netdb_name_type="$xxx"
19638                                 fi
19639                                 ;;
19640                         esac
19641                 done
19642                 : In case none of those worked, prompt the user.
19643                 case "$netdb_name_type" in
19644                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19645                         dflt='char *'
19646                         . ./myread
19647                         netdb_name_type=$ans
19648                         ;;
19649                 esac
19650                 ;;
19651         *)      : no gethostbyname, so pick harmless default
19652                 netdb_name_type='char *'
19653                 ;;
19654         esac
19655 fi
19656
19657 : check for type of 1st argument to getnetbyaddr. 
19658 if test "X$netdb_net_type" = X ; then
19659         case "$d_getnbyaddr" in
19660         $define)
19661                 $cat <<EOM
19662
19663 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19664 EOM
19665                 hdrs="$define sys/types.h
19666                         $d_socket sys/socket.h 
19667                         $i_niin netinet/in.h 
19668                         $i_netdb netdb.h
19669                         $i_unistd unistd.h"
19670                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19671                         case "$netdb_net_type" in
19672                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19673                                 if ./protochk "$try" $hdrs; then
19674                                         echo "Your system accepts $xxx."
19675                                         netdb_net_type="$xxx"
19676                                 fi
19677                                 ;;
19678                         esac
19679                 done
19680                 : In case none of those worked, prompt the user.
19681                 case "$netdb_net_type" in
19682                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19683                         dflt='long'
19684                         . ./myread
19685                         netdb_net_type=$ans
19686                         ;;
19687                 esac
19688                 ;;
19689         *)      : no getnetbyaddr, so pick harmless default
19690                 netdb_net_type='long'
19691                 ;;
19692         esac
19693 fi
19694 : locate the preferred pager for this system
19695 fn=f/
19696 case "$pager" in
19697 '')
19698         dflt=''
19699         case "$pg" in
19700         /*) dflt=$pg;;
19701         [a-zA-Z]:/*) dflt=$pg;;
19702         esac
19703         case "$more" in
19704         /*) dflt=$more;;
19705         [a-zA-Z]:/*) dflt=$more;;
19706         esac
19707         case "$less" in
19708         /*) dflt=$less;;
19709         [a-zA-Z]:/*) dflt=$less;;
19710         esac
19711         case "$dflt" in
19712         '') dflt=/usr/ucb/more;;
19713         esac
19714         ;;
19715 *)      dflt="$pager"
19716         : Instruct ./getfile to trust the hinted or previous pager value,
19717         : even if it does not begin with a slash.  For example, on os2,
19718         : pager might be cmd /c more.  See comments in UU/getfile.
19719         fn="f/($pager)"
19720         ;;
19721 esac
19722 echo " "
19723 rp='What pager is used on your system?'
19724 . ./getfile
19725 pager="$ans"
19726
19727 : see what type pids are declared as in the kernel
19728 rp="What is the type of process ids on this system?"
19729 set pid_t pidtype int stdio.h sys/types.h
19730 eval $typedef_ask
19731
19732 : see if ar generates random libraries by itself
19733 echo " "
19734 echo "Checking how to generate random libraries on your machine..." >&4
19735 echo 'int bar1() { return bar2(); }' > bar1.c
19736 echo 'int bar2() { return 2; }' > bar2.c
19737 $cat > foo.c <<EOP
19738 #$i_stdlib I_STDLIB
19739 #ifdef I_STDLIB
19740 #include <stdlib.h>
19741 #endif
19742 int main() { printf("%d\n", bar1()); exit(0); }
19743 EOP
19744 $cc $ccflags -c bar1.c >/dev/null 2>&1
19745 $cc $ccflags -c bar2.c >/dev/null 2>&1
19746 $cc $ccflags -c foo.c >/dev/null 2>&1
19747 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19748 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19749         $run ./foobar >/dev/null 2>&1; then
19750         echo "$ar appears to generate random libraries itself."
19751         orderlib=false
19752         if [ "X$ranlib" = "X" ]; then
19753             ranlib=":"
19754         fi
19755 elif $ar s bar$_a >/dev/null 2>&1 &&
19756         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19757         $run ./foobar >/dev/null 2>&1; then
19758                 echo "a table of contents needs to be added with '$ar s'."
19759                 orderlib=false
19760                 ranlib="$ar s"
19761 elif $ar ts bar$_a >/dev/null 2>&1 &&
19762         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19763         $run ./foobar >/dev/null 2>&1; then
19764                 echo "a table of contents needs to be added with '$ar ts'."
19765                 orderlib=false
19766                 ranlib="$ar ts"
19767 else
19768         case "$ranlib" in
19769         :) ranlib='';;
19770         '')
19771                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19772                 $test -f $ranlib || ranlib=''
19773                 ;;
19774         esac
19775         if $test -n "$ranlib"; then
19776                 echo "your system has '$ranlib'; we'll use that."
19777                 orderlib=false
19778         else
19779                 echo "your system doesn't seem to support random libraries"
19780                 echo "so we'll use lorder and tsort to order the libraries."
19781                 orderlib=true
19782                 ranlib=":"
19783         fi
19784 fi
19785 $rm -f foo* bar*
19786
19787 : check for type of arguments to select. 
19788 case "$selecttype" in
19789 '') case "$d_select" in
19790         $define)
19791                 echo " "
19792                 $cat <<EOM
19793 Checking to see what type of arguments are accepted by select().
19794 EOM
19795                 hdrs="$define sys/types.h
19796                         $i_systime sys/time.h 
19797                         $i_sysselct sys/select.h
19798                         $d_socket sys/socket.h"
19799                 : The first arg can be int, unsigned, or size_t
19800                 : The last arg may or may not be 'const'
19801                 val=''
19802                 : void pointer has been seen but using that
19803                 : breaks the selectminbits test
19804                 for xxx in 'fd_set *' 'int *'; do
19805                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19806                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19807                                         case "$val" in
19808                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19809                                                 if ./protochk "$try" $hdrs; then
19810                                                         echo "Your system accepts $xxx."
19811                                                         val="$xxx"
19812                                                 fi
19813                                                 ;;
19814                                         esac
19815                                 done
19816                         done
19817                 done
19818                 case "$val" in
19819                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19820                         case "$d_fd_set" in
19821                                 $define) dflt="fd_set *" ;;
19822                                 *)              dflt="int *" ;;
19823                         esac
19824                         . ./myread
19825                         val=$ans
19826                         ;;
19827                 esac
19828                 selecttype="$val"
19829                 ;;
19830         *)      : no select, so pick a harmless default
19831                 selecttype='int *'
19832                 ;;
19833         esac
19834         ;;
19835 esac
19836
19837 : check for the select 'width'
19838 case "$selectminbits" in
19839 '') safebits=`expr $ptrsize \* 8`
19840     case "$d_select" in
19841         $define)
19842                 $cat <<EOM
19843
19844 Checking to see on how many bits at a time your select() operates...
19845 EOM
19846                 $cat >try.c <<EOCP
19847 #include <sys/types.h>
19848 #$i_time I_TIME
19849 #$i_systime I_SYS_TIME
19850 #$i_systimek I_SYS_TIME_KERNEL
19851 #ifdef I_TIME
19852 #   include <time.h>
19853 #endif
19854 #ifdef I_SYS_TIME
19855 #   ifdef I_SYS_TIME_KERNEL
19856 #       define KERNEL
19857 #   endif
19858 #   include <sys/time.h>
19859 #   ifdef I_SYS_TIME_KERNEL
19860 #       undef KERNEL
19861 #   endif
19862 #endif
19863 #$i_sysselct I_SYS_SELECT
19864 #ifdef I_SYS_SELECT
19865 #include <sys/select.h>
19866 #endif
19867 #$d_socket HAS_SOCKET
19868 #ifdef HAS_SOCKET
19869 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19870 #endif
19871 #include <stdio.h>
19872 #$i_stdlib I_STDLIB
19873 #ifdef I_STDLIB
19874 #include <stdlib.h>
19875 #endif
19876 $selecttype b;
19877 #define S sizeof(*(b))
19878 #define MINBITS 64
19879 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19880 #define NBITS  (NBYTES * 8)
19881 int main() {
19882     char *s = (char *)malloc(NBYTES);
19883     struct timeval t;
19884     int i;
19885     FILE* fp;
19886     int fd;
19887
19888     if (!s)
19889         exit(1);
19890     fclose(stdin);
19891     fp = fopen("try.c", "r");
19892     if (fp == 0)
19893       exit(2);
19894     fd = fileno(fp);
19895     if (fd < 0)
19896       exit(3);
19897     b = ($selecttype)s;
19898     for (i = 0; i < NBITS; i++)
19899         FD_SET(i, b);
19900     t.tv_sec  = 0;
19901     t.tv_usec = 0;
19902     select(fd + 1, b, 0, 0, &t);
19903     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19904     free(s);
19905     printf("%d\n", i + 1);
19906     return 0;
19907 }
19908 EOCP
19909                 set try
19910                 if eval $compile_ok; then
19911                         selectminbits=`$run ./try`
19912                         case "$selectminbits" in
19913                         '')     cat >&4 <<EOM
19914 Cannot figure out on how many bits at a time your select() operates.
19915 I'll play safe and guess it is $safebits bits.
19916 EOM
19917                                 selectminbits=$safebits
19918                                 bits="$safebits bits"
19919                                 ;;
19920                         1)      bits="1 bit" ;;
19921                         *)      bits="$selectminbits bits" ;;
19922                         esac
19923                         echo "Your select() operates on $bits at a time." >&4
19924                 else
19925                         rp='What is the minimum number of bits your select() operates on?'
19926                         case "$byteorder" in
19927                         12345678)       dflt=64 ;;
19928                         1234)           dflt=32 ;;
19929                         *)              dflt=1  ;;
19930                         esac
19931                         . ./myread
19932                         val=$ans
19933                         selectminbits="$val"
19934                 fi
19935                 $rm_try
19936                 ;;
19937         *)      : no select, so pick a harmless default
19938                 selectminbits=$safebits
19939                 ;;
19940         esac
19941         ;;
19942 esac
19943
19944 : Trace out the files included by signal.h, then look for SIGxxx names.
19945 : Remove SIGARRAYSIZE used by HPUX.
19946 : Remove SIGSTKSIZE used by Linux.
19947 : Remove SIGSTKSZ used by Posix.
19948 : Remove SIGTYP void lines used by OS2.
19949 : Some cpps, like os390, dont give the file name anywhere
19950 if [ "X$fieldn" = X ]; then
19951         : Just make some guesses.  We check them later.
19952         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19953 else
19954         xxx=`echo '#include <signal.h>' |
19955         $cppstdin $cppminus $cppflags 2>/dev/null |
19956         $grep '^[       ]*#.*include' | 
19957         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19958 fi
19959 : Check this list of files to be sure we have parsed the cpp output ok.
19960 : This will also avoid potentially non-existent files, such 
19961 : as ../foo/bar.h
19962 xxxfiles=''
19963 for xx in $xxx /dev/null ; do
19964         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19965 done
19966 : If we have found no files, at least try signal.h
19967 case "$xxxfiles" in
19968 '')     xxxfiles=`./findhdr signal.h` ;;
19969 esac
19970 xxx=`awk '
19971 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19972         print substr($2, 4, 20)
19973 }
19974 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19975         print substr($3, 4, 20)
19976 }' $xxxfiles`
19977 : Append some common names just in case the awk scan failed.
19978 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19979 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19980 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19981 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19982 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19983
19984 : generate a few handy files for later
19985 $cat > signal.c <<EOCP
19986 #include <sys/types.h>
19987 #include <signal.h>
19988 #$i_stdlib I_STDLIB
19989 #ifdef I_STDLIB
19990 #include <stdlib.h>
19991 #endif
19992 #include <stdio.h>
19993 int main() {
19994
19995 /* Strange style to avoid deeply-nested #if/#else/#endif */
19996 #ifndef NSIG
19997 #  ifdef _NSIG
19998 #    define NSIG (_NSIG)
19999 #  endif
20000 #endif
20001
20002 #ifndef NSIG
20003 #  ifdef SIGMAX
20004 #    define NSIG (SIGMAX+1)
20005 #  endif
20006 #endif
20007
20008 #ifndef NSIG
20009 #  ifdef SIG_MAX
20010 #    define NSIG (SIG_MAX+1)
20011 #  endif
20012 #endif
20013
20014 #ifndef NSIG
20015 #  ifdef _SIG_MAX
20016 #    define NSIG (_SIG_MAX+1)
20017 #  endif
20018 #endif
20019
20020 #ifndef NSIG
20021 #  ifdef MAXSIG
20022 #    define NSIG (MAXSIG+1)
20023 #  endif
20024 #endif
20025
20026 #ifndef NSIG
20027 #  ifdef MAX_SIG
20028 #    define NSIG (MAX_SIG+1)
20029 #  endif
20030 #endif
20031
20032 #ifndef NSIG
20033 #  ifdef SIGARRAYSIZE
20034 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20035 #  endif
20036 #endif
20037
20038 #ifndef NSIG
20039 #  ifdef _sys_nsig
20040 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20041 #  endif
20042 #endif
20043
20044 /* Default to some arbitrary number that's big enough to get most
20045    of the common signals.
20046 */
20047 #ifndef NSIG
20048 #    define NSIG 50
20049 #endif
20050
20051 printf("NSIG %d\n", NSIG);
20052
20053 #ifndef JUST_NSIG
20054
20055 EOCP
20056
20057 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20058 {
20059         printf "#ifdef SIG"; printf $1; printf "\n"
20060         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20061         printf $1; printf ");\n"
20062         printf "#endif\n"
20063 }
20064 END {
20065         printf "#endif /* JUST_NSIG */\n";
20066         printf "exit(0);\n}\n";
20067 }
20068 ' >>signal.c
20069 $cat >signal.awk <<'EOP'
20070 BEGIN { ndups = 0 }
20071 $1 ~ /^NSIG$/ { nsig = $2 }
20072 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20073     if ($2 > maxsig) { maxsig = $2 }
20074     if (sig_name[$2]) {
20075         dup_name[ndups] = $1
20076         dup_num[ndups] = $2
20077         ndups++ 
20078     }
20079     else {
20080         sig_name[$2] = $1
20081         sig_num[$2] = $2
20082     }
20083 }
20084 END { 
20085     if (nsig == 0) {
20086         nsig = maxsig + 1
20087     }
20088     printf("NSIG %d\n", nsig);
20089     for (n = 1; n < nsig; n++) {
20090         if (sig_name[n]) {
20091             printf("%s %d\n", sig_name[n], sig_num[n])
20092         }
20093         else {
20094             printf("NUM%d %d\n", n, n) 
20095         }
20096     }
20097     for (n = 0; n < ndups; n++) {
20098         printf("%s %d\n", dup_name[n], dup_num[n])
20099     }
20100 }
20101 EOP
20102 $cat >signal_cmd <<EOS
20103 $startsh
20104 if $test -s signal.lst; then
20105     echo "Using your existing signal.lst file"
20106         exit 0
20107 fi
20108 xxx="$xxx"
20109 EOS
20110 $cat >>signal_cmd <<'EOS'
20111
20112 set signal
20113 if eval $compile_ok; then
20114         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20115 else
20116         echo "(I can't seem be able to compile the whole test program)" >&4
20117         echo "(I'll try it in little pieces.)" >&4
20118         set signal -DJUST_NSIG
20119         if eval $compile_ok; then
20120                 $run ./signal$_exe > signal.nsg
20121                 $cat signal.nsg
20122         else
20123                 echo "I can't seem to figure out how many signals you have." >&4
20124                 echo "Guessing 50." >&4
20125                 echo 'NSIG 50' > signal.nsg
20126         fi
20127         : Now look at all the signal names, one at a time.
20128         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20129                 $cat > signal.c <<EOCP
20130 #include <sys/types.h>
20131 #include <signal.h>
20132 #include <stdio.h>
20133 int main() {
20134 printf("$xx %d\n", SIG${xx});
20135 return 0;
20136 }
20137 EOCP
20138                 set signal
20139                 if eval $compile; then
20140                         echo "SIG${xx} found."
20141                         $run ./signal$_exe  >> signal.ls1
20142                 else
20143                         echo "SIG${xx} NOT found."
20144                 fi
20145         done
20146         if $test -s signal.ls1; then
20147                 $cat signal.nsg signal.ls1 |
20148                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20149         fi
20150
20151 fi
20152 if $test -s signal.lst; then
20153         :
20154 else
20155         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20156         echo 'kill -l' >signal
20157         set X `csh -f <signal`
20158         $rm -f signal
20159         shift
20160         case $# in
20161         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20162         esac
20163         echo $@ | $tr ' ' $trnl | \
20164             $awk '{ printf "%s %d\n", $1, ++s; }
20165                   END { printf "NSIG %d\n", ++s }' >signal.lst
20166 fi
20167 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20168 EOS
20169 chmod a+x signal_cmd
20170 $eunicefix signal_cmd
20171
20172 : generate list of signal names
20173 echo " "
20174 case "$sig_name_init" in
20175 '') doinit=yes ;;
20176 *)  case "$sig_num_init" in
20177     ''|*,*) doinit=yes ;;
20178     esac ;;
20179 esac
20180 case "$doinit" in
20181 yes)
20182         echo "Generating a list of signal names and numbers..." >&4
20183         . ./signal_cmd
20184         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20185         sig_name=`$awk 'BEGIN { printf "ZERO " }
20186                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20187         sig_num=`$awk  'BEGIN { printf "0 " }
20188                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20189         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20190                              !/^NSIG/   { printf "\"%s\", ", $1 }
20191                              END        { printf "0\n" }' signal.lst`
20192         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20193                              !/^NSIG/   { printf "%d, ", $2}
20194                              END        { printf "0\n"}' signal.lst`
20195         ;;
20196 esac
20197 echo "The following $sig_count signals are available:"
20198 echo " "
20199 echo $sig_name | $awk \
20200 'BEGIN { linelen = 0 }
20201 {
20202         for (i = 1; i <= NF; i++) {
20203                 name = "SIG" $i " "
20204                 linelen = linelen + length(name)
20205                 if (linelen > 70) {
20206                         printf "\n"
20207                         linelen = length(name)
20208                 }
20209                 printf "%s", name
20210         }
20211         printf "\n"
20212 }'
20213 sig_size=`echo $sig_name | awk '{print NF}'`
20214 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20215
20216 echo " "
20217 case "$sizetype" in
20218 *_t) zzz="$sizetype"    ;;
20219 *)   zzz="filesize"     ;;
20220 esac
20221 echo "Checking the size of $zzz..." >&4 
20222 cat > try.c <<EOCP
20223 #include <sys/types.h>
20224 #include <stdio.h>
20225 #$i_stdlib I_STDLIB
20226 #ifdef I_STDLIB
20227 #include <stdlib.h>
20228 #endif
20229 int main() {
20230     printf("%d\n", (int)sizeof($sizetype));
20231     exit(0);
20232 }
20233 EOCP
20234 set try
20235 if eval $compile_ok; then
20236         yyy=`$run ./try`
20237         case "$yyy" in
20238         '')     sizesize=4
20239                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20240                 ;;
20241         *)      sizesize=$yyy
20242                 echo "Your $zzz size is $sizesize bytes."
20243                 ;;
20244         esac
20245 else
20246         sizesize=4
20247         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20248 fi
20249
20250
20251 : check for socklen_t
20252 echo " "
20253 echo "Checking to see if you have socklen_t..." >&4
20254 $cat >try.c <<EOCP
20255 #include <sys/types.h>
20256 #$d_socket HAS_SOCKET
20257 #ifdef HAS_SOCKET
20258 #include <sys/socket.h>
20259 #endif
20260 int main() { socklen_t x = 16; }
20261 EOCP
20262 set try
20263 if eval $compile; then
20264         val="$define"
20265         echo "You have socklen_t."
20266 else
20267         val="$undef"
20268         echo "You do not have socklen_t."
20269         case "$sizetype" in
20270         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20271         esac
20272 fi
20273 $rm_try
20274 set d_socklen_t
20275 eval $setvar
20276
20277 : see if this is a socks.h system
20278 set socks.h i_socks
20279 eval $inhdr
20280
20281 : check for type of the size argument to socket calls
20282 case "$d_socket" in
20283 "$define")
20284         $cat <<EOM
20285
20286 Checking to see what type is the last argument of accept().
20287 EOM
20288         yyy=''
20289         case "$d_socklen_t" in
20290         "$define") yyy="$yyy socklen_t"
20291         esac
20292         yyy="$yyy $sizetype int long unsigned"
20293         for xxx in $yyy; do
20294                 case "$socksizetype" in
20295                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20296                         case "$usesocks" in
20297                         "$define")
20298                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20299                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20300                                         socksizetype="$xxx"
20301                                 fi
20302                                 ;;
20303                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20304                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20305                                         socksizetype="$xxx"
20306                                 fi
20307                                 ;;
20308                         esac
20309                         ;;
20310                 esac
20311         done
20312 : In case none of those worked, prompt the user.
20313         case "$socksizetype" in
20314         '')     rp='What is the type for socket address structure sizes?'
20315                 dflt='int'
20316                 . ./myread
20317                 socksizetype=$ans
20318                 ;;
20319         esac
20320         ;;
20321 *)      : no sockets, so pick relatively harmless default
20322         socksizetype='int'
20323         ;;
20324 esac
20325
20326 : see what type is used for signed size_t
20327 set ssize_t ssizetype int stdio.h sys/types.h
20328 eval $typedef
20329 dflt="$ssizetype"
20330 $cat > try.c <<EOM
20331 #include <stdio.h>
20332 #$i_stdlib I_STDLIB
20333 #ifdef I_STDLIB
20334 #include <stdlib.h>
20335 #endif
20336 #include <sys/types.h>
20337 #define Size_t $sizetype
20338 #define SSize_t $dflt
20339 int main()
20340 {
20341         if (sizeof(Size_t) == sizeof(SSize_t))
20342                 printf("$dflt\n");
20343         else if (sizeof(Size_t) == sizeof(int))
20344                 printf("int\n");
20345         else
20346                 printf("long\n");
20347         exit(0);
20348 }
20349 EOM
20350 echo " "
20351 set try
20352 if eval $compile_ok && $run ./try > /dev/null; then
20353         ssizetype=`$run ./try`
20354         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20355 else
20356         $cat >&4 <<EOM
20357 Help! I can't compile and run the ssize_t test program: please enlighten me!
20358 (This is probably a misconfiguration in your system or libraries, and
20359 you really ought to fix it.  Still, I'll try anyway.)
20360
20361 I need a type that is the same size as $sizetype, but is guaranteed to
20362 be signed.  Common values are ssize_t, int and long.
20363
20364 EOM
20365         rp="What signed type is the same size as $sizetype?"
20366         . ./myread
20367         ssizetype="$ans"
20368 fi
20369 $rm_try
20370
20371 : see what type of char stdio uses.
20372 echo " "
20373 echo '#include <stdio.h>' > stdio.c
20374 $cppstdin $cppminus < stdio.c > stdioh
20375 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20376         echo "Your stdio uses unsigned chars." >&4
20377         stdchar="unsigned char"
20378 else
20379         echo "Your stdio uses signed chars." >&4
20380         stdchar="char"
20381 fi
20382 $rm -f stdio.* stdioh
20383
20384 : see what type uids are declared as in the kernel
20385 echo " "
20386 echo "Looking for the type for user ids returned by getuid()."
20387 set uid_t uidtype xxx stdio.h sys/types.h
20388 eval $typedef
20389 case "$uidtype" in
20390 xxx)
20391         xxx=`./findhdr sys/user.h`
20392         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20393         case $1 in
20394         unsigned) dflt="$1 $2" ;;
20395         *) dflt="$1" ;;
20396         esac
20397         ;;
20398 *) dflt="$uidtype";;
20399 esac
20400 case "$uidtype" in
20401 uid_t)  echo "uid_t found." ;;
20402 *)      rp="What is the type for user ids returned by getuid()?"
20403         . ./myread
20404         uidtype="$ans"
20405         ;;
20406 esac
20407
20408 echo " "
20409 case "$uidtype" in
20410 *_t) zzz="$uidtype"     ;;
20411 *)   zzz="uid"          ;;
20412 esac
20413 echo "Checking the size of $zzz..." >&4 
20414 cat > try.c <<EOCP
20415 #include <sys/types.h>
20416 #include <stdio.h>
20417 #$i_stdlib I_STDLIB
20418 #ifdef I_STDLIB
20419 #include <stdlib.h>
20420 #endif
20421 int main() {
20422     printf("%d\n", (int)sizeof($uidtype));
20423     exit(0);
20424 }
20425 EOCP
20426 set try
20427 if eval $compile_ok; then
20428         yyy=`$run ./try`
20429         case "$yyy" in
20430         '')     uidsize=4
20431                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20432                 ;;
20433         *)      uidsize=$yyy
20434                 echo "Your $zzz is $uidsize bytes long."
20435                 ;;
20436         esac
20437 else
20438         uidsize=4
20439         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20440 fi
20441
20442 echo " "
20443 case "$uidtype" in
20444 *_t) zzz="$uidtype"     ;;
20445 *)   zzz="uid"          ;;
20446 esac
20447 echo "Checking the sign of $zzz..." >&4
20448 cat > try.c <<EOCP
20449 #include <sys/types.h>
20450 #include <stdio.h>
20451 int main() {
20452         $uidtype foo = -1;
20453         if (foo < 0)
20454                 printf("-1\n");
20455         else
20456                 printf("1\n");
20457 }
20458 EOCP
20459 set try
20460 if eval $compile; then
20461         yyy=`$run ./try`
20462         case "$yyy" in
20463         '')     uidsign=1
20464                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20465                 ;;
20466         *)      uidsign=$yyy
20467                 case "$uidsign" in
20468                  1) echo "Your $zzz is unsigned." ;;
20469                 -1) echo "Your $zzz is signed."   ;;
20470                 esac
20471                 ;;
20472         esac
20473 else
20474         uidsign=1
20475         echo "(I can't compile the test program--guessing unsigned.)" >&4
20476 fi
20477
20478
20479
20480 echo " "
20481 $echo "Checking the format string to be used for uids..." >&4
20482
20483 case "$uidsign" in
20484 -1)     if $test X"$uidsize" = X"$ivsize"; then
20485                 uidformat="$ivdformat"
20486         else
20487                 if $test X"$uidsize" = X"$longsize"; then
20488                         uidformat='"ld"'
20489                 else
20490                         if $test X"$uidsize" = X"$intsize"; then
20491                                 uidformat='"d"'
20492                         else
20493                                 if $test X"$uidsize" = X"$shortsize"; then
20494                                         uidformat='"hd"'
20495                                 fi
20496                         fi
20497                 fi
20498         fi
20499         ;;
20500 *)      if $test X"$uidsize" = X"$uvsize"; then
20501                 uidformat="$uvuformat"
20502         else
20503                 if $test X"$uidsize" = X"$longsize"; then
20504                         uidformat='"lu"'
20505                 else
20506                         if $test X"$uidsize" = X"$intsize"; then
20507                                 uidformat='"u"'
20508                         else
20509                                 if $test X"$uidsize" = X"$shortsize"; then
20510                                         uidformat='"hu"'
20511                                 fi
20512                         fi
20513                 fi
20514         fi
20515         ;;
20516 esac
20517
20518
20519 case "$usesitecustomize" in
20520     $define|true|[Yy]*)
20521         usesitecustomize="$define"
20522         ;;
20523     *)
20524         usesitecustomize="$undef"
20525         ;;
20526     esac
20527
20528 : determine compiler compiler
20529 case "$yacc" in
20530 '')
20531         dflt=yacc;;
20532 *)
20533         dflt="$yacc";;
20534 esac
20535 echo " "
20536 comp='yacc'
20537 if $test -f "$byacc$_exe"; then
20538         dflt="$byacc"
20539         comp="byacc or $comp"
20540 fi
20541 if $test -f "$bison$_exe"; then
20542         comp="$comp or bison -y"
20543 fi
20544 rp="Which compiler compiler ($comp) shall I use?"
20545 . ./myread
20546 yacc="$ans"
20547 case "$yacc" in
20548 *bis*)
20549         case "$yacc" in
20550         *-y*) ;;
20551         *)
20552                 yacc="$yacc -y"
20553                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20554                 ;;
20555         esac
20556         ;;
20557 esac
20558
20559 : see if this is a fp.h system
20560 set fp.h i_fp
20561 eval $inhdr
20562
20563 : see if this is a fp_class.h system
20564 set fp_class.h i_fp_class
20565 eval $inhdr
20566
20567 : see if gdbm.h is available
20568 set gdbm.h t_gdbm
20569 eval $inhdr
20570 case "$t_gdbm" in
20571 $define)
20572         : see if gdbm_open exists
20573         set gdbm_open d_gdbm_open
20574         eval $inlibc
20575         case "$d_gdbm_open" in
20576         $undef)
20577                 t_gdbm="$undef"
20578                 echo "We won't be including <gdbm.h>"
20579                 ;;
20580         esac
20581         ;;
20582 esac
20583 val="$t_gdbm"
20584 set i_gdbm
20585 eval $setvar
20586
20587 : see if this is a ieeefp.h system
20588 case "$i_ieeefp" in
20589 '' ) set ieeefp.h i_ieeefp
20590      eval $inhdr
20591      ;;
20592 esac
20593
20594 : see if this is a libutil.h system
20595 set libutil.h i_libutil
20596 eval $inhdr
20597
20598 : see if mach cthreads are available
20599 if test "X$usethreads" = "X$define"; then
20600         set mach/cthreads.h i_machcthr
20601         eval $inhdr
20602 else
20603         i_machcthr="$undef"
20604 fi
20605
20606
20607
20608 : see if this is a mntent.h system
20609 set mntent.h i_mntent
20610 eval $inhdr
20611
20612 : see if ndbm.h is available
20613 set ndbm.h t_ndbm
20614 eval $inhdr
20615
20616 case "$t_ndbm" in
20617 $undef)
20618     # Some Linux distributions such as RedHat 7.1 put the
20619     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20620     if $test -f /usr/include/gdbm/ndbm.h; then
20621         echo '<gdbm/ndbm.h> found.'
20622         ccflags="$ccflags -I/usr/include/gdbm"
20623         cppflags="$cppflags -I/usr/include/gdbm"
20624         t_ndbm=$define
20625     fi
20626     ;;
20627 esac
20628
20629 case "$t_ndbm" in
20630 $define)
20631         : see if dbm_open exists
20632         set dbm_open d_dbm_open
20633         eval $inlibc
20634         case "$d_dbm_open" in
20635         $undef)
20636                 t_ndbm="$undef"
20637                 echo "We won't be including <ndbm.h>"
20638                 ;;
20639         esac
20640         ;;
20641 esac
20642 val="$t_ndbm"
20643 set i_ndbm
20644 eval $setvar
20645
20646 : see if net/errno.h is available
20647 val=''
20648 set net/errno.h val
20649 eval $inhdr
20650
20651 : Unfortunately, it causes problems on some systems.  Arrgh.
20652 case "$val" in
20653 $define)
20654         cat > try.c <<'EOM'
20655 #include <stdio.h>
20656 #include <errno.h>
20657 #include <net/errno.h>
20658 int func()
20659 {
20660         return ENOTSOCK;
20661 }
20662 EOM
20663         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20664                 echo "We'll be including <net/errno.h>." >&4
20665         else
20666                 echo "We won't be including <net/errno.h>." >&4
20667                 val="$undef"
20668         fi
20669         $rm_try
20670         ;;
20671 esac
20672 set i_neterrno
20673 eval $setvar
20674
20675 : see if netinet/tcp.h is available
20676 set netinet/tcp.h i_netinettcp
20677 eval $inhdr
20678
20679 : see if this is a poll.h system
20680 set poll.h i_poll
20681 eval $inhdr
20682
20683 : see if this is a prot.h system
20684 set prot.h i_prot
20685 eval $inhdr
20686
20687 echo " "
20688 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20689 $cat <<'EOSH' > Cppsym.know
20690 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20691 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20692 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20693 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20694 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20695 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20696 bull c cadmus clipper CMU COFF COMPILER_VERSION
20697 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20698 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20699 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20700 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20701 GLIBC GLIBC_MINOR
20702 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20703 H3050R H3050RX hbullx20 hcx host_mips
20704 hp200 hp300 hp700 HP700 hp800 hp9000
20705 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20706 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20707 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20708 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20709 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20710 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20711 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20712 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20713 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20714 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20715 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20716 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20717 MATH_HAS_NO_SIDE_EFFECTS
20718 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20719 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20720 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20721 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20722 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20723 NetBSD news1500 news1700 news1800 news1900 news3700
20724 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20725 ns32016 ns32332 ns32k nsc32000
20726 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20727 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20728 pc532 pdp11 PGC PIC plexus PORTAR posix
20729 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20730 POSIX_C_SOURCE POSIX_SOURCE POWER
20731 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20732 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20733 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20734 sony sony_news sonyrisc sparc sparclite spectrum
20735 stardent stdc STDC_EXT stratos sun sun3 sun386
20736 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20737 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20738 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20739 sysV68 sysV88 Tek4132 Tek4300 titan
20740 TM3200 TM5400 TM5600
20741 tower tower32 tower32_200 tower32_600 tower32_700
20742 tower32_800 tower32_850 tss
20743 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20744 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20745 unix UNIX95 UNIX99 unixpc unos
20746 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20747 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20748 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20749 USGr4 USGr4_2
20750 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20751 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20752 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20753 z8000
20754 EOSH
20755 # Maybe put other stuff here too.
20756 cat <<EOSH >>Cppsym.know
20757 $osname
20758 EOSH
20759 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20760 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20761 $cat Cppsym.know > Cppsym.c
20762 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20763 $rm -f Cppsym.a Cppsym.b Cppsym.c
20764 cat <<EOSH > Cppsym
20765 $startsh
20766 if $test \$# -gt 0; then
20767     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20768     if $test -s Cppsym.got; then
20769         $rm -f Cppsym.got
20770         exit 0
20771     fi
20772     $rm -f Cppsym.got
20773     exit 1
20774 else
20775     $tr " " "$trnl" | ./Cppsym.try
20776     exit 0
20777 fi
20778 EOSH
20779 chmod +x Cppsym
20780 $eunicefix Cppsym
20781 cat <<EOSH > Cppsym.try
20782 $startsh
20783 cat <<'EOCP' > try.c
20784 #include <stdio.h>
20785 #if cpp_stuff == 1
20786 #define STRINGIFY(a)    "a"
20787 #endif
20788 #if cpp_stuff == 42
20789 #define StGiFy(a)  #a
20790 #define STRINGIFY(a)    StGiFy(a)
20791 #endif
20792 #if $cpp_stuff != 1 && $cpp_stuff != 42
20793 #   include "Bletch: How does this C preprocessor stringify macros?"
20794 #endif
20795 int main() {
20796 EOCP
20797 $awk \\
20798 EOSH
20799 cat <<'EOSH' >> Cppsym.try
20800 'length($1) > 0 {
20801     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20802     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20803     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20804     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20805 }'       >> try.c
20806 echo 'return 0;}' >> try.c
20807 EOSH
20808 cat <<EOSH >> Cppsym.try
20809 ccflags="$ccflags"
20810 case "$osname-$gccversion" in
20811 irix-) ccflags="\$ccflags -woff 1178" ;;
20812 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20813 esac
20814 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20815 EOSH
20816 chmod +x Cppsym.try
20817 $eunicefix Cppsym.try
20818 ./Cppsym < Cppsym.know > Cppsym.true
20819 : Add in any linux cpp "predefined macros":
20820 case "$osname::$gccversion" in
20821   *linux*::*.*)
20822     tHdrH=_tmpHdr
20823     rm -f $tHdrH'.h' $tHdrH
20824     touch $tHdrH'.h'
20825     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20826        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20827        if [ -s $tHdrH'_cppsym.real' ]; then
20828           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20829        fi
20830     fi
20831     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20832   ;;
20833 esac
20834 : now check the C compiler for additional symbols
20835 postprocess_cc_v=''
20836 case "$osname" in
20837 aix) postprocess_cc_v="|$tr , ' '" ;;
20838 esac
20839 $cat >ccsym <<EOS
20840 $startsh
20841 $cat >tmp.c <<EOF
20842 extern int foo;
20843 EOF
20844 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20845 do
20846         case "\$i" in
20847         -D*) echo "\$i" | $sed 's/^-D//';;
20848         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20849         esac
20850 done
20851 $rm_try
20852 EOS
20853 postprocess_cc_v=''
20854 chmod +x ccsym
20855 $eunicefix ccsym
20856 ./ccsym > ccsym1.raw
20857 if $test -s ccsym1.raw; then
20858        $sort ccsym1.raw | $uniq >ccsym.raw
20859 else
20860        mv ccsym1.raw ccsym.raw
20861 fi
20862
20863 $awk '/\=/ { print $0; next }
20864         { print $0"=1" }' ccsym.raw >ccsym.list
20865 $comm -13 Cppsym.true ccsym.list >ccsym.own
20866 $comm -12 Cppsym.true ccsym.list >ccsym.com
20867 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20868 also=''
20869 if $test -z ccsym.raw; then
20870         echo "Your C compiler doesn't seem to define any symbols!" >&4
20871         echo " "
20872         echo "However, your C preprocessor defines the following symbols:"
20873         $cat Cppsym.true
20874         ccsymbols=''
20875         cppsymbols=`$cat Cppsym.true`
20876         cppsymbols=`echo $cppsymbols`
20877         cppccsymbols="$cppsymbols"
20878 else
20879         if $test -s ccsym.com; then
20880                 echo "Your C compiler and pre-processor define these symbols:"
20881                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20882                 also='also '
20883                 symbols='ones'
20884                 cppccsymbols=`$cat ccsym.com`
20885                 cppccsymbols=`echo $cppccsymbols`
20886                 $test "$silent" || sleep 1
20887         fi
20888         if $test -s ccsym.cpp; then
20889                 $test "$also" && echo " "
20890                 echo "Your C pre-processor ${also}defines the following symbols:"
20891                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20892                 also='further '
20893                 cppsymbols=`$cat ccsym.cpp`
20894                 cppsymbols=`echo $cppsymbols`
20895                 $test "$silent" || sleep 1
20896         fi
20897         if $test -s ccsym.own; then
20898                 $test "$also" && echo " "
20899                 echo "Your C compiler ${also}defines the following cpp symbols:"
20900                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20901                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20902                 ccsymbols=`$cat ccsym.own`
20903                 ccsymbols=`echo $ccsymbols`
20904                 $test "$silent" || sleep 1
20905         fi
20906 fi
20907
20908 : see if this is a termio system
20909 val="$undef"
20910 val2="$undef"
20911 val3="$undef"
20912 if $test `./findhdr termios.h`; then
20913         set tcsetattr i_termios
20914         eval $inlibc
20915         val3="$i_termios"
20916 fi
20917 echo " "
20918 case "$val3" in
20919 "$define") echo "You have POSIX termios.h... good!" >&4;;
20920 *) if ./Cppsym pyr; then
20921                 case "`/bin/universe`" in
20922                 ucb) if $test `./findhdr sgtty.h`; then
20923                                 val2="$define"
20924                                 echo "<sgtty.h> found." >&4
20925                         else
20926                                 echo "System is pyramid with BSD universe."
20927                                 echo "<sgtty.h> not found--you could have problems." >&4
20928                         fi;;
20929                 *) if $test `./findhdr termio.h`; then
20930                                 val="$define"
20931                                 echo "<termio.h> found." >&4
20932                         else
20933                                 echo "System is pyramid with USG universe."
20934                                 echo "<termio.h> not found--you could have problems." >&4
20935                         fi;;
20936                 esac
20937         elif ./usg; then
20938                 if $test `./findhdr termio.h`; then
20939                         echo "<termio.h> found." >&4
20940                         val="$define"
20941                 elif $test `./findhdr sgtty.h`; then
20942                         echo "<sgtty.h> found." >&4
20943                         val2="$define"
20944                 else
20945 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20946                 fi
20947         else
20948                 if $test `./findhdr sgtty.h`; then
20949                         echo "<sgtty.h> found." >&4
20950                         val2="$define"
20951                 elif $test `./findhdr termio.h`; then
20952                         echo "<termio.h> found." >&4
20953                         val="$define"
20954                 else
20955 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20956                 fi
20957         fi;;
20958 esac
20959 set i_termio; eval $setvar
20960 val=$val2; set i_sgtty; eval $setvar
20961 val=$val3; set i_termios; eval $setvar
20962
20963 : see if stddef is available
20964 set stddef.h i_stddef
20965 eval $inhdr
20966
20967 : see if sys/access.h is available
20968 set sys/access.h i_sysaccess
20969 eval $inhdr
20970
20971 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20972 set sys/filio.h i_sysfilio
20973 eval $inhdr
20974 echo " "
20975 if $test `./findhdr sys/ioctl.h`; then
20976         val="$define"
20977         echo '<sys/ioctl.h> found.' >&4
20978 else
20979         val="$undef"
20980         if $test $i_sysfilio = "$define"; then
20981             echo '<sys/ioctl.h> NOT found.' >&4
20982         else
20983                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20984                 $test $i_termio = "$define" && xxx="termio.h"
20985                 $test $i_termios = "$define" && xxx="termios.h"
20986 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20987         fi
20988 fi
20989 set i_sysioctl
20990 eval $setvar
20991
20992 : see if socket ioctl defs are in sys/sockio.h
20993 echo " "
20994 xxx=`./findhdr sys/sockio.h`
20995 if $test "$xxx"; then
20996         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20997                 val="$define"
20998                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20999         else
21000                 val="$undef"
21001                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21002         fi
21003 else
21004         val="$undef"
21005         $cat <<EOM
21006 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21007 EOM
21008 fi
21009 set i_syssockio
21010 eval $setvar
21011
21012
21013 : see if this is a syslog.h system
21014 set syslog.h i_syslog
21015 eval $inhdr
21016
21017
21018 : see if this is a sys/mode.h system
21019 set sys/mode.h i_sysmode
21020 eval $inhdr
21021
21022 : see if sys/resource.h has to be included
21023 set sys/resource.h i_sysresrc
21024 eval $inhdr
21025
21026 : see if sys/security.h is available
21027 set sys/security.h i_syssecrt
21028 eval $inhdr
21029
21030 : see if this is a sys/statvfs.h system
21031 set sys/statvfs.h i_sysstatvfs
21032 eval $inhdr
21033
21034 : see if this is a sys/un.h system
21035 set sys/un.h i_sysun
21036 eval $inhdr
21037
21038
21039 : see if this is a sys/utsname.h system
21040 set sys/utsname.h i_sysutsname
21041 eval $inhdr
21042
21043 : see if this is a syswait system
21044 set sys/wait.h i_syswait
21045 eval $inhdr
21046
21047 : see if this is a ustat.h system
21048 set ustat.h i_ustat
21049 eval $inhdr
21050
21051 : see if this is an utime system
21052 set utime.h i_utime
21053 eval $inhdr
21054
21055 : see if this is a values.h system
21056 set values.h i_values
21057 eval $inhdr
21058
21059 : see if this is a vfork system
21060 case "$d_vfork" in
21061 "$define")
21062         set vfork.h i_vfork
21063         eval $inhdr
21064         ;;
21065 *)
21066         i_vfork="$undef"
21067         ;;
21068 esac
21069
21070 echo " "
21071 echo "Looking for extensions..." >&4
21072 : If we are using the old config.sh, known_extensions may contain
21073 : old or inaccurate or duplicate values.
21074 known_extensions=''
21075 nonxs_extensions=''
21076 : We do not use find because it might not be available.
21077 : We do not just use MANIFEST because the user may have dropped
21078 : some additional extensions into the source tree and expect them
21079 : to be built.
21080
21081 : Function to recursively find available extensions, ignoring DynaLoader
21082 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21083 find_extensions='
21084     for xxx in *; do
21085         case "$xxx" in
21086             DynaLoader|dynaload) ;;
21087             *)
21088             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21089                 known_extensions="$known_extensions $1$xxx";
21090             elif $test -f $xxx/Makefile.PL; then
21091                 nonxs_extensions="$nonxs_extensions $1$xxx";
21092             else
21093                 if $test -d $xxx -a $# -lt 10; then
21094                     set $1$xxx/ $*;
21095                     cd "$xxx";
21096                     eval $find_extensions;
21097                     cd ..;
21098                     shift;
21099                 fi;
21100             fi
21101             ;;
21102         esac;
21103     done'
21104 tdir=`pwd`
21105 cd "$rsrc/ext"
21106 set X
21107 shift
21108 eval $find_extensions
21109 # Special case:  Add in threads/shared since it is not picked up by the
21110 # recursive find above (and adding in general recursive finding breaks
21111 # SDBM_File/sdbm).  A.D.  10/25/2001.
21112 known_extensions="$known_extensions threads/shared"
21113 set X $known_extensions
21114 shift
21115 known_extensions="$*"
21116 set X $nonxs_extensions
21117 shift
21118 nonxs_extensions="$*"
21119 cd "$tdir"
21120
21121 : Now see which are supported on this system.
21122 avail_ext=''
21123 for xxx in $known_extensions ; do
21124         case "$xxx" in
21125         DB_File|db_file)
21126                 case "$i_db" in
21127                 $define) avail_ext="$avail_ext $xxx" ;;
21128                 esac
21129                 ;;
21130         GDBM_File|gdbm_fil)
21131                 case "$i_gdbm" in
21132                 $define) avail_ext="$avail_ext $xxx" ;;
21133                 esac
21134                 ;;
21135         I18N/Langinfo|i18n_lan)
21136                 case "$i_langinfo$d_nl_langinfo" in
21137                 $define$define) avail_ext="$avail_ext $xxx" ;;
21138                 esac
21139                 ;;
21140         IPC/SysV|ipc/sysv)
21141                 : XXX Do we need a useipcsysv variable here
21142                 case "${d_msg}${d_sem}${d_shm}" in
21143                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21144                 esac
21145                 ;;
21146         NDBM_File|ndbm_fil)
21147                 case "$i_ndbm" in
21148                 $define)
21149                     case "$osname-$use64bitint" in
21150                     hpux-define)
21151                         case "$libs" in
21152                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21153                         esac
21154                         ;;
21155                     *) avail_ext="$avail_ext $xxx" ;;
21156                     esac
21157                     ;;
21158                 esac
21159                 ;;
21160         ODBM_File|odbm_fil)
21161                 case "${i_dbm}${i_rpcsvcdbm}" in
21162                 *"${define}"*)
21163                     case "$d_cplusplus" in
21164                     define) ;; # delete as a function name will not work
21165                     *)  case "$osname-$use64bitint" in
21166                         hpux-define)
21167                             case "$libs" in
21168                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21169                             esac
21170                             ;;
21171                         *) avail_ext="$avail_ext $xxx" ;;
21172                         esac
21173                         ;;
21174                     esac
21175                     ;;
21176                 esac
21177                 ;;
21178         Opcode|opcode)
21179                 case "$useopcode" in
21180                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21181                 esac
21182                 ;;
21183         POSIX|posix)
21184                 case "$useposix" in
21185                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21186                 esac
21187                 ;;
21188         Socket|socket)
21189                 case "$d_socket" in
21190                 true|$define|y)
21191                     case "$osname" in
21192                     beos) ;; # not unless BONE
21193                     *) avail_ext="$avail_ext $xxx" ;;
21194                     esac
21195                     ;;
21196                 esac
21197                 ;;
21198         Sys/Syslog|sys/syslog)
21199                 : XXX syslog requires socket
21200                 case "$d_socket" in
21201                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21202                 esac
21203                 ;;
21204         Thread|thread)
21205                 case "$usethreads" in
21206                 true|$define|y)
21207                         case "$use5005threads" in
21208                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21209                         esac
21210                 esac
21211                 ;;
21212         threads|threads/shared)
21213                 # threads and threads::shared are special cases.
21214                 # To stop people from asking "Perl 5.8.0 was supposed
21215                 # to have this new fancy threads implementation but my
21216                 # perl doesn't have it" and from people trying to
21217                 # (re)install the threads module using CPAN.pm and
21218                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21219                 # the threads.pm and threads/shared.pm will always be
21220                 # there, croaking informatively ("you need to rebuild
21221                 # all of Perl with threads, sorry") when threads haven't
21222                 # been compiled in.
21223                 # --jhi
21224                 avail_ext="$avail_ext $xxx"
21225                 ;;
21226         Win32*)
21227                 case "$osname" in
21228                 cygwin) avail_ext="$avail_ext $xxx" ;;
21229                 esac
21230                 ;;
21231         XS/APItest|xs/apitest)
21232                 # This is just for testing.  Skip it unless we have dynamic loading.
21233
21234                 case "$usedl" in
21235                 $define) avail_ext="$avail_ext $xxx" ;;
21236                 esac
21237                 ;;
21238         XS/Typemap|xs/typemap)
21239                 # This is just for testing.  Skip it unless we have dynamic loading.
21240                 case "$usedl" in
21241                 $define) avail_ext="$avail_ext $xxx" ;;
21242                 esac
21243                 ;;
21244         *)      avail_ext="$avail_ext $xxx"
21245                 ;;
21246         esac
21247 done
21248
21249 set X $avail_ext
21250 shift
21251 avail_ext="$*"
21252
21253 case "$onlyextensions" in
21254 '') ;;
21255 *)  keepextensions=''
21256     echo "You have requested that only certains extensions be included..." >&4
21257     for i in $onlyextensions; do
21258         case " $avail_ext " in
21259         *" $i "*)
21260             echo "Keeping extension $i."
21261             keepextensions="$keepextensions $i"
21262             ;;
21263         *) echo "Ignoring extension $i." ;;
21264         esac
21265     done
21266     avail_ext="$keepextensions"
21267     ;;
21268 esac
21269
21270 case "$noextensions" in
21271 '') ;;
21272 *)  keepextensions=''
21273     echo "You have requested that certain extensions be ignored..." >&4
21274     for i in $avail_ext; do
21275         case " $noextensions " in
21276         *" $i "*) echo "Ignoring extension $i." ;;
21277         *) echo "Keeping extension $i.";
21278            keepextensions="$keepextensions $i"
21279            ;;
21280         esac
21281     done
21282     avail_ext="$keepextensions"
21283     ;;
21284 esac
21285
21286 : Now see which nonxs extensions are supported on this system.
21287 : For now assume all are.
21288 nonxs_ext=''
21289 for xxx in $nonxs_extensions ; do
21290         case "$xxx" in
21291         *)      nonxs_ext="$nonxs_ext $xxx"
21292                 ;;
21293         esac
21294 done
21295
21296 set X $nonxs_ext
21297 shift
21298 nonxs_ext="$*"
21299
21300 case $usedl in
21301 $define)
21302         $cat <<EOM
21303 A number of extensions are supplied with $package.  You may choose to
21304 compile these extensions for dynamic loading (the default), compile
21305 them into the $package executable (static loading), or not include
21306 them at all.  Answer "none" to include no extensions.
21307 Note that DynaLoader is always built and need not be mentioned here.
21308
21309 EOM
21310         case "$dynamic_ext" in
21311         '')
21312                 : Exclude those listed in static_ext
21313                 dflt=''
21314                 for xxx in $avail_ext; do
21315                         case " $static_ext " in
21316                         *" $xxx "*) ;;
21317                         *) dflt="$dflt $xxx" ;;
21318                         esac
21319                 done
21320                 set X $dflt
21321                 shift
21322                 dflt="$*"
21323                 ;;
21324         *)      dflt="$dynamic_ext"
21325                 # Perhaps we are reusing an old out-of-date config.sh.
21326                 case "$hint" in
21327                 previous)
21328                         if test X"$dynamic_ext" != X"$avail_ext"; then
21329                                 $cat <<EOM
21330 NOTICE:  Your previous config.sh list may be incorrect.
21331 The extensions now available to you are
21332         ${avail_ext}
21333 but the default list from your previous config.sh is
21334         ${dynamic_ext}
21335
21336 EOM
21337                         fi
21338                         ;;
21339                 esac
21340                 ;;
21341         esac
21342         case "$dflt" in
21343         '')     dflt=none;;
21344         esac
21345         rp="What extensions do you wish to load dynamically?"
21346         . ./myread
21347         case "$ans" in
21348         none) dynamic_ext=' ' ;;
21349         *) dynamic_ext="$ans" ;;
21350         esac
21351
21352         case "$static_ext" in
21353         '')
21354                 : Exclude those already listed in dynamic linking
21355                 dflt=''
21356                 for xxx in $avail_ext; do
21357                         case " $dynamic_ext " in
21358                         *" $xxx "*) ;;
21359                         *) dflt="$dflt $xxx" ;;
21360                         esac
21361                 done
21362                 set X $dflt
21363                 shift
21364                 dflt="$*"
21365                 ;;
21366         *)  dflt="$static_ext"
21367                 ;;
21368         esac
21369
21370         case "$dflt" in
21371         '')     dflt=none;;
21372         esac
21373         rp="What extensions do you wish to load statically?"
21374         . ./myread
21375         case "$ans" in
21376         none) static_ext=' ' ;;
21377         *) static_ext="$ans" ;;
21378         esac
21379         ;;
21380 *)
21381         $cat <<EOM
21382 A number of extensions are supplied with $package.  Answer "none"
21383 to include no extensions.
21384 Note that DynaLoader is always built and need not be mentioned here.
21385
21386 EOM
21387         case "$static_ext" in
21388         '') dflt="$avail_ext" ;;
21389         *)      dflt="$static_ext"
21390                 # Perhaps we are reusing an old out-of-date config.sh.
21391                 case "$hint" in
21392                 previous)
21393                         if test X"$static_ext" != X"$avail_ext"; then
21394                                 $cat <<EOM
21395 NOTICE:  Your previous config.sh list may be incorrect.
21396 The extensions now available to you are
21397         ${avail_ext}
21398 but the default list from your previous config.sh is
21399         ${static_ext}
21400
21401 EOM
21402                         fi
21403                         ;;
21404                 esac
21405                 ;;
21406         esac
21407         : Exclude those that are not xs extensions
21408         case "$dflt" in
21409         '')     dflt=none;;
21410         esac
21411         rp="What extensions do you wish to include?"
21412         . ./myread
21413         case "$ans" in
21414         none) static_ext=' ' ;;
21415         *) static_ext="$ans" ;;
21416         esac
21417         ;;
21418 esac
21419 #
21420 # Encode is a special case.  If we are building Encode as a static
21421 # extension, we need to explicitly list its subextensions as well.
21422 # For other nested extensions, this is handled automatically by
21423 # the appropriate Makefile.PL.
21424 case " $static_ext " in
21425         *" Encode "*) # Add the subextensions of Encode
21426         cd "$rsrc/ext"
21427         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21428                 static_ext="$static_ext Encode/$xxx"
21429         done
21430         cd "$tdir"
21431         ;;
21432 esac
21433
21434 set X $dynamic_ext $static_ext $nonxs_ext
21435 shift
21436 extensions="$*"
21437
21438 # Sanity check:  We require an extension suitable for use with
21439 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21440 # should show up as failures in the test suite, but it's helpful to
21441 # catch them now.) The 'extensions' list is normally sorted
21442 # alphabetically, so we need to accept either
21443 #    DB_File ... Fcntl ... IO  ....
21444 # or something like
21445 #    Fcntl ... NDBM_File ... IO  ....
21446 case " $extensions"  in
21447 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21448 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21449 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21450 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21451    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21452    ;;
21453 esac
21454
21455 : Remove libraries needed only for extensions
21456 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21457 : The exception is SunOS 4.x, which needs them.
21458 case "${osname}X${osvers}" in
21459 sunos*X4*)
21460     perllibs="$libs"
21461     ;;
21462 *) case "$usedl" in
21463     $define|true|[yY]*)
21464             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21465             shift
21466             perllibs="$*"
21467             ;;
21468     *)  perllibs="$libs"
21469             ;;
21470     esac
21471     ;;
21472 esac
21473
21474 : Remove build directory name from cppstdin so it can be used from
21475 : either the present location or the final installed location.
21476 echo " "
21477 : Get out of the UU directory to get correct path name.
21478 cd ..
21479 case "$cppstdin" in
21480 `pwd`/cppstdin)
21481         echo "Stripping down cppstdin path name"
21482         cppstdin=cppstdin
21483         ;;
21484 esac
21485 cd UU
21486
21487 : end of configuration questions
21488 echo " "
21489 echo "End of configuration questions."
21490 echo " "
21491
21492 : back to where it started
21493 if test -d ../UU; then
21494         cd ..
21495 fi
21496
21497 : configuration may be patched via a 'config.arch' file
21498 if $test -f config.arch; then
21499         echo "I see a config.arch file, loading it."
21500         . ./config.arch
21501 fi
21502
21503 : configuration may be patched via a 'config.over' file
21504 if $test -f config.over; then
21505         echo " "
21506         dflt=y
21507         rp='I see a config.over file.  Do you wish to load it?'
21508         . UU/myread
21509         case "$ans" in
21510         n*) echo "OK, I'll ignore it.";;
21511         *)      . ./config.over
21512                 echo "Configuration override changes have been loaded."
21513                 ;;
21514         esac
21515 fi
21516
21517 : in case they want portability, strip down executable paths
21518 case "$d_portable" in
21519 "$define")
21520         echo " "
21521         echo "Stripping down executable paths..." >&4
21522         for file in $loclist $trylist; do
21523                 eval temp=\$$file
21524                 eval $file=`basename $temp`
21525         done
21526         ;;
21527 esac
21528
21529 : create config.sh file
21530 echo " "
21531 echo "Creating config.sh..." >&4
21532 $spitshell <<EOT >config.sh
21533 $startsh
21534 #
21535 # This file was produced by running the Configure script. It holds all the
21536 # definitions figured out by Configure. Should you modify one of these values,
21537 # do not forget to propagate your changes by running "Configure -der". You may
21538 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21539 #
21540
21541 # Package name      : $package
21542 # Source directory  : $src
21543 # Configuration time: $cf_time
21544 # Configured by     : $cf_by
21545 # Target system     : $myuname
21546
21547 Author='$Author'
21548 Date='$Date'
21549 Header='$Header'
21550 Id='$Id'
21551 Locker='$Locker'
21552 Log='$Log'
21553 Mcc='$Mcc'
21554 RCSfile='$RCSfile'
21555 Revision='$Revision'
21556 Source='$Source'
21557 State='$State'
21558 _a='$_a'
21559 _exe='$_exe'
21560 _o='$_o'
21561 afs='$afs'
21562 afsroot='$afsroot'
21563 alignbytes='$alignbytes'
21564 ansi2knr='$ansi2knr'
21565 aphostname='$aphostname'
21566 api_revision='$api_revision'
21567 api_subversion='$api_subversion'
21568 api_version='$api_version'
21569 api_versionstring='$api_versionstring'
21570 ar='$ar'
21571 archlib='$archlib'
21572 archlibexp='$archlibexp'
21573 archname64='$archname64'
21574 archname='$archname'
21575 archobjs='$archobjs'
21576 asctime_r_proto='$asctime_r_proto'
21577 awk='$awk'
21578 baserev='$baserev'
21579 bash='$bash'
21580 bin='$bin'
21581 binexp='$binexp'
21582 bison='$bison'
21583 byacc='$byacc'
21584 byteorder='$byteorder'
21585 c='$c'
21586 castflags='$castflags'
21587 cat='$cat'
21588 cc='$cc'
21589 cccdlflags='$cccdlflags'
21590 ccdlflags='$ccdlflags'
21591 ccflags='$ccflags'
21592 ccflags_uselargefiles='$ccflags_uselargefiles'
21593 ccname='$ccname'
21594 ccsymbols='$ccsymbols'
21595 ccversion='$ccversion'
21596 cf_by='$cf_by'
21597 cf_email='$cf_email'
21598 cf_time='$cf_time'
21599 charsize='$charsize'
21600 chgrp='$chgrp'
21601 chmod='$chmod'
21602 chown='$chown'
21603 clocktype='$clocktype'
21604 comm='$comm'
21605 compress='$compress'
21606 contains='$contains'
21607 cp='$cp'
21608 cpio='$cpio'
21609 cpp='$cpp'
21610 cpp_stuff='$cpp_stuff'
21611 cppccsymbols='$cppccsymbols'
21612 cppflags='$cppflags'
21613 cpplast='$cpplast'
21614 cppminus='$cppminus'
21615 cpprun='$cpprun'
21616 cppstdin='$cppstdin'
21617 cppsymbols='$cppsymbols'
21618 crypt_r_proto='$crypt_r_proto'
21619 cryptlib='$cryptlib'
21620 csh='$csh'
21621 ctermid_r_proto='$ctermid_r_proto'
21622 ctime_r_proto='$ctime_r_proto'
21623 d_Gconvert='$d_Gconvert'
21624 d_PRIEUldbl='$d_PRIEUldbl'
21625 d_PRIFUldbl='$d_PRIFUldbl'
21626 d_PRIGUldbl='$d_PRIGUldbl'
21627 d_PRIXU64='$d_PRIXU64'
21628 d_PRId64='$d_PRId64'
21629 d_PRIeldbl='$d_PRIeldbl'
21630 d_PRIfldbl='$d_PRIfldbl'
21631 d_PRIgldbl='$d_PRIgldbl'
21632 d_PRIi64='$d_PRIi64'
21633 d_PRIo64='$d_PRIo64'
21634 d_PRIu64='$d_PRIu64'
21635 d_PRIx64='$d_PRIx64'
21636 d_SCNfldbl='$d_SCNfldbl'
21637 d__fwalk='$d__fwalk'
21638 d_access='$d_access'
21639 d_accessx='$d_accessx'
21640 d_aintl='$d_aintl'
21641 d_alarm='$d_alarm'
21642 d_archlib='$d_archlib'
21643 d_asctime_r='$d_asctime_r'
21644 d_atolf='$d_atolf'
21645 d_atoll='$d_atoll'
21646 d_attribute_format='$d_attribute_format'
21647 d_attribute_malloc='$d_attribute_malloc'
21648 d_attribute_nonnull='$d_attribute_nonnull'
21649 d_attribute_noreturn='$d_attribute_noreturn'
21650 d_attribute_pure='$d_attribute_pure'
21651 d_attribute_unused='$d_attribute_unused'
21652 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21653 d_bcmp='$d_bcmp'
21654 d_bcopy='$d_bcopy'
21655 d_bsd='$d_bsd'
21656 d_bsdgetpgrp='$d_bsdgetpgrp'
21657 d_bsdsetpgrp='$d_bsdsetpgrp'
21658 d_builtin_choose_expr='$d_builtin_choose_expr'
21659 d_builtin_expect='$d_builtin_expect'
21660 d_bzero='$d_bzero'
21661 d_c99_variadic_macros='$d_c99_variadic_macros'
21662 d_casti32='$d_casti32'
21663 d_castneg='$d_castneg'
21664 d_charvspr='$d_charvspr'
21665 d_chown='$d_chown'
21666 d_chroot='$d_chroot'
21667 d_chsize='$d_chsize'
21668 d_class='$d_class'
21669 d_clearenv='$d_clearenv'
21670 d_closedir='$d_closedir'
21671 d_cmsghdr_s='$d_cmsghdr_s'
21672 d_const='$d_const'
21673 d_copysignl='$d_copysignl'
21674 d_cplusplus='$d_cplusplus'
21675 d_crypt='$d_crypt'
21676 d_crypt_r='$d_crypt_r'
21677 d_csh='$d_csh'
21678 d_ctermid='$d_ctermid'
21679 d_ctermid_r='$d_ctermid_r'
21680 d_ctime_r='$d_ctime_r'
21681 d_cuserid='$d_cuserid'
21682 d_dbl_dig='$d_dbl_dig'
21683 d_dbminitproto='$d_dbminitproto'
21684 d_difftime='$d_difftime'
21685 d_dir_dd_fd='$d_dir_dd_fd'
21686 d_dirfd='$d_dirfd'
21687 d_dirnamlen='$d_dirnamlen'
21688 d_dlerror='$d_dlerror'
21689 d_dlopen='$d_dlopen'
21690 d_dlsymun='$d_dlsymun'
21691 d_dosuid='$d_dosuid'
21692 d_drand48_r='$d_drand48_r'
21693 d_drand48proto='$d_drand48proto'
21694 d_dup2='$d_dup2'
21695 d_eaccess='$d_eaccess'
21696 d_endgrent='$d_endgrent'
21697 d_endgrent_r='$d_endgrent_r'
21698 d_endhent='$d_endhent'
21699 d_endhostent_r='$d_endhostent_r'
21700 d_endnent='$d_endnent'
21701 d_endnetent_r='$d_endnetent_r'
21702 d_endpent='$d_endpent'
21703 d_endprotoent_r='$d_endprotoent_r'
21704 d_endpwent='$d_endpwent'
21705 d_endpwent_r='$d_endpwent_r'
21706 d_endsent='$d_endsent'
21707 d_endservent_r='$d_endservent_r'
21708 d_eofnblk='$d_eofnblk'
21709 d_eunice='$d_eunice'
21710 d_faststdio='$d_faststdio'
21711 d_fchdir='$d_fchdir'
21712 d_fchmod='$d_fchmod'
21713 d_fchown='$d_fchown'
21714 d_fcntl='$d_fcntl'
21715 d_fcntl_can_lock='$d_fcntl_can_lock'
21716 d_fd_macros='$d_fd_macros'
21717 d_fd_set='$d_fd_set'
21718 d_fds_bits='$d_fds_bits'
21719 d_fgetpos='$d_fgetpos'
21720 d_finite='$d_finite'
21721 d_finitel='$d_finitel'
21722 d_flexfnam='$d_flexfnam'
21723 d_flock='$d_flock'
21724 d_flockproto='$d_flockproto'
21725 d_fork='$d_fork'
21726 d_fp_class='$d_fp_class'
21727 d_fpathconf='$d_fpathconf'
21728 d_fpclass='$d_fpclass'
21729 d_fpclassify='$d_fpclassify'
21730 d_fpclassl='$d_fpclassl'
21731 d_fpos64_t='$d_fpos64_t'
21732 d_frexpl='$d_frexpl'
21733 d_fs_data_s='$d_fs_data_s'
21734 d_fseeko='$d_fseeko'
21735 d_fsetpos='$d_fsetpos'
21736 d_fstatfs='$d_fstatfs'
21737 d_fstatvfs='$d_fstatvfs'
21738 d_fsync='$d_fsync'
21739 d_ftello='$d_ftello'
21740 d_ftime='$d_ftime'
21741 d_futimes='$d_futimes'
21742 d_getcwd='$d_getcwd'
21743 d_getespwnam='$d_getespwnam'
21744 d_getfsstat='$d_getfsstat'
21745 d_getgrent='$d_getgrent'
21746 d_getgrent_r='$d_getgrent_r'
21747 d_getgrgid_r='$d_getgrgid_r'
21748 d_getgrnam_r='$d_getgrnam_r'
21749 d_getgrps='$d_getgrps'
21750 d_gethbyaddr='$d_gethbyaddr'
21751 d_gethbyname='$d_gethbyname'
21752 d_gethent='$d_gethent'
21753 d_gethname='$d_gethname'
21754 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21755 d_gethostbyname_r='$d_gethostbyname_r'
21756 d_gethostent_r='$d_gethostent_r'
21757 d_gethostprotos='$d_gethostprotos'
21758 d_getitimer='$d_getitimer'
21759 d_getlogin='$d_getlogin'
21760 d_getlogin_r='$d_getlogin_r'
21761 d_getmnt='$d_getmnt'
21762 d_getmntent='$d_getmntent'
21763 d_getnbyaddr='$d_getnbyaddr'
21764 d_getnbyname='$d_getnbyname'
21765 d_getnent='$d_getnent'
21766 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21767 d_getnetbyname_r='$d_getnetbyname_r'
21768 d_getnetent_r='$d_getnetent_r'
21769 d_getnetprotos='$d_getnetprotos'
21770 d_getpagsz='$d_getpagsz'
21771 d_getpbyname='$d_getpbyname'
21772 d_getpbynumber='$d_getpbynumber'
21773 d_getpent='$d_getpent'
21774 d_getpgid='$d_getpgid'
21775 d_getpgrp2='$d_getpgrp2'
21776 d_getpgrp='$d_getpgrp'
21777 d_getppid='$d_getppid'
21778 d_getprior='$d_getprior'
21779 d_getprotobyname_r='$d_getprotobyname_r'
21780 d_getprotobynumber_r='$d_getprotobynumber_r'
21781 d_getprotoent_r='$d_getprotoent_r'
21782 d_getprotoprotos='$d_getprotoprotos'
21783 d_getprpwnam='$d_getprpwnam'
21784 d_getpwent='$d_getpwent'
21785 d_getpwent_r='$d_getpwent_r'
21786 d_getpwnam_r='$d_getpwnam_r'
21787 d_getpwuid_r='$d_getpwuid_r'
21788 d_getsbyname='$d_getsbyname'
21789 d_getsbyport='$d_getsbyport'
21790 d_getsent='$d_getsent'
21791 d_getservbyname_r='$d_getservbyname_r'
21792 d_getservbyport_r='$d_getservbyport_r'
21793 d_getservent_r='$d_getservent_r'
21794 d_getservprotos='$d_getservprotos'
21795 d_getspnam='$d_getspnam'
21796 d_getspnam_r='$d_getspnam_r'
21797 d_gettimeod='$d_gettimeod'
21798 d_gmtime_r='$d_gmtime_r'
21799 d_gnulibc='$d_gnulibc'
21800 d_grpasswd='$d_grpasswd'
21801 d_hasmntopt='$d_hasmntopt'
21802 d_htonl='$d_htonl'
21803 d_ilogbl='$d_ilogbl'
21804 d_inc_version_list='$d_inc_version_list'
21805 d_index='$d_index'
21806 d_inetaton='$d_inetaton'
21807 d_int64_t='$d_int64_t'
21808 d_isascii='$d_isascii'
21809 d_isfinite='$d_isfinite'
21810 d_isinf='$d_isinf'
21811 d_isnan='$d_isnan'
21812 d_isnanl='$d_isnanl'
21813 d_killpg='$d_killpg'
21814 d_lchown='$d_lchown'
21815 d_ldbl_dig='$d_ldbl_dig'
21816 d_libm_lib_version='$d_libm_lib_version'
21817 d_link='$d_link'
21818 d_localtime_r='$d_localtime_r'
21819 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21820 d_locconv='$d_locconv'
21821 d_lockf='$d_lockf'
21822 d_longdbl='$d_longdbl'
21823 d_longlong='$d_longlong'
21824 d_lseekproto='$d_lseekproto'
21825 d_lstat='$d_lstat'
21826 d_madvise='$d_madvise'
21827 d_malloc_good_size='$d_malloc_good_size'
21828 d_malloc_size='$d_malloc_size'
21829 d_mblen='$d_mblen'
21830 d_mbstowcs='$d_mbstowcs'
21831 d_mbtowc='$d_mbtowc'
21832 d_memchr='$d_memchr'
21833 d_memcmp='$d_memcmp'
21834 d_memcpy='$d_memcpy'
21835 d_memmove='$d_memmove'
21836 d_memset='$d_memset'
21837 d_mkdir='$d_mkdir'
21838 d_mkdtemp='$d_mkdtemp'
21839 d_mkfifo='$d_mkfifo'
21840 d_mkstemp='$d_mkstemp'
21841 d_mkstemps='$d_mkstemps'
21842 d_mktime='$d_mktime'
21843 d_mmap='$d_mmap'
21844 d_modfl='$d_modfl'
21845 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21846 d_modflproto='$d_modflproto'
21847 d_mprotect='$d_mprotect'
21848 d_msg='$d_msg'
21849 d_msg_ctrunc='$d_msg_ctrunc'
21850 d_msg_dontroute='$d_msg_dontroute'
21851 d_msg_oob='$d_msg_oob'
21852 d_msg_peek='$d_msg_peek'
21853 d_msg_proxy='$d_msg_proxy'
21854 d_msgctl='$d_msgctl'
21855 d_msgget='$d_msgget'
21856 d_msghdr_s='$d_msghdr_s'
21857 d_msgrcv='$d_msgrcv'
21858 d_msgsnd='$d_msgsnd'
21859 d_msync='$d_msync'
21860 d_munmap='$d_munmap'
21861 d_mymalloc='$d_mymalloc'
21862 d_nice='$d_nice'
21863 d_nl_langinfo='$d_nl_langinfo'
21864 d_nv_preserves_uv='$d_nv_preserves_uv'
21865 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21866 d_off64_t='$d_off64_t'
21867 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21868 d_oldpthreads='$d_oldpthreads'
21869 d_oldsock='$d_oldsock'
21870 d_open3='$d_open3'
21871 d_pathconf='$d_pathconf'
21872 d_pause='$d_pause'
21873 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21874 d_phostname='$d_phostname'
21875 d_pipe='$d_pipe'
21876 d_poll='$d_poll'
21877 d_portable='$d_portable'
21878 d_printf_format_null='$d_printf_format_null'
21879 d_procselfexe='$d_procselfexe'
21880 d_pseudofork='$d_pseudofork'
21881 d_pthread_atfork='$d_pthread_atfork'
21882 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21883 d_pthread_yield='$d_pthread_yield'
21884 d_pwage='$d_pwage'
21885 d_pwchange='$d_pwchange'
21886 d_pwclass='$d_pwclass'
21887 d_pwcomment='$d_pwcomment'
21888 d_pwexpire='$d_pwexpire'
21889 d_pwgecos='$d_pwgecos'
21890 d_pwpasswd='$d_pwpasswd'
21891 d_pwquota='$d_pwquota'
21892 d_qgcvt='$d_qgcvt'
21893 d_quad='$d_quad'
21894 d_random_r='$d_random_r'
21895 d_readdir64_r='$d_readdir64_r'
21896 d_readdir='$d_readdir'
21897 d_readdir_r='$d_readdir_r'
21898 d_readlink='$d_readlink'
21899 d_readv='$d_readv'
21900 d_recvmsg='$d_recvmsg'
21901 d_rename='$d_rename'
21902 d_rewinddir='$d_rewinddir'
21903 d_rmdir='$d_rmdir'
21904 d_safebcpy='$d_safebcpy'
21905 d_safemcpy='$d_safemcpy'
21906 d_sanemcmp='$d_sanemcmp'
21907 d_sbrkproto='$d_sbrkproto'
21908 d_scalbnl='$d_scalbnl'
21909 d_sched_yield='$d_sched_yield'
21910 d_scm_rights='$d_scm_rights'
21911 d_seekdir='$d_seekdir'
21912 d_select='$d_select'
21913 d_sem='$d_sem'
21914 d_semctl='$d_semctl'
21915 d_semctl_semid_ds='$d_semctl_semid_ds'
21916 d_semctl_semun='$d_semctl_semun'
21917 d_semget='$d_semget'
21918 d_semop='$d_semop'
21919 d_sendmsg='$d_sendmsg'
21920 d_setegid='$d_setegid'
21921 d_seteuid='$d_seteuid'
21922 d_setgrent='$d_setgrent'
21923 d_setgrent_r='$d_setgrent_r'
21924 d_setgrps='$d_setgrps'
21925 d_sethent='$d_sethent'
21926 d_sethostent_r='$d_sethostent_r'
21927 d_setitimer='$d_setitimer'
21928 d_setlinebuf='$d_setlinebuf'
21929 d_setlocale='$d_setlocale'
21930 d_setlocale_r='$d_setlocale_r'
21931 d_setnent='$d_setnent'
21932 d_setnetent_r='$d_setnetent_r'
21933 d_setpent='$d_setpent'
21934 d_setpgid='$d_setpgid'
21935 d_setpgrp2='$d_setpgrp2'
21936 d_setpgrp='$d_setpgrp'
21937 d_setprior='$d_setprior'
21938 d_setproctitle='$d_setproctitle'
21939 d_setprotoent_r='$d_setprotoent_r'
21940 d_setpwent='$d_setpwent'
21941 d_setpwent_r='$d_setpwent_r'
21942 d_setregid='$d_setregid'
21943 d_setresgid='$d_setresgid'
21944 d_setresuid='$d_setresuid'
21945 d_setreuid='$d_setreuid'
21946 d_setrgid='$d_setrgid'
21947 d_setruid='$d_setruid'
21948 d_setsent='$d_setsent'
21949 d_setservent_r='$d_setservent_r'
21950 d_setsid='$d_setsid'
21951 d_setvbuf='$d_setvbuf'
21952 d_sfio='$d_sfio'
21953 d_shm='$d_shm'
21954 d_shmat='$d_shmat'
21955 d_shmatprototype='$d_shmatprototype'
21956 d_shmctl='$d_shmctl'
21957 d_shmdt='$d_shmdt'
21958 d_shmget='$d_shmget'
21959 d_sigaction='$d_sigaction'
21960 d_signbit='$d_signbit'
21961 d_sigprocmask='$d_sigprocmask'
21962 d_sigsetjmp='$d_sigsetjmp'
21963 d_sitearch='$d_sitearch'
21964 d_snprintf='$d_snprintf'
21965 d_sockatmark='$d_sockatmark'
21966 d_sockatmarkproto='$d_sockatmarkproto'
21967 d_socket='$d_socket'
21968 d_socklen_t='$d_socklen_t'
21969 d_sockpair='$d_sockpair'
21970 d_socks5_init='$d_socks5_init'
21971 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21972 d_sqrtl='$d_sqrtl'
21973 d_srand48_r='$d_srand48_r'
21974 d_srandom_r='$d_srandom_r'
21975 d_sresgproto='$d_sresgproto'
21976 d_sresuproto='$d_sresuproto'
21977 d_statblks='$d_statblks'
21978 d_statfs_f_flags='$d_statfs_f_flags'
21979 d_statfs_s='$d_statfs_s'
21980 d_statvfs='$d_statvfs'
21981 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21982 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21983 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21984 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21985 d_stdio_stream_array='$d_stdio_stream_array'
21986 d_stdiobase='$d_stdiobase'
21987 d_stdstdio='$d_stdstdio'
21988 d_strchr='$d_strchr'
21989 d_strcoll='$d_strcoll'
21990 d_strctcpy='$d_strctcpy'
21991 d_strerrm='$d_strerrm'
21992 d_strerror='$d_strerror'
21993 d_strerror_r='$d_strerror_r'
21994 d_strftime='$d_strftime'
21995 d_strlcat='$d_strlcat'
21996 d_strlcpy='$d_strlcpy'
21997 d_strtod='$d_strtod'
21998 d_strtol='$d_strtol'
21999 d_strtold='$d_strtold'
22000 d_strtoll='$d_strtoll'
22001 d_strtoq='$d_strtoq'
22002 d_strtoul='$d_strtoul'
22003 d_strtoull='$d_strtoull'
22004 d_strtouq='$d_strtouq'
22005 d_strxfrm='$d_strxfrm'
22006 d_suidsafe='$d_suidsafe'
22007 d_symlink='$d_symlink'
22008 d_syscall='$d_syscall'
22009 d_syscallproto='$d_syscallproto'
22010 d_sysconf='$d_sysconf'
22011 d_sysernlst='$d_sysernlst'
22012 d_syserrlst='$d_syserrlst'
22013 d_system='$d_system'
22014 d_tcgetpgrp='$d_tcgetpgrp'
22015 d_tcsetpgrp='$d_tcsetpgrp'
22016 d_telldir='$d_telldir'
22017 d_telldirproto='$d_telldirproto'
22018 d_time='$d_time'
22019 d_times='$d_times'
22020 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22021 d_tm_tm_zone='$d_tm_tm_zone'
22022 d_tmpnam_r='$d_tmpnam_r'
22023 d_truncate='$d_truncate'
22024 d_ttyname_r='$d_ttyname_r'
22025 d_tzname='$d_tzname'
22026 d_u32align='$d_u32align'
22027 d_ualarm='$d_ualarm'
22028 d_umask='$d_umask'
22029 d_uname='$d_uname'
22030 d_union_semun='$d_union_semun'
22031 d_unordered='$d_unordered'
22032 d_unsetenv='$d_unsetenv'
22033 d_usleep='$d_usleep'
22034 d_usleepproto='$d_usleepproto'
22035 d_ustat='$d_ustat'
22036 d_vendorarch='$d_vendorarch'
22037 d_vendorbin='$d_vendorbin'
22038 d_vendorlib='$d_vendorlib'
22039 d_vendorscript='$d_vendorscript'
22040 d_vfork='$d_vfork'
22041 d_void_closedir='$d_void_closedir'
22042 d_voidsig='$d_voidsig'
22043 d_voidtty='$d_voidtty'
22044 d_volatile='$d_volatile'
22045 d_vprintf='$d_vprintf'
22046 d_vsnprintf='$d_vsnprintf'
22047 d_wait4='$d_wait4'
22048 d_waitpid='$d_waitpid'
22049 d_wcstombs='$d_wcstombs'
22050 d_wctomb='$d_wctomb'
22051 d_writev='$d_writev'
22052 d_xenix='$d_xenix'
22053 date='$date'
22054 db_hashtype='$db_hashtype'
22055 db_prefixtype='$db_prefixtype'
22056 db_version_major='$db_version_major'
22057 db_version_minor='$db_version_minor'
22058 db_version_patch='$db_version_patch'
22059 defvoidused='$defvoidused'
22060 direntrytype='$direntrytype'
22061 dlext='$dlext'
22062 dlsrc='$dlsrc'
22063 doublesize='$doublesize'
22064 drand01='$drand01'
22065 drand48_r_proto='$drand48_r_proto'
22066 dynamic_ext='$dynamic_ext'
22067 eagain='$eagain'
22068 ebcdic='$ebcdic'
22069 echo='$echo'
22070 egrep='$egrep'
22071 emacs='$emacs'
22072 endgrent_r_proto='$endgrent_r_proto'
22073 endhostent_r_proto='$endhostent_r_proto'
22074 endnetent_r_proto='$endnetent_r_proto'
22075 endprotoent_r_proto='$endprotoent_r_proto'
22076 endpwent_r_proto='$endpwent_r_proto'
22077 endservent_r_proto='$endservent_r_proto'
22078 eunicefix='$eunicefix'
22079 exe_ext='$exe_ext'
22080 expr='$expr'
22081 extensions='$extensions'
22082 extras='$extras'
22083 fflushNULL='$fflushNULL'
22084 fflushall='$fflushall'
22085 find='$find'
22086 firstmakefile='$firstmakefile'
22087 flex='$flex'
22088 fpossize='$fpossize'
22089 fpostype='$fpostype'
22090 freetype='$freetype'
22091 from='$from'
22092 full_ar='$full_ar'
22093 full_csh='$full_csh'
22094 full_sed='$full_sed'
22095 gccansipedantic='$gccansipedantic'
22096 gccosandvers='$gccosandvers'
22097 gccversion='$gccversion'
22098 getgrent_r_proto='$getgrent_r_proto'
22099 getgrgid_r_proto='$getgrgid_r_proto'
22100 getgrnam_r_proto='$getgrnam_r_proto'
22101 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22102 gethostbyname_r_proto='$gethostbyname_r_proto'
22103 gethostent_r_proto='$gethostent_r_proto'
22104 getlogin_r_proto='$getlogin_r_proto'
22105 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22106 getnetbyname_r_proto='$getnetbyname_r_proto'
22107 getnetent_r_proto='$getnetent_r_proto'
22108 getprotobyname_r_proto='$getprotobyname_r_proto'
22109 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22110 getprotoent_r_proto='$getprotoent_r_proto'
22111 getpwent_r_proto='$getpwent_r_proto'
22112 getpwnam_r_proto='$getpwnam_r_proto'
22113 getpwuid_r_proto='$getpwuid_r_proto'
22114 getservbyname_r_proto='$getservbyname_r_proto'
22115 getservbyport_r_proto='$getservbyport_r_proto'
22116 getservent_r_proto='$getservent_r_proto'
22117 getspnam_r_proto='$getspnam_r_proto'
22118 gidformat='$gidformat'
22119 gidsign='$gidsign'
22120 gidsize='$gidsize'
22121 gidtype='$gidtype'
22122 glibpth='$glibpth'
22123 gmake='$gmake'
22124 gmtime_r_proto='$gmtime_r_proto'
22125 gnulibc_version='$gnulibc_version'
22126 grep='$grep'
22127 groupcat='$groupcat'
22128 groupstype='$groupstype'
22129 gzip='$gzip'
22130 h_fcntl='$h_fcntl'
22131 h_sysfile='$h_sysfile'
22132 hint='$hint'
22133 hostcat='$hostcat'
22134 html1dir='$html1dir'
22135 html1direxp='$html1direxp'
22136 html3dir='$html3dir'
22137 html3direxp='$html3direxp'
22138 i16size='$i16size'
22139 i16type='$i16type'
22140 i32size='$i32size'
22141 i32type='$i32type'
22142 i64size='$i64size'
22143 i64type='$i64type'
22144 i8size='$i8size'
22145 i8type='$i8type'
22146 i_arpainet='$i_arpainet'
22147 i_bsdioctl='$i_bsdioctl'
22148 i_crypt='$i_crypt'
22149 i_db='$i_db'
22150 i_dbm='$i_dbm'
22151 i_dirent='$i_dirent'
22152 i_dld='$i_dld'
22153 i_dlfcn='$i_dlfcn'
22154 i_fcntl='$i_fcntl'
22155 i_float='$i_float'
22156 i_fp='$i_fp'
22157 i_fp_class='$i_fp_class'
22158 i_gdbm='$i_gdbm'
22159 i_grp='$i_grp'
22160 i_ieeefp='$i_ieeefp'
22161 i_inttypes='$i_inttypes'
22162 i_langinfo='$i_langinfo'
22163 i_libutil='$i_libutil'
22164 i_limits='$i_limits'
22165 i_locale='$i_locale'
22166 i_machcthr='$i_machcthr'
22167 i_malloc='$i_malloc'
22168 i_math='$i_math'
22169 i_memory='$i_memory'
22170 i_mntent='$i_mntent'
22171 i_ndbm='$i_ndbm'
22172 i_netdb='$i_netdb'
22173 i_neterrno='$i_neterrno'
22174 i_netinettcp='$i_netinettcp'
22175 i_niin='$i_niin'
22176 i_poll='$i_poll'
22177 i_prot='$i_prot'
22178 i_pthread='$i_pthread'
22179 i_pwd='$i_pwd'
22180 i_rpcsvcdbm='$i_rpcsvcdbm'
22181 i_sfio='$i_sfio'
22182 i_sgtty='$i_sgtty'
22183 i_shadow='$i_shadow'
22184 i_socks='$i_socks'
22185 i_stdarg='$i_stdarg'
22186 i_stddef='$i_stddef'
22187 i_stdlib='$i_stdlib'
22188 i_string='$i_string'
22189 i_sunmath='$i_sunmath'
22190 i_sysaccess='$i_sysaccess'
22191 i_sysdir='$i_sysdir'
22192 i_sysfile='$i_sysfile'
22193 i_sysfilio='$i_sysfilio'
22194 i_sysin='$i_sysin'
22195 i_sysioctl='$i_sysioctl'
22196 i_syslog='$i_syslog'
22197 i_sysmman='$i_sysmman'
22198 i_sysmode='$i_sysmode'
22199 i_sysmount='$i_sysmount'
22200 i_sysndir='$i_sysndir'
22201 i_sysparam='$i_sysparam'
22202 i_sysresrc='$i_sysresrc'
22203 i_syssecrt='$i_syssecrt'
22204 i_sysselct='$i_sysselct'
22205 i_syssockio='$i_syssockio'
22206 i_sysstat='$i_sysstat'
22207 i_sysstatfs='$i_sysstatfs'
22208 i_sysstatvfs='$i_sysstatvfs'
22209 i_systime='$i_systime'
22210 i_systimek='$i_systimek'
22211 i_systimes='$i_systimes'
22212 i_systypes='$i_systypes'
22213 i_sysuio='$i_sysuio'
22214 i_sysun='$i_sysun'
22215 i_sysutsname='$i_sysutsname'
22216 i_sysvfs='$i_sysvfs'
22217 i_syswait='$i_syswait'
22218 i_termio='$i_termio'
22219 i_termios='$i_termios'
22220 i_time='$i_time'
22221 i_unistd='$i_unistd'
22222 i_ustat='$i_ustat'
22223 i_utime='$i_utime'
22224 i_values='$i_values'
22225 i_varargs='$i_varargs'
22226 i_varhdr='$i_varhdr'
22227 i_vfork='$i_vfork'
22228 ignore_versioned_solibs='$ignore_versioned_solibs'
22229 inc_version_list='$inc_version_list'
22230 inc_version_list_init='$inc_version_list_init'
22231 incpath='$incpath'
22232 inews='$inews'
22233 initialinstalllocation='$initialinstalllocation'
22234 installarchlib='$installarchlib'
22235 installbin='$installbin'
22236 installhtml1dir='$installhtml1dir'
22237 installhtml3dir='$installhtml3dir'
22238 installman1dir='$installman1dir'
22239 installman3dir='$installman3dir'
22240 installprefix='$installprefix'
22241 installprefixexp='$installprefixexp'
22242 installprivlib='$installprivlib'
22243 installscript='$installscript'
22244 installsitearch='$installsitearch'
22245 installsitebin='$installsitebin'
22246 installsitehtml1dir='$installsitehtml1dir'
22247 installsitehtml3dir='$installsitehtml3dir'
22248 installsitelib='$installsitelib'
22249 installsiteman1dir='$installsiteman1dir'
22250 installsiteman3dir='$installsiteman3dir'
22251 installsitescript='$installsitescript'
22252 installstyle='$installstyle'
22253 installusrbinperl='$installusrbinperl'
22254 installvendorarch='$installvendorarch'
22255 installvendorbin='$installvendorbin'
22256 installvendorhtml1dir='$installvendorhtml1dir'
22257 installvendorhtml3dir='$installvendorhtml3dir'
22258 installvendorlib='$installvendorlib'
22259 installvendorman1dir='$installvendorman1dir'
22260 installvendorman3dir='$installvendorman3dir'
22261 installvendorscript='$installvendorscript'
22262 intsize='$intsize'
22263 issymlink='$issymlink'
22264 ivdformat='$ivdformat'
22265 ivsize='$ivsize'
22266 ivtype='$ivtype'
22267 known_extensions='$known_extensions'
22268 ksh='$ksh'
22269 ld='$ld'
22270 lddlflags='$lddlflags'
22271 ldflags='$ldflags'
22272 ldflags_uselargefiles='$ldflags_uselargefiles'
22273 ldlibpthname='$ldlibpthname'
22274 less='$less'
22275 lib_ext='$lib_ext'
22276 libc='$libc'
22277 libperl='$libperl'
22278 libpth='$libpth'
22279 libs='$libs'
22280 libsdirs='$libsdirs'
22281 libsfiles='$libsfiles'
22282 libsfound='$libsfound'
22283 libspath='$libspath'
22284 libswanted='$libswanted'
22285 libswanted_uselargefiles='$libswanted_uselargefiles'
22286 line='$line'
22287 lint='$lint'
22288 lkflags='$lkflags'
22289 ln='$ln'
22290 lns='$lns'
22291 localtime_r_proto='$localtime_r_proto'
22292 locincpth='$locincpth'
22293 loclibpth='$loclibpth'
22294 longdblsize='$longdblsize'
22295 longlongsize='$longlongsize'
22296 longsize='$longsize'
22297 lp='$lp'
22298 lpr='$lpr'
22299 ls='$ls'
22300 lseeksize='$lseeksize'
22301 lseektype='$lseektype'
22302 mad='$mad'
22303 madlyh='$madlyh'
22304 madlyobj='$madlyobj'
22305 madlysrc='$madlysrc'
22306 mail='$mail'
22307 mailx='$mailx'
22308 make='$make'
22309 make_set_make='$make_set_make'
22310 mallocobj='$mallocobj'
22311 mallocsrc='$mallocsrc'
22312 malloctype='$malloctype'
22313 man1dir='$man1dir'
22314 man1direxp='$man1direxp'
22315 man1ext='$man1ext'
22316 man3dir='$man3dir'
22317 man3direxp='$man3direxp'
22318 man3ext='$man3ext'
22319 mips_type='$mips_type'
22320 mistrustnm='$mistrustnm'
22321 mkdir='$mkdir'
22322 mmaptype='$mmaptype'
22323 modetype='$modetype'
22324 more='$more'
22325 multiarch='$multiarch'
22326 mv='$mv'
22327 myarchname='$myarchname'
22328 mydomain='$mydomain'
22329 myhostname='$myhostname'
22330 myuname='$myuname'
22331 n='$n'
22332 need_va_copy='$need_va_copy'
22333 netdb_hlen_type='$netdb_hlen_type'
22334 netdb_host_type='$netdb_host_type'
22335 netdb_name_type='$netdb_name_type'
22336 netdb_net_type='$netdb_net_type'
22337 nm='$nm'
22338 nm_opt='$nm_opt'
22339 nm_so_opt='$nm_so_opt'
22340 nonxs_ext='$nonxs_ext'
22341 nroff='$nroff'
22342 nvEUformat='$nvEUformat'
22343 nvFUformat='$nvFUformat'
22344 nvGUformat='$nvGUformat'
22345 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22346 nveformat='$nveformat'
22347 nvfformat='$nvfformat'
22348 nvgformat='$nvgformat'
22349 nvsize='$nvsize'
22350 nvtype='$nvtype'
22351 o_nonblock='$o_nonblock'
22352 obj_ext='$obj_ext'
22353 old_pthread_create_joinable='$old_pthread_create_joinable'
22354 optimize='$optimize'
22355 orderlib='$orderlib'
22356 osname='$osname'
22357 osvers='$osvers'
22358 otherlibdirs='$otherlibdirs'
22359 package='$package'
22360 pager='$pager'
22361 passcat='$passcat'
22362 patchlevel='$patchlevel'
22363 path_sep='$path_sep'
22364 perl5='$perl5'
22365 perl='$perl'
22366 perl_patchlevel='$perl_patchlevel'
22367 perladmin='$perladmin'
22368 perllibs='$perllibs'
22369 perlpath='$perlpath'
22370 pg='$pg'
22371 phostname='$phostname'
22372 pidtype='$pidtype'
22373 plibpth='$plibpth'
22374 pmake='$pmake'
22375 pr='$pr'
22376 prefix='$prefix'
22377 prefixexp='$prefixexp'
22378 privlib='$privlib'
22379 privlibexp='$privlibexp'
22380 procselfexe='$procselfexe'
22381 prototype='$prototype'
22382 ptrsize='$ptrsize'
22383 quadkind='$quadkind'
22384 quadtype='$quadtype'
22385 randbits='$randbits'
22386 randfunc='$randfunc'
22387 random_r_proto='$random_r_proto'
22388 randseedtype='$randseedtype'
22389 ranlib='$ranlib'
22390 rd_nodata='$rd_nodata'
22391 readdir64_r_proto='$readdir64_r_proto'
22392 readdir_r_proto='$readdir_r_proto'
22393 revision='$revision'
22394 rm='$rm'
22395 rm_try='$rm_try'
22396 rmail='$rmail'
22397 run='$run'
22398 runnm='$runnm'
22399 sPRIEUldbl='$sPRIEUldbl'
22400 sPRIFUldbl='$sPRIFUldbl'
22401 sPRIGUldbl='$sPRIGUldbl'
22402 sPRIXU64='$sPRIXU64'
22403 sPRId64='$sPRId64'
22404 sPRIeldbl='$sPRIeldbl'
22405 sPRIfldbl='$sPRIfldbl'
22406 sPRIgldbl='$sPRIgldbl'
22407 sPRIi64='$sPRIi64'
22408 sPRIo64='$sPRIo64'
22409 sPRIu64='$sPRIu64'
22410 sPRIx64='$sPRIx64'
22411 sSCNfldbl='$sSCNfldbl'
22412 sched_yield='$sched_yield'
22413 scriptdir='$scriptdir'
22414 scriptdirexp='$scriptdirexp'
22415 sed='$sed'
22416 seedfunc='$seedfunc'
22417 selectminbits='$selectminbits'
22418 selecttype='$selecttype'
22419 sendmail='$sendmail'
22420 setgrent_r_proto='$setgrent_r_proto'
22421 sethostent_r_proto='$sethostent_r_proto'
22422 setlocale_r_proto='$setlocale_r_proto'
22423 setnetent_r_proto='$setnetent_r_proto'
22424 setprotoent_r_proto='$setprotoent_r_proto'
22425 setpwent_r_proto='$setpwent_r_proto'
22426 setservent_r_proto='$setservent_r_proto'
22427 sh='$sh'
22428 shar='$shar'
22429 sharpbang='$sharpbang'
22430 shmattype='$shmattype'
22431 shortsize='$shortsize'
22432 shrpenv='$shrpenv'
22433 shsharp='$shsharp'
22434 sig_count='$sig_count'
22435 sig_name='$sig_name'
22436 sig_name_init='$sig_name_init'
22437 sig_num='$sig_num'
22438 sig_num_init='$sig_num_init'
22439 sig_size='$sig_size'
22440 signal_t='$signal_t'
22441 sitearch='$sitearch'
22442 sitearchexp='$sitearchexp'
22443 sitebin='$sitebin'
22444 sitebinexp='$sitebinexp'
22445 sitehtml1dir='$sitehtml1dir'
22446 sitehtml1direxp='$sitehtml1direxp'
22447 sitehtml3dir='$sitehtml3dir'
22448 sitehtml3direxp='$sitehtml3direxp'
22449 sitelib='$sitelib'
22450 sitelib_stem='$sitelib_stem'
22451 sitelibexp='$sitelibexp'
22452 siteman1dir='$siteman1dir'
22453 siteman1direxp='$siteman1direxp'
22454 siteman3dir='$siteman3dir'
22455 siteman3direxp='$siteman3direxp'
22456 siteprefix='$siteprefix'
22457 siteprefixexp='$siteprefixexp'
22458 sitescript='$sitescript'
22459 sitescriptexp='$sitescriptexp'
22460 sizesize='$sizesize'
22461 sizetype='$sizetype'
22462 sleep='$sleep'
22463 smail='$smail'
22464 so='$so'
22465 sockethdr='$sockethdr'
22466 socketlib='$socketlib'
22467 socksizetype='$socksizetype'
22468 sort='$sort'
22469 spackage='$spackage'
22470 spitshell='$spitshell'
22471 srand48_r_proto='$srand48_r_proto'
22472 srandom_r_proto='$srandom_r_proto'
22473 src='$src'
22474 ssizetype='$ssizetype'
22475 startperl='$startperl'
22476 startsh='$startsh'
22477 static_ext='$static_ext'
22478 stdchar='$stdchar'
22479 stdio_base='$stdio_base'
22480 stdio_bufsiz='$stdio_bufsiz'
22481 stdio_cnt='$stdio_cnt'
22482 stdio_filbuf='$stdio_filbuf'
22483 stdio_ptr='$stdio_ptr'
22484 stdio_stream_array='$stdio_stream_array'
22485 strerror_r_proto='$strerror_r_proto'
22486 strings='$strings'
22487 submit='$submit'
22488 subversion='$subversion'
22489 sysman='$sysman'
22490 tail='$tail'
22491 tar='$tar'
22492 targetarch='$targetarch'
22493 tbl='$tbl'
22494 tee='$tee'
22495 test='$test'
22496 timeincl='$timeincl'
22497 timetype='$timetype'
22498 tmpnam_r_proto='$tmpnam_r_proto'
22499 to='$to'
22500 touch='$touch'
22501 tr='$tr'
22502 trnl='$trnl'
22503 troff='$troff'
22504 ttyname_r_proto='$ttyname_r_proto'
22505 u16size='$u16size'
22506 u16type='$u16type'
22507 u32size='$u32size'
22508 u32type='$u32type'
22509 u64size='$u64size'
22510 u64type='$u64type'
22511 u8size='$u8size'
22512 u8type='$u8type'
22513 uidformat='$uidformat'
22514 uidsign='$uidsign'
22515 uidsize='$uidsize'
22516 uidtype='$uidtype'
22517 uname='$uname'
22518 uniq='$uniq'
22519 uquadtype='$uquadtype'
22520 use5005threads='$use5005threads'
22521 use64bitall='$use64bitall'
22522 use64bitint='$use64bitint'
22523 usecrosscompile='$usecrosscompile'
22524 usedl='$usedl'
22525 usefaststdio='$usefaststdio'
22526 useithreads='$useithreads'
22527 uselargefiles='$uselargefiles'
22528 uselongdouble='$uselongdouble'
22529 usemallocwrap='$usemallocwrap'
22530 usemorebits='$usemorebits'
22531 usemultiplicity='$usemultiplicity'
22532 usemymalloc='$usemymalloc'
22533 usenm='$usenm'
22534 useopcode='$useopcode'
22535 useperlio='$useperlio'
22536 useposix='$useposix'
22537 usereentrant='$usereentrant'
22538 userelocatableinc='$userelocatableinc'
22539 usesfio='$usesfio'
22540 useshrplib='$useshrplib'
22541 usesitecustomize='$usesitecustomize'
22542 usesocks='$usesocks'
22543 usethreads='$usethreads'
22544 usevendorprefix='$usevendorprefix'
22545 usevfork='$usevfork'
22546 usrinc='$usrinc'
22547 uuname='$uuname'
22548 uvXUformat='$uvXUformat'
22549 uvoformat='$uvoformat'
22550 uvsize='$uvsize'
22551 uvtype='$uvtype'
22552 uvuformat='$uvuformat'
22553 uvxformat='$uvxformat'
22554 vendorarch='$vendorarch'
22555 vendorarchexp='$vendorarchexp'
22556 vendorbin='$vendorbin'
22557 vendorbinexp='$vendorbinexp'
22558 vendorhtml1dir='$vendorhtml1dir'
22559 vendorhtml1direxp='$vendorhtml1direxp'
22560 vendorhtml3dir='$vendorhtml3dir'
22561 vendorhtml3direxp='$vendorhtml3direxp'
22562 vendorlib='$vendorlib'
22563 vendorlib_stem='$vendorlib_stem'
22564 vendorlibexp='$vendorlibexp'
22565 vendorman1dir='$vendorman1dir'
22566 vendorman1direxp='$vendorman1direxp'
22567 vendorman3dir='$vendorman3dir'
22568 vendorman3direxp='$vendorman3direxp'
22569 vendorprefix='$vendorprefix'
22570 vendorprefixexp='$vendorprefixexp'
22571 vendorscript='$vendorscript'
22572 vendorscriptexp='$vendorscriptexp'
22573 version='$version'
22574 version_patchlevel_string='$version_patchlevel_string'
22575 versiononly='$versiononly'
22576 vi='$vi'
22577 voidflags='$voidflags'
22578 xlibpth='$xlibpth'
22579 yacc='$yacc'
22580 yaccflags='$yaccflags'
22581 zcat='$zcat'
22582 zip='$zip'
22583 EOT
22584
22585 : Add in command line options if available
22586 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22587
22588 : add special variables
22589 $test -f $src/patchlevel.h && \
22590 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22591 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22592 echo "PERL_CONFIG_SH=true" >>config.sh
22593
22594 : propagate old symbols
22595 if $test -f UU/config.sh; then
22596         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22597         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22598         $sort | $uniq -u >UU/oldsyms
22599         set X `cat UU/oldsyms`
22600         shift
22601         case $# in
22602         0) ;;
22603         *)
22604                 cat <<EOM
22605 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22606 EOM
22607                 echo "# Variables propagated from previous config.sh file." >>config.sh
22608                 for sym in `cat UU/oldsyms`; do
22609                         echo "    Propagating $hint variable "'$'"$sym..."
22610                         eval 'tmp="$'"${sym}"'"'
22611                         echo "$tmp" | \
22612                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22613                 done
22614                 ;;
22615         esac
22616 fi
22617
22618 : Finish up by extracting the .SH files
22619 case "$alldone" in
22620 exit)
22621         $rm -rf UU
22622         echo "Extraction done."
22623         exit 0
22624         ;;
22625 cont)
22626         ;;
22627 '')
22628         dflt=''
22629         nostick=true
22630         $cat <<EOM
22631
22632 If you'd like to make any changes to the config.sh file before I begin
22633 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22634
22635 EOM
22636         rp="Press return or use a shell escape to edit config.sh:"
22637         . UU/myread
22638         nostick=''
22639         case "$ans" in
22640         '') ;;
22641         *) : in case they cannot read
22642                 sh 1>&4 -c "$ans";;
22643         esac
22644         ;;
22645 esac
22646
22647 : if this fails, just run all the .SH files by hand
22648 . ./config.sh
22649
22650 echo " "
22651 exec 1>&4
22652 pwd=`pwd`
22653 . ./UU/extract
22654 cd "$pwd"
22655
22656 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22657         dflt=y
22658         case "$silent" in
22659         true) ;;
22660         *)
22661                 $cat <<EOM
22662
22663 Now you need to generate make dependencies by running "$make depend".
22664 You might prefer to run it in background: "$make depend > makedepend.out &"
22665 It can take a while, so you might not want to run it right now.
22666
22667 EOM
22668                 ;;
22669         esac
22670         rp="Run $make depend now?"
22671         . UU/myread
22672         case "$ans" in
22673         y*)
22674                 $make depend && echo "Now you must run '$make'."
22675                 ;;
22676         *)
22677                 echo "You must run '$make depend' then '$make'."
22678                 ;;
22679         esac
22680 elif test -f [Mm]akefile; then
22681         echo " "
22682         echo "Now you must run a $make."
22683 else
22684         echo "Configure done."
22685 fi
22686
22687 if $test -f Policy.sh; then
22688     $cat <<EOM
22689
22690 If you compile $package on a different machine or from a different object
22691 directory, copy the Policy.sh file from this object directory to the
22692 new one before you run Configure -- this will help you with most of
22693 the policy defaults.
22694
22695 EOM
22696 fi
22697 if $test -f config.msg; then
22698     echo "Hmm.  I also noted the following information while running:"
22699     echo " "
22700     $cat config.msg >&4
22701     $rm -f config.msg
22702 fi
22703 $rm -f kit*isdone ark*isdone
22704 $rm -rf UU
22705
22706 : End of Configure
22707