cd04dae25d4e564c5e44bb668d202b2adc7fd39c
[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 Mon Oct  8 10:22:27 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 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_math=''
873 i_memory=''
874 i_mntent=''
875 i_ndbm=''
876 i_netdb=''
877 i_neterrno=''
878 i_netinettcp=''
879 i_niin=''
880 i_sysin=''
881 i_poll=''
882 i_prot=''
883 i_pthread=''
884 d_pwage=''
885 d_pwchange=''
886 d_pwclass=''
887 d_pwcomment=''
888 d_pwexpire=''
889 d_pwgecos=''
890 d_pwpasswd=''
891 d_pwquota=''
892 i_pwd=''
893 i_sfio=''
894 i_shadow=''
895 i_socks=''
896 i_stddef=''
897 i_stdlib=''
898 i_string=''
899 strings=''
900 i_sunmath=''
901 i_sysaccess=''
902 i_sysdir=''
903 i_sysfile=''
904 d_voidtty=''
905 i_bsdioctl=''
906 i_sysfilio=''
907 i_sysioctl=''
908 i_syssockio=''
909 i_syslog=''
910 i_sysmman=''
911 i_sysmode=''
912 i_sysmount=''
913 i_sysndir=''
914 i_sysparam=''
915 i_sysresrc=''
916 i_syssecrt=''
917 i_sysselct=''
918 i_sysstat=''
919 i_sysstatfs=''
920 i_sysstatvfs=''
921 i_systimes=''
922 i_systypes=''
923 i_sysuio=''
924 i_sysun=''
925 i_sysutsname=''
926 i_sysvfs=''
927 i_syswait=''
928 i_sgtty=''
929 i_termio=''
930 i_termios=''
931 d_tm_tm_gmtoff=''
932 d_tm_tm_zone=''
933 i_systime=''
934 i_systimek=''
935 i_time=''
936 timeincl=''
937 i_unistd=''
938 i_ustat=''
939 i_utime=''
940 i_values=''
941 i_stdarg=''
942 i_varargs=''
943 i_varhdr=''
944 i_vfork=''
945 d_inc_version_list=''
946 inc_version_list=''
947 inc_version_list_init=''
948 installprefix=''
949 installprefixexp=''
950 installstyle=''
951 installusrbinperl=''
952 intsize=''
953 longsize=''
954 shortsize=''
955 issymlink=''
956 libc=''
957 ldlibpthname=''
958 libperl=''
959 shrpenv=''
960 useshrplib=''
961 glibpth=''
962 libpth=''
963 loclibpth=''
964 plibpth=''
965 xlibpth=''
966 ignore_versioned_solibs=''
967 libs=''
968 libsdirs=''
969 libsfiles=''
970 libsfound=''
971 libspath=''
972 lns=''
973 d_PRIEUldbl=''
974 d_PRIFUldbl=''
975 d_PRIGUldbl=''
976 d_PRIeldbl=''
977 d_PRIfldbl=''
978 d_PRIgldbl=''
979 d_SCNfldbl=''
980 sPRIEUldbl=''
981 sPRIFUldbl=''
982 sPRIGUldbl=''
983 sPRIeldbl=''
984 sPRIfldbl=''
985 sPRIgldbl=''
986 sSCNfldbl=''
987 lseeksize=''
988 lseektype=''
989 mad=''
990 madlyh=''
991 madlyobj=''
992 madlysrc=''
993 make_set_make=''
994 d_mymalloc=''
995 freetype=''
996 mallocobj=''
997 mallocsrc=''
998 malloctype=''
999 usemallocwrap=''
1000 usemymalloc=''
1001 installman1dir=''
1002 man1dir=''
1003 man1direxp=''
1004 man1ext=''
1005 installman3dir=''
1006 man3dir=''
1007 man3direxp=''
1008 man3ext=''
1009 modetype=''
1010 multiarch=''
1011 mydomain=''
1012 myhostname=''
1013 phostname=''
1014 c=''
1015 n=''
1016 d_eofnblk=''
1017 eagain=''
1018 o_nonblock=''
1019 rd_nodata=''
1020 need_va_copy=''
1021 netdb_hlen_type=''
1022 netdb_host_type=''
1023 netdb_name_type=''
1024 netdb_net_type=''
1025 groupcat=''
1026 hostcat=''
1027 passcat=''
1028 orderlib=''
1029 ranlib=''
1030 d_perl_otherlibdirs=''
1031 otherlibdirs=''
1032 package=''
1033 spackage=''
1034 pager=''
1035 api_revision=''
1036 api_subversion=''
1037 api_version=''
1038 api_versionstring=''
1039 patchlevel=''
1040 perl_patchlevel=''
1041 revision=''
1042 subversion=''
1043 version=''
1044 version_patchlevel_string=''
1045 perl5=''
1046 perladmin=''
1047 perlpath=''
1048 d_nv_preserves_uv=''
1049 d_nv_zero_is_allbits_zero=''
1050 i16size=''
1051 i16type=''
1052 i32size=''
1053 i32type=''
1054 i64size=''
1055 i64type=''
1056 i8size=''
1057 i8type=''
1058 ivsize=''
1059 ivtype=''
1060 nv_preserves_uv_bits=''
1061 nvsize=''
1062 nvtype=''
1063 u16size=''
1064 u16type=''
1065 u32size=''
1066 u32type=''
1067 u64size=''
1068 u64type=''
1069 u8size=''
1070 u8type=''
1071 uvsize=''
1072 uvtype=''
1073 ivdformat=''
1074 nvEUformat=''
1075 nvFUformat=''
1076 nvGUformat=''
1077 nveformat=''
1078 nvfformat=''
1079 nvgformat=''
1080 uvXUformat=''
1081 uvoformat=''
1082 uvuformat=''
1083 uvxformat=''
1084 pidtype=''
1085 prefix=''
1086 prefixexp=''
1087 installprivlib=''
1088 privlib=''
1089 privlibexp=''
1090 prototype=''
1091 ptrsize=''
1092 d_PRIXU64=''
1093 d_PRId64=''
1094 d_PRIi64=''
1095 d_PRIo64=''
1096 d_PRIu64=''
1097 d_PRIx64=''
1098 sPRIXU64=''
1099 sPRId64=''
1100 sPRIi64=''
1101 sPRIo64=''
1102 sPRIu64=''
1103 sPRIx64=''
1104 d_quad=''
1105 quadkind=''
1106 quadtype=''
1107 uquadtype=''
1108 drand01=''
1109 randbits=''
1110 randfunc=''
1111 randseedtype=''
1112 seedfunc=''
1113 installscript=''
1114 scriptdir=''
1115 scriptdirexp=''
1116 selectminbits=''
1117 selecttype=''
1118 sh=''
1119 sig_count=''
1120 sig_name=''
1121 sig_name_init=''
1122 sig_num=''
1123 sig_num_init=''
1124 sig_size=''
1125 d_sitearch=''
1126 installsitearch=''
1127 sitearch=''
1128 sitearchexp=''
1129 installsitebin=''
1130 sitebin=''
1131 sitebinexp=''
1132 installsitehtml1dir=''
1133 sitehtml1dir=''
1134 sitehtml1direxp=''
1135 installsitehtml3dir=''
1136 sitehtml3dir=''
1137 sitehtml3direxp=''
1138 installsitelib=''
1139 sitelib=''
1140 sitelib_stem=''
1141 sitelibexp=''
1142 installsiteman1dir=''
1143 siteman1dir=''
1144 siteman1direxp=''
1145 installsiteman3dir=''
1146 siteman3dir=''
1147 siteman3direxp=''
1148 siteprefix=''
1149 siteprefixexp=''
1150 installsitescript=''
1151 sitescript=''
1152 sitescriptexp=''
1153 sizesize=''
1154 sizetype=''
1155 so=''
1156 socksizetype=''
1157 sharpbang=''
1158 shsharp=''
1159 spitshell=''
1160 src=''
1161 ssizetype=''
1162 startperl=''
1163 startsh=''
1164 stdchar=''
1165 d_stdio_stream_array=''
1166 stdio_stream_array=''
1167 sysman=''
1168 trnl=''
1169 uidformat=''
1170 uidsign=''
1171 uidsize=''
1172 uidtype=''
1173 archname64=''
1174 use64bitall=''
1175 use64bitint=''
1176 usefaststdio=''
1177 ccflags_uselargefiles=''
1178 ldflags_uselargefiles=''
1179 libswanted_uselargefiles=''
1180 uselargefiles=''
1181 uselongdouble=''
1182 usemorebits=''
1183 usemultiplicity=''
1184 nm_opt=''
1185 nm_so_opt=''
1186 runnm=''
1187 usenm=''
1188 useperlio=''
1189 usesocks=''
1190 d_oldpthreads=''
1191 use5005threads=''
1192 useithreads=''
1193 usereentrant=''
1194 usethreads=''
1195 incpath=''
1196 mips_type=''
1197 usrinc=''
1198 d_vendorarch=''
1199 installvendorarch=''
1200 vendorarch=''
1201 vendorarchexp=''
1202 d_vendorbin=''
1203 installvendorbin=''
1204 vendorbin=''
1205 vendorbinexp=''
1206 installvendorhtml1dir=''
1207 vendorhtml1dir=''
1208 vendorhtml1direxp=''
1209 installvendorhtml3dir=''
1210 vendorhtml3dir=''
1211 vendorhtml3direxp=''
1212 d_vendorlib=''
1213 installvendorlib=''
1214 vendorlib=''
1215 vendorlib_stem=''
1216 vendorlibexp=''
1217 installvendorman1dir=''
1218 vendorman1dir=''
1219 vendorman1direxp=''
1220 installvendorman3dir=''
1221 vendorman3dir=''
1222 vendorman3direxp=''
1223 usevendorprefix=''
1224 vendorprefix=''
1225 vendorprefixexp=''
1226 d_vendorscript=''
1227 installvendorscript=''
1228 vendorscript=''
1229 vendorscriptexp=''
1230 versiononly=''
1231 defvoidused=''
1232 voidflags=''
1233 yacc=''
1234 yaccflags=''
1235 CONFIG=''
1236
1237 define='define'
1238 undef='undef'
1239 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1240 rmlist=''
1241
1242 : We must find out about Eunice early
1243 eunicefix=':'
1244 if test -f /etc/unixtovms; then
1245         eunicefix=/etc/unixtovms
1246 fi
1247 if test -f /etc/unixtovms.exe; then
1248         eunicefix=/etc/unixtovms.exe
1249 fi
1250
1251 : Set executable suffix now -- needed before hints available
1252 if test -f "/libs/version.library"; then
1253 : Amiga OS
1254     _exe=""
1255 elif test -f "/system/gnu_library/bin/ar.pm"; then
1256 : Stratus VOS
1257     _exe=".pm"
1258 elif test -n "$DJGPP"; then
1259 : DOS DJGPP
1260     _exe=".exe"
1261 elif test -d c:/. -o -n "$is_os2" ; then
1262 : OS/2 or cygwin
1263     _exe=".exe"
1264 fi
1265
1266 i_whoami=''
1267 : Trailing extension.  Override this in a hint file, if needed.
1268 : Extra object files, if any, needed on this platform.
1269 archobjs=''
1270 archname=''
1271 groupstype=''
1272 libnames=''
1273 : change the next line if compiling for Xenix/286 on Xenix/386
1274 xlibpth='/usr/lib/386 /lib/386'
1275 : Possible local library directories to search.
1276 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279 : general looking path for locating libraries
1280 glibpth="/lib /usr/lib $xlibpth"
1281 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1282 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1284 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1285
1286 : Private path used by Configure to find libraries.  Its value
1287 : is prepended to libpth. This variable takes care of special
1288 : machines, like the mips.  Usually, it should be empty.
1289 plibpth=''
1290
1291 : default library list
1292 libswanted=''
1293 : some systems want to use only the non-versioned libso:s
1294 ignore_versioned_solibs=''
1295 siteman1dir=''
1296 siteman3dir=''
1297 sitescript=''
1298 : set usethreads on the Configure command line to enable threads.
1299 usereentrant='undef'
1300 : full support for void wanted by default
1301 defvoidused=15
1302
1303 : Possible local include directories to search.
1304 : Set locincpth to "" in a hint file to defeat local include searches.
1305 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1306 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1307 :
1308 : no include file wanted by default
1309 inclwanted=''
1310
1311 : Enable -DEBUGGING and -DDEBUGGING from the command line
1312 EBUGGING=''
1313 DEBUGGING=old
1314
1315 ccname=''
1316 ccversion=''
1317 perllibs=''
1318 : set useposix=false in your hint file to disable the POSIX extension.
1319 useposix=true
1320 : set useopcode=false in your hint file to disable the Opcode extension.
1321 useopcode=true
1322 archname64=''
1323 ccflags_uselargefiles=''
1324 ldflags_uselargefiles=''
1325 libswanted_uselargefiles=''
1326 : set usemultiplicity on the Configure command line to enable multiplicity.
1327 : set usesocks on the Configure command line to enable socks.
1328 : List of libraries we want.
1329 : If anyone needs extra -lxxx, put those in a hint file.
1330 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1331 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1332 : We probably want to search /usr/shlib before most other libraries.
1333 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1334 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1335 glibpth="/usr/shlib $glibpth"
1336 : Do not use vfork unless overridden by a hint file.
1337 usevfork=false
1338
1339 : Find the basic shell for Bourne shell scripts
1340 case "$sh" in
1341 '')
1342         case "$SYSTYPE" in
1343         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1344         *) xxx='/bin/sh';;
1345         esac
1346         if test -f "$xxx"; then
1347                 sh="$xxx"
1348         else
1349                 : Build up a list and do a single loop so we can 'break' out.
1350                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1351                 for xxx in sh bash ksh pdksh ash; do
1352                         for p in $pth; do
1353                                 try="$try ${p}/${xxx}"
1354                         done
1355                 done
1356                 for xxx in $try; do
1357                         if test -f "$xxx"; then
1358                                 sh="$xxx";
1359                                 break
1360                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test -f "$xxx.exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         fi
1367                 done
1368         fi
1369         ;;
1370 esac
1371
1372 case "$sh" in
1373 '')     cat >&2 <<EOM
1374 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1375
1376 Usually it's in /bin/sh.  How did you even get this far?
1377 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1378 we'll try to straighten this all out.
1379 EOM
1380         exit 1
1381         ;;
1382 esac
1383
1384 : see if sh knows # comments
1385 if `$sh -c '#' >/dev/null 2>&1`; then
1386         shsharp=true
1387         spitshell=cat
1388         xcat=/bin/cat
1389         test -f $xcat$_exe || xcat=/usr/bin/cat
1390         if test ! -f $xcat$_exe; then
1391                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1392                         if test -f $p/cat$_exe; then
1393                                 xcat=$p/cat
1394                                 break
1395                         fi
1396                 done
1397                 if test ! -f $xcat$_exe; then
1398                         echo "Can't find cat anywhere!"
1399                         exit 1
1400                 fi
1401         fi
1402         echo "#!$xcat" >sharp
1403         $eunicefix sharp
1404         chmod +x sharp
1405         ./sharp > today
1406         if test -s today; then
1407                 sharpbang='#!'
1408         else
1409                 echo "#! $xcat" > sharp
1410                 $eunicefix sharp
1411                 chmod +x sharp
1412                 ./sharp > today
1413                 if test -s today; then
1414                         sharpbang='#! '
1415                 else
1416                         sharpbang=': use '
1417                 fi
1418         fi
1419 else
1420         echo " "
1421         echo "Your $sh doesn't grok # comments--I will strip them later on."
1422         shsharp=false
1423         cd ..
1424         echo "exec grep -v '^[  ]*#'" >spitshell
1425         chmod +x spitshell
1426         $eunicefix spitshell
1427         spitshell=`pwd`/spitshell
1428         cd UU
1429         echo "I presume that if # doesn't work, #! won't work either!"
1430         sharpbang=': use '
1431 fi
1432 rm -f sharp today
1433
1434 : figure out how to guarantee sh startup
1435 case "$startsh" in
1436 '') startsh=${sharpbang}${sh} ;;
1437 *)
1438 esac
1439 cat >sharp <<EOSS
1440 $startsh
1441 set abc
1442 test "$?abc" != 1
1443 EOSS
1444
1445 chmod +x sharp
1446 $eunicefix sharp
1447 if ./sharp; then
1448         : echo "Yup, it does."
1449 else
1450         echo "Hmm... '$startsh' does not guarantee sh startup..."
1451         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1452 fi
1453 rm -f sharp
1454
1455
1456 : Save command line options in file UU/cmdline.opt for later use in
1457 : generating config.sh.
1458 cat > cmdline.opt <<EOSH
1459 # Configure command line arguments.
1460 config_arg0='$0'
1461 config_args='$*'
1462 config_argc=$#
1463 EOSH
1464 argn=1
1465 args_exp=''
1466 args_sep=''
1467 for arg in "$@"; do
1468         cat >>cmdline.opt <<EOSH
1469 config_arg$argn='$arg'
1470 EOSH
1471         # Extreme backslashitis: replace each ' by '"'"'
1472         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473 $arg
1474 EOC
1475         arg_exp=`cat cmdl.opt`
1476         args_exp="$args_exp$args_sep'$arg_exp'"
1477         argn=`expr $argn + 1`
1478         args_sep=' '
1479 done
1480 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1481 # used by ./hints/os2.sh
1482 rm -f cmdl.opt
1483
1484 : produce awk script to parse command line options
1485 cat >options.awk <<'EOF'
1486 BEGIN {
1487         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1488
1489         len = length(optstr);
1490         for (i = 1; i <= len; i++) {
1491                 c = substr(optstr, i, 1);
1492                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493                 if (a == ":") {
1494                         arg[c] = 1;
1495                         i++;
1496                 }
1497                 opt[c] = 1;
1498         }
1499 }
1500 {
1501         expect = 0;
1502         str = $0;
1503         if (substr(str, 1, 1) != "-") {
1504                 printf("'%s'\n", str);
1505                 next;
1506         }
1507         len = length($0);
1508         for (i = 2; i <= len; i++) {
1509                 c = substr(str, i, 1);
1510                 if (!opt[c]) {
1511                         printf("-%s\n", substr(str, i));
1512                         next;
1513                 }
1514                 printf("-%s\n", c);
1515                 if (arg[c]) {
1516                         if (i < len)
1517                                 printf("'%s'\n", substr(str, i + 1));
1518                         else
1519                                 expect = 1;
1520                         next;
1521                 }
1522         }
1523 }
1524 END {
1525         if (expect)
1526                 print "?";
1527 }
1528 EOF
1529
1530 : process the command line options
1531 set X `for arg in "$@"; do echo "X$arg"; done |
1532         sed -e s/X// | awk -f options.awk`
1533 eval "set $*"
1534 shift
1535 rm -f options.awk
1536
1537 : set up default values
1538 fastread=''
1539 reuseval=false
1540 config_sh=''
1541 alldone=''
1542 error=''
1543 silent=''
1544 extractsh=''
1545 override=''
1546 knowitall=''
1547 rm -f optdef.sh posthint.sh
1548 cat >optdef.sh <<EOS
1549 $startsh
1550 EOS
1551
1552
1553 : option parsing
1554 while test $# -gt 0; do
1555         case "$1" in
1556         -d) shift; fastread=yes;;
1557         -e) shift; alldone=cont;;
1558         -f)
1559                 shift
1560                 cd ..
1561                 if test -r "$1"; then
1562                         config_sh="$1"
1563                 else
1564                         echo "$me: cannot read config file $1." >&2
1565                         error=true
1566                 fi
1567                 cd UU
1568                 shift;;
1569         --help|\
1570         -h) shift; error=true;;
1571         -r) shift; reuseval=true;;
1572         -s) shift; silent=true; realsilent=true;;
1573         -E) shift; alldone=exit;;
1574         -K) shift; knowitall=true;;
1575         -O) shift; override=true;;
1576         -S) shift; silent=true; extractsh=true;;
1577         -D)
1578                 shift
1579                 case "$1" in
1580                 *=)
1581                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1582                         echo "$me: ignoring -D $1" >&2
1583                         ;;
1584                 *=*) echo "$1" | \
1585                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1586                 *) echo "$1='define'" >> optdef.sh;;
1587                 esac
1588                 shift
1589                 ;;
1590         -U)
1591                 shift
1592                 case "$1" in
1593                 *=) echo "$1" >> optdef.sh;;
1594                 *=*)
1595                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1596                         echo "$me: ignoring -U $1" >&2
1597                         ;;
1598                 *) echo "$1='undef'" >> optdef.sh;;
1599                 esac
1600                 shift
1601                 ;;
1602         -A)
1603             shift
1604             xxx=''
1605             yyy="$1"
1606             zzz=''
1607             uuu=undef
1608             case "$yyy" in
1609             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1610                  case "$zzz" in
1611                  *:*) zzz='' ;;
1612                  *)   xxx=append
1613                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1614                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1615                  esac
1616                  ;;
1617             esac
1618             case "$xxx" in
1619             '')  case "$yyy" in
1620                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1621                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1622                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1623                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1624                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1625                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1626                  esac
1627                  ;;       
1628             esac
1629             case "$xxx" in
1630             append)
1631                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1632             clear)
1633                 echo "$yyy=''"                  >> posthint.sh ;;
1634             define)
1635                 case "$zzz" in
1636                 '') zzz=define ;;
1637                 esac
1638                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1639             eval)
1640                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1641             prepend)
1642                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1643             undef)
1644                 case "$zzz" in
1645                 '') zzz="$uuu" ;;
1646                 esac
1647                 echo "$yyy=$zzz"                >> posthint.sh ;;
1648             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1649             esac
1650             shift
1651             ;;
1652         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1653             exit 0;;
1654         --) break;;
1655         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1656         *) break;;
1657         esac
1658 done
1659
1660 case "$error" in
1661 true)
1662         cat >&2 <<EOM
1663 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1664                  [-U symbol] [-U symbol=] [-A command:symbol...]
1665   -d : use defaults for all answers.
1666   -e : go on without questioning past the production of config.sh.
1667   -f : specify an alternate default configuration file.
1668   -h : print this help message and exit (with an error status).
1669   -r : reuse C symbols value if possible (skips costly nm extraction).
1670   -s : silent mode, only echoes questions and essential information.
1671   -D : define symbol to have some value:
1672          -D symbol         symbol gets the value 'define'
1673          -D symbol=value   symbol gets the value 'value'
1674        common used examples (see INSTALL for more info):
1675          -Duse64bitint            use 64bit integers
1676          -Duse64bitall            use 64bit integers and pointers
1677          -Dusethreads             use thread support
1678          -Dinc_version_list=none  do not include older perl trees in @INC
1679          -DEBUGGING=none          DEBUGGING options
1680          -Dcc=gcc                 choose your compiler
1681          -Dprefix=/opt/perl5      choose your destination
1682   -E : stop at the end of questions, after having produced config.sh.
1683   -K : do not use unless you know what you are doing.
1684   -O : let -D and -U override definitions from loaded configuration file.
1685   -S : perform variable substitutions on all .SH files (can mix with -f)
1686   -U : undefine symbol:
1687          -U symbol    symbol gets the value 'undef'
1688          -U symbol=   symbol gets completely empty
1689        e.g.:  -Uversiononly
1690   -A : manipulate symbol after the platform specific hints have been applied:
1691          -A append:symbol=value   append value to symbol
1692          -A symbol=value          like append:, but with a separating space
1693          -A define:symbol=value   define symbol to have value
1694          -A clear:symbol          define symbol to be ''
1695          -A define:symbol         define symbol to be 'define'
1696          -A eval:symbol=value     define symbol to be eval of value
1697          -A prepend:symbol=value  prepend value to symbol
1698          -A undef:symbol          define symbol to be 'undef'
1699          -A undef:symbol=         define symbol to be ''
1700        e.g.:  -A prepend:libswanted='cl pthread '
1701               -A ccflags=-DSOME_MACRO
1702   -V : print version number and exit (with a zero status).
1703 EOM
1704         exit 1
1705         ;;
1706 esac
1707
1708 : Sanity checks
1709 case "$fastread$alldone" in
1710 yescont|yesexit) ;;
1711 *)
1712         case "$extractsh" in
1713         true) ;;
1714         *)
1715                 if test ! -t 0; then
1716                         echo "Say 'sh Configure', not 'sh <Configure'"
1717                         exit 1
1718                 fi
1719                 ;;
1720         esac
1721         ;;
1722 esac
1723
1724 exec 4>&1
1725 case "$silent" in
1726 true) exec 1>/dev/null;;
1727 esac
1728
1729 : run the defines and the undefines, if any, but leave the file out there...
1730 touch optdef.sh
1731 . ./optdef.sh
1732 : create the posthint manipulation script and leave the file out there...
1733 touch posthint.sh
1734
1735 : set package name
1736 package=perl5
1737 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1738 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1739 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1740 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1741 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1742 esac
1743
1744 : Some greps do not return status, grrr.
1745 echo "grimblepritz" >grimble
1746 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1747         contains=contains
1748 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1749         contains=grep
1750 else
1751         contains=contains
1752 fi
1753 rm -f grimble
1754 : the following should work in any shell
1755 case "$contains" in
1756 contains*)
1757         echo " "
1758         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1759         cat >contains <<'EOSS'
1760 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1761 EOSS
1762 chmod +x contains
1763 esac
1764
1765 : Find the path to the source tree
1766 case "$src" in
1767 '') case "$0" in
1768     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1769          case "$src" in
1770          /*)    ;;
1771          .)     ;;
1772          *)     src=`cd ../$src && pwd` ;;
1773          esac
1774          ;;
1775     *)   src='.';;
1776     esac;;
1777 esac
1778 case "$src" in
1779 '')     src=/
1780         rsrc=/
1781         ;;
1782 /*) rsrc="$src";;
1783 *) rsrc="../$src";;
1784 esac
1785 if test -f $rsrc/Configure && \
1786         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1787 then
1788    : found it, so we are ok.
1789 else
1790         rsrc=''
1791         for src in . .. ../.. ../../.. ../../../..; do
1792                 if test -f ../$src/Configure && \
1793                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1794                 then
1795                         rsrc=../$src
1796                         break
1797                 fi
1798         done
1799 fi
1800 case "$rsrc" in
1801 '')
1802         cat <<EOM >&4
1803
1804 Sorry, I can't seem to locate the source dir for $package.  Please start
1805 Configure with an explicit path -- i.e. /some/path/Configure.
1806
1807 EOM
1808         exit 1
1809         ;;
1810 ../.)   rsrc='..';;
1811 *)
1812         echo " "
1813         echo "Sources for $package found in \"$src\"." >&4
1814         ;;
1815 esac
1816
1817 : script used to extract .SH files with variable substitutions
1818 cat >extract <<'EOS'
1819 PERL_CONFIG_SH=true
1820 echo "Doing variable substitutions on .SH files..."
1821 if test -f MANIFEST; then
1822         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1823 else
1824         echo "(Looking for .SH files under the source directory.)"
1825         set x `(cd "$src"; find . -name "*.SH" -print)`
1826 fi
1827 shift
1828 case $# in
1829 0) set x `(cd "$src"; echo *.SH)`; shift;;
1830 esac
1831 if test ! -f "$src/$1"; then
1832         shift
1833 fi
1834 mkdir_p='
1835 name=$1;
1836 create="";
1837 while test $name; do
1838         if test ! -d "$name"; then
1839                 create="$name $create";
1840                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1841                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1842         else
1843                 name="";
1844         fi;
1845 done;
1846 for file in $create; do
1847         mkdir $file;
1848 done
1849 '
1850 for file in $*; do
1851         case "$src" in
1852         ".")
1853                 case "$file" in
1854                 */*)
1855                         dir=`expr X$file : 'X\(.*\)/'`
1856                         file=`expr X$file : 'X.*/\(.*\)'`
1857                         (cd "$dir" && . ./$file)
1858                         ;;
1859                 *)
1860                         . ./$file
1861                         ;;
1862                 esac
1863                 ;;
1864         *)
1865                 case "$file" in
1866                 */*)
1867                         dir=`expr X$file : 'X\(.*\)/'`
1868                         file=`expr X$file : 'X.*/\(.*\)'`
1869                         (set x $dir; shift; eval $mkdir_p)
1870                         sh <"$src/$dir/$file"
1871                         ;;
1872                 *)
1873                         sh <"$src/$file"
1874                         ;;
1875                 esac
1876                 ;;
1877         esac
1878 done
1879 if test -f "$src/config_h.SH"; then
1880         if test ! -f config.h; then
1881         : oops, they left it out of MANIFEST, probably, so do it anyway.
1882         . "$src/config_h.SH"
1883         fi
1884 fi
1885 EOS
1886
1887 : extract files and exit if asked to do so
1888 case "$extractsh" in
1889 true)
1890         case "$realsilent" in
1891         true) ;;
1892         *) exec 1>&4;;
1893         esac
1894         case "$config_sh" in
1895         '') config_sh='config.sh';;
1896         esac
1897         echo " "
1898         echo "Fetching answers from $config_sh..."
1899         cd ..
1900         . $config_sh
1901         test "$override" && . ./optdef.sh
1902         echo " "
1903         . UU/extract
1904         rm -rf UU
1905         echo "Extraction done."
1906         exit 0
1907         ;;
1908 esac
1909
1910 : Eunice requires " " instead of "", can you believe it
1911 echo " "
1912 : Here we go...
1913 echo "Beginning of configuration questions for $package."
1914
1915 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1916
1917 : first determine how to suppress newline on echo command
1918 echo " "
1919 echo "Checking echo to see how to suppress newlines..."
1920 (echo "hi there\c" ; echo " ") >.echotmp
1921 if $contains c .echotmp >/dev/null 2>&1 ; then
1922         echo "...using -n."
1923         n='-n'
1924         c=''
1925 else
1926         cat <<'EOM'
1927 ...using \c
1928 EOM
1929         n=''
1930         c='\c'
1931 fi
1932 echo $n "The star should be here-->$c"
1933 echo '*'
1934 rm -f .echotmp
1935
1936 : Now test for existence of everything in MANIFEST
1937 echo " "
1938 if test -f "$rsrc/MANIFEST"; then
1939         echo "First let's make sure your kit is complete.  Checking..." >&4
1940         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1941         rm -f missing
1942         tmppwd=`pwd`
1943         for filelist in x??; do
1944                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1945         done
1946         if test -s missing; then
1947                 cat missing >&4
1948                 cat >&4 <<'EOM'
1949
1950 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1951
1952 You have the option of continuing the configuration process, despite the
1953 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1954 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1955 and contact the author (perlbug@perl.org).
1956
1957 EOM
1958                 echo $n "Continue? [n] $c" >&4
1959                 read ans
1960                 case "$ans" in
1961                 y*)
1962                         echo "Continuing..." >&4
1963                         rm -f missing
1964                         ;;
1965                 *)
1966                         echo "ABORTING..." >&4
1967                         kill $$
1968                         ;;
1969                 esac
1970         else
1971                 echo "Looks good..."
1972         fi
1973 else
1974         echo "There is no MANIFEST file.  I hope your kit is complete !"
1975 fi
1976 rm -f missing x??
1977
1978 echo " "
1979 : Find the appropriate value for a newline for tr
1980 if test -n "$DJGPP"; then
1981        trnl='\012'
1982 fi
1983 if test X"$trnl" = X; then
1984         case "`echo foo|tr '\n' x 2>/dev/null`" in
1985         foox) trnl='\n' ;;
1986         esac
1987 fi
1988 if test X"$trnl" = X; then
1989         case "`echo foo|tr '\012' x 2>/dev/null`" in
1990         foox) trnl='\012' ;;
1991         esac
1992 fi
1993 if test X"$trnl" = X; then
1994        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1995        fooxy) trnl='\n\r' ;;
1996        esac
1997 fi
1998 if test X"$trnl" = X; then
1999         cat <<EOM >&2
2000
2001 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2002
2003 EOM
2004         exit 1
2005 fi
2006
2007 : compute the number of columns on the terminal for proper question formatting
2008 case "$COLUMNS" in
2009 '') COLUMNS='80';;
2010 esac
2011
2012 : set up the echo used in my read
2013 myecho="case \"\$xxxm\" in
2014 '') echo $n \"\$rp $c\" >&4;;
2015 *) case \"\$rp\" in
2016         '') echo $n \"[\$xxxm] $c\";;
2017         *)
2018                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2019                         echo \"\$rp\" >&4
2020                         echo $n \"[\$xxxm] $c\" >&4
2021                 else
2022                         echo $n \"\$rp [\$xxxm] $c\" >&4
2023                 fi
2024                 ;;
2025         esac;;
2026 esac"
2027
2028 : now set up to do reads with possible shell escape and default assignment
2029 cat <<EOSC >myread
2030 $startsh
2031 xxxm=\$dflt
2032 $myecho
2033 ans='!'
2034 case "\$fastread" in
2035 yes) case "\$dflt" in
2036         '') ;;
2037         *) ans='';
2038                 case "\$silent-\$rp" in
2039                 true-) ;;
2040                 *) echo " " >&4;;
2041                 esac;;
2042         esac;;
2043 *) case "\$silent" in
2044         true) case "\$rp" in
2045                 '') ans='';;
2046                 esac;;
2047         esac;;
2048 esac
2049 while expr "X\$ans" : "X!" >/dev/null; do
2050         read answ
2051         set x \$xxxm
2052         shift
2053         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2054         case  "\$answ" in
2055         "!")
2056                 sh 1>&4
2057                 echo " "
2058                 $myecho
2059                 ;;
2060         !*)
2061                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2062                 shift
2063                 sh 1>&4 -c "\$*"
2064                 echo " "
2065                 $myecho
2066                 ;;
2067         "\$ans")
2068                 case "\$ans" in
2069                 \\&*)
2070                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2071                         shift
2072                         case "\$1" in
2073                         -d)
2074                                 fastread=yes
2075                                 echo "(OK, I'll run with -d after this question.)" >&4
2076                                 ;;
2077                         -*)
2078                                 echo "*** Sorry, \$1 not supported yet." >&4
2079                                 ;;
2080                         esac
2081                         $myecho
2082                         ans=!
2083                         ;;
2084                 esac;;
2085         *)
2086                 case "\$aok" in
2087                 y)
2088                         echo "*** Substitution done -- please confirm."
2089                         xxxm="\$ans"
2090                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2091                         xxxm="\$ans"
2092                         ans=!
2093                         ;;
2094                 *)
2095                         echo "*** Error -- try again."
2096                         ans=!
2097                         ;;
2098                 esac
2099                 $myecho
2100                 ;;
2101         esac
2102         case "\$ans\$xxxm\$nostick" in
2103         '')
2104                 ans=!
2105                 $myecho
2106                 ;;
2107         esac
2108 done
2109 case "\$ans" in
2110 '') ans="\$xxxm";;
2111 esac
2112 EOSC
2113
2114 : create .config dir to save info across Configure sessions
2115 test -d ../.config || mkdir ../.config
2116 cat >../.config/README <<EOF
2117 This directory created by Configure to save information that should
2118 persist across sessions for $package.
2119
2120 You may safely delete it if you wish.
2121 EOF
2122
2123 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2124 case "$usedevel" in
2125 $define|true|[yY]*) ;;
2126 *) case "$xversion" in
2127    *[13579])
2128         cat >&4 <<EOH
2129 *** WHOA THERE!!! ***
2130
2131     This is an UNSTABLE DEVELOPMENT release.
2132     The version of this $package distribution is $xversion, that is, odd,
2133     (as opposed to even) and that signifies a development release.
2134     If you want a maintenance release, you want an even-numbered version.
2135
2136     Do ***NOT*** install this into production use.
2137     Data corruption and crashes are possible.
2138
2139     It is most seriously suggested that you do not continue any further
2140     unless you want to help in developing and debugging Perl.
2141
2142     If you *still* want to build perl, you can answer 'y' now,
2143     or pass -Dusedevel to Configure.
2144
2145 EOH
2146         rp='Do you really want to continue?'
2147         dflt='n'
2148         . ./myread
2149         case "$ans" in
2150         [yY]) echo >&4 "Okay, continuing."
2151               usedevel="$define" ;;
2152         *) echo >&4 "Okay, bye."
2153            exit 1
2154            ;;
2155         esac
2156         ;;
2157     esac
2158     ;;
2159 esac
2160 case "$usedevel" in
2161 $define|true|[yY]*)
2162         case "$versiononly" in
2163         '') versiononly="$define" ;;
2164         esac
2165         case "$installusrbinperl" in
2166         '') installusrbinperl="$undef" ;;
2167         esac
2168         ;;
2169 esac
2170
2171 : general instructions
2172 needman=true
2173 firsttime=true
2174 user=`(logname) 2>/dev/null`
2175 case "$user" in
2176 '') user=`whoami 2>&1`;;
2177 esac
2178 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2179         firsttime=false
2180         echo " "
2181         rp='Would you like to see the instructions?'
2182         dflt=n
2183         . ./myread
2184         case "$ans" in
2185         [yY]*) ;;
2186         *) needman=false;;
2187         esac
2188 fi
2189 if $needman; then
2190         cat <<EOH
2191
2192 This installation shell script will examine your system and ask you questions
2193 to determine how the perl5 package should be installed. If you get
2194 stuck on a question, you may use a ! shell escape to start a subshell or
2195 execute a command.  Many of the questions will have default answers in square
2196 brackets; typing carriage return will give you the default.
2197
2198 On some of the questions which ask for file or directory names you are allowed
2199 to use the ~name construct to specify the login directory belonging to "name",
2200 even if you don't have a shell which knows about that.  Questions where this is
2201 allowed will be marked "(~name ok)".
2202
2203 EOH
2204         rp=''
2205         dflt='Type carriage return to continue'
2206         . ./myread
2207         cat <<'EOH'
2208
2209 The prompter used in this script allows you to use shell variables and
2210 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2211 in the default answer, as if the default line was a set of arguments given to a
2212 script shell.  This means you may also use $* to repeat the whole default line,
2213 so you do not have to re-type everything to add something to the default.
2214
2215 Everytime there is a substitution, you will have to confirm.  If there is an
2216 error (e.g. an unmatched backtick), the default answer will remain unchanged
2217 and you will be prompted again.
2218
2219 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2220 the questions and use the computed defaults (or the previous answers if there
2221 was already a config.sh file). Type 'Configure -h' for a list of options.
2222 You may also start interactively and then answer '& -d' at any prompt to turn
2223 on the non-interactive behaviour for the remainder of the execution.
2224
2225 EOH
2226         . ./myread
2227         cat <<EOH
2228
2229 Much effort has been expended to ensure that this shell script will run on any
2230 Unix system.  If despite that it blows up on yours, your best bet is to edit
2231 Configure and run it again.  If you can't run Configure for some reason,
2232 you'll have to generate a config.sh file by hand.  Whatever problems you
2233 have, let me (perlbug@perl.org) know how I blew it.
2234
2235 This installation script affects things in two ways:
2236
2237 1) it may do direct variable substitutions on some of the files included
2238    in this kit.
2239 2) it builds a config.h file for inclusion in C programs.  You may edit
2240    any of these files as the need arises after running this script.
2241
2242 If you make a mistake on a question, there is no easy way to back up to it
2243 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2244 files.  Configure will offer to let you do this before it runs the SH files.
2245
2246 EOH
2247         dflt='Type carriage return to continue'
2248         . ./myread
2249         case "$firsttime" in
2250         true) echo $user >>../.config/instruct;;
2251         esac
2252 fi
2253
2254 : find out where common programs are
2255 echo " "
2256 echo "Locating common programs..." >&4
2257 cat <<EOSC >loc
2258 $startsh
2259 case \$# in
2260 0) exit 1;;
2261 esac
2262 thing=\$1
2263 shift
2264 dflt=\$1
2265 shift
2266 for dir in \$*; do
2267         case "\$thing" in
2268         .)
2269         if test -d \$dir/\$thing; then
2270                 echo \$dir
2271                 exit 0
2272         fi
2273         ;;
2274         *)
2275         for thisthing in \$dir/\$thing; do
2276                 : just loop through to pick last item
2277         done
2278         if test -f \$thisthing; then
2279                 echo \$thisthing
2280                 exit 0
2281         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2282                 echo \$thisthing
2283                 exit 0
2284         elif test -f \$dir/\$thing.exe; then
2285                 if test -n "$DJGPP"; then
2286                         echo \$dir/\$thing.exe
2287                 elif test "$eunicefix" != ":"; then
2288                         : on Eunice apparently
2289                         echo \$dir/\$thing
2290                         exit 0
2291                 fi
2292                 exit 0
2293         fi
2294         ;;
2295         esac
2296 done
2297 echo \$dflt
2298 exit 1
2299 EOSC
2300 chmod +x loc
2301 $eunicefix loc
2302 loclist="
2303 awk
2304 cat
2305 chmod
2306 comm
2307 cp
2308 echo
2309 expr
2310 grep
2311 ls
2312 mkdir
2313 rm
2314 sed
2315 sort
2316 touch
2317 tr
2318 uniq
2319 "
2320 trylist="
2321 Mcc
2322 ar
2323 bison
2324 byacc
2325 cpp
2326 csh
2327 date
2328 egrep
2329 gmake
2330 gzip
2331 less
2332 ln
2333 make
2334 more
2335 nm
2336 nroff
2337 pg
2338 test
2339 uname
2340 zip
2341 "
2342 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2343 pth="$pth /lib /usr/lib"
2344 for file in $loclist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't know where '$file' is, and my life depends on it." >&4
2369                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2370                 exit 1
2371                 ;;
2372         esac
2373 done
2374 echo " "
2375 echo "Don't worry if any of the following aren't found..."
2376 say=offhand
2377 for file in $trylist; do
2378         eval xxx=\$$file
2379         case "$xxx" in
2380         /*|?:[\\/]*)
2381                 if test -f "$xxx"; then
2382                         : ok
2383                 else
2384                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385                         xxx=`./loc $file $file $pth`
2386                 fi
2387                 ;;
2388         '') xxx=`./loc $file $file $pth`;;
2389         *) xxx=`./loc $xxx $xxx $pth`;;
2390         esac
2391         eval $file=$xxx$_exe
2392         eval _$file=$xxx
2393         case "$xxx" in
2394         /*)
2395                 echo $file is in $xxx.
2396                 ;;
2397         ?:[\\/]*)
2398                 echo $file is in $xxx.
2399                 ;;
2400         *)
2401                 echo "I don't see $file out there, $say."
2402                 say=either
2403                 ;;
2404         esac
2405 done
2406 case "$egrep" in
2407 egrep)
2408         echo "Substituting grep for egrep."
2409         egrep=$grep
2410         _egrep=$grep
2411         ;;
2412 esac
2413 case "$ln" in
2414 ln)
2415         echo "Substituting cp for ln."
2416         ln=$cp
2417         _ln=$cp
2418         ;;
2419 esac
2420 case "$make" in
2421 make)   
2422         case "$gmake" in
2423         gmake)
2424         echo "I can't find make or gmake, and my life depends on it." >&4
2425         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426         exit 1
2427         ;;
2428         esac
2429         ;;
2430 esac    
2431 case "$gmake" in
2432 gmake)  ;;
2433 *)      # We can't have osname yet.
2434         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435                 # Assume that gmake, if found, is definitely GNU make
2436                 # and prefer it over the system make.
2437                 echo "Substituting gmake for make."
2438                 make=$gmake
2439                 _make=$gmake
2440         fi
2441         ;;
2442 esac
2443 case "$test" in
2444 test)
2445         echo "Hopefully test is built into your sh."
2446         ;;
2447 *)
2448         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2449                 echo "Using the test built into your sh."
2450                 test=test
2451                 _test=test
2452         fi
2453         ;;
2454 esac
2455 case "$echo" in
2456 echo)
2457         echo "Hopefully echo is built into your sh."
2458         ;;
2459 '') ;;
2460 *)
2461         echo " "
2462 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463         $echo $n "hi there$c" >foo1
2464         echo $n "hi there$c" >foo2
2465         if cmp foo1 foo2 >/dev/null 2>&1; then
2466                 echo "They are compatible.  In fact, they may be identical."
2467         else
2468                 case "$n" in
2469                 '-n') n='' c='\c';;
2470                 *) n='-n' c='';;
2471                 esac
2472                 cat <<FOO
2473 They are not compatible!  You are probably running ksh on a non-USG system.
2474 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475 have echo built in and we may have to run some Bourne shell scripts.  That
2476 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2477
2478 FOO
2479                 $echo $n "The star should be here-->$c"
2480                 $echo "*"
2481         fi
2482         $rm -f foo1 foo2
2483         ;;
2484 esac
2485
2486 # This question was auctioned at YAPC::Europe-2007 in Vienna
2487 # I never promised you could answer it. I only auctioned the question.
2488 cat <<FOO
2489 The following message is sponsored by
2490
2491   Dresden.pm<--The stars should be here.
2492
2493 Dear Perl user, system administrator or package
2494 maintainer, the Perl community sends greetings to
2495 you. Do you (emblematical) greet back [Y/n]? n
2496
2497 FOO
2498
2499 cat <<EOS >trygcc
2500 $startsh
2501 EOS
2502 cat <<'EOSC' >>trygcc
2503 case "$cc" in
2504 '') ;;
2505 *)  $rm -f try try.*
2506     $cat >try.c <<EOM
2507 int main(int argc, char *argv[]) {
2508   return 0;
2509 }
2510 EOM
2511     if $cc -o try $ccflags $ldflags try.c; then
2512        :
2513     else
2514         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2515         despair=yes
2516         trygcc=yes
2517         case "$cc" in
2518         *gcc*) trygcc=no ;;
2519         esac
2520         # Skip this test because it gives a false match on output like:
2521         #    ./trygcc: line 23: cc: command not found
2522         # case "`$cc -v -c try.c 2>&1`" in
2523         # *gcc*) trygcc=no ;;
2524         # esac
2525         if $test X"$trygcc" = Xyes; then
2526             if gcc -o try -c try.c; then
2527                 echo " "
2528                 echo "You seem to have a working gcc, though." >&4
2529                 # Switching compilers may undo the work of hints files.
2530                 # The most common problem is -D_REENTRANT for threads.
2531                 # This heuristic catches that case, but gets false positives
2532                 # if -Dusethreads was not actually specified.  Better to
2533                 # bail out here with a useful message than fail 
2534                 # mysteriously later. Should we perhaps just try to
2535                 # re-invoke Configure -Dcc=gcc config_args ?
2536                 if $test -f usethreads.cbu; then
2537                         $cat >&4 <<EOM 
2538
2539 *** However, any setting of the C compiler flags (e.g. for thread support)
2540 *** will be lost.  It may be necessary for you to restart Configure and
2541 *** add -Dcc=gcc to your Configure command line.
2542
2543 EOM
2544                         rp="Would you like to go ahead and try gcc anyway?"
2545                         dflt=n
2546                 else
2547                         rp="Would you like to use it?"
2548                         dflt=y
2549                 fi
2550                 if $test -f myread; then
2551                     . ./myread
2552                 else
2553                     if $test -f UU/myread; then
2554                         . ./UU/myread
2555                     else
2556                         echo "Cannot find myread, sorry.  Aborting." >&2
2557                         exit 1
2558                     fi
2559                 fi  
2560                 case "$ans" in
2561                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2562                 esac
2563             fi
2564         fi
2565     fi
2566     $rm -f try try.*
2567     ;;
2568 esac
2569 EOSC
2570
2571 cat <<EOS >checkcc
2572 $startsh
2573 EOS
2574 cat <<'EOSC' >>checkcc
2575 case "$cc" in        
2576 '') ;;
2577 *)  $rm -f try try.*              
2578     $cat >try.c <<EOM
2579 int main(int argc, char *argv[]) {
2580   return 0;
2581 }
2582 EOM
2583     if $cc -o try $ccflags $ldflags try.c; then
2584        :
2585     else
2586         if $test X"$despair" = Xyes; then
2587            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2588         fi
2589         $cat >&4 <<EOM         
2590 You need to find a working C compiler.
2591 Either (purchase and) install the C compiler supplied by your OS vendor,
2592 or for a free C compiler try http://gcc.gnu.org/
2593 I cannot continue any further, aborting.
2594 EOM
2595         exit 1
2596     fi
2597     $rm -f try try.*
2598     ;;
2599 esac
2600 EOSC
2601
2602 : determine whether symbolic links are supported
2603 echo " "
2604 $touch blurfl
2605 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2606         echo "Symbolic links are supported." >&4
2607         lns="$ln -s"
2608 else
2609         echo "Symbolic links are NOT supported." >&4
2610         lns="$ln"
2611 fi
2612 $rm -f blurfl sym
2613
2614 : determine whether symbolic links are supported
2615 echo " "
2616 case "$lns" in
2617 *"ln"*" -s")
2618         echo "Checking how to test for symbolic links..." >&4
2619         $lns blurfl sym
2620         if $test "X$issymlink" = X; then
2621                 case "$newsh" in
2622                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2623                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2624                 esac
2625                 if test $? = 0; then
2626                         issymlink="test -h"
2627                 else
2628                         echo "Your builtin 'test -h' may be broken." >&4
2629                         case "$test" in
2630                         /*)     ;;
2631                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2632                                 for p in $pth
2633                                 do
2634                                         if test -f "$p/$test"; then
2635                                                 test="$p/$test"
2636                                                 break
2637                                         fi
2638                                 done
2639                                 ;;
2640                         esac
2641                         case "$test" in
2642                         /*)
2643                                 echo "Trying external '$test -h'." >&4
2644                                 issymlink="$test -h"
2645                                 if $test ! -h sym >/dev/null 2>&1; then
2646                                         echo "External '$test -h' is broken, too." >&4
2647                                         issymlink=''
2648                                 fi
2649                                 ;;
2650                         *)      issymlink='' ;;
2651                         esac
2652                 fi              
2653         fi
2654         if $test "X$issymlink" = X; then
2655                 if $test -L sym 2>/dev/null; then
2656                         issymlink="$test -L"
2657                         echo "The builtin '$test -L' worked." >&4
2658                 fi
2659         fi
2660         if $test "X$issymlink" != X; then
2661                 echo "You can test for symbolic links with '$issymlink'." >&4
2662         else
2663                 echo "I do not know how you can test for symbolic links." >&4
2664         fi
2665         $rm -f blurfl sym
2666         ;;
2667 *)      echo "No symbolic links, so not testing for their testing..." >&4
2668         ;;
2669 esac
2670 echo " "
2671
2672
2673 case "$mksymlinks" in
2674 $define|true|[yY]*)
2675         case "$src" in
2676         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2677                 exit 1
2678                 ;;
2679         *)      case "$lns:$issymlink" in
2680                 *"ln"*" -s:"*"test -"?)
2681                         echo "Creating the symbolic links..." >&4
2682                         echo "(First creating the subdirectories...)" >&4
2683                         cd ..
2684                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2685                                 read directory
2686                                 test -z "$directory" && break
2687                                 mkdir -p $directory
2688                         done
2689                         # Sanity check 1.
2690                         if test ! -d t/base; then
2691                                 echo "Failed to create the subdirectories.  Aborting." >&4
2692                                 exit 1
2693                         fi
2694                         echo "(Then creating the symlinks...)" >&4
2695                         awk '{print $1}' $src/MANIFEST | while true; do
2696                                 read filename
2697                                 test -z "$filename" && break
2698                                 if test -f $filename; then
2699                                         if $issymlink $filename; then
2700                                                 rm -f $filename
2701                                         fi
2702                                 fi
2703                                 if test -f $filename; then
2704                                         echo "$filename already exists, not symlinking."
2705                                 else
2706                                         ln -s $src/$filename $filename
2707                                 fi
2708                         done
2709                         # Sanity check 2.
2710                         if test ! -f t/base/lex.t; then
2711                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2712                                 exit 1
2713                         fi
2714                         cd UU
2715                         ;;
2716                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2717                         ;;
2718                 esac
2719                 ;;
2720         esac
2721         ;;
2722 esac
2723
2724
2725 case "$usecrosscompile" in
2726 $define|true|[yY]*)
2727         $echo "Cross-compiling..."
2728         croak=''
2729         case "$cc" in
2730         *-*-gcc) # A cross-compiling gcc, probably.
2731             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2732             ar=$targetarch-ar
2733             # leave out ld, choosing it is more complex
2734             nm=$targetarch-nm
2735             ranlib=$targetarch-ranlib
2736             $echo 'extern int foo;' > try.c
2737             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2738             shift
2739             if $test $# -gt 0; then
2740                 incpth="$incpth $*"
2741                 incpth="`$echo $incpth|$sed 's/^ //'`"
2742                 echo "Guessing incpth '$incpth'." >&4
2743                 for i in $*; do
2744                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2745                     if $test -d $j; then
2746                         libpth="$libpth $j"
2747                     fi
2748                 done   
2749                 libpth="`$echo $libpth|$sed 's/^ //'`"
2750                 echo "Guessing libpth '$libpth'." >&4
2751             fi
2752             $rm -f try.c
2753             ;;
2754         esac
2755         case "$targetarch" in
2756         '') echo "Targetarch not defined." >&4; croak=y ;;
2757         *)  echo "Using targetarch $targetarch." >&4 ;;
2758         esac
2759         case "$incpth" in
2760         '') echo "Incpth not defined." >&4; croak=y ;;
2761         *)  echo "Using incpth '$incpth'." >&4 ;;
2762         esac
2763         case "$libpth" in
2764         '') echo "Libpth not defined." >&4; croak=y ;;
2765         *)  echo "Using libpth '$libpth'." >&4 ;;
2766         esac
2767         case "$usrinc" in
2768         '') for i in $incpth; do
2769                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2770                     usrinc=$i
2771                     echo "Guessing usrinc $usrinc." >&4
2772                     break
2773                 fi
2774             done
2775             case "$usrinc" in
2776             '') echo "Usrinc not defined." >&4; croak=y ;;
2777             esac
2778             ;;
2779         *)  echo "Using usrinc $usrinc." >&4 ;;
2780         esac
2781         case "$targethost" in
2782         '') echo "Targethost not defined." >&4; croak=y ;;
2783         *)  echo "Using targethost $targethost." >&4
2784         esac
2785         locincpth=' '
2786         loclibpth=' '
2787         case "$croak" in
2788         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2789         esac
2790         case "$src" in
2791         /*) run=$src/Cross/run
2792             targetmkdir=$src/Cross/mkdir
2793             to=$src/Cross/to
2794             from=$src/Cross/from
2795             ;;
2796         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2797             run=$pwd/Cross/run
2798             targetmkdir=$pwd/Cross/mkdir
2799             to=$pwd/Cross/to
2800             from=$pwd/Cross/from
2801             ;;
2802         esac
2803         case "$targetrun" in
2804         '') targetrun=ssh ;;
2805         esac
2806         case "$targetto" in
2807         '') targetto=scp ;;
2808         esac
2809         case "$targetfrom" in
2810         '') targetfrom=scp ;;
2811         esac
2812         run=$run-$targetrun
2813         to=$to-$targetto
2814         from=$from-$targetfrom
2815         case "$targetdir" in
2816         '')  targetdir=/tmp
2817              echo "Guessing targetdir $targetdir." >&4
2818              ;;
2819         esac
2820         case "$targetuser" in
2821         '')  targetuser=root
2822              echo "Guessing targetuser $targetuser." >&4
2823              ;;
2824         esac
2825         case "$targetfrom" in
2826         scp)    q=-q ;;
2827         *)      q='' ;;
2828         esac
2829         case "$targetrun" in
2830         ssh|rsh)
2831             cat >$run <<EOF
2832 #!/bin/sh
2833 case "\$1" in
2834 -cwd)
2835   shift
2836   cwd=\$1
2837   shift
2838   ;;
2839 esac
2840 case "\$cwd" in
2841 '') cwd=$targetdir ;;
2842 esac
2843 exe=\$1
2844 shift
2845 if $test ! -f \$exe.xok; then
2846   $to \$exe
2847   $touch \$exe.xok
2848 fi
2849 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2850 EOF
2851             ;;
2852         *)  echo "Unknown targetrun '$targetrun'" >&4
2853             exit 1
2854             ;;
2855         esac
2856         case "$targetmkdir" in
2857         */Cross/mkdir)
2858             cat >$targetmkdir <<EOF
2859 #!/bin/sh
2860 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2861 EOF
2862             $chmod a+rx $targetmkdir
2863             ;;
2864         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2865             exit 1
2866             ;;
2867         esac
2868         case "$targetto" in
2869         scp|rcp)
2870             cat >$to <<EOF
2871 #!/bin/sh
2872 for f in \$@
2873 do
2874   case "\$f" in
2875   /*)
2876     $targetmkdir \`dirname \$f\`
2877     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2878     ;;
2879   *)
2880     $targetmkdir $targetdir/\`dirname \$f\`
2881     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2882     ;;
2883   esac
2884 done
2885 exit 0
2886 EOF
2887             ;;
2888         cp) cat >$to <<EOF
2889 #!/bin/sh
2890 for f in \$@
2891 do
2892   case "\$f" in
2893   /*)
2894     $mkdir -p $targetdir/\`dirname \$f\`
2895     $cp \$f $targetdir/\$f || exit 1
2896     ;;
2897   *)
2898     $targetmkdir $targetdir/\`dirname \$f\`
2899     $cp \$f $targetdir/\$f || exit 1
2900     ;;
2901   esac
2902 done
2903 exit 0
2904 EOF
2905             ;;
2906         *)  echo "Unknown targetto '$targetto'" >&4
2907             exit 1
2908             ;;
2909         esac
2910         case "$targetfrom" in
2911         scp|rcp)
2912           cat >$from <<EOF
2913 #!/bin/sh
2914 for f in \$@
2915 do
2916   $rm -f \$f
2917   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2918 done
2919 exit 0
2920 EOF
2921             ;;
2922         cp) cat >$from <<EOF
2923 #!/bin/sh
2924 for f in \$@
2925 do
2926   $rm -f \$f
2927   cp $targetdir/\$f . || exit 1
2928 done
2929 exit 0
2930 EOF
2931             ;;
2932         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2933             exit 1
2934             ;;
2935         esac
2936         if $test ! -f $run; then
2937             echo "Target 'run' script '$run' not found." >&4
2938         else
2939             $chmod a+rx $run
2940         fi
2941         if $test ! -f $to; then
2942             echo "Target 'to' script '$to' not found." >&4
2943         else
2944             $chmod a+rx $to
2945         fi
2946         if $test ! -f $from; then
2947             echo "Target 'from' script '$from' not found." >&4
2948         else
2949             $chmod a+rx $from
2950         fi
2951         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2952             exit 1
2953         fi
2954         cat >&4 <<EOF
2955 Using '$run' for remote execution,
2956 and '$from' and '$to'
2957 for remote file transfer.
2958 EOF
2959         ;;
2960 *)      run=''
2961         to=:
2962         from=:
2963         usecrosscompile='undef'
2964         targetarch=''
2965         ;;
2966 esac
2967
2968 : see whether [:lower:] and [:upper:] are supported character classes
2969 echo " "
2970 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2971 ABYZ)
2972         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2973         up='[:upper:]'
2974         low='[:lower:]'
2975         ;;
2976 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2977         # (0xd9 and 0xe2), therefore that is a nice testing point.
2978         if test "X$up" = X -o "X$low" = X; then
2979             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2980             rs) up='[A-Z]'
2981                 low='[a-z]'
2982                 ;;
2983             esac
2984         fi
2985         if test "X$up" = X -o "X$low" = X; then
2986             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2987             rs) up='A-Z'
2988                 low='a-z'
2989                 ;;
2990             esac
2991         fi
2992         if test "X$up" = X -o "X$low" = X; then
2993             case "`echo RS | od -x 2>/dev/null`" in
2994             *D9E2*|*d9e2*)
2995                 echo "Hey, this might be EBCDIC." >&4
2996                 if test "X$up" = X -o "X$low" = X; then
2997                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2998                     rs) up='[A-IJ-RS-Z]'
2999                         low='[a-ij-rs-z]'
3000                         ;;
3001                     esac
3002                 fi
3003                 if test "X$up" = X -o "X$low" = X; then
3004                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3005                     rs) up='A-IJ-RS-Z'
3006                         low='a-ij-rs-z'
3007                         ;;
3008                     esac
3009                 fi
3010                 ;;
3011             esac
3012         fi
3013 esac
3014 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3015 rs)
3016     echo "Using $up and $low to convert case." >&4
3017     ;;
3018 *)
3019     echo "I don't know how to translate letters from upper to lower case." >&4
3020     echo "Your tr is not acting any way I know of." >&4
3021     exit 1
3022     ;;
3023 esac
3024 : set up the translation script tr, must be called with ./tr of course
3025 cat >tr <<EOSC
3026 $startsh
3027 case "\$1\$2" in
3028 '[A-Z][a-z]') exec $tr '$up' '$low';;
3029 '[a-z][A-Z]') exec $tr '$low' '$up';;
3030 esac
3031 exec $tr "\$@"
3032 EOSC
3033 chmod +x tr
3034 $eunicefix tr
3035
3036 : Try to determine whether config.sh was made on this system
3037 case "$config_sh" in
3038 '')
3039 myuname=`$uname -a 2>/dev/null`
3040 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3041 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3042 # because the A-Z/a-z are not consecutive.
3043 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3044         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3045 newmyuname="$myuname"
3046 dflt=n
3047 case "$knowitall" in
3048 '')
3049         if test -f ../config.sh; then
3050                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3051                         eval "`grep myuname= ../config.sh`"
3052                 fi
3053                 if test "X$myuname" = "X$newmyuname"; then
3054                         dflt=y
3055                 fi
3056         fi
3057         ;;
3058 *) dflt=y;;
3059 esac
3060
3061 : Get old answers from old config file if Configure was run on the
3062 : same system, otherwise use the hints.
3063 hint=default
3064 cd ..
3065 if test -f config.sh; then
3066         echo " "
3067         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3068         . UU/myread
3069         case "$ans" in
3070         n*|N*) echo "OK, I'll ignore it."
3071                 mv config.sh config.sh.old
3072                 myuname="$newmyuname"
3073                 ;;
3074         *)  echo "Fetching default answers from your old config.sh file..." >&4
3075                 tmp_n="$n"
3076                 tmp_c="$c"
3077                 tmp_sh="$sh"
3078                 . ./config.sh
3079                 cp config.sh UU
3080                 n="$tmp_n"
3081                 c="$tmp_c"
3082                 : Older versions did not always set $sh.  Catch re-use of such
3083                 : an old config.sh.
3084                 case "$sh" in
3085                 '') sh="$tmp_sh" ;;
3086                 esac
3087                 hint=previous
3088                 ;;
3089         esac
3090 fi
3091 . ./UU/checkcc
3092 if test ! -f config.sh; then
3093         $cat <<EOM
3094
3095 First time through, eh?  I have some defaults handy for some systems
3096 that need some extra help getting the Configure answers right:
3097
3098 EOM
3099         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3100         dflt=''
3101         : Half the following guesses are probably wrong... If you have better
3102         : tests or hints, please send them to perlbug@perl.org
3103         : The metaconfig authors would also appreciate a copy...
3104         $test -f /irix && osname=irix
3105         $test -f /xenix && osname=sco_xenix
3106         $test -f /dynix && osname=dynix
3107         $test -f /dnix && osname=dnix
3108         $test -f /lynx.os && osname=lynxos
3109         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3110         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3111         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3112         $test -f /bin/mips && /bin/mips && osname=mips
3113         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3114                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3115         $test -d /usr/apollo/bin && osname=apollo
3116         $test -f /etc/saf/_sactab && osname=svr4
3117         $test -d /usr/include/minix && osname=minix
3118         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3119         if $test -d /MachTen -o -d /MachTen_Folder; then
3120                 osname=machten
3121                 if $test -x /sbin/version; then
3122                         osvers=`/sbin/version | $awk '{print $2}' |
3123                         $sed -e 's/[A-Za-z]$//'`
3124                 elif $test -x /usr/etc/version; then
3125                         osvers=`/usr/etc/version | $awk '{print $2}' |
3126                         $sed -e 's/[A-Za-z]$//'`
3127                 else
3128                         osvers="$2.$3"
3129                 fi
3130         fi
3131
3132         $test -f /sys/posix.dll &&
3133                 $test -f /usr/bin/what &&
3134                 set X `/usr/bin/what /sys/posix.dll` &&
3135                 $test "$3" = UWIN &&
3136                 osname=uwin &&
3137                 osvers="$5"
3138
3139         if $test -f $uname; then
3140                 set X $myuname
3141                 shift
3142
3143                 case "$5" in
3144                 fps*) osname=fps ;;
3145                 mips*)
3146                         case "$4" in
3147                         umips) osname=umips ;;
3148                         *) osname=mips ;;
3149                         esac;;
3150                 [23]100) osname=mips ;;
3151                 next*) osname=next ;;
3152                 i386*)
3153                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3154                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3155                                 osname='sco'
3156                                 osvers=$tmp
3157                         elif $test -f /etc/kconfig; then
3158                                 osname=isc
3159                                 if test "$lns" = "$ln -s"; then
3160                                         osvers=4
3161                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3162                                         osvers=3
3163                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3164                                         osvers=2
3165                                 fi
3166                         fi
3167                         tmp=''
3168                         ;;
3169                 pc*)
3170                         if test -n "$DJGPP"; then
3171                                 osname=dos
3172                                 osvers=djgpp
3173                         fi
3174                         ;;
3175                 esac
3176
3177                 case "$1" in
3178                 aix) osname=aix
3179                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3180                         case "$tmp" in
3181                         # oslevel can fail with:
3182                         # oslevel: Unable to acquire lock.
3183                         *not\ found) osvers="$4"."$3" ;;
3184                         '<3240'|'<>3240') osvers=3.2.0 ;;
3185                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3186                         '=3250'|'>3250') osvers=3.2.5 ;;
3187                         *) osvers=$tmp;;
3188                         esac
3189                         ;;
3190                 bsd386) osname=bsd386
3191                         osvers=`$uname -r`
3192                         ;;
3193                 cygwin*) osname=cygwin
3194                         osvers="$3"
3195                         ;;
3196                 *dc.osx) osname=dcosx
3197                         osvers="$3"
3198                         ;;
3199                 dnix) osname=dnix
3200                         osvers="$3"
3201                         ;;
3202                 domainos) osname=apollo
3203                         osvers="$3"
3204                         ;;
3205                 dgux)   osname=dgux
3206                         osvers="$3"
3207                         ;;
3208                 dragonfly) osname=dragonfly
3209                         osvers="$3"
3210                         ;;
3211                 dynixptx*) osname=dynixptx
3212                         osvers=`echo "$4"|sed 's/^v//'`
3213                         ;;
3214                 freebsd) osname=freebsd
3215                         osvers="$3" ;;
3216                 genix)  osname=genix ;;
3217                 gnu)    osname=gnu
3218                         osvers="$3" ;;
3219                 hp*)    osname=hpux
3220                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3221                         ;;
3222                 irix*)  osname=irix
3223                         case "$3" in
3224                         4*) osvers=4 ;;
3225                         5*) osvers=5 ;;
3226                         *)      osvers="$3" ;;
3227                         esac
3228                         ;;
3229                 linux)  osname=linux
3230                         case "$3" in
3231                         *)      osvers="$3" ;;
3232                         esac
3233                         ;;
3234                 MiNT)   osname=mint
3235                         ;;
3236                 netbsd*) osname=netbsd
3237                         osvers="$3"
3238                         ;;
3239                 news-os) osvers="$3"
3240                         case "$3" in
3241                         4*) osname=newsos4 ;;
3242                         *) osname=newsos ;;
3243                         esac
3244                         ;;
3245                 next*) osname=next ;;
3246                 nonstop-ux) osname=nonstopux ;;
3247                 openbsd) osname=openbsd
3248                         osvers="$3"
3249                         ;;
3250                 os2)    osname=os2
3251                         osvers="$4"
3252                         ;;
3253                 POSIX-BC | posix-bc ) osname=posix-bc
3254                         osvers="$3"
3255                         ;;
3256                 powerux | power_ux | powermax_os | powermaxos | \
3257                 powerunix | power_unix) osname=powerux
3258                         osvers="$3"
3259                         ;;
3260                 qnx) osname=qnx
3261                         osvers="$4"
3262                         ;;
3263                 solaris) osname=solaris
3264                         case "$3" in
3265                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3266                         *)      osvers="$3" ;;
3267                         esac
3268                         ;;
3269                 sunos) osname=sunos
3270                         case "$3" in
3271                         5*) osname=solaris
3272                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3273                         *)      osvers="$3" ;;
3274                         esac
3275                         ;;
3276                 titanos) osname=titanos
3277                         case "$3" in
3278                         1*) osvers=1 ;;
3279                         2*) osvers=2 ;;
3280                         3*) osvers=3 ;;
3281                         4*) osvers=4 ;;
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 ultrix) osname=ultrix
3286                         osvers="$3"
3287                         ;;
3288                 osf1|mls+)      case "$5" in
3289                                 alpha)
3290                                         osname=dec_osf
3291                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3292                                         case "$osvers" in
3293                                         [1-9].[0-9]*) ;;
3294                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3295                                         esac
3296                                         ;;
3297                         hp*)    osname=hp_osf1  ;;
3298                         mips)   osname=mips_osf1 ;;
3299                         esac
3300                         ;;
3301                 # UnixWare 7.1.2 is known as Open UNIX 8
3302                 openunix|unixware) osname=svr5
3303                         osvers="$4"
3304                         ;;
3305                 uts)    osname=uts
3306                         osvers="$3"
3307                         ;;
3308                 vos) osvers="$3"
3309                         ;;
3310                 $2) case "$osname" in
3311                         *isc*) ;;
3312                         *freebsd*) ;;
3313                         svr*)
3314                                 : svr4.x or possibly later
3315                                 case "svr$3" in
3316                                 ${osname}*)
3317                                         osname=svr$3
3318                                         osvers=$4
3319                                         ;;
3320                                 esac
3321                                 case "$osname" in
3322                                 svr4.0)
3323                                         : Check for ESIX
3324                                         if test -f /stand/boot ; then
3325                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3326                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3327                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3328                                                         if test -n "$isesix"; then
3329                                                                 osname=esix4
3330                                                         fi
3331                                                 fi
3332                                         fi
3333                                         ;;
3334                                 esac
3335                                 ;;
3336                         *)      if test -f /etc/systemid; then
3337                                         osname=sco
3338                                         set `echo $3 | $sed 's/\./ /g'` $4
3339                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3340                                                 osvers=$1.$2.$3
3341                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3342                                                 osvers=$1.$2
3343                                         elif $test -f $src/hints/sco_$1.sh; then
3344                                                 osvers=$1
3345                                         fi
3346                                 else
3347                                         case "$osname" in
3348                                         '') : Still unknown.  Probably a generic Sys V.
3349                                                 osname="sysv"
3350                                                 osvers="$3"
3351                                                 ;;
3352                                         esac
3353                                 fi
3354                                 ;;
3355                         esac
3356                         ;;
3357                 *)      case "$osname" in
3358                         '') : Still unknown.  Probably a generic BSD.
3359                                 osname="$1"
3360                                 osvers="$3"
3361                                 ;;
3362                         esac
3363                         ;;
3364                 esac
3365         else
3366                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3367                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3368                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3369                                 osname=news_os
3370                         fi
3371                         $rm -f UU/kernel.what
3372                 elif test -d c:/. -o -n "$is_os2" ; then
3373                         set X $myuname
3374                         osname=os2
3375                         osvers="$5"
3376                 fi
3377         fi
3378
3379         case "$targetarch" in
3380         '') ;;
3381         *)  hostarch=$osname
3382             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3383             osvers=''
3384             ;;
3385         esac
3386
3387         : Now look for a hint file osname_osvers, unless one has been
3388         : specified already.
3389         case "$hintfile" in
3390         ''|' ')
3391                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3392                 : Also try without trailing minor version numbers.
3393                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3394                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3395                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3396                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3397                 case "$file" in
3398                 '') dflt=none ;;
3399                 *)  case "$osvers" in
3400                         '') dflt=$file
3401                                 ;;
3402                         *)  if $test -f $src/hints/$file.sh ; then
3403                                         dflt=$file
3404                                 elif $test -f $src/hints/$xfile.sh ; then
3405                                         dflt=$xfile
3406                                 elif $test -f $src/hints/$xxfile.sh ; then
3407                                         dflt=$xxfile
3408                                 elif $test -f $src/hints/$xxxfile.sh ; then
3409                                         dflt=$xxxfile
3410                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3411                                         dflt=$xxxxfile
3412                                 elif $test -f "$src/hints/${osname}.sh" ; then
3413                                         dflt="${osname}"
3414                                 else
3415                                         dflt=none
3416                                 fi
3417                                 ;;
3418                         esac
3419                         ;;
3420                 esac
3421                 if $test -f Policy.sh ; then
3422                         case "$dflt" in
3423                         *Policy*) ;;
3424                         none) dflt="Policy" ;;
3425                         *) dflt="Policy $dflt" ;;
3426                         esac
3427                 fi
3428                 ;;
3429         *)
3430                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3431                 ;;
3432         esac
3433
3434         if $test -f Policy.sh ; then
3435                 $cat <<EOM
3436
3437 There's also a Policy hint file available, which should make the
3438 site-specific (policy) questions easier to answer.
3439 EOM
3440
3441         fi
3442
3443         $cat <<EOM
3444
3445 You may give one or more space-separated answers, or "none" if appropriate.
3446 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3447 previous run of Configure, you may specify it as well as or instead of
3448 OS-specific hints.  If hints are provided for your OS, you should use them:
3449 although Perl can probably be built without hints on many platforms, using
3450 hints often improve performance and may enable features that Configure can't
3451 set up on its own. If there are no hints that match your OS, specify "none";
3452 DO NOT give a wrong version or a wrong OS.
3453
3454 EOM
3455
3456         rp="Which of these apply, if any?"
3457         . UU/myread
3458         tans=$ans
3459         for file in $tans; do
3460                 if $test X$file = XPolicy -a -f Policy.sh; then
3461                         . Policy.sh
3462                         $cat Policy.sh >> UU/config.sh
3463                 elif $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"$tans" = X -o X"$tans" = Xnone ; then
3467                         : nothing
3468                 else
3469                         : Give one chance to correct a possible typo.
3470                         echo "$file.sh does not exist"
3471                         dflt=$file
3472                         rp="hint to use instead?"
3473                         . UU/myread
3474                         for file in $ans; do
3475                                 if $test -f "$src/hints/$file.sh"; then
3476                                         . $src/hints/$file.sh
3477                                         $cat $src/hints/$file.sh >> UU/config.sh
3478                                 elif $test X$ans = X -o X$ans = Xnone ; then
3479                                         : nothing
3480                                 else
3481                                         echo "$file.sh does not exist -- ignored."
3482                                 fi
3483                         done
3484                 fi
3485         done
3486
3487         hint=recommended
3488         : Remember our hint file for later.
3489         if $test -f "$src/hints/$file.sh" ; then
3490                 hintfile="$file"
3491         else
3492                 hintfile=''
3493         fi
3494 fi
3495 cd UU
3496 ;;
3497 *)
3498         echo " "
3499         echo "Fetching default answers from $config_sh..." >&4
3500         tmp_n="$n"
3501         tmp_c="$c"
3502         cd ..
3503         cp $config_sh config.sh 2>/dev/null
3504         chmod +w config.sh
3505         . ./config.sh
3506         cd UU
3507         cp ../config.sh .
3508         n="$tmp_n"
3509         c="$tmp_c"
3510         hint=previous
3511         ;;
3512 esac
3513 test "$override" && . ./optdef.sh
3514
3515 : Restore computed paths
3516 for file in $loclist $trylist; do
3517         eval $file="\$_$file"
3518 done
3519
3520 cat << EOM
3521
3522 Configure uses the operating system name and version to set some defaults.
3523 The default value is probably right if the name rings a bell. Otherwise,
3524 since spelling matters for me, either accept the default or answer "none"
3525 to leave it blank.
3526
3527 EOM
3528 case "$osname" in
3529         ''|' ')
3530                 case "$hintfile" in
3531                 ''|' '|none) dflt=none ;;
3532                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3533                 esac
3534                 ;;
3535         *) dflt="$osname" ;;
3536 esac
3537 rp="Operating system name?"
3538 . ./myread
3539 case "$ans" in
3540 none)  osname='' ;;
3541 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3542 esac
3543 echo " "
3544 case "$osvers" in
3545         ''|' ')
3546                 case "$hintfile" in
3547                 ''|' '|none) dflt=none ;;
3548                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3549                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3550                         case "$dflt" in
3551                         ''|' ') dflt=none ;;
3552                         esac
3553                         ;;
3554                 esac
3555                 ;;
3556         *) dflt="$osvers" ;;
3557 esac
3558 rp="Operating system version?"
3559 . ./myread
3560 case "$ans" in
3561 none)  osvers='' ;;
3562 *) osvers="$ans" ;;
3563 esac
3564
3565
3566 . ./posthint.sh
3567
3568 : who configured the system
3569 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3570 case "$cf_by" in
3571 "")
3572         cf_by=`(logname) 2>/dev/null`
3573         case "$cf_by" in
3574         "")
3575                 cf_by=`(whoami) 2>/dev/null`
3576                 case "$cf_by" in
3577                 "") cf_by=unknown ;;
3578                 esac ;;
3579         esac ;;
3580 esac
3581
3582 : decide how portable to be.  Allow command line overrides.
3583 case "$d_portable" in
3584 "$undef") ;;
3585 *)      d_portable="$define" ;;
3586 esac
3587
3588 : set up shell script to do ~ expansion
3589 cat >filexp <<EOSS
3590 $startsh
3591 : expand filename
3592 case "\$1" in
3593  ~/*|~)
3594         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3595         ;;
3596  ~*)
3597         if $test -f /bin/csh; then
3598                 /bin/csh -f -c "glob \$1"
3599                 failed=\$?
3600                 echo ""
3601                 exit \$failed
3602         else
3603                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3604                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3605                 if $test ! -d "\$dir"; then
3606                         me=\`basename \$0\`
3607                         echo "\$me: can't locate home directory for: \$name" >&2
3608                         exit 1
3609                 fi
3610                 case "\$1" in
3611                 */*)
3612                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3613                         ;;
3614                 *)
3615                         echo \$dir
3616                         ;;
3617                 esac
3618         fi
3619         ;;
3620 *)
3621         echo \$1
3622         ;;
3623 esac
3624 EOSS
3625 chmod +x filexp
3626 $eunicefix filexp
3627
3628 : now set up to get a file name
3629 cat <<EOS >getfile
3630 $startsh
3631 EOS
3632 cat <<'EOSC' >>getfile
3633 tilde=''
3634 fullpath=''
3635 already=''
3636 skip=''
3637 none_ok=''
3638 exp_file=''
3639 nopath_ok=''
3640 orig_rp="$rp"
3641 orig_dflt="$dflt"
3642 case "$gfpth" in
3643 '') gfpth='.' ;;
3644 esac
3645
3646 case "$fn" in
3647 *\(*)
3648         : getfile will accept an answer from the comma-separated list
3649         : enclosed in parentheses even if it does not meet other criteria.
3650         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3651         fn=`echo $fn | sed 's/(.*)//'`
3652         ;;
3653 esac
3654
3655 case "$fn" in
3656 *:*)
3657         loc_file=`expr $fn : '.*:\(.*\)'`
3658         fn=`expr $fn : '\(.*\):.*'`
3659         ;;
3660 esac
3661
3662 case "$fn" in
3663 *~*) tilde=true;;
3664 esac
3665 case "$fn" in
3666 */*) fullpath=true;;
3667 esac
3668 case "$fn" in
3669 *+*) skip=true;;
3670 esac
3671 case "$fn" in
3672 *n*) none_ok=true;;
3673 esac
3674 case "$fn" in
3675 *e*) exp_file=true;;
3676 esac
3677 case "$fn" in
3678 *p*) nopath_ok=true;;
3679 esac
3680
3681 case "$fn" in
3682 *f*) type='File';;
3683 *d*) type='Directory';;
3684 *l*) type='Locate';;
3685 esac
3686
3687 what="$type"
3688 case "$what" in
3689 Locate) what='File';;
3690 esac
3691
3692 case "$exp_file" in
3693 '')
3694         case "$d_portable" in
3695         "$define") ;;
3696         *) exp_file=true;;
3697         esac
3698         ;;
3699 esac
3700
3701 cd ..
3702 while test "$type"; do
3703         redo=''
3704         rp="$orig_rp"
3705         dflt="$orig_dflt"
3706         case "$tilde" in
3707         true) rp="$rp (~name ok)";;
3708         esac
3709         . UU/myread
3710         if test -f UU/getfile.ok && \
3711                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3712         then
3713                 value="$ans"
3714                 ansexp="$ans"
3715                 break
3716         fi
3717         case "$ans" in
3718         none)
3719                 value=''
3720                 ansexp=''
3721                 case "$none_ok" in
3722                 true) type='';;
3723                 esac
3724                 ;;
3725         *)
3726                 case "$tilde" in
3727                 '') value="$ans"
3728                         ansexp="$ans";;
3729                 *)
3730                         value=`UU/filexp $ans`
3731                         case $? in
3732                         0)
3733                                 if test "$ans" != "$value"; then
3734                                         echo "(That expands to $value on this system.)"
3735                                 fi
3736                                 ;;
3737                         *) value="$ans";;
3738                         esac
3739                         ansexp="$value"
3740                         case "$exp_file" in
3741                         '') value="$ans";;
3742                         esac
3743                         ;;
3744                 esac
3745                 case "$fullpath" in
3746                 true)
3747                         case "$ansexp" in
3748                         /*) value="$ansexp" ;;
3749                         [a-zA-Z]:/*) value="$ansexp" ;;
3750                         *)
3751                                 redo=true
3752                                 case "$already" in
3753                                 true)
3754                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3755                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3756                                         ;;
3757                                 *)
3758                                 echo "Please give a full path name, starting with slash." >&4
3759                                         case "$tilde" in
3760                                         true)
3761                                 echo "Note that using ~name is ok provided it expands well." >&4
3762                                                 already=true
3763                                                 ;;
3764                                         esac
3765                                 esac
3766                                 ;;
3767                         esac
3768                         ;;
3769                 esac
3770                 case "$redo" in
3771                 '')
3772                         case "$type" in
3773                         File)
3774                                 for fp in $gfpth; do
3775                                         if test "X$fp" = X.; then
3776                                             pf="$ansexp"
3777                                         else    
3778                                             pf="$fp/$ansexp"
3779                                         fi
3780                                         if test -f "$pf"; then
3781                                                 type=''
3782                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3783                                         then
3784                                                 echo "($value is not a plain file, but that's ok.)"
3785                                                 type=''
3786                                         fi
3787                                         if test X"$type" = X; then
3788                                             value="$pf"
3789                                             break
3790                                         fi
3791                                 done
3792                                 ;;
3793                         Directory)
3794                                 for fp in $gfpth; do
3795                                         if test "X$fp" = X.; then
3796                                             dir="$ans"
3797                                             direxp="$ansexp"
3798                                         else    
3799                                             dir="$fp/$ansexp"
3800                                             direxp="$fp/$ansexp"
3801                                         fi
3802                                         if test -d "$direxp"; then
3803                                                 type=''
3804                                                 value="$dir"
3805                                                 break
3806                                         fi
3807                                 done
3808                                 ;;
3809                         Locate)
3810                                 if test -d "$ansexp"; then
3811                                         echo "(Looking for $loc_file in directory $value.)"
3812                                         value="$value/$loc_file"
3813                                         ansexp="$ansexp/$loc_file"
3814                                 fi
3815                                 if test -f "$ansexp"; then
3816                                         type=''
3817                                 fi
3818                                 case "$nopath_ok" in
3819                                 true)   case "$value" in
3820                                         */*) ;;
3821                                         *)      echo "Assuming $value will be in people's path."
3822                                                 type=''
3823                                                 ;;
3824                                         esac
3825                                         ;;
3826                                 esac
3827                                 ;;
3828                         esac
3829
3830                         case "$skip" in
3831                         true) type='';
3832                         esac
3833
3834                         case "$type" in
3835                         '') ;;
3836                         *)
3837                                 if test "$fastread" = yes; then
3838                                         dflt=y
3839                                 else
3840                                         dflt=n
3841                                 fi
3842                                 rp="$what $value doesn't exist.  Use that name anyway?"
3843                                 . UU/myread
3844                                 dflt=''
3845                                 case "$ans" in
3846                                 y*) type='';;
3847                                 *) echo " ";;
3848                                 esac
3849                                 ;;
3850                         esac
3851                         ;;
3852                 esac
3853                 ;;
3854         esac
3855 done
3856 cd UU
3857 ans="$value"
3858 rp="$orig_rp"
3859 dflt="$orig_dflt"
3860 rm -f getfile.ok
3861 test "X$gfpthkeep" != Xy && gfpth=""
3862 EOSC
3863
3864 : determine root of directory hierarchy where package will be installed.
3865 case "$prefix" in
3866 '')
3867         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3868         ;;
3869 *?/)
3870         dflt=`echo "$prefix" | sed 's/.$//'`
3871         ;;
3872 *)
3873         dflt="$prefix"
3874         ;;
3875 esac
3876 $cat <<EOM
3877
3878 By default, $package will be installed in $dflt/bin, manual pages
3879 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3880 installation directories. Typically this is something like /usr/local.
3881 If you wish to have binaries under /usr/bin but other parts of the
3882 installation under /usr/local, that's ok: you will be prompted
3883 separately for each of the installation directories, the prefix being
3884 only used to set the defaults.
3885
3886 EOM
3887 fn=d~
3888 rp='Installation prefix to use?'
3889 . ./getfile
3890 oldprefix=''
3891 case "$prefix" in
3892 '') ;;
3893 *)
3894         case "$ans" in
3895         "$prefix") ;;
3896         *) oldprefix="$prefix";;
3897         esac
3898         ;;
3899 esac
3900 prefix="$ans"
3901 prefixexp="$ansexp"
3902
3903 case "$afsroot" in
3904 '')     afsroot=/afs ;;
3905 *)      afsroot=$afsroot ;;
3906 esac
3907
3908 : is AFS running?
3909 echo " "
3910 case "$afs" in
3911 $define|true)   afs=true ;;
3912 $undef|false)   afs=false ;;
3913 *)      if test -d $afsroot; then
3914                 afs=true
3915         else
3916                 afs=false
3917         fi
3918         ;;
3919 esac
3920 if $afs; then
3921         echo "AFS may be running... I'll be extra cautious then..." >&4
3922 else
3923         echo "AFS does not seem to be running..." >&4
3924 fi
3925
3926 : determine installation prefix for where package is to be installed.
3927 if $afs; then 
3928 $cat <<EOM
3929
3930 Since you are running AFS, I need to distinguish the directory in which
3931 files will reside from the directory in which they are installed (and from
3932 which they are presumably copied to the former directory by occult means).
3933
3934 EOM
3935         case "$installprefix" in
3936         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3937         *) dflt="$installprefix";;
3938         esac
3939 else
3940 $cat <<EOM
3941
3942 In some special cases, particularly when building $package for distribution,
3943 it is convenient to distinguish the directory in which files should be
3944 installed from the directory ($prefix) in which they will
3945 eventually reside.  For most users, these two directories are the same.
3946
3947 EOM
3948         case "$installprefix" in
3949         '') dflt=$prefix ;;
3950         *) dflt=$installprefix;;
3951         esac
3952 fi
3953 fn=d~
3954 rp='What installation prefix should I use for installing files?'
3955 . ./getfile
3956 installprefix="$ans"
3957 installprefixexp="$ansexp"
3958
3959 : Perform the prefixexp/installprefixexp correction if necessary
3960 cat <<EOS >installprefix
3961 $startsh
3962 EOS
3963 cat <<'EOSC' >>installprefix
3964 : Change installation prefix, if necessary.
3965 if $test X"$prefix" != X"$installprefix"; then
3966     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3967 else
3968     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3969 fi
3970 EOSC
3971 chmod +x installprefix
3972 $eunicefix installprefix
3973
3974 : Set variables such as privlib and privlibexp from the output of ./getfile
3975 : performing the prefixexp/installprefixexp correction if necessary.
3976 cat <<EOS >setprefixvar
3977 $startsh
3978 EOS
3979 cat <<'EOSC' >>setprefixvar
3980 eval "${prefixvar}=\"\$ans\""
3981 eval "${prefixvar}exp=\"\$ansexp\""
3982 . ./installprefix
3983 EOSC
3984 chmod +x setprefixvar
3985 $eunicefix setprefixvar
3986
3987 : set up the script used to warn in case of inconsistency
3988 cat <<EOS >whoa
3989 $startsh
3990 EOS
3991 cat <<'EOSC' >>whoa
3992 dflt=y
3993 case "$hint" in
3994     recommended)
3995         case "$hintfile" in
3996         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3997                 ;;
3998         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3999                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4000                 ;;
4001         esac
4002         ;;
4003     *)  echo " "
4004         echo "*** WHOA THERE!!! ***" >&4
4005         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4006         ;;
4007 esac
4008 rp="    Keep the $hint value?"
4009 . ./myread
4010 case "$ans" in
4011 y) td=$was; tu=$was;;
4012 esac
4013 EOSC
4014
4015 : function used to set $1 to $val
4016 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4017 case "$val$was" in
4018 $define$undef) . ./whoa; eval "$var=\$td";;
4019 $undef$define) . ./whoa; eval "$var=\$tu";;
4020 *) eval "$var=$val";;
4021 esac'
4022
4023 case "$usesocks" in
4024 $define|true|[yY]*)     dflt='y';;
4025 *) dflt='n';;
4026 esac
4027 cat <<EOM
4028
4029 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4030 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4031 to use the PerlIO abstraction layer, this will be implicitly selected.
4032
4033 If this doesn't make any sense to you, just accept the default '$dflt'.
4034 EOM
4035 rp='Build Perl for SOCKS?'
4036 . ./myread
4037 case "$ans" in
4038 y|Y)    val="$define" ;;     
4039 *)      val="$undef" ;;
4040 esac
4041 set usesocks
4042 eval $setvar
4043
4044 case "$usesocks" in
4045 $define|true|[yY]*) useperlio="$define";;
4046 esac
4047
4048 case "$useperlio" in
4049 $define|true|[yY]*|'')  dflt='y';;
4050 *) dflt='n';;
4051 esac
4052 cat <<EOM
4053
4054 Previous version of $package used the standard IO mechanisms as
4055 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4056 alternate IO mechanisms via the PerlIO abstraction layer, but the
4057 stdio mechanism is still available if needed.  The abstraction layer
4058 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4059 Using PerlIO with sfio may cause problems with some extension modules.
4060
4061 If this doesn't make any sense to you, just accept the default '$dflt'.
4062 EOM
4063 rp='Use the PerlIO abstraction layer?'
4064 . ./myread
4065 case "$ans" in
4066 y|Y) 
4067         val="$define"
4068         ;;
4069 *)      
4070         echo "Ok, doing things the stdio way."
4071         val="$undef"
4072         ;;
4073 esac
4074 set useperlio
4075 eval $setvar 
4076
4077 case "$usesocks" in
4078 $define|true|[yY]*)
4079         case "$useperlio" in
4080         $define|true|[yY]*) ;;
4081         *)      cat >&4 <<EOM
4082
4083 You are using the SOCKS proxy protocol library which means that you
4084 should also use the PerlIO layer.  You may be headed for trouble.
4085
4086 EOM
4087                 ;;
4088         esac
4089         ;;
4090 esac
4091
4092         
4093 : get the patchlevel
4094 echo " "
4095 echo "Getting the current patchlevel..." >&4
4096 if $test -r $rsrc/patchlevel.h;then
4097         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4098         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4099         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4100         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4101         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4102         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4103         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4104 else
4105         revision=0
4106         patchlevel=0
4107         subversion=0
4108         api_revision=0
4109         api_version=0
4110         api_subversion=0
4111         perl_patchlevel=0
4112         $echo "(You do not have patchlevel.h.  Eek.)"
4113 fi
4114 if $test -r $rsrc/.patch ; then
4115         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4116                 perl_patchlevel=`cat $rsrc/.patch`
4117         fi
4118 fi
4119 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4120 version_patchlevel_string="version $patchlevel subversion $subversion"
4121 case "$perl_patchlevel" in
4122 0|'') ;;
4123 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4124 esac
4125
4126 $echo "(You have $package $version_patchlevel_string.)"
4127
4128 case "$osname" in
4129 dos|vms)
4130         : XXX Should be a Configure test for double-dots in filenames.
4131         version=`echo $revision $patchlevel $subversion | \
4132                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4133         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4134                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4135         ;;
4136 *)
4137         version=`echo $revision $patchlevel $subversion | \
4138                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4139         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4140                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4141         ;;
4142 esac
4143 : Special case the 5.005_xx maintenance series, which used 5.005
4144 : without any subversion label as a subdirectory in $sitelib
4145 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4146         api_versionstring='5.005'
4147 fi
4148
4149 case "$usethreads" in
4150 $define|true|[yY]*)     dflt='y';;
4151 *)     # Catch case where user specified ithreads or 5005threads but
4152        # forgot -Dusethreads (A.D. 4/2002)
4153        case "$useithreads$use5005threads" in
4154        *$define*)      
4155                 case "$useperlio" in
4156                 "$define")      dflt='y' ;;
4157                 *)              dflt='n' ;;
4158                 esac
4159                 ;;
4160        *)       dflt='n';;
4161        esac
4162        ;;
4163 esac
4164 cat <<EOM
4165
4166 Perl can be built to take advantage of threads on some systems.
4167 To do so, Configure can be run with -Dusethreads.
4168
4169 Note that Perl built with threading support runs slightly slower
4170 and uses more memory than plain Perl. The current implementation
4171 is believed to be stable, but it is fairly new, and so should be
4172 treated with caution.
4173
4174 If this doesn't make any sense to you, just accept the default '$dflt'.
4175 EOM
4176 rp='Build a threading Perl?'
4177 . ./myread
4178 case "$ans" in
4179 y|Y)    val="$define" ;;
4180 *)      val="$undef" ;;
4181 esac
4182 set usethreads
4183 eval $setvar
4184
4185 if $test $patchlevel -lt 9; then
4186     case "$usethreads" in
4187     $define)
4188         $cat <<EOM
4189
4190 Since release 5.6, Perl has had two different threading implementations,
4191 the newer interpreter-based version (ithreads) with one interpreter per
4192 thread, and the older 5.005 version (5005threads).
4193 The 5005threads version is effectively unmaintained and will probably be
4194 removed in Perl 5.10, so there should be no need to build a Perl using it
4195 unless needed for backwards compatibility with some existing 5.005threads
4196 code.
4197
4198 EOM
4199         : Default to ithreads unless overridden on command line or with
4200         : old config.sh
4201         dflt='y'
4202         case "$use5005threads" in
4203                 $define|true|[yY]*) dflt='n';;
4204         esac
4205         case "$useithreads" in
4206                 $undef|false|[nN]*) dflt='n';;
4207         esac
4208         rp='Use the newer interpreter-based ithreads?'
4209         . ./myread
4210         case "$ans" in
4211         y|Y)    val="$define" ;;
4212         *)      val="$undef" ;;
4213         esac
4214         set useithreads
4215         eval $setvar
4216         : Now set use5005threads to the opposite value.
4217         case "$useithreads" in
4218         $define) val="$undef" ;;
4219         *) val="$define" ;;
4220         esac
4221         set use5005threads
4222         eval $setvar
4223         ;;
4224     *)
4225         useithreads="$undef"
4226         use5005threads="$undef"
4227         ;;
4228     esac
4229
4230     case "$useithreads$use5005threads" in
4231     "$define$define")
4232         $cat >&4 <<EOM
4233
4234 You cannot have both the ithreads and the 5.005 threads enabled
4235 at the same time.  Disabling the 5.005 threads since they are
4236 much less stable than the ithreads.
4237
4238 EOM
4239         use5005threads="$undef"
4240         ;;
4241     esac
4242
4243 else
4244 : perl-5.9.x and later
4245
4246     if test X"$usethreads" = "X$define"; then
4247         case "$use5005threads" in
4248             $define|true|[yY]*)
4249                 $cat >&4 <<EOM
4250
4251 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4252
4253 EOM
4254             ;;
4255         esac
4256     fi
4257
4258     use5005threads="$undef"
4259     useithreads="$usethreads"
4260 fi
4261
4262 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4263         cat >&4 <<EOF
4264 ***
4265 *** To build with ithreads you must also use the PerlIO layer.
4266 *** Cannot continue, aborting.
4267 ***
4268 EOF
4269         exit 1
4270 fi
4271
4272 case "$d_oldpthreads" in
4273 '')     : Configure tests would be welcome here.  For now, assume undef.
4274         val="$undef" ;;
4275 *)      val="$d_oldpthreads" ;;
4276 esac
4277 set d_oldpthreads
4278 eval $setvar
4279
4280
4281 : Look for a hint-file generated 'call-back-unit'.  If the
4282 : user has specified that a threading perl is to be built,
4283 : we may need to set or change some other defaults.
4284 if $test -f usethreads.cbu; then
4285     echo "Your platform has some specific hints regarding threaded builds, using them..."
4286     . ./usethreads.cbu
4287 else
4288     case "$usethreads" in
4289         "$define"|true|[yY]*)
4290                 $cat <<EOM
4291 (Your platform does not have any specific hints for threaded builds.
4292  Assuming POSIX threads, then.)
4293 EOM
4294         ;;
4295     esac
4296 fi
4297
4298 cat <<EOM
4299
4300 Perl can be built so that multiple Perl interpreters can coexist
4301 within the same Perl executable.
4302 EOM
4303
4304 case "$useithreads" in
4305 $define)
4306         cat <<EOM
4307 This multiple interpreter support is required for interpreter-based threads.
4308 EOM
4309         val="$define"
4310         ;;
4311 *)      case "$usemultiplicity" in
4312         $define|true|[yY]*)     dflt='y';;
4313         *) dflt='n';;
4314         esac
4315         echo " "
4316         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4317         rp='Build Perl for multiplicity?'
4318         . ./myread
4319         case "$ans" in
4320         y|Y)    val="$define" ;;
4321         *)      val="$undef" ;;
4322         esac
4323         ;;
4324 esac
4325 set usemultiplicity
4326 eval $setvar
4327
4328
4329 case "$usemorebits" in
4330 "$define"|true|[yY]*)
4331         use64bitint="$define"
4332         uselongdouble="$define"
4333         usemorebits="$define"
4334         ;;
4335 *)      usemorebits="$undef"
4336         ;;
4337 esac
4338
4339 : make some quick guesses about what we are up against
4340 echo " "
4341 $echo $n "Hmm...  $c"
4342 echo exit 1 >bsd
4343 echo exit 1 >usg
4344 echo exit 1 >v7
4345 echo exit 1 >osf1
4346 echo exit 1 >eunice
4347 echo exit 1 >xenix
4348 echo exit 1 >venix
4349 echo exit 1 >os2
4350 d_bsd="$undef"
4351 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4352 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4353 then
4354         echo "Looks kind of like an OSF/1 system, but we'll see..."
4355         echo exit 0 >osf1
4356 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4357         xxx=`./loc addbib blurfl $pth`
4358         if $test -f $xxx; then
4359         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4360                 echo exit 0 >bsd
4361                 echo exit 0 >usg
4362         else
4363                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364                         echo "Looks kind of like an extended USG system, but we'll see..."
4365                 else
4366                         echo "Looks kind of like a USG system, but we'll see..."
4367                 fi
4368                 echo exit 0 >usg
4369         fi
4370 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4371         echo "Looks kind of like a BSD system, but we'll see..."
4372         d_bsd="$define"
4373         echo exit 0 >bsd
4374 else
4375         echo "Looks kind of like a Version 7 system, but we'll see..."
4376         echo exit 0 >v7
4377 fi
4378 case "$eunicefix" in
4379 *unixtovms*)
4380         $cat <<'EOI'
4381 There is, however, a strange, musty smell in the air that reminds me of
4382 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4383 EOI
4384         echo exit 0 >eunice
4385         d_eunice="$define"
4386 : it so happens the Eunice I know will not run shell scripts in Unix format
4387         ;;
4388 *)
4389         echo " "
4390         echo "Congratulations.  You aren't running Eunice."
4391         d_eunice="$undef"
4392         ;;
4393 esac
4394 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4395 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4396 : semicolon as a patch separator
4397 case "$p_" in
4398 :) ;;
4399 *)
4400         $cat <<'EOI'
4401 I have the feeling something is not exactly right, however...don't tell me...
4402 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4403 (Or you may be running DOS with DJGPP.)
4404 EOI
4405         echo exit 0 >os2
4406         ;;
4407 esac
4408 if test -f /xenix; then
4409         echo "Actually, this looks more like a XENIX system..."
4410         echo exit 0 >xenix
4411         d_xenix="$define"
4412 else
4413         echo " "
4414         echo "It's not Xenix..."
4415         d_xenix="$undef"
4416 fi
4417 chmod +x xenix
4418 $eunicefix xenix
4419 if test -f /venix; then
4420         echo "Actually, this looks more like a VENIX system..."
4421         echo exit 0 >venix
4422 else
4423         echo " "
4424         if ./xenix; then
4425                 : null
4426         else
4427                 echo "Nor is it Venix..."
4428         fi
4429 fi
4430 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4431 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4432 $rm -f foo
4433
4434 case "$cc" in
4435 '') dflt=cc;;
4436 *) dflt="$cc";;
4437 esac
4438 rp="Use which C compiler?"
4439 . ./myread
4440 cc="$ans"
4441
4442 : See if they have not cc but they do have gcc
4443 . ./trygcc
4444 : Look for a hint-file generated 'call-back-unit'.  Now that the
4445 : user has specified the compiler, we may need to set or change some
4446 : other defaults.
4447 if $test -f cc.cbu; then
4448     . ./cc.cbu
4449 fi
4450 . ./checkcc
4451
4452 echo " "
4453 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4454 $cat >try.c <<EOM
4455 #include <stdio.h>
4456 int main() {
4457 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4458 #ifdef __VERSION__
4459         printf("%s\n", __VERSION__);
4460 #else
4461         printf("%s\n", "1");
4462 #endif
4463 #endif
4464         return(0);
4465 }
4466 EOM
4467 if $cc -o try $ccflags $ldflags try.c; then
4468         gccversion=`$run ./try`
4469         case "$gccversion" in
4470         '') echo "You are not using GNU cc." ;;
4471         *)  echo "You are using GNU cc $gccversion."
4472             ccname=gcc
4473             ;;
4474         esac
4475 else
4476         echo " "
4477         echo "*** WHOA THERE!!! ***" >&4
4478         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4479         case "$knowitall" in
4480         '')
4481         echo "    You'd better start hunting for one and let me know about it." >&4
4482                 exit 1
4483                 ;;
4484         esac
4485 fi
4486 $rm -f try try.*
4487 case "$gccversion" in
4488 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4489 esac
4490 case "$gccversion" in
4491 '') gccosandvers='' ;;
4492 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4493    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4494    gccshortvers=''
4495    case "$gccosandvers" in
4496    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4497    $osname$osvers) ;; # looking good
4498    $osname*) cat <<EOM >&4
4499
4500 *** WHOA THERE!!! ***
4501
4502     Your gcc has not been compiled for the exact release of
4503     your operating system ($gccosandvers versus $osname$osvers).
4504
4505     In general it is a good idea to keep gcc synchronized with
4506     the operating system because otherwise serious problems
4507     may ensue when trying to compile software, like Perl.
4508
4509     I'm trying to be optimistic here, though, and will continue.
4510     If later during the configuration and build icky compilation
4511     problems appear (headerfile conflicts being the most common
4512     manifestation), I suggest reinstalling the gcc to match
4513     your operating system release.
4514
4515 EOM
4516       ;;
4517    *) gccosandvers='' ;; # failed to parse, better be silent
4518    esac
4519    ;;
4520 esac
4521 case "$ccname" in
4522 '') ccname="$cc" ;;
4523 esac
4524
4525 # gcc 3.* complain about adding -Idirectories that they already know about,
4526 # so we will take those off from locincpth.
4527 case "$gccversion" in
4528 3*)
4529     echo "main(){}">try.c
4530     for incdir in $locincpth; do
4531        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4532              grep '^c[cp]p*[01]: warning: changing search order '`
4533        if test "X$warn" != X; then
4534            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4535        fi
4536     done
4537     $rm -f try try.*
4538 esac
4539
4540 : What should the include directory be ?
4541 echo " "
4542 $echo $n "Hmm...  $c"
4543 dflt='/usr/include'
4544 incpath=''
4545 mips_type=''
4546 if $test -f /bin/mips && /bin/mips; then
4547         echo "Looks like a MIPS system..."
4548         $cat >usr.c <<'EOCP'
4549 #ifdef SYSTYPE_BSD43
4550 /bsd43
4551 #endif
4552 EOCP
4553         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4554                 dflt='/bsd43/usr/include'
4555                 incpath='/bsd43'
4556                 mips_type='BSD 4.3'
4557         else
4558                 mips_type='System V'
4559         fi
4560         $rm -f usr.c usr.out
4561         echo "and you're compiling with the $mips_type compiler and libraries."
4562         xxx_prompt=y
4563         echo "exit 0" >mips
4564 else
4565         echo "Doesn't look like a MIPS system."
4566         xxx_prompt=n
4567         echo "exit 1" >mips
4568 fi
4569 chmod +x mips
4570 $eunicefix mips
4571 case "$usrinc" in
4572 '') ;;
4573 *) dflt="$usrinc";;
4574 esac
4575 case "$xxx_prompt" in
4576 y)      fn=d/
4577         echo " "
4578         rp='Where are the include files you want to use?'
4579         . ./getfile
4580         usrinc="$ans"
4581         ;;
4582 *)      usrinc="$dflt"
4583         ;;
4584 esac
4585
4586 : see how we invoke the C preprocessor
4587 echo " "
4588 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4589 cat <<'EOT' >testcpp.c
4590 #define ABC abc
4591 #define XYZ xyz
4592 ABC.XYZ
4593 EOT
4594 cd ..
4595 if test ! -f cppstdin; then
4596         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4597                 # AIX cc -E doesn't show the absolute headerfile
4598                 # locations but we'll cheat by using the -M flag.
4599                 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
4600         else
4601                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4602         fi
4603 else
4604         echo "Keeping your $hint cppstdin wrapper."
4605 fi
4606 chmod 755 cppstdin
4607 wrapper=`pwd`/cppstdin
4608 ok='false'
4609 cd UU
4610
4611 if $test "X$cppstdin" != "X" && \
4612         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4613         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4614 then
4615         echo "You used to use $cppstdin $cppminus so we'll use that again."
4616         case "$cpprun" in
4617         '') echo "But let's see if we can live without a wrapper..." ;;
4618         *)
4619                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4620                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4621                 then
4622                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4623                         ok='true'
4624                 else
4625                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4626                 fi
4627                 ;;
4628         esac
4629 else
4630         case "$cppstdin" in
4631         '') ;;
4632         *)
4633                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4634                 ;;
4635         esac
4636 fi
4637
4638 if $ok; then
4639         : nothing
4640 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4641         $cc -E <testcpp.c >testcpp.out 2>&1; \
4642         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643         echo "Yup, it does."
4644         x_cpp="$cc -E"
4645         x_minus='';
4646 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4647         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4648         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649         echo "Yup, it does."
4650         x_cpp="$cc -E"
4651         x_minus='-';
4652 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4653         $cc -P <testcpp.c >testcpp.out 2>&1; \
4654         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4655         echo "Yipee, that works!"
4656         x_cpp="$cc -P"
4657         x_minus='';
4658 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4659         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4660         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661         echo "At long last!"
4662         x_cpp="$cc -P"
4663         x_minus='-';
4664 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4665         $cpp <testcpp.c >testcpp.out 2>&1; \
4666         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4667         echo "It works!"
4668         x_cpp="$cpp"
4669         x_minus='';
4670 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4671         $cpp - <testcpp.c >testcpp.out 2>&1; \
4672         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4673         echo "Hooray, it works!  I was beginning to wonder."
4674         x_cpp="$cpp"
4675         x_minus='-';
4676 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4677         $wrapper <testcpp.c >testcpp.out 2>&1; \
4678         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4679         x_cpp="$wrapper"
4680         x_minus=''
4681         echo "Eureka!"
4682 else
4683         dflt=''
4684         rp="No dice.  I can't find a C preprocessor.  Name one:"
4685         . ./myread
4686         x_cpp="$ans"
4687         x_minus=''
4688         $x_cpp <testcpp.c >testcpp.out 2>&1
4689         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4690                 echo "OK, that will do." >&4
4691         else
4692 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4693                 exit 1
4694         fi
4695 fi
4696
4697 case "$ok" in
4698 false)
4699         cppstdin="$x_cpp"
4700         cppminus="$x_minus"
4701         cpprun="$x_cpp"
4702         cpplast="$x_minus"
4703         set X $x_cpp
4704         shift
4705         case "$1" in
4706         "$cpp")
4707                 echo "Perhaps can we force $cc -E using a wrapper..."
4708                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4709                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4710                 then
4711                         echo "Yup, we can."
4712                         cppstdin="$wrapper"
4713                         cppminus='';
4714                 else
4715                         echo "Nope, we'll have to live without it..."
4716                 fi
4717                 ;;
4718         esac
4719         case "$cpprun" in
4720         "$wrapper")
4721                 cpprun=''
4722                 cpplast=''
4723                 ;;
4724         esac
4725         ;;
4726 esac
4727
4728 case "$cppstdin" in
4729 "$wrapper"|'cppstdin') ;;
4730 *) $rm -f $wrapper;;
4731 esac
4732 $rm -f testcpp.c testcpp.out
4733
4734 : Set private lib path
4735 case "$plibpth" in
4736 '') if ./mips; then
4737                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4738         fi;;
4739 esac
4740 case "$libpth" in
4741 ' ') dlist='';;
4742 '') dlist="$loclibpth $plibpth $glibpth";;
4743 *) dlist="$libpth";;
4744 esac
4745
4746 : Now check and see which directories actually exist, avoiding duplicates
4747 libpth=''
4748 for xxx in $dlist
4749 do
4750     if $test -d $xxx; then
4751                 case " $libpth " in
4752                 *" $xxx "*) ;;
4753                 *) libpth="$libpth $xxx";;
4754                 esac
4755     fi
4756 done
4757 $cat <<'EOM'
4758
4759 Some systems have incompatible or broken versions of libraries.  Among
4760 the directories listed in the question below, please remove any you
4761 know not to be holding relevant libraries, and add any that are needed.
4762 Say "none" for none.
4763
4764 EOM
4765 case "$libpth" in
4766 '') dflt='none';;
4767 *)
4768         set X $libpth
4769         shift
4770         dflt=${1+"$@"}
4771         ;;
4772 esac
4773 rp="Directories to use for library searches?"
4774 . ./myread
4775 case "$ans" in
4776 none) libpth=' ';;
4777 *) libpth="$ans";;
4778 esac
4779
4780 : compute shared library extension
4781 case "$so" in
4782 '')
4783         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4784                 dflt='sl'
4785         else
4786                 dflt='so'
4787         fi
4788         ;;
4789 *) dflt="$so";;
4790 esac
4791 $cat <<EOM
4792
4793 On some systems, shared libraries may be available.  Answer 'none' if
4794 you want to suppress searching of shared libraries for the remainder
4795 of this configuration.
4796
4797 EOM
4798 rp='What is the file extension used for shared libraries?'
4799 . ./myread
4800 so="$ans"
4801
4802 : Define several unixisms.
4803 : Hints files or command line option can be used to override them.
4804 : The convoluted testing is in case hints files set either the old
4805 : or the new name.
4806 case "$_exe" in
4807 '')     case "$exe_ext" in
4808         '')     ;;
4809         *)      _exe="$exe_ext" ;;
4810         esac
4811         ;;
4812 esac
4813 case "$_a" in
4814 '')     case "$lib_ext" in
4815     '') _a='.a';;
4816         *)      _a="$lib_ext" ;;
4817         esac
4818         ;;
4819 esac
4820 case "$_o" in
4821 '') case "$obj_ext" in
4822         '')     _o='.o';;
4823         *)      _o="$obj_ext";;
4824         esac
4825         ;;
4826 esac
4827 case "$p_" in
4828 '') case "$path_sep" in
4829         '')     p_=':';;
4830         *)      p_="$path_sep";;
4831         esac
4832         ;;
4833 esac
4834 exe_ext=$_exe
4835 lib_ext=$_a
4836 obj_ext=$_o
4837 path_sep=$p_
4838
4839 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4840
4841 : Which makefile gets called first.  This is used by make depend.
4842 case "$firstmakefile" in
4843 '') firstmakefile='makefile';;
4844 esac
4845
4846 case "$ccflags" in
4847 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4848 esac
4849
4850 case "$uselongdouble" in
4851 $define|true|[yY]*)     dflt='y';;
4852 *) dflt='n';;
4853 esac
4854 cat <<EOM
4855
4856 Perl can be built to take advantage of long doubles which
4857 (if available) may give more accuracy and range for floating point numbers.
4858
4859 If this doesn't make any sense to you, just accept the default '$dflt'.
4860 EOM
4861 rp='Try to use long doubles if available?'
4862 . ./myread
4863 case "$ans" in
4864 y|Y)    val="$define"   ;;
4865 *)      val="$undef"    ;;
4866 esac
4867 set uselongdouble
4868 eval $setvar
4869
4870 case "$uselongdouble" in
4871 true|[yY]*) uselongdouble="$define" ;;
4872 esac
4873
4874 : Look for a hint-file generated 'call-back-unit'.  If the
4875 : user has specified that long doubles should be used,
4876 : we may need to set or change some other defaults.
4877 if $test -f uselongdouble.cbu; then
4878     echo "Your platform has some specific hints regarding long doubles, using them..."
4879     . ./uselongdouble.cbu
4880 else
4881     case "$uselongdouble" in
4882         $define)
4883                 $cat <<EOM
4884 (Your platform does not have any specific hints for long doubles.)
4885 EOM
4886         ;;
4887     esac
4888 fi
4889
4890 : Looking for optional libraries
4891 echo " "
4892 echo "Checking for optional libraries..." >&4
4893 case "$libs" in
4894 ' '|'') dflt='';;
4895 *) dflt="$libs";;
4896 esac
4897 case "$libswanted" in
4898 '') libswanted='c_s';;
4899 esac
4900 case "$usesocks" in
4901 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4902 esac
4903 libsfound=''
4904 libsfiles=''
4905 libsdirs=''
4906 libspath=''
4907 for thisdir in $libpth $xlibpth; do
4908   test -d $thisdir && libspath="$libspath $thisdir"
4909 done
4910 for thislib in $libswanted; do
4911         for thisdir in $libspath; do
4912             xxx=''
4913             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4914                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4915                 $test -f "$xxx" && eval $libscheck
4916                 $test -f "$xxx" && libstyle=shared
4917             fi
4918             if test ! -f "$xxx"; then
4919                 xxx=$thisdir/lib$thislib.$so
4920                 $test -f "$xxx" && eval $libscheck
4921                 $test -f "$xxx" && libstyle=shared
4922             fi  
4923             if test ! -f "$xxx"; then
4924                 xxx=$thisdir/lib$thislib$_a
4925                 $test -f "$xxx" && eval $libscheck
4926                 $test -f "$xxx" && libstyle=static
4927             fi
4928             if test ! -f "$xxx"; then
4929                 xxx=$thisdir/$thislib$_a
4930                 $test -f "$xxx" && eval $libscheck
4931                 $test -f "$xxx" && libstyle=static
4932             fi
4933             if test ! -f "$xxx"; then
4934                 xxx=$thisdir/lib${thislib}_s$_a
4935                 $test -f "$xxx" && eval $libscheck
4936                 $test -f "$xxx" && libstyle=static
4937                 $test -f "$xxx" && thislib=${thislib}_s
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/Slib$thislib$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943             fi
4944             if $test -f "$xxx"; then
4945                 case "$libstyle" in
4946                 shared) echo "Found -l$thislib (shared)." ;;
4947                 static) echo "Found -l$thislib." ;;
4948                 *)      echo "Found -l$thislib ($libstyle)." ;;
4949                 esac
4950                 case " $dflt " in
4951                 *"-l$thislib "*);;
4952                 *) dflt="$dflt -l$thislib"
4953                    libsfound="$libsfound $xxx"
4954                    yyy=`basename $xxx`
4955                    libsfiles="$libsfiles $yyy"
4956                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4957                    case " $libsdirs " in
4958                    *" $yyy "*) ;;
4959                    *) libsdirs="$libsdirs $yyy" ;;
4960                    esac
4961                    ;;
4962                 esac
4963                 break
4964             fi  
4965         done
4966         if $test ! -f "$xxx"; then
4967             echo "No -l$thislib."
4968         fi
4969 done
4970 set X $dflt
4971 shift
4972 dflt="$*"
4973 case "$libs" in
4974 '') dflt="$dflt";;
4975 *) dflt="$libs";;
4976 esac
4977 case "$dflt" in
4978 ' '|'') dflt='none';;
4979 esac
4980
4981 $cat <<EOM
4982
4983 In order to compile $package on your machine, a number of libraries
4984 are usually needed.  Include any other special libraries here as well.
4985 Say "none" for none.  The default list is almost always right.
4986 EOM
4987
4988 echo " "
4989 rp="What libraries to use?"
4990 . ./myread
4991 case "$ans" in
4992 none) libs=' ';;
4993 *) libs="$ans";;
4994 esac
4995
4996 : determine optimization, if desired, or use for debug flag also
4997 case "$optimize" in
4998 ' '|$undef) dflt='none';;
4999 '') dflt='-O';;
5000 *) dflt="$optimize";;
5001 esac
5002 $cat <<EOH
5003
5004 By default, $package compiles with the -O flag to use the optimizer.
5005 Alternately, you might want to use the symbolic debugger, which uses
5006 the -g flag (on traditional Unix systems).  Either flag can be
5007 specified here.  To use neither flag, specify the word "none".
5008
5009 EOH
5010 rp="What optimizer/debugger flag should be used?"
5011 . ./myread
5012 optimize="$ans"
5013 case "$optimize" in
5014 'none') optimize=" ";;
5015 esac
5016
5017 : Check what DEBUGGING is required from the command line
5018 : -DEBUGGING      or -DDEBUGGING or
5019 : -DEBUGGING=both                       = -g + -DDEBUGGING
5020 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5021 : -DEBUGGING=none or -UDEBUGGING        =
5022 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5023 case "$EBUGGING" in
5024 '')     ;;
5025 *)      DEBUGGING=$EBUGGING ;;
5026 esac
5027
5028 case "$DEBUGGING" in
5029 -g|both|$define)
5030     case "$optimize" in
5031         *-g*) ;;
5032         *)    optimize="$optimize -g" ;;
5033     esac ;;
5034 none|$undef)
5035     case "$optimize" in
5036         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5037                 shift
5038                 optimize="$*"
5039                 ;;
5040     esac ;;
5041 esac
5042
5043 dflt=''
5044 case "$DEBUGGING" in
5045 both|$define) dflt='-DDEBUGGING'
5046 esac
5047
5048 : argument order is deliberate, as the flag will start with - which set could
5049 : think is an option
5050 checkccflag='check=$1; flag=$2;
5051 echo " ";
5052 echo "Checking if your compiler accepts $flag" 2>&1;
5053 echo "int main(void) { return 0; }" > gcctest.c;
5054 if $cc -O2 $flag -o gcctest gcctest.c; then
5055     echo "Yes, it does." 2>&1;
5056     case "$ccflags" in
5057     *$check*)
5058         echo "Leaving current flags $ccflags alone." 2>&1
5059         ;;
5060     *) dflt="$dflt $flag" ;;
5061     esac
5062 else
5063     echo "Nope, it does not, but that is ok." 2>&1;
5064 fi
5065 '
5066
5067 : We will not override a previous value, but we might want to
5068 : augment a hint file
5069 case "$hint" in
5070 default|recommended)
5071         case "$gccversion" in
5072         1*) dflt="$dflt -fpcc-struct-return" ;;
5073         esac
5074         case "$optimize:$DEBUGGING" in
5075         *-g*:old) dflt="$dflt -DDEBUGGING";;
5076         esac
5077         case "$gccversion" in
5078         2*) if test -d /etc/conf/kconfig.d &&
5079                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5080                 then
5081                         # Interactive Systems (ISC) POSIX mode.
5082                         dflt="$dflt -posix"
5083                 fi
5084                 ;;
5085         esac
5086         case "$gccversion" in
5087         1*) ;;
5088         2.[0-8]*) ;;
5089         ?*)     set strict-aliasing -fno-strict-aliasing
5090                 eval $checkccflag
5091                 ;;
5092         esac
5093         # For gcc, adding -pipe speeds up compilations for some, but apparently
5094         # some assemblers can't read from stdin.  (It also slows down compilations
5095         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5096         case "$gccversion" in
5097         ?*)     set pipe -pipe
5098                 eval $checkccflag
5099                 ;;
5100         esac
5101         ;;
5102 esac
5103
5104 case "$mips_type" in
5105 *BSD*|'') inclwanted="$locincpth $usrinc";;
5106 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5107 esac
5108 for thisincl in $inclwanted; do
5109         if $test -d $thisincl; then
5110                 if $test x$thisincl != x$usrinc; then
5111                         case "$dflt" in
5112                         *" -I$thisincl "*);;
5113                         *) dflt="$dflt -I$thisincl ";;
5114                         esac
5115                 fi
5116         fi
5117 done
5118
5119 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5120         xxx=true;
5121 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5122         xxx=true;
5123 else
5124         xxx=false;
5125 fi;
5126 if $xxx; then
5127         case "$dflt" in
5128         *$2*);;
5129         *) dflt="$dflt -D$2";;
5130         esac;
5131 fi'
5132
5133 set signal.h LANGUAGE_C; eval $inctest
5134
5135 case "$usesocks" in
5136 $define)
5137         ccflags="$ccflags -DSOCKS"
5138         ;;
5139 esac
5140
5141 case "$hint" in
5142 default|recommended) dflt="$ccflags $dflt" ;;
5143 *) dflt="$ccflags";;
5144 esac
5145
5146 case "$dflt" in
5147 ''|' ') dflt=none;;
5148 esac
5149
5150 $cat <<EOH
5151
5152 Your C compiler may want other flags.  For this question you should include
5153 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5154 but you should NOT include libraries or ld flags like -lwhatever.  If you
5155 want $package to honor its debug switch, you should include -DDEBUGGING here.
5156 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5157
5158 To use no flags, specify the word "none".
5159
5160 EOH
5161 set X $dflt
5162 shift
5163 dflt=${1+"$@"}
5164 rp="Any additional cc flags?"
5165 . ./myread
5166 case "$ans" in
5167 none) ccflags='';;
5168 *) ccflags="$ans";;
5169 esac
5170
5171 : the following weeds options from ccflags that are of no interest to cpp
5172 case "$cppflags" in
5173 '') cppflags="$ccflags" ;;
5174 *)  cppflags="$cppflags $ccflags" ;;
5175 esac
5176 case "$gccversion" in
5177 1*) cppflags="$cppflags -D__GNUC__"
5178 esac
5179 case "$mips_type" in
5180 '');;
5181 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5182 esac
5183 case "$cppflags" in
5184 '');;
5185 *)
5186         echo " "
5187         echo "Let me guess what the preprocessor flags are..." >&4
5188         set X $cppflags
5189         shift
5190         cppflags=''
5191         $cat >cpp.c <<'EOM'
5192 #define BLURFL foo
5193
5194 BLURFL xx LFRULB
5195 EOM
5196         previous=''
5197         for flag in $*
5198         do
5199                 case "$flag" in
5200                 -*) ftry="$flag";;
5201                 *) ftry="$previous $flag";;
5202                 esac
5203                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5204                         >cpp1.out 2>/dev/null && \
5205                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5206                         >cpp2.out 2>/dev/null && \
5207                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5208                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5209                 then
5210                         cppflags="$cppflags $ftry"
5211                         previous=''
5212                 else
5213                         previous="$flag"
5214                 fi
5215         done
5216         set X $cppflags
5217         shift
5218         cppflags=${1+"$@"}
5219         case "$cppflags" in
5220         *-*)  echo "They appear to be: $cppflags";;
5221         esac
5222         $rm -f cpp.c cpp?.out
5223         ;;
5224 esac
5225
5226 : flags used in final linking phase
5227 case "$ldflags" in
5228 '') if ./venix; then
5229                 dflt='-i -z'
5230         else
5231                 dflt=''
5232         fi
5233         case "$ccflags" in
5234         *-posix*) dflt="$dflt -posix" ;;
5235         esac
5236         ;;
5237 *) dflt="$ldflags";;
5238 esac
5239
5240 : Try to guess additional flags to pick up local libraries.
5241 for thislibdir in $libpth; do
5242         case " $loclibpth " in
5243         *" $thislibdir "*)
5244                 case "$dflt " in
5245                 *"-L$thislibdir "*) ;;
5246                 *)  dflt="$dflt -L$thislibdir" ;;
5247                 esac
5248                 ;;
5249         esac
5250 done
5251
5252 case "$dflt" in
5253 '') dflt='none' ;;
5254 esac
5255
5256 $cat <<EOH
5257
5258 Your C linker may need flags.  For this question you should
5259 include -L/whatever and any other flags used by the C linker, but you
5260 should NOT include libraries like -lwhatever.
5261
5262 Make sure you include the appropriate -L/path flags if your C linker
5263 does not normally search all of the directories you specified above,
5264 namely
5265         $libpth
5266 To use no flags, specify the word "none".
5267
5268 EOH
5269
5270 rp="Any additional ld flags (NOT including libraries)?"
5271 . ./myread
5272 case "$ans" in
5273 none) ldflags='';;
5274 *) ldflags="$ans";;
5275 esac
5276 rmlist="$rmlist pdp11"
5277
5278 : coherency check
5279 echo " "
5280 echo "Checking your choice of C compiler and flags for coherency..." >&4
5281 $cat > try.c <<'EOF'
5282 #include <stdio.h>
5283 int main() { printf("Ok\n"); return(0); }
5284 EOF
5285 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5286 shift
5287 $cat >try.msg <<'EOM'
5288 I've tried to compile and run the following simple program:
5289
5290 EOM
5291 $cat try.c >> try.msg
5292
5293 $cat >> try.msg <<EOM
5294
5295 I used the command:
5296
5297         $*
5298         $run ./try
5299
5300 and I got the following output:
5301
5302 EOM
5303 dflt=y
5304 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5305         if $sh -c "$run ./try" >>try.msg 2>&1; then
5306                 xxx=`$run ./try`
5307                 case "$xxx" in
5308                 "Ok") dflt=n ;;
5309                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5310                         case " $libs " in
5311                         *" -lsfio "*)
5312                                 cat >> try.msg <<'EOQS'
5313 If $libs contains -lsfio, and sfio is mis-configured, then it
5314 sometimes (apparently) runs and exits with a 0 status, but with no
5315 output!  It may have to do with sfio's use of _exit vs. exit.
5316
5317 EOQS
5318                                 rp="You have a big problem.  Shall I abort Configure"
5319                                 dflt=y
5320                                 ;;
5321                         esac
5322                         ;;
5323                 esac
5324         else
5325                 echo "The program compiled OK, but exited with status $?." >>try.msg
5326                 rp="You have a problem.  Shall I abort Configure"
5327                 dflt=y
5328         fi
5329 else
5330         echo "I can't compile the test program." >>try.msg
5331         rp="You have a BIG problem.  Shall I abort Configure"
5332         dflt=y
5333 fi
5334 case "$dflt" in
5335 y)
5336         $cat try.msg >&4
5337         case "$knowitall" in
5338         '')
5339                 echo "(The supplied flags or libraries might be incorrect.)"
5340                 ;;
5341         *) dflt=n;;
5342         esac
5343         echo " "
5344         . ./myread
5345         case "$ans" in
5346         n*|N*) ;;
5347         *)      echo "Ok.  Stopping Configure." >&4
5348                 exit 1
5349                 ;;
5350         esac
5351         ;;
5352 n) echo "OK, that should do.";;
5353 esac
5354 $rm_try
5355
5356 : define a shorthand compile call
5357 compile='
5358 mc_file=$1;
5359 shift;
5360 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5361 : define a shorthand compile call for compilations that should be ok.
5362 compile_ok='
5363 mc_file=$1;
5364 shift;
5365 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5366
5367 : determine filename position in cpp output
5368 echo " "
5369 echo "Computing filename position in cpp output for #include directives..." >&4
5370 case "$osname" in
5371 vos) testaccess=-e ;;
5372 *)   testaccess=-r ;;
5373 esac
5374 echo '#include <stdio.h>' > foo.c
5375 $cat >fieldn <<EOF
5376 $startsh
5377 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5378 $grep '^[       ]*#.*stdio\.h' | \
5379 while read cline; do
5380         pos=1
5381         set \$cline
5382         while $test \$# -gt 0; do
5383                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5384                         echo "\$pos"
5385                         exit 0
5386                 fi
5387                 shift
5388                 pos=\`expr \$pos + 1\`
5389         done
5390 done
5391 EOF
5392 chmod +x fieldn
5393 fieldn=`./fieldn`
5394 $rm -f foo.c fieldn
5395 case $fieldn in
5396 '') pos='???';;
5397 1) pos=first;;
5398 2) pos=second;;
5399 3) pos=third;;
5400 *) pos="${fieldn}th";;
5401 esac
5402 echo "Your cpp writes the filename in the $pos field of the line."
5403
5404 case "$osname" in
5405 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5406 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5407 *)   cppfilter='' ;;
5408 esac
5409 : locate header file
5410 $cat >findhdr <<EOF
5411 $startsh
5412 wanted=\$1
5413 name=''
5414 for usrincdir in $usrinc
5415 do
5416         if test -f \$usrincdir/\$wanted; then
5417                 echo "\$usrincdir/\$wanted"
5418                 exit 0
5419         fi
5420 done
5421 awkprg='{ print \$$fieldn }'
5422 echo "#include <\$wanted>" > foo\$\$.c
5423 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5424 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5425 while read cline; do
5426         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5427         case "\$name" in
5428         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5429         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5430         *) exit 2;;
5431         esac;
5432 done;
5433 #
5434 # status = 0: grep returned 0 lines, case statement not executed
5435 # status = 1: headerfile found
5436 # status = 2: while loop executed, no headerfile found
5437 #
5438 status=\$?
5439 $rm -f foo\$\$.c;
5440 if test \$status -eq 1; then
5441         exit 0;
5442 fi
5443 exit 1
5444 EOF
5445 chmod +x findhdr
5446
5447 : define an alternate in-header-list? function
5448 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5449 cont=true; xxf="echo \"<\$1> found.\" >&4";
5450 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5451 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5452 esac;
5453 case $# in 4) instead=instead;; *) instead="at last";; esac;
5454 while $test "$cont"; do
5455         xxx=`./findhdr $1`
5456         var=$2; eval "was=\$$2";
5457         if $test "$xxx" && $test -r "$xxx";
5458         then eval $xxf;
5459         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5460                 cont="";
5461         else eval $xxnf;
5462         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5463         set $yyy; shift; shift; yyy=$@;
5464         case $# in 0) cont="";;
5465         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5466                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5467         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5468                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5469         esac;
5470 done;
5471 while $test "$yyy";
5472 do set $yyy; var=$2; eval "was=\$$2";
5473         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5474         set $yyy; shift; shift; yyy=$@;
5475 done'
5476
5477 : see if stdlib is available
5478 set stdlib.h i_stdlib
5479 eval $inhdr
5480
5481 : check for lengths of integral types
5482 echo " "
5483 case "$intsize" in
5484 '')
5485         echo "Checking to see how big your integers are..." >&4
5486         $cat >try.c <<EOCP
5487 #include <stdio.h>
5488 #$i_stdlib I_STDLIB
5489 #ifdef I_STDLIB
5490 #include <stdlib.h>
5491 #endif
5492 int main()
5493 {
5494         printf("intsize=%d;\n", (int)sizeof(int));
5495         printf("longsize=%d;\n", (int)sizeof(long));
5496         printf("shortsize=%d;\n", (int)sizeof(short));
5497         exit(0);
5498 }
5499 EOCP
5500         set try
5501         if eval $compile_ok && $run ./try > /dev/null; then
5502                 eval `$run ./try`
5503                 echo "Your integers are $intsize bytes long."
5504                 echo "Your long integers are $longsize bytes long."
5505                 echo "Your short integers are $shortsize bytes long."
5506         else
5507                 $cat >&4 <<EOM
5508 !
5509 Help! I can't compile and run the intsize test program: please enlighten me!
5510 (This is probably a misconfiguration in your system or libraries, and
5511 you really ought to fix it.  Still, I'll try anyway.)
5512 !
5513 EOM
5514                 dflt=4
5515                 rp="What is the size of an integer (in bytes)?"
5516                 . ./myread
5517                 intsize="$ans"
5518                 dflt=$intsize
5519                 rp="What is the size of a long integer (in bytes)?"
5520                 . ./myread
5521                 longsize="$ans"
5522                 dflt=2
5523                 rp="What is the size of a short integer (in bytes)?"
5524                 . ./myread
5525                 shortsize="$ans"
5526         fi
5527         ;;
5528 esac
5529 $rm_try
5530
5531 : check for long long
5532 echo " "
5533 echo "Checking to see if you have long long..." >&4
5534 echo 'int main() { long long x = 7; return 0; }' > try.c
5535 set try
5536 if eval $compile; then
5537         val="$define"
5538         echo "You have long long."
5539 else
5540         val="$undef"
5541         echo "You do not have long long."
5542 fi
5543 $rm_try
5544 set d_longlong
5545 eval $setvar
5546
5547 : check for length of long long
5548 case "${d_longlong}${longlongsize}" in
5549 $define)
5550         echo " "
5551         echo "Checking to see how big your long longs are..." >&4
5552         $cat >try.c <<'EOCP'
5553 #include <stdio.h>
5554 int main()
5555 {
5556     printf("%d\n", (int)sizeof(long long));
5557     return(0);
5558 }
5559 EOCP
5560         set try
5561         if eval $compile_ok; then
5562                 longlongsize=`$run ./try`
5563                 echo "Your long longs are $longlongsize bytes long."
5564         else
5565                 dflt='8'
5566                 echo " "
5567                 echo "(I can't seem to compile the test program.  Guessing...)"
5568                 rp="What is the size of a long long (in bytes)?"
5569                 . ./myread
5570                 longlongsize="$ans"
5571         fi
5572         if $test "X$longsize" = "X$longlongsize"; then
5573                 echo "(That isn't any different from an ordinary long.)"
5574         fi
5575         ;;
5576 esac
5577 $rm_try
5578
5579 : see if inttypes.h is available
5580 : we want a real compile instead of Inhdr because some systems
5581 : have an inttypes.h which includes non-existent headers
5582 echo " "
5583 $cat >try.c <<EOCP
5584 #include <inttypes.h>
5585 int main() {
5586         static int32_t foo32 = 0x12345678;
5587 }
5588 EOCP
5589 set try
5590 if eval $compile; then
5591         echo "<inttypes.h> found." >&4
5592         val="$define"
5593 else
5594         echo "<inttypes.h> NOT found." >&4
5595         val="$undef"
5596 fi
5597 $rm_try
5598 set i_inttypes
5599 eval $setvar
5600
5601 : check for int64_t
5602 echo " "
5603 echo "Checking to see if you have int64_t..." >&4
5604 $cat >try.c <<EOCP
5605 #include <sys/types.h>
5606 #$i_inttypes I_INTTYPES
5607 #ifdef I_INTTYPES
5608 #include <inttypes.h>
5609 #endif
5610 int main() { int64_t x = 7; }
5611 EOCP
5612 set try
5613 if eval $compile; then
5614         val="$define"
5615         echo "You have int64_t."
5616 else
5617         val="$undef"
5618         echo "You do not have int64_t."
5619 fi
5620 $rm_try
5621 set d_int64_t
5622 eval $setvar
5623
5624
5625 echo " "
5626 echo "Checking which 64-bit integer type we could use..." >&4
5627
5628 case "$intsize" in
5629 8) val=int
5630    set quadtype
5631    eval $setvar
5632    val='"unsigned int"'
5633    set uquadtype
5634    eval $setvar
5635    quadkind=1
5636    ;;
5637 *) case "$longsize" in
5638    8) val=long
5639       set quadtype
5640       eval $setvar
5641       val='"unsigned long"'
5642       set uquadtype
5643       eval $setvar
5644       quadkind=2
5645       ;;
5646    *) case "$d_longlong:$longlongsize" in
5647       define:8)
5648         val='"long long"'
5649         set quadtype
5650         eval $setvar
5651         val='"unsigned long long"'
5652         set uquadtype
5653         eval $setvar
5654         quadkind=3
5655         ;;
5656       *) case "$d_int64_t" in
5657          define)
5658            val=int64_t
5659            set quadtype
5660            eval $setvar
5661            val=uint64_t
5662            set uquadtype
5663            eval $setvar
5664            quadkind=4
5665            ;;
5666          esac
5667          ;;
5668       esac
5669       ;;
5670    esac
5671    ;;
5672 esac
5673
5674 case "$quadtype" in
5675 '')     echo "Alas, no 64-bit integer types in sight." >&4
5676         d_quad="$undef"
5677         ;;
5678 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5679         d_quad="$define"
5680         ;;
5681 esac
5682
5683
5684 case "$uselonglong" in
5685 "$define"|true|[yY]*)
5686         cat <<EOM >&4
5687
5688 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5689 EOM
5690         use64bitint="$define"
5691         ;;
5692 esac                          
5693 case "$use64bits" in
5694 "$define"|true|[yY]*)
5695         cat <<EOM >&4
5696
5697 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5698 EOM
5699         use64bitint="$define"
5700         ;;
5701 esac                          
5702 case "$use64bitints" in
5703 "$define"|true|[yY]*)
5704         cat <<EOM >&4
5705
5706 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5707 EOM
5708         use64bitint="$define"
5709         ;;
5710 esac                          
5711 case "$use64bitsint" in
5712 "$define"|true|[yY]*)
5713         cat <<EOM >&4
5714
5715 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5716 EOM
5717         use64bitint="$define"
5718         ;;
5719 esac                          
5720 case "$uselonglongs" in
5721 "$define"|true|[yY]*)
5722         cat <<EOM >&4
5723
5724 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5725 EOM
5726         use64bitint="$define"
5727         ;;
5728 esac                          
5729 case "$use64bitsall" in
5730 "$define"|true|[yY]*)
5731         cat <<EOM >&4
5732
5733 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5734 EOM
5735         use64bitall="$define"
5736         ;;
5737 esac                          
5738
5739 case "$ccflags" in
5740 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5741 esac
5742 case "$use64bitall" in
5743 "$define"|true|[yY]*) use64bitint="$define" ;;
5744 esac
5745
5746 case "$longsize" in
5747 8) cat <<EOM
5748
5749 You have natively 64-bit long integers.
5750 EOM
5751    val="$define"
5752    ;;
5753 *) case "$use64bitint" in
5754    "$define"|true|[yY]*) dflt='y';;
5755    *) dflt='n';;
5756    esac
5757    case "$d_quad" in
5758    "$define") ;;
5759    *) dflt='n' ;;
5760    esac
5761    cat <<EOM
5762
5763 Perl can be built to take advantage of 64-bit integer types
5764 on some systems.  To do so, Configure can be run with -Duse64bitint.
5765 Choosing this option will most probably introduce binary incompatibilities.
5766
5767 If this doesn't make any sense to you, just accept the default '$dflt'.
5768 (The default has been chosen based on your configuration.)
5769 EOM
5770    rp='Try to use 64-bit integers, if available?'
5771    . ./myread
5772    case "$ans" in
5773    [yY]*) val="$define" ;;
5774    *)     val="$undef"  ;;
5775    esac
5776    ;;
5777 esac
5778 set use64bitint
5779 eval $setvar
5780
5781 case "$use64bitall" in
5782 "$define"|true|[yY]*) dflt='y' ;;
5783 *) case "$longsize" in
5784    8) dflt='y' ;;
5785    *) dflt='n' ;;
5786    esac
5787    ;;
5788 esac    
5789 cat <<EOM
5790
5791 You may also choose to try maximal 64-bitness.  It means using as much
5792 64-bitness as possible on the platform.  This in turn means even more
5793 binary incompatibilities.  On the other hand, your platform may not
5794 have any more 64-bitness available than what you already have chosen.
5795
5796 If this doesn't make any sense to you, just accept the default '$dflt'.
5797 (The default has been chosen based on your configuration.)
5798 EOM
5799 rp='Try to use maximal 64-bit support, if available?'
5800 . ./myread
5801 case "$ans" in
5802 [yY]*) val="$define" ;;
5803 *)     val="$undef"  ;;
5804 esac
5805 set use64bitall
5806 eval $setvar
5807 case "$use64bitall" in
5808 "$define")
5809         case "$use64bitint" in
5810         "$undef")
5811                 cat <<EOM
5812
5813 Since you have chosen a maximally 64-bit build, I'm also turning on
5814 the use of 64-bit integers.
5815 EOM
5816                 use64bitint="$define" ;;
5817         esac
5818         ;;
5819 esac
5820
5821 : Look for a hint-file generated 'call-back-unit'.  If the
5822 : user has specified that a 64-bit perl is to be built,
5823 : we may need to set or change some other defaults.
5824 if $test -f use64bitint.cbu; then
5825         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5826         . ./use64bitint.cbu
5827 fi
5828 case "$use64bitint" in
5829 "$define"|true|[yY]*)
5830         case "$longsize" in
5831         4) case "$archname64" in
5832            '') archname64=64int ;;
5833            esac
5834            ;;
5835         esac
5836         ;;
5837 esac
5838
5839 : Look for a hint-file generated 'call-back-unit'.  If the
5840 : user has specified that a maximally 64-bit perl is to be built,
5841 : we may need to set or change some other defaults.
5842 if $test -f use64bitall.cbu; then
5843         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5844         . ./use64bitall.cbu
5845 fi
5846 case "$use64bitall" in
5847 "$define"|true|[yY]*)
5848         case "$longsize" in
5849         4) case "$archname64" in
5850            ''|64int) archname64=64all ;;
5851            esac
5852            ;;
5853         esac
5854         ;;
5855 esac
5856
5857 case "$d_quad:$use64bitint" in
5858 $undef:$define)
5859         cat >&4 <<EOF
5860
5861 *** You have chosen to use 64-bit integers,
5862 *** but none can be found.
5863 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5864 *** Cannot continue, aborting.
5865
5866 EOF
5867         exit 1
5868         ;;
5869 esac
5870
5871 : check for length of double
5872 echo " "
5873 case "$doublesize" in
5874 '')
5875         echo "Checking to see how big your double precision numbers are..." >&4
5876         $cat >try.c <<EOCP
5877 #include <stdio.h>
5878 #$i_stdlib I_STDLIB
5879 #ifdef I_STDLIB
5880 #include <stdlib.h>
5881 #endif
5882 int main()
5883 {
5884     printf("%d\n", (int)sizeof(double));
5885     exit(0);
5886 }
5887 EOCP
5888         set try
5889         if eval $compile_ok; then
5890                 doublesize=`$run ./try`
5891                 echo "Your double is $doublesize bytes long."
5892         else
5893                 dflt='8'
5894                 echo "(I can't seem to compile the test program.  Guessing...)"
5895                 rp="What is the size of a double precision number (in bytes)?"
5896                 . ./myread
5897                 doublesize="$ans"
5898         fi
5899         ;;
5900 esac
5901 $rm_try
5902
5903 : check for long doubles
5904 echo " "
5905 echo "Checking to see if you have long double..." >&4
5906 echo 'int main() { long double x = 7.0; }' > try.c
5907 set try
5908 if eval $compile; then
5909         val="$define"
5910         echo "You have long double."
5911 else
5912         val="$undef"
5913         echo "You do not have long double."
5914 fi
5915 $rm_try
5916 set d_longdbl
5917 eval $setvar
5918
5919 : check for length of long double
5920 case "${d_longdbl}${longdblsize}" in
5921 $define)
5922         echo " "
5923         echo "Checking to see how big your long doubles are..." >&4
5924         $cat >try.c <<'EOCP'
5925 #include <stdio.h>
5926 int main()
5927 {
5928         printf("%d\n", sizeof(long double));
5929 }
5930 EOCP
5931         set try
5932         set try
5933         if eval $compile; then
5934                 longdblsize=`$run ./try`
5935                 echo "Your long doubles are $longdblsize bytes long."
5936         else
5937                 dflt='8'
5938                 echo " "
5939                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5940                 rp="What is the size of a long double (in bytes)?"
5941                 . ./myread
5942                 longdblsize="$ans"
5943         fi
5944         if $test "X$doublesize" = "X$longdblsize"; then
5945                 echo "That isn't any different from an ordinary double."
5946                 echo "I'll keep your setting anyway, but you may see some"
5947                 echo "harmless compilation warnings."
5948         fi
5949         ;;
5950 esac
5951 $rm_try
5952
5953 : determine the architecture name
5954 echo " "
5955 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5956         tarch=`arch`"-$osname"
5957 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5958         if uname -m > tmparch 2>&1 ; then
5959                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5960                         -e 's/$/'"-$osname/" tmparch`
5961         else
5962                 tarch="$osname"
5963         fi
5964         $rm -f tmparch
5965 else
5966         tarch="$osname"
5967 fi
5968 case "$myarchname" in
5969 ''|"$tarch") ;;
5970 *)
5971         echo "(Your architecture name used to be $myarchname.)"
5972         archname=''
5973         ;;
5974 esac
5975 case "$targetarch" in
5976 '') ;;
5977 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5978 esac
5979 myarchname="$tarch"
5980 case "$archname" in
5981 '') dflt="$tarch";;
5982 *) dflt="$archname";;
5983 esac
5984 rp='What is your architecture name'
5985 . ./myread
5986 archname="$ans"
5987 case "$usethreads" in
5988 $define)
5989         echo "Threads selected." >&4
5990         case "$archname" in
5991         *-thread*) echo "...and architecture name already has -thread." >&4
5992                 ;;
5993         *)      archname="$archname-thread"
5994                 echo "...setting architecture name to $archname." >&4
5995                 ;;
5996         esac
5997         ;;
5998 esac
5999 case "$usemultiplicity" in
6000 $define)
6001         echo "Multiplicity selected." >&4
6002         case "$archname" in
6003         *-multi*) echo "...and architecture name already has -multi." >&4
6004                 ;;
6005         *)      archname="$archname-multi"
6006                 echo "...setting architecture name to $archname." >&4
6007                 ;;
6008         esac
6009         ;;
6010 esac
6011 case "$use64bitint$use64bitall" in
6012 *"$define"*)
6013         case "$archname64" in
6014         '')
6015                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6016                 ;;
6017         *)
6018                 case "$use64bitint" in
6019                 "$define") echo "64 bit integers selected." >&4 ;;
6020                 esac
6021                 case "$use64bitall" in
6022                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6023                 esac
6024                 case "$archname" in
6025                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6026                         ;;
6027                 *)      archname="$archname-$archname64"
6028                         echo "...setting architecture name to $archname." >&4
6029                         ;;
6030                 esac
6031                 ;;
6032         esac
6033 esac
6034 case "$uselongdouble" in
6035 $define)
6036         echo "Long doubles selected." >&4
6037         case "$longdblsize" in
6038         $doublesize)
6039                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6040                 ;;
6041         *)
6042                 case "$archname" in
6043                 *-ld*) echo "...and architecture name already has -ld." >&4
6044                         ;;
6045                 *)      archname="$archname-ld"
6046                         echo "...setting architecture name to $archname." >&4
6047                         ;;
6048                 esac
6049                 ;;
6050         esac
6051         ;;
6052 esac
6053 case "$useperlio" in
6054 $define)
6055         echo "Perlio selected." >&4
6056         ;;
6057 *)
6058         echo "Perlio not selected, using stdio." >&4
6059         case "$archname" in
6060         *-stdio*) echo "...and architecture name already has -stdio." >&4
6061                 ;;
6062         *)      archname="$archname-stdio"
6063                 echo "...setting architecture name to $archname." >&4
6064                 ;;
6065         esac
6066         ;;
6067 esac
6068 if $test -f archname.cbu; then
6069         echo "Your platform has some specific hints for architecture name, using them..."
6070         . ./archname.cbu
6071 fi
6072
6073 : set the prefixit variable, to compute a suitable default value
6074 prefixit='case "$3" in
6075 ""|none)
6076         case "$oldprefix" in
6077         "") eval "$1=\"\$$2\"";;
6078         *)
6079                 case "$3" in
6080                 "") eval "$1=";;
6081                 none)
6082                         eval "tp=\"\$$2\"";
6083                         case "$tp" in
6084                         ""|" ") eval "$1=\"\$$2\"";;
6085                         *) eval "$1=";;
6086                         esac;;
6087                 esac;;
6088         esac;;
6089 *)
6090         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6091         case "$tp" in
6092         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6093         /*-$oldprefix/*|\~*-$oldprefix/*)
6094                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6095         *) eval "$1=\"\$$2\"";;
6096         esac;;
6097 esac'
6098
6099 : determine installation style
6100 : For now, try to deduce it from prefix unless it is already set.
6101 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6102 case "$installstyle" in
6103 '')     case "$prefix" in
6104                 *perl*) dflt='lib';;
6105                 *) dflt='lib/perl5' ;;
6106         esac
6107         ;;
6108 *)      dflt="$installstyle" ;;
6109 esac
6110 : Probably not worth prompting for this since we prompt for all
6111 : the directories individually, and the prompt would be too long and
6112 : confusing anyway.
6113 installstyle=$dflt
6114
6115 : determine where public executables go
6116 echo " "
6117 set dflt bin bin
6118 eval $prefixit
6119 fn=d~
6120 rp='Pathname where the public executables will reside?'
6121 . ./getfile
6122 if $test "X$ansexp" != "X$binexp"; then
6123         installbin=''
6124 fi
6125 prefixvar=bin
6126 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6127 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6128 :     this via initialinstalllocation
6129 . ./setprefixvar
6130
6131 case "$userelocatableinc" in
6132 $define|true|[yY]*)     dflt='y' ;;
6133 *)                      dflt='n' ;;
6134 esac
6135 cat <<EOM
6136
6137 Would you like to build Perl so that the installation is relocatable, so that
6138 library paths in @INC are determined relative to the path of the perl binary?
6139 This is not advised for system Perl installs, or if you need to run setid
6140 scripts or scripts under taint mode.
6141
6142 If this doesn't make any sense to you, just accept the default '$dflt'.
6143 EOM
6144 rp='Use relocatable @INC?'
6145 . ./myread
6146 case "$ans" in
6147 y|Y)    val="$define" ;;
6148 *)      val="$undef"  ;;
6149 esac
6150 set userelocatableinc
6151 eval $setvar
6152
6153 initialinstalllocation="$binexp"
6154 : Default prefix is now "up one level from where the binaries are"
6155 case "$userelocatableinc" in
6156 $define|true|[yY]*)
6157     bin=".../"
6158     binexp=".../"
6159     prefix=".../.."
6160     prefixexp=".../.."
6161     installprefixexp=".../.."
6162     ;;
6163 esac
6164
6165 : determine where private library files go
6166 : Usual default is /usr/local/lib/perl5/$version.
6167 : Also allow things like /opt/perl/lib/$version, since
6168 : /opt/perl/lib/perl5... would be redundant.
6169 : The default "style" setting is made in installstyle.U
6170 case "$installstyle" in
6171 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6172 *)       set dflt privlib lib/$version ;;
6173 esac
6174 eval $prefixit
6175 $cat <<EOM
6176
6177 There are some auxiliary files for $package that need to be put into a
6178 private library directory that is accessible by everyone.
6179
6180 EOM
6181 fn=$binexp
6182 fn=d~+
6183 rp='Pathname where the private library files will reside?'
6184 . ./getfile
6185 prefixvar=privlib
6186 . ./setprefixvar
6187
6188 : set the prefixup variable, to restore leading tilda escape
6189 prefixup='case "$prefixexp" in
6190 "$prefix") ;;
6191 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6192 esac'
6193
6194 : determine where public architecture dependent libraries go
6195 set archlib archlib
6196 eval $prefixit
6197 : privlib default is /usr/local/lib/$package/$version
6198 : archlib default is /usr/local/lib/$package/$version/$archname
6199 : privlib may have an optional trailing /share.
6200 tdflt=`echo $privlib | $sed 's,/share$,,'`
6201 tdflt=$tdflt/$archname
6202 case "$archlib" in
6203 '')     dflt=$tdflt
6204         ;;
6205 *)      dflt="$archlib"
6206     ;;
6207 esac
6208 $cat <<EOM
6209
6210 $spackage contains architecture-dependent library files.  If you are
6211 sharing libraries in a heterogeneous environment, you might store
6212 these files in a separate location.  Otherwise, you can just include
6213 them with the rest of the public library files.
6214
6215 EOM
6216 fn=$binexp
6217 fn=d+~
6218 rp='Where do you want to put the public architecture-dependent libraries?'
6219 . ./getfile
6220 prefixvar=archlib
6221 . ./setprefixvar
6222 if $test X"$archlib" = X"$privlib"; then
6223         d_archlib="$undef"
6224 else
6225         d_archlib="$define"
6226 fi
6227
6228 : see if setuid scripts can be secure
6229 $cat <<EOM
6230
6231 Some kernels have a bug that prevents setuid #! scripts from being
6232 secure.  Some sites have disabled setuid #! scripts because of this.
6233
6234 First let's decide if your kernel supports secure setuid #! scripts.
6235 (If setuid #! scripts would be secure but have been disabled anyway,
6236 don't say that they are secure if asked.)
6237
6238 EOM
6239
6240 val="$undef"
6241 if $test -d /dev/fd; then
6242         echo "#!$ls" >reflect
6243         chmod +x,u+s reflect
6244         ./reflect >flect 2>&1
6245         if $contains "/dev/fd" flect >/dev/null; then
6246                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6247                 val="$define"
6248         else
6249                 $cat <<EOM
6250 If you are not sure if they are secure, I can check but I'll need a
6251 username and password different from the one you are using right now.
6252 If you don't have such a username or don't want me to test, simply
6253 enter 'none'.
6254
6255 EOM
6256                 rp='Other username to test security of setuid scripts with?'
6257                 dflt='none'
6258                 . ./myread
6259                 case "$ans" in
6260                 n|none)
6261                         case "$d_suidsafe" in
6262                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6263                                 dflt=n;;
6264                         "$undef")
6265                                 echo "Well, the $hint value is *not* secure." >&4
6266                                 dflt=n;;
6267                         *)      echo "Well, the $hint value *is* secure." >&4
6268                                 dflt=y;;
6269                         esac
6270                         ;;
6271                 *)
6272                         $rm -f reflect flect
6273                         echo "#!$ls" >reflect
6274                         chmod +x,u+s reflect
6275                         echo >flect
6276                         chmod a+w flect
6277                         echo '"su" will (probably) prompt you for '"$ans's password."
6278                         su $ans -c './reflect >flect'
6279                         if $contains "/dev/fd" flect >/dev/null; then
6280                                 echo "Okay, it looks like setuid scripts are secure." >&4
6281                                 dflt=y
6282                         else
6283                                 echo "I don't think setuid scripts are secure." >&4
6284                                 dflt=n
6285                         fi
6286                         ;;
6287                 esac
6288                 rp='Does your kernel have *secure* setuid scripts?'
6289                 . ./myread
6290                 case "$ans" in
6291                 [yY]*)  val="$define";;
6292                 *)      val="$undef";;
6293                 esac
6294         fi
6295 else
6296         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6297         echo "(That's for file descriptors, not floppy disks.)"
6298         val="$undef"
6299 fi
6300 set d_suidsafe
6301 eval $setvar
6302
6303 $rm -f reflect flect
6304
6305 : now see if they want to do setuid emulation
6306 echo " "
6307 val="$undef"
6308 case "$d_suidsafe" in
6309 "$define")
6310         val="$undef"
6311         echo "No need to emulate SUID scripts since they are secure here." >&4
6312         ;;
6313 *)
6314         $cat <<EOM
6315 Some systems have disabled setuid scripts, especially systems where
6316 setuid scripts cannot be secure.  On systems where setuid scripts have
6317 been disabled, the setuid/setgid bits on scripts are currently
6318 useless.  It is possible for $package to detect those bits and emulate
6319 setuid/setgid in a secure fashion.  This emulation will only work if
6320 setuid scripts have been disabled in your kernel.
6321
6322 EOM
6323         case "$d_dosuid" in
6324         "$define") dflt=y ;;
6325         *) dflt=n ;;
6326         esac
6327         rp="Do you want to do setuid/setgid emulation?"
6328         . ./myread
6329         case "$ans" in
6330         [yY]*)  val="$define";;
6331         *)      val="$undef";;
6332         esac
6333         ;;
6334 esac
6335 set d_dosuid
6336 eval $setvar
6337
6338 : Find perl5.005 or later.
6339 echo "Looking for a previously installed perl5.005 or later... "
6340 case "$perl5" in
6341 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6342                 : Check if this perl is recent and can load a simple module
6343                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6344                         perl5=$tdir/perl
6345                         break;
6346                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6347                         perl5=$tdir/perl5
6348                         break;
6349                 fi
6350         done
6351         ;;
6352 *)      perl5="$perl5"
6353         ;;
6354 esac
6355 case "$perl5" in
6356 '')     echo "None found.  That's ok.";;
6357 *)      echo "Using $perl5." ;;
6358 esac
6359
6360 $cat <<EOM
6361
6362 After $package is installed, you may wish to install various
6363 add-on modules and utilities.  Typically, these add-ons will
6364 be installed under $prefix with the rest
6365 of this package.  However, you may wish to install such add-ons
6366 elsewhere under a different prefix.
6367
6368 If you do not wish to put everything under a single prefix, that's
6369 ok.  You will be prompted for the individual locations; this siteprefix
6370 is only used to suggest the defaults.
6371
6372 The default should be fine for most people.
6373
6374 EOM
6375 fn=d~+
6376 rp='Installation prefix to use for add-on modules and utilities?'
6377 : XXX Here might be another good place for an installstyle setting.
6378 case "$siteprefix" in
6379 '') dflt=$prefix ;;
6380 *)  dflt=$siteprefix ;;
6381 esac
6382 . ./getfile
6383 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6384 oldsiteprefix=''
6385 case "$siteprefix" in
6386 '') ;;
6387 *)      case "$ans" in
6388         "$prefix") ;;
6389         *) oldsiteprefix="$prefix";;
6390         esac
6391         ;;
6392 esac
6393 siteprefix="$ans"
6394 siteprefixexp="$ansexp"
6395
6396 : determine where site specific libraries go.
6397 : Usual default is /usr/local/lib/perl5/site_perl/$version
6398 : The default "style" setting is made in installstyle.U
6399 : XXX No longer works with Prefixit stuff.
6400 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6401 case "$sitelib" in
6402 '') case "$installstyle" in
6403         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6404         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6405         esac
6406         ;;
6407 *)      dflt="$sitelib"
6408         ;;
6409 esac
6410 $cat <<EOM
6411
6412 The installation process will create a directory for
6413 site-specific extensions and modules.  Most users find it convenient
6414 to place all site-specific files in this directory rather than in the
6415 main distribution directory.
6416
6417 EOM
6418 fn=d~+
6419 rp='Pathname for the site-specific library files?'
6420 . ./getfile
6421 prefixvar=sitelib
6422 . ./setprefixvar
6423 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6424
6425 : Determine list of previous versions to include in @INC
6426 $cat > getverlist <<EOPL
6427 #!$perl5 -w
6428 use File::Basename;
6429 \$api_versionstring = "$api_versionstring";
6430 \$version = "$version";
6431 \$stem = "$sitelib_stem";
6432 \$archname = "$archname";
6433 EOPL
6434         $cat >> getverlist <<'EOPL'
6435 # The list found is store twice for each entry: the original name, and
6436 # the binary broken down version as pack "sss", so sorting is easy and
6437 # unambiguous. This will work for all versions that have a maximum of
6438 # three digit groups, separate by '.'s or '_'s. Names are extended with
6439 # ".0.0" to ensure at least three elements for the pack.
6440 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6441
6442 # Can't have leading @ because metaconfig interprets it as a command!
6443 ;@inc_version_list=();
6444 # XXX Redo to do opendir/readdir?
6445 if (-d $stem) {
6446     chdir($stem);
6447     ;@candidates = map {
6448         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6449 }
6450 else {
6451     ;@candidates = ();
6452 }
6453
6454 ($pversion, $aversion, $vsn5005) = map {
6455     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6456 foreach $d (@candidates) {
6457     if ($d->[1] lt $pversion) {
6458         if ($d->[1] ge $aversion) {
6459             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6460         }
6461         elsif ($d->[1] ge $vsn5005) {
6462             unshift(@inc_version_list, grep { -d } $d->[0]);
6463         }
6464     }
6465     else {
6466         # Skip newer version.  I.e. don't look in
6467         # 5.7.0 if we're installing 5.6.1.
6468     }
6469 }
6470
6471 if (@inc_version_list) {
6472     print join(' ', @inc_version_list);
6473 }
6474 else {
6475     # Blank space to preserve value for next Configure run.
6476     print " ";
6477 }
6478 EOPL
6479 chmod +x getverlist
6480 case "$inc_version_list" in
6481 '')     if test -x "$perl5$exe_ext"; then
6482                 dflt=`$perl5 getverlist`
6483         else
6484                 dflt='none'
6485         fi
6486         ;;
6487 $undef) dflt='none' ;;
6488 *)  eval dflt=\"$inc_version_list\" ;;
6489 esac
6490 case "$dflt" in
6491 ''|' ') dflt=none ;;
6492 esac
6493 case "$dflt" in
6494 5.005) dflt=none ;;
6495 esac
6496 $cat <<EOM
6497
6498 In order to ease the process of upgrading, this version of perl
6499 can be configured to use modules built and installed with earlier
6500 versions of perl that were installed under $prefix.  Specify here
6501 the list of earlier versions that this version of perl should check.
6502 If Configure detected no earlier versions of perl installed under
6503 $prefix, then the list will be empty.  Answer 'none' to tell perl
6504 to not search earlier versions.
6505
6506 The default should almost always be sensible, so if you're not sure,
6507 just accept the default.
6508 EOM
6509
6510 rp='List of earlier versions to include in @INC?'
6511 . ./myread
6512 case "$ans" in
6513 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6514 *) inc_version_list="$ans" ;;
6515 esac
6516 case "$inc_version_list" in
6517 ''|' ')
6518         inc_version_list_init='0'
6519         d_inc_version_list="$undef"
6520         ;;
6521 *)      inc_version_list_init=`echo $inc_version_list |
6522                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6523         d_inc_version_list="$define"
6524         ;;
6525 esac
6526 $rm -f getverlist
6527
6528 : see if this is a malloc.h system
6529 : we want a real compile instead of Inhdr because some systems have a
6530 : malloc.h that just gives a compile error saying to use stdlib.h instead
6531 echo " "
6532 $cat >try.c <<EOCP
6533 #include <stdlib.h>
6534 #include <malloc.h>
6535 int main () { return 0; }
6536 EOCP
6537 set try
6538 if eval $compile; then
6539     echo "<malloc.h> found." >&4
6540     val="$define"
6541 else
6542     echo "<malloc.h> NOT found." >&4
6543     val="$undef"
6544 fi
6545 $rm_try
6546 set i_malloc
6547 eval $setvar
6548
6549 : check for void type
6550 echo " "
6551 echo "Checking to see how well your C compiler groks the void type..." >&4
6552 case "$voidflags" in
6553 '')
6554         $cat >try.c <<EOCP
6555 #$i_stdlib I_STDLIB
6556 #ifdef I_STDLIB
6557 #include <stdlib.h>
6558 #endif
6559 #if TRY & 1
6560 void sub() {
6561 #else
6562 sub() {
6563 #endif
6564         extern void moo();      /* function returning void */
6565         void (*goo)();          /* ptr to func returning void */
6566 #if TRY & 8
6567         void *hue;              /* generic ptr */
6568 #endif
6569 #if TRY & 2
6570         void (*foo[10])();
6571 #endif
6572
6573 #if TRY & 4
6574         if(goo == moo) {
6575                 exit(0);
6576         }
6577 #endif
6578         exit(0);
6579 }
6580 int main() { sub(); }
6581 EOCP
6582         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6583                 voidflags=$defvoidused
6584         echo "Good.  It appears to support void to the level $package wants.">&4
6585                 if $contains warning .out >/dev/null 2>&1; then
6586                         echo "However, you might get some warnings that look like this:"
6587                         $cat .out
6588                 fi
6589         else
6590 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6591                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6592                         echo "It supports 1..."
6593                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6594                                 echo "It also supports 2..."
6595                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6596                                         voidflags=7
6597                                         echo "And it supports 4 but not 8 definitely."
6598                                 else
6599                                         echo "It doesn't support 4..."
6600                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6601                                                 voidflags=11
6602                                                 echo "But it supports 8."
6603                                         else
6604                                                 voidflags=3
6605                                                 echo "Neither does it support 8."
6606                                         fi
6607                                 fi
6608                         else
6609                                 echo "It does not support 2..."
6610                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6611                                         voidflags=13
6612                                         echo "But it supports 4 and 8."
6613                                 else
6614                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6615                                                 voidflags=5
6616                                                 echo "And it supports 4 but has not heard about 8."
6617                                         else
6618                                                 echo "However it supports 8 but not 4."
6619                                         fi
6620                                 fi
6621                         fi
6622                 else
6623                         echo "There is no support at all for void."
6624                         voidflags=0
6625                 fi
6626         fi
6627 esac
6628 case "$voidflags" in
6629 "$defvoidused") ;;
6630 *)      $cat >&4 <<'EOM'
6631   Support flag bits are:
6632     1: basic void declarations.
6633     2: arrays of pointers to functions returning void.
6634     4: operations between pointers to and addresses of void functions.
6635     8: generic void pointers.
6636 EOM
6637         dflt="$voidflags";
6638         rp="Your void support flags add up to what?"
6639         . ./myread
6640         voidflags="$ans"
6641         ;;
6642 esac
6643 $rm_try
6644
6645 : check for length of pointer
6646 echo " "
6647 case "$ptrsize" in
6648 '')
6649         echo "Checking to see how big your pointers are..." >&4
6650         if test "$voidflags" -gt 7; then
6651                 echo '#define VOID_PTR char *' > try.c
6652         else
6653                 echo '#define VOID_PTR void *' > try.c
6654         fi
6655         $cat >>try.c <<EOCP
6656 #include <stdio.h>
6657 #$i_stdlib I_STDLIB
6658 #ifdef I_STDLIB
6659 #include <stdlib.h>
6660 #endif
6661 int main()
6662 {
6663     printf("%d\n", (int)sizeof(VOID_PTR));
6664     exit(0);
6665 }
6666 EOCP
6667         set try
6668         if eval $compile_ok; then
6669                 ptrsize=`$run ./try`
6670                 echo "Your pointers are $ptrsize bytes long."
6671         else
6672                 dflt='4'
6673                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6674                 rp="What is the size of a pointer (in bytes)?"
6675                 . ./myread
6676                 ptrsize="$ans"
6677         fi
6678         ;;
6679 esac
6680 $rm_try
6681 case "$use64bitall" in
6682 "$define"|true|[yY]*)
6683         case "$ptrsize" in
6684         4)      cat <<EOM >&4
6685
6686 *** You have chosen a maximally 64-bit build,
6687 *** but your pointers are only 4 bytes wide.
6688 *** Please rerun Configure without -Duse64bitall.
6689 EOM
6690                 case "$d_quad" in
6691                 define)
6692                         cat <<EOM >&4
6693 *** Since you have quads, you could possibly try with -Duse64bitint.
6694 EOM
6695                         ;;
6696                 esac
6697                 cat <<EOM >&4
6698 *** Cannot continue, aborting.
6699
6700 EOM
6701
6702                 exit 1
6703                 ;;
6704         esac
6705         ;;
6706 esac
6707
6708
6709 : determine whether to use malloc wrapping
6710 echo " "
6711 case "$usemallocwrap" in
6712 [yY]*|true|$define)     dflt='y' ;;
6713 [nN]*|false|$undef)     dflt='n' ;;
6714 *)      case "$usedevel" in
6715         [yY]*|true|$define)     dflt='y' ;;
6716         *) dflt='n' ;;
6717         esac
6718         ;;
6719 esac
6720 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6721 . ./myread
6722 usemallocwrap="$ans"
6723 case "$ans" in
6724 y*|true)
6725         usemallocwrap="$define" ;;
6726 *)
6727         usemallocwrap="$undef" ;;
6728 esac
6729
6730 : determine which malloc to compile in
6731 echo " "
6732 case "$usemymalloc" in
6733 [yY]*|true|$define)     dflt='y' ;;
6734 [nN]*|false|$undef)     dflt='n' ;;
6735 *)      case "$ptrsize" in
6736         4) dflt='y' ;;
6737         *) dflt='n' ;;
6738         esac
6739         ;;
6740 esac
6741 rp="Do you wish to attempt to use the malloc that comes with $package?"
6742 . ./myread
6743 usemymalloc="$ans"
6744 case "$ans" in
6745 y*|true)
6746         usemymalloc='y'
6747         mallocsrc='malloc.c'
6748         mallocobj="malloc$_o"
6749         d_mymalloc="$define"
6750         case "$libs" in
6751         *-lmalloc*)
6752                 : Remove malloc from list of libraries to use
6753                 echo "Removing unneeded -lmalloc from library list" >&4
6754                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6755                 shift
6756                 libs="$*"
6757                 echo "libs = $libs" >&4
6758                 ;;
6759         esac
6760         ;;
6761 *)
6762         usemymalloc='n'
6763         mallocsrc=''
6764         mallocobj=''
6765         d_mymalloc="$undef"
6766         ;;
6767 esac
6768
6769 : compute the return types of malloc and free
6770 echo " "
6771 $cat >malloc.c <<END
6772 #$i_malloc I_MALLOC
6773 #$i_stdlib I_STDLIB
6774 #include <stdio.h>
6775 #include <sys/types.h>
6776 #ifdef I_MALLOC
6777 #include <malloc.h>
6778 #endif
6779 #ifdef I_STDLIB
6780 #include <stdlib.h>
6781 #endif
6782 #ifdef TRY_MALLOC
6783 void *malloc();
6784 #endif
6785 #ifdef TRY_FREE
6786 void free();
6787 #endif
6788 END
6789 case "$malloctype" in
6790 '')
6791         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6792                 malloctype='void *'
6793         else
6794                 malloctype='char *'
6795         fi
6796         ;;
6797 esac
6798 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6799
6800 case "$freetype" in
6801 '')
6802         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6803                 freetype='void'
6804         else
6805                 freetype='int'
6806         fi
6807         ;;
6808 esac
6809 echo "Your system uses $freetype free(), it would seem." >&4
6810 $rm -f malloc.[co]
6811 : determine where site specific architecture-dependent libraries go.
6812 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6813 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6814 : sitelib may have an optional trailing /share.
6815 case "$sitearch" in
6816 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6817         dflt="$dflt/$archname"
6818         ;;
6819 *)      dflt="$sitearch"
6820         ;;
6821 esac
6822 set sitearch sitearch none
6823 eval $prefixit
6824 $cat <<EOM
6825
6826 The installation process will also create a directory for
6827 architecture-dependent site-specific extensions and modules.
6828
6829 EOM
6830 fn=d~+
6831 rp='Pathname for the site-specific architecture-dependent library files?'
6832 . ./getfile
6833 prefixvar=sitearch
6834 . ./setprefixvar
6835 if $test X"$sitearch" = X"$sitelib"; then
6836         d_sitearch="$undef"
6837 else
6838         d_sitearch="$define"
6839 fi
6840
6841 $cat <<EOM
6842
6843 The installation process will also create a directory for
6844 vendor-supplied add-ons.  Vendors who supply perl with their system
6845 may find it convenient to place all vendor-supplied files in this
6846 directory rather than in the main distribution directory.  This will
6847 ease upgrades between binary-compatible maintenance versions of perl.
6848
6849 Of course you may also use these directories in whatever way you see
6850 fit.  For example, you might use them to access modules shared over a
6851 company-wide network.
6852
6853 The default answer should be fine for most people.
6854 This causes further questions about vendor add-ons to be skipped
6855 and no vendor-specific directories will be configured for perl.
6856
6857 EOM
6858 rp='Do you want to configure vendor-specific add-on directories?'
6859 case "$usevendorprefix" in
6860 define|true|[yY]*) dflt=y ;;
6861 *)      : User may have set vendorprefix directly on Configure command line.
6862         case "$vendorprefix" in
6863         ''|' ') dflt=n ;;
6864         *)      dflt=y ;;
6865         esac
6866         ;;
6867 esac
6868 . ./myread
6869 case "$ans" in
6870 [yY]*)  fn=d~+
6871         rp='Installation prefix to use for vendor-supplied add-ons?'
6872         case "$vendorprefix" in
6873         '') dflt='' ;;
6874         *)  dflt=$vendorprefix ;;
6875         esac
6876         . ./getfile
6877         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6878         oldvendorprefix=''
6879         case "$vendorprefix" in
6880         '') ;;
6881         *)      case "$ans" in
6882                 "$prefix") ;;
6883                 *) oldvendorprefix="$prefix";;
6884                 esac
6885                 ;;
6886         esac
6887         usevendorprefix="$define"
6888         vendorprefix="$ans"
6889         vendorprefixexp="$ansexp"
6890         ;;
6891 *)      usevendorprefix="$undef"
6892         vendorprefix=''
6893         vendorprefixexp=''
6894         ;;
6895 esac
6896
6897 case "$vendorprefix" in
6898 '')     d_vendorlib="$undef"
6899         vendorlib=''
6900         vendorlibexp=''
6901         ;;
6902 *)      d_vendorlib="$define"
6903         : determine where vendor-supplied modules go.
6904         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6905         case "$vendorlib" in
6906         '')
6907                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6908                 case "$installstyle" in
6909                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6910                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6911                 esac
6912                 ;;
6913         *)      dflt="$vendorlib"
6914                 ;;
6915         esac
6916         fn=d~+
6917         rp='Pathname for the vendor-supplied library files?'
6918         . ./getfile
6919         vendorlib="$ans"
6920         vendorlibexp="$ansexp"
6921         ;;
6922 esac
6923 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6924 prefixvar=vendorlib
6925 . ./installprefix
6926
6927 case "$vendorprefix" in
6928 '')     d_vendorarch="$undef"
6929         vendorarch=''
6930         vendorarchexp=''
6931         ;;
6932 *)      d_vendorarch="$define"
6933         : determine where vendor-supplied architecture-dependent libraries go.
6934         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6935         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6936         : vendorlib may have an optional trailing /share.
6937         case "$vendorarch" in
6938         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6939                 dflt="$dflt/$archname"
6940                 ;;
6941         *)      dflt="$vendorarch" ;;
6942         esac
6943         fn=d~+
6944         rp='Pathname for vendor-supplied architecture-dependent files?'
6945         . ./getfile
6946         vendorarch="$ans"
6947         vendorarchexp="$ansexp"
6948         ;;
6949 esac
6950 prefixvar=vendorarch
6951 . ./installprefix
6952
6953 : Final catch-all directories to search
6954 $cat <<EOM
6955
6956 Lastly, you can have perl look in other directories for extensions and
6957 modules in addition to those already specified.
6958 These directories will be searched after 
6959         $sitearch 
6960         $sitelib 
6961 EOM
6962 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6963 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6964 echo ' '
6965 case "$otherlibdirs" in
6966 ''|' ') dflt='none' ;;
6967 *)      dflt="$otherlibdirs" ;;
6968 esac
6969 $cat <<EOM
6970 Enter a colon-separated set of extra paths to include in perl's @INC
6971 search path, or enter 'none' for no extra paths.
6972
6973 EOM
6974
6975 rp='Colon-separated list of additional directories for perl to search?'
6976 . ./myread
6977 case "$ans" in
6978 ' '|''|none)    otherlibdirs=' ' ;;     
6979 *)      otherlibdirs="$ans" ;;
6980 esac
6981 case "$otherlibdirs" in
6982 ' ') val=$undef ;;
6983 *)      val=$define ;;
6984 esac
6985 set d_perl_otherlibdirs
6986 eval $setvar
6987
6988 : Cruising for prototypes
6989 echo " "
6990 echo "Checking out function prototypes..." >&4
6991 $cat >prototype.c <<EOCP
6992 #$i_stdlib I_STDLIB
6993 #ifdef I_STDLIB
6994 #include <stdlib.h>
6995 #endif
6996 int main(int argc, char *argv[]) {
6997         exit(0);}
6998 EOCP
6999 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7000         echo "Your C compiler appears to support function prototypes."
7001         val="$define"
7002 else
7003         echo "Your C compiler doesn't seem to understand function prototypes."
7004         val="$undef"
7005 fi
7006 set prototype
7007 eval $setvar
7008 $rm -f prototype*
7009
7010 case "$prototype" in
7011 "$define") ;;
7012 *)      ansi2knr='ansi2knr'
7013         echo " "
7014         cat <<EOM >&4
7015
7016 $me:  FATAL ERROR:
7017 This version of $package can only be compiled by a compiler that 
7018 understands function prototypes.  Unfortunately, your C compiler 
7019         $cc $ccflags
7020 doesn't seem to understand them.  Sorry about that.
7021
7022 If GNU cc is available for your system, perhaps you could try that instead.  
7023
7024 Eventually, we hope to support building Perl with pre-ANSI compilers.
7025 If you would like to help in that effort, please contact <perlbug@perl.org>.
7026
7027 Aborting Configure now.
7028 EOM
7029         exit 2
7030         ;;
7031 esac
7032
7033 echo " "
7034 case "$extras" in
7035 '') dflt='n';;
7036 *) dflt='y';;
7037 esac
7038 cat <<EOM
7039 Perl can be built with extra modules or bundles of modules which
7040 will be fetched from the CPAN and installed alongside Perl.
7041
7042 Notice that you will need access to the CPAN; either via the Internet,
7043 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7044 be asked later to configure the CPAN.pm module which will in turn do
7045 the installation of the rest of the extra modules or bundles.)
7046
7047 Notice also that if the modules require any external software such as
7048 libraries and headers (the libz library and the zlib.h header for the
7049 Compress::Zlib module, for example) you MUST have any such software
7050 already installed, this configuration process will NOT install such
7051 things for you.
7052
7053 If this doesn't make any sense to you, just accept the default '$dflt'.
7054 EOM
7055 rp='Install any extra modules (y or n)?'
7056 . ./myread
7057 case "$ans" in
7058 y|Y)
7059         cat <<EOM
7060
7061 Please list any extra modules or bundles to be installed from CPAN,
7062 with spaces between the names.  The names can be in any format the
7063 'install' command of CPAN.pm will understand.  (Answer 'none',
7064 without the quotes, to install no extra modules or bundles.)
7065 EOM
7066         rp='Extras?'
7067         dflt="$extras"
7068         . ./myread
7069         extras="$ans"
7070 esac
7071 case "$extras" in
7072 ''|'none')
7073         val=''
7074         $rm -f ../extras.lst
7075         ;;
7076 *)      echo "(Saving the list of extras for later...)"
7077         echo "$extras" > ../extras.lst
7078         val="'$extras'"
7079         ;;
7080 esac
7081 set extras
7082 eval $setvar
7083 echo " "
7084
7085 : determine where html pages for programs go
7086 set html1dir html1dir none
7087 eval $prefixit
7088 $cat <<EOM
7089
7090 If you wish to install html files for programs in $spackage, indicate
7091 the appropriate directory here.  To skip installing html files,
7092 answer "none".
7093 EOM
7094 case "$html1dir" in
7095 ''|none|$undef|' ') dflt=none ;;
7096 *) dflt=$html1dir ;;
7097 esac
7098 fn=dn+~
7099 rp="Directory for the main $spackage html pages?"
7100 . ./getfile
7101 prefixvar=html1dir
7102 . ./setprefixvar
7103 : Use ' ' for none so value is preserved next time through Configure
7104 $test X"$html1dir" = "X" && html1dir=' '
7105
7106 : determine where html pages for libraries and modules go
7107 set html3dir html3dir none
7108 eval $prefixit
7109 $cat <<EOM
7110
7111 If you wish to install html files for modules associated with $spackage,
7112 indicate the appropriate directory here.  To skip installing html files,
7113 answer "none".
7114 EOM
7115 : There is no obvious default.  If they have specified html1dir, then
7116 : try to key off that, possibly changing .../html1 into .../html3.
7117 case "$html3dir" in
7118 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7119 *) dflt=$html3dir ;;
7120 esac
7121 fn=dn+~
7122 rp="Directory for the $spackage module html pages?"
7123 . ./getfile
7124 prefixvar=html3dir
7125 . ./setprefixvar
7126 : Use ' ' for none so value is preserved next time through Configure
7127 $test X"$html3dir" = "X" && html3dir=' '
7128
7129 : determine whether to install perl also as /usr/bin/perl
7130
7131 echo " "
7132 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7133         $cat <<EOM
7134 Many scripts expect perl to be installed as /usr/bin/perl.
7135
7136 If you want to, I can install the perl you are about to compile
7137 as /usr/bin/perl (in addition to $bin/perl).
7138 EOM
7139         if test -f /usr/bin/perl; then
7140             $cat <<EOM
7141
7142 However, please note that because you already have a /usr/bin/perl,
7143 overwriting that with a new Perl would very probably cause problems.
7144 Therefore I'm assuming you don't want to do that (unless you insist).
7145
7146 EOM
7147             case "$installusrbinperl" in
7148             "$define"|[yY]*)    dflt='y';;
7149             *)                  dflt='n';;
7150             esac
7151         else
7152             $cat <<EOM
7153
7154 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7155
7156 EOM
7157             case "$installusrbinperl" in
7158             "$undef"|[nN]*)     dflt='n';;
7159             *)                  dflt='y';;
7160             esac
7161         fi
7162         rp="Do you want to install perl as /usr/bin/perl?"
7163         . ./myread
7164         case "$ans" in
7165         [yY]*)  val="$define";;
7166         *)      val="$undef" ;;
7167         esac
7168 else
7169         val="$undef"
7170 fi
7171 set installusrbinperl
7172 eval $setvar
7173
7174 echo " "
7175 echo "Checking for GNU C Library..." >&4
7176 cat >try.c <<'EOCP'
7177 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7178    alone are insufficient to distinguish different versions, such as
7179    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7180    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7181 */
7182 #include <stdio.h>
7183 int main(void)
7184 {
7185 #ifdef __GLIBC__
7186 #   ifdef __GLIBC_MINOR__
7187 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7188 #           include <gnu/libc-version.h>
7189             printf("%s\n",  gnu_get_libc_version());
7190 #       else
7191             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7192 #       endif
7193 #   else
7194         printf("%d\n",  __GLIBC__);
7195 #   endif
7196     return 0;
7197 #else
7198     return 1;
7199 #endif
7200 }
7201 EOCP
7202 set try
7203 if eval $compile_ok && $run ./try > glibc.ver; then
7204         val="$define"
7205         gnulibc_version=`$cat glibc.ver`
7206         echo "You are using the GNU C Library version $gnulibc_version"
7207 else
7208         val="$undef"
7209         gnulibc_version=''
7210         echo "You are not using the GNU C Library"
7211 fi
7212 $rm_try glibc.ver
7213 set d_gnulibc
7214 eval $setvar
7215
7216 : see if nm is to be used to determine whether a symbol is defined or not
7217 case "$usenm" in
7218 '')
7219         dflt=''
7220         case "$d_gnulibc" in
7221         "$define")
7222                 echo " "
7223                 echo "nm probably won't work on the GNU C Library." >&4
7224                 dflt=n
7225                 ;;
7226         esac
7227         case "$dflt" in
7228         '') 
7229                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7230                         echo " "
7231                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7232                         echo "'nm' won't be sufficient on this sytem." >&4
7233                         dflt=n
7234                 fi
7235                 ;;
7236         esac
7237         case "$dflt" in
7238         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7239                 if $test $dflt -gt 20; then
7240                         dflt=y
7241                 else
7242                         dflt=n
7243                 fi
7244                 ;;
7245         esac
7246         ;;
7247 *)
7248         case "$usenm" in
7249         true|$define) dflt=y;;
7250         *) dflt=n;;
7251         esac
7252         ;;
7253 esac
7254 $cat <<EOM
7255
7256 I can use $nm to extract the symbols from your C libraries. This
7257 is a time consuming task which may generate huge output on the disk (up
7258 to 3 megabytes) but that should make the symbols extraction faster. The
7259 alternative is to skip the 'nm' extraction part and to compile a small
7260 test program instead to determine whether each symbol is present. If
7261 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7262 this may be the best solution.
7263
7264 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7265
7266 EOM
7267 rp="Shall I use $nm to extract C symbols from the libraries?"
7268 . ./myread
7269 case "$ans" in
7270 [Nn]*) usenm=false;;
7271 *) usenm=true;;
7272 esac
7273
7274 runnm=$usenm
7275 case "$reuseval" in
7276 true) runnm=false;;
7277 esac
7278
7279 : nm options which may be necessary
7280 case "$nm_opt" in
7281 '') if $test -f /mach_boot; then
7282                 nm_opt=''       # Mach
7283         elif $test -d /usr/ccs/lib; then
7284                 nm_opt='-p'     # Solaris (and SunOS?)
7285         elif $test -f /dgux; then
7286                 nm_opt='-p'     # DG-UX
7287         elif $test -f /lib64/rld; then
7288                 nm_opt='-p'     # 64-bit Irix
7289         else
7290                 nm_opt=''
7291         fi;;
7292 esac
7293
7294 : nm options which may be necessary for shared libraries but illegal
7295 : for archive libraries.  Thank you, Linux.
7296 case "$nm_so_opt" in
7297 '')     case "$myuname" in
7298         *linux*|gnu*)
7299                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7300                         nm_so_opt='--dynamic'
7301                 fi
7302                 ;;
7303         esac
7304         ;;
7305 esac
7306
7307 case "$runnm" in
7308 true)
7309 : get list of predefined functions in a handy place
7310 echo " "
7311 case "$libc" in
7312 '') libc=unknown
7313         case "$libs" in
7314         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7315         esac
7316         ;;
7317 esac
7318 case "$libs" in
7319 '') ;;
7320 *)  for thislib in $libs; do
7321         case "$thislib" in
7322         -lc|-lc_s)
7323                 : Handle C library specially below.
7324                 ;;
7325         -l*)
7326                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7327                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7328                         :
7329                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7330                         :
7331                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7332                         :
7333                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7334                         :
7335                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7336                         :
7337                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7338                         :
7339                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7340                         :
7341                 else
7342                         try=''
7343                 fi
7344                 libnames="$libnames $try"
7345                 ;;
7346         *) libnames="$libnames $thislib" ;;
7347         esac
7348         done
7349         ;;
7350 esac
7351 xxx=normal
7352 case "$libc" in
7353 unknown)
7354         set /lib/libc.$so
7355         for xxx in $libpth; do
7356                 $test -r $1 || set $xxx/libc.$so
7357                 : The messy sed command sorts on library version numbers.
7358                 $test -r $1 || \
7359                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7360                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7361                                 h
7362                                 s/[0-9][0-9]*/0000&/g
7363                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7364                                 G
7365                                 s/\n/ /' | \
7366                          $sort | $sed -e 's/^.* //'`
7367                 eval set \$$#
7368         done
7369         $test -r $1 || set /usr/ccs/lib/libc.$so
7370         $test -r $1 || set /lib/libsys_s$_a
7371         ;;
7372 *)
7373         set blurfl
7374         ;;
7375 esac
7376 if $test -r "$1"; then
7377         echo "Your (shared) C library seems to be in $1."
7378         libc="$1"
7379 elif $test -r /lib/libc && $test -r /lib/clib; then
7380         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7381         xxx=apollo
7382         libc='/lib/clib /lib/libc'
7383         if $test -r /lib/syslib; then
7384                 echo "(Your math library is in /lib/syslib.)"
7385                 libc="$libc /lib/syslib"
7386         fi
7387 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7388         echo "Your C library seems to be in $libc, as you said before."
7389 elif $test -r $incpath/usr/lib/libc$_a; then
7390         libc=$incpath/usr/lib/libc$_a;
7391         echo "Your C library seems to be in $libc.  That's fine."
7392 elif $test -r /lib/libc$_a; then
7393         libc=/lib/libc$_a;
7394         echo "Your C library seems to be in $libc.  You're normal."
7395 else
7396         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7397                 :
7398         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7399                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7400         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7401                 :
7402         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7403                 :
7404         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7405                 :
7406         else
7407                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7408         fi
7409         if $test -r "$tans"; then
7410                 echo "Your C library seems to be in $tans, of all places."
7411                 libc=$tans
7412         else
7413                 libc='blurfl'
7414         fi
7415 fi
7416 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7417         dflt="$libc"
7418         cat <<EOM
7419
7420 If the guess above is wrong (which it might be if you're using a strange
7421 compiler, or your machine supports multiple models), you can override it here.
7422
7423 EOM
7424 else
7425         dflt=''
7426         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7427         cat >&4 <<EOM
7428 I can't seem to find your C library.  I've looked in the following places:
7429
7430 EOM
7431         $sed 's/^/      /' libpath
7432         cat <<EOM
7433
7434 None of these seems to contain your C library. I need to get its name...
7435
7436 EOM
7437 fi
7438 fn=f
7439 rp='Where is your C library?'
7440 . ./getfile
7441 libc="$ans"
7442
7443 echo " "
7444 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7445 set X `cat libnames`
7446 shift
7447 xxx=files
7448 case $# in 1) xxx=file; esac
7449 echo "Extracting names from the following $xxx for later perusal:" >&4
7450 echo " "
7451 $sed 's/^/      /' libnames >&4
7452 echo " "
7453 $echo $n "This may take a while...$c" >&4
7454
7455 for file in $*; do
7456         case $file in
7457         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7458         *) $nm $nm_opt $file 2>/dev/null;;
7459         esac
7460 done >libc.tmp
7461
7462 $echo $n ".$c"
7463 $grep fprintf libc.tmp > libc.ptf
7464 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7465 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7466 xxx='[ADTSIW]'
7467 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7468         eval $xscan;\
7469         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7470                 eval $xrun
7471 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7472         eval $xscan;\
7473         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7474                 eval $xrun
7475 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7476         eval $xscan;\
7477         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7478                 eval $xrun
7479 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7480         eval $xscan;\
7481         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7482                 eval $xrun
7483 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7484         eval $xscan;\
7485         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7486                 eval $xrun
7487 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7488         eval $xscan;\
7489         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7490                 eval $xrun
7491 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7492                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7493         eval $xscan;\
7494         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7495                 eval $xrun
7496 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7497         eval $xscan;\
7498         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7499                 eval $xrun
7500 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7501         eval $xscan;\
7502         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7503                 eval $xrun
7504 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7505         eval $xscan;\
7506         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7507                 eval $xrun
7508 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7509         eval $xscan;\
7510         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7511                 eval $xrun
7512 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7513         eval $xscan;\
7514         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7515                 eval $xrun
7516 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7517         eval $xscan;\
7518         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7519                 eval $xrun
7520 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7521         eval $xscan;\
7522         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7523                 eval $xrun
7524 else
7525         $nm -p $* 2>/dev/null >libc.tmp
7526         $grep fprintf libc.tmp > libc.ptf
7527         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7528                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7529         then
7530                 nm_opt='-p'
7531                 eval $xrun
7532         else
7533                 echo " "
7534                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7535                 com=''
7536                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7537                         for thisname in $libnames $libc; do
7538                                 $ar t $thisname >>libc.tmp
7539                         done
7540                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7541                         echo "Ok." >&4
7542                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7543                         # Repeat libc to extract forwarders to DLL entries too
7544                         for thisname in $libnames $libc; do
7545                                 $ar tv $thisname >>libc.tmp
7546                                 # Revision 50 of EMX has bug in $ar.
7547                                 # it will not extract forwarders to DLL entries
7548                                 # Use emximp which will extract exactly them.
7549                                 emximp -o tmp.imp $thisname \
7550                                     2>/dev/null && \
7551                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7552                                     < tmp.imp >>libc.tmp
7553                                 $rm tmp.imp
7554                         done
7555                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7556                         echo "Ok." >&4
7557                 else
7558                         echo "$ar didn't seem to work right." >&4
7559                         echo "Maybe this is a Cray...trying bld instead..." >&4
7560                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7561                         then
7562                                 for thisname in $libnames; do
7563                                         bld t $libnames | \
7564                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7565                                         $ar t $thisname >>libc.tmp
7566                                 done
7567                                 echo "Ok." >&4
7568                         else
7569                                 echo "That didn't work either.  Giving up." >&4
7570                                 exit 1
7571                         fi
7572                 fi
7573         fi
7574 fi
7575 nm_extract="$com"
7576 case "$PASE" in
7577 define)
7578     echo " "
7579     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7580     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7581     ;;
7582 *)  if $test -f /lib/syscalls.exp; then
7583         echo " "
7584         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7585         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7586     fi
7587     ;;
7588 esac
7589 ;;
7590 esac
7591 $rm -f libnames libpath
7592
7593 : see if dld is available
7594 set dld.h i_dld
7595 eval $inhdr
7596
7597
7598 echo " "
7599 echo "Checking for C++..." >&4
7600 $cat >try.c <<'EOCP'
7601 #include <stdio.h>
7602 int main(void)
7603 {
7604 #ifdef __cplusplus
7605     return 0;
7606 #else
7607     return 1;
7608 #endif
7609 }
7610 EOCP
7611 set try
7612 if eval $compile_ok && $run ./try; then
7613         val="$define"
7614         echo "You are using a C++ compiler."
7615 else
7616         val="$undef"
7617         echo "You are not using a C++ compiler."
7618 fi
7619 $rm_try cplusplus$$
7620 set d_cplusplus
7621 eval $setvar
7622
7623 : is a C symbol defined?
7624 csym='tlook=$1;
7625 case "$3" in
7626 -v) tf=libc.tmp; tdc="";;
7627 -a) tf=libc.tmp; tdc="[]";;
7628 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7629 esac;
7630 tx=yes;
7631 case "$reuseval-$4" in
7632 true-) ;;
7633 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7634 esac;
7635 case "$tx" in
7636 yes)
7637         tval=false;
7638         case "$d_cplusplus" in
7639                 $define) extern_C=\"C\";;
7640         esac;
7641         if $test "$runnm" = true; then
7642                 if $contains $tlook $tf >/dev/null 2>&1; then
7643                         tval=true;
7644                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7645                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7646                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7647                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7648                         $rm_try;
7649                 fi;
7650         else
7651                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7652                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7653                 $rm_try;
7654         fi;
7655         ;;
7656 *)
7657         case "$tval" in
7658         $define) tval=true;;
7659         *) tval=false;;
7660         esac;
7661         ;;
7662 esac;
7663 eval "$2=$tval"'
7664
7665 : define an is-in-libc? function
7666 inlibc='echo " "; td=$define; tu=$undef;
7667 sym=$1; var=$2; eval "was=\$$2";
7668 tx=yes;
7669 case "$reuseval$was" in
7670 true) ;;
7671 true*) tx=no;;
7672 esac;
7673 case "$tx" in
7674 yes)
7675         set $sym tres -f;
7676         eval $csym;
7677         case "$tres" in
7678         true)
7679                 echo "$sym() found." >&4;
7680                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7681         *)
7682                 echo "$sym() NOT found." >&4;
7683                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7684         esac;;
7685 *)
7686         case "$was" in
7687         $define) echo "$sym() found." >&4;;
7688         *) echo "$sym() NOT found." >&4;;
7689         esac;;
7690 esac'
7691
7692 : see if dlopen exists
7693 xxx_runnm="$runnm"
7694 xxx_ccflags="$ccflags"
7695 runnm=false
7696 : with g++ one needs -shared to get is-in-libc to work for dlopen
7697 case "$gccversion" in
7698 '')     ;;
7699 *)      case "$d_cplusplus" in
7700         "$define") ccflags="$ccflags -shared" ;;
7701         esac
7702         ;;
7703 esac
7704 set dlopen d_dlopen
7705 eval $inlibc
7706 runnm="$xxx_runnm"
7707 ccflags="$xxx_ccflags"
7708
7709 : see if this is a unistd.h system
7710 set unistd.h i_unistd
7711 eval $inhdr
7712
7713 : determine which dynamic loading, if any, to compile in
7714 echo " "
7715 dldir="ext/DynaLoader"
7716 case "$usedl" in
7717 $define|y|true)
7718         dflt='y'
7719         usedl="$define"
7720         ;;
7721 $undef|n|false)
7722         dflt='n'
7723         usedl="$undef"
7724         ;;
7725 *)
7726         dflt='n'
7727         case "$d_dlopen" in
7728             $define) dflt='y' ;;
7729         esac
7730         case "$i_dld" in
7731             $define) dflt='y' ;;
7732         esac
7733         : Does a dl_xxx.xs file exist for this operating system
7734         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7735         ;;
7736 esac
7737 rp="Do you wish to use dynamic loading?"
7738 . ./myread
7739 usedl="$ans"
7740 case "$ans" in
7741 y*) usedl="$define"
7742         case "$dlsrc" in
7743         '')
7744                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7745                         dflt="$dldir/dl_${osname}.xs"
7746                 elif $test "$d_dlopen" = "$define" ; then
7747                         dflt="$dldir/dl_dlopen.xs"
7748                 elif $test "$i_dld" = "$define" ; then
7749                         dflt="$dldir/dl_dld.xs"
7750                 else
7751                         dflt=''
7752                 fi
7753                 ;;
7754         *)      dflt="$dldir/$dlsrc"
7755                 ;;
7756         esac
7757     echo "The following dynamic loading files are available:"
7758         : Can not go over to $dldir because getfile has path hard-coded in.
7759         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7760         rp="Source file to use for dynamic loading"
7761         fn="fne"
7762         gfpth="$src"
7763         . ./getfile
7764         usedl="$define"
7765         : emulate basename
7766         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7767
7768         $cat << EOM
7769
7770 Some systems may require passing special flags to $cc -c to
7771 compile modules that will be used to create a shared library.
7772 To use no flags, say "none".
7773
7774 EOM
7775     case "$cccdlflags" in
7776     '') case "$gccversion" in
7777                 '') case "$osname" in
7778                         hpux)   dflt='+z' ;;
7779                         next)   dflt='none' ;;
7780                         irix*)  dflt='-KPIC' ;;
7781                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7782                         sunos)  dflt='-pic' ;;
7783                         *)      dflt='none' ;;
7784                     esac
7785                         ;;
7786                 *)  case "$osname" in
7787                         darwin) dflt='none' ;;
7788                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7789                         *)      dflt='-fpic' ;;
7790                     esac ;;
7791             esac ;;
7792         ' ') dflt='none' ;;
7793     *)  dflt="$cccdlflags" ;;
7794     esac
7795     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7796     . ./myread
7797     case "$ans" in
7798     none) cccdlflags=' ' ;;
7799     *) cccdlflags="$ans" ;;
7800     esac
7801
7802     cat << EOM
7803
7804 Some systems use ld to create libraries that can be dynamically loaded,
7805 while other systems (such as those using ELF) use $cc.
7806
7807 EOM
7808         case "$ld" in
7809         '')     $cat >try.c <<EOM
7810 /* Test for whether ELF binaries are produced */
7811 #include <fcntl.h>
7812 #$i_stdlib I_STDLIB
7813 #ifdef I_STDLIB
7814 #include <stdlib.h>
7815 #endif
7816 #$i_unistd I_UNISTD
7817 #ifdef I_UNISTD
7818 #include <unistd.h>
7819 #endif
7820 int main() {
7821         char b[4];
7822         int i = open("a.out",O_RDONLY);
7823         if(i == -1)
7824                 exit(1); /* fail */
7825         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7826                 exit(0); /* succeed (yes, it's ELF) */
7827         else
7828                 exit(1); /* fail */
7829 }
7830 EOM
7831                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7832                         cat <<EOM
7833 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7834 EOM
7835                         dflt="$cc"
7836                 else
7837                         echo "I'll use ld to build dynamic libraries."
7838                         dflt='ld'
7839                 fi
7840                 $rm_try
7841                 ;;
7842         *)      dflt="$ld"
7843                 ;;
7844         esac
7845
7846     rp="What command should be used to create dynamic libraries?"
7847     . ./myread
7848         ld="$ans"
7849
7850     cat << EOM
7851
7852 Some systems may require passing special flags to $ld to create a
7853 library that can be dynamically loaded.  If your ld flags include
7854 -L/other/path options to locate libraries outside your loader's normal
7855 search path, you may need to specify those -L options here as well.  To
7856 use no flags, say "none".
7857
7858 EOM
7859     case "$lddlflags" in
7860     '') case "$osname" in
7861                         beos) dflt='-nostart' ;;
7862                         hpux) dflt='-b';
7863                               case "$gccversion" in
7864                               '') dflt="$dflt +vnocompatwarnings" ;;
7865                               esac
7866                               ;;
7867                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7868                         next)  dflt='none' ;;
7869                         solaris) dflt='-G' ;;
7870                         sunos) dflt='-assert nodefinitions' ;;
7871                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7872                 *)     dflt='none' ;;
7873                         esac
7874                         ;;
7875     *) dflt="$lddlflags" ;;
7876     esac
7877
7878         : Try to guess additional flags to pick up local libraries.
7879         : Be careful not to append to a plain 'none'
7880         case "$dflt" in
7881         none) dflt='' ;;
7882         esac
7883         for thisflag in $ldflags; do
7884                 case "$thisflag" in
7885                 -L*|-R*|-Wl,-R*)
7886                         case " $dflt " in
7887                         *" $thisflag "*) ;;
7888                         *) dflt="$dflt $thisflag" ;;
7889                         esac
7890                         ;;
7891                 esac
7892         done
7893
7894         case "$dflt" in
7895         ''|' ') dflt='none' ;;
7896         esac
7897
7898     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7899     . ./myread
7900     case "$ans" in
7901     none) lddlflags=' ' ;;
7902     *) lddlflags="$ans" ;;
7903     esac
7904
7905         cat <<EOM
7906
7907 Some systems may require passing special flags to $cc to indicate that
7908 the resulting executable will use dynamic linking.  To use no flags,
7909 say "none".
7910
7911 EOM
7912     case "$ccdlflags" in
7913     '') case "$osname" in
7914             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7915             next|sunos) dflt='none' ;;
7916             *)          dflt='none' ;;
7917             esac ;;
7918     ' ')  dflt='none' ;;
7919     *)  dflt="$ccdlflags" ;;
7920     esac
7921     rp="Any special flags to pass to $cc to use dynamic linking?"
7922     . ./myread
7923     case "$ans" in
7924     none) ccdlflags=' ' ;;
7925     *) ccdlflags="$ans" ;;
7926     esac
7927     ;;
7928 *)  usedl="$undef"
7929         ld='ld'
7930     dlsrc='dl_none.xs'
7931     lddlflags=''
7932     ccdlflags=''
7933     ;;
7934 esac
7935
7936 also=''
7937 case "$usedl" in
7938 $undef)
7939         # No dynamic loading being used, so don't bother even to prompt.
7940         useshrplib='false'
7941         ;;
7942 *)      case "$useshrplib" in
7943         '')     case "$osname" in
7944                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7945                         dflt=y
7946                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7947                         ;;
7948                 next*)
7949                         case "$osvers" in
7950                         4*)     dflt=y
7951                                 also='Building a shared libperl is needed for MAB support.'
7952                                 ;;
7953                         *)      dflt=n
7954                                 ;;
7955                         esac
7956                         ;;
7957                 *)      dflt=n
7958                         ;;
7959                 esac
7960                 ;;
7961         $define|true|[Yy]*)
7962                 dflt=y
7963                 ;;
7964         *)      dflt=n
7965                 ;;
7966         esac
7967         $cat << EOM
7968
7969 The perl executable is normally obtained by linking perlmain.c with
7970 libperl${_a}, any static extensions (usually just DynaLoader), and
7971 any other libraries needed on this system (such as -lm, etc.).  Since
7972 your system supports dynamic loading, it is probably possible to build
7973 a shared libperl.$so.  If you will have more than one executable linked
7974 to libperl.$so, this will significantly reduce the size of each
7975 executable, but it may have a noticeable effect on performance.  The
7976 default is probably sensible for your system.
7977 $also
7978
7979 EOM
7980         rp="Build a shared libperl.$so (y/n)"
7981         . ./myread
7982         case "$ans" in
7983         true|$define|[Yy]*)
7984                 useshrplib='true'  ;;
7985         *)      useshrplib='false' ;;
7986         esac
7987         ;;
7988 esac
7989
7990 case "$useshrplib" in
7991 true)
7992         case "$libperl" in
7993         '')
7994                 # Figure out a good name for libperl.so.  Since it gets stored in
7995                 # a version-specific architecture-dependent library, the version
7996                 # number isn't really that important, except for making cc/ld happy.
7997                 #
7998                 # A name such as libperl.so.3.1
7999                 majmin="libperl.$so.$patchlevel.$subversion"
8000                 # A name such as libperl.so.301
8001                 majonly=`echo $patchlevel $subversion |
8002                         $awk '{printf "%d%02d", $1, $2}'`
8003                 majonly=libperl.$so.$majonly
8004                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8005                 # rely on figuring it out from the naming of libc.
8006                 case "${osname}${osvers}" in
8007                 next4*)
8008                         dflt=libperl.5.$so
8009                         # XXX How handle the --version stuff for MAB?
8010                         ;;
8011                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8012                         dflt=libperl.$so
8013                         ;;
8014                 cygwin*) # ld links against an importlib
8015                         dflt=libperl$lib_ext
8016                         ;;
8017                 *)      # Try to guess based on whether libc has major.minor.
8018                         case "$libc" in
8019                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8020                         *libc.$so.[0-9]*) dflt=$majonly ;;
8021                         *)      dflt=libperl.$so ;;
8022                         esac
8023                         ;;
8024                 esac
8025                 ;;
8026         *)      dflt=$libperl
8027                 ;;
8028         esac
8029         cat << EOM
8030
8031 I need to select a good name for the shared libperl.  If your system uses
8032 library names with major and minor numbers, then you might want something
8033 like $majmin.  Alternatively, if your system uses a single version
8034 number for shared libraries, then you might want to use $majonly.
8035 Or, your system might be quite happy with a simple libperl.$so.
8036
8037 Since the shared libperl will get installed into a version-specific
8038 architecture-dependent directory, the version number of the shared perl
8039 library probably isn't important, so the default should be o.k.
8040
8041 EOM
8042         rp='What name do you want to give to the shared libperl?'
8043         . ./myread
8044         libperl=$ans
8045         echo "Ok, I'll use $libperl"
8046         ;;
8047 *)
8048         libperl="libperl${_a}"
8049         ;;
8050 esac
8051
8052 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8053 case "$shrpdir" in
8054 '') ;;
8055 *)      $cat >&4 <<EOM
8056 WARNING:  Use of the shrpdir variable for the installation location of
8057 the shared $libperl is not supported.  It was never documented and
8058 will not work in this version.  Let me (perlbug@perl.org)
8059 know of any problems this may cause.
8060
8061 EOM
8062         case "$shrpdir" in
8063         "$archlibexp/CORE")
8064                 $cat >&4 <<EOM
8065 But your current setting of $shrpdir is
8066 the default anyway, so it's harmless.
8067 EOM
8068                 ;;
8069         *)
8070                 $cat >&4 <<EOM
8071 Further, your current attempted setting of $shrpdir
8072 conflicts with the value of $archlibexp/CORE
8073 that installperl will use.
8074 EOM
8075                 ;;
8076         esac
8077         ;;
8078 esac
8079
8080 # How will the perl executable find the installed shared $libperl?
8081 # Add $xxx to ccdlflags.
8082 # If we can't figure out a command-line option, use $shrpenv to
8083 # set env LD_RUN_PATH.  The main perl makefile uses this.
8084 shrpdir=$archlibexp/CORE
8085 xxx=''
8086 tmp_shrpenv=''
8087 if "$useshrplib"; then
8088     case "$osname" in 
8089         aix)
8090                 # We'll set it in Makefile.SH...
8091                 ;;
8092         solaris)
8093                 xxx="-R $shrpdir"
8094                 ;;
8095         freebsd|netbsd|openbsd|interix|dragonfly)
8096                 xxx="-Wl,-R$shrpdir"
8097                 ;;
8098         bsdos|linux|irix*|dec_osf|gnu*)
8099                 xxx="-Wl,-rpath,$shrpdir"
8100                 ;;
8101         next)
8102                 # next doesn't like the default...
8103                 ;;
8104         beos)
8105                 # beos doesn't like the default, either.
8106                 ;;
8107         hpux*)
8108                 # hpux doesn't like the default, either.
8109                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8110                 ;;
8111         *)
8112                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8113                 ;;
8114         esac
8115         case "$xxx" in
8116         '') ;;
8117         *)      
8118                 # Only add $xxx if it isn't already in ccdlflags.
8119                 case " $ccdlflags " in
8120                 *" $xxx "*)     ;;
8121                 *)      ccdlflags="$ccdlflags $xxx"
8122                         cat <<EOM >&4
8123
8124 Adding $xxx to the flags
8125 passed to $ld so that the perl executable will find the 
8126 installed shared $libperl.
8127
8128 EOM
8129                         ;;
8130                 esac
8131                 ;;
8132         esac
8133 fi
8134 # Fix ccdlflags in AIX for building external extensions.
8135 # (For building Perl itself bare -bE:perl.exp is needed,
8136 #  Makefile.SH takes care of this.)
8137 case "$osname" in
8138 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8139 esac
8140 # Respect a hint or command-line value.
8141 case "$shrpenv" in
8142 '') shrpenv="$tmp_shrpenv" ;;
8143 esac
8144 case "$ldlibpthname" in
8145 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8146 none)   ldlibpthname='' ;;
8147 esac
8148
8149 : determine where manual pages are on this system
8150 echo " "
8151 case "$sysman" in
8152 '') 
8153         syspath='/usr/share/man/man1 /usr/man/man1'
8154         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8155         syspath="$syspath /usr/man/u_man/man1"
8156         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8157         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8158         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8159         sysman=`./loc . /usr/man/man1 $syspath`
8160         ;;
8161 esac
8162 if $test -d "$sysman"; then
8163         echo "System manual is in $sysman." >&4
8164 else
8165         echo "Could not find manual pages in source form." >&4
8166 fi
8167
8168 : determine where manual pages go
8169 set man1dir man1dir none
8170 eval $prefixit
8171 $cat <<EOM
8172
8173 $spackage has manual pages available in source form.
8174 EOM
8175 case "$nroff" in
8176 nroff)
8177         echo "However, you don't have nroff, so they're probably useless to you."
8178         case "$man1dir" in
8179         '') man1dir="none";;
8180         esac;;
8181 esac
8182 echo "If you don't want the manual sources installed, answer 'none'."
8183 case "$man1dir" in
8184 ' ') dflt=none
8185         ;;
8186 '')
8187         lookpath="$prefixexp/share/man/man1"
8188         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8189         lookpath="$lookpath $prefixexp/man/p_man/man1"
8190         lookpath="$lookpath $prefixexp/man/u_man/man1"
8191         lookpath="$lookpath $prefixexp/man/man.1"
8192         case "$sysman" in
8193         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8194         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8195         esac
8196         set dflt
8197         eval $prefixup
8198         ;;
8199 *)  dflt="$man1dir"
8200         ;;
8201 esac
8202 echo " "
8203 fn=dn+~
8204 rp="Where do the main $spackage manual pages (source) go?"
8205 . ./getfile
8206 if $test "X$man1direxp" != "X$ansexp"; then
8207         installman1dir=''
8208 fi
8209 prefixvar=man1dir
8210 . ./setprefixvar
8211
8212 case "$man1dir" in
8213 '')     man1dir=' '
8214         installman1dir='';;
8215 esac
8216
8217 : What suffix to use on installed man pages
8218
8219 case "$man1dir" in
8220 ' ')
8221         man1ext='0'
8222         ;;
8223 *)
8224         rp="What suffix should be used for the main $spackage man pages?"
8225         case "$man1ext" in
8226         '')     case "$man1dir" in
8227                 *1)  dflt=1 ;;
8228                 *1p) dflt=1p ;;
8229                 *1pm) dflt=1pm ;;
8230                 *l) dflt=l;;
8231                 *n) dflt=n;;
8232                 *o) dflt=o;;
8233                 *p) dflt=p;;
8234                 *C) dflt=C;;
8235                 *L) dflt=L;;
8236                 *L1) dflt=L1;;
8237                 *) dflt=1;;
8238                 esac
8239                 ;;
8240         *)      dflt="$man1ext";;
8241         esac
8242         . ./myread
8243         man1ext="$ans"
8244         ;;
8245 esac
8246
8247 : see if we can have long filenames
8248 echo " "
8249 first=123456789abcdef
8250 $rm -f $first
8251 if (echo hi >$first) 2>/dev/null; then
8252         if $test -f 123456789abcde; then
8253                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8254                 val="$undef"
8255         else
8256                 echo 'You can have filenames longer than 14 characters.'>&4
8257                 val="$define"
8258         fi
8259 else
8260         $cat <<'EOM'
8261 You can't have filenames longer than 14 chars.
8262 You can't even think about them!
8263 EOM
8264         val="$undef"
8265 fi 
8266 set d_flexfnam
8267 eval $setvar
8268 $rm -rf 123456789abcde*
8269
8270 : determine where library module manual pages go
8271 set man3dir man3dir none
8272 eval $prefixit
8273 $cat <<EOM
8274
8275 $spackage has manual pages for many of the library modules.
8276 EOM
8277
8278 case "$nroff" in
8279 nroff)
8280         $cat <<'EOM'
8281 However, you don't have nroff, so they're probably useless to you.
8282 EOM
8283         case "$man3dir" in
8284         '') man3dir="none";;
8285         esac;;
8286 esac
8287
8288 case "$d_flexfnam" in
8289 undef)
8290         $cat <<'EOM'
8291 However, your system can't handle the long file names like File::Basename.3.
8292 EOM
8293         case "$man3dir" in
8294         '') man3dir="none";;
8295         esac;;
8296 esac
8297
8298 echo "If you don't want the manual sources installed, answer 'none'."
8299 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8300 case "$man3dir" in
8301 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8302         if $test -d "$privlib/man/man3"; then
8303                 cat <<EOM >&4
8304
8305 WARNING:  Previous versions of perl installed man3 pages into
8306 $privlib/man/man3.  This version will suggest a
8307 new default of $dflt.
8308 EOM
8309                 tdflt=$dflt
8310                 dflt='n'
8311                 rp='Do you wish to preserve the old behavior?(y/n)'
8312                 . ./myread
8313                 case "$ans" in
8314                 y*) dflt="$privlib/man/man3" ;;
8315                 *)  dflt=$tdflt ;;
8316                 esac
8317     fi
8318         ;;
8319 *)      dflt="$man3dir" ;;
8320 esac
8321 case "$dflt" in
8322 ' ') dflt=none ;;
8323 esac
8324 echo " "
8325 fn=dn+~
8326 rp="Where do the $package library man pages (source) go?"
8327 . ./getfile
8328 prefixvar=man3dir
8329 . ./setprefixvar
8330
8331 case "$man3dir" in
8332 '')     man3dir=' '
8333         installman3dir='';;
8334 esac
8335
8336 : What suffix to use on installed man pages
8337 case "$man3dir" in
8338 ' ')
8339         man3ext='0'
8340         ;;
8341 *)
8342         rp="What suffix should be used for the $package library man pages?"
8343         case "$man3ext" in
8344         '')     case "$man3dir" in
8345                 *3)  dflt=3 ;;
8346                 *3p) dflt=3p ;;
8347                 *3pm) dflt=3pm ;;
8348                 *l) dflt=l;;
8349                 *n) dflt=n;;
8350                 *o) dflt=o;;
8351                 *p) dflt=p;;
8352                 *C) dflt=C;;
8353                 *L) dflt=L;;
8354                 *L3) dflt=L3;;
8355                 *) dflt=3;;
8356                 esac
8357                 ;;
8358         *)      dflt="$man3ext";;
8359         esac
8360         . ./myread
8361         man3ext="$ans"
8362         ;;
8363 esac
8364
8365 : see if we have to deal with yellow pages, now NIS.
8366 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8367         if $test -f /usr/etc/nibindd; then
8368                 echo " "
8369                 echo "I'm fairly confident you're on a NeXT."
8370                 echo " "
8371                 rp='Do you get the hosts file via NetInfo?'
8372                 dflt=y
8373                 case "$hostcat" in
8374                 nidump*) ;;
8375                 '') ;;
8376                 *) dflt=n;;
8377                 esac
8378                 . ./myread
8379                 case "$ans" in
8380                 y*) hostcat='nidump hosts .';;
8381                 *)      case "$hostcat" in
8382                         nidump*) hostcat='';;
8383                         esac
8384                         ;;
8385                 esac
8386         fi
8387         case "$hostcat" in
8388         nidump*) ;;
8389         *)
8390                 case "$hostcat" in
8391                 *ypcat*) dflt=y;;
8392                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8393                                 dflt=y
8394                         else
8395                                 dflt=n
8396                         fi;;
8397                 *) dflt=n;;
8398                 esac
8399                 echo " "
8400                 rp='Are you getting the hosts file via yellow pages?'
8401                 . ./myread
8402                 case "$ans" in
8403                 y*) hostcat='ypcat hosts';;
8404                 *) hostcat='cat /etc/hosts';;
8405                 esac
8406                 ;;
8407         esac
8408 fi
8409 case "$hostcat" in
8410 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8411 esac
8412 case "$groupcat" in
8413 '') test -f /etc/group && groupcat='cat /etc/group';;
8414 esac
8415 case "$passcat" in
8416 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8417 esac
8418
8419 : now get the host name
8420 echo " "
8421 echo "Figuring out host name..." >&4
8422 case "$myhostname" in
8423 '') cont=true
8424         echo 'Maybe "hostname" will work...'
8425         if tans=`sh -c hostname 2>&1` ; then
8426                 myhostname=$tans
8427                 phostname=hostname
8428                 cont=''
8429         fi
8430         ;;
8431 *) cont='';;
8432 esac
8433 if $test "$cont"; then
8434         if ./xenix; then
8435                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8436                 if tans=`cat /etc/systemid 2>&1` ; then
8437                         myhostname=$tans
8438                         phostname='cat /etc/systemid'
8439                         echo "Whadyaknow.  Xenix always was a bit strange..."
8440                         cont=''
8441                 fi
8442         elif $test -r /etc/systemid; then
8443                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8444         fi
8445 fi
8446 if $test "$cont"; then
8447         echo 'No, maybe "uuname -l" will work...'
8448         if tans=`sh -c 'uuname -l' 2>&1` ; then
8449                 myhostname=$tans
8450                 phostname='uuname -l'
8451         else
8452                 echo 'Strange.  Maybe "uname -n" will work...'
8453                 if tans=`sh -c 'uname -n' 2>&1` ; then
8454                         myhostname=$tans
8455                         phostname='uname -n'
8456                 else
8457                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8458                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8459                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8460                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8461                         else
8462                                 case "$myhostname" in
8463                                 '') echo "Does this machine have an identity crisis or something?"
8464                                         phostname='';;
8465                                 *)
8466                                         echo "Well, you said $myhostname before..."
8467                                         phostname='echo $myhostname';;
8468                                 esac
8469                         fi
8470                 fi
8471         fi
8472 fi
8473 case "$myhostname" in
8474 '') myhostname=noname ;;
8475 esac
8476 : you do not want to know about this
8477 set $myhostname
8478 myhostname=$1
8479
8480 : verify guess
8481 if $test "$myhostname" ; then
8482         dflt=y
8483         rp='Your host name appears to be "'$myhostname'".'" Right?"
8484         . ./myread
8485         case "$ans" in
8486         y*) ;;
8487         *) myhostname='';;
8488         esac
8489 fi
8490
8491 : bad guess or no guess
8492 while $test "X$myhostname" = X ; do
8493         dflt=''
8494         rp="Please type the (one word) name of your host:"
8495         . ./myread
8496         myhostname="$ans"
8497 done
8498
8499 : translate upper to lower if necessary
8500 case "$myhostname" in
8501 *[A-Z]*)
8502         echo "(Normalizing case in your host name)"
8503         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8504         ;;
8505 esac
8506
8507 case "$myhostname" in
8508 *.*)
8509         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8510         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8511         echo "(Trimming domain name from host name--host name is now $myhostname)"
8512         ;;
8513 *) case "$mydomain" in
8514         '')
8515                 {
8516                         test "X$hostcat" = "Xypcat hosts" &&
8517                         ypmatch "$myhostname" hosts 2>/dev/null |\
8518                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8519                         $test -s hosts
8520                 } || {
8521                         test "X$hostcat" != "X" &&
8522                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8523                                         /[       ]$myhostname[  . ]/p" > hosts
8524                 }
8525                 tmp_re="[       . ]"
8526                 if $test -f hosts; then
8527                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8528                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8529                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8530                                 hosts | $sort | $uniq | \
8531                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8532                         case `$echo X$dflt` in
8533                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8534                                 dflt=.
8535                                 ;;
8536                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8537                                 ;;
8538                         esac
8539                 else
8540                         echo "(I cannot locate a hosts database anywhere)"
8541                         dflt=.
8542                 fi
8543                 case "$dflt" in
8544                 .)
8545                         tans=`./loc resolv.conf X /etc /usr/etc`
8546                         if $test -f "$tans"; then
8547                                 echo "(Attempting domain name extraction from $tans)"
8548                                 dflt=.`$sed -n -e 's/   / /g' \
8549                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8550                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8551                                 case "$dflt" in
8552                                 .) dflt=.`$sed -n -e 's/        / /g' \
8553                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8554                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8555                                         ;;
8556                                 esac
8557                         fi
8558                         ;;
8559                 esac
8560                 case "$dflt" in
8561                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8562                         dflt=.`sh -c domainname 2>/dev/null`
8563                         case "$dflt" in
8564                         '') dflt='.';;
8565                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8566                         esac
8567                         ;;
8568                 esac
8569                 case "$dflt$osname" in
8570                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8571                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8572                         ;;
8573                 esac
8574                 case "$dflt" in
8575                 .) echo "(Lost all hope -- silly guess then)"
8576                         dflt='.nonet'
8577                         ;;
8578                 esac
8579                 $rm -f hosts
8580                 ;;
8581         *) dflt="$mydomain";;
8582         esac;;
8583 esac
8584 echo " "
8585 rp="What is your domain name?"
8586 . ./myread
8587 tans="$ans"
8588 case "$ans" in
8589 '') ;;
8590 .*) ;;
8591 *) tans=".$tans";;
8592 esac
8593 mydomain="$tans"
8594
8595 : translate upper to lower if necessary
8596 case "$mydomain" in
8597 *[A-Z]*)
8598         echo "(Normalizing case in your domain name)"
8599         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8600         ;;
8601 esac
8602
8603 : a little sanity check here
8604 case "$phostname" in
8605 '') ;;
8606 *)
8607         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8608         $myhostname$mydomain|$myhostname) ;;
8609         *)
8610                 case "$phostname" in
8611                 sed*)
8612                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8613                         ;;
8614                 *)
8615                         echo "(That doesn't agree with your $phostname command, by the way.)"
8616                         ;;
8617                 esac
8618         ;;
8619         esac
8620         ;;
8621 esac
8622
8623 $cat <<EOM
8624
8625 I need to get your e-mail address in Internet format if possible, i.e.
8626 something like user@host.domain. Please answer accurately since I have
8627 no easy means to double check it. The default value provided below
8628 is most probably close to reality but may not be valid from outside
8629 your organization...
8630
8631 EOM
8632 cont=x
8633 while test "$cont"; do
8634         case "$cf_email" in
8635         '') dflt="$cf_by@$myhostname$mydomain";;
8636         *) dflt="$cf_email";;
8637         esac
8638         rp='What is your e-mail address?'
8639         . ./myread
8640         cf_email="$ans"
8641         case "$cf_email" in
8642         *@*.*) cont='' ;;
8643         *)
8644                 rp='Address does not look like an Internet one.  Use it anyway?'
8645                 case "$fastread" in
8646                 yes) dflt=y ;;
8647                 *) dflt=n ;;
8648                 esac
8649                 . ./myread
8650                 case "$ans" in
8651                 y*) cont='' ;;
8652                 *) echo " " ;;
8653                 esac
8654                 ;;
8655         esac
8656 done
8657
8658 $cat <<EOM
8659
8660 If you or somebody else will be maintaining perl at your site, please
8661 fill in the correct e-mail address here so that they may be contacted
8662 if necessary. Currently, the "perlbug" program included with perl
8663 will send mail to this address in addition to perlbug@perl.org. You may
8664 enter "none" for no administrator.
8665
8666 EOM
8667 case "$perladmin" in
8668 '') dflt="$cf_email";;
8669 *) dflt="$perladmin";;
8670 esac
8671 rp='Perl administrator e-mail address'
8672 . ./myread
8673 perladmin="$ans"
8674
8675 : determine whether to only install version-specific parts.
8676 echo " "
8677 $cat <<EOM
8678 Do you want to install only the version-specific parts of the perl
8679 distribution?  Usually you do *not* want to do this.
8680 EOM
8681 case "$versiononly" in
8682 "$define"|[Yy]*|true) dflt='y' ;;
8683 *) dflt='n';
8684 esac
8685 rp="Do you want to install only the version-specific parts of perl?"
8686 . ./myread
8687 case "$ans" in
8688 [yY]*)  val="$define";;
8689 *)      val="$undef" ;;
8690 esac
8691 set versiononly
8692 eval $setvar
8693
8694 case "$versiononly" in
8695 "$define") inc_version_list=''
8696            inc_version_list_init=0
8697            ;;
8698 esac
8699
8700 : figure out how to guarantee perl startup
8701 : XXX Note that this currently takes advantage of the bug that binexp ignores
8702 :     the Configure -Dinstallprefix setting, which in turn means that under
8703 :     relocatable @INC, initialinstalllocation is what binexp started as.
8704 case "$startperl" in
8705 '')
8706         case "$sharpbang" in
8707         *!)
8708                 $cat <<EOH
8709
8710 I can use the #! construct to start perl on your system. This will
8711 make startup of perl scripts faster, but may cause problems if you
8712 want to share those scripts and perl is not in a standard place
8713 ($initialinstalllocation/perl) on all your platforms. The alternative
8714 is to force a shell by starting the script with a single ':' character.
8715
8716 EOH
8717                 case "$versiononly" in
8718                 "$define")      dflt="$initialinstalllocation/perl$version";;
8719                 *)              dflt="$initialinstalllocation/perl";;
8720                 esac
8721                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8722                 . ./myread
8723                 case "$ans" in
8724                 none)   startperl=": # use perl";;
8725                 *)      startperl="#!$ans"
8726                         if $test 30 -lt `echo "$ans" | wc -c`; then
8727                                 $cat >&4 <<EOM
8728
8729 WARNING:  Some systems limit the #! command to 32 characters.
8730 If you experience difficulty running Perl scripts with #!, try
8731 installing Perl in a directory with a shorter pathname.
8732
8733 EOM
8734                         fi ;;
8735                 esac
8736                 ;;
8737         *) startperl=": # use perl"
8738                 ;;
8739         esac
8740         ;;
8741 esac
8742 echo "I'll use $startperl to start perl scripts."
8743
8744 : figure best path for perl in scripts
8745 case "$perlpath" in
8746 '')
8747         case "$versiononly" in
8748         "$define")      perlpath="$initialinstalllocation/perl$version";;
8749         *)              perlpath="$initialinstalllocation/perl";;
8750         esac
8751         case "$startperl" in
8752         *!*) ;;
8753         *)
8754                 $cat <<EOH
8755
8756 I will use the "eval 'exec'" idiom to start Perl on your system.
8757 I can use the full path of your Perl binary for this purpose, but
8758 doing so may cause problems if you want to share those scripts and
8759 Perl is not always in a standard place ($initialinstalllocation/perl).
8760
8761 EOH
8762                 dflt="$initialinstalllocation/perl"
8763                 rp="What path shall I use in \"eval 'exec'\"?"
8764                 . ./myread
8765                 perlpath="$ans"
8766                 ;;
8767         esac
8768         ;;
8769 esac
8770 case "$startperl" in
8771 *!*)    ;;
8772 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8773 esac
8774
8775 : determine where public executable scripts go
8776 set scriptdir scriptdir
8777 eval $prefixit
8778 case "$scriptdir" in
8779 '')
8780         dflt="$bin"
8781         : guess some guesses
8782         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8783         $test -d /usr/share/bin     && dflt=/usr/share/bin
8784         $test -d /usr/local/script  && dflt=/usr/local/script
8785         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8786         $test -d $prefixexp/script  && dflt=$prefixexp/script
8787         set dflt
8788         eval $prefixup
8789         ;;
8790 *)  dflt="$scriptdir"
8791         ;;
8792 esac
8793 $cat <<EOM
8794
8795 Some installations have a separate directory just for executable scripts so
8796 that they can mount it across multiple architectures but keep the scripts in
8797 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8798 Or you might just lump your scripts in with all your other executables.
8799
8800 EOM
8801 fn=d~
8802 rp='Where do you keep publicly executable scripts?'
8803 . ./getfile
8804 if $test "X$ansexp" != "X$scriptdirexp"; then
8805         installscript=''
8806 fi
8807 installscriptdir=''
8808 prefixvar=scriptdir
8809 . ./setprefixvar
8810 : A little fix up for an irregularly named variable.
8811 installscript="$installscriptdir"
8812
8813 : determine where add-on public executables go
8814 case "$sitebin" in
8815 '')     dflt=$siteprefix/bin ;;
8816 *)      dflt=$sitebin ;;
8817 esac
8818 fn=d~
8819 rp='Pathname where the add-on public executables should be installed?'
8820 . ./getfile
8821 prefixvar=sitebin
8822 . ./setprefixvar
8823
8824 : determine where add-on html pages go
8825 : There is no standard location, so try to copy the previously-selected
8826 : directory structure for the core html pages.
8827 case "$sitehtml1dir" in
8828 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8829 *)     dflt=$sitehtml1dir ;;
8830 esac
8831 case "$dflt" in
8832 ''|' ') dflt=none ;;
8833 esac
8834 fn=dn+~
8835 rp='Pathname where the site-specific html pages should be installed?'
8836 . ./getfile
8837 prefixvar=sitehtml1dir
8838 . ./setprefixvar
8839
8840 : determine where add-on library html pages go
8841 : There is no standard location, so try to copy the previously-selected
8842 : directory structure for the core html pages.
8843 case "$sitehtml3dir" in
8844 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8845 *)     dflt=$sitehtml3dir ;;
8846 esac
8847 case "$dflt" in
8848 ''|' ') dflt=none ;;
8849 esac
8850 fn=dn+~
8851 rp='Pathname where the site-specific library html pages should be installed?'
8852 . ./getfile
8853 prefixvar=sitehtml3dir
8854 . ./setprefixvar
8855
8856 : determine where add-on manual pages go
8857 case "$siteman1dir" in
8858 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8859 *)      dflt=$siteman1dir ;;
8860 esac
8861 case "$dflt" in
8862 ''|' ') dflt=none ;;
8863 esac
8864 fn=dn+~
8865 rp='Pathname where the site-specific manual pages should be installed?'
8866 . ./getfile
8867 prefixvar=siteman1dir
8868 . ./setprefixvar
8869
8870 : determine where add-on library man pages go
8871 case "$siteman3dir" in
8872 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8873 *)      dflt=$siteman3dir ;;
8874 esac
8875 case "$dflt" in
8876 ''|' ') dflt=none ;;
8877 esac
8878 fn=dn+~
8879 rp='Pathname where the site-specific library manual pages should be installed?'
8880 . ./getfile
8881 prefixvar=siteman3dir
8882 . ./setprefixvar
8883
8884 : determine where add-on public executable scripts go
8885 case "$sitescript" in
8886 '')     dflt=$siteprefix/script
8887         $test -d $dflt || dflt=$sitebin ;;
8888 *)  dflt="$sitescript" ;;
8889 esac
8890 fn=d~+
8891 rp='Pathname where add-on public executable scripts should be installed?'
8892 . ./getfile
8893 prefixvar=sitescript
8894 . ./setprefixvar
8895
8896 case "$usefaststdio" in
8897 $define|true|[yY]*|'')
8898         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8899         case "$xversion" in
8900         [68])   dflt='y' ;;
8901         *)      dflt='n' ;;
8902         esac
8903         ;;
8904 *) dflt='n';;
8905 esac
8906 cat <<EOM
8907
8908 Perl can be built to use 'fast stdio', which means using the stdio
8909 library but also directly manipulating the stdio buffers to enable
8910 faster I/O.  Using stdio is better for backward compatibility (especially
8911 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8912 interface has been preferred instead of stdio.
8913
8914 If this doesn't make any sense to you, just accept the default '$dflt'.
8915 EOM
8916 rp='Use the "fast stdio" if available?'
8917 . ./myread
8918 case "$ans" in
8919 y|Y)    val="$define" ;;     
8920 *)      val="$undef" ;;
8921 esac
8922 set usefaststdio
8923 eval $setvar
8924
8925
8926 : define an is-a-typedef? function
8927 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8928 case "$inclist" in
8929 "") inclist="sys/types.h";;
8930 esac;
8931 eval "varval=\$$var";
8932 case "$varval" in
8933 "")
8934         $rm -f temp.c;
8935         for inc in $inclist; do
8936                 echo "#include <$inc>" >>temp.c;
8937         done;
8938         echo "#ifdef $type" >> temp.c;
8939         echo "printf(\"We have $type\");" >> temp.c;
8940         echo "#endif" >> temp.c;
8941         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8942         if $contains $type temp.E >/dev/null 2>&1; then
8943                 eval "$var=\$type";
8944         else
8945                 eval "$var=\$def";
8946         fi;
8947         $rm -f temp.?;;
8948 *) eval "$var=\$varval";;
8949 esac'
8950
8951 : define an is-a-typedef? function that prompts if the type is not available.
8952 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8953 case "$inclist" in
8954 "") inclist="sys/types.h";;
8955 esac;
8956 eval "varval=\$$var";
8957 case "$varval" in
8958 "")
8959         $rm -f temp.c;
8960         for inc in $inclist; do
8961                 echo "#include <$inc>" >>temp.c;
8962         done;
8963         echo "#ifdef $type" >> temp.c;
8964         echo "printf(\"We have $type\");" >> temp.c;
8965         echo "#endif" >> temp.c;
8966         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8967         echo " " ;
8968         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8969         if $contains $type temp.E >/dev/null 2>&1; then
8970                 echo "$type found." >&4;
8971                 eval "$var=\$type";
8972         else
8973                 echo "$type NOT found." >&4;
8974                 dflt="$def";
8975                 . ./myread ;
8976                 eval "$var=\$ans";
8977         fi;
8978         $rm -f temp.?;;
8979 *) eval "$var=\$varval";;
8980 esac'
8981
8982 : see what type lseek is declared as in the kernel
8983 rp="What is the type used for lseek's offset on this system?"
8984 set off_t lseektype long stdio.h sys/types.h
8985 eval $typedef_ask
8986
8987 echo " "
8988 echo "Checking to see how big your file offsets are..." >&4
8989 $cat >try.c <<EOCP
8990 #include <sys/types.h>
8991 #include <stdio.h>
8992 int main()
8993 {
8994     printf("%d\n", (int)sizeof($lseektype));
8995     return(0);
8996 }
8997 EOCP
8998 set try
8999 if eval $compile_ok; then
9000         lseeksize=`$run ./try`
9001         echo "Your file offsets are $lseeksize bytes long."
9002 else
9003         dflt=$longsize
9004         echo " "
9005         echo "(I can't seem to compile the test program.  Guessing...)"
9006         rp="What is the size of your file offsets (in bytes)?"
9007         . ./myread
9008         lseeksize="$ans"
9009 fi
9010 $rm_try
9011
9012 : see what type file positions are declared as in the library
9013 rp="What is the type for file position used by fsetpos()?"
9014 set fpos_t fpostype long stdio.h sys/types.h
9015 eval $typedef_ask
9016
9017 echo " "
9018 case "$fpostype" in
9019 *_t) zzz="$fpostype"    ;;
9020 *)   zzz="fpos_t"       ;;
9021 esac
9022 echo "Checking the size of $zzz..." >&4 
9023 cat > try.c <<EOCP
9024 #include <sys/types.h>
9025 #include <stdio.h>
9026 #$i_stdlib I_STDLIB
9027 #ifdef I_STDLIB
9028 #include <stdlib.h>
9029 #endif
9030 int main() {
9031     printf("%d\n", (int)sizeof($fpostype));
9032     exit(0);
9033 }
9034 EOCP
9035 set try
9036 if eval $compile_ok; then
9037         yyy=`$run ./try`
9038         case "$yyy" in
9039         '')     fpossize=4
9040                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9041                 ;;
9042         *)      fpossize=$yyy
9043                 echo "Your $zzz is $fpossize bytes long."
9044                 ;;
9045         esac
9046 else
9047         dflt="$longsize"
9048         echo " " >&4
9049         echo "(I can't compile the test program.  Guessing...)" >&4
9050         rp="What is the size of your file positions (in bytes)?"
9051         . ./myread
9052         fpossize="$ans"
9053 fi
9054
9055 # Backward compatibility (uselfs is deprecated).
9056 case "$uselfs" in
9057 "$define"|true|[yY]*)
9058         cat <<EOM >&4
9059
9060 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9061 EOM
9062         uselargefiles="$define"
9063         ;;
9064 esac
9065
9066 case "$lseeksize:$fpossize" in
9067 8:8) cat <<EOM
9068
9069 You can have files larger than 2 gigabytes.
9070 EOM
9071    val="$define" ;;
9072 *)    case "$uselargefiles" in
9073    "$undef"|false|[nN]*) dflt='n' ;;
9074    *)   dflt='y' ;;
9075    esac
9076    cat <<EOM
9077
9078 Perl can be built to understand large files (files larger than 2 gigabytes)
9079 on some systems.  To do so, Configure can be run with -Duselargefiles.
9080
9081 If this doesn't make any sense to you, just accept the default '$dflt'.
9082 EOM
9083    rp='Try to understand large files, if available?'
9084    . ./myread
9085    case "$ans" in
9086    y|Y)         val="$define" ;;
9087    *)           val="$undef"  ;;
9088    esac
9089    ;;
9090 esac
9091 set uselargefiles
9092 eval $setvar
9093 : Look for a hint-file generated 'call-back-unit'.  If the
9094 : user has specified that a large files perl is to be built,
9095 : we may need to set or change some other defaults.
9096 if $test -f uselargefiles.cbu; then
9097         echo "Your platform has some specific hints regarding large file builds, using them..."
9098         . ./uselargefiles.cbu
9099 fi
9100 case "$uselargefiles" in
9101 "$define")
9102         if $test -f uselargefiles.cbu; then
9103                 echo " "
9104                 echo "Rechecking to see how big your file offsets are..." >&4
9105                 $cat >try.c <<EOCP
9106 #include <sys/types.h>
9107 #include <stdio.h>
9108 int main()
9109 {
9110     printf("%d\n", (int)sizeof($lseektype));
9111     return(0);
9112 }
9113 EOCP
9114                 set try
9115                 if eval $compile_ok; then
9116                         lseeksize=`$run ./try`
9117                         $echo "Your file offsets are now $lseeksize bytes long."
9118                 else
9119                         dflt="$lseeksize"
9120                         echo " "
9121                         echo "(I can't seem to compile the test program.  Guessing...)"
9122                         rp="What is the size of your file offsets (in bytes)?"
9123                         . ./myread
9124                         lseeksize="$ans"
9125                 fi
9126                 case "$fpostype" in
9127                 *_t) zzz="$fpostype"    ;;
9128                 *)   zzz="fpos_t"       ;;
9129                 esac
9130                 $echo $n "Rechecking the size of $zzz...$c" >&4
9131                 $cat > try.c <<EOCP
9132 #include <sys/types.h>
9133 #include <stdio.h>
9134 #$i_stdlib I_STDLIB
9135 #ifdef I_STDLIB
9136 #include <stdlib.h>
9137 #endif
9138 int main() {
9139     printf("%d\n", (int)sizeof($fpostype));
9140     return(0);
9141 }
9142 EOCP
9143                 set try
9144                 if eval $compile_ok; then
9145                         yyy=`$run ./try`
9146                         dflt="$lseeksize"
9147                         case "$yyy" in
9148                         '')     echo " "
9149                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9150                                 ;;
9151                         *)      fpossize=$yyy
9152                                 echo " $fpossize bytes." >&4
9153                                 ;;
9154                         esac
9155                 else
9156                         dflt="$fpossize"
9157                         echo " "
9158                         echo "(I can't compile the test program.  Guessing...)" >&4
9159                         rp="What is the size of your file positions (in bytes)?"
9160                         . ./myread
9161                         fpossize="$ans"
9162                 fi
9163                 $rm_try
9164         fi
9165         ;;
9166 esac
9167
9168 case "$vendorprefix" in
9169 '')     d_vendorbin="$undef"
9170         vendorbin=''
9171         vendorbinexp=''
9172         ;;
9173 *)      d_vendorbin="$define"
9174         : determine where vendor-supplied executables go.
9175         case "$vendorbin" in
9176         '') dflt=$vendorprefix/bin ;;
9177         *)      dflt="$vendorbin" ;;
9178         esac
9179         fn=d~+
9180         rp='Pathname for the vendor-supplied executables directory?'
9181         . ./getfile
9182         vendorbin="$ans"
9183         vendorbinexp="$ansexp"
9184         ;;
9185 esac
9186 prefixvar=vendorbin
9187 . ./installprefix
9188
9189 case "$vendorprefix" in
9190 '')     vendorhtml1dir=''
9191         vendorhtml1direxp=''
9192         ;;
9193 *)      : determine where vendor-supplied html pages go.
9194         : There is no standard location, so try to copy the previously-selected
9195         : directory structure for the core html pages.
9196         : XXX Better default suggestions would be welcome.
9197         case "$vendorhtml1dir" in
9198         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9199         *)      dflt=$vendorhtml1dir ;;
9200         esac
9201         case "$dflt" in
9202         ''|' ') dflt=none ;;
9203         esac
9204         fn=dn+~
9205         rp='Pathname for the vendor-supplied html pages?'
9206         . ./getfile
9207         vendorhtml1dir="$ans"
9208         vendorhtml1direxp="$ansexp"
9209         ;;
9210 esac
9211 : Use ' ' for none so value is preserved next time through Configure
9212 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9213 prefixvar=vendorhtml1dir
9214 . ./installprefix
9215
9216 case "$vendorprefix" in
9217 '')     vendorhtml3dir=''
9218         vendorhtml3direxp=''
9219         ;;
9220 *)      : determine where vendor-supplied module html pages go.
9221         : There is no standard location, so try to copy the previously-selected
9222         : directory structure for the core html pages.
9223         : XXX Better default suggestions would be welcome.
9224         case "$vendorhtml3dir" in
9225         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9226         *)      dflt=$vendorhtml3dir ;;
9227         esac
9228         case "$dflt" in
9229         ''|' ') dflt=none ;;
9230         esac
9231         fn=dn+~
9232         rp='Pathname for the vendor-supplied html pages?'
9233         . ./getfile
9234         vendorhtml3dir="$ans"
9235         vendorhtml3direxp="$ansexp"
9236         ;;
9237 esac
9238 : Use ' ' for none so value is preserved next time through Configure
9239 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9240 prefixvar=vendorhtml3dir
9241 . ./installprefix
9242
9243 case "$vendorprefix" in
9244 '')     vendorman1dir=''
9245         vendorman1direxp=''
9246         ;;
9247 *)      : determine where vendor-supplied manual pages go.
9248         case "$vendorman1dir" in
9249         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9250         *)      dflt=$vendorman1dir ;;
9251         esac
9252         case "$dflt" in
9253         ''|' ') dflt=none ;;
9254         esac
9255         fn=nd~+
9256         rp='Pathname for the vendor-supplied manual section 1 pages?'
9257         . ./getfile
9258         vendorman1dir="$ans"
9259         vendorman1direxp="$ansexp"
9260         ;;
9261 esac
9262 : Use ' ' for none so value is preserved next time through Configure
9263 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9264 prefixvar=vendorman1dir
9265 . ./installprefix
9266
9267 case "$vendorprefix" in
9268 '')     vendorman3dir=''
9269         vendorman3direxp=''
9270         ;;
9271 *)      : determine where vendor-supplied module manual pages go.
9272         case "$vendorman3dir" in
9273         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9274         *)      dflt=$vendorman3dir ;;
9275         esac
9276         case "$dflt" in
9277         ''|' ') dflt=none ;;
9278         esac
9279         fn=nd~+
9280         rp='Pathname for the vendor-supplied manual section 3 pages?'
9281         . ./getfile
9282         vendorman3dir="$ans"
9283         vendorman3direxp="$ansexp"
9284         ;;
9285 esac
9286 : Use ' ' for none so value is preserved next time through Configure
9287 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9288 prefixvar=vendorman3dir
9289 . ./installprefix
9290
9291 case "$vendorprefix" in
9292 '')     d_vendorscript="$undef"
9293         vendorscript=''
9294         vendorscriptexp=''
9295         ;;
9296 *)      d_vendorscript="$define"
9297         : determine where vendor-supplied scripts go.
9298         case "$vendorscript" in
9299         '')     dflt=$vendorprefix/script
9300                 $test -d $dflt || dflt=$vendorbin ;;
9301         *)  dflt="$vendorscript" ;;
9302         esac
9303         $cat <<EOM
9304
9305 The installation process will create a directory for
9306 vendor-supplied scripts.
9307
9308 EOM
9309         fn=d~+
9310         rp='Pathname for the vendor-supplied scripts directory?'
9311         . ./getfile
9312         vendorscript="$ans"
9313         vendorscriptexp="$ansexp"
9314         ;;
9315 esac
9316 prefixvar=vendorscript
9317 . ./installprefix
9318
9319 : see if qgcvt exists
9320 set qgcvt d_qgcvt
9321 eval $inlibc
9322
9323 echo " "
9324
9325 if $test X"$d_longdbl" = X"$define"; then
9326
9327 echo "Checking how to print long doubles..." >&4
9328
9329 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9330         $cat >try.c <<'EOCP'
9331 #include <sys/types.h>
9332 #include <stdio.h>
9333 int main() {
9334   double d = 123.456;
9335   printf("%.3f\n", d);
9336 }
9337 EOCP
9338         set try
9339         if eval $compile; then
9340                 yyy=`$run ./try`
9341                 case "$yyy" in
9342                 123.456)
9343                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9344                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9345                         echo "We will use %f."
9346                         ;;
9347                 esac
9348         fi
9349 fi
9350
9351 if $test X"$sPRIfldbl" = X; then
9352         $cat >try.c <<'EOCP'
9353 #include <sys/types.h>
9354 #include <stdio.h>
9355 int main() {
9356   long double d = 123.456;
9357   printf("%.3Lf\n", d);
9358 }
9359 EOCP
9360         set try
9361         if eval $compile; then
9362                 yyy=`$run ./try`
9363                 case "$yyy" in
9364                 123.456)
9365                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9366                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9367                         echo "We will use %Lf."
9368                         ;;
9369                 esac
9370         fi
9371 fi
9372
9373 if $test X"$sPRIfldbl" = X; then
9374         $cat >try.c <<'EOCP'
9375 #include <sys/types.h>
9376 #include <stdio.h>
9377 int main() {
9378   long double d = 123.456;
9379   printf("%.3llf\n", d);
9380 }
9381 EOCP
9382         set try
9383         if eval $compile; then
9384                 yyy=`$run ./try`
9385                 case "$yyy" in
9386                 123.456)
9387                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9388                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9389                         echo "We will use %llf."
9390                         ;;
9391                 esac
9392         fi
9393 fi
9394
9395 if $test X"$sPRIfldbl" = X; then
9396         $cat >try.c <<'EOCP'
9397 #include <sys/types.h>
9398 #include <stdio.h>
9399 int main() {
9400   long double d = 123.456;
9401   printf("%.3lf\n", d);
9402 }
9403 EOCP
9404         set try
9405         if eval $compile; then
9406                 yyy=`$run ./try`
9407                 case "$yyy" in
9408                 123.456)
9409                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9410                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9411                         echo "We will use %lf."
9412                         ;;
9413                 esac
9414         fi
9415 fi
9416
9417 if $test X"$sPRIfldbl" = X; then
9418         echo "Cannot figure out how to print long doubles." >&4
9419 else
9420         sSCNfldbl=$sPRIfldbl    # expect consistency
9421 fi
9422
9423 $rm_try
9424
9425 fi # d_longdbl
9426
9427 case "$sPRIfldbl" in
9428 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9429         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9430         d_SCNfldbl="$undef";
9431         ;;
9432 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9433         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9434         d_SCNfldbl="$define";
9435         ;;
9436 esac
9437
9438 : Check how to convert floats to strings.
9439
9440 if test "X$d_Gconvert" = X; then
9441
9442 echo " "
9443 echo "Checking for an efficient way to convert floats to strings."
9444 echo " " > try.c
9445 case "$uselongdouble" in
9446 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9447 esac
9448 case "$d_longdbl" in
9449 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9450 esac
9451 case "$d_PRIgldbl" in
9452 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9453 esac
9454 $cat >>try.c <<EOP
9455 #ifdef TRY_gconvert
9456 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9457 char *myname = "gconvert";
9458 #endif
9459 #ifdef TRY_gcvt
9460 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9461 char *myname = "gcvt";
9462 #endif
9463 #ifdef TRY_qgcvt
9464 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9465 char *myname = "qgcvt";
9466 #define DOUBLETYPE long double
9467 #endif
9468 #ifdef TRY_sprintf
9469 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9470 #ifdef HAS_PRIgldbl
9471 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9472 #else
9473 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9474 #endif
9475 #else
9476 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9477 #endif
9478 char *myname = "sprintf";
9479 #endif
9480
9481 #ifndef DOUBLETYPE
9482 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9483 #define DOUBLETYPE long double
9484 #else
9485 #define DOUBLETYPE double
9486 #endif
9487 #endif
9488
9489 #include <stdio.h>
9490
9491 #define I_STDLIB $i_stdlib
9492 #ifdef I_STDLIB
9493 #include <stdlib.h>
9494 #endif
9495
9496 int
9497 checkit(expect, got)
9498 char *expect;
9499 char *got;
9500 {
9501     if (strcmp(expect, got)) {
9502                 printf("%s oddity:  Expected %s, got %s\n",
9503                         myname, expect, got);
9504                 exit(1);
9505         }
9506 }
9507
9508 int main()
9509 {
9510         char buf[64];
9511         buf[63] = '\0';
9512
9513         /* This must be 1st test on (which?) platform */
9514         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9515         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9516         checkit("0.1", buf);
9517
9518         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9519         checkit("0.01", buf);
9520
9521         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9522         checkit("0.001", buf);
9523
9524         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9525         checkit("0.0001", buf);
9526
9527         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9528         if (strlen(buf) > 5)
9529             checkit("9e-005", buf); /* for Microsoft ?? */
9530         else
9531             checkit("9e-05", buf);
9532
9533         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9534         checkit("1", buf);
9535
9536         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9537         checkit("1.1", buf);
9538
9539         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9540         checkit("1.01", buf);
9541
9542         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9543         checkit("1.001", buf);
9544
9545         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9546         checkit("1.0001", buf);
9547
9548         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9549         checkit("1.00001", buf);
9550
9551         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9552         checkit("1.000001", buf);
9553
9554         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9555         checkit("0", buf);
9556
9557         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9558         checkit("-1", buf);
9559
9560         /* Some Linux gcvt's give 1.e+5 here. */
9561         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9562         checkit("100000", buf);
9563
9564         /* Some Linux gcvt's give -1.e+5 here. */
9565         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9566         checkit("-100000", buf);
9567
9568         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9569         checkit("123.456", buf);
9570
9571         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9572         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9573         /* 34 should be enough to scare even long double
9574          * places into using the e notation. */
9575         if (strlen(buf) > 5)
9576             checkit("1e+034", buf); /* for Microsoft */
9577         else
9578             checkit("1e+34", buf);
9579
9580         /* For Perl, if you add additional tests here, also add them to
9581          * t/base/num.t for benefit of platforms not using Configure or
9582          * overriding d_Gconvert */
9583
9584         exit(0);
9585 }
9586 EOP
9587 : first add preferred functions to our list
9588 xxx_list=""
9589 for xxx_convert in $gconvert_preference; do
9590     case $xxx_convert in
9591     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9592     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9593     esac
9594 done
9595 : then add any others
9596 for xxx_convert in gconvert gcvt sprintf; do
9597     case "$xxx_list" in
9598     *$xxx_convert*) ;;
9599     *) xxx_list="$xxx_list $xxx_convert" ;;
9600     esac
9601 done
9602
9603 case "$d_longdbl$uselongdouble" in
9604 "$define$define")
9605     : again, add prefered functions to our list first
9606     xxx_ld_list=""
9607     for xxx_convert in $gconvert_ld_preference; do
9608         case $xxx_convert in
9609         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9610         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9611         esac
9612     done
9613     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9614     for xxx_convert in qgcvt sprintf $xxx_list; do
9615         case "$xxx_ld_list" in
9616         $xxx_convert*|*" $xxx_convert"*) ;;
9617         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9618         esac
9619     done
9620     : if sprintf cannot do long doubles, move it to the end
9621     if test "$d_PRIgldbl" != "$define"; then
9622         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9623     fi
9624     : if no qgcvt, remove it
9625     if test "$d_qgcvt" != "$define"; then
9626         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9627     fi
9628     : use the ld_list
9629     xxx_list="$xxx_ld_list"
9630     ;;
9631 esac
9632
9633 for xxx_convert in $xxx_list; do
9634         echo "Trying $xxx_convert..."
9635         $rm -f try try$_o core
9636         set try -DTRY_$xxx_convert
9637         if eval $compile; then
9638                 echo "$xxx_convert() found." >&4
9639                 if $run ./try; then
9640                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9641                         break;
9642                 else
9643                         echo "...But $xxx_convert didn't work as I expected."
9644                         xxx_convert=''
9645                 fi
9646         else
9647                 echo "$xxx_convert NOT found." >&4
9648         fi
9649 done
9650
9651 if test X$xxx_convert = X; then
9652     echo "*** WHOA THERE!!! ***" >&4
9653     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9654     xxx_convert=sprintf
9655 fi
9656
9657 case "$xxx_convert" in
9658 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9659 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9660 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9661 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9662    "$define$define$define")
9663       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9664    "$define$define$undef")
9665       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9666    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9667    esac
9668    ;;
9669 esac
9670
9671 fi
9672 $rm_try
9673
9674 : see if _fwalk exists
9675 set fwalk d__fwalk
9676 eval $inlibc
9677
9678 : Initialize h_fcntl
9679 h_fcntl=false
9680
9681 : Initialize h_sysfile
9682 h_sysfile=false
9683
9684 : access call always available on UNIX
9685 set access d_access
9686 eval $inlibc
9687
9688 : locate the flags for 'access()'
9689 case "$d_access" in
9690 "$define")
9691         echo " "
9692         $cat >access.c <<EOCP
9693 #include <sys/types.h>
9694 #ifdef I_FCNTL
9695 #include <fcntl.h>
9696 #endif
9697 #ifdef I_SYS_FILE
9698 #include <sys/file.h>
9699 #endif
9700 #ifdef I_UNISTD
9701 #include <unistd.h>
9702 #endif
9703 #$i_stdlib I_STDLIB
9704 #ifdef I_STDLIB
9705 #include <stdlib.h>
9706 #endif
9707 int main() {
9708         exit(R_OK);
9709 }
9710 EOCP
9711         : check sys/file.h first, no particular reason here
9712         if $test `./findhdr sys/file.h` && \
9713                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9714                 h_sysfile=true;
9715                 echo "<sys/file.h> defines the *_OK access constants." >&4
9716         elif $test `./findhdr fcntl.h` && \
9717                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9718                 h_fcntl=true;
9719                 echo "<fcntl.h> defines the *_OK access constants." >&4
9720         elif $test `./findhdr unistd.h` && \
9721                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9722                 echo "<unistd.h> defines the *_OK access constants." >&4
9723         else
9724                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9725         fi
9726         ;;
9727 esac
9728 $rm -f access*
9729
9730 : see if accessx exists
9731 set accessx d_accessx
9732 eval $inlibc
9733
9734 : see if aintl exists
9735 set aintl d_aintl
9736 eval $inlibc
9737
9738 : see if alarm exists
9739 set alarm d_alarm
9740 eval $inlibc
9741
9742 : see if POSIX threads are available
9743 set pthread.h i_pthread
9744 eval $inhdr
9745
9746 : define a fucntion to check prototypes
9747 $cat > protochk <<EOSH
9748 $startsh
9749 cc="$cc"
9750 optimize="$optimize"
9751 ccflags="$ccflags"
9752 prototype="$prototype"
9753 define="$define"
9754 rm_try="$rm_try"
9755 usethreads=$usethreads
9756 i_pthread=$i_pthread
9757 pthread_h_first=$pthread_h_first
9758 EOSH
9759
9760 $cat >> protochk <<'EOSH'
9761
9762 $rm_try
9763 foo="$1"
9764 shift
9765 while test $# -ge 2; do
9766         case "$1" in
9767                 $define) echo "#include <$2>" >> try.c ;;
9768                 literal) echo "$2" >> try.c ;;
9769         esac
9770     # Extra magic for the benefit of systems that need pthread.h
9771     # to be included early to correctly detect threadsafe functions.
9772     # Such functions must guarantee themselves, though, that the usethreads
9773     # and i_pthread have been defined, before calling protochk.
9774     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9775         echo "#include <pthread.h>" >> try.c
9776         pthread_h_done=yes
9777     fi
9778     shift 2
9779 done
9780 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9781 cat >> try.c <<'EOCP'
9782 #ifdef CAN_PROTOTYPE
9783 #define _(args) args
9784 #else
9785 #define _(args) ()
9786 #endif
9787 EOCP
9788 echo "$foo" >> try.c
9789 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9790 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9791 status=$?
9792 $rm_try
9793 exit $status
9794 EOSH
9795 chmod +x protochk
9796 $eunicefix protochk
9797
9798 hasproto='varname=$1; func=$2; shift; shift;
9799 while $test $# -ge 2; do
9800         case "$1" in
9801         $define) echo "#include <$2>";;
9802         esac ;
9803     shift 2;
9804 done > try.c;
9805 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9806 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9807         echo "$func() prototype found.";
9808         val="$define";
9809 else
9810         echo "$func() prototype NOT found.";
9811         val="$undef";
9812 fi;
9813 set $varname;
9814 eval $setvar;
9815 $rm_try tryout.c'
9816
9817 : see if sys/types.h has to be included
9818 set sys/types.h i_systypes
9819 eval $inhdr
9820
9821 : see if sys/select.h has to be included
9822 set sys/select.h i_sysselct
9823 eval $inhdr
9824
9825 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9826 while $test $# -ge 2; do
9827         case "$1" in
9828         $define) echo "#include <$2>";;
9829         esac ;
9830     shift 2;
9831 done > try.c;
9832 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9833 set try;
9834 if eval $compile; then
9835         val="$define";
9836 else
9837         val="$undef";
9838 fi;
9839 set $varname;
9840 eval $setvar;
9841 $rm_try'
9842
9843 : see if we should include time.h, sys/time.h, or both
9844 echo " "
9845 if test "X$timeincl" = X; then
9846         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9847         $echo $n "I'm now running the test program...$c"
9848         $cat >try.c <<EOCP
9849 #include <sys/types.h>
9850 #ifdef I_TIME
9851 #include <time.h>
9852 #endif
9853 #ifdef I_SYSTIME
9854 #ifdef SYSTIMEKERNEL
9855 #define KERNEL
9856 #endif
9857 #include <sys/time.h>
9858 #endif
9859 #ifdef I_SYSSELECT
9860 #include <sys/select.h>
9861 #endif
9862 #$i_stdlib I_STDLIB
9863 #ifdef I_STDLIB
9864 #include <stdlib.h>
9865 #endif
9866 int main()
9867 {
9868         struct tm foo;
9869 #ifdef S_TIMEVAL
9870         struct timeval bar;
9871 #endif
9872 #ifdef S_TIMEZONE
9873         struct timezone tzp;
9874 #endif
9875         if (foo.tm_sec == foo.tm_sec)
9876                 exit(0);
9877 #ifdef S_TIMEVAL
9878         if (bar.tv_sec == bar.tv_sec)
9879                 exit(0);
9880 #endif
9881         exit(1);
9882 }
9883 EOCP
9884         flags=''
9885         for s_timezone in '-DS_TIMEZONE' ''; do
9886         sysselect=''
9887         for s_timeval in '-DS_TIMEVAL' ''; do
9888         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9889         for i_time in '' '-DI_TIME'; do
9890         for i_systime in '-DI_SYSTIME' ''; do
9891                 case "$flags" in
9892                 '') $echo $n ".$c"
9893                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9894                         if eval $compile; then
9895                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9896                                 shift
9897                                 flags="$*"
9898                                 echo " "
9899                                 $echo $n "Succeeded with $flags$c"
9900                         fi
9901                         ;;
9902                 esac
9903         done
9904         done
9905         done
9906         done
9907         done
9908         timeincl=''
9909         echo " "
9910         case "$flags" in
9911         *SYSTIMEKERNEL*) i_systimek="$define"
9912                 timeincl=`./findhdr sys/time.h`
9913                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9914         *) i_systimek="$undef";;
9915         esac
9916         case "$flags" in
9917         *I_TIME*) i_time="$define"
9918                 timeincl=`./findhdr time.h`" $timeincl"
9919                 echo "We'll include <time.h>." >&4;;
9920         *) i_time="$undef";;
9921         esac
9922         case "$flags" in
9923         *I_SYSTIME*) i_systime="$define"
9924                 timeincl=`./findhdr sys/time.h`" $timeincl"
9925                 echo "We'll include <sys/time.h>." >&4;;
9926         *) i_systime="$undef";;
9927         esac
9928         $rm_try
9929 fi
9930 : see if struct tm knows about tm_zone
9931 case "$i_systime$i_time" in
9932 *$define*)
9933         echo " "
9934         echo "Checking to see if your struct tm has tm_zone field..." >&4
9935         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9936         eval $hasfield
9937         ;;
9938 *)      val="$undef"
9939         set d_tm_tm_zone
9940         eval $setvar
9941         ;;
9942 esac
9943 case "$d_tm_tm_zone" in
9944 "$define")      echo "Yes, it does."   ;;
9945 *)              echo "No, it doesn't." ;;
9946 esac
9947 : see if struct tm knows about tm_gmtoff
9948 case "$i_systime$i_time" in
9949 *$define*)
9950         echo " "
9951         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9952         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9953         eval $hasfield
9954         ;;
9955 *)      val="$undef"
9956         set d_tm_tm_gmtoff
9957         eval $setvar
9958         ;;
9959 esac
9960 case "$d_tm_tm_gmtoff" in
9961 "$define")      echo "Yes, it does."   ;;
9962 *)              echo "No, it doesn't." ;;
9963 esac
9964
9965 : see if asctime_r exists
9966 set asctime_r d_asctime_r
9967 eval $inlibc
9968 case "$d_asctime_r" in
9969 "$define")
9970         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9971         case "$d_asctime_r_proto:$usethreads" in
9972         ":define")      d_asctime_r_proto=define
9973                 set d_asctime_r_proto asctime_r $hdrs
9974                 eval $hasproto ;;
9975         *)      ;;
9976         esac
9977         case "$d_asctime_r_proto" in
9978         define)
9979         case "$asctime_r_proto" in
9980         ''|0) try='char* asctime_r(const struct tm*, char*);'
9981         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9982         esac
9983         case "$asctime_r_proto" in
9984         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9985         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9986         esac
9987         case "$asctime_r_proto" in
9988         ''|0) try='int asctime_r(const struct tm*, char*);'
9989         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9990         esac
9991         case "$asctime_r_proto" in
9992         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9993         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9994         esac
9995         case "$asctime_r_proto" in
9996         ''|0)   d_asctime_r=undef
9997                 asctime_r_proto=0
9998                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9999         * )     case "$asctime_r_proto" in
10000                 REENTRANT_PROTO*) ;;
10001                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10002                 esac
10003                 echo "Prototype: $try" ;;
10004         esac
10005         ;;
10006         *)      case "$usethreads" in
10007                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10008                 esac
10009                 d_asctime_r=undef
10010                 asctime_r_proto=0
10011                 ;;
10012         esac
10013         ;;
10014 *)      asctime_r_proto=0
10015         ;;
10016 esac
10017
10018 : see if atolf exists
10019 set atolf d_atolf
10020 eval $inlibc
10021
10022 : see if atoll exists
10023 set atoll d_atoll
10024 eval $inlibc
10025
10026 : Look for GCC-style attribute format
10027 case "$d_attribute_format" in
10028 '')
10029 echo " "
10030 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10031 $cat >attrib.c <<'EOCP'
10032 #include <stdio.h>
10033 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10034 EOCP
10035 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10036         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10037                 echo "Your C compiler doesn't support __attribute__((format))."
10038                 val="$undef"
10039         else
10040                 echo "Your C compiler supports __attribute__((format))."
10041                 val="$define"
10042         fi
10043 else
10044         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10045         val="$undef"
10046 fi
10047 ;;
10048 *) val="$d_attribute_format" ;;
10049 esac
10050 set d_attribute_format
10051 eval $setvar
10052 $rm -f attrib*
10053
10054 : Look for GCC-style attribute format with null format allowed
10055 case "$d_printf_format_null" in
10056 '') case "$d_attribute_format" in
10057     $define)
10058         echo " "
10059         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10060 $cat >attrib.c <<EOCP
10061 #include <stdio.h>
10062 #$i_stdlib I_STDLIB
10063 #ifdef I_STDLIB
10064 #include <stdlib.h>
10065 #endif
10066 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10067 int null_printf (char* pat,...) { return (int)pat; }
10068 int main () { exit(null_printf(NULL)); }
10069 EOCP
10070         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10071             : run the executable in case it produces a run-time warning
10072             if $run ./attrib >>attrib.out 2>&1; then
10073                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10074                     echo "Your C compiler doesn't allow __printf__ format to be null."
10075                     val="$undef"
10076                 else
10077                     echo "Your C compiler allows __printf__ format to be null."
10078                     val="$define"
10079                 fi
10080             else
10081             echo "Your C compiler executable failed with __printf__ format null."
10082             val="$undef"
10083         fi
10084     else
10085         echo "Your C compiler fails with __printf__ format null."
10086         val="$undef"
10087     fi
10088     ;;
10089     *)  val="$undef" ;;
10090     esac
10091 ;;
10092 *)  val="$d_printf_format_null" ;;
10093 esac
10094 set d_printf_format_null
10095 eval $setvar
10096 $rm -f attrib*
10097
10098 : Look for GCC-style attribute malloc
10099 case "$d_attribute_malloc" in
10100 '')
10101 echo " "
10102 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10103 $cat >attrib.c <<'EOCP'
10104 #include <stdio.h>
10105 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10106 EOCP
10107 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10108         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10109                 echo "Your C compiler doesn't support __attribute__((malloc))."
10110                 val="$undef"
10111         else
10112                 echo "Your C compiler supports __attribute__((malloc))."
10113                 val="$define"
10114         fi
10115 else
10116         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10117         val="$undef"
10118 fi
10119 ;;
10120 *) val="$d_attribute_malloc" ;;
10121 esac
10122 set d_attribute_malloc
10123 eval $setvar
10124 $rm -f attrib*
10125
10126 : Look for GCC-style attribute nonnull
10127 case "$d_attribute_nonnull" in
10128 '')
10129 echo " "
10130 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10131 $cat >attrib.c <<'EOCP'
10132 #include <stdio.h>
10133 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10134 EOCP
10135 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10136         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10137                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10138                 val="$undef"
10139         else
10140                 echo "Your C compiler supports __attribute__((nonnull))."
10141                 val="$define"
10142         fi
10143 else
10144         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10145         val="$undef"
10146 fi
10147 ;;
10148 *) val="$d_attribute_nonnull" ;;
10149 esac
10150 set d_attribute_nonnull
10151 eval $setvar
10152 $rm -f attrib*
10153
10154 : Look for GCC-style attribute noreturn
10155 case "$d_attribute_noreturn" in
10156 '')
10157 echo " "
10158 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10159 $cat >attrib.c <<'EOCP'
10160 #include <stdio.h>
10161 void fall_over_dead( void ) __attribute__((noreturn));
10162 EOCP
10163 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10164         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10165                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10166                 val="$undef"
10167         else
10168                 echo "Your C compiler supports __attribute__((noreturn))."
10169                 val="$define"
10170         fi
10171 else
10172         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10173         val="$undef"
10174 fi
10175 ;;
10176 *) val="$d_attribute_noreturn" ;;
10177 esac
10178 set d_attribute_noreturn
10179 eval $setvar
10180 $rm -f attrib*
10181
10182 : Look for GCC-style attribute pure
10183 case "$d_attribute_pure" in
10184 '')
10185 echo " "
10186 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10187 $cat >attrib.c <<'EOCP'
10188 #include <stdio.h>
10189 int square( int n ) __attribute__((pure));
10190 EOCP
10191 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10192         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10193                 echo "Your C compiler doesn't support __attribute__((pure))."
10194                 val="$undef"
10195         else
10196                 echo "Your C compiler supports __attribute__((pure))."
10197                 val="$define"
10198         fi
10199 else
10200         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10201         val="$undef"
10202 fi
10203 ;;
10204 *) val="$d_attribute_pure" ;;
10205 esac
10206 set d_attribute_pure
10207 eval $setvar
10208 $rm -f attrib*
10209
10210 : Look for GCC-style attribute unused
10211 case "$d_attribute_unused" in
10212 '')
10213 echo " "
10214 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10215 $cat >attrib.c <<'EOCP'
10216 #include <stdio.h>
10217 int do_something( int dummy __attribute__((unused)), int n );
10218 EOCP
10219 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10220         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10221                 echo "Your C compiler doesn't support __attribute__((unused))."
10222                 val="$undef"
10223         else
10224                 echo "Your C compiler supports __attribute__((unused))."
10225                 val="$define"
10226         fi
10227 else
10228         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10229         val="$undef"
10230 fi
10231 ;;
10232 *) val="$d_attribute_unused" ;;
10233 esac
10234 set d_attribute_unused
10235 eval $setvar
10236 $rm -f attrib*
10237
10238 : Look for GCC-style attribute warn_unused_result
10239 case "$d_attribute_warn_unused_result" in
10240 '')
10241 echo " "
10242 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10243 $cat >attrib.c <<'EOCP'
10244 #include <stdio.h>
10245 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10246 EOCP
10247 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10248         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10249                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10250                 val="$undef"
10251         else
10252                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10253                 val="$define"
10254         fi
10255 else
10256         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10257         val="$undef"
10258 fi
10259 ;;
10260 *) val="$d_attribute_warn_unused_result" ;;
10261 esac
10262 set d_attribute_warn_unused_result
10263 eval $setvar
10264 $rm -f attrib*
10265
10266 : see if bcmp exists
10267 set bcmp d_bcmp
10268 eval $inlibc
10269
10270 : see if bcopy exists
10271 set bcopy d_bcopy
10272 eval $inlibc
10273
10274 : see if getpgrp exists
10275 set getpgrp d_getpgrp
10276 eval $inlibc
10277
10278 case "$d_getpgrp" in
10279 "$define")
10280         echo " "
10281         echo "Checking to see which flavor of getpgrp is in use..."
10282         $cat >try.c <<EOP
10283 #$i_unistd I_UNISTD
10284 #include <sys/types.h>
10285 #ifdef I_UNISTD
10286 #  include <unistd.h>
10287 #endif
10288 #$i_stdlib I_STDLIB
10289 #ifdef I_STDLIB
10290 #include <stdlib.h>
10291 #endif
10292 int main()
10293 {
10294         if (getuid() == 0) {
10295                 printf("(I see you are running Configure as super-user...)\n");
10296                 setuid(1);
10297         }
10298 #ifdef TRY_BSD_PGRP
10299         if (getpgrp(1) == 0)
10300                 exit(0);
10301 #else
10302         if (getpgrp() > 0)
10303                 exit(0);
10304 #endif
10305         exit(1);
10306 }
10307 EOP
10308         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10309                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10310                 val="$define"
10311         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10312                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10313                 val="$undef"
10314         else
10315                 echo "I can't seem to compile and run the test program."
10316                 if ./usg; then
10317                         xxx="a USG one, i.e. you use getpgrp()."
10318                 else
10319                         # SVR4 systems can appear rather BSD-ish.
10320                         case "$i_unistd" in
10321                         $undef)
10322                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10323                                 val="$define"
10324                                 ;;
10325                         $define)
10326                                 xxx="probably a USG one, i.e. you use getpgrp()."
10327                                 val="$undef"
10328                                 ;;
10329                         esac
10330                 fi
10331                 echo "Assuming your getpgrp is $xxx" >&4
10332         fi
10333         ;;
10334 *) val="$undef";;
10335 esac
10336 set d_bsdgetpgrp
10337 eval $setvar
10338 $rm_try
10339
10340 : see if setpgrp exists
10341 set setpgrp d_setpgrp
10342 eval $inlibc
10343
10344 case "$d_setpgrp" in
10345 "$define")
10346         echo " "
10347         echo "Checking to see which flavor of setpgrp is in use..."
10348         $cat >try.c <<EOP
10349 #$i_unistd I_UNISTD
10350 #include <sys/types.h>
10351 #ifdef I_UNISTD
10352 #  include <unistd.h>
10353 #endif
10354 #$i_stdlib I_STDLIB
10355 #ifdef I_STDLIB
10356 #include <stdlib.h>
10357 #endif
10358 int main()
10359 {
10360         if (getuid() == 0) {
10361                 printf("(I see you are running Configure as super-user...)\n");
10362                 setuid(1);
10363         }
10364 #ifdef TRY_BSD_PGRP
10365         if (-1 == setpgrp(1, 1))
10366                 exit(0);
10367 #else
10368         if (setpgrp() != -1)
10369                 exit(0);
10370 #endif
10371         exit(1);
10372 }
10373 EOP
10374         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10375                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10376                 val="$define"
10377         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10378                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10379                 val="$undef"
10380         else
10381                 echo "(I can't seem to compile and run the test program.)"
10382                 if ./usg; then
10383                         xxx="a USG one, i.e. you use setpgrp()."
10384                 else
10385                         # SVR4 systems can appear rather BSD-ish.
10386                         case "$i_unistd" in
10387                         $undef)
10388                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10389                                 val="$define"
10390                                 ;;
10391                         $define)
10392                                 xxx="probably a USG one, i.e. you use setpgrp()."
10393                                 val="$undef"
10394                                 ;;
10395                         esac
10396                 fi
10397                 echo "Assuming your setpgrp is $xxx" >&4
10398         fi
10399         ;;
10400 *) val="$undef";;
10401 esac
10402 set d_bsdsetpgrp
10403 eval $setvar
10404 $rm_try
10405
10406 : Look for GCC-style __builtin_choose_expr
10407 case "$d_builtin_choose_expr" in
10408 '')
10409     echo " "
10410     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10411     $cat >try.c <<'EOCP'
10412 #include <assert.h>
10413 #include <stdlib.h>
10414 #include <stdio.h>
10415
10416 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10417
10418 int main(void) {
10419     assert( SYRINX(1) == 2112 );
10420     assert( SYRINX(1) != 5150 );
10421     assert( SYRINX(0) == 5150 );
10422     assert( SYRINX(0) != 2112 );
10423     puts( "All good!" );
10424     exit(0);
10425 }
10426
10427 EOCP
10428     set try
10429     if eval $compile; then
10430         echo "Your C compiler supports __builtin_choose_expr."
10431         val="$define"
10432     else
10433         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10434         val="$undef"
10435     fi
10436 ;;
10437 *) val="$d_builtin_choose_expr" ;;
10438 esac
10439
10440 set d_builtin_choose_expr
10441 eval $setvar
10442 $rm_try
10443
10444 : Look for GCC-style __builtin_expect
10445 case "$d_builtin_expect" in
10446 '')
10447     echo " "
10448     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10449     $cat >builtin.c <<'EOCP'
10450 int main(void) {
10451     int n = 50;
10452     if ( __builtin_expect(n, 0) ) n = 1;
10453 }
10454 EOCP
10455     set try
10456     if eval $compile; then
10457         echo "Your C compiler supports __builtin_choose_expr."
10458         val="$define"
10459     else
10460         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10461         val="$undef"
10462     fi
10463     ;;
10464 *) val="$d_builtin_expect" ;;
10465 esac
10466
10467 set d_builtin_expect
10468 eval $setvar
10469 $rm_try
10470
10471 : see if bzero exists
10472 set bzero d_bzero
10473 eval $inlibc
10474
10475 : see if stdarg is available
10476 echo " "
10477 if $test `./findhdr stdarg.h`; then
10478         echo "<stdarg.h> found." >&4
10479         valstd="$define"
10480 else
10481         echo "<stdarg.h> NOT found." >&4
10482         valstd="$undef"
10483 fi
10484
10485 : see if varags is available
10486 echo " "
10487 if $test `./findhdr varargs.h`; then
10488         echo "<varargs.h> found." >&4
10489 else
10490         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10491 fi
10492
10493 : set up the varargs testing programs
10494 $cat > varargs.c <<EOP
10495 #ifdef I_STDARG
10496 #include <stdarg.h>
10497 #endif
10498 #ifdef I_VARARGS
10499 #include <varargs.h>
10500 #endif
10501
10502 #ifdef I_STDARG
10503 int f(char *p, ...)
10504 #else
10505 int f(va_alist)
10506 va_dcl
10507 #endif
10508 {
10509         va_list ap;
10510 #ifndef I_STDARG
10511         char *p;
10512 #endif
10513 #ifdef I_STDARG
10514         va_start(ap,p);
10515 #else
10516         va_start(ap);
10517         p = va_arg(ap, char *);
10518 #endif
10519         va_end(ap);
10520         return 0;
10521 }
10522 EOP
10523 $cat > varargs <<EOP
10524 $startsh
10525 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10526         echo "true"
10527 else
10528         echo "false"
10529 fi
10530 $rm -f varargs$_o
10531 EOP
10532 chmod +x varargs
10533
10534 : now check which varargs header should be included
10535 echo " "
10536 i_varhdr=''
10537 case "$valstd" in
10538 "$define")
10539         if `./varargs I_STDARG`; then
10540                 val='stdarg.h'
10541         elif `./varargs I_VARARGS`; then
10542                 val='varargs.h'
10543         fi
10544         ;;
10545 *)
10546         if `./varargs I_VARARGS`; then
10547                 val='varargs.h'
10548         fi
10549         ;;
10550 esac
10551 case "$val" in
10552 '')
10553 echo "I could not find the definition for va_dcl... You have problems..." >&4
10554         val="$undef"; set i_stdarg; eval $setvar
10555         val="$undef"; set i_varargs; eval $setvar
10556         ;;
10557 *) 
10558         set i_varhdr
10559         eval $setvar
10560         case "$i_varhdr" in
10561         stdarg.h)
10562                 val="$define"; set i_stdarg; eval $setvar
10563                 val="$undef"; set i_varargs; eval $setvar
10564                 ;;
10565         varargs.h)
10566                 val="$undef"; set i_stdarg; eval $setvar
10567                 val="$define"; set i_varargs; eval $setvar
10568                 ;;
10569         esac
10570         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10571 esac
10572 $rm -f varargs*
10573
10574 : see if the Compiler supports C99 variadic macros
10575 case "$i_stdarg$i_stdlib" in
10576     "$define$define")
10577     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10578     $cat >try.c <<EOCP
10579 #include <stdio.h>
10580 #include <stdarg.h>
10581
10582 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10583
10584 int main() {
10585   char buf[20];
10586   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10587   puts(buf);
10588   return 0;
10589 }
10590 EOCP
10591     set try
10592     if eval $compile && $run ./try 2>&1 >/dev/null; then
10593         case "`$run ./try`" in
10594             "123 456 789")
10595             echo "You have C99 variadic macros." >&4
10596             d_c99_variadic_macros="$define"
10597             ;;
10598             *)
10599             echo "You don't have functional C99 variadic macros." >&4
10600             d_c99_variadic_macros="$undef"
10601             ;;
10602         esac
10603     else
10604         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10605         d_c99_variadic_macros="$undef"
10606     fi
10607     $rm_try
10608     ;;
10609     *)
10610     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10611     d_c99_variadic_macros="$undef"
10612     ;;
10613 esac
10614
10615 : see if signal is declared as pointer to function returning int or void
10616 echo " "
10617 xxx=`./findhdr signal.h`
10618 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10619 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10620         echo "You have int (*signal())() instead of void." >&4
10621         val="$undef"
10622 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10623         echo "You have void (*signal())()." >&4
10624         val="$define"
10625 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10626         echo "You have int (*signal())() instead of void." >&4
10627         val="$undef"
10628 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10629         echo "You have void (*signal())()." >&4
10630         val="$define"
10631 else
10632         case "$d_voidsig" in
10633         '')
10634         echo "I can't determine whether signal handler returns void or int..." >&4
10635                 dflt=void
10636                 rp="What type does your signal handler return?"
10637                 . ./myread
10638                 case "$ans" in
10639                 v*) val="$define";;
10640                 *) val="$undef";;
10641                 esac;;
10642         "$define")
10643                 echo "As you already told me, signal handler returns void." >&4
10644                 val="$define"
10645                 ;;
10646         *)      echo "As you already told me, signal handler returns int." >&4
10647                 val="$undef"
10648                 ;;
10649         esac
10650 fi
10651 set d_voidsig
10652 eval $setvar
10653 case "$d_voidsig" in
10654 "$define") signal_t="void";;
10655 *) signal_t="int";;
10656 esac
10657 $rm -f $$.tmp
10658
10659 : check for ability to cast large floats to 32-bit ints.
10660 echo " "
10661 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10662 if $test "$intsize" -ge 4; then
10663         xxx=int
10664 else
10665         xxx=long
10666 fi
10667 $cat >try.c <<EOCP
10668 #include <stdio.h>
10669 #$i_stdlib I_STDLIB
10670 #ifdef I_STDLIB
10671 #include <stdlib.h>
10672 #endif
10673 #include <sys/types.h>
10674 #include <signal.h>
10675 $signal_t blech(int s) { exit(3); }
10676 int main()
10677 {
10678         $xxx i32;
10679         double f, g;
10680         int result = 0;
10681         char str[16];
10682         signal(SIGFPE, blech);
10683
10684         /* Don't let compiler optimize the test away.  Store the number
10685            in a writable string for gcc to pass to sscanf under HP/UX.
10686         */
10687         sprintf(str, "2147483647");
10688         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10689         g = 10 * f;
10690         i32  = ($xxx) g;
10691
10692         /* x86 processors will probably give 0x8000 0000, which is a
10693            sign change.  We don't want that.  We want to mimic SPARC
10694            behavior here, which is to preserve the sign and give
10695            back 0x7fff ffff.
10696         */
10697         if (i32 != ($xxx) f)
10698                 result |= 1;
10699         exit(result);
10700 }
10701 EOCP
10702 set try
10703 if eval $compile_ok; then
10704         $run ./try
10705         yyy=$?
10706 else
10707         echo "(I can't seem to compile the test program--assuming it can't)"
10708         yyy=1
10709 fi
10710 case "$yyy" in
10711 0)      val="$define"
10712         echo "Yup, it can."
10713         ;;
10714 *)      val="$undef"
10715         echo "Nope, it can't."
10716         ;;
10717 esac
10718 set d_casti32
10719 eval $setvar
10720 $rm_try
10721
10722 : check for ability to cast negative floats to unsigned
10723 echo " "
10724 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10725 $cat >try.c <<EOCP
10726 #include <stdio.h>
10727 #$i_stdlib I_STDLIB
10728 #ifdef I_STDLIB
10729 #include <stdlib.h>
10730 #endif
10731 #include <sys/types.h>
10732 #include <signal.h>
10733 $signal_t blech(int s) { exit(7); }
10734 $signal_t blech_in_list(int s) { exit(4); }
10735 unsigned long dummy_long(unsigned long p) { return p; }
10736 unsigned int dummy_int(unsigned int p) { return p; }
10737 unsigned short dummy_short(unsigned short p) { return p; }
10738 int main()
10739 {
10740         double f;
10741         unsigned long along;
10742         unsigned int aint;
10743         unsigned short ashort;
10744         int result = 0;
10745         char str[16];
10746
10747         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10748            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10749            optimized the whole file away
10750         */
10751         /* Store the number in a writable string for gcc to pass to
10752            sscanf under HP/UX.
10753         */
10754         sprintf(str, "-123");
10755         sscanf(str, "%lf", &f);  /* f = -123.; */
10756
10757         signal(SIGFPE, blech);
10758         along = (unsigned long)f;
10759         aint = (unsigned int)f;
10760         ashort = (unsigned short)f;
10761         if (along != (unsigned long)-123)
10762                 result |= 1;
10763         if (aint != (unsigned int)-123)
10764                 result |= 1;
10765         if (ashort != (unsigned short)-123)
10766                 result |= 1;
10767         sprintf(str, "1073741824.");
10768         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10769         f = f + f;
10770         along = 0;
10771         along = (unsigned long)f;
10772         if (along != 0x80000000)
10773                 result |= 2;
10774         f -= 1.;
10775         along = 0;
10776         along = (unsigned long)f;
10777         if (along != 0x7fffffff)
10778                 result |= 1;
10779         f += 2.;
10780         along = 0;
10781         along = (unsigned long)f;
10782         if (along != 0x80000001)
10783                 result |= 2;
10784         if (result)
10785                 exit(result);
10786         signal(SIGFPE, blech_in_list);
10787         sprintf(str, "123.");
10788         sscanf(str, "%lf", &f);  /* f = 123.; */
10789         along = dummy_long((unsigned long)f);
10790         aint = dummy_int((unsigned int)f);
10791         ashort = dummy_short((unsigned short)f);
10792         if (along != (unsigned long)123)
10793                 result |= 4;
10794         if (aint != (unsigned int)123)
10795                 result |= 4;
10796         if (ashort != (unsigned short)123)
10797                 result |= 4;
10798         exit(result);
10799
10800 }
10801 EOCP
10802 set try
10803 if eval $compile_ok; then
10804         $run ./try
10805         castflags=$?
10806 else
10807         echo "(I can't seem to compile the test program--assuming it can't)"
10808         castflags=7
10809 fi
10810 case "$castflags" in
10811 0)      val="$define"
10812         echo "Yup, it can."
10813         ;;
10814 *)      val="$undef"
10815         echo "Nope, it can't."
10816         ;;
10817 esac
10818 set d_castneg
10819 eval $setvar
10820 $rm_try
10821
10822 : see if vprintf exists
10823 echo " "
10824 if set vprintf val -f d_vprintf; eval $csym; $val; then
10825         echo 'vprintf() found.' >&4
10826         val="$define"
10827         $cat >try.c <<EOF
10828 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10829 #$i_varargs I_VARARGS
10830
10831 #$i_stdlib I_STDLIB
10832 #$i_unistd I_UNISTD
10833
10834 #ifdef I_STDARG
10835 #  include <stdarg.h>
10836 #else /* I_VARARGS */
10837 #  include <varargs.h>
10838 #endif
10839
10840 #ifdef I_UNISTD
10841 #  include <unistd.h>
10842 #endif
10843
10844 #ifdef I_STDLIB
10845 #  include <stdlib.h>
10846 #endif
10847
10848 #include <stdio.h> /* vsprintf prototype */
10849
10850 #ifdef I_STDARG
10851 void xxx(int n, ...)
10852 {
10853     va_list args;
10854     char buf[10];
10855     va_start(args, n);
10856     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10857 }
10858 int main() { xxx(1, "foo"); }
10859
10860 #else /* I_VARARGS */
10861
10862 xxx(va_alist)
10863 va_dcl
10864 {
10865     va_list args;
10866     char buf[10];
10867     va_start(args);
10868     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10869 }
10870 int main() { xxx("foo"); }
10871
10872 #endif
10873
10874 EOF
10875         set try
10876         if eval $compile_ok; then
10877                 if $run ./try; then
10878                         echo "Your vsprintf() returns (int)." >&4
10879                         val2="$undef"
10880                 else
10881                         echo "Your vsprintf() returns (char*)." >&4
10882                         val2="$define"
10883                 fi
10884         else
10885                 echo 'I am unable to compile the vsprintf() test program.' >&4
10886                 # We shouldn't get here.  If we do, assume the standard signature,
10887                 # not the old BSD one.
10888                 echo 'Guessing that vsprintf() returns (int).' >&4
10889                 val2="$undef"
10890         fi
10891 else
10892         echo 'vprintf() NOT found.' >&4
10893         val="$undef"
10894         val2="$undef"
10895 fi
10896 $rm_try
10897 set d_vprintf
10898 eval $setvar
10899 val=$val2
10900 set d_charvspr
10901 eval $setvar
10902
10903 : see if chown exists
10904 set chown d_chown
10905 eval $inlibc
10906
10907 : see if chroot exists
10908 set chroot d_chroot
10909 eval $inlibc
10910
10911 : see if chsize exists
10912 set chsize d_chsize
10913 eval $inlibc
10914
10915 : see if class exists
10916 set class d_class
10917 eval $inlibc
10918
10919 : see if clearenv exists
10920 set clearenv d_clearenv
10921 eval $inlibc
10922
10923 hasstruct='varname=$1; struct=$2; shift; shift;
10924 while $test $# -ge 2; do
10925         case "$1" in
10926         $define) echo "#include <$2>";;
10927         esac ;
10928     shift 2;
10929 done > try.c;
10930 echo "int main () { struct $struct foo; }" >> try.c;
10931 set try;
10932 if eval $compile; then
10933         val="$define";
10934 else
10935         val="$undef";
10936 fi;
10937 set $varname;
10938 eval $setvar;
10939 $rm_try'
10940
10941 socketlib=''
10942 sockethdr=''
10943 : see whether socket exists
10944 echo " "
10945 $echo $n "Hmm... $c" >&4
10946 if set socket val -f d_socket; eval $csym; $val; then
10947         echo "Looks like you have Berkeley networking support." >&4
10948         d_socket="$define"
10949         if set setsockopt val -f; eval $csym; $val; then
10950                 d_oldsock="$undef"
10951         else
10952                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10953                 d_oldsock="$define"
10954         fi
10955 else
10956         if $contains socklib libc.list >/dev/null 2>&1; then
10957                 echo "Looks like you have Berkeley networking support." >&4
10958                 d_socket="$define"
10959                 : we will have to assume that it supports the 4.2 BSD interface
10960                 d_oldsock="$undef"
10961         else
10962                 echo "You don't have Berkeley networking in libc$_a..." >&4
10963                 if test "X$d_socket" = "X$define"; then
10964                    echo "...but you seem to believe that you have sockets." >&4
10965                 else
10966                         for net in net socket
10967                         do
10968                                 if test -f /usr/lib/lib$net$_a; then
10969                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10970                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10971                                         if $contains socket libc.list >/dev/null 2>&1; then
10972                                                 d_socket="$define"
10973                                                 socketlib="-l$net"
10974                                                 case "$net" in
10975                                                 net)
10976                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10977                                                         sockethdr="-I/usr/netinclude"
10978                                                         ;;
10979                                                 esac
10980                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10981                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10982                                                         d_oldsock="$undef"
10983                                                 else
10984                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10985                                                         d_oldsock="$define"
10986                                                 fi
10987                                                 break
10988                                         fi
10989                                 fi
10990                         done
10991                         if test "X$d_socket" != "X$define"; then
10992                            echo "or anywhere else I see." >&4
10993                            d_socket="$undef"
10994                            d_oldsock="$undef"
10995                         fi
10996                 fi
10997         fi
10998 fi
10999
11000 : see if socketpair exists
11001 set socketpair d_sockpair
11002 eval $inlibc
11003
11004
11005 echo " "
11006 echo "Checking the availability of certain socket constants..." >&4
11007 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11008         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11009         $cat >try.c <<EOF
11010 #include <sys/types.h>
11011 #include <sys/socket.h>
11012 int main() {
11013     int i = $ENUM;
11014 }
11015 EOF
11016         val="$undef"
11017         set try; if eval $compile; then
11018                 val="$define"
11019         fi
11020         set d_${enum}; eval $setvar
11021         $rm_try
11022 done
11023
11024 : see if this is a sys/uio.h system
11025 set sys/uio.h i_sysuio
11026 eval $inhdr
11027
11028
11029 echo " "
11030 echo "Checking to see if your system supports struct cmsghdr..." >&4
11031 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11032 eval $hasstruct
11033 case "$d_cmsghdr_s" in
11034 "$define")      echo "Yes, it does."   ;;
11035 *)              echo "No, it doesn't." ;;
11036 esac
11037
11038
11039 : check for const keyword
11040 echo " "
11041 echo 'Checking to see if your C compiler knows about "const"...' >&4
11042 $cat >const.c <<'EOCP'
11043 typedef struct spug { int drokk; } spug;
11044 int main()
11045 {
11046         const char *foo;
11047         const spug y = { 0 };
11048 }
11049 EOCP
11050 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11051         val="$define"
11052         echo "Yup, it does."
11053 else
11054         val="$undef"
11055         echo "Nope, it doesn't."
11056 fi
11057 set d_const
11058 eval $setvar
11059
11060 : see if copysignl exists
11061 set copysignl d_copysignl
11062 eval $inlibc
11063
11064 : see if crypt exists
11065 echo " "
11066 set crypt d_crypt
11067 eval $inlibc
11068 case "$d_crypt" in
11069 $define) cryptlib='' ;;
11070 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11071                 echo 'crypt() found.' >&4
11072                 val="$define"
11073                 cryptlib=''
11074         else
11075                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11076                 if $test -z "$cryptlib"; then
11077                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11078                 else
11079                         cryptlib=-lcrypt
11080                 fi
11081                 if $test -z "$cryptlib"; then
11082                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11083                 else
11084                         cryptlib=-lcrypt
11085                 fi
11086                 if $test -z "$cryptlib"; then
11087                         cryptlib=`./loc libcrypt$_a "" $libpth`
11088                 else
11089                         cryptlib=-lcrypt
11090                 fi
11091                 if $test -z "$cryptlib"; then
11092                         echo 'crypt() NOT found.' >&4
11093                         val="$undef"
11094                 else
11095                         val="$define"
11096                 fi
11097         fi
11098         set d_crypt
11099         eval $setvar
11100         ;;
11101 esac
11102
11103 : see if this is a crypt.h system
11104 set crypt.h i_crypt
11105 eval $inhdr
11106
11107 : see if crypt_r exists
11108 set crypt_r d_crypt_r
11109 eval $inlibc
11110 case "$d_crypt_r" in
11111 "$define")
11112         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11113         case "$d_crypt_r_proto:$usethreads" in
11114         ":define")      d_crypt_r_proto=define
11115                 set d_crypt_r_proto crypt_r $hdrs
11116                 eval $hasproto ;;
11117         *)      ;;
11118         esac
11119         case "$d_crypt_r_proto" in
11120         define)
11121         case "$crypt_r_proto" in
11122         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11123         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11124         esac
11125         case "$crypt_r_proto" in
11126         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11127         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11128         esac
11129         case "$crypt_r_proto" in
11130         ''|0)   d_crypt_r=undef
11131                 crypt_r_proto=0
11132                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11133         * )     case "$crypt_r_proto" in
11134                 REENTRANT_PROTO*) ;;
11135                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11136                 esac
11137                 echo "Prototype: $try" ;;
11138         esac
11139         ;;
11140         *)      case "$usethreads" in
11141                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11142                 esac
11143                 d_crypt_r=undef
11144                 crypt_r_proto=0
11145                 ;;
11146         esac
11147         ;;
11148 *)      crypt_r_proto=0
11149         ;;
11150 esac
11151
11152 : get csh whereabouts
11153 case "$csh" in
11154 'csh') val="$undef" ;;
11155 *) val="$define" ;;
11156 esac
11157 set d_csh
11158 eval $setvar
11159 : Respect a hint or command line value for full_csh.
11160 case "$full_csh" in
11161 '') full_csh=$csh ;;
11162 esac
11163
11164 : see if ctermid exists
11165 set ctermid d_ctermid
11166 eval $inlibc
11167
11168 : see if ctermid_r exists
11169 set ctermid_r d_ctermid_r
11170 eval $inlibc
11171 case "$d_ctermid_r" in
11172 "$define")
11173         hdrs="$i_systypes sys/types.h define stdio.h "
11174         case "$d_ctermid_r_proto:$usethreads" in
11175         ":define")      d_ctermid_r_proto=define
11176                 set d_ctermid_r_proto ctermid_r $hdrs
11177                 eval $hasproto ;;
11178         *)      ;;
11179         esac
11180         case "$d_ctermid_r_proto" in
11181         define)
11182         case "$ctermid_r_proto" in
11183         ''|0) try='char* ctermid_r(char*);'
11184         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11185         esac
11186         case "$ctermid_r_proto" in
11187         ''|0)   d_ctermid_r=undef
11188                 ctermid_r_proto=0
11189                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11190         * )     case "$ctermid_r_proto" in
11191                 REENTRANT_PROTO*) ;;
11192                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11193                 esac
11194                 echo "Prototype: $try" ;;
11195         esac
11196         ;;
11197         *)      case "$usethreads" in
11198                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11199                 esac
11200                 d_ctermid_r=undef
11201                 ctermid_r_proto=0
11202                 ;;
11203         esac
11204         ;;
11205 *)      ctermid_r_proto=0
11206         ;;
11207 esac
11208
11209 : see if ctime_r exists
11210 set ctime_r d_ctime_r
11211 eval $inlibc
11212 case "$d_ctime_r" in
11213 "$define")
11214         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11215         case "$d_ctime_r_proto:$usethreads" in
11216         ":define")      d_ctime_r_proto=define
11217                 set d_ctime_r_proto ctime_r $hdrs
11218                 eval $hasproto ;;
11219         *)      ;;
11220         esac
11221         case "$d_ctime_r_proto" in
11222         define)
11223         case "$ctime_r_proto" in
11224         ''|0) try='char* ctime_r(const time_t*, char*);'
11225         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11226         esac
11227         case "$ctime_r_proto" in
11228         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11229         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11230         esac
11231         case "$ctime_r_proto" in
11232         ''|0) try='int ctime_r(const time_t*, char*);'
11233         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11234         esac
11235         case "$ctime_r_proto" in
11236         ''|0) try='int ctime_r(const time_t*, char*, int);'
11237         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11238         esac
11239         case "$ctime_r_proto" in
11240         ''|0)   d_ctime_r=undef
11241                 ctime_r_proto=0
11242                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11243         * )     case "$ctime_r_proto" in
11244                 REENTRANT_PROTO*) ;;
11245                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11246                 esac
11247                 echo "Prototype: $try" ;;
11248         esac
11249         ;;
11250         *)      case "$usethreads" in
11251                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11252                 esac
11253                 d_ctime_r=undef
11254                 ctime_r_proto=0
11255                 ;;
11256         esac
11257         ;;
11258 *)      ctime_r_proto=0
11259         ;;
11260 esac
11261
11262 : see if cuserid exists
11263 set cuserid d_cuserid
11264 eval $inlibc
11265
11266 : see if this is a limits.h system
11267 set limits.h i_limits
11268 eval $inhdr
11269
11270 : see if this is a float.h system
11271 set float.h i_float
11272 eval $inhdr
11273
11274 : See if number of significant digits in a double precision number is known
11275 echo " "
11276 $cat >dbl_dig.c <<EOM
11277 #$i_limits I_LIMITS
11278 #$i_float I_FLOAT
11279 #ifdef I_LIMITS
11280 #include <limits.h>
11281 #endif
11282 #ifdef I_FLOAT
11283 #include <float.h>
11284 #endif
11285 #ifdef DBL_DIG
11286 printf("Contains DBL_DIG");
11287 #endif
11288 EOM
11289 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11290 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11291         echo "DBL_DIG found." >&4
11292         val="$define"
11293 else
11294         echo "DBL_DIG NOT found." >&4
11295         val="$undef"
11296 fi
11297 $rm -f dbl_dig.?
11298 set d_dbl_dig
11299 eval $setvar
11300
11301 : see if dbm.h is available
11302 : see if dbmclose exists
11303 set dbmclose d_dbmclose
11304 eval $inlibc
11305
11306 case "$d_dbmclose" in
11307 $define)
11308         set dbm.h i_dbm
11309         eval $inhdr
11310         case "$i_dbm" in
11311         $define)
11312                 val="$undef"
11313                 set i_rpcsvcdbm
11314                 eval $setvar
11315                 ;;
11316         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11317                 eval $inhdr
11318                 ;;
11319         esac
11320         ;;
11321 *)      echo "We won't be including <dbm.h>"
11322         val="$undef"
11323         set i_dbm
11324         eval $setvar
11325         val="$undef"
11326         set i_rpcsvcdbm
11327         eval $setvar
11328         ;;
11329 esac
11330
11331 : see if prototype for dbminit is available
11332 echo " "
11333 set d_dbminitproto dbminit $i_dbm dbm.h
11334 eval $hasproto
11335
11336 : see if difftime exists
11337 set difftime d_difftime
11338 eval $inlibc
11339
11340 : see if this is a dirent system
11341 echo " "
11342 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11343         val="$define"
11344         echo "<dirent.h> found." >&4
11345 else
11346         val="$undef"
11347         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11348                 echo "<sys/dir.h> found." >&4
11349                 echo " "
11350         else
11351                 xinc=`./findhdr sys/ndir.h`
11352         fi
11353         echo "<dirent.h> NOT found." >&4
11354 fi
11355 set i_dirent
11356 eval $setvar
11357
11358 : Look for type of directory structure.
11359 echo " "
11360 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11361
11362 case "$direntrytype" in
11363 ''|' ')
11364         case "$i_dirent" in
11365         $define) guess1='struct dirent' ;;
11366         *) guess1='struct direct'  ;;
11367         esac
11368         ;;
11369 *)      guess1="$direntrytype"
11370         ;;
11371 esac
11372
11373 case "$guess1" in
11374 'struct dirent') guess2='struct direct' ;;
11375 *) guess2='struct dirent' ;;
11376 esac
11377
11378 if $contains "$guess1" try.c >/dev/null 2>&1; then
11379         direntrytype="$guess1"
11380         echo "Your directory entries are $direntrytype." >&4
11381 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11382         direntrytype="$guess2"
11383         echo "Your directory entries seem to be $direntrytype." >&4
11384 else
11385         echo "I don't recognize your system's directory entries." >&4
11386         rp="What type is used for directory entries on this system?"
11387         dflt="$guess1"
11388         . ./myread
11389         direntrytype="$ans"
11390 fi
11391 $rm_try
11392
11393 : see if the directory entry stores field length
11394 echo " "
11395 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11396 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11397         echo "Good, your directory entry keeps length information in d_namlen." >&4
11398         val="$define"
11399 else
11400         echo "Your directory entry does not know about the d_namlen field." >&4
11401         val="$undef"
11402 fi
11403 set d_dirnamlen
11404 eval $setvar
11405 $rm_try
11406
11407 : Look for DIR.dd_fd
11408 case "$i_dirent" in
11409 "$define")
11410     echo "Checking to see if DIR has a dd_fd member variable" >&4
11411     $cat >try.c <<EOCP
11412 #$i_stdlib I_STDLIB
11413 #ifdef I_STDLIB
11414 #include <stdlib.h>
11415 #endif
11416 #include <dirent.h>
11417
11418 int main() {
11419     DIR dir;
11420     dir.dd_fd = 1;
11421     return 0;
11422 }
11423 EOCP
11424     val=$undef
11425     set try
11426     if eval $compile; then
11427         echo "Yes, it does."
11428         val="$define"
11429     else
11430         echo "No, it does not."
11431         val="$undef"
11432     fi
11433     ;;
11434 *)
11435     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11436     val="$undef"
11437     ;;
11438 esac
11439 set d_dir_dd_fd
11440 eval $setvar
11441 $rm_try
11442
11443 : see if this is an sysdir system
11444 set sys/dir.h i_sysdir
11445 eval $inhdr
11446
11447 : see if this is an sysndir system
11448 set sys/ndir.h i_sysndir
11449 eval $inhdr
11450
11451 : Look for dirfd
11452 echo " "
11453 $cat >dirfd.c <<EOM
11454 #include <stdio.h>
11455 #$i_stdlib I_STDLIB
11456 #ifdef I_STDLIB
11457 #include <stdlib.h>
11458 #endif
11459 #$i_dirent I_DIRENT             /**/
11460 #$i_sysdir I_SYS_DIR            /**/
11461 #$i_sysndir I_SYS_NDIR          /**/
11462 #$i_systypes I_SYS_TYPES        /**/
11463 #if defined(I_SYS_TYPES)
11464 #include <sys/types.h>
11465 #endif
11466 #if defined(I_DIRENT)
11467 #include <dirent.h>
11468 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11469 #include <sys/dir.h>
11470 #endif
11471 #else
11472 #ifdef I_SYS_NDIR
11473 #include <sys/ndir.h>
11474 #else
11475 #ifdef I_SYS_DIR
11476 #ifdef hp9000s500
11477 #include <ndir.h>       /* may be wrong in the future */
11478 #else
11479 #include <sys/dir.h>
11480 #endif
11481 #endif
11482 #endif
11483 #endif 
11484 int main() {
11485         DIR *dirp = opendir(".");
11486         if (dirfd(dirp) >= 0)
11487                 exit(0);
11488         else
11489                 exit(1);
11490 }
11491 EOM
11492 val=$undef
11493 set dirfd
11494 if eval $compile; then
11495         val="$define"
11496 fi
11497 case "$val" in
11498 $define)        echo "dirfd() found." >&4       ;;
11499 *)              echo "dirfd() NOT found." >&4   ;;
11500 esac
11501 set d_dirfd
11502 eval $setvar
11503 $rm -f dirfd*
11504
11505 : see if dlerror exists
11506 xxx_runnm="$runnm"
11507 runnm=false
11508 set dlerror d_dlerror
11509 eval $inlibc
11510 runnm="$xxx_runnm"
11511
11512 : see if dlfcn is available
11513 set dlfcn.h i_dlfcn
11514 eval $inhdr
11515
11516 case "$usedl" in
11517 $define|y|true)
11518         $cat << EOM
11519
11520 On a few systems, the dynamically loaded modules that perl generates and uses
11521 will need a different extension than shared libs. The default will probably
11522 be appropriate.
11523
11524 EOM
11525         case "$dlext" in
11526         '')     dflt="$so" ;;
11527         *)      dflt="$dlext" ;;
11528         esac
11529         rp='What is the extension of dynamically loaded modules'
11530         . ./myread
11531         dlext="$ans"
11532         ;;
11533 *)
11534         dlext="none"
11535         ;;
11536 esac
11537
11538 : Check if dlsym need a leading underscore
11539 echo " "
11540 val="$undef"
11541
11542 case "$dlsrc" in
11543 dl_dlopen.xs)
11544         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11545         $cat >dyna.c <<'EOM'
11546 fred () { }
11547 EOM
11548
11549 $cat >fred.c<<EOM
11550
11551 #include <stdio.h>
11552 #$i_stdlib I_STDLIB
11553 #ifdef I_STDLIB
11554 #include <stdlib.h>
11555 #endif
11556 #$i_dlfcn I_DLFCN
11557 #ifdef I_DLFCN
11558 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11559 #else
11560 #include <sys/types.h>
11561 #include <nlist.h>
11562 #include <link.h>
11563 #endif
11564
11565 extern int fred() ;
11566
11567 int main()
11568 {
11569     void * handle ;
11570     void * symbol ;
11571 #ifndef RTLD_LAZY
11572     int mode = 1 ;
11573 #else
11574     int mode = RTLD_LAZY ;
11575 #endif
11576     handle = dlopen("./dyna.$dlext", mode) ;
11577     if (handle == NULL) {
11578         printf ("1\n") ;
11579         fflush (stdout) ;
11580         exit(0);
11581     }
11582     symbol = dlsym(handle, "fred") ;
11583     if (symbol == NULL) {
11584         /* try putting a leading underscore */
11585         symbol = dlsym(handle, "_fred") ;
11586         if (symbol == NULL) {
11587             printf ("2\n") ;
11588             fflush (stdout) ;
11589             exit(0);
11590         }
11591         printf ("3\n") ;
11592     }
11593     else
11594         printf ("4\n") ;
11595     fflush (stdout) ;
11596     exit(0);
11597 }
11598 EOM
11599         : Call the object file tmp-dyna.o in case dlext=o.
11600         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11601                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11602                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11603                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11604                 xxx=`$run ./fred`
11605                 case $xxx in
11606                 1)      echo "Test program failed using dlopen." >&4
11607                         echo "Perhaps you should not use dynamic loading." >&4;;
11608                 2)      echo "Test program failed using dlsym." >&4
11609                         echo "Perhaps you should not use dynamic loading." >&4;;
11610                 3)      echo "dlsym needs a leading underscore" >&4
11611                         val="$define" ;;
11612                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11613                 esac
11614         else
11615                 echo "I can't compile and run the test program." >&4
11616                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11617         fi
11618         ;;
11619 esac
11620                 
11621 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11622
11623 set d_dlsymun
11624 eval $setvar
11625
11626 : see if drand48_r exists
11627 set drand48_r d_drand48_r
11628 eval $inlibc
11629 case "$d_drand48_r" in
11630 "$define")
11631         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11632         case "$d_drand48_r_proto:$usethreads" in
11633         ":define")      d_drand48_r_proto=define
11634                 set d_drand48_r_proto drand48_r $hdrs
11635                 eval $hasproto ;;
11636         *)      ;;
11637         esac
11638         case "$d_drand48_r_proto" in
11639         define)
11640         case "$drand48_r_proto" in
11641         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11642         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11643         esac
11644         case "$drand48_r_proto" in
11645         ''|0)   d_drand48_r=undef
11646                 drand48_r_proto=0
11647                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11648         * )     case "$drand48_r_proto" in
11649                 REENTRANT_PROTO*) ;;
11650                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11651                 esac
11652                 echo "Prototype: $try" ;;
11653         esac
11654         ;;
11655         *)      case "$usethreads" in
11656                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11657                 esac
11658                 d_drand48_r=undef
11659                 drand48_r_proto=0
11660                 ;;
11661         esac
11662         ;;
11663 *)      drand48_r_proto=0
11664         ;;
11665 esac
11666
11667 : see if prototype for drand48 is available
11668 echo " "
11669 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11670 eval $hasproto
11671
11672 : see if dup2 exists
11673 set dup2 d_dup2
11674 eval $inlibc
11675
11676 : see if eaccess exists
11677 set eaccess d_eaccess
11678 eval $inlibc
11679
11680 : see if endgrent exists
11681 set endgrent d_endgrent
11682 eval $inlibc
11683
11684 : see if this is an grp system
11685 set grp.h i_grp
11686 eval $inhdr
11687
11688 case "$i_grp" in
11689 $define)
11690         xxx=`./findhdr grp.h`
11691         $cppstdin $cppflags $cppminus < $xxx >$$.h
11692
11693         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11694                 val="$define"
11695         else
11696                 val="$undef"
11697         fi
11698         set d_grpasswd
11699         eval $setvar
11700
11701         $rm -f $$.h
11702         ;;
11703 *)
11704         val="$undef";
11705         set d_grpasswd; eval $setvar
11706         ;;
11707 esac
11708
11709 : see if endgrent_r exists
11710 set endgrent_r d_endgrent_r
11711 eval $inlibc
11712 case "$d_endgrent_r" in
11713 "$define")
11714         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11715         case "$d_endgrent_r_proto:$usethreads" in
11716         ":define")      d_endgrent_r_proto=define
11717                 set d_endgrent_r_proto endgrent_r $hdrs
11718                 eval $hasproto ;;
11719         *)      ;;
11720         esac
11721         case "$d_endgrent_r_proto" in
11722         define)
11723         case "$endgrent_r_proto" in
11724         ''|0) try='int endgrent_r(FILE**);'
11725         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11726         esac
11727         case "$endgrent_r_proto" in
11728         ''|0) try='void endgrent_r(FILE**);'
11729         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11730         esac
11731         case "$endgrent_r_proto" in
11732         ''|0)   d_endgrent_r=undef
11733                 endgrent_r_proto=0
11734                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11735         * )     case "$endgrent_r_proto" in
11736                 REENTRANT_PROTO*) ;;
11737                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11738                 esac
11739                 echo "Prototype: $try" ;;
11740         esac
11741         ;;
11742         *)      case "$usethreads" in
11743                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11744                 esac
11745                 d_endgrent_r=undef
11746                 endgrent_r_proto=0
11747                 ;;
11748         esac
11749         ;;
11750 *)      endgrent_r_proto=0
11751         ;;
11752 esac
11753
11754 : see if endhostent exists
11755 set endhostent d_endhent
11756 eval $inlibc
11757
11758 : see if this is a netdb.h system
11759 set netdb.h i_netdb
11760 eval $inhdr
11761
11762 : see if endhostent_r exists
11763 set endhostent_r d_endhostent_r
11764 eval $inlibc
11765 case "$d_endhostent_r" in
11766 "$define")
11767         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11768         case "$d_endhostent_r_proto:$usethreads" in
11769         ":define")      d_endhostent_r_proto=define
11770                 set d_endhostent_r_proto endhostent_r $hdrs
11771                 eval $hasproto ;;
11772         *)      ;;
11773         esac
11774         case "$d_endhostent_r_proto" in
11775         define)
11776         case "$endhostent_r_proto" in
11777         ''|0) try='int endhostent_r(struct hostent_data*);'
11778         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11779         esac
11780         case "$endhostent_r_proto" in
11781         ''|0) try='void endhostent_r(struct hostent_data*);'
11782         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11783         esac
11784         case "$endhostent_r_proto" in
11785         ''|0)   d_endhostent_r=undef
11786                 endhostent_r_proto=0
11787                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11788         * )     case "$endhostent_r_proto" in
11789                 REENTRANT_PROTO*) ;;
11790                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11791                 esac
11792                 echo "Prototype: $try" ;;
11793         esac
11794         ;;
11795         *)      case "$usethreads" in
11796                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11797                 esac
11798                 d_endhostent_r=undef
11799                 endhostent_r_proto=0
11800                 ;;
11801         esac
11802         ;;
11803 *)      endhostent_r_proto=0
11804         ;;
11805 esac
11806
11807 : see if endnetent exists
11808 set endnetent d_endnent
11809 eval $inlibc
11810
11811 : see if endnetent_r exists
11812 set endnetent_r d_endnetent_r
11813 eval $inlibc
11814 case "$d_endnetent_r" in
11815 "$define")
11816         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11817         case "$d_endnetent_r_proto:$usethreads" in
11818         ":define")      d_endnetent_r_proto=define
11819                 set d_endnetent_r_proto endnetent_r $hdrs
11820                 eval $hasproto ;;
11821         *)      ;;
11822         esac
11823         case "$d_endnetent_r_proto" in
11824         define)
11825         case "$endnetent_r_proto" in
11826         ''|0) try='int endnetent_r(struct netent_data*);'
11827         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11828         esac
11829         case "$endnetent_r_proto" in
11830         ''|0) try='void endnetent_r(struct netent_data*);'
11831         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11832         esac
11833         case "$endnetent_r_proto" in
11834         ''|0)   d_endnetent_r=undef
11835                 endnetent_r_proto=0
11836                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11837         * )     case "$endnetent_r_proto" in
11838                 REENTRANT_PROTO*) ;;
11839                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11840                 esac
11841                 echo "Prototype: $try" ;;
11842         esac
11843         ;;
11844         *)      case "$usethreads" in
11845                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11846                 esac
11847                 d_endnetent_r=undef
11848                 endnetent_r_proto=0
11849                 ;;
11850         esac
11851         ;;
11852 *)      endnetent_r_proto=0
11853         ;;
11854 esac
11855
11856 : see if endprotoent exists
11857 set endprotoent d_endpent
11858 eval $inlibc
11859
11860 : see if endprotoent_r exists
11861 set endprotoent_r d_endprotoent_r
11862 eval $inlibc
11863 case "$d_endprotoent_r" in
11864 "$define")
11865         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11866         case "$d_endprotoent_r_proto:$usethreads" in
11867         ":define")      d_endprotoent_r_proto=define
11868                 set d_endprotoent_r_proto endprotoent_r $hdrs
11869                 eval $hasproto ;;
11870         *)      ;;
11871         esac
11872         case "$d_endprotoent_r_proto" in
11873         define)
11874         case "$endprotoent_r_proto" in
11875         ''|0) try='int endprotoent_r(struct protoent_data*);'
11876         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11877         esac
11878         case "$endprotoent_r_proto" in
11879         ''|0) try='void endprotoent_r(struct protoent_data*);'
11880         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11881         esac
11882         case "$endprotoent_r_proto" in
11883         ''|0)   d_endprotoent_r=undef
11884                 endprotoent_r_proto=0
11885                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11886         * )     case "$endprotoent_r_proto" in
11887                 REENTRANT_PROTO*) ;;
11888                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11889                 esac
11890                 echo "Prototype: $try" ;;
11891         esac
11892         ;;
11893         *)      case "$usethreads" in
11894                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11895                 esac
11896                 d_endprotoent_r=undef
11897                 endprotoent_r_proto=0
11898                 ;;
11899         esac
11900         ;;
11901 *)      endprotoent_r_proto=0
11902         ;;
11903 esac
11904
11905 : see if endpwent exists
11906 set endpwent d_endpwent
11907 eval $inlibc
11908
11909 : see if this is a pwd.h system
11910 set pwd.h i_pwd
11911 eval $inhdr
11912
11913 case "$i_pwd" in
11914 $define)
11915         xxx=`./findhdr pwd.h`
11916         $cppstdin $cppflags $cppminus < $xxx >$$.h
11917
11918         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11919                 val="$define"
11920         else
11921                 val="$undef"
11922         fi
11923         set d_pwquota
11924         eval $setvar
11925
11926         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11927                 val="$define"
11928         else
11929                 val="$undef"
11930         fi
11931         set d_pwage
11932         eval $setvar
11933
11934         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11935                 val="$define"
11936         else
11937                 val="$undef"
11938         fi
11939         set d_pwchange
11940         eval $setvar
11941
11942         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11943                 val="$define"
11944         else
11945                 val="$undef"
11946         fi
11947         set d_pwclass
11948         eval $setvar
11949
11950         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11951                 val="$define"
11952         else
11953                 val="$undef"
11954         fi
11955         set d_pwexpire
11956         eval $setvar
11957
11958         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11959                 val="$define"
11960         else
11961                 val="$undef"
11962         fi
11963         set d_pwcomment
11964         eval $setvar
11965
11966         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11967                 val="$define"
11968         else
11969                 val="$undef"
11970         fi
11971         set d_pwgecos
11972         eval $setvar
11973
11974         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11975                 val="$define"
11976         else
11977                 val="$undef"
11978         fi
11979         set d_pwpasswd
11980         eval $setvar
11981
11982         $rm -f $$.h
11983         ;;
11984 *)
11985         val="$undef"; 
11986         set d_pwquota; eval $setvar
11987         set d_pwage; eval $setvar
11988         set d_pwchange; eval $setvar
11989         set d_pwclass; eval $setvar
11990         set d_pwexpire; eval $setvar
11991         set d_pwcomment; eval $setvar
11992         set d_pwgecos; eval $setvar
11993         set d_pwpasswd; eval $setvar
11994         ;;
11995 esac
11996
11997 : see if endpwent_r exists
11998 set endpwent_r d_endpwent_r
11999 eval $inlibc
12000 case "$d_endpwent_r" in
12001 "$define")
12002         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12003         case "$d_endpwent_r_proto:$usethreads" in
12004         ":define")      d_endpwent_r_proto=define
12005                 set d_endpwent_r_proto endpwent_r $hdrs
12006                 eval $hasproto ;;
12007         *)      ;;
12008         esac
12009         case "$d_endpwent_r_proto" in
12010         define)
12011         case "$endpwent_r_proto" in
12012         ''|0) try='int endpwent_r(FILE**);'
12013         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12014         esac
12015         case "$endpwent_r_proto" in
12016         ''|0) try='void endpwent_r(FILE**);'
12017         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12018         esac
12019         case "$endpwent_r_proto" in
12020         ''|0)   d_endpwent_r=undef
12021                 endpwent_r_proto=0
12022                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12023         * )     case "$endpwent_r_proto" in
12024                 REENTRANT_PROTO*) ;;
12025                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12026                 esac
12027                 echo "Prototype: $try" ;;
12028         esac
12029         ;;
12030         *)      case "$usethreads" in
12031                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12032                 esac
12033                 d_endpwent_r=undef
12034                 endpwent_r_proto=0
12035                 ;;
12036         esac
12037         ;;
12038 *)      endpwent_r_proto=0
12039         ;;
12040 esac
12041
12042 : see if endservent exists
12043 set endservent d_endsent
12044 eval $inlibc
12045
12046 : see if endservent_r exists
12047 set endservent_r d_endservent_r
12048 eval $inlibc
12049 case "$d_endservent_r" in
12050 "$define")
12051         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12052         case "$d_endservent_r_proto:$usethreads" in
12053         ":define")      d_endservent_r_proto=define
12054                 set d_endservent_r_proto endservent_r $hdrs
12055                 eval $hasproto ;;
12056         *)      ;;
12057         esac
12058         case "$d_endservent_r_proto" in
12059         define)
12060         case "$endservent_r_proto" in
12061         ''|0) try='int endservent_r(struct servent_data*);'
12062         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12063         esac
12064         case "$endservent_r_proto" in
12065         ''|0) try='void endservent_r(struct servent_data*);'
12066         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12067         esac
12068         case "$endservent_r_proto" in
12069         ''|0)   d_endservent_r=undef
12070                 endservent_r_proto=0
12071                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12072         * )     case "$endservent_r_proto" in
12073                 REENTRANT_PROTO*) ;;
12074                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12075                 esac
12076                 echo "Prototype: $try" ;;
12077         esac
12078         ;;
12079         *)      case "$usethreads" in
12080                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12081                 esac
12082                 d_endservent_r=undef
12083                 endservent_r_proto=0
12084                 ;;
12085         esac
12086         ;;
12087 *)      endservent_r_proto=0
12088         ;;
12089 esac
12090
12091 : Locate the flags for 'open()'
12092 echo " "
12093 $cat >try.c <<EOCP
12094 #include <sys/types.h>
12095 #ifdef I_FCNTL
12096 #include <fcntl.h>
12097 #endif
12098 #ifdef I_SYS_FILE
12099 #include <sys/file.h>
12100 #endif
12101 #$i_stdlib I_STDLIB
12102 #ifdef I_STDLIB
12103 #include <stdlib.h>
12104 #endif
12105 int main() {
12106         if(O_RDONLY);
12107 #ifdef O_TRUNC
12108         exit(0);
12109 #else
12110         exit(1);
12111 #endif
12112 }
12113 EOCP
12114 : check sys/file.h first to get FREAD on Sun
12115 if $test `./findhdr sys/file.h` && \
12116                 set try -DI_SYS_FILE && eval $compile; then
12117         h_sysfile=true;
12118         echo "<sys/file.h> defines the O_* constants..." >&4
12119         if $run ./try; then
12120                 echo "and you have the 3 argument form of open()." >&4
12121                 val="$define"
12122         else
12123                 echo "but not the 3 argument form of open().  Oh, well." >&4
12124                 val="$undef"
12125         fi
12126 elif $test `./findhdr fcntl.h` && \
12127                 set try -DI_FCNTL && eval $compile; then
12128         h_fcntl=true;
12129         echo "<fcntl.h> defines the O_* constants..." >&4
12130         if $run ./try; then
12131                 echo "and you have the 3 argument form of open()." >&4
12132                 val="$define"
12133         else
12134                 echo "but not the 3 argument form of open().  Oh, well." >&4
12135                 val="$undef"
12136         fi
12137 else
12138         val="$undef"
12139         echo "I can't find the O_* constant definitions!  You got problems." >&4
12140 fi
12141 set d_open3
12142 eval $setvar
12143 $rm_try
12144
12145 : see which of string.h or strings.h is needed
12146 echo " "
12147 strings=`./findhdr string.h`
12148 if $test "$strings" && $test -r "$strings"; then
12149         echo "Using <string.h> instead of <strings.h>." >&4
12150         val="$define"
12151 else
12152         val="$undef"
12153         strings=`./findhdr strings.h`
12154         if $test "$strings" && $test -r "$strings"; then
12155                 echo "Using <strings.h> instead of <string.h>." >&4
12156         else
12157                 echo "No string header found -- You'll surely have problems." >&4
12158         fi
12159 fi
12160 set i_string
12161 eval $setvar
12162 case "$i_string" in
12163 "$undef") strings=`./findhdr strings.h`;;
12164 *)        strings=`./findhdr string.h`;;
12165 esac
12166
12167 : see if this is a sys/file.h system
12168 val=''
12169 set sys/file.h val
12170 eval $inhdr
12171
12172 : do we need to include sys/file.h ?
12173 case "$val" in
12174 "$define")
12175         echo " "
12176         if $h_sysfile; then
12177                 val="$define"
12178                 echo "We'll be including <sys/file.h>." >&4
12179         else
12180                 val="$undef"
12181                 echo "We won't be including <sys/file.h>." >&4
12182         fi
12183         ;;
12184 *)
12185         h_sysfile=false
12186         ;;
12187 esac
12188 set i_sysfile
12189 eval $setvar
12190
12191 : see if fcntl.h is there
12192 val=''
12193 set fcntl.h val
12194 eval $inhdr
12195
12196 : see if we can include fcntl.h
12197 case "$val" in
12198 "$define")
12199         echo " "
12200         if $h_fcntl; then
12201                 val="$define"
12202                 echo "We'll be including <fcntl.h>." >&4
12203         else
12204                 val="$undef"
12205                 if $h_sysfile; then
12206         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12207                 else
12208                         echo "We won't be including <fcntl.h>." >&4
12209                 fi
12210         fi
12211         ;;
12212 *)
12213         h_fcntl=false
12214         val="$undef"
12215         ;;
12216 esac
12217 set i_fcntl
12218 eval $setvar
12219
12220 : see if fork exists
12221 set fork d_fork
12222 eval $inlibc
12223
12224 : see if pipe exists
12225 set pipe d_pipe
12226 eval $inlibc
12227
12228 : check for non-blocking I/O stuff
12229 case "$h_sysfile" in
12230 true) echo "#include <sys/file.h>" > head.c;;
12231 *)
12232        case "$h_fcntl" in
12233        true) echo "#include <fcntl.h>" > head.c;;
12234        *) echo "#include <sys/fcntl.h>" > head.c;;
12235        esac
12236        ;;
12237 esac
12238 echo " "
12239 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12240 case "$o_nonblock" in
12241 '')
12242         $cat head.c > try.c
12243         $cat >>try.c <<EOCP
12244 #include <stdio.h>
12245 #$i_stdlib I_STDLIB
12246 #ifdef I_STDLIB
12247 #include <stdlib.h>
12248 #endif
12249 #$i_fcntl I_FCNTL
12250 #ifdef I_FCNTL
12251 #include <fcntl.h>
12252 #endif
12253 int main() {
12254 #ifdef O_NONBLOCK
12255         printf("O_NONBLOCK\n");
12256         exit(0);
12257 #endif
12258 #ifdef O_NDELAY
12259         printf("O_NDELAY\n");
12260         exit(0);
12261 #endif
12262 #ifdef FNDELAY
12263         printf("FNDELAY\n");
12264         exit(0);
12265 #endif
12266         exit(0);
12267 }
12268 EOCP
12269         set try
12270         if eval $compile_ok; then
12271                 o_nonblock=`$run ./try`
12272                 case "$o_nonblock" in
12273                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12274                 *) echo "Seems like we can use $o_nonblock.";;
12275                 esac
12276         else
12277                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12278         fi
12279         ;;
12280 *) echo "Using $hint value $o_nonblock.";;
12281 esac
12282 $rm_try
12283
12284 echo " "
12285 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12286 case "$eagain" in
12287 '')
12288         case "$d_fork:$d_pipe" in
12289         define:define)
12290         $cat head.c > try.c
12291         $cat >>try.c <<EOCP
12292 #include <errno.h>
12293 #include <sys/types.h>
12294 #include <signal.h>
12295 #include <stdio.h>
12296 #$i_stdlib I_STDLIB
12297 #ifdef I_STDLIB
12298 #include <stdlib.h>
12299 #endif
12300 #$i_fcntl I_FCNTL
12301 #ifdef I_FCNTL
12302 #include <fcntl.h>
12303 #endif
12304 #define MY_O_NONBLOCK $o_nonblock
12305 #ifndef errno  /* XXX need better Configure test */
12306 extern int errno;
12307 #endif
12308 #$i_unistd I_UNISTD
12309 #ifdef I_UNISTD
12310 #include <unistd.h>
12311 #endif
12312 #$i_string I_STRING
12313 #ifdef I_STRING
12314 #include <string.h>
12315 #else
12316 #include <strings.h>
12317 #endif
12318 $signal_t blech(int x) { exit(3); }
12319 EOCP
12320         $cat >> try.c <<'EOCP'
12321 int main()
12322 {
12323         int pd[2];
12324         int pu[2];
12325         char buf[1];
12326         char string[100];
12327
12328         pipe(pd);       /* Down: child -> parent */
12329         pipe(pu);       /* Up: parent -> child */
12330         if (0 != fork()) {
12331                 int ret;
12332                 close(pd[1]);   /* Parent reads from pd[0] */
12333                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12334 #ifdef F_SETFL
12335                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12336                         exit(1);
12337 #else
12338                 exit(4);
12339 #endif
12340                 signal(SIGALRM, blech);
12341                 alarm(5);
12342                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12343                         exit(2);
12344                 sprintf(string, "%d\n", ret);
12345                 write(2, string, strlen(string));
12346                 alarm(0);
12347 #ifdef EAGAIN
12348                 if (errno == EAGAIN) {
12349                         printf("EAGAIN\n");
12350                         goto ok;
12351                 }
12352 #endif
12353 #ifdef EWOULDBLOCK
12354                 if (errno == EWOULDBLOCK)
12355                         printf("EWOULDBLOCK\n");
12356 #endif
12357         ok:
12358                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12359                 sleep(2);                               /* Give it time to close our pipe */
12360                 alarm(5);
12361                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12362                 alarm(0);
12363                 sprintf(string, "%d\n", ret);
12364                 write(4, string, strlen(string));
12365                 exit(0);
12366         }
12367
12368         close(pd[0]);                   /* We write to pd[1] */
12369         close(pu[1]);                   /* We read from pu[0] */
12370         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12371         close(pd[1]);                   /* Pipe pd is now fully closed! */
12372         exit(0);                                /* Bye bye, thank you for playing! */
12373 }
12374 EOCP
12375         set try
12376         if eval $compile_ok; then
12377                 echo "$startsh" >mtry
12378                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12379                 chmod +x mtry
12380                 ./mtry >/dev/null 2>&1
12381                 case $? in
12382                 0) eagain=`$cat try.out`;;
12383                 1) echo "Could not perform non-blocking setting!";;
12384                 2) echo "I did a successful read() for something that was not there!";;
12385                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12386                 4) echo "Could not find F_SETFL!";;
12387                 *) echo "Something terribly wrong happened during testing.";;
12388                 esac
12389                 rd_nodata=`$cat try.ret`
12390                 echo "A read() system call with no data present returns $rd_nodata."
12391                 case "$rd_nodata" in
12392                 0|-1) ;;
12393                 *)
12394                         echo "(That's peculiar, fixing that to be -1.)"
12395                         rd_nodata=-1
12396                         ;;
12397                 esac
12398                 case "$eagain" in
12399                 '')
12400                         echo "Forcing errno EAGAIN on read() with no data available."
12401                         eagain=EAGAIN
12402                         ;;
12403                 *)
12404                         echo "Your read() sets errno to $eagain when no data is available."
12405                         ;;
12406                 esac
12407                 status=`$cat try.err`
12408                 case "$status" in
12409                 0) echo "And it correctly returns 0 to signal EOF.";;
12410                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12411                 *) echo "However, your read() returns '$status' on EOF??";;
12412                 esac
12413                 val="$define"
12414                 if test "$status" = "$rd_nodata"; then
12415                         echo "WARNING: you can't distinguish between EOF and no data!"
12416                         val="$undef"
12417                 fi
12418         else
12419                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12420                 eagain=EAGAIN
12421         fi
12422         ;;
12423         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12424                 eagain=EAGAIN
12425                 val="$define"
12426                 ;;
12427         esac
12428         set d_eofnblk
12429         eval $setvar
12430         ;;
12431 *)
12432         echo "Using $hint value $eagain."
12433         echo "Your read() returns $rd_nodata when no data is present."
12434         case "$d_eofnblk" in
12435         "$define") echo "And you can see EOF because read() returns 0.";;
12436         "$undef") echo "But you can't see EOF status from read() returned value.";;
12437         *)
12438                 echo "(Assuming you can't see EOF status from read anyway.)"
12439                 d_eofnblk=$undef
12440                 ;;
12441         esac
12442         ;;
12443 esac
12444 $rm_try head.c mtry
12445
12446 : see if _ptr and _cnt from stdio act std
12447 echo " "
12448
12449 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12450         echo "(Looks like you have stdio.h from BSD.)"
12451         case "$stdio_ptr" in
12452         '') stdio_ptr='((fp)->_p)'
12453                 ptr_lval=$define
12454                 ;;
12455         *)      ptr_lval=$d_stdio_ptr_lval;;
12456         esac
12457         case "$stdio_cnt" in
12458         '') stdio_cnt='((fp)->_r)'
12459                 cnt_lval=$define
12460                 ;;
12461         *)      cnt_lval=$d_stdio_cnt_lval;;
12462         esac
12463         case "$stdio_base" in
12464         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12465         esac
12466         case "$stdio_bufsiz" in
12467         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12468         esac
12469 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12470         echo "(Looks like you have stdio.h from Linux.)"
12471         case "$stdio_ptr" in
12472         '') stdio_ptr='((fp)->_IO_read_ptr)'
12473                 ptr_lval=$define
12474                 ;;
12475         *)      ptr_lval=$d_stdio_ptr_lval;;
12476         esac
12477         case "$stdio_cnt" in
12478         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12479                 cnt_lval=$undef
12480                 ;;
12481         *)      cnt_lval=$d_stdio_cnt_lval;;
12482         esac
12483         case "$stdio_base" in
12484         '') stdio_base='((fp)->_IO_read_base)';;
12485         esac
12486         case "$stdio_bufsiz" in
12487         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12488         esac
12489 else
12490         case "$stdio_ptr" in
12491         '') stdio_ptr='((fp)->_ptr)'
12492                 ptr_lval=$define
12493                 ;;
12494         *)      ptr_lval=$d_stdio_ptr_lval;;
12495         esac
12496         case "$stdio_cnt" in
12497         '') stdio_cnt='((fp)->_cnt)'
12498                 cnt_lval=$define
12499                 ;;
12500         *)      cnt_lval=$d_stdio_cnt_lval;;
12501         esac
12502         case "$stdio_base" in
12503         '') stdio_base='((fp)->_base)';;
12504         esac
12505         case "$stdio_bufsiz" in
12506         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12507         esac
12508 fi
12509
12510 : test whether _ptr and _cnt really work
12511 echo "Checking how std your stdio is..." >&4
12512 $cat >try.c <<EOP
12513 #include <stdio.h>
12514 #$i_stdlib I_STDLIB
12515 #ifdef I_STDLIB
12516 #include <stdlib.h>
12517 #endif
12518 #define FILE_ptr(fp)    $stdio_ptr
12519 #define FILE_cnt(fp)    $stdio_cnt
12520 int main() {
12521         FILE *fp = fopen("try.c", "r");
12522         char c = getc(fp);
12523         if (
12524                 18 <= FILE_cnt(fp) &&
12525                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12526         )
12527                 exit(0);
12528         exit(1);
12529 }
12530 EOP
12531 val="$undef"
12532 set try
12533 if eval $compile && $to try.c; then
12534         if $run ./try; then
12535                 echo "Your stdio acts pretty std."
12536                 val="$define"
12537         else
12538                 echo "Your stdio isn't very std."
12539         fi
12540 else
12541         echo "Your stdio doesn't appear very std."
12542 fi
12543 $rm_try
12544
12545 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12546 # direct buffer manipulation no longer works.  The Configure tests
12547 # should be changed to correctly detect this, but until then,
12548 # the following check should at least let perl compile and run.
12549 # (This quick fix should be updated before 5.8.1.)
12550 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12551 # A. Dougherty, June 3, 2002.
12552 case "$d_gnulibc" in
12553 $define)
12554         case "$gnulibc_version" in
12555         2.[01]*)  ;;
12556         2.2) ;;
12557         2.2.[0-9]) ;;
12558         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12559                 val="$undef"
12560                 ;;
12561         esac
12562         ;;
12563 esac
12564 set d_stdstdio
12565 eval $setvar
12566
12567 : Can _ptr be used as an lvalue?
12568 case "$d_stdstdio$ptr_lval" in
12569 $define$define) val=$define ;;
12570 *) val=$undef ;;
12571 esac
12572 set d_stdio_ptr_lval
12573 eval $setvar
12574
12575 : Can _cnt be used as an lvalue?
12576 case "$d_stdstdio$cnt_lval" in
12577 $define$define) val=$define ;;
12578 *) val=$undef ;;
12579 esac
12580 set d_stdio_cnt_lval
12581 eval $setvar
12582
12583
12584 : test whether setting _ptr sets _cnt as a side effect
12585 d_stdio_ptr_lval_sets_cnt="$undef"
12586 d_stdio_ptr_lval_nochange_cnt="$undef"
12587 case "$d_stdio_ptr_lval$d_stdstdio" in
12588 $define$define)
12589         echo "Checking to see what happens if we set the stdio ptr..." >&4
12590 $cat >try.c <<EOP
12591 #include <stdio.h>
12592 /* Can we scream? */
12593 /* Eat dust sed :-) */
12594 /* In the buffer space, no one can hear you scream. */
12595 #$i_stdlib I_STDLIB
12596 #ifdef I_STDLIB
12597 #include <stdlib.h>
12598 #endif
12599 #define FILE_ptr(fp)    $stdio_ptr
12600 #define FILE_cnt(fp)    $stdio_cnt
12601 #include <sys/types.h>
12602 int main() {
12603         FILE *fp = fopen("try.c", "r");
12604         int c;
12605         char *ptr;
12606         size_t cnt;
12607         if (!fp) {
12608             puts("Fail even to read");
12609             exit(1);
12610         }
12611         c = getc(fp); /* Read away the first # */
12612         if (c == EOF) {
12613             puts("Fail even to read");
12614             exit(1);
12615         }
12616         if (!(
12617                 18 <= FILE_cnt(fp) &&
12618                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12619         )) {
12620                 puts("Fail even to read");
12621                 exit (1);
12622         }
12623         ptr = (char*) FILE_ptr(fp);
12624         cnt = (size_t)FILE_cnt(fp);
12625
12626         FILE_ptr(fp) += 42;
12627
12628         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12629                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12630                 exit (1);
12631         }
12632         if (FILE_cnt(fp) <= 20) {
12633                 printf ("Fail (<20 chars to test)");
12634                 exit (1);
12635         }
12636         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12637                 puts("Fail compare");
12638                 exit (1);
12639         }
12640         if (cnt == FILE_cnt(fp)) {
12641                 puts("Pass_unchanged");
12642                 exit (0);
12643         }
12644         if (FILE_cnt(fp) == (cnt - 42)) {
12645                 puts("Pass_changed");
12646                 exit (0);
12647         }
12648         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12649         return 1;
12650
12651 }
12652 EOP
12653         set try
12654         if eval $compile && $to try.c; then
12655                 case `$run ./try` in
12656                 Pass_changed)
12657                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12658                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12659                 Pass_unchanged)
12660                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12661                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12662                 Fail*)
12663                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12664                 *)
12665                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12666         esac
12667         else
12668                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12669         fi
12670         $rm_try
12671         ;;
12672 esac
12673
12674 : see if _base is also standard
12675 val="$undef"
12676 case "$d_stdstdio" in
12677 $define)
12678         $cat >try.c <<EOP
12679 #include <stdio.h>
12680 #$i_stdlib I_STDLIB
12681 #ifdef I_STDLIB
12682 #include <stdlib.h>
12683 #endif
12684 #define FILE_base(fp)   $stdio_base
12685 #define FILE_bufsiz(fp) $stdio_bufsiz
12686 int main() {
12687         FILE *fp = fopen("try.c", "r");
12688         char c = getc(fp);
12689         if (
12690                 19 <= FILE_bufsiz(fp) &&
12691                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12692         )
12693                 exit(0);
12694         exit(1);
12695 }
12696 EOP
12697         set try
12698         if eval $compile && $to try.c; then
12699                 if $run ./try; then
12700                         echo "And its _base field acts std."
12701                         val="$define"
12702                 else
12703                         echo "But its _base field isn't std."
12704                 fi
12705         else
12706                 echo "However, it seems to be lacking the _base field."
12707         fi
12708         $rm_try
12709         ;;
12710 esac
12711 set d_stdiobase
12712 eval $setvar
12713
12714 : see if fast_stdio exists
12715 val="$undef"
12716 case "$d_stdstdio:$d_stdio_ptr_lval" in
12717 "$define:$define")
12718         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12719         *$define*)
12720                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12721                 val="$define"
12722                 ;;
12723         esac
12724         ;;
12725 esac
12726 set d_faststdio
12727 eval $setvar
12728
12729
12730
12731 : see if fchdir exists
12732 set fchdir d_fchdir
12733 eval $inlibc
12734
12735 : see if fchmod exists
12736 set fchmod d_fchmod
12737 eval $inlibc
12738
12739 : see if fchown exists
12740 set fchown d_fchown
12741 eval $inlibc
12742
12743 : see if this is an fcntl system
12744 set fcntl d_fcntl
12745 eval $inlibc
12746
12747 echo " "
12748 : See if fcntl-based locking works.
12749 $cat >try.c <<EOCP
12750 #$i_stdlib I_STDLIB
12751 #ifdef I_STDLIB
12752 #include <stdlib.h>
12753 #endif
12754 #include <unistd.h>
12755 #include <fcntl.h>
12756 #include <signal.h>
12757 $signal_t blech(int x) { exit(3); }
12758 int main() {
12759 #if defined(F_SETLK) && defined(F_SETLKW)
12760      struct flock flock;
12761      int retval, fd;
12762      fd = open("try.c", O_RDONLY);
12763      flock.l_type = F_RDLCK;
12764      flock.l_whence = SEEK_SET;
12765      flock.l_start = flock.l_len = 0;
12766      signal(SIGALRM, blech);
12767      alarm(10);
12768      retval = fcntl(fd, F_SETLK, &flock);
12769      close(fd);
12770      (retval < 0 ? exit(2) : exit(0));
12771 #else
12772      exit(2);
12773 #endif
12774 }
12775 EOCP
12776 echo "Checking if fcntl-based file locking works... "
12777 case "$d_fcntl" in
12778 "$define")
12779         set try
12780         if eval $compile_ok; then
12781                 if $run ./try; then
12782                         echo "Yes, it seems to work."
12783                         val="$define"
12784                 else
12785                         echo "Nope, it didn't work."
12786                         val="$undef"
12787                         case "$?" in
12788                         3) $cat >&4 <<EOM
12789 ***
12790 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12791 *** This is (almost) impossible.
12792 *** If your NFS lock daemons are not feeling well, something like
12793 *** this may happen, please investigate.  Cannot continue, aborting.
12794 ***
12795 EOM
12796                                 exit 1
12797                                 ;;
12798                         esac
12799                 fi
12800         else
12801                 echo "I'm unable to compile the test program, so I'll assume not."
12802                 val="$undef"
12803         fi
12804         ;;
12805 *) val="$undef";
12806         echo "Nope, since you don't even have fcntl()."
12807         ;;
12808 esac
12809 set d_fcntl_can_lock
12810 eval $setvar
12811 $rm_try
12812
12813 : check for fd_set items
12814 $cat <<EOM
12815
12816 Checking to see how well your C compiler handles fd_set and friends ...
12817 EOM
12818 $cat >try.c <<EOCP
12819 #$i_stdlib I_STDLIB
12820 #ifdef I_STDLIB
12821 #include <stdlib.h>
12822 #endif
12823 #$i_systime I_SYS_TIME
12824 #$i_sysselct I_SYS_SELECT
12825 #$d_socket HAS_SOCKET
12826 #include <sys/types.h>
12827 #ifdef HAS_SOCKET
12828 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12829 #endif
12830 #ifdef I_SYS_TIME
12831 #include <sys/time.h>
12832 #endif
12833 #ifdef I_SYS_SELECT
12834 #include <sys/select.h>
12835 #endif
12836 int main() {
12837         fd_set fds;
12838
12839 #ifdef TRYBITS
12840         if(fds.fds_bits);
12841 #endif
12842
12843 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12844         exit(0);
12845 #else
12846         exit(1);
12847 #endif
12848 }
12849 EOCP
12850 set try -DTRYBITS
12851 if eval $compile; then
12852         d_fds_bits="$define"
12853         d_fd_set="$define"
12854         echo "Well, your system knows about the normal fd_set typedef..." >&4
12855         if $run ./try; then
12856                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12857                 d_fd_macros="$define"
12858         else
12859                 $cat >&4 <<'EOM'
12860 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12861 EOM
12862                 d_fd_macros="$undef"
12863         fi
12864 else
12865         $cat <<'EOM'
12866 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12867 EOM
12868         set try
12869         if eval $compile; then
12870                 d_fds_bits="$undef"
12871                 d_fd_set="$define"
12872                 echo "Well, your system has some sort of fd_set available..." >&4
12873                 if $run ./try; then
12874                         echo "and you have the normal fd_set macros." >&4
12875                         d_fd_macros="$define"
12876                 else
12877                         $cat <<'EOM'
12878 but not the normal fd_set macros!  Gross!  More work for me...
12879 EOM
12880                         d_fd_macros="$undef"
12881                 fi
12882         else
12883         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12884                 d_fd_set="$undef"
12885                 d_fds_bits="$undef"
12886                 d_fd_macros="$undef"
12887         fi
12888 fi
12889 $rm_try
12890
12891 : see if fgetpos exists
12892 set fgetpos d_fgetpos
12893 eval $inlibc
12894
12895 : see if finite exists
12896 set finite d_finite
12897 eval $inlibc
12898
12899 : see if finitel exists
12900 set finitel d_finitel
12901 eval $inlibc
12902
12903 : see if flock exists
12904 set flock d_flock
12905 eval $inlibc
12906
12907 : see if prototype for flock is available
12908 echo " "
12909 set d_flockproto flock $i_sysfile sys/file.h
12910 eval $hasproto
12911
12912 : see if fp_class exists
12913 set fp_class d_fp_class
12914 eval $inlibc
12915
12916 : see if pathconf exists
12917 set pathconf d_pathconf
12918 eval $inlibc
12919
12920 : see if fpathconf exists
12921 set fpathconf d_fpathconf
12922 eval $inlibc
12923
12924 : see if fpclass exists
12925 set fpclass d_fpclass
12926 eval $inlibc
12927
12928 : see if fpclassify exists
12929 set fpclassify d_fpclassify
12930 eval $inlibc
12931
12932 : see if fpclassl exists
12933 set fpclassl d_fpclassl
12934 eval $inlibc
12935
12936
12937 : check for fpos64_t
12938 echo " "
12939 echo "Checking to see if you have fpos64_t..." >&4
12940 $cat >try.c <<EOCP
12941 #include <stdio.h>
12942 int main() { fpos64_t x = 7; }
12943 EOCP
12944 set try
12945 if eval $compile; then
12946         val="$define"
12947         echo "You have fpos64_t."
12948 else
12949         val="$undef"
12950         echo "You do not have fpos64_t."
12951         case "$fpossize" in
12952         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12953         esac
12954 fi
12955 $rm_try
12956 set d_fpos64_t
12957 eval $setvar
12958
12959 : see if frexpl exists
12960 set frexpl d_frexpl
12961 eval $inlibc
12962
12963 : see if this is a sys/param system
12964 set sys/param.h i_sysparam
12965 eval $inhdr
12966
12967 : see if this is a sys/mount.h system
12968 set sys/mount.h i_sysmount
12969 eval $inhdr
12970
12971
12972 echo " "
12973 echo "Checking to see if your system supports struct fs_data..." >&4
12974 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12975 eval $hasstruct
12976 case "$d_fs_data_s" in
12977 "$define")      echo "Yes, it does."   ;;
12978 *)              echo "No, it doesn't." ;;
12979 esac
12980
12981 : see if fseeko exists
12982 set fseeko d_fseeko
12983 eval $inlibc
12984 case "$longsize" in
12985 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12986 esac
12987
12988 : see if fsetpos exists
12989 set fsetpos d_fsetpos
12990 eval $inlibc
12991
12992
12993 : see if fstatfs exists
12994 set fstatfs d_fstatfs
12995 eval $inlibc
12996
12997
12998 : see if statvfs exists
12999 set statvfs d_statvfs
13000 eval $inlibc
13001
13002 : see if fstatvfs exists
13003 set fstatvfs d_fstatvfs
13004 eval $inlibc
13005
13006
13007 : see if fsync exists
13008 set fsync d_fsync
13009 eval $inlibc
13010
13011 : see if ftello exists
13012 set ftello d_ftello
13013 eval $inlibc
13014 case "$longsize" in
13015 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13016 esac
13017
13018 d_futimes="$undef"
13019 : check for a working futimes
13020 echo " "
13021 echo "Checking if you have a working futimes()" >&4
13022 $cat >try.c <<EOCP
13023 #include <stdio.h>
13024 #include <sys/time.h>
13025 #include <errno.h>
13026 #include <fcntl.h>
13027
13028 int main ()
13029 {
13030     int fd, rv;
13031     fd = open ("try.c", O_RDWR);
13032     if (-1 == fd) exit (1);
13033     rv = futimes (fd, NULL);
13034     exit (rv == -1 ? errno : 0);
13035 }
13036 EOCP
13037 set try
13038 if eval $compile; then
13039     `$run ./try`
13040     rc=$?
13041     case "$rc" in
13042         0)  echo "Yes, you have" >&4
13043             d_futimes="$define"
13044             ;;
13045         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13046             ;;
13047     esac
13048 else
13049     echo "No, it does not (probably harmless)" >&4
13050 fi
13051 $rm_try
13052
13053 : see if getcwd exists
13054 set getcwd d_getcwd
13055 eval $inlibc
13056
13057 : see if getespwnam exists
13058 set getespwnam d_getespwnam
13059 eval $inlibc
13060
13061
13062 : see if getfsstat exists
13063 set getfsstat d_getfsstat
13064 eval $inlibc
13065
13066 : see if getgrent exists
13067 set getgrent d_getgrent
13068 eval $inlibc
13069
13070 : see if getgrent_r exists
13071 set getgrent_r d_getgrent_r
13072 eval $inlibc
13073 case "$d_getgrent_r" in
13074 "$define")
13075         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13076         case "$d_getgrent_r_proto:$usethreads" in
13077         ":define")      d_getgrent_r_proto=define
13078                 set d_getgrent_r_proto getgrent_r $hdrs
13079                 eval $hasproto ;;
13080         *)      ;;
13081         esac
13082         case "$d_getgrent_r_proto" in
13083         define)
13084         case "$getgrent_r_proto" in
13085         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13086         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13087         esac
13088         case "$getgrent_r_proto" in
13089         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13090         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13091         esac
13092         case "$getgrent_r_proto" in
13093         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13094         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13095         esac
13096         case "$getgrent_r_proto" in
13097         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13098         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13099         esac
13100         case "$getgrent_r_proto" in
13101         ''|0) try='int getgrent_r(struct group*, char*, int);'
13102         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13103         esac
13104         case "$getgrent_r_proto" in
13105         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13106         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13107         esac
13108         case "$getgrent_r_proto" in
13109         ''|0)   d_getgrent_r=undef
13110                 getgrent_r_proto=0
13111                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13112         * )     case "$getgrent_r_proto" in
13113                 REENTRANT_PROTO*) ;;
13114                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13115                 esac
13116                 echo "Prototype: $try" ;;
13117         esac
13118         ;;
13119         *)      case "$usethreads" in
13120                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13121                 esac
13122                 d_getgrent_r=undef
13123                 getgrent_r_proto=0
13124                 ;;
13125         esac
13126         ;;
13127 *)      getgrent_r_proto=0
13128         ;;
13129 esac
13130
13131 : see if getgrgid_r exists
13132 set getgrgid_r d_getgrgid_r
13133 eval $inlibc
13134 case "$d_getgrgid_r" in
13135 "$define")
13136         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13137         case "$d_getgrgid_r_proto:$usethreads" in
13138         ":define")      d_getgrgid_r_proto=define
13139                 set d_getgrgid_r_proto getgrgid_r $hdrs
13140                 eval $hasproto ;;
13141         *)      ;;
13142         esac
13143         case "$d_getgrgid_r_proto" in
13144         define)
13145         case "$getgrgid_r_proto" in
13146         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13147         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13148         esac
13149         case "$getgrgid_r_proto" in
13150         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13151         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13152         esac
13153         case "$getgrgid_r_proto" in
13154         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13155         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13156         esac
13157         case "$getgrgid_r_proto" in
13158         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13159         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13160         esac
13161         case "$getgrgid_r_proto" in
13162         ''|0)   d_getgrgid_r=undef
13163                 getgrgid_r_proto=0
13164                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13165         * )     case "$getgrgid_r_proto" in
13166                 REENTRANT_PROTO*) ;;
13167                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13168                 esac
13169                 echo "Prototype: $try" ;;
13170         esac
13171         ;;
13172         *)      case "$usethreads" in
13173                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13174                 esac
13175                 d_getgrgid_r=undef
13176                 getgrgid_r_proto=0
13177                 ;;
13178         esac
13179         ;;
13180 *)      getgrgid_r_proto=0
13181         ;;
13182 esac
13183
13184 : see if getgrnam_r exists
13185 set getgrnam_r d_getgrnam_r
13186 eval $inlibc
13187 case "$d_getgrnam_r" in
13188 "$define")
13189         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13190         case "$d_getgrnam_r_proto:$usethreads" in
13191         ":define")      d_getgrnam_r_proto=define
13192                 set d_getgrnam_r_proto getgrnam_r $hdrs
13193                 eval $hasproto ;;
13194         *)      ;;
13195         esac
13196         case "$d_getgrnam_r_proto" in
13197         define)
13198         case "$getgrnam_r_proto" in
13199         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13200         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13201         esac
13202         case "$getgrnam_r_proto" in
13203         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13204         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13205         esac
13206         case "$getgrnam_r_proto" in
13207         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13208         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13209         esac
13210         case "$getgrnam_r_proto" in
13211         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13212         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13213         esac
13214         case "$getgrnam_r_proto" in
13215         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13216         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13217         esac
13218         case "$getgrnam_r_proto" in
13219         ''|0)   d_getgrnam_r=undef
13220                 getgrnam_r_proto=0
13221                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13222         * )     case "$getgrnam_r_proto" in
13223                 REENTRANT_PROTO*) ;;
13224                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13225                 esac
13226                 echo "Prototype: $try" ;;
13227         esac
13228         ;;
13229         *)      case "$usethreads" in
13230                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13231                 esac
13232                 d_getgrnam_r=undef
13233                 getgrnam_r_proto=0
13234                 ;;
13235         esac
13236         ;;
13237 *)      getgrnam_r_proto=0
13238         ;;
13239 esac
13240
13241 : see if gethostbyaddr exists
13242 set gethostbyaddr d_gethbyaddr
13243 eval $inlibc
13244
13245 : see if gethostbyname exists
13246 set gethostbyname d_gethbyname
13247 eval $inlibc
13248
13249 : see if gethostent exists
13250 set gethostent d_gethent
13251 eval $inlibc
13252
13253 : see how we will look up host name
13254 echo " "
13255 call=''
13256 if set gethostname val -f d_gethname; eval $csym; $val; then
13257         echo 'gethostname() found.' >&4
13258         d_gethname="$define"
13259         call=gethostname
13260 fi
13261 if set uname val -f d_uname; eval $csym; $val; then
13262         if ./xenix; then
13263                 $cat <<'EOM'
13264 uname() was found, but you're running xenix, and older versions of xenix
13265 have a broken uname(). If you don't really know whether your xenix is old
13266 enough to have a broken system call, use the default answer.
13267
13268 EOM
13269                 dflt=y
13270                 case "$d_uname" in
13271                 "$define") dflt=n;;
13272                 esac
13273                 rp='Is your uname() broken?'
13274                 . ./myread
13275                 case "$ans" in
13276                 n*) d_uname="$define"; call=uname;;
13277                 esac
13278         else
13279                 echo 'uname() found.' >&4
13280                 d_uname="$define"
13281                 case "$call" in
13282                 '') call=uname ;;
13283                 esac
13284         fi
13285 fi
13286 case "$d_gethname" in
13287 '') d_gethname="$undef";;
13288 esac
13289 case "$d_uname" in
13290 '') d_uname="$undef";;
13291 esac
13292 case "$d_uname$d_gethname" in
13293 *define*)
13294         dflt=n
13295         cat <<EOM
13296  
13297 Every now and then someone has a $call() that lies about the hostname
13298 but can't be fixed for political or economic reasons.  If you wish, I can
13299 pretend $call() isn't there and maybe compute hostname at run-time
13300 thanks to the '$phostname' command.
13301
13302 EOM
13303         rp="Shall I ignore $call() from now on?"
13304         . ./myread
13305         case "$ans" in
13306         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13307         esac;;
13308 esac
13309 case "$phostname" in
13310 '') aphostname='';;
13311 *) case "$aphostname" in
13312         /*) ;;
13313         *) set X $phostname
13314                 shift
13315                 file=$1
13316                 shift
13317                 file=`./loc $file $file $pth`
13318                 aphostname=`echo $file $*`
13319                 ;;
13320         esac
13321         ;;
13322 esac
13323 case "$d_uname$d_gethname" in
13324 *define*) ;;
13325 *)
13326         case "$phostname" in
13327         '')
13328                 echo "There will be no way for $package to get your hostname." >&4;;
13329         *)
13330         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13331                 ;;
13332         esac;;
13333 esac
13334 case "$d_phostname" in
13335 '') d_phostname="$undef";;
13336 esac
13337
13338 : see if gethostbyaddr_r exists
13339 set gethostbyaddr_r d_gethostbyaddr_r
13340 eval $inlibc
13341 case "$d_gethostbyaddr_r" in
13342 "$define")
13343         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13344         case "$d_gethostbyaddr_r_proto:$usethreads" in
13345         ":define")      d_gethostbyaddr_r_proto=define
13346                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13347                 eval $hasproto ;;
13348         *)      ;;
13349         esac
13350         case "$d_gethostbyaddr_r_proto" in
13351         define)
13352         case "$gethostbyaddr_r_proto" in
13353         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13354         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13355         esac
13356         case "$gethostbyaddr_r_proto" in
13357         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13358         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13359         esac
13360         case "$gethostbyaddr_r_proto" in
13361         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13362         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13363         esac
13364         case "$gethostbyaddr_r_proto" in
13365         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13366         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13367         esac
13368         case "$gethostbyaddr_r_proto" in
13369         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13370         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13371         esac
13372         case "$gethostbyaddr_r_proto" in
13373         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13374         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13375         esac
13376         case "$gethostbyaddr_r_proto" in
13377         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13378         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13379         esac
13380         case "$gethostbyaddr_r_proto" in
13381         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13382         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13383         esac
13384         case "$gethostbyaddr_r_proto" in
13385         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13386         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13387         esac
13388         case "$gethostbyaddr_r_proto" in
13389         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13390         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13391         esac
13392         case "$gethostbyaddr_r_proto" in
13393         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13394         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13395         esac
13396         case "$gethostbyaddr_r_proto" in
13397         ''|0)   d_gethostbyaddr_r=undef
13398                 gethostbyaddr_r_proto=0
13399                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13400         * )     case "$gethostbyaddr_r_proto" in
13401                 REENTRANT_PROTO*) ;;
13402                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13403                 esac
13404                 echo "Prototype: $try" ;;
13405         esac
13406         ;;
13407         *)      case "$usethreads" in
13408                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13409                 esac
13410                 d_gethostbyaddr_r=undef
13411                 gethostbyaddr_r_proto=0
13412                 ;;
13413         esac
13414         ;;
13415 *)      gethostbyaddr_r_proto=0
13416         ;;
13417 esac
13418
13419 : see if gethostbyname_r exists
13420 set gethostbyname_r d_gethostbyname_r
13421 eval $inlibc
13422 case "$d_gethostbyname_r" in
13423 "$define")
13424         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13425         case "$d_gethostbyname_r_proto:$usethreads" in
13426         ":define")      d_gethostbyname_r_proto=define
13427                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13428                 eval $hasproto ;;
13429         *)      ;;
13430         esac
13431         case "$d_gethostbyname_r_proto" in
13432         define)
13433         case "$gethostbyname_r_proto" in
13434         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13435         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13436         esac
13437         case "$gethostbyname_r_proto" in
13438         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13439         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13440         esac
13441         case "$gethostbyname_r_proto" in
13442         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13443         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13444         esac
13445         case "$gethostbyname_r_proto" in
13446         ''|0)   d_gethostbyname_r=undef
13447                 gethostbyname_r_proto=0
13448                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13449         * )     case "$gethostbyname_r_proto" in
13450                 REENTRANT_PROTO*) ;;
13451                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13452                 esac
13453                 echo "Prototype: $try" ;;
13454         esac
13455         ;;
13456         *)      case "$usethreads" in
13457                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13458                 esac
13459                 d_gethostbyname_r=undef
13460                 gethostbyname_r_proto=0
13461                 ;;
13462         esac
13463         ;;
13464 *)      gethostbyname_r_proto=0
13465         ;;
13466 esac
13467
13468 : see if gethostent_r exists
13469 set gethostent_r d_gethostent_r
13470 eval $inlibc
13471 case "$d_gethostent_r" in
13472 "$define")
13473         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13474         case "$d_gethostent_r_proto:$usethreads" in
13475         ":define")      d_gethostent_r_proto=define
13476                 set d_gethostent_r_proto gethostent_r $hdrs
13477                 eval $hasproto ;;
13478         *)      ;;
13479         esac
13480         case "$d_gethostent_r_proto" in
13481         define)
13482         case "$gethostent_r_proto" in
13483         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13484         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13485         esac
13486         case "$gethostent_r_proto" in
13487         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13488         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13489         esac
13490         case "$gethostent_r_proto" in
13491         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13492         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13493         esac
13494         case "$gethostent_r_proto" in
13495         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13496         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13497         esac
13498         case "$gethostent_r_proto" in
13499         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13500         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13501         esac
13502         case "$gethostent_r_proto" in
13503         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13504         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13505         esac
13506         case "$gethostent_r_proto" in
13507         ''|0)   d_gethostent_r=undef
13508                 gethostent_r_proto=0
13509                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13510         * )     case "$gethostent_r_proto" in
13511                 REENTRANT_PROTO*) ;;
13512                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13513                 esac
13514                 echo "Prototype: $try" ;;
13515         esac
13516         ;;
13517         *)      case "$usethreads" in
13518                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13519                 esac
13520                 d_gethostent_r=undef
13521                 gethostent_r_proto=0
13522                 ;;
13523         esac
13524         ;;
13525 *)      gethostent_r_proto=0
13526         ;;
13527 esac
13528
13529 : see if prototypes for various gethostxxx netdb.h functions are available
13530 echo " "
13531 set d_gethostprotos gethostent $i_netdb netdb.h
13532 eval $hasproto
13533
13534 : see if getitimer exists
13535 set getitimer d_getitimer
13536 eval $inlibc
13537
13538 : see if getlogin exists
13539 set getlogin d_getlogin
13540 eval $inlibc
13541
13542 : see if getlogin_r exists
13543 set getlogin_r d_getlogin_r
13544 eval $inlibc
13545 case "$d_getlogin_r" in
13546 "$define")
13547         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13548         case "$d_getlogin_r_proto:$usethreads" in
13549         ":define")      d_getlogin_r_proto=define
13550                 set d_getlogin_r_proto getlogin_r $hdrs
13551                 eval $hasproto ;;
13552         *)      ;;
13553         esac
13554         case "$d_getlogin_r_proto" in
13555         define)
13556         case "$getlogin_r_proto" in
13557         ''|0) try='int getlogin_r(char*, size_t);'
13558         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13559         esac
13560         case "$getlogin_r_proto" in
13561         ''|0) try='int getlogin_r(char*, int);'
13562         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13563         esac
13564         case "$getlogin_r_proto" in
13565         ''|0) try='char* getlogin_r(char*, size_t);'
13566         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13567         esac
13568         case "$getlogin_r_proto" in
13569         ''|0) try='char* getlogin_r(char*, int);'
13570         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13571         esac
13572         case "$getlogin_r_proto" in
13573         ''|0)   d_getlogin_r=undef
13574                 getlogin_r_proto=0
13575                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13576         * )     case "$getlogin_r_proto" in
13577                 REENTRANT_PROTO*) ;;
13578                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13579                 esac
13580                 echo "Prototype: $try" ;;
13581         esac
13582         ;;
13583         *)      case "$usethreads" in
13584                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13585                 esac
13586                 d_getlogin_r=undef
13587                 getlogin_r_proto=0
13588                 ;;
13589         esac
13590         ;;
13591 *)      getlogin_r_proto=0
13592         ;;
13593 esac
13594
13595 : see if getmnt exists
13596 set getmnt d_getmnt
13597 eval $inlibc
13598
13599 : see if getmntent exists
13600 set getmntent d_getmntent
13601 eval $inlibc
13602
13603 : see if getnetbyaddr exists
13604 set getnetbyaddr d_getnbyaddr
13605 eval $inlibc
13606
13607 : see if getnetbyname exists
13608 set getnetbyname d_getnbyname
13609 eval $inlibc
13610
13611 : see if getnetent exists
13612 set getnetent d_getnent
13613 eval $inlibc
13614
13615 : see if getnetbyaddr_r exists
13616 set getnetbyaddr_r d_getnetbyaddr_r
13617 eval $inlibc
13618 case "$d_getnetbyaddr_r" in
13619 "$define")
13620         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13621         case "$d_getnetbyaddr_r_proto:$usethreads" in
13622         ":define")      d_getnetbyaddr_r_proto=define
13623                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13624                 eval $hasproto ;;
13625         *)      ;;
13626         esac
13627         case "$d_getnetbyaddr_r_proto" in
13628         define)
13629         case "$getnetbyaddr_r_proto" in
13630         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13631         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13632         esac
13633         case "$getnetbyaddr_r_proto" in
13634         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13635         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13636         esac
13637         case "$getnetbyaddr_r_proto" in
13638         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13639         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13640         esac
13641         case "$getnetbyaddr_r_proto" in
13642         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13643         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13644         esac
13645         case "$getnetbyaddr_r_proto" in
13646         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13647         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13648         esac
13649         case "$getnetbyaddr_r_proto" in
13650         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13651         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13652         esac
13653         case "$getnetbyaddr_r_proto" in
13654         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13655         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13656         esac
13657         case "$getnetbyaddr_r_proto" in
13658         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13659         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13660         esac
13661         case "$getnetbyaddr_r_proto" in
13662         ''|0)   d_getnetbyaddr_r=undef
13663                 getnetbyaddr_r_proto=0
13664                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13665         * )     case "$getnetbyaddr_r_proto" in
13666                 REENTRANT_PROTO*) ;;
13667                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13668                 esac
13669                 echo "Prototype: $try" ;;
13670         esac
13671         ;;
13672         *)      case "$usethreads" in
13673                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13674                 esac
13675                 d_getnetbyaddr_r=undef
13676                 getnetbyaddr_r_proto=0
13677                 ;;
13678         esac
13679         ;;
13680 *)      getnetbyaddr_r_proto=0
13681         ;;
13682 esac
13683
13684 : see if getnetbyname_r exists
13685 set getnetbyname_r d_getnetbyname_r
13686 eval $inlibc
13687 case "$d_getnetbyname_r" in
13688 "$define")
13689         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13690         case "$d_getnetbyname_r_proto:$usethreads" in
13691         ":define")      d_getnetbyname_r_proto=define
13692                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13693                 eval $hasproto ;;
13694         *)      ;;
13695         esac
13696         case "$d_getnetbyname_r_proto" in
13697         define)
13698         case "$getnetbyname_r_proto" in
13699         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13700         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13701         esac
13702         case "$getnetbyname_r_proto" in
13703         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13704         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13705         esac
13706         case "$getnetbyname_r_proto" in
13707         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13708         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13709         esac
13710         case "$getnetbyname_r_proto" in
13711         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13712         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13713         esac
13714         case "$getnetbyname_r_proto" in
13715         ''|0)   d_getnetbyname_r=undef
13716                 getnetbyname_r_proto=0
13717                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13718         * )     case "$getnetbyname_r_proto" in
13719                 REENTRANT_PROTO*) ;;
13720                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13721                 esac
13722                 echo "Prototype: $try" ;;
13723         esac
13724         ;;
13725         *)      case "$usethreads" in
13726                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13727                 esac
13728                 d_getnetbyname_r=undef
13729                 getnetbyname_r_proto=0
13730                 ;;
13731         esac
13732         ;;
13733 *)      getnetbyname_r_proto=0
13734         ;;
13735 esac
13736
13737 : see if getnetent_r exists
13738 set getnetent_r d_getnetent_r
13739 eval $inlibc
13740 case "$d_getnetent_r" in
13741 "$define")
13742         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13743         case "$d_getnetent_r_proto:$usethreads" in
13744         ":define")      d_getnetent_r_proto=define
13745                 set d_getnetent_r_proto getnetent_r $hdrs
13746                 eval $hasproto ;;
13747         *)      ;;
13748         esac
13749         case "$d_getnetent_r_proto" in
13750         define)
13751         case "$getnetent_r_proto" in
13752         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13753         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13754         esac
13755         case "$getnetent_r_proto" in
13756         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13757         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13758         esac
13759         case "$getnetent_r_proto" in
13760         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13761         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13762         esac
13763         case "$getnetent_r_proto" in
13764         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13765         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13766         esac
13767         case "$getnetent_r_proto" in
13768         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13769         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13770         esac
13771         case "$getnetent_r_proto" in
13772         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13773         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13774         esac
13775         case "$getnetent_r_proto" in
13776         ''|0)   d_getnetent_r=undef
13777                 getnetent_r_proto=0
13778                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13779         * )     case "$getnetent_r_proto" in
13780                 REENTRANT_PROTO*) ;;
13781                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13782                 esac
13783                 echo "Prototype: $try" ;;
13784         esac
13785         ;;
13786         *)      case "$usethreads" in
13787                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13788                 esac
13789                 d_getnetent_r=undef
13790                 getnetent_r_proto=0
13791                 ;;
13792         esac
13793         ;;
13794 *)      getnetent_r_proto=0
13795         ;;
13796 esac
13797
13798 : see if prototypes for various getnetxxx netdb.h functions are available
13799 echo " "
13800 set d_getnetprotos getnetent $i_netdb netdb.h
13801 eval $hasproto
13802
13803 : see if getpagesize exists
13804 set getpagesize d_getpagsz
13805 eval $inlibc
13806
13807
13808 : see if getprotobyname exists
13809 set getprotobyname d_getpbyname
13810 eval $inlibc
13811
13812 : see if getprotobynumber exists
13813 set getprotobynumber d_getpbynumber
13814 eval $inlibc
13815
13816 : see if getprotoent exists
13817 set getprotoent d_getpent
13818 eval $inlibc
13819
13820 : see if getpgid exists
13821 set getpgid d_getpgid
13822 eval $inlibc
13823
13824 : see if getpgrp2 exists
13825 set getpgrp2 d_getpgrp2
13826 eval $inlibc
13827
13828 : see if getppid exists
13829 set getppid d_getppid
13830 eval $inlibc
13831
13832 : see if getpriority exists
13833 set getpriority d_getprior
13834 eval $inlibc
13835
13836 : see if getprotobyname_r exists
13837 set getprotobyname_r d_getprotobyname_r
13838 eval $inlibc
13839 case "$d_getprotobyname_r" in
13840 "$define")
13841         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13842         case "$d_getprotobyname_r_proto:$usethreads" in
13843         ":define")      d_getprotobyname_r_proto=define
13844                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13845                 eval $hasproto ;;
13846         *)      ;;
13847         esac
13848         case "$d_getprotobyname_r_proto" in
13849         define)
13850         case "$getprotobyname_r_proto" in
13851         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13852         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13853         esac
13854         case "$getprotobyname_r_proto" in
13855         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13856         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13857         esac
13858         case "$getprotobyname_r_proto" in
13859         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13860         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13861         esac
13862         case "$getprotobyname_r_proto" in
13863         ''|0)   d_getprotobyname_r=undef
13864                 getprotobyname_r_proto=0
13865                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13866         * )     case "$getprotobyname_r_proto" in
13867                 REENTRANT_PROTO*) ;;
13868                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13869                 esac
13870                 echo "Prototype: $try" ;;
13871         esac
13872         ;;
13873         *)      case "$usethreads" in
13874                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13875                 esac
13876                 d_getprotobyname_r=undef
13877                 getprotobyname_r_proto=0
13878                 ;;
13879         esac
13880         ;;
13881 *)      getprotobyname_r_proto=0
13882         ;;
13883 esac
13884
13885 : see if getprotobynumber_r exists
13886 set getprotobynumber_r d_getprotobynumber_r
13887 eval $inlibc
13888 case "$d_getprotobynumber_r" in
13889 "$define")
13890         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13891         case "$d_getprotobynumber_r_proto:$usethreads" in
13892         ":define")      d_getprotobynumber_r_proto=define
13893                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13894                 eval $hasproto ;;
13895         *)      ;;
13896         esac
13897         case "$d_getprotobynumber_r_proto" in
13898         define)
13899         case "$getprotobynumber_r_proto" in
13900         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13901         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13902         esac
13903         case "$getprotobynumber_r_proto" in
13904         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13905         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13906         esac
13907         case "$getprotobynumber_r_proto" in
13908         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13909         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13910         esac
13911         case "$getprotobynumber_r_proto" in
13912         ''|0)   d_getprotobynumber_r=undef
13913                 getprotobynumber_r_proto=0
13914                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13915         * )     case "$getprotobynumber_r_proto" in
13916                 REENTRANT_PROTO*) ;;
13917                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13918                 esac
13919                 echo "Prototype: $try" ;;
13920         esac
13921         ;;
13922         *)      case "$usethreads" in
13923                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13924                 esac
13925                 d_getprotobynumber_r=undef
13926                 getprotobynumber_r_proto=0
13927                 ;;
13928         esac
13929         ;;
13930 *)      getprotobynumber_r_proto=0
13931         ;;
13932 esac
13933
13934 : see if getprotoent_r exists
13935 set getprotoent_r d_getprotoent_r
13936 eval $inlibc
13937 case "$d_getprotoent_r" in
13938 "$define")
13939         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13940         case "$d_getprotoent_r_proto:$usethreads" in
13941         ":define")      d_getprotoent_r_proto=define
13942                 set d_getprotoent_r_proto getprotoent_r $hdrs
13943                 eval $hasproto ;;
13944         *)      ;;
13945         esac
13946         case "$d_getprotoent_r_proto" in
13947         define)
13948         case "$getprotoent_r_proto" in
13949         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13950         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13951         esac
13952         case "$getprotoent_r_proto" in
13953         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13954         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13955         esac
13956         case "$getprotoent_r_proto" in
13957         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13958         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13959         esac
13960         case "$getprotoent_r_proto" in
13961         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13962         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13963         esac
13964         case "$getprotoent_r_proto" in
13965         ''|0)   d_getprotoent_r=undef
13966                 getprotoent_r_proto=0
13967                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13968         * )     case "$getprotoent_r_proto" in
13969                 REENTRANT_PROTO*) ;;
13970                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13971                 esac
13972                 echo "Prototype: $try" ;;
13973         esac
13974         ;;
13975         *)      case "$usethreads" in
13976                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13977                 esac
13978                 d_getprotoent_r=undef
13979                 getprotoent_r_proto=0
13980                 ;;
13981         esac
13982         ;;
13983 *)      getprotoent_r_proto=0
13984         ;;
13985 esac
13986
13987 : see if prototypes for various getprotoxxx netdb.h functions are available
13988 echo " "
13989 set d_getprotoprotos getprotoent $i_netdb netdb.h
13990 eval $hasproto
13991
13992 : see if getprpwnam exists
13993 set getprpwnam d_getprpwnam
13994 eval $inlibc
13995
13996 : see if getpwent exists
13997 set getpwent d_getpwent
13998 eval $inlibc
13999
14000 : see if getpwent_r exists
14001 set getpwent_r d_getpwent_r
14002 eval $inlibc
14003 case "$d_getpwent_r" in
14004 "$define")
14005         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14006         case "$d_getpwent_r_proto:$usethreads" in
14007         ":define")      d_getpwent_r_proto=define
14008                 set d_getpwent_r_proto getpwent_r $hdrs
14009                 eval $hasproto ;;
14010         *)      ;;
14011         esac
14012         case "$d_getpwent_r_proto" in
14013         define)
14014         case "$getpwent_r_proto" in
14015         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14016         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14017         esac
14018         case "$getpwent_r_proto" in
14019         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14020         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14021         esac
14022         case "$getpwent_r_proto" in
14023         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14024         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14025         esac
14026         case "$getpwent_r_proto" in
14027         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14028         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14029         esac
14030         case "$getpwent_r_proto" in
14031         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14032         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14033         esac
14034         case "$getpwent_r_proto" in
14035         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14036         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14037         esac
14038         case "$getpwent_r_proto" in
14039         ''|0)   d_getpwent_r=undef
14040                 getpwent_r_proto=0
14041                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14042         * )     case "$getpwent_r_proto" in
14043                 REENTRANT_PROTO*) ;;
14044                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14045                 esac
14046                 echo "Prototype: $try" ;;
14047         esac
14048         ;;
14049         *)      case "$usethreads" in
14050                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14051                 esac
14052                 d_getpwent_r=undef
14053                 getpwent_r_proto=0
14054                 ;;
14055         esac
14056         ;;
14057 *)      getpwent_r_proto=0
14058         ;;
14059 esac
14060
14061 : see if getpwnam_r exists
14062 set getpwnam_r d_getpwnam_r
14063 eval $inlibc
14064 case "$d_getpwnam_r" in
14065 "$define")
14066         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14067         case "$d_getpwnam_r_proto:$usethreads" in
14068         ":define")      d_getpwnam_r_proto=define
14069                 set d_getpwnam_r_proto getpwnam_r $hdrs
14070                 eval $hasproto ;;
14071         *)      ;;
14072         esac
14073         case "$d_getpwnam_r_proto" in
14074         define)
14075         case "$getpwnam_r_proto" in
14076         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14077         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14078         esac
14079         case "$getpwnam_r_proto" in
14080         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14081         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14082         esac
14083         case "$getpwnam_r_proto" in
14084         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14085         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14086         esac
14087         case "$getpwnam_r_proto" in
14088         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14089         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14090         esac
14091         case "$getpwnam_r_proto" in
14092         ''|0)   d_getpwnam_r=undef
14093                 getpwnam_r_proto=0
14094                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14095         * )     case "$getpwnam_r_proto" in
14096                 REENTRANT_PROTO*) ;;
14097                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14098                 esac
14099                 echo "Prototype: $try" ;;
14100         esac
14101         ;;
14102         *)      case "$usethreads" in
14103                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14104                 esac
14105                 d_getpwnam_r=undef
14106                 getpwnam_r_proto=0
14107                 ;;
14108         esac
14109         ;;
14110 *)      getpwnam_r_proto=0
14111         ;;
14112 esac
14113
14114 : see if getpwuid_r exists
14115 set getpwuid_r d_getpwuid_r
14116 eval $inlibc
14117 case "$d_getpwuid_r" in
14118 "$define")
14119         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14120         case "$d_getpwuid_r_proto:$usethreads" in
14121         ":define")      d_getpwuid_r_proto=define
14122                 set d_getpwuid_r_proto getpwuid_r $hdrs
14123                 eval $hasproto ;;
14124         *)      ;;
14125         esac
14126         case "$d_getpwuid_r_proto" in
14127         define)
14128         case "$getpwuid_r_proto" in
14129         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14130         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14131         esac
14132         case "$getpwuid_r_proto" in
14133         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14134         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14135         esac
14136         case "$getpwuid_r_proto" in
14137         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14138         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14139         esac
14140         case "$getpwuid_r_proto" in
14141         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14142         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14143         esac
14144         case "$getpwuid_r_proto" in
14145         ''|0)   d_getpwuid_r=undef
14146                 getpwuid_r_proto=0
14147                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14148         * )     case "$getpwuid_r_proto" in
14149                 REENTRANT_PROTO*) ;;
14150                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14151                 esac
14152                 echo "Prototype: $try" ;;
14153         esac
14154         ;;
14155         *)      case "$usethreads" in
14156                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14157                 esac
14158                 d_getpwuid_r=undef
14159                 getpwuid_r_proto=0
14160                 ;;
14161         esac
14162         ;;
14163 *)      getpwuid_r_proto=0
14164         ;;
14165 esac
14166
14167
14168 : see if getservbyname exists
14169 set getservbyname d_getsbyname
14170 eval $inlibc
14171
14172 : see if getservbyport exists
14173 set getservbyport d_getsbyport
14174 eval $inlibc
14175
14176 : see if getservent exists
14177 set getservent d_getsent
14178 eval $inlibc
14179
14180 : see if getservbyname_r exists
14181 set getservbyname_r d_getservbyname_r
14182 eval $inlibc
14183 case "$d_getservbyname_r" in
14184 "$define")
14185         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14186         case "$d_getservbyname_r_proto:$usethreads" in
14187         ":define")      d_getservbyname_r_proto=define
14188                 set d_getservbyname_r_proto getservbyname_r $hdrs
14189                 eval $hasproto ;;
14190         *)      ;;
14191         esac
14192         case "$d_getservbyname_r_proto" in
14193         define)
14194         case "$getservbyname_r_proto" in
14195         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14196         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14197         esac
14198         case "$getservbyname_r_proto" in
14199         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14200         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14201         esac
14202         case "$getservbyname_r_proto" in
14203         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14204         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14205         esac
14206         case "$getservbyname_r_proto" in
14207         ''|0)   d_getservbyname_r=undef
14208                 getservbyname_r_proto=0
14209                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14210         * )     case "$getservbyname_r_proto" in
14211                 REENTRANT_PROTO*) ;;
14212                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14213                 esac
14214                 echo "Prototype: $try" ;;
14215         esac
14216         ;;
14217         *)      case "$usethreads" in
14218                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14219                 esac
14220                 d_getservbyname_r=undef
14221                 getservbyname_r_proto=0
14222                 ;;
14223         esac
14224         ;;
14225 *)      getservbyname_r_proto=0
14226         ;;
14227 esac
14228
14229 : see if getservbyport_r exists
14230 set getservbyport_r d_getservbyport_r
14231 eval $inlibc
14232 case "$d_getservbyport_r" in
14233 "$define")
14234         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14235         case "$d_getservbyport_r_proto:$usethreads" in
14236         ":define")      d_getservbyport_r_proto=define
14237                 set d_getservbyport_r_proto getservbyport_r $hdrs
14238                 eval $hasproto ;;
14239         *)      ;;
14240         esac
14241         case "$d_getservbyport_r_proto" in
14242         define)
14243         case "$getservbyport_r_proto" in
14244         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14245         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14246         esac
14247         case "$getservbyport_r_proto" in
14248         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14249         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14250         esac
14251         case "$getservbyport_r_proto" in
14252         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14253         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14254         esac
14255         case "$getservbyport_r_proto" in
14256         ''|0)   d_getservbyport_r=undef
14257                 getservbyport_r_proto=0
14258                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14259         * )     case "$getservbyport_r_proto" in
14260                 REENTRANT_PROTO*) ;;
14261                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14262                 esac
14263                 echo "Prototype: $try" ;;
14264         esac
14265         ;;
14266         *)      case "$usethreads" in
14267                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14268                 esac
14269                 d_getservbyport_r=undef
14270                 getservbyport_r_proto=0
14271                 ;;
14272         esac
14273         ;;
14274 *)      getservbyport_r_proto=0
14275         ;;
14276 esac
14277
14278 : see if getservent_r exists
14279 set getservent_r d_getservent_r
14280 eval $inlibc
14281 case "$d_getservent_r" in
14282 "$define")
14283         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14284         case "$d_getservent_r_proto:$usethreads" in
14285         ":define")      d_getservent_r_proto=define
14286                 set d_getservent_r_proto getservent_r $hdrs
14287                 eval $hasproto ;;
14288         *)      ;;
14289         esac
14290         case "$d_getservent_r_proto" in
14291         define)
14292         case "$getservent_r_proto" in
14293         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14294         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14295         esac
14296         case "$getservent_r_proto" in
14297         ''|0) try='int getservent_r(struct servent*, char*, int);'
14298         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14299         esac
14300         case "$getservent_r_proto" in
14301         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14302         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14303         esac
14304         case "$getservent_r_proto" in
14305         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14306         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14307         esac
14308         case "$getservent_r_proto" in
14309         ''|0)   d_getservent_r=undef
14310                 getservent_r_proto=0
14311                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14312         * )     case "$getservent_r_proto" in
14313                 REENTRANT_PROTO*) ;;
14314                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14315                 esac
14316                 echo "Prototype: $try" ;;
14317         esac
14318         ;;
14319         *)      case "$usethreads" in
14320                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14321                 esac
14322                 d_getservent_r=undef
14323                 getservent_r_proto=0
14324                 ;;
14325         esac
14326         ;;
14327 *)      getservent_r_proto=0
14328         ;;
14329 esac
14330
14331 : see if prototypes for various getservxxx netdb.h functions are available
14332 echo " "
14333 set d_getservprotos getservent $i_netdb netdb.h
14334 eval $hasproto
14335
14336 : see if getspnam exists
14337 set getspnam d_getspnam
14338 eval $inlibc
14339
14340 : see if this is a shadow.h system
14341 set shadow.h i_shadow
14342 eval $inhdr
14343
14344 : see if getspnam_r exists
14345 set getspnam_r d_getspnam_r
14346 eval $inlibc
14347 case "$d_getspnam_r" in
14348 "$define")
14349         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14350         case "$d_getspnam_r_proto:$usethreads" in
14351         ":define")      d_getspnam_r_proto=define
14352                 set d_getspnam_r_proto getspnam_r $hdrs
14353                 eval $hasproto ;;
14354         *)      ;;
14355         esac
14356         case "$d_getspnam_r_proto" in
14357         define)
14358         case "$getspnam_r_proto" in
14359         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14360         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14361         esac
14362         case "$getspnam_r_proto" in
14363         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14364         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14365         esac
14366         case "$getspnam_r_proto" in
14367         ''|0)   d_getspnam_r=undef
14368                 getspnam_r_proto=0
14369                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14370         * )     case "$getspnam_r_proto" in
14371                 REENTRANT_PROTO*) ;;
14372                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14373                 esac
14374                 echo "Prototype: $try" ;;
14375         esac
14376         ;;
14377         *)      case "$usethreads" in
14378                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14379                 esac
14380                 d_getspnam_r=undef
14381                 getspnam_r_proto=0
14382                 ;;
14383         esac
14384         ;;
14385 *)      getspnam_r_proto=0
14386         ;;
14387 esac
14388
14389 : see if gettimeofday or ftime exists
14390 set gettimeofday d_gettimeod
14391 eval $inlibc
14392 case "$d_gettimeod" in
14393 "$undef")
14394         set ftime d_ftime 
14395         eval $inlibc
14396         ;;
14397 *)
14398         val="$undef"; set d_ftime; eval $setvar
14399         ;;
14400 esac
14401 case "$d_gettimeod$d_ftime" in
14402 "$undef$undef")
14403         echo " "
14404         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14405         ;;
14406 esac
14407
14408 : see if gmtime_r exists
14409 set gmtime_r d_gmtime_r
14410 eval $inlibc
14411 case "$d_gmtime_r" in
14412 "$define")
14413         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14414         case "$d_gmtime_r_proto:$usethreads" in
14415         ":define")      d_gmtime_r_proto=define
14416                 set d_gmtime_r_proto gmtime_r $hdrs
14417                 eval $hasproto ;;
14418         *)      ;;
14419         esac
14420         case "$d_gmtime_r_proto" in
14421         define)
14422         case "$gmtime_r_proto" in
14423         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14424         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14425         esac
14426         case "$gmtime_r_proto" in
14427         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14428         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14429         esac
14430         case "$gmtime_r_proto" in
14431         ''|0)   d_gmtime_r=undef
14432                 gmtime_r_proto=0
14433                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14434         * )     case "$gmtime_r_proto" in
14435                 REENTRANT_PROTO*) ;;
14436                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14437                 esac
14438                 echo "Prototype: $try" ;;
14439         esac
14440         ;;
14441         *)      case "$usethreads" in
14442                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14443                 esac
14444                 d_gmtime_r=undef
14445                 gmtime_r_proto=0
14446                 ;;
14447         esac
14448         ;;
14449 *)      gmtime_r_proto=0
14450         ;;
14451 esac
14452
14453 : see if hasmntopt exists
14454 set hasmntopt d_hasmntopt
14455 eval $inlibc
14456
14457 : see if this is a netinet/in.h or sys/in.h system
14458 set netinet/in.h i_niin sys/in.h i_sysin
14459 eval $inhdr
14460
14461 : see if arpa/inet.h has to be included
14462 set arpa/inet.h i_arpainet
14463 eval $inhdr
14464
14465 : see if htonl --and friends-- exists
14466 val=''
14467 set htonl val
14468 eval $inlibc
14469
14470 : Maybe they are macros.
14471 case "$val" in
14472 $undef)
14473         $cat >htonl.c <<EOM
14474 #include <stdio.h>
14475 #include <sys/types.h>
14476 #$i_niin I_NETINET_IN
14477 #$i_sysin I_SYS_IN
14478 #$i_arpainet I_ARPA_INET
14479 #ifdef I_NETINET_IN
14480 #include <netinet/in.h>
14481 #endif
14482 #ifdef I_SYS_IN
14483 #include <sys/in.h>
14484 #endif
14485 #ifdef I_ARPA_INET
14486 #include <arpa/inet.h>
14487 #endif
14488 #ifdef htonl
14489 printf("Defined as a macro.");
14490 #endif
14491 EOM
14492         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14493         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14494                 val="$define"
14495                 echo "But it seems to be defined as a macro." >&4
14496         fi
14497         $rm -f htonl.?
14498         ;;
14499 esac
14500 set d_htonl
14501 eval $setvar
14502
14503 : see if ilogbl exists
14504 set ilogbl d_ilogbl
14505 eval $inlibc
14506
14507 : index or strchr
14508 echo " "
14509 if set index val -f; eval $csym; $val; then
14510         if set strchr val -f d_strchr; eval $csym; $val; then
14511                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14512                         val="$define"
14513                         vali="$undef"
14514                         echo "strchr() found." >&4
14515                 else
14516                         val="$undef"
14517                         vali="$define"
14518                         echo "index() found." >&4
14519                 fi
14520         else
14521                 val="$undef"
14522                 vali="$define"
14523                 echo "index() found." >&4
14524         fi
14525 else
14526         if set strchr val -f d_strchr; eval $csym; $val; then
14527                 val="$define"
14528                 vali="$undef"
14529                 echo "strchr() found." >&4
14530         else
14531                 echo "No index() or strchr() found!" >&4
14532                 val="$undef"
14533                 vali="$undef"
14534         fi
14535 fi
14536 set d_strchr; eval $setvar
14537 val="$vali"
14538 set d_index; eval $setvar
14539
14540 : check whether inet_aton exists
14541 set inet_aton d_inetaton
14542 eval $inlibc
14543
14544 : Look for isascii
14545 echo " "
14546 $cat >isascii.c <<EOCP
14547 #include <stdio.h>
14548 #include <ctype.h>
14549 #$i_stdlib I_STDLIB
14550 #ifdef I_STDLIB
14551 #include <stdlib.h>
14552 #endif
14553 int main() {
14554         int c = 'A';
14555         if (isascii(c))
14556                 exit(0);
14557         else
14558                 exit(1);
14559 }
14560 EOCP
14561 set isascii
14562 if eval $compile; then
14563         echo "isascii() found." >&4
14564         val="$define"
14565 else
14566         echo "isascii() NOT found." >&4
14567         val="$undef"
14568 fi
14569 set d_isascii
14570 eval $setvar
14571 $rm -f isascii*
14572
14573 : see if isfinite exists
14574 set isfinite d_isfinite
14575 eval $inlibc
14576
14577 : see if isinf exists
14578 set isinf d_isinf
14579 eval $inlibc
14580
14581 : see if isnan exists
14582 set isnan d_isnan
14583 eval $inlibc
14584
14585 : see if isnanl exists
14586 set isnanl d_isnanl
14587 eval $inlibc
14588
14589 : see if killpg exists
14590 set killpg d_killpg
14591 eval $inlibc
14592
14593 : see if lchown exists
14594 echo " "
14595 $cat > try.c <<'EOCP'
14596 /* System header to define __stub macros and hopefully few prototypes,
14597     which can conflict with char lchown(); below.  */
14598 #include <assert.h>
14599 /* Override any gcc2 internal prototype to avoid an error.  */
14600 /* We use char because int might match the return type of a gcc2
14601    builtin and then its argument prototype would still apply.  */
14602 char lchown();
14603 int main() {
14604     /*  The GNU C library defines this for functions which it implements
14605         to always fail with ENOSYS.  Some functions are actually named
14606         something starting with __ and the normal name is an alias.  */
14607 #if defined (__stub_lchown) || defined (__stub___lchown)
14608 choke me
14609 #else
14610 lchown();
14611 #endif
14612 ; return 0; }
14613 EOCP
14614 set try
14615 if eval $compile; then
14616     $echo "lchown() found." >&4
14617     val="$define"
14618 else
14619     $echo "lchown() NOT found." >&4
14620     val="$undef"
14621 fi
14622 set d_lchown
14623 eval $setvar
14624
14625 : See if number of significant digits in a double precision number is known
14626 echo " "
14627 $cat >ldbl_dig.c <<EOM
14628 #$i_limits I_LIMITS
14629 #$i_float I_FLOAT
14630 #ifdef I_LIMITS
14631 #include <limits.h>
14632 #endif
14633 #ifdef I_FLOAT
14634 #include <float.h>
14635 #endif
14636 #ifdef LDBL_DIG
14637 printf("Contains LDBL_DIG");
14638 #endif
14639 EOM
14640 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14641 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14642         echo "LDBL_DIG found." >&4
14643         val="$define"
14644 else
14645         echo "LDBL_DIG NOT found." >&4
14646         val="$undef"
14647 fi
14648 $rm -f ldbl_dig.?
14649 set d_ldbl_dig
14650 eval $setvar
14651
14652 : see if this is a math.h system
14653 set math.h i_math
14654 eval $inhdr
14655
14656 d_libm_lib_version="$undef"
14657 case $i_math in
14658     $define)
14659         : check to see if math.h defines _LIB_VERSION
14660         echo " "
14661         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14662         $cat >try.c <<EOCP
14663 #include <unistd.h>
14664 #include <math.h>
14665 int main (int argc, char *argv[])
14666 {
14667     printf ("%d\n", _LIB_VERSION);
14668     return (0);
14669     } /* main */
14670 EOCP
14671         set try
14672         if eval $compile; then
14673             foo=`$run ./try`
14674             echo "Yes, it does ($foo)" >&4
14675             d_libm_lib_version="$define"
14676         else
14677             echo "No, it does not (probably harmless)" >&4
14678             fi
14679         $rm_try
14680         ;;
14681
14682     esac
14683
14684 : see if link exists
14685 set link d_link
14686 eval $inlibc
14687
14688 : see if localtime_r exists
14689 set localtime_r d_localtime_r
14690 eval $inlibc
14691 case "$d_localtime_r" in
14692 "$define")
14693         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14694         case "$d_localtime_r_proto:$usethreads" in
14695         ":define")      d_localtime_r_proto=define
14696                 set d_localtime_r_proto localtime_r $hdrs
14697                 eval $hasproto ;;
14698         *)      ;;
14699         esac
14700         case "$d_localtime_r_proto" in
14701         define)
14702         case "$localtime_r_proto" in
14703         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14704         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14705         esac
14706         case "$localtime_r_proto" in
14707         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14708         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14709         esac
14710         case "$localtime_r_proto" in
14711         ''|0)   d_localtime_r=undef
14712                 localtime_r_proto=0
14713                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14714         * )     case "$localtime_r_proto" in
14715                 REENTRANT_PROTO*) ;;
14716                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14717                 esac
14718                 echo "Prototype: $try" ;;
14719         esac
14720         ;;
14721         *)      case "$usethreads" in
14722                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14723                 esac
14724                 d_localtime_r=undef
14725                 localtime_r_proto=0
14726                 ;;
14727         esac
14728         ;;
14729 *)      localtime_r_proto=0
14730         ;;
14731 esac
14732
14733 : see if localtime_r calls tzset
14734 case "$localtime_r_proto" in
14735 REENTRANT_PROTO*)
14736         $cat >try.c <<EOCP
14737 /*  Does our libc's localtime_r call tzset ?
14738  *  return 0 if so, 1 otherwise.
14739  */
14740 #include <sys/types.h>
14741 #include <unistd.h>
14742 #include <time.h>
14743 #include <string.h>
14744 #include <malloc.h>
14745 int main()
14746 {
14747     time_t t = time(0L);
14748     char w_tz[]="TZ" "=GMT+5",
14749          e_tz[]="TZ" "=GMT-5",
14750         *tz_e = (char*)malloc(16),
14751         *tz_w = (char*)malloc(16);
14752     struct tm tm_e, tm_w;
14753     memset(&tm_e,'\0',sizeof(struct tm));
14754     memset(&tm_w,'\0',sizeof(struct tm));
14755     strcpy(tz_e,e_tz);
14756     strcpy(tz_w,w_tz);
14757
14758     putenv(tz_e);
14759     localtime_r(&t, &tm_e);
14760
14761     putenv(tz_w);
14762     localtime_r(&t, &tm_w);
14763
14764     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14765         return 1;
14766     return 0;
14767 }
14768 EOCP
14769         set try
14770         if eval $compile; then
14771             if $run ./try; then
14772                 d_localtime_r_needs_tzset=undef;
14773             else
14774                 d_localtime_r_needs_tzset=define;
14775             fi;
14776         else
14777             d_localtime_r_needs_tzset=undef;
14778         fi;
14779      ;;
14780   *)
14781      d_localtime_r_needs_tzset=undef;
14782      ;;
14783 esac
14784 $rm_try
14785
14786 : see if localeconv exists
14787 set localeconv d_locconv
14788 eval $inlibc
14789
14790 : see if lockf exists
14791 set lockf d_lockf
14792 eval $inlibc
14793
14794 : see if prototype for lseek is available
14795 echo " "
14796 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14797 eval $hasproto
14798
14799 : see if lstat exists
14800 set lstat d_lstat
14801 eval $inlibc
14802
14803 : see if madvise exists
14804 set madvise d_madvise
14805 eval $inlibc
14806
14807 : see if malloc_size exists
14808 set malloc_size d_malloc_size
14809 eval $inlibc
14810
14811 : see if malloc_size_good exists
14812 set malloc_good_size d_malloc_good_size
14813 eval $inlibc
14814
14815 : see if mblen exists
14816 set mblen d_mblen
14817 eval $inlibc
14818
14819 : see if mbstowcs exists
14820 set mbstowcs d_mbstowcs
14821 eval $inlibc
14822
14823 : see if mbtowc exists
14824 set mbtowc d_mbtowc
14825 eval $inlibc
14826
14827 : see if memchr exists
14828 set memchr d_memchr
14829 eval $inlibc
14830
14831 : see if memcmp exists
14832 set memcmp d_memcmp
14833 eval $inlibc
14834
14835 : see if memcpy exists
14836 set memcpy d_memcpy
14837 eval $inlibc
14838
14839 : see if memmove exists
14840 set memmove d_memmove
14841 eval $inlibc
14842
14843 : see if memset exists
14844 set memset d_memset
14845 eval $inlibc
14846
14847 : see if mkdir exists
14848 set mkdir d_mkdir
14849 eval $inlibc
14850
14851 : see if mkdtemp exists
14852 set mkdtemp d_mkdtemp
14853 eval $inlibc
14854
14855 : see if mkfifo exists
14856 set mkfifo d_mkfifo
14857 eval $inlibc
14858
14859 : see if mkstemp exists
14860 set mkstemp d_mkstemp
14861 eval $inlibc
14862
14863 : see if mkstemps exists
14864 set mkstemps d_mkstemps
14865 eval $inlibc
14866
14867 : see if mktime exists
14868 set mktime d_mktime
14869 eval $inlibc
14870
14871 : see if this is a sys/mman.h system
14872 set sys/mman.h i_sysmman
14873 eval $inhdr
14874
14875 : see if mmap exists
14876 set mmap d_mmap
14877 eval $inlibc
14878 : see what shmat returns
14879 : default to something harmless
14880 mmaptype='void *'
14881 case "$i_sysmman$d_mmap" in
14882 "$define$define")
14883         $cat >mmap.c <<'END'
14884 #include <sys/mman.h>
14885 void *mmap();
14886 END
14887         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14888                 mmaptype='void *'
14889         else
14890                 mmaptype='caddr_t'
14891         fi
14892         echo "and it returns ($mmaptype)." >&4
14893         ;;
14894 esac
14895
14896
14897
14898 : see if sqrtl exists
14899 set sqrtl d_sqrtl
14900 eval $inlibc
14901
14902 : see if scalbnl exists
14903 set scalbnl d_scalbnl
14904 eval $inlibc
14905
14906 : see if modfl exists
14907 set modfl d_modfl
14908 eval $inlibc
14909
14910 : see if prototype for modfl is available
14911 echo " "
14912 set d_modflproto modfl $i_math math.h
14913 eval $hasproto
14914
14915 d_modfl_pow32_bug="$undef"
14916
14917 case "$d_longdbl$d_modfl" in
14918 $define$define)
14919         $cat <<EOM
14920 Checking to see whether your modfl() is okay for large values...
14921 EOM
14922 $cat >try.c <<EOCP
14923 #include <math.h>
14924 #include <stdio.h>
14925 EOCP
14926 if $test "X$d_modflproto" != "X$define"; then
14927         $cat >>try.c <<EOCP
14928 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14929 long double modfl (long double, long double *);
14930 EOCP
14931 fi
14932 $cat >>try.c <<EOCP
14933 int main() {
14934     long double nv = 4294967303.15;
14935     long double v, w;
14936     v = modfl(nv, &w);
14937 #ifdef __GLIBC__
14938     printf("glibc");
14939 #endif
14940     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14941     return 0;
14942 }
14943 EOCP
14944         case "$osname:$gccversion" in
14945         aix:)   saveccflags="$ccflags"
14946                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14947         esac
14948         set try
14949         if eval $compile; then
14950                 foo=`$run ./try`
14951                 case "$foo" in
14952                 *" 4294967303.150000 1.150000 4294967302.000000")
14953                         echo >&4 "Your modfl() is broken for large values."
14954                         d_modfl_pow32_bug="$define"
14955                         case "$foo" in
14956                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14957                         ;;
14958                         esac
14959                         ;;
14960                 *" 4294967303.150000 0.150000 4294967303.000000")
14961                         echo >&4 "Your modfl() seems okay for large values."
14962                         ;;
14963                 *)      echo >&4 "I don't understand your modfl() at all."
14964                         d_modfl="$undef"
14965                         ;;
14966                 esac
14967                 $rm_try
14968         else
14969                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14970                 d_modfl="$undef"
14971         fi
14972         case "$osname:$gccversion" in
14973         aix:)   ccflags="$saveccflags" ;; # restore
14974         esac
14975         ;;
14976 esac
14977
14978 if $test "$uselongdouble" = "$define"; then
14979     message=""
14980     if $test "$d_sqrtl" != "$define"; then
14981         message="$message sqrtl"
14982     fi
14983     if $test "$d_modfl" != "$define"; then
14984         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14985             echo "You have both aintl and copysignl, so I can emulate modfl."
14986         else
14987             message="$message modfl"
14988         fi
14989     fi
14990     if $test "$d_frexpl" != "$define"; then
14991         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14992             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14993         else
14994             message="$message frexpl"
14995         fi
14996     fi
14997
14998     if $test "$message" != ""; then
14999         $cat <<EOM >&4
15000
15001 *** You requested the use of long doubles but you do not seem to have
15002 *** the following mathematical functions needed for long double support:
15003 ***    $message
15004 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15005 *** Cannot continue, aborting.
15006
15007 EOM
15008
15009         exit 1
15010     fi
15011 fi
15012
15013 : see if mprotect exists
15014 set mprotect d_mprotect
15015 eval $inlibc
15016
15017 : see if msgctl exists
15018 set msgctl d_msgctl
15019 eval $inlibc
15020
15021 : see if msgget exists
15022 set msgget d_msgget
15023 eval $inlibc
15024
15025 : see if msgsnd exists
15026 set msgsnd d_msgsnd
15027 eval $inlibc
15028
15029 : see if msgrcv exists
15030 set msgrcv d_msgrcv
15031 eval $inlibc
15032
15033 : see how much of the 'msg*(2)' library is present.
15034 h_msg=true
15035 echo " "
15036 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15037 *"$undef"*) h_msg=false;;
15038 esac
15039 case "$osname" in
15040 freebsd)
15041     case "`ipcs 2>&1`" in
15042     "SVID messages"*"not configured"*)
15043         echo "Your $osname does not have the msg*(2) configured." >&4
15044         h_msg=false
15045         val="$undef"
15046         set msgctl d_msgctl
15047         eval $setvar
15048         set msgget d_msgget
15049         eval $setvar
15050         set msgsnd d_msgsnd
15051         eval $setvar
15052         set msgrcv d_msgrcv
15053         eval $setvar
15054         ;;
15055     esac
15056     ;;
15057 esac
15058 : we could also check for sys/ipc.h ...
15059 if $h_msg && $test `./findhdr sys/msg.h`; then
15060         echo "You have the full msg*(2) library." >&4
15061         val="$define"
15062 else
15063         echo "You don't have the full msg*(2) library." >&4
15064         val="$undef"
15065 fi
15066 set d_msg
15067 eval $setvar
15068
15069
15070 echo " "
15071 echo "Checking to see if your system supports struct msghdr..." >&4
15072 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15073 eval $hasstruct
15074 case "$d_msghdr_s" in
15075 "$define")      echo "Yes, it does."   ;;
15076 *)              echo "No, it doesn't." ;;
15077 esac
15078
15079
15080 : see if msync exists
15081 set msync d_msync
15082 eval $inlibc
15083
15084 : see if munmap exists
15085 set munmap d_munmap
15086 eval $inlibc
15087
15088 : see if nice exists
15089 set nice d_nice
15090 eval $inlibc
15091
15092 : see if this is a langinfo.h system
15093 set langinfo.h i_langinfo
15094 eval $inhdr
15095
15096 : see if nl_langinfo exists
15097 set nl_langinfo d_nl_langinfo
15098 eval $inlibc
15099
15100 : check for volatile keyword
15101 echo " "
15102 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15103 $cat >try.c <<'EOCP'
15104 int main()
15105 {
15106         typedef struct _goo_struct goo_struct;
15107         goo_struct * volatile goo = ((goo_struct *)0);
15108         struct _goo_struct {
15109                 long long_int;
15110                 int reg_int;
15111                 char char_var;
15112         };
15113         typedef unsigned short foo_t;
15114         char *volatile foo;
15115         volatile int bar;
15116         volatile foo_t blech;
15117         foo = foo;
15118 }
15119 EOCP
15120 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15121         val="$define"
15122         echo "Yup, it does."
15123 else
15124         val="$undef"
15125         echo "Nope, it doesn't."
15126 fi
15127 set d_volatile
15128 eval $setvar
15129 $rm_try
15130
15131
15132 echo " "
15133 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15134
15135 case "$use64bitint:$d_quad:$quadtype" in
15136 define:define:?*)
15137         ivtype="$quadtype"
15138         uvtype="$uquadtype"
15139         ivsize=8
15140         uvsize=8
15141         ;;
15142 *)      ivtype="long"
15143         uvtype="unsigned long"
15144         ivsize=$longsize
15145         uvsize=$longsize
15146         ;;
15147 esac
15148
15149 case "$uselongdouble:$d_longdbl" in
15150 define:define)
15151         nvtype="long double"
15152         nvsize=$longdblsize
15153         ;;
15154 *)      nvtype=double
15155         nvsize=$doublesize
15156         ;;
15157 esac
15158
15159 $echo "(IV will be "$ivtype", $ivsize bytes)"
15160 $echo "(UV will be "$uvtype", $uvsize bytes)"
15161 $echo "(NV will be "$nvtype", $nvsize bytes)"
15162
15163 $cat >try.c <<EOCP
15164 #$i_inttypes I_INTTYPES
15165 #ifdef I_INTTYPES
15166 #include <inttypes.h>
15167 #endif
15168 #include <stdio.h>
15169 int main() {
15170 #ifdef INT8
15171    int8_t i =  INT8_MAX;
15172   uint8_t u = UINT8_MAX;
15173   printf("int8_t\n");
15174 #endif
15175 #ifdef INT16
15176    int16_t i =  INT16_MAX;
15177   uint16_t i = UINT16_MAX;
15178   printf("int16_t\n");
15179 #endif
15180 #ifdef INT32
15181    int32_t i =  INT32_MAX;
15182   uint32_t u = UINT32_MAX;
15183   printf("int32_t\n");
15184 #endif
15185 }
15186 EOCP
15187
15188 i8type=char
15189 u8type="unsigned char"
15190 i8size=1
15191 u8size=1
15192
15193 case "$i16type" in
15194 '')     case "$shortsize" in
15195         2)      i16type=short
15196                 u16type="unsigned short"
15197                 i16size=$shortsize
15198                 u16size=$shortsize
15199                 ;;
15200         esac
15201         ;;
15202 esac
15203 case "$i16type" in
15204 '')     set try -DINT16
15205         if eval $compile; then
15206                 case "`$run ./try`" in
15207                 int16_t)
15208                         i16type=int16_t
15209                         u16type=uint16_t
15210                         i16size=2
15211                         u16size=2
15212                         ;;
15213                 esac
15214         fi
15215         ;;
15216 esac
15217 case "$i16type" in
15218 '')     if $test $shortsize -ge 2; then
15219                 i16type=short
15220                 u16type="unsigned short"
15221                 i16size=$shortsize
15222                 u16size=$shortsize
15223         fi
15224         ;;
15225 esac
15226
15227 case "$i32type" in
15228 '')     case "$longsize" in
15229         4)      i32type=long
15230                 u32type="unsigned long"
15231                 i32size=$longsize
15232                 u32size=$longsize
15233                 ;;
15234         *)      case "$intsize" in
15235                 4)      i32type=int
15236                         u32type="unsigned int"
15237                         i32size=$intsize
15238                         u32size=$intsize
15239                         ;;
15240                 esac
15241                 ;;
15242         esac
15243         ;;
15244 esac
15245 case "$i32type" in
15246 '')     set try -DINT32
15247         if eval $compile; then
15248                 case "`$run ./try`" in
15249                 int32_t)
15250                         i32type=int32_t
15251                         u32type=uint32_t
15252                         i32size=4
15253                         u32size=4
15254                         ;;
15255                 esac
15256         fi
15257         ;;
15258 esac
15259 case "$i32type" in
15260 '')     if $test $intsize -ge 4; then
15261                 i32type=int
15262                 u32type="unsigned int"
15263                 i32size=$intsize
15264                 u32size=$intsize
15265         fi
15266         ;;
15267 esac
15268
15269 case "$i64type" in
15270 '')     case "$d_quad:$quadtype" in
15271         define:?*)
15272                 i64type="$quadtype"
15273                 u64type="$uquadtype"
15274                 i64size=8
15275                 u64size=8
15276                 ;;
15277         esac
15278         ;;
15279 esac
15280
15281 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15282 : volatile so that the compiler has to store it out to memory.
15283 if test X"$d_volatile" = X"$define"; then
15284         volatile=volatile
15285 fi
15286 $cat <<EOP >try.c
15287 #include <stdio.h>
15288 #$i_stdlib I_STDLIB
15289 #ifdef I_STDLIB
15290 #include <stdlib.h>
15291 #endif
15292 #include <sys/types.h>
15293 #include <signal.h>
15294 #ifdef SIGFPE
15295 $volatile int bletched = 0;
15296 $signal_t blech(int s) { bletched = 1; }
15297 #endif
15298 int main() {
15299     $uvtype u = 0;
15300     $nvtype d;
15301     int     n = 8 * $uvsize;
15302     int     i;
15303 #ifdef SIGFPE
15304     signal(SIGFPE, blech);
15305 #endif
15306
15307     for (i = 0; i < n; i++) {
15308       u = u << 1 | ($uvtype)1;
15309       d = ($nvtype)u;
15310       if (($uvtype)d != u)
15311         break;
15312       if (d <= 0)
15313         break;
15314       d = ($nvtype)(u - 1);
15315       if (($uvtype)d != (u - 1))
15316         break;
15317 #ifdef SIGFPE
15318       if (bletched)
15319         break;
15320 #endif
15321     }
15322     printf("%d\n", ((i == n) ? -n : i));
15323     exit(0);
15324 }
15325 EOP
15326 set try
15327
15328 d_nv_preserves_uv="$undef"
15329 if eval $compile; then
15330         nv_preserves_uv_bits="`$run ./try`"
15331 fi
15332 case "$nv_preserves_uv_bits" in
15333 \-[1-9]*)
15334         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15335         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15336         d_nv_preserves_uv="$define"
15337         ;;
15338 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15339         d_nv_preserves_uv="$undef" ;;
15340 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15341         nv_preserves_uv_bits="0" ;;
15342 esac
15343 $rm_try
15344
15345 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15346 : volatile so that the compiler has to store it out to memory.
15347 if test X"$d_volatile" = X"$define"; then
15348         volatile=volatile
15349 fi
15350 $cat <<EOP >try.c
15351 #include <stdio.h>
15352 #$i_stdlib I_STDLIB
15353 #ifdef I_STDLIB
15354 #include <stdlib.h>
15355 #endif
15356 #$i_string I_STRING
15357 #ifdef I_STRING
15358 #  include <string.h>
15359 #else
15360 #  include <strings.h>
15361 #endif
15362 #include <sys/types.h>
15363 #include <signal.h>
15364 #ifdef SIGFPE
15365 $volatile int bletched = 0;
15366 $signal_t blech(int s) { bletched = 1; }
15367 #endif
15368
15369 int checkit($nvtype d, char *where) {
15370     unsigned char *p = (char *)&d;
15371     unsigned char *end = p + sizeof(d);
15372     int fail = 0;
15373
15374     while (p < end)
15375         fail += *p++;
15376
15377     if (!fail)
15378         return 0;
15379
15380     p = (char *)&d;
15381     printf("No - %s: 0x", where);
15382     while (p < end)
15383         printf ("%02X", *p++);
15384     printf("\n");
15385     return 1;
15386 }
15387
15388 int main(int argc, char **argv) {
15389     $nvtype d = 0.0;
15390     int fail = 0;
15391     fail += checkit(d, "0.0");
15392
15393     /* The compiler shouldn't be assuming that bletched is 0  */
15394     d = bletched;
15395
15396     fail += checkit(d, "bleched");
15397
15398 #ifdef SIGFPE
15399     signal(SIGFPE, blech);
15400 #endif
15401
15402     /* Paranoia - the compiler should have no way of knowing that ANSI says
15403        that argv[argc] will always be NULL.  Actually, if it did assume this it
15404        would be buggy, as this is C and main() can be called from elsewhere in
15405        the program.  */
15406     d = argv[argc] ? 1 : 0;
15407
15408     if (d) {
15409         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15410     }
15411
15412     fail += checkit(d, "ternary");
15413
15414     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15415
15416     if (d != 0.0) {
15417         printf("No - memset doesn't give 0.0\n");
15418         /* This might just blow up:  */
15419         printf("(gives %g)\n", d);
15420         return 1;
15421     }
15422
15423 #ifdef SIGFPE
15424     if (bletched) {
15425         printf("No - something bleched\n");
15426         return 1;
15427     }
15428 #endif
15429     if (fail) {
15430       printf("No - %d fail(s)\n", fail);
15431       return 1;
15432     }
15433     printf("Yes\n");
15434     return 0;
15435 }
15436 EOP
15437 set try
15438
15439 d_nv_zero_is_allbits_zero="$undef"
15440 if eval $compile; then
15441     xxx="`$run ./try`"
15442     case "$?" in
15443         0)
15444             case "$xxx" in
15445                 Yes)  cat >&4 <<EOM
15446 0.0 is represented as all bits zero in memory
15447 EOM
15448                     d_nv_zero_is_allbits_zero="$define"
15449                     ;;
15450                 *)  cat >&4 <<EOM
15451 0.0 is not represented as all bits zero in memory
15452 EOM
15453                     d_nv_zero_is_allbits_zero="$undef"
15454                     ;;
15455             esac
15456             ;;
15457         *)  cat >&4 <<EOM
15458 0.0 is not represented as all bits zero in memory
15459 EOM
15460             d_nv_zero_is_allbits_zero="$undef"
15461             ;;
15462     esac
15463 fi
15464 $rm_try
15465
15466 : check for off64_t
15467 echo " "
15468 echo "Checking to see if you have off64_t..." >&4
15469 $cat >try.c <<EOCP
15470 #include <sys/types.h>
15471 #include <unistd.h>
15472 int main() { off64_t x = 7; }
15473 EOCP
15474 set try
15475 if eval $compile; then
15476         val="$define"
15477         echo "You have off64_t."
15478 else
15479         val="$undef"
15480         echo "You do not have off64_t."
15481         case "$lseeksize" in
15482         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15483         esac
15484 fi
15485 $rm_try
15486 set d_off64_t
15487 eval $setvar
15488
15489 : how to create joinable pthreads
15490 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15491         echo " "
15492         echo "Checking what constant to use for creating joinable pthreads..." >&4
15493         $cat >try.c <<'EOCP'
15494 #include <pthread.h>
15495 int main() {
15496     int detachstate = JOINABLE;
15497 }
15498 EOCP
15499         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15500         if eval $compile; then
15501                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15502                 val="$undef" # Yes, undef.
15503                 set d_old_pthread_create_joinable
15504                 eval $setvar
15505                 val=""
15506                 set old_pthread_create_joinable
15507                 eval $setvar
15508         else
15509                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15510                 if eval $compile; then
15511                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15512                         val="$define"
15513                         set d_old_pthread_create_joinable
15514                         eval $setvar
15515                         val=PTHREAD_CREATE_UNDETACHED
15516                         set old_pthread_create_joinable
15517                         eval $setvar
15518                 else
15519                         set try -DJOINABLE=__UNDETACHED
15520                         if eval $compile; then
15521                                 echo "You seem to use __UNDETACHED." >&4
15522                                 val="$define"
15523                                 set d_old_pthread_create_joinable
15524                                 eval $setvar
15525                                 val=__UNDETACHED
15526                                 set old_pthread_create_joinable
15527                                 eval $setvar
15528                         else
15529                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15530                                 val="$define"
15531                                 set d_old_pthread_create_joinable
15532                                 eval $setvar
15533                                 val=0
15534                                 set old_pthread_create_joinable
15535                                 eval $setvar
15536                         fi
15537                 fi
15538         fi
15539         $rm_try
15540 else
15541     d_old_pthread_create_joinable="$undef"
15542     old_pthread_create_joinable=""
15543 fi
15544
15545 : see if pause exists
15546 set pause d_pause
15547 eval $inlibc
15548
15549 : see if poll exists
15550 set poll d_poll
15551 eval $inlibc
15552
15553 : see if readlink exists
15554 set readlink d_readlink
15555 eval $inlibc
15556
15557 echo " "
15558 procselfexe=''
15559 val="$undef"
15560 case "$d_readlink" in
15561 "$define")
15562         if $issymlink /proc/self/exe ; then
15563                 $ls -l /proc/self/exe > reflect
15564                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15565                         echo "You have Linux-like /proc/self/exe."
15566                         procselfexe='"/proc/self/exe"'
15567                         val="$define"
15568                 fi
15569         fi
15570         if $issymlink /proc/curproc/file ; then
15571                 $ls -l /proc/curproc/file > reflect
15572                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15573                         echo "You have BSD-like /proc/curproc/file."
15574                         procselfexe='"/proc/curproc/file"'
15575                         val="$define"
15576                 fi
15577         fi
15578         ;;
15579 esac
15580 $rm -f reflect
15581 set d_procselfexe
15582 eval $setvar
15583
15584 : backward compatibility for d_hvfork
15585 if test X$d_hvfork != X; then
15586         d_vfork="$d_hvfork"
15587         d_hvfork=''
15588 fi
15589 : see if there is a vfork
15590 val=''
15591 set vfork val
15592 eval $inlibc
15593
15594 d_pseudofork=$undef
15595
15596 : Ok, but do we want to use it. vfork is reportedly unreliable in
15597 : perl on Solaris 2.x, and probably elsewhere.
15598 case "$val" in
15599 $define)
15600         echo " "
15601         case "$usevfork" in
15602         false) dflt='n';;
15603         *) dflt='y';;
15604         esac
15605         cat <<'EOM'
15606
15607 Perl can only use a vfork() that doesn't suffer from strict
15608 restrictions on calling functions or modifying global data in
15609 the child.  For example, glibc-2.1 contains such a vfork()
15610 that is unsuitable.  If your system provides a proper fork()
15611 call, chances are that you do NOT want perl to use vfork().
15612
15613 EOM
15614         rp="Do you still want to use vfork()?"
15615         . ./myread
15616         case "$ans" in
15617         y|Y) ;;
15618         *)
15619                 echo "Ok, we won't use vfork()."
15620                 val="$undef"
15621                 ;;
15622         esac
15623         ;;
15624 esac
15625 set d_vfork
15626 eval $setvar
15627 case "$d_vfork" in
15628 $define) usevfork='true';;
15629 *) usevfork='false';;
15630 esac
15631
15632 : see whether the pthread_atfork exists
15633 $cat >try.c <<EOP
15634 #include <pthread.h>
15635 #include <stdio.h>
15636 int main() {
15637 #ifdef  PTHREAD_ATFORK
15638         pthread_atfork(NULL,NULL,NULL);
15639 #endif
15640 }
15641 EOP
15642
15643 : see if pthread_atfork exists
15644 set try -DPTHREAD_ATFORK
15645 if eval $compile; then
15646     val="$define"
15647 else
15648     val="$undef"
15649 fi
15650 case "$usethreads" in
15651 $define)
15652         case "$val" in
15653         $define) echo 'pthread_atfork found.' >&4        ;;
15654         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15655         esac
15656 esac
15657 set d_pthread_atfork
15658 eval $setvar
15659
15660 : see if pthread_attr_setscope exists
15661 set pthread_attr_setscope d_pthread_attr_setscope
15662 eval $inlibc
15663
15664
15665 : see whether the various POSIXish _yields exist
15666 $cat >try.c <<EOP
15667 #include <pthread.h>
15668 #include <stdio.h>
15669 int main() {
15670 #ifdef SCHED_YIELD
15671         sched_yield();
15672 #else
15673 #ifdef PTHREAD_YIELD
15674         pthread_yield();
15675 #else
15676 #ifdef PTHREAD_YIELD_NULL
15677         pthread_yield(NULL);
15678 #endif
15679 #endif
15680 #endif
15681 }
15682 EOP
15683 : see if sched_yield exists
15684 set try -DSCHED_YIELD
15685 if eval $compile; then
15686     val="$define"
15687     sched_yield='sched_yield()'
15688 else
15689     val="$undef"
15690 fi
15691 case "$usethreads" in
15692 $define)
15693         case "$val" in
15694         $define) echo 'sched_yield() found.' >&4        ;;
15695         *)       echo 'sched_yield() NOT found.' >&4    ;;
15696         esac
15697 esac
15698 set d_sched_yield
15699 eval $setvar
15700
15701 : see if pthread_yield exists
15702 set try -DPTHREAD_YIELD
15703 if eval $compile; then
15704     val="$define"
15705     case "$sched_yield" in
15706     '') sched_yield='pthread_yield()' ;;
15707     esac
15708 else
15709     set try -DPTHREAD_YIELD_NULL
15710     if eval $compile; then
15711         val="$define"
15712         case "$sched_yield" in
15713         '') sched_yield='pthread_yield(NULL)' ;;
15714         esac
15715     else
15716         val="$undef"
15717     fi
15718 fi
15719 case "$usethreads" in
15720 $define)
15721         case "$val" in
15722         $define) echo 'pthread_yield() found.' >&4      ;;
15723         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15724         esac
15725         ;;
15726 esac
15727 set d_pthread_yield
15728 eval $setvar
15729 case "$sched_yield" in
15730 '') sched_yield=undef ;;
15731 esac
15732 $rm_try
15733
15734 : see if random_r exists
15735 set random_r d_random_r
15736 eval $inlibc
15737 case "$d_random_r" in
15738 "$define")
15739         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15740         case "$d_random_r_proto:$usethreads" in
15741         ":define")      d_random_r_proto=define
15742                 set d_random_r_proto random_r $hdrs
15743                 eval $hasproto ;;
15744         *)      ;;
15745         esac
15746         case "$d_random_r_proto" in
15747         define)
15748         case "$random_r_proto" in
15749         ''|0) try='int random_r(int*, struct random_data*);'
15750         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15751         esac
15752         case "$random_r_proto" in
15753         ''|0) try='int random_r(long*, struct random_data*);'
15754         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15755         esac
15756         case "$random_r_proto" in
15757         ''|0) try='int random_r(struct random_data*, int32_t*);'
15758         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15759         esac
15760         case "$random_r_proto" in
15761         ''|0)   d_random_r=undef
15762                 random_r_proto=0
15763                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15764         * )     case "$random_r_proto" in
15765                 REENTRANT_PROTO*) ;;
15766                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15767                 esac
15768                 echo "Prototype: $try" ;;
15769         esac
15770         ;;
15771         *)      case "$usethreads" in
15772                 define) echo "random_r has no prototype, not using it." >&4 ;;
15773                 esac
15774                 d_random_r=undef
15775                 random_r_proto=0
15776                 ;;
15777         esac
15778         ;;
15779 *)      random_r_proto=0
15780         ;;
15781 esac
15782
15783 : see if readdir and friends exist
15784 set readdir d_readdir
15785 eval $inlibc
15786 set seekdir d_seekdir
15787 eval $inlibc
15788 set telldir d_telldir
15789 eval $inlibc
15790 set rewinddir d_rewinddir
15791 eval $inlibc
15792
15793 : see if readdir64_r exists
15794 set readdir64_r d_readdir64_r
15795 eval $inlibc
15796 case "$d_readdir64_r" in
15797 "$define")
15798         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15799         case "$d_readdir64_r_proto:$usethreads" in
15800         ":define")      d_readdir64_r_proto=define
15801                 set d_readdir64_r_proto readdir64_r $hdrs
15802                 eval $hasproto ;;
15803         *)      ;;
15804         esac
15805         case "$d_readdir64_r_proto" in
15806         define)
15807         case "$readdir64_r_proto" in
15808         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15809         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15810         esac
15811         case "$readdir64_r_proto" in
15812         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15813         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15814         esac
15815         case "$readdir64_r_proto" in
15816         ''|0)   d_readdir64_r=undef
15817                 readdir64_r_proto=0
15818                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15819         * )     case "$readdir64_r_proto" in
15820                 REENTRANT_PROTO*) ;;
15821                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15822                 esac
15823                 echo "Prototype: $try" ;;
15824         esac
15825         ;;
15826         *)      case "$usethreads" in
15827                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15828                 esac
15829                 d_readdir64_r=undef
15830                 readdir64_r_proto=0
15831                 ;;
15832         esac
15833         ;;
15834 *)      readdir64_r_proto=0
15835         ;;
15836 esac
15837
15838 : see if readdir_r exists
15839 set readdir_r d_readdir_r
15840 eval $inlibc
15841 case "$d_readdir_r" in
15842 "$define")
15843         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15844         case "$d_readdir_r_proto:$usethreads" in
15845         ":define")      d_readdir_r_proto=define
15846                 set d_readdir_r_proto readdir_r $hdrs
15847                 eval $hasproto ;;
15848         *)      ;;
15849         esac
15850         case "$d_readdir_r_proto" in
15851         define)
15852         case "$readdir_r_proto" in
15853         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15854         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15855         esac
15856         case "$readdir_r_proto" in
15857         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15858         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15859         esac
15860         case "$readdir_r_proto" in
15861         ''|0)   d_readdir_r=undef
15862                 readdir_r_proto=0
15863                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15864         * )     case "$readdir_r_proto" in
15865                 REENTRANT_PROTO*) ;;
15866                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15867                 esac
15868                 echo "Prototype: $try" ;;
15869         esac
15870         ;;
15871         *)      case "$usethreads" in
15872                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15873                 esac
15874                 d_readdir_r=undef
15875                 readdir_r_proto=0
15876                 ;;
15877         esac
15878         ;;
15879 *)      readdir_r_proto=0
15880         ;;
15881 esac
15882
15883 : see if readv exists
15884 set readv d_readv
15885 eval $inlibc
15886
15887 : see if recvmsg exists
15888 set recvmsg d_recvmsg
15889 eval $inlibc
15890
15891 : see if rename exists
15892 set rename d_rename
15893 eval $inlibc
15894
15895 : see if rmdir exists
15896 set rmdir d_rmdir
15897 eval $inlibc
15898
15899 : see if memory.h is available.
15900 val=''
15901 set memory.h val
15902 eval $inhdr
15903
15904 : See if it conflicts with string.h
15905 case "$val" in
15906 $define)
15907         case "$strings" in
15908         '') ;;
15909         *)
15910                 $cppstdin $cppflags $cppminus < $strings > mem.h
15911                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15912                         echo " "
15913                         echo "We won't be including <memory.h>."
15914                         val="$undef"
15915                 fi
15916                 $rm -f mem.h
15917                 ;;
15918         esac
15919 esac
15920 set i_memory
15921 eval $setvar
15922
15923 : can bcopy handle overlapping blocks?
15924 echo " "
15925 val="$undef"
15926 case "$d_memmove" in
15927 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15928 *)      case "$d_bcopy" in
15929         "$define")
15930                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15931                 $cat >try.c <<EOCP
15932 #$i_memory I_MEMORY
15933 #$i_stdlib I_STDLIB
15934 #$i_string I_STRING
15935 #$i_unistd I_UNISTD
15936 EOCP
15937         $cat >>try.c <<'EOCP'
15938 #include <stdio.h>
15939 #ifdef I_MEMORY
15940 #  include <memory.h>
15941 #endif
15942 #ifdef I_STDLIB
15943 #  include <stdlib.h>
15944 #endif
15945 #ifdef I_STRING
15946 #  include <string.h>
15947 #else
15948 #  include <strings.h>
15949 #endif
15950 #ifdef I_UNISTD
15951 #  include <unistd.h>  /* Needed for NetBSD */
15952 #endif
15953 int main()
15954 {
15955 char buf[128], abc[128];
15956 char *b;
15957 int len;
15958 int off;
15959 int align;
15960
15961 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15962    try to store the string in read-only memory. */
15963 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15964
15965 for (align = 7; align >= 0; align--) {
15966         for (len = 36; len; len--) {
15967                 b = buf+align;
15968                 bcopy(abc, b, len);
15969                 for (off = 1; off <= len; off++) {
15970                         bcopy(b, b+off, len);
15971                         bcopy(b+off, b, len);
15972                         if (bcmp(b, abc, len))
15973                                 exit(1);
15974                 }
15975         }
15976 }
15977 exit(0);
15978 }
15979 EOCP
15980                 set try
15981                 if eval $compile_ok; then
15982                         if $run ./try 2>/dev/null; then
15983                                 echo "Yes, it can."
15984                                 val="$define"
15985                         else
15986                                 echo "It can't, sorry."
15987                         fi
15988                 else
15989                         echo "(I can't compile the test program, so we'll assume not...)"
15990                 fi
15991                 ;;
15992         esac
15993         $rm_try
15994         ;;
15995 esac
15996 set d_safebcpy
15997 eval $setvar
15998
15999 : can memcpy handle overlapping blocks?
16000 echo " "
16001 val="$undef"
16002 case "$d_memmove" in
16003 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16004 *)      case "$d_memcpy" in
16005         "$define")
16006                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16007                 $cat >try.c <<EOCP
16008 #$i_memory I_MEMORY
16009 #$i_stdlib I_STDLIB
16010 #$i_string I_STRING
16011 #$i_unistd I_UNISTD
16012 EOCP
16013         $cat >>try.c <<'EOCP'
16014 #include <stdio.h>
16015 #ifdef I_MEMORY
16016 #  include <memory.h>
16017 #endif
16018 #ifdef I_STDLIB
16019 #  include <stdlib.h>
16020 #endif
16021 #ifdef I_STRING
16022 #  include <string.h>
16023 #else
16024 #  include <strings.h>
16025 #endif
16026 #ifdef I_UNISTD
16027 #  include <unistd.h>  /* Needed for NetBSD */
16028 #endif
16029 int main()
16030 {
16031 char buf[128], abc[128];
16032 char *b;
16033 int len;
16034 int off;
16035 int align;
16036
16037 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16038    try to store the string in read-only memory. */
16039 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16040
16041 for (align = 7; align >= 0; align--) {
16042         for (len = 36; len; len--) {
16043                 b = buf+align;
16044                 memcpy(b, abc, len);
16045                 for (off = 1; off <= len; off++) {
16046                         memcpy(b+off, b, len);
16047                         memcpy(b, b+off, len);
16048                         if (memcmp(b, abc, len))
16049                                 exit(1);
16050                 }
16051         }
16052 }
16053 exit(0);
16054 }
16055 EOCP
16056                 set try
16057                 if eval $compile_ok; then
16058                         if $run ./try 2>/dev/null; then
16059                                 echo "Yes, it can."
16060                                 val="$define"
16061                         else
16062                                 echo "It can't, sorry."
16063                         fi
16064                 else
16065                         echo "(I can't compile the test program, so we'll assume not...)"
16066                 fi
16067                 ;;
16068         esac
16069         $rm_try
16070         ;;
16071 esac
16072 set d_safemcpy
16073 eval $setvar
16074
16075 : can memcmp be trusted to compare relative magnitude?
16076 val="$undef"
16077 case "$d_memcmp" in
16078 "$define")
16079         echo " "
16080         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16081         $cat >try.c <<EOCP
16082 #$i_memory I_MEMORY
16083 #$i_stdlib I_STDLIB
16084 #$i_string I_STRING
16085 #$i_unistd I_UNISTD
16086 EOCP
16087         $cat >>try.c <<'EOCP'
16088 #include <stdio.h>
16089 #ifdef I_MEMORY
16090 #  include <memory.h>
16091 #endif
16092 #ifdef I_STDLIB
16093 #  include <stdlib.h>
16094 #endif
16095 #ifdef I_STRING
16096 #  include <string.h>
16097 #else
16098 #  include <strings.h>
16099 #endif
16100 #ifdef I_UNISTD
16101 #  include <unistd.h>  /* Needed for NetBSD */
16102 #endif
16103 int main()
16104 {
16105 char a = -1;
16106 char b = 0;
16107 if ((a < b) && memcmp(&a, &b, 1) < 0)
16108         exit(1);
16109 exit(0);
16110 }
16111 EOCP
16112         set try
16113         if eval $compile_ok; then
16114                 if $run ./try 2>/dev/null; then
16115                         echo "Yes, it can."
16116                         val="$define"
16117                 else
16118                         echo "No, it can't (it uses signed chars)."
16119                 fi
16120         else
16121                 echo "(I can't compile the test program, so we'll assume not...)"
16122         fi
16123         ;;
16124 esac
16125 $rm_try
16126 set d_sanemcmp
16127 eval $setvar
16128
16129 : see if prototype for sbrk is available
16130 echo " "
16131 set d_sbrkproto sbrk $i_unistd unistd.h
16132 eval $hasproto
16133
16134 : see if select exists
16135 set select d_select
16136 eval $inlibc
16137
16138 : see if semctl exists
16139 set semctl d_semctl
16140 eval $inlibc
16141
16142 : see if semget exists
16143 set semget d_semget
16144 eval $inlibc
16145
16146 : see if semop exists
16147 set semop d_semop
16148 eval $inlibc
16149
16150 : see how much of the 'sem*(2)' library is present.
16151 h_sem=true
16152 echo " "
16153 case "$d_semctl$d_semget$d_semop" in
16154 *"$undef"*) h_sem=false;;
16155 esac
16156 case "$osname" in
16157 freebsd)
16158     case "`ipcs 2>&1`" in
16159     "SVID messages"*"not configured"*)
16160         echo "Your $osname does not have the sem*(2) configured." >&4
16161         h_sem=false
16162         val="$undef"
16163         set semctl d_semctl
16164         eval $setvar
16165         set semget d_semget
16166         eval $setvar
16167         set semop d_semop
16168         eval $setvar
16169         ;;
16170     esac
16171     ;;
16172 esac
16173 : we could also check for sys/ipc.h ...
16174 if $h_sem && $test `./findhdr sys/sem.h`; then
16175         echo "You have the full sem*(2) library." >&4
16176         val="$define"
16177 else
16178         echo "You don't have the full sem*(2) library." >&4
16179         val="$undef"
16180 fi
16181 set d_sem
16182 eval $setvar
16183
16184 : see whether sys/sem.h defines union semun
16185 echo " "
16186 $cat > try.c <<'END'
16187 #include <sys/types.h>
16188 #include <sys/ipc.h>
16189 #include <sys/sem.h>
16190 int main () { union semun semun; semun.buf = 0; }
16191 END
16192 set try
16193 if eval $compile; then
16194     echo "You have union semun in <sys/sem.h>." >&4
16195     val="$define"
16196 else
16197     echo "You do not have union semun in <sys/sem.h>." >&4
16198     val="$undef"
16199 fi
16200 $rm_try
16201 set d_union_semun
16202 eval $setvar
16203
16204 : see how to do semctl IPC_STAT
16205 case "$d_sem" in
16206 $define)
16207     echo " "
16208     $cat > tryh.h <<END
16209 #ifndef S_IRUSR
16210 #   ifdef S_IREAD
16211 #       define S_IRUSR S_IREAD
16212 #       define S_IWUSR S_IWRITE
16213 #       define S_IXUSR S_IEXEC
16214 #   else
16215 #       define S_IRUSR 0400
16216 #       define S_IWUSR 0200
16217 #       define S_IXUSR 0100
16218 #   endif
16219 #   define S_IRGRP (S_IRUSR>>3)
16220 #   define S_IWGRP (S_IWUSR>>3)
16221 #   define S_IXGRP (S_IXUSR>>3)
16222 #   define S_IROTH (S_IRUSR>>6)
16223 #   define S_IWOTH (S_IWUSR>>6)
16224 #   define S_IXOTH (S_IXUSR>>6)
16225 #endif
16226 #ifndef S_IRWXU
16227 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16228 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16229 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16230 #endif
16231 END
16232     : see whether semctl IPC_STAT can use union semun
16233     case "$d_semctl_semun" in
16234     '')
16235       val="$undef"
16236       $cat > try.c <<END
16237 #include <sys/types.h>
16238 #include <sys/ipc.h>
16239 #include <sys/sem.h>
16240 #include <sys/stat.h>
16241 #include <stdio.h>
16242 #include <errno.h>
16243 #include "tryh.h"
16244 #ifndef errno
16245 extern int errno;
16246 #endif
16247 #$d_union_semun HAS_UNION_SEMUN
16248 int main() {
16249     union semun
16250 #ifndef HAS_UNION_SEMUN
16251     {
16252         int val;
16253         struct semid_ds *buf;
16254         unsigned short *array;
16255     }
16256 #endif
16257     arg;
16258     int sem, st;
16259
16260 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16261     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16262     if (sem > -1) {
16263         struct semid_ds argbuf;
16264         arg.buf = &argbuf;
16265 #       ifdef IPC_STAT
16266         st = semctl(sem, 0, IPC_STAT, arg);
16267         if (st == 0)
16268             printf("semun\n");
16269         else
16270 #       endif /* IPC_STAT */
16271             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16272 #       ifdef IPC_RMID
16273         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16274 #       endif /* IPC_RMID */
16275             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16276     } else
16277 #endif /* IPC_PRIVATE && ... */
16278         printf("semget failed: errno = %d\n", errno);
16279   return 0;
16280 }
16281 END
16282       set try
16283       if eval $compile; then
16284           xxx=`$run ./try`
16285           case "$xxx" in
16286           semun) val="$define" ;;
16287           esac
16288       fi
16289       $rm_try
16290       set d_semctl_semun
16291       eval $setvar
16292       ;;
16293     esac
16294     case "$d_semctl_semun" in
16295     $define)
16296         echo "You can use union semun for semctl IPC_STAT." >&4
16297         also='also'
16298         ;;
16299     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16300         also=''
16301         ;;
16302     esac
16303
16304     : see whether semctl IPC_STAT can use struct semid_ds pointer
16305     case "$d_semctl_semid_ds" in
16306     '')
16307       val="$undef"
16308       $cat > try.c <<'END'
16309 #include <sys/types.h>
16310 #include <sys/ipc.h>
16311 #include <sys/sem.h>
16312 #include <sys/stat.h>
16313 #include "tryh.h"
16314 #include <stdio.h>
16315 #include <errno.h>
16316 #ifndef errno
16317 extern int errno;
16318 #endif
16319 int main() {
16320     struct semid_ds arg;
16321     int sem, st;
16322
16323 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16324     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16325     if (sem > -1) {
16326 #       ifdef IPC_STAT
16327         st = semctl(sem, 0, IPC_STAT, &arg);
16328         if (st == 0)
16329             printf("semid_ds\n");
16330         else
16331 #       endif /* IPC_STAT */
16332             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16333 #       ifdef IPC_RMID
16334         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16335 #       endif /* IPC_RMID */
16336             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16337     } else
16338 #endif /* IPC_PRIVATE && ... */
16339         printf("semget failed: errno = %d\n", errno);
16340
16341     return 0;
16342 }
16343 END
16344       set try
16345       if eval $compile; then
16346           xxx=`$run ./try`
16347           case "$xxx" in
16348           semid_ds) val="$define" ;;
16349           esac
16350       fi
16351       $rm_try
16352       set d_semctl_semid_ds
16353       eval $setvar
16354       ;;
16355     esac
16356     case "$d_semctl_semid_ds" in
16357     $define)
16358         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16359         ;;
16360     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16361         ;;
16362     esac
16363     ;;
16364 *)  val="$undef"
16365
16366     # We do not have the full sem*(2) library, so assume we can not
16367     # use either.
16368
16369     set d_semctl_semun
16370     eval $setvar
16371
16372     set d_semctl_semid_ds
16373     eval $setvar
16374     ;;
16375 esac
16376 $rm_try tryh.h
16377
16378 : see if sendmsg exists
16379 set sendmsg d_sendmsg
16380 eval $inlibc
16381
16382 : see if setegid exists
16383 set setegid d_setegid
16384 eval $inlibc
16385
16386 : see if seteuid exists
16387 set seteuid d_seteuid
16388 eval $inlibc
16389
16390 : see if setgrent exists
16391 set setgrent d_setgrent
16392 eval $inlibc
16393
16394 : see if setgrent_r exists
16395 set setgrent_r d_setgrent_r
16396 eval $inlibc
16397 case "$d_setgrent_r" in
16398 "$define")
16399         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16400         case "$d_setgrent_r_proto:$usethreads" in
16401         ":define")      d_setgrent_r_proto=define
16402                 set d_setgrent_r_proto setgrent_r $hdrs
16403                 eval $hasproto ;;
16404         *)      ;;
16405         esac
16406         case "$d_setgrent_r_proto" in
16407         define)
16408         case "$setgrent_r_proto" in
16409         ''|0) try='int setgrent_r(FILE**);'
16410         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16411         esac
16412         case "$setgrent_r_proto" in
16413         ''|0) try='void setgrent_r(FILE**);'
16414         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16415         esac
16416         case "$setgrent_r_proto" in
16417         ''|0)   d_setgrent_r=undef
16418                 setgrent_r_proto=0
16419                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16420         * )     case "$setgrent_r_proto" in
16421                 REENTRANT_PROTO*) ;;
16422                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16423                 esac
16424                 echo "Prototype: $try" ;;
16425         esac
16426         ;;
16427         *)      case "$usethreads" in
16428                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16429                 esac
16430                 d_setgrent_r=undef
16431                 setgrent_r_proto=0
16432                 ;;
16433         esac
16434         ;;
16435 *)      setgrent_r_proto=0
16436         ;;
16437 esac
16438
16439 : see if sethostent exists
16440 set sethostent d_sethent
16441 eval $inlibc
16442
16443 : see if sethostent_r exists
16444 set sethostent_r d_sethostent_r
16445 eval $inlibc
16446 case "$d_sethostent_r" in
16447 "$define")
16448         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16449         case "$d_sethostent_r_proto:$usethreads" in
16450         ":define")      d_sethostent_r_proto=define
16451                 set d_sethostent_r_proto sethostent_r $hdrs
16452                 eval $hasproto ;;
16453         *)      ;;
16454         esac
16455         case "$d_sethostent_r_proto" in
16456         define)
16457         case "$sethostent_r_proto" in
16458         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16459         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16460         esac
16461         case "$sethostent_r_proto" in
16462         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16463         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16464         esac
16465         case "$sethostent_r_proto" in
16466         ''|0)   d_sethostent_r=undef
16467                 sethostent_r_proto=0
16468                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16469         * )     case "$sethostent_r_proto" in
16470                 REENTRANT_PROTO*) ;;
16471                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16472                 esac
16473                 echo "Prototype: $try" ;;
16474         esac
16475         ;;
16476         *)      case "$usethreads" in
16477                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16478                 esac
16479                 d_sethostent_r=undef
16480                 sethostent_r_proto=0
16481                 ;;
16482         esac
16483         ;;
16484 *)      sethostent_r_proto=0
16485         ;;
16486 esac
16487
16488 : see if setitimer exists
16489 set setitimer d_setitimer
16490 eval $inlibc
16491
16492 : see if setlinebuf exists
16493 set setlinebuf d_setlinebuf
16494 eval $inlibc
16495
16496 : see if setlocale exists
16497 set setlocale d_setlocale
16498 eval $inlibc
16499
16500 : see if locale.h is available
16501 set locale.h i_locale
16502 eval $inhdr
16503
16504 : see if setlocale_r exists
16505 set setlocale_r d_setlocale_r
16506 eval $inlibc
16507 case "$d_setlocale_r" in
16508 "$define")
16509         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16510         case "$d_setlocale_r_proto:$usethreads" in
16511         ":define")      d_setlocale_r_proto=define
16512                 set d_setlocale_r_proto setlocale_r $hdrs
16513                 eval $hasproto ;;
16514         *)      ;;
16515         esac
16516         case "$d_setlocale_r_proto" in
16517         define)
16518         case "$setlocale_r_proto" in
16519         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16520         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16521         esac
16522         case "$setlocale_r_proto" in
16523         ''|0)   d_setlocale_r=undef
16524                 setlocale_r_proto=0
16525                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16526         * )     case "$setlocale_r_proto" in
16527                 REENTRANT_PROTO*) ;;
16528                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16529                 esac
16530                 echo "Prototype: $try" ;;
16531         esac
16532         ;;
16533         *)      case "$usethreads" in
16534                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16535                 esac
16536                 d_setlocale_r=undef
16537                 setlocale_r_proto=0
16538                 ;;
16539         esac
16540         ;;
16541 *)      setlocale_r_proto=0
16542         ;;
16543 esac
16544
16545 : see if setnetent exists
16546 set setnetent d_setnent
16547 eval $inlibc
16548
16549 : see if setnetent_r exists
16550 set setnetent_r d_setnetent_r
16551 eval $inlibc
16552 case "$d_setnetent_r" in
16553 "$define")
16554         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16555         case "$d_setnetent_r_proto:$usethreads" in
16556         ":define")      d_setnetent_r_proto=define
16557                 set d_setnetent_r_proto setnetent_r $hdrs
16558                 eval $hasproto ;;
16559         *)      ;;
16560         esac
16561         case "$d_setnetent_r_proto" in
16562         define)
16563         case "$setnetent_r_proto" in
16564         ''|0) try='int setnetent_r(int, struct netent_data*);'
16565         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16566         esac
16567         case "$setnetent_r_proto" in
16568         ''|0) try='void setnetent_r(int, struct netent_data*);'
16569         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16570         esac
16571         case "$setnetent_r_proto" in
16572         ''|0)   d_setnetent_r=undef
16573                 setnetent_r_proto=0
16574                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16575         * )     case "$setnetent_r_proto" in
16576                 REENTRANT_PROTO*) ;;
16577                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16578                 esac
16579                 echo "Prototype: $try" ;;
16580         esac
16581         ;;
16582         *)      case "$usethreads" in
16583                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16584                 esac
16585                 d_setnetent_r=undef
16586                 setnetent_r_proto=0
16587                 ;;
16588         esac
16589         ;;
16590 *)      setnetent_r_proto=0
16591         ;;
16592 esac
16593
16594 : see if setprotoent exists
16595 set setprotoent d_setpent
16596 eval $inlibc
16597
16598 : see if setpgid exists
16599 set setpgid d_setpgid
16600 eval $inlibc
16601
16602 : see if setpgrp2 exists
16603 set setpgrp2 d_setpgrp2
16604 eval $inlibc
16605
16606 : see if setpriority exists
16607 set setpriority d_setprior
16608 eval $inlibc
16609
16610 : see if setproctitle exists
16611 set setproctitle d_setproctitle
16612 eval $inlibc
16613
16614 : see if setprotoent_r exists
16615 set setprotoent_r d_setprotoent_r
16616 eval $inlibc
16617 case "$d_setprotoent_r" in
16618 "$define")
16619         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16620         case "$d_setprotoent_r_proto:$usethreads" in
16621         ":define")      d_setprotoent_r_proto=define
16622                 set d_setprotoent_r_proto setprotoent_r $hdrs
16623                 eval $hasproto ;;
16624         *)      ;;
16625         esac
16626         case "$d_setprotoent_r_proto" in
16627         define)
16628         case "$setprotoent_r_proto" in
16629         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16630         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16631         esac
16632         case "$setprotoent_r_proto" in
16633         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16634         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16635         esac
16636         case "$setprotoent_r_proto" in
16637         ''|0)   d_setprotoent_r=undef
16638                 setprotoent_r_proto=0
16639                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16640         * )     case "$setprotoent_r_proto" in
16641                 REENTRANT_PROTO*) ;;
16642                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16643                 esac
16644                 echo "Prototype: $try" ;;
16645         esac
16646         ;;
16647         *)      case "$usethreads" in
16648                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16649                 esac
16650                 d_setprotoent_r=undef
16651                 setprotoent_r_proto=0
16652                 ;;
16653         esac
16654         ;;
16655 *)      setprotoent_r_proto=0
16656         ;;
16657 esac
16658
16659 : see if setpwent exists
16660 set setpwent d_setpwent
16661 eval $inlibc
16662
16663 : see if setpwent_r exists
16664 set setpwent_r d_setpwent_r
16665 eval $inlibc
16666 case "$d_setpwent_r" in
16667 "$define")
16668         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16669         case "$d_setpwent_r_proto:$usethreads" in
16670         ":define")      d_setpwent_r_proto=define
16671                 set d_setpwent_r_proto setpwent_r $hdrs
16672                 eval $hasproto ;;
16673         *)      ;;
16674         esac
16675         case "$d_setpwent_r_proto" in
16676         define)
16677         case "$setpwent_r_proto" in
16678         ''|0) try='int setpwent_r(FILE**);'
16679         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16680         esac
16681         case "$setpwent_r_proto" in
16682         ''|0) try='void setpwent_r(FILE**);'
16683         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16684         esac
16685         case "$setpwent_r_proto" in
16686         ''|0)   d_setpwent_r=undef
16687                 setpwent_r_proto=0
16688                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16689         * )     case "$setpwent_r_proto" in
16690                 REENTRANT_PROTO*) ;;
16691                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16692                 esac
16693                 echo "Prototype: $try" ;;
16694         esac
16695         ;;
16696         *)      case "$usethreads" in
16697                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16698                 esac
16699                 d_setpwent_r=undef
16700                 setpwent_r_proto=0
16701                 ;;
16702         esac
16703         ;;
16704 *)      setpwent_r_proto=0
16705         ;;
16706 esac
16707
16708 : see if setregid exists
16709 set setregid d_setregid
16710 eval $inlibc
16711 set setresgid d_setresgid
16712 eval $inlibc
16713
16714 : see if setreuid exists
16715 set setreuid d_setreuid
16716 eval $inlibc
16717 set setresuid d_setresuid
16718 eval $inlibc
16719
16720 : see if setrgid exists
16721 set setrgid d_setrgid
16722 eval $inlibc
16723
16724 : see if setruid exists
16725 set setruid d_setruid
16726 eval $inlibc
16727
16728 : see if setservent exists
16729 set setservent d_setsent
16730 eval $inlibc
16731
16732 : see if setservent_r exists
16733 set setservent_r d_setservent_r
16734 eval $inlibc
16735 case "$d_setservent_r" in
16736 "$define")
16737         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16738         case "$d_setservent_r_proto:$usethreads" in
16739         ":define")      d_setservent_r_proto=define
16740                 set d_setservent_r_proto setservent_r $hdrs
16741                 eval $hasproto ;;
16742         *)      ;;
16743         esac
16744         case "$d_setservent_r_proto" in
16745         define)
16746         case "$setservent_r_proto" in
16747         ''|0) try='int setservent_r(int, struct servent_data*);'
16748         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16749         esac
16750         case "$setservent_r_proto" in
16751         ''|0) try='void setservent_r(int, struct servent_data*);'
16752         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16753         esac
16754         case "$setservent_r_proto" in
16755         ''|0)   d_setservent_r=undef
16756                 setservent_r_proto=0
16757                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16758         * )     case "$setservent_r_proto" in
16759                 REENTRANT_PROTO*) ;;
16760                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16761                 esac
16762                 echo "Prototype: $try" ;;
16763         esac
16764         ;;
16765         *)      case "$usethreads" in
16766                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16767                 esac
16768                 d_setservent_r=undef
16769                 setservent_r_proto=0
16770                 ;;
16771         esac
16772         ;;
16773 *)      setservent_r_proto=0
16774         ;;
16775 esac
16776
16777 : see if setsid exists
16778 set setsid d_setsid
16779 eval $inlibc
16780
16781 : see if setvbuf exists
16782 set setvbuf d_setvbuf
16783 eval $inlibc
16784
16785 : see if sfio.h is available
16786 set sfio.h i_sfio
16787 eval $inhdr
16788
16789
16790 : see if sfio library is available
16791 case "$i_sfio" in
16792 $define)
16793         val=''
16794         set sfreserve val
16795         eval $inlibc
16796         ;;
16797 *)
16798         val="$undef"
16799         ;;
16800 esac
16801 : Ok, but do we want to use it.
16802 case "$val" in
16803 $define)
16804         case "$usesfio" in
16805         true|$define|[yY]*) dflt='y';;
16806         *) dflt='n';;
16807         esac
16808         echo "$package can use the sfio library, but it is experimental."
16809         case "$useperlio" in
16810         "$undef")
16811             echo "For sfio also the PerlIO abstraction layer is needed."
16812             echo "Earlier you said you wouldn't want that."
16813             ;;
16814         esac
16815         rp="You seem to have sfio available, do you want to try using it?"
16816         . ./myread
16817         case "$ans" in
16818         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16819                 useperlio="$define"
16820                 val="$define"
16821                 ;;
16822         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16823                 val="$undef"
16824                 ;;
16825         esac
16826         ;;
16827 *)      case "$usesfio" in
16828         true|$define|[yY]*)
16829                 echo "Sorry, cannot find sfio on this machine." >&4
16830                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16831                 val="$undef"
16832                 ;;
16833         esac
16834         ;;
16835 esac
16836 set d_sfio
16837 eval $setvar
16838 case "$d_sfio" in
16839 $define) usesfio='true';;
16840 *) usesfio='false';;
16841 esac
16842 case "$d_sfio" in
16843 $define) ;;
16844 *)      : Remove sfio from list of libraries to use
16845         case "$libs" in
16846         *-lsfio*)
16847                 echo "Removing unneeded -lsfio from library list" >&4
16848                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16849                 shift
16850                 libs="$*"
16851                 echo "libs = $libs" >&4
16852                 ;;
16853         esac
16854 ;;
16855 esac
16856
16857
16858 : see if shmctl exists
16859 set shmctl d_shmctl
16860 eval $inlibc
16861
16862 : see if shmget exists
16863 set shmget d_shmget
16864 eval $inlibc
16865
16866 : see if shmat exists
16867 set shmat d_shmat
16868 eval $inlibc
16869 : see what shmat returns
16870 case "$d_shmat" in
16871 "$define")
16872         $cat >shmat.c <<'END'
16873 #include <sys/shm.h>
16874 void *shmat();
16875 END
16876         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16877                 shmattype='void *'
16878         else
16879                 shmattype='char *'
16880         fi
16881         echo "and it returns ($shmattype)." >&4
16882         : see if a prototype for shmat is available
16883         xxx=`./findhdr sys/shm.h`
16884         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16885         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16886                 val="$define"
16887         else
16888                 val="$undef"
16889         fi
16890         $rm -f shmat.[co]
16891         ;;
16892 *)
16893         val="$undef"
16894         ;;
16895 esac
16896 set d_shmatprototype
16897 eval $setvar
16898
16899 : see if shmdt exists
16900 set shmdt d_shmdt
16901 eval $inlibc
16902
16903 : see how much of the 'shm*(2)' library is present.
16904 h_shm=true
16905 echo " "
16906 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16907 *"$undef"*) h_shm=false;;
16908 esac
16909 case "$osname" in
16910 freebsd)
16911     case "`ipcs 2>&1`" in
16912     "SVID shared memory"*"not configured"*)
16913         echo "Your $osname does not have the shm*(2) configured." >&4
16914         h_shm=false
16915         val="$undef"
16916         set shmctl d_shmctl
16917         evat $setvar
16918         set shmget d_shmget
16919         evat $setvar
16920         set shmat d_shmat
16921         evat $setvar
16922         set shmdt d_shmdt
16923         evat $setvar
16924         ;;
16925     esac
16926     ;;
16927 esac
16928 : we could also check for sys/ipc.h ...
16929 if $h_shm && $test `./findhdr sys/shm.h`; then
16930         echo "You have the full shm*(2) library." >&4
16931         val="$define"
16932 else
16933         echo "You don't have the full shm*(2) library." >&4
16934         val="$undef"
16935 fi
16936 set d_shm
16937 eval $setvar
16938
16939 echo " "
16940 : see if we have sigaction
16941 if set sigaction val -f d_sigaction; eval $csym; $val; then
16942         echo 'sigaction() found.' >&4
16943         $cat > try.c <<EOP
16944 #include <stdio.h>
16945 #include <sys/types.h>
16946 #include <signal.h>
16947 #$i_stdlib I_STDLIB
16948 #ifdef I_STDLIB
16949 #include <stdlib.h>
16950 #endif
16951 int main()
16952 {
16953     struct sigaction act, oact;
16954     act.sa_flags = 0;
16955     oact.sa_handler = 0;
16956     /* so that act and oact are used */
16957     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16958 }
16959 EOP
16960         set try
16961         if eval $compile_ok; then
16962                 val="$define"
16963         else
16964                 echo "But you don't seem to have a useable struct sigaction." >&4
16965                 val="$undef"
16966         fi
16967 else
16968         echo 'sigaction NOT found.' >&4
16969         val="$undef"
16970 fi
16971 set d_sigaction; eval $setvar
16972 $rm_try
16973
16974 : see if this is a sunmath.h system
16975 set sunmath.h i_sunmath
16976 eval $inhdr
16977
16978 : see if signbit exists
16979 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16980 $cat >try.c <<EOCP
16981 #$i_math I_MATH
16982 #$i_sunmath I_SUNMATH
16983 #ifdef I_MATH
16984 #  include <math.h>
16985 #endif
16986 #ifdef I_SUNMATH  /* Solaris special math library */
16987 #  include <sunmath.h>
16988 #endif
16989 #define NV $nvtype
16990 int main(int argc, char **argv)
16991 {
16992     NV x = 0.0;
16993     NV y = -0.0;
16994     if ((signbit(x) == 0) && (signbit(y) != 0))
16995         return 0;
16996     else
16997         return 1;
16998 }
16999 EOCP
17000 val="$undef"
17001 set try
17002 if eval $compile; then
17003     if $run ./try; then
17004         $echo "Yes." >&4
17005         val="$define"
17006     else
17007         $echo "Signbit seems to be available, but doesn't work as I expected."
17008         $echo "I won't use it." >&4
17009         val="$undef"
17010     fi
17011 else
17012     $echo "Nope." >&4
17013     dflt="$undef"
17014 fi
17015 set d_signbit
17016 eval $setvar
17017 $rm_try
17018
17019 : see if sigprocmask exists
17020 set sigprocmask d_sigprocmask
17021 eval $inlibc
17022
17023 : see if sigsetjmp exists
17024 echo " "
17025 case "$d_sigsetjmp" in
17026 '')
17027         $cat >try.c <<EOP
17028 #include <setjmp.h>
17029 #$i_stdlib I_STDLIB
17030 #ifdef I_STDLIB
17031 #include <stdlib.h>
17032 #endif
17033 sigjmp_buf env;
17034 int set = 1;
17035 int main()
17036 {
17037         if (sigsetjmp(env,1))
17038                 exit(set);
17039         set = 0;
17040         siglongjmp(env, 1);
17041         exit(1);
17042 }
17043 EOP
17044         set try
17045         if eval $compile; then
17046                 if $run ./try >/dev/null 2>&1; then
17047                         echo "POSIX sigsetjmp found." >&4
17048                         val="$define"
17049                 else
17050                         $cat >&4 <<EOM
17051 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17052 I'll ignore them.
17053 EOM
17054                         val="$undef"
17055                 fi
17056         else
17057                 echo "sigsetjmp not found." >&4
17058                 val="$undef"
17059         fi
17060         ;;
17061 *) val="$d_sigsetjmp"
17062         case "$d_sigsetjmp" in
17063         $define) echo "POSIX sigsetjmp found." >&4;;
17064         $undef) echo "sigsetjmp not found." >&4;;
17065         esac
17066         ;;
17067 esac
17068 set d_sigsetjmp
17069 eval $setvar
17070 $rm_try
17071
17072 : see if snprintf exists
17073 set snprintf d_snprintf
17074 eval $inlibc
17075
17076 : see if vsnprintf exists
17077 set vsnprintf d_vsnprintf
17078 eval $inlibc
17079
17080 case "$d_snprintf-$d_vsnprintf" in
17081 "$define-$define")
17082     $cat <<EOM
17083 Checking whether your snprintf() and vsnprintf() work okay...
17084 EOM
17085     $cat >try.c <<'EOCP'
17086 /* v?snprintf testing logic courtesy of Russ Allbery.
17087  * According to C99:
17088  * - if the buffer is too short it still must be \0-terminated
17089  * - if the buffer is too short the potentially required length
17090  *   must be returned and not -1
17091  * - if the buffer is NULL the potentially required length
17092  *   must be returned and not -1 or core dump
17093  */
17094 #include <stdio.h>
17095 #include <stdarg.h>
17096
17097 char buf[2];
17098
17099 int test (char *format, ...)
17100 {
17101     va_list args;
17102     int count;
17103
17104     va_start (args, format);
17105     count = vsnprintf (buf, sizeof buf, format, args);
17106     va_end (args);
17107     return count;
17108 }
17109
17110 int main ()
17111 {
17112     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17113              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17114 }
17115 EOCP
17116     set try
17117     if eval $compile; then
17118         `$run ./try`
17119         case "$?" in
17120         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17121         *) cat <<EOM >&4
17122 Your snprintf() and snprintf() don't seem to be working okay.
17123 EOM
17124            d_snprintf="$undef"
17125            d_vsnprintf="$undef"
17126            ;;
17127         esac
17128     else
17129         echo "(I can't seem to compile the test program--assuming they don't)"
17130         d_snprintf="$undef"
17131         d_vsnprintf="$undef"
17132     fi
17133     $rm_try
17134     ;;
17135 esac
17136
17137 : see if sockatmark exists
17138 set sockatmark d_sockatmark
17139 eval $inlibc
17140
17141 : see if prototype for sockatmark is available
17142 echo " "
17143 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17144 eval $hasproto
17145
17146 : see if socks5_init exists
17147 set socks5_init d_socks5_init
17148 eval $inlibc
17149
17150 : see if sprintf returns the length of the string in the buffer as per ANSI
17151 $echo "Checking whether sprintf returns the length of the string..." >&4
17152 $cat <<EOP >try.c
17153 #include <stdio.h>
17154 #$i_stdlib I_STDLIB
17155 #ifdef I_STDLIB
17156 #include <stdlib.h>
17157 #endif
17158 #$i_string I_STRING
17159 #ifdef I_STRING
17160 #  include <string.h>
17161 #else
17162 #  include <strings.h>
17163 #endif
17164 #$i_math I_MATH
17165 #ifdef I_MATH
17166 #include <math.h>
17167 #endif
17168
17169 char buffer[256];
17170
17171 int check (size_t expect, int test) {
17172   size_t got = strlen(buffer);
17173   if (expect == got)
17174     return 0;
17175
17176   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17177        test, buffer);
17178   exit (test);
17179 }
17180
17181 int main(int argc, char **argv) {
17182   int test = 0;
17183
17184   check(sprintf(buffer, ""), ++test);
17185   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17186   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17187
17188   return 0;
17189 }
17190 EOP
17191 set try
17192
17193 d_sprintf_returns_strlen="$undef"
17194 if eval $compile; then
17195     xxx="`$run ./try`"
17196     case "$?" in
17197         0) cat >&4 <<EOM
17198 sprintf returns the length of the string (as ANSI says it should)
17199 EOM
17200         d_sprintf_returns_strlen="$define"
17201         ;;
17202         *) cat >&4 <<EOM
17203 sprintf does not return the length of the string (how old is this system?)
17204 EOM
17205         d_sprintf_returns_strlen="$undef"
17206         ;;
17207     esac
17208 fi
17209 $rm_try
17210
17211 : see if srand48_r exists
17212 set srand48_r d_srand48_r
17213 eval $inlibc
17214 case "$d_srand48_r" in
17215 "$define")
17216         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17217         case "$d_srand48_r_proto:$usethreads" in
17218         ":define")      d_srand48_r_proto=define
17219                 set d_srand48_r_proto srand48_r $hdrs
17220                 eval $hasproto ;;
17221         *)      ;;
17222         esac
17223         case "$d_srand48_r_proto" in
17224         define)
17225         case "$srand48_r_proto" in
17226         ''|0) try='int srand48_r(long, struct drand48_data*);'
17227         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17228         esac
17229         case "$srand48_r_proto" in
17230         ''|0)   d_srand48_r=undef
17231                 srand48_r_proto=0
17232                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17233         * )     case "$srand48_r_proto" in
17234                 REENTRANT_PROTO*) ;;
17235                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17236                 esac
17237                 echo "Prototype: $try" ;;
17238         esac
17239         ;;
17240         *)      case "$usethreads" in
17241                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17242                 esac
17243                 d_srand48_r=undef
17244                 srand48_r_proto=0
17245                 ;;
17246         esac
17247         ;;
17248 *)      srand48_r_proto=0
17249         ;;
17250 esac
17251
17252 : see if srandom_r exists
17253 set srandom_r d_srandom_r
17254 eval $inlibc
17255 case "$d_srandom_r" in
17256 "$define")
17257         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17258         case "$d_srandom_r_proto:$usethreads" in
17259         ":define")      d_srandom_r_proto=define
17260                 set d_srandom_r_proto srandom_r $hdrs
17261                 eval $hasproto ;;
17262         *)      ;;
17263         esac
17264         case "$d_srandom_r_proto" in
17265         define)
17266         case "$srandom_r_proto" in
17267         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17268         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17269         esac
17270         case "$srandom_r_proto" in
17271         ''|0)   d_srandom_r=undef
17272                 srandom_r_proto=0
17273                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17274         * )     case "$srandom_r_proto" in
17275                 REENTRANT_PROTO*) ;;
17276                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17277                 esac
17278                 echo "Prototype: $try" ;;
17279         esac
17280         ;;
17281         *)      case "$usethreads" in
17282                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17283                 esac
17284                 d_srandom_r=undef
17285                 srandom_r_proto=0
17286                 ;;
17287         esac
17288         ;;
17289 *)      srandom_r_proto=0
17290         ;;
17291 esac
17292
17293 : see if prototype for setresgid is available
17294 echo " "
17295 set d_sresgproto setresgid $i_unistd unistd.h
17296 eval $hasproto
17297
17298 : see if prototype for setresuid is available
17299 echo " "
17300 set d_sresuproto setresuid $i_unistd unistd.h
17301 eval $hasproto
17302
17303 : see if sys/stat.h is available
17304 set sys/stat.h i_sysstat
17305 eval $inhdr
17306
17307
17308 : see if stat knows about block sizes
17309 echo " "
17310 echo "Checking to see if your struct stat has st_blocks field..." >&4
17311 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17312 eval $hasfield
17313
17314
17315 : see if this is a sys/vfs.h system
17316 set sys/vfs.h i_sysvfs
17317 eval $inhdr
17318
17319
17320 : see if this is a sys/statfs.h system
17321 set sys/statfs.h i_sysstatfs
17322 eval $inhdr
17323
17324
17325 echo " "
17326 echo "Checking to see if your system supports struct statfs..." >&4
17327 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
17328 eval $hasstruct
17329 case "$d_statfs_s" in
17330 "$define")      echo "Yes, it does."   ;;
17331 *)              echo "No, it doesn't." ;;
17332 esac
17333
17334
17335
17336 : see if struct statfs knows about f_flags
17337 case "$d_statfs_s" in
17338 define) 
17339         echo " "
17340         echo "Checking to see if your struct statfs has f_flags field..." >&4
17341         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
17342         eval $hasfield
17343         ;;
17344 *)      val="$undef"
17345         set d_statfs_f_flags
17346         eval $setvar
17347         ;;
17348 esac
17349 case "$d_statfs_f_flags" in
17350 "$define")      echo "Yes, it does."   ;;
17351 *)              echo "No, it doesn't." ;;
17352 esac
17353
17354 $cat >&4 <<EOM
17355 Checking how to access stdio streams by file descriptor number...
17356 EOM
17357 case "$stdio_stream_array" in
17358 '')     $cat >try.c <<EOCP
17359 #include <stdio.h>
17360 int main() {
17361   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17362     printf("yes\n");
17363 }
17364 EOCP
17365         for s in _iob __iob __sF
17366         do
17367                 set try -DSTDIO_STREAM_ARRAY=$s
17368                 if eval $compile; then
17369                         case "`$run ./try`" in
17370                         yes)    stdio_stream_array=$s; break ;;
17371                         esac
17372                 fi
17373         done
17374         $rm_try
17375 esac
17376 case "$stdio_stream_array" in
17377 '')     $cat >&4 <<EOM
17378 I can't figure out how to access stdio streams by file descriptor number.
17379 EOM
17380         d_stdio_stream_array="$undef"
17381         ;;
17382 *)      $cat >&4 <<EOM
17383 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17384 EOM
17385         d_stdio_stream_array="$define"
17386         ;;
17387 esac
17388
17389 : see if strcoll exists
17390 set strcoll d_strcoll
17391 eval $inlibc
17392
17393 : check for structure copying
17394 echo " "
17395 echo "Checking to see if your C compiler can copy structs..." >&4
17396 $cat >try.c <<'EOCP'
17397 int main()
17398 {
17399         struct blurfl {
17400                 int dyick;
17401         } foo, bar;
17402
17403         foo = bar;
17404 }
17405 EOCP
17406 if $cc -c try.c >/dev/null 2>&1 ; then
17407         val="$define"
17408         echo "Yup, it can."
17409 else
17410         val="$undef"
17411         echo "Nope, it can't."
17412 fi
17413 set d_strctcpy
17414 eval $setvar
17415 $rm_try
17416
17417 : see if strerror and/or sys_errlist[] exist
17418 echo " "
17419 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17420     if set strerror val -f d_strerror; eval $csym; $val; then
17421                 echo 'strerror() found.' >&4
17422                 d_strerror="$define"
17423                 d_strerrm='strerror(e)'
17424                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17425                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17426                         d_syserrlst="$define"
17427                 else
17428                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17429                         d_syserrlst="$undef"
17430                 fi
17431     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17432                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17433                 echo 'strerror() found in string header.' >&4
17434                 d_strerror="$define"
17435                 d_strerrm='strerror(e)'
17436                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17437                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17438                                 d_syserrlst="$define"
17439                 else
17440                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17441                         d_syserrlst="$undef"
17442                 fi
17443     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17444                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17445                 d_strerror="$undef"
17446                 d_syserrlst="$define"
17447                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17448     else
17449                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17450                 d_strerror="$undef"
17451                 d_syserrlst="$undef"
17452                 d_strerrm='"unknown"'
17453     fi
17454 fi
17455
17456 : see if strerror_r exists
17457 set strerror_r d_strerror_r
17458 eval $inlibc
17459 case "$d_strerror_r" in
17460 "$define")
17461         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17462         case "$d_strerror_r_proto:$usethreads" in
17463         ":define")      d_strerror_r_proto=define
17464                 set d_strerror_r_proto strerror_r $hdrs
17465                 eval $hasproto ;;
17466         *)      ;;
17467         esac
17468         case "$d_strerror_r_proto" in
17469         define)
17470         case "$strerror_r_proto" in
17471         ''|0) try='int strerror_r(int, char*, size_t);'
17472         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17473         esac
17474         case "$strerror_r_proto" in
17475         ''|0) try='int strerror_r(int, char*, int);'
17476         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17477         esac
17478         case "$strerror_r_proto" in
17479         ''|0) try='char* strerror_r(int, char*, size_t);'
17480         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17481         esac
17482         case "$strerror_r_proto" in
17483         ''|0)   d_strerror_r=undef
17484                 strerror_r_proto=0
17485                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17486         * )     case "$strerror_r_proto" in
17487                 REENTRANT_PROTO*) ;;
17488                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17489                 esac
17490                 echo "Prototype: $try" ;;
17491         esac
17492         ;;
17493         *)      case "$usethreads" in
17494                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17495                 esac
17496                 d_strerror_r=undef
17497                 strerror_r_proto=0
17498                 ;;
17499         esac
17500         ;;
17501 *)      strerror_r_proto=0
17502         ;;
17503 esac
17504
17505 : see if strftime exists
17506 set strftime d_strftime
17507 eval $inlibc
17508
17509 : see if strlcat exists
17510 set strlcat d_strlcat
17511 eval $inlibc
17512
17513 : see if strlcpy exists
17514 set strlcpy d_strlcpy
17515 eval $inlibc
17516
17517 : see if strtod exists
17518 set strtod d_strtod
17519 eval $inlibc
17520
17521 : see if strtol exists
17522 set strtol d_strtol
17523 eval $inlibc
17524
17525 : see if strtold exists
17526 set strtold d_strtold
17527 eval $inlibc
17528
17529 : see if strtoll exists
17530 set strtoll d_strtoll
17531 eval $inlibc
17532
17533 case "$d_longlong-$d_strtoll" in
17534 "$define-$define")
17535         $cat <<EOM
17536 Checking whether your strtoll() works okay...
17537 EOM
17538         $cat >try.c <<'EOCP'
17539 #include <errno.h>
17540 #ifdef __hpux
17541 #define strtoll __strtoll
17542 #endif
17543 #ifdef __EMX__
17544 #define strtoll _strtoll
17545 #endif
17546 #include <stdio.h>
17547 extern long long int strtoll(char *s, char **, int); 
17548 static int bad = 0;
17549 int check(char *s, long long ell, int een) {
17550         long long gll;
17551         errno = 0;
17552         gll = strtoll(s, 0, 10);
17553         if (!((gll == ell) && (errno == een)))
17554                 bad++;
17555 }
17556 int main() {
17557         check(" 1",                                      1LL, 0);
17558         check(" 0",                                      0LL, 0);
17559         check("-1",                                     -1LL, 0);
17560         check("-9223372036854775808", -9223372036854775808LL, 0);
17561         check("-9223372036854775808", -9223372036854775808LL, 0);
17562         check(" 9223372036854775807",  9223372036854775807LL, 0);
17563         check("-9223372036854775808", -9223372036854775808LL, 0);
17564         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17565         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17566         if (!bad)
17567                 printf("ok\n");
17568 }
17569 EOCP
17570         set try
17571         if eval $compile; then
17572                 yyy=`$run ./try`
17573                 case "$yyy" in
17574                 ok) echo "Your strtoll() seems to be working okay." ;;
17575                 *) cat <<EOM >&4
17576 Your strtoll() doesn't seem to be working okay.
17577 EOM
17578                    d_strtoll="$undef"
17579                    ;;
17580                 esac
17581         else
17582                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17583                 d_strtoll="$undef"
17584         fi
17585         ;;
17586 esac
17587
17588 : see if strtoq exists
17589 set strtoq d_strtoq
17590 eval $inlibc
17591
17592 : see if strtoul exists
17593 set strtoul d_strtoul
17594 eval $inlibc
17595
17596 case "$d_strtoul" in
17597 "$define")
17598         $cat <<EOM
17599 Checking whether your strtoul() works okay...
17600 EOM
17601         $cat >try.c <<'EOCP'
17602 #include <errno.h>
17603 #include <stdio.h>
17604 extern unsigned long int strtoul(char *s, char **, int); 
17605 static int bad = 0;
17606 void check(char *s, unsigned long eul, int een) {
17607         unsigned long gul;
17608         errno = 0;
17609         gul = strtoul(s, 0, 10);
17610         if (!((gul == eul) && (errno == een)))
17611                 bad++;
17612 }
17613 int main() {
17614         check(" 1", 1L, 0);
17615         check(" 0", 0L, 0);
17616 EOCP
17617         case "$longsize" in
17618         8)
17619             $cat >>try.c <<'EOCP'
17620         check("18446744073709551615", 18446744073709551615UL, 0);
17621         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17622 #if 0 /* strtoul() for /^-/ strings is undefined. */
17623         check("-1", 18446744073709551615UL, 0);
17624         check("-18446744073709551614", 2, 0);
17625         check("-18446744073709551615", 1, 0);
17626         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17627         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17628 #endif
17629 EOCP
17630                 ;;
17631         4)
17632                     $cat >>try.c <<'EOCP'
17633         check("4294967295", 4294967295UL, 0);
17634         check("4294967296", 4294967295UL, ERANGE);
17635 #if 0 /* strtoul() for /^-/ strings is undefined. */
17636         check("-1", 4294967295UL, 0);
17637         check("-4294967294", 2, 0);
17638         check("-4294967295", 1, 0);
17639         check("-4294967296", 4294967295UL, ERANGE);
17640         check("-4294967297", 4294967295UL, ERANGE);
17641 #endif
17642 EOCP
17643                 ;;
17644         *)
17645 : Should we write these tests to be more portable by sprintf-ing
17646 : ~0 and then manipulating that char string as input for strtol?
17647                 ;;
17648         esac
17649         $cat >>try.c <<'EOCP'
17650         if (!bad)
17651                 printf("ok\n");
17652         return 0;
17653 }
17654 EOCP
17655         set try
17656         if eval $compile; then
17657                 case "`$run ./try`" in
17658                 ok) echo "Your strtoul() seems to be working okay." ;;
17659                 *) cat <<EOM >&4
17660 Your strtoul() doesn't seem to be working okay.
17661 EOM
17662                    d_strtoul="$undef"
17663                    ;;
17664                 esac
17665         else
17666                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17667                 d_strtoul="$undef"
17668         fi
17669         ;;
17670 esac
17671
17672 : see if strtoull exists
17673 set strtoull d_strtoull
17674 eval $inlibc
17675
17676 case "$d_longlong-$d_strtoull" in
17677 "$define-$define")
17678         $cat <<EOM
17679 Checking whether your strtoull() works okay...
17680 EOM
17681         $cat >try.c <<'EOCP'
17682 #include <errno.h>
17683 #ifdef __hpux
17684 #define strtoull __strtoull
17685 #endif
17686 #include <stdio.h>
17687 extern unsigned long long int strtoull(char *s, char **, int); 
17688 static int bad = 0;
17689 int check(char *s, long long eull, int een) {
17690         long long gull;
17691         errno = 0;
17692         gull = strtoull(s, 0, 10);
17693         if (!((gull == eull) && (errno == een)))
17694                 bad++;
17695 }
17696 int main() {
17697         check(" 1",                                        1LL, 0);
17698         check(" 0",                                        0LL, 0);
17699         check("18446744073709551615",  18446744073709551615ULL, 0);
17700         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17701 #if 0 /* strtoull() for /^-/ strings is undefined. */
17702         check("-1",                    18446744073709551615ULL, 0);
17703         check("-18446744073709551614",                     2LL, 0);
17704         check("-18446744073709551615",                     1LL, 0);
17705         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17706         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17707 #endif
17708         if (!bad)
17709                 printf("ok\n");
17710 }
17711 EOCP
17712         set try
17713         if eval $compile; then
17714                 case "`$run ./try`" in
17715                 ok) echo "Your strtoull() seems to be working okay." ;;
17716                 *) cat <<EOM >&4
17717 Your strtoull() doesn't seem to be working okay.
17718 EOM
17719                    d_strtoull="$undef"
17720                    ;;
17721                 esac
17722         else
17723                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17724                 d_strtoull="$undef"
17725         fi
17726         ;;
17727 esac
17728
17729 : see if strtouq exists
17730 set strtouq d_strtouq
17731 eval $inlibc
17732
17733 case "$d_strtouq" in
17734 "$define")
17735         $cat <<EOM
17736 Checking whether your strtouq() works okay...
17737 EOM
17738         $cat >try.c <<'EOCP'
17739 #include <errno.h>
17740 #include <stdio.h>
17741 extern unsigned long long int strtouq(char *s, char **, int); 
17742 static int bad = 0;
17743 void check(char *s, unsigned long long eull, int een) {
17744         unsigned long long gull;
17745         errno = 0;
17746         gull = strtouq(s, 0, 10);
17747         if (!((gull == eull) && (errno == een)))
17748                 bad++;
17749 }
17750 int main() {
17751         check(" 1",                                        1LL, 0);
17752         check(" 0",                                        0LL, 0);
17753         check("18446744073709551615",  18446744073709551615ULL, 0);
17754         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17755 #if 0 /* strtouq() for /^-/ strings is undefined. */
17756         check("-1",                    18446744073709551615ULL, 0);
17757         check("-18446744073709551614",                     2LL, 0);
17758         check("-18446744073709551615",                     1LL, 0);
17759         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17760         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17761 #endif
17762         if (!bad)
17763                 printf("ok\n");
17764         return 0;
17765 }
17766 EOCP
17767         set try
17768         if eval $compile; then
17769                 case "`$run ./try`" in
17770                 ok) echo "Your strtouq() seems to be working okay." ;;
17771                 *) cat <<EOM >&4
17772 Your strtouq() doesn't seem to be working okay.
17773 EOM
17774                    d_strtouq="$undef"
17775                    ;;
17776                 esac
17777         else
17778                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17779                 d_strtouq="$undef"
17780         fi
17781         ;;
17782 esac
17783
17784 : see if strxfrm exists
17785 set strxfrm d_strxfrm
17786 eval $inlibc
17787
17788 : see if symlink exists
17789 set symlink d_symlink
17790 eval $inlibc
17791
17792 : see if syscall exists
17793 set syscall d_syscall
17794 eval $inlibc
17795
17796 : see if prototype for syscall is available
17797 echo " "
17798 set d_syscallproto syscall $i_unistd unistd.h
17799 eval $hasproto
17800
17801 : see if sysconf exists
17802 set sysconf d_sysconf
17803 eval $inlibc
17804
17805 : see if system exists
17806 set system d_system
17807 eval $inlibc
17808
17809 : see if tcgetpgrp exists
17810 set tcgetpgrp d_tcgetpgrp
17811 eval $inlibc
17812
17813 : see if tcsetpgrp exists
17814 set tcsetpgrp d_tcsetpgrp
17815 eval $inlibc
17816
17817 : see if prototype for telldir is available
17818 echo " "
17819 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17820 eval $hasproto
17821
17822 : see if time exists
17823 echo " "
17824 if test "X$d_time" = X -o X"$timetype" = X; then
17825     if set time val -f d_time; eval $csym; $val; then
17826                 echo 'time() found.' >&4
17827                 val="$define"
17828                 rp="What is the type returned by time() on this system?"
17829                 set time_t timetype long stdio.h sys/types.h
17830                 eval $typedef_ask
17831     else
17832                 echo 'time() not found, hope that will do.' >&4
17833                 val="$undef"
17834                 timetype='int';
17835     fi
17836     set d_time
17837     eval $setvar
17838 fi
17839
17840 : see if this is a sys/times.h system
17841 set sys/times.h i_systimes
17842 eval $inhdr
17843
17844 : see if times exists
17845 echo " "
17846 if set times val -f d_times; eval $csym; $val; then
17847         echo 'times() found.' >&4
17848         d_times="$define"
17849         inc=''
17850         case "$i_systimes" in
17851         "$define") inc='sys/times.h';;
17852         esac
17853         rp="What is the type returned by times() on this system?"
17854         set clock_t clocktype long stdio.h sys/types.h $inc
17855         eval $typedef_ask
17856 else
17857         echo 'times() NOT found, hope that will do.' >&4
17858         d_times="$undef"
17859         clocktype='int'
17860 fi
17861
17862 : see if tmpnam_r exists
17863 set tmpnam_r d_tmpnam_r
17864 eval $inlibc
17865 case "$d_tmpnam_r" in
17866 "$define")
17867         hdrs="$i_systypes sys/types.h define stdio.h "
17868         case "$d_tmpnam_r_proto:$usethreads" in
17869         ":define")      d_tmpnam_r_proto=define
17870                 set d_tmpnam_r_proto tmpnam_r $hdrs
17871                 eval $hasproto ;;
17872         *)      ;;
17873         esac
17874         case "$d_tmpnam_r_proto" in
17875         define)
17876         case "$tmpnam_r_proto" in
17877         ''|0) try='char* tmpnam_r(char*);'
17878         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17879         esac
17880         case "$tmpnam_r_proto" in
17881         ''|0)   d_tmpnam_r=undef
17882                 tmpnam_r_proto=0
17883                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17884         * )     case "$tmpnam_r_proto" in
17885                 REENTRANT_PROTO*) ;;
17886                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17887                 esac
17888                 echo "Prototype: $try" ;;
17889         esac
17890         ;;
17891         *)      case "$usethreads" in
17892                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17893                 esac
17894                 d_tmpnam_r=undef
17895                 tmpnam_r_proto=0
17896                 ;;
17897         esac
17898         ;;
17899 *)      tmpnam_r_proto=0
17900         ;;
17901 esac
17902
17903 : see if truncate exists
17904 set truncate d_truncate
17905 eval $inlibc
17906
17907 : see if ttyname_r exists
17908 set ttyname_r d_ttyname_r
17909 eval $inlibc
17910 case "$d_ttyname_r" in
17911 "$define")
17912         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17913         case "$d_ttyname_r_proto:$usethreads" in
17914         ":define")      d_ttyname_r_proto=define
17915                 set d_ttyname_r_proto ttyname_r $hdrs
17916                 eval $hasproto ;;
17917         *)      ;;
17918         esac
17919         case "$d_ttyname_r_proto" in
17920         define)
17921         case "$ttyname_r_proto" in
17922         ''|0) try='int ttyname_r(int, char*, size_t);'
17923         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17924         esac
17925         case "$ttyname_r_proto" in
17926         ''|0) try='int ttyname_r(int, char*, int);'
17927         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17928         esac
17929         case "$ttyname_r_proto" in
17930         ''|0) try='char* ttyname_r(int, char*, int);'
17931         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17932         esac
17933         case "$ttyname_r_proto" in
17934         ''|0)   d_ttyname_r=undef
17935                 ttyname_r_proto=0
17936                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17937         * )     case "$ttyname_r_proto" in
17938                 REENTRANT_PROTO*) ;;
17939                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17940                 esac
17941                 echo "Prototype: $try" ;;
17942         esac
17943         ;;
17944         *)      case "$usethreads" in
17945                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17946                 esac
17947                 d_ttyname_r=undef
17948                 ttyname_r_proto=0
17949                 ;;
17950         esac
17951         ;;
17952 *)      ttyname_r_proto=0
17953         ;;
17954 esac
17955
17956 : see if tzname[] exists
17957 echo " "
17958 if set tzname val -a d_tzname; eval $csym; $val; then
17959         val="$define"
17960         echo 'tzname[] found.' >&4
17961 else
17962         val="$undef"
17963         echo 'tzname[] NOT found.' >&4
17964 fi
17965 set d_tzname
17966 eval $setvar
17967
17968 case "$osname" in
17969 next|rhapsody|darwin) multiarch="$define" ;;
17970 esac
17971 case "$multiarch" in
17972 ''|[nN]*) multiarch="$undef" ;;
17973 esac
17974
17975 : check for ordering of bytes in a UV
17976 echo " "
17977 case "$usecrosscompile$multiarch" in
17978 *$define*)
17979         $cat <<EOM
17980 You seem to be either cross-compiling or doing a multiarchitecture build,
17981 skipping the byteorder check.
17982
17983 EOM
17984         byteorder='ffff'
17985         ;;
17986 *)
17987         case "$byteorder" in
17988         '')
17989                 $cat <<'EOM'
17990 In the following, larger digits indicate more significance.  A big-endian
17991 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17992 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17993 machines may have weird orders like 3412.  A Cray will report 87654321,
17994 an Alpha will report 12345678. If the test program works the default is
17995 probably right.
17996 I'm now running the test program...
17997 EOM
17998                 $cat >try.c <<EOCP
17999 #include <stdio.h>
18000 #$i_stdlib I_STDLIB
18001 #ifdef I_STDLIB
18002 #include <stdlib.h>
18003 #endif
18004 #include <sys/types.h>
18005 typedef $uvtype UV;
18006 int main()
18007 {
18008         int i;
18009         union {
18010                 UV l;
18011                 char c[$uvsize];
18012         } u;
18013
18014         if ($uvsize > 4)
18015                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18016         else
18017                 u.l = (UV)0x04030201;
18018         for (i = 0; i < $uvsize; i++)
18019                 printf("%c", u.c[i]+'0');
18020         printf("\n");
18021         exit(0);
18022 }
18023 EOCP
18024                 xxx_prompt=y
18025                 set try
18026                 if eval $compile && $run ./try > /dev/null; then
18027                         dflt=`$run ./try`
18028                         case "$dflt" in
18029                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18030                                 echo "(The test program ran ok.)"
18031                                 echo "byteorder=$dflt"
18032                                 xxx_prompt=n
18033                         ;;
18034                         ????|????????) echo "(The test program ran ok.)" ;;
18035                         *) echo "(The test program didn't run right for some reason.)" ;;
18036                         esac
18037                 else
18038                         dflt='4321'
18039                         cat <<'EOM'
18040 (I can't seem to compile the test program.  Guessing big-endian...)
18041 EOM
18042                 fi
18043                 case "$xxx_prompt" in
18044                 y)
18045                         rp="What is the order of bytes in $uvtype?"
18046                         . ./myread
18047                         byteorder="$ans"
18048                         ;;
18049                 *)      byteorder=$dflt
18050                         ;;
18051                 esac
18052                 ;;
18053         esac
18054         $rm_try
18055         ;;
18056 esac
18057
18058 $cat <<EOM
18059
18060 Checking to see whether you can access character data unalignedly...
18061 EOM
18062 case "$d_u32align" in
18063 '')   $cat >try.c <<EOCP
18064 #include <stdio.h>
18065 #$i_stdlib I_STDLIB
18066 #ifdef I_STDLIB
18067 #include <stdlib.h>
18068 #endif
18069 #define U32 $u32type
18070 #define BYTEORDER 0x$byteorder
18071 #define U8 $u8type
18072 #include <signal.h>
18073 #ifdef SIGBUS
18074 $signal_t bletch(int s) { exit(4); }
18075 #endif
18076 int main() {
18077 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18078     U8 buf[8];
18079     U32 *up;
18080     int i;
18081
18082     if (sizeof(U32) != 4) {
18083         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18084         exit(1);
18085     }
18086
18087     fflush(stdout);
18088
18089 #ifdef SIGBUS
18090     signal(SIGBUS, bletch);
18091 #endif
18092
18093     buf[0] = 0;
18094     buf[1] = 0;
18095     buf[2] = 0;
18096     buf[3] = 1;
18097     buf[4] = 0;
18098     buf[5] = 0;
18099     buf[6] = 0;
18100     buf[7] = 1;
18101
18102     for (i = 0; i < 4; i++) {
18103         up = (U32*)(buf + i);
18104         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18105                (*up == 1 << (8*(3-i)))  /* little-endian */
18106               )
18107            )
18108         {
18109             printf("read failed (%x)\n", *up);
18110             exit(2);
18111         }
18112     }
18113
18114     /* write test */
18115     for (i = 0; i < 4; i++) {
18116         up = (U32*)(buf + i);
18117         *up = 0xBeef;
18118         if (*up != 0xBeef) {
18119             printf("write failed (%x)\n", *up);
18120             exit(3);
18121         }
18122     }
18123
18124     exit(0);
18125 #else
18126     printf("1\n");
18127     exit(1);
18128 #endif
18129     return 0;
18130 }
18131 EOCP
18132 set try
18133 if eval $compile_ok; then
18134         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18135         $run ./try 2>&1 >/dev/null
18136         case "$?" in
18137         0)      cat >&4 <<EOM
18138 You can access character data pretty unalignedly.
18139 EOM
18140                 d_u32align="$undef"
18141                 ;;
18142         *)      cat >&4 <<EOM
18143 It seems that you must access character data in an aligned manner.
18144 EOM
18145                 d_u32align="$define"
18146                 ;;
18147         esac
18148 else
18149         rp='Can you access character data at unaligned addresses?'
18150         dflt='n'
18151         . ./myread
18152         case "$ans" in
18153         [yY]*)  d_u32align="$undef"  ;;
18154         *)      d_u32align="$define" ;;
18155         esac
18156 fi
18157 $rm_try
18158 ;;
18159 esac
18160
18161 : see if ualarm exists
18162 set ualarm d_ualarm
18163 eval $inlibc
18164
18165 : see if umask exists
18166 set umask d_umask
18167 eval $inlibc
18168
18169 : see if unordered exists
18170 set unordered d_unordered
18171 eval $inlibc
18172
18173 : see if unsetenv exists
18174 set unsetenv d_unsetenv
18175 eval $inlibc
18176
18177 : see if usleep exists
18178 set usleep d_usleep
18179 eval $inlibc
18180
18181 : see if prototype for usleep is available
18182 echo " "
18183 set d_usleepproto usleep $i_unistd unistd.h
18184 eval $hasproto
18185
18186 : see if ustat exists
18187 set ustat d_ustat
18188 eval $inlibc
18189
18190 : see if closedir exists
18191 set closedir d_closedir
18192 eval $inlibc
18193
18194 case "$d_closedir" in
18195 "$define")
18196         echo " "
18197         echo "Checking whether closedir() returns a status..." >&4
18198         cat > try.c <<EOM
18199 #$i_dirent I_DIRENT             /**/
18200 #$i_sysdir I_SYS_DIR            /**/
18201 #$i_sysndir I_SYS_NDIR          /**/
18202 #$i_systypes I_SYS_TYPES        /**/
18203
18204 #if defined(I_SYS_TYPES)
18205 #include <sys/types.h>
18206 #endif
18207 #if defined(I_DIRENT)
18208 #include <dirent.h>
18209 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18210 #include <sys/dir.h>
18211 #endif
18212 #else
18213 #ifdef I_SYS_NDIR
18214 #include <sys/ndir.h>
18215 #else
18216 #ifdef I_SYS_DIR
18217 #ifdef hp9000s500
18218 #include <ndir.h>       /* may be wrong in the future */
18219 #else
18220 #include <sys/dir.h>
18221 #endif
18222 #endif
18223 #endif
18224 #endif
18225 int main() { return closedir(opendir(".")); }
18226 EOM
18227         set try
18228         if eval $compile_ok; then
18229                 if $run ./try > /dev/null 2>&1 ; then
18230                         echo "Yes, it does."
18231                         val="$undef"
18232                 else
18233                         echo "No, it doesn't."
18234                         val="$define"
18235                 fi
18236         else
18237                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18238                 val="$define"
18239         fi
18240         ;;
18241 *)
18242         val="$undef";
18243         ;;
18244 esac
18245 set d_void_closedir
18246 eval $setvar
18247 $rm_try
18248
18249 : see if there is a wait4
18250 set wait4 d_wait4
18251 eval $inlibc
18252
18253 : see if waitpid exists
18254 set waitpid d_waitpid
18255 eval $inlibc
18256
18257 : see if wcstombs exists
18258 set wcstombs d_wcstombs
18259 eval $inlibc
18260
18261 : see if wctomb exists
18262 set wctomb d_wctomb
18263 eval $inlibc
18264
18265 : see if writev exists
18266 set writev d_writev
18267 eval $inlibc
18268
18269 : preserve RCS keywords in files with variable substitution, grrr
18270 Date='$Date'
18271 Id='$Id'
18272 Log='$Log'
18273 RCSfile='$RCSfile'
18274 Revision='$Revision'
18275
18276 : check for alignment requirements
18277 echo " "
18278 case "$usecrosscompile$multiarch" in
18279 *$define*)
18280         $cat <<EOM
18281 You seem to be either cross-compiling or doing a multiarchitecture build,
18282 skipping the memory alignment check.
18283
18284 EOM
18285         case "$alignbytes" in
18286         '') alignbytes=8 ;;
18287         esac
18288         ;;
18289 *)
18290         case "$alignbytes" in
18291         '') echo "Checking alignment constraints..." >&4
18292                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18293                         $cat >try.c <<'EOCP'
18294 typedef long double NV;
18295 EOCP
18296                 else
18297                         $cat >try.c <<'EOCP'
18298 typedef double NV;
18299 EOCP
18300                 fi
18301                 $cat >>try.c <<'EOCP'
18302 #include <stdio.h>
18303 struct foobar {
18304         char foo;
18305         NV bar;
18306 } try_algn;
18307 int main()
18308 {
18309     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18310     return(0);
18311 }
18312 EOCP
18313                 set try
18314                 if eval $compile_ok; then
18315                         dflt=`$run ./try`
18316                 else
18317                         dflt='8'
18318                         echo "(I can't seem to compile the test program...)"
18319                 fi
18320                 ;;
18321         *) dflt="$alignbytes"
18322                 ;;
18323         esac
18324         rp="Doubles must be aligned on a how-many-byte boundary?"
18325         . ./myread
18326         alignbytes="$ans"
18327         $rm_try
18328         ;;
18329 esac
18330
18331
18332 : set the base revision
18333 baserev=5.0
18334
18335 : how do we concatenate cpp tokens here?
18336 echo " "
18337 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18338 $cat >cpp_stuff.c <<'EOCP'
18339 #define RCAT(a,b)a/**/b
18340 #define ACAT(a,b)a ## b
18341 RCAT(Rei,ser)
18342 ACAT(Cir,cus)
18343 EOCP
18344 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18345 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18346         echo "Oh!  Smells like ANSI's been here." >&4
18347         echo "We can catify or stringify, separately or together!"
18348         cpp_stuff=42
18349 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18350         echo "Ah, yes!  The good old days!" >&4
18351         echo "However, in the good old days we don't know how to stringify and"
18352         echo "catify at the same time."
18353         cpp_stuff=1
18354 else
18355         $cat >&4 <<EOM
18356 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18357 You're going to have to edit the values of CAT[2-5] in config.h...
18358 EOM
18359         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18360 fi
18361 $rm -f cpp_stuff.*
18362
18363 : see if this is a db.h system
18364 set db.h i_db
18365 eval $inhdr
18366
18367 case "$i_db" in
18368 $define)
18369         : Check db version.
18370         echo " "
18371         echo "Checking Berkeley DB version ..." >&4
18372         $cat >try.c <<EOCP
18373 #$d_const HASCONST
18374 #ifndef HASCONST
18375 #define const
18376 #endif
18377 #include <sys/types.h>
18378 #include <stdio.h>
18379 #$i_stdlib I_STDLIB
18380 #ifdef I_STDLIB
18381 #include <stdlib.h>
18382 #endif
18383 #include <db.h>
18384 int main(int argc, char *argv[])
18385 {
18386 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18387     int Major, Minor, Patch ;
18388     unsigned long Version ;
18389     (void)db_version(&Major, &Minor, &Patch) ;
18390     if (argc == 2) {
18391         printf("%d %d %d %d %d %d\n",
18392                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18393                Major, Minor, Patch);
18394         exit(0);
18395     }
18396     printf("You have Berkeley DB Version 2 or greater.\n");
18397
18398     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18399                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18400     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18401                 Major, Minor, Patch) ;
18402
18403     /* check that db.h & libdb are compatible */
18404     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18405         printf("db.h and libdb are incompatible.\n") ;
18406         exit(3);
18407     }
18408
18409     printf("db.h and libdb are compatible.\n") ;
18410
18411     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18412                 + DB_VERSION_PATCH ;
18413
18414     /* needs to be >= 2.3.4 */
18415     if (Version < 2003004) {
18416     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18417         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18418         exit(2);
18419     }
18420
18421     exit(0);
18422 #else
18423 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18424     if (argc == 2) {
18425         printf("1 0 0\n");
18426         exit(0);
18427     }
18428     printf("You have Berkeley DB Version 1.\n");
18429     exit(0);    /* DB version < 2: the coast is clear. */
18430 #else
18431     exit(1);    /* <db.h> not Berkeley DB? */
18432 #endif
18433 #endif
18434 }
18435 EOCP
18436         set try
18437         if eval $compile_ok && $run ./try; then
18438                 echo 'Looks OK.' >&4
18439                 set `$run ./try 1`
18440                 db_version_major=$1
18441                 db_version_minor=$2
18442                 db_version_patch=$3
18443         else
18444                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18445                 i_db=$undef
18446                 case " $libs " in
18447                 *"-ldb "*)
18448                         : Remove db from list of libraries to use
18449                         echo "Removing unusable -ldb from library list" >&4
18450                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18451                         shift
18452                         libs="$*"
18453                         echo "libs = $libs" >&4
18454                         ;;
18455                 esac
18456         fi
18457         $rm_try
18458         ;;
18459 esac
18460
18461 case "$i_db" in
18462 define)
18463         : Check the return type needed for hash
18464         echo " "
18465         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18466         $cat >try.c <<EOCP
18467 #$d_const HASCONST
18468 #ifndef HASCONST
18469 #define const
18470 #endif
18471 #include <sys/types.h>
18472 #include <db.h>
18473
18474 #ifndef DB_VERSION_MAJOR
18475 u_int32_t hash_cb (ptr, size)
18476 const void *ptr;
18477 size_t size;
18478 {
18479 }
18480 HASHINFO info;
18481 int main()
18482 {
18483         info.hash = hash_cb;
18484 }
18485 #endif
18486 EOCP
18487         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18488                 if $contains warning try.out >>/dev/null 2>&1 ; then
18489                         db_hashtype='int'
18490                 else
18491                         db_hashtype='u_int32_t'
18492                 fi
18493         else
18494                 : XXX Maybe we should just give up here.
18495                 db_hashtype=u_int32_t
18496                 $cat try.out >&4
18497                 echo "Help:  I can't seem to compile the db test program." >&4
18498                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18499         fi
18500         $rm_try
18501         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18502         ;;
18503 *)      db_hashtype=u_int32_t
18504         ;;
18505 esac
18506 case "$i_db" in
18507 define)
18508         : Check the return type needed for prefix
18509         echo " "
18510         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18511         cat >try.c <<EOCP
18512 #$d_const HASCONST
18513 #ifndef HASCONST
18514 #define const
18515 #endif
18516 #include <sys/types.h>
18517 #include <db.h>
18518
18519 #ifndef DB_VERSION_MAJOR
18520 size_t prefix_cb (key1, key2)
18521 const DBT *key1;
18522 const DBT *key2;
18523 {
18524 }
18525 BTREEINFO info;
18526 int main()
18527 {
18528         info.prefix = prefix_cb;
18529 }
18530 #endif
18531 EOCP
18532         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18533                 if $contains warning try.out >>/dev/null 2>&1 ; then
18534                         db_prefixtype='int'
18535                 else
18536                         db_prefixtype='size_t'
18537                 fi
18538         else
18539                 db_prefixtype='size_t'
18540                 : XXX Maybe we should just give up here.
18541                 $cat try.out >&4
18542                 echo "Help:  I can't seem to compile the db test program." >&4
18543                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18544         fi
18545         $rm_try
18546         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18547         ;;
18548 *)      db_prefixtype='size_t'
18549         ;;
18550 esac
18551
18552 : How can we generate normalized random numbers ?
18553 echo " "
18554 echo "Looking for a random number function..." >&4
18555 case "$randfunc" in
18556 '')
18557         if set drand48 val -f; eval $csym; $val; then
18558                 dflt="drand48"
18559                 echo "Good, found drand48()." >&4
18560         elif set random val -f; eval $csym; $val; then
18561                 dflt="random"
18562                 echo "OK, found random()." >&4
18563         else
18564                 dflt="rand"
18565                 echo "Yick, looks like I have to use rand()." >&4
18566         fi
18567         echo " "
18568         ;;
18569 *)
18570         dflt="$randfunc"
18571         ;;
18572 esac
18573 cont=true
18574
18575 case "$ccflags" in
18576 *-Dmy_rand=*|*-Dmy_srand=*)
18577         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18578         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18579         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18580         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18581         ;;
18582 esac
18583
18584 while $test "$cont"; do
18585         rp="Use which function to generate random numbers?"
18586         . ./myread
18587         if $test "$ans" = "$dflt"; then
18588                 : null
18589         else
18590                 randbits=''
18591         fi
18592         randfunc="$ans"
18593         if set $ans val -f; eval $csym; $val; then
18594                 cont=''
18595         else
18596                 dflt=y
18597                 rp="I cannot find function $ans. Use that name anyway?"
18598                 . ./myread
18599                 dflt=rand
18600                 case "$ans" in
18601                         [yY]*) cont='';;
18602                 esac
18603         fi
18604         case "$cont" in
18605         '')
18606                 case "$randfunc" in
18607                 drand48)
18608                         drand01="drand48()"
18609                         seedfunc="srand48"
18610                         randbits=48
18611                         randseedtype=long
18612                         ;;
18613                 rand|random)
18614                         case "$randbits" in
18615                         '')
18616 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18617                                 $cat >try.c <<EOCP
18618 #$i_unistd I_UNISTD
18619 #$i_stdlib I_STDLIB
18620 #include <stdio.h>
18621 #ifdef I_UNISTD
18622 #  include <unistd.h>
18623 #endif
18624 #ifdef I_STDLIB
18625 #  include <stdlib.h>
18626 #endif
18627 int main()
18628 {
18629         register int i;
18630         register unsigned long tmp;
18631         register unsigned long max = 0L;
18632
18633         for (i = 1000; i; i--) {
18634                 tmp = (unsigned long) $randfunc();
18635                 if (tmp > max) max = tmp;
18636         }
18637         for (i = 0; max; i++)
18638                 max /= 2;
18639         printf("%d\n",i);
18640 }
18641 EOCP
18642                                 set try
18643                                 if eval $compile_ok; then
18644                                         dflt=`try`
18645                                 else
18646                                         dflt='?'
18647                                         echo "(I can't seem to compile the test program...)"
18648                                 fi
18649                                 ;;
18650                         *)
18651                                 dflt="$randbits"
18652                                 ;;
18653                         esac
18654                         rp="How many bits does your $randfunc() function produce?"
18655                         . ./myread
18656                         randbits="$ans"
18657                         $rm_try
18658                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18659                         seedfunc="s$randfunc"
18660                         randseedtype=unsigned
18661                         ;;
18662                 *)
18663                         dflt="31"
18664                         rp="How many bits does your $randfunc() function produce?"
18665                         . ./myread
18666                         randbits="$ans"
18667                         seedfunc="s$randfunc"
18668                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18669                         if set $seedfunc val -f; eval $csym; $val; then
18670                                 echo "(Using $seedfunc() to seed random generator)"
18671                         else
18672                                 echo "(Warning: no $seedfunc() to seed random generator)"
18673                                 seedfunc=rand
18674                         fi
18675                         randseedtype=unsigned
18676                         ;;
18677                 esac
18678                 ;;
18679         esac
18680 done
18681
18682 echo " "
18683 echo "Determining whether or not we are on an EBCDIC system..." >&4
18684 $cat >try.c <<'EOM'
18685 int main()
18686 {
18687   if ('M'==0xd4) return 0;
18688   return 1;
18689 }
18690 EOM
18691
18692 val=$undef
18693 set try
18694 if eval $compile_ok; then
18695         if $run ./try; then
18696                 echo "You seem to speak EBCDIC." >&4
18697                 val="$define"
18698         else
18699                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18700         fi
18701 else
18702         echo "I'm unable to compile the test program." >&4
18703         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18704 fi
18705 $rm_try
18706 set ebcdic
18707 eval $setvar
18708
18709 echo " "
18710 $cat >&4 <<EOM
18711 Checking how to flush all pending stdio output...
18712 EOM
18713 # I only know how to find the first 32 possibly open files on SunOS.
18714 # See also hints/sunos_4_1.sh and util.c  --AD
18715 case "$osname" in
18716 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18717 esac
18718 $cat >>try.c <<EOCP
18719 #include <stdio.h>
18720 #$i_stdlib I_STDLIB
18721 #ifdef I_STDLIB
18722 #include <stdlib.h>
18723 #endif
18724 #$i_unistd I_UNISTD
18725 #ifdef I_UNISTD
18726 # include <unistd.h>
18727 #endif
18728 #$d_sysconf HAS_SYSCONF
18729 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18730 #ifdef HAS_STDIO_STREAM_ARRAY
18731 # define STDIO_STREAM_ARRAY $stdio_stream_array
18732 #endif
18733 int main() {
18734   FILE* p;
18735   unlink("try.out");
18736   p = fopen("try.out", "w");
18737 #ifdef TRY_FPUTC
18738   fputc('x', p);
18739 #else
18740 # ifdef TRY_FPRINTF
18741   fprintf(p, "x");
18742 # endif
18743 #endif
18744 #ifdef TRY_FFLUSH_NULL
18745   fflush(NULL);
18746 #endif
18747 #ifdef TRY_FFLUSH_ALL
18748   {
18749     long open_max = -1;
18750 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18751     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18752 # else
18753 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18754     open_max = sysconf(_SC_OPEN_MAX);
18755 #  else
18756 #   ifdef FOPEN_MAX
18757     open_max = FOPEN_MAX;
18758 #   else
18759 #    ifdef OPEN_MAX
18760     open_max = OPEN_MAX;
18761 #    else
18762 #     ifdef _NFILE
18763     open_max = _NFILE;
18764 #     endif
18765 #    endif
18766 #   endif
18767 #  endif
18768 # endif
18769 # ifdef HAS_STDIO_STREAM_ARRAY
18770     if (open_max > 0) {
18771       long i;
18772       for (i = 0; i < open_max; i++)
18773             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18774                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18775                 STDIO_STREAM_ARRAY[i]._flag)
18776                 fflush(&STDIO_STREAM_ARRAY[i]);
18777     }
18778   }
18779 # endif
18780 #endif
18781   _exit(42);
18782 }
18783 EOCP
18784 : first we have to find out how _not_ to flush
18785 $to try.c
18786 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18787     output=''
18788     set try -DTRY_FPUTC
18789     if eval $compile; then
18790             $run ./try 2>/dev/null
18791             code="$?"
18792             $from try.out
18793             if $test ! -s try.out -a "X$code" = X42; then
18794                 output=-DTRY_FPUTC
18795             fi
18796     fi
18797     case "$output" in
18798     '')
18799             set try -DTRY_FPRINTF
18800             if eval $compile; then
18801                     $run ./try 2>/dev/null
18802                     code="$?"
18803                     $from try.out
18804                     if $test ! -s try.out -a "X$code" = X42; then
18805                         output=-DTRY_FPRINTF
18806                     fi
18807             fi
18808         ;;
18809     esac
18810 fi
18811 : check for fflush NULL behaviour
18812 case "$fflushNULL" in
18813 '')     set try -DTRY_FFLUSH_NULL $output
18814         if eval $compile; then
18815                 $run ./try 2>/dev/null
18816                 code="$?"
18817                 $from try.out
18818                 if $test -s try.out -a "X$code" = X42; then
18819                         fflushNULL="`$cat try.out`"
18820                 else
18821                         if $test "X$code" != X42; then
18822                                 $cat >&4 <<EOM
18823 (If this test failed, don't worry, we'll try another method shortly.)
18824 EOM
18825                         fi
18826                 fi
18827         fi
18828         $rm_try
18829         case "$fflushNULL" in
18830         x)      $cat >&4 <<EOM
18831 Your fflush(NULL) works okay for output streams.
18832 Let's see if it clobbers input pipes...
18833 EOM
18834 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18835 # bug that improperly flushes the input end of pipes.  So we avoid the
18836 # autoflush on fork/system/exec support for now. :-(
18837 $cat >tryp.c <<EOCP
18838 #include <stdio.h>
18839 int
18840 main(int argc, char **argv)
18841 {
18842     char buf[1024];
18843     int i;
18844     char *bp = buf;
18845     while (1) {
18846         while ((i = getc(stdin)) != -1
18847                && (*bp++ = i) != '\n'
18848                && bp < &buf[1024])
18849         /* DO NOTHING */ ;
18850         *bp = '\0';
18851         fprintf(stdout, "%s", buf);
18852         fflush(NULL);
18853         if (i == -1)
18854             return 0;
18855         bp = buf;
18856     }
18857 }
18858 EOCP
18859                 fflushNULL="$define"
18860                 set tryp
18861                 if eval $compile; then
18862                     $rm -f tryp.out
18863                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18864                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18865                        $cat >&4 <<EOM
18866 fflush(NULL) seems to behave okay with input streams.
18867 EOM
18868                         fflushNULL="$define"
18869                     else
18870                         $cat >&4 <<EOM
18871 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18872 EOM
18873                         fflushNULL="$undef"
18874                     fi
18875                 fi
18876                 $rm -f core tryp.c tryp.core core.tryp.*
18877                 ;;
18878         '')     $cat >&4 <<EOM
18879 Your fflush(NULL) isn't working (contrary to ANSI C).
18880 EOM
18881                 fflushNULL="$undef"
18882                 ;;
18883         *)      $cat >&4 <<EOM
18884 Cannot figure out whether your fflush(NULL) works or not.
18885 I'm assuming it doesn't (contrary to ANSI C).
18886 EOM
18887                 fflushNULL="$undef"
18888                 ;;
18889         esac
18890         ;;
18891 $define|true|[yY]*)
18892         fflushNULL="$define"
18893         ;;
18894 *)
18895         fflushNULL="$undef"
18896         ;;
18897 esac
18898 : check explicit looping only if NULL did not work, and if the pipe
18899 : bug does not show up on an explicit flush too
18900 case "$fflushNULL" in
18901 "$undef")
18902         $cat >tryp.c <<EOCP
18903 #include <stdio.h>
18904 int
18905 main(int argc, char **argv)
18906 {
18907     char buf[1024];
18908     int i;
18909     char *bp = buf;
18910     while (1) {
18911         while ((i = getc(stdin)) != -1
18912                && (*bp++ = i) != '\n'
18913                && bp < &buf[1024])
18914         /* DO NOTHING */ ;
18915         *bp = '\0';
18916         fprintf(stdout, "%s", buf);
18917         fflush(stdin);
18918         if (i == -1)
18919             return 0;
18920         bp = buf;
18921     }
18922 }
18923 EOCP
18924         set tryp
18925         if eval $compile; then
18926             $rm -f tryp.out
18927             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18928             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18929                $cat >&4 <<EOM
18930 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18931 EOM
18932                 : now check for fflushall behaviour
18933                 case "$fflushall" in
18934                 '')     set try -DTRY_FFLUSH_ALL $output
18935                         if eval $compile; then
18936                                 $cat >&4 <<EOM
18937 (Now testing the other method--but note that this also may fail.)
18938 EOM
18939                                 $run ./try 2>/dev/null
18940                                 code=$?
18941                                 $from try.out
18942                                 if $test -s try.out -a "X$code" = X42; then
18943                                         fflushall="`$cat try.out`"
18944                                 fi
18945                         fi
18946                         $rm_try
18947                         case "$fflushall" in
18948                         x)      $cat >&4 <<EOM
18949 Whew. Flushing explicitly all the stdio streams works.
18950 EOM
18951                                 fflushall="$define"
18952                                 ;;
18953                         '')     $cat >&4 <<EOM
18954 Sigh. Flushing explicitly all the stdio streams doesn't work.
18955 EOM
18956                                 fflushall="$undef"
18957                                 ;;
18958                         *)      $cat >&4 <<EOM
18959 Cannot figure out whether flushing stdio streams explicitly works or not.
18960 I'm assuming it doesn't.
18961 EOM
18962                                 fflushall="$undef"
18963                                 ;;
18964                         esac
18965                         ;;
18966                 "$define"|true|[yY]*)
18967                         fflushall="$define"
18968                         ;;
18969                 *)
18970                         fflushall="$undef"
18971                         ;;
18972                 esac
18973             else
18974                 $cat >&4 <<EOM
18975 All is futile.  Even fflush(stdin) clobbers input pipes!
18976 EOM
18977                 fflushall="$undef"
18978             fi
18979         else
18980             fflushall="$undef"
18981         fi
18982         $rm -f core tryp.c tryp.core core.tryp.*
18983         ;;
18984 *)      fflushall="$undef"
18985         ;;
18986 esac
18987
18988 case "$fflushNULL$fflushall" in
18989 undefundef)
18990         $cat <<EOM
18991 OK, I give up.  I cannot figure out how to flush pending stdio output.
18992 We won't be flushing handles at all before fork/exec/popen.
18993 EOM
18994         ;;
18995 esac
18996 $rm_try
18997
18998 : Store the full pathname to the ar program for use in the C program
18999 : Respect a hint or command line value for full_ar.
19000 case "$full_ar" in
19001 '') full_ar=$ar ;;
19002 esac
19003
19004 : Store the full pathname to the sed program for use in the C program
19005 full_sed=$sed
19006
19007 : see what type gids are declared as in the kernel
19008 echo " "
19009 echo "Looking for the type for group ids returned by getgid()."
19010 set gid_t gidtype xxx stdio.h sys/types.h
19011 eval $typedef
19012 case "$gidtype" in
19013 xxx)
19014         xxx=`./findhdr sys/user.h`
19015         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19016         case $1 in
19017         unsigned) dflt="$1 $2" ;;
19018         *) dflt="$1" ;;
19019         esac
19020         ;;
19021 *) dflt="$gidtype";;
19022 esac
19023 case "$gidtype" in
19024 gid_t) echo "gid_t found." ;;
19025 *)      rp="What is the type for group ids returned by getgid()?"
19026         . ./myread
19027         gidtype="$ans"
19028         ;;
19029 esac
19030
19031 echo " "
19032 case "$gidtype" in
19033 *_t) zzz="$gidtype"     ;;
19034 *)   zzz="gid"          ;;
19035 esac
19036 echo "Checking the size of $zzz..." >&4 
19037 cat > try.c <<EOCP
19038 #include <sys/types.h>
19039 #include <stdio.h>
19040 #$i_stdlib I_STDLIB
19041 #ifdef I_STDLIB
19042 #include <stdlib.h>
19043 #endif
19044 int main() {
19045     printf("%d\n", (int)sizeof($gidtype));
19046     exit(0);
19047 }
19048 EOCP
19049 set try
19050 if eval $compile_ok; then
19051         yyy=`$run ./try`
19052         case "$yyy" in
19053         '')     gidsize=4
19054                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19055                 ;;
19056         *)      gidsize=$yyy
19057                 echo "Your $zzz is $gidsize bytes long."
19058                 ;;
19059         esac
19060 else
19061         gidsize=4
19062         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19063 fi
19064
19065
19066 echo " "
19067 case "$gidtype" in
19068 *_t) zzz="$gidtype"     ;;
19069 *)   zzz="gid"          ;;
19070 esac
19071 echo "Checking the sign of $zzz..." >&4 
19072 cat > try.c <<EOCP
19073 #include <sys/types.h>
19074 #include <stdio.h>
19075 int main() {
19076         $gidtype foo = -1;
19077         if (foo < 0)
19078                 printf("-1\n");
19079         else
19080                 printf("1\n");
19081 }
19082 EOCP
19083 set try
19084 if eval $compile; then
19085         yyy=`$run ./try`
19086         case "$yyy" in
19087         '')     gidsign=1
19088                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19089                 ;;
19090         *)      gidsign=$yyy
19091                 case "$gidsign" in
19092                  1) echo "Your $zzz is unsigned." ;;
19093                 -1) echo "Your $zzz is signed."   ;;
19094                 esac
19095                 ;;
19096         esac
19097 else
19098         gidsign=1
19099         echo "(I can't compile the test program--guessing unsigned.)" >&4
19100 fi
19101
19102
19103 echo " "
19104
19105 if $test X"$quadtype" != X; then
19106
19107 echo "Checking how to print 64-bit integers..." >&4
19108
19109 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19110         $cat >try.c <<'EOCP'
19111 #include <sys/types.h>
19112 #include <stdio.h>
19113 int main() {
19114   int q = 12345678901;
19115   printf("%ld\n", q);
19116 }
19117 EOCP
19118         set try
19119         if eval $compile; then
19120                 yyy=`$run ./try`
19121                 case "$yyy" in
19122                 12345678901)
19123                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19124                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19125                         echo "We will use %d."
19126                         ;;
19127                 esac
19128         fi
19129 fi
19130
19131 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19132         $cat >try.c <<'EOCP'
19133 #include <sys/types.h>
19134 #include <stdio.h>
19135 int main() {
19136   long q = 12345678901;
19137   printf("%ld\n", q);
19138 }
19139 EOCP
19140         set try
19141         if eval $compile; then
19142                 yyy=`$run ./try`
19143                 case "$yyy" in
19144                 12345678901)
19145                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19146                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19147                         echo "We will use %ld."
19148                         ;;
19149                 esac
19150         fi
19151 fi
19152
19153 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19154         $cat >try.c <<'EOCP'
19155 #include <sys/types.h>
19156 #include <inttypes.h>
19157 #include <stdio.h>
19158 int main() {
19159   int64_t q = 12345678901;
19160   printf("%" PRId64 "\n", q);
19161 }
19162 EOCP
19163         set try
19164         if eval $compile; then
19165                 yyy=`$run ./try`
19166                 case "$yyy" in
19167                 12345678901)
19168                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19169                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19170                         echo "We will use the C9X style."
19171                         ;;
19172                 esac
19173         fi
19174 fi
19175
19176 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19177         $cat >try.c <<EOCP
19178 #include <sys/types.h>
19179 #include <stdio.h>
19180 int main() {
19181   $quadtype q = 12345678901;
19182   printf("%Ld\n", q);
19183 }
19184 EOCP
19185         set try
19186         if eval $compile; then
19187                 yyy=`$run ./try`
19188                 case "$yyy" in
19189                 12345678901)
19190                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19191                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19192                         echo "We will use %Ld."
19193                         ;;
19194                 esac
19195         fi
19196 fi
19197
19198 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19199         $cat >try.c <<'EOCP'
19200 #include <sys/types.h>
19201 #include <stdio.h>
19202 int main() {
19203   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19204   printf("%lld\n", q);
19205 }
19206 EOCP
19207         set try
19208         if eval $compile; then
19209                 yyy=`$run ./try`
19210                 case "$yyy" in
19211                 12345678901)
19212                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19213                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19214                         echo "We will use the %lld style."
19215                         ;;
19216                 esac
19217         fi
19218 fi
19219
19220 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19221         $cat >try.c <<EOCP
19222 #include <sys/types.h>
19223 #include <stdio.h>
19224 int main() {
19225   $quadtype q = 12345678901;
19226   printf("%qd\n", q);
19227 }
19228 EOCP
19229         set try
19230         if eval $compile; then
19231                 yyy=`$run ./try`
19232                 case "$yyy" in
19233                 12345678901)
19234                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19235                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19236                         echo "We will use %qd."
19237                         ;;
19238                 esac
19239         fi
19240 fi
19241
19242 if $test X"$sPRId64" = X; then
19243         echo "Cannot figure out how to print 64-bit integers." >&4
19244 fi
19245 $rm_try
19246
19247 fi
19248
19249 case "$sPRId64" in
19250 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19251         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19252         ;;
19253 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19254         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19255         ;;
19256 esac
19257
19258
19259 echo " "
19260 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19261
19262 if $test X"$ivsize" = X8; then
19263         ivdformat="$sPRId64"
19264         uvuformat="$sPRIu64"
19265         uvoformat="$sPRIo64"
19266         uvxformat="$sPRIx64"
19267         uvXUformat="$sPRIXU64"
19268 else
19269         if $test X"$ivsize" = X"$longsize"; then
19270                 ivdformat='"ld"'
19271                 uvuformat='"lu"'
19272                 uvoformat='"lo"'
19273                 uvxformat='"lx"'
19274                 uvXUformat='"lX"'
19275         else
19276                 if $test X"$ivsize" = X"$intsize"; then
19277                         ivdformat='"d"'
19278                         uvuformat='"u"'
19279                         uvoformat='"o"'
19280                         uvxformat='"x"'
19281                         uvXUformat='"X"'
19282                 else
19283                         : far out
19284                         if $test X"$ivsize" = X"$shortsize"; then
19285                                 ivdformat='"hd"'
19286                                 uvuformat='"hu"'
19287                                 uvoformat='"ho"'
19288                                 uvxformat='"hx"'
19289                                 uvXUformat='"hX"'
19290                         fi
19291                 fi
19292         fi
19293 fi
19294
19295 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19296         nveformat="$sPRIeldbl"
19297         nvfformat="$sPRIfldbl"
19298         nvgformat="$sPRIgldbl"
19299         nvEUformat="$sPRIEUldbl"
19300         nvFUformat="$sPRIFUldbl"
19301         nvGUformat="$sPRIGUldbl"
19302 else
19303         nveformat='"e"'
19304         nvfformat='"f"'
19305         nvgformat='"g"'
19306         nvEUformat='"E"'
19307         nvFUformat='"F"'
19308         nvGUformat='"G"'
19309 fi
19310
19311 case "$ivdformat" in
19312 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19313     exit 1
19314     ;;
19315 esac
19316
19317
19318 echo " "
19319 $echo "Checking the format string to be used for gids..." >&4
19320
19321 case "$gidsign" in
19322 -1)     if $test X"$gidsize" = X"$ivsize"; then
19323                 gidformat="$ivdformat"
19324         else
19325                 if $test X"$gidsize" = X"$longsize"; then
19326                         gidformat='"ld"'
19327                 else
19328                         if $test X"$gidsize" = X"$intsize"; then
19329                                 gidformat='"d"'
19330                         else
19331                                 if $test X"$gidsize" = X"$shortsize"; then
19332                                         gidformat='"hd"'
19333                                 fi
19334                         fi
19335                 fi
19336         fi
19337         ;;
19338 *)      if $test X"$gidsize" = X"$uvsize"; then
19339                 gidformat="$uvuformat"
19340         else
19341                 if $test X"$gidsize" = X"$longsize"; then
19342                         gidformat='"lu"'
19343                 else
19344                         if $test X"$gidsize" = X"$intsize"; then
19345                                 gidformat='"u"'
19346                         else
19347                                 if $test X"$gidsize" = X"$shortsize"; then
19348                                         gidformat='"hu"'
19349                                 fi
19350                         fi
19351                 fi
19352         fi
19353         ;;
19354 esac
19355
19356 : see if getgroups exists
19357 set getgroups d_getgrps
19358 eval $inlibc
19359
19360 : see if setgroups exists
19361 set setgroups d_setgrps
19362 eval $inlibc
19363
19364
19365 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19366 echo " "
19367 case "$d_getgrps$d_setgrps" in
19368 *define*)
19369         case "$groupstype" in
19370         '') dflt="$gidtype" ;;
19371         *)  dflt="$groupstype" ;;
19372         esac
19373         $cat <<EOM
19374 What type of pointer is the second argument to getgroups() and setgroups()?
19375 Usually this is the same as group ids, $gidtype, but not always.
19376
19377 EOM
19378         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19379         . ./myread
19380         groupstype="$ans"
19381         ;;
19382 *)  groupstype="$gidtype";;
19383 esac
19384
19385
19386 if $test $patchlevel -lt 9; then
19387 : MAD is not available in 5.8.x or earlier.
19388     ans=n;
19389 else
19390     case "$mad" in
19391     $define|true|[yY]*) dflt='y' ;;
19392     *)                  dflt='n' ;;
19393     esac
19394     cat <<EOM
19395
19396 Would you like to build with Misc Attribute Decoration? This is development
19397 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19398 overhead on the interpreter.
19399
19400 If this doesn't make any sense to you, just accept the default '$dflt'.
19401 EOM
19402     rp='Build Perl with MAD?'
19403     . ./myread
19404 fi
19405 case "$ans" in
19406 y|Y)    val="$define"
19407         madlyh='madly.h madly.act madly.tab'
19408         madlysrc='madly.c'
19409         madlyobj="madly$_o" ;;
19410 *)      val="$undef"
19411         madlyh=''
19412         madlysrc=''
19413         madlyobj='' ;;
19414 esac
19415 set mad
19416 eval $setvar
19417
19418 echo " "
19419 echo "Checking if your $make program sets \$(MAKE)..." >&4
19420 case "$make_set_make" in
19421 '')
19422         $sed 's/^X //' > testmake.mak << 'EOF'
19423 Xall:
19424 X       @echo 'maketemp="$(MAKE)"'
19425 EOF
19426         case "`$make -f testmake.mak 2>/dev/null`" in
19427         *maketemp=*) make_set_make='#' ;;
19428         *)      make_set_make="MAKE=$make" ;;
19429         esac
19430         $rm -f testmake.mak
19431         ;;
19432 esac
19433 case "$make_set_make" in
19434 '#') echo "Yup, it does.";;
19435 *) echo "Nope, it doesn't.";;
19436 esac
19437
19438 : see what type is used for mode_t
19439 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19440 set mode_t modetype int stdio.h sys/types.h
19441 eval $typedef_ask
19442
19443 : see if we need va_copy
19444 echo " "
19445 case "$i_stdarg" in
19446 "$define")
19447         $cat >try.c <<EOCP
19448 #include <stdarg.h>
19449 #include <stdio.h>
19450 #$i_stdlib I_STDLIB
19451 #ifdef I_STDLIB
19452 #include <stdlib.h>
19453 #endif
19454 #include <signal.h>
19455
19456 int
19457 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19458 {
19459   return vfprintf(f, fmt, *valp);
19460 }
19461
19462 int
19463 myvfprintf(FILE *f, const  char *fmt, va_list val)
19464 {
19465   return ivfprintf(f, fmt, &val);
19466 }
19467
19468 int
19469 myprintf(char *fmt, ...)
19470 {
19471   va_list val;
19472   va_start(val, fmt);
19473   return myvfprintf(stdout, fmt, val);
19474 }
19475
19476 int
19477 main(int ac, char **av)
19478 {
19479   signal(SIGSEGV, exit);
19480
19481   myprintf("%s%cs all right, then\n", "that", '\'');
19482   exit(0);
19483 }
19484 EOCP
19485         set try
19486         if eval $compile && $run ./try 2>&1 >/dev/null; then
19487                 case "`$run ./try`" in
19488                 "that's all right, then")
19489                         okay=yes
19490                         ;;
19491                 esac
19492         fi
19493         case "$okay" in
19494         yes)    echo "It seems that you don't need va_copy()." >&4
19495                 need_va_copy="$undef"
19496                 ;;
19497         *)      echo "It seems that va_copy() or similar will be needed." >&4
19498                 need_va_copy="$define"
19499                 ;;
19500         esac
19501         $rm_try
19502         ;;
19503 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19504         ;;
19505 esac
19506
19507 : see what type is used for size_t
19508 rp="What is the type used for the length parameter for string functions?"
19509 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19510 eval $typedef_ask
19511
19512 : check for type of arguments to gethostbyaddr. 
19513 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19514         case "$d_gethbyaddr" in
19515         $define)
19516                 $cat <<EOM
19517
19518 Checking to see what type of arguments are accepted by gethostbyaddr().
19519 EOM
19520                 hdrs="$define sys/types.h
19521                         $d_socket sys/socket.h 
19522                         $i_niin netinet/in.h 
19523                         $i_netdb netdb.h
19524                         $i_unistd unistd.h"
19525                 : The first arg can 'char *' or 'void *'
19526                 : The second arg is some of integral type
19527                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19528                         for yyy in size_t long int; do
19529                                 case "$netdb_host_type" in
19530                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19531                                         if ./protochk "$try" $hdrs; then
19532                                                 echo "Your system accepts $xxx for the first arg."
19533                                                 echo "...and $yyy for the second arg."
19534                                                 netdb_host_type="$xxx"
19535                                                 netdb_hlen_type="$yyy"
19536                                         fi
19537                                         ;;
19538                                 esac
19539                         done
19540                 done
19541                 : In case none of those worked, prompt the user.
19542                 case "$netdb_host_type" in
19543                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19544                         dflt='char *'
19545                         . ./myread
19546                         netdb_host_type=$ans
19547                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19548                         dflt="$sizetype"
19549                         . ./myread
19550                         netdb_hlen_type=$ans
19551                         ;;
19552                 esac
19553                 ;;
19554         *)      : no gethostbyaddr, so pick harmless defaults
19555                 netdb_host_type='char *'
19556                 netdb_hlen_type="$sizetype"
19557                 ;;
19558         esac
19559         # Remove the "const" if needed. -- but then we'll have a 
19560         # prototype clash!
19561         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19562 fi
19563
19564 : check for type of argument to gethostbyname. 
19565 if test "X$netdb_name_type" = X ; then
19566         case "$d_gethbyname" in
19567         $define)
19568                 $cat <<EOM
19569
19570 Checking to see what type of argument is accepted by gethostbyname().
19571 EOM
19572                 hdrs="$define sys/types.h
19573                         $d_socket sys/socket.h 
19574                         $i_niin netinet/in.h 
19575                         $i_netdb netdb.h
19576                         $i_unistd unistd.h"
19577                 for xxx in "const char *" "char *"; do
19578                         case "$netdb_name_type" in
19579                         '')     try="extern struct hostent *gethostbyname($xxx);"
19580                                 if ./protochk "$try" $hdrs; then
19581                                         echo "Your system accepts $xxx."
19582                                         netdb_name_type="$xxx"
19583                                 fi
19584                                 ;;
19585                         esac
19586                 done
19587                 : In case none of those worked, prompt the user.
19588                 case "$netdb_name_type" in
19589                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19590                         dflt='char *'
19591                         . ./myread
19592                         netdb_name_type=$ans
19593                         ;;
19594                 esac
19595                 ;;
19596         *)      : no gethostbyname, so pick harmless default
19597                 netdb_name_type='char *'
19598                 ;;
19599         esac
19600 fi
19601
19602 : check for type of 1st argument to getnetbyaddr. 
19603 if test "X$netdb_net_type" = X ; then
19604         case "$d_getnbyaddr" in
19605         $define)
19606                 $cat <<EOM
19607
19608 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19609 EOM
19610                 hdrs="$define sys/types.h
19611                         $d_socket sys/socket.h 
19612                         $i_niin netinet/in.h 
19613                         $i_netdb netdb.h
19614                         $i_unistd unistd.h"
19615                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19616                         case "$netdb_net_type" in
19617                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19618                                 if ./protochk "$try" $hdrs; then
19619                                         echo "Your system accepts $xxx."
19620                                         netdb_net_type="$xxx"
19621                                 fi
19622                                 ;;
19623                         esac
19624                 done
19625                 : In case none of those worked, prompt the user.
19626                 case "$netdb_net_type" in
19627                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19628                         dflt='long'
19629                         . ./myread
19630                         netdb_net_type=$ans
19631                         ;;
19632                 esac
19633                 ;;
19634         *)      : no getnetbyaddr, so pick harmless default
19635                 netdb_net_type='long'
19636                 ;;
19637         esac
19638 fi
19639 : locate the preferred pager for this system
19640 fn=f/
19641 case "$pager" in
19642 '')
19643         dflt=''
19644         case "$pg" in
19645         /*) dflt=$pg;;
19646         [a-zA-Z]:/*) dflt=$pg;;
19647         esac
19648         case "$more" in
19649         /*) dflt=$more;;
19650         [a-zA-Z]:/*) dflt=$more;;
19651         esac
19652         case "$less" in
19653         /*) dflt=$less;;
19654         [a-zA-Z]:/*) dflt=$less;;
19655         esac
19656         case "$dflt" in
19657         '') dflt=/usr/ucb/more;;
19658         esac
19659         ;;
19660 *)      dflt="$pager"
19661         : Instruct ./getfile to trust the hinted or previous pager value,
19662         : even if it does not begin with a slash.  For example, on os2,
19663         : pager might be cmd /c more.  See comments in UU/getfile.
19664         fn="f/($pager)"
19665         ;;
19666 esac
19667 echo " "
19668 rp='What pager is used on your system?'
19669 . ./getfile
19670 pager="$ans"
19671
19672 : see what type pids are declared as in the kernel
19673 rp="What is the type of process ids on this system?"
19674 set pid_t pidtype int stdio.h sys/types.h
19675 eval $typedef_ask
19676
19677 : see if ar generates random libraries by itself
19678 echo " "
19679 echo "Checking how to generate random libraries on your machine..." >&4
19680 echo 'int bar1() { return bar2(); }' > bar1.c
19681 echo 'int bar2() { return 2; }' > bar2.c
19682 $cat > foo.c <<EOP
19683 #$i_stdlib I_STDLIB
19684 #ifdef I_STDLIB
19685 #include <stdlib.h>
19686 #endif
19687 int main() { printf("%d\n", bar1()); exit(0); }
19688 EOP
19689 $cc $ccflags -c bar1.c >/dev/null 2>&1
19690 $cc $ccflags -c bar2.c >/dev/null 2>&1
19691 $cc $ccflags -c foo.c >/dev/null 2>&1
19692 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19693 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19694         $run ./foobar >/dev/null 2>&1; then
19695         echo "$ar appears to generate random libraries itself."
19696         orderlib=false
19697         if [ "X$ranlib" = "X" ]; then
19698             ranlib=":"
19699         fi
19700 elif $ar s bar$_a >/dev/null 2>&1 &&
19701         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19702         $run ./foobar >/dev/null 2>&1; then
19703                 echo "a table of contents needs to be added with '$ar s'."
19704                 orderlib=false
19705                 ranlib="$ar s"
19706 elif $ar ts bar$_a >/dev/null 2>&1 &&
19707         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19708         $run ./foobar >/dev/null 2>&1; then
19709                 echo "a table of contents needs to be added with '$ar ts'."
19710                 orderlib=false
19711                 ranlib="$ar ts"
19712 else
19713         case "$ranlib" in
19714         :) ranlib='';;
19715         '')
19716                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19717                 $test -f $ranlib || ranlib=''
19718                 ;;
19719         esac
19720         if $test -n "$ranlib"; then
19721                 echo "your system has '$ranlib'; we'll use that."
19722                 orderlib=false
19723         else
19724                 echo "your system doesn't seem to support random libraries"
19725                 echo "so we'll use lorder and tsort to order the libraries."
19726                 orderlib=true
19727                 ranlib=":"
19728         fi
19729 fi
19730 $rm -f foo* bar*
19731
19732 : check for type of arguments to select. 
19733 case "$selecttype" in
19734 '') case "$d_select" in
19735         $define)
19736                 echo " "
19737                 $cat <<EOM
19738 Checking to see what type of arguments are accepted by select().
19739 EOM
19740                 hdrs="$define sys/types.h
19741                         $i_systime sys/time.h 
19742                         $i_sysselct sys/select.h
19743                         $d_socket sys/socket.h"
19744                 : The first arg can be int, unsigned, or size_t
19745                 : The last arg may or may not be 'const'
19746                 val=''
19747                 : void pointer has been seen but using that
19748                 : breaks the selectminbits test
19749                 for xxx in 'fd_set *' 'int *'; do
19750                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19751                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19752                                         case "$val" in
19753                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19754                                                 if ./protochk "$try" $hdrs; then
19755                                                         echo "Your system accepts $xxx."
19756                                                         val="$xxx"
19757                                                 fi
19758                                                 ;;
19759                                         esac
19760                                 done
19761                         done
19762                 done
19763                 case "$val" in
19764                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19765                         case "$d_fd_set" in
19766                                 $define) dflt="fd_set *" ;;
19767                                 *)              dflt="int *" ;;
19768                         esac
19769                         . ./myread
19770                         val=$ans
19771                         ;;
19772                 esac
19773                 selecttype="$val"
19774                 ;;
19775         *)      : no select, so pick a harmless default
19776                 selecttype='int *'
19777                 ;;
19778         esac
19779         ;;
19780 esac
19781
19782 : check for the select 'width'
19783 case "$selectminbits" in
19784 '') safebits=`expr $ptrsize \* 8`
19785     case "$d_select" in
19786         $define)
19787                 $cat <<EOM
19788
19789 Checking to see on how many bits at a time your select() operates...
19790 EOM
19791                 $cat >try.c <<EOCP
19792 #include <sys/types.h>
19793 #$i_time I_TIME
19794 #$i_systime I_SYS_TIME
19795 #$i_systimek I_SYS_TIME_KERNEL
19796 #ifdef I_TIME
19797 #   include <time.h>
19798 #endif
19799 #ifdef I_SYS_TIME
19800 #   ifdef I_SYS_TIME_KERNEL
19801 #       define KERNEL
19802 #   endif
19803 #   include <sys/time.h>
19804 #   ifdef I_SYS_TIME_KERNEL
19805 #       undef KERNEL
19806 #   endif
19807 #endif
19808 #$i_sysselct I_SYS_SELECT
19809 #ifdef I_SYS_SELECT
19810 #include <sys/select.h>
19811 #endif
19812 #$d_socket HAS_SOCKET
19813 #ifdef HAS_SOCKET
19814 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19815 #endif
19816 #include <stdio.h>
19817 #$i_stdlib I_STDLIB
19818 #ifdef I_STDLIB
19819 #include <stdlib.h>
19820 #endif
19821 $selecttype b;
19822 #define S sizeof(*(b))
19823 #define MINBITS 64
19824 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19825 #define NBITS  (NBYTES * 8)
19826 int main() {
19827     char *s = (char *)malloc(NBYTES);
19828     struct timeval t;
19829     int i;
19830     FILE* fp;
19831     int fd;
19832
19833     if (!s)
19834         exit(1);
19835     fclose(stdin);
19836     fp = fopen("try.c", "r");
19837     if (fp == 0)
19838       exit(2);
19839     fd = fileno(fp);
19840     if (fd < 0)
19841       exit(3);
19842     b = ($selecttype)s;
19843     for (i = 0; i < NBITS; i++)
19844         FD_SET(i, b);
19845     t.tv_sec  = 0;
19846     t.tv_usec = 0;
19847     select(fd + 1, b, 0, 0, &t);
19848     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19849     free(s);
19850     printf("%d\n", i + 1);
19851     return 0;
19852 }
19853 EOCP
19854                 set try
19855                 if eval $compile_ok; then
19856                         selectminbits=`$run ./try`
19857                         case "$selectminbits" in
19858                         '')     cat >&4 <<EOM
19859 Cannot figure out on how many bits at a time your select() operates.
19860 I'll play safe and guess it is $safebits bits.
19861 EOM
19862                                 selectminbits=$safebits
19863                                 bits="$safebits bits"
19864                                 ;;
19865                         1)      bits="1 bit" ;;
19866                         *)      bits="$selectminbits bits" ;;
19867                         esac
19868                         echo "Your select() operates on $bits at a time." >&4
19869                 else
19870                         rp='What is the minimum number of bits your select() operates on?'
19871                         case "$byteorder" in
19872                         12345678)       dflt=64 ;;
19873                         1234)           dflt=32 ;;
19874                         *)              dflt=1  ;;
19875                         esac
19876                         . ./myread
19877                         val=$ans
19878                         selectminbits="$val"
19879                 fi
19880                 $rm_try
19881                 ;;
19882         *)      : no select, so pick a harmless default
19883                 selectminbits=$safebits
19884                 ;;
19885         esac
19886         ;;
19887 esac
19888
19889 : Trace out the files included by signal.h, then look for SIGxxx names.
19890 : Remove SIGARRAYSIZE used by HPUX.
19891 : Remove SIGSTKSIZE used by Linux.
19892 : Remove SIGSTKSZ used by Posix.
19893 : Remove SIGTYP void lines used by OS2.
19894 : Some cpps, like os390, dont give the file name anywhere
19895 if [ "X$fieldn" = X ]; then
19896         : Just make some guesses.  We check them later.
19897         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19898 else
19899         xxx=`echo '#include <signal.h>' |
19900         $cppstdin $cppminus $cppflags 2>/dev/null |
19901         $grep '^[       ]*#.*include' | 
19902         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19903 fi
19904 : Check this list of files to be sure we have parsed the cpp output ok.
19905 : This will also avoid potentially non-existent files, such 
19906 : as ../foo/bar.h
19907 xxxfiles=''
19908 for xx in $xxx /dev/null ; do
19909         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19910 done
19911 : If we have found no files, at least try signal.h
19912 case "$xxxfiles" in
19913 '')     xxxfiles=`./findhdr signal.h` ;;
19914 esac
19915 xxx=`awk '
19916 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19917         print substr($2, 4, 20)
19918 }
19919 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19920         print substr($3, 4, 20)
19921 }' $xxxfiles`
19922 : Append some common names just in case the awk scan failed.
19923 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19924 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19925 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19926 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19927 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19928
19929 : generate a few handy files for later
19930 $cat > signal.c <<EOCP
19931 #include <sys/types.h>
19932 #include <signal.h>
19933 #$i_stdlib I_STDLIB
19934 #ifdef I_STDLIB
19935 #include <stdlib.h>
19936 #endif
19937 #include <stdio.h>
19938 int main() {
19939
19940 /* Strange style to avoid deeply-nested #if/#else/#endif */
19941 #ifndef NSIG
19942 #  ifdef _NSIG
19943 #    define NSIG (_NSIG)
19944 #  endif
19945 #endif
19946
19947 #ifndef NSIG
19948 #  ifdef SIGMAX
19949 #    define NSIG (SIGMAX+1)
19950 #  endif
19951 #endif
19952
19953 #ifndef NSIG
19954 #  ifdef SIG_MAX
19955 #    define NSIG (SIG_MAX+1)
19956 #  endif
19957 #endif
19958
19959 #ifndef NSIG
19960 #  ifdef _SIG_MAX
19961 #    define NSIG (_SIG_MAX+1)
19962 #  endif
19963 #endif
19964
19965 #ifndef NSIG
19966 #  ifdef MAXSIG
19967 #    define NSIG (MAXSIG+1)
19968 #  endif
19969 #endif
19970
19971 #ifndef NSIG
19972 #  ifdef MAX_SIG
19973 #    define NSIG (MAX_SIG+1)
19974 #  endif
19975 #endif
19976
19977 #ifndef NSIG
19978 #  ifdef SIGARRAYSIZE
19979 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19980 #  endif
19981 #endif
19982
19983 #ifndef NSIG
19984 #  ifdef _sys_nsig
19985 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19986 #  endif
19987 #endif
19988
19989 /* Default to some arbitrary number that's big enough to get most
19990    of the common signals.
19991 */
19992 #ifndef NSIG
19993 #    define NSIG 50
19994 #endif
19995
19996 printf("NSIG %d\n", NSIG);
19997
19998 #ifndef JUST_NSIG
19999
20000 EOCP
20001
20002 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20003 {
20004         printf "#ifdef SIG"; printf $1; printf "\n"
20005         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20006         printf $1; printf ");\n"
20007         printf "#endif\n"
20008 }
20009 END {
20010         printf "#endif /* JUST_NSIG */\n";
20011         printf "exit(0);\n}\n";
20012 }
20013 ' >>signal.c
20014 $cat >signal.awk <<'EOP'
20015 BEGIN { ndups = 0 }
20016 $1 ~ /^NSIG$/ { nsig = $2 }
20017 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20018     if ($2 > maxsig) { maxsig = $2 }
20019     if (sig_name[$2]) {
20020         dup_name[ndups] = $1
20021         dup_num[ndups] = $2
20022         ndups++ 
20023     }
20024     else {
20025         sig_name[$2] = $1
20026         sig_num[$2] = $2
20027     }
20028 }
20029 END { 
20030     if (nsig == 0) {
20031         nsig = maxsig + 1
20032     }
20033     printf("NSIG %d\n", nsig);
20034     for (n = 1; n < nsig; n++) {
20035         if (sig_name[n]) {
20036             printf("%s %d\n", sig_name[n], sig_num[n])
20037         }
20038         else {
20039             printf("NUM%d %d\n", n, n) 
20040         }
20041     }
20042     for (n = 0; n < ndups; n++) {
20043         printf("%s %d\n", dup_name[n], dup_num[n])
20044     }
20045 }
20046 EOP
20047 $cat >signal_cmd <<EOS
20048 $startsh
20049 if $test -s signal.lst; then
20050     echo "Using your existing signal.lst file"
20051         exit 0
20052 fi
20053 xxx="$xxx"
20054 EOS
20055 $cat >>signal_cmd <<'EOS'
20056
20057 set signal
20058 if eval $compile_ok; then
20059         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20060 else
20061         echo "(I can't seem be able to compile the whole test program)" >&4
20062         echo "(I'll try it in little pieces.)" >&4
20063         set signal -DJUST_NSIG
20064         if eval $compile_ok; then
20065                 $run ./signal$_exe > signal.nsg
20066                 $cat signal.nsg
20067         else
20068                 echo "I can't seem to figure out how many signals you have." >&4
20069                 echo "Guessing 50." >&4
20070                 echo 'NSIG 50' > signal.nsg
20071         fi
20072         : Now look at all the signal names, one at a time.
20073         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20074                 $cat > signal.c <<EOCP
20075 #include <sys/types.h>
20076 #include <signal.h>
20077 #include <stdio.h>
20078 int main() {
20079 printf("$xx %d\n", SIG${xx});
20080 return 0;
20081 }
20082 EOCP
20083                 set signal
20084                 if eval $compile; then
20085                         echo "SIG${xx} found."
20086                         $run ./signal$_exe  >> signal.ls1
20087                 else
20088                         echo "SIG${xx} NOT found."
20089                 fi
20090         done
20091         if $test -s signal.ls1; then
20092                 $cat signal.nsg signal.ls1 |
20093                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20094         fi
20095
20096 fi
20097 if $test -s signal.lst; then
20098         :
20099 else
20100         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20101         echo 'kill -l' >signal
20102         set X `csh -f <signal`
20103         $rm -f signal
20104         shift
20105         case $# in
20106         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20107         esac
20108         echo $@ | $tr ' ' $trnl | \
20109             $awk '{ printf "%s %d\n", $1, ++s; }
20110                   END { printf "NSIG %d\n", ++s }' >signal.lst
20111 fi
20112 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20113 EOS
20114 chmod a+x signal_cmd
20115 $eunicefix signal_cmd
20116
20117 : generate list of signal names
20118 echo " "
20119 case "$sig_name_init" in
20120 '') doinit=yes ;;
20121 *)  case "$sig_num_init" in
20122     ''|*,*) doinit=yes ;;
20123     esac ;;
20124 esac
20125 case "$doinit" in
20126 yes)
20127         echo "Generating a list of signal names and numbers..." >&4
20128         . ./signal_cmd
20129         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20130         sig_name=`$awk 'BEGIN { printf "ZERO " }
20131                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20132         sig_num=`$awk  'BEGIN { printf "0 " }
20133                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20134         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20135                              !/^NSIG/   { printf "\"%s\", ", $1 }
20136                              END        { printf "0\n" }' signal.lst`
20137         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20138                              !/^NSIG/   { printf "%d, ", $2}
20139                              END        { printf "0\n"}' signal.lst`
20140         ;;
20141 esac
20142 echo "The following $sig_count signals are available:"
20143 echo " "
20144 echo $sig_name | $awk \
20145 'BEGIN { linelen = 0 }
20146 {
20147         for (i = 1; i <= NF; i++) {
20148                 name = "SIG" $i " "
20149                 linelen = linelen + length(name)
20150                 if (linelen > 70) {
20151                         printf "\n"
20152                         linelen = length(name)
20153                 }
20154                 printf "%s", name
20155         }
20156         printf "\n"
20157 }'
20158 sig_size=`echo $sig_name | awk '{print NF}'`
20159 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20160
20161 echo " "
20162 case "$sizetype" in
20163 *_t) zzz="$sizetype"    ;;
20164 *)   zzz="filesize"     ;;
20165 esac
20166 echo "Checking the size of $zzz..." >&4 
20167 cat > try.c <<EOCP
20168 #include <sys/types.h>
20169 #include <stdio.h>
20170 #$i_stdlib I_STDLIB
20171 #ifdef I_STDLIB
20172 #include <stdlib.h>
20173 #endif
20174 int main() {
20175     printf("%d\n", (int)sizeof($sizetype));
20176     exit(0);
20177 }
20178 EOCP
20179 set try
20180 if eval $compile_ok; then
20181         yyy=`$run ./try`
20182         case "$yyy" in
20183         '')     sizesize=4
20184                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20185                 ;;
20186         *)      sizesize=$yyy
20187                 echo "Your $zzz size is $sizesize bytes."
20188                 ;;
20189         esac
20190 else
20191         sizesize=4
20192         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20193 fi
20194
20195
20196 : check for socklen_t
20197 echo " "
20198 echo "Checking to see if you have socklen_t..." >&4
20199 $cat >try.c <<EOCP
20200 #include <sys/types.h>
20201 #$d_socket HAS_SOCKET
20202 #ifdef HAS_SOCKET
20203 #include <sys/socket.h>
20204 #endif
20205 int main() { socklen_t x = 16; }
20206 EOCP
20207 set try
20208 if eval $compile; then
20209         val="$define"
20210         echo "You have socklen_t."
20211 else
20212         val="$undef"
20213         echo "You do not have socklen_t."
20214         case "$sizetype" in
20215         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20216         esac
20217 fi
20218 $rm_try
20219 set d_socklen_t
20220 eval $setvar
20221
20222 : see if this is a socks.h system
20223 set socks.h i_socks
20224 eval $inhdr
20225
20226 : check for type of the size argument to socket calls
20227 case "$d_socket" in
20228 "$define")
20229         $cat <<EOM
20230
20231 Checking to see what type is the last argument of accept().
20232 EOM
20233         yyy=''
20234         case "$d_socklen_t" in
20235         "$define") yyy="$yyy socklen_t"
20236         esac
20237         yyy="$yyy $sizetype int long unsigned"
20238         for xxx in $yyy; do
20239                 case "$socksizetype" in
20240                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20241                         case "$usesocks" in
20242                         "$define")
20243                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20244                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20245                                         socksizetype="$xxx"
20246                                 fi
20247                                 ;;
20248                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20249                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20250                                         socksizetype="$xxx"
20251                                 fi
20252                                 ;;
20253                         esac
20254                         ;;
20255                 esac
20256         done
20257 : In case none of those worked, prompt the user.
20258         case "$socksizetype" in
20259         '')     rp='What is the type for socket address structure sizes?'
20260                 dflt='int'
20261                 . ./myread
20262                 socksizetype=$ans
20263                 ;;
20264         esac
20265         ;;
20266 *)      : no sockets, so pick relatively harmless default
20267         socksizetype='int'
20268         ;;
20269 esac
20270
20271 : see what type is used for signed size_t
20272 set ssize_t ssizetype int stdio.h sys/types.h
20273 eval $typedef
20274 dflt="$ssizetype"
20275 $cat > try.c <<EOM
20276 #include <stdio.h>
20277 #$i_stdlib I_STDLIB
20278 #ifdef I_STDLIB
20279 #include <stdlib.h>
20280 #endif
20281 #include <sys/types.h>
20282 #define Size_t $sizetype
20283 #define SSize_t $dflt
20284 int main()
20285 {
20286         if (sizeof(Size_t) == sizeof(SSize_t))
20287                 printf("$dflt\n");
20288         else if (sizeof(Size_t) == sizeof(int))
20289                 printf("int\n");
20290         else
20291                 printf("long\n");
20292         exit(0);
20293 }
20294 EOM
20295 echo " "
20296 set try
20297 if eval $compile_ok && $run ./try > /dev/null; then
20298         ssizetype=`$run ./try`
20299         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20300 else
20301         $cat >&4 <<EOM
20302 Help! I can't compile and run the ssize_t test program: please enlighten me!
20303 (This is probably a misconfiguration in your system or libraries, and
20304 you really ought to fix it.  Still, I'll try anyway.)
20305
20306 I need a type that is the same size as $sizetype, but is guaranteed to
20307 be signed.  Common values are ssize_t, int and long.
20308
20309 EOM
20310         rp="What signed type is the same size as $sizetype?"
20311         . ./myread
20312         ssizetype="$ans"
20313 fi
20314 $rm_try
20315
20316 : see what type of char stdio uses.
20317 echo " "
20318 echo '#include <stdio.h>' > stdio.c
20319 $cppstdin $cppminus < stdio.c > stdioh
20320 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20321         echo "Your stdio uses unsigned chars." >&4
20322         stdchar="unsigned char"
20323 else
20324         echo "Your stdio uses signed chars." >&4
20325         stdchar="char"
20326 fi
20327 $rm -f stdio.* stdioh
20328
20329 : see what type uids are declared as in the kernel
20330 echo " "
20331 echo "Looking for the type for user ids returned by getuid()."
20332 set uid_t uidtype xxx stdio.h sys/types.h
20333 eval $typedef
20334 case "$uidtype" in
20335 xxx)
20336         xxx=`./findhdr sys/user.h`
20337         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20338         case $1 in
20339         unsigned) dflt="$1 $2" ;;
20340         *) dflt="$1" ;;
20341         esac
20342         ;;
20343 *) dflt="$uidtype";;
20344 esac
20345 case "$uidtype" in
20346 uid_t)  echo "uid_t found." ;;
20347 *)      rp="What is the type for user ids returned by getuid()?"
20348         . ./myread
20349         uidtype="$ans"
20350         ;;
20351 esac
20352
20353 echo " "
20354 case "$uidtype" in
20355 *_t) zzz="$uidtype"     ;;
20356 *)   zzz="uid"          ;;
20357 esac
20358 echo "Checking the size of $zzz..." >&4 
20359 cat > try.c <<EOCP
20360 #include <sys/types.h>
20361 #include <stdio.h>
20362 #$i_stdlib I_STDLIB
20363 #ifdef I_STDLIB
20364 #include <stdlib.h>
20365 #endif
20366 int main() {
20367     printf("%d\n", (int)sizeof($uidtype));
20368     exit(0);
20369 }
20370 EOCP
20371 set try
20372 if eval $compile_ok; then
20373         yyy=`$run ./try`
20374         case "$yyy" in
20375         '')     uidsize=4
20376                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20377                 ;;
20378         *)      uidsize=$yyy
20379                 echo "Your $zzz is $uidsize bytes long."
20380                 ;;
20381         esac
20382 else
20383         uidsize=4
20384         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20385 fi
20386
20387 echo " "
20388 case "$uidtype" in
20389 *_t) zzz="$uidtype"     ;;
20390 *)   zzz="uid"          ;;
20391 esac
20392 echo "Checking the sign of $zzz..." >&4
20393 cat > try.c <<EOCP
20394 #include <sys/types.h>
20395 #include <stdio.h>
20396 int main() {
20397         $uidtype foo = -1;
20398         if (foo < 0)
20399                 printf("-1\n");
20400         else
20401                 printf("1\n");
20402 }
20403 EOCP
20404 set try
20405 if eval $compile; then
20406         yyy=`$run ./try`
20407         case "$yyy" in
20408         '')     uidsign=1
20409                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20410                 ;;
20411         *)      uidsign=$yyy
20412                 case "$uidsign" in
20413                  1) echo "Your $zzz is unsigned." ;;
20414                 -1) echo "Your $zzz is signed."   ;;
20415                 esac
20416                 ;;
20417         esac
20418 else
20419         uidsign=1
20420         echo "(I can't compile the test program--guessing unsigned.)" >&4
20421 fi
20422
20423
20424
20425 echo " "
20426 $echo "Checking the format string to be used for uids..." >&4
20427
20428 case "$uidsign" in
20429 -1)     if $test X"$uidsize" = X"$ivsize"; then
20430                 uidformat="$ivdformat"
20431         else
20432                 if $test X"$uidsize" = X"$longsize"; then
20433                         uidformat='"ld"'
20434                 else
20435                         if $test X"$uidsize" = X"$intsize"; then
20436                                 uidformat='"d"'
20437                         else
20438                                 if $test X"$uidsize" = X"$shortsize"; then
20439                                         uidformat='"hd"'
20440                                 fi
20441                         fi
20442                 fi
20443         fi
20444         ;;
20445 *)      if $test X"$uidsize" = X"$uvsize"; then
20446                 uidformat="$uvuformat"
20447         else
20448                 if $test X"$uidsize" = X"$longsize"; then
20449                         uidformat='"lu"'
20450                 else
20451                         if $test X"$uidsize" = X"$intsize"; then
20452                                 uidformat='"u"'
20453                         else
20454                                 if $test X"$uidsize" = X"$shortsize"; then
20455                                         uidformat='"hu"'
20456                                 fi
20457                         fi
20458                 fi
20459         fi
20460         ;;
20461 esac
20462
20463
20464 case "$usesitecustomize" in
20465     $define|true|[Yy]*)
20466         usesitecustomize="$define"
20467         ;;
20468     *)
20469         usesitecustomize="$undef"
20470         ;;
20471     esac
20472
20473 : determine compiler compiler
20474 case "$yacc" in
20475 '')
20476         dflt=yacc;;
20477 *)
20478         dflt="$yacc";;
20479 esac
20480 echo " "
20481 comp='yacc'
20482 if $test -f "$byacc$_exe"; then
20483         dflt="$byacc"
20484         comp="byacc or $comp"
20485 fi
20486 if $test -f "$bison$_exe"; then
20487         comp="$comp or bison -y"
20488 fi
20489 rp="Which compiler compiler ($comp) shall I use?"
20490 . ./myread
20491 yacc="$ans"
20492 case "$yacc" in
20493 *bis*)
20494         case "$yacc" in
20495         *-y*) ;;
20496         *)
20497                 yacc="$yacc -y"
20498                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20499                 ;;
20500         esac
20501         ;;
20502 esac
20503
20504 : see if this is a fp.h system
20505 set fp.h i_fp
20506 eval $inhdr
20507
20508 : see if this is a fp_class.h system
20509 set fp_class.h i_fp_class
20510 eval $inhdr
20511
20512 : see if gdbm.h is available
20513 set gdbm.h t_gdbm
20514 eval $inhdr
20515 case "$t_gdbm" in
20516 $define)
20517         : see if gdbm_open exists
20518         set gdbm_open d_gdbm_open
20519         eval $inlibc
20520         case "$d_gdbm_open" in
20521         $undef)
20522                 t_gdbm="$undef"
20523                 echo "We won't be including <gdbm.h>"
20524                 ;;
20525         esac
20526         ;;
20527 esac
20528 val="$t_gdbm"
20529 set i_gdbm
20530 eval $setvar
20531
20532 : see if this is a ieeefp.h system
20533 case "$i_ieeefp" in
20534 '' ) set ieeefp.h i_ieeefp
20535      eval $inhdr
20536      ;;
20537 esac
20538
20539 : see if this is a libutil.h system
20540 set libutil.h i_libutil
20541 eval $inhdr
20542
20543 : see if mach cthreads are available
20544 if test "X$usethreads" = "X$define"; then
20545         set mach/cthreads.h i_machcthr
20546         eval $inhdr
20547 else
20548         i_machcthr="$undef"
20549 fi
20550
20551
20552
20553 : see if this is a mntent.h system
20554 set mntent.h i_mntent
20555 eval $inhdr
20556
20557 : see if ndbm.h is available
20558 set ndbm.h t_ndbm
20559 eval $inhdr
20560
20561 case "$t_ndbm" in
20562 $undef)
20563     # Some Linux distributions such as RedHat 7.1 put the
20564     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20565     if $test -f /usr/include/gdbm/ndbm.h; then
20566         echo '<gdbm/ndbm.h> found.'
20567         ccflags="$ccflags -I/usr/include/gdbm"
20568         cppflags="$cppflags -I/usr/include/gdbm"
20569         t_ndbm=$define
20570     fi
20571     ;;
20572 esac
20573
20574 case "$t_ndbm" in
20575 $define)
20576         : see if dbm_open exists
20577         set dbm_open d_dbm_open
20578         eval $inlibc
20579         case "$d_dbm_open" in
20580         $undef)
20581                 t_ndbm="$undef"
20582                 echo "We won't be including <ndbm.h>"
20583                 ;;
20584         esac
20585         ;;
20586 esac
20587 val="$t_ndbm"
20588 set i_ndbm
20589 eval $setvar
20590
20591 : see if net/errno.h is available
20592 val=''
20593 set net/errno.h val
20594 eval $inhdr
20595
20596 : Unfortunately, it causes problems on some systems.  Arrgh.
20597 case "$val" in
20598 $define)
20599         cat > try.c <<'EOM'
20600 #include <stdio.h>
20601 #include <errno.h>
20602 #include <net/errno.h>
20603 int func()
20604 {
20605         return ENOTSOCK;
20606 }
20607 EOM
20608         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20609                 echo "We'll be including <net/errno.h>." >&4
20610         else
20611                 echo "We won't be including <net/errno.h>." >&4
20612                 val="$undef"
20613         fi
20614         $rm_try
20615         ;;
20616 esac
20617 set i_neterrno
20618 eval $setvar
20619
20620 : see if netinet/tcp.h is available
20621 set netinet/tcp.h i_netinettcp
20622 eval $inhdr
20623
20624 : see if this is a poll.h system
20625 set poll.h i_poll
20626 eval $inhdr
20627
20628 : see if this is a prot.h system
20629 set prot.h i_prot
20630 eval $inhdr
20631
20632 echo " "
20633 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20634 $cat <<'EOSH' > Cppsym.know
20635 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20636 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20637 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20638 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20639 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20640 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20641 bull c cadmus clipper CMU COFF COMPILER_VERSION
20642 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20643 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20644 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20645 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20646 GLIBC GLIBC_MINOR
20647 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20648 H3050R H3050RX hbullx20 hcx host_mips
20649 hp200 hp300 hp700 HP700 hp800 hp9000
20650 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20651 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20652 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20653 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20654 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20655 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20656 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20657 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20658 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20659 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20660 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20661 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20662 MATH_HAS_NO_SIDE_EFFECTS
20663 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20664 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20665 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20666 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20667 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20668 NetBSD news1500 news1700 news1800 news1900 news3700
20669 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20670 ns32016 ns32332 ns32k nsc32000
20671 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20672 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20673 pc532 pdp11 PGC PIC plexus PORTAR posix
20674 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20675 POSIX_C_SOURCE POSIX_SOURCE POWER
20676 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20677 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20678 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20679 sony sony_news sonyrisc sparc sparclite spectrum
20680 stardent stdc STDC_EXT stratos sun sun3 sun386
20681 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20682 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20683 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20684 sysV68 sysV88 Tek4132 Tek4300 titan
20685 TM3200 TM5400 TM5600
20686 tower tower32 tower32_200 tower32_600 tower32_700
20687 tower32_800 tower32_850 tss
20688 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20689 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20690 unix UNIX95 UNIX99 unixpc unos
20691 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20692 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20693 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20694 USGr4 USGr4_2
20695 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20696 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20697 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20698 z8000
20699 EOSH
20700 # Maybe put other stuff here too.
20701 cat <<EOSH >>Cppsym.know
20702 $osname
20703 EOSH
20704 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20705 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20706 $cat Cppsym.know > Cppsym.c
20707 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20708 $rm -f Cppsym.a Cppsym.b Cppsym.c
20709 cat <<EOSH > Cppsym
20710 $startsh
20711 if $test \$# -gt 0; then
20712     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20713     if $test -s Cppsym.got; then
20714         $rm -f Cppsym.got
20715         exit 0
20716     fi
20717     $rm -f Cppsym.got
20718     exit 1
20719 else
20720     $tr " " "$trnl" | ./Cppsym.try
20721     exit 0
20722 fi
20723 EOSH
20724 chmod +x Cppsym
20725 $eunicefix Cppsym
20726 cat <<EOSH > Cppsym.try
20727 $startsh
20728 cat <<'EOCP' > try.c
20729 #include <stdio.h>
20730 #if cpp_stuff == 1
20731 #define STRINGIFY(a)    "a"
20732 #endif
20733 #if cpp_stuff == 42
20734 #define StGiFy(a)  #a
20735 #define STRINGIFY(a)    StGiFy(a)
20736 #endif
20737 #if $cpp_stuff != 1 && $cpp_stuff != 42
20738 #   include "Bletch: How does this C preprocessor stringify macros?"
20739 #endif
20740 int main() {
20741 EOCP
20742 $awk \\
20743 EOSH
20744 cat <<'EOSH' >> Cppsym.try
20745 'length($1) > 0 {
20746     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20747     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20748     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20749     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20750 }'       >> try.c
20751 echo 'return 0;}' >> try.c
20752 EOSH
20753 cat <<EOSH >> Cppsym.try
20754 ccflags="$ccflags"
20755 case "$osname-$gccversion" in
20756 irix-) ccflags="\$ccflags -woff 1178" ;;
20757 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20758 esac
20759 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20760 EOSH
20761 chmod +x Cppsym.try
20762 $eunicefix Cppsym.try
20763 ./Cppsym < Cppsym.know > Cppsym.true
20764 : Add in any linux cpp "predefined macros":
20765 case "$osname::$gccversion" in
20766   *linux*::*.*)
20767     tHdrH=_tmpHdr
20768     rm -f $tHdrH'.h' $tHdrH
20769     touch $tHdrH'.h'
20770     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20771        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20772        if [ -s $tHdrH'_cppsym.real' ]; then
20773           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20774        fi
20775     fi
20776     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20777   ;;
20778 esac
20779 : now check the C compiler for additional symbols
20780 postprocess_cc_v=''
20781 case "$osname" in
20782 aix) postprocess_cc_v="|$tr , ' '" ;;
20783 esac
20784 $cat >ccsym <<EOS
20785 $startsh
20786 $cat >tmp.c <<EOF
20787 extern int foo;
20788 EOF
20789 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20790 do
20791         case "\$i" in
20792         -D*) echo "\$i" | $sed 's/^-D//';;
20793         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20794         esac
20795 done
20796 $rm_try
20797 EOS
20798 postprocess_cc_v=''
20799 chmod +x ccsym
20800 $eunicefix ccsym
20801 ./ccsym > ccsym1.raw
20802 if $test -s ccsym1.raw; then
20803        $sort ccsym1.raw | $uniq >ccsym.raw
20804 else
20805        mv ccsym1.raw ccsym.raw
20806 fi
20807
20808 $awk '/\=/ { print $0; next }
20809         { print $0"=1" }' ccsym.raw >ccsym.list
20810 $comm -13 Cppsym.true ccsym.list >ccsym.own
20811 $comm -12 Cppsym.true ccsym.list >ccsym.com
20812 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20813 also=''
20814 if $test -z ccsym.raw; then
20815         echo "Your C compiler doesn't seem to define any symbols!" >&4
20816         echo " "
20817         echo "However, your C preprocessor defines the following symbols:"
20818         $cat Cppsym.true
20819         ccsymbols=''
20820         cppsymbols=`$cat Cppsym.true`
20821         cppsymbols=`echo $cppsymbols`
20822         cppccsymbols="$cppsymbols"
20823 else
20824         if $test -s ccsym.com; then
20825                 echo "Your C compiler and pre-processor define these symbols:"
20826                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20827                 also='also '
20828                 symbols='ones'
20829                 cppccsymbols=`$cat ccsym.com`
20830                 cppccsymbols=`echo $cppccsymbols`
20831                 $test "$silent" || sleep 1
20832         fi
20833         if $test -s ccsym.cpp; then
20834                 $test "$also" && echo " "
20835                 echo "Your C pre-processor ${also}defines the following symbols:"
20836                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20837                 also='further '
20838                 cppsymbols=`$cat ccsym.cpp`
20839                 cppsymbols=`echo $cppsymbols`
20840                 $test "$silent" || sleep 1
20841         fi
20842         if $test -s ccsym.own; then
20843                 $test "$also" && echo " "
20844                 echo "Your C compiler ${also}defines the following cpp symbols:"
20845                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20846                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20847                 ccsymbols=`$cat ccsym.own`
20848                 ccsymbols=`echo $ccsymbols`
20849                 $test "$silent" || sleep 1
20850         fi
20851 fi
20852
20853 : see if this is a termio system
20854 val="$undef"
20855 val2="$undef"
20856 val3="$undef"
20857 if $test `./findhdr termios.h`; then
20858         set tcsetattr i_termios
20859         eval $inlibc
20860         val3="$i_termios"
20861 fi
20862 echo " "
20863 case "$val3" in
20864 "$define") echo "You have POSIX termios.h... good!" >&4;;
20865 *) if ./Cppsym pyr; then
20866                 case "`/bin/universe`" in
20867                 ucb) if $test `./findhdr sgtty.h`; then
20868                                 val2="$define"
20869                                 echo "<sgtty.h> found." >&4
20870                         else
20871                                 echo "System is pyramid with BSD universe."
20872                                 echo "<sgtty.h> not found--you could have problems." >&4
20873                         fi;;
20874                 *) if $test `./findhdr termio.h`; then
20875                                 val="$define"
20876                                 echo "<termio.h> found." >&4
20877                         else
20878                                 echo "System is pyramid with USG universe."
20879                                 echo "<termio.h> not found--you could have problems." >&4
20880                         fi;;
20881                 esac
20882         elif ./usg; then
20883                 if $test `./findhdr termio.h`; then
20884                         echo "<termio.h> found." >&4
20885                         val="$define"
20886                 elif $test `./findhdr sgtty.h`; then
20887                         echo "<sgtty.h> found." >&4
20888                         val2="$define"
20889                 else
20890 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20891                 fi
20892         else
20893                 if $test `./findhdr sgtty.h`; then
20894                         echo "<sgtty.h> found." >&4
20895                         val2="$define"
20896                 elif $test `./findhdr termio.h`; then
20897                         echo "<termio.h> found." >&4
20898                         val="$define"
20899                 else
20900 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20901                 fi
20902         fi;;
20903 esac
20904 set i_termio; eval $setvar
20905 val=$val2; set i_sgtty; eval $setvar
20906 val=$val3; set i_termios; eval $setvar
20907
20908 : see if stddef is available
20909 set stddef.h i_stddef
20910 eval $inhdr
20911
20912 : see if sys/access.h is available
20913 set sys/access.h i_sysaccess
20914 eval $inhdr
20915
20916 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20917 set sys/filio.h i_sysfilio
20918 eval $inhdr
20919 echo " "
20920 if $test `./findhdr sys/ioctl.h`; then
20921         val="$define"
20922         echo '<sys/ioctl.h> found.' >&4
20923 else
20924         val="$undef"
20925         if $test $i_sysfilio = "$define"; then
20926             echo '<sys/ioctl.h> NOT found.' >&4
20927         else
20928                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20929                 $test $i_termio = "$define" && xxx="termio.h"
20930                 $test $i_termios = "$define" && xxx="termios.h"
20931 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20932         fi
20933 fi
20934 set i_sysioctl
20935 eval $setvar
20936
20937 : see if socket ioctl defs are in sys/sockio.h
20938 echo " "
20939 xxx=`./findhdr sys/sockio.h`
20940 if $test "$xxx"; then
20941         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20942                 val="$define"
20943                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20944         else
20945                 val="$undef"
20946                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20947         fi
20948 else
20949         val="$undef"
20950         $cat <<EOM
20951 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20952 EOM
20953 fi
20954 set i_syssockio
20955 eval $setvar
20956
20957
20958 : see if this is a syslog.h system
20959 set syslog.h i_syslog
20960 eval $inhdr
20961
20962
20963 : see if this is a sys/mode.h system
20964 set sys/mode.h i_sysmode
20965 eval $inhdr
20966
20967 : see if sys/resource.h has to be included
20968 set sys/resource.h i_sysresrc
20969 eval $inhdr
20970
20971 : see if sys/security.h is available
20972 set sys/security.h i_syssecrt
20973 eval $inhdr
20974
20975 : see if this is a sys/statvfs.h system
20976 set sys/statvfs.h i_sysstatvfs
20977 eval $inhdr
20978
20979 : see if this is a sys/un.h system
20980 set sys/un.h i_sysun
20981 eval $inhdr
20982
20983
20984 : see if this is a sys/utsname.h system
20985 set sys/utsname.h i_sysutsname
20986 eval $inhdr
20987
20988 : see if this is a syswait system
20989 set sys/wait.h i_syswait
20990 eval $inhdr
20991
20992 : see if this is a ustat.h system
20993 set ustat.h i_ustat
20994 eval $inhdr
20995
20996 : see if this is an utime system
20997 set utime.h i_utime
20998 eval $inhdr
20999
21000 : see if this is a values.h system
21001 set values.h i_values
21002 eval $inhdr
21003
21004 : see if this is a vfork system
21005 case "$d_vfork" in
21006 "$define")
21007         set vfork.h i_vfork
21008         eval $inhdr
21009         ;;
21010 *)
21011         i_vfork="$undef"
21012         ;;
21013 esac
21014
21015 echo " "
21016 echo "Looking for extensions..." >&4
21017 : If we are using the old config.sh, known_extensions may contain
21018 : old or inaccurate or duplicate values.
21019 known_extensions=''
21020 nonxs_extensions=''
21021 : We do not use find because it might not be available.
21022 : We do not just use MANIFEST because the user may have dropped
21023 : some additional extensions into the source tree and expect them
21024 : to be built.
21025
21026 : Function to recursively find available extensions, ignoring DynaLoader
21027 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21028 find_extensions='
21029     for xxx in *; do
21030         case "$xxx" in
21031             DynaLoader|dynaload) ;;
21032             *)
21033             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21034                 known_extensions="$known_extensions $1$xxx";
21035             elif $test -f $xxx/Makefile.PL; then
21036                 nonxs_extensions="$nonxs_extensions $1$xxx";
21037             else
21038                 if $test -d $xxx -a $# -lt 10; then
21039                     set $1$xxx/ $*;
21040                     cd "$xxx";
21041                     eval $find_extensions;
21042                     cd ..;
21043                     shift;
21044                 fi;
21045             fi
21046             ;;
21047         esac;
21048     done'
21049 tdir=`pwd`
21050 cd "$rsrc/ext"
21051 set X
21052 shift
21053 eval $find_extensions
21054 # Special case:  Add in modules that nest beyond the first level.
21055 # Currently threads/shared and Hash/Util/FieldHash, since they are
21056 # not picked up by the recursive find above (and adding in general
21057 # recursive finding breaks SDBM_File/sdbm).
21058 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21059 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21060 set X $known_extensions
21061 shift
21062 known_extensions="$*"
21063 set X $nonxs_extensions
21064 shift
21065 nonxs_extensions="$*"
21066 cd "$tdir"
21067
21068 : Now see which are supported on this system.
21069 avail_ext=''
21070 for xxx in $known_extensions ; do
21071         case "$xxx" in
21072         DB_File|db_file)
21073                 case "$i_db" in
21074                 $define) avail_ext="$avail_ext $xxx" ;;
21075                 esac
21076                 ;;
21077         GDBM_File|gdbm_fil)
21078                 case "$i_gdbm" in
21079                 $define) avail_ext="$avail_ext $xxx" ;;
21080                 esac
21081                 ;;
21082         I18N/Langinfo|i18n_lan)
21083                 case "$i_langinfo$d_nl_langinfo" in
21084                 $define$define) avail_ext="$avail_ext $xxx" ;;
21085                 esac
21086                 ;;
21087         IPC/SysV|ipc/sysv)
21088                 : XXX Do we need a useipcsysv variable here
21089                 case "${d_msg}${d_sem}${d_shm}" in
21090                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21091                 esac
21092                 ;;
21093         NDBM_File|ndbm_fil)
21094                 case "$i_ndbm" in
21095                 $define)
21096                     case "$osname-$use64bitint" in
21097                     hpux-define)
21098                         case "$libs" in
21099                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21100                         esac
21101                         ;;
21102                     *) avail_ext="$avail_ext $xxx" ;;
21103                     esac
21104                     ;;
21105                 esac
21106                 ;;
21107         ODBM_File|odbm_fil)
21108                 case "${i_dbm}${i_rpcsvcdbm}" in
21109                 *"${define}"*)
21110                     case "$d_cplusplus" in
21111                     define) ;; # delete as a function name will not work
21112                     *)  case "$osname-$use64bitint" in
21113                         hpux-define)
21114                             case "$libs" in
21115                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21116                             esac
21117                             ;;
21118                         *) avail_ext="$avail_ext $xxx" ;;
21119                         esac
21120                         ;;
21121                     esac
21122                     ;;
21123                 esac
21124                 ;;
21125         Opcode|opcode)
21126                 case "$useopcode" in
21127                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21128                 esac
21129                 ;;
21130         POSIX|posix)
21131                 case "$useposix" in
21132                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21133                 esac
21134                 ;;
21135         Socket|socket)
21136                 case "$d_socket" in
21137                 true|$define|y)
21138                     case "$osname" in
21139                     beos) ;; # not unless BONE
21140                     *) avail_ext="$avail_ext $xxx" ;;
21141                     esac
21142                     ;;
21143                 esac
21144                 ;;
21145         Sys/Syslog|sys/syslog)
21146                 : XXX syslog requires socket
21147                 case "$d_socket" in
21148                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21149                 esac
21150                 ;;
21151         Thread|thread)
21152                 case "$usethreads" in
21153                 true|$define|y)
21154                         case "$use5005threads" in
21155                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21156                         esac
21157                 esac
21158                 ;;
21159         threads|threads/shared)
21160                 # threads and threads::shared are special cases.
21161                 # To stop people from asking "Perl 5.8.0 was supposed
21162                 # to have this new fancy threads implementation but my
21163                 # perl doesn't have it" and from people trying to
21164                 # (re)install the threads module using CPAN.pm and
21165                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21166                 # the threads.pm and threads/shared.pm will always be
21167                 # there, croaking informatively ("you need to rebuild
21168                 # all of Perl with threads, sorry") when threads haven't
21169                 # been compiled in.
21170                 # --jhi
21171                 avail_ext="$avail_ext $xxx"
21172                 ;;
21173         Win32*)
21174                 case "$osname" in
21175                 cygwin) avail_ext="$avail_ext $xxx" ;;
21176                 esac
21177                 ;;
21178         XS/APItest|xs/apitest)
21179                 # This is just for testing.  Skip it unless we have dynamic loading.
21180
21181                 case "$usedl" in
21182                 $define) avail_ext="$avail_ext $xxx" ;;
21183                 esac
21184                 ;;
21185         XS/Typemap|xs/typemap)
21186                 # This is just for testing.  Skip it unless we have dynamic loading.
21187                 case "$usedl" in
21188                 $define) avail_ext="$avail_ext $xxx" ;;
21189                 esac
21190                 ;;
21191         *)      avail_ext="$avail_ext $xxx"
21192                 ;;
21193         esac
21194 done
21195
21196 set X $avail_ext
21197 shift
21198 avail_ext="$*"
21199
21200 case "$onlyextensions" in
21201 '') ;;
21202 *)  keepextensions=''
21203     echo "You have requested that only certains extensions be included..." >&4
21204     for i in $onlyextensions; do
21205         case " $avail_ext " in
21206         *" $i "*)
21207             echo "Keeping extension $i."
21208             keepextensions="$keepextensions $i"
21209             ;;
21210         *) echo "Ignoring extension $i." ;;
21211         esac
21212     done
21213     avail_ext="$keepextensions"
21214     ;;
21215 esac
21216
21217 case "$noextensions" in
21218 '') ;;
21219 *)  keepextensions=''
21220     echo "You have requested that certain extensions be ignored..." >&4
21221     for i in $avail_ext; do
21222         case " $noextensions " in
21223         *" $i "*) echo "Ignoring extension $i." ;;
21224         *) echo "Keeping extension $i.";
21225            keepextensions="$keepextensions $i"
21226            ;;
21227         esac
21228     done
21229     avail_ext="$keepextensions"
21230     ;;
21231 esac
21232
21233 : Now see which nonxs extensions are supported on this system.
21234 : For now assume all are.
21235 nonxs_ext=''
21236 for xxx in $nonxs_extensions ; do
21237         case "$xxx" in
21238         *)      nonxs_ext="$nonxs_ext $xxx"
21239                 ;;
21240         esac
21241 done
21242
21243 set X $nonxs_ext
21244 shift
21245 nonxs_ext="$*"
21246
21247 case $usedl in
21248 $define)
21249         $cat <<EOM
21250 A number of extensions are supplied with $package.  You may choose to
21251 compile these extensions for dynamic loading (the default), compile
21252 them into the $package executable (static loading), or not include
21253 them at all.  Answer "none" to include no extensions.
21254 Note that DynaLoader is always built and need not be mentioned here.
21255
21256 EOM
21257         case "$dynamic_ext" in
21258         '')
21259                 : Exclude those listed in static_ext
21260                 dflt=''
21261                 for xxx in $avail_ext; do
21262                         case " $static_ext " in
21263                         *" $xxx "*) ;;
21264                         *) dflt="$dflt $xxx" ;;
21265                         esac
21266                 done
21267                 set X $dflt
21268                 shift
21269                 dflt="$*"
21270                 ;;
21271         *)      dflt="$dynamic_ext"
21272                 # Perhaps we are reusing an old out-of-date config.sh.
21273                 case "$hint" in
21274                 previous)
21275                         if test X"$dynamic_ext" != X"$avail_ext"; then
21276                                 $cat <<EOM
21277 NOTICE:  Your previous config.sh list may be incorrect.
21278 The extensions now available to you are
21279         ${avail_ext}
21280 but the default list from your previous config.sh is
21281         ${dynamic_ext}
21282
21283 EOM
21284                         fi
21285                         ;;
21286                 esac
21287                 ;;
21288         esac
21289         case "$dflt" in
21290         '')     dflt=none;;
21291         esac
21292         rp="What extensions do you wish to load dynamically?"
21293         . ./myread
21294         case "$ans" in
21295         none) dynamic_ext=' ' ;;
21296         *) dynamic_ext="$ans" ;;
21297         esac
21298
21299         case "$static_ext" in
21300         '')
21301                 : Exclude those already listed in dynamic linking
21302                 dflt=''
21303                 for xxx in $avail_ext; do
21304                         case " $dynamic_ext " in
21305                         *" $xxx "*) ;;
21306                         *) dflt="$dflt $xxx" ;;
21307                         esac
21308                 done
21309                 set X $dflt
21310                 shift
21311                 dflt="$*"
21312                 ;;
21313         *)  dflt="$static_ext"
21314                 ;;
21315         esac
21316
21317         case "$dflt" in
21318         '')     dflt=none;;
21319         esac
21320         rp="What extensions do you wish to load statically?"
21321         . ./myread
21322         case "$ans" in
21323         none) static_ext=' ' ;;
21324         *) static_ext="$ans" ;;
21325         esac
21326         ;;
21327 *)
21328         $cat <<EOM
21329 A number of extensions are supplied with $package.  Answer "none"
21330 to include no extensions.
21331 Note that DynaLoader is always built and need not be mentioned here.
21332
21333 EOM
21334         case "$static_ext" in
21335         '') dflt="$avail_ext" ;;
21336         *)      dflt="$static_ext"
21337                 # Perhaps we are reusing an old out-of-date config.sh.
21338                 case "$hint" in
21339                 previous)
21340                         if test X"$static_ext" != X"$avail_ext"; then
21341                                 $cat <<EOM
21342 NOTICE:  Your previous config.sh list may be incorrect.
21343 The extensions now available to you are
21344         ${avail_ext}
21345 but the default list from your previous config.sh is
21346         ${static_ext}
21347
21348 EOM
21349                         fi
21350                         ;;
21351                 esac
21352                 ;;
21353         esac
21354         : Exclude those that are not xs extensions
21355         case "$dflt" in
21356         '')     dflt=none;;
21357         esac
21358         rp="What extensions do you wish to include?"
21359         . ./myread
21360         case "$ans" in
21361         none) static_ext=' ' ;;
21362         *) static_ext="$ans" ;;
21363         esac
21364         ;;
21365 esac
21366 #
21367 # Encode is a special case.  If we are building Encode as a static
21368 # extension, we need to explicitly list its subextensions as well.
21369 # For other nested extensions, this is handled automatically by
21370 # the appropriate Makefile.PL.
21371 case " $static_ext " in
21372         *" Encode "*) # Add the subextensions of Encode
21373         cd "$rsrc/ext"
21374         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21375                 static_ext="$static_ext Encode/$xxx"
21376         done
21377         cd "$tdir"
21378         ;;
21379 esac
21380
21381 set X $dynamic_ext $static_ext $nonxs_ext
21382 shift
21383 extensions="$*"
21384
21385 # Sanity check:  We require an extension suitable for use with
21386 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21387 # should show up as failures in the test suite, but it's helpful to
21388 # catch them now.) The 'extensions' list is normally sorted
21389 # alphabetically, so we need to accept either
21390 #    DB_File ... Fcntl ... IO  ....
21391 # or something like
21392 #    Fcntl ... NDBM_File ... IO  ....
21393 case " $extensions"  in
21394 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21395 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21396 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21397 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21398    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21399    ;;
21400 esac
21401
21402 : Remove libraries needed only for extensions
21403 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21404 : The exception is SunOS 4.x, which needs them.
21405 case "${osname}X${osvers}" in
21406 sunos*X4*)
21407     perllibs="$libs"
21408     ;;
21409 *) case "$usedl" in
21410     $define|true|[yY]*)
21411             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21412             shift
21413             perllibs="$*"
21414             ;;
21415     *)  perllibs="$libs"
21416             ;;
21417     esac
21418     ;;
21419 esac
21420
21421 : Remove build directory name from cppstdin so it can be used from
21422 : either the present location or the final installed location.
21423 echo " "
21424 : Get out of the UU directory to get correct path name.
21425 cd ..
21426 case "$cppstdin" in
21427 `pwd`/cppstdin)
21428         echo "Stripping down cppstdin path name"
21429         cppstdin=cppstdin
21430         ;;
21431 esac
21432 cd UU
21433
21434 : end of configuration questions
21435 echo " "
21436 echo "End of configuration questions."
21437 echo " "
21438
21439 : back to where it started
21440 if test -d ../UU; then
21441         cd ..
21442 fi
21443
21444 : configuration may be patched via a 'config.arch' file
21445 if $test -f config.arch; then
21446         echo "I see a config.arch file, loading it."
21447         . ./config.arch
21448 fi
21449
21450 : configuration may be patched via a 'config.over' file
21451 if $test -f config.over; then
21452         echo " "
21453         dflt=y
21454         rp='I see a config.over file.  Do you wish to load it?'
21455         . UU/myread
21456         case "$ans" in
21457         n*) echo "OK, I'll ignore it.";;
21458         *)      . ./config.over
21459                 echo "Configuration override changes have been loaded."
21460                 ;;
21461         esac
21462 fi
21463
21464 : in case they want portability, strip down executable paths
21465 case "$d_portable" in
21466 "$define")
21467         echo " "
21468         echo "Stripping down executable paths..." >&4
21469         for file in $loclist $trylist; do
21470                 eval temp=\$$file
21471                 eval $file=`basename $temp`
21472         done
21473         ;;
21474 esac
21475
21476 : create config.sh file
21477 echo " "
21478 echo "Creating config.sh..." >&4
21479 $spitshell <<EOT >config.sh
21480 $startsh
21481 #
21482 # This file was produced by running the Configure script. It holds all the
21483 # definitions figured out by Configure. Should you modify one of these values,
21484 # do not forget to propagate your changes by running "Configure -der". You may
21485 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21486 #
21487
21488 # Package name      : $package
21489 # Source directory  : $src
21490 # Configuration time: $cf_time
21491 # Configured by     : $cf_by
21492 # Target system     : $myuname
21493
21494 Author='$Author'
21495 Date='$Date'
21496 Header='$Header'
21497 Id='$Id'
21498 Locker='$Locker'
21499 Log='$Log'
21500 Mcc='$Mcc'
21501 RCSfile='$RCSfile'
21502 Revision='$Revision'
21503 Source='$Source'
21504 State='$State'
21505 _a='$_a'
21506 _exe='$_exe'
21507 _o='$_o'
21508 afs='$afs'
21509 afsroot='$afsroot'
21510 alignbytes='$alignbytes'
21511 ansi2knr='$ansi2knr'
21512 aphostname='$aphostname'
21513 api_revision='$api_revision'
21514 api_subversion='$api_subversion'
21515 api_version='$api_version'
21516 api_versionstring='$api_versionstring'
21517 ar='$ar'
21518 archlib='$archlib'
21519 archlibexp='$archlibexp'
21520 archname64='$archname64'
21521 archname='$archname'
21522 archobjs='$archobjs'
21523 asctime_r_proto='$asctime_r_proto'
21524 awk='$awk'
21525 baserev='$baserev'
21526 bash='$bash'
21527 bin='$bin'
21528 binexp='$binexp'
21529 bison='$bison'
21530 byacc='$byacc'
21531 byteorder='$byteorder'
21532 c='$c'
21533 castflags='$castflags'
21534 cat='$cat'
21535 cc='$cc'
21536 cccdlflags='$cccdlflags'
21537 ccdlflags='$ccdlflags'
21538 ccflags='$ccflags'
21539 ccflags_uselargefiles='$ccflags_uselargefiles'
21540 ccname='$ccname'
21541 ccsymbols='$ccsymbols'
21542 ccversion='$ccversion'
21543 cf_by='$cf_by'
21544 cf_email='$cf_email'
21545 cf_time='$cf_time'
21546 chgrp='$chgrp'
21547 chmod='$chmod'
21548 chown='$chown'
21549 clocktype='$clocktype'
21550 comm='$comm'
21551 compress='$compress'
21552 contains='$contains'
21553 cp='$cp'
21554 cpio='$cpio'
21555 cpp='$cpp'
21556 cpp_stuff='$cpp_stuff'
21557 cppccsymbols='$cppccsymbols'
21558 cppflags='$cppflags'
21559 cpplast='$cpplast'
21560 cppminus='$cppminus'
21561 cpprun='$cpprun'
21562 cppstdin='$cppstdin'
21563 cppsymbols='$cppsymbols'
21564 crypt_r_proto='$crypt_r_proto'
21565 cryptlib='$cryptlib'
21566 csh='$csh'
21567 ctermid_r_proto='$ctermid_r_proto'
21568 ctime_r_proto='$ctime_r_proto'
21569 d_Gconvert='$d_Gconvert'
21570 d_PRIEUldbl='$d_PRIEUldbl'
21571 d_PRIFUldbl='$d_PRIFUldbl'
21572 d_PRIGUldbl='$d_PRIGUldbl'
21573 d_PRIXU64='$d_PRIXU64'
21574 d_PRId64='$d_PRId64'
21575 d_PRIeldbl='$d_PRIeldbl'
21576 d_PRIfldbl='$d_PRIfldbl'
21577 d_PRIgldbl='$d_PRIgldbl'
21578 d_PRIi64='$d_PRIi64'
21579 d_PRIo64='$d_PRIo64'
21580 d_PRIu64='$d_PRIu64'
21581 d_PRIx64='$d_PRIx64'
21582 d_SCNfldbl='$d_SCNfldbl'
21583 d__fwalk='$d__fwalk'
21584 d_access='$d_access'
21585 d_accessx='$d_accessx'
21586 d_aintl='$d_aintl'
21587 d_alarm='$d_alarm'
21588 d_archlib='$d_archlib'
21589 d_asctime_r='$d_asctime_r'
21590 d_atolf='$d_atolf'
21591 d_atoll='$d_atoll'
21592 d_attribute_format='$d_attribute_format'
21593 d_attribute_malloc='$d_attribute_malloc'
21594 d_attribute_nonnull='$d_attribute_nonnull'
21595 d_attribute_noreturn='$d_attribute_noreturn'
21596 d_attribute_pure='$d_attribute_pure'
21597 d_attribute_unused='$d_attribute_unused'
21598 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21599 d_bcmp='$d_bcmp'
21600 d_bcopy='$d_bcopy'
21601 d_bsd='$d_bsd'
21602 d_bsdgetpgrp='$d_bsdgetpgrp'
21603 d_bsdsetpgrp='$d_bsdsetpgrp'
21604 d_builtin_choose_expr='$d_builtin_choose_expr'
21605 d_builtin_expect='$d_builtin_expect'
21606 d_bzero='$d_bzero'
21607 d_c99_variadic_macros='$d_c99_variadic_macros'
21608 d_casti32='$d_casti32'
21609 d_castneg='$d_castneg'
21610 d_charvspr='$d_charvspr'
21611 d_chown='$d_chown'
21612 d_chroot='$d_chroot'
21613 d_chsize='$d_chsize'
21614 d_class='$d_class'
21615 d_clearenv='$d_clearenv'
21616 d_closedir='$d_closedir'
21617 d_cmsghdr_s='$d_cmsghdr_s'
21618 d_const='$d_const'
21619 d_copysignl='$d_copysignl'
21620 d_cplusplus='$d_cplusplus'
21621 d_crypt='$d_crypt'
21622 d_crypt_r='$d_crypt_r'
21623 d_csh='$d_csh'
21624 d_ctermid='$d_ctermid'
21625 d_ctermid_r='$d_ctermid_r'
21626 d_ctime_r='$d_ctime_r'
21627 d_cuserid='$d_cuserid'
21628 d_dbl_dig='$d_dbl_dig'
21629 d_dbminitproto='$d_dbminitproto'
21630 d_difftime='$d_difftime'
21631 d_dir_dd_fd='$d_dir_dd_fd'
21632 d_dirfd='$d_dirfd'
21633 d_dirnamlen='$d_dirnamlen'
21634 d_dlerror='$d_dlerror'
21635 d_dlopen='$d_dlopen'
21636 d_dlsymun='$d_dlsymun'
21637 d_dosuid='$d_dosuid'
21638 d_drand48_r='$d_drand48_r'
21639 d_drand48proto='$d_drand48proto'
21640 d_dup2='$d_dup2'
21641 d_eaccess='$d_eaccess'
21642 d_endgrent='$d_endgrent'
21643 d_endgrent_r='$d_endgrent_r'
21644 d_endhent='$d_endhent'
21645 d_endhostent_r='$d_endhostent_r'
21646 d_endnent='$d_endnent'
21647 d_endnetent_r='$d_endnetent_r'
21648 d_endpent='$d_endpent'
21649 d_endprotoent_r='$d_endprotoent_r'
21650 d_endpwent='$d_endpwent'
21651 d_endpwent_r='$d_endpwent_r'
21652 d_endsent='$d_endsent'
21653 d_endservent_r='$d_endservent_r'
21654 d_eofnblk='$d_eofnblk'
21655 d_eunice='$d_eunice'
21656 d_faststdio='$d_faststdio'
21657 d_fchdir='$d_fchdir'
21658 d_fchmod='$d_fchmod'
21659 d_fchown='$d_fchown'
21660 d_fcntl='$d_fcntl'
21661 d_fcntl_can_lock='$d_fcntl_can_lock'
21662 d_fd_macros='$d_fd_macros'
21663 d_fd_set='$d_fd_set'
21664 d_fds_bits='$d_fds_bits'
21665 d_fgetpos='$d_fgetpos'
21666 d_finite='$d_finite'
21667 d_finitel='$d_finitel'
21668 d_flexfnam='$d_flexfnam'
21669 d_flock='$d_flock'
21670 d_flockproto='$d_flockproto'
21671 d_fork='$d_fork'
21672 d_fp_class='$d_fp_class'
21673 d_fpathconf='$d_fpathconf'
21674 d_fpclass='$d_fpclass'
21675 d_fpclassify='$d_fpclassify'
21676 d_fpclassl='$d_fpclassl'
21677 d_fpos64_t='$d_fpos64_t'
21678 d_frexpl='$d_frexpl'
21679 d_fs_data_s='$d_fs_data_s'
21680 d_fseeko='$d_fseeko'
21681 d_fsetpos='$d_fsetpos'
21682 d_fstatfs='$d_fstatfs'
21683 d_fstatvfs='$d_fstatvfs'
21684 d_fsync='$d_fsync'
21685 d_ftello='$d_ftello'
21686 d_ftime='$d_ftime'
21687 d_futimes='$d_futimes'
21688 d_getcwd='$d_getcwd'
21689 d_getespwnam='$d_getespwnam'
21690 d_getfsstat='$d_getfsstat'
21691 d_getgrent='$d_getgrent'
21692 d_getgrent_r='$d_getgrent_r'
21693 d_getgrgid_r='$d_getgrgid_r'
21694 d_getgrnam_r='$d_getgrnam_r'
21695 d_getgrps='$d_getgrps'
21696 d_gethbyaddr='$d_gethbyaddr'
21697 d_gethbyname='$d_gethbyname'
21698 d_gethent='$d_gethent'
21699 d_gethname='$d_gethname'
21700 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21701 d_gethostbyname_r='$d_gethostbyname_r'
21702 d_gethostent_r='$d_gethostent_r'
21703 d_gethostprotos='$d_gethostprotos'
21704 d_getitimer='$d_getitimer'
21705 d_getlogin='$d_getlogin'
21706 d_getlogin_r='$d_getlogin_r'
21707 d_getmnt='$d_getmnt'
21708 d_getmntent='$d_getmntent'
21709 d_getnbyaddr='$d_getnbyaddr'
21710 d_getnbyname='$d_getnbyname'
21711 d_getnent='$d_getnent'
21712 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21713 d_getnetbyname_r='$d_getnetbyname_r'
21714 d_getnetent_r='$d_getnetent_r'
21715 d_getnetprotos='$d_getnetprotos'
21716 d_getpagsz='$d_getpagsz'
21717 d_getpbyname='$d_getpbyname'
21718 d_getpbynumber='$d_getpbynumber'
21719 d_getpent='$d_getpent'
21720 d_getpgid='$d_getpgid'
21721 d_getpgrp2='$d_getpgrp2'
21722 d_getpgrp='$d_getpgrp'
21723 d_getppid='$d_getppid'
21724 d_getprior='$d_getprior'
21725 d_getprotobyname_r='$d_getprotobyname_r'
21726 d_getprotobynumber_r='$d_getprotobynumber_r'
21727 d_getprotoent_r='$d_getprotoent_r'
21728 d_getprotoprotos='$d_getprotoprotos'
21729 d_getprpwnam='$d_getprpwnam'
21730 d_getpwent='$d_getpwent'
21731 d_getpwent_r='$d_getpwent_r'
21732 d_getpwnam_r='$d_getpwnam_r'
21733 d_getpwuid_r='$d_getpwuid_r'
21734 d_getsbyname='$d_getsbyname'
21735 d_getsbyport='$d_getsbyport'
21736 d_getsent='$d_getsent'
21737 d_getservbyname_r='$d_getservbyname_r'
21738 d_getservbyport_r='$d_getservbyport_r'
21739 d_getservent_r='$d_getservent_r'
21740 d_getservprotos='$d_getservprotos'
21741 d_getspnam='$d_getspnam'
21742 d_getspnam_r='$d_getspnam_r'
21743 d_gettimeod='$d_gettimeod'
21744 d_gmtime_r='$d_gmtime_r'
21745 d_gnulibc='$d_gnulibc'
21746 d_grpasswd='$d_grpasswd'
21747 d_hasmntopt='$d_hasmntopt'
21748 d_htonl='$d_htonl'
21749 d_ilogbl='$d_ilogbl'
21750 d_inc_version_list='$d_inc_version_list'
21751 d_index='$d_index'
21752 d_inetaton='$d_inetaton'
21753 d_int64_t='$d_int64_t'
21754 d_isascii='$d_isascii'
21755 d_isfinite='$d_isfinite'
21756 d_isinf='$d_isinf'
21757 d_isnan='$d_isnan'
21758 d_isnanl='$d_isnanl'
21759 d_killpg='$d_killpg'
21760 d_lchown='$d_lchown'
21761 d_ldbl_dig='$d_ldbl_dig'
21762 d_libm_lib_version='$d_libm_lib_version'
21763 d_link='$d_link'
21764 d_localtime_r='$d_localtime_r'
21765 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21766 d_locconv='$d_locconv'
21767 d_lockf='$d_lockf'
21768 d_longdbl='$d_longdbl'
21769 d_longlong='$d_longlong'
21770 d_lseekproto='$d_lseekproto'
21771 d_lstat='$d_lstat'
21772 d_madvise='$d_madvise'
21773 d_malloc_good_size='$d_malloc_good_size'
21774 d_malloc_size='$d_malloc_size'
21775 d_mblen='$d_mblen'
21776 d_mbstowcs='$d_mbstowcs'
21777 d_mbtowc='$d_mbtowc'
21778 d_memchr='$d_memchr'
21779 d_memcmp='$d_memcmp'
21780 d_memcpy='$d_memcpy'
21781 d_memmove='$d_memmove'
21782 d_memset='$d_memset'
21783 d_mkdir='$d_mkdir'
21784 d_mkdtemp='$d_mkdtemp'
21785 d_mkfifo='$d_mkfifo'
21786 d_mkstemp='$d_mkstemp'
21787 d_mkstemps='$d_mkstemps'
21788 d_mktime='$d_mktime'
21789 d_mmap='$d_mmap'
21790 d_modfl='$d_modfl'
21791 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21792 d_modflproto='$d_modflproto'
21793 d_mprotect='$d_mprotect'
21794 d_msg='$d_msg'
21795 d_msg_ctrunc='$d_msg_ctrunc'
21796 d_msg_dontroute='$d_msg_dontroute'
21797 d_msg_oob='$d_msg_oob'
21798 d_msg_peek='$d_msg_peek'
21799 d_msg_proxy='$d_msg_proxy'
21800 d_msgctl='$d_msgctl'
21801 d_msgget='$d_msgget'
21802 d_msghdr_s='$d_msghdr_s'
21803 d_msgrcv='$d_msgrcv'
21804 d_msgsnd='$d_msgsnd'
21805 d_msync='$d_msync'
21806 d_munmap='$d_munmap'
21807 d_mymalloc='$d_mymalloc'
21808 d_nice='$d_nice'
21809 d_nl_langinfo='$d_nl_langinfo'
21810 d_nv_preserves_uv='$d_nv_preserves_uv'
21811 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21812 d_off64_t='$d_off64_t'
21813 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21814 d_oldpthreads='$d_oldpthreads'
21815 d_oldsock='$d_oldsock'
21816 d_open3='$d_open3'
21817 d_pathconf='$d_pathconf'
21818 d_pause='$d_pause'
21819 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21820 d_phostname='$d_phostname'
21821 d_pipe='$d_pipe'
21822 d_poll='$d_poll'
21823 d_portable='$d_portable'
21824 d_printf_format_null='$d_printf_format_null'
21825 d_procselfexe='$d_procselfexe'
21826 d_pseudofork='$d_pseudofork'
21827 d_pthread_atfork='$d_pthread_atfork'
21828 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21829 d_pthread_yield='$d_pthread_yield'
21830 d_pwage='$d_pwage'
21831 d_pwchange='$d_pwchange'
21832 d_pwclass='$d_pwclass'
21833 d_pwcomment='$d_pwcomment'
21834 d_pwexpire='$d_pwexpire'
21835 d_pwgecos='$d_pwgecos'
21836 d_pwpasswd='$d_pwpasswd'
21837 d_pwquota='$d_pwquota'
21838 d_qgcvt='$d_qgcvt'
21839 d_quad='$d_quad'
21840 d_random_r='$d_random_r'
21841 d_readdir64_r='$d_readdir64_r'
21842 d_readdir='$d_readdir'
21843 d_readdir_r='$d_readdir_r'
21844 d_readlink='$d_readlink'
21845 d_readv='$d_readv'
21846 d_recvmsg='$d_recvmsg'
21847 d_rename='$d_rename'
21848 d_rewinddir='$d_rewinddir'
21849 d_rmdir='$d_rmdir'
21850 d_safebcpy='$d_safebcpy'
21851 d_safemcpy='$d_safemcpy'
21852 d_sanemcmp='$d_sanemcmp'
21853 d_sbrkproto='$d_sbrkproto'
21854 d_scalbnl='$d_scalbnl'
21855 d_sched_yield='$d_sched_yield'
21856 d_scm_rights='$d_scm_rights'
21857 d_seekdir='$d_seekdir'
21858 d_select='$d_select'
21859 d_sem='$d_sem'
21860 d_semctl='$d_semctl'
21861 d_semctl_semid_ds='$d_semctl_semid_ds'
21862 d_semctl_semun='$d_semctl_semun'
21863 d_semget='$d_semget'
21864 d_semop='$d_semop'
21865 d_sendmsg='$d_sendmsg'
21866 d_setegid='$d_setegid'
21867 d_seteuid='$d_seteuid'
21868 d_setgrent='$d_setgrent'
21869 d_setgrent_r='$d_setgrent_r'
21870 d_setgrps='$d_setgrps'
21871 d_sethent='$d_sethent'
21872 d_sethostent_r='$d_sethostent_r'
21873 d_setitimer='$d_setitimer'
21874 d_setlinebuf='$d_setlinebuf'
21875 d_setlocale='$d_setlocale'
21876 d_setlocale_r='$d_setlocale_r'
21877 d_setnent='$d_setnent'
21878 d_setnetent_r='$d_setnetent_r'
21879 d_setpent='$d_setpent'
21880 d_setpgid='$d_setpgid'
21881 d_setpgrp2='$d_setpgrp2'
21882 d_setpgrp='$d_setpgrp'
21883 d_setprior='$d_setprior'
21884 d_setproctitle='$d_setproctitle'
21885 d_setprotoent_r='$d_setprotoent_r'
21886 d_setpwent='$d_setpwent'
21887 d_setpwent_r='$d_setpwent_r'
21888 d_setregid='$d_setregid'
21889 d_setresgid='$d_setresgid'
21890 d_setresuid='$d_setresuid'
21891 d_setreuid='$d_setreuid'
21892 d_setrgid='$d_setrgid'
21893 d_setruid='$d_setruid'
21894 d_setsent='$d_setsent'
21895 d_setservent_r='$d_setservent_r'
21896 d_setsid='$d_setsid'
21897 d_setvbuf='$d_setvbuf'
21898 d_sfio='$d_sfio'
21899 d_shm='$d_shm'
21900 d_shmat='$d_shmat'
21901 d_shmatprototype='$d_shmatprototype'
21902 d_shmctl='$d_shmctl'
21903 d_shmdt='$d_shmdt'
21904 d_shmget='$d_shmget'
21905 d_sigaction='$d_sigaction'
21906 d_signbit='$d_signbit'
21907 d_sigprocmask='$d_sigprocmask'
21908 d_sigsetjmp='$d_sigsetjmp'
21909 d_sitearch='$d_sitearch'
21910 d_snprintf='$d_snprintf'
21911 d_sockatmark='$d_sockatmark'
21912 d_sockatmarkproto='$d_sockatmarkproto'
21913 d_socket='$d_socket'
21914 d_socklen_t='$d_socklen_t'
21915 d_sockpair='$d_sockpair'
21916 d_socks5_init='$d_socks5_init'
21917 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21918 d_sqrtl='$d_sqrtl'
21919 d_srand48_r='$d_srand48_r'
21920 d_srandom_r='$d_srandom_r'
21921 d_sresgproto='$d_sresgproto'
21922 d_sresuproto='$d_sresuproto'
21923 d_statblks='$d_statblks'
21924 d_statfs_f_flags='$d_statfs_f_flags'
21925 d_statfs_s='$d_statfs_s'
21926 d_statvfs='$d_statvfs'
21927 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21928 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21929 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21930 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21931 d_stdio_stream_array='$d_stdio_stream_array'
21932 d_stdiobase='$d_stdiobase'
21933 d_stdstdio='$d_stdstdio'
21934 d_strchr='$d_strchr'
21935 d_strcoll='$d_strcoll'
21936 d_strctcpy='$d_strctcpy'
21937 d_strerrm='$d_strerrm'
21938 d_strerror='$d_strerror'
21939 d_strerror_r='$d_strerror_r'
21940 d_strftime='$d_strftime'
21941 d_strlcat='$d_strlcat'
21942 d_strlcpy='$d_strlcpy'
21943 d_strtod='$d_strtod'
21944 d_strtol='$d_strtol'
21945 d_strtold='$d_strtold'
21946 d_strtoll='$d_strtoll'
21947 d_strtoq='$d_strtoq'
21948 d_strtoul='$d_strtoul'
21949 d_strtoull='$d_strtoull'
21950 d_strtouq='$d_strtouq'
21951 d_strxfrm='$d_strxfrm'
21952 d_suidsafe='$d_suidsafe'
21953 d_symlink='$d_symlink'
21954 d_syscall='$d_syscall'
21955 d_syscallproto='$d_syscallproto'
21956 d_sysconf='$d_sysconf'
21957 d_sysernlst='$d_sysernlst'
21958 d_syserrlst='$d_syserrlst'
21959 d_system='$d_system'
21960 d_tcgetpgrp='$d_tcgetpgrp'
21961 d_tcsetpgrp='$d_tcsetpgrp'
21962 d_telldir='$d_telldir'
21963 d_telldirproto='$d_telldirproto'
21964 d_time='$d_time'
21965 d_times='$d_times'
21966 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21967 d_tm_tm_zone='$d_tm_tm_zone'
21968 d_tmpnam_r='$d_tmpnam_r'
21969 d_truncate='$d_truncate'
21970 d_ttyname_r='$d_ttyname_r'
21971 d_tzname='$d_tzname'
21972 d_u32align='$d_u32align'
21973 d_ualarm='$d_ualarm'
21974 d_umask='$d_umask'
21975 d_uname='$d_uname'
21976 d_union_semun='$d_union_semun'
21977 d_unordered='$d_unordered'
21978 d_unsetenv='$d_unsetenv'
21979 d_usleep='$d_usleep'
21980 d_usleepproto='$d_usleepproto'
21981 d_ustat='$d_ustat'
21982 d_vendorarch='$d_vendorarch'
21983 d_vendorbin='$d_vendorbin'
21984 d_vendorlib='$d_vendorlib'
21985 d_vendorscript='$d_vendorscript'
21986 d_vfork='$d_vfork'
21987 d_void_closedir='$d_void_closedir'
21988 d_voidsig='$d_voidsig'
21989 d_voidtty='$d_voidtty'
21990 d_volatile='$d_volatile'
21991 d_vprintf='$d_vprintf'
21992 d_vsnprintf='$d_vsnprintf'
21993 d_wait4='$d_wait4'
21994 d_waitpid='$d_waitpid'
21995 d_wcstombs='$d_wcstombs'
21996 d_wctomb='$d_wctomb'
21997 d_writev='$d_writev'
21998 d_xenix='$d_xenix'
21999 date='$date'
22000 db_hashtype='$db_hashtype'
22001 db_prefixtype='$db_prefixtype'
22002 db_version_major='$db_version_major'
22003 db_version_minor='$db_version_minor'
22004 db_version_patch='$db_version_patch'
22005 defvoidused='$defvoidused'
22006 direntrytype='$direntrytype'
22007 dlext='$dlext'
22008 dlsrc='$dlsrc'
22009 doublesize='$doublesize'
22010 drand01='$drand01'
22011 drand48_r_proto='$drand48_r_proto'
22012 dynamic_ext='$dynamic_ext'
22013 eagain='$eagain'
22014 ebcdic='$ebcdic'
22015 echo='$echo'
22016 egrep='$egrep'
22017 emacs='$emacs'
22018 endgrent_r_proto='$endgrent_r_proto'
22019 endhostent_r_proto='$endhostent_r_proto'
22020 endnetent_r_proto='$endnetent_r_proto'
22021 endprotoent_r_proto='$endprotoent_r_proto'
22022 endpwent_r_proto='$endpwent_r_proto'
22023 endservent_r_proto='$endservent_r_proto'
22024 eunicefix='$eunicefix'
22025 exe_ext='$exe_ext'
22026 expr='$expr'
22027 extensions='$extensions'
22028 extras='$extras'
22029 fflushNULL='$fflushNULL'
22030 fflushall='$fflushall'
22031 find='$find'
22032 firstmakefile='$firstmakefile'
22033 flex='$flex'
22034 fpossize='$fpossize'
22035 fpostype='$fpostype'
22036 freetype='$freetype'
22037 from='$from'
22038 full_ar='$full_ar'
22039 full_csh='$full_csh'
22040 full_sed='$full_sed'
22041 gccansipedantic='$gccansipedantic'
22042 gccosandvers='$gccosandvers'
22043 gccversion='$gccversion'
22044 getgrent_r_proto='$getgrent_r_proto'
22045 getgrgid_r_proto='$getgrgid_r_proto'
22046 getgrnam_r_proto='$getgrnam_r_proto'
22047 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22048 gethostbyname_r_proto='$gethostbyname_r_proto'
22049 gethostent_r_proto='$gethostent_r_proto'
22050 getlogin_r_proto='$getlogin_r_proto'
22051 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22052 getnetbyname_r_proto='$getnetbyname_r_proto'
22053 getnetent_r_proto='$getnetent_r_proto'
22054 getprotobyname_r_proto='$getprotobyname_r_proto'
22055 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22056 getprotoent_r_proto='$getprotoent_r_proto'
22057 getpwent_r_proto='$getpwent_r_proto'
22058 getpwnam_r_proto='$getpwnam_r_proto'
22059 getpwuid_r_proto='$getpwuid_r_proto'
22060 getservbyname_r_proto='$getservbyname_r_proto'
22061 getservbyport_r_proto='$getservbyport_r_proto'
22062 getservent_r_proto='$getservent_r_proto'
22063 getspnam_r_proto='$getspnam_r_proto'
22064 gidformat='$gidformat'
22065 gidsign='$gidsign'
22066 gidsize='$gidsize'
22067 gidtype='$gidtype'
22068 glibpth='$glibpth'
22069 gmake='$gmake'
22070 gmtime_r_proto='$gmtime_r_proto'
22071 gnulibc_version='$gnulibc_version'
22072 grep='$grep'
22073 groupcat='$groupcat'
22074 groupstype='$groupstype'
22075 gzip='$gzip'
22076 h_fcntl='$h_fcntl'
22077 h_sysfile='$h_sysfile'
22078 hint='$hint'
22079 hostcat='$hostcat'
22080 html1dir='$html1dir'
22081 html1direxp='$html1direxp'
22082 html3dir='$html3dir'
22083 html3direxp='$html3direxp'
22084 i16size='$i16size'
22085 i16type='$i16type'
22086 i32size='$i32size'
22087 i32type='$i32type'
22088 i64size='$i64size'
22089 i64type='$i64type'
22090 i8size='$i8size'
22091 i8type='$i8type'
22092 i_arpainet='$i_arpainet'
22093 i_bsdioctl='$i_bsdioctl'
22094 i_crypt='$i_crypt'
22095 i_db='$i_db'
22096 i_dbm='$i_dbm'
22097 i_dirent='$i_dirent'
22098 i_dld='$i_dld'
22099 i_dlfcn='$i_dlfcn'
22100 i_fcntl='$i_fcntl'
22101 i_float='$i_float'
22102 i_fp='$i_fp'
22103 i_fp_class='$i_fp_class'
22104 i_gdbm='$i_gdbm'
22105 i_grp='$i_grp'
22106 i_ieeefp='$i_ieeefp'
22107 i_inttypes='$i_inttypes'
22108 i_langinfo='$i_langinfo'
22109 i_libutil='$i_libutil'
22110 i_limits='$i_limits'
22111 i_locale='$i_locale'
22112 i_machcthr='$i_machcthr'
22113 i_malloc='$i_malloc'
22114 i_math='$i_math'
22115 i_memory='$i_memory'
22116 i_mntent='$i_mntent'
22117 i_ndbm='$i_ndbm'
22118 i_netdb='$i_netdb'
22119 i_neterrno='$i_neterrno'
22120 i_netinettcp='$i_netinettcp'
22121 i_niin='$i_niin'
22122 i_poll='$i_poll'
22123 i_prot='$i_prot'
22124 i_pthread='$i_pthread'
22125 i_pwd='$i_pwd'
22126 i_rpcsvcdbm='$i_rpcsvcdbm'
22127 i_sfio='$i_sfio'
22128 i_sgtty='$i_sgtty'
22129 i_shadow='$i_shadow'
22130 i_socks='$i_socks'
22131 i_stdarg='$i_stdarg'
22132 i_stddef='$i_stddef'
22133 i_stdlib='$i_stdlib'
22134 i_string='$i_string'
22135 i_sunmath='$i_sunmath'
22136 i_sysaccess='$i_sysaccess'
22137 i_sysdir='$i_sysdir'
22138 i_sysfile='$i_sysfile'
22139 i_sysfilio='$i_sysfilio'
22140 i_sysin='$i_sysin'
22141 i_sysioctl='$i_sysioctl'
22142 i_syslog='$i_syslog'
22143 i_sysmman='$i_sysmman'
22144 i_sysmode='$i_sysmode'
22145 i_sysmount='$i_sysmount'
22146 i_sysndir='$i_sysndir'
22147 i_sysparam='$i_sysparam'
22148 i_sysresrc='$i_sysresrc'
22149 i_syssecrt='$i_syssecrt'
22150 i_sysselct='$i_sysselct'
22151 i_syssockio='$i_syssockio'
22152 i_sysstat='$i_sysstat'
22153 i_sysstatfs='$i_sysstatfs'
22154 i_sysstatvfs='$i_sysstatvfs'
22155 i_systime='$i_systime'
22156 i_systimek='$i_systimek'
22157 i_systimes='$i_systimes'
22158 i_systypes='$i_systypes'
22159 i_sysuio='$i_sysuio'
22160 i_sysun='$i_sysun'
22161 i_sysutsname='$i_sysutsname'
22162 i_sysvfs='$i_sysvfs'
22163 i_syswait='$i_syswait'
22164 i_termio='$i_termio'
22165 i_termios='$i_termios'
22166 i_time='$i_time'
22167 i_unistd='$i_unistd'
22168 i_ustat='$i_ustat'
22169 i_utime='$i_utime'
22170 i_values='$i_values'
22171 i_varargs='$i_varargs'
22172 i_varhdr='$i_varhdr'
22173 i_vfork='$i_vfork'
22174 ignore_versioned_solibs='$ignore_versioned_solibs'
22175 inc_version_list='$inc_version_list'
22176 inc_version_list_init='$inc_version_list_init'
22177 incpath='$incpath'
22178 inews='$inews'
22179 initialinstalllocation='$initialinstalllocation'
22180 installarchlib='$installarchlib'
22181 installbin='$installbin'
22182 installhtml1dir='$installhtml1dir'
22183 installhtml3dir='$installhtml3dir'
22184 installman1dir='$installman1dir'
22185 installman3dir='$installman3dir'
22186 installprefix='$installprefix'
22187 installprefixexp='$installprefixexp'
22188 installprivlib='$installprivlib'
22189 installscript='$installscript'
22190 installsitearch='$installsitearch'
22191 installsitebin='$installsitebin'
22192 installsitehtml1dir='$installsitehtml1dir'
22193 installsitehtml3dir='$installsitehtml3dir'
22194 installsitelib='$installsitelib'
22195 installsiteman1dir='$installsiteman1dir'
22196 installsiteman3dir='$installsiteman3dir'
22197 installsitescript='$installsitescript'
22198 installstyle='$installstyle'
22199 installusrbinperl='$installusrbinperl'
22200 installvendorarch='$installvendorarch'
22201 installvendorbin='$installvendorbin'
22202 installvendorhtml1dir='$installvendorhtml1dir'
22203 installvendorhtml3dir='$installvendorhtml3dir'
22204 installvendorlib='$installvendorlib'
22205 installvendorman1dir='$installvendorman1dir'
22206 installvendorman3dir='$installvendorman3dir'
22207 installvendorscript='$installvendorscript'
22208 intsize='$intsize'
22209 issymlink='$issymlink'
22210 ivdformat='$ivdformat'
22211 ivsize='$ivsize'
22212 ivtype='$ivtype'
22213 known_extensions='$known_extensions'
22214 ksh='$ksh'
22215 ld='$ld'
22216 lddlflags='$lddlflags'
22217 ldflags='$ldflags'
22218 ldflags_uselargefiles='$ldflags_uselargefiles'
22219 ldlibpthname='$ldlibpthname'
22220 less='$less'
22221 lib_ext='$lib_ext'
22222 libc='$libc'
22223 libperl='$libperl'
22224 libpth='$libpth'
22225 libs='$libs'
22226 libsdirs='$libsdirs'
22227 libsfiles='$libsfiles'
22228 libsfound='$libsfound'
22229 libspath='$libspath'
22230 libswanted='$libswanted'
22231 libswanted_uselargefiles='$libswanted_uselargefiles'
22232 line='$line'
22233 lint='$lint'
22234 lkflags='$lkflags'
22235 ln='$ln'
22236 lns='$lns'
22237 localtime_r_proto='$localtime_r_proto'
22238 locincpth='$locincpth'
22239 loclibpth='$loclibpth'
22240 longdblsize='$longdblsize'
22241 longlongsize='$longlongsize'
22242 longsize='$longsize'
22243 lp='$lp'
22244 lpr='$lpr'
22245 ls='$ls'
22246 lseeksize='$lseeksize'
22247 lseektype='$lseektype'
22248 mad='$mad'
22249 madlyh='$madlyh'
22250 madlyobj='$madlyobj'
22251 madlysrc='$madlysrc'
22252 mail='$mail'
22253 mailx='$mailx'
22254 make='$make'
22255 make_set_make='$make_set_make'
22256 mallocobj='$mallocobj'
22257 mallocsrc='$mallocsrc'
22258 malloctype='$malloctype'
22259 man1dir='$man1dir'
22260 man1direxp='$man1direxp'
22261 man1ext='$man1ext'
22262 man3dir='$man3dir'
22263 man3direxp='$man3direxp'
22264 man3ext='$man3ext'
22265 mips_type='$mips_type'
22266 mistrustnm='$mistrustnm'
22267 mkdir='$mkdir'
22268 mmaptype='$mmaptype'
22269 modetype='$modetype'
22270 more='$more'
22271 multiarch='$multiarch'
22272 mv='$mv'
22273 myarchname='$myarchname'
22274 mydomain='$mydomain'
22275 myhostname='$myhostname'
22276 myuname='$myuname'
22277 n='$n'
22278 need_va_copy='$need_va_copy'
22279 netdb_hlen_type='$netdb_hlen_type'
22280 netdb_host_type='$netdb_host_type'
22281 netdb_name_type='$netdb_name_type'
22282 netdb_net_type='$netdb_net_type'
22283 nm='$nm'
22284 nm_opt='$nm_opt'
22285 nm_so_opt='$nm_so_opt'
22286 nonxs_ext='$nonxs_ext'
22287 nroff='$nroff'
22288 nvEUformat='$nvEUformat'
22289 nvFUformat='$nvFUformat'
22290 nvGUformat='$nvGUformat'
22291 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22292 nveformat='$nveformat'
22293 nvfformat='$nvfformat'
22294 nvgformat='$nvgformat'
22295 nvsize='$nvsize'
22296 nvtype='$nvtype'
22297 o_nonblock='$o_nonblock'
22298 obj_ext='$obj_ext'
22299 old_pthread_create_joinable='$old_pthread_create_joinable'
22300 optimize='$optimize'
22301 orderlib='$orderlib'
22302 osname='$osname'
22303 osvers='$osvers'
22304 otherlibdirs='$otherlibdirs'
22305 package='$package'
22306 pager='$pager'
22307 passcat='$passcat'
22308 patchlevel='$patchlevel'
22309 path_sep='$path_sep'
22310 perl5='$perl5'
22311 perl='$perl'
22312 perl_patchlevel='$perl_patchlevel'
22313 perladmin='$perladmin'
22314 perllibs='$perllibs'
22315 perlpath='$perlpath'
22316 pg='$pg'
22317 phostname='$phostname'
22318 pidtype='$pidtype'
22319 plibpth='$plibpth'
22320 pmake='$pmake'
22321 pr='$pr'
22322 prefix='$prefix'
22323 prefixexp='$prefixexp'
22324 privlib='$privlib'
22325 privlibexp='$privlibexp'
22326 procselfexe='$procselfexe'
22327 prototype='$prototype'
22328 ptrsize='$ptrsize'
22329 quadkind='$quadkind'
22330 quadtype='$quadtype'
22331 randbits='$randbits'
22332 randfunc='$randfunc'
22333 random_r_proto='$random_r_proto'
22334 randseedtype='$randseedtype'
22335 ranlib='$ranlib'
22336 rd_nodata='$rd_nodata'
22337 readdir64_r_proto='$readdir64_r_proto'
22338 readdir_r_proto='$readdir_r_proto'
22339 revision='$revision'
22340 rm='$rm'
22341 rm_try='$rm_try'
22342 rmail='$rmail'
22343 run='$run'
22344 runnm='$runnm'
22345 sPRIEUldbl='$sPRIEUldbl'
22346 sPRIFUldbl='$sPRIFUldbl'
22347 sPRIGUldbl='$sPRIGUldbl'
22348 sPRIXU64='$sPRIXU64'
22349 sPRId64='$sPRId64'
22350 sPRIeldbl='$sPRIeldbl'
22351 sPRIfldbl='$sPRIfldbl'
22352 sPRIgldbl='$sPRIgldbl'
22353 sPRIi64='$sPRIi64'
22354 sPRIo64='$sPRIo64'
22355 sPRIu64='$sPRIu64'
22356 sPRIx64='$sPRIx64'
22357 sSCNfldbl='$sSCNfldbl'
22358 sched_yield='$sched_yield'
22359 scriptdir='$scriptdir'
22360 scriptdirexp='$scriptdirexp'
22361 sed='$sed'
22362 seedfunc='$seedfunc'
22363 selectminbits='$selectminbits'
22364 selecttype='$selecttype'
22365 sendmail='$sendmail'
22366 setgrent_r_proto='$setgrent_r_proto'
22367 sethostent_r_proto='$sethostent_r_proto'
22368 setlocale_r_proto='$setlocale_r_proto'
22369 setnetent_r_proto='$setnetent_r_proto'
22370 setprotoent_r_proto='$setprotoent_r_proto'
22371 setpwent_r_proto='$setpwent_r_proto'
22372 setservent_r_proto='$setservent_r_proto'
22373 sh='$sh'
22374 shar='$shar'
22375 sharpbang='$sharpbang'
22376 shmattype='$shmattype'
22377 shortsize='$shortsize'
22378 shrpenv='$shrpenv'
22379 shsharp='$shsharp'
22380 sig_count='$sig_count'
22381 sig_name='$sig_name'
22382 sig_name_init='$sig_name_init'
22383 sig_num='$sig_num'
22384 sig_num_init='$sig_num_init'
22385 sig_size='$sig_size'
22386 signal_t='$signal_t'
22387 sitearch='$sitearch'
22388 sitearchexp='$sitearchexp'
22389 sitebin='$sitebin'
22390 sitebinexp='$sitebinexp'
22391 sitehtml1dir='$sitehtml1dir'
22392 sitehtml1direxp='$sitehtml1direxp'
22393 sitehtml3dir='$sitehtml3dir'
22394 sitehtml3direxp='$sitehtml3direxp'
22395 sitelib='$sitelib'
22396 sitelib_stem='$sitelib_stem'
22397 sitelibexp='$sitelibexp'
22398 siteman1dir='$siteman1dir'
22399 siteman1direxp='$siteman1direxp'
22400 siteman3dir='$siteman3dir'
22401 siteman3direxp='$siteman3direxp'
22402 siteprefix='$siteprefix'
22403 siteprefixexp='$siteprefixexp'
22404 sitescript='$sitescript'
22405 sitescriptexp='$sitescriptexp'
22406 sizesize='$sizesize'
22407 sizetype='$sizetype'
22408 sleep='$sleep'
22409 smail='$smail'
22410 so='$so'
22411 sockethdr='$sockethdr'
22412 socketlib='$socketlib'
22413 socksizetype='$socksizetype'
22414 sort='$sort'
22415 spackage='$spackage'
22416 spitshell='$spitshell'
22417 srand48_r_proto='$srand48_r_proto'
22418 srandom_r_proto='$srandom_r_proto'
22419 src='$src'
22420 ssizetype='$ssizetype'
22421 startperl='$startperl'
22422 startsh='$startsh'
22423 static_ext='$static_ext'
22424 stdchar='$stdchar'
22425 stdio_base='$stdio_base'
22426 stdio_bufsiz='$stdio_bufsiz'
22427 stdio_cnt='$stdio_cnt'
22428 stdio_filbuf='$stdio_filbuf'
22429 stdio_ptr='$stdio_ptr'
22430 stdio_stream_array='$stdio_stream_array'
22431 strerror_r_proto='$strerror_r_proto'
22432 strings='$strings'
22433 submit='$submit'
22434 subversion='$subversion'
22435 sysman='$sysman'
22436 tail='$tail'
22437 tar='$tar'
22438 targetarch='$targetarch'
22439 tbl='$tbl'
22440 tee='$tee'
22441 test='$test'
22442 timeincl='$timeincl'
22443 timetype='$timetype'
22444 tmpnam_r_proto='$tmpnam_r_proto'
22445 to='$to'
22446 touch='$touch'
22447 tr='$tr'
22448 trnl='$trnl'
22449 troff='$troff'
22450 ttyname_r_proto='$ttyname_r_proto'
22451 u16size='$u16size'
22452 u16type='$u16type'
22453 u32size='$u32size'
22454 u32type='$u32type'
22455 u64size='$u64size'
22456 u64type='$u64type'
22457 u8size='$u8size'
22458 u8type='$u8type'
22459 uidformat='$uidformat'
22460 uidsign='$uidsign'
22461 uidsize='$uidsize'
22462 uidtype='$uidtype'
22463 uname='$uname'
22464 uniq='$uniq'
22465 uquadtype='$uquadtype'
22466 use5005threads='$use5005threads'
22467 use64bitall='$use64bitall'
22468 use64bitint='$use64bitint'
22469 usecrosscompile='$usecrosscompile'
22470 usedl='$usedl'
22471 usefaststdio='$usefaststdio'
22472 useithreads='$useithreads'
22473 uselargefiles='$uselargefiles'
22474 uselongdouble='$uselongdouble'
22475 usemallocwrap='$usemallocwrap'
22476 usemorebits='$usemorebits'
22477 usemultiplicity='$usemultiplicity'
22478 usemymalloc='$usemymalloc'
22479 usenm='$usenm'
22480 useopcode='$useopcode'
22481 useperlio='$useperlio'
22482 useposix='$useposix'
22483 usereentrant='$usereentrant'
22484 userelocatableinc='$userelocatableinc'
22485 usesfio='$usesfio'
22486 useshrplib='$useshrplib'
22487 usesitecustomize='$usesitecustomize'
22488 usesocks='$usesocks'
22489 usethreads='$usethreads'
22490 usevendorprefix='$usevendorprefix'
22491 usevfork='$usevfork'
22492 usrinc='$usrinc'
22493 uuname='$uuname'
22494 uvXUformat='$uvXUformat'
22495 uvoformat='$uvoformat'
22496 uvsize='$uvsize'
22497 uvtype='$uvtype'
22498 uvuformat='$uvuformat'
22499 uvxformat='$uvxformat'
22500 vendorarch='$vendorarch'
22501 vendorarchexp='$vendorarchexp'
22502 vendorbin='$vendorbin'
22503 vendorbinexp='$vendorbinexp'
22504 vendorhtml1dir='$vendorhtml1dir'
22505 vendorhtml1direxp='$vendorhtml1direxp'
22506 vendorhtml3dir='$vendorhtml3dir'
22507 vendorhtml3direxp='$vendorhtml3direxp'
22508 vendorlib='$vendorlib'
22509 vendorlib_stem='$vendorlib_stem'
22510 vendorlibexp='$vendorlibexp'
22511 vendorman1dir='$vendorman1dir'
22512 vendorman1direxp='$vendorman1direxp'
22513 vendorman3dir='$vendorman3dir'
22514 vendorman3direxp='$vendorman3direxp'
22515 vendorprefix='$vendorprefix'
22516 vendorprefixexp='$vendorprefixexp'
22517 vendorscript='$vendorscript'
22518 vendorscriptexp='$vendorscriptexp'
22519 version='$version'
22520 version_patchlevel_string='$version_patchlevel_string'
22521 versiononly='$versiononly'
22522 vi='$vi'
22523 voidflags='$voidflags'
22524 xlibpth='$xlibpth'
22525 yacc='$yacc'
22526 yaccflags='$yaccflags'
22527 zcat='$zcat'
22528 zip='$zip'
22529 EOT
22530
22531 : Add in command line options if available
22532 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22533
22534 : add special variables
22535 $test -f $src/patchlevel.h && \
22536 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22537 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22538 echo "PERL_CONFIG_SH=true" >>config.sh
22539
22540 : propagate old symbols
22541 if $test -f UU/config.sh; then
22542         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22543         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22544         $sort | $uniq -u >UU/oldsyms
22545         set X `cat UU/oldsyms`
22546         shift
22547         case $# in
22548         0) ;;
22549         *)
22550                 cat <<EOM
22551 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22552 EOM
22553                 echo "# Variables propagated from previous config.sh file." >>config.sh
22554                 for sym in `cat UU/oldsyms`; do
22555                         echo "    Propagating $hint variable "'$'"$sym..."
22556                         eval 'tmp="$'"${sym}"'"'
22557                         echo "$tmp" | \
22558                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22559                 done
22560                 ;;
22561         esac
22562 fi
22563
22564 : Finish up by extracting the .SH files
22565 case "$alldone" in
22566 exit)
22567         $rm -rf UU
22568         echo "Extraction done."
22569         exit 0
22570         ;;
22571 cont)
22572         ;;
22573 '')
22574         dflt=''
22575         nostick=true
22576         $cat <<EOM
22577
22578 If you'd like to make any changes to the config.sh file before I begin
22579 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22580
22581 EOM
22582         rp="Press return or use a shell escape to edit config.sh:"
22583         . UU/myread
22584         nostick=''
22585         case "$ans" in
22586         '') ;;
22587         *) : in case they cannot read
22588                 sh 1>&4 -c "$ans";;
22589         esac
22590         ;;
22591 esac
22592
22593 : if this fails, just run all the .SH files by hand
22594 . ./config.sh
22595
22596 echo " "
22597 exec 1>&4
22598 pwd=`pwd`
22599 . ./UU/extract
22600 cd "$pwd"
22601
22602 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22603         dflt=y
22604         case "$silent" in
22605         true) ;;
22606         *)
22607                 $cat <<EOM
22608
22609 Now you need to generate make dependencies by running "$make depend".
22610 You might prefer to run it in background: "$make depend > makedepend.out &"
22611 It can take a while, so you might not want to run it right now.
22612
22613 EOM
22614                 ;;
22615         esac
22616         rp="Run $make depend now?"
22617         . UU/myread
22618         case "$ans" in
22619         y*)
22620                 $make depend && echo "Now you must run '$make'."
22621                 ;;
22622         *)
22623                 echo "You must run '$make depend' then '$make'."
22624                 ;;
22625         esac
22626 elif test -f [Mm]akefile; then
22627         echo " "
22628         echo "Now you must run a $make."
22629 else
22630         echo "Configure done."
22631 fi
22632
22633 if $test -f Policy.sh; then
22634     $cat <<EOM
22635
22636 If you compile $package on a different machine or from a different object
22637 directory, copy the Policy.sh file from this object directory to the
22638 new one before you run Configure -- this will help you with most of
22639 the policy defaults.
22640
22641 EOM
22642 fi
22643 if $test -f config.msg; then
22644     echo "Hmm.  I also noted the following information while running:"
22645     echo " "
22646     $cat config.msg >&4
22647     $rm -f config.msg
22648 fi
22649 $rm -f kit*isdone ark*isdone
22650 $rm -rf UU
22651
22652 : End of Configure
22653