Configure now probes for _LIB_VERSION support in math.h/libm
[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 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sun Apr 10 19:26:39 CEST 2005 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
51         cat >&4 <<EOF
52 ***
53 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
55 *** Please read the README.plan9 for further instructions.
56 *** Cannot continue, aborting.
57 ***
58 EOF
59         exit 1
60 fi
61
62 : compute my invocation name
63 me=$0
64 case "$0" in
65 */*)
66         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67         test "$me" || me=$0
68         ;;
69 esac
70
71 : Proper separator for the PATH environment variable
72 p_=:
73 : On OS/2 this directory should exist if this is not floppy only system :-]
74 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
75     if test -n "$OS2_SHELL"; then
76                 p_=\;
77                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
79                 is_os2=yes
80         elif test -n "$DJGPP"; then
81                 case "X${MACHTYPE:-nonesuchmach}" in
82                 *cygwin) ;;
83                 *) p_=\; ;;
84                 esac
85         fi
86 fi
87
88 : Proper PATH setting
89 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
90 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
91 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
92 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
93 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
94 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
95 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
96 paths="$paths /sbin /usr/sbin /usr/libexec"
97 paths="$paths /system/gnu_library/bin"
98
99 for p in $paths
100 do
101         case "$p_$PATH$p_" in
102         *$p_$p$p_*) ;;
103         *) test -d $p && PATH=$PATH$p_$p ;;
104         esac
105 done
106
107 PATH=.$p_$PATH
108 export PATH
109
110 : shall we be using ksh?
111 inksh=''
112 needksh=''
113 avoidksh=''
114 newsh=/bin/ksh
115 changesh=''
116 if (PATH=.; alias -x) >/dev/null 2>&1; then
117                 inksh=true
118 fi
119 if test -f /hp-ux -a -f /bin/ksh; then
120         needksh='to avoid sh bug in "here document" expansion'
121 fi
122 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
123         if test X`/usr/bin/uname -v` = X4; then
124                 avoidksh="to avoid AIX 4's /bin/sh"
125                 newsh=/usr/bin/bsh
126         fi
127 fi
128 if test -f /osf_boot -a -f /usr/sbin/setld; then
129         if test X`/usr/bin/uname -s` = XOSF1; then
130                 avoidksh="to avoid Digital UNIX' ksh"
131                 newsh=/bin/sh
132                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
133         fi
134 fi
135 case "$inksh/$needksh" in
136 /[a-z]*)
137                 ENV=''
138                 changesh=true
139                 reason="$needksh"
140         ;;
141 esac
142 case "$inksh/$avoidksh" in
143 true/[a-z]*)
144         changesh=true
145         reason="$avoidksh"
146         ;;
147 esac
148 case "$inksh/$needksh-$avoidksh-" in
149 true/--)
150                 cat <<EOM
151 (I see you are using the Korn shell.  Some ksh's blow up on $me,
152 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
153 EOM
154         ;;
155 esac
156 case "$changesh" in
157 true)
158         export newsh
159         echo "(Feeding myself to $newsh $reason.)"
160         case "$0" in
161         Configure|*/Configure) exec $newsh $0 "$@";;
162         *) exec $newsh Configure "$@";;
163         esac
164         ;;
165 esac
166
167 : if needed set CDPATH to a harmless value that is not chatty
168 : avoid bash 2.02 problems with empty CDPATH.
169 case "$CDPATH" in
170 '')     ;;
171 *)      case "$SHELL" in
172         *bash*) CDPATH='.' ;;
173         *)              CDPATH='' ;;
174         esac
175         ;;
176 esac
177 : Configure runs within the UU subdirectory
178 test -d UU || mkdir UU
179 cd UU && rm -f ./*
180
181 ccname=''
182 ccversion=''
183 ccsymbols=''
184 cppccsymbols=''
185 cppsymbols=''
186 from=''
187 run=''
188 targetarch=''
189 to=''
190 usecrosscompile=''
191 mistrustnm=''
192 perllibs=''
193 dynamic_ext=''
194 extensions=''
195 known_extensions=''
196 nonxs_ext=''
197 static_ext=''
198 useopcode=''
199 useposix=''
200 extras=''
201 d_bsd=''
202 d_eunice=''
203 d_xenix=''
204 eunicefix=''
205 Mcc=''
206 ar=''
207 awk=''
208 bash=''
209 bison=''
210 byacc=''
211 cat=''
212 chgrp=''
213 chmod=''
214 chown=''
215 comm=''
216 compress=''
217 cp=''
218 cpio=''
219 cpp=''
220 csh=''
221 date=''
222 echo=''
223 egrep=''
224 emacs=''
225 expr=''
226 find=''
227 flex=''
228 gmake=''
229 grep=''
230 gzip=''
231 inews=''
232 ksh=''
233 less=''
234 line=''
235 lint=''
236 ln=''
237 lp=''
238 lpr=''
239 ls=''
240 mail=''
241 mailx=''
242 make=''
243 mkdir=''
244 more=''
245 mv=''
246 nm=''
247 nroff=''
248 perl=''
249 pg=''
250 pmake=''
251 pr=''
252 rm=''
253 rmail=''
254 sed=''
255 sendmail=''
256 shar=''
257 sleep=''
258 smail=''
259 sort=''
260 submit=''
261 tail=''
262 tar=''
263 tbl=''
264 tee=''
265 test=''
266 touch=''
267 tr=''
268 troff=''
269 uname=''
270 uniq=''
271 uuname=''
272 vi=''
273 zcat=''
274 zip=''
275 full_ar=''
276 full_sed=''
277 libswanted=''
278 hint=''
279 myuname=''
280 osname=''
281 osvers=''
282 Author=''
283 Date=''
284 Header=''
285 Id=''
286 Locker=''
287 Log=''
288 RCSfile=''
289 Revision=''
290 Source=''
291 State=''
292 _a=''
293 _exe=''
294 _o=''
295 archobjs=''
296 exe_ext=''
297 firstmakefile=''
298 lib_ext=''
299 obj_ext=''
300 path_sep=''
301 afs=''
302 afsroot=''
303 alignbytes=''
304 ansi2knr=''
305 archlib=''
306 archlibexp=''
307 d_archlib=''
308 installarchlib=''
309 archname=''
310 myarchname=''
311 d_atolf=''
312 d_atoll=''
313 baserev=''
314 bin=''
315 binexp=''
316 installbin=''
317 byteorder=''
318 cc=''
319 ccflags=''
320 cppflags=''
321 ldflags=''
322 lkflags=''
323 locincpth=''
324 optimize=''
325 cf_email=''
326 cf_by=''
327 cf_time=''
328 charsize=''
329 contains=''
330 cpp_stuff=''
331 cpplast=''
332 cppminus=''
333 cpprun=''
334 cppstdin=''
335 d__fwalk=''
336 d_access=''
337 d_accessx=''
338 d_aintl=''
339 d_alarm=''
340 asctime_r_proto=''
341 d_asctime_r=''
342 d_attribut=''
343 d_bcmp=''
344 d_bcopy=''
345 d_bzero=''
346 d_casti32=''
347 castflags=''
348 d_castneg=''
349 d_chown=''
350 d_chroot=''
351 d_chsize=''
352 d_class=''
353 d_closedir=''
354 d_void_closedir=''
355 d_cmsghdr_s=''
356 d_const=''
357 d_copysignl=''
358 cryptlib=''
359 d_crypt=''
360 crypt_r_proto=''
361 d_crypt_r=''
362 d_csh=''
363 full_csh=''
364 ctermid_r_proto=''
365 d_ctermid_r=''
366 ctime_r_proto=''
367 d_ctime_r=''
368 d_cuserid=''
369 d_dbl_dig=''
370 d_dbminitproto=''
371 d_difftime=''
372 d_dirfd=''
373 d_dlerror=''
374 d_dlopen=''
375 d_dlsymun=''
376 d_dosuid=''
377 d_suidsafe=''
378 d_drand48_r=''
379 drand48_r_proto=''
380 d_drand48proto=''
381 d_dup2=''
382 d_eaccess=''
383 d_endgrent=''
384 d_endgrent_r=''
385 endgrent_r_proto=''
386 d_endhent=''
387 d_endhostent_r=''
388 endhostent_r_proto=''
389 d_endnent=''
390 d_endnetent_r=''
391 endnetent_r_proto=''
392 d_endpent=''
393 d_endprotoent_r=''
394 endprotoent_r_proto=''
395 d_endpwent=''
396 d_endpwent_r=''
397 endpwent_r_proto=''
398 d_endsent=''
399 d_endservent_r=''
400 endservent_r_proto=''
401 d_faststdio=''
402 d_fchdir=''
403 d_fchmod=''
404 d_fchown=''
405 d_fcntl=''
406 d_fcntl_can_lock=''
407 d_fd_macros=''
408 d_fd_set=''
409 d_fds_bits=''
410 d_fgetpos=''
411 d_finite=''
412 d_finitel=''
413 d_flexfnam=''
414 d_flock=''
415 d_flockproto=''
416 d_fork=''
417 d_fp_class=''
418 d_fpclass=''
419 d_fpclassify=''
420 d_fpclassl=''
421 d_fpos64_t=''
422 d_frexpl=''
423 d_fs_data_s=''
424 d_fseeko=''
425 d_fsetpos=''
426 d_fstatfs=''
427 d_fsync=''
428 d_ftello=''
429 d_ftime=''
430 d_gettimeod=''
431 d_Gconvert=''
432 d_getcwd=''
433 d_getespwnam=''
434 d_getfsstat=''
435 d_getgrent=''
436 d_getgrent_r=''
437 getgrent_r_proto=''
438 d_getgrgid_r=''
439 getgrgid_r_proto=''
440 d_getgrnam_r=''
441 getgrnam_r_proto=''
442 d_getgrps=''
443 d_gethbyaddr=''
444 d_gethbyname=''
445 d_gethent=''
446 aphostname=''
447 d_gethname=''
448 d_phostname=''
449 d_uname=''
450 d_gethostbyaddr_r=''
451 gethostbyaddr_r_proto=''
452 d_gethostbyname_r=''
453 gethostbyname_r_proto=''
454 d_gethostent_r=''
455 gethostent_r_proto=''
456 d_gethostprotos=''
457 d_getitimer=''
458 d_getlogin=''
459 d_getlogin_r=''
460 getlogin_r_proto=''
461 d_getmnt=''
462 d_getmntent=''
463 d_getnbyaddr=''
464 d_getnbyname=''
465 d_getnent=''
466 d_getnetbyaddr_r=''
467 getnetbyaddr_r_proto=''
468 d_getnetbyname_r=''
469 getnetbyname_r_proto=''
470 d_getnetent_r=''
471 getnetent_r_proto=''
472 d_getnetprotos=''
473 d_getpagsz=''
474 d_getpent=''
475 d_getpgid=''
476 d_getpgrp2=''
477 d_bsdgetpgrp=''
478 d_getpgrp=''
479 d_getppid=''
480 d_getprior=''
481 d_getpbyname=''
482 d_getpbynumber=''
483 d_getprotobyname_r=''
484 getprotobyname_r_proto=''
485 d_getprotobynumber_r=''
486 getprotobynumber_r_proto=''
487 d_getprotoent_r=''
488 getprotoent_r_proto=''
489 d_getprotoprotos=''
490 d_getprpwnam=''
491 d_getpwent=''
492 d_getpwent_r=''
493 getpwent_r_proto=''
494 d_getpwnam_r=''
495 getpwnam_r_proto=''
496 d_getpwuid_r=''
497 getpwuid_r_proto=''
498 d_getsent=''
499 d_getservbyname_r=''
500 getservbyname_r_proto=''
501 d_getservbyport_r=''
502 getservbyport_r_proto=''
503 d_getservent_r=''
504 getservent_r_proto=''
505 d_getservprotos=''
506 d_getspnam=''
507 d_getspnam_r=''
508 getspnam_r_proto=''
509 d_getsbyname=''
510 d_getsbyport=''
511 d_gmtime_r=''
512 gmtime_r_proto=''
513 d_gnulibc=''
514 gnulibc_version=''
515 d_hasmntopt=''
516 d_htonl=''
517 d_ilogbl=''
518 d_inetaton=''
519 d_int64_t=''
520 d_isascii=''
521 d_isfinite=''
522 d_isinf=''
523 d_isnan=''
524 d_isnanl=''
525 d_killpg=''
526 d_lchown=''
527 d_ldbl_dig=''
528 d_libm_lib_version=''
529 d_link=''
530 d_localtime_r=''
531 localtime_r_proto=''
532 d_locconv=''
533 d_lockf=''
534 d_longdbl=''
535 longdblsize=''
536 d_longlong=''
537 longlongsize=''
538 d_lseekproto=''
539 d_lstat=''
540 d_madvise=''
541 d_mblen=''
542 d_mbstowcs=''
543 d_mbtowc=''
544 d_memchr=''
545 d_memcmp=''
546 d_memcpy=''
547 d_memmove=''
548 d_memset=''
549 d_mkdir=''
550 d_mkdtemp=''
551 d_mkfifo=''
552 d_mkstemp=''
553 d_mkstemps=''
554 d_mktime=''
555 d_mmap=''
556 mmaptype=''
557 d_modfl=''
558 d_modfl_pow32_bug=''
559 d_modflproto=''
560 d_mprotect=''
561 d_msg=''
562 d_msgctl=''
563 d_msgget=''
564 d_msghdr_s=''
565 d_msgrcv=''
566 d_msgsnd=''
567 d_msync=''
568 d_munmap=''
569 d_nice=''
570 d_nl_langinfo=''
571 d_off64_t=''
572 d_open3=''
573 d_fpathconf=''
574 d_pathconf=''
575 d_pause=''
576 d_pipe=''
577 d_poll=''
578 d_portable=''
579 d_procselfexe=''
580 procselfexe=''
581 d_old_pthread_create_joinable=''
582 old_pthread_create_joinable=''
583 d_pthread_atfork=''
584 d_pthread_attr_setscope=''
585 d_pthread_yield=''
586 d_sched_yield=''
587 sched_yield=''
588 d_qgcvt=''
589 d_random_r=''
590 random_r_proto=''
591 d_readdir64_r=''
592 readdir64_r_proto=''
593 d_readdir=''
594 d_rewinddir=''
595 d_seekdir=''
596 d_telldir=''
597 d_readdir_r=''
598 readdir_r_proto=''
599 d_readlink=''
600 d_readv=''
601 d_recvmsg=''
602 d_rename=''
603 d_rmdir=''
604 d_safebcpy=''
605 d_safemcpy=''
606 d_sanemcmp=''
607 d_sbrkproto=''
608 d_scalbnl=''
609 d_select=''
610 d_sem=''
611 d_semctl=''
612 d_semget=''
613 d_semop=''
614 d_sendmsg=''
615 d_setegid=''
616 d_seteuid=''
617 d_setgrent=''
618 d_setgrent_r=''
619 setgrent_r_proto=''
620 d_setgrps=''
621 d_sethent=''
622 d_sethostent_r=''
623 sethostent_r_proto=''
624 d_setitimer=''
625 d_setlinebuf=''
626 d_setlocale=''
627 d_setlocale_r=''
628 setlocale_r_proto=''
629 d_setnent=''
630 d_setnetent_r=''
631 setnetent_r_proto=''
632 d_setpent=''
633 d_setpgid=''
634 d_setpgrp2=''
635 d_bsdsetpgrp=''
636 d_setpgrp=''
637 d_setprior=''
638 d_setproctitle=''
639 d_setprotoent_r=''
640 setprotoent_r_proto=''
641 d_setpwent=''
642 d_setpwent_r=''
643 setpwent_r_proto=''
644 d_setregid=''
645 d_setresgid=''
646 d_setresuid=''
647 d_setreuid=''
648 d_setrgid=''
649 d_setruid=''
650 d_setsent=''
651 d_setservent_r=''
652 setservent_r_proto=''
653 d_setsid=''
654 d_setvbuf=''
655 d_sfio=''
656 usesfio=''
657 d_shm=''
658 d_shmat=''
659 d_shmatprototype=''
660 shmattype=''
661 d_shmctl=''
662 d_shmdt=''
663 d_shmget=''
664 d_sigaction=''
665 d_sigprocmask=''
666 d_sigsetjmp=''
667 d_sitecustomize=''
668 usesitecustomize=''
669 d_sockatmark=''
670 d_sockatmarkproto=''
671 d_msg_ctrunc=''
672 d_msg_dontroute=''
673 d_msg_oob=''
674 d_msg_peek=''
675 d_msg_proxy=''
676 d_oldsock=''
677 d_scm_rights=''
678 d_socket=''
679 d_sockpair=''
680 sockethdr=''
681 socketlib=''
682 d_socklen_t=''
683 d_socks5_init=''
684 d_sqrtl=''
685 d_srand48_r=''
686 srand48_r_proto=''
687 d_srandom_r=''
688 srandom_r_proto=''
689 d_sresgproto=''
690 d_sresuproto=''
691 d_statblks=''
692 d_statfs_f_flags=''
693 d_statfs_s=''
694 d_fstatvfs=''
695 d_statvfs=''
696 d_stdio_cnt_lval=''
697 d_stdio_ptr_lval=''
698 d_stdio_ptr_lval_nochange_cnt=''
699 d_stdio_ptr_lval_sets_cnt=''
700 d_stdiobase=''
701 d_stdstdio=''
702 stdio_base=''
703 stdio_bufsiz=''
704 stdio_cnt=''
705 stdio_filbuf=''
706 stdio_ptr=''
707 d_index=''
708 d_strchr=''
709 d_strcoll=''
710 d_strctcpy=''
711 d_strerrm=''
712 d_strerror=''
713 d_sysernlst=''
714 d_syserrlst=''
715 d_strerror_r=''
716 strerror_r_proto=''
717 d_strftime=''
718 d_strlcat=''
719 d_strlcpy=''
720 d_strtod=''
721 d_strtol=''
722 d_strtold=''
723 d_strtoll=''
724 d_strtoq=''
725 d_strtoul=''
726 d_strtoull=''
727 d_strtouq=''
728 d_strxfrm=''
729 d_symlink=''
730 d_syscall=''
731 d_syscallproto=''
732 d_sysconf=''
733 d_system=''
734 d_tcgetpgrp=''
735 d_tcsetpgrp=''
736 d_telldirproto=''
737 d_time=''
738 timetype=''
739 clocktype=''
740 d_times=''
741 d_tmpnam_r=''
742 tmpnam_r_proto=''
743 d_truncate=''
744 d_ttyname_r=''
745 ttyname_r_proto=''
746 d_tzname=''
747 d_u32align=''
748 d_ualarm=''
749 d_umask=''
750 d_semctl_semid_ds=''
751 d_semctl_semun=''
752 d_union_semun=''
753 d_unordered=''
754 d_usleep=''
755 d_usleepproto=''
756 d_ustat=''
757 d_vfork=''
758 usevfork=''
759 d_voidsig=''
760 signal_t=''
761 d_volatile=''
762 d_charvspr=''
763 d_vprintf=''
764 d_wait4=''
765 d_waitpid=''
766 d_wcstombs=''
767 d_wctomb=''
768 d_writev=''
769 dlext=''
770 cccdlflags=''
771 ccdlflags=''
772 dlsrc=''
773 ld=''
774 lddlflags=''
775 usedl=''
776 doublesize=''
777 ebcdic=''
778 fflushNULL=''
779 fflushall=''
780 fpossize=''
781 fpostype=''
782 gccansipedantic=''
783 gccosandvers=''
784 gccversion=''
785 gidformat=''
786 gidsign=''
787 gidsize=''
788 gidtype=''
789 groupstype=''
790 h_fcntl=''
791 h_sysfile=''
792 html1dir=''
793 html1direxp=''
794 installhtml1dir=''
795 html3dir=''
796 html3direxp=''
797 installhtml3dir=''
798 i_arpainet=''
799 i_crypt=''
800 db_hashtype=''
801 db_prefixtype=''
802 db_version_major=''
803 db_version_minor=''
804 db_version_patch=''
805 i_db=''
806 i_dbm=''
807 i_rpcsvcdbm=''
808 d_dirnamlen=''
809 direntrytype=''
810 i_dirent=''
811 i_dld=''
812 i_dlfcn=''
813 i_fcntl=''
814 i_float=''
815 i_fp=''
816 i_fp_class=''
817 i_gdbm=''
818 d_grpasswd=''
819 i_grp=''
820 i_ieeefp=''
821 i_inttypes=''
822 i_langinfo=''
823 i_libutil=''
824 i_limits=''
825 i_locale=''
826 i_machcthr=''
827 i_malloc=''
828 i_math=''
829 i_memory=''
830 i_mntent=''
831 i_ndbm=''
832 i_netdb=''
833 i_neterrno=''
834 i_netinettcp=''
835 i_niin=''
836 i_sysin=''
837 i_poll=''
838 i_prot=''
839 i_pthread=''
840 d_pwage=''
841 d_pwchange=''
842 d_pwclass=''
843 d_pwcomment=''
844 d_pwexpire=''
845 d_pwgecos=''
846 d_pwpasswd=''
847 d_pwquota=''
848 i_pwd=''
849 i_sfio=''
850 i_shadow=''
851 i_socks=''
852 i_stddef=''
853 i_stdlib=''
854 i_string=''
855 strings=''
856 i_sunmath=''
857 i_sysaccess=''
858 i_sysdir=''
859 i_sysfile=''
860 d_voidtty=''
861 i_bsdioctl=''
862 i_sysfilio=''
863 i_sysioctl=''
864 i_syssockio=''
865 i_syslog=''
866 i_sysmman=''
867 i_sysmode=''
868 i_sysmount=''
869 i_sysndir=''
870 i_sysparam=''
871 i_sysresrc=''
872 i_syssecrt=''
873 i_sysselct=''
874 i_sysstat=''
875 i_sysstatfs=''
876 i_sysstatvfs=''
877 i_systimes=''
878 i_systypes=''
879 i_sysuio=''
880 i_sysun=''
881 i_sysutsname=''
882 i_sysvfs=''
883 i_syswait=''
884 i_sgtty=''
885 i_termio=''
886 i_termios=''
887 d_tm_tm_gmtoff=''
888 d_tm_tm_zone=''
889 i_systime=''
890 i_systimek=''
891 i_time=''
892 timeincl=''
893 i_unistd=''
894 i_ustat=''
895 i_utime=''
896 i_values=''
897 i_stdarg=''
898 i_varargs=''
899 i_varhdr=''
900 i_vfork=''
901 inc_version_list=''
902 inc_version_list_init=''
903 installprefix=''
904 installprefixexp=''
905 installstyle=''
906 installusrbinperl=''
907 intsize=''
908 longsize=''
909 shortsize=''
910 issymlink=''
911 libc=''
912 ldlibpthname=''
913 libperl=''
914 shrpenv=''
915 useshrplib=''
916 glibpth=''
917 libpth=''
918 loclibpth=''
919 plibpth=''
920 xlibpth=''
921 ignore_versioned_solibs=''
922 libs=''
923 libsdirs=''
924 libsfiles=''
925 libsfound=''
926 libspath=''
927 lns=''
928 d_PRIEUldbl=''
929 d_PRIFUldbl=''
930 d_PRIGUldbl=''
931 d_PRIeldbl=''
932 d_PRIfldbl=''
933 d_PRIgldbl=''
934 d_SCNfldbl=''
935 sPRIEUldbl=''
936 sPRIFUldbl=''
937 sPRIGUldbl=''
938 sPRIeldbl=''
939 sPRIfldbl=''
940 sPRIgldbl=''
941 sSCNfldbl=''
942 lseeksize=''
943 lseektype=''
944 make_set_make=''
945 d_mymalloc=''
946 freetype=''
947 mallocobj=''
948 mallocsrc=''
949 malloctype=''
950 usemallocwrap=''
951 usemymalloc=''
952 installman1dir=''
953 man1dir=''
954 man1direxp=''
955 man1ext=''
956 installman3dir=''
957 man3dir=''
958 man3direxp=''
959 man3ext=''
960 modetype=''
961 multiarch=''
962 mydomain=''
963 myhostname=''
964 phostname=''
965 c=''
966 n=''
967 d_eofnblk=''
968 eagain=''
969 o_nonblock=''
970 rd_nodata=''
971 need_va_copy=''
972 netdb_hlen_type=''
973 netdb_host_type=''
974 netdb_name_type=''
975 netdb_net_type=''
976 groupcat=''
977 hostcat=''
978 passcat=''
979 orderlib=''
980 ranlib=''
981 d_perl_otherlibdirs=''
982 otherlibdirs=''
983 package=''
984 spackage=''
985 pager=''
986 api_revision=''
987 api_subversion=''
988 api_version=''
989 api_versionstring=''
990 patchlevel=''
991 perl_patchlevel=''
992 revision=''
993 subversion=''
994 version=''
995 version_patchlevel_string=''
996 perl5=''
997 perladmin=''
998 perlpath=''
999 d_nv_preserves_uv=''
1000 i16size=''
1001 i16type=''
1002 i32size=''
1003 i32type=''
1004 i64size=''
1005 i64type=''
1006 i8size=''
1007 i8type=''
1008 ivsize=''
1009 ivtype=''
1010 nv_preserves_uv_bits=''
1011 nvsize=''
1012 nvtype=''
1013 u16size=''
1014 u16type=''
1015 u32size=''
1016 u32type=''
1017 u64size=''
1018 u64type=''
1019 u8size=''
1020 u8type=''
1021 uvsize=''
1022 uvtype=''
1023 ivdformat=''
1024 nvEUformat=''
1025 nvFUformat=''
1026 nvGUformat=''
1027 nveformat=''
1028 nvfformat=''
1029 nvgformat=''
1030 uvXUformat=''
1031 uvoformat=''
1032 uvuformat=''
1033 uvxformat=''
1034 pidtype=''
1035 prefix=''
1036 prefixexp=''
1037 installprivlib=''
1038 privlib=''
1039 privlibexp=''
1040 prototype=''
1041 ptrsize=''
1042 d_PRIXU64=''
1043 d_PRId64=''
1044 d_PRIi64=''
1045 d_PRIo64=''
1046 d_PRIu64=''
1047 d_PRIx64=''
1048 sPRIXU64=''
1049 sPRId64=''
1050 sPRIi64=''
1051 sPRIo64=''
1052 sPRIu64=''
1053 sPRIx64=''
1054 d_quad=''
1055 quadkind=''
1056 quadtype=''
1057 uquadtype=''
1058 drand01=''
1059 randbits=''
1060 randfunc=''
1061 randseedtype=''
1062 seedfunc=''
1063 installscript=''
1064 scriptdir=''
1065 scriptdirexp=''
1066 selectminbits=''
1067 selecttype=''
1068 sh=''
1069 sig_count=''
1070 sig_name=''
1071 sig_name_init=''
1072 sig_num=''
1073 sig_num_init=''
1074 sig_size=''
1075 installsitearch=''
1076 sitearch=''
1077 sitearchexp=''
1078 installsitebin=''
1079 sitebin=''
1080 sitebinexp=''
1081 installsitehtml1dir=''
1082 sitehtml1dir=''
1083 sitehtml1direxp=''
1084 installsitehtml3dir=''
1085 sitehtml3dir=''
1086 sitehtml3direxp=''
1087 installsitelib=''
1088 sitelib=''
1089 sitelib_stem=''
1090 sitelibexp=''
1091 installsiteman1dir=''
1092 siteman1dir=''
1093 siteman1direxp=''
1094 installsiteman3dir=''
1095 siteman3dir=''
1096 siteman3direxp=''
1097 siteprefix=''
1098 siteprefixexp=''
1099 installsitescript=''
1100 sitescript=''
1101 sitescriptexp=''
1102 sizesize=''
1103 sizetype=''
1104 so=''
1105 socksizetype=''
1106 sharpbang=''
1107 shsharp=''
1108 spitshell=''
1109 src=''
1110 ssizetype=''
1111 startperl=''
1112 startsh=''
1113 stdchar=''
1114 d_stdio_stream_array=''
1115 stdio_stream_array=''
1116 sysman=''
1117 trnl=''
1118 uidformat=''
1119 uidsign=''
1120 uidsize=''
1121 uidtype=''
1122 archname64=''
1123 use64bitall=''
1124 use64bitint=''
1125 usefaststdio=''
1126 ccflags_uselargefiles=''
1127 ldflags_uselargefiles=''
1128 libswanted_uselargefiles=''
1129 uselargefiles=''
1130 uselongdouble=''
1131 usemorebits=''
1132 usemultiplicity=''
1133 nm_opt=''
1134 nm_so_opt=''
1135 runnm=''
1136 usenm=''
1137 useperlio=''
1138 userelocatableinc=''
1139 usesocks=''
1140 d_oldpthreads=''
1141 use5005threads=''
1142 useithreads=''
1143 usereentrant=''
1144 usethreads=''
1145 incpath=''
1146 mips_type=''
1147 usrinc=''
1148 d_vendorarch=''
1149 installvendorarch=''
1150 vendorarch=''
1151 vendorarchexp=''
1152 d_vendorbin=''
1153 installvendorbin=''
1154 vendorbin=''
1155 vendorbinexp=''
1156 installvendorhtml1dir=''
1157 vendorhtml1dir=''
1158 vendorhtml1direxp=''
1159 installvendorhtml3dir=''
1160 vendorhtml3dir=''
1161 vendorhtml3direxp=''
1162 d_vendorlib=''
1163 installvendorlib=''
1164 vendorlib=''
1165 vendorlib_stem=''
1166 vendorlibexp=''
1167 installvendorman1dir=''
1168 vendorman1dir=''
1169 vendorman1direxp=''
1170 installvendorman3dir=''
1171 vendorman3dir=''
1172 vendorman3direxp=''
1173 usevendorprefix=''
1174 vendorprefix=''
1175 vendorprefixexp=''
1176 d_vendorscript=''
1177 installvendorscript=''
1178 vendorscript=''
1179 vendorscriptexp=''
1180 versiononly=''
1181 defvoidused=''
1182 voidflags=''
1183 yacc=''
1184 yaccflags=''
1185 CONFIG=''
1186
1187 define='define'
1188 undef='undef'
1189 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1190 rmlist=''
1191
1192 : We must find out about Eunice early
1193 eunicefix=':'
1194 if test -f /etc/unixtovms; then
1195         eunicefix=/etc/unixtovms
1196 fi
1197 if test -f /etc/unixtovms.exe; then
1198         eunicefix=/etc/unixtovms.exe
1199 fi
1200
1201 : Set executable suffix now -- needed before hints available
1202 if test -f "/libs/version.library"; then
1203 : Amiga OS
1204     _exe=""
1205 elif test -f "/system/gnu_library/bin/ar.pm"; then
1206 : Stratus VOS
1207     _exe=".pm"
1208 elif test -n "$DJGPP"; then
1209 : DOS DJGPP
1210     _exe=".exe"
1211 elif test -d c:/. -o -n "$is_os2" ; then
1212 : OS/2 or cygwin
1213     _exe=".exe"
1214 fi
1215
1216 i_whoami=''
1217 ccname=''
1218 ccversion=''
1219 perllibs=''
1220 : set useposix=false in your hint file to disable the POSIX extension.
1221 useposix=true
1222 : set useopcode=false in your hint file to disable the Opcode extension.
1223 useopcode=true
1224 : Trailing extension.  Override this in a hint file, if needed.
1225 : Extra object files, if any, needed on this platform.
1226 archobjs=''
1227 archname=''
1228 : Possible local include directories to search.
1229 : Set locincpth to "" in a hint file to defeat local include searches.
1230 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1231 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1232 :
1233 : no include file wanted by default
1234 inclwanted=''
1235
1236 groupstype=''
1237 libnames=''
1238 : change the next line if compiling for Xenix/286 on Xenix/386
1239 xlibpth='/usr/lib/386 /lib/386'
1240 : Possible local library directories to search.
1241 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1242 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1243
1244 : general looking path for locating libraries
1245 glibpth="/lib /usr/lib $xlibpth"
1246 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1247 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1248 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1249
1250 : Private path used by Configure to find libraries.  Its value
1251 : is prepended to libpth. This variable takes care of special
1252 : machines, like the mips.  Usually, it should be empty.
1253 plibpth=''
1254
1255 : default library list
1256 libswanted=''
1257 : some systems want to use only the non-versioned libso:s
1258 ignore_versioned_solibs=''
1259 siteman1dir=''
1260 siteman3dir=''
1261 sitescript=''
1262 archname64=''
1263 ccflags_uselargefiles=''
1264 ldflags_uselargefiles=''
1265 libswanted_uselargefiles=''
1266 : set usemultiplicity on the Configure command line to enable multiplicity.
1267 : set usesocks on the Configure command line to enable socks.
1268 : set usethreads on the Configure command line to enable threads.
1269 usereentrant='undef'
1270 : full support for void wanted by default
1271 defvoidused=15
1272
1273 : List of libraries we want.
1274 : If anyone needs extra -lxxx, put those in a hint file.
1275 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1276 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1277 : We probably want to search /usr/shlib before most other libraries.
1278 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1279 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1280 glibpth="/usr/shlib $glibpth"
1281 : Do not use vfork unless overridden by a hint file.
1282 usevfork=false
1283
1284 : Find the basic shell for Bourne shell scripts
1285 case "$sh" in
1286 '')
1287         case "$SYSTYPE" in
1288         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1289         *) xxx='/bin/sh';;
1290         esac
1291         if test -f "$xxx"; then
1292                 sh="$xxx"
1293         else
1294                 : Build up a list and do a single loop so we can 'break' out.
1295                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1296                 for xxx in sh bash ksh pdksh ash; do
1297                         for p in $pth; do
1298                                 try="$try ${p}/${xxx}"
1299                         done
1300                 done
1301                 for xxx in $try; do
1302                         if test -f "$xxx"; then
1303                                 sh="$xxx";
1304                                 break
1305                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1306                                 sh="$xxx";
1307                                 break
1308                         elif test -f "$xxx.exe"; then
1309                                 sh="$xxx";
1310                                 break
1311                         fi
1312                 done
1313         fi
1314         ;;
1315 esac
1316
1317 case "$sh" in
1318 '')     cat >&2 <<EOM
1319 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1320
1321 Usually it's in /bin/sh.  How did you even get this far?
1322 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1323 we'll try to straighten this all out.
1324 EOM
1325         exit 1
1326         ;;
1327 esac
1328
1329 : see if sh knows # comments
1330 if `$sh -c '#' >/dev/null 2>&1`; then
1331         shsharp=true
1332         spitshell=cat
1333         xcat=/bin/cat
1334         test -f $xcat$_exe || xcat=/usr/bin/cat
1335         if test ! -f $xcat$_exe; then
1336                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1337                         if test -f $p/cat$_exe; then
1338                                 xcat=$p/cat
1339                                 break
1340                         fi
1341                 done
1342                 if test ! -f $xcat$_exe; then
1343                         echo "Can't find cat anywhere!"
1344                         exit 1
1345                 fi
1346         fi
1347         echo "#!$xcat" >sharp
1348         $eunicefix sharp
1349         chmod +x sharp
1350         ./sharp > today
1351         if test -s today; then
1352                 sharpbang='#!'
1353         else
1354                 echo "#! $xcat" > sharp
1355                 $eunicefix sharp
1356                 chmod +x sharp
1357                 ./sharp > today
1358                 if test -s today; then
1359                         sharpbang='#! '
1360                 else
1361                         sharpbang=': use '
1362                 fi
1363         fi
1364 else
1365         echo " "
1366         echo "Your $sh doesn't grok # comments--I will strip them later on."
1367         shsharp=false
1368         cd ..
1369         echo "exec grep -v '^[  ]*#'" >spitshell
1370         chmod +x spitshell
1371         $eunicefix spitshell
1372         spitshell=`pwd`/spitshell
1373         cd UU
1374         echo "I presume that if # doesn't work, #! won't work either!"
1375         sharpbang=': use '
1376 fi
1377 rm -f sharp today
1378
1379 : figure out how to guarantee sh startup
1380 case "$startsh" in
1381 '') startsh=${sharpbang}${sh} ;;
1382 *)
1383 esac
1384 cat >sharp <<EOSS
1385 $startsh
1386 set abc
1387 test "$?abc" != 1
1388 EOSS
1389
1390 chmod +x sharp
1391 $eunicefix sharp
1392 if ./sharp; then
1393         : echo "Yup, it does."
1394 else
1395         echo "Hmm... '$startsh' does not guarantee sh startup..."
1396         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1397 fi
1398 rm -f sharp
1399
1400
1401 : Save command line options in file UU/cmdline.opt for later use in
1402 : generating config.sh.
1403 cat > cmdline.opt <<EOSH
1404 # Configure command line arguments.
1405 config_arg0='$0'
1406 config_args='$*'
1407 config_argc=$#
1408 EOSH
1409 argn=1
1410 args_exp=''
1411 args_sep=''
1412 for arg in "$@"; do
1413         cat >>cmdline.opt <<EOSH
1414 config_arg$argn='$arg'
1415 EOSH
1416         # Extreme backslashitis: replace each ' by '"'"'
1417         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1418 $arg
1419 EOC
1420         arg_exp=`cat cmdl.opt`
1421         args_exp="$args_exp$args_sep'$arg_exp'"
1422         argn=`expr $argn + 1`
1423         args_sep=' '
1424 done
1425 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1426 # used by ./hints/os2.sh
1427 rm -f cmdl.opt
1428
1429 : produce awk script to parse command line options
1430 cat >options.awk <<'EOF'
1431 BEGIN {
1432         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1433
1434         len = length(optstr);
1435         for (i = 1; i <= len; i++) {
1436                 c = substr(optstr, i, 1);
1437                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1438                 if (a == ":") {
1439                         arg[c] = 1;
1440                         i++;
1441                 }
1442                 opt[c] = 1;
1443         }
1444 }
1445 {
1446         expect = 0;
1447         str = $0;
1448         if (substr(str, 1, 1) != "-") {
1449                 printf("'%s'\n", str);
1450                 next;
1451         }
1452         len = length($0);
1453         for (i = 2; i <= len; i++) {
1454                 c = substr(str, i, 1);
1455                 if (!opt[c]) {
1456                         printf("-%s\n", substr(str, i));
1457                         next;
1458                 }
1459                 printf("-%s\n", c);
1460                 if (arg[c]) {
1461                         if (i < len)
1462                                 printf("'%s'\n", substr(str, i + 1));
1463                         else
1464                                 expect = 1;
1465                         next;
1466                 }
1467         }
1468 }
1469 END {
1470         if (expect)
1471                 print "?";
1472 }
1473 EOF
1474
1475 : process the command line options
1476 set X `for arg in "$@"; do echo "X$arg"; done |
1477         sed -e s/X// | awk -f options.awk`
1478 eval "set $*"
1479 shift
1480 rm -f options.awk
1481
1482 : set up default values
1483 fastread=''
1484 reuseval=false
1485 config_sh=''
1486 alldone=''
1487 error=''
1488 silent=''
1489 extractsh=''
1490 override=''
1491 knowitall=''
1492 rm -f optdef.sh posthint.sh
1493 cat >optdef.sh <<EOS
1494 $startsh
1495 EOS
1496
1497
1498 : option parsing
1499 while test $# -gt 0; do
1500         case "$1" in
1501         -d) shift; fastread=yes;;
1502         -e) shift; alldone=cont;;
1503         -f)
1504                 shift
1505                 cd ..
1506                 if test -r "$1"; then
1507                         config_sh="$1"
1508                 else
1509                         echo "$me: cannot read config file $1." >&2
1510                         error=true
1511                 fi
1512                 cd UU
1513                 shift;;
1514         -h) shift; error=true;;
1515         -r) shift; reuseval=true;;
1516         -s) shift; silent=true; realsilent=true;;
1517         -E) shift; alldone=exit;;
1518         -K) shift; knowitall=true;;
1519         -O) shift; override=true;;
1520         -S) shift; silent=true; extractsh=true;;
1521         -D)
1522                 shift
1523                 case "$1" in
1524                 *=)
1525                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1526                         echo "$me: ignoring -D $1" >&2
1527                         ;;
1528                 *=*) echo "$1" | \
1529                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1530                 *) echo "$1='define'" >> optdef.sh;;
1531                 esac
1532                 shift
1533                 ;;
1534         -U)
1535                 shift
1536                 case "$1" in
1537                 *=) echo "$1" >> optdef.sh;;
1538                 *=*)
1539                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1540                         echo "$me: ignoring -U $1" >&2
1541                         ;;
1542                 *) echo "$1='undef'" >> optdef.sh;;
1543                 esac
1544                 shift
1545                 ;;
1546         -A)
1547             shift
1548             xxx=''
1549             yyy="$1"
1550             zzz=''
1551             uuu=undef
1552             case "$yyy" in
1553             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1554                  case "$zzz" in
1555                  *:*) zzz='' ;;
1556                  *)   xxx=append
1557                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1558                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1559                  esac
1560                  ;;
1561             esac
1562             case "$xxx" in
1563             '')  case "$yyy" in
1564                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1565                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1566                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1567                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1568                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1569                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1570                  esac
1571                  ;;       
1572             esac
1573             case "$xxx" in
1574             append)
1575                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1576             clear)
1577                 echo "$yyy=''"                  >> posthint.sh ;;
1578             define)
1579                 case "$zzz" in
1580                 '') zzz=define ;;
1581                 esac
1582                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1583             eval)
1584                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1585             prepend)
1586                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1587             undef)
1588                 case "$zzz" in
1589                 '') zzz="$uuu" ;;
1590                 esac
1591                 echo "$yyy=$zzz"                >> posthint.sh ;;
1592             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1593             esac
1594             shift
1595             ;;
1596         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1597             exit 0;;
1598         --) break;;
1599         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1600         *) break;;
1601         esac
1602 done
1603
1604 case "$error" in
1605 true)
1606         cat >&2 <<EOM
1607 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1608                  [-U symbol] [-U symbol=] [-A command:symbol...]
1609   -d : use defaults for all answers.
1610   -e : go on without questioning past the production of config.sh.
1611   -f : specify an alternate default configuration file.
1612   -h : print this help message and exit (with an error status).
1613   -r : reuse C symbols value if possible (skips costly nm extraction).
1614   -s : silent mode, only echoes questions and essential information.
1615   -D : define symbol to have some value:
1616          -D symbol         symbol gets the value 'define'
1617          -D symbol=value   symbol gets the value 'value'
1618   -E : stop at the end of questions, after having produced config.sh.
1619   -K : do not use unless you know what you are doing.
1620   -O : let -D and -U override definitions from loaded configuration file.
1621   -S : perform variable substitutions on all .SH files (can mix with -f)
1622   -U : undefine symbol:
1623          -U symbol    symbol gets the value 'undef'
1624          -U symbol=   symbol gets completely empty
1625   -A : manipulate symbol after the platform specific hints have been applied:
1626          -A symbol=value                append " "value to symbol
1627          -A append:symbol=value         append value to symbol
1628          -A define:symbol=value         define symbol to have value
1629          -A clear:symbol                define symbol to be ''
1630          -A define:symbol               define symbol to be 'define'
1631          -A eval:symbol=value           define symbol to be eval of value
1632          -A prepend:symbol=value        prepend value to symbol
1633          -A undef:symbol                define symbol to be 'undef'
1634          -A undef:symbol=               define symbol to be ''
1635   -V : print version number and exit (with a zero status).
1636 EOM
1637         exit 1
1638         ;;
1639 esac
1640
1641 : Sanity checks
1642 case "$fastread$alldone" in
1643 yescont|yesexit) ;;
1644 *)
1645         case "$extractsh" in
1646         true) ;;
1647         *)
1648                 if test ! -t 0; then
1649                         echo "Say 'sh Configure', not 'sh <Configure'"
1650                         exit 1
1651                 fi
1652                 ;;
1653         esac
1654         ;;
1655 esac
1656
1657 exec 4>&1
1658 case "$silent" in
1659 true) exec 1>/dev/null;;
1660 esac
1661
1662 : run the defines and the undefines, if any, but leave the file out there...
1663 touch optdef.sh
1664 . ./optdef.sh
1665 : create the posthint manipulation script and leave the file out there...
1666 touch posthint.sh
1667
1668 : set package name
1669 package=perl5
1670 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1671 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1672 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1673 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1674 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1675 esac
1676
1677 : Some greps do not return status, grrr.
1678 echo "grimblepritz" >grimble
1679 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1680         contains=contains
1681 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1682         contains=grep
1683 else
1684         contains=contains
1685 fi
1686 rm -f grimble
1687 : the following should work in any shell
1688 case "$contains" in
1689 contains*)
1690         echo " "
1691         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1692         cat >contains <<'EOSS'
1693 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1694 EOSS
1695 chmod +x contains
1696 esac
1697
1698 : Find the path to the source tree
1699 case "$src" in
1700 '') case "$0" in
1701     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1702          case "$src" in
1703          /*)    ;;
1704          .)     ;;
1705          *)     src=`cd ../$src && pwd` ;;
1706          esac
1707          ;;
1708     *)   src='.';;
1709     esac;;
1710 esac
1711 case "$src" in
1712 '')     src=/
1713         rsrc=/
1714         ;;
1715 /*) rsrc="$src";;
1716 *) rsrc="../$src";;
1717 esac
1718 if test -f $rsrc/Configure && \
1719         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1720 then
1721    : found it, so we are ok.
1722 else
1723         rsrc=''
1724         for src in . .. ../.. ../../.. ../../../..; do
1725                 if test -f ../$src/Configure && \
1726                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1727                 then
1728                         rsrc=../$src
1729                         break
1730                 fi
1731         done
1732 fi
1733 case "$rsrc" in
1734 '')
1735         cat <<EOM >&4
1736
1737 Sorry, I can't seem to locate the source dir for $package.  Please start
1738 Configure with an explicit path -- i.e. /some/path/Configure.
1739
1740 EOM
1741         exit 1
1742         ;;
1743 ../.)   rsrc='..';;
1744 *)
1745         echo " "
1746         echo "Sources for $package found in \"$src\"." >&4
1747         ;;
1748 esac
1749
1750 : script used to extract .SH files with variable substitutions
1751 cat >extract <<'EOS'
1752 PERL_CONFIG_SH=true
1753 echo "Doing variable substitutions on .SH files..."
1754 if test -f MANIFEST; then
1755         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1756 else
1757         echo "(Looking for .SH files under the source directory.)"
1758         set x `(cd "$src"; find . -name "*.SH" -print)`
1759 fi
1760 shift
1761 case $# in
1762 0) set x `(cd "$src"; echo *.SH)`; shift;;
1763 esac
1764 if test ! -f "$src/$1"; then
1765         shift
1766 fi
1767 mkdir_p='
1768 name=$1;
1769 create="";
1770 while test $name; do
1771         if test ! -d "$name"; then
1772                 create="$name $create";
1773                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1774                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1775         else
1776                 name="";
1777         fi;
1778 done;
1779 for file in $create; do
1780         mkdir $file;
1781 done
1782 '
1783 for file in $*; do
1784         case "$src" in
1785         ".")
1786                 case "$file" in
1787                 */*)
1788                         dir=`expr X$file : 'X\(.*\)/'`
1789                         file=`expr X$file : 'X.*/\(.*\)'`
1790                         (cd "$dir" && . ./$file)
1791                         ;;
1792                 *)
1793                         . ./$file
1794                         ;;
1795                 esac
1796                 ;;
1797         *)
1798                 case "$file" in
1799                 */*)
1800                         dir=`expr X$file : 'X\(.*\)/'`
1801                         file=`expr X$file : 'X.*/\(.*\)'`
1802                         (set x $dir; shift; eval $mkdir_p)
1803                         sh <"$src/$dir/$file"
1804                         ;;
1805                 *)
1806                         sh <"$src/$file"
1807                         ;;
1808                 esac
1809                 ;;
1810         esac
1811 done
1812 if test -f "$src/config_h.SH"; then
1813         if test ! -f config.h; then
1814         : oops, they left it out of MANIFEST, probably, so do it anyway.
1815         . "$src/config_h.SH"
1816         fi
1817 fi
1818 EOS
1819
1820 : extract files and exit if asked to do so
1821 case "$extractsh" in
1822 true)
1823         case "$realsilent" in
1824         true) ;;
1825         *) exec 1>&4;;
1826         esac
1827         case "$config_sh" in
1828         '') config_sh='config.sh';;
1829         esac
1830         echo " "
1831         echo "Fetching answers from $config_sh..."
1832         cd ..
1833         . $config_sh
1834         test "$override" && . ./optdef.sh
1835         echo " "
1836         . UU/extract
1837         rm -rf UU
1838         echo "Extraction done."
1839         exit 0
1840         ;;
1841 esac
1842
1843 : Eunice requires " " instead of "", can you believe it
1844 echo " "
1845 : Here we go...
1846 echo "Beginning of configuration questions for $package."
1847
1848 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1849
1850 : first determine how to suppress newline on echo command
1851 echo " "
1852 echo "Checking echo to see how to suppress newlines..."
1853 (echo "hi there\c" ; echo " ") >.echotmp
1854 if $contains c .echotmp >/dev/null 2>&1 ; then
1855         echo "...using -n."
1856         n='-n'
1857         c=''
1858 else
1859         cat <<'EOM'
1860 ...using \c
1861 EOM
1862         n=''
1863         c='\c'
1864 fi
1865 echo $n "The star should be here-->$c"
1866 echo '*'
1867 rm -f .echotmp
1868
1869 : Now test for existence of everything in MANIFEST
1870 echo " "
1871 if test -f "$rsrc/MANIFEST"; then
1872         echo "First let's make sure your kit is complete.  Checking..." >&4
1873         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1874         rm -f missing
1875         tmppwd=`pwd`
1876         for filelist in x??; do
1877                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1878         done
1879         if test -s missing; then
1880                 cat missing >&4
1881                 cat >&4 <<'EOM'
1882
1883 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1884
1885 You have the option of continuing the configuration process, despite the
1886 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1887 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1888 and contact the author (perlbug@perl.org).
1889
1890 EOM
1891                 echo $n "Continue? [n] $c" >&4
1892                 read ans
1893                 case "$ans" in
1894                 y*)
1895                         echo "Continuing..." >&4
1896                         rm -f missing
1897                         ;;
1898                 *)
1899                         echo "ABORTING..." >&4
1900                         kill $$
1901                         ;;
1902                 esac
1903         else
1904                 echo "Looks good..."
1905         fi
1906 else
1907         echo "There is no MANIFEST file.  I hope your kit is complete !"
1908 fi
1909 rm -f missing x??
1910
1911 echo " "
1912 : Find the appropriate value for a newline for tr
1913 if test -n "$DJGPP"; then
1914        trnl='\012'
1915 fi
1916 if test X"$trnl" = X; then
1917         case "`echo foo|tr '\n' x 2>/dev/null`" in
1918         foox) trnl='\n' ;;
1919         esac
1920 fi
1921 if test X"$trnl" = X; then
1922         case "`echo foo|tr '\012' x 2>/dev/null`" in
1923         foox) trnl='\012' ;;
1924         esac
1925 fi
1926 if test X"$trnl" = X; then
1927        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1928        fooxy) trnl='\n\r' ;;
1929        esac
1930 fi
1931 if test X"$trnl" = X; then
1932         cat <<EOM >&2
1933
1934 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1935
1936 EOM
1937         exit 1
1938 fi
1939
1940 : compute the number of columns on the terminal for proper question formatting
1941 case "$COLUMNS" in
1942 '') COLUMNS='80';;
1943 esac
1944
1945 : set up the echo used in my read
1946 myecho="case \"\$xxxm\" in
1947 '') echo $n \"\$rp $c\" >&4;;
1948 *) case \"\$rp\" in
1949         '') echo $n \"[\$xxxm] $c\";;
1950         *)
1951                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1952                         echo \"\$rp\" >&4
1953                         echo $n \"[\$xxxm] $c\" >&4
1954                 else
1955                         echo $n \"\$rp [\$xxxm] $c\" >&4
1956                 fi
1957                 ;;
1958         esac;;
1959 esac"
1960
1961 : now set up to do reads with possible shell escape and default assignment
1962 cat <<EOSC >myread
1963 $startsh
1964 xxxm=\$dflt
1965 $myecho
1966 ans='!'
1967 case "\$fastread" in
1968 yes) case "\$dflt" in
1969         '') ;;
1970         *) ans='';
1971                 case "\$silent-\$rp" in
1972                 true-) ;;
1973                 *) echo " " >&4;;
1974                 esac;;
1975         esac;;
1976 *) case "\$silent" in
1977         true) case "\$rp" in
1978                 '') ans='';;
1979                 esac;;
1980         esac;;
1981 esac
1982 while expr "X\$ans" : "X!" >/dev/null; do
1983         read answ
1984         set x \$xxxm
1985         shift
1986         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1987         case  "\$answ" in
1988         "!")
1989                 sh 1>&4
1990                 echo " "
1991                 $myecho
1992                 ;;
1993         !*)
1994                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1995                 shift
1996                 sh 1>&4 -c "\$*"
1997                 echo " "
1998                 $myecho
1999                 ;;
2000         "\$ans")
2001                 case "\$ans" in
2002                 \\&*)
2003                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2004                         shift
2005                         case "\$1" in
2006                         -d)
2007                                 fastread=yes
2008                                 echo "(OK, I'll run with -d after this question.)" >&4
2009                                 ;;
2010                         -*)
2011                                 echo "*** Sorry, \$1 not supported yet." >&4
2012                                 ;;
2013                         esac
2014                         $myecho
2015                         ans=!
2016                         ;;
2017                 esac;;
2018         *)
2019                 case "\$aok" in
2020                 y)
2021                         echo "*** Substitution done -- please confirm."
2022                         xxxm="\$ans"
2023                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2024                         xxxm="\$ans"
2025                         ans=!
2026                         ;;
2027                 *)
2028                         echo "*** Error -- try again."
2029                         ans=!
2030                         ;;
2031                 esac
2032                 $myecho
2033                 ;;
2034         esac
2035         case "\$ans\$xxxm\$nostick" in
2036         '')
2037                 ans=!
2038                 $myecho
2039                 ;;
2040         esac
2041 done
2042 case "\$ans" in
2043 '') ans="\$xxxm";;
2044 esac
2045 EOSC
2046
2047 : create .config dir to save info across Configure sessions
2048 test -d ../.config || mkdir ../.config
2049 cat >../.config/README <<EOF
2050 This directory created by Configure to save information that should
2051 persist across sessions for $package.
2052
2053 You may safely delete it if you wish.
2054 EOF
2055
2056 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2057 case "$usedevel" in
2058 $define|true|[yY]*) ;;
2059 *) case "$xversion" in
2060    *[13579])
2061         cat >&4 <<EOH
2062 *** WHOA THERE!!! ***
2063
2064     This is an UNSTABLE DEVELOPMENT release.
2065     The version of this $package distribution is $xversion, that is, odd,
2066     (as opposed to even) and that signifies a development release.
2067     If you want a maintenance release, you want an even-numbered version.
2068
2069     Do ***NOT*** install this into production use.
2070     Data corruption and crashes are possible.
2071
2072     It is most seriously suggested that you do not continue any further
2073     unless you want to help in developing and debugging Perl.
2074
2075     If you *still* want to build perl, you can answer 'y' now,
2076     or pass -Dusedevel to Configure.
2077
2078 EOH
2079         rp='Do you really want to continue?'
2080         dflt='n'
2081         . ./myread
2082         case "$ans" in
2083         [yY]) echo >&4 "Okay, continuing."
2084               usedevel="$define" ;;
2085         *) echo >&4 "Okay, bye."
2086            exit 1
2087            ;;
2088         esac
2089         ;;
2090     esac
2091     ;;
2092 esac
2093 case "$usedevel" in
2094 $define|true|[yY]*)
2095         case "$versiononly" in
2096         '') versiononly="$define" ;;
2097         esac
2098         case "$installusrbinperl" in
2099         '') installusrbinperl="$undef" ;;
2100         esac
2101         ;;
2102 esac
2103
2104 : general instructions
2105 needman=true
2106 firsttime=true
2107 user=`(logname) 2>/dev/null`
2108 case "$user" in
2109 '') user=`whoami 2>&1`;;
2110 esac
2111 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2112         firsttime=false
2113         echo " "
2114         rp='Would you like to see the instructions?'
2115         dflt=n
2116         . ./myread
2117         case "$ans" in
2118         [yY]*) ;;
2119         *) needman=false;;
2120         esac
2121 fi
2122 if $needman; then
2123         cat <<EOH
2124
2125 This installation shell script will examine your system and ask you questions
2126 to determine how the perl5 package should be installed. If you get
2127 stuck on a question, you may use a ! shell escape to start a subshell or
2128 execute a command.  Many of the questions will have default answers in square
2129 brackets; typing carriage return will give you the default.
2130
2131 On some of the questions which ask for file or directory names you are allowed
2132 to use the ~name construct to specify the login directory belonging to "name",
2133 even if you don't have a shell which knows about that.  Questions where this is
2134 allowed will be marked "(~name ok)".
2135
2136 EOH
2137         rp=''
2138         dflt='Type carriage return to continue'
2139         . ./myread
2140         cat <<'EOH'
2141
2142 The prompter used in this script allows you to use shell variables and
2143 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2144 in the default answer, as if the default line was a set of arguments given to a
2145 script shell.  This means you may also use $* to repeat the whole default line,
2146 so you do not have to re-type everything to add something to the default.
2147
2148 Everytime there is a substitution, you will have to confirm.  If there is an
2149 error (e.g. an unmatched backtick), the default answer will remain unchanged
2150 and you will be prompted again.
2151
2152 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2153 the questions and use the computed defaults (or the previous answers if there
2154 was already a config.sh file). Type 'Configure -h' for a list of options.
2155 You may also start interactively and then answer '& -d' at any prompt to turn
2156 on the non-interactive behaviour for the remainder of the execution.
2157
2158 EOH
2159         . ./myread
2160         cat <<EOH
2161
2162 Much effort has been expended to ensure that this shell script will run on any
2163 Unix system.  If despite that it blows up on yours, your best bet is to edit
2164 Configure and run it again.  If you can't run Configure for some reason,
2165 you'll have to generate a config.sh file by hand.  Whatever problems you
2166 have, let me (perlbug@perl.org) know how I blew it.
2167
2168 This installation script affects things in two ways:
2169
2170 1) it may do direct variable substitutions on some of the files included
2171    in this kit.
2172 2) it builds a config.h file for inclusion in C programs.  You may edit
2173    any of these files as the need arises after running this script.
2174
2175 If you make a mistake on a question, there is no easy way to back up to it
2176 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2177 files.  Configure will offer to let you do this before it runs the SH files.
2178
2179 EOH
2180         dflt='Type carriage return to continue'
2181         . ./myread
2182         case "$firsttime" in
2183         true) echo $user >>../.config/instruct;;
2184         esac
2185 fi
2186
2187 : find out where common programs are
2188 echo " "
2189 echo "Locating common programs..." >&4
2190 cat <<EOSC >loc
2191 $startsh
2192 case \$# in
2193 0) exit 1;;
2194 esac
2195 thing=\$1
2196 shift
2197 dflt=\$1
2198 shift
2199 for dir in \$*; do
2200         case "\$thing" in
2201         .)
2202         if test -d \$dir/\$thing; then
2203                 echo \$dir
2204                 exit 0
2205         fi
2206         ;;
2207         *)
2208         for thisthing in \$dir/\$thing; do
2209                 : just loop through to pick last item
2210         done
2211         if test -f \$thisthing; then
2212                 echo \$thisthing
2213                 exit 0
2214         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2215                 echo \$thisthing
2216                 exit 0
2217         elif test -f \$dir/\$thing.exe; then
2218                 if test -n "$DJGPP"; then
2219                         echo \$dir/\$thing.exe
2220                 elif test "$eunicefix" != ":"; then
2221                         : on Eunice apparently
2222                         echo \$dir/\$thing
2223                         exit 0
2224                 fi
2225                 exit 0
2226         fi
2227         ;;
2228         esac
2229 done
2230 echo \$dflt
2231 exit 1
2232 EOSC
2233 chmod +x loc
2234 $eunicefix loc
2235 loclist="
2236 awk
2237 cat
2238 chmod
2239 comm
2240 cp
2241 echo
2242 expr
2243 grep
2244 ls
2245 mkdir
2246 rm
2247 sed
2248 sort
2249 touch
2250 tr
2251 uniq
2252 "
2253 trylist="
2254 Mcc
2255 ar
2256 bison
2257 byacc
2258 cpp
2259 csh
2260 date
2261 egrep
2262 gmake
2263 gzip
2264 less
2265 ln
2266 make
2267 more
2268 nm
2269 nroff
2270 pg
2271 test
2272 uname
2273 zip
2274 "
2275 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2276 pth="$pth /lib /usr/lib"
2277 for file in $loclist; do
2278         eval xxx=\$$file
2279         case "$xxx" in
2280         /*|?:[\\/]*)
2281                 if test -f "$xxx"; then
2282                         : ok
2283                 else
2284                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2285                         xxx=`./loc $file $file $pth`
2286                 fi
2287                 ;;
2288         '') xxx=`./loc $file $file $pth`;;
2289         *) xxx=`./loc $xxx $xxx $pth`;;
2290         esac
2291         eval $file=$xxx$_exe
2292         eval _$file=$xxx
2293         case "$xxx" in
2294         /*)
2295                 echo $file is in $xxx.
2296                 ;;
2297         ?:[\\/]*)
2298                 echo $file is in $xxx.
2299                 ;;
2300         *)
2301                 echo "I don't know where '$file' is, and my life depends on it." >&4
2302                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2303                 exit 1
2304                 ;;
2305         esac
2306 done
2307 echo " "
2308 echo "Don't worry if any of the following aren't found..."
2309 say=offhand
2310 for file in $trylist; do
2311         eval xxx=\$$file
2312         case "$xxx" in
2313         /*|?:[\\/]*)
2314                 if test -f "$xxx"; then
2315                         : ok
2316                 else
2317                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2318                         xxx=`./loc $file $file $pth`
2319                 fi
2320                 ;;
2321         '') xxx=`./loc $file $file $pth`;;
2322         *) xxx=`./loc $xxx $xxx $pth`;;
2323         esac
2324         eval $file=$xxx$_exe
2325         eval _$file=$xxx
2326         case "$xxx" in
2327         /*)
2328                 echo $file is in $xxx.
2329                 ;;
2330         ?:[\\/]*)
2331                 echo $file is in $xxx.
2332                 ;;
2333         *)
2334                 echo "I don't see $file out there, $say."
2335                 say=either
2336                 ;;
2337         esac
2338 done
2339 case "$egrep" in
2340 egrep)
2341         echo "Substituting grep for egrep."
2342         egrep=$grep
2343         _egrep=$grep
2344         ;;
2345 esac
2346 case "$ln" in
2347 ln)
2348         echo "Substituting cp for ln."
2349         ln=$cp
2350         _ln=$cp
2351         ;;
2352 esac
2353 case "$make" in
2354 make)   
2355         case "$gmake" in
2356         gmake)
2357         echo "I can't find make or gmake, and my life depends on it." >&4
2358         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2359         exit 1
2360         ;;
2361         esac
2362         ;;
2363 esac    
2364 case "$gmake" in
2365 gmake)  ;;
2366 *)      # We can't have osname yet.
2367         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2368                 # Assume that gmake, if found, is definitely GNU make
2369                 # and prefer it over the system make.
2370                 echo "Substituting gmake for make."
2371                 make=$gmake
2372                 _make=$gmake
2373         fi
2374         ;;
2375 esac
2376 case "$test" in
2377 test)
2378         echo "Hopefully test is built into your sh."
2379         ;;
2380 *)
2381         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2382                 echo "Using the test built into your sh."
2383                 test=test
2384                 _test=test
2385         fi
2386         ;;
2387 esac
2388 case "$echo" in
2389 echo)
2390         echo "Hopefully echo is built into your sh."
2391         ;;
2392 '') ;;
2393 *)
2394         echo " "
2395 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2396         $echo $n "hi there$c" >foo1
2397         echo $n "hi there$c" >foo2
2398         if cmp foo1 foo2 >/dev/null 2>&1; then
2399                 echo "They are compatible.  In fact, they may be identical."
2400         else
2401                 case "$n" in
2402                 '-n') n='' c='\c';;
2403                 *) n='-n' c='';;
2404                 esac
2405                 cat <<FOO
2406 They are not compatible!  You are probably running ksh on a non-USG system.
2407 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2408 have echo built in and we may have to run some Bourne shell scripts.  That
2409 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2410
2411 FOO
2412                 $echo $n "The star should be here-->$c"
2413                 $echo "*"
2414         fi
2415         $rm -f foo1 foo2
2416         ;;
2417 esac
2418
2419 cat <<EOS >trygcc
2420 $startsh
2421 EOS
2422 cat <<'EOSC' >>trygcc
2423 case "$cc" in
2424 '') ;;
2425 *)  $rm -f try try.*
2426     $cat >try.c <<EOM
2427 int main(int argc, char *argv[]) {
2428   return 0;
2429 }
2430 EOM
2431     if $cc -o try $ccflags $ldflags try.c; then
2432        :
2433     else
2434         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2435         despair=yes
2436         trygcc=yes
2437         case "$cc" in
2438         *gcc*) trygcc=no ;;
2439         esac
2440         case "`$cc -v -c try.c 2>&1`" in
2441         *gcc*) trygcc=no ;;
2442         esac
2443         if $test X"$trygcc" = Xyes; then
2444             if gcc -o try -c try.c; then
2445                 echo " "
2446                 echo "You seem to have a working gcc, though." >&4
2447                 rp="Would you like to use it?"
2448                 dflt=y
2449                 if $test -f myread; then
2450                     . ./myread
2451                 else
2452                     if $test -f UU/myread; then
2453                         . ./UU/myread
2454                     else
2455                         echo "Cannot find myread, sorry.  Aborting." >&2
2456                         exit 1
2457                     fi
2458                 fi  
2459                 case "$ans" in
2460                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2461                        if $test -f usethreads.cbu; then
2462                            $cat >&4 <<EOM 
2463
2464 *** However, any setting of the C compiler flags (e.g. for thread support)
2465 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2466 *** (together with e.g. -Dusethreads).
2467
2468 EOM
2469                        fi;;
2470                 esac
2471             fi
2472         fi
2473     fi
2474     $rm -f try try.*
2475     ;;
2476 esac
2477 EOSC
2478
2479 cat <<EOS >checkcc
2480 $startsh
2481 EOS
2482 cat <<'EOSC' >>checkcc
2483 case "$cc" in        
2484 '') ;;
2485 *)  $rm -f try try.*              
2486     $cat >try.c <<EOM
2487 int main(int argc, char *argv[]) {
2488   return 0;
2489 }
2490 EOM
2491     if $cc -o try $ccflags $ldflags try.c; then
2492        :
2493     else
2494         if $test X"$despair" = Xyes; then
2495            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2496         fi
2497         $cat >&4 <<EOM         
2498 You need to find a working C compiler.
2499 Either (purchase and) install the C compiler supplied by your OS vendor,
2500 or for a free C compiler try http://gcc.gnu.org/
2501 I cannot continue any further, aborting.
2502 EOM
2503         exit 1
2504     fi
2505     $rm -f try try.*
2506     ;;
2507 esac
2508 EOSC
2509
2510 : determine whether symbolic links are supported
2511 echo " "
2512 $touch blurfl
2513 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2514         echo "Symbolic links are supported." >&4
2515         lns="$ln -s"
2516 else
2517         echo "Symbolic links are NOT supported." >&4
2518         lns="$ln"
2519 fi
2520 $rm -f blurfl sym
2521
2522 : determine whether symbolic links are supported
2523 echo " "
2524 case "$lns" in
2525 *"ln"*" -s")
2526         echo "Checking how to test for symbolic links..." >&4
2527         $lns blurfl sym
2528         if $test "X$issymlink" = X; then
2529                 case "$newsh" in
2530                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2531                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2532                 esac
2533                 if test $? = 0; then
2534                         issymlink="test -h"
2535                 else
2536                         echo "Your builtin 'test -h' may be broken." >&4
2537                         case "$test" in
2538                         /*)     ;;
2539                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2540                                 for p in $pth
2541                                 do
2542                                         if test -f "$p/$test"; then
2543                                                 test="$p/$test"
2544                                                 break
2545                                         fi
2546                                 done
2547                                 ;;
2548                         esac
2549                         case "$test" in
2550                         /*)
2551                                 echo "Trying external '$test -h'." >&4
2552                                 issymlink="$test -h"
2553                                 if $test ! -h sym >/dev/null 2>&1; then
2554                                         echo "External '$test -h' is broken, too." >&4
2555                                         issymlink=''
2556                                 fi
2557                                 ;;
2558                         *)      issymlink='' ;;
2559                         esac
2560                 fi              
2561         fi
2562         if $test "X$issymlink" = X; then
2563                 if $test -L sym 2>/dev/null; then
2564                         issymlink="$test -L"
2565                         echo "The builtin '$test -L' worked." >&4
2566                 fi
2567         fi
2568         if $test "X$issymlink" != X; then
2569                 echo "You can test for symbolic links with '$issymlink'." >&4
2570         else
2571                 echo "I do not know how you can test for symbolic links." >&4
2572         fi
2573         $rm -f blurfl sym
2574         ;;
2575 *)      echo "No symbolic links, so not testing for their testing..." >&4
2576         ;;
2577 esac
2578 echo " "
2579
2580
2581 case "$mksymlinks" in
2582 $define|true|[yY]*)
2583         case "$src" in
2584         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2585                 exit 1
2586                 ;;
2587         *)      case "$lns:$issymlink" in
2588                 *"ln"*" -s:"*"test -"?)
2589                         echo "Creating the symbolic links..." >&4
2590                         echo "(First creating the subdirectories...)" >&4
2591                         cd ..
2592                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2593                                 read directory
2594                                 test -z "$directory" && break
2595                                 mkdir -p $directory
2596                         done
2597                         # Sanity check 1.
2598                         if test ! -d t/base; then
2599                                 echo "Failed to create the subdirectories.  Aborting." >&4
2600                                 exit 1
2601                         fi
2602                         echo "(Then creating the symlinks...)" >&4
2603                         awk '{print $1}' $src/MANIFEST | while true; do
2604                                 read filename
2605                                 test -z "$filename" && break
2606                                 if test -f $filename; then
2607                                         if $issymlink $filename; then
2608                                                 rm -f $filename
2609                                         fi
2610                                 fi
2611                                 if test -f $filename; then
2612                                         echo "$filename already exists, not symlinking."
2613                                 else
2614                                         ln -s $src/$filename $filename
2615                                 fi
2616                         done
2617                         # Sanity check 2.
2618                         if test ! -f t/base/lex.t; then
2619                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2620                                 exit 1
2621                         fi
2622                         cd UU
2623                         ;;
2624                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2625                         ;;
2626                 esac
2627                 ;;
2628         esac
2629         ;;
2630 esac
2631
2632
2633 case "$usecrosscompile" in
2634 $define|true|[yY]*)
2635         $echo "Cross-compiling..."
2636         croak=''
2637         case "$cc" in
2638         *-*-gcc) # A cross-compiling gcc, probably.
2639             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2640             ar=$targetarch-ar
2641             # leave out ld, choosing it is more complex
2642             nm=$targetarch-nm
2643             ranlib=$targetarch-ranlib
2644             $echo 'extern int foo;' > try.c
2645             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2646             shift
2647             if $test $# -gt 0; then
2648                 incpth="$incpth $*"
2649                 incpth="`$echo $incpth|$sed 's/^ //'`"
2650                 echo "Guessing incpth '$incpth'." >&4
2651                 for i in $*; do
2652                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2653                     if $test -d $j; then
2654                         libpth="$libpth $j"
2655                     fi
2656                 done   
2657                 libpth="`$echo $libpth|$sed 's/^ //'`"
2658                 echo "Guessing libpth '$libpth'." >&4
2659             fi
2660             $rm -f try.c
2661             ;;
2662         esac
2663         case "$targetarch" in
2664         '') echo "Targetarch not defined." >&4; croak=y ;;
2665         *)  echo "Using targetarch $targetarch." >&4 ;;
2666         esac
2667         case "$incpth" in
2668         '') echo "Incpth not defined." >&4; croak=y ;;
2669         *)  echo "Using incpth '$incpth'." >&4 ;;
2670         esac
2671         case "$libpth" in
2672         '') echo "Libpth not defined." >&4; croak=y ;;
2673         *)  echo "Using libpth '$libpth'." >&4 ;;
2674         esac
2675         case "$usrinc" in
2676         '') for i in $incpth; do
2677                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2678                     usrinc=$i
2679                     echo "Guessing usrinc $usrinc." >&4
2680                     break
2681                 fi
2682             done
2683             case "$usrinc" in
2684             '') echo "Usrinc not defined." >&4; croak=y ;;
2685             esac
2686             ;;
2687         *)  echo "Using usrinc $usrinc." >&4 ;;
2688         esac
2689         case "$targethost" in
2690         '') echo "Targethost not defined." >&4; croak=y ;;
2691         *)  echo "Using targethost $targethost." >&4
2692         esac
2693         locincpth=' '
2694         loclibpth=' '
2695         case "$croak" in
2696         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2697         esac
2698         case "$src" in
2699         /*) run=$src/Cross/run
2700             targetmkdir=$src/Cross/mkdir
2701             to=$src/Cross/to
2702             from=$src/Cross/from
2703             ;;
2704         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2705             run=$pwd/Cross/run
2706             targetmkdir=$pwd/Cross/mkdir
2707             to=$pwd/Cross/to
2708             from=$pwd/Cross/from
2709             ;;
2710         esac
2711         case "$targetrun" in
2712         '') targetrun=ssh ;;
2713         esac
2714         case "$targetto" in
2715         '') targetto=scp ;;
2716         esac
2717         case "$targetfrom" in
2718         '') targetfrom=scp ;;
2719         esac
2720         run=$run-$targetrun
2721         to=$to-$targetto
2722         from=$from-$targetfrom
2723         case "$targetdir" in
2724         '')  targetdir=/tmp
2725              echo "Guessing targetdir $targetdir." >&4
2726              ;;
2727         esac
2728         case "$targetuser" in
2729         '')  targetuser=root
2730              echo "Guessing targetuser $targetuser." >&4
2731              ;;
2732         esac
2733         case "$targetfrom" in
2734         scp)    q=-q ;;
2735         *)      q='' ;;
2736         esac
2737         case "$targetrun" in
2738         ssh|rsh)
2739             cat >$run <<EOF
2740 #!/bin/sh
2741 case "\$1" in
2742 -cwd)
2743   shift
2744   cwd=\$1
2745   shift
2746   ;;
2747 esac
2748 case "\$cwd" in
2749 '') cwd=$targetdir ;;
2750 esac
2751 exe=\$1
2752 shift
2753 if $test ! -f \$exe.xok; then
2754   $to \$exe
2755   $touch \$exe.xok
2756 fi
2757 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2758 EOF
2759             ;;
2760         *)  echo "Unknown targetrun '$targetrun'" >&4
2761             exit 1
2762             ;;
2763         esac
2764         case "$targetmkdir" in
2765         */Cross/mkdir)
2766             cat >$targetmkdir <<EOF
2767 #!/bin/sh
2768 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2769 EOF
2770             $chmod a+rx $targetmkdir
2771             ;;
2772         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2773             exit 1
2774             ;;
2775         esac
2776         case "$targetto" in
2777         scp|rcp)
2778             cat >$to <<EOF
2779 #!/bin/sh
2780 for f in \$@
2781 do
2782   case "\$f" in
2783   /*)
2784     $targetmkdir \`dirname \$f\`
2785     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2786     ;;
2787   *)
2788     $targetmkdir $targetdir/\`dirname \$f\`
2789     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2790     ;;
2791   esac
2792 done
2793 exit 0
2794 EOF
2795             ;;
2796         cp) cat >$to <<EOF
2797 #!/bin/sh
2798 for f in \$@
2799 do
2800   case "\$f" in
2801   /*)
2802     $mkdir -p $targetdir/\`dirname \$f\`
2803     $cp \$f $targetdir/\$f || exit 1
2804     ;;
2805   *)
2806     $targetmkdir $targetdir/\`dirname \$f\`
2807     $cp \$f $targetdir/\$f || exit 1
2808     ;;
2809   esac
2810 done
2811 exit 0
2812 EOF
2813             ;;
2814         *)  echo "Unknown targetto '$targetto'" >&4
2815             exit 1
2816             ;;
2817         esac
2818         case "$targetfrom" in
2819         scp|rcp)
2820           cat >$from <<EOF
2821 #!/bin/sh
2822 for f in \$@
2823 do
2824   $rm -f \$f
2825   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2826 done
2827 exit 0
2828 EOF
2829             ;;
2830         cp) cat >$from <<EOF
2831 #!/bin/sh
2832 for f in \$@
2833 do
2834   $rm -f \$f
2835   cp $targetdir/\$f . || exit 1
2836 done
2837 exit 0
2838 EOF
2839             ;;
2840         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2841             exit 1
2842             ;;
2843         esac
2844         if $test ! -f $run; then
2845             echo "Target 'run' script '$run' not found." >&4
2846         else
2847             $chmod a+rx $run
2848         fi
2849         if $test ! -f $to; then
2850             echo "Target 'to' script '$to' not found." >&4
2851         else
2852             $chmod a+rx $to
2853         fi
2854         if $test ! -f $from; then
2855             echo "Target 'from' script '$from' not found." >&4
2856         else
2857             $chmod a+rx $from
2858         fi
2859         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2860             exit 1
2861         fi
2862         cat >&4 <<EOF
2863 Using '$run' for remote execution,
2864 and '$from' and '$to'
2865 for remote file transfer.
2866 EOF
2867         ;;
2868 *)      run=''
2869         to=:
2870         from=:
2871         usecrosscompile='undef'
2872         targetarch=''
2873         ;;
2874 esac
2875
2876 : see whether [:lower:] and [:upper:] are supported character classes
2877 echo " "
2878 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2879 ABYZ)
2880         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2881         up='[:upper:]'
2882         low='[:lower:]'
2883         ;;
2884 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2885         # (0xd9 and 0xe2), therefore that is a nice testing point.
2886         if test "X$up" = X -o "X$low" = X; then
2887             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2888             rs) up='[A-Z]'
2889                 low='[a-z]'
2890                 ;;
2891             esac
2892         fi
2893         if test "X$up" = X -o "X$low" = X; then
2894             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2895             rs) up='A-Z'
2896                 low='a-z'
2897                 ;;
2898             esac
2899         fi
2900         if test "X$up" = X -o "X$low" = X; then
2901             case "`echo RS | od -x 2>/dev/null`" in
2902             *D9E2*|*d9e2*)
2903                 echo "Hey, this might be EBCDIC." >&4
2904                 if test "X$up" = X -o "X$low" = X; then
2905                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2906                     rs) up='[A-IJ-RS-Z]'
2907                         low='[a-ij-rs-z]'
2908                         ;;
2909                     esac
2910                 fi
2911                 if test "X$up" = X -o "X$low" = X; then
2912                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2913                     rs) up='A-IJ-RS-Z'
2914                         low='a-ij-rs-z'
2915                         ;;
2916                     esac
2917                 fi
2918                 ;;
2919             esac
2920         fi
2921 esac
2922 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2923 rs)
2924     echo "Using $up and $low to convert case." >&4
2925     ;;
2926 *)
2927     echo "I don't know how to translate letters from upper to lower case." >&4
2928     echo "Your tr is not acting any way I know of." >&4
2929     exit 1
2930     ;;
2931 esac
2932 : set up the translation script tr, must be called with ./tr of course
2933 cat >tr <<EOSC
2934 $startsh
2935 case "\$1\$2" in
2936 '[A-Z][a-z]') exec $tr '$up' '$low';;
2937 '[a-z][A-Z]') exec $tr '$low' '$up';;
2938 esac
2939 exec $tr "\$@"
2940 EOSC
2941 chmod +x tr
2942 $eunicefix tr
2943
2944 : Try to determine whether config.sh was made on this system
2945 case "$config_sh" in
2946 '')
2947 myuname=`$uname -a 2>/dev/null`
2948 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2949 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2950 # because the A-Z/a-z are not consecutive.
2951 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2952         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2953 newmyuname="$myuname"
2954 dflt=n
2955 case "$knowitall" in
2956 '')
2957         if test -f ../config.sh; then
2958                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2959                         eval "`grep myuname= ../config.sh`"
2960                 fi
2961                 if test "X$myuname" = "X$newmyuname"; then
2962                         dflt=y
2963                 fi
2964         fi
2965         ;;
2966 *) dflt=y;;
2967 esac
2968
2969 : Get old answers from old config file if Configure was run on the
2970 : same system, otherwise use the hints.
2971 hint=default
2972 cd ..
2973 if test -f config.sh; then
2974         echo " "
2975         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2976         . UU/myread
2977         case "$ans" in
2978         n*|N*) echo "OK, I'll ignore it."
2979                 mv config.sh config.sh.old
2980                 myuname="$newmyuname"
2981                 ;;
2982         *)  echo "Fetching default answers from your old config.sh file..." >&4
2983                 tmp_n="$n"
2984                 tmp_c="$c"
2985                 tmp_sh="$sh"
2986                 . ./config.sh
2987                 cp config.sh UU
2988                 n="$tmp_n"
2989                 c="$tmp_c"
2990                 : Older versions did not always set $sh.  Catch re-use of such
2991                 : an old config.sh.
2992                 case "$sh" in
2993                 '') sh="$tmp_sh" ;;
2994                 esac
2995                 hint=previous
2996                 ;;
2997         esac
2998 fi
2999 . ./UU/checkcc
3000 if test ! -f config.sh; then
3001         $cat <<EOM
3002
3003 First time through, eh?  I have some defaults handy for some systems
3004 that need some extra help getting the Configure answers right:
3005
3006 EOM
3007         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3008         dflt=''
3009         : Half the following guesses are probably wrong... If you have better
3010         : tests or hints, please send them to perlbug@perl.org
3011         : The metaconfig authors would also appreciate a copy...
3012         $test -f /irix && osname=irix
3013         $test -f /xenix && osname=sco_xenix
3014         $test -f /dynix && osname=dynix
3015         $test -f /dnix && osname=dnix
3016         $test -f /lynx.os && osname=lynxos
3017         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3018         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3019         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3020         $test -f /bin/mips && /bin/mips && osname=mips
3021         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3022                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3023         $test -d /usr/apollo/bin && osname=apollo
3024         $test -f /etc/saf/_sactab && osname=svr4
3025         $test -d /usr/include/minix && osname=minix
3026         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3027         if $test -d /MachTen -o -d /MachTen_Folder; then
3028                 osname=machten
3029                 if $test -x /sbin/version; then
3030                         osvers=`/sbin/version | $awk '{print $2}' |
3031                         $sed -e 's/[A-Za-z]$//'`
3032                 elif $test -x /usr/etc/version; then
3033                         osvers=`/usr/etc/version | $awk '{print $2}' |
3034                         $sed -e 's/[A-Za-z]$//'`
3035                 else
3036                         osvers="$2.$3"
3037                 fi
3038         fi
3039
3040         $test -f /sys/posix.dll &&
3041                 $test -f /usr/bin/what &&
3042                 set X `/usr/bin/what /sys/posix.dll` &&
3043                 $test "$3" = UWIN &&
3044                 osname=uwin &&
3045                 osvers="$5"
3046
3047         if $test -f $uname; then
3048                 set X $myuname
3049                 shift
3050
3051                 case "$5" in
3052                 fps*) osname=fps ;;
3053                 mips*)
3054                         case "$4" in
3055                         umips) osname=umips ;;
3056                         *) osname=mips ;;
3057                         esac;;
3058                 [23]100) osname=mips ;;
3059                 next*) osname=next ;;
3060                 i386*)
3061                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3062                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3063                                 osname='sco'
3064                                 osvers=$tmp
3065                         elif $test -f /etc/kconfig; then
3066                                 osname=isc
3067                                 if test "$lns" = "$ln -s"; then
3068                                         osvers=4
3069                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3070                                         osvers=3
3071                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3072                                         osvers=2
3073                                 fi
3074                         fi
3075                         tmp=''
3076                         ;;
3077                 pc*)
3078                         if test -n "$DJGPP"; then
3079                                 osname=dos
3080                                 osvers=djgpp
3081                         fi
3082                         ;;
3083                 esac
3084
3085                 case "$1" in
3086                 aix) osname=aix
3087                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3088                         case "$tmp" in
3089                         # oslevel can fail with:
3090                         # oslevel: Unable to acquire lock.
3091                         *not\ found) osvers="$4"."$3" ;;
3092                         '<3240'|'<>3240') osvers=3.2.0 ;;
3093                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3094                         '=3250'|'>3250') osvers=3.2.5 ;;
3095                         *) osvers=$tmp;;
3096                         esac
3097                         ;;
3098                 bsd386) osname=bsd386
3099                         osvers=`$uname -r`
3100                         ;;
3101                 cygwin*) osname=cygwin
3102                         osvers="$3"
3103                         ;;
3104                 *dc.osx) osname=dcosx
3105                         osvers="$3"
3106                         ;;
3107                 dnix) osname=dnix
3108                         osvers="$3"
3109                         ;;
3110                 domainos) osname=apollo
3111                         osvers="$3"
3112                         ;;
3113                 dgux)   osname=dgux 
3114                         osvers="$3"
3115                         ;;
3116                 dynixptx*) osname=dynixptx
3117                         osvers=`echo "$4"|sed 's/^v//'`
3118                         ;;
3119                 freebsd) osname=freebsd 
3120                         osvers="$3" ;;
3121                 genix)  osname=genix ;;
3122                 gnu)    osname=gnu
3123                         osvers="$3" ;;
3124                 hp*)    osname=hpux 
3125                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3126                         ;;
3127                 irix*)  osname=irix
3128                         case "$3" in
3129                         4*) osvers=4 ;;
3130                         5*) osvers=5 ;;
3131                         *)      osvers="$3" ;;
3132                         esac
3133                         ;;
3134                 linux)  osname=linux
3135                         case "$3" in
3136                         *)      osvers="$3" ;;
3137                         esac
3138                         ;;
3139                 MiNT)   osname=mint
3140                         ;;
3141                 netbsd*) osname=netbsd
3142                         osvers="$3"
3143                         ;;
3144                 news-os) osvers="$3"
3145                         case "$3" in
3146                         4*) osname=newsos4 ;;
3147                         *) osname=newsos ;;
3148                         esac
3149                         ;;
3150                 next*) osname=next ;;
3151                 nonstop-ux) osname=nonstopux ;;
3152                 openbsd) osname=openbsd
3153                         osvers="$3"
3154                         ;;
3155                 os2)    osname=os2
3156                         osvers="$4"
3157                         ;;
3158                 POSIX-BC | posix-bc ) osname=posix-bc
3159                         osvers="$3"
3160                         ;;
3161                 powerux | power_ux | powermax_os | powermaxos | \
3162                 powerunix | power_unix) osname=powerux
3163                         osvers="$3"
3164                         ;;
3165                 qnx) osname=qnx
3166                         osvers="$4"
3167                         ;;
3168                 solaris) osname=solaris
3169                         case "$3" in
3170                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3171                         *)      osvers="$3" ;;
3172                         esac
3173                         ;;
3174                 sunos) osname=sunos
3175                         case "$3" in
3176                         5*) osname=solaris
3177                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3178                         *)      osvers="$3" ;;
3179                         esac
3180                         ;;
3181                 titanos) osname=titanos
3182                         case "$3" in
3183                         1*) osvers=1 ;;
3184                         2*) osvers=2 ;;
3185                         3*) osvers=3 ;;
3186                         4*) osvers=4 ;;
3187                         *)      osvers="$3" ;;
3188                         esac
3189                         ;;
3190                 ultrix) osname=ultrix
3191                         osvers="$3"
3192                         ;;
3193                 osf1|mls+)      case "$5" in
3194                                 alpha)
3195                                         osname=dec_osf
3196                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3197                                         case "$osvers" in
3198                                         [1-9].[0-9]*) ;;
3199                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3200                                         esac
3201                                         ;;
3202                         hp*)    osname=hp_osf1  ;;
3203                         mips)   osname=mips_osf1 ;;
3204                         esac
3205                         ;;
3206                 # UnixWare 7.1.2 is known as Open UNIX 8
3207                 openunix|unixware) osname=svr5
3208                         osvers="$4"
3209                         ;;
3210                 uts)    osname=uts
3211                         osvers="$3"
3212                         ;;
3213                 vos) osvers="$3"
3214                         ;;
3215                 $2) case "$osname" in
3216                         *isc*) ;;
3217                         *freebsd*) ;;
3218                         svr*)
3219                                 : svr4.x or possibly later
3220                                 case "svr$3" in 
3221                                 ${osname}*)
3222                                         osname=svr$3
3223                                         osvers=$4
3224                                         ;;
3225                                 esac
3226                                 case "$osname" in
3227                                 svr4.0)
3228                                         : Check for ESIX
3229                                         if test -f /stand/boot ; then
3230                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3231                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3232                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3233                                                         if test -n "$isesix"; then
3234                                                                 osname=esix4
3235                                                         fi
3236                                                 fi
3237                                         fi
3238                                         ;;
3239                                 esac
3240                                 ;;
3241                         *)      if test -f /etc/systemid; then
3242                                         osname=sco
3243                                         set `echo $3 | $sed 's/\./ /g'` $4
3244                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3245                                                 osvers=$1.$2.$3
3246                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3247                                                 osvers=$1.$2
3248                                         elif $test -f $src/hints/sco_$1.sh; then
3249                                                 osvers=$1
3250                                         fi
3251                                 else
3252                                         case "$osname" in
3253                                         '') : Still unknown.  Probably a generic Sys V.
3254                                                 osname="sysv"
3255                                                 osvers="$3"
3256                                                 ;;
3257                                         esac
3258                                 fi
3259                                 ;;
3260                         esac
3261                         ;;
3262                 *)      case "$osname" in
3263                         '') : Still unknown.  Probably a generic BSD.
3264                                 osname="$1"
3265                                 osvers="$3"
3266                                 ;;
3267                         esac
3268                         ;;
3269                 esac
3270         else
3271                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3272                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3273                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3274                                 osname=news_os
3275                         fi
3276                         $rm -f UU/kernel.what
3277                 elif test -d c:/. -o -n "$is_os2" ; then
3278                         set X $myuname
3279                         osname=os2
3280                         osvers="$5"
3281                 fi
3282         fi
3283         
3284         case "$targetarch" in
3285         '') ;;
3286         *)  hostarch=$osname
3287             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3288             osvers=''
3289             ;;
3290         esac
3291
3292         : Now look for a hint file osname_osvers, unless one has been
3293         : specified already.
3294         case "$hintfile" in
3295         ''|' ')
3296                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3297                 : Also try without trailing minor version numbers.
3298                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3299                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3300                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3301                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3302                 case "$file" in
3303                 '') dflt=none ;;
3304                 *)  case "$osvers" in
3305                         '') dflt=$file
3306                                 ;;
3307                         *)  if $test -f $src/hints/$file.sh ; then
3308                                         dflt=$file
3309                                 elif $test -f $src/hints/$xfile.sh ; then
3310                                         dflt=$xfile
3311                                 elif $test -f $src/hints/$xxfile.sh ; then
3312                                         dflt=$xxfile
3313                                 elif $test -f $src/hints/$xxxfile.sh ; then
3314                                         dflt=$xxxfile
3315                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3316                                         dflt=$xxxxfile
3317                                 elif $test -f "$src/hints/${osname}.sh" ; then
3318                                         dflt="${osname}"
3319                                 else
3320                                         dflt=none
3321                                 fi
3322                                 ;;
3323                         esac
3324                         ;;
3325                 esac
3326                 if $test -f Policy.sh ; then
3327                         case "$dflt" in
3328                         *Policy*) ;;
3329                         none) dflt="Policy" ;;
3330                         *) dflt="Policy $dflt" ;;
3331                         esac
3332                 fi
3333                 ;;
3334         *)
3335                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3336                 ;;
3337         esac
3338
3339         if $test -f Policy.sh ; then
3340                 $cat <<EOM
3341
3342 There's also a Policy hint file available, which should make the
3343 site-specific (policy) questions easier to answer.
3344 EOM
3345
3346         fi
3347
3348         $cat <<EOM
3349
3350 You may give one or more space-separated answers, or "none" if appropriate.
3351 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3352 is a good thing.  DO NOT give a wrong version or a wrong OS.
3353
3354 EOM
3355
3356         rp="Which of these apply, if any?"
3357         . UU/myread
3358         tans=$ans
3359         for file in $tans; do
3360                 if $test X$file = XPolicy -a -f Policy.sh; then
3361                         . Policy.sh
3362                         $cat Policy.sh >> UU/config.sh
3363                 elif $test -f $src/hints/$file.sh; then
3364                         . $src/hints/$file.sh
3365                         $cat $src/hints/$file.sh >> UU/config.sh
3366                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3367                         : nothing
3368                 else
3369                         : Give one chance to correct a possible typo.
3370                         echo "$file.sh does not exist"
3371                         dflt=$file
3372                         rp="hint to use instead?"
3373                         . UU/myread
3374                         for file in $ans; do
3375                                 if $test -f "$src/hints/$file.sh"; then
3376                                         . $src/hints/$file.sh
3377                                         $cat $src/hints/$file.sh >> UU/config.sh
3378                                 elif $test X$ans = X -o X$ans = Xnone ; then
3379                                         : nothing
3380                                 else
3381                                         echo "$file.sh does not exist -- ignored."
3382                                 fi
3383                         done
3384                 fi
3385         done
3386
3387         hint=recommended
3388         : Remember our hint file for later.
3389         if $test -f "$src/hints/$file.sh" ; then
3390                 hintfile="$file"
3391         else
3392                 hintfile=''
3393         fi
3394 fi
3395 cd UU
3396 ;;
3397 *)
3398         echo " "
3399         echo "Fetching default answers from $config_sh..." >&4
3400         tmp_n="$n"
3401         tmp_c="$c"
3402         cd ..
3403         cp $config_sh config.sh 2>/dev/null
3404         chmod +w config.sh
3405         . ./config.sh
3406         cd UU
3407         cp ../config.sh .
3408         n="$tmp_n"
3409         c="$tmp_c"
3410         hint=previous
3411         ;;
3412 esac
3413 test "$override" && . ./optdef.sh
3414
3415 : Restore computed paths
3416 for file in $loclist $trylist; do
3417         eval $file="\$_$file"
3418 done
3419
3420 cat << EOM
3421
3422 Configure uses the operating system name and version to set some defaults.
3423 The default value is probably right if the name rings a bell. Otherwise,
3424 since spelling matters for me, either accept the default or answer "none"
3425 to leave it blank.
3426
3427 EOM
3428 case "$osname" in
3429         ''|' ')
3430                 case "$hintfile" in
3431                 ''|' '|none) dflt=none ;;
3432                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3433                 esac
3434                 ;;
3435         *) dflt="$osname" ;;
3436 esac
3437 rp="Operating system name?"
3438 . ./myread
3439 case "$ans" in
3440 none)  osname='' ;;
3441 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3442 esac
3443 echo " "
3444 case "$osvers" in
3445         ''|' ')
3446                 case "$hintfile" in
3447                 ''|' '|none) dflt=none ;;
3448                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3449                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3450                         case "$dflt" in
3451                         ''|' ') dflt=none ;;
3452                         esac
3453                         ;;
3454                 esac
3455                 ;;
3456         *) dflt="$osvers" ;;
3457 esac
3458 rp="Operating system version?"
3459 . ./myread
3460 case "$ans" in
3461 none)  osvers='' ;;
3462 *) osvers="$ans" ;;
3463 esac
3464
3465
3466 . ./posthint.sh
3467
3468 : who configured the system
3469 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3470 case "$cf_by" in
3471 "")
3472         cf_by=`(logname) 2>/dev/null`
3473         case "$cf_by" in
3474         "")
3475                 cf_by=`(whoami) 2>/dev/null`
3476                 case "$cf_by" in
3477                 "") cf_by=unknown ;;
3478                 esac ;;
3479         esac ;;
3480 esac
3481
3482 : set up the script used to warn in case of inconsistency
3483 cat <<EOS >whoa
3484 $startsh
3485 EOS
3486 cat <<'EOSC' >>whoa
3487 dflt=y
3488 echo " "
3489 echo "*** WHOA THERE!!! ***" >&4
3490 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3491 rp="    Keep the $hint value?"
3492 . ./myread
3493 case "$ans" in
3494 y) td=$was; tu=$was;;
3495 esac
3496 EOSC
3497
3498 : function used to set $1 to $val
3499 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3500 case "$val$was" in
3501 $define$undef) . ./whoa; eval "$var=\$td";;
3502 $undef$define) . ./whoa; eval "$var=\$tu";;
3503 *) eval "$var=$val";;
3504 esac'
3505
3506 case "$usesocks" in
3507 $define|true|[yY]*)     dflt='y';;
3508 *) dflt='n';;
3509 esac
3510 cat <<EOM
3511
3512 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3513 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3514 to use the PerlIO abstraction layer, this will be implicitly selected.
3515
3516 If this doesn't make any sense to you, just accept the default '$dflt'.
3517 EOM
3518 rp='Build Perl for SOCKS?'
3519 . ./myread
3520 case "$ans" in
3521 y|Y)    val="$define" ;;     
3522 *)      val="$undef" ;;
3523 esac
3524 set usesocks
3525 eval $setvar
3526
3527 case "$usesocks" in
3528 $define|true|[yY]*) useperlio="$define";;
3529 esac
3530
3531 case "$useperlio" in
3532 $define|true|[yY]*|'')  dflt='y';;
3533 *) dflt='n';;
3534 esac
3535 cat <<EOM
3536
3537 Previous version of $package used the standard IO mechanisms as
3538 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3539 alternate IO mechanisms via the PerlIO abstraction layer, but the
3540 stdio mechanism is still available if needed.  The abstraction layer
3541 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3542 Using PerlIO with sfio may cause problems with some extension modules.
3543
3544 If this doesn't make any sense to you, just accept the default '$dflt'.
3545 EOM
3546 rp='Use the PerlIO abstraction layer?'
3547 . ./myread
3548 case "$ans" in
3549 y|Y) 
3550         val="$define"
3551         ;;
3552 *)      
3553         echo "Ok, doing things the stdio way."
3554         val="$undef"
3555         ;;
3556 esac
3557 set useperlio
3558 eval $setvar 
3559
3560 case "$usesocks" in
3561 $define|true|[yY]*)
3562         case "$useperlio" in
3563         $define|true|[yY]*) ;;
3564         *)      cat >&4 <<EOM
3565
3566 You are using the SOCKS proxy protocol library which means that you
3567 should also use the PerlIO layer.  You may be headed for trouble.
3568
3569 EOM
3570                 ;;
3571         esac
3572         ;;
3573 esac
3574
3575         
3576 case "$usethreads" in
3577 $define|true|[yY]*)     dflt='y';;
3578 *)     # Catch case where user specified ithreads or 5005threads but
3579        # forgot -Dusethreads (A.D. 4/2002)
3580        case "$useithreads$use5005threads" in
3581        *$define*)      
3582                 case "$useperlio" in
3583                 "$define")      dflt='y' ;;
3584                 *)              dflt='n' ;;
3585                 esac
3586                 ;;
3587        *)       dflt='n';;
3588        esac
3589        ;;
3590 esac
3591 cat <<EOM
3592
3593 Perl can be built to take advantage of threads on some systems.
3594 To do so, Configure can be run with -Dusethreads.
3595
3596 Note that Perl built with threading support runs slightly slower
3597 and uses more memory than plain Perl. The current implementation
3598 is believed to be stable, but it is fairly new, and so should be
3599 treated with caution.
3600
3601 If this doesn't make any sense to you, just accept the default '$dflt'.
3602 EOM
3603 rp='Build a threading Perl?'
3604 . ./myread
3605 case "$ans" in
3606 y|Y)    val="$define" ;;
3607 *)      val="$undef" ;;
3608 esac
3609 set usethreads
3610 eval $setvar
3611
3612 case "$usethreads" in
3613 $define)
3614         $cat <<EOM
3615
3616 Since release 5.6, Perl has had two different threading implementations,
3617 the newer interpreter-based version (ithreads) with one interpreter per
3618 thread, and the older 5.005 version (5005threads).
3619 The 5005threads version is effectively unmaintained and will probably be
3620 removed in Perl 5.10, so there should be no need to build a Perl using it
3621 unless needed for backwards compatibility with some existing 5.005threads
3622 code.
3623
3624 EOM
3625         : Default to ithreads unless overridden on command line or with
3626         : old config.sh
3627         dflt='y'
3628         case "$use5005threads" in
3629                 $define|true|[yY]*) dflt='n';;
3630         esac
3631         case "$useithreads" in
3632                 $undef|false|[nN]*) dflt='n';;
3633         esac
3634         rp='Use the newer interpreter-based ithreads?'
3635         . ./myread
3636         case "$ans" in
3637         y|Y)    val="$define" ;;
3638         *)      val="$undef" ;;
3639         esac
3640         set useithreads
3641         eval $setvar
3642         : Now set use5005threads to the opposite value.
3643         case "$useithreads" in
3644         $define) val="$undef" ;;
3645         *) val="$define" ;;
3646         esac
3647         set use5005threads
3648         eval $setvar
3649         ;;
3650 *)
3651         useithreads="$undef"
3652         use5005threads="$undef"
3653         ;;
3654 esac
3655
3656 case "$useithreads$use5005threads" in
3657 "$define$define")
3658         $cat >&4 <<EOM
3659
3660 You cannot have both the ithreads and the 5.005 threads enabled
3661 at the same time.  Disabling the 5.005 threads since they are
3662 much less stable than the ithreads.
3663
3664 EOM
3665         use5005threads="$undef"
3666         ;;
3667 esac
3668
3669 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3670         cat >&4 <<EOF
3671 ***
3672 *** To build with ithreads you must also use the PerlIO layer.
3673 *** Cannot continue, aborting.
3674 ***
3675 EOF
3676         exit 1
3677 fi
3678
3679 case "$d_oldpthreads" in
3680 '')     : Configure tests would be welcome here.  For now, assume undef.
3681         val="$undef" ;;
3682 *)      val="$d_oldpthreads" ;;
3683 esac
3684 set d_oldpthreads
3685 eval $setvar
3686
3687
3688 : Look for a hint-file generated 'call-back-unit'.  If the
3689 : user has specified that a threading perl is to be built,
3690 : we may need to set or change some other defaults.
3691 if $test -f usethreads.cbu; then
3692     echo "Your platform has some specific hints regarding threaded builds, using them..."
3693     . ./usethreads.cbu
3694 else
3695     case "$usethreads" in
3696         "$define"|true|[yY]*)
3697                 $cat <<EOM
3698 (Your platform does not have any specific hints for threaded builds.
3699  Assuming POSIX threads, then.)
3700 EOM
3701         ;;
3702     esac
3703 fi
3704
3705 cat <<EOM
3706
3707 Perl can be built so that multiple Perl interpreters can coexist
3708 within the same Perl executable.
3709 EOM
3710
3711 case "$useithreads" in
3712 $define)
3713         cat <<EOM
3714 This multiple interpreter support is required for interpreter-based threads.
3715 EOM
3716         val="$define"
3717         ;;
3718 *)      case "$usemultiplicity" in
3719         $define|true|[yY]*)     dflt='y';;
3720         *) dflt='n';;
3721         esac
3722         echo " "
3723         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3724         rp='Build Perl for multiplicity?'
3725         . ./myread
3726         case "$ans" in
3727         y|Y)    val="$define" ;;
3728         *)      val="$undef" ;;
3729         esac
3730         ;;
3731 esac
3732 set usemultiplicity
3733 eval $setvar
3734
3735
3736 case "$usemorebits" in
3737 "$define"|true|[yY]*)
3738         use64bitint="$define"
3739         uselongdouble="$define"
3740         usemorebits="$define"
3741         ;;
3742 *)      usemorebits="$undef"
3743         ;;
3744 esac
3745
3746 : make some quick guesses about what we are up against
3747 echo " "
3748 $echo $n "Hmm...  $c"
3749 echo exit 1 >bsd
3750 echo exit 1 >usg
3751 echo exit 1 >v7
3752 echo exit 1 >osf1
3753 echo exit 1 >eunice
3754 echo exit 1 >xenix
3755 echo exit 1 >venix
3756 echo exit 1 >os2
3757 d_bsd="$undef"
3758 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3759 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3760 then
3761         echo "Looks kind of like an OSF/1 system, but we'll see..."
3762         echo exit 0 >osf1
3763 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3764         xxx=`./loc addbib blurfl $pth`
3765         if $test -f $xxx; then
3766         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3767                 echo exit 0 >bsd
3768                 echo exit 0 >usg
3769         else
3770                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3771                         echo "Looks kind of like an extended USG system, but we'll see..."
3772                 else
3773                         echo "Looks kind of like a USG system, but we'll see..."
3774                 fi
3775                 echo exit 0 >usg
3776         fi
3777 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3778         echo "Looks kind of like a BSD system, but we'll see..."
3779         d_bsd="$define"
3780         echo exit 0 >bsd
3781 else
3782         echo "Looks kind of like a Version 7 system, but we'll see..."
3783         echo exit 0 >v7
3784 fi
3785 case "$eunicefix" in
3786 *unixtovms*)
3787         $cat <<'EOI'
3788 There is, however, a strange, musty smell in the air that reminds me of
3789 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3790 EOI
3791         echo exit 0 >eunice
3792         d_eunice="$define"
3793 : it so happens the Eunice I know will not run shell scripts in Unix format
3794         ;;
3795 *)
3796         echo " "
3797         echo "Congratulations.  You aren't running Eunice."
3798         d_eunice="$undef"
3799         ;;
3800 esac
3801 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3802 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3803 : semicolon as a patch separator
3804 case "$p_" in
3805 :) ;;
3806 *)
3807         $cat <<'EOI'
3808 I have the feeling something is not exactly right, however...don't tell me...
3809 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3810 (Or you may be running DOS with DJGPP.)
3811 EOI
3812         echo exit 0 >os2
3813         ;;
3814 esac
3815 if test -f /xenix; then
3816         echo "Actually, this looks more like a XENIX system..."
3817         echo exit 0 >xenix
3818         d_xenix="$define"
3819 else
3820         echo " "
3821         echo "It's not Xenix..."
3822         d_xenix="$undef"
3823 fi
3824 chmod +x xenix
3825 $eunicefix xenix
3826 if test -f /venix; then
3827         echo "Actually, this looks more like a VENIX system..."
3828         echo exit 0 >venix
3829 else
3830         echo " "
3831         if ./xenix; then
3832                 : null
3833         else
3834                 echo "Nor is it Venix..."
3835         fi
3836 fi
3837 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3838 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3839 $rm -f foo
3840
3841 case "$cc" in
3842 '') dflt=cc;;
3843 *) dflt="$cc";;
3844 esac
3845 rp="Use which C compiler?"
3846 . ./myread
3847 cc="$ans"
3848
3849 : See if they have not cc but they do have gcc
3850 . ./trygcc
3851 : Look for a hint-file generated 'call-back-unit'.  Now that the
3852 : user has specified the compiler, we may need to set or change some
3853 : other defaults.
3854 if $test -f cc.cbu; then
3855     . ./cc.cbu
3856 fi
3857 . ./checkcc
3858
3859 echo " "
3860 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3861 $cat >try.c <<EOM
3862 #include <stdio.h>
3863 int main() {
3864 #ifdef __GNUC__
3865 #ifdef __VERSION__
3866         printf("%s\n", __VERSION__);
3867 #else
3868         printf("%s\n", "1");
3869 #endif
3870 #endif
3871         return(0);
3872 }
3873 EOM
3874 if $cc -o try $ccflags $ldflags try.c; then
3875         gccversion=`$run ./try`
3876         case "$gccversion" in
3877         '') echo "You are not using GNU cc." ;;
3878         *)  echo "You are using GNU cc $gccversion."
3879             ccname=gcc
3880             ;;
3881         esac
3882 else
3883         echo " "
3884         echo "*** WHOA THERE!!! ***" >&4
3885         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3886         case "$knowitall" in
3887         '')
3888         echo "    You'd better start hunting for one and let me know about it." >&4
3889                 exit 1
3890                 ;;
3891         esac
3892 fi
3893 $rm -f try try.*
3894 case "$gccversion" in
3895 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3896 esac
3897 case "$gccversion" in
3898 '') gccosandvers='' ;;
3899 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3900    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3901    gccshortvers=''
3902    case "$gccosandvers" in
3903    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3904    $osname$osvers) ;; # looking good
3905    $osname*) cat <<EOM >&4
3906
3907 *** WHOA THERE!!! ***
3908
3909     Your gcc has not been compiled for the exact release of
3910     your operating system ($gccosandvers versus $osname$osvers).
3911
3912     In general it is a good idea to keep gcc synchronized with
3913     the operating system because otherwise serious problems
3914     may ensue when trying to compile software, like Perl.
3915
3916     I'm trying to be optimistic here, though, and will continue.
3917     If later during the configuration and build icky compilation
3918     problems appear (headerfile conflicts being the most common
3919     manifestation), I suggest reinstalling the gcc to match
3920     your operating system release.
3921
3922 EOM
3923       ;;
3924    *) gccosandvers='' ;; # failed to parse, better be silent
3925    esac
3926    ;;
3927 esac
3928 case "$ccname" in
3929 '') ccname="$cc" ;;
3930 esac
3931
3932 # gcc 3.* complain about adding -Idirectories that they already know about,
3933 # so we will take those off from locincpth.
3934 case "$gccversion" in
3935 3*)
3936     echo "main(){}">try.c
3937     for incdir in $locincpth; do
3938        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3939              grep '^c[cp]p*[01]: warning: changing search order '`
3940        if test "X$warn" != X; then
3941            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3942        fi
3943     done
3944     $rm -f try try.*
3945 esac
3946
3947 : decide how portable to be.  Allow command line overrides.
3948 case "$d_portable" in
3949 "$undef") ;;
3950 *)      d_portable="$define" ;;
3951 esac
3952
3953 : set up shell script to do ~ expansion
3954 cat >filexp <<EOSS
3955 $startsh
3956 : expand filename
3957 case "\$1" in
3958  ~/*|~)
3959         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3960         ;;
3961  ~*)
3962         if $test -f /bin/csh; then
3963                 /bin/csh -f -c "glob \$1"
3964                 failed=\$?
3965                 echo ""
3966                 exit \$failed
3967         else
3968                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3969                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3970                 if $test ! -d "\$dir"; then
3971                         me=\`basename \$0\`
3972                         echo "\$me: can't locate home directory for: \$name" >&2
3973                         exit 1
3974                 fi
3975                 case "\$1" in
3976                 */*)
3977                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3978                         ;;
3979                 *)
3980                         echo \$dir
3981                         ;;
3982                 esac
3983         fi
3984         ;;
3985 *)
3986         echo \$1
3987         ;;
3988 esac
3989 EOSS
3990 chmod +x filexp
3991 $eunicefix filexp
3992
3993 : now set up to get a file name
3994 cat <<EOS >getfile
3995 $startsh
3996 EOS
3997 cat <<'EOSC' >>getfile
3998 tilde=''
3999 fullpath=''
4000 already=''
4001 skip=''
4002 none_ok=''
4003 exp_file=''
4004 nopath_ok=''
4005 orig_rp="$rp"
4006 orig_dflt="$dflt"
4007 case "$gfpth" in
4008 '') gfpth='.' ;;
4009 esac
4010
4011 case "$fn" in
4012 *\(*)
4013         : getfile will accept an answer from the comma-separated list
4014         : enclosed in parentheses even if it does not meet other criteria.
4015         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4016         fn=`echo $fn | sed 's/(.*)//'`
4017         ;;
4018 esac
4019
4020 case "$fn" in
4021 *:*)
4022         loc_file=`expr $fn : '.*:\(.*\)'`
4023         fn=`expr $fn : '\(.*\):.*'`
4024         ;;
4025 esac
4026
4027 case "$fn" in
4028 *~*) tilde=true;;
4029 esac
4030 case "$fn" in
4031 */*) fullpath=true;;
4032 esac
4033 case "$fn" in
4034 *+*) skip=true;;
4035 esac
4036 case "$fn" in
4037 *n*) none_ok=true;;
4038 esac
4039 case "$fn" in
4040 *e*) exp_file=true;;
4041 esac
4042 case "$fn" in
4043 *p*) nopath_ok=true;;
4044 esac
4045
4046 case "$fn" in
4047 *f*) type='File';;
4048 *d*) type='Directory';;
4049 *l*) type='Locate';;
4050 esac
4051
4052 what="$type"
4053 case "$what" in
4054 Locate) what='File';;
4055 esac
4056
4057 case "$exp_file" in
4058 '')
4059         case "$d_portable" in
4060         "$define") ;;
4061         *) exp_file=true;;
4062         esac
4063         ;;
4064 esac
4065
4066 cd ..
4067 while test "$type"; do
4068         redo=''
4069         rp="$orig_rp"
4070         dflt="$orig_dflt"
4071         case "$tilde" in
4072         true) rp="$rp (~name ok)";;
4073         esac
4074         . UU/myread
4075         if test -f UU/getfile.ok && \
4076                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4077         then
4078                 value="$ans"
4079                 ansexp="$ans"
4080                 break
4081         fi
4082         case "$ans" in
4083         none)
4084                 value=''
4085                 ansexp=''
4086                 case "$none_ok" in
4087                 true) type='';;
4088                 esac
4089                 ;;
4090         *)
4091                 case "$tilde" in
4092                 '') value="$ans"
4093                         ansexp="$ans";;
4094                 *)
4095                         value=`UU/filexp $ans`
4096                         case $? in
4097                         0)
4098                                 if test "$ans" != "$value"; then
4099                                         echo "(That expands to $value on this system.)"
4100                                 fi
4101                                 ;;
4102                         *) value="$ans";;
4103                         esac
4104                         ansexp="$value"
4105                         case "$exp_file" in
4106                         '') value="$ans";;
4107                         esac
4108                         ;;
4109                 esac
4110                 case "$fullpath" in
4111                 true)
4112                         case "$ansexp" in
4113                         /*) value="$ansexp" ;;
4114                         [a-zA-Z]:/*) value="$ansexp" ;;
4115                         *)
4116                                 redo=true
4117                                 case "$already" in
4118                                 true)
4119                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4120                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4121                                         ;;
4122                                 *)
4123                                 echo "Please give a full path name, starting with slash." >&4
4124                                         case "$tilde" in
4125                                         true)
4126                                 echo "Note that using ~name is ok provided it expands well." >&4
4127                                                 already=true
4128                                                 ;;
4129                                         esac
4130                                 esac
4131                                 ;;
4132                         esac
4133                         ;;
4134                 esac
4135                 case "$redo" in
4136                 '')
4137                         case "$type" in
4138                         File)
4139                                 for fp in $gfpth; do
4140                                         if test "X$fp" = X.; then
4141                                             pf="$ansexp"
4142                                         else    
4143                                             pf="$fp/$ansexp"
4144                                         fi
4145                                         if test -f "$pf"; then
4146                                                 type=''
4147                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4148                                         then
4149                                                 echo "($value is not a plain file, but that's ok.)"
4150                                                 type=''
4151                                         fi
4152                                         if test X"$type" = X; then
4153                                             value="$pf"
4154                                             break
4155                                         fi
4156                                 done
4157                                 ;;
4158                         Directory)
4159                                 for fp in $gfpth; do
4160                                         if test "X$fp" = X.; then
4161                                             dir="$ans"
4162                                             direxp="$ansexp"
4163                                         else    
4164                                             dir="$fp/$ansexp"
4165                                             direxp="$fp/$ansexp"
4166                                         fi
4167                                         if test -d "$direxp"; then
4168                                                 type=''
4169                                                 value="$dir"
4170                                                 break
4171                                         fi
4172                                 done
4173                                 ;;
4174                         Locate)
4175                                 if test -d "$ansexp"; then
4176                                         echo "(Looking for $loc_file in directory $value.)"
4177                                         value="$value/$loc_file"
4178                                         ansexp="$ansexp/$loc_file"
4179                                 fi
4180                                 if test -f "$ansexp"; then
4181                                         type=''
4182                                 fi
4183                                 case "$nopath_ok" in
4184                                 true)   case "$value" in
4185                                         */*) ;;
4186                                         *)      echo "Assuming $value will be in people's path."
4187                                                 type=''
4188                                                 ;;
4189                                         esac
4190                                         ;;
4191                                 esac
4192                                 ;;
4193                         esac
4194
4195                         case "$skip" in
4196                         true) type='';
4197                         esac
4198
4199                         case "$type" in
4200                         '') ;;
4201                         *)
4202                                 if test "$fastread" = yes; then
4203                                         dflt=y
4204                                 else
4205                                         dflt=n
4206                                 fi
4207                                 rp="$what $value doesn't exist.  Use that name anyway?"
4208                                 . UU/myread
4209                                 dflt=''
4210                                 case "$ans" in
4211                                 y*) type='';;
4212                                 *) echo " ";;
4213                                 esac
4214                                 ;;
4215                         esac
4216                         ;;
4217                 esac
4218                 ;;
4219         esac
4220 done
4221 cd UU
4222 ans="$value"
4223 rp="$orig_rp"
4224 dflt="$orig_dflt"
4225 rm -f getfile.ok
4226 test "X$gfpthkeep" != Xy && gfpth=""
4227 EOSC
4228
4229 : What should the include directory be ?
4230 echo " "
4231 $echo $n "Hmm...  $c"
4232 dflt='/usr/include'
4233 incpath=''
4234 mips_type=''
4235 if $test -f /bin/mips && /bin/mips; then
4236         echo "Looks like a MIPS system..."
4237         $cat >usr.c <<'EOCP'
4238 #ifdef SYSTYPE_BSD43
4239 /bsd43
4240 #endif
4241 EOCP
4242         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4243                 dflt='/bsd43/usr/include'
4244                 incpath='/bsd43'
4245                 mips_type='BSD 4.3'
4246         else
4247                 mips_type='System V'
4248         fi
4249         $rm -f usr.c usr.out
4250         echo "and you're compiling with the $mips_type compiler and libraries."
4251         xxx_prompt=y
4252         echo "exit 0" >mips
4253 else
4254         echo "Doesn't look like a MIPS system."
4255         xxx_prompt=n
4256         echo "exit 1" >mips
4257 fi
4258 chmod +x mips
4259 $eunicefix mips
4260 case "$usrinc" in
4261 '') ;;
4262 *) dflt="$usrinc";;
4263 esac
4264 case "$xxx_prompt" in
4265 y)      fn=d/
4266         echo " "
4267         rp='Where are the include files you want to use?'
4268         . ./getfile
4269         usrinc="$ans"
4270         ;;
4271 *)      usrinc="$dflt"
4272         ;;
4273 esac
4274
4275 : see how we invoke the C preprocessor
4276 echo " "
4277 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4278 cat <<'EOT' >testcpp.c
4279 #define ABC abc
4280 #define XYZ xyz
4281 ABC.XYZ
4282 EOT
4283 cd ..
4284 if test ! -f cppstdin; then
4285         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4286                 # AIX cc -E doesn't show the absolute headerfile
4287                 # locations but we'll cheat by using the -M flag.
4288                 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
4289         else
4290                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4291         fi
4292 else
4293         echo "Keeping your $hint cppstdin wrapper."
4294 fi
4295 chmod 755 cppstdin
4296 wrapper=`pwd`/cppstdin
4297 ok='false'
4298 cd UU
4299
4300 if $test "X$cppstdin" != "X" && \
4301         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4302         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4303 then
4304         echo "You used to use $cppstdin $cppminus so we'll use that again."
4305         case "$cpprun" in
4306         '') echo "But let's see if we can live without a wrapper..." ;;
4307         *)
4308                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4309                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4310                 then
4311                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4312                         ok='true'
4313                 else
4314                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4315                 fi
4316                 ;;
4317         esac
4318 else
4319         case "$cppstdin" in
4320         '') ;;
4321         *)
4322                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4323                 ;;
4324         esac
4325 fi
4326
4327 if $ok; then
4328         : nothing
4329 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4330         $cc -E <testcpp.c >testcpp.out 2>&1; \
4331         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4332         echo "Yup, it does."
4333         x_cpp="$cc -E"
4334         x_minus='';
4335 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4336         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4337         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4338         echo "Yup, it does."
4339         x_cpp="$cc -E"
4340         x_minus='-';
4341 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4342         $cc -P <testcpp.c >testcpp.out 2>&1; \
4343         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4344         echo "Yipee, that works!"
4345         x_cpp="$cc -P"
4346         x_minus='';
4347 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4348         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4349         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350         echo "At long last!"
4351         x_cpp="$cc -P"
4352         x_minus='-';
4353 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4354         $cpp <testcpp.c >testcpp.out 2>&1; \
4355         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4356         echo "It works!"
4357         x_cpp="$cpp"
4358         x_minus='';
4359 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4360         $cpp - <testcpp.c >testcpp.out 2>&1; \
4361         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4362         echo "Hooray, it works!  I was beginning to wonder."
4363         x_cpp="$cpp"
4364         x_minus='-';
4365 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4366         $wrapper <testcpp.c >testcpp.out 2>&1; \
4367         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4368         x_cpp="$wrapper"
4369         x_minus=''
4370         echo "Eureka!"
4371 else
4372         dflt=''
4373         rp="No dice.  I can't find a C preprocessor.  Name one:"
4374         . ./myread
4375         x_cpp="$ans"
4376         x_minus=''
4377         $x_cpp <testcpp.c >testcpp.out 2>&1
4378         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4379                 echo "OK, that will do." >&4
4380         else
4381 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4382                 exit 1
4383         fi
4384 fi
4385
4386 case "$ok" in
4387 false)
4388         cppstdin="$x_cpp"
4389         cppminus="$x_minus"
4390         cpprun="$x_cpp"
4391         cpplast="$x_minus"
4392         set X $x_cpp
4393         shift
4394         case "$1" in
4395         "$cpp")
4396                 echo "Perhaps can we force $cc -E using a wrapper..."
4397                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4398                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4399                 then
4400                         echo "Yup, we can."
4401                         cppstdin="$wrapper"
4402                         cppminus='';
4403                 else
4404                         echo "Nope, we'll have to live without it..."
4405                 fi
4406                 ;;
4407         esac
4408         case "$cpprun" in
4409         "$wrapper")
4410                 cpprun=''
4411                 cpplast=''
4412                 ;;
4413         esac
4414         ;;
4415 esac
4416
4417 case "$cppstdin" in
4418 "$wrapper"|'cppstdin') ;;
4419 *) $rm -f $wrapper;;
4420 esac
4421 $rm -f testcpp.c testcpp.out
4422
4423 : Set private lib path
4424 case "$plibpth" in
4425 '') if ./mips; then
4426                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4427         fi;;
4428 esac
4429 case "$libpth" in
4430 ' ') dlist='';;
4431 '') dlist="$loclibpth $plibpth $glibpth";;
4432 *) dlist="$libpth";;
4433 esac
4434
4435 : Now check and see which directories actually exist, avoiding duplicates
4436 libpth=''
4437 for xxx in $dlist
4438 do
4439     if $test -d $xxx; then
4440                 case " $libpth " in
4441                 *" $xxx "*) ;;
4442                 *) libpth="$libpth $xxx";;
4443                 esac
4444     fi
4445 done
4446 $cat <<'EOM'
4447
4448 Some systems have incompatible or broken versions of libraries.  Among
4449 the directories listed in the question below, please remove any you
4450 know not to be holding relevant libraries, and add any that are needed.
4451 Say "none" for none.
4452
4453 EOM
4454 case "$libpth" in
4455 '') dflt='none';;
4456 *)
4457         set X $libpth
4458         shift
4459         dflt=${1+"$@"}
4460         ;;
4461 esac
4462 rp="Directories to use for library searches?"
4463 . ./myread
4464 case "$ans" in
4465 none) libpth=' ';;
4466 *) libpth="$ans";;
4467 esac
4468
4469 : compute shared library extension
4470 case "$so" in
4471 '')
4472         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4473                 dflt='sl'
4474         else
4475                 dflt='so'
4476         fi
4477         ;;
4478 *) dflt="$so";;
4479 esac
4480 $cat <<EOM
4481
4482 On some systems, shared libraries may be available.  Answer 'none' if
4483 you want to suppress searching of shared libraries for the remainder
4484 of this configuration.
4485
4486 EOM
4487 rp='What is the file extension used for shared libraries?'
4488 . ./myread
4489 so="$ans"
4490
4491 : Define several unixisms.
4492 : Hints files or command line option can be used to override them.
4493 : The convoluted testing is in case hints files set either the old
4494 : or the new name.
4495 case "$_exe" in
4496 '')     case "$exe_ext" in
4497         '')     ;;
4498         *)      _exe="$exe_ext" ;;
4499         esac
4500         ;;
4501 esac
4502 case "$_a" in
4503 '')     case "$lib_ext" in
4504     '') _a='.a';;
4505         *)      _a="$lib_ext" ;;
4506         esac
4507         ;;
4508 esac
4509 case "$_o" in
4510 '') case "$obj_ext" in
4511         '')     _o='.o';;
4512         *)      _o="$obj_ext";;
4513         esac
4514         ;;
4515 esac
4516 case "$p_" in
4517 '') case "$path_sep" in
4518         '')     p_=':';;
4519         *)      p_="$path_sep";;
4520         esac
4521         ;;
4522 esac
4523 exe_ext=$_exe
4524 lib_ext=$_a
4525 obj_ext=$_o
4526 path_sep=$p_
4527
4528 : Which makefile gets called first.  This is used by make depend.
4529 case "$firstmakefile" in
4530 '') firstmakefile='makefile';;
4531 esac
4532
4533 case "$ccflags" in
4534 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4535 esac
4536
4537 case "$uselongdouble" in
4538 $define|true|[yY]*)     dflt='y';;
4539 *) dflt='n';;
4540 esac
4541 cat <<EOM
4542
4543 Perl can be built to take advantage of long doubles which
4544 (if available) may give more accuracy and range for floating point numbers.
4545
4546 If this doesn't make any sense to you, just accept the default '$dflt'.
4547 EOM
4548 rp='Try to use long doubles if available?'
4549 . ./myread
4550 case "$ans" in
4551 y|Y)    val="$define"   ;;
4552 *)      val="$undef"    ;;
4553 esac
4554 set uselongdouble
4555 eval $setvar
4556
4557 case "$uselongdouble" in
4558 true|[yY]*) uselongdouble="$define" ;;
4559 esac
4560
4561 : Look for a hint-file generated 'call-back-unit'.  If the
4562 : user has specified that long doubles should be used,
4563 : we may need to set or change some other defaults.
4564 if $test -f uselongdouble.cbu; then
4565     echo "Your platform has some specific hints regarding long doubles, using them..."
4566     . ./uselongdouble.cbu
4567 else
4568     case "$uselongdouble" in
4569         $define)
4570                 $cat <<EOM
4571 (Your platform does not have any specific hints for long doubles.)
4572 EOM
4573         ;;
4574     esac
4575 fi
4576
4577 : Looking for optional libraries
4578 echo " "
4579 echo "Checking for optional libraries..." >&4
4580 case "$libs" in
4581 ' '|'') dflt='';;
4582 *) dflt="$libs";;
4583 esac
4584 case "$libswanted" in
4585 '') libswanted='c_s';;
4586 esac
4587 case "$usesocks" in
4588 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4589 esac
4590 libsfound=''
4591 libsfiles=''
4592 libsdirs=''
4593 libspath=''
4594 for thisdir in $libpth $xlibpth; do
4595   test -d $thisdir && libspath="$libspath $thisdir"
4596 done
4597 for thislib in $libswanted; do
4598         for thisdir in $libspath; do
4599             xxx=''
4600             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4601                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4602                 $test -f "$xxx" && eval $libscheck
4603                 $test -f "$xxx" && libstyle=shared
4604             fi
4605             if test ! -f "$xxx"; then
4606                 xxx=$thisdir/lib$thislib.$so
4607                 $test -f "$xxx" && eval $libscheck
4608                 $test -f "$xxx" && libstyle=shared
4609             fi  
4610             if test ! -f "$xxx"; then
4611                 xxx=$thisdir/lib$thislib$_a
4612                 $test -f "$xxx" && eval $libscheck
4613                 $test -f "$xxx" && libstyle=static
4614             fi
4615             if test ! -f "$xxx"; then
4616                 xxx=$thisdir/$thislib$_a
4617                 $test -f "$xxx" && eval $libscheck
4618                 $test -f "$xxx" && libstyle=static
4619             fi
4620             if test ! -f "$xxx"; then
4621                 xxx=$thisdir/lib${thislib}_s$_a
4622                 $test -f "$xxx" && eval $libscheck
4623                 $test -f "$xxx" && libstyle=static
4624                 $test -f "$xxx" && thislib=${thislib}_s
4625             fi
4626             if test ! -f "$xxx"; then
4627                 xxx=$thisdir/Slib$thislib$_a
4628                 $test -f "$xxx" && eval $libscheck
4629                 $test -f "$xxx" && libstyle=static
4630             fi
4631             if $test -f "$xxx"; then
4632                 case "$libstyle" in
4633                 shared) echo "Found -l$thislib (shared)." ;;
4634                 static) echo "Found -l$thislib." ;;
4635                 *)      echo "Found -l$thislib ($libstyle)." ;;
4636                 esac
4637                 case " $dflt " in
4638                 *"-l$thislib "*);;
4639                 *) dflt="$dflt -l$thislib"
4640                    libsfound="$libsfound $xxx"
4641                    yyy=`basename $xxx`
4642                    libsfiles="$libsfiles $yyy"
4643                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4644                    case " $libsdirs " in
4645                    *" $yyy "*) ;;
4646                    *) libsdirs="$libsdirs $yyy" ;;
4647                    esac
4648                    ;;
4649                 esac
4650                 break
4651             fi  
4652         done
4653         if $test ! -f "$xxx"; then
4654             echo "No -l$thislib."
4655         fi
4656 done
4657 set X $dflt
4658 shift
4659 dflt="$*"
4660 case "$libs" in
4661 '') dflt="$dflt";;
4662 *) dflt="$libs";;
4663 esac
4664 case "$dflt" in
4665 ' '|'') dflt='none';;
4666 esac
4667
4668 $cat <<EOM
4669
4670 In order to compile $package on your machine, a number of libraries
4671 are usually needed.  Include any other special libraries here as well.
4672 Say "none" for none.  The default list is almost always right.
4673 EOM
4674
4675 echo " "
4676 rp="What libraries to use?"
4677 . ./myread
4678 case "$ans" in
4679 none) libs=' ';;
4680 *) libs="$ans";;
4681 esac
4682
4683 : determine optimization, if desired, or use for debug flag also
4684 case "$optimize" in
4685 ' '|$undef) dflt='none';;
4686 '') dflt='-O';;
4687 *) dflt="$optimize";;
4688 esac
4689 $cat <<EOH
4690
4691 By default, $package compiles with the -O flag to use the optimizer.
4692 Alternately, you might want to use the symbolic debugger, which uses
4693 the -g flag (on traditional Unix systems).  Either flag can be
4694 specified here.  To use neither flag, specify the word "none".
4695
4696 EOH
4697 rp="What optimizer/debugger flag should be used?"
4698 . ./myread
4699 optimize="$ans"
4700 case "$optimize" in
4701 'none') optimize=" ";;
4702 esac
4703
4704 dflt=''
4705 : We will not override a previous value, but we might want to
4706 : augment a hint file
4707 case "$hint" in
4708 default|recommended)
4709         case "$gccversion" in
4710         1*) dflt='-fpcc-struct-return' ;;
4711         esac
4712         case "$optimize" in
4713         *-g*) dflt="$dflt -DDEBUGGING";;
4714         esac
4715         case "$gccversion" in
4716         2*) if test -d /etc/conf/kconfig.d &&
4717                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4718                 then
4719                         # Interactive Systems (ISC) POSIX mode.
4720                         dflt="$dflt -posix"
4721                 fi
4722                 ;;
4723         esac
4724         case "$gccversion" in
4725         1*) ;;
4726         2.[0-8]*) ;;
4727         ?*)     echo " "
4728                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4729                 echo 'int main(void) { return 0; }' > gcctest.c
4730                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4731                         echo "Yes, it does." 2>&1
4732                         case "$ccflags" in
4733                         *strict-aliasing*)
4734                                 echo "Leaving current flags $ccflags alone." 2>&1
4735                                 ;;
4736                         *) dflt="$dflt -fno-strict-aliasing" ;;
4737                         esac
4738                 else
4739                         echo "Nope, it doesn't, but that's ok." 2>&1
4740                 fi
4741                 ;;
4742         esac
4743         # For gcc, adding -pipe speeds up compilations for some, but apparently
4744         # some assemblers can't read from stdin.  (It also slows down compilations
4745         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4746         case "$gccversion" in
4747         ?*)     echo " "
4748                 echo "Checking if your compiler accepts -pipe" 2>&1
4749                 echo 'int main(void) { return 0; }' > gcctest.c
4750                 if $cc -O2 -pipe -o gcctest gcctest.c; then
4751                         echo "Yes, it does." 2>&1
4752                         case "$ccflags" in
4753                         *-pipe*)
4754                                 echo "Leaving current flags $ccflags alone." 2>&1
4755                                 ;;
4756                         *) dflt="$dflt -pipe" ;;
4757                         esac
4758                 else
4759                         echo "Nope, it doesn't, but that's ok." 2>&1
4760                 fi
4761                 ;;
4762         esac
4763         ;;
4764 esac
4765
4766 case "$mips_type" in
4767 *BSD*|'') inclwanted="$locincpth $usrinc";;
4768 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4769 esac
4770 for thisincl in $inclwanted; do
4771         if $test -d $thisincl; then
4772                 if $test x$thisincl != x$usrinc; then
4773                         case "$dflt" in
4774                         *" -I$thisincl "*);;
4775                         *) dflt="$dflt -I$thisincl ";;
4776                         esac
4777                 fi
4778         fi
4779 done
4780
4781 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4782         xxx=true;
4783 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4784         xxx=true;
4785 else
4786         xxx=false;
4787 fi;
4788 if $xxx; then
4789         case "$dflt" in
4790         *$2*);;
4791         *) dflt="$dflt -D$2";;
4792         esac;
4793 fi'
4794
4795 set signal.h LANGUAGE_C; eval $inctest
4796
4797 case "$usesocks" in
4798 $define)
4799         ccflags="$ccflags -DSOCKS"
4800         ;;
4801 esac
4802
4803 case "$hint" in
4804 default|recommended) dflt="$ccflags $dflt" ;;
4805 *) dflt="$ccflags";;
4806 esac
4807
4808 case "$dflt" in
4809 ''|' ') dflt=none;;
4810 esac
4811
4812 $cat <<EOH
4813
4814 Your C compiler may want other flags.  For this question you should include
4815 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4816 but you should NOT include libraries or ld flags like -lwhatever.  If you
4817 want $package to honor its debug switch, you should include -DDEBUGGING here.
4818 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4819
4820 To use no flags, specify the word "none".
4821
4822 EOH
4823 set X $dflt
4824 shift
4825 dflt=${1+"$@"}
4826 rp="Any additional cc flags?"
4827 . ./myread
4828 case "$ans" in
4829 none) ccflags='';;
4830 *) ccflags="$ans";;
4831 esac
4832
4833 : the following weeds options from ccflags that are of no interest to cpp
4834 case "$cppflags" in
4835 '') cppflags="$ccflags" ;;
4836 *)  cppflags="$cppflags $ccflags" ;;
4837 esac
4838 case "$gccversion" in
4839 1*) cppflags="$cppflags -D__GNUC__"
4840 esac
4841 case "$mips_type" in
4842 '');;
4843 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4844 esac
4845 case "$cppflags" in
4846 '');;
4847 *)
4848         echo " "
4849         echo "Let me guess what the preprocessor flags are..." >&4
4850         set X $cppflags
4851         shift
4852         cppflags=''
4853         $cat >cpp.c <<'EOM'
4854 #define BLURFL foo
4855
4856 BLURFL xx LFRULB
4857 EOM
4858         previous=''
4859         for flag in $*
4860         do
4861                 case "$flag" in
4862                 -*) ftry="$flag";;
4863                 *) ftry="$previous $flag";;
4864                 esac
4865                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4866                         >cpp1.out 2>/dev/null && \
4867                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4868                         >cpp2.out 2>/dev/null && \
4869                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4870                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4871                 then
4872                         cppflags="$cppflags $ftry"
4873                         previous=''
4874                 else
4875                         previous="$flag"
4876                 fi
4877         done
4878         set X $cppflags
4879         shift
4880         cppflags=${1+"$@"}
4881         case "$cppflags" in
4882         *-*)  echo "They appear to be: $cppflags";;
4883         esac
4884         $rm -f cpp.c cpp?.out
4885         ;;
4886 esac
4887
4888 : flags used in final linking phase
4889 case "$ldflags" in
4890 '') if ./venix; then
4891                 dflt='-i -z'
4892         else
4893                 dflt=''
4894         fi
4895         case "$ccflags" in
4896         *-posix*) dflt="$dflt -posix" ;;
4897         esac
4898         ;;
4899 *) dflt="$ldflags";;
4900 esac
4901
4902 : Try to guess additional flags to pick up local libraries.
4903 for thislibdir in $libpth; do
4904         case " $loclibpth " in
4905         *" $thislibdir "*)
4906                 case "$dflt " in
4907                 *"-L$thislibdir "*) ;;
4908                 *)  dflt="$dflt -L$thislibdir" ;;
4909                 esac
4910                 ;;
4911         esac
4912 done
4913
4914 case "$dflt" in
4915 '') dflt='none' ;;
4916 esac
4917
4918 $cat <<EOH
4919
4920 Your C linker may need flags.  For this question you should
4921 include -L/whatever and any other flags used by the C linker, but you
4922 should NOT include libraries like -lwhatever.
4923
4924 Make sure you include the appropriate -L/path flags if your C linker
4925 does not normally search all of the directories you specified above,
4926 namely
4927         $libpth
4928 To use no flags, specify the word "none".
4929
4930 EOH
4931
4932 rp="Any additional ld flags (NOT including libraries)?"
4933 . ./myread
4934 case "$ans" in
4935 none) ldflags='';;
4936 *) ldflags="$ans";;
4937 esac
4938 rmlist="$rmlist pdp11"
4939
4940 : coherency check
4941 echo " "
4942 echo "Checking your choice of C compiler and flags for coherency..." >&4
4943 $cat > try.c <<'EOF'
4944 #include <stdio.h>
4945 int main() { printf("Ok\n"); return(0); }
4946 EOF
4947 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4948 shift
4949 $cat >try.msg <<'EOM'
4950 I've tried to compile and run the following simple program:
4951
4952 EOM
4953 $cat try.c >> try.msg
4954
4955 $cat >> try.msg <<EOM
4956
4957 I used the command:
4958
4959         $*
4960         $run ./try
4961
4962 and I got the following output:
4963
4964 EOM
4965 dflt=y
4966 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4967         if $sh -c "$run ./try" >>try.msg 2>&1; then
4968                 xxx=`$run ./try`
4969                 case "$xxx" in
4970                 "Ok") dflt=n ;;
4971                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4972                         case " $libs " in
4973                         *" -lsfio "*)
4974                                 cat >> try.msg <<'EOQS'
4975 If $libs contains -lsfio, and sfio is mis-configured, then it
4976 sometimes (apparently) runs and exits with a 0 status, but with no
4977 output!  It may have to do with sfio's use of _exit vs. exit.
4978
4979 EOQS
4980                                 rp="You have a big problem.  Shall I abort Configure"
4981                                 dflt=y
4982                                 ;;
4983                         esac
4984                         ;;
4985                 esac
4986         else
4987                 echo "The program compiled OK, but exited with status $?." >>try.msg
4988                 rp="You have a problem.  Shall I abort Configure"
4989                 dflt=y
4990         fi
4991 else
4992         echo "I can't compile the test program." >>try.msg
4993         rp="You have a BIG problem.  Shall I abort Configure"
4994         dflt=y
4995 fi
4996 case "$dflt" in
4997 y)
4998         $cat try.msg >&4
4999         case "$knowitall" in
5000         '')
5001                 echo "(The supplied flags or libraries might be incorrect.)"
5002                 ;;
5003         *) dflt=n;;
5004         esac
5005         echo " "
5006         . ./myread
5007         case "$ans" in
5008         n*|N*) ;;
5009         *)      echo "Ok.  Stopping Configure." >&4
5010                 exit 1
5011                 ;;
5012         esac
5013         ;;
5014 n) echo "OK, that should do.";;
5015 esac
5016 $rm -f try try.* core
5017
5018 : define a shorthand compile call
5019 compile='
5020 mc_file=$1;
5021 shift;
5022 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5023 : define a shorthand compile call for compilations that should be ok.
5024 compile_ok='
5025 mc_file=$1;
5026 shift;
5027 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5028
5029 : determine filename position in cpp output
5030 echo " "
5031 echo "Computing filename position in cpp output for #include directives..." >&4
5032 case "$osname" in
5033 vos) testaccess=-e ;;
5034 *)   testaccess=-r ;;
5035 esac
5036 echo '#include <stdio.h>' > foo.c
5037 $cat >fieldn <<EOF
5038 $startsh
5039 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5040 $grep '^[       ]*#.*stdio\.h' | \
5041 while read cline; do
5042         pos=1
5043         set \$cline
5044         while $test \$# -gt 0; do
5045                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5046                         echo "\$pos"
5047                         exit 0
5048                 fi
5049                 shift
5050                 pos=\`expr \$pos + 1\`
5051         done
5052 done
5053 EOF
5054 chmod +x fieldn
5055 fieldn=`./fieldn`
5056 $rm -f foo.c fieldn
5057 case $fieldn in
5058 '') pos='???';;
5059 1) pos=first;;
5060 2) pos=second;;
5061 3) pos=third;;
5062 *) pos="${fieldn}th";;
5063 esac
5064 echo "Your cpp writes the filename in the $pos field of the line."
5065
5066 case "$osname" in
5067 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5068 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5069 *)   cppfilter='' ;;
5070 esac
5071 : locate header file
5072 $cat >findhdr <<EOF
5073 $startsh
5074 wanted=\$1
5075 name=''
5076 for usrincdir in $usrinc
5077 do
5078         if test -f \$usrincdir/\$wanted; then
5079                 echo "\$usrincdir/\$wanted"
5080                 exit 0
5081         fi
5082 done
5083 awkprg='{ print \$$fieldn }'
5084 echo "#include <\$wanted>" > foo\$\$.c
5085 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5086 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5087 while read cline; do
5088         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5089         case "\$name" in
5090         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5091         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5092         *) exit 2;;
5093         esac;
5094 done;
5095 #
5096 # status = 0: grep returned 0 lines, case statement not executed
5097 # status = 1: headerfile found
5098 # status = 2: while loop executed, no headerfile found
5099 #
5100 status=\$?
5101 $rm -f foo\$\$.c;
5102 if test \$status -eq 1; then
5103         exit 0;
5104 fi
5105 exit 1
5106 EOF
5107 chmod +x findhdr
5108
5109 : define an alternate in-header-list? function
5110 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5111 cont=true; xxf="echo \"<\$1> found.\" >&4";
5112 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5113 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5114 esac;
5115 case $# in 4) instead=instead;; *) instead="at last";; esac;
5116 while $test "$cont"; do
5117         xxx=`./findhdr $1`
5118         var=$2; eval "was=\$$2";
5119         if $test "$xxx" && $test -r "$xxx";
5120         then eval $xxf;
5121         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5122                 cont="";
5123         else eval $xxnf;
5124         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5125         set $yyy; shift; shift; yyy=$@;
5126         case $# in 0) cont="";;
5127         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5128                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5129         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5130                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5131         esac;
5132 done;
5133 while $test "$yyy";
5134 do set $yyy; var=$2; eval "was=\$$2";
5135         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5136         set $yyy; shift; shift; yyy=$@;
5137 done'
5138
5139 : see if stdlib is available
5140 set stdlib.h i_stdlib
5141 eval $inhdr
5142
5143 : check for lengths of integral types
5144 echo " "
5145 case "$intsize" in
5146 '')
5147         echo "Checking to see how big your integers are..." >&4
5148         $cat >try.c <<EOCP
5149 #include <stdio.h>
5150 #$i_stdlib I_STDLIB
5151 #ifdef I_STDLIB
5152 #include <stdlib.h>
5153 #endif
5154 int main()
5155 {
5156         printf("intsize=%d;\n", (int)sizeof(int));
5157         printf("longsize=%d;\n", (int)sizeof(long));
5158         printf("shortsize=%d;\n", (int)sizeof(short));
5159         exit(0);
5160 }
5161 EOCP
5162         set try
5163         if eval $compile_ok && $run ./try > /dev/null; then
5164                 eval `$run ./try`
5165                 echo "Your integers are $intsize bytes long."
5166                 echo "Your long integers are $longsize bytes long."
5167                 echo "Your short integers are $shortsize bytes long."
5168         else
5169                 $cat >&4 <<EOM
5170 !
5171 Help! I can't compile and run the intsize test program: please enlighten me!
5172 (This is probably a misconfiguration in your system or libraries, and
5173 you really ought to fix it.  Still, I'll try anyway.)
5174 !
5175 EOM
5176                 dflt=4
5177                 rp="What is the size of an integer (in bytes)?"
5178                 . ./myread
5179                 intsize="$ans"
5180                 dflt=$intsize
5181                 rp="What is the size of a long integer (in bytes)?"
5182                 . ./myread
5183                 longsize="$ans"
5184                 dflt=2
5185                 rp="What is the size of a short integer (in bytes)?"
5186                 . ./myread
5187                 shortsize="$ans"
5188         fi
5189         ;;
5190 esac
5191 $rm -f try try.*
5192
5193 : check for long long
5194 echo " "
5195 echo "Checking to see if you have long long..." >&4
5196 echo 'int main() { long long x = 7; return 0; }' > try.c
5197 set try
5198 if eval $compile; then
5199         val="$define"
5200         echo "You have long long."
5201 else
5202         val="$undef"
5203         echo "You do not have long long."
5204 fi
5205 $rm try.*
5206 set d_longlong
5207 eval $setvar
5208
5209 : check for length of long long
5210 case "${d_longlong}${longlongsize}" in
5211 $define)
5212         echo " "
5213         echo "Checking to see how big your long longs are..." >&4
5214         $cat >try.c <<'EOCP'
5215 #include <stdio.h>
5216 int main()
5217 {
5218     printf("%d\n", (int)sizeof(long long));
5219     return(0);
5220 }
5221 EOCP
5222         set try
5223         if eval $compile_ok; then
5224                 longlongsize=`$run ./try`
5225                 echo "Your long longs are $longlongsize bytes long."
5226         else
5227                 dflt='8'
5228                 echo " "
5229                 echo "(I can't seem to compile the test program.  Guessing...)"
5230                 rp="What is the size of a long long (in bytes)?"
5231                 . ./myread
5232                 longlongsize="$ans"
5233         fi
5234         if $test "X$longsize" = "X$longlongsize"; then
5235                 echo "(That isn't any different from an ordinary long.)"
5236         fi      
5237         ;;
5238 esac
5239 $rm -f try.* try
5240
5241 : see if inttypes.h is available
5242 : we want a real compile instead of Inhdr because some systems
5243 : have an inttypes.h which includes non-existent headers
5244 echo " "
5245 $cat >try.c <<EOCP
5246 #include <inttypes.h>
5247 int main() {
5248         static int32_t foo32 = 0x12345678;
5249 }
5250 EOCP
5251 set try
5252 if eval $compile; then
5253         echo "<inttypes.h> found." >&4
5254         val="$define"
5255 else
5256         echo "<inttypes.h> NOT found." >&4
5257         val="$undef"
5258 fi
5259 $rm -f try.c try
5260 set i_inttypes
5261 eval $setvar
5262
5263 : check for int64_t
5264 echo " "
5265 echo "Checking to see if you have int64_t..." >&4
5266 $cat >try.c <<EOCP
5267 #include <sys/types.h>
5268 #$i_inttypes I_INTTYPES
5269 #ifdef I_INTTYPES
5270 #include <inttypes.h>
5271 #endif
5272 int main() { int64_t x = 7; }
5273 EOCP
5274 set try
5275 if eval $compile; then
5276         val="$define"
5277         echo "You have int64_t."
5278 else
5279         val="$undef"
5280         echo "You do not have int64_t."
5281 fi
5282 $rm -f try try.*
5283 set d_int64_t
5284 eval $setvar
5285
5286
5287 echo " "
5288 echo "Checking which 64-bit integer type we could use..." >&4
5289
5290 case "$intsize" in
5291 8) val=int
5292    set quadtype
5293    eval $setvar
5294    val='"unsigned int"'
5295    set uquadtype
5296    eval $setvar
5297    quadkind=1
5298    ;;
5299 *) case "$longsize" in
5300    8) val=long
5301       set quadtype
5302       eval $setvar
5303       val='"unsigned long"'
5304       set uquadtype
5305       eval $setvar
5306       quadkind=2
5307       ;;
5308    *) case "$d_longlong:$longlongsize" in
5309       define:8)
5310         val='"long long"'
5311         set quadtype
5312         eval $setvar
5313         val='"unsigned long long"'
5314         set uquadtype
5315         eval $setvar
5316         quadkind=3
5317         ;;
5318       *) case "$d_int64_t" in
5319          define)
5320            val=int64_t
5321            set quadtype
5322            eval $setvar
5323            val=uint64_t
5324            set uquadtype
5325            eval $setvar
5326            quadkind=4
5327            ;;
5328          esac
5329          ;;
5330       esac
5331       ;;
5332    esac
5333    ;;
5334 esac
5335
5336 case "$quadtype" in
5337 '')     echo "Alas, no 64-bit integer types in sight." >&4
5338         d_quad="$undef"
5339         ;;
5340 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5341         d_quad="$define"
5342         ;;
5343 esac
5344
5345
5346 case "$uselonglong" in
5347 "$define"|true|[yY]*)
5348         cat <<EOM >&4
5349
5350 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5351 EOM
5352         use64bitint="$define"
5353         ;;
5354 esac                          
5355 case "$use64bits" in
5356 "$define"|true|[yY]*)
5357         cat <<EOM >&4
5358
5359 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5360 EOM
5361         use64bitint="$define"
5362         ;;
5363 esac                          
5364 case "$use64bitints" in
5365 "$define"|true|[yY]*)
5366         cat <<EOM >&4
5367
5368 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5369 EOM
5370         use64bitint="$define"
5371         ;;
5372 esac                          
5373 case "$use64bitsint" in
5374 "$define"|true|[yY]*)
5375         cat <<EOM >&4
5376
5377 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5378 EOM
5379         use64bitint="$define"
5380         ;;
5381 esac                          
5382 case "$uselonglongs" in
5383 "$define"|true|[yY]*)
5384         cat <<EOM >&4
5385
5386 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5387 EOM
5388         use64bitint="$define"
5389         ;;
5390 esac                          
5391 case "$use64bitsall" in
5392 "$define"|true|[yY]*)
5393         cat <<EOM >&4
5394
5395 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5396 EOM
5397         use64bitall="$define"
5398         ;;
5399 esac                          
5400
5401 case "$ccflags" in
5402 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5403 esac
5404 case "$use64bitall" in
5405 "$define"|true|[yY]*) use64bitint="$define" ;;
5406 esac
5407
5408 case "$longsize" in
5409 8) cat <<EOM
5410
5411 You have natively 64-bit long integers.
5412 EOM
5413    val="$define"
5414    ;;
5415 *) case "$use64bitint" in
5416    "$define"|true|[yY]*) dflt='y';;
5417    *) dflt='n';;
5418    esac
5419    case "$d_quad" in
5420    "$define") ;;
5421    *) dflt='n' ;;
5422    esac
5423    cat <<EOM
5424
5425 Perl can be built to take advantage of 64-bit integer types
5426 on some systems.  To do so, Configure can be run with -Duse64bitint.
5427 Choosing this option will most probably introduce binary incompatibilities.
5428
5429 If this doesn't make any sense to you, just accept the default '$dflt'.
5430 (The default has been chosen based on your configuration.)
5431 EOM
5432    rp='Try to use 64-bit integers, if available?'
5433    . ./myread
5434    case "$ans" in
5435    [yY]*) val="$define" ;;
5436    *)     val="$undef"  ;;
5437    esac
5438    ;;
5439 esac
5440 set use64bitint
5441 eval $setvar
5442
5443 case "$use64bitall" in
5444 "$define"|true|[yY]*) dflt='y' ;;
5445 *) case "$longsize" in
5446    8) dflt='y' ;;
5447    *) dflt='n' ;;
5448    esac
5449    ;;
5450 esac    
5451 cat <<EOM
5452
5453 You may also choose to try maximal 64-bitness.  It means using as much
5454 64-bitness as possible on the platform.  This in turn means even more
5455 binary incompatibilities.  On the other hand, your platform may not
5456 have any more 64-bitness available than what you already have chosen.
5457
5458 If this doesn't make any sense to you, just accept the default '$dflt'.
5459 (The default has been chosen based on your configuration.)
5460 EOM
5461 rp='Try to use maximal 64-bit support, if available?'
5462 . ./myread
5463 case "$ans" in
5464 [yY]*) val="$define" ;;
5465 *)     val="$undef"  ;;
5466 esac
5467 set use64bitall
5468 eval $setvar
5469 case "$use64bitall" in
5470 "$define")
5471         case "$use64bitint" in
5472         "$undef")
5473                 cat <<EOM
5474
5475 Since you have chosen a maximally 64-bit build, I'm also turning on
5476 the use of 64-bit integers.
5477 EOM
5478                 use64bitint="$define" ;;
5479         esac
5480         ;;
5481 esac
5482
5483 : Look for a hint-file generated 'call-back-unit'.  If the
5484 : user has specified that a 64-bit perl is to be built,
5485 : we may need to set or change some other defaults.
5486 if $test -f use64bitint.cbu; then
5487         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5488         . ./use64bitint.cbu
5489 fi
5490 case "$use64bitint" in
5491 "$define"|true|[yY]*)
5492         case "$longsize" in
5493         4) case "$archname64" in
5494            '') archname64=64int ;;
5495            esac
5496            ;;
5497         esac
5498         ;;
5499 esac
5500
5501 : Look for a hint-file generated 'call-back-unit'.  If the
5502 : user has specified that a maximally 64-bit perl is to be built,
5503 : we may need to set or change some other defaults.
5504 if $test -f use64bitall.cbu; then
5505         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5506         . ./use64bitall.cbu
5507 fi
5508 case "$use64bitall" in
5509 "$define"|true|[yY]*)
5510         case "$longsize" in
5511         4) case "$archname64" in
5512            ''|64int) archname64=64all ;;
5513            esac
5514            ;;
5515         esac
5516         ;;
5517 esac
5518
5519 case "$d_quad:$use64bitint" in
5520 $undef:$define)
5521         cat >&4 <<EOF
5522
5523 *** You have chosen to use 64-bit integers,
5524 *** but none can be found.
5525 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5526 *** Cannot continue, aborting.
5527
5528 EOF
5529         exit 1
5530         ;;
5531 esac
5532
5533 : check for length of double
5534 echo " "
5535 case "$doublesize" in
5536 '')
5537         echo "Checking to see how big your double precision numbers are..." >&4
5538         $cat >try.c <<EOCP
5539 #include <stdio.h>
5540 #$i_stdlib I_STDLIB
5541 #ifdef I_STDLIB
5542 #include <stdlib.h>
5543 #endif
5544 int main()
5545 {
5546     printf("%d\n", (int)sizeof(double));
5547     exit(0);
5548 }
5549 EOCP
5550         set try
5551         if eval $compile_ok; then
5552                 doublesize=`$run ./try`
5553                 echo "Your double is $doublesize bytes long."
5554         else
5555                 dflt='8'
5556                 echo "(I can't seem to compile the test program.  Guessing...)"
5557                 rp="What is the size of a double precision number (in bytes)?"
5558                 . ./myread
5559                 doublesize="$ans"
5560         fi
5561         ;;
5562 esac
5563 $rm -f try.c try
5564
5565 : check for long doubles
5566 echo " "
5567 echo "Checking to see if you have long double..." >&4
5568 echo 'int main() { long double x = 7.0; }' > try.c
5569 set try
5570 if eval $compile; then
5571         val="$define"
5572         echo "You have long double."
5573 else
5574         val="$undef"
5575         echo "You do not have long double."
5576 fi
5577 $rm try.*
5578 set d_longdbl
5579 eval $setvar
5580
5581 : check for length of long double
5582 case "${d_longdbl}${longdblsize}" in
5583 $define)
5584         echo " "
5585         echo "Checking to see how big your long doubles are..." >&4
5586         $cat >try.c <<'EOCP'
5587 #include <stdio.h>
5588 int main()
5589 {
5590         printf("%d\n", sizeof(long double));
5591 }
5592 EOCP
5593         set try
5594         set try
5595         if eval $compile; then
5596                 longdblsize=`$run ./try`
5597                 echo "Your long doubles are $longdblsize bytes long."
5598         else
5599                 dflt='8'
5600                 echo " "
5601                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5602                 rp="What is the size of a long double (in bytes)?"
5603                 . ./myread
5604                 longdblsize="$ans"
5605         fi
5606         if $test "X$doublesize" = "X$longdblsize"; then
5607                 echo "That isn't any different from an ordinary double."
5608                 echo "I'll keep your setting anyway, but you may see some"
5609                 echo "harmless compilation warnings."
5610         fi      
5611         ;;
5612 esac
5613 $rm -f try.* try
5614
5615 : determine the architecture name
5616 echo " "
5617 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5618         tarch=`arch`"-$osname"
5619 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5620         if uname -m > tmparch 2>&1 ; then
5621                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5622                         -e 's/$/'"-$osname/" tmparch`
5623         else
5624                 tarch="$osname"
5625         fi
5626         $rm -f tmparch
5627 else
5628         tarch="$osname"
5629 fi
5630 case "$myarchname" in
5631 ''|"$tarch") ;;
5632 *)
5633         echo "(Your architecture name used to be $myarchname.)"
5634         archname=''
5635         ;;
5636 esac
5637 case "$targetarch" in
5638 '') ;;
5639 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5640 esac
5641 myarchname="$tarch"
5642 case "$archname" in
5643 '') dflt="$tarch";;
5644 *) dflt="$archname";;
5645 esac
5646 rp='What is your architecture name'
5647 . ./myread
5648 archname="$ans"
5649 case "$usethreads" in
5650 $define)
5651         echo "Threads selected." >&4
5652         case "$archname" in
5653         *-thread*) echo "...and architecture name already has -thread." >&4
5654                 ;;
5655         *)      archname="$archname-thread"
5656                 echo "...setting architecture name to $archname." >&4
5657                 ;;
5658         esac
5659         ;;
5660 esac
5661 case "$usemultiplicity" in
5662 $define)
5663         echo "Multiplicity selected." >&4
5664         case "$archname" in
5665         *-multi*) echo "...and architecture name already has -multi." >&4
5666                 ;;
5667         *)      archname="$archname-multi"
5668                 echo "...setting architecture name to $archname." >&4
5669                 ;;
5670         esac
5671         ;;
5672 esac
5673 case "$use64bitint$use64bitall" in
5674 *"$define"*)
5675         case "$archname64" in
5676         '')
5677                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5678                 ;;
5679         *)
5680                 case "$use64bitint" in
5681                 "$define") echo "64 bit integers selected." >&4 ;;
5682                 esac
5683                 case "$use64bitall" in
5684                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5685                 esac
5686                 case "$archname" in
5687                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5688                         ;;
5689                 *)      archname="$archname-$archname64"
5690                         echo "...setting architecture name to $archname." >&4
5691                         ;;
5692                 esac
5693                 ;;
5694         esac
5695 esac
5696 case "$uselongdouble" in
5697 $define)
5698         echo "Long doubles selected." >&4
5699         case "$longdblsize" in
5700         $doublesize)
5701                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5702                 ;;
5703         *)
5704                 case "$archname" in
5705                 *-ld*) echo "...and architecture name already has -ld." >&4
5706                         ;;
5707                 *)      archname="$archname-ld"
5708                         echo "...setting architecture name to $archname." >&4
5709                         ;;
5710                 esac
5711                 ;;
5712         esac
5713         ;;
5714 esac
5715 case "$useperlio" in
5716 $define)
5717         echo "Perlio selected." >&4
5718         ;;
5719 *)
5720         echo "Perlio not selected, using stdio." >&4
5721         case "$archname" in
5722         *-stdio*) echo "...and architecture name already has -stdio." >&4
5723                 ;;
5724         *)      archname="$archname-stdio"
5725                 echo "...setting architecture name to $archname." >&4
5726                 ;;
5727         esac
5728         ;;
5729 esac
5730 if $test -f archname.cbu; then
5731         echo "Your platform has some specific hints for architecture name, using them..."
5732         . ./archname.cbu
5733 fi
5734
5735 : determine root of directory hierarchy where package will be installed.
5736 case "$prefix" in
5737 '')
5738         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5739         ;;
5740 *?/)
5741         dflt=`echo "$prefix" | sed 's/.$//'`
5742         ;;
5743 *)
5744         dflt="$prefix"
5745         ;;
5746 esac
5747 $cat <<EOM
5748
5749 By default, $package will be installed in $dflt/bin, manual pages
5750 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5751 installation directories. Typically this is something like /usr/local.
5752 If you wish to have binaries under /usr/bin but other parts of the
5753 installation under /usr/local, that's ok: you will be prompted
5754 separately for each of the installation directories, the prefix being
5755 only used to set the defaults.
5756
5757 EOM
5758 fn=d~
5759 rp='Installation prefix to use?'
5760 . ./getfile
5761 oldprefix=''
5762 case "$prefix" in
5763 '') ;;
5764 *)
5765         case "$ans" in
5766         "$prefix") ;;
5767         *) oldprefix="$prefix";;
5768         esac
5769         ;;
5770 esac
5771 prefix="$ans"
5772 prefixexp="$ansexp"
5773
5774 case "$afsroot" in
5775 '')     afsroot=/afs ;;
5776 *)      afsroot=$afsroot ;;
5777 esac
5778
5779 : is AFS running?
5780 echo " "
5781 case "$afs" in
5782 $define|true)   afs=true ;;
5783 $undef|false)   afs=false ;;
5784 *)      if test -d $afsroot; then
5785                 afs=true
5786         else
5787                 afs=false
5788         fi
5789         ;;
5790 esac
5791 if $afs; then
5792         echo "AFS may be running... I'll be extra cautious then..." >&4
5793 else
5794         echo "AFS does not seem to be running..." >&4
5795 fi
5796
5797 : determine installation prefix for where package is to be installed.
5798 if $afs; then 
5799 $cat <<EOM
5800
5801 Since you are running AFS, I need to distinguish the directory in which
5802 files will reside from the directory in which they are installed (and from
5803 which they are presumably copied to the former directory by occult means).
5804
5805 EOM
5806         case "$installprefix" in
5807         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5808         *) dflt="$installprefix";;
5809         esac
5810 else
5811 $cat <<EOM
5812
5813 In some special cases, particularly when building $package for distribution,
5814 it is convenient to distinguish the directory in which files should be
5815 installed from the directory ($prefix) in which they will
5816 eventually reside.  For most users, these two directories are the same.
5817
5818 EOM
5819         case "$installprefix" in
5820         '') dflt=$prefix ;;
5821         *) dflt=$installprefix;;
5822         esac
5823 fi
5824 fn=d~
5825 rp='What installation prefix should I use for installing files?'
5826 . ./getfile
5827 installprefix="$ans"
5828 installprefixexp="$ansexp"
5829
5830 : set the prefixit variable, to compute a suitable default value
5831 prefixit='case "$3" in
5832 ""|none)
5833         case "$oldprefix" in
5834         "") eval "$1=\"\$$2\"";;
5835         *)
5836                 case "$3" in
5837                 "") eval "$1=";;
5838                 none)
5839                         eval "tp=\"\$$2\"";
5840                         case "$tp" in
5841                         ""|" ") eval "$1=\"\$$2\"";;
5842                         *) eval "$1=";;
5843                         esac;;
5844                 esac;;
5845         esac;;
5846 *)
5847         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5848         case "$tp" in
5849         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5850         /*-$oldprefix/*|\~*-$oldprefix/*)
5851                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5852         *) eval "$1=\"\$$2\"";;
5853         esac;;
5854 esac'
5855
5856 : get the patchlevel
5857 echo " "
5858 echo "Getting the current patchlevel..." >&4
5859 if $test -r $rsrc/patchlevel.h;then
5860         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5861         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5862         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5863         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5864         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5865         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5866        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5867 else
5868         revision=0
5869         patchlevel=0
5870         subversion=0
5871         api_revision=0
5872         api_version=0
5873         api_subversion=0
5874         perl_patchlevel=0
5875         $echo "(You do not have patchlevel.h.  Eek.)"
5876 fi
5877 if $test -r $rsrc/.patch ; then  
5878         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5879                 perl_patchlevel=`cat $rsrc/.patch`
5880         fi
5881 fi
5882 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5883 version_patchlevel_string="version $patchlevel subversion $subversion"
5884 case "$perl_patchlevel" in
5885 0|'') ;;
5886 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5887 esac
5888
5889 $echo "(You have $package $version_patchlevel_string.)"
5890
5891 case "$osname" in
5892 dos|vms)
5893         : XXX Should be a Configure test for double-dots in filenames.
5894         version=`echo $revision $patchlevel $subversion | \
5895                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5896         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5897                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5898         ;;
5899 *)
5900         version=`echo $revision $patchlevel $subversion | \
5901                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5902         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5903                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5904         ;;
5905 esac
5906 : Special case the 5.005_xx maintenance series, which used 5.005
5907 : without any subversion label as a subdirectory in $sitelib
5908 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5909         api_versionstring='5.005'
5910 fi
5911
5912 : determine installation style
5913 : For now, try to deduce it from prefix unless it is already set.
5914 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5915 case "$installstyle" in
5916 '')     case "$prefix" in
5917                 *perl*) dflt='lib';;
5918                 *) dflt='lib/perl5' ;;
5919         esac
5920         ;;
5921 *)      dflt="$installstyle" ;;
5922 esac
5923 : Probably not worth prompting for this since we prompt for all
5924 : the directories individually, and the prompt would be too long and
5925 : confusing anyway.
5926 installstyle=$dflt
5927
5928 : determine where private library files go
5929 : Usual default is /usr/local/lib/perl5/$version.
5930 : Also allow things like /opt/perl/lib/$version, since 
5931 : /opt/perl/lib/perl5... would be redundant.
5932 : The default "style" setting is made in installstyle.U
5933 case "$installstyle" in
5934 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5935 *)       set dflt privlib lib/$version ;;
5936 esac
5937 eval $prefixit
5938 $cat <<EOM
5939
5940 There are some auxiliary files for $package that need to be put into a
5941 private library directory that is accessible by everyone.
5942
5943 EOM
5944 fn=d~+
5945 rp='Pathname where the private library files will reside?'
5946 . ./getfile
5947 privlib="$ans"
5948 privlibexp="$ansexp"
5949 : Change installation prefix, if necessary.
5950 if $test X"$prefix" != X"$installprefix"; then
5951         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5952 else
5953         installprivlib="$privlibexp"
5954 fi
5955
5956 : set the prefixup variable, to restore leading tilda escape
5957 prefixup='case "$prefixexp" in
5958 "$prefix") ;;
5959 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5960 esac'
5961
5962 : determine where public architecture dependent libraries go
5963 set archlib archlib
5964 eval $prefixit
5965 : privlib default is /usr/local/lib/$package/$version
5966 : archlib default is /usr/local/lib/$package/$version/$archname
5967 : privlib may have an optional trailing /share.
5968 tdflt=`echo $privlib | $sed 's,/share$,,'`
5969 tdflt=$tdflt/$archname
5970 case "$archlib" in
5971 '')     dflt=$tdflt
5972         ;;
5973 *)      dflt="$archlib"
5974     ;;
5975 esac
5976 $cat <<EOM
5977
5978 $spackage contains architecture-dependent library files.  If you are
5979 sharing libraries in a heterogeneous environment, you might store
5980 these files in a separate location.  Otherwise, you can just include
5981 them with the rest of the public library files.
5982
5983 EOM
5984 fn=d+~
5985 rp='Where do you want to put the public architecture-dependent libraries?'
5986 . ./getfile
5987 archlib="$ans"
5988 archlibexp="$ansexp"
5989 if $test X"$archlib" = X"$privlib"; then
5990         d_archlib="$undef"
5991 else
5992         d_archlib="$define"
5993 fi
5994 : Change installation prefix, if necessary.
5995 if $test X"$prefix" != X"$installprefix"; then
5996         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5997 else
5998         installarchlib="$archlibexp"
5999 fi
6000
6001 : see if setuid scripts can be secure
6002 $cat <<EOM
6003
6004 Some kernels have a bug that prevents setuid #! scripts from being
6005 secure.  Some sites have disabled setuid #! scripts because of this.
6006
6007 First let's decide if your kernel supports secure setuid #! scripts.
6008 (If setuid #! scripts would be secure but have been disabled anyway,
6009 don't say that they are secure if asked.)
6010
6011 EOM
6012
6013 val="$undef"
6014 if $test -d /dev/fd; then
6015         echo "#!$ls" >reflect
6016         chmod +x,u+s reflect
6017         ./reflect >flect 2>&1
6018         if $contains "/dev/fd" flect >/dev/null; then
6019                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6020                 val="$define"
6021         else
6022                 $cat <<EOM
6023 If you are not sure if they are secure, I can check but I'll need a
6024 username and password different from the one you are using right now.
6025 If you don't have such a username or don't want me to test, simply
6026 enter 'none'.
6027
6028 EOM
6029                 rp='Other username to test security of setuid scripts with?'
6030                 dflt='none'
6031                 . ./myread
6032                 case "$ans" in
6033                 n|none)
6034                         case "$d_suidsafe" in
6035                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6036                                 dflt=n;;
6037                         "$undef")
6038                                 echo "Well, the $hint value is *not* secure." >&4
6039                                 dflt=n;;
6040                         *)      echo "Well, the $hint value *is* secure." >&4
6041                                 dflt=y;;
6042                         esac
6043                         ;;
6044                 *)
6045                         $rm -f reflect flect
6046                         echo "#!$ls" >reflect
6047                         chmod +x,u+s reflect
6048                         echo >flect
6049                         chmod a+w flect
6050                         echo '"su" will (probably) prompt you for '"$ans's password."
6051                         su $ans -c './reflect >flect'
6052                         if $contains "/dev/fd" flect >/dev/null; then
6053                                 echo "Okay, it looks like setuid scripts are secure." >&4
6054                                 dflt=y
6055                         else
6056                                 echo "I don't think setuid scripts are secure." >&4
6057                                 dflt=n
6058                         fi
6059                         ;;
6060                 esac
6061                 rp='Does your kernel have *secure* setuid scripts?'
6062                 . ./myread
6063                 case "$ans" in
6064                 [yY]*)  val="$define";;
6065                 *)      val="$undef";;
6066                 esac
6067         fi
6068 else
6069         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6070         echo "(That's for file descriptors, not floppy disks.)"
6071         val="$undef"
6072 fi
6073 set d_suidsafe
6074 eval $setvar
6075
6076 $rm -f reflect flect
6077
6078 : now see if they want to do setuid emulation
6079 echo " "
6080 val="$undef"
6081 case "$d_suidsafe" in
6082 "$define")
6083         val="$undef"
6084         echo "No need to emulate SUID scripts since they are secure here." >&4
6085         ;;
6086 *)
6087         $cat <<EOM
6088 Some systems have disabled setuid scripts, especially systems where
6089 setuid scripts cannot be secure.  On systems where setuid scripts have
6090 been disabled, the setuid/setgid bits on scripts are currently
6091 useless.  It is possible for $package to detect those bits and emulate
6092 setuid/setgid in a secure fashion.  This emulation will only work if
6093 setuid scripts have been disabled in your kernel.
6094
6095 EOM
6096         case "$d_dosuid" in
6097         "$define") dflt=y ;;
6098         *) dflt=n ;;
6099         esac
6100         rp="Do you want to do setuid/setgid emulation?"
6101         . ./myread
6102         case "$ans" in
6103         [yY]*)  val="$define";;
6104         *)      val="$undef";;
6105         esac
6106         ;;
6107 esac
6108 set d_dosuid
6109 eval $setvar
6110
6111 : see if this is a malloc.h system
6112 : we want a real compile instead of Inhdr because some systems have a
6113 : malloc.h that just gives a compile error saying to use stdlib.h instead
6114 echo " "
6115 $cat >try.c <<EOCP
6116 #include <stdlib.h>
6117 #include <malloc.h>
6118 int main () { return 0; }
6119 EOCP
6120 set try
6121 if eval $compile; then
6122     echo "<malloc.h> found." >&4
6123     val="$define"
6124 else
6125     echo "<malloc.h> NOT found." >&4
6126     val="$undef"
6127 fi
6128 $rm -f try.c try
6129 set i_malloc
6130 eval $setvar
6131
6132 : check for void type
6133 echo " "
6134 echo "Checking to see how well your C compiler groks the void type..." >&4
6135 case "$voidflags" in
6136 '')
6137         $cat >try.c <<EOCP
6138 #$i_stdlib I_STDLIB
6139 #ifdef I_STDLIB
6140 #include <stdlib.h>
6141 #endif
6142 #if TRY & 1
6143 void sub() {
6144 #else
6145 sub() {
6146 #endif
6147         extern void moo();      /* function returning void */
6148         void (*goo)();          /* ptr to func returning void */
6149 #if TRY & 8
6150         void *hue;              /* generic ptr */
6151 #endif
6152 #if TRY & 2
6153         void (*foo[10])();
6154 #endif
6155
6156 #if TRY & 4
6157         if(goo == moo) {
6158                 exit(0);
6159         }
6160 #endif
6161         exit(0);
6162 }
6163 int main() { sub(); }
6164 EOCP
6165         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6166                 voidflags=$defvoidused
6167         echo "Good.  It appears to support void to the level $package wants.">&4
6168                 if $contains warning .out >/dev/null 2>&1; then
6169                         echo "However, you might get some warnings that look like this:"
6170                         $cat .out
6171                 fi
6172         else
6173 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6174                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6175                         echo "It supports 1..."
6176                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6177                                 echo "It also supports 2..."
6178                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6179                                         voidflags=7
6180                                         echo "And it supports 4 but not 8 definitely."
6181                                 else
6182                                         echo "It doesn't support 4..."
6183                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6184                                                 voidflags=11
6185                                                 echo "But it supports 8."
6186                                         else
6187                                                 voidflags=3
6188                                                 echo "Neither does it support 8."
6189                                         fi
6190                                 fi
6191                         else
6192                                 echo "It does not support 2..."
6193                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6194                                         voidflags=13
6195                                         echo "But it supports 4 and 8."
6196                                 else
6197                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6198                                                 voidflags=5
6199                                                 echo "And it supports 4 but has not heard about 8."
6200                                         else
6201                                                 echo "However it supports 8 but not 4."
6202                                         fi
6203                                 fi
6204                         fi
6205                 else
6206                         echo "There is no support at all for void."
6207                         voidflags=0
6208                 fi
6209         fi
6210 esac
6211 case "$voidflags" in
6212 "$defvoidused") ;;
6213 *)      $cat >&4 <<'EOM'
6214   Support flag bits are:
6215     1: basic void declarations.
6216     2: arrays of pointers to functions returning void.
6217     4: operations between pointers to and addresses of void functions.
6218     8: generic void pointers.
6219 EOM
6220         dflt="$voidflags";
6221         rp="Your void support flags add up to what?"
6222         . ./myread
6223         voidflags="$ans"
6224         ;;
6225 esac
6226 $rm -f try.* .out
6227
6228 : check for length of pointer
6229 echo " "
6230 case "$ptrsize" in
6231 '')
6232         echo "Checking to see how big your pointers are..." >&4
6233         if test "$voidflags" -gt 7; then
6234                 echo '#define VOID_PTR char *' > try.c
6235         else
6236                 echo '#define VOID_PTR void *' > try.c
6237         fi
6238         $cat >>try.c <<EOCP
6239 #include <stdio.h>
6240 #$i_stdlib I_STDLIB
6241 #ifdef I_STDLIB
6242 #include <stdlib.h>
6243 #endif
6244 int main()
6245 {
6246     printf("%d\n", (int)sizeof(VOID_PTR));
6247     exit(0);
6248 }
6249 EOCP
6250         set try
6251         if eval $compile_ok; then
6252                 ptrsize=`$run ./try`
6253                 echo "Your pointers are $ptrsize bytes long."
6254         else
6255                 dflt='4'
6256                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6257                 rp="What is the size of a pointer (in bytes)?"
6258                 . ./myread
6259                 ptrsize="$ans"
6260         fi
6261         ;;
6262 esac
6263 $rm -f try.c try
6264 case "$use64bitall" in
6265 "$define"|true|[yY]*)
6266         case "$ptrsize" in
6267         4)      cat <<EOM >&4
6268
6269 *** You have chosen a maximally 64-bit build,
6270 *** but your pointers are only 4 bytes wide.
6271 *** Please rerun Configure without -Duse64bitall.
6272 EOM
6273                 case "$d_quad" in
6274                 define)
6275                         cat <<EOM >&4
6276 *** Since you have quads, you could possibly try with -Duse64bitint.
6277 EOM
6278                         ;;
6279                 esac
6280                 cat <<EOM >&4
6281 *** Cannot continue, aborting.
6282
6283 EOM
6284
6285                 exit 1
6286                 ;;
6287         esac
6288         ;;
6289 esac
6290
6291
6292 : determine whether to use malloc wrapping
6293 echo " "
6294 case "$usemallocwrap" in
6295 [yY]*|true|$define)     dflt='y' ;;
6296 [nN]*|false|$undef)     dflt='n' ;;
6297 *)      case "$usedevel" in
6298         [yY]*|true|$define)     dflt='y' ;;
6299         *) dflt='n' ;;
6300         esac
6301         ;;
6302 esac
6303 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6304 . ./myread
6305 usemallocwrap="$ans"
6306 case "$ans" in
6307 y*|true)
6308         usemallocwrap="$define" ;;
6309 *)
6310         usemallocwrap="$undef" ;;
6311 esac
6312
6313 : determine which malloc to compile in
6314 echo " "
6315 case "$usemymalloc" in
6316 [yY]*|true|$define)     dflt='y' ;;
6317 [nN]*|false|$undef)     dflt='n' ;;
6318 *)      case "$ptrsize" in
6319         4) dflt='y' ;;
6320         *) dflt='n' ;;
6321         esac
6322         ;;
6323 esac
6324 rp="Do you wish to attempt to use the malloc that comes with $package?"
6325 . ./myread
6326 usemymalloc="$ans"
6327 case "$ans" in
6328 y*|true)
6329         usemymalloc='y'
6330         mallocsrc='malloc.c'
6331         mallocobj="malloc$_o"
6332         d_mymalloc="$define"
6333         case "$libs" in
6334         *-lmalloc*)
6335                 : Remove malloc from list of libraries to use
6336                 echo "Removing unneeded -lmalloc from library list" >&4
6337                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6338                 shift
6339                 libs="$*"
6340                 echo "libs = $libs" >&4
6341                 ;;
6342         esac
6343         ;;
6344 *)
6345         usemymalloc='n'
6346         mallocsrc=''
6347         mallocobj=''
6348         d_mymalloc="$undef"
6349         ;;
6350 esac
6351
6352 : compute the return types of malloc and free
6353 echo " "
6354 $cat >malloc.c <<END
6355 #$i_malloc I_MALLOC
6356 #$i_stdlib I_STDLIB
6357 #include <stdio.h>
6358 #include <sys/types.h>
6359 #ifdef I_MALLOC
6360 #include <malloc.h>
6361 #endif
6362 #ifdef I_STDLIB
6363 #include <stdlib.h>
6364 #endif
6365 #ifdef TRY_MALLOC
6366 void *malloc();
6367 #endif
6368 #ifdef TRY_FREE
6369 void free();
6370 #endif
6371 END
6372 case "$malloctype" in
6373 '')
6374         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6375                 malloctype='void *'
6376         else
6377                 malloctype='char *'
6378         fi
6379         ;;
6380 esac
6381 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6382
6383 case "$freetype" in
6384 '')
6385         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6386                 freetype='void'
6387         else
6388                 freetype='int'
6389         fi
6390         ;;
6391 esac
6392 echo "Your system uses $freetype free(), it would seem." >&4
6393 $rm -f malloc.[co]
6394 $cat <<EOM
6395
6396 After $package is installed, you may wish to install various
6397 add-on modules and utilities.  Typically, these add-ons will
6398 be installed under $prefix with the rest
6399 of this package.  However, you may wish to install such add-ons
6400 elsewhere under a different prefix.
6401
6402 If you do not wish to put everything under a single prefix, that's
6403 ok.  You will be prompted for the individual locations; this siteprefix
6404 is only used to suggest the defaults.
6405
6406 The default should be fine for most people.
6407
6408 EOM
6409 fn=d~+
6410 rp='Installation prefix to use for add-on modules and utilities?'
6411 : XXX Here might be another good place for an installstyle setting.
6412 case "$siteprefix" in
6413 '') dflt=$prefix ;;
6414 *)  dflt=$siteprefix ;;
6415 esac
6416 . ./getfile
6417 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6418 oldsiteprefix=''
6419 case "$siteprefix" in
6420 '') ;;
6421 *)      case "$ans" in
6422         "$prefix") ;;
6423         *) oldsiteprefix="$prefix";;
6424         esac
6425         ;;
6426 esac
6427 siteprefix="$ans"
6428 siteprefixexp="$ansexp"
6429
6430 : determine where site specific libraries go.
6431 : Usual default is /usr/local/lib/perl5/site_perl/$version
6432 : The default "style" setting is made in installstyle.U
6433 : XXX No longer works with Prefixit stuff.
6434 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6435 case "$sitelib" in
6436 '') case "$installstyle" in
6437         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6438         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6439         esac
6440         ;;
6441 *)      dflt="$sitelib"
6442         ;;
6443 esac
6444 $cat <<EOM
6445
6446 The installation process will create a directory for
6447 site-specific extensions and modules.  Most users find it convenient
6448 to place all site-specific files in this directory rather than in the
6449 main distribution directory.
6450
6451 EOM
6452 fn=d~+
6453 rp='Pathname for the site-specific library files?'
6454 . ./getfile
6455 sitelib="$ans"
6456 sitelibexp="$ansexp"
6457 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6458 : Change installation prefix, if necessary.
6459 if $test X"$prefix" != X"$installprefix"; then
6460         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6461 else
6462         installsitelib="$sitelibexp"
6463 fi
6464
6465 : determine where site specific architecture-dependent libraries go.
6466 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6467 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6468 : sitelib may have an optional trailing /share.
6469 case "$sitearch" in
6470 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6471         dflt="$dflt/$archname"
6472         ;;
6473 *)      dflt="$sitearch"
6474         ;;
6475 esac
6476 set sitearch sitearch none
6477 eval $prefixit
6478 $cat <<EOM
6479
6480 The installation process will also create a directory for
6481 architecture-dependent site-specific extensions and modules.
6482
6483 EOM
6484 fn=d~+
6485 rp='Pathname for the site-specific architecture-dependent library files?'
6486 . ./getfile
6487 sitearch="$ans"
6488 sitearchexp="$ansexp"
6489 : Change installation prefix, if necessary.
6490 if $test X"$prefix" != X"$installprefix"; then
6491         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6492 else
6493         installsitearch="$sitearchexp"
6494 fi
6495
6496 $cat <<EOM
6497
6498 The installation process will also create a directory for
6499 vendor-supplied add-ons.  Vendors who supply perl with their system
6500 may find it convenient to place all vendor-supplied files in this
6501 directory rather than in the main distribution directory.  This will
6502 ease upgrades between binary-compatible maintenance versions of perl.
6503
6504 Of course you may also use these directories in whatever way you see
6505 fit.  For example, you might use them to access modules shared over a
6506 company-wide network.
6507
6508 The default answer should be fine for most people.
6509 This causes further questions about vendor add-ons to be skipped
6510 and no vendor-specific directories will be configured for perl.
6511
6512 EOM
6513 rp='Do you want to configure vendor-specific add-on directories?'
6514 case "$usevendorprefix" in
6515 define|true|[yY]*) dflt=y ;;
6516 *)      : User may have set vendorprefix directly on Configure command line.
6517         case "$vendorprefix" in
6518         ''|' ') dflt=n ;;
6519         *)      dflt=y ;;
6520         esac
6521         ;;
6522 esac
6523 . ./myread
6524 case "$ans" in
6525 [yY]*)  fn=d~+
6526         rp='Installation prefix to use for vendor-supplied add-ons?'
6527         case "$vendorprefix" in
6528         '') dflt='' ;;
6529         *)  dflt=$vendorprefix ;;
6530         esac
6531         . ./getfile
6532         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6533         oldvendorprefix=''
6534         case "$vendorprefix" in
6535         '') ;;
6536         *)      case "$ans" in
6537                 "$prefix") ;;
6538                 *) oldvendorprefix="$prefix";;
6539                 esac
6540                 ;;
6541         esac
6542         usevendorprefix="$define"
6543         vendorprefix="$ans"
6544         vendorprefixexp="$ansexp"
6545         ;;
6546 *)      usevendorprefix="$undef"
6547         vendorprefix=''
6548         vendorprefixexp=''
6549         ;;
6550 esac
6551
6552 case "$vendorprefix" in
6553 '')     d_vendorlib="$undef"
6554         vendorlib=''
6555         vendorlibexp=''
6556         ;;
6557 *)      d_vendorlib="$define"
6558         : determine where vendor-supplied modules go.
6559         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6560         case "$vendorlib" in
6561         '')
6562                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6563                 case "$installstyle" in
6564                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6565                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6566                 esac
6567                 ;;
6568         *)      dflt="$vendorlib"
6569                 ;;
6570         esac
6571         fn=d~+
6572         rp='Pathname for the vendor-supplied library files?'
6573         . ./getfile
6574         vendorlib="$ans"
6575         vendorlibexp="$ansexp"
6576         ;;
6577 esac
6578 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6579 : Change installation prefix, if necessary.
6580 if $test X"$prefix" != X"$installprefix"; then
6581         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6582 else
6583         installvendorlib="$vendorlibexp"
6584 fi
6585
6586 case "$vendorprefix" in
6587 '')     d_vendorarch="$undef"
6588         vendorarch=''
6589         vendorarchexp=''
6590         ;;
6591 *)      d_vendorarch="$define"
6592         : determine where vendor-supplied architecture-dependent libraries go.
6593         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6594         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6595         : vendorlib may have an optional trailing /share.
6596         case "$vendorarch" in
6597         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6598                 dflt="$dflt/$archname"
6599                 ;;
6600         *)      dflt="$vendorarch" ;;
6601         esac
6602         fn=d~+
6603         rp='Pathname for vendor-supplied architecture-dependent files?'
6604         . ./getfile
6605         vendorarch="$ans"
6606         vendorarchexp="$ansexp"
6607         ;;
6608 esac
6609 : Change installation prefix, if necessary.
6610 if $test X"$prefix" != X"$installprefix"; then
6611         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6612 else
6613         installvendorarch="$vendorarchexp"
6614 fi
6615
6616 : Final catch-all directories to search
6617 $cat <<EOM
6618
6619 Lastly, you can have perl look in other directories for extensions and
6620 modules in addition to those already specified.
6621 These directories will be searched after 
6622         $sitearch 
6623         $sitelib 
6624 EOM
6625 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6626 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6627 echo ' '
6628 case "$otherlibdirs" in
6629 ''|' ') dflt='none' ;;
6630 *)      dflt="$otherlibdirs" ;;
6631 esac
6632 $cat <<EOM
6633 Enter a colon-separated set of extra paths to include in perl's @INC
6634 search path, or enter 'none' for no extra paths.
6635
6636 EOM
6637
6638 rp='Colon-separated list of additional directories for perl to search?'
6639 . ./myread
6640 case "$ans" in
6641 ' '|''|none)    otherlibdirs=' ' ;;     
6642 *)      otherlibdirs="$ans" ;;
6643 esac
6644 case "$otherlibdirs" in
6645 ' ') val=$undef ;;
6646 *)      val=$define ;;
6647 esac
6648 set d_perl_otherlibdirs
6649 eval $setvar
6650
6651 : Cruising for prototypes
6652 echo " "
6653 echo "Checking out function prototypes..." >&4
6654 $cat >prototype.c <<EOCP
6655 #$i_stdlib I_STDLIB
6656 #ifdef I_STDLIB
6657 #include <stdlib.h>
6658 #endif
6659 int main(int argc, char *argv[]) {
6660         exit(0);}
6661 EOCP
6662 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6663         echo "Your C compiler appears to support function prototypes."
6664         val="$define"
6665 else
6666         echo "Your C compiler doesn't seem to understand function prototypes."
6667         val="$undef"
6668 fi
6669 set prototype
6670 eval $setvar
6671 $rm -f prototype*
6672
6673 case "$prototype" in
6674 "$define") ;;
6675 *)      ansi2knr='ansi2knr'
6676         echo " "
6677         cat <<EOM >&4
6678
6679 $me:  FATAL ERROR:
6680 This version of $package can only be compiled by a compiler that 
6681 understands function prototypes.  Unfortunately, your C compiler 
6682         $cc $ccflags
6683 doesn't seem to understand them.  Sorry about that.
6684
6685 If GNU cc is available for your system, perhaps you could try that instead.  
6686
6687 Eventually, we hope to support building Perl with pre-ANSI compilers.
6688 If you would like to help in that effort, please contact <perlbug@perl.org>.
6689
6690 Aborting Configure now.
6691 EOM
6692         exit 2
6693         ;;
6694 esac
6695
6696 : determine where public executables go
6697 echo " "
6698 set dflt bin bin
6699 eval $prefixit
6700 fn=d~
6701 rp='Pathname where the public executables will reside?'
6702 . ./getfile
6703 if $test "X$ansexp" != "X$binexp"; then
6704         installbin=''
6705 fi
6706 bin="$ans"
6707 binexp="$ansexp"
6708 : Change installation prefix, if necessary.
6709 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6710 if $test X"$prefix" != X"$installprefix"; then
6711         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6712 else
6713         installbin="$binexp"
6714 fi
6715
6716 echo " "
6717 case "$extras" in
6718 '') dflt='n';;
6719 *) dflt='y';;
6720 esac
6721 cat <<EOM
6722 Perl can be built with extra modules or bundles of modules which
6723 will be fetched from the CPAN and installed alongside Perl.
6724
6725 Notice that you will need access to the CPAN; either via the Internet,
6726 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6727 be asked later to configure the CPAN.pm module which will in turn do
6728 the installation of the rest of the extra modules or bundles.)
6729
6730 Notice also that if the modules require any external software such as
6731 libraries and headers (the libz library and the zlib.h header for the
6732 Compress::Zlib module, for example) you MUST have any such software
6733 already installed, this configuration process will NOT install such
6734 things for you.
6735
6736 If this doesn't make any sense to you, just accept the default '$dflt'.
6737 EOM
6738 rp='Install any extra modules (y or n)?'
6739 . ./myread
6740 case "$ans" in
6741 y|Y)
6742         cat <<EOM
6743
6744 Please list any extra modules or bundles to be installed from CPAN,
6745 with spaces between the names.  The names can be in any format the
6746 'install' command of CPAN.pm will understand.  (Answer 'none',
6747 without the quotes, to install no extra modules or bundles.)
6748 EOM
6749         rp='Extras?'
6750         dflt="$extras"
6751         . ./myread
6752         extras="$ans"
6753 esac
6754 case "$extras" in
6755 ''|'none')
6756         val=''
6757         $rm -f ../extras.lst
6758         ;;
6759 *)      echo "(Saving the list of extras for later...)"
6760         echo "$extras" > ../extras.lst
6761         val="'$extras'"
6762         ;;
6763 esac
6764 set extras
6765 eval $setvar
6766 echo " "
6767
6768 : determine where html pages for programs go
6769 set html1dir html1dir none
6770 eval $prefixit
6771 $cat <<EOM
6772
6773 If you wish to install html files for programs in $spackage, indicate 
6774 the appropriate directory here.  To skip installing html files,
6775 answer "none".
6776 EOM
6777 case "$html1dir" in
6778 ''|none|$undef|' ') dflt=none ;;
6779 *) dflt=$html1dir ;;
6780 esac
6781 fn=dn+~
6782 rp="Directory for the main $spackage html pages?"
6783 . ./getfile
6784 html1dir="$ans"
6785 html1direxp="$ansexp"
6786 : Use ' ' for none so value is preserved next time through Configure
6787 $test X"$html1dir" = "X" && html1dir=' '
6788 : Change installation prefix, if necessary.
6789 if $test X"$prefix" != X"$installprefix"; then
6790         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6791 else
6792         installhtml1dir="$html1direxp"
6793 fi
6794
6795 : determine where html pages for libraries and modules go
6796 set html3dir html3dir none
6797 eval $prefixit
6798 $cat <<EOM
6799
6800 If you wish to install html files for modules associated with $spackage,
6801 indicate the appropriate directory here.  To skip installing html files,
6802 answer "none".
6803 EOM
6804 : There is no obvious default.  If they have specified html1dir, then
6805 : try to key off that, possibly changing .../html1 into .../html3.
6806 case "$html3dir" in
6807 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6808 *) dflt=$html3dir ;;
6809 esac
6810 fn=dn+~
6811 rp="Directory for the $spackage module html pages?"
6812 . ./getfile
6813 html3dir="$ans"
6814 html3direxp="$ansexp"
6815 : Use ' ' for none so value is preserved next time through Configure
6816 $test X"$html3dir" = "X" && html3dir=' '
6817 : Change installation prefix, if necessary.
6818 if $test X"$prefix" != X"$installprefix"; then
6819         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6820 else
6821         installhtml3dir="$html3direxp"
6822 fi
6823
6824 : Find perl5.005 or later.
6825 echo "Looking for a previously installed perl5.005 or later... "
6826 case "$perl5" in
6827 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6828                 : Check if this perl is recent and can load a simple module
6829                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6830                         perl5=$tdir/perl
6831                         break;
6832                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6833                         perl5=$tdir/perl5
6834                         break;
6835                 fi
6836         done
6837         ;;
6838 *)      perl5="$perl5"
6839         ;;
6840 esac
6841 case "$perl5" in
6842 '')     echo "None found.  That's ok.";;
6843 *)      echo "Using $perl5." ;;
6844 esac
6845
6846 : Determine list of previous versions to include in @INC
6847 $cat > getverlist <<EOPL
6848 #!$perl5 -w
6849 use File::Basename;
6850 \$api_versionstring = "$api_versionstring";
6851 \$version = "$version";
6852 \$stem = "$sitelib_stem";
6853 \$archname = "$archname";
6854 EOPL
6855         $cat >> getverlist <<'EOPL'
6856 # Can't have leading @ because metaconfig interprets it as a command!
6857 ;@inc_version_list=();
6858 # XXX Redo to do opendir/readdir? 
6859 if (-d $stem) {
6860     chdir($stem);
6861     ;@candidates = glob("5.*");
6862 }
6863 else {
6864     ;@candidates = ();
6865 }
6866
6867 # XXX ToDo:  These comparisons must be reworked when two-digit
6868 # subversions come along, so that 5.7.10 compares as greater than
6869 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6870 # widespread that we can use the built-in version vectors rather
6871 # than reinventing them here.  For 5.6.0, however, we must
6872 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6873 foreach $d (@candidates) {
6874     if ($d lt $version) {
6875         if ($d ge $api_versionstring) {
6876             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6877         }
6878         elsif ($d ge "5.005") {
6879             unshift(@inc_version_list, grep { -d } $d);
6880         }
6881     }
6882     else {
6883         # Skip newer version.  I.e. don't look in
6884         # 5.7.0 if we're installing 5.6.1.
6885     }
6886 }
6887
6888 if (@inc_version_list) {
6889     print join(' ', @inc_version_list);
6890 }
6891 else {
6892     # Blank space to preserve value for next Configure run.
6893     print " ";
6894 }
6895 EOPL
6896 chmod +x getverlist
6897 case "$inc_version_list" in
6898 '')     if test -x "$perl5$exe_ext"; then
6899                 dflt=`$perl5 getverlist`
6900         else
6901                 dflt='none'
6902         fi
6903         ;;
6904 $undef) dflt='none' ;;
6905 *)  eval dflt=\"$inc_version_list\" ;;
6906 esac
6907 case "$dflt" in
6908 ''|' ') dflt=none ;;
6909 esac
6910 case "$dflt" in
6911 5.005) dflt=none ;;
6912 esac
6913 $cat <<EOM
6914
6915 In order to ease the process of upgrading, this version of perl 
6916 can be configured to use modules built and installed with earlier 
6917 versions of perl that were installed under $prefix.  Specify here
6918 the list of earlier versions that this version of perl should check.
6919 If Configure detected no earlier versions of perl installed under
6920 $prefix, then the list will be empty.  Answer 'none' to tell perl
6921 to not search earlier versions.
6922
6923 The default should almost always be sensible, so if you're not sure,
6924 just accept the default.
6925 EOM
6926
6927 rp='List of earlier versions to include in @INC?'
6928 . ./myread
6929 case "$ans" in
6930 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6931 *) inc_version_list="$ans" ;;
6932 esac
6933 case "$inc_version_list" in
6934 ''|' ') 
6935         inc_version_list_init='0';;
6936 *)      inc_version_list_init=`echo $inc_version_list |
6937                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6938         ;;
6939 esac
6940 $rm -f getverlist
6941
6942 : determine whether to install perl also as /usr/bin/perl
6943
6944 echo " "
6945 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6946         $cat <<EOM
6947 Many scripts expect perl to be installed as /usr/bin/perl.
6948
6949 If you want to, I can install the perl you are about to compile
6950 as /usr/bin/perl (in addition to $bin/perl).
6951 EOM
6952         if test -f /usr/bin/perl; then
6953             $cat <<EOM
6954
6955 However, please note that because you already have a /usr/bin/perl,
6956 overwriting that with a new Perl would very probably cause problems.
6957 Therefore I'm assuming you don't want to do that (unless you insist).
6958
6959 EOM
6960             case "$installusrbinperl" in
6961             "$define"|[yY]*)    dflt='y';;
6962             *)                  dflt='n';;
6963             esac
6964         else
6965             $cat <<EOM
6966
6967 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6968
6969 EOM
6970             case "$installusrbinperl" in
6971             "$undef"|[nN]*)     dflt='n';;
6972             *)                  dflt='y';;
6973             esac
6974         fi
6975         rp="Do you want to install perl as /usr/bin/perl?"
6976         . ./myread
6977         case "$ans" in
6978         [yY]*)  val="$define";;
6979         *)      val="$undef" ;;
6980         esac
6981 else
6982         val="$undef"
6983 fi
6984 set installusrbinperl
6985 eval $setvar
6986
6987 echo " "
6988 echo "Checking for GNU C Library..." >&4
6989 cat >try.c <<'EOCP'
6990 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6991    alone are insufficient to distinguish different versions, such as
6992    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6993    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6994 */
6995 #include <stdio.h>
6996 int main(void)
6997 {
6998 #ifdef __GLIBC__
6999 #   ifdef __GLIBC_MINOR__
7000 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7001 #           include <gnu/libc-version.h>
7002             printf("%s\n",  gnu_get_libc_version());
7003 #       else
7004             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7005 #       endif
7006 #   else
7007         printf("%d\n",  __GLIBC__);
7008 #   endif
7009     return 0;
7010 #else
7011     return 1;
7012 #endif
7013 }
7014 EOCP
7015 set try
7016 if eval $compile_ok && $run ./try > glibc.ver; then
7017         val="$define"
7018         gnulibc_version=`$cat glibc.ver`
7019         echo "You are using the GNU C Library version $gnulibc_version"
7020 else
7021         val="$undef"
7022         gnulibc_version=''
7023         echo "You are not using the GNU C Library"
7024 fi
7025 $rm -f try try.* glibc.ver
7026 set d_gnulibc
7027 eval $setvar
7028
7029 : see if nm is to be used to determine whether a symbol is defined or not
7030 case "$usenm" in
7031 '')
7032         dflt=''
7033         case "$d_gnulibc" in
7034         "$define")
7035                 echo " "
7036                 echo "nm probably won't work on the GNU C Library." >&4
7037                 dflt=n
7038                 ;;
7039         esac
7040         case "$dflt" in
7041         '') 
7042                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7043                         echo " "
7044                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7045                         echo "'nm' won't be sufficient on this sytem." >&4
7046                         dflt=n
7047                 fi
7048                 ;;
7049         esac
7050         case "$dflt" in
7051         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7052                 if $test $dflt -gt 20; then
7053                         dflt=y
7054                 else
7055                         dflt=n
7056                 fi
7057                 ;;
7058         esac
7059         ;;
7060 *)
7061         case "$usenm" in
7062         true|$define) dflt=y;;
7063         *) dflt=n;;
7064         esac
7065         ;;
7066 esac
7067 $cat <<EOM
7068
7069 I can use $nm to extract the symbols from your C libraries. This
7070 is a time consuming task which may generate huge output on the disk (up
7071 to 3 megabytes) but that should make the symbols extraction faster. The
7072 alternative is to skip the 'nm' extraction part and to compile a small
7073 test program instead to determine whether each symbol is present. If
7074 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7075 this may be the best solution.
7076
7077 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7078
7079 EOM
7080 rp="Shall I use $nm to extract C symbols from the libraries?"
7081 . ./myread
7082 case "$ans" in
7083 [Nn]*) usenm=false;;
7084 *) usenm=true;;
7085 esac
7086
7087 runnm=$usenm
7088 case "$reuseval" in
7089 true) runnm=false;;
7090 esac
7091
7092 : nm options which may be necessary
7093 case "$nm_opt" in
7094 '') if $test -f /mach_boot; then
7095                 nm_opt=''       # Mach
7096         elif $test -d /usr/ccs/lib; then
7097                 nm_opt='-p'     # Solaris (and SunOS?)
7098         elif $test -f /dgux; then
7099                 nm_opt='-p'     # DG-UX
7100         elif $test -f /lib64/rld; then
7101                 nm_opt='-p'     # 64-bit Irix
7102         else
7103                 nm_opt=''
7104         fi;;
7105 esac
7106
7107 : nm options which may be necessary for shared libraries but illegal
7108 : for archive libraries.  Thank you, Linux.
7109 case "$nm_so_opt" in
7110 '')     case "$myuname" in
7111         *linux*|gnu*)
7112                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7113                         nm_so_opt='--dynamic'
7114                 fi
7115                 ;;
7116         esac
7117         ;;
7118 esac
7119
7120 case "$runnm" in
7121 true)
7122 : get list of predefined functions in a handy place
7123 echo " "
7124 case "$libc" in
7125 '') libc=unknown
7126         case "$libs" in
7127         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7128         esac
7129         ;;
7130 esac
7131 case "$libs" in
7132 '') ;;
7133 *)  for thislib in $libs; do
7134         case "$thislib" in
7135         -lc|-lc_s)
7136                 : Handle C library specially below.
7137                 ;;
7138         -l*)
7139                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7140                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7141                         :
7142                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7143                         :
7144                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7145                         :
7146                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7147                         :
7148                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7149                         :
7150                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7151                         :
7152                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7153                         :
7154                 else
7155                         try=''
7156                 fi
7157                 libnames="$libnames $try"
7158                 ;;
7159         *) libnames="$libnames $thislib" ;;
7160         esac
7161         done
7162         ;;
7163 esac
7164 xxx=normal
7165 case "$libc" in
7166 unknown)
7167         set /lib/libc.$so
7168         for xxx in $libpth; do
7169                 $test -r $1 || set $xxx/libc.$so
7170                 : The messy sed command sorts on library version numbers.
7171                 $test -r $1 || \
7172                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7173                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7174                                 h
7175                                 s/[0-9][0-9]*/0000&/g
7176                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7177                                 G
7178                                 s/\n/ /' | \
7179                          $sort | $sed -e 's/^.* //'`
7180                 eval set \$$#
7181         done
7182         $test -r $1 || set /usr/ccs/lib/libc.$so
7183         $test -r $1 || set /lib/libsys_s$_a
7184         ;;
7185 *)
7186         set blurfl
7187         ;;
7188 esac
7189 if $test -r "$1"; then
7190         echo "Your (shared) C library seems to be in $1."
7191         libc="$1"
7192 elif $test -r /lib/libc && $test -r /lib/clib; then
7193         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7194         xxx=apollo
7195         libc='/lib/clib /lib/libc'
7196         if $test -r /lib/syslib; then
7197                 echo "(Your math library is in /lib/syslib.)"
7198                 libc="$libc /lib/syslib"
7199         fi
7200 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7201         echo "Your C library seems to be in $libc, as you said before."
7202 elif $test -r $incpath/usr/lib/libc$_a; then
7203         libc=$incpath/usr/lib/libc$_a;
7204         echo "Your C library seems to be in $libc.  That's fine."
7205 elif $test -r /lib/libc$_a; then
7206         libc=/lib/libc$_a;
7207         echo "Your C library seems to be in $libc.  You're normal."
7208 else
7209         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7210                 :
7211         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7212                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7213         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7214                 :
7215         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7216                 :
7217         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7218                 :
7219         else
7220                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7221         fi
7222         if $test -r "$tans"; then
7223                 echo "Your C library seems to be in $tans, of all places."
7224                 libc=$tans
7225         else
7226                 libc='blurfl'
7227         fi
7228 fi
7229 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7230         dflt="$libc"
7231         cat <<EOM
7232
7233 If the guess above is wrong (which it might be if you're using a strange
7234 compiler, or your machine supports multiple models), you can override it here.
7235
7236 EOM
7237 else
7238         dflt=''
7239         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7240         cat >&4 <<EOM
7241 I can't seem to find your C library.  I've looked in the following places:
7242
7243 EOM
7244         $sed 's/^/      /' libpath
7245         cat <<EOM
7246
7247 None of these seems to contain your C library. I need to get its name...
7248
7249 EOM
7250 fi
7251 fn=f
7252 rp='Where is your C library?'
7253 . ./getfile
7254 libc="$ans"
7255
7256 echo " "
7257 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7258 set X `cat libnames`
7259 shift
7260 xxx=files
7261 case $# in 1) xxx=file; esac
7262 echo "Extracting names from the following $xxx for later perusal:" >&4
7263 echo " "
7264 $sed 's/^/      /' libnames >&4
7265 echo " "
7266 $echo $n "This may take a while...$c" >&4
7267
7268 for file in $*; do
7269         case $file in
7270         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7271         *) $nm $nm_opt $file 2>/dev/null;;
7272         esac
7273 done >libc.tmp
7274
7275 $echo $n ".$c"
7276 $grep fprintf libc.tmp > libc.ptf
7277 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7278 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7279 xxx='[ADTSIW]'
7280 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7281         eval $xscan;\
7282         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7283                 eval $xrun
7284 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7285         eval $xscan;\
7286         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7287                 eval $xrun
7288 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7289         eval $xscan;\
7290         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7291                 eval $xrun
7292 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7293         eval $xscan;\
7294         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7295                 eval $xrun
7296 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7297         eval $xscan;\
7298         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7299                 eval $xrun
7300 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7301         eval $xscan;\
7302         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7303                 eval $xrun
7304 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7305                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7306         eval $xscan;\
7307         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7308                 eval $xrun
7309 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7310         eval $xscan;\
7311         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7312                 eval $xrun
7313 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7314         eval $xscan;\
7315         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7316                 eval $xrun
7317 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7318         eval $xscan;\
7319         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7320                 eval $xrun
7321 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7322         eval $xscan;\
7323         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7324                 eval $xrun
7325 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7326         eval $xscan;\
7327         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7328                 eval $xrun
7329 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7330         eval $xscan;\
7331         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7332                 eval $xrun
7333 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7334         eval $xscan;\
7335         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7336                 eval $xrun
7337 else
7338         $nm -p $* 2>/dev/null >libc.tmp
7339         $grep fprintf libc.tmp > libc.ptf
7340         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7341                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7342         then
7343                 nm_opt='-p'
7344                 eval $xrun
7345         else
7346                 echo " "
7347                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7348                 com=''
7349                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7350                         for thisname in $libnames $libc; do
7351                                 $ar t $thisname >>libc.tmp
7352                         done
7353                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7354                         echo "Ok." >&4
7355                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7356                         # Repeat libc to extract forwarders to DLL entries too
7357                         for thisname in $libnames $libc; do
7358                                 $ar tv $thisname >>libc.tmp
7359                                 # Revision 50 of EMX has bug in $ar.
7360                                 # it will not extract forwarders to DLL entries
7361                                 # Use emximp which will extract exactly them.
7362                                 emximp -o tmp.imp $thisname \
7363                                     2>/dev/null && \
7364                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7365                                     < tmp.imp >>libc.tmp
7366                                 $rm tmp.imp
7367                         done
7368                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7369                         echo "Ok." >&4
7370                 else
7371                         echo "$ar didn't seem to work right." >&4
7372                         echo "Maybe this is a Cray...trying bld instead..." >&4
7373                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7374                         then
7375                                 for thisname in $libnames; do
7376                                         bld t $libnames | \
7377                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7378                                         $ar t $thisname >>libc.tmp
7379                                 done
7380                                 echo "Ok." >&4
7381                         else
7382                                 echo "That didn't work either.  Giving up." >&4
7383                                 exit 1
7384                         fi
7385                 fi
7386         fi
7387 fi
7388 nm_extract="$com"
7389 case "$PASE" in
7390 define)
7391     echo " "
7392     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7393     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7394     ;;
7395 *)  if $test -f /lib/syscalls.exp; then
7396         echo " "
7397         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7398         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7399     fi
7400     ;;
7401 esac
7402 ;;
7403 esac
7404 $rm -f libnames libpath
7405
7406 : see if dld is available
7407 set dld.h i_dld
7408 eval $inhdr
7409
7410 : is a C symbol defined?
7411 csym='tlook=$1;
7412 case "$3" in
7413 -v) tf=libc.tmp; tdc="";;
7414 -a) tf=libc.tmp; tdc="[]";;
7415 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7416 esac;
7417 tx=yes;
7418 case "$reuseval-$4" in
7419 true-) ;;
7420 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7421 esac;
7422 case "$tx" in
7423 yes)
7424         tval=false;
7425         if $test "$runnm" = true; then
7426                 if $contains $tlook $tf >/dev/null 2>&1; then
7427                         tval=true;
7428                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7429                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7430                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7431                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7432                         $rm -f try$_exe try.c core core.* try.core;
7433                 fi;
7434         else
7435                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7436                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7437                 $rm -f try$_exe try.c;
7438         fi;
7439         ;;
7440 *)
7441         case "$tval" in
7442         $define) tval=true;;
7443         *) tval=false;;
7444         esac;
7445         ;;
7446 esac;
7447 eval "$2=$tval"'
7448
7449 : define an is-in-libc? function
7450 inlibc='echo " "; td=$define; tu=$undef;
7451 sym=$1; var=$2; eval "was=\$$2";
7452 tx=yes;
7453 case "$reuseval$was" in
7454 true) ;;
7455 true*) tx=no;;
7456 esac;
7457 case "$tx" in
7458 yes)
7459         set $sym tres -f;
7460         eval $csym;
7461         case "$tres" in
7462         true)
7463                 echo "$sym() found." >&4;
7464                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7465         *)
7466                 echo "$sym() NOT found." >&4;
7467                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7468         esac;;
7469 *)
7470         case "$was" in
7471         $define) echo "$sym() found." >&4;;
7472         *) echo "$sym() NOT found." >&4;;
7473         esac;;
7474 esac'
7475
7476 : see if dlopen exists
7477 xxx_runnm="$runnm"
7478 runnm=false
7479 set dlopen d_dlopen
7480 eval $inlibc
7481 runnm="$xxx_runnm"
7482
7483 : determine which dynamic loading, if any, to compile in
7484 echo " "
7485 dldir="ext/DynaLoader"
7486 case "$usedl" in
7487 $define|y|true)
7488         dflt='y'
7489         usedl="$define"
7490         ;;
7491 $undef|n|false)
7492         dflt='n'
7493         usedl="$undef"
7494         ;;
7495 *) 
7496         dflt='n'
7497         case "$d_dlopen" in
7498             $define) dflt='y' ;;
7499         esac
7500         case "$i_dld" in
7501             $define) dflt='y' ;;
7502         esac
7503         : Does a dl_xxx.xs file exist for this operating system
7504         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7505         ;;
7506 esac
7507 rp="Do you wish to use dynamic loading?"
7508 . ./myread
7509 usedl="$ans"
7510 case "$ans" in
7511 y*) usedl="$define"
7512         case "$dlsrc" in
7513         '')
7514                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7515                         dflt="$dldir/dl_${osname}.xs"
7516                 elif $test "$d_dlopen" = "$define" ; then
7517                         dflt="$dldir/dl_dlopen.xs"
7518                 elif $test "$i_dld" = "$define" ; then
7519                         dflt="$dldir/dl_dld.xs"
7520                 else
7521                         dflt=''
7522                 fi
7523                 ;;
7524         *)      dflt="$dldir/$dlsrc"
7525                 ;;
7526         esac
7527     echo "The following dynamic loading files are available:"
7528         : Can not go over to $dldir because getfile has path hard-coded in.
7529         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7530         rp="Source file to use for dynamic loading"
7531         fn="fne"
7532         gfpth="$src"
7533         . ./getfile
7534         usedl="$define"
7535         : emulate basename
7536         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7537
7538         $cat << EOM
7539
7540 Some systems may require passing special flags to $cc -c to
7541 compile modules that will be used to create a shared library.
7542 To use no flags, say "none".
7543
7544 EOM
7545     case "$cccdlflags" in
7546     '') case "$gccversion" in
7547                 '') case "$osname" in
7548                         hpux)   dflt='+z' ;;
7549                         next)   dflt='none' ;;
7550                         irix*)  dflt='-KPIC' ;;
7551                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7552                         sunos)  dflt='-pic' ;;
7553                         *)      dflt='none' ;;
7554                     esac
7555                         ;;
7556                 *)  case "$osname" in
7557                         darwin) dflt='none' ;;
7558                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7559                         *)      dflt='-fpic' ;;
7560                     esac ;;
7561             esac ;;
7562         ' ') dflt='none' ;;
7563     *)  dflt="$cccdlflags" ;;
7564     esac
7565     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7566     . ./myread
7567     case "$ans" in
7568     none) cccdlflags=' ' ;;
7569     *) cccdlflags="$ans" ;;
7570     esac
7571
7572     cat << EOM
7573
7574 Some systems use ld to create libraries that can be dynamically loaded,
7575 while other systems (such as those using ELF) use $cc.
7576
7577 EOM
7578         case "$ld" in
7579         '')     $cat >try.c <<EOM
7580 /* Test for whether ELF binaries are produced */
7581 #include <fcntl.h>
7582 #$i_stdlib I_STDLIB
7583 #ifdef I_STDLIB
7584 #include <stdlib.h>
7585 #endif
7586 int main() {
7587         char b[4];
7588         int i = open("a.out",O_RDONLY);
7589         if(i == -1) 
7590                 exit(1); /* fail */
7591         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7592                 exit(0); /* succeed (yes, it's ELF) */
7593         else
7594                 exit(1); /* fail */
7595 }
7596 EOM
7597                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7598                         cat <<EOM
7599 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7600 EOM
7601                         dflt="$cc"
7602                 else
7603                         echo "I'll use ld to build dynamic libraries."
7604                         dflt='ld'
7605                 fi
7606                 rm -f try.c a.out
7607                 ;;
7608         *)      dflt="$ld"
7609                 ;;
7610         esac
7611
7612     rp="What command should be used to create dynamic libraries?"
7613     . ./myread
7614         ld="$ans"
7615
7616     cat << EOM
7617
7618 Some systems may require passing special flags to $ld to create a
7619 library that can be dynamically loaded.  If your ld flags include
7620 -L/other/path options to locate libraries outside your loader's normal
7621 search path, you may need to specify those -L options here as well.  To
7622 use no flags, say "none".
7623
7624 EOM
7625     case "$lddlflags" in
7626     '') case "$osname" in
7627                         beos) dflt='-nostart' ;;
7628                         hpux) dflt='-b';
7629                               case "$gccversion" in
7630                               '') dflt="$dflt +vnocompatwarnings" ;;
7631                               esac
7632                               ;;        
7633                         linux|irix*|gnu*)       dflt='-shared' ;;
7634                         next)  dflt='none' ;;
7635                         solaris) dflt='-G' ;;
7636                         sunos) dflt='-assert nodefinitions' ;;
7637                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7638                 *)     dflt='none' ;;
7639                         esac
7640                         ;;
7641     *) dflt="$lddlflags" ;;
7642     esac
7643
7644         : Try to guess additional flags to pick up local libraries.
7645         : Be careful not to append to a plain 'none'
7646         case "$dflt" in
7647         none) dflt='' ;;
7648         esac
7649         for thisflag in $ldflags; do
7650                 case "$thisflag" in
7651                 -L*|-R*|-Wl,-R*)
7652                         case " $dflt " in
7653                         *" $thisflag "*) ;;
7654                         *) dflt="$dflt $thisflag" ;;
7655                         esac
7656                         ;;
7657                 esac
7658         done
7659
7660         case "$dflt" in
7661         ''|' ') dflt='none' ;;
7662         esac
7663
7664     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7665     . ./myread
7666     case "$ans" in
7667     none) lddlflags=' ' ;;
7668     *) lddlflags="$ans" ;;
7669     esac
7670
7671         cat <<EOM
7672
7673 Some systems may require passing special flags to $cc to indicate that
7674 the resulting executable will use dynamic linking.  To use no flags,
7675 say "none".
7676
7677 EOM
7678     case "$ccdlflags" in
7679     '') case "$osname" in
7680             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7681             next|sunos) dflt='none' ;;
7682             *)          dflt='none' ;;
7683             esac ;;
7684     ' ')  dflt='none' ;;
7685     *)  dflt="$ccdlflags" ;;
7686     esac
7687     rp="Any special flags to pass to $cc to use dynamic linking?"
7688     . ./myread
7689     case "$ans" in
7690     none) ccdlflags=' ' ;;
7691     *) ccdlflags="$ans" ;;
7692     esac
7693     ;;
7694 *)  usedl="$undef"
7695         ld='ld'
7696     dlsrc='dl_none.xs'
7697     lddlflags=''
7698     ccdlflags=''
7699     ;;
7700 esac
7701
7702 also=''
7703 case "$usedl" in
7704 $undef)
7705         # No dynamic loading being used, so don't bother even to prompt.
7706         useshrplib='false'
7707         ;;
7708 *)      case "$useshrplib" in
7709         '')     case "$osname" in
7710                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7711                         dflt=y
7712                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7713                         ;;
7714                 next*)
7715                         case "$osvers" in
7716                         4*)     dflt=y
7717                                 also='Building a shared libperl is needed for MAB support.'
7718                                 ;;
7719                         *)      dflt=n
7720                                 ;;
7721                         esac
7722                         ;;
7723                 *)      dflt=n
7724                         ;;
7725                 esac
7726                 ;;
7727         $define|true|[Yy]*)
7728                 dflt=y
7729                 ;;
7730         *)      dflt=n
7731                 ;;
7732         esac
7733         $cat << EOM
7734
7735 The perl executable is normally obtained by linking perlmain.c with
7736 libperl${_a}, any static extensions (usually just DynaLoader), and
7737 any other libraries needed on this system (such as -lm, etc.).  Since
7738 your system supports dynamic loading, it is probably possible to build
7739 a shared libperl.$so.  If you will have more than one executable linked
7740 to libperl.$so, this will significantly reduce the size of each
7741 executable, but it may have a noticeable affect on performance.  The
7742 default is probably sensible for your system.
7743 $also
7744
7745 EOM
7746         rp="Build a shared libperl.$so (y/n)"
7747         . ./myread
7748         case "$ans" in
7749         true|$define|[Yy]*)
7750                 useshrplib='true'  ;;
7751         *)      useshrplib='false' ;;
7752         esac
7753         ;;
7754 esac
7755
7756 case "$useshrplib" in
7757 true)
7758         case "$libperl" in
7759         '')
7760                 # Figure out a good name for libperl.so.  Since it gets stored in
7761                 # a version-specific architecture-dependent library, the version
7762                 # number isn't really that important, except for making cc/ld happy.
7763                 #
7764                 # A name such as libperl.so.3.1
7765                 majmin="libperl.$so.$patchlevel.$subversion"
7766                 # A name such as libperl.so.301
7767                 majonly=`echo $patchlevel $subversion |
7768                         $awk '{printf "%d%02d", $1, $2}'`
7769                 majonly=libperl.$so.$majonly
7770                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7771                 # rely on figuring it out from the naming of libc.
7772                 case "${osname}${osvers}" in
7773                 next4*)
7774                         dflt=libperl.5.$so
7775                         # XXX How handle the --version stuff for MAB?
7776                         ;;
7777                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7778                         dflt=libperl.$so
7779                         ;;
7780                 cygwin*) # ld links against an importlib
7781                         dflt=libperl$lib_ext
7782                         ;;
7783                 *)      # Try to guess based on whether libc has major.minor.
7784                         case "$libc" in
7785                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7786                         *libc.$so.[0-9]*) dflt=$majonly ;;
7787                         *)      dflt=libperl.$so ;;
7788                         esac
7789                         ;;
7790                 esac
7791                 ;;
7792         *)      dflt=$libperl
7793                 ;;
7794         esac
7795         cat << EOM
7796
7797 I need to select a good name for the shared libperl.  If your system uses
7798 library names with major and minor numbers, then you might want something
7799 like $majmin.  Alternatively, if your system uses a single version
7800 number for shared libraries, then you might want to use $majonly.
7801 Or, your system might be quite happy with a simple libperl.$so.
7802
7803 Since the shared libperl will get installed into a version-specific
7804 architecture-dependent directory, the version number of the shared perl
7805 library probably isn't important, so the default should be o.k.
7806
7807 EOM
7808         rp='What name do you want to give to the shared libperl?'
7809         . ./myread
7810         libperl=$ans
7811         echo "Ok, I'll use $libperl"
7812         ;;
7813 *)
7814         libperl="libperl${_a}"
7815         ;;
7816 esac
7817
7818 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7819 case "$shrpdir" in
7820 '') ;;
7821 *)      $cat >&4 <<EOM
7822 WARNING:  Use of the shrpdir variable for the installation location of
7823 the shared $libperl is not supported.  It was never documented and
7824 will not work in this version.  Let me (perlbug@perl.org)
7825 know of any problems this may cause.
7826
7827 EOM
7828         case "$shrpdir" in
7829         "$archlibexp/CORE")
7830                 $cat >&4 <<EOM
7831 But your current setting of $shrpdir is
7832 the default anyway, so it's harmless.
7833 EOM
7834                 ;;
7835         *)
7836                 $cat >&4 <<EOM
7837 Further, your current attempted setting of $shrpdir
7838 conflicts with the value of $archlibexp/CORE
7839 that installperl will use.
7840 EOM
7841                 ;;
7842         esac
7843         ;;
7844 esac
7845
7846 # How will the perl executable find the installed shared $libperl?
7847 # Add $xxx to ccdlflags.
7848 # If we can't figure out a command-line option, use $shrpenv to
7849 # set env LD_RUN_PATH.  The main perl makefile uses this.
7850 shrpdir=$archlibexp/CORE
7851 xxx=''
7852 tmp_shrpenv=''
7853 if "$useshrplib"; then
7854     case "$osname" in 
7855         aix)
7856                 # We'll set it in Makefile.SH...
7857                 ;;
7858         solaris)
7859                 xxx="-R $shrpdir"
7860                 ;;
7861         freebsd|netbsd|openbsd|interix)
7862                 xxx="-Wl,-R$shrpdir"
7863                 ;;
7864         bsdos|linux|irix*|dec_osf|gnu*)
7865                 xxx="-Wl,-rpath,$shrpdir"
7866                 ;;
7867         next)
7868                 # next doesn't like the default...
7869                 ;;
7870         beos)
7871                 # beos doesn't like the default, either.
7872                 ;;
7873         hpux*)
7874                 # hpux doesn't like the default, either.
7875                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7876                 ;;
7877         *)
7878                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7879                 ;;
7880         esac
7881         case "$xxx" in
7882         '') ;;
7883         *)      
7884                 # Only add $xxx if it isn't already in ccdlflags.
7885                 case " $ccdlflags " in
7886                 *" $xxx "*)     ;;
7887                 *)      ccdlflags="$ccdlflags $xxx"
7888                         cat <<EOM >&4
7889
7890 Adding $xxx to the flags
7891 passed to $ld so that the perl executable will find the 
7892 installed shared $libperl.
7893
7894 EOM
7895                         ;;
7896                 esac
7897                 ;;
7898         esac
7899 fi
7900 # Fix ccdlflags in AIX for building external extensions.
7901 # (For building Perl itself bare -bE:perl.exp is needed,
7902 #  Makefile.SH takes care of this.)
7903 case "$osname" in
7904 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7905 esac
7906 # Respect a hint or command-line value.
7907 case "$shrpenv" in
7908 '') shrpenv="$tmp_shrpenv" ;;
7909 esac
7910 case "$ldlibpthname" in
7911 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7912 none)   ldlibpthname='' ;;
7913 esac
7914
7915 : determine where manual pages are on this system
7916 echo " "
7917 case "$sysman" in
7918 '') 
7919         syspath='/usr/share/man/man1 /usr/man/man1'
7920         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7921         syspath="$syspath /usr/man/u_man/man1"
7922         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7923         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7924         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7925         sysman=`./loc . /usr/man/man1 $syspath`
7926         ;;
7927 esac
7928 if $test -d "$sysman"; then
7929         echo "System manual is in $sysman." >&4
7930 else
7931         echo "Could not find manual pages in source form." >&4
7932 fi
7933
7934 : determine where manual pages go
7935 set man1dir man1dir none
7936 eval $prefixit
7937 $cat <<EOM
7938
7939 $spackage has manual pages available in source form.
7940 EOM
7941 case "$nroff" in
7942 nroff)
7943         echo "However, you don't have nroff, so they're probably useless to you."
7944         case "$man1dir" in
7945         '') man1dir="none";;
7946         esac;;
7947 esac
7948 echo "If you don't want the manual sources installed, answer 'none'."
7949 case "$man1dir" in
7950 ' ') dflt=none
7951         ;;
7952 '')
7953         lookpath="$prefixexp/share/man/man1"
7954         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7955         lookpath="$lookpath $prefixexp/man/p_man/man1"
7956         lookpath="$lookpath $prefixexp/man/u_man/man1"
7957         lookpath="$lookpath $prefixexp/man/man.1"
7958         case "$sysman" in
7959         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7960         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7961         esac
7962         set dflt
7963         eval $prefixup
7964         ;;
7965 *)  dflt="$man1dir"
7966         ;;
7967 esac
7968 echo " "
7969 fn=dn+~
7970 rp="Where do the main $spackage manual pages (source) go?"
7971 . ./getfile
7972 if $test "X$man1direxp" != "X$ansexp"; then
7973         installman1dir=''
7974 fi
7975 man1dir="$ans"
7976 man1direxp="$ansexp"
7977 case "$man1dir" in
7978 '')     man1dir=' '
7979         installman1dir='';;
7980 esac
7981
7982 : Change installation prefix, if necessary.
7983 if $test X"$prefix" != X"$installprefix"; then
7984         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7985 else
7986         installman1dir="$man1direxp"
7987 fi
7988
7989 : What suffix to use on installed man pages
7990
7991 case "$man1dir" in
7992 ' ')
7993         man1ext='0'
7994         ;;
7995 *)
7996         rp="What suffix should be used for the main $spackage man pages?"
7997         case "$man1ext" in
7998         '')     case "$man1dir" in
7999                 *1)  dflt=1 ;;
8000                 *1p) dflt=1p ;;
8001                 *1pm) dflt=1pm ;;
8002                 *l) dflt=l;;
8003                 *n) dflt=n;;
8004                 *o) dflt=o;;
8005                 *p) dflt=p;;
8006                 *C) dflt=C;;
8007                 *L) dflt=L;;
8008                 *L1) dflt=L1;;
8009                 *) dflt=1;;
8010                 esac
8011                 ;;
8012         *)      dflt="$man1ext";;
8013         esac
8014         . ./myread
8015         man1ext="$ans"
8016         ;;
8017 esac
8018
8019 : see if we can have long filenames
8020 echo " "
8021 first=123456789abcdef
8022 $rm -f $first
8023 if (echo hi >$first) 2>/dev/null; then
8024         if $test -f 123456789abcde; then
8025                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8026                 val="$undef"
8027         else
8028                 echo 'You can have filenames longer than 14 characters.'>&4
8029                 val="$define"
8030         fi
8031 else
8032         $cat <<'EOM'
8033 You can't have filenames longer than 14 chars.
8034 You can't even think about them!
8035 EOM
8036         val="$undef"
8037 fi 
8038 set d_flexfnam
8039 eval $setvar
8040 $rm -rf 123456789abcde*
8041
8042 : determine where library module manual pages go
8043 set man3dir man3dir none
8044 eval $prefixit
8045 $cat <<EOM
8046
8047 $spackage has manual pages for many of the library modules.
8048 EOM
8049
8050 case "$nroff" in
8051 nroff)
8052         $cat <<'EOM'
8053 However, you don't have nroff, so they're probably useless to you.
8054 EOM
8055         case "$man3dir" in
8056         '') man3dir="none";;
8057         esac;;
8058 esac
8059
8060 case "$d_flexfnam" in
8061 undef)
8062         $cat <<'EOM'
8063 However, your system can't handle the long file names like File::Basename.3. 
8064 EOM
8065         case "$man3dir" in
8066         '') man3dir="none";;
8067         esac;;
8068 esac
8069
8070 echo "If you don't want the manual sources installed, answer 'none'."
8071 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8072 case "$man3dir" in
8073 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8074         if $test -d "$privlib/man/man3"; then
8075                 cat <<EOM >&4
8076
8077 WARNING:  Previous versions of perl installed man3 pages into
8078 $privlib/man/man3.  This version will suggest a 
8079 new default of $dflt.  
8080 EOM
8081                 tdflt=$dflt
8082                 dflt='n'
8083                 rp='Do you wish to preserve the old behavior?(y/n)'
8084                 . ./myread
8085                 case "$ans" in
8086                 y*) dflt="$privlib/man/man3" ;;
8087                 *)  dflt=$tdflt ;;
8088                 esac
8089     fi
8090         ;;
8091 *)      dflt="$man3dir" ;;
8092 esac
8093 case "$dflt" in
8094 ' ') dflt=none ;;
8095 esac
8096 echo " "
8097 fn=dn+~
8098 rp="Where do the $package library man pages (source) go?"
8099 . ./getfile
8100 man3dir="$ans"
8101 man3direxp="$ansexp"
8102 case "$man3dir" in
8103 '')     man3dir=' '
8104         installman3dir='';;
8105 esac
8106
8107 : Change installation prefix, if necessary.
8108 if $test X"$prefix" != X"$installprefix"; then
8109         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8110 else
8111         installman3dir="$man3direxp"
8112 fi
8113
8114 : What suffix to use on installed man pages
8115 case "$man3dir" in
8116 ' ')
8117         man3ext='0'
8118         ;;
8119 *)
8120         rp="What suffix should be used for the $package library man pages?"
8121         case "$man3ext" in
8122         '')     case "$man3dir" in
8123                 *3)  dflt=3 ;;
8124                 *3p) dflt=3p ;;
8125                 *3pm) dflt=3pm ;;
8126                 *l) dflt=l;;
8127                 *n) dflt=n;;
8128                 *o) dflt=o;;
8129                 *p) dflt=p;;
8130                 *C) dflt=C;;
8131                 *L) dflt=L;;
8132                 *L3) dflt=L3;;
8133                 *) dflt=3;;
8134                 esac
8135                 ;;
8136         *)      dflt="$man3ext";;
8137         esac
8138         . ./myread
8139         man3ext="$ans"
8140         ;;
8141 esac
8142
8143 : see if we have to deal with yellow pages, now NIS.
8144 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8145         if $test -f /usr/etc/nibindd; then
8146                 echo " "
8147                 echo "I'm fairly confident you're on a NeXT."
8148                 echo " "
8149                 rp='Do you get the hosts file via NetInfo?'
8150                 dflt=y
8151                 case "$hostcat" in
8152                 nidump*) ;;
8153                 '') ;;
8154                 *) dflt=n;;
8155                 esac
8156                 . ./myread
8157                 case "$ans" in
8158                 y*) hostcat='nidump hosts .';;
8159                 *)      case "$hostcat" in
8160                         nidump*) hostcat='';;
8161                         esac
8162                         ;;
8163                 esac
8164         fi
8165         case "$hostcat" in
8166         nidump*) ;;
8167         *)
8168                 case "$hostcat" in
8169                 *ypcat*) dflt=y;;
8170                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8171                                 dflt=y
8172                         else
8173                                 dflt=n
8174                         fi;;
8175                 *) dflt=n;;
8176                 esac
8177                 echo " "
8178                 rp='Are you getting the hosts file via yellow pages?'
8179                 . ./myread
8180                 case "$ans" in
8181                 y*) hostcat='ypcat hosts';;
8182                 *) hostcat='cat /etc/hosts';;
8183                 esac
8184                 ;;
8185         esac
8186 fi
8187 case "$hostcat" in
8188 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8189 esac
8190 case "$groupcat" in
8191 '') test -f /etc/group && groupcat='cat /etc/group';;
8192 esac
8193 case "$passcat" in
8194 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8195 esac
8196
8197 : now get the host name
8198 echo " "
8199 echo "Figuring out host name..." >&4
8200 case "$myhostname" in
8201 '') cont=true
8202         echo 'Maybe "hostname" will work...'
8203         if tans=`sh -c hostname 2>&1` ; then
8204                 myhostname=$tans
8205                 phostname=hostname
8206                 cont=''
8207         fi
8208         ;;
8209 *) cont='';;
8210 esac
8211 if $test "$cont"; then
8212         if ./xenix; then
8213                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8214                 if tans=`cat /etc/systemid 2>&1` ; then
8215                         myhostname=$tans
8216                         phostname='cat /etc/systemid'
8217                         echo "Whadyaknow.  Xenix always was a bit strange..."
8218                         cont=''
8219                 fi
8220         elif $test -r /etc/systemid; then
8221                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8222         fi
8223 fi
8224 if $test "$cont"; then
8225         echo 'No, maybe "uuname -l" will work...'
8226         if tans=`sh -c 'uuname -l' 2>&1` ; then
8227                 myhostname=$tans
8228                 phostname='uuname -l'
8229         else
8230                 echo 'Strange.  Maybe "uname -n" will work...'
8231                 if tans=`sh -c 'uname -n' 2>&1` ; then
8232                         myhostname=$tans
8233                         phostname='uname -n'
8234                 else
8235                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8236                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8237                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8238                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8239                         else
8240                                 case "$myhostname" in
8241                                 '') echo "Does this machine have an identity crisis or something?"
8242                                         phostname='';;
8243                                 *)
8244                                         echo "Well, you said $myhostname before..."
8245                                         phostname='echo $myhostname';;
8246                                 esac
8247                         fi
8248                 fi
8249         fi
8250 fi
8251 case "$myhostname" in
8252 '') myhostname=noname ;;
8253 esac
8254 : you do not want to know about this
8255 set $myhostname
8256 myhostname=$1
8257
8258 : verify guess
8259 if $test "$myhostname" ; then
8260         dflt=y
8261         rp='Your host name appears to be "'$myhostname'".'" Right?"
8262         . ./myread
8263         case "$ans" in
8264         y*) ;;
8265         *) myhostname='';;
8266         esac
8267 fi
8268
8269 : bad guess or no guess
8270 while $test "X$myhostname" = X ; do
8271         dflt=''
8272         rp="Please type the (one word) name of your host:"
8273         . ./myread
8274         myhostname="$ans"
8275 done
8276
8277 : translate upper to lower if necessary
8278 case "$myhostname" in
8279 *[A-Z]*)
8280         echo "(Normalizing case in your host name)"
8281         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8282         ;;
8283 esac
8284
8285 case "$myhostname" in
8286 *.*)
8287         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8288         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8289         echo "(Trimming domain name from host name--host name is now $myhostname)"
8290         ;;
8291 *) case "$mydomain" in
8292         '')
8293                 {
8294                         test "X$hostcat" = "Xypcat hosts" &&
8295                         ypmatch "$myhostname" hosts 2>/dev/null |\
8296                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8297                         $test -s hosts
8298                 } || {
8299                         test "X$hostcat" != "X" &&
8300                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8301                                         /[       ]$myhostname[  . ]/p" > hosts
8302                 }
8303                 tmp_re="[       . ]"
8304                 if $test -f hosts; then
8305                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8306                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8307                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8308                                 hosts | $sort | $uniq | \
8309                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8310                         case `$echo X$dflt` in
8311                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8312                                 dflt=.
8313                                 ;;
8314                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8315                                 ;;
8316                         esac
8317                 else
8318                         echo "(I cannot locate a hosts database anywhere)"
8319                         dflt=.
8320                 fi
8321                 case "$dflt" in
8322                 .)
8323                         tans=`./loc resolv.conf X /etc /usr/etc`
8324                         if $test -f "$tans"; then
8325                                 echo "(Attempting domain name extraction from $tans)"
8326                                 dflt=.`$sed -n -e 's/   / /g' \
8327                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8328                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8329                                 case "$dflt" in
8330                                 .) dflt=.`$sed -n -e 's/        / /g' \
8331                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8332                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8333                                         ;;
8334                                 esac
8335                         fi
8336                         ;;
8337                 esac
8338                 case "$dflt" in
8339                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8340                         dflt=.`sh -c domainname 2>/dev/null`
8341                         case "$dflt" in
8342                         '') dflt='.';;
8343                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8344                         esac
8345                         ;;
8346                 esac
8347                 case "$dflt$osname" in
8348                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8349                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8350                         ;;
8351                 esac
8352                 case "$dflt" in
8353                 .) echo "(Lost all hope -- silly guess then)"
8354                         dflt='.nonet'
8355                         ;;
8356                 esac
8357                 $rm -f hosts
8358                 ;;
8359         *) dflt="$mydomain";;
8360         esac;;
8361 esac
8362 echo " "
8363 rp="What is your domain name?"
8364 . ./myread
8365 tans="$ans"
8366 case "$ans" in
8367 '') ;;
8368 .*) ;;
8369 *) tans=".$tans";;
8370 esac
8371 mydomain="$tans"
8372
8373 : translate upper to lower if necessary
8374 case "$mydomain" in
8375 *[A-Z]*)
8376         echo "(Normalizing case in your domain name)"
8377         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8378         ;;
8379 esac
8380
8381 : a little sanity check here
8382 case "$phostname" in
8383 '') ;;
8384 *)
8385         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8386         $myhostname$mydomain|$myhostname) ;;
8387         *)
8388                 case "$phostname" in
8389                 sed*)
8390                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8391                         ;;
8392                 *)
8393                         echo "(That doesn't agree with your $phostname command, by the way.)"
8394                         ;;
8395                 esac
8396         ;;
8397         esac
8398         ;;
8399 esac
8400
8401 $cat <<EOM
8402
8403 I need to get your e-mail address in Internet format if possible, i.e.
8404 something like user@host.domain. Please answer accurately since I have
8405 no easy means to double check it. The default value provided below
8406 is most probably close to reality but may not be valid from outside
8407 your organization...
8408
8409 EOM
8410 cont=x
8411 while test "$cont"; do
8412         case "$cf_email" in
8413         '') dflt="$cf_by@$myhostname$mydomain";;
8414         *) dflt="$cf_email";;
8415         esac
8416         rp='What is your e-mail address?'
8417         . ./myread
8418         cf_email="$ans"
8419         case "$cf_email" in
8420         *@*.*) cont='' ;;
8421         *)
8422                 rp='Address does not look like an Internet one.  Use it anyway?'
8423                 case "$fastread" in
8424                 yes) dflt=y ;;
8425                 *) dflt=n ;;
8426                 esac
8427                 . ./myread
8428                 case "$ans" in
8429                 y*) cont='' ;;
8430                 *) echo " " ;;
8431                 esac
8432                 ;;
8433         esac
8434 done
8435
8436 $cat <<EOM
8437
8438 If you or somebody else will be maintaining perl at your site, please
8439 fill in the correct e-mail address here so that they may be contacted
8440 if necessary. Currently, the "perlbug" program included with perl
8441 will send mail to this address in addition to perlbug@perl.org. You may
8442 enter "none" for no administrator.
8443
8444 EOM
8445 case "$perladmin" in
8446 '') dflt="$cf_email";;
8447 *) dflt="$perladmin";;
8448 esac
8449 rp='Perl administrator e-mail address'
8450 . ./myread
8451 perladmin="$ans"
8452
8453 : determine whether to only install version-specific parts.
8454 echo " "
8455 $cat <<EOM
8456 Do you want to install only the version-specific parts of the perl
8457 distribution?  Usually you do *not* want to do this.
8458 EOM
8459 case "$versiononly" in
8460 "$define"|[Yy]*|true) dflt='y' ;;
8461 *) dflt='n';
8462 esac
8463 rp="Do you want to install only the version-specific parts of perl?"
8464 . ./myread
8465 case "$ans" in
8466 [yY]*)  val="$define";;
8467 *)      val="$undef" ;;
8468 esac
8469 set versiononly
8470 eval $setvar
8471
8472 case "$versiononly" in
8473 "$define") inc_version_list=''
8474            inc_version_list_init=0
8475            ;;
8476 esac
8477
8478 : figure out how to guarantee perl startup
8479 case "$startperl" in
8480 '')
8481         case "$sharpbang" in
8482         *!)
8483                 $cat <<EOH
8484
8485 I can use the #! construct to start perl on your system. This will
8486 make startup of perl scripts faster, but may cause problems if you
8487 want to share those scripts and perl is not in a standard place
8488 ($binexp/perl) on all your platforms. The alternative is to force
8489 a shell by starting the script with a single ':' character.
8490
8491 EOH
8492                 case "$versiononly" in
8493                 "$define")      dflt="$binexp/perl$version";;  
8494                 *)              dflt="$binexp/perl";;
8495                 esac
8496                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8497                 . ./myread
8498                 case "$ans" in
8499                 none)   startperl=": # use perl";;
8500                 *)      startperl="#!$ans"
8501                         if $test 30 -lt `echo "$ans" | wc -c`; then
8502                                 $cat >&4 <<EOM
8503
8504 WARNING:  Some systems limit the #! command to 32 characters.
8505 If you experience difficulty running Perl scripts with #!, try
8506 installing Perl in a directory with a shorter pathname.
8507
8508 EOM
8509                         fi ;;
8510                 esac
8511                 ;;
8512         *) startperl=": # use perl"
8513                 ;;
8514         esac
8515         ;;
8516 esac
8517 echo "I'll use $startperl to start perl scripts."
8518
8519 : figure best path for perl in scripts
8520 case "$perlpath" in
8521 '')
8522         case "$versiononly" in
8523         "$define")      perlpath="$binexp/perl$version";;
8524         *)              perlpath="$binexp/perl";;
8525         esac
8526         case "$startperl" in
8527         *!*) ;;
8528         *)
8529                 $cat <<EOH
8530
8531 I will use the "eval 'exec'" idiom to start Perl on your system.
8532 I can use the full path of your Perl binary for this purpose, but
8533 doing so may cause problems if you want to share those scripts and
8534 Perl is not always in a standard place ($binexp/perl).
8535
8536 EOH
8537                 dflt="$binexp/perl"
8538                 rp="What path shall I use in \"eval 'exec'\"?"
8539                 . ./myread
8540                 perlpath="$ans"
8541                 ;;
8542         esac
8543         ;;
8544 esac
8545 case "$startperl" in
8546 *!*)    ;;
8547 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8548 esac
8549
8550 : determine where public executable scripts go
8551 set scriptdir scriptdir
8552 eval $prefixit
8553 case "$scriptdir" in
8554 '')
8555         dflt="$bin"
8556         : guess some guesses
8557         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8558         $test -d /usr/share/bin     && dflt=/usr/share/bin
8559         $test -d /usr/local/script  && dflt=/usr/local/script
8560         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8561         $test -d $prefixexp/script  && dflt=$prefixexp/script
8562         set dflt
8563         eval $prefixup
8564         ;;
8565 *)  dflt="$scriptdir"
8566         ;;
8567 esac
8568 $cat <<EOM
8569  
8570 Some installations have a separate directory just for executable scripts so
8571 that they can mount it across multiple architectures but keep the scripts in
8572 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8573 Or you might just lump your scripts in with all your other executables.
8574  
8575 EOM
8576 fn=d~
8577 rp='Where do you keep publicly executable scripts?'
8578 . ./getfile
8579 if $test "X$ansexp" != "X$scriptdirexp"; then
8580         installscript=''
8581 fi
8582 scriptdir="$ans"
8583 scriptdirexp="$ansexp"
8584 : Change installation prefix, if necessary.
8585 if $test X"$prefix" != X"$installprefix"; then
8586         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8587 else
8588         installscript="$scriptdirexp"
8589 fi
8590
8591 : determine where add-on public executables go
8592 case "$sitebin" in
8593 '')     dflt=$siteprefix/bin ;;
8594 *)      dflt=$sitebin ;;
8595 esac
8596 fn=d~
8597 rp='Pathname where the add-on public executables should be installed?'
8598 . ./getfile
8599 sitebin="$ans"
8600 sitebinexp="$ansexp"
8601 : Change installation prefix, if necessary.
8602 if $test X"$prefix" != X"$installprefix"; then
8603         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8604 else
8605         installsitebin="$sitebinexp"
8606 fi
8607
8608 : determine where add-on html pages go
8609 : There is no standard location, so try to copy the previously-selected
8610 : directory structure for the core html pages.
8611 case "$sitehtml1dir" in
8612 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8613 *)     dflt=$sitehtml1dir ;;
8614 esac
8615 case "$dflt" in
8616 ''|' ') dflt=none ;;
8617 esac
8618 fn=dn+~
8619 rp='Pathname where the site-specific html pages should be installed?'
8620 . ./getfile
8621 sitehtml1dir="$ans"
8622 sitehtml1direxp="$ansexp"
8623 : Change installation prefix, if necessary.
8624 if $test X"$prefix" != X"$installprefix"; then
8625         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8626 else
8627         installsitehtml1dir="$sitehtml1direxp"
8628 fi
8629
8630 : determine where add-on library html pages go
8631 : There is no standard location, so try to copy the previously-selected
8632 : directory structure for the core html pages.
8633 case "$sitehtml3dir" in
8634 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8635 *)     dflt=$sitehtml3dir ;;
8636 esac
8637 case "$dflt" in
8638 ''|' ') dflt=none ;;
8639 esac
8640 fn=dn+~
8641 rp='Pathname where the site-specific library html pages should be installed?'
8642 . ./getfile
8643 sitehtml3dir="$ans"
8644 sitehtml3direxp="$ansexp"
8645 : Change installation prefix, if necessary.
8646 if $test X"$prefix" != X"$installprefix"; then
8647         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8648 else
8649         installsitehtml3dir="$sitehtml3direxp"
8650 fi
8651
8652 : determine where add-on manual pages go
8653 case "$siteman1dir" in
8654 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8655 *)      dflt=$siteman1dir ;;
8656 esac
8657 case "$dflt" in
8658 ''|' ') dflt=none ;;
8659 esac
8660 fn=dn+~
8661 rp='Pathname where the site-specific manual pages should be installed?'
8662 . ./getfile
8663 siteman1dir="$ans"
8664 siteman1direxp="$ansexp"
8665 : Change installation prefix, if necessary.
8666 if $test X"$prefix" != X"$installprefix"; then
8667         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8668 else
8669         installsiteman1dir="$siteman1direxp"
8670 fi
8671
8672 : determine where add-on library man pages go
8673 case "$siteman3dir" in
8674 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8675 *)      dflt=$siteman3dir ;;
8676 esac
8677 case "$dflt" in
8678 ''|' ') dflt=none ;;
8679 esac
8680 fn=dn+~
8681 rp='Pathname where the site-specific library manual pages should be installed?'
8682 . ./getfile
8683 siteman3dir="$ans"
8684 siteman3direxp="$ansexp"
8685 : Change installation prefix, if necessary.
8686 if $test X"$prefix" != X"$installprefix"; then
8687         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8688 else
8689         installsiteman3dir="$siteman3direxp"
8690 fi
8691
8692 : determine where add-on public executable scripts go
8693 case "$sitescript" in
8694 '')     dflt=$siteprefix/script
8695         $test -d $dflt || dflt=$sitebin ;;
8696 *)  dflt="$sitescript" ;;
8697 esac
8698 fn=d~+
8699 rp='Pathname where add-on public executable scripts should be installed?'
8700 . ./getfile
8701 sitescript="$ans"
8702 sitescriptexp="$ansexp"
8703 : Change installation prefix, if necessary.
8704 if $test X"$prefix" != X"$installprefix"; then
8705         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8706 else
8707         installsitescript="$sitescriptexp"
8708 fi
8709
8710 case "$usefaststdio" in
8711 $define|true|[yY]*|'')
8712         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8713         case "$xversion" in
8714         [68])   dflt='y' ;;
8715         *)      dflt='n' ;;
8716         esac
8717         ;;
8718 *) dflt='n';;
8719 esac
8720 cat <<EOM
8721
8722 Perl can be built to use 'fast stdio', which means using the stdio
8723 library but also directly manipulating the stdio buffers to enable
8724 faster I/O.  Using stdio is better for backward compatibility (especially
8725 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8726 interface has been preferred instead of stdio.
8727
8728 If this doesn't make any sense to you, just accept the default '$dflt'.
8729 EOM
8730 rp='Use the "fast stdio" if available?'
8731 . ./myread
8732 case "$ans" in
8733 y|Y)    val="$define" ;;     
8734 *)      val="$undef" ;;
8735 esac
8736 set usefaststdio
8737 eval $setvar
8738
8739
8740 : define an is-a-typedef? function
8741 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8742 case "$inclist" in
8743 "") inclist="sys/types.h";;
8744 esac;
8745 eval "varval=\$$var";
8746 case "$varval" in
8747 "")
8748         $rm -f temp.c;
8749         for inc in $inclist; do
8750                 echo "#include <$inc>" >>temp.c;
8751         done;
8752         echo "#ifdef $type" >> temp.c;
8753         echo "printf(\"We have $type\");" >> temp.c;
8754         echo "#endif" >> temp.c;
8755         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8756         if $contains $type temp.E >/dev/null 2>&1; then
8757                 eval "$var=\$type";
8758         else
8759                 eval "$var=\$def";
8760         fi;
8761         $rm -f temp.?;;
8762 *) eval "$var=\$varval";;
8763 esac'
8764
8765 : define an is-a-typedef? function that prompts if the type is not available.
8766 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8767 case "$inclist" in
8768 "") inclist="sys/types.h";;
8769 esac;
8770 eval "varval=\$$var";
8771 case "$varval" in
8772 "")
8773         $rm -f temp.c;
8774         for inc in $inclist; do
8775                 echo "#include <$inc>" >>temp.c;
8776         done;
8777         echo "#ifdef $type" >> temp.c;
8778         echo "printf(\"We have $type\");" >> temp.c;
8779         echo "#endif" >> temp.c;
8780         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8781         echo " " ;
8782         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8783         if $contains $type temp.E >/dev/null 2>&1; then
8784                 echo "$type found." >&4;
8785                 eval "$var=\$type";
8786         else
8787                 echo "$type NOT found." >&4;
8788                 dflt="$def";
8789                 . ./myread ;
8790                 eval "$var=\$ans";
8791         fi;
8792         $rm -f temp.?;;
8793 *) eval "$var=\$varval";;
8794 esac'
8795
8796 : see what type lseek is declared as in the kernel
8797 rp="What is the type used for lseek's offset on this system?"
8798 set off_t lseektype long stdio.h sys/types.h
8799 eval $typedef_ask
8800
8801 echo " "
8802 echo "Checking to see how big your file offsets are..." >&4
8803 $cat >try.c <<EOCP
8804 #include <sys/types.h>
8805 #include <stdio.h>
8806 int main()
8807 {
8808     printf("%d\n", (int)sizeof($lseektype));
8809     return(0); 
8810 }
8811 EOCP
8812 set try
8813 if eval $compile_ok; then
8814         lseeksize=`$run ./try`
8815         echo "Your file offsets are $lseeksize bytes long."
8816 else
8817         dflt=$longsize
8818         echo " "
8819         echo "(I can't seem to compile the test program.  Guessing...)"
8820         rp="What is the size of your file offsets (in bytes)?"
8821         . ./myread
8822         lseeksize="$ans"
8823 fi
8824 $rm -f try.c try
8825
8826 : see what type file positions are declared as in the library
8827 rp="What is the type for file position used by fsetpos()?"
8828 set fpos_t fpostype long stdio.h sys/types.h
8829 eval $typedef_ask
8830
8831 echo " "
8832 case "$fpostype" in
8833 *_t) zzz="$fpostype"    ;;
8834 *)   zzz="fpos_t"       ;;
8835 esac
8836 echo "Checking the size of $zzz..." >&4 
8837 cat > try.c <<EOCP
8838 #include <sys/types.h>
8839 #include <stdio.h>
8840 #$i_stdlib I_STDLIB
8841 #ifdef I_STDLIB
8842 #include <stdlib.h>
8843 #endif
8844 int main() {
8845     printf("%d\n", (int)sizeof($fpostype));
8846     exit(0);
8847 }
8848 EOCP
8849 set try
8850 if eval $compile_ok; then
8851         yyy=`$run ./try`
8852         case "$yyy" in
8853         '')     fpossize=4
8854                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8855                 ;;
8856         *)      fpossize=$yyy
8857                 echo "Your $zzz is $fpossize bytes long."
8858                 ;;
8859         esac
8860 else
8861         dflt="$longsize"
8862         echo " " >&4
8863         echo "(I can't compile the test program.  Guessing...)" >&4
8864         rp="What is the size of your file positions (in bytes)?"
8865         . ./myread
8866         fpossize="$ans"
8867 fi
8868
8869 # Backward compatibility (uselfs is deprecated).
8870 case "$uselfs" in
8871 "$define"|true|[yY]*)
8872         cat <<EOM >&4
8873
8874 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8875 EOM
8876         uselargefiles="$define"
8877         ;;
8878 esac                          
8879
8880 case "$lseeksize:$fpossize" in
8881 8:8) cat <<EOM
8882
8883 You can have files larger than 2 gigabytes.
8884 EOM
8885    val="$define" ;;
8886 *)    case "$uselargefiles" in
8887    "$undef"|false|[nN]*) dflt='n' ;;
8888    *)   dflt='y' ;;
8889    esac
8890    cat <<EOM
8891
8892 Perl can be built to understand large files (files larger than 2 gigabytes)
8893 on some systems.  To do so, Configure can be run with -Duselargefiles.
8894
8895 If this doesn't make any sense to you, just accept the default '$dflt'.
8896 EOM
8897    rp='Try to understand large files, if available?'
8898    . ./myread
8899    case "$ans" in
8900    y|Y)         val="$define" ;;
8901    *)           val="$undef"  ;;
8902    esac
8903    ;;
8904 esac
8905 set uselargefiles
8906 eval $setvar
8907 : Look for a hint-file generated 'call-back-unit'.  If the
8908 : user has specified that a large files perl is to be built,
8909 : we may need to set or change some other defaults.
8910 if $test -f uselargefiles.cbu; then
8911         echo "Your platform has some specific hints regarding large file builds, using them..."
8912         . ./uselargefiles.cbu
8913 fi
8914 case "$uselargefiles" in
8915 "$define")
8916         if $test -f uselargefiles.cbu; then
8917                 echo " "
8918                 echo "Rechecking to see how big your file offsets are..." >&4
8919                 $cat >try.c <<EOCP
8920 #include <sys/types.h>
8921 #include <stdio.h>
8922 int main()
8923 {
8924     printf("%d\n", (int)sizeof($lseektype));
8925     return(0); 
8926 }
8927 EOCP
8928                 set try
8929                 if eval $compile_ok; then
8930                         lseeksize=`$run ./try`
8931                         $echo "Your file offsets are now $lseeksize bytes long."
8932                 else
8933                         dflt="$lseeksize"
8934                         echo " "
8935                         echo "(I can't seem to compile the test program.  Guessing...)"
8936                         rp="What is the size of your file offsets (in bytes)?"
8937                         . ./myread
8938                         lseeksize="$ans"
8939                 fi
8940                 case "$fpostype" in
8941                 *_t) zzz="$fpostype"    ;;
8942                 *)   zzz="fpos_t"       ;;
8943                 esac
8944                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8945                 $cat > try.c <<EOCP
8946 #include <sys/types.h>
8947 #include <stdio.h>
8948 #$i_stdlib I_STDLIB
8949 #ifdef I_STDLIB
8950 #include <stdlib.h>
8951 #endif
8952 int main() {
8953     printf("%d\n", (int)sizeof($fpostype));
8954     return(0);
8955 }
8956 EOCP
8957                 set try
8958                 if eval $compile_ok; then
8959                         yyy=`$run ./try`
8960                         dflt="$lseeksize"
8961                         case "$yyy" in
8962                         '')     echo " "
8963                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8964                                 ;;
8965                         *)      fpossize=$yyy
8966                                 echo " $fpossize bytes." >&4
8967                                 ;;
8968                         esac
8969                 else
8970                         dflt="$fpossize"
8971                         echo " "
8972                         echo "(I can't compile the test program.  Guessing...)" >&4
8973                         rp="What is the size of your file positions (in bytes)?"
8974                         . ./myread
8975                         fpossize="$ans"
8976                 fi
8977                 $rm -f try.c try
8978         fi
8979         ;;
8980 esac
8981
8982 # probably will refer to
8983 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
8984 need_relocation=0
8985 userelocatableinc=undef
8986
8987 case "$vendorprefix" in
8988 '')     d_vendorbin="$undef"
8989         vendorbin=''
8990         vendorbinexp=''
8991         ;;
8992 *)      d_vendorbin="$define"
8993         : determine where vendor-supplied executables go.
8994         case "$vendorbin" in
8995         '') dflt=$vendorprefix/bin ;;
8996         *)      dflt="$vendorbin" ;;
8997         esac
8998         fn=d~+
8999         rp='Pathname for the vendor-supplied executables directory?'
9000         . ./getfile
9001         vendorbin="$ans"
9002         vendorbinexp="$ansexp"
9003         ;;
9004 esac
9005 : Change installation prefix, if necessary.
9006 if $test X"$prefix" != X"$installprefix"; then
9007         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9008 else
9009         installvendorbin="$vendorbinexp"
9010 fi
9011
9012 case "$vendorprefix" in
9013 '')     vendorhtml1dir=''
9014         vendorhtml1direxp=''
9015         ;;
9016 *)      : determine where vendor-supplied html pages go.
9017         : There is no standard location, so try to copy the previously-selected
9018         : directory structure for the core html pages.
9019         : XXX Better default suggestions would be welcome.
9020         case "$vendorhtml1dir" in
9021         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9022         *)      dflt=$vendorhtml1dir ;;
9023         esac
9024         case "$dflt" in
9025         ''|' ') dflt=none ;;
9026         esac
9027         fn=dn+~
9028         rp='Pathname for the vendor-supplied html pages?'
9029         . ./getfile
9030         vendorhtml1dir="$ans"
9031         vendorhtml1direxp="$ansexp"
9032         ;;
9033 esac
9034 : Use ' ' for none so value is preserved next time through Configure
9035 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9036 : Change installation prefix, if necessary.
9037 if $test X"$prefix" != X"$installprefix"; then
9038         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9039 else
9040         installvendorhtml1dir="$vendorhtml1direxp"
9041 fi
9042
9043 case "$vendorprefix" in
9044 '')     vendorhtml3dir=''
9045         vendorhtml3direxp=''
9046         ;;
9047 *)      : determine where vendor-supplied module html pages go.
9048         : There is no standard location, so try to copy the previously-selected
9049         : directory structure for the core html pages.
9050         : XXX Better default suggestions would be welcome.
9051         case "$vendorhtml3dir" in
9052         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9053         *)      dflt=$vendorhtml3dir ;;
9054         esac
9055         case "$dflt" in
9056         ''|' ') dflt=none ;;
9057         esac
9058         fn=dn+~
9059         rp='Pathname for the vendor-supplied html pages?'
9060         . ./getfile
9061         vendorhtml3dir="$ans"
9062         vendorhtml3direxp="$ansexp"
9063         ;;
9064 esac
9065 : Use ' ' for none so value is preserved next time through Configure
9066 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9067 : Change installation prefix, if necessary.
9068 if $test X"$prefix" != X"$installprefix"; then
9069         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9070 else
9071         installvendorhtml3dir="$vendorhtml3direxp"
9072 fi
9073
9074 case "$vendorprefix" in
9075 '')     vendorman1dir=''
9076         vendorman1direxp=''
9077         ;;
9078 *)      : determine where vendor-supplied manual pages go.
9079         case "$vendorman1dir" in
9080         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9081         *)      dflt=$vendorman1dir ;;
9082         esac
9083         case "$dflt" in
9084         ''|' ') dflt=none ;;
9085         esac
9086         fn=nd~+
9087         rp='Pathname for the vendor-supplied manual section 1 pages?'
9088         . ./getfile
9089         vendorman1dir="$ans"
9090         vendorman1direxp="$ansexp"
9091         ;;
9092 esac
9093 : Use ' ' for none so value is preserved next time through Configure
9094 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9095 : Change installation prefix, if necessary.
9096 if $test X"$prefix" != X"$installprefix"; then
9097         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9098 else
9099         installvendorman1dir="$vendorman1direxp"
9100 fi
9101
9102 case "$vendorprefix" in
9103 '')     vendorman3dir=''
9104         vendorman3direxp=''
9105         ;;
9106 *)      : determine where vendor-supplied module manual pages go.
9107         case "$vendorman3dir" in
9108         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9109         *)      dflt=$vendorman3dir ;;
9110         esac
9111         case "$dflt" in
9112         ''|' ') dflt=none ;;
9113         esac
9114         fn=nd~+
9115         rp='Pathname for the vendor-supplied manual section 3 pages?'
9116         . ./getfile
9117         vendorman3dir="$ans"
9118         vendorman3direxp="$ansexp"
9119         ;;
9120 esac
9121 : Use ' ' for none so value is preserved next time through Configure
9122 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9123 : Change installation prefix, if necessary.
9124 if $test X"$prefix" != X"$installprefix"; then
9125         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9126 else
9127         installvendorman3dir="$vendorman3direxp"
9128 fi
9129
9130 case "$vendorprefix" in
9131 '')     d_vendorscript="$undef"
9132         vendorscript=''
9133         vendorscriptexp=''
9134         ;;
9135 *)      d_vendorscript="$define"
9136         : determine where vendor-supplied scripts go.
9137         case "$vendorscript" in
9138         '')     dflt=$vendorprefix/script
9139                 $test -d $dflt || dflt=$vendorbin ;;
9140         *)  dflt="$vendorscript" ;;
9141         esac
9142         $cat <<EOM
9143
9144 The installation process will create a directory for 
9145 vendor-supplied scripts.
9146
9147 EOM
9148         fn=d~+
9149         rp='Pathname for the vendor-supplied scripts directory?'
9150         . ./getfile
9151         vendorscript="$ans"
9152         vendorscriptexp="$ansexp"
9153         ;;
9154 esac
9155 : Change installation prefix, if necessary.
9156 if $test X"$prefix" != X"$installprefix"; then
9157         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9158 else
9159         installvendorscript="$vendorscriptexp"
9160 fi
9161
9162 : see if qgcvt exists
9163 set qgcvt d_qgcvt
9164 eval $inlibc
9165
9166 echo " "
9167
9168 if $test X"$d_longdbl" = X"$define"; then
9169
9170 echo "Checking how to print long doubles..." >&4
9171
9172 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9173         $cat >try.c <<'EOCP'
9174 #include <sys/types.h>
9175 #include <stdio.h>
9176 int main() {
9177   double d = 123.456;
9178   printf("%.3f\n", d);
9179 }
9180 EOCP
9181         set try
9182         if eval $compile; then
9183                 yyy=`$run ./try`
9184                 case "$yyy" in
9185                 123.456)
9186                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9187                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9188                         echo "We will use %f."
9189                         ;;
9190                 esac
9191         fi
9192 fi
9193
9194 if $test X"$sPRIfldbl" = X; then
9195         $cat >try.c <<'EOCP'
9196 #include <sys/types.h>
9197 #include <stdio.h>
9198 int main() {
9199   long double d = 123.456;
9200   printf("%.3Lf\n", d);
9201 }
9202 EOCP
9203         set try
9204         if eval $compile; then
9205                 yyy=`$run ./try`
9206                 case "$yyy" in
9207                 123.456)
9208                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9209                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9210                         echo "We will use %Lf."
9211                         ;;
9212                 esac
9213         fi
9214 fi
9215
9216 if $test X"$sPRIfldbl" = X; then
9217         $cat >try.c <<'EOCP'
9218 #include <sys/types.h>
9219 #include <stdio.h>
9220 int main() {
9221   long double d = 123.456;
9222   printf("%.3llf\n", d);
9223 }
9224 EOCP
9225         set try
9226         if eval $compile; then
9227                 yyy=`$run ./try`
9228                 case "$yyy" in
9229                 123.456)
9230                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9231                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9232                         echo "We will use %llf."
9233                         ;;
9234                 esac
9235         fi
9236 fi
9237
9238 if $test X"$sPRIfldbl" = X; then
9239         $cat >try.c <<'EOCP'
9240 #include <sys/types.h>
9241 #include <stdio.h>
9242 int main() {
9243   long double d = 123.456;
9244   printf("%.3lf\n", d);
9245 }
9246 EOCP
9247         set try
9248         if eval $compile; then
9249                 yyy=`$run ./try`
9250                 case "$yyy" in
9251                 123.456)
9252                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9253                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9254                         echo "We will use %lf."
9255                         ;;
9256                 esac
9257         fi
9258 fi
9259
9260 if $test X"$sPRIfldbl" = X; then
9261         echo "Cannot figure out how to print long doubles." >&4
9262 else
9263         sSCNfldbl=$sPRIfldbl    # expect consistency
9264 fi
9265
9266 $rm -f try try.*
9267
9268 fi # d_longdbl
9269
9270 case "$sPRIfldbl" in
9271 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9272         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9273         d_SCNfldbl="$undef";
9274         ;;
9275 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9276         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9277         d_SCNfldbl="$define";
9278         ;;
9279 esac
9280
9281 : Check how to convert floats to strings.
9282
9283 if test "X$d_Gconvert" = X; then
9284
9285 echo " "
9286 echo "Checking for an efficient way to convert floats to strings."
9287 echo " " > try.c
9288 case "$uselongdouble" in
9289 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9290 esac
9291 case "$d_longdbl" in
9292 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9293 esac
9294 case "$d_PRIgldbl" in
9295 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9296 esac
9297 $cat >>try.c <<EOP
9298 #ifdef TRY_gconvert
9299 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9300 char *myname = "gconvert";
9301 #endif
9302 #ifdef TRY_gcvt
9303 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9304 char *myname = "gcvt";
9305 #endif
9306 #ifdef TRY_qgcvt
9307 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9308 char *myname = "qgcvt";
9309 #define DOUBLETYPE long double
9310 #endif
9311 #ifdef TRY_sprintf
9312 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9313 #ifdef HAS_PRIgldbl
9314 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9315 #else
9316 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9317 #endif
9318 #else
9319 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9320 #endif
9321 char *myname = "sprintf";
9322 #endif
9323
9324 #ifndef DOUBLETYPE
9325 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9326 #define DOUBLETYPE long double
9327 #else
9328 #define DOUBLETYPE double
9329 #endif
9330 #endif
9331
9332 #include <stdio.h>
9333
9334 #define I_STDLIB $i_stdlib
9335 #ifdef I_STDLIB
9336 #include <stdlib.h>
9337 #endif
9338
9339 int
9340 checkit(expect, got)
9341 char *expect;
9342 char *got;
9343 {
9344     if (strcmp(expect, got)) {
9345                 printf("%s oddity:  Expected %s, got %s\n",
9346                         myname, expect, got);
9347                 exit(1);
9348         }
9349 }
9350
9351 int main()
9352
9353         char buf[64]; 
9354         buf[63] = '\0';
9355
9356         /* This must be 1st test on (which?) platform */
9357         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9358         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9359         checkit("0.1", buf);
9360
9361         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9362         checkit("0.01", buf);
9363
9364         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9365         checkit("0.001", buf);
9366
9367         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9368         checkit("0.0001", buf);
9369
9370         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9371         if (strlen(buf) > 5)
9372             checkit("9e-005", buf); /* for Microsoft ?? */
9373         else
9374             checkit("9e-05", buf);
9375
9376         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9377         checkit("1", buf);
9378
9379         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9380         checkit("1.1", buf);
9381
9382         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9383         checkit("1.01", buf);
9384
9385         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9386         checkit("1.001", buf);
9387
9388         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9389         checkit("1.0001", buf);
9390
9391         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9392         checkit("1.00001", buf);
9393
9394         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9395         checkit("1.000001", buf);
9396
9397         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9398         checkit("0", buf);
9399
9400         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9401         checkit("-1", buf);
9402
9403         /* Some Linux gcvt's give 1.e+5 here. */
9404         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9405         checkit("100000", buf);
9406         
9407         /* Some Linux gcvt's give -1.e+5 here. */
9408         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9409         checkit("-100000", buf);
9410
9411         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9412         checkit("123.456", buf);
9413
9414         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9415         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9416         /* 34 should be enough to scare even long double
9417          * places into using the e notation. */
9418         if (strlen(buf) > 5)
9419             checkit("1e+034", buf); /* for Microsoft */
9420         else
9421             checkit("1e+34", buf);
9422
9423         /* For Perl, if you add additional tests here, also add them to
9424          * t/base/num.t for benefit of platforms not using Configure or
9425          * overriding d_Gconvert */
9426
9427         exit(0);
9428 }
9429 EOP
9430 : first add preferred functions to our list
9431 xxx_list=""
9432 for xxx_convert in $gconvert_preference; do
9433     case $xxx_convert in
9434     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9435     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9436     esac 
9437 done
9438 : then add any others
9439 for xxx_convert in gconvert gcvt sprintf; do
9440     case "$xxx_list" in
9441     *$xxx_convert*) ;;
9442     *) xxx_list="$xxx_list $xxx_convert" ;;
9443     esac 
9444 done
9445
9446 case "$d_longdbl$uselongdouble" in
9447 "$define$define")
9448     : again, add prefered functions to our list first
9449     xxx_ld_list=""
9450     for xxx_convert in $gconvert_ld_preference; do
9451         case $xxx_convert in
9452         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9453         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9454         esac
9455     done
9456     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9457     for xxx_convert in qgcvt sprintf $xxx_list; do
9458         case "$xxx_ld_list" in
9459         $xxx_convert*|*" $xxx_convert"*) ;;
9460         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9461         esac
9462     done
9463     : if sprintf cannot do long doubles, move it to the end
9464     if test "$d_PRIgldbl" != "$define"; then
9465         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9466     fi
9467     : if no qgcvt, remove it
9468     if test "$d_qgcvt" != "$define"; then
9469         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9470     fi
9471     : use the ld_list
9472     xxx_list="$xxx_ld_list"
9473     ;;
9474 esac
9475
9476 for xxx_convert in $xxx_list; do
9477         echo "Trying $xxx_convert..."
9478         $rm -f try try$_o
9479         set try -DTRY_$xxx_convert
9480         if eval $compile; then
9481                 echo "$xxx_convert() found." >&4
9482                 if $run ./try; then
9483                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9484                         break;
9485                 else
9486                         echo "...But $xxx_convert didn't work as I expected."
9487                         xxx_convert=''
9488                 fi
9489         else
9490                 echo "$xxx_convert NOT found." >&4
9491         fi
9492 done
9493
9494 if test X$xxx_convert = X; then
9495     echo "*** WHOA THERE!!! ***" >&4
9496     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9497     xxx_convert=sprintf
9498 fi
9499
9500 case "$xxx_convert" in
9501 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9502 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9503 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9504 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9505    "$define$define$define")
9506       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9507    "$define$define$undef")
9508       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9509    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9510    esac
9511    ;;  
9512 esac
9513
9514 fi
9515
9516 : see if _fwalk exists
9517 set fwalk d__fwalk
9518 eval $inlibc
9519
9520 : Initialize h_fcntl
9521 h_fcntl=false
9522
9523 : Initialize h_sysfile
9524 h_sysfile=false
9525
9526 : access call always available on UNIX
9527 set access d_access
9528 eval $inlibc
9529
9530 : locate the flags for 'access()'
9531 case "$d_access" in
9532 "$define")
9533         echo " "
9534         $cat >access.c <<EOCP
9535 #include <sys/types.h>
9536 #ifdef I_FCNTL
9537 #include <fcntl.h>
9538 #endif
9539 #ifdef I_SYS_FILE
9540 #include <sys/file.h>
9541 #endif
9542 #ifdef I_UNISTD
9543 #include <unistd.h>
9544 #endif
9545 #$i_stdlib I_STDLIB
9546 #ifdef I_STDLIB
9547 #include <stdlib.h>
9548 #endif
9549 int main() {
9550         exit(R_OK);
9551 }
9552 EOCP
9553         : check sys/file.h first, no particular reason here
9554         if $test `./findhdr sys/file.h` && \
9555                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9556                 h_sysfile=true;
9557                 echo "<sys/file.h> defines the *_OK access constants." >&4
9558         elif $test `./findhdr fcntl.h` && \
9559                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9560                 h_fcntl=true;
9561                 echo "<fcntl.h> defines the *_OK access constants." >&4
9562         elif $test `./findhdr unistd.h` && \
9563                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9564                 echo "<unistd.h> defines the *_OK access constants." >&4
9565         else
9566                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9567         fi
9568         ;;
9569 esac
9570 $rm -f access*
9571
9572 : see if accessx exists
9573 set accessx d_accessx
9574 eval $inlibc
9575
9576 : see if aintl exists
9577 set aintl d_aintl
9578 eval $inlibc
9579
9580 : see if alarm exists
9581 set alarm d_alarm
9582 eval $inlibc
9583
9584 : see if POSIX threads are available
9585 set pthread.h i_pthread
9586 eval $inhdr
9587
9588 : define a fucntion to check prototypes
9589 $cat > protochk <<EOSH
9590 $startsh
9591 cc="$cc"
9592 optimize="$optimize"
9593 ccflags="$ccflags"
9594 prototype="$prototype"
9595 define="$define"
9596 rm=$rm
9597 usethreads=$usethreads
9598 i_pthread=$i_pthread
9599 pthread_h_first=$pthread_h_first
9600 EOSH
9601
9602 $cat >> protochk <<'EOSH'
9603
9604 $rm -f try.c
9605 foo="$1"
9606 shift
9607 while test $# -ge 2; do
9608         case "$1" in
9609                 $define) echo "#include <$2>" >> try.c ;;
9610                 literal) echo "$2" >> try.c ;;
9611         esac
9612     # Extra magic for the benefit of systems that need pthread.h
9613     # to be included early to correctly detect threadsafe functions.
9614     # Such functions must guarantee themselves, though, that the usethreads
9615     # and i_pthread have been defined, before calling protochk.
9616     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9617         echo "#include <pthread.h>" >> try.c
9618         pthread_h_done=yes
9619     fi
9620     shift 2
9621 done
9622 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9623 cat >> try.c <<'EOCP'
9624 #ifdef CAN_PROTOTYPE
9625 #define _(args) args
9626 #else
9627 #define _(args) ()
9628 #endif
9629 EOCP
9630 echo "$foo" >> try.c
9631 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9632 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9633 status=$?
9634 $rm -f try.[co]
9635 exit $status
9636 EOSH
9637 chmod +x protochk
9638 $eunicefix protochk
9639
9640 hasproto='varname=$1; func=$2; shift; shift;
9641 while $test $# -ge 2; do
9642         case "$1" in
9643         $define) echo "#include <$2>";;
9644         esac ;
9645     shift 2;
9646 done > try.c;
9647 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9648 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9649         echo "$func() prototype found.";
9650         val="$define";
9651 else
9652         echo "$func() prototype NOT found.";
9653         val="$undef";
9654 fi;
9655 set $varname;
9656 eval $setvar;
9657 $rm -f try.c tryout.c'
9658
9659 : see if sys/types.h has to be included
9660 set sys/types.h i_systypes
9661 eval $inhdr
9662
9663 : see if sys/select.h has to be included
9664 set sys/select.h i_sysselct
9665 eval $inhdr
9666
9667 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9668 while $test $# -ge 2; do
9669         case "$1" in
9670         $define) echo "#include <$2>";;
9671         esac ;
9672     shift 2;
9673 done > try.c;
9674 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9675 set try;
9676 if eval $compile; then
9677         val="$define";
9678 else
9679         val="$undef";
9680 fi;
9681 set $varname;
9682 eval $setvar;
9683 $rm -f try.c try.o'
9684
9685 : see if we should include time.h, sys/time.h, or both
9686 echo " "
9687 if test "X$timeincl" = X; then
9688         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9689         $echo $n "I'm now running the test program...$c"
9690         $cat >try.c <<EOCP
9691 #include <sys/types.h>
9692 #ifdef I_TIME
9693 #include <time.h>
9694 #endif
9695 #ifdef I_SYSTIME
9696 #ifdef SYSTIMEKERNEL
9697 #define KERNEL
9698 #endif
9699 #include <sys/time.h>
9700 #endif
9701 #ifdef I_SYSSELECT
9702 #include <sys/select.h>
9703 #endif
9704 #$i_stdlib I_STDLIB
9705 #ifdef I_STDLIB
9706 #include <stdlib.h>
9707 #endif
9708 int main()
9709 {
9710         struct tm foo;
9711 #ifdef S_TIMEVAL
9712         struct timeval bar;
9713 #endif
9714 #ifdef S_TIMEZONE
9715         struct timezone tzp;
9716 #endif
9717         if (foo.tm_sec == foo.tm_sec)
9718                 exit(0);
9719 #ifdef S_TIMEVAL
9720         if (bar.tv_sec == bar.tv_sec)
9721                 exit(0);
9722 #endif
9723         exit(1);
9724 }
9725 EOCP
9726         flags=''
9727         for s_timezone in '-DS_TIMEZONE' ''; do
9728         sysselect=''
9729         for s_timeval in '-DS_TIMEVAL' ''; do
9730         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9731         for i_time in '' '-DI_TIME'; do
9732         for i_systime in '-DI_SYSTIME' ''; do
9733                 case "$flags" in
9734                 '') $echo $n ".$c"
9735                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9736                         if eval $compile; then
9737                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9738                                 shift
9739                                 flags="$*"
9740                                 echo " "
9741                                 $echo $n "Succeeded with $flags$c"
9742                         fi
9743                         ;;
9744                 esac
9745         done
9746         done
9747         done
9748         done
9749         done
9750         timeincl=''
9751         echo " "
9752         case "$flags" in
9753         *SYSTIMEKERNEL*) i_systimek="$define"
9754                 timeincl=`./findhdr sys/time.h`
9755                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9756         *) i_systimek="$undef";;
9757         esac
9758         case "$flags" in
9759         *I_TIME*) i_time="$define"
9760                 timeincl=`./findhdr time.h`" $timeincl"
9761                 echo "We'll include <time.h>." >&4;;
9762         *) i_time="$undef";;
9763         esac
9764         case "$flags" in
9765         *I_SYSTIME*) i_systime="$define"
9766                 timeincl=`./findhdr sys/time.h`" $timeincl"
9767                 echo "We'll include <sys/time.h>." >&4;;
9768         *) i_systime="$undef";;
9769         esac
9770         $rm -f try.c try
9771 fi
9772 : see if struct tm knows about tm_zone
9773 case "$i_systime$i_time" in
9774 *$define*) 
9775         echo " "
9776         echo "Checking to see if your struct tm has tm_zone field..." >&4
9777         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9778         eval $hasfield
9779         ;;
9780 *)      val="$undef"
9781         set d_tm_tm_zone
9782         eval $setvar
9783         ;;
9784 esac
9785 case "$d_tm_tm_zone" in
9786 "$define")      echo "Yes, it does."   ;;
9787 *)              echo "No, it doesn't." ;;
9788 esac
9789 : see if struct tm knows about tm_gmtoff
9790 case "$i_systime$i_time" in
9791 *$define*) 
9792         echo " "
9793         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9794         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9795         eval $hasfield
9796         ;;
9797 *)      val="$undef"
9798         set d_tm_tm_gmtoff
9799         eval $setvar
9800         ;;
9801 esac
9802 case "$d_tm_tm_gmtoff" in
9803 "$define")      echo "Yes, it does."   ;;
9804 *)              echo "No, it doesn't." ;;
9805 esac
9806
9807 : see if asctime_r exists
9808 set asctime_r d_asctime_r
9809 eval $inlibc
9810 case "$d_asctime_r" in
9811 "$define")
9812         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9813         case "$d_asctime_r_proto:$usethreads" in
9814         ":define")      d_asctime_r_proto=define
9815                 set d_asctime_r_proto asctime_r $hdrs
9816                 eval $hasproto ;;
9817         *)      ;;
9818         esac
9819         case "$d_asctime_r_proto" in
9820         define)
9821         case "$asctime_r_proto" in
9822         ''|0) try='char* asctime_r(const struct tm*, char*);'
9823         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9824         esac
9825         case "$asctime_r_proto" in
9826         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9827         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9828         esac
9829         case "$asctime_r_proto" in
9830         ''|0) try='int asctime_r(const struct tm*, char*);'
9831         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9832         esac
9833         case "$asctime_r_proto" in
9834         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9835         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9836         esac
9837         case "$asctime_r_proto" in
9838         ''|0)   d_asctime_r=undef
9839                 asctime_r_proto=0
9840                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9841         * )     case "$asctime_r_proto" in
9842                 REENTRANT_PROTO*) ;;
9843                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9844                 esac
9845                 echo "Prototype: $try" ;;
9846         esac
9847         ;;
9848         *)      case "$usethreads" in
9849                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9850                 esac
9851                 d_asctime_r=undef
9852                 asctime_r_proto=0
9853                 ;;
9854         esac
9855         ;;
9856 *)      asctime_r_proto=0
9857         ;;
9858 esac
9859
9860 : see if atolf exists
9861 set atolf d_atolf
9862 eval $inlibc
9863
9864 : see if atoll exists
9865 set atoll d_atoll
9866 eval $inlibc
9867
9868 : Look for GNU-cc style attribute checking
9869 case "$d_attribut" in
9870 '')
9871 echo " "
9872 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9873 $cat >attrib.c <<'EOCP'
9874 #include <stdio.h>
9875 void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
9876 EOCP
9877 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9878         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9879                 echo "Your C compiler doesn't fully support __attribute__."
9880                 val="$undef"
9881         else
9882                 echo "Your C compiler supports __attribute__."
9883                 val="$define"
9884         fi
9885 else
9886         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9887         val="$undef"
9888 fi
9889 ;;
9890 *) val="$d_attribut" ;;
9891 esac
9892 set d_attribut
9893 eval $setvar
9894 $rm -f attrib*
9895
9896 : see if bcmp exists
9897 set bcmp d_bcmp
9898 eval $inlibc
9899
9900 : see if bcopy exists
9901 set bcopy d_bcopy
9902 eval $inlibc
9903
9904 : see if this is a unistd.h system
9905 set unistd.h i_unistd
9906 eval $inhdr
9907
9908 : see if getpgrp exists
9909 set getpgrp d_getpgrp
9910 eval $inlibc
9911
9912 case "$d_getpgrp" in
9913 "$define")
9914         echo " "
9915         echo "Checking to see which flavor of getpgrp is in use..."
9916         $cat >try.c <<EOP
9917 #$i_unistd I_UNISTD
9918 #include <sys/types.h>
9919 #ifdef I_UNISTD
9920 #  include <unistd.h>
9921 #endif
9922 #$i_stdlib I_STDLIB
9923 #ifdef I_STDLIB
9924 #include <stdlib.h>
9925 #endif
9926 int main()
9927 {
9928         if (getuid() == 0) {
9929                 printf("(I see you are running Configure as super-user...)\n");
9930                 setuid(1);
9931         }
9932 #ifdef TRY_BSD_PGRP
9933         if (getpgrp(1) == 0)
9934                 exit(0);
9935 #else
9936         if (getpgrp() > 0)
9937                 exit(0);
9938 #endif
9939         exit(1);
9940 }
9941 EOP
9942         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9943                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9944                 val="$define"
9945         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9946                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9947                 val="$undef"
9948         else
9949                 echo "I can't seem to compile and run the test program."
9950                 if ./usg; then
9951                         xxx="a USG one, i.e. you use getpgrp()."
9952                 else
9953                         # SVR4 systems can appear rather BSD-ish.
9954                         case "$i_unistd" in
9955                         $undef)
9956                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9957                                 val="$define"
9958                                 ;;
9959                         $define)
9960                                 xxx="probably a USG one, i.e. you use getpgrp()."
9961                                 val="$undef"
9962                                 ;;
9963                         esac
9964                 fi
9965                 echo "Assuming your getpgrp is $xxx" >&4
9966         fi
9967         ;;
9968 *) val="$undef";;
9969 esac
9970 set d_bsdgetpgrp
9971 eval $setvar
9972 $rm -f try try.*
9973
9974 : see if setpgrp exists
9975 set setpgrp d_setpgrp
9976 eval $inlibc
9977
9978 case "$d_setpgrp" in
9979 "$define")
9980         echo " "
9981         echo "Checking to see which flavor of setpgrp is in use..."
9982         $cat >try.c <<EOP
9983 #$i_unistd I_UNISTD
9984 #include <sys/types.h>
9985 #ifdef I_UNISTD
9986 #  include <unistd.h>
9987 #endif
9988 #$i_stdlib I_STDLIB
9989 #ifdef I_STDLIB
9990 #include <stdlib.h>
9991 #endif
9992 int main()
9993 {
9994         if (getuid() == 0) {
9995                 printf("(I see you are running Configure as super-user...)\n");
9996                 setuid(1);
9997         }
9998 #ifdef TRY_BSD_PGRP
9999         if (-1 == setpgrp(1, 1))
10000                 exit(0);
10001 #else
10002         if (setpgrp() != -1)
10003                 exit(0);
10004 #endif
10005         exit(1);
10006 }
10007 EOP
10008         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10009                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10010                 val="$define"
10011         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10012                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10013                 val="$undef"
10014         else
10015                 echo "(I can't seem to compile and run the test program.)"
10016                 if ./usg; then
10017                         xxx="a USG one, i.e. you use setpgrp()."
10018                 else
10019                         # SVR4 systems can appear rather BSD-ish.
10020                         case "$i_unistd" in
10021                         $undef)
10022                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10023                                 val="$define"
10024                                 ;;
10025                         $define)
10026                                 xxx="probably a USG one, i.e. you use setpgrp()."
10027                                 val="$undef"
10028                                 ;;
10029                         esac
10030                 fi
10031                 echo "Assuming your setpgrp is $xxx" >&4
10032         fi
10033         ;;
10034 *) val="$undef";;
10035 esac
10036 set d_bsdsetpgrp
10037 eval $setvar
10038 $rm -f try try.*
10039 : see if bzero exists
10040 set bzero d_bzero
10041 eval $inlibc
10042
10043 : see if signal is declared as pointer to function returning int or void
10044 echo " "
10045 xxx=`./findhdr signal.h`
10046 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10047 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10048         echo "You have int (*signal())() instead of void." >&4
10049         val="$undef"
10050 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10051         echo "You have void (*signal())()." >&4
10052         val="$define"
10053 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10054         echo "You have int (*signal())() instead of void." >&4
10055         val="$undef"
10056 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10057         echo "You have void (*signal())()." >&4
10058         val="$define"
10059 else
10060         case "$d_voidsig" in
10061         '')
10062         echo "I can't determine whether signal handler returns void or int..." >&4
10063                 dflt=void
10064                 rp="What type does your signal handler return?"
10065                 . ./myread
10066                 case "$ans" in
10067                 v*) val="$define";;
10068                 *) val="$undef";;
10069                 esac;;
10070         "$define")
10071                 echo "As you already told me, signal handler returns void." >&4
10072                 val="$define"
10073                 ;;
10074         *)      echo "As you already told me, signal handler returns int." >&4
10075                 val="$undef"
10076                 ;;
10077         esac
10078 fi
10079 set d_voidsig
10080 eval $setvar
10081 case "$d_voidsig" in
10082 "$define") signal_t="void";;
10083 *) signal_t="int";;
10084 esac
10085 $rm -f $$.tmp
10086
10087 : check for ability to cast large floats to 32-bit ints.
10088 echo " "
10089 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10090 if $test "$intsize" -ge 4; then
10091         xxx=int
10092 else
10093         xxx=long
10094 fi
10095 $cat >try.c <<EOCP
10096 #include <stdio.h>
10097 #$i_stdlib I_STDLIB
10098 #ifdef I_STDLIB
10099 #include <stdlib.h>
10100 #endif
10101 #include <sys/types.h>
10102 #include <signal.h>
10103 $signal_t blech(s) int s; { exit(3); }
10104 int main()
10105 {
10106         $xxx i32;
10107         double f, g;
10108         int result = 0;
10109         char str[16];
10110         signal(SIGFPE, blech);
10111
10112         /* Don't let compiler optimize the test away.  Store the number 
10113            in a writable string for gcc to pass to sscanf under HP/UX.
10114         */
10115         sprintf(str, "2147483647");
10116         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10117         g = 10 * f;
10118         i32  = ($xxx) g;
10119
10120         /* x86 processors will probably give 0x8000 0000, which is a
10121            sign change.  We don't want that.  We want to mimic SPARC
10122            behavior here, which is to preserve the sign and give
10123            back 0x7fff ffff.
10124         */
10125         if (i32 != ($xxx) f)
10126                 result |= 1;
10127         exit(result);
10128 }
10129 EOCP
10130 set try
10131 if eval $compile_ok; then
10132         $run ./try
10133         yyy=$?
10134 else
10135         echo "(I can't seem to compile the test program--assuming it can't)"
10136         yyy=1
10137 fi
10138 case "$yyy" in
10139 0)      val="$define"
10140         echo "Yup, it can."
10141         ;;
10142 *)      val="$undef"
10143         echo "Nope, it can't."
10144         ;;
10145 esac
10146 set d_casti32
10147 eval $setvar
10148 $rm -f try try.*
10149
10150 : check for ability to cast negative floats to unsigned
10151 echo " "
10152 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10153 $cat >try.c <<EOCP
10154 #include <stdio.h>
10155 #$i_stdlib I_STDLIB
10156 #ifdef I_STDLIB
10157 #include <stdlib.h>
10158 #endif
10159 #include <sys/types.h>
10160 #include <signal.h>
10161 $signal_t blech(s) int s; { exit(7); }
10162 $signal_t blech_in_list(s) int s; { exit(4); }
10163 unsigned long dummy_long(p) unsigned long p; { return p; }
10164 unsigned int dummy_int(p) unsigned int p; { return p; }
10165 unsigned short dummy_short(p) unsigned short p; { return p; }
10166 int main()
10167 {
10168         double f;
10169         unsigned long along;
10170         unsigned int aint;
10171         unsigned short ashort;
10172         int result = 0;
10173         char str[16];
10174         
10175         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10176            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10177            optimized the whole file away
10178         */
10179         /* Store the number in a writable string for gcc to pass to 
10180            sscanf under HP/UX.
10181         */
10182         sprintf(str, "-123");
10183         sscanf(str, "%lf", &f);  /* f = -123.; */
10184
10185         signal(SIGFPE, blech);
10186         along = (unsigned long)f;
10187         aint = (unsigned int)f;
10188         ashort = (unsigned short)f;
10189         if (along != (unsigned long)-123)
10190                 result |= 1;
10191         if (aint != (unsigned int)-123)
10192                 result |= 1;
10193         if (ashort != (unsigned short)-123)
10194                 result |= 1;
10195         sprintf(str, "1073741824.");
10196         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10197         f = f + f;
10198         along = 0;
10199         along = (unsigned long)f;
10200         if (along != 0x80000000)
10201                 result |= 2;
10202         f -= 1.;
10203         along = 0;
10204         along = (unsigned long)f;
10205         if (along != 0x7fffffff)
10206                 result |= 1;
10207         f += 2.;
10208         along = 0;
10209         along = (unsigned long)f;
10210         if (along != 0x80000001)
10211                 result |= 2;
10212         if (result)
10213                 exit(result);
10214         signal(SIGFPE, blech_in_list);
10215         sprintf(str, "123.");
10216         sscanf(str, "%lf", &f);  /* f = 123.; */
10217         along = dummy_long((unsigned long)f);
10218         aint = dummy_int((unsigned int)f);
10219         ashort = dummy_short((unsigned short)f);
10220         if (along != (unsigned long)123)
10221                 result |= 4;
10222         if (aint != (unsigned int)123)
10223                 result |= 4;
10224         if (ashort != (unsigned short)123)
10225                 result |= 4;
10226         exit(result);
10227
10228 }
10229 EOCP
10230 set try
10231 if eval $compile_ok; then
10232         $run ./try
10233         castflags=$?
10234 else
10235         echo "(I can't seem to compile the test program--assuming it can't)"
10236         castflags=7
10237 fi
10238 case "$castflags" in
10239 0)      val="$define"
10240         echo "Yup, it can."
10241         ;;
10242 *)      val="$undef"
10243         echo "Nope, it can't."
10244         ;;
10245 esac
10246 set d_castneg
10247 eval $setvar
10248 $rm -f try.*
10249
10250 : see if vprintf exists
10251 echo " "
10252 if set vprintf val -f d_vprintf; eval $csym; $val; then
10253         echo 'vprintf() found.' >&4
10254         val="$define"
10255         $cat >try.c <<EOF
10256 #include <varargs.h>
10257 #$i_stdlib I_STDLIB
10258 #ifdef I_STDLIB
10259 #include <stdlib.h>
10260 #endif
10261
10262 int main() { xxx("foo"); }
10263
10264 xxx(va_alist)
10265 va_dcl
10266 {
10267         va_list args;
10268         char buf[10];
10269
10270         va_start(args);
10271         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10272 }
10273 EOF
10274         set try
10275         if eval $compile && $run ./try; then
10276                 echo "Your vsprintf() returns (int)." >&4
10277                 val2="$undef"
10278         else
10279                 echo "Your vsprintf() returns (char*)." >&4
10280                 val2="$define"
10281         fi
10282 else
10283         echo 'vprintf() NOT found.' >&4
10284                 val="$undef"
10285                 val2="$undef"
10286 fi
10287 $rm -f try try.*
10288 set d_vprintf
10289 eval $setvar
10290 val=$val2
10291 set d_charvspr
10292 eval $setvar
10293
10294 : see if chown exists
10295 set chown d_chown
10296 eval $inlibc
10297
10298 : see if chroot exists
10299 set chroot d_chroot
10300 eval $inlibc
10301
10302 : see if chsize exists
10303 set chsize d_chsize
10304 eval $inlibc
10305
10306 : see if class exists
10307 set class d_class
10308 eval $inlibc
10309
10310 hasstruct='varname=$1; struct=$2; shift; shift;
10311 while $test $# -ge 2; do
10312         case "$1" in
10313         $define) echo "#include <$2>";;
10314         esac ;
10315     shift 2;
10316 done > try.c;
10317 echo "int main () { struct $struct foo; }" >> try.c;
10318 set try;
10319 if eval $compile; then
10320         val="$define";
10321 else
10322         val="$undef";
10323 fi;
10324 set $varname;
10325 eval $setvar;
10326 $rm -f try.c try.o'
10327
10328 socketlib=''
10329 sockethdr=''
10330 : see whether socket exists
10331 echo " "
10332 $echo $n "Hmm... $c" >&4
10333 if set socket val -f d_socket; eval $csym; $val; then
10334         echo "Looks like you have Berkeley networking support." >&4
10335         d_socket="$define"
10336         if set setsockopt val -f; eval $csym; $val; then
10337                 d_oldsock="$undef"
10338         else
10339                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10340                 d_oldsock="$define"
10341         fi
10342 else
10343         if $contains socklib libc.list >/dev/null 2>&1; then
10344                 echo "Looks like you have Berkeley networking support." >&4
10345                 d_socket="$define"
10346                 : we will have to assume that it supports the 4.2 BSD interface
10347                 d_oldsock="$undef"
10348         else
10349                 echo "You don't have Berkeley networking in libc$_a..." >&4
10350                 if test "X$d_socket" = "X$define"; then
10351                    echo "...but you seem to believe that you have sockets." >&4
10352                 else
10353                         for net in net socket
10354                         do
10355                                 if test -f /usr/lib/lib$net$_a; then
10356                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10357                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10358                                         if $contains socket libc.list >/dev/null 2>&1; then
10359                                                 d_socket="$define"
10360                                                 socketlib="-l$net"
10361                                                 case "$net" in
10362                                                 net)
10363                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10364                                                         sockethdr="-I/usr/netinclude"
10365                                                         ;;
10366                                                 esac
10367                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10368                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10369                                                         d_oldsock="$undef"
10370                                                 else
10371                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10372                                                         d_oldsock="$define"
10373                                                 fi
10374                                                 break
10375                                         fi
10376                                 fi
10377                         done
10378                         if test "X$d_socket" != "X$define"; then
10379                            echo "or anywhere else I see." >&4
10380                            d_socket="$undef"
10381                            d_oldsock="$undef"
10382                         fi
10383                 fi
10384         fi
10385 fi
10386
10387 : see if socketpair exists
10388 set socketpair d_sockpair
10389 eval $inlibc
10390
10391
10392 echo " "
10393 echo "Checking the availability of certain socket constants..." >&4
10394 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10395         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10396         $cat >try.c <<EOF
10397 #include <sys/types.h>
10398 #include <sys/socket.h>
10399 int main() {
10400     int i = $ENUM;
10401 }
10402 EOF
10403         val="$undef"
10404         set try; if eval $compile; then
10405                 val="$define"
10406         fi
10407         set d_${enum}; eval $setvar
10408         $rm -f try.c try
10409 done
10410
10411 : see if this is a sys/uio.h system
10412 set sys/uio.h i_sysuio
10413 eval $inhdr
10414
10415
10416 echo " "
10417 echo "Checking to see if your system supports struct cmsghdr..." >&4
10418 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10419 eval $hasstruct
10420 case "$d_cmsghdr_s" in
10421 "$define")      echo "Yes, it does."   ;;
10422 *)              echo "No, it doesn't." ;;
10423 esac
10424
10425
10426 : check for const keyword
10427 echo " "
10428 echo 'Checking to see if your C compiler knows about "const"...' >&4
10429 $cat >const.c <<'EOCP'
10430 typedef struct spug { int drokk; } spug;
10431 int main()
10432 {
10433         const char *foo;
10434         const spug y;
10435 }
10436 EOCP
10437 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10438         val="$define"
10439         echo "Yup, it does."
10440 else
10441         val="$undef"
10442         echo "Nope, it doesn't."
10443 fi
10444 set d_const
10445 eval $setvar
10446
10447 : see if copysignl exists
10448 set copysignl d_copysignl
10449 eval $inlibc
10450
10451 : see if crypt exists
10452 echo " "
10453 set crypt d_crypt
10454 eval $inlibc
10455 case "$d_crypt" in
10456 $define) cryptlib='' ;;
10457 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10458                 echo 'crypt() found.' >&4
10459                 val="$define"
10460                 cryptlib=''
10461         else
10462                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10463                 if $test -z "$cryptlib"; then
10464                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10465                 else
10466                         cryptlib=-lcrypt
10467                 fi
10468                 if $test -z "$cryptlib"; then
10469                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10470                 else
10471                         cryptlib=-lcrypt
10472                 fi
10473                 if $test -z "$cryptlib"; then
10474                         cryptlib=`./loc libcrypt$_a "" $libpth`
10475                 else
10476                         cryptlib=-lcrypt
10477                 fi
10478                 if $test -z "$cryptlib"; then
10479                         echo 'crypt() NOT found.' >&4
10480                         val="$undef"
10481                 else
10482                         val="$define"
10483                 fi
10484         fi
10485         set d_crypt
10486         eval $setvar
10487         ;;
10488 esac
10489
10490 : see if this is a crypt.h system
10491 set crypt.h i_crypt
10492 eval $inhdr
10493
10494 : see if crypt_r exists
10495 set crypt_r d_crypt_r
10496 eval $inlibc
10497 case "$d_crypt_r" in
10498 "$define")
10499         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10500         case "$d_crypt_r_proto:$usethreads" in
10501         ":define")      d_crypt_r_proto=define
10502                 set d_crypt_r_proto crypt_r $hdrs
10503                 eval $hasproto ;;
10504         *)      ;;
10505         esac
10506         case "$d_crypt_r_proto" in
10507         define)
10508         case "$crypt_r_proto" in
10509         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10510         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10511         esac
10512         case "$crypt_r_proto" in
10513         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10514         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10515         esac
10516         case "$crypt_r_proto" in
10517         ''|0)   d_crypt_r=undef
10518                 crypt_r_proto=0
10519                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10520         * )     case "$crypt_r_proto" in
10521                 REENTRANT_PROTO*) ;;
10522                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10523                 esac
10524                 echo "Prototype: $try" ;;
10525         esac
10526         ;;
10527         *)      case "$usethreads" in
10528                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10529                 esac
10530                 d_crypt_r=undef
10531                 crypt_r_proto=0
10532                 ;;
10533         esac
10534         ;;
10535 *)      crypt_r_proto=0
10536         ;;
10537 esac
10538
10539 : get csh whereabouts
10540 case "$csh" in
10541 'csh') val="$undef" ;;
10542 *) val="$define" ;;
10543 esac
10544 set d_csh
10545 eval $setvar
10546 : Respect a hint or command line value for full_csh.
10547 case "$full_csh" in
10548 '') full_csh=$csh ;;
10549 esac
10550
10551 : see if ctermid_r exists
10552 set ctermid_r d_ctermid_r
10553 eval $inlibc
10554 case "$d_ctermid_r" in
10555 "$define")
10556         hdrs="$i_systypes sys/types.h define stdio.h "
10557         case "$d_ctermid_r_proto:$usethreads" in
10558         ":define")      d_ctermid_r_proto=define
10559                 set d_ctermid_r_proto ctermid_r $hdrs
10560                 eval $hasproto ;;
10561         *)      ;;
10562         esac
10563         case "$d_ctermid_r_proto" in
10564         define)
10565         case "$ctermid_r_proto" in
10566         ''|0) try='char* ctermid_r(char*);'
10567         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10568         esac
10569         case "$ctermid_r_proto" in
10570         ''|0)   d_ctermid_r=undef
10571                 ctermid_r_proto=0
10572                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10573         * )     case "$ctermid_r_proto" in
10574                 REENTRANT_PROTO*) ;;
10575                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10576                 esac
10577                 echo "Prototype: $try" ;;
10578         esac
10579         ;;
10580         *)      case "$usethreads" in
10581                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10582                 esac
10583                 d_ctermid_r=undef
10584                 ctermid_r_proto=0
10585                 ;;
10586         esac
10587         ;;
10588 *)      ctermid_r_proto=0
10589         ;;
10590 esac
10591
10592 : see if ctime_r exists
10593 set ctime_r d_ctime_r
10594 eval $inlibc
10595 case "$d_ctime_r" in
10596 "$define")
10597         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10598         case "$d_ctime_r_proto:$usethreads" in
10599         ":define")      d_ctime_r_proto=define
10600                 set d_ctime_r_proto ctime_r $hdrs
10601                 eval $hasproto ;;
10602         *)      ;;
10603         esac
10604         case "$d_ctime_r_proto" in
10605         define)
10606         case "$ctime_r_proto" in
10607         ''|0) try='char* ctime_r(const time_t*, char*);'
10608         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10609         esac
10610         case "$ctime_r_proto" in
10611         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10612         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10613         esac
10614         case "$ctime_r_proto" in
10615         ''|0) try='int ctime_r(const time_t*, char*);'
10616         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10617         esac
10618         case "$ctime_r_proto" in
10619         ''|0) try='int ctime_r(const time_t*, char*, int);'
10620         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10621         esac
10622         case "$ctime_r_proto" in
10623         ''|0)   d_ctime_r=undef
10624                 ctime_r_proto=0
10625                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10626         * )     case "$ctime_r_proto" in
10627                 REENTRANT_PROTO*) ;;
10628                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10629                 esac
10630                 echo "Prototype: $try" ;;
10631         esac
10632         ;;
10633         *)      case "$usethreads" in
10634                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10635                 esac
10636                 d_ctime_r=undef
10637                 ctime_r_proto=0
10638                 ;;
10639         esac
10640         ;;
10641 *)      ctime_r_proto=0
10642         ;;
10643 esac
10644
10645 : see if cuserid exists
10646 set cuserid d_cuserid
10647 eval $inlibc
10648
10649 : see if this is a limits.h system
10650 set limits.h i_limits
10651 eval $inhdr
10652
10653 : see if this is a float.h system
10654 set float.h i_float
10655 eval $inhdr
10656
10657 : See if number of significant digits in a double precision number is known
10658 echo " "
10659 $cat >dbl_dig.c <<EOM
10660 #$i_limits I_LIMITS
10661 #$i_float I_FLOAT
10662 #ifdef I_LIMITS
10663 #include <limits.h>
10664 #endif
10665 #ifdef I_FLOAT
10666 #include <float.h>
10667 #endif
10668 #ifdef DBL_DIG
10669 printf("Contains DBL_DIG");
10670 #endif
10671 EOM
10672 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10673 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10674         echo "DBL_DIG found." >&4
10675         val="$define"
10676 else
10677         echo "DBL_DIG NOT found." >&4
10678         val="$undef"
10679 fi
10680 $rm -f dbl_dig.?
10681 set d_dbl_dig
10682 eval $setvar
10683
10684 : see if dbm.h is available
10685 : see if dbmclose exists
10686 set dbmclose d_dbmclose
10687 eval $inlibc
10688
10689 case "$d_dbmclose" in
10690 $define)
10691         set dbm.h i_dbm
10692         eval $inhdr
10693         case "$i_dbm" in
10694         $define)
10695                 val="$undef"
10696                 set i_rpcsvcdbm
10697                 eval $setvar
10698                 ;;
10699         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10700                 eval $inhdr
10701                 ;;
10702         esac
10703         ;;
10704 *)      echo "We won't be including <dbm.h>"
10705         val="$undef"
10706         set i_dbm
10707         eval $setvar
10708         val="$undef"
10709         set i_rpcsvcdbm
10710         eval $setvar
10711         ;;
10712 esac
10713
10714 : see if prototype for dbminit is available
10715 echo " "
10716 set d_dbminitproto dbminit $i_dbm dbm.h
10717 eval $hasproto
10718
10719 : see if difftime exists
10720 set difftime d_difftime
10721 eval $inlibc
10722
10723 : see if this is a dirent system
10724 echo " "
10725 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10726         val="$define"
10727         echo "<dirent.h> found." >&4
10728 else
10729         val="$undef"
10730         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10731                 echo "<sys/dir.h> found." >&4
10732                 echo " "
10733         else
10734                 xinc=`./findhdr sys/ndir.h`
10735         fi
10736         echo "<dirent.h> NOT found." >&4
10737 fi
10738 set i_dirent
10739 eval $setvar
10740
10741 : Look for type of directory structure.
10742 echo " "
10743 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10744
10745 case "$direntrytype" in
10746 ''|' ')
10747         case "$i_dirent" in
10748         $define) guess1='struct dirent' ;;
10749         *) guess1='struct direct'  ;;
10750         esac
10751         ;;
10752 *)      guess1="$direntrytype"
10753         ;;
10754 esac
10755
10756 case "$guess1" in
10757 'struct dirent') guess2='struct direct' ;;
10758 *) guess2='struct dirent' ;;
10759 esac
10760                 
10761 if $contains "$guess1" try.c >/dev/null 2>&1; then
10762         direntrytype="$guess1"
10763         echo "Your directory entries are $direntrytype." >&4
10764 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10765         direntrytype="$guess2"
10766         echo "Your directory entries seem to be $direntrytype." >&4
10767 else
10768         echo "I don't recognize your system's directory entries." >&4
10769         rp="What type is used for directory entries on this system?"
10770         dflt="$guess1"
10771         . ./myread
10772         direntrytype="$ans"
10773 fi
10774 $rm -f try.c
10775
10776
10777 : see if the directory entry stores field length
10778 echo " "
10779 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10780 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10781         echo "Good, your directory entry keeps length information in d_namlen." >&4
10782         val="$define"
10783 else
10784         echo "Your directory entry does not know about the d_namlen field." >&4
10785         val="$undef"
10786 fi
10787 set d_dirnamlen
10788 eval $setvar
10789 $rm -f try.c
10790
10791 : see if this is an sysdir system
10792 set sys/dir.h i_sysdir
10793 eval $inhdr
10794
10795 : see if this is an sysndir system
10796 set sys/ndir.h i_sysndir
10797 eval $inhdr
10798
10799 : Look for dirfd
10800 echo " "
10801 $cat >dirfd.c <<EOM
10802 #include <stdio.h>
10803 #$i_stdlib I_STDLIB
10804 #ifdef I_STDLIB
10805 #include <stdlib.h>
10806 #endif
10807 #$i_dirent I_DIRENT             /**/
10808 #$i_sysdir I_SYS_DIR            /**/
10809 #$i_sysndir I_SYS_NDIR          /**/
10810 #$i_systypes I_SYS_TYPES        /**/
10811 #if defined(I_SYS_TYPES)
10812 #include <sys/types.h>
10813 #endif
10814 #if defined(I_DIRENT)
10815 #include <dirent.h>
10816 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10817 #include <sys/dir.h>
10818 #endif
10819 #else
10820 #ifdef I_SYS_NDIR
10821 #include <sys/ndir.h>
10822 #else
10823 #ifdef I_SYS_DIR
10824 #ifdef hp9000s500
10825 #include <ndir.h>       /* may be wrong in the future */
10826 #else
10827 #include <sys/dir.h>
10828 #endif
10829 #endif
10830 #endif
10831 #endif 
10832 int main() {
10833         DIR *dirp = opendir(".");
10834         if (dirfd(dirp) >= 0)
10835                 exit(0);
10836         else
10837                 exit(1);
10838 }
10839 EOM
10840 set dirfd
10841 if eval $compile; then
10842         val="$define"
10843 fi
10844 case "$val" in
10845 $define)        echo "dirfd() found." >&4       ;;
10846 *)              echo "dirfd() NOT found." >&4   ;;
10847 esac
10848 set d_dirfd
10849 eval $setvar
10850 $rm -f dirfd*
10851
10852 : see if dlerror exists
10853 xxx_runnm="$runnm"
10854 runnm=false
10855 set dlerror d_dlerror
10856 eval $inlibc
10857 runnm="$xxx_runnm"
10858
10859 : see if dlfcn is available
10860 set dlfcn.h i_dlfcn
10861 eval $inhdr
10862
10863 case "$usedl" in
10864 $define|y|true)
10865         $cat << EOM
10866
10867 On a few systems, the dynamically loaded modules that perl generates and uses
10868 will need a different extension than shared libs. The default will probably
10869 be appropriate.
10870
10871 EOM
10872         case "$dlext" in
10873         '')     dflt="$so" ;;
10874         *)      dflt="$dlext" ;;
10875         esac
10876         rp='What is the extension of dynamically loaded modules'
10877         . ./myread
10878         dlext="$ans"
10879         ;;
10880 *)
10881         dlext="none"
10882         ;;
10883 esac
10884
10885 : Check if dlsym need a leading underscore
10886 echo " "
10887 val="$undef"
10888
10889 case "$dlsrc" in
10890 dl_dlopen.xs)
10891         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10892         $cat >dyna.c <<'EOM'
10893 fred () { }
10894 EOM
10895
10896 $cat >fred.c<<EOM
10897
10898 #include <stdio.h>
10899 #$i_stdlib I_STDLIB
10900 #ifdef I_STDLIB
10901 #include <stdlib.h>
10902 #endif
10903 #$i_dlfcn I_DLFCN
10904 #ifdef I_DLFCN
10905 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10906 #else
10907 #include <sys/types.h>
10908 #include <nlist.h>
10909 #include <link.h>
10910 #endif
10911
10912 extern int fred() ;
10913
10914 int main()
10915 {
10916     void * handle ;
10917     void * symbol ;
10918 #ifndef RTLD_LAZY
10919     int mode = 1 ;
10920 #else
10921     int mode = RTLD_LAZY ;
10922 #endif
10923     handle = dlopen("./dyna.$dlext", mode) ;
10924     if (handle == NULL) {
10925         printf ("1\n") ;
10926         fflush (stdout) ;
10927         exit(0);
10928     }
10929     symbol = dlsym(handle, "fred") ;
10930     if (symbol == NULL) {
10931         /* try putting a leading underscore */
10932         symbol = dlsym(handle, "_fred") ;
10933         if (symbol == NULL) {
10934             printf ("2\n") ;
10935             fflush (stdout) ;
10936             exit(0);
10937         }
10938         printf ("3\n") ;
10939     }
10940     else
10941         printf ("4\n") ;
10942     fflush (stdout) ;
10943     exit(0);
10944 }
10945 EOM
10946         : Call the object file tmp-dyna.o in case dlext=o.
10947         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10948                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10949                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10950                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10951                 xxx=`$run ./fred`
10952                 case $xxx in
10953                 1)      echo "Test program failed using dlopen." >&4
10954                         echo "Perhaps you should not use dynamic loading." >&4;;
10955                 2)      echo "Test program failed using dlsym." >&4
10956                         echo "Perhaps you should not use dynamic loading." >&4;;
10957                 3)      echo "dlsym needs a leading underscore" >&4
10958                         val="$define" ;;
10959                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10960                 esac
10961         else
10962                 echo "I can't compile and run the test program." >&4
10963                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10964         fi
10965         ;;
10966 esac
10967                 
10968 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10969
10970 set d_dlsymun
10971 eval $setvar
10972
10973 : see if drand48_r exists
10974 set drand48_r d_drand48_r
10975 eval $inlibc
10976 case "$d_drand48_r" in
10977 "$define")
10978         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10979         case "$d_drand48_r_proto:$usethreads" in
10980         ":define")      d_drand48_r_proto=define
10981                 set d_drand48_r_proto drand48_r $hdrs
10982                 eval $hasproto ;;
10983         *)      ;;
10984         esac
10985         case "$d_drand48_r_proto" in
10986         define)
10987         case "$drand48_r_proto" in
10988         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10989         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10990         esac
10991         case "$drand48_r_proto" in
10992         ''|0)   d_drand48_r=undef
10993                 drand48_r_proto=0
10994                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10995         * )     case "$drand48_r_proto" in
10996                 REENTRANT_PROTO*) ;;
10997                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10998                 esac
10999                 echo "Prototype: $try" ;;
11000         esac
11001         ;;
11002         *)      case "$usethreads" in
11003                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11004                 esac
11005                 d_drand48_r=undef
11006                 drand48_r_proto=0
11007                 ;;
11008         esac
11009         ;;
11010 *)      drand48_r_proto=0
11011         ;;
11012 esac
11013
11014 : see if prototype for drand48 is available
11015 echo " "
11016 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11017 eval $hasproto
11018
11019 : see if dup2 exists
11020 set dup2 d_dup2
11021 eval $inlibc
11022
11023 : see if eaccess exists
11024 set eaccess d_eaccess
11025 eval $inlibc
11026
11027 : see if endgrent exists
11028 set endgrent d_endgrent
11029 eval $inlibc
11030
11031 : see if this is an grp system
11032 set grp.h i_grp
11033 eval $inhdr
11034
11035 case "$i_grp" in
11036 $define)
11037         xxx=`./findhdr grp.h`
11038         $cppstdin $cppflags $cppminus < $xxx >$$.h
11039
11040         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11041                 val="$define"
11042         else
11043                 val="$undef"
11044         fi
11045         set d_grpasswd
11046         eval $setvar
11047
11048         $rm -f $$.h
11049         ;;
11050 *)
11051         val="$undef";
11052         set d_grpasswd; eval $setvar
11053         ;;
11054 esac
11055
11056 : see if endgrent_r exists
11057 set endgrent_r d_endgrent_r
11058 eval $inlibc
11059 case "$d_endgrent_r" in
11060 "$define")
11061         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11062         case "$d_endgrent_r_proto:$usethreads" in
11063         ":define")      d_endgrent_r_proto=define
11064                 set d_endgrent_r_proto endgrent_r $hdrs
11065                 eval $hasproto ;;
11066         *)      ;;
11067         esac
11068         case "$d_endgrent_r_proto" in
11069         define)
11070         case "$endgrent_r_proto" in
11071         ''|0) try='int endgrent_r(FILE**);'
11072         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11073         esac
11074         case "$endgrent_r_proto" in
11075         ''|0) try='void endgrent_r(FILE**);'
11076         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11077         esac
11078         case "$endgrent_r_proto" in
11079         ''|0)   d_endgrent_r=undef
11080                 endgrent_r_proto=0
11081                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11082         * )     case "$endgrent_r_proto" in
11083                 REENTRANT_PROTO*) ;;
11084                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11085                 esac
11086                 echo "Prototype: $try" ;;
11087         esac
11088         ;;
11089         *)      case "$usethreads" in
11090                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11091                 esac
11092                 d_endgrent_r=undef
11093                 endgrent_r_proto=0
11094                 ;;
11095         esac
11096         ;;
11097 *)      endgrent_r_proto=0
11098         ;;
11099 esac
11100
11101 : see if endhostent exists
11102 set endhostent d_endhent
11103 eval $inlibc
11104
11105 : see if this is a netdb.h system
11106 set netdb.h i_netdb
11107 eval $inhdr
11108
11109 : see if endhostent_r exists
11110 set endhostent_r d_endhostent_r
11111 eval $inlibc
11112 case "$d_endhostent_r" in
11113 "$define")
11114         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11115         case "$d_endhostent_r_proto:$usethreads" in
11116         ":define")      d_endhostent_r_proto=define
11117                 set d_endhostent_r_proto endhostent_r $hdrs
11118                 eval $hasproto ;;
11119         *)      ;;
11120         esac
11121         case "$d_endhostent_r_proto" in
11122         define)
11123         case "$endhostent_r_proto" in
11124         ''|0) try='int endhostent_r(struct hostent_data*);'
11125         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11126         esac
11127         case "$endhostent_r_proto" in
11128         ''|0) try='void endhostent_r(struct hostent_data*);'
11129         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11130         esac
11131         case "$endhostent_r_proto" in
11132         ''|0)   d_endhostent_r=undef
11133                 endhostent_r_proto=0
11134                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11135         * )     case "$endhostent_r_proto" in
11136                 REENTRANT_PROTO*) ;;
11137                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11138                 esac
11139                 echo "Prototype: $try" ;;
11140         esac
11141         ;;
11142         *)      case "$usethreads" in
11143                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11144                 esac
11145                 d_endhostent_r=undef
11146                 endhostent_r_proto=0
11147                 ;;
11148         esac
11149         ;;
11150 *)      endhostent_r_proto=0
11151         ;;
11152 esac
11153
11154 : see if endnetent exists
11155 set endnetent d_endnent
11156 eval $inlibc
11157
11158 : see if endnetent_r exists
11159 set endnetent_r d_endnetent_r
11160 eval $inlibc
11161 case "$d_endnetent_r" in
11162 "$define")
11163         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11164         case "$d_endnetent_r_proto:$usethreads" in
11165         ":define")      d_endnetent_r_proto=define
11166                 set d_endnetent_r_proto endnetent_r $hdrs
11167                 eval $hasproto ;;
11168         *)      ;;
11169         esac
11170         case "$d_endnetent_r_proto" in
11171         define)
11172         case "$endnetent_r_proto" in
11173         ''|0) try='int endnetent_r(struct netent_data*);'
11174         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11175         esac
11176         case "$endnetent_r_proto" in
11177         ''|0) try='void endnetent_r(struct netent_data*);'
11178         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11179         esac
11180         case "$endnetent_r_proto" in
11181         ''|0)   d_endnetent_r=undef
11182                 endnetent_r_proto=0
11183                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11184         * )     case "$endnetent_r_proto" in
11185                 REENTRANT_PROTO*) ;;
11186                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11187                 esac
11188                 echo "Prototype: $try" ;;
11189         esac
11190         ;;
11191         *)      case "$usethreads" in
11192                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11193                 esac
11194                 d_endnetent_r=undef
11195                 endnetent_r_proto=0
11196                 ;;
11197         esac
11198         ;;
11199 *)      endnetent_r_proto=0
11200         ;;
11201 esac
11202
11203 : see if endprotoent exists
11204 set endprotoent d_endpent
11205 eval $inlibc
11206
11207 : see if endprotoent_r exists
11208 set endprotoent_r d_endprotoent_r
11209 eval $inlibc
11210 case "$d_endprotoent_r" in
11211 "$define")
11212         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11213         case "$d_endprotoent_r_proto:$usethreads" in
11214         ":define")      d_endprotoent_r_proto=define
11215                 set d_endprotoent_r_proto endprotoent_r $hdrs
11216                 eval $hasproto ;;
11217         *)      ;;
11218         esac
11219         case "$d_endprotoent_r_proto" in
11220         define)
11221         case "$endprotoent_r_proto" in
11222         ''|0) try='int endprotoent_r(struct protoent_data*);'
11223         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11224         esac
11225         case "$endprotoent_r_proto" in
11226         ''|0) try='void endprotoent_r(struct protoent_data*);'
11227         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11228         esac
11229         case "$endprotoent_r_proto" in
11230         ''|0)   d_endprotoent_r=undef
11231                 endprotoent_r_proto=0
11232                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11233         * )     case "$endprotoent_r_proto" in
11234                 REENTRANT_PROTO*) ;;
11235                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11236                 esac
11237                 echo "Prototype: $try" ;;
11238         esac
11239         ;;
11240         *)      case "$usethreads" in
11241                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11242                 esac
11243                 d_endprotoent_r=undef
11244                 endprotoent_r_proto=0
11245                 ;;
11246         esac
11247         ;;
11248 *)      endprotoent_r_proto=0
11249         ;;
11250 esac
11251
11252 : see if endpwent exists
11253 set endpwent d_endpwent
11254 eval $inlibc
11255
11256 : see if this is a pwd.h system
11257 set pwd.h i_pwd
11258 eval $inhdr
11259
11260 case "$i_pwd" in
11261 $define)
11262         xxx=`./findhdr pwd.h`
11263         $cppstdin $cppflags $cppminus < $xxx >$$.h
11264
11265         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11266                 val="$define"
11267         else
11268                 val="$undef"
11269         fi
11270         set d_pwquota
11271         eval $setvar
11272
11273         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11274                 val="$define"
11275         else
11276                 val="$undef"
11277         fi
11278         set d_pwage
11279         eval $setvar
11280
11281         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11282                 val="$define"
11283         else
11284                 val="$undef"
11285         fi
11286         set d_pwchange
11287         eval $setvar
11288
11289         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11290                 val="$define"
11291         else
11292                 val="$undef"
11293         fi
11294         set d_pwclass
11295         eval $setvar
11296
11297         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11298                 val="$define"
11299         else
11300                 val="$undef"
11301         fi
11302         set d_pwexpire
11303         eval $setvar
11304
11305         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11306                 val="$define"
11307         else
11308                 val="$undef"
11309         fi
11310         set d_pwcomment
11311         eval $setvar
11312
11313         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11314                 val="$define"
11315         else
11316                 val="$undef"
11317         fi
11318         set d_pwgecos
11319         eval $setvar
11320
11321         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11322                 val="$define"
11323         else
11324                 val="$undef"
11325         fi
11326         set d_pwpasswd
11327         eval $setvar
11328
11329         $rm -f $$.h
11330         ;;
11331 *)
11332         val="$undef"; 
11333         set d_pwquota; eval $setvar
11334         set d_pwage; eval $setvar
11335         set d_pwchange; eval $setvar
11336         set d_pwclass; eval $setvar
11337         set d_pwexpire; eval $setvar
11338         set d_pwcomment; eval $setvar
11339         set d_pwgecos; eval $setvar
11340         set d_pwpasswd; eval $setvar
11341         ;;
11342 esac
11343
11344 : see if endpwent_r exists
11345 set endpwent_r d_endpwent_r
11346 eval $inlibc
11347 case "$d_endpwent_r" in
11348 "$define")
11349         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11350         case "$d_endpwent_r_proto:$usethreads" in
11351         ":define")      d_endpwent_r_proto=define
11352                 set d_endpwent_r_proto endpwent_r $hdrs
11353                 eval $hasproto ;;
11354         *)      ;;
11355         esac
11356         case "$d_endpwent_r_proto" in
11357         define)
11358         case "$endpwent_r_proto" in
11359         ''|0) try='int endpwent_r(FILE**);'
11360         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11361         esac
11362         case "$endpwent_r_proto" in
11363         ''|0) try='void endpwent_r(FILE**);'
11364         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11365         esac
11366         case "$endpwent_r_proto" in
11367         ''|0)   d_endpwent_r=undef
11368                 endpwent_r_proto=0
11369                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11370         * )     case "$endpwent_r_proto" in
11371                 REENTRANT_PROTO*) ;;
11372                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11373                 esac
11374                 echo "Prototype: $try" ;;
11375         esac
11376         ;;
11377         *)      case "$usethreads" in
11378                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11379                 esac
11380                 d_endpwent_r=undef
11381                 endpwent_r_proto=0
11382                 ;;
11383         esac
11384         ;;
11385 *)      endpwent_r_proto=0
11386         ;;
11387 esac
11388
11389 : see if endservent exists
11390 set endservent d_endsent
11391 eval $inlibc
11392
11393 : see if endservent_r exists
11394 set endservent_r d_endservent_r
11395 eval $inlibc
11396 case "$d_endservent_r" in
11397 "$define")
11398         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11399         case "$d_endservent_r_proto:$usethreads" in
11400         ":define")      d_endservent_r_proto=define
11401                 set d_endservent_r_proto endservent_r $hdrs
11402                 eval $hasproto ;;
11403         *)      ;;
11404         esac
11405         case "$d_endservent_r_proto" in
11406         define)
11407         case "$endservent_r_proto" in
11408         ''|0) try='int endservent_r(struct servent_data*);'
11409         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11410         esac
11411         case "$endservent_r_proto" in
11412         ''|0) try='void endservent_r(struct servent_data*);'
11413         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11414         esac
11415         case "$endservent_r_proto" in
11416         ''|0)   d_endservent_r=undef
11417                 endservent_r_proto=0
11418                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11419         * )     case "$endservent_r_proto" in
11420                 REENTRANT_PROTO*) ;;
11421                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11422                 esac
11423                 echo "Prototype: $try" ;;
11424         esac
11425         ;;
11426         *)      case "$usethreads" in
11427                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11428                 esac
11429                 d_endservent_r=undef
11430                 endservent_r_proto=0
11431                 ;;
11432         esac
11433         ;;
11434 *)      endservent_r_proto=0
11435         ;;
11436 esac
11437
11438 : Locate the flags for 'open()'
11439 echo " "
11440 $cat >try.c <<EOCP
11441 #include <sys/types.h>
11442 #ifdef I_FCNTL
11443 #include <fcntl.h>
11444 #endif
11445 #ifdef I_SYS_FILE
11446 #include <sys/file.h>
11447 #endif
11448 #$i_stdlib I_STDLIB
11449 #ifdef I_STDLIB
11450 #include <stdlib.h>
11451 #endif
11452 int main() {
11453         if(O_RDONLY);
11454 #ifdef O_TRUNC
11455         exit(0);
11456 #else
11457         exit(1);
11458 #endif
11459 }
11460 EOCP
11461 : check sys/file.h first to get FREAD on Sun
11462 if $test `./findhdr sys/file.h` && \
11463                 set try -DI_SYS_FILE && eval $compile; then
11464         h_sysfile=true;
11465         echo "<sys/file.h> defines the O_* constants..." >&4
11466         if $run ./try; then
11467                 echo "and you have the 3 argument form of open()." >&4
11468                 val="$define"
11469         else
11470                 echo "but not the 3 argument form of open().  Oh, well." >&4
11471                 val="$undef"
11472         fi
11473 elif $test `./findhdr fcntl.h` && \
11474                 set try -DI_FCNTL && eval $compile; then
11475         h_fcntl=true;
11476         echo "<fcntl.h> defines the O_* constants..." >&4
11477         if $run ./try; then
11478                 echo "and you have the 3 argument form of open()." >&4
11479                 val="$define"
11480         else
11481                 echo "but not the 3 argument form of open().  Oh, well." >&4
11482                 val="$undef"
11483         fi
11484 else
11485         val="$undef"
11486         echo "I can't find the O_* constant definitions!  You got problems." >&4
11487 fi
11488 set d_open3
11489 eval $setvar
11490 $rm -f try try.*
11491
11492 : see which of string.h or strings.h is needed
11493 echo " "
11494 strings=`./findhdr string.h`
11495 if $test "$strings" && $test -r "$strings"; then
11496         echo "Using <string.h> instead of <strings.h>." >&4
11497         val="$define"
11498 else
11499         val="$undef"
11500         strings=`./findhdr strings.h`
11501         if $test "$strings" && $test -r "$strings"; then
11502                 echo "Using <strings.h> instead of <string.h>." >&4
11503         else
11504                 echo "No string header found -- You'll surely have problems." >&4
11505         fi
11506 fi
11507 set i_string
11508 eval $setvar
11509 case "$i_string" in
11510 "$undef") strings=`./findhdr strings.h`;;
11511 *)        strings=`./findhdr string.h`;;
11512 esac
11513
11514 : see if this is a sys/file.h system
11515 val=''
11516 set sys/file.h val
11517 eval $inhdr
11518
11519 : do we need to include sys/file.h ?
11520 case "$val" in
11521 "$define")
11522         echo " "
11523         if $h_sysfile; then
11524                 val="$define"
11525                 echo "We'll be including <sys/file.h>." >&4
11526         else
11527                 val="$undef"
11528                 echo "We won't be including <sys/file.h>." >&4
11529         fi
11530         ;;
11531 *)
11532         h_sysfile=false
11533         ;;
11534 esac
11535 set i_sysfile
11536 eval $setvar
11537
11538 : see if fcntl.h is there
11539 val=''
11540 set fcntl.h val
11541 eval $inhdr
11542
11543 : see if we can include fcntl.h
11544 case "$val" in
11545 "$define")
11546         echo " "
11547         if $h_fcntl; then
11548                 val="$define"
11549                 echo "We'll be including <fcntl.h>." >&4
11550         else
11551                 val="$undef"
11552                 if $h_sysfile; then
11553         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11554                 else
11555                         echo "We won't be including <fcntl.h>." >&4
11556                 fi
11557         fi
11558         ;;
11559 *)
11560         h_fcntl=false
11561         val="$undef"
11562         ;;
11563 esac
11564 set i_fcntl
11565 eval $setvar
11566
11567 : check for non-blocking I/O stuff
11568 case "$h_sysfile" in
11569 true) echo "#include <sys/file.h>" > head.c;;
11570 *)
11571        case "$h_fcntl" in
11572        true) echo "#include <fcntl.h>" > head.c;;
11573        *) echo "#include <sys/fcntl.h>" > head.c;;
11574        esac
11575        ;;
11576 esac
11577 echo " "
11578 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11579 case "$o_nonblock" in
11580 '')
11581         $cat head.c > try.c
11582         $cat >>try.c <<EOCP
11583 #include <stdio.h>
11584 #$i_stdlib I_STDLIB
11585 #ifdef I_STDLIB
11586 #include <stdlib.h>
11587 #endif
11588 #$i_fcntl I_FCNTL
11589 #ifdef I_FCNTL
11590 #include <fcntl.h>
11591 #endif
11592 int main() {
11593 #ifdef O_NONBLOCK
11594         printf("O_NONBLOCK\n");
11595         exit(0);
11596 #endif
11597 #ifdef O_NDELAY
11598         printf("O_NDELAY\n");
11599         exit(0);
11600 #endif
11601 #ifdef FNDELAY
11602         printf("FNDELAY\n");
11603         exit(0);
11604 #endif
11605         exit(0);
11606 }
11607 EOCP
11608         set try
11609         if eval $compile_ok; then
11610                 o_nonblock=`$run ./try`
11611                 case "$o_nonblock" in
11612                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11613                 *) echo "Seems like we can use $o_nonblock.";;
11614                 esac
11615         else
11616                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11617         fi
11618         ;;
11619 *) echo "Using $hint value $o_nonblock.";;
11620 esac
11621 $rm -f try try.* .out core
11622
11623 echo " "
11624 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11625 case "$eagain" in
11626 '')
11627         $cat head.c > try.c
11628         $cat >>try.c <<EOCP
11629 #include <errno.h>
11630 #include <sys/types.h>
11631 #include <signal.h>
11632 #include <stdio.h> 
11633 #$i_stdlib I_STDLIB
11634 #ifdef I_STDLIB
11635 #include <stdlib.h>
11636 #endif
11637 #$i_fcntl I_FCNTL
11638 #ifdef I_FCNTL
11639 #include <fcntl.h>
11640 #endif
11641 #define MY_O_NONBLOCK $o_nonblock
11642 #ifndef errno  /* XXX need better Configure test */
11643 extern int errno;
11644 #endif
11645 #$i_unistd I_UNISTD
11646 #ifdef I_UNISTD
11647 #include <unistd.h>
11648 #endif
11649 #$i_string I_STRING
11650 #ifdef I_STRING
11651 #include <string.h>
11652 #else
11653 #include <strings.h>
11654 #endif
11655 $signal_t blech(x) int x; { exit(3); }
11656 EOCP
11657         $cat >> try.c <<'EOCP'
11658 int main()
11659 {
11660         int pd[2];
11661         int pu[2];
11662         char buf[1];
11663         char string[100];
11664
11665         pipe(pd);       /* Down: child -> parent */
11666         pipe(pu);       /* Up: parent -> child */
11667         if (0 != fork()) {
11668                 int ret;
11669                 close(pd[1]);   /* Parent reads from pd[0] */
11670                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11671 #ifdef F_SETFL
11672                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11673                         exit(1);
11674 #else
11675                 exit(4);
11676 #endif
11677                 signal(SIGALRM, blech);
11678                 alarm(5);
11679                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11680                         exit(2);
11681                 sprintf(string, "%d\n", ret);
11682                 write(2, string, strlen(string));
11683                 alarm(0);
11684 #ifdef EAGAIN
11685                 if (errno == EAGAIN) {
11686                         printf("EAGAIN\n");
11687                         goto ok;
11688                 }
11689 #endif
11690 #ifdef EWOULDBLOCK
11691                 if (errno == EWOULDBLOCK)
11692                         printf("EWOULDBLOCK\n");
11693 #endif
11694         ok:
11695                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11696                 sleep(2);                               /* Give it time to close our pipe */
11697                 alarm(5);
11698                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11699                 alarm(0);
11700                 sprintf(string, "%d\n", ret);
11701                 write(4, string, strlen(string));
11702                 exit(0);
11703         }
11704
11705         close(pd[0]);                   /* We write to pd[1] */
11706         close(pu[1]);                   /* We read from pu[0] */
11707         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11708         close(pd[1]);                   /* Pipe pd is now fully closed! */
11709         exit(0);                                /* Bye bye, thank you for playing! */
11710 }
11711 EOCP
11712         set try
11713         if eval $compile_ok; then
11714                 echo "$startsh" >mtry
11715                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11716                 chmod +x mtry
11717                 ./mtry >/dev/null 2>&1
11718                 case $? in
11719                 0) eagain=`$cat try.out`;;
11720                 1) echo "Could not perform non-blocking setting!";;
11721                 2) echo "I did a successful read() for something that was not there!";;
11722                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11723                 4) echo "Could not find F_SETFL!";;
11724                 *) echo "Something terribly wrong happened during testing.";;
11725                 esac
11726                 rd_nodata=`$cat try.ret`
11727                 echo "A read() system call with no data present returns $rd_nodata."
11728                 case "$rd_nodata" in
11729                 0|-1) ;;
11730                 *)
11731                         echo "(That's peculiar, fixing that to be -1.)"
11732                         rd_nodata=-1
11733                         ;;
11734                 esac
11735                 case "$eagain" in
11736                 '')
11737                         echo "Forcing errno EAGAIN on read() with no data available."
11738                         eagain=EAGAIN
11739                         ;;
11740                 *)
11741                         echo "Your read() sets errno to $eagain when no data is available."
11742                         ;;
11743                 esac
11744                 status=`$cat try.err`
11745                 case "$status" in
11746                 0) echo "And it correctly returns 0 to signal EOF.";;
11747                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11748                 *) echo "However, your read() returns '$status' on EOF??";;
11749                 esac
11750                 val="$define"
11751                 if test "$status" = "$rd_nodata"; then
11752                         echo "WARNING: you can't distinguish between EOF and no data!"
11753                         val="$undef"
11754                 fi
11755         else
11756                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11757                 eagain=EAGAIN
11758         fi
11759         set d_eofnblk
11760         eval $setvar
11761         ;;
11762 *)
11763         echo "Using $hint value $eagain."
11764         echo "Your read() returns $rd_nodata when no data is present."
11765         case "$d_eofnblk" in
11766         "$define") echo "And you can see EOF because read() returns 0.";;
11767         "$undef") echo "But you can't see EOF status from read() returned value.";;
11768         *)
11769                 echo "(Assuming you can't see EOF status from read anyway.)"
11770                 d_eofnblk=$undef
11771                 ;;
11772         esac
11773         ;;
11774 esac
11775 $rm -f try try.* .out core head.c mtry
11776
11777 : see if _ptr and _cnt from stdio act std
11778 echo " "
11779
11780 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11781         echo "(Looks like you have stdio.h from BSD.)"
11782         case "$stdio_ptr" in
11783         '') stdio_ptr='((fp)->_p)'
11784                 ptr_lval=$define
11785                 ;;
11786         *)      ptr_lval=$d_stdio_ptr_lval;;
11787         esac
11788         case "$stdio_cnt" in
11789         '') stdio_cnt='((fp)->_r)'
11790                 cnt_lval=$define
11791                 ;;
11792         *)      cnt_lval=$d_stdio_cnt_lval;;
11793         esac
11794         case "$stdio_base" in
11795         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11796         esac
11797         case "$stdio_bufsiz" in
11798         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11799         esac
11800 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11801         echo "(Looks like you have stdio.h from Linux.)"
11802         case "$stdio_ptr" in
11803         '') stdio_ptr='((fp)->_IO_read_ptr)'
11804                 ptr_lval=$define
11805                 ;;
11806         *)      ptr_lval=$d_stdio_ptr_lval;;
11807         esac
11808         case "$stdio_cnt" in
11809         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11810                 cnt_lval=$undef
11811                 ;;
11812         *)      cnt_lval=$d_stdio_cnt_lval;;
11813         esac
11814         case "$stdio_base" in
11815         '') stdio_base='((fp)->_IO_read_base)';;
11816         esac
11817         case "$stdio_bufsiz" in
11818         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11819         esac
11820 else
11821         case "$stdio_ptr" in
11822         '') stdio_ptr='((fp)->_ptr)'
11823                 ptr_lval=$define
11824                 ;;
11825         *)      ptr_lval=$d_stdio_ptr_lval;;
11826         esac
11827         case "$stdio_cnt" in
11828         '') stdio_cnt='((fp)->_cnt)'
11829                 cnt_lval=$define
11830                 ;;
11831         *)      cnt_lval=$d_stdio_cnt_lval;;
11832         esac
11833         case "$stdio_base" in
11834         '') stdio_base='((fp)->_base)';;
11835         esac
11836         case "$stdio_bufsiz" in
11837         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11838         esac
11839 fi
11840
11841 : test whether _ptr and _cnt really work
11842 echo "Checking how std your stdio is..." >&4
11843 $cat >try.c <<EOP
11844 #include <stdio.h>
11845 #$i_stdlib I_STDLIB
11846 #ifdef I_STDLIB
11847 #include <stdlib.h>
11848 #endif
11849 #define FILE_ptr(fp)    $stdio_ptr
11850 #define FILE_cnt(fp)    $stdio_cnt
11851 int main() {
11852         FILE *fp = fopen("try.c", "r");
11853         char c = getc(fp);
11854         if (
11855                 18 <= FILE_cnt(fp) &&
11856                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11857         )
11858                 exit(0);
11859         exit(1);
11860 }
11861 EOP
11862 val="$undef"
11863 set try
11864 if eval $compile && $to try.c; then
11865         if $run ./try; then
11866                 echo "Your stdio acts pretty std."
11867                 val="$define"
11868         else
11869                 echo "Your stdio isn't very std."
11870         fi
11871 else
11872         echo "Your stdio doesn't appear very std."
11873 fi
11874 $rm -f try.c try
11875
11876 # glibc 2.2.90 and above apparently change stdio streams so Perl's
11877 # direct buffer manipulation no longer works.  The Configure tests
11878 # should be changed to correctly detect this, but until then,
11879 # the following check should at least let perl compile and run.
11880 # (This quick fix should be updated before 5.8.1.)
11881 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
11882 # A. Dougherty, June 3, 2002.
11883 case "$d_gnulibc" in
11884 $define)
11885         case "$gnulibc_version" in
11886         2.[01]*)  ;;
11887         2.2) ;;
11888         2.2.[0-9]) ;;
11889         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
11890                 val="$undef"
11891                 ;;
11892         esac
11893         ;;
11894 esac
11895 set d_stdstdio
11896 eval $setvar
11897
11898 : Can _ptr be used as an lvalue?
11899 case "$d_stdstdio$ptr_lval" in
11900 $define$define) val=$define ;;
11901 *) val=$undef ;;
11902 esac
11903 set d_stdio_ptr_lval
11904 eval $setvar
11905
11906 : Can _cnt be used as an lvalue?
11907 case "$d_stdstdio$cnt_lval" in
11908 $define$define) val=$define ;;
11909 *) val=$undef ;;
11910 esac
11911 set d_stdio_cnt_lval
11912 eval $setvar
11913
11914
11915 : test whether setting _ptr sets _cnt as a side effect
11916 d_stdio_ptr_lval_sets_cnt="$undef"
11917 d_stdio_ptr_lval_nochange_cnt="$undef"
11918 case "$d_stdio_ptr_lval$d_stdstdio" in
11919 $define$define)
11920         echo "Checking to see what happens if we set the stdio ptr..." >&4
11921 $cat >try.c <<EOP
11922 #include <stdio.h>
11923 /* Can we scream? */
11924 /* Eat dust sed :-) */
11925 /* In the buffer space, no one can hear you scream. */
11926 #$i_stdlib I_STDLIB
11927 #ifdef I_STDLIB
11928 #include <stdlib.h>
11929 #endif
11930 #define FILE_ptr(fp)    $stdio_ptr
11931 #define FILE_cnt(fp)    $stdio_cnt
11932 #include <sys/types.h>
11933 int main() {
11934         FILE *fp = fopen("try.c", "r");
11935         int c;
11936         char *ptr;
11937         size_t cnt;
11938         if (!fp) {
11939             puts("Fail even to read");
11940             exit(1);
11941         }
11942         c = getc(fp); /* Read away the first # */
11943         if (c == EOF) {
11944             puts("Fail even to read");
11945             exit(1);
11946         }
11947         if (!(
11948                 18 <= FILE_cnt(fp) &&
11949                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11950         )) {
11951                 puts("Fail even to read");
11952                 exit (1);
11953         }
11954         ptr = (char*) FILE_ptr(fp);
11955         cnt = (size_t)FILE_cnt(fp);
11956
11957         FILE_ptr(fp) += 42;
11958
11959         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11960                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11961                 exit (1);
11962         }
11963         if (FILE_cnt(fp) <= 20) {
11964                 printf ("Fail (<20 chars to test)");
11965                 exit (1);
11966         }
11967         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11968                 puts("Fail compare");
11969                 exit (1);
11970         }
11971         if (cnt == FILE_cnt(fp)) {
11972                 puts("Pass_unchanged");
11973                 exit (0);
11974         }       
11975         if (FILE_cnt(fp) == (cnt - 42)) {
11976                 puts("Pass_changed");
11977                 exit (0);
11978         }
11979         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11980         return 1;
11981
11982 }
11983 EOP
11984         set try
11985         if eval $compile && $to try.c; then
11986                 case `$run ./try` in
11987                 Pass_changed)
11988                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11989                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11990                 Pass_unchanged)
11991                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11992                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11993                 Fail*)
11994                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11995                 *)
11996                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11997         esac
11998         else
11999                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12000         fi
12001         $rm -f try.c try
12002         ;;
12003 esac
12004
12005 : see if _base is also standard
12006 val="$undef"
12007 case "$d_stdstdio" in
12008 $define)
12009         $cat >try.c <<EOP
12010 #include <stdio.h>
12011 #$i_stdlib I_STDLIB
12012 #ifdef I_STDLIB
12013 #include <stdlib.h>
12014 #endif
12015 #define FILE_base(fp)   $stdio_base
12016 #define FILE_bufsiz(fp) $stdio_bufsiz
12017 int main() {
12018         FILE *fp = fopen("try.c", "r");
12019         char c = getc(fp);
12020         if (
12021                 19 <= FILE_bufsiz(fp) &&
12022                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12023         )
12024                 exit(0);
12025         exit(1);
12026 }
12027 EOP
12028         set try
12029         if eval $compile && $to try.c; then
12030                 if $run ./try; then
12031                         echo "And its _base field acts std."
12032                         val="$define"
12033                 else
12034                         echo "But its _base field isn't std."
12035                 fi
12036         else
12037                 echo "However, it seems to be lacking the _base field."
12038         fi
12039         $rm -f try.c try
12040         ;;
12041 esac
12042 set d_stdiobase
12043 eval $setvar
12044
12045 : see if fast_stdio exists
12046 val="$undef"
12047 case "$d_stdstdio:$d_stdio_ptr_lval" in
12048 "$define:$define")
12049         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12050         *$define*)
12051                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12052                 val="$define"
12053                 ;;
12054         esac
12055         ;;
12056 esac
12057 set d_faststdio
12058 eval $setvar
12059
12060
12061
12062 : see if fchdir exists
12063 set fchdir d_fchdir
12064 eval $inlibc
12065
12066 : see if fchmod exists
12067 set fchmod d_fchmod
12068 eval $inlibc
12069
12070 : see if fchown exists
12071 set fchown d_fchown
12072 eval $inlibc
12073
12074 : see if this is an fcntl system
12075 set fcntl d_fcntl
12076 eval $inlibc
12077
12078 echo " "
12079 : See if fcntl-based locking works.
12080 $cat >try.c <<EOCP
12081 #$i_stdlib I_STDLIB
12082 #ifdef I_STDLIB
12083 #include <stdlib.h>
12084 #endif
12085 #include <unistd.h>
12086 #include <fcntl.h>
12087 #include <signal.h>
12088 $signal_t blech(x) int x; { exit(3); }
12089 int main() {
12090 #if defined(F_SETLK) && defined(F_SETLKW)
12091      struct flock flock;
12092      int retval, fd;
12093      fd = open("try.c", O_RDONLY);
12094      flock.l_type = F_RDLCK;
12095      flock.l_whence = SEEK_SET;
12096      flock.l_start = flock.l_len = 0;
12097      signal(SIGALRM, blech);
12098      alarm(10);
12099      retval = fcntl(fd, F_SETLK, &flock);
12100      close(fd);
12101      (retval < 0 ? exit(2) : exit(0));
12102 #else
12103      exit(2);
12104 #endif
12105 }
12106 EOCP
12107 echo "Checking if fcntl-based file locking works... "
12108 case "$d_fcntl" in
12109 "$define")
12110         set try
12111         if eval $compile_ok; then
12112                 if $run ./try; then
12113                         echo "Yes, it seems to work."
12114                         val="$define"
12115                 else
12116                         echo "Nope, it didn't work."
12117                         val="$undef"
12118                         case "$?" in
12119                         3) $cat >&4 <<EOM
12120 ***
12121 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12122 *** This is (almost) impossible.
12123 *** If your NFS lock daemons are not feeling well, something like
12124 *** this may happen, please investigate.  Cannot continue, aborting.
12125 ***
12126 EOM
12127                                 exit 1
12128                                 ;;
12129                         esac
12130                 fi
12131         else
12132                 echo "I'm unable to compile the test program, so I'll assume not."
12133                 val="$undef"
12134         fi
12135         ;;
12136 *) val="$undef";
12137         echo "Nope, since you don't even have fcntl()."
12138         ;;
12139 esac
12140 set d_fcntl_can_lock
12141 eval $setvar
12142 $rm -f try*
12143
12144
12145 : check for fd_set items
12146 $cat <<EOM
12147
12148 Checking to see how well your C compiler handles fd_set and friends ...
12149 EOM
12150 $cat >try.c <<EOCP
12151 #$i_stdlib I_STDLIB
12152 #ifdef I_STDLIB
12153 #include <stdlib.h>
12154 #endif
12155 #$i_systime I_SYS_TIME
12156 #$i_sysselct I_SYS_SELECT
12157 #$d_socket HAS_SOCKET
12158 #include <sys/types.h>
12159 #ifdef HAS_SOCKET
12160 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12161 #endif
12162 #ifdef I_SYS_TIME
12163 #include <sys/time.h>
12164 #endif
12165 #ifdef I_SYS_SELECT
12166 #include <sys/select.h>
12167 #endif
12168 int main() {
12169         fd_set fds;
12170
12171 #ifdef TRYBITS
12172         if(fds.fds_bits);
12173 #endif
12174
12175 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12176         exit(0);
12177 #else
12178         exit(1);
12179 #endif
12180 }
12181 EOCP
12182 set try -DTRYBITS
12183 if eval $compile; then
12184         d_fds_bits="$define"
12185         d_fd_set="$define"
12186         echo "Well, your system knows about the normal fd_set typedef..." >&4
12187         if $run ./try; then
12188                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12189                 d_fd_macros="$define"
12190         else
12191                 $cat >&4 <<'EOM'
12192 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12193 EOM
12194                 d_fd_macros="$undef"
12195         fi
12196 else
12197         $cat <<'EOM'
12198 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12199 EOM
12200         set try
12201         if eval $compile; then
12202                 d_fds_bits="$undef"
12203                 d_fd_set="$define"
12204                 echo "Well, your system has some sort of fd_set available..." >&4
12205                 if $run ./try; then
12206                         echo "and you have the normal fd_set macros." >&4
12207                         d_fd_macros="$define"
12208                 else
12209                         $cat <<'EOM'
12210 but not the normal fd_set macros!  Gross!  More work for me...
12211 EOM
12212                         d_fd_macros="$undef"
12213                 fi
12214         else
12215         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12216                 d_fd_set="$undef"
12217                 d_fds_bits="$undef"
12218                 d_fd_macros="$undef"
12219         fi
12220 fi
12221 $rm -f try try.*
12222
12223 : see if fgetpos exists
12224 set fgetpos d_fgetpos
12225 eval $inlibc
12226
12227 : see if finite exists
12228 set finite d_finite
12229 eval $inlibc
12230
12231 : see if finitel exists
12232 set finitel d_finitel
12233 eval $inlibc
12234
12235 : see if flock exists
12236 set flock d_flock
12237 eval $inlibc
12238
12239 : see if prototype for flock is available
12240 echo " "
12241 set d_flockproto flock $i_sysfile sys/file.h
12242 eval $hasproto
12243
12244 : see if fork exists
12245 set fork d_fork
12246 eval $inlibc
12247
12248 : see if fp_class exists
12249 set fp_class d_fp_class
12250 eval $inlibc
12251
12252 : see if pathconf exists
12253 set pathconf d_pathconf
12254 eval $inlibc
12255
12256 : see if fpathconf exists
12257 set fpathconf d_fpathconf
12258 eval $inlibc
12259
12260 : see if fpclass exists
12261 set fpclass d_fpclass
12262 eval $inlibc
12263
12264 : see if fpclassify exists
12265 set fpclassify d_fpclassify
12266 eval $inlibc
12267
12268 : see if fpclassl exists
12269 set fpclassl d_fpclassl
12270 eval $inlibc
12271
12272
12273 : check for fpos64_t
12274 echo " "
12275 echo "Checking to see if you have fpos64_t..." >&4
12276 $cat >try.c <<EOCP
12277 #include <stdio.h>
12278 int main() { fpos64_t x = 7; }
12279 EOCP
12280 set try
12281 if eval $compile; then
12282         val="$define"
12283         echo "You have fpos64_t."
12284 else
12285         val="$undef"
12286         echo "You do not have fpos64_t."
12287         case "$fpossize" in
12288         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12289         esac
12290 fi
12291 $rm -f try.* try
12292 set d_fpos64_t
12293 eval $setvar
12294
12295 : see if frexpl exists
12296 set frexpl d_frexpl
12297 eval $inlibc
12298
12299 : see if this is a sys/param system
12300 set sys/param.h i_sysparam
12301 eval $inhdr
12302
12303 : see if this is a sys/mount.h system
12304 set sys/mount.h i_sysmount
12305 eval $inhdr
12306
12307
12308 echo " "
12309 echo "Checking to see if your system supports struct fs_data..." >&4
12310 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12311 eval $hasstruct
12312 case "$d_fs_data_s" in
12313 "$define")      echo "Yes, it does."   ;;
12314 *)              echo "No, it doesn't." ;;
12315 esac
12316
12317 : see if fseeko exists
12318 set fseeko d_fseeko
12319 eval $inlibc
12320 case "$longsize" in
12321 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12322 esac
12323
12324 : see if fsetpos exists
12325 set fsetpos d_fsetpos
12326 eval $inlibc
12327
12328
12329 : see if fstatfs exists
12330 set fstatfs d_fstatfs
12331 eval $inlibc
12332
12333
12334 : see if statvfs exists
12335 set statvfs d_statvfs
12336 eval $inlibc
12337
12338 : see if fstatvfs exists
12339 set fstatvfs d_fstatvfs
12340 eval $inlibc
12341
12342
12343 : see if fsync exists
12344 set fsync d_fsync
12345 eval $inlibc
12346
12347 : see if ftello exists
12348 set ftello d_ftello
12349 eval $inlibc
12350 case "$longsize" in
12351 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12352 esac
12353
12354 : see if getcwd exists
12355 set getcwd d_getcwd
12356 eval $inlibc
12357
12358 : see if getespwnam exists
12359 set getespwnam d_getespwnam
12360 eval $inlibc
12361
12362
12363 : see if getfsstat exists
12364 set getfsstat d_getfsstat
12365 eval $inlibc
12366
12367 : see if getgrent exists
12368 set getgrent d_getgrent
12369 eval $inlibc
12370
12371 : see if getgrent_r exists
12372 set getgrent_r d_getgrent_r
12373 eval $inlibc
12374 case "$d_getgrent_r" in
12375 "$define")
12376         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12377         case "$d_getgrent_r_proto:$usethreads" in
12378         ":define")      d_getgrent_r_proto=define
12379                 set d_getgrent_r_proto getgrent_r $hdrs
12380                 eval $hasproto ;;
12381         *)      ;;
12382         esac
12383         case "$d_getgrent_r_proto" in
12384         define)
12385         case "$getgrent_r_proto" in
12386         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12387         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12388         esac
12389         case "$getgrent_r_proto" in
12390         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12391         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12392         esac
12393         case "$getgrent_r_proto" in
12394         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12395         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12396         esac
12397         case "$getgrent_r_proto" in
12398         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12399         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12400         esac
12401         case "$getgrent_r_proto" in
12402         ''|0) try='int getgrent_r(struct group*, char*, int);'
12403         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12404         esac
12405         case "$getgrent_r_proto" in
12406         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12407         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12408         esac
12409         case "$getgrent_r_proto" in
12410         ''|0)   d_getgrent_r=undef
12411                 getgrent_r_proto=0
12412                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12413         * )     case "$getgrent_r_proto" in
12414                 REENTRANT_PROTO*) ;;
12415                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12416                 esac
12417                 echo "Prototype: $try" ;;
12418         esac
12419         ;;
12420         *)      case "$usethreads" in
12421                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12422                 esac
12423                 d_getgrent_r=undef
12424                 getgrent_r_proto=0
12425                 ;;
12426         esac
12427         ;;
12428 *)      getgrent_r_proto=0
12429         ;;
12430 esac
12431
12432 : see if getgrgid_r exists
12433 set getgrgid_r d_getgrgid_r
12434 eval $inlibc
12435 case "$d_getgrgid_r" in
12436 "$define")
12437         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12438         case "$d_getgrgid_r_proto:$usethreads" in
12439         ":define")      d_getgrgid_r_proto=define
12440                 set d_getgrgid_r_proto getgrgid_r $hdrs
12441                 eval $hasproto ;;
12442         *)      ;;
12443         esac
12444         case "$d_getgrgid_r_proto" in
12445         define)
12446         case "$getgrgid_r_proto" in
12447         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12448         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12449         esac
12450         case "$getgrgid_r_proto" in
12451         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12452         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12453         esac
12454         case "$getgrgid_r_proto" in
12455         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12456         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12457         esac
12458         case "$getgrgid_r_proto" in
12459         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12460         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12461         esac
12462         case "$getgrgid_r_proto" in
12463         ''|0)   d_getgrgid_r=undef
12464                 getgrgid_r_proto=0
12465                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12466         * )     case "$getgrgid_r_proto" in
12467                 REENTRANT_PROTO*) ;;
12468                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12469                 esac
12470                 echo "Prototype: $try" ;;
12471         esac
12472         ;;
12473         *)      case "$usethreads" in
12474                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12475                 esac
12476                 d_getgrgid_r=undef
12477                 getgrgid_r_proto=0
12478                 ;;
12479         esac
12480         ;;
12481 *)      getgrgid_r_proto=0
12482         ;;
12483 esac
12484
12485 : see if getgrnam_r exists
12486 set getgrnam_r d_getgrnam_r
12487 eval $inlibc
12488 case "$d_getgrnam_r" in
12489 "$define")
12490         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12491         case "$d_getgrnam_r_proto:$usethreads" in
12492         ":define")      d_getgrnam_r_proto=define
12493                 set d_getgrnam_r_proto getgrnam_r $hdrs
12494                 eval $hasproto ;;
12495         *)      ;;
12496         esac
12497         case "$d_getgrnam_r_proto" in
12498         define)
12499         case "$getgrnam_r_proto" in
12500         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12501         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12502         esac
12503         case "$getgrnam_r_proto" in
12504         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12505         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12506         esac
12507         case "$getgrnam_r_proto" in
12508         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12509         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12510         esac
12511         case "$getgrnam_r_proto" in
12512         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12513         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12514         esac
12515         case "$getgrnam_r_proto" in
12516         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12517         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12518         esac
12519         case "$getgrnam_r_proto" in
12520         ''|0)   d_getgrnam_r=undef
12521                 getgrnam_r_proto=0
12522                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12523         * )     case "$getgrnam_r_proto" in
12524                 REENTRANT_PROTO*) ;;
12525                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12526                 esac
12527                 echo "Prototype: $try" ;;
12528         esac
12529         ;;
12530         *)      case "$usethreads" in
12531                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12532                 esac
12533                 d_getgrnam_r=undef
12534                 getgrnam_r_proto=0
12535                 ;;
12536         esac
12537         ;;
12538 *)      getgrnam_r_proto=0
12539         ;;
12540 esac
12541
12542 : see if gethostbyaddr exists
12543 set gethostbyaddr d_gethbyaddr
12544 eval $inlibc
12545
12546 : see if gethostbyname exists
12547 set gethostbyname d_gethbyname
12548 eval $inlibc
12549
12550 : see if gethostent exists
12551 set gethostent d_gethent
12552 eval $inlibc
12553
12554 : see how we will look up host name
12555 echo " "
12556 call=''
12557 if set gethostname val -f d_gethname; eval $csym; $val; then
12558         echo 'gethostname() found.' >&4
12559         d_gethname="$define"
12560         call=gethostname
12561 fi
12562 if set uname val -f d_uname; eval $csym; $val; then
12563         if ./xenix; then
12564                 $cat <<'EOM'
12565 uname() was found, but you're running xenix, and older versions of xenix
12566 have a broken uname(). If you don't really know whether your xenix is old
12567 enough to have a broken system call, use the default answer.
12568
12569 EOM
12570                 dflt=y
12571                 case "$d_uname" in
12572                 "$define") dflt=n;;
12573                 esac
12574                 rp='Is your uname() broken?'
12575                 . ./myread
12576                 case "$ans" in
12577                 n*) d_uname="$define"; call=uname;;
12578                 esac
12579         else
12580                 echo 'uname() found.' >&4
12581                 d_uname="$define"
12582                 case "$call" in
12583                 '') call=uname ;;
12584                 esac
12585         fi
12586 fi
12587 case "$d_gethname" in
12588 '') d_gethname="$undef";;
12589 esac
12590 case "$d_uname" in
12591 '') d_uname="$undef";;
12592 esac
12593 case "$d_uname$d_gethname" in
12594 *define*)
12595         dflt=n
12596         cat <<EOM
12597  
12598 Every now and then someone has a $call() that lies about the hostname
12599 but can't be fixed for political or economic reasons.  If you wish, I can
12600 pretend $call() isn't there and maybe compute hostname at run-time
12601 thanks to the '$phostname' command.
12602
12603 EOM
12604         rp="Shall I ignore $call() from now on?"
12605         . ./myread
12606         case "$ans" in
12607         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12608         esac;;
12609 esac
12610 case "$phostname" in
12611 '') aphostname='';;
12612 *) case "$aphostname" in
12613         /*) ;;
12614         *) set X $phostname
12615                 shift
12616                 file=$1
12617                 shift
12618                 file=`./loc $file $file $pth`
12619                 aphostname=`echo $file $*`
12620                 ;;
12621         esac
12622         ;;
12623 esac
12624 case "$d_uname$d_gethname" in
12625 *define*) ;;
12626 *)
12627         case "$phostname" in
12628         '')
12629                 echo "There will be no way for $package to get your hostname." >&4;;
12630         *)
12631         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12632                 ;;
12633         esac;;
12634 esac
12635 case "$d_phostname" in
12636 '') d_phostname="$undef";;
12637 esac
12638
12639 : see if gethostbyaddr_r exists
12640 set gethostbyaddr_r d_gethostbyaddr_r
12641 eval $inlibc
12642 case "$d_gethostbyaddr_r" in
12643 "$define")
12644         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12645         case "$d_gethostbyaddr_r_proto:$usethreads" in
12646         ":define")      d_gethostbyaddr_r_proto=define
12647                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12648                 eval $hasproto ;;
12649         *)      ;;
12650         esac
12651         case "$d_gethostbyaddr_r_proto" in
12652         define)
12653         case "$gethostbyaddr_r_proto" in
12654         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12655         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12656         esac
12657         case "$gethostbyaddr_r_proto" in
12658         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12659         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12660         esac
12661         case "$gethostbyaddr_r_proto" in
12662         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12663         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12664         esac
12665         case "$gethostbyaddr_r_proto" in
12666         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12667         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12668         esac
12669         case "$gethostbyaddr_r_proto" in
12670         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12671         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12672         esac
12673         case "$gethostbyaddr_r_proto" in
12674         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12675         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12676         esac
12677         case "$gethostbyaddr_r_proto" in
12678         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12679         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12680         esac
12681         case "$gethostbyaddr_r_proto" in
12682         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12683         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12684         esac
12685         case "$gethostbyaddr_r_proto" in
12686         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12687         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12688         esac
12689         case "$gethostbyaddr_r_proto" in
12690         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12691         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12692         esac
12693         case "$gethostbyaddr_r_proto" in
12694         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12695         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12696         esac
12697         case "$gethostbyaddr_r_proto" in
12698         ''|0)   d_gethostbyaddr_r=undef
12699                 gethostbyaddr_r_proto=0
12700                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12701         * )     case "$gethostbyaddr_r_proto" in
12702                 REENTRANT_PROTO*) ;;
12703                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12704                 esac
12705                 echo "Prototype: $try" ;;
12706         esac
12707         ;;
12708         *)      case "$usethreads" in
12709                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12710                 esac
12711                 d_gethostbyaddr_r=undef
12712                 gethostbyaddr_r_proto=0
12713                 ;;
12714         esac
12715         ;;
12716 *)      gethostbyaddr_r_proto=0
12717         ;;
12718 esac
12719
12720 : see if gethostbyname_r exists
12721 set gethostbyname_r d_gethostbyname_r
12722 eval $inlibc
12723 case "$d_gethostbyname_r" in
12724 "$define")
12725         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12726         case "$d_gethostbyname_r_proto:$usethreads" in
12727         ":define")      d_gethostbyname_r_proto=define
12728                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12729                 eval $hasproto ;;
12730         *)      ;;
12731         esac
12732         case "$d_gethostbyname_r_proto" in
12733         define)
12734         case "$gethostbyname_r_proto" in
12735         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12736         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12737         esac
12738         case "$gethostbyname_r_proto" in
12739         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12740         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12741         esac
12742         case "$gethostbyname_r_proto" in
12743         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12744         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12745         esac
12746         case "$gethostbyname_r_proto" in
12747         ''|0)   d_gethostbyname_r=undef
12748                 gethostbyname_r_proto=0
12749                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12750         * )     case "$gethostbyname_r_proto" in
12751                 REENTRANT_PROTO*) ;;
12752                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12753                 esac
12754                 echo "Prototype: $try" ;;
12755         esac
12756         ;;
12757         *)      case "$usethreads" in
12758                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12759                 esac
12760                 d_gethostbyname_r=undef
12761                 gethostbyname_r_proto=0
12762                 ;;
12763         esac
12764         ;;
12765 *)      gethostbyname_r_proto=0
12766         ;;
12767 esac
12768
12769 : see if gethostent_r exists
12770 set gethostent_r d_gethostent_r
12771 eval $inlibc
12772 case "$d_gethostent_r" in
12773 "$define")
12774         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12775         case "$d_gethostent_r_proto:$usethreads" in
12776         ":define")      d_gethostent_r_proto=define
12777                 set d_gethostent_r_proto gethostent_r $hdrs
12778                 eval $hasproto ;;
12779         *)      ;;
12780         esac
12781         case "$d_gethostent_r_proto" in
12782         define)
12783         case "$gethostent_r_proto" in
12784         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12785         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12786         esac
12787         case "$gethostent_r_proto" in
12788         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12789         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12790         esac
12791         case "$gethostent_r_proto" in
12792         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12793         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12794         esac
12795         case "$gethostent_r_proto" in
12796         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12797         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12798         esac
12799         case "$gethostent_r_proto" in
12800         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12801         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12802         esac
12803         case "$gethostent_r_proto" in
12804         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12805         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12806         esac
12807         case "$gethostent_r_proto" in
12808         ''|0)   d_gethostent_r=undef
12809                 gethostent_r_proto=0
12810                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12811         * )     case "$gethostent_r_proto" in
12812                 REENTRANT_PROTO*) ;;
12813                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12814                 esac
12815                 echo "Prototype: $try" ;;
12816         esac
12817         ;;
12818         *)      case "$usethreads" in
12819                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12820                 esac
12821                 d_gethostent_r=undef
12822                 gethostent_r_proto=0
12823                 ;;
12824         esac
12825         ;;
12826 *)      gethostent_r_proto=0
12827         ;;
12828 esac
12829
12830 : see if prototypes for various gethostxxx netdb.h functions are available
12831 echo " "
12832 set d_gethostprotos gethostent $i_netdb netdb.h
12833 eval $hasproto
12834
12835 : see if getitimer exists
12836 set getitimer d_getitimer
12837 eval $inlibc
12838
12839 : see if getlogin exists
12840 set getlogin d_getlogin
12841 eval $inlibc
12842
12843 : see if getlogin_r exists
12844 set getlogin_r d_getlogin_r
12845 eval $inlibc
12846 case "$d_getlogin_r" in
12847 "$define")
12848         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12849         case "$d_getlogin_r_proto:$usethreads" in
12850         ":define")      d_getlogin_r_proto=define
12851                 set d_getlogin_r_proto getlogin_r $hdrs
12852                 eval $hasproto ;;
12853         *)      ;;
12854         esac
12855         case "$d_getlogin_r_proto" in
12856         define)
12857         case "$getlogin_r_proto" in
12858         ''|0) try='int getlogin_r(char*, size_t);'
12859         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12860         esac
12861         case "$getlogin_r_proto" in
12862         ''|0) try='int getlogin_r(char*, int);'
12863         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12864         esac
12865         case "$getlogin_r_proto" in
12866         ''|0) try='char* getlogin_r(char*, size_t);'
12867         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12868         esac
12869         case "$getlogin_r_proto" in
12870         ''|0) try='char* getlogin_r(char*, int);'
12871         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12872         esac
12873         case "$getlogin_r_proto" in
12874         ''|0)   d_getlogin_r=undef
12875                 getlogin_r_proto=0
12876                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12877         * )     case "$getlogin_r_proto" in
12878                 REENTRANT_PROTO*) ;;
12879                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12880                 esac
12881                 echo "Prototype: $try" ;;
12882         esac
12883         ;;
12884         *)      case "$usethreads" in
12885                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12886                 esac
12887                 d_getlogin_r=undef
12888                 getlogin_r_proto=0
12889                 ;;
12890         esac
12891         ;;
12892 *)      getlogin_r_proto=0
12893         ;;
12894 esac
12895
12896 : see if getmnt exists
12897 set getmnt d_getmnt
12898 eval $inlibc
12899
12900 : see if getmntent exists
12901 set getmntent d_getmntent
12902 eval $inlibc
12903
12904 : see if getnetbyaddr exists
12905 set getnetbyaddr d_getnbyaddr
12906 eval $inlibc
12907
12908 : see if getnetbyname exists
12909 set getnetbyname d_getnbyname
12910 eval $inlibc
12911
12912 : see if getnetent exists
12913 set getnetent d_getnent
12914 eval $inlibc
12915
12916 : see if getnetbyaddr_r exists
12917 set getnetbyaddr_r d_getnetbyaddr_r
12918 eval $inlibc
12919 case "$d_getnetbyaddr_r" in
12920 "$define")
12921         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12922         case "$d_getnetbyaddr_r_proto:$usethreads" in
12923         ":define")      d_getnetbyaddr_r_proto=define
12924                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12925                 eval $hasproto ;;
12926         *)      ;;
12927         esac
12928         case "$d_getnetbyaddr_r_proto" in
12929         define)
12930         case "$getnetbyaddr_r_proto" in
12931         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12932         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12933         esac
12934         case "$getnetbyaddr_r_proto" in
12935         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12936         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12937         esac
12938         case "$getnetbyaddr_r_proto" in
12939         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12940         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12941         esac
12942         case "$getnetbyaddr_r_proto" in
12943         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12944         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12945         esac
12946         case "$getnetbyaddr_r_proto" in
12947         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12948         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12949         esac
12950         case "$getnetbyaddr_r_proto" in
12951         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12952         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12953         esac
12954         case "$getnetbyaddr_r_proto" in
12955         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12956         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12957         esac
12958         case "$getnetbyaddr_r_proto" in
12959         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12960         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12961         esac
12962         case "$getnetbyaddr_r_proto" in
12963         ''|0)   d_getnetbyaddr_r=undef
12964                 getnetbyaddr_r_proto=0
12965                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12966         * )     case "$getnetbyaddr_r_proto" in
12967                 REENTRANT_PROTO*) ;;
12968                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12969                 esac
12970                 echo "Prototype: $try" ;;
12971         esac
12972         ;;
12973         *)      case "$usethreads" in
12974                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12975                 esac
12976                 d_getnetbyaddr_r=undef
12977                 getnetbyaddr_r_proto=0
12978                 ;;
12979         esac
12980         ;;
12981 *)      getnetbyaddr_r_proto=0
12982         ;;
12983 esac
12984
12985 : see if getnetbyname_r exists
12986 set getnetbyname_r d_getnetbyname_r
12987 eval $inlibc
12988 case "$d_getnetbyname_r" in
12989 "$define")
12990         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12991         case "$d_getnetbyname_r_proto:$usethreads" in
12992         ":define")      d_getnetbyname_r_proto=define
12993                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12994                 eval $hasproto ;;
12995         *)      ;;
12996         esac
12997         case "$d_getnetbyname_r_proto" in
12998         define)
12999         case "$getnetbyname_r_proto" in
13000         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13001         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13002         esac
13003         case "$getnetbyname_r_proto" in
13004         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13005         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13006         esac
13007         case "$getnetbyname_r_proto" in
13008         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13009         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13010         esac
13011         case "$getnetbyname_r_proto" in
13012         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13013         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13014         esac
13015         case "$getnetbyname_r_proto" in
13016         ''|0)   d_getnetbyname_r=undef
13017                 getnetbyname_r_proto=0
13018                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13019         * )     case "$getnetbyname_r_proto" in
13020                 REENTRANT_PROTO*) ;;
13021                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13022                 esac
13023                 echo "Prototype: $try" ;;
13024         esac
13025         ;;
13026         *)      case "$usethreads" in
13027                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13028                 esac
13029                 d_getnetbyname_r=undef
13030                 getnetbyname_r_proto=0
13031                 ;;
13032         esac
13033         ;;
13034 *)      getnetbyname_r_proto=0
13035         ;;
13036 esac
13037
13038 : see if getnetent_r exists
13039 set getnetent_r d_getnetent_r
13040 eval $inlibc
13041 case "$d_getnetent_r" in
13042 "$define")
13043         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13044         case "$d_getnetent_r_proto:$usethreads" in
13045         ":define")      d_getnetent_r_proto=define
13046                 set d_getnetent_r_proto getnetent_r $hdrs
13047                 eval $hasproto ;;
13048         *)      ;;
13049         esac
13050         case "$d_getnetent_r_proto" in
13051         define)
13052         case "$getnetent_r_proto" in
13053         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13054         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13055         esac
13056         case "$getnetent_r_proto" in
13057         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13058         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13059         esac
13060         case "$getnetent_r_proto" in
13061         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13062         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13063         esac
13064         case "$getnetent_r_proto" in
13065         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13066         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13067         esac
13068         case "$getnetent_r_proto" in
13069         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13070         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13071         esac
13072         case "$getnetent_r_proto" in
13073         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13074         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13075         esac
13076         case "$getnetent_r_proto" in
13077         ''|0)   d_getnetent_r=undef
13078                 getnetent_r_proto=0
13079                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13080         * )     case "$getnetent_r_proto" in
13081                 REENTRANT_PROTO*) ;;
13082                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13083                 esac
13084                 echo "Prototype: $try" ;;
13085         esac
13086         ;;
13087         *)      case "$usethreads" in
13088                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13089                 esac
13090                 d_getnetent_r=undef
13091                 getnetent_r_proto=0
13092                 ;;
13093         esac
13094         ;;
13095 *)      getnetent_r_proto=0
13096         ;;
13097 esac
13098
13099 : see if prototypes for various getnetxxx netdb.h functions are available
13100 echo " "
13101 set d_getnetprotos getnetent $i_netdb netdb.h
13102 eval $hasproto
13103
13104 : see if getpagesize exists
13105 set getpagesize d_getpagsz
13106 eval $inlibc
13107
13108
13109 : see if getprotobyname exists
13110 set getprotobyname d_getpbyname
13111 eval $inlibc
13112
13113 : see if getprotobynumber exists
13114 set getprotobynumber d_getpbynumber
13115 eval $inlibc
13116
13117 : see if getprotoent exists
13118 set getprotoent d_getpent
13119 eval $inlibc
13120
13121 : see if getpgid exists
13122 set getpgid d_getpgid
13123 eval $inlibc
13124
13125 : see if getpgrp2 exists
13126 set getpgrp2 d_getpgrp2
13127 eval $inlibc
13128
13129 : see if getppid exists
13130 set getppid d_getppid
13131 eval $inlibc
13132
13133 : see if getpriority exists
13134 set getpriority d_getprior
13135 eval $inlibc
13136
13137 : see if getprotobyname_r exists
13138 set getprotobyname_r d_getprotobyname_r
13139 eval $inlibc
13140 case "$d_getprotobyname_r" in
13141 "$define")
13142         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13143         case "$d_getprotobyname_r_proto:$usethreads" in
13144         ":define")      d_getprotobyname_r_proto=define
13145                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13146                 eval $hasproto ;;
13147         *)      ;;
13148         esac
13149         case "$d_getprotobyname_r_proto" in
13150         define)
13151         case "$getprotobyname_r_proto" in
13152         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13153         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13154         esac
13155         case "$getprotobyname_r_proto" in
13156         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13157         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13158         esac
13159         case "$getprotobyname_r_proto" in
13160         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13161         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13162         esac
13163         case "$getprotobyname_r_proto" in
13164         ''|0)   d_getprotobyname_r=undef
13165                 getprotobyname_r_proto=0
13166                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13167         * )     case "$getprotobyname_r_proto" in
13168                 REENTRANT_PROTO*) ;;
13169                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13170                 esac
13171                 echo "Prototype: $try" ;;
13172         esac
13173         ;;
13174         *)      case "$usethreads" in
13175                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13176                 esac
13177                 d_getprotobyname_r=undef
13178                 getprotobyname_r_proto=0
13179                 ;;
13180         esac
13181         ;;
13182 *)      getprotobyname_r_proto=0
13183         ;;
13184 esac
13185
13186 : see if getprotobynumber_r exists
13187 set getprotobynumber_r d_getprotobynumber_r
13188 eval $inlibc
13189 case "$d_getprotobynumber_r" in
13190 "$define")
13191         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13192         case "$d_getprotobynumber_r_proto:$usethreads" in
13193         ":define")      d_getprotobynumber_r_proto=define
13194                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13195                 eval $hasproto ;;
13196         *)      ;;
13197         esac
13198         case "$d_getprotobynumber_r_proto" in
13199         define)
13200         case "$getprotobynumber_r_proto" in
13201         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13202         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13203         esac
13204         case "$getprotobynumber_r_proto" in
13205         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13206         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13207         esac
13208         case "$getprotobynumber_r_proto" in
13209         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13210         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13211         esac
13212         case "$getprotobynumber_r_proto" in
13213         ''|0)   d_getprotobynumber_r=undef
13214                 getprotobynumber_r_proto=0
13215                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13216         * )     case "$getprotobynumber_r_proto" in
13217                 REENTRANT_PROTO*) ;;
13218                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13219                 esac
13220                 echo "Prototype: $try" ;;
13221         esac
13222         ;;
13223         *)      case "$usethreads" in
13224                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13225                 esac
13226                 d_getprotobynumber_r=undef
13227                 getprotobynumber_r_proto=0
13228                 ;;
13229         esac
13230         ;;
13231 *)      getprotobynumber_r_proto=0
13232         ;;
13233 esac
13234
13235 : see if getprotoent_r exists
13236 set getprotoent_r d_getprotoent_r
13237 eval $inlibc
13238 case "$d_getprotoent_r" in
13239 "$define")
13240         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13241         case "$d_getprotoent_r_proto:$usethreads" in
13242         ":define")      d_getprotoent_r_proto=define
13243                 set d_getprotoent_r_proto getprotoent_r $hdrs
13244                 eval $hasproto ;;
13245         *)      ;;
13246         esac
13247         case "$d_getprotoent_r_proto" in
13248         define)
13249         case "$getprotoent_r_proto" in
13250         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13251         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13252         esac
13253         case "$getprotoent_r_proto" in
13254         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13255         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13256         esac
13257         case "$getprotoent_r_proto" in
13258         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13259         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13260         esac
13261         case "$getprotoent_r_proto" in
13262         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13263         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13264         esac
13265         case "$getprotoent_r_proto" in
13266         ''|0)   d_getprotoent_r=undef
13267                 getprotoent_r_proto=0
13268                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13269         * )     case "$getprotoent_r_proto" in
13270                 REENTRANT_PROTO*) ;;
13271                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13272                 esac
13273                 echo "Prototype: $try" ;;
13274         esac
13275         ;;
13276         *)      case "$usethreads" in
13277                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13278                 esac
13279                 d_getprotoent_r=undef
13280                 getprotoent_r_proto=0
13281                 ;;
13282         esac
13283         ;;
13284 *)      getprotoent_r_proto=0
13285         ;;
13286 esac
13287
13288 : see if prototypes for various getprotoxxx netdb.h functions are available
13289 echo " "
13290 set d_getprotoprotos getprotoent $i_netdb netdb.h
13291 eval $hasproto
13292
13293 : see if getprpwnam exists
13294 set getprpwnam d_getprpwnam
13295 eval $inlibc
13296
13297 : see if getpwent exists
13298 set getpwent d_getpwent
13299 eval $inlibc
13300
13301 : see if getpwent_r exists
13302 set getpwent_r d_getpwent_r
13303 eval $inlibc
13304 case "$d_getpwent_r" in
13305 "$define")
13306         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13307         case "$d_getpwent_r_proto:$usethreads" in
13308         ":define")      d_getpwent_r_proto=define
13309                 set d_getpwent_r_proto getpwent_r $hdrs
13310                 eval $hasproto ;;
13311         *)      ;;
13312         esac
13313         case "$d_getpwent_r_proto" in
13314         define)
13315         case "$getpwent_r_proto" in
13316         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13317         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13318         esac
13319         case "$getpwent_r_proto" in
13320         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13321         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13322         esac
13323         case "$getpwent_r_proto" in
13324         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13325         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13326         esac
13327         case "$getpwent_r_proto" in
13328         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13329         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13330         esac
13331         case "$getpwent_r_proto" in
13332         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13333         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13334         esac
13335         case "$getpwent_r_proto" in
13336         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13337         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13338         esac
13339         case "$getpwent_r_proto" in
13340         ''|0)   d_getpwent_r=undef
13341                 getpwent_r_proto=0
13342                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13343         * )     case "$getpwent_r_proto" in
13344                 REENTRANT_PROTO*) ;;
13345                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13346                 esac
13347                 echo "Prototype: $try" ;;
13348         esac
13349         ;;
13350         *)      case "$usethreads" in
13351                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13352                 esac
13353                 d_getpwent_r=undef
13354                 getpwent_r_proto=0
13355                 ;;
13356         esac
13357         ;;
13358 *)      getpwent_r_proto=0
13359         ;;
13360 esac
13361
13362 : see if getpwnam_r exists
13363 set getpwnam_r d_getpwnam_r
13364 eval $inlibc
13365 case "$d_getpwnam_r" in
13366 "$define")
13367         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13368         case "$d_getpwnam_r_proto:$usethreads" in
13369         ":define")      d_getpwnam_r_proto=define
13370                 set d_getpwnam_r_proto getpwnam_r $hdrs
13371                 eval $hasproto ;;
13372         *)      ;;
13373         esac
13374         case "$d_getpwnam_r_proto" in
13375         define)
13376         case "$getpwnam_r_proto" in
13377         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13378         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13379         esac
13380         case "$getpwnam_r_proto" in
13381         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13382         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13383         esac
13384         case "$getpwnam_r_proto" in
13385         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13386         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13387         esac
13388         case "$getpwnam_r_proto" in
13389         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13390         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13391         esac
13392         case "$getpwnam_r_proto" in
13393         ''|0)   d_getpwnam_r=undef
13394                 getpwnam_r_proto=0
13395                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13396         * )     case "$getpwnam_r_proto" in
13397                 REENTRANT_PROTO*) ;;
13398                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13399                 esac
13400                 echo "Prototype: $try" ;;
13401         esac
13402         ;;
13403         *)      case "$usethreads" in
13404                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13405                 esac
13406                 d_getpwnam_r=undef
13407                 getpwnam_r_proto=0
13408                 ;;
13409         esac
13410         ;;
13411 *)      getpwnam_r_proto=0
13412         ;;
13413 esac
13414
13415 : see if getpwuid_r exists
13416 set getpwuid_r d_getpwuid_r
13417 eval $inlibc
13418 case "$d_getpwuid_r" in
13419 "$define")
13420         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13421         case "$d_getpwuid_r_proto:$usethreads" in
13422         ":define")      d_getpwuid_r_proto=define
13423                 set d_getpwuid_r_proto getpwuid_r $hdrs
13424                 eval $hasproto ;;
13425         *)      ;;
13426         esac
13427         case "$d_getpwuid_r_proto" in
13428         define)
13429         case "$getpwuid_r_proto" in
13430         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13431         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13432         esac
13433         case "$getpwuid_r_proto" in
13434         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13435         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13436         esac
13437         case "$getpwuid_r_proto" in
13438         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13439         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13440         esac
13441         case "$getpwuid_r_proto" in
13442         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13443         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13444         esac
13445         case "$getpwuid_r_proto" in
13446         ''|0)   d_getpwuid_r=undef
13447                 getpwuid_r_proto=0
13448                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13449         * )     case "$getpwuid_r_proto" in
13450                 REENTRANT_PROTO*) ;;
13451                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13452                 esac
13453                 echo "Prototype: $try" ;;
13454         esac
13455         ;;
13456         *)      case "$usethreads" in
13457                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13458                 esac
13459                 d_getpwuid_r=undef
13460                 getpwuid_r_proto=0
13461                 ;;
13462         esac
13463         ;;
13464 *)      getpwuid_r_proto=0
13465         ;;
13466 esac
13467
13468
13469 : see if getservbyname exists
13470 set getservbyname d_getsbyname
13471 eval $inlibc
13472
13473 : see if getservbyport exists
13474 set getservbyport d_getsbyport
13475 eval $inlibc
13476
13477 : see if getservent exists
13478 set getservent d_getsent
13479 eval $inlibc
13480
13481 : see if getservbyname_r exists
13482 set getservbyname_r d_getservbyname_r
13483 eval $inlibc
13484 case "$d_getservbyname_r" in
13485 "$define")
13486         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13487         case "$d_getservbyname_r_proto:$usethreads" in
13488         ":define")      d_getservbyname_r_proto=define
13489                 set d_getservbyname_r_proto getservbyname_r $hdrs
13490                 eval $hasproto ;;
13491         *)      ;;
13492         esac
13493         case "$d_getservbyname_r_proto" in
13494         define)
13495         case "$getservbyname_r_proto" in
13496         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13497         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13498         esac
13499         case "$getservbyname_r_proto" in
13500         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13501         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13502         esac
13503         case "$getservbyname_r_proto" in
13504         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13505         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13506         esac
13507         case "$getservbyname_r_proto" in
13508         ''|0)   d_getservbyname_r=undef
13509                 getservbyname_r_proto=0
13510                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13511         * )     case "$getservbyname_r_proto" in
13512                 REENTRANT_PROTO*) ;;
13513                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13514                 esac
13515                 echo "Prototype: $try" ;;
13516         esac
13517         ;;
13518         *)      case "$usethreads" in
13519                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13520                 esac
13521                 d_getservbyname_r=undef
13522                 getservbyname_r_proto=0
13523                 ;;
13524         esac
13525         ;;
13526 *)      getservbyname_r_proto=0
13527         ;;
13528 esac
13529
13530 : see if getservbyport_r exists
13531 set getservbyport_r d_getservbyport_r
13532 eval $inlibc
13533 case "$d_getservbyport_r" in
13534 "$define")
13535         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13536         case "$d_getservbyport_r_proto:$usethreads" in
13537         ":define")      d_getservbyport_r_proto=define
13538                 set d_getservbyport_r_proto getservbyport_r $hdrs
13539                 eval $hasproto ;;
13540         *)      ;;
13541         esac
13542         case "$d_getservbyport_r_proto" in
13543         define)
13544         case "$getservbyport_r_proto" in
13545         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13546         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13547         esac
13548         case "$getservbyport_r_proto" in
13549         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13550         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13551         esac
13552         case "$getservbyport_r_proto" in
13553         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13554         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13555         esac
13556         case "$getservbyport_r_proto" in
13557         ''|0)   d_getservbyport_r=undef
13558                 getservbyport_r_proto=0
13559                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13560         * )     case "$getservbyport_r_proto" in
13561                 REENTRANT_PROTO*) ;;
13562                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13563                 esac
13564                 echo "Prototype: $try" ;;
13565         esac
13566         ;;
13567         *)      case "$usethreads" in
13568                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13569                 esac
13570                 d_getservbyport_r=undef
13571                 getservbyport_r_proto=0
13572                 ;;
13573         esac
13574         ;;
13575 *)      getservbyport_r_proto=0
13576         ;;
13577 esac
13578
13579 : see if getservent_r exists
13580 set getservent_r d_getservent_r
13581 eval $inlibc
13582 case "$d_getservent_r" in
13583 "$define")
13584         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13585         case "$d_getservent_r_proto:$usethreads" in
13586         ":define")      d_getservent_r_proto=define
13587                 set d_getservent_r_proto getservent_r $hdrs
13588                 eval $hasproto ;;
13589         *)      ;;
13590         esac
13591         case "$d_getservent_r_proto" in
13592         define)
13593         case "$getservent_r_proto" in
13594         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13595         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13596         esac
13597         case "$getservent_r_proto" in
13598         ''|0) try='int getservent_r(struct servent*, char*, int);'
13599         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13600         esac
13601         case "$getservent_r_proto" in
13602         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13603         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13604         esac
13605         case "$getservent_r_proto" in
13606         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13607         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13608         esac
13609         case "$getservent_r_proto" in
13610         ''|0)   d_getservent_r=undef
13611                 getservent_r_proto=0
13612                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13613         * )     case "$getservent_r_proto" in
13614                 REENTRANT_PROTO*) ;;
13615                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13616                 esac
13617                 echo "Prototype: $try" ;;
13618         esac
13619         ;;
13620         *)      case "$usethreads" in
13621                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13622                 esac
13623                 d_getservent_r=undef
13624                 getservent_r_proto=0
13625                 ;;
13626         esac
13627         ;;
13628 *)      getservent_r_proto=0
13629         ;;
13630 esac
13631
13632 : see if prototypes for various getservxxx netdb.h functions are available
13633 echo " "
13634 set d_getservprotos getservent $i_netdb netdb.h
13635 eval $hasproto
13636
13637 : see if getspnam exists
13638 set getspnam d_getspnam
13639 eval $inlibc
13640
13641 : see if this is a shadow.h system
13642 set shadow.h i_shadow
13643 eval $inhdr
13644
13645 : see if getspnam_r exists
13646 set getspnam_r d_getspnam_r
13647 eval $inlibc
13648 case "$d_getspnam_r" in
13649 "$define")
13650         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13651         case "$d_getspnam_r_proto:$usethreads" in
13652         ":define")      d_getspnam_r_proto=define
13653                 set d_getspnam_r_proto getspnam_r $hdrs
13654                 eval $hasproto ;;
13655         *)      ;;
13656         esac
13657         case "$d_getspnam_r_proto" in
13658         define)
13659         case "$getspnam_r_proto" in
13660         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13661         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13662         esac
13663         case "$getspnam_r_proto" in
13664         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13665         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13666         esac
13667         case "$getspnam_r_proto" in
13668         ''|0)   d_getspnam_r=undef
13669                 getspnam_r_proto=0
13670                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13671         * )     case "$getspnam_r_proto" in
13672                 REENTRANT_PROTO*) ;;
13673                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13674                 esac
13675                 echo "Prototype: $try" ;;
13676         esac
13677         ;;
13678         *)      case "$usethreads" in
13679                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13680                 esac
13681                 d_getspnam_r=undef
13682                 getspnam_r_proto=0
13683                 ;;
13684         esac
13685         ;;
13686 *)      getspnam_r_proto=0
13687         ;;
13688 esac
13689
13690 : see if gettimeofday or ftime exists
13691 set gettimeofday d_gettimeod
13692 eval $inlibc
13693 case "$d_gettimeod" in
13694 "$undef")
13695         set ftime d_ftime 
13696         eval $inlibc
13697         ;;
13698 *)
13699         val="$undef"; set d_ftime; eval $setvar
13700         ;;
13701 esac
13702 case "$d_gettimeod$d_ftime" in
13703 "$undef$undef")
13704         echo " "
13705         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13706         ;;
13707 esac
13708
13709 : see if gmtime_r exists
13710 set gmtime_r d_gmtime_r
13711 eval $inlibc
13712 case "$d_gmtime_r" in
13713 "$define")
13714         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13715         case "$d_gmtime_r_proto:$usethreads" in
13716         ":define")      d_gmtime_r_proto=define
13717                 set d_gmtime_r_proto gmtime_r $hdrs
13718                 eval $hasproto ;;
13719         *)      ;;
13720         esac
13721         case "$d_gmtime_r_proto" in
13722         define)
13723         case "$gmtime_r_proto" in
13724         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13725         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13726         esac
13727         case "$gmtime_r_proto" in
13728         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13729         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13730         esac
13731         case "$gmtime_r_proto" in
13732         ''|0)   d_gmtime_r=undef
13733                 gmtime_r_proto=0
13734                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13735         * )     case "$gmtime_r_proto" in
13736                 REENTRANT_PROTO*) ;;
13737                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13738                 esac
13739                 echo "Prototype: $try" ;;
13740         esac
13741         ;;
13742         *)      case "$usethreads" in
13743                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13744                 esac
13745                 d_gmtime_r=undef
13746                 gmtime_r_proto=0
13747                 ;;
13748         esac
13749         ;;
13750 *)      gmtime_r_proto=0
13751         ;;
13752 esac
13753
13754 : see if hasmntopt exists
13755 set hasmntopt d_hasmntopt
13756 eval $inlibc
13757
13758 : see if this is a netinet/in.h or sys/in.h system
13759 set netinet/in.h i_niin sys/in.h i_sysin
13760 eval $inhdr
13761
13762 : see if arpa/inet.h has to be included
13763 set arpa/inet.h i_arpainet
13764 eval $inhdr
13765
13766 : see if htonl --and friends-- exists
13767 val=''
13768 set htonl val
13769 eval $inlibc
13770
13771 : Maybe they are macros.
13772 case "$val" in
13773 $undef)
13774         $cat >htonl.c <<EOM
13775 #include <stdio.h>
13776 #include <sys/types.h>
13777 #$i_niin I_NETINET_IN
13778 #$i_sysin I_SYS_IN
13779 #$i_arpainet I_ARPA_INET
13780 #ifdef I_NETINET_IN
13781 #include <netinet/in.h>
13782 #endif
13783 #ifdef I_SYS_IN
13784 #include <sys/in.h>
13785 #endif
13786 #ifdef I_ARPA_INET
13787 #include <arpa/inet.h>
13788 #endif
13789 #ifdef htonl
13790 printf("Defined as a macro.");
13791 #endif
13792 EOM
13793         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13794         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13795                 val="$define"
13796                 echo "But it seems to be defined as a macro." >&4
13797         fi
13798         $rm -f htonl.?
13799         ;;
13800 esac
13801 set d_htonl
13802 eval $setvar
13803
13804 : see if ilogbl exists
13805 set ilogbl d_ilogbl
13806 eval $inlibc
13807
13808 : index or strchr
13809 echo " "
13810 if set index val -f; eval $csym; $val; then
13811         if set strchr val -f d_strchr; eval $csym; $val; then
13812                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13813                         val="$define"
13814                         vali="$undef"
13815                         echo "strchr() found." >&4
13816                 else
13817                         val="$undef"
13818                         vali="$define"
13819                         echo "index() found." >&4
13820                 fi
13821         else
13822                 val="$undef"
13823                 vali="$define"
13824                 echo "index() found." >&4
13825         fi
13826 else
13827         if set strchr val -f d_strchr; eval $csym; $val; then
13828                 val="$define"
13829                 vali="$undef"
13830                 echo "strchr() found." >&4
13831         else
13832                 echo "No index() or strchr() found!" >&4
13833                 val="$undef"
13834                 vali="$undef"
13835         fi
13836 fi
13837 set d_strchr; eval $setvar
13838 val="$vali"
13839 set d_index; eval $setvar
13840
13841 : check whether inet_aton exists
13842 set inet_aton d_inetaton
13843 eval $inlibc
13844
13845 : Look for isascii
13846 echo " "
13847 $cat >isascii.c <<EOCP
13848 #include <stdio.h>
13849 #include <ctype.h>
13850 #$i_stdlib I_STDLIB
13851 #ifdef I_STDLIB
13852 #include <stdlib.h>
13853 #endif
13854 int main() {
13855         int c = 'A';
13856         if (isascii(c))
13857                 exit(0);
13858         else
13859                 exit(1);
13860 }
13861 EOCP
13862 set isascii
13863 if eval $compile; then
13864         echo "isascii() found." >&4
13865         val="$define"
13866 else
13867         echo "isascii() NOT found." >&4
13868         val="$undef"
13869 fi
13870 set d_isascii
13871 eval $setvar
13872 $rm -f isascii*
13873
13874 : see if isfinite exists
13875 set isfinite d_isfinite
13876 eval $inlibc
13877
13878 : see if isinf exists
13879 set isinf d_isinf
13880 eval $inlibc
13881
13882 : see if isnan exists
13883 set isnan d_isnan
13884 eval $inlibc
13885
13886 : see if isnanl exists
13887 set isnanl d_isnanl
13888 eval $inlibc
13889
13890 : see if killpg exists
13891 set killpg d_killpg
13892 eval $inlibc
13893
13894 : see if lchown exists
13895 echo " "
13896 $cat > try.c <<'EOCP'
13897 /* System header to define __stub macros and hopefully few prototypes,
13898     which can conflict with char lchown(); below.  */
13899 #include <assert.h>
13900 /* Override any gcc2 internal prototype to avoid an error.  */
13901 /* We use char because int might match the return type of a gcc2
13902    builtin and then its argument prototype would still apply.  */
13903 char lchown();
13904 int main() {
13905     /*  The GNU C library defines this for functions which it implements
13906         to always fail with ENOSYS.  Some functions are actually named
13907         something starting with __ and the normal name is an alias.  */
13908 #if defined (__stub_lchown) || defined (__stub___lchown)
13909 choke me
13910 #else
13911 lchown();
13912 #endif
13913 ; return 0; }
13914 EOCP
13915 set try
13916 if eval $compile; then
13917     $echo "lchown() found." >&4
13918     val="$define"
13919 else
13920     $echo "lchown() NOT found." >&4
13921     val="$undef"
13922 fi
13923 set d_lchown
13924 eval $setvar
13925
13926 : See if number of significant digits in a double precision number is known
13927 echo " "
13928 $cat >ldbl_dig.c <<EOM
13929 #$i_limits I_LIMITS
13930 #$i_float I_FLOAT
13931 #ifdef I_LIMITS
13932 #include <limits.h>
13933 #endif
13934 #ifdef I_FLOAT
13935 #include <float.h>
13936 #endif
13937 #ifdef LDBL_DIG
13938 printf("Contains LDBL_DIG");
13939 #endif
13940 EOM
13941 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13942 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13943         echo "LDBL_DIG found." >&4
13944         val="$define"
13945 else
13946         echo "LDBL_DIG NOT found." >&4
13947         val="$undef"
13948 fi
13949 $rm -f ldbl_dig.?
13950 set d_ldbl_dig
13951 eval $setvar
13952
13953 : see if this is a math.h system
13954 set math.h i_math
13955 eval $inhdr
13956
13957 d_libm_lib_version="$undef"
13958 case $i_math in
13959     $define)
13960         : check to see if math.h defines _LIB_VERSION
13961         echo " "
13962         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
13963         $cat >try.c <<EOCP
13964 #include <unistd.h>
13965 #include <math.h>
13966 int main (int argc, char *argv[])
13967 {
13968     printf ("%d\n", _LIB_VERSION);
13969     return (0);
13970     } /* main */
13971 EOCP
13972         set try
13973         if eval $compile; then
13974             foo=`$run ./try`
13975             echo "Yes, it does ($foo)" >&4
13976             d_libm_lib_version="$define"
13977         else
13978             echo "No, it does not (probably harmless)\n" >&4
13979             fi
13980         $rm -f try.* try core core.try.*
13981         ;;
13982
13983     esac
13984
13985 : see if link exists
13986 set link d_link
13987 eval $inlibc
13988
13989 : see if localtime_r exists
13990 set localtime_r d_localtime_r
13991 eval $inlibc
13992 case "$d_localtime_r" in
13993 "$define")
13994         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13995         case "$d_localtime_r_proto:$usethreads" in
13996         ":define")      d_localtime_r_proto=define
13997                 set d_localtime_r_proto localtime_r $hdrs
13998                 eval $hasproto ;;
13999         *)      ;;
14000         esac
14001         case "$d_localtime_r_proto" in
14002         define)
14003         case "$localtime_r_proto" in
14004         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14005         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14006         esac
14007         case "$localtime_r_proto" in
14008         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14009         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14010         esac
14011         case "$localtime_r_proto" in
14012         ''|0)   d_localtime_r=undef
14013                 localtime_r_proto=0
14014                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14015         * )     case "$localtime_r_proto" in
14016                 REENTRANT_PROTO*) ;;
14017                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14018                 esac
14019                 echo "Prototype: $try" ;;
14020         esac
14021         ;;
14022         *)      case "$usethreads" in
14023                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14024                 esac
14025                 d_localtime_r=undef
14026                 localtime_r_proto=0
14027                 ;;
14028         esac
14029         ;;
14030 *)      localtime_r_proto=0
14031         ;;
14032 esac
14033
14034 : see if localeconv exists
14035 set localeconv d_locconv
14036 eval $inlibc
14037
14038 : see if lockf exists
14039 set lockf d_lockf
14040 eval $inlibc
14041
14042 : see if prototype for lseek is available
14043 echo " "
14044 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14045 eval $hasproto
14046
14047 : see if lstat exists
14048 set lstat d_lstat
14049 eval $inlibc
14050
14051 : see if madvise exists
14052 set madvise d_madvise
14053 eval $inlibc
14054
14055 : see if mblen exists
14056 set mblen d_mblen
14057 eval $inlibc
14058
14059 : see if mbstowcs exists
14060 set mbstowcs d_mbstowcs
14061 eval $inlibc
14062
14063 : see if mbtowc exists
14064 set mbtowc d_mbtowc
14065 eval $inlibc
14066
14067 : see if memchr exists
14068 set memchr d_memchr
14069 eval $inlibc
14070
14071 : see if memcmp exists
14072 set memcmp d_memcmp
14073 eval $inlibc
14074
14075 : see if memcpy exists
14076 set memcpy d_memcpy
14077 eval $inlibc
14078
14079 : see if memmove exists
14080 set memmove d_memmove
14081 eval $inlibc
14082
14083 : see if memset exists
14084 set memset d_memset
14085 eval $inlibc
14086
14087 : see if mkdir exists
14088 set mkdir d_mkdir
14089 eval $inlibc
14090
14091 : see if mkdtemp exists
14092 set mkdtemp d_mkdtemp
14093 eval $inlibc
14094
14095 : see if mkfifo exists
14096 set mkfifo d_mkfifo
14097 eval $inlibc
14098
14099 : see if mkstemp exists
14100 set mkstemp d_mkstemp
14101 eval $inlibc
14102
14103 : see if mkstemps exists
14104 set mkstemps d_mkstemps
14105 eval $inlibc
14106
14107 : see if mktime exists
14108 set mktime d_mktime
14109 eval $inlibc
14110
14111 : see if this is a sys/mman.h system
14112 set sys/mman.h i_sysmman
14113 eval $inhdr
14114
14115 : see if mmap exists
14116 set mmap d_mmap
14117 eval $inlibc
14118 : see what shmat returns
14119 : default to something harmless
14120 mmaptype='void *'
14121 case "$i_sysmman$d_mmap" in
14122 "$define$define")
14123         $cat >mmap.c <<'END'
14124 #include <sys/mman.h>
14125 void *mmap();
14126 END
14127         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14128                 mmaptype='void *'
14129         else
14130                 mmaptype='caddr_t'
14131         fi
14132         echo "and it returns ($mmaptype)." >&4
14133         ;;
14134 esac
14135
14136
14137
14138 : see if sqrtl exists
14139 set sqrtl d_sqrtl
14140 eval $inlibc
14141
14142 : see if scalbnl exists
14143 set scalbnl d_scalbnl
14144 eval $inlibc
14145
14146 : see if modfl exists
14147 set modfl d_modfl
14148 eval $inlibc
14149
14150 : see if prototype for modfl is available
14151 echo " "
14152 set d_modflproto modfl $i_math math.h
14153 eval $hasproto
14154
14155 d_modfl_pow32_bug="$undef"
14156
14157 case "$d_longdbl$d_modfl" in
14158 $define$define)
14159         $cat <<EOM
14160 Checking to see whether your modfl() is okay for large values...
14161 EOM
14162 $cat >try.c <<EOCP
14163 #include <math.h> 
14164 #include <stdio.h>
14165 EOCP
14166 if $test "X$d_modflproto" != "X$define"; then
14167         $cat >>try.c <<EOCP
14168 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14169 long double modfl (long double, long double *);
14170 EOCP
14171 fi
14172 $cat >>try.c <<EOCP
14173 int main() {
14174     long double nv = 4294967303.15;
14175     long double v, w;
14176     v = modfl(nv, &w);         
14177 #ifdef __GLIBC__
14178     printf("glibc");
14179 #endif
14180     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14181     return 0;
14182 }
14183 EOCP
14184         case "$osname:$gccversion" in
14185         aix:)   saveccflags="$ccflags"
14186                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14187         esac
14188         set try
14189         if eval $compile; then
14190                 foo=`$run ./try`
14191                 case "$foo" in
14192                 *" 4294967303.150000 1.150000 4294967302.000000")
14193                         echo >&4 "Your modfl() is broken for large values."
14194                         d_modfl_pow32_bug="$define"
14195                         case "$foo" in
14196                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14197                         ;;
14198                         esac
14199                         ;;
14200                 *" 4294967303.150000 0.150000 4294967303.000000")
14201                         echo >&4 "Your modfl() seems okay for large values."
14202                         ;;
14203                 *)      echo >&4 "I don't understand your modfl() at all."
14204                         d_modfl="$undef"
14205                         ;;
14206                 esac
14207                 $rm -f try.* try core core.try.*
14208         else
14209                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14210                 d_modfl="$undef"
14211         fi
14212         case "$osname:$gccversion" in
14213         aix:)   ccflags="$saveccflags" ;; # restore
14214         esac
14215         ;;
14216 esac
14217
14218 if $test "$uselongdouble" = "$define"; then
14219     message=""
14220     if $test "$d_sqrtl" != "$define"; then
14221         message="$message sqrtl"
14222     fi
14223     if $test "$d_modfl" != "$define"; then
14224         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14225             echo "You have both aintl and copysignl, so I can emulate modfl."
14226         else
14227             message="$message modfl"
14228         fi
14229     fi
14230     if $test "$d_frexpl" != "$define"; then
14231         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14232             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14233         else
14234             message="$message frexpl"
14235         fi
14236     fi
14237
14238     if $test "$message" != ""; then
14239         $cat <<EOM >&4
14240
14241 *** You requested the use of long doubles but you do not seem to have
14242 *** the following mathematical functions needed for long double support:
14243 ***    $message
14244 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14245 *** Cannot continue, aborting.
14246
14247 EOM
14248
14249         exit 1
14250     fi
14251 fi
14252
14253 : see if mprotect exists
14254 set mprotect d_mprotect
14255 eval $inlibc
14256
14257 : see if msgctl exists
14258 set msgctl d_msgctl
14259 eval $inlibc
14260
14261 : see if msgget exists
14262 set msgget d_msgget
14263 eval $inlibc
14264
14265 : see if msgsnd exists
14266 set msgsnd d_msgsnd
14267 eval $inlibc
14268
14269 : see if msgrcv exists
14270 set msgrcv d_msgrcv
14271 eval $inlibc
14272
14273 : see how much of the 'msg*(2)' library is present.
14274 h_msg=true
14275 echo " "
14276 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14277 *"$undef"*) h_msg=false;;
14278 esac
14279 case "$osname" in
14280 freebsd)
14281     case "`ipcs 2>&1`" in
14282     "SVID messages"*"not configured"*)
14283         echo "Your $osname does not have the msg*(2) configured." >&4
14284         h_msg=false
14285         val="$undef"
14286         set msgctl d_msgctl
14287         eval $setvar
14288         set msgget d_msgget
14289         eval $setvar
14290         set msgsnd d_msgsnd
14291         eval $setvar
14292         set msgrcv d_msgrcv
14293         eval $setvar
14294         ;;
14295     esac
14296     ;;
14297 esac
14298 : we could also check for sys/ipc.h ...
14299 if $h_msg && $test `./findhdr sys/msg.h`; then
14300         echo "You have the full msg*(2) library." >&4
14301         val="$define"
14302 else
14303         echo "You don't have the full msg*(2) library." >&4
14304         val="$undef"
14305 fi
14306 set d_msg
14307 eval $setvar
14308
14309
14310 echo " "
14311 echo "Checking to see if your system supports struct msghdr..." >&4
14312 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14313 eval $hasstruct
14314 case "$d_msghdr_s" in
14315 "$define")      echo "Yes, it does."   ;;
14316 *)              echo "No, it doesn't." ;;
14317 esac
14318
14319
14320 : see if msync exists
14321 set msync d_msync
14322 eval $inlibc
14323
14324 : see if munmap exists
14325 set munmap d_munmap
14326 eval $inlibc
14327
14328 : see if nice exists
14329 set nice d_nice
14330 eval $inlibc
14331
14332 : see if this is a langinfo.h system
14333 set langinfo.h i_langinfo
14334 eval $inhdr
14335
14336 : see if nl_langinfo exists
14337 set nl_langinfo d_nl_langinfo
14338 eval $inlibc
14339
14340 : check for length of character
14341 echo " "
14342 case "$charsize" in
14343 '')
14344         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14345         $cat >try.c <<EOCP
14346 #include <stdio.h>
14347 #$i_stdlib I_STDLIB
14348 #ifdef I_STDLIB
14349 #include <stdlib.h>
14350 #endif
14351 int main()
14352 {
14353     printf("%d\n", (int)sizeof(char));
14354     exit(0);
14355 }
14356 EOCP
14357         set try
14358         if eval $compile_ok; then
14359                 dflt=`$run ./try`
14360         else
14361                 dflt='1'
14362                 echo "(I can't seem to compile the test program.  Guessing...)"
14363         fi
14364         ;;
14365 *)
14366         dflt="$charsize"
14367         ;;
14368 esac
14369 rp="What is the size of a character (in bytes)?"
14370 . ./myread
14371 charsize="$ans"
14372 $rm -f try.c try
14373
14374 : check for volatile keyword
14375 echo " "
14376 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14377 $cat >try.c <<'EOCP'
14378 int main()
14379 {
14380         typedef struct _goo_struct goo_struct;
14381         goo_struct * volatile goo = ((goo_struct *)0);
14382         struct _goo_struct {
14383                 long long_int;
14384                 int reg_int;
14385                 char char_var;
14386         };
14387         typedef unsigned short foo_t;
14388         char *volatile foo;
14389         volatile int bar;
14390         volatile foo_t blech;
14391         foo = foo;
14392 }
14393 EOCP
14394 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14395         val="$define"
14396         echo "Yup, it does."
14397 else
14398         val="$undef"
14399         echo "Nope, it doesn't."
14400 fi
14401 set d_volatile
14402 eval $setvar
14403 $rm -f try.*
14404
14405
14406 echo " "
14407 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14408
14409 case "$use64bitint:$d_quad:$quadtype" in
14410 define:define:?*)
14411         ivtype="$quadtype"
14412         uvtype="$uquadtype"
14413         ivsize=8
14414         uvsize=8
14415         ;;
14416 *)      ivtype="long"
14417         uvtype="unsigned long"
14418         ivsize=$longsize
14419         uvsize=$longsize
14420         ;;
14421 esac
14422
14423 case "$uselongdouble:$d_longdbl" in
14424 define:define)
14425         nvtype="long double"
14426         nvsize=$longdblsize
14427         ;;
14428 *)      nvtype=double
14429         nvsize=$doublesize
14430         ;;
14431 esac
14432
14433 $echo "(IV will be "$ivtype", $ivsize bytes)"
14434 $echo "(UV will be "$uvtype", $uvsize bytes)"
14435 $echo "(NV will be "$nvtype", $nvsize bytes)"
14436
14437 $cat >try.c <<EOCP
14438 #$i_inttypes I_INTTYPES
14439 #ifdef I_INTTYPES
14440 #include <inttypes.h>
14441 #endif
14442 #include <stdio.h>
14443 int main() {
14444 #ifdef INT8
14445    int8_t i =  INT8_MAX;
14446   uint8_t u = UINT8_MAX;
14447   printf("int8_t\n");
14448 #endif
14449 #ifdef INT16
14450    int16_t i =  INT16_MAX;
14451   uint16_t i = UINT16_MAX;
14452   printf("int16_t\n");
14453 #endif
14454 #ifdef INT32
14455    int32_t i =  INT32_MAX;
14456   uint32_t u = UINT32_MAX;
14457   printf("int32_t\n");
14458 #endif
14459 }
14460 EOCP
14461
14462 case "$i8type" in
14463 '')     case "$charsize" in
14464         1)      i8type=char
14465                 u8type="unsigned char"
14466                 i8size=$charsize
14467                 u8size=$charsize
14468                 ;;
14469         esac
14470         ;;
14471 esac
14472 case "$i8type" in
14473 '')     set try -DINT8
14474         if eval $compile; then
14475                 case "`$run ./try`" in
14476                 int8_t) i8type=int8_t
14477                         u8type=uint8_t
14478                         i8size=1
14479                         u8size=1
14480                         ;;
14481                 esac
14482         fi
14483         ;;
14484 esac
14485 case "$i8type" in
14486 '')     if $test $charsize -ge 1; then
14487                 i8type=char
14488                 u8type="unsigned char"
14489                 i8size=$charsize
14490                 u8size=$charsize
14491         fi
14492         ;;
14493 esac
14494
14495 case "$i16type" in
14496 '')     case "$shortsize" in
14497         2)      i16type=short
14498                 u16type="unsigned short"
14499                 i16size=$shortsize
14500                 u16size=$shortsize
14501                 ;;
14502         esac
14503         ;;
14504 esac
14505 case "$i16type" in
14506 '')     set try -DINT16
14507         if eval $compile; then
14508                 case "`$run ./try`" in
14509                 int16_t)
14510                         i16type=int16_t
14511                         u16type=uint16_t
14512                         i16size=2
14513                         u16size=2
14514                         ;;
14515                 esac
14516         fi
14517         ;;
14518 esac
14519 case "$i16type" in
14520 '')     if $test $shortsize -ge 2; then
14521                 i16type=short
14522                 u16type="unsigned short"
14523                 i16size=$shortsize
14524                 u16size=$shortsize
14525         fi
14526         ;;
14527 esac
14528
14529 case "$i32type" in
14530 '')     case "$longsize" in
14531         4)      i32type=long
14532                 u32type="unsigned long"
14533                 i32size=$longsize
14534                 u32size=$longsize
14535                 ;;
14536         *)      case "$intsize" in
14537                 4)      i32type=int
14538                         u32type="unsigned int"
14539                         i32size=$intsize
14540                         u32size=$intsize
14541                         ;;
14542                 esac
14543                 ;;
14544         esac
14545         ;;
14546 esac
14547 case "$i32type" in
14548 '')     set try -DINT32
14549         if eval $compile; then
14550                 case "`$run ./try`" in
14551                 int32_t)
14552                         i32type=int32_t
14553                         u32type=uint32_t
14554                         i32size=4
14555                         u32size=4
14556                         ;;
14557                 esac
14558         fi
14559         ;;
14560 esac
14561 case "$i32type" in
14562 '')     if $test $intsize -ge 4; then
14563                 i32type=int
14564                 u32type="unsigned int"
14565                 i32size=$intsize
14566                 u32size=$intsize
14567         fi
14568         ;;
14569 esac
14570
14571 case "$i64type" in
14572 '')     case "$d_quad:$quadtype" in
14573         define:?*)
14574                 i64type="$quadtype"
14575                 u64type="$uquadtype"
14576                 i64size=8
14577                 u64size=8
14578                 ;;
14579         esac
14580         ;;
14581 esac
14582
14583 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14584 : volatile so that the compiler has to store it out to memory.
14585 if test X"$d_volatile" = X"$define"; then
14586         volatile=volatile
14587 fi
14588 $cat <<EOP >try.c
14589 #include <stdio.h>
14590 #$i_stdlib I_STDLIB
14591 #ifdef I_STDLIB
14592 #include <stdlib.h>
14593 #endif
14594 #include <sys/types.h>
14595 #include <signal.h>
14596 #ifdef SIGFPE
14597 $volatile int bletched = 0;
14598 $signal_t blech(s) int s; { bletched = 1; }
14599 #endif
14600 int main() {
14601     $uvtype u = 0;
14602     $nvtype d;
14603     int     n = 8 * $uvsize;
14604     int     i;
14605 #ifdef SIGFPE
14606     signal(SIGFPE, blech);
14607 #endif
14608
14609     for (i = 0; i < n; i++) {
14610       u = u << 1 | ($uvtype)1;
14611       d = ($nvtype)u;
14612       if (($uvtype)d != u)
14613         break;
14614       if (d <= 0)
14615         break;
14616       d = ($nvtype)(u - 1);
14617       if (($uvtype)d != (u - 1))
14618         break;
14619 #ifdef SIGFPE
14620       if (bletched) {
14621         break;
14622 #endif
14623       } 
14624     }
14625     printf("%d\n", ((i == n) ? -n : i));
14626     exit(0);
14627 }
14628 EOP
14629 set try
14630
14631 d_nv_preserves_uv="$undef"
14632 if eval $compile; then
14633         nv_preserves_uv_bits="`$run ./try`"
14634 fi
14635 case "$nv_preserves_uv_bits" in
14636 \-[1-9]*)       
14637         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14638         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14639         d_nv_preserves_uv="$define"
14640         ;;
14641 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14642         d_nv_preserves_uv="$undef" ;;
14643 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14644         nv_preserves_uv_bits="$undef" ;;
14645 esac
14646
14647 $rm -f try.* try
14648
14649
14650 : check for off64_t
14651 echo " "
14652 echo "Checking to see if you have off64_t..." >&4
14653 $cat >try.c <<EOCP
14654 #include <sys/types.h>
14655 #include <unistd.h>
14656 int main() { off64_t x = 7; }
14657 EOCP
14658 set try
14659 if eval $compile; then
14660         val="$define"
14661         echo "You have off64_t."
14662 else
14663         val="$undef"
14664         echo "You do not have off64_t."
14665         case "$lseeksize" in
14666         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14667         esac
14668 fi
14669 $rm -f try.* try
14670 set d_off64_t
14671 eval $setvar
14672
14673 : how to create joinable pthreads
14674 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14675         echo " "
14676         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14677         $cat >try.c <<'EOCP'
14678 #include <pthread.h>
14679 int main() {
14680     int detachstate = JOINABLE;
14681 }
14682 EOCP
14683         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14684         if eval $compile; then
14685                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14686                 val="$undef" # Yes, undef.
14687                 set d_old_pthread_create_joinable
14688                 eval $setvar
14689                 val=""
14690                 set old_pthread_create_joinable
14691                 eval $setvar
14692         else
14693                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14694                 if eval $compile; then
14695                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14696                         val="$define"
14697                         set d_old_pthread_create_joinable
14698                         eval $setvar
14699                         val=PTHREAD_CREATE_UNDETACHED
14700                         set old_pthread_create_joinable
14701                         eval $setvar
14702                 else            
14703                         set try -DJOINABLE=__UNDETACHED
14704                         if eval $compile; then
14705                                 echo "You seem to use __UNDETACHED." >&4
14706                                 val="$define"
14707                                 set d_old_pthread_create_joinable
14708                                 eval $setvar
14709                                 val=__UNDETACHED
14710                                 set old_pthread_create_joinable
14711                                 eval $setvar
14712                         else
14713                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14714                                 val="$define"
14715                                 set d_old_pthread_create_joinable
14716                                 eval $setvar
14717                                 val=0
14718                                 set old_pthread_create_joinable
14719                                 eval $setvar
14720                         fi
14721                 fi
14722         fi
14723         $rm -f try try.*
14724 else
14725     d_old_pthread_create_joinable="$undef"
14726     old_pthread_create_joinable=""
14727 fi
14728
14729 : see if pause exists
14730 set pause d_pause
14731 eval $inlibc
14732
14733 : see if pipe exists
14734 set pipe d_pipe
14735 eval $inlibc
14736
14737 : see if poll exists
14738 set poll d_poll
14739 eval $inlibc
14740
14741 : see if readlink exists
14742 set readlink d_readlink
14743 eval $inlibc
14744
14745 echo " "
14746 procselfexe=''
14747 val="$undef"
14748 case "$d_readlink" in
14749 "$define")
14750         if $issymlink /proc/self/exe ; then
14751                 $ls -l /proc/self/exe > reflect
14752                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14753                         echo "You have Linux-like /proc/self/exe."
14754                         procselfexe='"/proc/self/exe"'
14755                         val="$define"
14756                 fi
14757         fi
14758         if $issymlink /proc/curproc/file ; then
14759                 $ls -l /proc/curproc/file > reflect
14760                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14761                         echo "You have BSD-like /proc/curproc/file."
14762                         procselfexe='"/proc/curproc/file"'
14763                         val="$define"
14764                 fi
14765         fi
14766         ;;
14767 esac
14768 $rm -f reflect
14769 set d_procselfexe
14770 eval $setvar
14771
14772 : see whether the pthread_atfork exists
14773 $cat >try.c <<EOP
14774 #include <pthread.h>
14775 #include <stdio.h>
14776 int main() {
14777 #ifdef  PTHREAD_ATFORK
14778         pthread_atfork(NULL,NULL,NULL);
14779 #endif
14780 }
14781 EOP
14782
14783 : see if pthread_atfork exists
14784 set try -DPTHREAD_ATFORK
14785 if eval $compile; then
14786     val="$define"
14787 else
14788     val="$undef"
14789 fi
14790 case "$usethreads" in
14791 $define)
14792         case "$val" in
14793         $define) echo 'pthread_atfork found.' >&4        ;;
14794         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14795         esac
14796 esac
14797 set d_pthread_atfork
14798 eval $setvar
14799
14800 : see if pthread_attr_setscope exists
14801 set pthread_attr_setscope d_pthread_attr_setscope
14802 eval $inlibc
14803
14804
14805 : see whether the various POSIXish _yields exist
14806 $cat >try.c <<EOP
14807 #include <pthread.h>
14808 #include <stdio.h>
14809 int main() {
14810 #ifdef SCHED_YIELD
14811         sched_yield();
14812 #else
14813 #ifdef PTHREAD_YIELD
14814         pthread_yield();
14815 #else
14816 #ifdef PTHREAD_YIELD_NULL
14817         pthread_yield(NULL);
14818 #endif
14819 #endif
14820 #endif
14821 }
14822 EOP
14823 : see if sched_yield exists
14824 set try -DSCHED_YIELD
14825 if eval $compile; then
14826     val="$define"
14827     sched_yield='sched_yield()'
14828 else
14829     val="$undef"
14830 fi
14831 case "$usethreads" in
14832 $define)
14833         case "$val" in
14834         $define) echo 'sched_yield() found.' >&4        ;;
14835         *)       echo 'sched_yield() NOT found.' >&4    ;;
14836         esac
14837 esac
14838 set d_sched_yield
14839 eval $setvar
14840
14841 : see if pthread_yield exists
14842 set try -DPTHREAD_YIELD
14843 if eval $compile; then
14844     val="$define"
14845     case "$sched_yield" in
14846     '') sched_yield='pthread_yield()' ;;
14847     esac
14848 else
14849     set try -DPTHREAD_YIELD_NULL
14850     if eval $compile; then
14851         val="$define"
14852         case "$sched_yield" in
14853         '') sched_yield='pthread_yield(NULL)' ;;
14854         esac
14855     else
14856         val="$undef"
14857     fi
14858 fi
14859 case "$usethreads" in
14860 $define)
14861         case "$val" in
14862         $define) echo 'pthread_yield() found.' >&4      ;;
14863         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14864         esac
14865         ;;
14866 esac
14867 set d_pthread_yield
14868 eval $setvar
14869
14870 case "$sched_yield" in
14871 '') sched_yield=undef ;;
14872 esac
14873
14874 $rm -f try try.*
14875
14876 : see if random_r exists
14877 set random_r d_random_r
14878 eval $inlibc
14879 case "$d_random_r" in
14880 "$define")
14881         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14882         case "$d_random_r_proto:$usethreads" in
14883         ":define")      d_random_r_proto=define
14884                 set d_random_r_proto random_r $hdrs
14885                 eval $hasproto ;;
14886         *)      ;;
14887         esac
14888         case "$d_random_r_proto" in
14889         define)
14890         case "$random_r_proto" in
14891         ''|0) try='int random_r(int*, struct random_data*);'
14892         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14893         esac
14894         case "$random_r_proto" in
14895         ''|0) try='int random_r(long*, struct random_data*);'
14896         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14897         esac
14898         case "$random_r_proto" in
14899         ''|0) try='int random_r(struct random_data*, int32_t*);'
14900         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
14901         esac
14902         case "$random_r_proto" in
14903         ''|0)   d_random_r=undef
14904                 random_r_proto=0
14905                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14906         * )     case "$random_r_proto" in
14907                 REENTRANT_PROTO*) ;;
14908                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14909                 esac
14910                 echo "Prototype: $try" ;;
14911         esac
14912         ;;
14913         *)      case "$usethreads" in
14914                 define) echo "random_r has no prototype, not using it." >&4 ;;
14915                 esac
14916                 d_random_r=undef
14917                 random_r_proto=0
14918                 ;;
14919         esac
14920         ;;
14921 *)      random_r_proto=0
14922         ;;
14923 esac
14924
14925 : see if readdir and friends exist
14926 set readdir d_readdir
14927 eval $inlibc
14928 set seekdir d_seekdir
14929 eval $inlibc
14930 set telldir d_telldir
14931 eval $inlibc
14932 set rewinddir d_rewinddir
14933 eval $inlibc
14934
14935 : see if readdir64_r exists
14936 set readdir64_r d_readdir64_r
14937 eval $inlibc
14938 case "$d_readdir64_r" in
14939 "$define")
14940         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14941         case "$d_readdir64_r_proto:$usethreads" in
14942         ":define")      d_readdir64_r_proto=define
14943                 set d_readdir64_r_proto readdir64_r $hdrs
14944                 eval $hasproto ;;
14945         *)      ;;
14946         esac
14947         case "$d_readdir64_r_proto" in
14948         define)
14949         case "$readdir64_r_proto" in
14950         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14951         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14952         esac
14953         case "$readdir64_r_proto" in
14954         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14955         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14956         esac
14957         case "$readdir64_r_proto" in
14958         ''|0)   d_readdir64_r=undef
14959                 readdir64_r_proto=0
14960                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14961         * )     case "$readdir64_r_proto" in
14962                 REENTRANT_PROTO*) ;;
14963                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14964                 esac
14965                 echo "Prototype: $try" ;;
14966         esac
14967         ;;
14968         *)      case "$usethreads" in
14969                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14970                 esac
14971                 d_readdir64_r=undef
14972                 readdir64_r_proto=0
14973                 ;;
14974         esac
14975         ;;
14976 *)      readdir64_r_proto=0
14977         ;;
14978 esac
14979
14980 : see if readdir_r exists
14981 set readdir_r d_readdir_r
14982 eval $inlibc
14983 case "$d_readdir_r" in
14984 "$define")
14985         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14986         case "$d_readdir_r_proto:$usethreads" in
14987         ":define")      d_readdir_r_proto=define
14988                 set d_readdir_r_proto readdir_r $hdrs
14989                 eval $hasproto ;;
14990         *)      ;;
14991         esac
14992         case "$d_readdir_r_proto" in
14993         define)
14994         case "$readdir_r_proto" in
14995         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14996         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14997         esac
14998         case "$readdir_r_proto" in
14999         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15000         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15001         esac
15002         case "$readdir_r_proto" in
15003         ''|0)   d_readdir_r=undef
15004                 readdir_r_proto=0
15005                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15006         * )     case "$readdir_r_proto" in
15007                 REENTRANT_PROTO*) ;;
15008                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15009                 esac
15010                 echo "Prototype: $try" ;;
15011         esac
15012         ;;
15013         *)      case "$usethreads" in
15014                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15015                 esac
15016                 d_readdir_r=undef
15017                 readdir_r_proto=0
15018                 ;;
15019         esac
15020         ;;
15021 *)      readdir_r_proto=0
15022         ;;
15023 esac
15024
15025 : see if readv exists
15026 set readv d_readv
15027 eval $inlibc
15028
15029 : see if recvmsg exists
15030 set recvmsg d_recvmsg
15031 eval $inlibc
15032
15033 : see if rename exists
15034 set rename d_rename
15035 eval $inlibc
15036
15037 : see if rmdir exists
15038 set rmdir d_rmdir
15039 eval $inlibc
15040
15041 : see if memory.h is available.
15042 val=''
15043 set memory.h val
15044 eval $inhdr
15045
15046 : See if it conflicts with string.h
15047 case "$val" in
15048 $define)
15049         case "$strings" in
15050         '') ;;
15051         *)
15052                 $cppstdin $cppflags $cppminus < $strings > mem.h
15053                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15054                         echo " "
15055                         echo "We won't be including <memory.h>."
15056                         val="$undef"
15057                 fi
15058                 $rm -f mem.h
15059                 ;;
15060         esac
15061 esac
15062 set i_memory
15063 eval $setvar
15064
15065 : can bcopy handle overlapping blocks?
15066 echo " "
15067 val="$undef"
15068 case "$d_memmove" in
15069 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15070 *)      case "$d_bcopy" in
15071         "$define")
15072                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15073                 $cat >try.c <<EOCP
15074 #$i_memory I_MEMORY
15075 #$i_stdlib I_STDLIB
15076 #$i_string I_STRING
15077 #$i_unistd I_UNISTD
15078 EOCP
15079         $cat >>try.c <<'EOCP'
15080 #include <stdio.h>
15081 #ifdef I_MEMORY
15082 #  include <memory.h>
15083 #endif
15084 #ifdef I_STDLIB
15085 #  include <stdlib.h>
15086 #endif
15087 #ifdef I_STRING
15088 #  include <string.h>
15089 #else
15090 #  include <strings.h>
15091 #endif
15092 #ifdef I_UNISTD
15093 #  include <unistd.h>  /* Needed for NetBSD */
15094 #endif
15095 int main()
15096 {
15097 char buf[128], abc[128];
15098 char *b;
15099 int len;
15100 int off;
15101 int align;
15102
15103 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15104    try to store the string in read-only memory. */
15105 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15106
15107 for (align = 7; align >= 0; align--) {
15108         for (len = 36; len; len--) {
15109                 b = buf+align;
15110                 bcopy(abc, b, len);
15111                 for (off = 1; off <= len; off++) {
15112                         bcopy(b, b+off, len);
15113                         bcopy(b+off, b, len);
15114                         if (bcmp(b, abc, len))
15115                                 exit(1);
15116                 }
15117         }
15118 }
15119 exit(0);
15120 }
15121 EOCP
15122                 set try
15123                 if eval $compile_ok; then
15124                         if ./try 2>/dev/null; then
15125                                 echo "Yes, it can."
15126                                 val="$define"
15127                         else
15128                                 echo "It can't, sorry."
15129                         fi
15130                 else
15131                         echo "(I can't compile the test program, so we'll assume not...)"
15132                 fi
15133                 ;;
15134         esac
15135         $rm -f try.* try core
15136         ;;
15137 esac
15138 set d_safebcpy
15139 eval $setvar
15140
15141 : can memcpy handle overlapping blocks?
15142 echo " "
15143 val="$undef"
15144 case "$d_memmove" in
15145 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15146 *)      case "$d_memcpy" in
15147         "$define")
15148                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15149                 $cat >try.c <<EOCP
15150 #$i_memory I_MEMORY
15151 #$i_stdlib I_STDLIB
15152 #$i_string I_STRING
15153 #$i_unistd I_UNISTD
15154 EOCP
15155         $cat >>try.c <<'EOCP'
15156 #include <stdio.h>
15157 #ifdef I_MEMORY
15158 #  include <memory.h>
15159 #endif
15160 #ifdef I_STDLIB
15161 #  include <stdlib.h>
15162 #endif
15163 #ifdef I_STRING
15164 #  include <string.h>
15165 #else
15166 #  include <strings.h>
15167 #endif
15168 #ifdef I_UNISTD
15169 #  include <unistd.h>  /* Needed for NetBSD */
15170 #endif
15171 int main()
15172 {
15173 char buf[128], abc[128];
15174 char *b;
15175 int len;
15176 int off;
15177 int align;
15178
15179 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15180    try to store the string in read-only memory. */
15181 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15182
15183 for (align = 7; align >= 0; align--) {
15184         for (len = 36; len; len--) {
15185                 b = buf+align;
15186                 memcpy(b, abc, len);
15187                 for (off = 1; off <= len; off++) {
15188                         memcpy(b+off, b, len);
15189                         memcpy(b, b+off, len);
15190                         if (memcmp(b, abc, len))
15191                                 exit(1);
15192                 }
15193         }
15194 }
15195 exit(0);
15196 }
15197 EOCP
15198                 set try
15199                 if eval $compile_ok; then
15200                         if ./try 2>/dev/null; then
15201                                 echo "Yes, it can."
15202                                 val="$define"
15203                         else
15204                                 echo "It can't, sorry."
15205                         fi
15206                 else
15207                         echo "(I can't compile the test program, so we'll assume not...)"
15208                 fi
15209                 ;;
15210         esac
15211         $rm -f try.* try core
15212         ;;
15213 esac
15214 set d_safemcpy
15215 eval $setvar
15216
15217 : can memcmp be trusted to compare relative magnitude?
15218 val="$undef"
15219 case "$d_memcmp" in
15220 "$define")
15221         echo " "
15222         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15223         $cat >try.c <<EOCP
15224 #$i_memory I_MEMORY
15225 #$i_stdlib I_STDLIB
15226 #$i_string I_STRING
15227 #$i_unistd I_UNISTD
15228 EOCP
15229         $cat >>try.c <<'EOCP'
15230 #include <stdio.h>
15231 #ifdef I_MEMORY
15232 #  include <memory.h>
15233 #endif
15234 #ifdef I_STDLIB
15235 #  include <stdlib.h>
15236 #endif
15237 #ifdef I_STRING
15238 #  include <string.h>
15239 #else
15240 #  include <strings.h>
15241 #endif
15242 #ifdef I_UNISTD
15243 #  include <unistd.h>  /* Needed for NetBSD */
15244 #endif
15245 int main()
15246 {
15247 char a = -1;
15248 char b = 0;
15249 if ((a < b) && memcmp(&a, &b, 1) < 0)
15250         exit(1);
15251 exit(0);
15252 }
15253 EOCP
15254         set try
15255         if eval $compile_ok; then
15256                 if $run ./try 2>/dev/null; then
15257                         echo "Yes, it can."
15258                         val="$define"
15259                 else
15260                         echo "No, it can't (it uses signed chars)."
15261                 fi
15262         else
15263                 echo "(I can't compile the test program, so we'll assume not...)"
15264         fi
15265         ;;
15266 esac
15267 $rm -f try.* try core
15268 set d_sanemcmp
15269 eval $setvar
15270
15271 : see if prototype for sbrk is available
15272 echo " "
15273 set d_sbrkproto sbrk $i_unistd unistd.h
15274 eval $hasproto
15275
15276 : see if select exists
15277 set select d_select
15278 eval $inlibc
15279
15280 : see if semctl exists
15281 set semctl d_semctl
15282 eval $inlibc
15283
15284 : see if semget exists
15285 set semget d_semget
15286 eval $inlibc
15287
15288 : see if semop exists
15289 set semop d_semop
15290 eval $inlibc
15291
15292 : see how much of the 'sem*(2)' library is present.
15293 h_sem=true
15294 echo " "
15295 case "$d_semctl$d_semget$d_semop" in
15296 *"$undef"*) h_sem=false;;
15297 esac
15298 case "$osname" in
15299 freebsd)
15300     case "`ipcs 2>&1`" in
15301     "SVID messages"*"not configured"*)
15302         echo "Your $osname does not have the sem*(2) configured." >&4
15303         h_sem=false
15304         val="$undef"
15305         set semctl d_semctl
15306         eval $setvar
15307         set semget d_semget
15308         eval $setvar
15309         set semop d_semop
15310         eval $setvar
15311         ;;
15312     esac
15313     ;;
15314 esac
15315 : we could also check for sys/ipc.h ...
15316 if $h_sem && $test `./findhdr sys/sem.h`; then
15317         echo "You have the full sem*(2) library." >&4
15318         val="$define"
15319 else
15320         echo "You don't have the full sem*(2) library." >&4
15321         val="$undef"
15322 fi
15323 set d_sem
15324 eval $setvar
15325
15326 : see whether sys/sem.h defines union semun
15327 echo " "
15328 $cat > try.c <<'END'
15329 #include <sys/types.h>
15330 #include <sys/ipc.h>
15331 #include <sys/sem.h>
15332 int main () { union semun semun; semun.buf = 0; }
15333 END
15334 set try
15335 if eval $compile; then
15336     echo "You have union semun in <sys/sem.h>." >&4
15337     val="$define"
15338 else
15339     echo "You do not have union semun in <sys/sem.h>." >&4
15340     val="$undef"
15341 fi
15342 $rm -f try try.c
15343 set d_union_semun
15344 eval $setvar
15345
15346 : see how to do semctl IPC_STAT
15347 case "$d_sem" in
15348 $define)
15349     echo " "
15350     $cat > try.h <<END
15351 #ifndef S_IRUSR
15352 #   ifdef S_IREAD
15353 #       define S_IRUSR S_IREAD
15354 #       define S_IWUSR S_IWRITE
15355 #       define S_IXUSR S_IEXEC
15356 #   else
15357 #       define S_IRUSR 0400
15358 #       define S_IWUSR 0200
15359 #       define S_IXUSR 0100
15360 #   endif
15361 #   define S_IRGRP (S_IRUSR>>3)
15362 #   define S_IWGRP (S_IWUSR>>3)
15363 #   define S_IXGRP (S_IXUSR>>3)
15364 #   define S_IROTH (S_IRUSR>>6)
15365 #   define S_IWOTH (S_IWUSR>>6)
15366 #   define S_IXOTH (S_IXUSR>>6)
15367 #endif
15368 #ifndef S_IRWXU
15369 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15370 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15371 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15372 #endif
15373 END
15374     : see whether semctl IPC_STAT can use union semun
15375     val="$undef"
15376     case "$d_semctl_semun" in
15377     '')
15378       $cat > try.c <<END
15379 #include <sys/types.h>
15380 #include <sys/ipc.h>
15381 #include <sys/sem.h>
15382 #include <sys/stat.h>
15383 #include <stdio.h>
15384 #include <errno.h>
15385 #include "try.h"
15386 #ifndef errno
15387 extern int errno;
15388 #endif
15389 #$d_union_semun HAS_UNION_SEMUN
15390 int main() {
15391     union semun
15392 #ifndef HAS_UNION_SEMUN
15393     {
15394         int val;
15395         struct semid_ds *buf;
15396         unsigned short *array;
15397     }
15398 #endif
15399     arg;
15400     int sem, st;
15401
15402 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15403     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15404     if (sem > -1) {
15405         struct semid_ds argbuf;
15406         arg.buf = &argbuf;
15407 #       ifdef IPC_STAT
15408         st = semctl(sem, 0, IPC_STAT, arg);
15409         if (st == 0)
15410             printf("semun\n");
15411         else
15412 #       endif /* IPC_STAT */
15413             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15414 #       ifdef IPC_RMID
15415         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15416 #       endif /* IPC_RMID */
15417             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15418     } else
15419 #endif /* IPC_PRIVATE && ... */
15420         printf("semget failed: errno = %d\n", errno);
15421   return 0;
15422 }
15423 END
15424       set try
15425       if eval $compile; then
15426           xxx=`$run ./try`
15427           case "$xxx" in
15428           semun) val="$define" ;;
15429           esac
15430       fi
15431       $rm -f try try.c
15432       ;;
15433     esac
15434     set d_semctl_semun
15435     eval $setvar
15436     case "$d_semctl_semun" in
15437     $define)
15438         echo "You can use union semun for semctl IPC_STAT." >&4
15439         also='also'
15440         ;;
15441     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15442         also=''
15443         ;;
15444     esac
15445
15446     : see whether semctl IPC_STAT can use struct semid_ds pointer
15447     val="$undef"
15448     case "$d_semctl_semid_ds" in
15449     '')
15450       $cat > try.c <<'END'
15451 #include <sys/types.h>
15452 #include <sys/ipc.h>
15453 #include <sys/sem.h>
15454 #include <sys/stat.h>
15455 #include "try.h"
15456 #include <stdio.h>
15457 #include <errno.h>
15458 #ifndef errno
15459 extern int errno;
15460 #endif
15461 int main() {
15462     struct semid_ds arg;
15463     int sem, st;
15464
15465 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15466     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15467     if (sem > -1) {
15468 #       ifdef IPC_STAT
15469         st = semctl(sem, 0, IPC_STAT, &arg);
15470         if (st == 0)
15471             printf("semid_ds\n");
15472         else
15473 #       endif /* IPC_STAT */
15474             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15475 #       ifdef IPC_RMID
15476         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15477 #       endif /* IPC_RMID */
15478             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15479     } else
15480 #endif /* IPC_PRIVATE && ... */
15481         printf("semget failed: errno = %d\n", errno);
15482
15483     return 0;
15484 }
15485 END
15486       set try
15487       if eval $compile; then
15488           xxx=`$run ./try`
15489           case "$xxx" in
15490           semid_ds) val="$define" ;;
15491           esac
15492       fi
15493       $rm -f try try.c
15494       ;;
15495     esac
15496     set d_semctl_semid_ds
15497     eval $setvar
15498     case "$d_semctl_semid_ds" in
15499     $define)
15500         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15501         ;;
15502     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15503         ;;
15504     esac
15505     $rm -f try.h
15506     ;;
15507 *)  val="$undef"
15508
15509     # We do not have the full sem*(2) library, so assume we can not
15510     # use either.
15511
15512     set d_semctl_semun
15513     eval $setvar
15514
15515     set d_semctl_semid_ds
15516     eval $setvar
15517     ;;
15518 esac
15519
15520 : see if sendmsg exists
15521 set sendmsg d_sendmsg
15522 eval $inlibc
15523
15524 : see if setegid exists
15525 set setegid d_setegid
15526 eval $inlibc
15527
15528 : see if seteuid exists
15529 set seteuid d_seteuid
15530 eval $inlibc
15531
15532 : see if setgrent exists
15533 set setgrent d_setgrent
15534 eval $inlibc
15535
15536 : see if setgrent_r exists
15537 set setgrent_r d_setgrent_r
15538 eval $inlibc
15539 case "$d_setgrent_r" in
15540 "$define")
15541         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15542         case "$d_setgrent_r_proto:$usethreads" in
15543         ":define")      d_setgrent_r_proto=define
15544                 set d_setgrent_r_proto setgrent_r $hdrs
15545                 eval $hasproto ;;
15546         *)      ;;
15547         esac
15548         case "$d_setgrent_r_proto" in
15549         define)
15550         case "$setgrent_r_proto" in
15551         ''|0) try='int setgrent_r(FILE**);'
15552         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15553         esac
15554         case "$setgrent_r_proto" in
15555         ''|0) try='void setgrent_r(FILE**);'
15556         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15557         esac
15558         case "$setgrent_r_proto" in
15559         ''|0)   d_setgrent_r=undef
15560                 setgrent_r_proto=0
15561                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15562         * )     case "$setgrent_r_proto" in
15563                 REENTRANT_PROTO*) ;;
15564                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15565                 esac
15566                 echo "Prototype: $try" ;;
15567         esac
15568         ;;
15569         *)      case "$usethreads" in
15570                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15571                 esac
15572                 d_setgrent_r=undef
15573                 setgrent_r_proto=0
15574                 ;;
15575         esac
15576         ;;
15577 *)      setgrent_r_proto=0
15578         ;;
15579 esac
15580
15581 : see if sethostent exists
15582 set sethostent d_sethent
15583 eval $inlibc
15584
15585 : see if sethostent_r exists
15586 set sethostent_r d_sethostent_r
15587 eval $inlibc
15588 case "$d_sethostent_r" in
15589 "$define")
15590         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15591         case "$d_sethostent_r_proto:$usethreads" in
15592         ":define")      d_sethostent_r_proto=define
15593                 set d_sethostent_r_proto sethostent_r $hdrs
15594                 eval $hasproto ;;
15595         *)      ;;
15596         esac
15597         case "$d_sethostent_r_proto" in
15598         define)
15599         case "$sethostent_r_proto" in
15600         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15601         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15602         esac
15603         case "$sethostent_r_proto" in
15604         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15605         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15606         esac
15607         case "$sethostent_r_proto" in
15608         ''|0)   d_sethostent_r=undef
15609                 sethostent_r_proto=0
15610                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15611         * )     case "$sethostent_r_proto" in
15612                 REENTRANT_PROTO*) ;;
15613                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15614                 esac
15615                 echo "Prototype: $try" ;;
15616         esac
15617         ;;
15618         *)      case "$usethreads" in
15619                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15620                 esac
15621                 d_sethostent_r=undef
15622                 sethostent_r_proto=0
15623                 ;;
15624         esac
15625         ;;
15626 *)      sethostent_r_proto=0
15627         ;;
15628 esac
15629
15630 : see if setitimer exists
15631 set setitimer d_setitimer
15632 eval $inlibc
15633
15634 : see if setlinebuf exists
15635 set setlinebuf d_setlinebuf
15636 eval $inlibc
15637
15638 : see if setlocale exists
15639 set setlocale d_setlocale
15640 eval $inlibc
15641
15642 : see if locale.h is available
15643 set locale.h i_locale
15644 eval $inhdr
15645
15646 : see if setlocale_r exists
15647 set setlocale_r d_setlocale_r
15648 eval $inlibc
15649 case "$d_setlocale_r" in
15650 "$define")
15651         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15652         case "$d_setlocale_r_proto:$usethreads" in
15653         ":define")      d_setlocale_r_proto=define
15654                 set d_setlocale_r_proto setlocale_r $hdrs
15655                 eval $hasproto ;;
15656         *)      ;;
15657         esac
15658         case "$d_setlocale_r_proto" in
15659         define)
15660         case "$setlocale_r_proto" in
15661         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15662         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15663         esac
15664         case "$setlocale_r_proto" in
15665         ''|0)   d_setlocale_r=undef
15666                 setlocale_r_proto=0
15667                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15668         * )     case "$setlocale_r_proto" in
15669                 REENTRANT_PROTO*) ;;
15670                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15671                 esac
15672                 echo "Prototype: $try" ;;
15673         esac
15674         ;;
15675         *)      case "$usethreads" in
15676                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15677                 esac
15678                 d_setlocale_r=undef
15679                 setlocale_r_proto=0
15680                 ;;
15681         esac
15682         ;;
15683 *)      setlocale_r_proto=0
15684         ;;
15685 esac
15686
15687 : see if setnetent exists
15688 set setnetent d_setnent
15689 eval $inlibc
15690
15691 : see if setnetent_r exists
15692 set setnetent_r d_setnetent_r
15693 eval $inlibc
15694 case "$d_setnetent_r" in
15695 "$define")
15696         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15697         case "$d_setnetent_r_proto:$usethreads" in
15698         ":define")      d_setnetent_r_proto=define
15699                 set d_setnetent_r_proto setnetent_r $hdrs
15700                 eval $hasproto ;;
15701         *)      ;;
15702         esac
15703         case "$d_setnetent_r_proto" in
15704         define)
15705         case "$setnetent_r_proto" in
15706         ''|0) try='int setnetent_r(int, struct netent_data*);'
15707         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15708         esac
15709         case "$setnetent_r_proto" in
15710         ''|0) try='void setnetent_r(int, struct netent_data*);'
15711         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15712         esac
15713         case "$setnetent_r_proto" in
15714         ''|0)   d_setnetent_r=undef
15715                 setnetent_r_proto=0
15716                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15717         * )     case "$setnetent_r_proto" in
15718                 REENTRANT_PROTO*) ;;
15719                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15720                 esac
15721                 echo "Prototype: $try" ;;
15722         esac
15723         ;;
15724         *)      case "$usethreads" in
15725                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15726                 esac
15727                 d_setnetent_r=undef
15728                 setnetent_r_proto=0
15729                 ;;
15730         esac
15731         ;;
15732 *)      setnetent_r_proto=0
15733         ;;
15734 esac
15735
15736 : see if setprotoent exists
15737 set setprotoent d_setpent
15738 eval $inlibc
15739
15740 : see if setpgid exists
15741 set setpgid d_setpgid
15742 eval $inlibc
15743
15744 : see if setpgrp2 exists
15745 set setpgrp2 d_setpgrp2
15746 eval $inlibc
15747
15748 : see if setpriority exists
15749 set setpriority d_setprior
15750 eval $inlibc
15751
15752 : see if setproctitle exists
15753 set setproctitle d_setproctitle
15754 eval $inlibc
15755
15756 : see if setprotoent_r exists
15757 set setprotoent_r d_setprotoent_r
15758 eval $inlibc
15759 case "$d_setprotoent_r" in
15760 "$define")
15761         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15762         case "$d_setprotoent_r_proto:$usethreads" in
15763         ":define")      d_setprotoent_r_proto=define
15764                 set d_setprotoent_r_proto setprotoent_r $hdrs
15765                 eval $hasproto ;;
15766         *)      ;;
15767         esac
15768         case "$d_setprotoent_r_proto" in
15769         define)
15770         case "$setprotoent_r_proto" in
15771         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15772         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15773         esac
15774         case "$setprotoent_r_proto" in
15775         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15776         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15777         esac
15778         case "$setprotoent_r_proto" in
15779         ''|0)   d_setprotoent_r=undef
15780                 setprotoent_r_proto=0
15781                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15782         * )     case "$setprotoent_r_proto" in
15783                 REENTRANT_PROTO*) ;;
15784                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15785                 esac
15786                 echo "Prototype: $try" ;;
15787         esac
15788         ;;
15789         *)      case "$usethreads" in
15790                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15791                 esac
15792                 d_setprotoent_r=undef
15793                 setprotoent_r_proto=0
15794                 ;;
15795         esac
15796         ;;
15797 *)      setprotoent_r_proto=0
15798         ;;
15799 esac
15800
15801 : see if setpwent exists
15802 set setpwent d_setpwent
15803 eval $inlibc
15804
15805 : see if setpwent_r exists
15806 set setpwent_r d_setpwent_r
15807 eval $inlibc
15808 case "$d_setpwent_r" in
15809 "$define")
15810         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15811         case "$d_setpwent_r_proto:$usethreads" in
15812         ":define")      d_setpwent_r_proto=define
15813                 set d_setpwent_r_proto setpwent_r $hdrs
15814                 eval $hasproto ;;
15815         *)      ;;
15816         esac
15817         case "$d_setpwent_r_proto" in
15818         define)
15819         case "$setpwent_r_proto" in
15820         ''|0) try='int setpwent_r(FILE**);'
15821         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15822         esac
15823         case "$setpwent_r_proto" in
15824         ''|0) try='void setpwent_r(FILE**);'
15825         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15826         esac
15827         case "$setpwent_r_proto" in
15828         ''|0)   d_setpwent_r=undef
15829                 setpwent_r_proto=0
15830                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15831         * )     case "$setpwent_r_proto" in
15832                 REENTRANT_PROTO*) ;;
15833                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15834                 esac
15835                 echo "Prototype: $try" ;;
15836         esac
15837         ;;
15838         *)      case "$usethreads" in
15839                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15840                 esac
15841                 d_setpwent_r=undef
15842                 setpwent_r_proto=0
15843                 ;;
15844         esac
15845         ;;
15846 *)      setpwent_r_proto=0
15847         ;;
15848 esac
15849
15850 : see if setregid exists
15851 set setregid d_setregid
15852 eval $inlibc
15853 set setresgid d_setresgid
15854 eval $inlibc
15855
15856 : see if setreuid exists
15857 set setreuid d_setreuid
15858 eval $inlibc
15859 set setresuid d_setresuid
15860 eval $inlibc
15861
15862 : see if setrgid exists
15863 set setrgid d_setrgid
15864 eval $inlibc
15865
15866 : see if setruid exists
15867 set setruid d_setruid
15868 eval $inlibc
15869
15870 : see if setservent exists
15871 set setservent d_setsent
15872 eval $inlibc
15873
15874 : see if setservent_r exists
15875 set setservent_r d_setservent_r
15876 eval $inlibc
15877 case "$d_setservent_r" in
15878 "$define")
15879         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15880         case "$d_setservent_r_proto:$usethreads" in
15881         ":define")      d_setservent_r_proto=define
15882                 set d_setservent_r_proto setservent_r $hdrs
15883                 eval $hasproto ;;
15884         *)      ;;
15885         esac
15886         case "$d_setservent_r_proto" in
15887         define)
15888         case "$setservent_r_proto" in
15889         ''|0) try='int setservent_r(int, struct servent_data*);'
15890         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15891         esac
15892         case "$setservent_r_proto" in
15893         ''|0) try='void setservent_r(int, struct servent_data*);'
15894         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15895         esac
15896         case "$setservent_r_proto" in
15897         ''|0)   d_setservent_r=undef
15898                 setservent_r_proto=0
15899                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15900         * )     case "$setservent_r_proto" in
15901                 REENTRANT_PROTO*) ;;
15902                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15903                 esac
15904                 echo "Prototype: $try" ;;
15905         esac
15906         ;;
15907         *)      case "$usethreads" in
15908                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15909                 esac
15910                 d_setservent_r=undef
15911                 setservent_r_proto=0
15912                 ;;
15913         esac
15914         ;;
15915 *)      setservent_r_proto=0
15916         ;;
15917 esac
15918
15919 : see if setsid exists
15920 set setsid d_setsid
15921 eval $inlibc
15922
15923 : see if setvbuf exists
15924 set setvbuf d_setvbuf
15925 eval $inlibc
15926
15927 : see if sfio.h is available
15928 set sfio.h i_sfio
15929 eval $inhdr
15930
15931
15932 : see if sfio library is available
15933 case "$i_sfio" in
15934 $define)
15935         val=''
15936         set sfreserve val
15937         eval $inlibc
15938         ;;
15939 *)
15940         val="$undef"
15941         ;;
15942 esac
15943 : Ok, but do we want to use it.
15944 case "$val" in
15945 $define)
15946         case "$usesfio" in
15947         true|$define|[yY]*) dflt='y';;
15948         *) dflt='n';;
15949         esac
15950         echo "$package can use the sfio library, but it is experimental."
15951         case "$useperlio" in
15952         "$undef")
15953             echo "For sfio also the PerlIO abstraction layer is needed."
15954             echo "Earlier you said you wouldn't want that."
15955             ;;
15956         esac
15957         rp="You seem to have sfio available, do you want to try using it?"
15958         . ./myread
15959         case "$ans" in
15960         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15961                 useperlio="$define"
15962                 val="$define"
15963                 ;;
15964         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15965                 val="$undef"
15966                 ;;
15967         esac
15968         ;;
15969 *)      case "$usesfio" in
15970         true|$define|[yY]*)
15971                 echo "Sorry, cannot find sfio on this machine." >&4
15972                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15973                 val="$undef"
15974                 ;;
15975         esac
15976         ;;
15977 esac
15978 set d_sfio
15979 eval $setvar
15980 case "$d_sfio" in
15981 $define) usesfio='true';;
15982 *) usesfio='false';;
15983 esac
15984 case "$d_sfio" in
15985 $define) ;;
15986 *)      : Remove sfio from list of libraries to use
15987         case "$libs" in
15988         *-lsfio*)
15989                 echo "Removing unneeded -lsfio from library list" >&4
15990                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15991                 shift
15992                 libs="$*"
15993                 echo "libs = $libs" >&4
15994                 ;;
15995         esac
15996 ;;
15997 esac
15998
15999
16000 : see if shmctl exists
16001 set shmctl d_shmctl
16002 eval $inlibc
16003
16004 : see if shmget exists
16005 set shmget d_shmget
16006 eval $inlibc
16007
16008 : see if shmat exists
16009 set shmat d_shmat
16010 eval $inlibc
16011 : see what shmat returns
16012 case "$d_shmat" in
16013 "$define")
16014         $cat >shmat.c <<'END'
16015 #include <sys/shm.h>
16016 void *shmat();
16017 END
16018         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16019                 shmattype='void *'
16020         else
16021                 shmattype='char *'
16022         fi
16023         echo "and it returns ($shmattype)." >&4
16024         : see if a prototype for shmat is available
16025         xxx=`./findhdr sys/shm.h`
16026         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16027         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16028                 val="$define"
16029         else
16030                 val="$undef"
16031         fi
16032         $rm -f shmat.[co]
16033         ;;
16034 *)
16035         val="$undef"
16036         ;;
16037 esac
16038 set d_shmatprototype
16039 eval $setvar
16040
16041 : see if shmdt exists
16042 set shmdt d_shmdt
16043 eval $inlibc
16044
16045 : see how much of the 'shm*(2)' library is present.
16046 h_shm=true
16047 echo " "
16048 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16049 *"$undef"*) h_shm=false;;
16050 esac
16051 case "$osname" in
16052 freebsd)
16053     case "`ipcs 2>&1`" in
16054     "SVID shared memory"*"not configured"*)
16055         echo "Your $osname does not have the shm*(2) configured." >&4
16056         h_shm=false
16057         val="$undef"
16058         set shmctl d_shmctl
16059         evat $setvar
16060         set shmget d_shmget
16061         evat $setvar
16062         set shmat d_shmat
16063         evat $setvar
16064         set shmdt d_shmdt
16065         evat $setvar
16066         ;;
16067     esac
16068     ;;
16069 esac
16070 : we could also check for sys/ipc.h ...
16071 if $h_shm && $test `./findhdr sys/shm.h`; then
16072         echo "You have the full shm*(2) library." >&4
16073         val="$define"
16074 else
16075         echo "You don't have the full shm*(2) library." >&4
16076         val="$undef"
16077 fi
16078 set d_shm
16079 eval $setvar
16080
16081 echo " "
16082 : see if we have sigaction
16083 if set sigaction val -f d_sigaction; eval $csym; $val; then
16084         echo 'sigaction() found.' >&4
16085         $cat > try.c <<EOP
16086 #include <stdio.h>
16087 #include <sys/types.h>
16088 #include <signal.h>
16089 #$i_stdlib I_STDLIB
16090 #ifdef I_STDLIB
16091 #include <stdlib.h>
16092 #endif
16093 int main()
16094 {
16095     struct sigaction act, oact;
16096     act.sa_flags = 0;
16097     oact.sa_handler = 0;
16098     /* so that act and oact are used */
16099     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16100 }
16101 EOP
16102         set try
16103         if eval $compile_ok; then
16104                 val="$define"
16105         else
16106                 echo "But you don't seem to have a useable struct sigaction." >&4
16107                 val="$undef"
16108         fi
16109 else
16110         echo 'sigaction NOT found.' >&4
16111         val="$undef"
16112 fi
16113 set d_sigaction; eval $setvar
16114 $rm -f try try$_o try.c
16115
16116 : see if sigprocmask exists
16117 set sigprocmask d_sigprocmask
16118 eval $inlibc
16119
16120 : see if sigsetjmp exists
16121 echo " "
16122 case "$d_sigsetjmp" in
16123 '')
16124         $cat >try.c <<EOP
16125 #include <setjmp.h>
16126 #$i_stdlib I_STDLIB
16127 #ifdef I_STDLIB
16128 #include <stdlib.h>
16129 #endif
16130 sigjmp_buf env;
16131 int set = 1;
16132 int main()
16133 {
16134         if (sigsetjmp(env,1))
16135                 exit(set);
16136         set = 0;
16137         siglongjmp(env, 1);
16138         exit(1);
16139 }
16140 EOP
16141         set try
16142         if eval $compile; then
16143                 if $run ./try >/dev/null 2>&1; then
16144                         echo "POSIX sigsetjmp found." >&4
16145                         val="$define"
16146                 else
16147                         $cat >&4 <<EOM
16148 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16149 I'll ignore them.
16150 EOM
16151                         val="$undef"
16152                 fi
16153         else
16154                 echo "sigsetjmp not found." >&4
16155                 val="$undef"
16156         fi
16157         ;;
16158 *) val="$d_sigsetjmp"
16159         case "$d_sigsetjmp" in
16160         $define) echo "POSIX sigsetjmp found." >&4;;
16161         $undef) echo "sigsetjmp not found." >&4;;
16162         esac
16163         ;;
16164 esac
16165 set d_sigsetjmp
16166 eval $setvar
16167 $rm -f try.c try
16168
16169
16170 d_sitecustomize="$undef"
16171 case "$usesitecustomize" in
16172     $define|true|[Yy]*)
16173         usesitecustomize="$define"
16174         d_sitecustomize="$define"
16175         ;;
16176     *)
16177         usesitecustomize="$undef"
16178     esac
16179
16180 : see if sockatmark exists
16181 set sockatmark d_sockatmark
16182 eval $inlibc
16183
16184 : see if prototype for sockatmark is available
16185 echo " "
16186 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16187 eval $hasproto
16188
16189 : see if socks5_init exists
16190 set socks5_init d_socks5_init
16191 eval $inlibc
16192
16193 : see if srand48_r exists
16194 set srand48_r d_srand48_r
16195 eval $inlibc
16196 case "$d_srand48_r" in
16197 "$define")
16198         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16199         case "$d_srand48_r_proto:$usethreads" in
16200         ":define")      d_srand48_r_proto=define
16201                 set d_srand48_r_proto srand48_r $hdrs
16202                 eval $hasproto ;;
16203         *)      ;;
16204         esac
16205         case "$d_srand48_r_proto" in
16206         define)
16207         case "$srand48_r_proto" in
16208         ''|0) try='int srand48_r(long, struct drand48_data*);'
16209         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16210         esac
16211         case "$srand48_r_proto" in
16212         ''|0)   d_srand48_r=undef
16213                 srand48_r_proto=0
16214                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16215         * )     case "$srand48_r_proto" in
16216                 REENTRANT_PROTO*) ;;
16217                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16218                 esac
16219                 echo "Prototype: $try" ;;
16220         esac
16221         ;;
16222         *)      case "$usethreads" in
16223                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16224                 esac
16225                 d_srand48_r=undef
16226                 srand48_r_proto=0
16227                 ;;
16228         esac
16229         ;;
16230 *)      srand48_r_proto=0
16231         ;;
16232 esac
16233
16234 : see if srandom_r exists
16235 set srandom_r d_srandom_r
16236 eval $inlibc
16237 case "$d_srandom_r" in
16238 "$define")
16239         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16240         case "$d_srandom_r_proto:$usethreads" in
16241         ":define")      d_srandom_r_proto=define
16242                 set d_srandom_r_proto srandom_r $hdrs
16243                 eval $hasproto ;;
16244         *)      ;;
16245         esac
16246         case "$d_srandom_r_proto" in
16247         define)
16248         case "$srandom_r_proto" in
16249         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16250         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16251         esac
16252         case "$srandom_r_proto" in
16253         ''|0)   d_srandom_r=undef
16254                 srandom_r_proto=0
16255                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16256         * )     case "$srandom_r_proto" in
16257                 REENTRANT_PROTO*) ;;
16258                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16259                 esac
16260                 echo "Prototype: $try" ;;
16261         esac
16262         ;;
16263         *)      case "$usethreads" in
16264                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16265                 esac
16266                 d_srandom_r=undef
16267                 srandom_r_proto=0
16268                 ;;
16269         esac
16270         ;;
16271 *)      srandom_r_proto=0
16272         ;;
16273 esac
16274
16275 : see if prototype for setresgid is available
16276 echo " "
16277 set d_sresgproto setresgid $i_unistd unistd.h
16278 eval $hasproto
16279
16280 : see if prototype for setresuid is available
16281 echo " "
16282 set d_sresuproto setresuid $i_unistd unistd.h
16283 eval $hasproto
16284
16285 : see if sys/stat.h is available
16286 set sys/stat.h i_sysstat
16287 eval $inhdr
16288
16289
16290 : see if stat knows about block sizes
16291 echo " "
16292 echo "Checking to see if your struct stat has st_blocks field..." >&4
16293 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16294 eval $hasfield
16295
16296
16297 : see if this is a sys/vfs.h system
16298 set sys/vfs.h i_sysvfs
16299 eval $inhdr
16300
16301
16302 : see if this is a sys/statfs.h system
16303 set sys/statfs.h i_sysstatfs
16304 eval $inhdr
16305
16306
16307 echo " "
16308 echo "Checking to see if your system supports struct statfs..." >&4
16309 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
16310 eval $hasstruct
16311 case "$d_statfs_s" in
16312 "$define")      echo "Yes, it does."   ;;
16313 *)              echo "No, it doesn't." ;;
16314 esac
16315
16316
16317
16318 : see if struct statfs knows about f_flags
16319 case "$d_statfs_s" in
16320 define) 
16321         echo " "
16322         echo "Checking to see if your struct statfs has f_flags field..." >&4
16323         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
16324         eval $hasfield
16325         ;;
16326 *)      val="$undef"
16327         set d_statfs_f_flags
16328         eval $setvar
16329         ;;
16330 esac
16331 case "$d_statfs_f_flags" in
16332 "$define")      echo "Yes, it does."   ;;
16333 *)              echo "No, it doesn't." ;;
16334 esac
16335
16336 $cat >&4 <<EOM
16337 Checking how to access stdio streams by file descriptor number...
16338 EOM
16339 case "$stdio_stream_array" in
16340 '')     $cat >try.c <<EOCP
16341 #include <stdio.h>
16342 int main() {
16343   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16344     printf("yes\n");
16345 }
16346 EOCP
16347         for s in _iob __iob __sF
16348         do
16349                 set try -DSTDIO_STREAM_ARRAY=$s
16350                 if eval $compile; then
16351                         case "`$run ./try`" in
16352                         yes)    stdio_stream_array=$s; break ;;
16353                         esac
16354                 fi
16355         done
16356         $rm -f try.* try$exe_ext
16357 esac
16358 case "$stdio_stream_array" in
16359 '')     $cat >&4 <<EOM
16360 I can't figure out how to access stdio streams by file descriptor number.
16361 EOM
16362         d_stdio_stream_array="$undef"
16363         ;;
16364 *)      $cat >&4 <<EOM
16365 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16366 EOM
16367         d_stdio_stream_array="$define"
16368         ;;
16369 esac
16370
16371 : see if strcoll exists
16372 set strcoll d_strcoll
16373 eval $inlibc
16374
16375 : check for structure copying
16376 echo " "
16377 echo "Checking to see if your C compiler can copy structs..." >&4
16378 $cat >try.c <<'EOCP'
16379 int main()
16380 {
16381         struct blurfl {
16382                 int dyick;
16383         } foo, bar;
16384
16385         foo = bar;
16386 }
16387 EOCP
16388 if $cc -c try.c >/dev/null 2>&1 ; then
16389         val="$define"
16390         echo "Yup, it can."
16391 else
16392         val="$undef"
16393         echo "Nope, it can't."
16394 fi
16395 set d_strctcpy
16396 eval $setvar
16397 $rm -f try.*
16398
16399 : see if strerror and/or sys_errlist[] exist
16400 echo " "
16401 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16402     if set strerror val -f d_strerror; eval $csym; $val; then
16403                 echo 'strerror() found.' >&4
16404                 d_strerror="$define"
16405                 d_strerrm='strerror(e)'
16406                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16407                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16408                         d_syserrlst="$define"
16409                 else
16410                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16411                         d_syserrlst="$undef"
16412                 fi
16413     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16414                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16415                 echo 'strerror() found in string header.' >&4
16416                 d_strerror="$define"
16417                 d_strerrm='strerror(e)'
16418                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16419                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16420                                 d_syserrlst="$define"
16421                 else
16422                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16423                         d_syserrlst="$undef"
16424                 fi
16425     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16426                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16427                 d_strerror="$undef"
16428                 d_syserrlst="$define"
16429                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16430     else
16431                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16432                 d_strerror="$undef"
16433                 d_syserrlst="$undef"
16434                 d_strerrm='"unknown"'
16435     fi
16436 fi
16437
16438 : see if strerror_r exists
16439 set strerror_r d_strerror_r
16440 eval $inlibc
16441 case "$d_strerror_r" in
16442 "$define")
16443         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16444         case "$d_strerror_r_proto:$usethreads" in
16445         ":define")      d_strerror_r_proto=define
16446                 set d_strerror_r_proto strerror_r $hdrs
16447                 eval $hasproto ;;
16448         *)      ;;
16449         esac
16450         case "$d_strerror_r_proto" in
16451         define)
16452         case "$strerror_r_proto" in
16453         ''|0) try='int strerror_r(int, char*, size_t);'
16454         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16455         esac
16456         case "$strerror_r_proto" in
16457         ''|0) try='int strerror_r(int, char*, int);'
16458         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16459         esac
16460         case "$strerror_r_proto" in
16461         ''|0) try='char* strerror_r(int, char*, size_t);'
16462         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16463         esac
16464         case "$strerror_r_proto" in
16465         ''|0)   d_strerror_r=undef
16466                 strerror_r_proto=0
16467                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16468         * )     case "$strerror_r_proto" in
16469                 REENTRANT_PROTO*) ;;
16470                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16471                 esac
16472                 echo "Prototype: $try" ;;
16473         esac
16474         ;;
16475         *)      case "$usethreads" in
16476                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16477                 esac
16478                 d_strerror_r=undef
16479                 strerror_r_proto=0
16480                 ;;
16481         esac
16482         ;;
16483 *)      strerror_r_proto=0
16484         ;;
16485 esac
16486
16487 : see if strftime exists
16488 set strftime d_strftime
16489 eval $inlibc
16490
16491 : see if strlcat exists
16492 set strlcat d_strlcat
16493 eval $inlibc
16494
16495 : see if strlcpy exists
16496 set strlcpy d_strlcpy
16497 eval $inlibc
16498
16499 : see if strtod exists
16500 set strtod d_strtod
16501 eval $inlibc
16502
16503 : see if strtol exists
16504 set strtol d_strtol
16505 eval $inlibc
16506
16507 : see if strtold exists
16508 set strtold d_strtold
16509 eval $inlibc
16510
16511 : see if strtoll exists
16512 set strtoll d_strtoll
16513 eval $inlibc
16514
16515 case "$d_longlong-$d_strtoll" in
16516 "$define-$define")
16517         $cat <<EOM
16518 Checking whether your strtoll() works okay...
16519 EOM
16520         $cat >try.c <<'EOCP'
16521 #include <errno.h>
16522 #ifdef __hpux
16523 #define strtoll __strtoll
16524 #endif
16525 #ifdef __EMX__
16526 #define strtoll _strtoll
16527 #endif
16528 #include <stdio.h>
16529 extern long long int strtoll(char *s, char **, int); 
16530 static int bad = 0;
16531 int check(char *s, long long ell, int een) {
16532         long long gll;
16533         errno = 0;
16534         gll = strtoll(s, 0, 10);
16535         if (!((gll == ell) && (errno == een)))
16536                 bad++;
16537 }
16538 int main() {
16539         check(" 1",                                      1LL, 0);
16540         check(" 0",                                      0LL, 0);
16541         check("-1",                                     -1LL, 0);
16542         check("-9223372036854775808", -9223372036854775808LL, 0);
16543         check("-9223372036854775808", -9223372036854775808LL, 0);
16544         check(" 9223372036854775807",  9223372036854775807LL, 0);
16545         check("-9223372036854775808", -9223372036854775808LL, 0);
16546         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16547         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16548         if (!bad)
16549                 printf("ok\n");
16550 }
16551 EOCP
16552         set try
16553         if eval $compile; then
16554                 yyy=`$run ./try`
16555                 case "$yyy" in
16556                 ok) echo "Your strtoll() seems to be working okay." ;;
16557                 *) cat <<EOM >&4
16558 Your strtoll() doesn't seem to be working okay.
16559 EOM
16560                    d_strtoll="$undef"
16561                    ;;
16562                 esac
16563         else
16564                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16565                 d_strtoll="$undef"
16566         fi
16567         ;;
16568 esac
16569
16570 : see if strtoq exists
16571 set strtoq d_strtoq
16572 eval $inlibc
16573
16574 : see if strtoul exists
16575 set strtoul d_strtoul
16576 eval $inlibc
16577
16578 case "$d_strtoul" in
16579 "$define")
16580         $cat <<EOM
16581 Checking whether your strtoul() works okay...
16582 EOM
16583         $cat >try.c <<'EOCP'
16584 #include <errno.h>
16585 #include <stdio.h>
16586 extern unsigned long int strtoul(char *s, char **, int); 
16587 static int bad = 0;
16588 void check(char *s, unsigned long eul, int een) {
16589         unsigned long gul;
16590         errno = 0;
16591         gul = strtoul(s, 0, 10);
16592         if (!((gul == eul) && (errno == een)))
16593                 bad++;
16594 }
16595 int main() {
16596         check(" 1", 1L, 0);
16597         check(" 0", 0L, 0);
16598 EOCP
16599         case "$longsize" in
16600         8)
16601             $cat >>try.c <<'EOCP'
16602         check("18446744073709551615", 18446744073709551615UL, 0);
16603         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16604 #if 0 /* strtoul() for /^-/ strings is undefined. */
16605         check("-1", 18446744073709551615UL, 0);
16606         check("-18446744073709551614", 2, 0);
16607         check("-18446744073709551615", 1, 0);
16608         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16609         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16610 #endif
16611 EOCP
16612                 ;;
16613         4)
16614                     $cat >>try.c <<'EOCP'
16615         check("4294967295", 4294967295UL, 0);
16616         check("4294967296", 4294967295UL, ERANGE);
16617 #if 0 /* strtoul() for /^-/ strings is undefined. */
16618         check("-1", 4294967295UL, 0);
16619         check("-4294967294", 2, 0);
16620         check("-4294967295", 1, 0);
16621         check("-4294967296", 4294967295UL, ERANGE);
16622         check("-4294967297", 4294967295UL, ERANGE);
16623 #endif
16624 EOCP
16625                 ;;
16626         *)
16627 : Should we write these tests to be more portable by sprintf-ing
16628 : ~0 and then manipulating that char string as input for strtol?
16629                 ;;
16630         esac
16631         $cat >>try.c <<'EOCP'
16632         if (!bad)
16633                 printf("ok\n");
16634         return 0;
16635 }
16636 EOCP
16637         set try
16638         if eval $compile; then
16639                 case "`$run ./try`" in
16640                 ok) echo "Your strtoul() seems to be working okay." ;;
16641                 *) cat <<EOM >&4
16642 Your strtoul() doesn't seem to be working okay.
16643 EOM
16644                    d_strtoul="$undef"
16645                    ;;
16646                 esac
16647         fi
16648         ;;
16649 esac
16650
16651 : see if strtoull exists
16652 set strtoull d_strtoull
16653 eval $inlibc
16654
16655 case "$d_longlong-$d_strtoull" in
16656 "$define-$define")
16657         $cat <<EOM
16658 Checking whether your strtoull() works okay...
16659 EOM
16660         $cat >try.c <<'EOCP'
16661 #include <errno.h>
16662 #ifdef __hpux
16663 #define strtoull __strtoull
16664 #endif
16665 #include <stdio.h>
16666 extern unsigned long long int strtoull(char *s, char **, int); 
16667 static int bad = 0;
16668 int check(char *s, long long eull, int een) {
16669         long long gull;
16670         errno = 0;
16671         gull = strtoull(s, 0, 10);
16672         if (!((gull == eull) && (errno == een)))
16673                 bad++;
16674 }
16675 int main() {
16676         check(" 1",                                        1LL, 0);
16677         check(" 0",                                        0LL, 0);
16678         check("18446744073709551615",  18446744073709551615ULL, 0);
16679         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16680 #if 0 /* strtoull() for /^-/ strings is undefined. */
16681         check("-1",                    18446744073709551615ULL, 0);
16682         check("-18446744073709551614",                     2LL, 0);
16683         check("-18446744073709551615",                     1LL, 0);
16684         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16685         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16686 #endif
16687         if (!bad)
16688                 printf("ok\n");
16689 }
16690 EOCP
16691         set try
16692         if eval $compile; then
16693                 case "`$run ./try`" in
16694                 ok) echo "Your strtoull() seems to be working okay." ;;
16695                 *) cat <<EOM >&4
16696 Your strtoull() doesn't seem to be working okay.
16697 EOM
16698                    d_strtoull="$undef"
16699                    ;;
16700                 esac
16701         fi
16702         ;;
16703 esac
16704
16705 : see if strtouq exists
16706 set strtouq d_strtouq
16707 eval $inlibc
16708
16709 case "$d_strtouq" in
16710 "$define")
16711         $cat <<EOM
16712 Checking whether your strtouq() works okay...
16713 EOM
16714         $cat >try.c <<'EOCP'
16715 #include <errno.h>
16716 #include <stdio.h>
16717 extern unsigned long long int strtouq(char *s, char **, int); 
16718 static int bad = 0;
16719 void check(char *s, unsigned long long eull, int een) {
16720         unsigned long long gull;
16721         errno = 0;
16722         gull = strtouq(s, 0, 10);
16723         if (!((gull == eull) && (errno == een)))
16724                 bad++;
16725 }
16726 int main() {
16727         check(" 1",                                        1LL, 0);
16728         check(" 0",                                        0LL, 0);
16729         check("18446744073709551615",  18446744073709551615ULL, 0);
16730         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16731 #if 0 /* strtouq() for /^-/ strings is undefined. */
16732         check("-1",                    18446744073709551615ULL, 0);
16733         check("-18446744073709551614",                     2LL, 0);
16734         check("-18446744073709551615",                     1LL, 0);
16735         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16736         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16737 #endif
16738         if (!bad)
16739                 printf("ok\n");
16740         return 0;
16741 }
16742 EOCP
16743         set try
16744         if eval $compile; then
16745                 case "`$run ./try`" in
16746                 ok) echo "Your strtouq() seems to be working okay." ;;
16747                 *) cat <<EOM >&4
16748 Your strtouq() doesn't seem to be working okay.
16749 EOM
16750                    d_strtouq="$undef"
16751                    ;;
16752                 esac
16753         fi
16754         ;;
16755 esac
16756
16757 : see if strxfrm exists
16758 set strxfrm d_strxfrm
16759 eval $inlibc
16760
16761 : see if symlink exists
16762 set symlink d_symlink
16763 eval $inlibc
16764
16765 : see if syscall exists
16766 set syscall d_syscall
16767 eval $inlibc
16768
16769 : see if prototype for syscall is available
16770 echo " "
16771 set d_syscallproto syscall $i_unistd unistd.h
16772 eval $hasproto
16773
16774 : see if sysconf exists
16775 set sysconf d_sysconf
16776 eval $inlibc
16777
16778 : see if system exists
16779 set system d_system
16780 eval $inlibc
16781
16782 : see if tcgetpgrp exists
16783 set tcgetpgrp d_tcgetpgrp
16784 eval $inlibc
16785
16786 : see if tcsetpgrp exists
16787 set tcsetpgrp d_tcsetpgrp
16788 eval $inlibc
16789
16790 : see if prototype for telldir is available
16791 echo " "
16792 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16793 eval $hasproto
16794
16795 : see if time exists
16796 echo " "
16797 if test "X$d_time" = X -o X"$timetype" = X; then
16798     if set time val -f d_time; eval $csym; $val; then
16799                 echo 'time() found.' >&4
16800                 val="$define"
16801                 rp="What is the type returned by time() on this system?"
16802                 set time_t timetype long stdio.h sys/types.h
16803                 eval $typedef_ask
16804     else
16805                 echo 'time() not found, hope that will do.' >&4
16806                 val="$undef"
16807                 timetype='int';
16808     fi
16809     set d_time
16810     eval $setvar
16811 fi
16812
16813 : see if this is a sys/times.h system
16814 set sys/times.h i_systimes
16815 eval $inhdr
16816
16817 : see if times exists
16818 echo " "
16819 if set times val -f d_times; eval $csym; $val; then
16820         echo 'times() found.' >&4
16821         d_times="$define"
16822         inc=''
16823         case "$i_systimes" in
16824         "$define") inc='sys/times.h';;
16825         esac
16826         rp="What is the type returned by times() on this system?"
16827         set clock_t clocktype long stdio.h sys/types.h $inc
16828         eval $typedef_ask
16829 else
16830         echo 'times() NOT found, hope that will do.' >&4
16831         d_times="$undef"
16832         clocktype='int'
16833 fi
16834
16835 : see if tmpnam_r exists
16836 set tmpnam_r d_tmpnam_r
16837 eval $inlibc
16838 case "$d_tmpnam_r" in
16839 "$define")
16840         hdrs="$i_systypes sys/types.h define stdio.h "
16841         case "$d_tmpnam_r_proto:$usethreads" in
16842         ":define")      d_tmpnam_r_proto=define
16843                 set d_tmpnam_r_proto tmpnam_r $hdrs
16844                 eval $hasproto ;;
16845         *)      ;;
16846         esac
16847         case "$d_tmpnam_r_proto" in
16848         define)
16849         case "$tmpnam_r_proto" in
16850         ''|0) try='char* tmpnam_r(char*);'
16851         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16852         esac
16853         case "$tmpnam_r_proto" in
16854         ''|0)   d_tmpnam_r=undef
16855                 tmpnam_r_proto=0
16856                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16857         * )     case "$tmpnam_r_proto" in
16858                 REENTRANT_PROTO*) ;;
16859                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16860                 esac
16861                 echo "Prototype: $try" ;;
16862         esac
16863         ;;
16864         *)      case "$usethreads" in
16865                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16866                 esac
16867                 d_tmpnam_r=undef
16868                 tmpnam_r_proto=0
16869                 ;;
16870         esac
16871         ;;
16872 *)      tmpnam_r_proto=0
16873         ;;
16874 esac
16875
16876 : see if truncate exists
16877 set truncate d_truncate
16878 eval $inlibc
16879
16880 : see if ttyname_r exists
16881 set ttyname_r d_ttyname_r
16882 eval $inlibc
16883 case "$d_ttyname_r" in
16884 "$define")
16885         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16886         case "$d_ttyname_r_proto:$usethreads" in
16887         ":define")      d_ttyname_r_proto=define
16888                 set d_ttyname_r_proto ttyname_r $hdrs
16889                 eval $hasproto ;;
16890         *)      ;;
16891         esac
16892         case "$d_ttyname_r_proto" in
16893         define)
16894         case "$ttyname_r_proto" in
16895         ''|0) try='int ttyname_r(int, char*, size_t);'
16896         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16897         esac
16898         case "$ttyname_r_proto" in
16899         ''|0) try='int ttyname_r(int, char*, int);'
16900         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16901         esac
16902         case "$ttyname_r_proto" in
16903         ''|0) try='char* ttyname_r(int, char*, int);'
16904         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16905         esac
16906         case "$ttyname_r_proto" in
16907         ''|0)   d_ttyname_r=undef
16908                 ttyname_r_proto=0
16909                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16910         * )     case "$ttyname_r_proto" in
16911                 REENTRANT_PROTO*) ;;
16912                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16913                 esac
16914                 echo "Prototype: $try" ;;
16915         esac
16916         ;;
16917         *)      case "$usethreads" in
16918                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16919                 esac
16920                 d_ttyname_r=undef
16921                 ttyname_r_proto=0
16922                 ;;
16923         esac
16924         ;;
16925 *)      ttyname_r_proto=0
16926         ;;
16927 esac
16928
16929 : see if tzname[] exists
16930 echo " "
16931 if set tzname val -a d_tzname; eval $csym; $val; then
16932         val="$define"
16933         echo 'tzname[] found.' >&4
16934 else
16935         val="$undef"
16936         echo 'tzname[] NOT found.' >&4
16937 fi
16938 set d_tzname
16939 eval $setvar
16940
16941 case "$osname" in
16942 next|rhapsody|darwin) multiarch="$define" ;;
16943 esac
16944 case "$multiarch" in
16945 ''|[nN]*) multiarch="$undef" ;;
16946 esac
16947
16948 : check for ordering of bytes in a UV
16949 echo " "
16950 case "$usecrosscompile$multiarch" in
16951 *$define*)
16952         $cat <<EOM
16953 You seem to be either cross-compiling or doing a multiarchitecture build,
16954 skipping the byteorder check.
16955
16956 EOM
16957         byteorder='ffff'
16958         ;;
16959 *)
16960         case "$byteorder" in
16961         '')
16962                 $cat <<'EOM'
16963 In the following, larger digits indicate more significance.  A big-endian
16964 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16965 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16966 machines may have weird orders like 3412.  A Cray will report 87654321,
16967 an Alpha will report 12345678. If the test program works the default is
16968 probably right.
16969 I'm now running the test program...
16970 EOM
16971                 $cat >try.c <<EOCP
16972 #include <stdio.h>
16973 #$i_stdlib I_STDLIB
16974 #ifdef I_STDLIB
16975 #include <stdlib.h>
16976 #endif
16977 #include <sys/types.h>
16978 typedef $uvtype UV;
16979 int main()
16980 {
16981         int i;
16982         union {
16983                 UV l;
16984                 char c[$uvsize];
16985         } u;
16986
16987         if ($uvsize > 4)
16988                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16989         else
16990                 u.l = (UV)0x04030201;
16991         for (i = 0; i < $uvsize; i++)
16992                 printf("%c", u.c[i]+'0');
16993         printf("\n");
16994         exit(0);
16995 }
16996 EOCP
16997                 xxx_prompt=y
16998                 set try
16999                 if eval $compile && ./try > /dev/null; then
17000                         dflt=`$run ./try`
17001                         case "$dflt" in
17002                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17003                                 echo "(The test program ran ok.)"
17004                                 echo "byteorder=$dflt"
17005                                 xxx_prompt=n
17006                         ;;
17007                         ????|????????) echo "(The test program ran ok.)" ;;
17008                         *) echo "(The test program didn't run right for some reason.)" ;;
17009                         esac
17010                 else
17011                         dflt='4321'
17012                         cat <<'EOM'
17013 (I can't seem to compile the test program.  Guessing big-endian...)
17014 EOM
17015                 fi
17016                 case "$xxx_prompt" in
17017                 y)
17018                         rp="What is the order of bytes in $uvtype?"
17019                         . ./myread
17020                         byteorder="$ans"
17021                         ;;
17022                 *)      byteorder=$dflt
17023                         ;;
17024                 esac
17025                 ;;
17026         esac
17027         $rm -f try.c try
17028         ;;
17029 esac
17030
17031
17032 $cat <<EOM
17033
17034 Checking to see whether you can access character data unalignedly...
17035 EOM
17036 case "$d_u32align" in
17037 '')   $cat >try.c <<EOCP
17038 #include <stdio.h>
17039 #$i_stdlib I_STDLIB
17040 #ifdef I_STDLIB
17041 #include <stdlib.h>
17042 #endif
17043 #define U32 $u32type
17044 #define BYTEORDER 0x$byteorder
17045 #define U8 $u8type
17046 #include <signal.h>
17047 #ifdef SIGBUS
17048 $signal_t bletch(s) int s; { exit(4); }
17049 #endif
17050 int main() {
17051 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17052     U8 buf[8];
17053     U32 *up;
17054     int i;
17055
17056     if (sizeof(U32) != 4) {
17057         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17058         exit(1);
17059     }
17060
17061     fflush(stdout);
17062
17063 #ifdef SIGBUS
17064     signal(SIGBUS, bletch);
17065 #endif
17066
17067     buf[0] = 0;
17068     buf[1] = 0;
17069     buf[2] = 0;
17070     buf[3] = 1;
17071     buf[4] = 0;
17072     buf[5] = 0;
17073     buf[6] = 0;
17074     buf[7] = 1;
17075
17076     for (i = 0; i < 4; i++) {
17077         up = (U32*)(buf + i);
17078         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17079                (*up == 1 << (8*(3-i)))  /* little-endian */
17080               )
17081            )
17082         {
17083             printf("read failed (%x)\n", *up);
17084             exit(2);
17085         }
17086     }
17087
17088     /* write test */
17089     for (i = 0; i < 4; i++) {
17090         up = (U32*)(buf + i);
17091         *up = 0xBeef;
17092         if (*up != 0xBeef) {
17093             printf("write failed (%x)\n", *up);
17094             exit(3);
17095         }
17096     }
17097
17098     exit(0);
17099 #else
17100     printf("1\n");
17101     exit(1);
17102 #endif
17103     return 0;
17104 }
17105 EOCP
17106 set try
17107 if eval $compile_ok; then
17108         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17109         $run ./try 2>&1 >/dev/null
17110         case "$?" in
17111         0)      cat >&4 <<EOM
17112 You can access character data pretty unalignedly.
17113 EOM
17114                 d_u32align="$undef"
17115                 ;;
17116         *)      cat >&4 <<EOM
17117 It seems that you must access character data in an aligned manner.
17118 EOM
17119                 d_u32align="$define"
17120                 ;;
17121         esac
17122 else
17123         rp='Can you access character data at unaligned addresses?'
17124         dflt='n'
17125         . ./myread
17126         case "$ans" in
17127         [yY]*)  d_u32align="$undef"  ;;
17128         *)      d_u32align="$define" ;;
17129         esac
17130 fi
17131 $rm -f core core.try.* try.core
17132 ;;
17133 esac
17134
17135 : see if ualarm exists
17136 set ualarm d_ualarm
17137 eval $inlibc
17138
17139 : see if umask exists
17140 set umask d_umask
17141 eval $inlibc
17142
17143 : see if unordered exists
17144 set unordered d_unordered
17145 eval $inlibc
17146
17147 : see if usleep exists
17148 set usleep d_usleep
17149 eval $inlibc
17150
17151 : see if prototype for usleep is available
17152 echo " "
17153 set d_usleepproto usleep $i_unistd unistd.h
17154 eval $hasproto
17155
17156 : see if ustat exists
17157 set ustat d_ustat
17158 eval $inlibc
17159
17160 : backward compatibility for d_hvfork
17161 if test X$d_hvfork != X; then
17162         d_vfork="$d_hvfork"
17163         d_hvfork=''
17164 fi
17165 : see if there is a vfork
17166 val=''
17167 set vfork val
17168 eval $inlibc
17169
17170 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17171 : perl on Solaris 2.x, and probably elsewhere.
17172 case "$val" in
17173 $define)
17174         echo " "
17175         case "$usevfork" in
17176         false) dflt='n';;
17177         *) dflt='y';;
17178         esac
17179         cat <<'EOM'
17180  
17181 Perl can only use a vfork() that doesn't suffer from strict
17182 restrictions on calling functions or modifying global data in
17183 the child.  For example, glibc-2.1 contains such a vfork()
17184 that is unsuitable.  If your system provides a proper fork()
17185 call, chances are that you do NOT want perl to use vfork().
17186
17187 EOM
17188         rp="Do you still want to use vfork()?"
17189         . ./myread
17190         case "$ans" in
17191         y|Y) ;;
17192         *)
17193                 echo "Ok, we won't use vfork()."
17194                 val="$undef"
17195                 ;;
17196         esac
17197         ;;
17198 esac
17199 set d_vfork
17200 eval $setvar
17201 case "$d_vfork" in
17202 $define) usevfork='true';;
17203 *) usevfork='false';;
17204 esac
17205
17206 : see if closedir exists
17207 set closedir d_closedir
17208 eval $inlibc
17209
17210 case "$d_closedir" in
17211 "$define")
17212         echo " "
17213         echo "Checking whether closedir() returns a status..." >&4
17214         cat > try.c <<EOM
17215 #$i_dirent I_DIRENT             /**/
17216 #$i_sysdir I_SYS_DIR            /**/
17217 #$i_sysndir I_SYS_NDIR          /**/
17218 #$i_systypes I_SYS_TYPES        /**/
17219
17220 #if defined(I_SYS_TYPES)
17221 #include <sys/types.h>
17222 #endif
17223 #if defined(I_DIRENT)
17224 #include <dirent.h>
17225 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17226 #include <sys/dir.h>
17227 #endif
17228 #else
17229 #ifdef I_SYS_NDIR
17230 #include <sys/ndir.h>
17231 #else
17232 #ifdef I_SYS_DIR
17233 #ifdef hp9000s500
17234 #include <ndir.h>       /* may be wrong in the future */
17235 #else
17236 #include <sys/dir.h>
17237 #endif
17238 #endif
17239 #endif
17240 #endif 
17241 int main() { return closedir(opendir(".")); }
17242 EOM
17243         set try
17244         if eval $compile_ok; then
17245                 if $run ./try > /dev/null 2>&1 ; then
17246                         echo "Yes, it does."
17247                         val="$undef"
17248                 else
17249                         echo "No, it doesn't."
17250                         val="$define"
17251                 fi
17252         else
17253                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17254                 val="$define"
17255         fi
17256         ;;
17257 *)
17258         val="$undef";
17259         ;;
17260 esac
17261 set d_void_closedir
17262 eval $setvar
17263 $rm -f try try.*
17264 : see if there is a wait4
17265 set wait4 d_wait4
17266 eval $inlibc
17267
17268 : see if waitpid exists
17269 set waitpid d_waitpid
17270 eval $inlibc
17271
17272 : see if wcstombs exists
17273 set wcstombs d_wcstombs
17274 eval $inlibc
17275
17276 : see if wctomb exists
17277 set wctomb d_wctomb
17278 eval $inlibc
17279
17280 : see if writev exists
17281 set writev d_writev
17282 eval $inlibc
17283
17284 : preserve RCS keywords in files with variable substitution, grrr
17285 Date='$Date'
17286 Id='$Id'
17287 Log='$Log'
17288 RCSfile='$RCSfile'
17289 Revision='$Revision'
17290
17291 : check for alignment requirements
17292 echo " "
17293 case "$usecrosscompile$multiarch" in
17294 *$define*)
17295         $cat <<EOM
17296 You seem to be either cross-compiling or doing a multiarchitecture build,
17297 skipping the memory alignment check.
17298
17299 EOM
17300         case "$alignbytes" in
17301         '') alignbytes=8 ;;
17302         esac
17303         ;;
17304 *)
17305         case "$alignbytes" in
17306         '') echo "Checking alignment constraints..." >&4
17307                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17308                         $cat >try.c <<'EOCP'
17309 typedef long double NV;
17310 EOCP
17311                 else
17312                         $cat >try.c <<'EOCP'
17313 typedef double NV;
17314 EOCP
17315                 fi
17316                 $cat >>try.c <<'EOCP'
17317 #include <stdio.h>
17318 struct foobar {
17319         char foo;
17320         NV bar;
17321 } try_algn;
17322 int main()
17323 {
17324     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17325     return(0);
17326 }
17327 EOCP
17328                 set try
17329                 if eval $compile_ok; then
17330                         dflt=`$run ./try`
17331                 else
17332                         dflt='8'
17333                         echo "(I can't seem to compile the test program...)"
17334                 fi
17335                 ;;
17336         *) dflt="$alignbytes"
17337                 ;;
17338         esac
17339         rp="Doubles must be aligned on a how-many-byte boundary?"
17340         . ./myread
17341         alignbytes="$ans"
17342         $rm -f try.c try
17343         ;;
17344 esac
17345
17346
17347 : set the base revision
17348 baserev=5.0
17349
17350 : how do we concatenate cpp tokens here?
17351 echo " "
17352 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17353 $cat >cpp_stuff.c <<'EOCP'
17354 #define RCAT(a,b)a/**/b
17355 #define ACAT(a,b)a ## b
17356 RCAT(Rei,ser)
17357 ACAT(Cir,cus)
17358 EOCP
17359 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17360 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17361         echo "Oh!  Smells like ANSI's been here." >&4
17362         echo "We can catify or stringify, separately or together!"
17363         cpp_stuff=42
17364 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17365         echo "Ah, yes!  The good old days!" >&4
17366         echo "However, in the good old days we don't know how to stringify and"
17367         echo "catify at the same time."
17368         cpp_stuff=1
17369 else
17370         $cat >&4 <<EOM
17371 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17372 You're going to have to edit the values of CAT[2-5] in config.h...
17373 EOM
17374         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17375 fi
17376 $rm -f cpp_stuff.*
17377
17378 : see if this is a db.h system
17379 set db.h i_db
17380 eval $inhdr
17381
17382 case "$i_db" in
17383 $define)
17384         : Check db version.
17385         echo " "
17386         echo "Checking Berkeley DB version ..." >&4
17387         $cat >try.c <<EOCP
17388 #$d_const HASCONST
17389 #ifndef HASCONST
17390 #define const
17391 #endif
17392 #include <sys/types.h>
17393 #include <stdio.h>
17394 #$i_stdlib I_STDLIB
17395 #ifdef I_STDLIB
17396 #include <stdlib.h>
17397 #endif
17398 #include <db.h>
17399 int main(int argc, char *argv[])
17400 {
17401 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17402     int Major, Minor, Patch ;
17403     unsigned long Version ;
17404     (void)db_version(&Major, &Minor, &Patch) ;
17405     if (argc == 2) {
17406         printf("%d %d %d %d %d %d\n",
17407                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17408                Major, Minor, Patch);
17409         exit(0);
17410     }
17411     printf("You have Berkeley DB Version 2 or greater.\n");
17412
17413     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17414                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17415     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17416                 Major, Minor, Patch) ;
17417
17418     /* check that db.h & libdb are compatible */
17419     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17420         printf("db.h and libdb are incompatible.\n") ;
17421         exit(3);        
17422     }
17423
17424     printf("db.h and libdb are compatible.\n") ;
17425
17426     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17427                 + DB_VERSION_PATCH ;
17428
17429     /* needs to be >= 2.3.4 */
17430     if (Version < 2003004) {
17431     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17432         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17433         exit(2);        
17434     }
17435
17436     exit(0);
17437 #else
17438 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17439     if (argc == 2) {
17440         printf("1 0 0\n");
17441         exit(0);
17442     }
17443     printf("You have Berkeley DB Version 1.\n");
17444     exit(0);    /* DB version < 2: the coast is clear. */
17445 #else
17446     exit(1);    /* <db.h> not Berkeley DB? */
17447 #endif
17448 #endif
17449 }
17450 EOCP
17451         set try
17452         if eval $compile_ok && $run ./try; then
17453                 echo 'Looks OK.' >&4
17454                 set `$run ./try 1`
17455                 db_version_major=$1
17456                 db_version_minor=$2
17457                 db_version_patch=$3
17458         else
17459                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17460                 i_db=$undef
17461                 case " $libs " in
17462                 *"-ldb "*)
17463                         : Remove db from list of libraries to use
17464                         echo "Removing unusable -ldb from library list" >&4
17465                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17466                         shift
17467                         libs="$*"
17468                         echo "libs = $libs" >&4
17469                         ;;
17470                 esac
17471         fi
17472         $rm -f try.*
17473         ;;
17474 esac
17475
17476 case "$i_db" in
17477 define)
17478         : Check the return type needed for hash 
17479         echo " "
17480         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17481         $cat >try.c <<EOCP
17482 #$d_const HASCONST
17483 #ifndef HASCONST
17484 #define const
17485 #endif
17486 #include <sys/types.h>
17487 #include <db.h>
17488
17489 #ifndef DB_VERSION_MAJOR
17490 u_int32_t hash_cb (ptr, size)
17491 const void *ptr;
17492 size_t size;
17493 {
17494 }
17495 HASHINFO info;
17496 int main()
17497 {
17498         info.hash = hash_cb;
17499 }
17500 #endif
17501 EOCP
17502         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17503                 if $contains warning try.out >>/dev/null 2>&1 ; then
17504                         db_hashtype='int'
17505                 else
17506                         db_hashtype='u_int32_t'
17507                 fi
17508         else
17509                 : XXX Maybe we should just give up here.
17510                 db_hashtype=u_int32_t
17511                 $cat try.out >&4
17512                 echo "Help:  I can't seem to compile the db test program." >&4
17513                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17514         fi
17515         $rm -f try.*
17516         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17517         ;;
17518 *)      db_hashtype=u_int32_t
17519         ;;
17520 esac
17521 case "$i_db" in
17522 define)
17523         : Check the return type needed for prefix 
17524         echo " "
17525         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17526         cat >try.c <<EOCP
17527 #$d_const HASCONST
17528 #ifndef HASCONST
17529 #define const
17530 #endif
17531 #include <sys/types.h>
17532 #include <db.h>
17533
17534 #ifndef DB_VERSION_MAJOR
17535 size_t prefix_cb (key1, key2)
17536 const DBT *key1;
17537 const DBT *key2;
17538 {
17539 }
17540 BTREEINFO info;
17541 int main()
17542 {
17543         info.prefix = prefix_cb;
17544 }
17545 #endif
17546 EOCP
17547         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17548                 if $contains warning try.out >>/dev/null 2>&1 ; then
17549                         db_prefixtype='int'
17550                 else
17551                         db_prefixtype='size_t'
17552                 fi
17553         else
17554                 db_prefixtype='size_t'
17555                 : XXX Maybe we should just give up here.
17556                 $cat try.out >&4
17557                 echo "Help:  I can't seem to compile the db test program." >&4
17558                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17559         fi
17560         $rm -f try.*
17561         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17562         ;;
17563 *)      db_prefixtype='size_t'
17564         ;;
17565 esac
17566
17567
17568 : How can we generate normalized random numbers ?
17569 echo " "
17570 echo "Looking for a random number function..." >&4
17571 case "$randfunc" in
17572 '')
17573         if set drand48 val -f; eval $csym; $val; then
17574                 dflt="drand48"
17575                 echo "Good, found drand48()." >&4
17576         elif set random val -f; eval $csym; $val; then
17577                 dflt="random"
17578                 echo "OK, found random()." >&4
17579         else
17580                 dflt="rand"
17581                 echo "Yick, looks like I have to use rand()." >&4
17582         fi
17583         echo " "
17584         ;;
17585 *)
17586         dflt="$randfunc"
17587         ;;
17588 esac
17589 cont=true
17590
17591 case "$ccflags" in
17592 *-Dmy_rand=*|*-Dmy_srand=*)
17593         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17594         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17595         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17596         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17597         ;;
17598 esac
17599
17600 while $test "$cont"; do
17601         rp="Use which function to generate random numbers?"
17602         . ./myread
17603         if $test "$ans" = "$dflt"; then
17604                 : null
17605         else
17606                 randbits=''
17607         fi
17608         randfunc="$ans"
17609         if set $ans val -f; eval $csym; $val; then
17610                 cont=''
17611         else
17612                 dflt=y
17613                 rp="I cannot find function $ans. Use that name anyway?"
17614                 . ./myread
17615                 dflt=rand
17616                 case "$ans" in
17617                         [yY]*) cont='';;
17618                 esac
17619         fi
17620         case "$cont" in
17621         '')
17622                 case "$randfunc" in
17623                 drand48)
17624                         drand01="drand48()"
17625                         seedfunc="srand48"
17626                         randbits=48
17627                         randseedtype=long
17628                         ;;
17629                 rand|random)
17630                         case "$randbits" in
17631                         '')
17632 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17633                                 $cat >try.c <<EOCP
17634 #$i_unistd I_UNISTD
17635 #$i_stdlib I_STDLIB
17636 #include <stdio.h>
17637 #ifdef I_UNISTD
17638 #  include <unistd.h>
17639 #endif
17640 #ifdef I_STDLIB
17641 #  include <stdlib.h>
17642 #endif
17643 int main()
17644 {
17645         register int i;
17646         register unsigned long tmp;
17647         register unsigned long max = 0L;
17648
17649         for (i = 1000; i; i--) {
17650                 tmp = (unsigned long) $randfunc();
17651                 if (tmp > max) max = tmp;
17652         }
17653         for (i = 0; max; i++)
17654                 max /= 2;
17655         printf("%d\n",i);
17656 }
17657 EOCP
17658                                 set try
17659                                 if eval $compile_ok; then
17660                                         dflt=`try`
17661                                 else
17662                                         dflt='?'
17663                                         echo "(I can't seem to compile the test program...)"
17664                                 fi
17665                                 ;;
17666                         *)
17667                                 dflt="$randbits"
17668                                 ;;
17669                         esac
17670                         rp="How many bits does your $randfunc() function produce?"
17671                         . ./myread
17672                         randbits="$ans"
17673                         $rm -f try.c try
17674                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17675                         seedfunc="s$randfunc"
17676                         randseedtype=unsigned
17677                         ;;
17678                 *)
17679                         dflt="31"
17680                         rp="How many bits does your $randfunc() function produce?"
17681                         . ./myread
17682                         randbits="$ans"
17683                         seedfunc="s$randfunc"
17684                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17685                         if set $seedfunc val -f; eval $csym; $val; then
17686                                 echo "(Using $seedfunc() to seed random generator)"
17687                         else
17688                                 echo "(Warning: no $seedfunc() to seed random generator)"
17689                                 seedfunc=rand
17690                         fi
17691                         randseedtype=unsigned
17692                         ;;
17693                 esac
17694                 ;;
17695         esac
17696 done
17697
17698 echo " "
17699 echo "Determining whether or not we are on an EBCDIC system..." >&4
17700 $cat >try.c <<'EOM'
17701 int main()
17702 {
17703   if ('M'==0xd4) return 0;
17704   return 1;
17705 }
17706 EOM
17707
17708 val=$undef
17709 set try
17710 if eval $compile_ok; then
17711         if $run ./try; then
17712                 echo "You seem to speak EBCDIC." >&4
17713                 val="$define"
17714         else
17715                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17716         fi
17717 else
17718         echo "I'm unable to compile the test program." >&4
17719         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17720 fi
17721 $rm -f try try.*
17722 set ebcdic
17723 eval $setvar
17724
17725 echo " "
17726 $cat >&4 <<EOM
17727 Checking how to flush all pending stdio output...
17728 EOM
17729 # I only know how to find the first 32 possibly open files on SunOS.
17730 # See also hints/sunos_4_1.sh and util.c  --AD
17731 case "$osname" in
17732 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17733 esac
17734 $cat >>try.c <<EOCP
17735 #include <stdio.h>
17736 #$i_stdlib I_STDLIB
17737 #ifdef I_STDLIB
17738 #include <stdlib.h>
17739 #endif
17740 #$i_unistd I_UNISTD
17741 #ifdef I_UNISTD
17742 # include <unistd.h>
17743 #endif
17744 #$d_sysconf HAS_SYSCONF
17745 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17746 #ifdef HAS_STDIO_STREAM_ARRAY
17747 # define STDIO_STREAM_ARRAY $stdio_stream_array
17748 #endif
17749 int main() {
17750   FILE* p;
17751   unlink("try.out");
17752   p = fopen("try.out", "w");
17753 #ifdef TRY_FPUTC
17754   fputc('x', p);
17755 #else
17756 # ifdef TRY_FPRINTF
17757   fprintf(p, "x");
17758 # endif
17759 #endif
17760 #ifdef TRY_FFLUSH_NULL
17761   fflush(NULL);
17762 #endif
17763 #ifdef TRY_FFLUSH_ALL
17764   {
17765     long open_max = -1;
17766 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17767     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17768 # else
17769 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17770     open_max = sysconf(_SC_OPEN_MAX);
17771 #  else
17772 #   ifdef FOPEN_MAX
17773     open_max = FOPEN_MAX;
17774 #   else
17775 #    ifdef OPEN_MAX
17776     open_max = OPEN_MAX;
17777 #    else
17778 #     ifdef _NFILE
17779     open_max = _NFILE;
17780 #     endif
17781 #    endif
17782 #   endif
17783 #  endif
17784 # endif 
17785 # ifdef HAS_STDIO_STREAM_ARRAY
17786     if (open_max > 0) {
17787       long i;
17788       for (i = 0; i < open_max; i++)
17789             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17790                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17791                 STDIO_STREAM_ARRAY[i]._flag)
17792                 fflush(&STDIO_STREAM_ARRAY[i]);
17793     }   
17794   }
17795 # endif
17796 #endif
17797   _exit(42);
17798 }
17799 EOCP
17800 : first we have to find out how _not_ to flush
17801 $to try.c
17802 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17803     output=''
17804     set try -DTRY_FPUTC
17805     if eval $compile; then
17806             $run ./try 2>/dev/null
17807             code="$?"
17808             $from try.out
17809             if $test ! -s try.out -a "X$code" = X42; then
17810                 output=-DTRY_FPUTC
17811             fi
17812     fi
17813     case "$output" in
17814     '')
17815             set try -DTRY_FPRINTF
17816             if eval $compile; then
17817                     $run ./try 2>/dev/null
17818                     code="$?"
17819                     $from try.out
17820                     if $test ! -s try.out -a "X$code" = X42; then
17821                         output=-DTRY_FPRINTF
17822                     fi
17823             fi
17824         ;;
17825     esac
17826 fi
17827 : check for fflush NULL behaviour
17828 case "$fflushNULL" in
17829 '')     set try -DTRY_FFLUSH_NULL $output
17830         if eval $compile; then
17831                 $run ./try 2>/dev/null
17832                 code="$?"
17833                 $from try.out
17834                 if $test -s try.out -a "X$code" = X42; then
17835                         fflushNULL="`$cat try.out`"
17836                 else
17837                         if $test "X$code" != X42; then
17838                                 $cat >&4 <<EOM
17839 (If this test failed, don't worry, we'll try another method shortly.)
17840 EOM
17841                         fi
17842                 fi
17843         fi
17844         $rm -f core try.core core.try.*
17845         case "$fflushNULL" in
17846         x)      $cat >&4 <<EOM
17847 Your fflush(NULL) works okay for output streams.
17848 Let's see if it clobbers input pipes...
17849 EOM
17850 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17851 # bug that improperly flushes the input end of pipes.  So we avoid the
17852 # autoflush on fork/system/exec support for now. :-(
17853 $cat >tryp.c <<EOCP
17854 #include <stdio.h>
17855 int
17856 main(int argc, char **argv)
17857 {
17858     char buf[1024];
17859     int i;
17860     char *bp = buf;
17861     while (1) {
17862         while ((i = getc(stdin)) != -1
17863                && (*bp++ = i) != '\n'
17864                && bp < &buf[1024])
17865         /* DO NOTHING */ ;
17866         *bp = '\0';
17867         fprintf(stdout, "%s", buf);
17868         fflush(NULL);
17869         if (i == -1)
17870             return 0;
17871         bp = buf;
17872     }
17873 }
17874 EOCP
17875                 fflushNULL="$define"
17876                 set tryp
17877                 if eval $compile; then
17878                     $rm -f tryp.out
17879                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17880                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17881                        $cat >&4 <<EOM
17882 fflush(NULL) seems to behave okay with input streams.
17883 EOM
17884                         fflushNULL="$define"
17885                     else
17886                         $cat >&4 <<EOM
17887 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17888 EOM
17889                         fflushNULL="$undef"
17890                     fi
17891                 fi
17892                 $rm -f core tryp.c tryp.core core.tryp.*
17893                 ;;
17894         '')     $cat >&4 <<EOM
17895 Your fflush(NULL) isn't working (contrary to ANSI C).
17896 EOM
17897                 fflushNULL="$undef"
17898                 ;;
17899         *)      $cat >&4 <<EOM
17900 Cannot figure out whether your fflush(NULL) works or not.
17901 I'm assuming it doesn't (contrary to ANSI C).
17902 EOM
17903                 fflushNULL="$undef"
17904                 ;;
17905         esac
17906         ;;
17907 $define|true|[yY]*)
17908         fflushNULL="$define"
17909         ;;
17910 *)
17911         fflushNULL="$undef"
17912         ;;
17913 esac
17914 : check explicit looping only if NULL did not work, and if the pipe
17915 : bug does not show up on an explicit flush too
17916 case "$fflushNULL" in
17917 "$undef")
17918         $cat >tryp.c <<EOCP
17919 #include <stdio.h>
17920 int
17921 main(int argc, char **argv)
17922 {
17923     char buf[1024];
17924     int i;
17925     char *bp = buf;
17926     while (1) {
17927         while ((i = getc(stdin)) != -1
17928                && (*bp++ = i) != '\n'
17929                && bp < &buf[1024])
17930         /* DO NOTHING */ ;
17931         *bp = '\0';
17932         fprintf(stdout, "%s", buf);
17933         fflush(stdin);
17934         if (i == -1)
17935             return 0;
17936         bp = buf;
17937     }
17938 }
17939 EOCP
17940         set tryp
17941         if eval $compile; then
17942             $rm -f tryp.out
17943             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17944             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17945                $cat >&4 <<EOM
17946 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17947 EOM
17948                 : now check for fflushall behaviour
17949                 case "$fflushall" in
17950                 '')     set try -DTRY_FFLUSH_ALL $output
17951                         if eval $compile; then
17952                                 $cat >&4 <<EOM
17953 (Now testing the other method--but note that this also may fail.)
17954 EOM
17955                                 $run ./try 2>/dev/null
17956                                 code=$?
17957                                 $from try.out
17958                                 if $test -s try.out -a "X$code" = X42; then
17959                                         fflushall="`$cat try.out`"
17960                                 fi
17961                         fi
17962                         $rm -f core try.core core.try.*
17963                         case "$fflushall" in
17964                         x)      $cat >&4 <<EOM
17965 Whew. Flushing explicitly all the stdio streams works.
17966 EOM
17967                                 fflushall="$define"
17968                                 ;;
17969                         '')     $cat >&4 <<EOM
17970 Sigh. Flushing explicitly all the stdio streams doesn't work.
17971 EOM
17972                                 fflushall="$undef"
17973                                 ;;
17974                         *)      $cat >&4 <<EOM
17975 Cannot figure out whether flushing stdio streams explicitly works or not.
17976 I'm assuming it doesn't.
17977 EOM
17978                                 fflushall="$undef"
17979                                 ;;
17980                         esac
17981                         ;;
17982                 "$define"|true|[yY]*)
17983                         fflushall="$define"
17984                         ;;
17985                 *)
17986                         fflushall="$undef"
17987                         ;;
17988                 esac
17989             else
17990                 $cat >&4 <<EOM
17991 All is futile.  Even fflush(stdin) clobbers input pipes!
17992 EOM
17993                 fflushall="$undef"
17994             fi
17995         else
17996             fflushall="$undef"
17997         fi
17998         $rm -f core tryp.c tryp.core core.tryp.*
17999         ;;
18000 *)      fflushall="$undef"
18001         ;;
18002 esac
18003
18004 case "$fflushNULL$fflushall" in
18005 undefundef)
18006         $cat <<EOM
18007 OK, I give up.  I cannot figure out how to flush pending stdio output.
18008 We won't be flushing handles at all before fork/exec/popen.
18009 EOM
18010         ;;
18011 esac
18012 $rm -f try.* try$exe_ext
18013
18014 : Store the full pathname to the ar program for use in the C program
18015 : Respect a hint or command line value for full_ar.
18016 case "$full_ar" in
18017 '') full_ar=$ar ;;
18018 esac
18019
18020 : Store the full pathname to the sed program for use in the C program
18021 full_sed=$sed
18022
18023 : see what type gids are declared as in the kernel
18024 echo " "
18025 echo "Looking for the type for group ids returned by getgid()."
18026 set gid_t gidtype xxx stdio.h sys/types.h
18027 eval $typedef
18028 case "$gidtype" in
18029 xxx)
18030         xxx=`./findhdr sys/user.h`
18031         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18032         case $1 in
18033         unsigned) dflt="$1 $2" ;;
18034         *) dflt="$1" ;;
18035         esac
18036         ;;
18037 *) dflt="$gidtype";;
18038 esac
18039 case "$gidtype" in
18040 gid_t) echo "gid_t found." ;;
18041 *)      rp="What is the type for group ids returned by getgid()?"
18042         . ./myread
18043         gidtype="$ans"
18044         ;;
18045 esac
18046
18047 echo " "
18048 case "$gidtype" in
18049 *_t) zzz="$gidtype"     ;;
18050 *)   zzz="gid"          ;;
18051 esac
18052 echo "Checking the size of $zzz..." >&4 
18053 cat > try.c <<EOCP
18054 #include <sys/types.h>
18055 #include <stdio.h>
18056 #$i_stdlib I_STDLIB
18057 #ifdef I_STDLIB
18058 #include <stdlib.h>
18059 #endif
18060 int main() {
18061     printf("%d\n", (int)sizeof($gidtype));
18062     exit(0);
18063 }
18064 EOCP
18065 set try
18066 if eval $compile_ok; then
18067         yyy=`$run ./try`
18068         case "$yyy" in
18069         '')     gidsize=4
18070                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18071                 ;;
18072         *)      gidsize=$yyy
18073                 echo "Your $zzz is $gidsize bytes long."
18074                 ;;
18075         esac
18076 else
18077         gidsize=4
18078         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18079 fi
18080
18081
18082 echo " "
18083 case "$gidtype" in
18084 *_t) zzz="$gidtype"     ;;
18085 *)   zzz="gid"          ;;
18086 esac
18087 echo "Checking the sign of $zzz..." >&4 
18088 cat > try.c <<EOCP
18089 #include <sys/types.h>
18090 #include <stdio.h>
18091 int main() {
18092         $gidtype foo = -1;
18093         if (foo < 0)
18094                 printf("-1\n");
18095         else
18096                 printf("1\n");
18097 }
18098 EOCP
18099 set try
18100 if eval $compile; then
18101         yyy=`$run ./try`
18102         case "$yyy" in
18103         '')     gidsign=1
18104                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18105                 ;;
18106         *)      gidsign=$yyy
18107                 case "$gidsign" in
18108                  1) echo "Your $zzz is unsigned." ;;
18109                 -1) echo "Your $zzz is signed."   ;;
18110                 esac
18111                 ;;
18112         esac
18113 else
18114         gidsign=1
18115         echo "(I can't compile the test program--guessing unsigned.)" >&4
18116 fi
18117
18118
18119 echo " "
18120
18121 if $test X"$quadtype" != X; then
18122
18123 echo "Checking how to print 64-bit integers..." >&4
18124
18125 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18126         $cat >try.c <<'EOCP'
18127 #include <sys/types.h>
18128 #include <stdio.h>
18129 int main() {
18130   int q = 12345678901;
18131   printf("%ld\n", q);
18132 }
18133 EOCP
18134         set try
18135         if eval $compile; then
18136                 yyy=`$run ./try`
18137                 case "$yyy" in
18138                 12345678901)
18139                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18140                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18141                         echo "We will use %d."
18142                         ;;
18143                 esac
18144         fi
18145 fi
18146
18147 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18148         $cat >try.c <<'EOCP'
18149 #include <sys/types.h>
18150 #include <stdio.h>
18151 int main() {
18152   long q = 12345678901;
18153   printf("%ld\n", q);
18154 }
18155 EOCP
18156         set try
18157         if eval $compile; then
18158                 yyy=`$run ./try`
18159                 case "$yyy" in
18160                 12345678901)
18161                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18162                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18163                         echo "We will use %ld."
18164                         ;;
18165                 esac
18166         fi
18167 fi
18168
18169 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18170         $cat >try.c <<'EOCP'
18171 #include <sys/types.h>
18172 #include <inttypes.h>
18173 #include <stdio.h>
18174 int main() {
18175   int64_t q = 12345678901;
18176   printf("%" PRId64 "\n", q);
18177 }
18178 EOCP
18179         set try
18180         if eval $compile; then
18181                 yyy=`$run ./try`
18182                 case "$yyy" in
18183                 12345678901)
18184                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18185                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18186                         echo "We will use the C9X style."
18187                         ;;
18188                 esac
18189         fi
18190 fi
18191
18192 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18193         $cat >try.c <<EOCP
18194 #include <sys/types.h>
18195 #include <stdio.h>
18196 int main() {
18197   $quadtype q = 12345678901;
18198   printf("%Ld\n", q);
18199 }
18200 EOCP
18201         set try
18202         if eval $compile; then
18203                 yyy=`$run ./try`
18204                 case "$yyy" in
18205                 12345678901)
18206                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18207                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18208                         echo "We will use %Ld."
18209                         ;;
18210                 esac
18211         fi
18212 fi
18213
18214 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18215         $cat >try.c <<'EOCP'
18216 #include <sys/types.h>
18217 #include <stdio.h>
18218 int main() {
18219   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18220   printf("%lld\n", q);
18221 }
18222 EOCP
18223         set try
18224         if eval $compile; then
18225                 yyy=`$run ./try`
18226                 case "$yyy" in
18227                 12345678901)
18228                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18229                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18230                         echo "We will use the %lld style."
18231                         ;;
18232                 esac
18233         fi
18234 fi
18235
18236 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18237         $cat >try.c <<EOCP
18238 #include <sys/types.h>
18239 #include <stdio.h>
18240 int main() {
18241   $quadtype q = 12345678901;
18242   printf("%qd\n", q);
18243 }
18244 EOCP
18245         set try
18246         if eval $compile; then
18247                 yyy=`$run ./try`
18248                 case "$yyy" in
18249                 12345678901)
18250                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18251                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18252                         echo "We will use %qd."
18253                         ;;
18254                 esac
18255         fi
18256 fi
18257
18258 if $test X"$sPRId64" = X; then
18259         echo "Cannot figure out how to print 64-bit integers." >&4
18260 fi
18261
18262 $rm -f try try.*
18263
18264 fi
18265
18266 case "$sPRId64" in
18267 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18268         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18269         ;;
18270 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18271         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18272         ;;
18273 esac
18274
18275
18276 echo " "
18277 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18278
18279 if $test X"$ivsize" = X8; then
18280         ivdformat="$sPRId64"
18281         uvuformat="$sPRIu64"
18282         uvoformat="$sPRIo64"
18283         uvxformat="$sPRIx64"
18284         uvXUformat="$sPRIXU64"
18285 else
18286         if $test X"$ivsize" = X"$longsize"; then
18287                 ivdformat='"ld"'
18288                 uvuformat='"lu"'
18289                 uvoformat='"lo"'
18290                 uvxformat='"lx"'
18291                 uvXUformat='"lX"'
18292         else
18293                 if $test X"$ivsize" = X"$intsize"; then
18294                         ivdformat='"d"'
18295                         uvuformat='"u"'
18296                         uvoformat='"o"'
18297                         uvxformat='"x"'
18298                         uvXUformat='"X"'
18299                 else
18300                         : far out
18301                         if $test X"$ivsize" = X"$shortsize"; then
18302                                 ivdformat='"hd"'
18303                                 uvuformat='"hu"'
18304                                 uvoformat='"ho"'
18305                                 uvxformat='"hx"'
18306                                 uvXUformat='"hX"'
18307                         fi
18308                 fi
18309         fi
18310 fi
18311
18312 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18313         nveformat="$sPRIeldbl"
18314         nvfformat="$sPRIfldbl"
18315         nvgformat="$sPRIgldbl"
18316         nvEUformat="$sPRIEUldbl"
18317         nvFUformat="$sPRIFUldbl"
18318         nvGUformat="$sPRIGUldbl"
18319 else
18320         nveformat='"e"'
18321         nvfformat='"f"'
18322         nvgformat='"g"'
18323         nvEUformat='"E"'
18324         nvFUformat='"F"'
18325         nvGUformat='"G"'
18326 fi
18327
18328 case "$ivdformat" in
18329 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18330     exit 1
18331     ;;
18332 esac
18333
18334
18335 echo " "
18336 $echo "Checking the format string to be used for gids..." >&4
18337
18338 case "$gidsign" in
18339 -1)     if $test X"$gidsize" = X"$ivsize"; then
18340                 gidformat="$ivdformat"
18341         else
18342                 if $test X"$gidsize" = X"$longsize"; then
18343                         gidformat='"ld"'
18344                 else
18345                         if $test X"$gidsize" = X"$intsize"; then
18346                                 gidformat='"d"'
18347                         else
18348                                 if $test X"$gidsize" = X"$shortsize"; then
18349                                         gidformat='"hd"'
18350                                 fi
18351                         fi
18352                 fi
18353         fi
18354         ;;
18355 *)      if $test X"$gidsize" = X"$uvsize"; then
18356                 gidformat="$uvuformat"
18357         else
18358                 if $test X"$gidsize" = X"$longsize"; then
18359                         gidformat='"lu"'
18360                 else
18361                         if $test X"$gidsize" = X"$intsize"; then
18362                                 gidformat='"u"'
18363                         else
18364                                 if $test X"$gidsize" = X"$shortsize"; then
18365                                         gidformat='"hu"'
18366                                 fi
18367                         fi
18368                 fi
18369         fi
18370         ;;
18371 esac
18372
18373 : see if getgroups exists
18374 set getgroups d_getgrps
18375 eval $inlibc
18376
18377 : see if setgroups exists
18378 set setgroups d_setgrps
18379 eval $inlibc
18380
18381
18382 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18383 echo " "
18384 case "$d_getgrps$d_setgrps" in
18385 *define*)
18386         case "$groupstype" in
18387         '') dflt="$gidtype" ;;
18388         *)  dflt="$groupstype" ;;
18389         esac
18390         $cat <<EOM
18391 What type of pointer is the second argument to getgroups() and setgroups()?
18392 Usually this is the same as group ids, $gidtype, but not always.
18393
18394 EOM
18395         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18396         . ./myread
18397         groupstype="$ans"
18398         ;;
18399 *)  groupstype="$gidtype";;
18400 esac
18401
18402 echo " "
18403 echo "Checking if your $make program sets \$(MAKE)..." >&4
18404 case "$make_set_make" in
18405 '')
18406         $sed 's/^X //' > testmake.mak << 'EOF'
18407 Xall:
18408 X       @echo 'maketemp="$(MAKE)"'
18409 EOF
18410         case "`$make -f testmake.mak 2>/dev/null`" in
18411         *maketemp=*) make_set_make='#' ;;
18412         *)      make_set_make="MAKE=$make" ;;
18413         esac
18414         $rm -f testmake.mak
18415         ;;
18416 esac
18417 case "$make_set_make" in
18418 '#') echo "Yup, it does.";;
18419 *) echo "Nope, it doesn't.";;
18420 esac
18421
18422 : see what type is used for mode_t
18423 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18424 set mode_t modetype int stdio.h sys/types.h
18425 eval $typedef_ask
18426
18427 : see if stdarg is available
18428 echo " "
18429 if $test `./findhdr stdarg.h`; then
18430         echo "<stdarg.h> found." >&4
18431         valstd="$define"
18432 else
18433         echo "<stdarg.h> NOT found." >&4
18434         valstd="$undef"
18435 fi
18436
18437 : see if varags is available
18438 echo " "
18439 if $test `./findhdr varargs.h`; then
18440         echo "<varargs.h> found." >&4
18441 else
18442         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18443 fi
18444
18445 : set up the varargs testing programs
18446 $cat > varargs.c <<EOP
18447 #ifdef I_STDARG
18448 #include <stdarg.h>
18449 #endif
18450 #ifdef I_VARARGS
18451 #include <varargs.h>
18452 #endif
18453
18454 #ifdef I_STDARG
18455 int f(char *p, ...)
18456 #else
18457 int f(va_alist)
18458 va_dcl
18459 #endif
18460 {
18461         va_list ap;
18462 #ifndef I_STDARG
18463         char *p;
18464 #endif
18465 #ifdef I_STDARG
18466         va_start(ap,p);
18467 #else
18468         va_start(ap);
18469         p = va_arg(ap, char *);
18470 #endif
18471         va_end(ap);
18472 }
18473 EOP
18474 $cat > varargs <<EOP
18475 $startsh
18476 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18477         echo "true"
18478 else
18479         echo "false"
18480 fi
18481 $rm -f varargs$_o
18482 EOP
18483 chmod +x varargs
18484
18485 : now check which varargs header should be included
18486 echo " "
18487 i_varhdr=''
18488 case "$valstd" in
18489 "$define")
18490         if `./varargs I_STDARG`; then
18491                 val='stdarg.h'
18492         elif `./varargs I_VARARGS`; then
18493                 val='varargs.h'
18494         fi
18495         ;;
18496 *)
18497         if `./varargs I_VARARGS`; then
18498                 val='varargs.h'
18499         fi
18500         ;;
18501 esac
18502 case "$val" in
18503 '')
18504 echo "I could not find the definition for va_dcl... You have problems..." >&4
18505         val="$undef"; set i_stdarg; eval $setvar
18506         val="$undef"; set i_varargs; eval $setvar
18507         ;;
18508 *) 
18509         set i_varhdr
18510         eval $setvar
18511         case "$i_varhdr" in
18512         stdarg.h)
18513                 val="$define"; set i_stdarg; eval $setvar
18514                 val="$undef"; set i_varargs; eval $setvar
18515                 ;;
18516         varargs.h)
18517                 val="$undef"; set i_stdarg; eval $setvar
18518                 val="$define"; set i_varargs; eval $setvar
18519                 ;;
18520         esac
18521         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18522 esac
18523 $rm -f varargs*
18524
18525 : see if we need va_copy
18526 echo " "
18527 case "$i_stdarg" in
18528 "$define")
18529         $cat >try.c <<EOCP
18530 #include <stdarg.h>
18531 #include <stdio.h>
18532 #$i_stdlib I_STDLIB
18533 #ifdef I_STDLIB
18534 #include <stdlib.h>
18535 #endif
18536 #include <signal.h>
18537
18538 int
18539 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18540 {
18541   return vfprintf(f, fmt, *valp);
18542 }
18543  
18544 int    
18545 myvfprintf(FILE *f, const  char *fmt, va_list val)
18546 {
18547   return ivfprintf(f, fmt, &val);
18548 }
18549       
18550 int
18551 myprintf(char *fmt, ...) 
18552 {
18553   va_list val;
18554   va_start(val, fmt);
18555   return myvfprintf(stdout, fmt, val); 
18556 }         
18557
18558 int
18559 main(int ac, char **av)
18560 {
18561   signal(SIGSEGV, exit);
18562
18563   myprintf("%s%cs all right, then\n", "that", '\'');                            
18564   exit(0);      
18565 }
18566 EOCP
18567         set try
18568         if eval $compile && $run ./try 2>&1 >/dev/null; then
18569                 case "`$run ./try`" in
18570                 "that's all right, then")
18571                         okay=yes
18572                         ;;
18573                 esac
18574         fi
18575         case "$okay" in
18576         yes)    echo "It seems that you don't need va_copy()." >&4
18577                 need_va_copy="$undef"
18578                 ;;
18579         *)      echo "It seems that va_copy() or similar will be needed." >&4
18580                 need_va_copy="$define"
18581                 ;;
18582         esac
18583         $rm -f try.* core core.* *.core *.core.*
18584         ;;
18585 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18586         ;;
18587 esac
18588
18589 : see what type is used for size_t
18590 rp="What is the type used for the length parameter for string functions?"
18591 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18592 eval $typedef_ask
18593
18594 : check for type of arguments to gethostbyaddr. 
18595 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18596         case "$d_gethbyaddr" in
18597         $define)
18598                 $cat <<EOM
18599
18600 Checking to see what type of arguments are accepted by gethostbyaddr().
18601 EOM
18602                 hdrs="$define sys/types.h
18603                         $d_socket sys/socket.h 
18604                         $i_niin netinet/in.h 
18605                         $i_netdb netdb.h
18606                         $i_unistd unistd.h"
18607                 : The first arg can 'char *' or 'void *'
18608                 : The second arg is some of integral type
18609                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18610                         for yyy in size_t long int; do
18611                                 case "$netdb_host_type" in
18612                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18613                                         if ./protochk "$try" $hdrs; then
18614                                                 echo "Your system accepts $xxx for the first arg."
18615                                                 echo "...and $yyy for the second arg."
18616                                                 netdb_host_type="$xxx"
18617                                                 netdb_hlen_type="$yyy"
18618                                         fi
18619                                         ;;
18620                                 esac
18621                         done
18622                 done
18623                 : In case none of those worked, prompt the user.
18624                 case "$netdb_host_type" in
18625                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18626                         dflt='char *'
18627                         . ./myread
18628                         netdb_host_type=$ans
18629                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18630                         dflt="$sizetype"
18631                         . ./myread
18632                         netdb_hlen_type=$ans
18633                         ;;
18634                 esac
18635                 ;;
18636         *)      : no gethostbyaddr, so pick harmless defaults
18637                 netdb_host_type='char *'
18638                 netdb_hlen_type="$sizetype"
18639                 ;;
18640         esac
18641         # Remove the "const" if needed. -- but then we'll have a 
18642         # prototype clash!
18643         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18644 fi
18645
18646 : check for type of argument to gethostbyname. 
18647 if test "X$netdb_name_type" = X ; then
18648         case "$d_gethbyname" in
18649         $define)
18650                 $cat <<EOM
18651
18652 Checking to see what type of argument is accepted by gethostbyname().
18653 EOM
18654                 hdrs="$define sys/types.h
18655                         $d_socket sys/socket.h 
18656                         $i_niin netinet/in.h 
18657                         $i_netdb netdb.h
18658                         $i_unistd unistd.h"
18659                 for xxx in "const char *" "char *"; do
18660                         case "$netdb_name_type" in
18661                         '')     try="extern struct hostent *gethostbyname($xxx);"
18662                                 if ./protochk "$try" $hdrs; then
18663                                         echo "Your system accepts $xxx."
18664                                         netdb_name_type="$xxx"
18665                                 fi
18666                                 ;;
18667                         esac
18668                 done
18669                 : In case none of those worked, prompt the user.
18670                 case "$netdb_name_type" in
18671                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18672                         dflt='char *'
18673                         . ./myread
18674                         netdb_name_type=$ans
18675                         ;;
18676                 esac
18677                 ;;
18678         *)      : no gethostbyname, so pick harmless default
18679                 netdb_name_type='char *'
18680                 ;;
18681         esac
18682 fi
18683
18684 : check for type of 1st argument to getnetbyaddr. 
18685 if test "X$netdb_net_type" = X ; then
18686         case "$d_getnbyaddr" in
18687         $define)
18688                 $cat <<EOM
18689
18690 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18691 EOM
18692                 hdrs="$define sys/types.h
18693                         $d_socket sys/socket.h 
18694                         $i_niin netinet/in.h 
18695                         $i_netdb netdb.h
18696                         $i_unistd unistd.h"
18697                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18698                         case "$netdb_net_type" in
18699                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18700                                 if ./protochk "$try" $hdrs; then
18701                                         echo "Your system accepts $xxx."
18702                                         netdb_net_type="$xxx"
18703                                 fi
18704                                 ;;
18705                         esac
18706                 done
18707                 : In case none of those worked, prompt the user.
18708                 case "$netdb_net_type" in
18709                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18710                         dflt='long'
18711                         . ./myread
18712                         netdb_net_type=$ans
18713                         ;;
18714                 esac
18715                 ;;
18716         *)      : no getnetbyaddr, so pick harmless default
18717                 netdb_net_type='long'
18718                 ;;
18719         esac
18720 fi
18721 : locate the preferred pager for this system
18722 fn=f/
18723 case "$pager" in
18724 '')
18725         dflt=''
18726         case "$pg" in
18727         /*) dflt=$pg;;
18728         [a-zA-Z]:/*) dflt=$pg;;
18729         esac
18730         case "$more" in
18731         /*) dflt=$more;;
18732         [a-zA-Z]:/*) dflt=$more;;
18733         esac
18734         case "$less" in
18735         /*) dflt=$less;;
18736         [a-zA-Z]:/*) dflt=$less;;
18737         esac
18738         case "$dflt" in
18739         '') dflt=/usr/ucb/more;;
18740         esac
18741         ;;
18742 *)      dflt="$pager"
18743         : Instruct ./getfile to trust the hinted or previous pager value,
18744         : even if it does not begin with a slash.  For example, on os2,
18745         : pager might be cmd /c more.  See comments in UU/getfile.
18746         fn="f/($pager)"
18747         ;;
18748 esac
18749 echo " "
18750 rp='What pager is used on your system?'
18751 . ./getfile
18752 pager="$ans"
18753
18754 : see what type pids are declared as in the kernel
18755 rp="What is the type of process ids on this system?"
18756 set pid_t pidtype int stdio.h sys/types.h
18757 eval $typedef_ask
18758
18759 : see if ar generates random libraries by itself
18760 echo " "
18761 echo "Checking how to generate random libraries on your machine..." >&4
18762 echo 'int bar1() { return bar2(); }' > bar1.c
18763 echo 'int bar2() { return 2; }' > bar2.c
18764 $cat > foo.c <<EOP
18765 #$i_stdlib I_STDLIB
18766 #ifdef I_STDLIB
18767 #include <stdlib.h>
18768 #endif
18769 int main() { printf("%d\n", bar1()); exit(0); }
18770 EOP
18771 $cc $ccflags -c bar1.c >/dev/null 2>&1
18772 $cc $ccflags -c bar2.c >/dev/null 2>&1
18773 $cc $ccflags -c foo.c >/dev/null 2>&1
18774 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18775 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18776         $run ./foobar >/dev/null 2>&1; then
18777         echo "$ar appears to generate random libraries itself."
18778         orderlib=false
18779         ranlib=":"
18780 elif $ar ts bar$_a >/dev/null 2>&1 &&
18781         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18782         $run ./foobar >/dev/null 2>&1; then
18783                 echo "a table of contents needs to be added with '$ar ts'."
18784                 orderlib=false
18785                 ranlib="$ar ts"
18786 else
18787         case "$ranlib" in
18788         :) ranlib='';;
18789         '')
18790                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18791                 $test -f $ranlib || ranlib=''
18792                 ;;
18793         esac
18794         if $test -n "$ranlib"; then
18795                 echo "your system has '$ranlib'; we'll use that."
18796                 orderlib=false
18797         else
18798                 echo "your system doesn't seem to support random libraries"
18799                 echo "so we'll use lorder and tsort to order the libraries."
18800                 orderlib=true
18801                 ranlib=":"
18802         fi
18803 fi
18804 $rm -f foo* bar* 
18805
18806 : check for type of arguments to select. 
18807 case "$selecttype" in
18808 '') case "$d_select" in
18809         $define)
18810                 echo " "
18811                 $cat <<EOM
18812 Checking to see what type of arguments are accepted by select().
18813 EOM
18814                 hdrs="$define sys/types.h
18815                         $i_systime sys/time.h 
18816                         $i_sysselct sys/select.h
18817                         $d_socket sys/socket.h"
18818                 : The first arg can be int, unsigned, or size_t
18819                 : The last arg may or may not be 'const'
18820                 val=''
18821                 : void pointer has been seen but using that
18822                 : breaks the selectminbits test
18823                 for xxx in 'fd_set *' 'int *'; do
18824                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18825                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18826                                         case "$val" in
18827                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18828                                                 if ./protochk "$try" $hdrs; then
18829                                                         echo "Your system accepts $xxx."
18830                                                         val="$xxx"
18831                                                 fi
18832                                                 ;;
18833                                         esac
18834                                 done
18835                         done
18836                 done
18837                 case "$val" in
18838                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18839                         case "$d_fd_set" in
18840                                 $define) dflt="fd_set *" ;;
18841                                 *)              dflt="int *" ;;
18842                         esac
18843                         . ./myread
18844                         val=$ans
18845                         ;;
18846                 esac
18847                 selecttype="$val"
18848                 ;;
18849         *)      : no select, so pick a harmless default
18850                 selecttype='int *'
18851                 ;;
18852         esac
18853         ;;
18854 esac
18855
18856 : check for the select 'width'
18857 case "$selectminbits" in
18858 '') safebits=`expr $ptrsize \* 8`
18859     case "$d_select" in
18860         $define)
18861                 $cat <<EOM
18862
18863 Checking to see on how many bits at a time your select() operates...
18864 EOM
18865                 $cat >try.c <<EOCP
18866 #include <sys/types.h>
18867 #$i_time I_TIME
18868 #$i_systime I_SYS_TIME
18869 #$i_systimek I_SYS_TIME_KERNEL
18870 #ifdef I_TIME
18871 #   include <time.h>
18872 #endif
18873 #ifdef I_SYS_TIME
18874 #   ifdef I_SYS_TIME_KERNEL
18875 #       define KERNEL
18876 #   endif
18877 #   include <sys/time.h>
18878 #   ifdef I_SYS_TIME_KERNEL
18879 #       undef KERNEL
18880 #   endif
18881 #endif
18882 #$i_sysselct I_SYS_SELECT
18883 #ifdef I_SYS_SELECT
18884 #include <sys/select.h>
18885 #endif
18886 #$d_socket HAS_SOCKET
18887 #ifdef HAS_SOCKET
18888 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18889 #endif
18890 #include <stdio.h>
18891 #$i_stdlib I_STDLIB
18892 #ifdef I_STDLIB
18893 #include <stdlib.h>
18894 #endif
18895 $selecttype b;
18896 #define S sizeof(*(b))
18897 #define MINBITS 64
18898 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18899 #define NBITS  (NBYTES * 8)
18900 int main() {
18901     char *s = malloc(NBYTES);
18902     struct timeval t;
18903     int i;
18904     FILE* fp;
18905     int fd;
18906
18907     if (!s)
18908         exit(1);
18909     fclose(stdin);
18910     fp = fopen("try.c", "r");
18911     if (fp == 0)
18912       exit(2);
18913     fd = fileno(fp);
18914     if (fd < 0)
18915       exit(3);
18916     b = ($selecttype)s;
18917     for (i = 0; i < NBITS; i++)
18918         FD_SET(i, b);
18919     t.tv_sec  = 0;
18920     t.tv_usec = 0;
18921     select(fd + 1, b, 0, 0, &t);
18922     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18923     free(s);
18924     printf("%d\n", i + 1);
18925     return 0;
18926 }
18927 EOCP
18928                 set try
18929                 if eval $compile_ok; then
18930                         selectminbits=`$run ./try`
18931                         case "$selectminbits" in
18932                         '')     cat >&4 <<EOM
18933 Cannot figure out on how many bits at a time your select() operates.
18934 I'll play safe and guess it is $safebits bits.
18935 EOM
18936                                 selectminbits=$safebits
18937                                 bits="$safebits bits"
18938                                 ;;
18939                         1)      bits="1 bit" ;;
18940                         *)      bits="$selectminbits bits" ;;
18941                         esac
18942                         echo "Your select() operates on $bits at a time." >&4
18943                 else
18944                         rp='What is the minimum number of bits your select() operates on?'
18945                         case "$byteorder" in
18946                         12345678)       dflt=64 ;;
18947                         1234)           dflt=32 ;;
18948                         *)              dflt=1  ;;
18949                         esac
18950                         . ./myread
18951                         val=$ans
18952                         selectminbits="$val"
18953                 fi
18954                 $rm -f try.* try
18955                 ;;
18956         *)      : no select, so pick a harmless default
18957                 selectminbits=$safebits
18958                 ;;
18959         esac
18960         ;;
18961 esac
18962
18963 : Trace out the files included by signal.h, then look for SIGxxx names.
18964 : Remove SIGARRAYSIZE used by HPUX.
18965 : Remove SIGSTKSIZE used by Linux.
18966 : Remove SIGSTKSZ used by Posix.
18967 : Remove SIGTYP void lines used by OS2.
18968 : Some cpps, like os390, dont give the file name anywhere
18969 if [ "X$fieldn" = X ]; then
18970         : Just make some guesses.  We check them later.
18971         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18972 else
18973         xxx=`echo '#include <signal.h>' |
18974         $cppstdin $cppminus $cppflags 2>/dev/null |
18975         $grep '^[       ]*#.*include' | 
18976         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18977 fi
18978 : Check this list of files to be sure we have parsed the cpp output ok.
18979 : This will also avoid potentially non-existent files, such 
18980 : as ../foo/bar.h
18981 xxxfiles=''
18982 for xx in $xxx /dev/null ; do
18983         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18984 done
18985 : If we have found no files, at least try signal.h
18986 case "$xxxfiles" in
18987 '')     xxxfiles=`./findhdr signal.h` ;;
18988 esac
18989 xxx=`awk '
18990 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18991         print substr($2, 4, 20)
18992 }
18993 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18994         print substr($3, 4, 20)
18995 }' $xxxfiles`
18996 : Append some common names just in case the awk scan failed.
18997 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18998 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18999 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19000 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19001 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19002
19003 : generate a few handy files for later
19004 $cat > signal.c <<EOCP
19005 #include <sys/types.h>
19006 #include <signal.h>
19007 #$i_stdlib I_STDLIB
19008 #ifdef I_STDLIB
19009 #include <stdlib.h>
19010 #endif
19011 #include <stdio.h>
19012 int main() {
19013
19014 /* Strange style to avoid deeply-nested #if/#else/#endif */
19015 #ifndef NSIG
19016 #  ifdef _NSIG
19017 #    define NSIG (_NSIG)
19018 #  endif
19019 #endif
19020
19021 #ifndef NSIG
19022 #  ifdef SIGMAX
19023 #    define NSIG (SIGMAX+1)
19024 #  endif
19025 #endif
19026
19027 #ifndef NSIG
19028 #  ifdef SIG_MAX
19029 #    define NSIG (SIG_MAX+1)
19030 #  endif
19031 #endif
19032
19033 #ifndef NSIG
19034 #  ifdef MAXSIG
19035 #    define NSIG (MAXSIG+1)
19036 #  endif
19037 #endif
19038
19039 #ifndef NSIG
19040 #  ifdef MAX_SIG
19041 #    define NSIG (MAX_SIG+1)
19042 #  endif
19043 #endif
19044
19045 #ifndef NSIG
19046 #  ifdef SIGARRAYSIZE
19047 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
19048 #  endif
19049 #endif
19050
19051 #ifndef NSIG
19052 #  ifdef _sys_nsig
19053 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19054 #  endif
19055 #endif
19056
19057 /* Default to some arbitrary number that's big enough to get most
19058    of the common signals.
19059 */
19060 #ifndef NSIG
19061 #    define NSIG 50
19062 #endif
19063
19064 printf("NSIG %d\n", NSIG);
19065
19066 #ifndef JUST_NSIG
19067
19068 EOCP
19069
19070 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19071 {
19072         printf "#ifdef SIG"; printf $1; printf "\n"
19073         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19074         printf $1; printf ");\n"
19075         printf "#endif\n"
19076 }
19077 END {
19078         printf "#endif /* JUST_NSIG */\n";
19079         printf "exit(0);\n}\n";
19080 }
19081 ' >>signal.c
19082 $cat >signal.awk <<'EOP'
19083 BEGIN { ndups = 0 }
19084 $1 ~ /^NSIG$/ { nsig = $2 }
19085 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19086     if ($2 > maxsig) { maxsig = $2 }
19087     if (sig_name[$2]) {
19088         dup_name[ndups] = $1
19089         dup_num[ndups] = $2
19090         ndups++ 
19091     }
19092     else {
19093         sig_name[$2] = $1
19094         sig_num[$2] = $2
19095     }
19096 }
19097 END { 
19098     if (nsig == 0) {
19099         nsig = maxsig + 1
19100     }
19101     printf("NSIG %d\n", nsig);
19102     for (n = 1; n < nsig; n++) {
19103         if (sig_name[n]) {
19104             printf("%s %d\n", sig_name[n], sig_num[n])
19105         }
19106         else {
19107             printf("NUM%d %d\n", n, n) 
19108         }
19109     }
19110     for (n = 0; n < ndups; n++) {
19111         printf("%s %d\n", dup_name[n], dup_num[n])
19112     }
19113 }
19114 EOP
19115 $cat >signal_cmd <<EOS
19116 $startsh
19117 if $test -s signal.lst; then
19118     echo "Using your existing signal.lst file"
19119         exit 0
19120 fi
19121 xxx="$xxx"
19122 EOS
19123 $cat >>signal_cmd <<'EOS'
19124
19125 set signal
19126 if eval $compile_ok; then
19127         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19128 else
19129         echo "(I can't seem be able to compile the whole test program)" >&4
19130         echo "(I'll try it in little pieces.)" >&4
19131         set signal -DJUST_NSIG
19132         if eval $compile_ok; then
19133                 $run ./signal$_exe > signal.nsg
19134                 $cat signal.nsg
19135         else
19136                 echo "I can't seem to figure out how many signals you have." >&4
19137                 echo "Guessing 50." >&4
19138                 echo 'NSIG 50' > signal.nsg
19139         fi
19140         : Now look at all the signal names, one at a time.
19141         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19142                 $cat > signal.c <<EOCP
19143 #include <sys/types.h>
19144 #include <signal.h>
19145 #include <stdio.h>
19146 int main() {
19147 printf("$xx %d\n", SIG${xx});
19148 return 0;
19149 }
19150 EOCP
19151                 set signal
19152                 if eval $compile; then
19153                         echo "SIG${xx} found."
19154                         $run ./signal$_exe  >> signal.ls1
19155                 else
19156                         echo "SIG${xx} NOT found."
19157                 fi
19158         done
19159         if $test -s signal.ls1; then
19160                 $cat signal.nsg signal.ls1 |
19161                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19162         fi
19163
19164 fi
19165 if $test -s signal.lst; then
19166         :
19167 else
19168         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19169         echo 'kill -l' >signal
19170         set X `csh -f <signal`
19171         $rm -f signal
19172         shift
19173         case $# in
19174         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19175         esac
19176         echo $@ | $tr ' ' $trnl | \
19177             $awk '{ printf "%s %d\n", $1, ++s; }
19178                   END { printf "NSIG %d\n", ++s }' >signal.lst
19179 fi
19180 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19181 EOS
19182 chmod a+x signal_cmd
19183 $eunicefix signal_cmd
19184
19185 : generate list of signal names
19186 echo " "
19187 case "$sig_name_init" in
19188 '') doinit=yes ;;
19189 *)  case "$sig_num_init" in
19190     ''|*,*) doinit=yes ;;
19191     esac ;;
19192 esac
19193 case "$doinit" in
19194 yes)
19195         echo "Generating a list of signal names and numbers..." >&4
19196         . ./signal_cmd
19197         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19198         sig_name=`$awk 'BEGIN { printf "ZERO " }
19199                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19200         sig_num=`$awk  'BEGIN { printf "0 " }
19201                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19202         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19203                              !/^NSIG/   { printf "\"%s\", ", $1 }
19204                              END        { printf "0\n" }' signal.lst`
19205         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19206                              !/^NSIG/   { printf "%d, ", $2}
19207                              END        { printf "0\n"}' signal.lst`
19208         ;;
19209 esac
19210 echo "The following $sig_count signals are available:"
19211 echo " "
19212 echo $sig_name | $awk \
19213 'BEGIN { linelen = 0 }
19214 {
19215         for (i = 1; i <= NF; i++) {
19216                 name = "SIG" $i " "
19217                 linelen = linelen + length(name)
19218                 if (linelen > 70) {
19219                         printf "\n"
19220                         linelen = length(name)
19221                 }
19222                 printf "%s", name
19223         }
19224         printf "\n"
19225 }'
19226 sig_size=`echo $sig_name | awk '{print NF}'`
19227 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19228
19229 echo " "
19230 case "$sizetype" in
19231 *_t) zzz="$sizetype"    ;;
19232 *)   zzz="filesize"     ;;
19233 esac
19234 echo "Checking the size of $zzz..." >&4 
19235 cat > try.c <<EOCP
19236 #include <sys/types.h>
19237 #include <stdio.h>
19238 #$i_stdlib I_STDLIB
19239 #ifdef I_STDLIB
19240 #include <stdlib.h>
19241 #endif
19242 int main() {
19243     printf("%d\n", (int)sizeof($sizetype));
19244     exit(0);
19245 }
19246 EOCP
19247 set try
19248 if eval $compile_ok; then
19249         yyy=`$run ./try`
19250         case "$yyy" in
19251         '')     sizesize=4
19252                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19253                 ;;
19254         *)      sizesize=$yyy
19255                 echo "Your $zzz size is $sizesize bytes."
19256                 ;;
19257         esac
19258 else
19259         sizesize=4
19260         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19261 fi
19262
19263
19264 : check for socklen_t
19265 echo " "
19266 echo "Checking to see if you have socklen_t..." >&4
19267 $cat >try.c <<EOCP
19268 #include <sys/types.h>
19269 #$d_socket HAS_SOCKET
19270 #ifdef HAS_SOCKET
19271 #include <sys/socket.h>
19272 #endif
19273 int main() { socklen_t x = 16; }
19274 EOCP
19275 set try
19276 if eval $compile; then
19277         val="$define"
19278         echo "You have socklen_t."
19279 else
19280         val="$undef"
19281         echo "You do not have socklen_t."
19282         case "$sizetype" in
19283         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19284         esac
19285 fi
19286 $rm -f try try.*
19287 set d_socklen_t
19288 eval $setvar
19289
19290 : see if this is a socks.h system
19291 set socks.h i_socks
19292 eval $inhdr
19293
19294 : check for type of the size argument to socket calls
19295 case "$d_socket" in
19296 "$define")
19297         $cat <<EOM
19298
19299 Checking to see what type is the last argument of accept().
19300 EOM
19301         yyy=''
19302         case "$d_socklen_t" in
19303         "$define") yyy="$yyy socklen_t"
19304         esac
19305         yyy="$yyy $sizetype int long unsigned"
19306         for xxx in $yyy; do
19307                 case "$socksizetype" in
19308                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19309                         case "$usesocks" in
19310                         "$define")
19311                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19312                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19313                                         socksizetype="$xxx"
19314                                 fi
19315                                 ;;
19316                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19317                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19318                                         socksizetype="$xxx"
19319                                 fi
19320                                 ;;
19321                         esac
19322                         ;;
19323                 esac
19324         done
19325 : In case none of those worked, prompt the user.
19326         case "$socksizetype" in
19327         '')     rp='What is the type for socket address structure sizes?'
19328                 dflt='int'
19329                 . ./myread
19330                 socksizetype=$ans
19331                 ;;
19332         esac
19333         ;;
19334 *)      : no sockets, so pick relatively harmless default
19335         socksizetype='int'
19336         ;;
19337 esac
19338
19339 : see what type is used for signed size_t
19340 set ssize_t ssizetype int stdio.h sys/types.h
19341 eval $typedef
19342 dflt="$ssizetype"
19343 $cat > try.c <<EOM
19344 #include <stdio.h>
19345 #$i_stdlib I_STDLIB
19346 #ifdef I_STDLIB
19347 #include <stdlib.h>
19348 #endif
19349 #include <sys/types.h>
19350 #define Size_t $sizetype
19351 #define SSize_t $dflt
19352 int main()
19353 {
19354         if (sizeof(Size_t) == sizeof(SSize_t))
19355                 printf("$dflt\n");
19356         else if (sizeof(Size_t) == sizeof(int))
19357                 printf("int\n");
19358         else 
19359                 printf("long\n");
19360         exit(0);
19361 }
19362 EOM
19363 echo " "
19364 set try
19365 if eval $compile_ok && $run ./try > /dev/null; then
19366         ssizetype=`$run ./try`
19367         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19368 else
19369         $cat >&4 <<EOM
19370 Help! I can't compile and run the ssize_t test program: please enlighten me!
19371 (This is probably a misconfiguration in your system or libraries, and
19372 you really ought to fix it.  Still, I'll try anyway.)
19373
19374 I need a type that is the same size as $sizetype, but is guaranteed to
19375 be signed.  Common values are ssize_t, int and long.
19376
19377 EOM
19378         rp="What signed type is the same size as $sizetype?"
19379         . ./myread
19380         ssizetype="$ans"
19381 fi
19382 $rm -f try try.*
19383
19384 : see what type of char stdio uses.
19385 echo " "
19386 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19387 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19388         echo "Your stdio uses unsigned chars." >&4
19389         stdchar="unsigned char"
19390 else
19391         echo "Your stdio uses signed chars." >&4
19392         stdchar="char"
19393 fi
19394 $rm -f stdioh
19395
19396
19397
19398 : see what type uids are declared as in the kernel
19399 echo " "
19400 echo "Looking for the type for user ids returned by getuid()."
19401 set uid_t uidtype xxx stdio.h sys/types.h
19402 eval $typedef
19403 case "$uidtype" in
19404 xxx)
19405         xxx=`./findhdr sys/user.h`
19406         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19407         case $1 in
19408         unsigned) dflt="$1 $2" ;;
19409         *) dflt="$1" ;;
19410         esac
19411         ;;
19412 *) dflt="$uidtype";;
19413 esac
19414 case "$uidtype" in
19415 uid_t)  echo "uid_t found." ;;
19416 *)      rp="What is the type for user ids returned by getuid()?"
19417         . ./myread
19418         uidtype="$ans"
19419         ;;
19420 esac
19421
19422 echo " "
19423 case "$uidtype" in
19424 *_t) zzz="$uidtype"     ;;
19425 *)   zzz="uid"          ;;
19426 esac
19427 echo "Checking the size of $zzz..." >&4 
19428 cat > try.c <<EOCP
19429 #include <sys/types.h>
19430 #include <stdio.h>
19431 #$i_stdlib I_STDLIB
19432 #ifdef I_STDLIB
19433 #include <stdlib.h>
19434 #endif
19435 int main() {
19436     printf("%d\n", (int)sizeof($uidtype));
19437     exit(0);
19438 }
19439 EOCP
19440 set try
19441 if eval $compile_ok; then
19442         yyy=`$run ./try`
19443         case "$yyy" in
19444         '')     uidsize=4
19445                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19446                 ;;
19447         *)      uidsize=$yyy
19448                 echo "Your $zzz is $uidsize bytes long."
19449                 ;;
19450         esac
19451 else
19452         uidsize=4
19453         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19454 fi
19455
19456 echo " "
19457 case "$uidtype" in
19458 *_t) zzz="$uidtype"     ;;
19459 *)   zzz="uid"          ;;
19460 esac
19461 echo "Checking the sign of $zzz..." >&4
19462 cat > try.c <<EOCP
19463 #include <sys/types.h>
19464 #include <stdio.h>
19465 int main() {
19466         $uidtype foo = -1;
19467         if (foo < 0)
19468                 printf("-1\n");
19469         else
19470                 printf("1\n");
19471 }
19472 EOCP
19473 set try
19474 if eval $compile; then
19475         yyy=`$run ./try`
19476         case "$yyy" in
19477         '')     uidsign=1
19478                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19479                 ;;
19480         *)      uidsign=$yyy
19481                 case "$uidsign" in
19482                  1) echo "Your $zzz is unsigned." ;;
19483                 -1) echo "Your $zzz is signed."   ;;
19484                 esac
19485                 ;;
19486         esac
19487 else
19488         uidsign=1
19489         echo "(I can't compile the test program--guessing unsigned.)" >&4
19490 fi
19491
19492
19493
19494 echo " "
19495 $echo "Checking the format string to be used for uids..." >&4
19496
19497 case "$uidsign" in
19498 -1)     if $test X"$uidsize" = X"$ivsize"; then
19499                 uidformat="$ivdformat"
19500         else
19501                 if $test X"$uidsize" = X"$longsize"; then
19502                         uidformat='"ld"'
19503                 else
19504                         if $test X"$uidsize" = X"$intsize"; then
19505                                 uidformat='"d"'
19506                         else
19507                                 if $test X"$uidsize" = X"$shortsize"; then
19508                                         uidformat='"hd"'
19509                                 fi
19510                         fi
19511                 fi
19512         fi
19513         ;;
19514 *)      if $test X"$uidsize" = X"$uvsize"; then
19515                 uidformat="$uvuformat"
19516         else
19517                 if $test X"$uidsize" = X"$longsize"; then
19518                         uidformat='"lu"'
19519                 else
19520                         if $test X"$uidsize" = X"$intsize"; then
19521                                 uidformat='"u"'
19522                         else
19523                                 if $test X"$uidsize" = X"$shortsize"; then
19524                                         uidformat='"hu"'
19525                                 fi
19526                         fi
19527                 fi
19528         fi
19529         ;;
19530 esac
19531
19532 : determine compiler compiler
19533 case "$yacc" in
19534 '')
19535         dflt=yacc;;
19536 *)
19537         dflt="$yacc";;
19538 esac
19539 echo " "
19540 comp='yacc'
19541 if $test -f "$byacc$_exe"; then
19542         dflt="$byacc"
19543         comp="byacc or $comp"
19544 fi
19545 if $test -f "$bison$_exe"; then
19546         comp="$comp or bison -y"
19547 fi
19548 rp="Which compiler compiler ($comp) shall I use?"
19549 . ./myread
19550 yacc="$ans"
19551 case "$yacc" in
19552 *bis*)
19553         case "$yacc" in
19554         *-y*) ;;
19555         *)
19556                 yacc="$yacc -y"
19557                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19558                 ;;
19559         esac
19560         ;;
19561 esac
19562
19563 : see if this is a fp.h system
19564 set fp.h i_fp
19565 eval $inhdr
19566
19567 : see if this is a fp_class.h system
19568 set fp_class.h i_fp_class
19569 eval $inhdr
19570
19571 : see if this is a ieeefp.h system
19572 case "$i_ieeefp" in
19573 '' ) set ieeefp.h i_ieeefp
19574      eval $inhdr
19575      ;;
19576 esac
19577
19578 : see if this is a libutil.h system
19579 set libutil.h i_libutil
19580 eval $inhdr
19581
19582 : see if mach cthreads are available
19583 if test "X$usethreads" = "X$define"; then
19584         set mach/cthreads.h i_machcthr
19585         eval $inhdr
19586 else
19587         i_machcthr="$undef"
19588 fi
19589
19590
19591
19592 : see if this is a mntent.h system
19593 set mntent.h i_mntent
19594 eval $inhdr
19595
19596 : see if ndbm.h is available
19597 set ndbm.h t_ndbm
19598 eval $inhdr
19599
19600 case "$t_ndbm" in
19601 $undef)
19602     # Some Linux distributions such as RedHat 7.1 put the
19603     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19604     if $test -f /usr/include/gdbm/ndbm.h; then
19605         echo '<gdbm/ndbm.h> found.'
19606         ccflags="$ccflags -I/usr/include/gdbm"
19607         cppflags="$cppflags -I/usr/include/gdbm"
19608         t_ndbm=$define
19609     fi
19610     ;;
19611 esac
19612
19613 case "$t_ndbm" in
19614 $define)
19615         : see if dbm_open exists
19616         set dbm_open d_dbm_open
19617         eval $inlibc
19618         case "$d_dbm_open" in
19619         $undef)
19620                 t_ndbm="$undef"
19621                 echo "We won't be including <ndbm.h>"
19622                 ;;
19623         esac
19624         ;;
19625 esac
19626 val="$t_ndbm"
19627 set i_ndbm
19628 eval $setvar
19629
19630 : see if net/errno.h is available
19631 val=''
19632 set net/errno.h val
19633 eval $inhdr
19634
19635 : Unfortunately, it causes problems on some systems.  Arrgh.
19636 case "$val" in
19637 $define)
19638         cat > try.c <<'EOM'
19639 #include <stdio.h>
19640 #include <errno.h>
19641 #include <net/errno.h>
19642 int func()
19643 {
19644         return ENOTSOCK;
19645 }
19646 EOM
19647         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19648                 echo "We'll be including <net/errno.h>." >&4
19649         else
19650                 echo "We won't be including <net/errno.h>." >&4
19651                 val="$undef"
19652         fi
19653         $rm -f try.* try
19654         ;;
19655 esac
19656 set i_neterrno
19657 eval $setvar
19658
19659 : see if netinet/tcp.h is available
19660 set netinet/tcp.h i_netinettcp
19661 eval $inhdr
19662
19663 : see if this is a poll.h system
19664 set poll.h i_poll
19665 eval $inhdr
19666
19667 : see if this is a prot.h system
19668 set prot.h i_prot
19669 eval $inhdr
19670
19671 echo " "
19672 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19673 $cat <<'EOSH' > Cppsym.know
19674 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19675 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19676 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19677 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19678 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19679 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19680 bull c cadmus clipper CMU COFF COMPILER_VERSION
19681 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19682 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19683 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19684 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19685 GLIBC GLIBC_MINOR
19686 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19687 H3050R H3050RX hbullx20 hcx host_mips
19688 hp200 hp300 hp700 HP700 hp800 hp9000
19689 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19690 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19691 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19692 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19693 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19694 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19695 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19696 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19697 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19698 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19699 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19700 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19701 MATH_HAS_NO_SIDE_EFFECTS
19702 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19703 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19704 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19705 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19706 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19707 NetBSD news1500 news1700 news1800 news1900 news3700
19708 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19709 ns32016 ns32332 ns32k nsc32000
19710 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19711 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19712 pc532 pdp11 PGC PIC plexus PORTAR posix
19713 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19714 POSIX_C_SOURCE POSIX_SOURCE POWER
19715 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19716 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19717 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19718 sony sony_news sonyrisc sparc sparclite spectrum
19719 stardent stdc STDC_EXT stratos sun sun3 sun386
19720 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19721 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19722 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19723 sysV68 sysV88 Tek4132 Tek4300 titan
19724 TM3200 TM5400 TM5600
19725 tower tower32 tower32_200 tower32_600 tower32_700
19726 tower32_800 tower32_850 tss
19727 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19728 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19729 unix UNIX95 UNIX99 unixpc unos
19730 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19731 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19732 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19733 USGr4 USGr4_2
19734 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19735 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19736 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19737 z8000
19738 EOSH
19739 # Maybe put other stuff here too.
19740 cat <<EOSH >>Cppsym.know
19741 $osname
19742 EOSH
19743 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19744 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19745 $cat Cppsym.know > Cppsym.c
19746 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19747 $rm -f Cppsym.a Cppsym.b Cppsym.c
19748 cat <<EOSH > Cppsym
19749 $startsh
19750 if $test \$# -gt 0; then
19751     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19752     if $test -s Cppsym.got; then
19753         $rm -f Cppsym.got
19754         exit 0
19755     fi
19756     $rm -f Cppsym.got
19757     exit 1
19758 else
19759     $tr " " "$trnl" | ./Cppsym.try
19760     exit 0
19761 fi
19762 EOSH
19763 chmod +x Cppsym
19764 $eunicefix Cppsym
19765 cat <<EOSH > Cppsym.try
19766 $startsh
19767 cat <<'EOCP' > try.c
19768 #include <stdio.h>
19769 int main() {
19770 EOCP
19771 $awk \\
19772 EOSH
19773 cat <<'EOSH' >> Cppsym.try
19774 'length($1) > 0 {
19775     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19776     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19777     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19778     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19779 }'       >> try.c
19780 echo 'return 0;}' >> try.c
19781 EOSH
19782 cat <<EOSH >> Cppsym.try
19783 ccflags="$ccflags"
19784 case "$osname-$gccversion" in
19785 irix-) ccflags="\$ccflags -woff 1178" ;;
19786 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19787 esac
19788 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19789 EOSH
19790 chmod +x Cppsym.try
19791 $eunicefix Cppsym.try
19792 ./Cppsym < Cppsym.know > Cppsym.true
19793 : now check the C compiler for additional symbols
19794 postprocess_cc_v=''
19795 case "$osname" in
19796 aix) postprocess_cc_v="|$tr , ' '" ;;
19797 esac
19798 $cat >ccsym <<EOS
19799 $startsh
19800 $cat >tmp.c <<EOF
19801 extern int foo;
19802 EOF
19803 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19804 do
19805         case "\$i" in
19806         -D*) echo "\$i" | $sed 's/^-D//';;
19807         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19808         esac
19809 done
19810 $rm -f try.c
19811 EOS
19812 postprocess_cc_v=''
19813 chmod +x ccsym
19814 $eunicefix ccsym
19815 ./ccsym > ccsym1.raw
19816 if $test -s ccsym1.raw; then
19817        $sort ccsym1.raw | $uniq >ccsym.raw
19818 else
19819        mv ccsym1.raw ccsym.raw
19820 fi
19821
19822 $awk '/\=/ { print $0; next }
19823         { print $0"=1" }' ccsym.raw >ccsym.list
19824 $awk '/\=/ { print $0; next }
19825         { print $0"=1" }' Cppsym.true >ccsym.true
19826 $comm -13 ccsym.true ccsym.list >ccsym.own
19827 $comm -12 ccsym.true ccsym.list >ccsym.com
19828 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19829 also=''
19830 if $test -z ccsym.raw; then
19831         echo "Your C compiler doesn't seem to define any symbols!" >&4
19832         echo " "
19833         echo "However, your C preprocessor defines the following symbols:"
19834         $cat Cppsym.true
19835         ccsymbols=''
19836         cppsymbols=`$cat Cppsym.true`
19837         cppsymbols=`echo $cppsymbols`
19838         cppccsymbols="$cppsymbols"
19839 else
19840         if $test -s ccsym.com; then
19841                 echo "Your C compiler and pre-processor define these symbols:"
19842                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19843                 also='also '
19844                 symbols='ones'
19845                 cppccsymbols=`$cat ccsym.com`
19846                 cppccsymbols=`echo $cppccsymbols`
19847                 $test "$silent" || sleep 1
19848         fi
19849         if $test -s ccsym.cpp; then
19850                 $test "$also" && echo " "
19851                 echo "Your C pre-processor ${also}defines the following symbols:"
19852                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19853                 also='further '
19854                 cppsymbols=`$cat ccsym.cpp`
19855                 cppsymbols=`echo $cppsymbols`
19856                 $test "$silent" || sleep 1
19857         fi
19858         if $test -s ccsym.own; then
19859                 $test "$also" && echo " "
19860                 echo "Your C compiler ${also}defines the following cpp symbols:"
19861                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19862                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19863                 ccsymbols=`$cat ccsym.own`
19864                 ccsymbols=`echo $ccsymbols`
19865                 $test "$silent" || sleep 1
19866         fi
19867 fi
19868
19869 : see if this is a termio system
19870 val="$undef"
19871 val2="$undef"
19872 val3="$undef"
19873 if $test `./findhdr termios.h`; then
19874         set tcsetattr i_termios
19875         eval $inlibc
19876         val3="$i_termios"
19877 fi
19878 echo " "
19879 case "$val3" in
19880 "$define") echo "You have POSIX termios.h... good!" >&4;;
19881 *) if ./Cppsym pyr; then
19882                 case "`/bin/universe`" in
19883                 ucb) if $test `./findhdr sgtty.h`; then
19884                                 val2="$define"
19885                                 echo "<sgtty.h> found." >&4
19886                         else
19887                                 echo "System is pyramid with BSD universe."
19888                                 echo "<sgtty.h> not found--you could have problems." >&4
19889                         fi;;
19890                 *) if $test `./findhdr termio.h`; then
19891                                 val="$define"
19892                                 echo "<termio.h> found." >&4
19893                         else
19894                                 echo "System is pyramid with USG universe."
19895                                 echo "<termio.h> not found--you could have problems." >&4
19896                         fi;;
19897                 esac
19898         elif ./usg; then
19899                 if $test `./findhdr termio.h`; then
19900                         echo "<termio.h> found." >&4
19901                         val="$define"
19902                 elif $test `./findhdr sgtty.h`; then
19903                         echo "<sgtty.h> found." >&4
19904                         val2="$define"
19905                 else
19906 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19907                 fi
19908         else
19909                 if $test `./findhdr sgtty.h`; then
19910                         echo "<sgtty.h> found." >&4
19911                         val2="$define"
19912                 elif $test `./findhdr termio.h`; then
19913                         echo "<termio.h> found." >&4
19914                         val="$define"
19915                 else
19916 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19917                 fi
19918         fi;;
19919 esac
19920 set i_termio; eval $setvar
19921 val=$val2; set i_sgtty; eval $setvar
19922 val=$val3; set i_termios; eval $setvar
19923
19924 : see if stddef is available
19925 set stddef.h i_stddef
19926 eval $inhdr
19927
19928 : see if this is a sunmath.h system
19929 set sunmath.h i_sunmath
19930 eval $inhdr
19931
19932 : see if sys/access.h is available
19933 set sys/access.h i_sysaccess
19934 eval $inhdr
19935
19936 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19937 set sys/filio.h i_sysfilio
19938 eval $inhdr
19939 echo " "
19940 if $test `./findhdr sys/ioctl.h`; then
19941         val="$define"
19942         echo '<sys/ioctl.h> found.' >&4
19943 else
19944         val="$undef"
19945         if $test $i_sysfilio = "$define"; then
19946             echo '<sys/ioctl.h> NOT found.' >&4
19947         else
19948                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19949                 $test $i_termio = "$define" && xxx="termio.h"
19950                 $test $i_termios = "$define" && xxx="termios.h"
19951 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19952         fi
19953 fi
19954 set i_sysioctl
19955 eval $setvar
19956
19957 : see if socket ioctl defs are in sys/sockio.h
19958 echo " "
19959 xxx=`./findhdr sys/sockio.h`
19960 if $test "$xxx"; then
19961         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19962                 val="$define"
19963                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19964         else
19965                 val="$undef"
19966                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19967         fi
19968 else
19969         val="$undef"
19970         $cat <<EOM
19971 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19972 EOM
19973 fi
19974 set i_syssockio
19975 eval $setvar
19976
19977
19978 : see if this is a syslog.h system
19979 set syslog.h i_syslog
19980 eval $inhdr
19981
19982
19983 : see if this is a sys/mode.h system
19984 set sys/mode.h i_sysmode
19985 eval $inhdr
19986
19987 : see if sys/resource.h has to be included
19988 set sys/resource.h i_sysresrc
19989 eval $inhdr
19990
19991 : see if sys/security.h is available
19992 set sys/security.h i_syssecrt
19993 eval $inhdr
19994
19995 : see if this is a sys/statvfs.h system
19996 set sys/statvfs.h i_sysstatvfs
19997 eval $inhdr
19998
19999 : see if this is a sys/un.h system
20000 set sys/un.h i_sysun
20001 eval $inhdr
20002
20003
20004 : see if this is a sys/utsname.h system
20005 set sys/utsname.h i_sysutsname
20006 eval $inhdr
20007
20008 : see if this is a syswait system
20009 set sys/wait.h i_syswait
20010 eval $inhdr
20011
20012 : see if this is a ustat.h system
20013 set ustat.h i_ustat
20014 eval $inhdr
20015
20016 : see if this is an utime system
20017 set utime.h i_utime
20018 eval $inhdr
20019
20020 : see if this is a values.h system
20021 set values.h i_values
20022 eval $inhdr
20023
20024 : see if this is a vfork system
20025 case "$d_vfork" in
20026 "$define")
20027         set vfork.h i_vfork
20028         eval $inhdr
20029         ;;
20030 *)
20031         i_vfork="$undef"
20032         ;;
20033 esac
20034
20035 : see if gdbm.h is available
20036 set gdbm.h t_gdbm
20037 eval $inhdr
20038 case "$t_gdbm" in
20039 $define)
20040         : see if gdbm_open exists
20041         set gdbm_open d_gdbm_open
20042         eval $inlibc
20043         case "$d_gdbm_open" in
20044         $undef)
20045                 t_gdbm="$undef"
20046                 echo "We won't be including <gdbm.h>"
20047                 ;;
20048         esac
20049         ;;
20050 esac
20051 val="$t_gdbm"
20052 set i_gdbm
20053 eval $setvar
20054
20055 echo " "
20056 echo "Looking for extensions..." >&4
20057 : If we are using the old config.sh, known_extensions may contain
20058 : old or inaccurate or duplicate values.
20059 known_extensions=''
20060 nonxs_extensions=''
20061 : We do not use find because it might not be available.
20062 : We do not just use MANIFEST because the user may have dropped
20063 : some additional extensions into the source tree and expect them
20064 : to be built.
20065
20066 : Function to recursively find available extensions, ignoring DynaLoader
20067 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20068 find_extensions='
20069     for xxx in *; do
20070        case "$xxx" in
20071            DynaLoader|dynaload) ;;
20072            *)
20073            if $test -f $xxx/$xxx.xs; then
20074                known_extensions="$known_extensions $1$xxx";
20075            elif $test -f $xxx/Makefile.PL; then
20076                nonxs_extensions="$nonxs_extensions $1$xxx";
20077            else
20078                if $test -d $xxx -a $# -lt 10; then
20079                    set $1$xxx/ $*;
20080                    cd "$xxx";
20081                    eval $find_extensions;
20082                    cd ..;
20083                    shift;
20084                fi;
20085            fi
20086            ;;
20087        esac;
20088     done'
20089 tdir=`pwd`
20090 cd "$rsrc/ext"
20091 set X
20092 shift
20093 eval $find_extensions
20094 # Special case:  Add in threads/shared since it is not picked up by the
20095 # recursive find above (and adding in general recursive finding breaks
20096 # SDBM_File/sdbm).  A.D.  10/25/2001.
20097 known_extensions="$known_extensions threads/shared"
20098 set X $nonxs_extensions
20099 shift
20100 nonxs_extensions="$*"
20101 set X $known_extensions
20102 shift
20103 known_extensions="$*"
20104 cd "$tdir"
20105
20106 : Now see which are supported on this system.
20107 avail_ext=''
20108 for xxx in $known_extensions ; do
20109         case "$xxx" in
20110         DB_File|db_file)
20111                 case "$i_db" in
20112                 $define) avail_ext="$avail_ext $xxx" ;;
20113                 esac
20114                 ;;
20115         GDBM_File|gdbm_fil)
20116                 case "$i_gdbm" in 
20117                 $define) avail_ext="$avail_ext $xxx" ;;
20118                 esac
20119                 ;;
20120         I18N/Langinfo|i18n_lan)
20121                 case "$i_langinfo$d_nl_langinfo" in 
20122                 $define$define) avail_ext="$avail_ext $xxx" ;;
20123                 esac
20124                 ;;
20125         NDBM_File|ndbm_fil)
20126                 case "$i_ndbm" in
20127                 $define)
20128                     case "$osname-$use64bitint" in
20129                     hpux-define)
20130                         case "$libs" in
20131                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20132                         esac
20133                         ;;
20134                     *) avail_ext="$avail_ext $xxx" ;;
20135                     esac
20136                     ;;
20137                 esac
20138                 ;;
20139         ODBM_File|odbm_fil) 
20140                 case "${i_dbm}${i_rpcsvcdbm}" in
20141                 *"${define}"*)
20142                     case "$osname-$use64bitint" in
20143                     hpux-define)
20144                         case "$libs" in
20145                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20146                         esac
20147                         ;;
20148                     *) avail_ext="$avail_ext $xxx" ;;
20149                     esac
20150                     ;;
20151                 esac
20152                 ;;
20153         POSIX|posix)
20154                 case "$useposix" in
20155                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20156                 esac
20157                 ;;
20158         Opcode|opcode)
20159                 case "$useopcode" in
20160                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20161                 esac
20162                 ;;
20163         Socket|socket)
20164                 case "$d_socket" in 
20165                 true|$define|y)
20166                     case "$osname" in
20167                     beos) ;; # not unless BONE
20168                     *) avail_ext="$avail_ext $xxx" ;;
20169                     esac
20170                     ;;
20171                 esac
20172                 ;;
20173         Sys/Syslog|sys/syslog)
20174                 : XXX syslog requires socket
20175                 case "$d_socket" in 
20176                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20177                 esac
20178                 ;;
20179         Thread|thread)
20180                 case "$usethreads" in
20181                 true|$define|y)
20182                         case "$useithreads" in
20183                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20184                         esac
20185                 esac
20186                 ;;
20187         XS/APItest|xs/apitest)
20188                 # This is just for testing.  Skip it unless we have dynamic loading.
20189
20190                 case "$usedl" in
20191                 $define) avail_ext="$avail_ext $xxx" ;;
20192                 esac
20193                 ;;
20194         XS/Typemap|xs/typemap)
20195                 # This is just for testing.  Skip it unless we have dynamic loading.
20196                 case "$usedl" in
20197                 $define) avail_ext="$avail_ext $xxx" ;;
20198                 esac
20199                 ;;
20200         threads|threads/shared)
20201                 # threads and threads::shared are special cases.
20202                 # To stop people from asking "Perl 5.8.0 was supposed
20203                 # to have this new fancy threads implementation but my
20204                 # perl doesn't have it" and from people trying to
20205                 # (re)install the threads module using CPAN.pm and
20206                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20207                 # the threads.pm and threads/shared.pm will always be
20208                 # there, croaking informatively ("you need to rebuild
20209                 # all of Perl with threads, sorry") when threads haven't
20210                 # been compiled in.
20211                 # --jhi
20212                 avail_ext="$avail_ext $xxx"
20213                 ;;
20214         IPC/SysV|ipc/sysv)
20215                 : XXX Do we need a useipcsysv variable here
20216                 case "${d_msg}${d_sem}${d_shm}" in 
20217                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20218                 esac
20219                 ;;
20220         *)      avail_ext="$avail_ext $xxx"
20221                 ;;
20222         esac
20223 done
20224
20225 set X $avail_ext
20226 shift
20227 avail_ext="$*"
20228
20229 case "$onlyextensions" in
20230 '') ;;
20231 *)  keepextensions=''
20232     echo "You have requested that only certains extensions be included..." >&4
20233     for i in $onlyextensions; do
20234         case " $avail_ext " in
20235         *" $i "*)
20236             echo "Keeping extension $i."
20237             keepextensions="$keepextensions $i"
20238             ;;
20239         *) echo "Ignoring extension $i." ;;
20240         esac
20241     done
20242     avail_ext="$keepextensions"
20243     ;;
20244 esac
20245
20246 case "$noextensions" in
20247 '') ;;
20248 *)  keepextensions=''
20249     echo "You have requested that certain extensions be ignored..." >&4
20250     for i in $avail_ext; do
20251         case " $noextensions " in
20252         *" $i "*) echo "Ignoring extension $i." ;;
20253         *) echo "Keeping extension $i.";
20254            keepextensions="$keepextensions $i"
20255            ;;
20256         esac
20257     done
20258     avail_ext="$keepextensions"
20259     ;;
20260 esac
20261
20262 : Now see which nonxs extensions are supported on this system.
20263 : For now assume all are.
20264 nonxs_ext=''
20265 for xxx in $nonxs_extensions ; do
20266         case "$xxx" in
20267         *)      nonxs_ext="$nonxs_ext $xxx"
20268                 ;;
20269         esac
20270 done
20271
20272 set X $nonxs_ext
20273 shift
20274 nonxs_ext="$*"
20275
20276 case $usedl in
20277 $define)
20278         $cat <<EOM
20279 A number of extensions are supplied with $package.  You may choose to
20280 compile these extensions for dynamic loading (the default), compile
20281 them into the $package executable (static loading), or not include
20282 them at all.  Answer "none" to include no extensions.
20283 Note that DynaLoader is always built and need not be mentioned here.
20284
20285 EOM
20286         case "$dynamic_ext" in
20287         '')
20288                 : Exclude those listed in static_ext
20289                 dflt=''
20290                 for xxx in $avail_ext; do
20291                         case " $static_ext " in
20292                         *" $xxx "*) ;;
20293                         *) dflt="$dflt $xxx" ;;
20294                         esac
20295                 done
20296                 set X $dflt
20297                 shift
20298                 dflt="$*"
20299                 ;;
20300         *)      dflt="$dynamic_ext"
20301                 # Perhaps we are reusing an old out-of-date config.sh.
20302                 case "$hint" in
20303                 previous)
20304                         if test X"$dynamic_ext" != X"$avail_ext"; then
20305                                 $cat <<EOM
20306 NOTICE:  Your previous config.sh list may be incorrect. 
20307 The extensions now available to you are 
20308         ${avail_ext}
20309 but the default list from your previous config.sh is
20310         ${dynamic_ext} 
20311
20312 EOM
20313                         fi
20314                         ;;
20315                 esac
20316                 ;;
20317         esac
20318         case "$dflt" in
20319         '')     dflt=none;;
20320         esac
20321         rp="What extensions do you wish to load dynamically?"
20322         . ./myread
20323         case "$ans" in
20324         none) dynamic_ext=' ' ;;
20325         *) dynamic_ext="$ans" ;;
20326         esac
20327
20328         case "$static_ext" in
20329         '')
20330                 : Exclude those already listed in dynamic linking
20331                 dflt=''
20332                 for xxx in $avail_ext; do
20333                         case " $dynamic_ext " in
20334                         *" $xxx "*) ;;
20335                         *) dflt="$dflt $xxx" ;;
20336                         esac
20337                 done
20338                 set X $dflt
20339                 shift
20340                 dflt="$*"
20341                 ;;
20342         *)  dflt="$static_ext" 
20343                 ;;
20344         esac
20345
20346         case "$dflt" in
20347         '')     dflt=none;;
20348         esac
20349         rp="What extensions do you wish to load statically?"
20350         . ./myread
20351         case "$ans" in
20352         none) static_ext=' ' ;;
20353         *) static_ext="$ans" ;;
20354         esac
20355         ;;
20356 *)
20357         $cat <<EOM
20358 A number of extensions are supplied with $package.  Answer "none" 
20359 to include no extensions. 
20360 Note that DynaLoader is always built and need not be mentioned here.
20361
20362 EOM
20363         case "$static_ext" in
20364         '') dflt="$avail_ext" ;;
20365         *)      dflt="$static_ext"
20366                 # Perhaps we are reusing an old out-of-date config.sh.
20367                 case "$hint" in
20368                 previous)
20369                         if test X"$static_ext" != X"$avail_ext"; then
20370                                 $cat <<EOM
20371 NOTICE:  Your previous config.sh list may be incorrect. 
20372 The extensions now available to you are 
20373         ${avail_ext}
20374 but the default list from your previous config.sh is
20375         ${static_ext} 
20376
20377 EOM
20378                         fi
20379                         ;;
20380                 esac
20381                 ;;
20382         esac
20383         : Exclude those that are not xs extensions
20384         case "$dflt" in
20385         '')     dflt=none;;
20386         esac
20387         rp="What extensions do you wish to include?"
20388         . ./myread
20389         case "$ans" in
20390         none) static_ext=' ' ;;
20391         *) static_ext="$ans" ;;
20392         esac
20393         ;;
20394 esac
20395 #        
20396 # Encode is a special case.  If we are building Encode as a static
20397 # extension, we need to explicitly list its subextensions as well.
20398 # For other nested extensions, this is handled automatically by
20399 # the appropriate Makefile.PL.
20400 case " $static_ext " in
20401         *" Encode "*) # Add the subextensions of Encode
20402         cd "$rsrc/ext"
20403         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20404                 static_ext="$static_ext Encode/$xxx"
20405         done
20406         cd "$tdir"
20407         ;;
20408 esac
20409
20410 set X $dynamic_ext $static_ext $nonxs_ext
20411 shift
20412 extensions="$*"
20413
20414 # Sanity check:  We require an extension suitable for use with
20415 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20416 # should show up as failures in the test suite, but it's helpful to
20417 # catch them now.) The 'extensions' list is normally sorted
20418 # alphabetically, so we need to accept either
20419 #    DB_File ... Fcntl ... IO  ....
20420 # or something like
20421 #    Fcntl ... NDBM_File ... IO  ....
20422 case " $extensions"  in
20423 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20424 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20425 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20426 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20427    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20428    ;;
20429 esac
20430
20431 : Remove libraries needed only for extensions
20432 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20433 : The exception is SunOS 4.x, which needs them.
20434 case "${osname}X${osvers}" in
20435 sunos*X4*)
20436     perllibs="$libs"
20437     ;;
20438 *) case "$usedl" in
20439     $define|true|[yY]*)
20440             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20441             shift
20442             perllibs="$*"
20443             ;;
20444     *)  perllibs="$libs"
20445             ;;
20446     esac
20447     ;;
20448 esac
20449
20450 : Remove build directory name from cppstdin so it can be used from
20451 : either the present location or the final installed location.
20452 echo " "
20453 : Get out of the UU directory to get correct path name.
20454 cd ..
20455 case "$cppstdin" in
20456 `pwd`/cppstdin)
20457         echo "Stripping down cppstdin path name"
20458         cppstdin=cppstdin
20459         ;;
20460 esac
20461 cd UU
20462
20463 : end of configuration questions
20464 echo " "
20465 echo "End of configuration questions."
20466 echo " "
20467
20468 : back to where it started
20469 if test -d ../UU; then
20470         cd ..
20471 fi
20472
20473 : configuration may be patched via a 'config.arch' file
20474 if $test -f config.arch; then
20475         echo "I see a config.arch file, loading it."
20476         . ./config.arch
20477 fi
20478
20479 : configuration may be patched via a 'config.over' file
20480 if $test -f config.over; then
20481         echo " "
20482         dflt=y
20483         rp='I see a config.over file.  Do you wish to load it?'
20484         . UU/myread
20485         case "$ans" in
20486         n*) echo "OK, I'll ignore it.";;
20487         *)      . ./config.over
20488                 echo "Configuration override changes have been loaded."
20489                 ;;
20490         esac
20491 fi
20492
20493 : in case they want portability, strip down executable paths
20494 case "$d_portable" in
20495 "$define")
20496         echo " "
20497         echo "Stripping down executable paths..." >&4
20498         for file in $loclist $trylist; do
20499                 eval temp=\$$file
20500                 eval $file=`basename $temp`
20501         done
20502         ;;
20503 esac
20504
20505 : create config.sh file
20506 echo " "
20507 echo "Creating config.sh..." >&4
20508 $spitshell <<EOT >config.sh
20509 $startsh
20510 #
20511 # This file was produced by running the Configure script. It holds all the
20512 # definitions figured out by Configure. Should you modify one of these values,
20513 # do not forget to propagate your changes by running "Configure -der". You may
20514 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20515 #
20516
20517 # Package name      : $package
20518 # Source directory  : $src
20519 # Configuration time: $cf_time
20520 # Configured by     : $cf_by
20521 # Target system     : $myuname
20522
20523 Author='$Author'
20524 Date='$Date'
20525 Header='$Header'
20526 Id='$Id'
20527 Locker='$Locker'
20528 Log='$Log'
20529 Mcc='$Mcc'
20530 RCSfile='$RCSfile'
20531 Revision='$Revision'
20532 Source='$Source'
20533 State='$State'
20534 _a='$_a'
20535 _exe='$_exe'
20536 _o='$_o'
20537 afs='$afs'
20538 afsroot='$afsroot'
20539 alignbytes='$alignbytes'
20540 ansi2knr='$ansi2knr'
20541 aphostname='$aphostname'
20542 api_revision='$api_revision'
20543 api_subversion='$api_subversion'
20544 api_version='$api_version'
20545 api_versionstring='$api_versionstring'
20546 ar='$ar'
20547 archlib='$archlib'
20548 archlibexp='$archlibexp'
20549 archname64='$archname64'
20550 archname='$archname'
20551 archobjs='$archobjs'
20552 asctime_r_proto='$asctime_r_proto'
20553 awk='$awk'
20554 baserev='$baserev'
20555 bash='$bash'
20556 bin='$bin'
20557 binexp='$binexp'
20558 bison='$bison'
20559 byacc='$byacc'
20560 byteorder='$byteorder'
20561 c='$c'
20562 castflags='$castflags'
20563 cat='$cat'
20564 cc='$cc'
20565 cccdlflags='$cccdlflags'
20566 ccdlflags='$ccdlflags'
20567 ccflags='$ccflags'
20568 ccflags_uselargefiles='$ccflags_uselargefiles'
20569 ccname='$ccname'
20570 ccsymbols='$ccsymbols'
20571 ccversion='$ccversion'
20572 cf_by='$cf_by'
20573 cf_email='$cf_email'
20574 cf_time='$cf_time'
20575 charsize='$charsize'
20576 chgrp='$chgrp'
20577 chmod='$chmod'
20578 chown='$chown'
20579 clocktype='$clocktype'
20580 comm='$comm'
20581 compress='$compress'
20582 contains='$contains'
20583 cp='$cp'
20584 cpio='$cpio'
20585 cpp='$cpp'
20586 cpp_stuff='$cpp_stuff'
20587 cppccsymbols='$cppccsymbols'
20588 cppflags='$cppflags'
20589 cpplast='$cpplast'
20590 cppminus='$cppminus'
20591 cpprun='$cpprun'
20592 cppstdin='$cppstdin'
20593 cppsymbols='$cppsymbols'
20594 crypt_r_proto='$crypt_r_proto'
20595 cryptlib='$cryptlib'
20596 csh='$csh'
20597 ctermid_r_proto='$ctermid_r_proto'
20598 ctime_r_proto='$ctime_r_proto'
20599 d_Gconvert='$d_Gconvert'
20600 d_PRIEUldbl='$d_PRIEUldbl'
20601 d_PRIFUldbl='$d_PRIFUldbl'
20602 d_PRIGUldbl='$d_PRIGUldbl'
20603 d_PRIXU64='$d_PRIXU64'
20604 d_PRId64='$d_PRId64'
20605 d_PRIeldbl='$d_PRIeldbl'
20606 d_PRIfldbl='$d_PRIfldbl'
20607 d_PRIgldbl='$d_PRIgldbl'
20608 d_PRIi64='$d_PRIi64'
20609 d_PRIo64='$d_PRIo64'
20610 d_PRIu64='$d_PRIu64'
20611 d_PRIx64='$d_PRIx64'
20612 d_SCNfldbl='$d_SCNfldbl'
20613 d__fwalk='$d__fwalk'
20614 d_access='$d_access'
20615 d_accessx='$d_accessx'
20616 d_aintl='$d_aintl'
20617 d_alarm='$d_alarm'
20618 d_archlib='$d_archlib'
20619 d_asctime_r='$d_asctime_r'
20620 d_atolf='$d_atolf'
20621 d_atoll='$d_atoll'
20622 d_attribut='$d_attribut'
20623 d_bcmp='$d_bcmp'
20624 d_bcopy='$d_bcopy'
20625 d_bsd='$d_bsd'
20626 d_bsdgetpgrp='$d_bsdgetpgrp'
20627 d_bsdsetpgrp='$d_bsdsetpgrp'
20628 d_bzero='$d_bzero'
20629 d_casti32='$d_casti32'
20630 d_castneg='$d_castneg'
20631 d_charvspr='$d_charvspr'
20632 d_chown='$d_chown'
20633 d_chroot='$d_chroot'
20634 d_chsize='$d_chsize'
20635 d_class='$d_class'
20636 d_closedir='$d_closedir'
20637 d_cmsghdr_s='$d_cmsghdr_s'
20638 d_const='$d_const'
20639 d_copysignl='$d_copysignl'
20640 d_crypt='$d_crypt'
20641 d_crypt_r='$d_crypt_r'
20642 d_csh='$d_csh'
20643 d_ctermid_r='$d_ctermid_r'
20644 d_ctime_r='$d_ctime_r'
20645 d_cuserid='$d_cuserid'
20646 d_dbl_dig='$d_dbl_dig'
20647 d_dbminitproto='$d_dbminitproto'
20648 d_difftime='$d_difftime'
20649 d_dirfd='$d_dirfd'
20650 d_dirnamlen='$d_dirnamlen'
20651 d_dlerror='$d_dlerror'
20652 d_dlopen='$d_dlopen'
20653 d_dlsymun='$d_dlsymun'
20654 d_dosuid='$d_dosuid'
20655 d_drand48_r='$d_drand48_r'
20656 d_drand48proto='$d_drand48proto'
20657 d_dup2='$d_dup2'
20658 d_eaccess='$d_eaccess'
20659 d_endgrent='$d_endgrent'
20660 d_endgrent_r='$d_endgrent_r'
20661 d_endhent='$d_endhent'
20662 d_endhostent_r='$d_endhostent_r'
20663 d_endnent='$d_endnent'
20664 d_endnetent_r='$d_endnetent_r'
20665 d_endpent='$d_endpent'
20666 d_endprotoent_r='$d_endprotoent_r'
20667 d_endpwent='$d_endpwent'
20668 d_endpwent_r='$d_endpwent_r'
20669 d_endsent='$d_endsent'
20670 d_endservent_r='$d_endservent_r'
20671 d_eofnblk='$d_eofnblk'
20672 d_eunice='$d_eunice'
20673 d_faststdio='$d_faststdio'
20674 d_fchdir='$d_fchdir'
20675 d_fchmod='$d_fchmod'
20676 d_fchown='$d_fchown'
20677 d_fcntl='$d_fcntl'
20678 d_fcntl_can_lock='$d_fcntl_can_lock'
20679 d_fd_macros='$d_fd_macros'
20680 d_fd_set='$d_fd_set'
20681 d_fds_bits='$d_fds_bits'
20682 d_fgetpos='$d_fgetpos'
20683 d_finite='$d_finite'
20684 d_finitel='$d_finitel'
20685 d_flexfnam='$d_flexfnam'
20686 d_flock='$d_flock'
20687 d_flockproto='$d_flockproto'
20688 d_fork='$d_fork'
20689 d_fp_class='$d_fp_class'
20690 d_fpathconf='$d_fpathconf'
20691 d_fpclass='$d_fpclass'
20692 d_fpclassify='$d_fpclassify'
20693 d_fpclassl='$d_fpclassl'
20694 d_fpos64_t='$d_fpos64_t'
20695 d_frexpl='$d_frexpl'
20696 d_fs_data_s='$d_fs_data_s'
20697 d_fseeko='$d_fseeko'
20698 d_fsetpos='$d_fsetpos'
20699 d_fstatfs='$d_fstatfs'
20700 d_fstatvfs='$d_fstatvfs'
20701 d_fsync='$d_fsync'
20702 d_ftello='$d_ftello'
20703 d_ftime='$d_ftime'
20704 d_getcwd='$d_getcwd'
20705 d_getespwnam='$d_getespwnam'
20706 d_getfsstat='$d_getfsstat'
20707 d_getgrent='$d_getgrent'
20708 d_getgrent_r='$d_getgrent_r'
20709 d_getgrgid_r='$d_getgrgid_r'
20710 d_getgrnam_r='$d_getgrnam_r'
20711 d_getgrps='$d_getgrps'
20712 d_gethbyaddr='$d_gethbyaddr'
20713 d_gethbyname='$d_gethbyname'
20714 d_gethent='$d_gethent'
20715 d_gethname='$d_gethname'
20716 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20717 d_gethostbyname_r='$d_gethostbyname_r'
20718 d_gethostent_r='$d_gethostent_r'
20719 d_gethostprotos='$d_gethostprotos'
20720 d_getitimer='$d_getitimer'
20721 d_getlogin='$d_getlogin'
20722 d_getlogin_r='$d_getlogin_r'
20723 d_getmnt='$d_getmnt'
20724 d_getmntent='$d_getmntent'
20725 d_getnbyaddr='$d_getnbyaddr'
20726 d_getnbyname='$d_getnbyname'
20727 d_getnent='$d_getnent'
20728 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20729 d_getnetbyname_r='$d_getnetbyname_r'
20730 d_getnetent_r='$d_getnetent_r'
20731 d_getnetprotos='$d_getnetprotos'
20732 d_getpagsz='$d_getpagsz'
20733 d_getpbyname='$d_getpbyname'
20734 d_getpbynumber='$d_getpbynumber'
20735 d_getpent='$d_getpent'
20736 d_getpgid='$d_getpgid'
20737 d_getpgrp2='$d_getpgrp2'
20738 d_getpgrp='$d_getpgrp'
20739 d_getppid='$d_getppid'
20740 d_getprior='$d_getprior'
20741 d_getprotobyname_r='$d_getprotobyname_r'
20742 d_getprotobynumber_r='$d_getprotobynumber_r'
20743 d_getprotoent_r='$d_getprotoent_r'
20744 d_getprotoprotos='$d_getprotoprotos'
20745 d_getprpwnam='$d_getprpwnam'
20746 d_getpwent='$d_getpwent'
20747 d_getpwent_r='$d_getpwent_r'
20748 d_getpwnam_r='$d_getpwnam_r'
20749 d_getpwuid_r='$d_getpwuid_r'
20750 d_getsbyname='$d_getsbyname'
20751 d_getsbyport='$d_getsbyport'
20752 d_getsent='$d_getsent'
20753 d_getservbyname_r='$d_getservbyname_r'
20754 d_getservbyport_r='$d_getservbyport_r'
20755 d_getservent_r='$d_getservent_r'
20756 d_getservprotos='$d_getservprotos'
20757 d_getspnam='$d_getspnam'
20758 d_getspnam_r='$d_getspnam_r'
20759 d_gettimeod='$d_gettimeod'
20760 d_gmtime_r='$d_gmtime_r'
20761 d_gnulibc='$d_gnulibc'
20762 d_grpasswd='$d_grpasswd'
20763 d_hasmntopt='$d_hasmntopt'
20764 d_htonl='$d_htonl'
20765 d_ilogbl='$d_ilogbl'
20766 d_index='$d_index'
20767 d_inetaton='$d_inetaton'
20768 d_int64_t='$d_int64_t'
20769 d_isascii='$d_isascii'
20770 d_isfinite='$d_isfinite'
20771 d_isinf='$d_isinf'
20772 d_isnan='$d_isnan'
20773 d_isnanl='$d_isnanl'
20774 d_killpg='$d_killpg'
20775 d_lchown='$d_lchown'
20776 d_ldbl_dig='$d_ldbl_dig'
20777 d_libm_lib_version='$d_libm_lib_version'
20778 d_link='$d_link'
20779 d_localtime_r='$d_localtime_r'
20780 d_locconv='$d_locconv'
20781 d_lockf='$d_lockf'
20782 d_longdbl='$d_longdbl'
20783 d_longlong='$d_longlong'
20784 d_lseekproto='$d_lseekproto'
20785 d_lstat='$d_lstat'
20786 d_madvise='$d_madvise'
20787 d_mblen='$d_mblen'
20788 d_mbstowcs='$d_mbstowcs'
20789 d_mbtowc='$d_mbtowc'
20790 d_memchr='$d_memchr'
20791 d_memcmp='$d_memcmp'
20792 d_memcpy='$d_memcpy'
20793 d_memmove='$d_memmove'
20794 d_memset='$d_memset'
20795 d_mkdir='$d_mkdir'
20796 d_mkdtemp='$d_mkdtemp'
20797 d_mkfifo='$d_mkfifo'
20798 d_mkstemp='$d_mkstemp'
20799 d_mkstemps='$d_mkstemps'
20800 d_mktime='$d_mktime'
20801 d_mmap='$d_mmap'
20802 d_modfl='$d_modfl'
20803 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20804 d_modflproto='$d_modflproto'
20805 d_mprotect='$d_mprotect'
20806 d_msg='$d_msg'
20807 d_msg_ctrunc='$d_msg_ctrunc'
20808 d_msg_dontroute='$d_msg_dontroute'
20809 d_msg_oob='$d_msg_oob'
20810 d_msg_peek='$d_msg_peek'
20811 d_msg_proxy='$d_msg_proxy'
20812 d_msgctl='$d_msgctl'
20813 d_msgget='$d_msgget'
20814 d_msghdr_s='$d_msghdr_s'
20815 d_msgrcv='$d_msgrcv'
20816 d_msgsnd='$d_msgsnd'
20817 d_msync='$d_msync'
20818 d_munmap='$d_munmap'
20819 d_mymalloc='$d_mymalloc'
20820 d_nice='$d_nice'
20821 d_nl_langinfo='$d_nl_langinfo'
20822 d_nv_preserves_uv='$d_nv_preserves_uv'
20823 d_off64_t='$d_off64_t'
20824 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20825 d_oldpthreads='$d_oldpthreads'
20826 d_oldsock='$d_oldsock'
20827 d_open3='$d_open3'
20828 d_pathconf='$d_pathconf'
20829 d_pause='$d_pause'
20830 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20831 d_phostname='$d_phostname'
20832 d_pipe='$d_pipe'
20833 d_poll='$d_poll'
20834 d_portable='$d_portable'
20835 d_procselfexe='$d_procselfexe'
20836 d_pthread_atfork='$d_pthread_atfork'
20837 d_pthread_attr_setscope='$d_pthread_attr_setscope'
20838 d_pthread_yield='$d_pthread_yield'
20839 d_pwage='$d_pwage'
20840 d_pwchange='$d_pwchange'
20841 d_pwclass='$d_pwclass'
20842 d_pwcomment='$d_pwcomment'
20843 d_pwexpire='$d_pwexpire'
20844 d_pwgecos='$d_pwgecos'
20845 d_pwpasswd='$d_pwpasswd'
20846 d_pwquota='$d_pwquota'
20847 d_qgcvt='$d_qgcvt'
20848 d_quad='$d_quad'
20849 d_random_r='$d_random_r'
20850 d_readdir64_r='$d_readdir64_r'
20851 d_readdir='$d_readdir'
20852 d_readdir_r='$d_readdir_r'
20853 d_readlink='$d_readlink'
20854 d_readv='$d_readv'
20855 d_recvmsg='$d_recvmsg'
20856 d_rename='$d_rename'
20857 d_rewinddir='$d_rewinddir'
20858 d_rmdir='$d_rmdir'
20859 d_safebcpy='$d_safebcpy'
20860 d_safemcpy='$d_safemcpy'
20861 d_sanemcmp='$d_sanemcmp'
20862 d_sbrkproto='$d_sbrkproto'
20863 d_scalbnl='$d_scalbnl'
20864 d_sched_yield='$d_sched_yield'
20865 d_scm_rights='$d_scm_rights'
20866 d_seekdir='$d_seekdir'
20867 d_select='$d_select'
20868 d_sem='$d_sem'
20869 d_semctl='$d_semctl'
20870 d_semctl_semid_ds='$d_semctl_semid_ds'
20871 d_semctl_semun='$d_semctl_semun'
20872 d_semget='$d_semget'
20873 d_semop='$d_semop'
20874 d_sendmsg='$d_sendmsg'
20875 d_setegid='$d_setegid'
20876 d_seteuid='$d_seteuid'
20877 d_setgrent='$d_setgrent'
20878 d_setgrent_r='$d_setgrent_r'
20879 d_setgrps='$d_setgrps'
20880 d_sethent='$d_sethent'
20881 d_sethostent_r='$d_sethostent_r'
20882 d_setitimer='$d_setitimer'
20883 d_setlinebuf='$d_setlinebuf'
20884 d_setlocale='$d_setlocale'
20885 d_setlocale_r='$d_setlocale_r'
20886 d_setnent='$d_setnent'
20887 d_setnetent_r='$d_setnetent_r'
20888 d_setpent='$d_setpent'
20889 d_setpgid='$d_setpgid'
20890 d_setpgrp2='$d_setpgrp2'
20891 d_setpgrp='$d_setpgrp'
20892 d_setprior='$d_setprior'
20893 d_setproctitle='$d_setproctitle'
20894 d_setprotoent_r='$d_setprotoent_r'
20895 d_setpwent='$d_setpwent'
20896 d_setpwent_r='$d_setpwent_r'
20897 d_setregid='$d_setregid'
20898 d_setresgid='$d_setresgid'
20899 d_setresuid='$d_setresuid'
20900 d_setreuid='$d_setreuid'
20901 d_setrgid='$d_setrgid'
20902 d_setruid='$d_setruid'
20903 d_setsent='$d_setsent'
20904 d_setservent_r='$d_setservent_r'
20905 d_setsid='$d_setsid'
20906 d_setvbuf='$d_setvbuf'
20907 d_sfio='$d_sfio'
20908 d_shm='$d_shm'
20909 d_shmat='$d_shmat'
20910 d_shmatprototype='$d_shmatprototype'
20911 d_shmctl='$d_shmctl'
20912 d_shmdt='$d_shmdt'
20913 d_shmget='$d_shmget'
20914 d_sigaction='$d_sigaction'
20915 d_sigprocmask='$d_sigprocmask'
20916 d_sigsetjmp='$d_sigsetjmp'
20917 d_sitecustomize='$d_sitecustomize'
20918 d_sockatmark='$d_sockatmark'
20919 d_sockatmarkproto='$d_sockatmarkproto'
20920 d_socket='$d_socket'
20921 d_socklen_t='$d_socklen_t'
20922 d_sockpair='$d_sockpair'
20923 d_socks5_init='$d_socks5_init'
20924 d_sqrtl='$d_sqrtl'
20925 d_srand48_r='$d_srand48_r'
20926 d_srandom_r='$d_srandom_r'
20927 d_sresgproto='$d_sresgproto'
20928 d_sresuproto='$d_sresuproto'
20929 d_statblks='$d_statblks'
20930 d_statfs_f_flags='$d_statfs_f_flags'
20931 d_statfs_s='$d_statfs_s'
20932 d_statvfs='$d_statvfs'
20933 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20934 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20935 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20936 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20937 d_stdio_stream_array='$d_stdio_stream_array'
20938 d_stdiobase='$d_stdiobase'
20939 d_stdstdio='$d_stdstdio'
20940 d_strchr='$d_strchr'
20941 d_strcoll='$d_strcoll'
20942 d_strctcpy='$d_strctcpy'
20943 d_strerrm='$d_strerrm'
20944 d_strerror='$d_strerror'
20945 d_strerror_r='$d_strerror_r'
20946 d_strftime='$d_strftime'
20947 d_strlcat='$d_strlcat'
20948 d_strlcpy='$d_strlcpy'
20949 d_strtod='$d_strtod'
20950 d_strtol='$d_strtol'
20951 d_strtold='$d_strtold'
20952 d_strtoll='$d_strtoll'
20953 d_strtoq='$d_strtoq'
20954 d_strtoul='$d_strtoul'
20955 d_strtoull='$d_strtoull'
20956 d_strtouq='$d_strtouq'
20957 d_strxfrm='$d_strxfrm'
20958 d_suidsafe='$d_suidsafe'
20959 d_symlink='$d_symlink'
20960 d_syscall='$d_syscall'
20961 d_syscallproto='$d_syscallproto'
20962 d_sysconf='$d_sysconf'
20963 d_sysernlst='$d_sysernlst'
20964 d_syserrlst='$d_syserrlst'
20965 d_system='$d_system'
20966 d_tcgetpgrp='$d_tcgetpgrp'
20967 d_tcsetpgrp='$d_tcsetpgrp'
20968 d_telldir='$d_telldir'
20969 d_telldirproto='$d_telldirproto'
20970 d_time='$d_time'
20971 d_times='$d_times'
20972 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20973 d_tm_tm_zone='$d_tm_tm_zone'
20974 d_tmpnam_r='$d_tmpnam_r'
20975 d_truncate='$d_truncate'
20976 d_ttyname_r='$d_ttyname_r'
20977 d_tzname='$d_tzname'
20978 d_u32align='$d_u32align'
20979 d_ualarm='$d_ualarm'
20980 d_umask='$d_umask'
20981 d_uname='$d_uname'
20982 d_union_semun='$d_union_semun'
20983 d_unordered='$d_unordered'
20984 d_usleep='$d_usleep'
20985 d_usleepproto='$d_usleepproto'
20986 d_ustat='$d_ustat'
20987 d_vendorarch='$d_vendorarch'
20988 d_vendorbin='$d_vendorbin'
20989 d_vendorlib='$d_vendorlib'
20990 d_vendorscript='$d_vendorscript'
20991 d_vfork='$d_vfork'
20992 d_void_closedir='$d_void_closedir'
20993 d_voidsig='$d_voidsig'
20994 d_voidtty='$d_voidtty'
20995 d_volatile='$d_volatile'
20996 d_vprintf='$d_vprintf'
20997 d_wait4='$d_wait4'
20998 d_waitpid='$d_waitpid'
20999 d_wcstombs='$d_wcstombs'
21000 d_wctomb='$d_wctomb'
21001 d_writev='$d_writev'
21002 d_xenix='$d_xenix'
21003 date='$date'
21004 db_hashtype='$db_hashtype'
21005 db_prefixtype='$db_prefixtype'
21006 db_version_major='$db_version_major'
21007 db_version_minor='$db_version_minor'
21008 db_version_patch='$db_version_patch'
21009 defvoidused='$defvoidused'
21010 direntrytype='$direntrytype'
21011 dlext='$dlext'
21012 dlsrc='$dlsrc'
21013 doublesize='$doublesize'
21014 drand01='$drand01'
21015 drand48_r_proto='$drand48_r_proto'
21016 dynamic_ext='$dynamic_ext'
21017 eagain='$eagain'
21018 ebcdic='$ebcdic'
21019 echo='$echo'
21020 egrep='$egrep'
21021 emacs='$emacs'
21022 endgrent_r_proto='$endgrent_r_proto'
21023 endhostent_r_proto='$endhostent_r_proto'
21024 endnetent_r_proto='$endnetent_r_proto'
21025 endprotoent_r_proto='$endprotoent_r_proto'
21026 endpwent_r_proto='$endpwent_r_proto'
21027 endservent_r_proto='$endservent_r_proto'
21028 eunicefix='$eunicefix'
21029 exe_ext='$exe_ext'
21030 expr='$expr'
21031 extensions='$extensions'
21032 extras='$extras'
21033 fflushNULL='$fflushNULL'
21034 fflushall='$fflushall'
21035 find='$find'
21036 firstmakefile='$firstmakefile'
21037 flex='$flex'
21038 fpossize='$fpossize'
21039 fpostype='$fpostype'
21040 freetype='$freetype'
21041 from='$from'
21042 full_ar='$full_ar'
21043 full_csh='$full_csh'
21044 full_sed='$full_sed'
21045 gccansipedantic='$gccansipedantic'
21046 gccosandvers='$gccosandvers'
21047 gccversion='$gccversion'
21048 getgrent_r_proto='$getgrent_r_proto'
21049 getgrgid_r_proto='$getgrgid_r_proto'
21050 getgrnam_r_proto='$getgrnam_r_proto'
21051 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21052 gethostbyname_r_proto='$gethostbyname_r_proto'
21053 gethostent_r_proto='$gethostent_r_proto'
21054 getlogin_r_proto='$getlogin_r_proto'
21055 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21056 getnetbyname_r_proto='$getnetbyname_r_proto'
21057 getnetent_r_proto='$getnetent_r_proto'
21058 getprotobyname_r_proto='$getprotobyname_r_proto'
21059 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21060 getprotoent_r_proto='$getprotoent_r_proto'
21061 getpwent_r_proto='$getpwent_r_proto'
21062 getpwnam_r_proto='$getpwnam_r_proto'
21063 getpwuid_r_proto='$getpwuid_r_proto'
21064 getservbyname_r_proto='$getservbyname_r_proto'
21065 getservbyport_r_proto='$getservbyport_r_proto'
21066 getservent_r_proto='$getservent_r_proto'
21067 getspnam_r_proto='$getspnam_r_proto'
21068 gidformat='$gidformat'
21069 gidsign='$gidsign'
21070 gidsize='$gidsize'
21071 gidtype='$gidtype'
21072 glibpth='$glibpth'
21073 gmake='$gmake'
21074 gmtime_r_proto='$gmtime_r_proto'
21075 gnulibc_version='$gnulibc_version'
21076 grep='$grep'
21077 groupcat='$groupcat'
21078 groupstype='$groupstype'
21079 gzip='$gzip'
21080 h_fcntl='$h_fcntl'
21081 h_sysfile='$h_sysfile'
21082 hint='$hint'
21083 hostcat='$hostcat'
21084 html1dir='$html1dir'
21085 html1direxp='$html1direxp'
21086 html3dir='$html3dir'
21087 html3direxp='$html3direxp'
21088 i16size='$i16size'
21089 i16type='$i16type'
21090 i32size='$i32size'
21091 i32type='$i32type'
21092 i64size='$i64size'
21093 i64type='$i64type'
21094 i8size='$i8size'
21095 i8type='$i8type'
21096 i_arpainet='$i_arpainet'
21097 i_bsdioctl='$i_bsdioctl'
21098 i_crypt='$i_crypt'
21099 i_db='$i_db'
21100 i_dbm='$i_dbm'
21101 i_dirent='$i_dirent'
21102 i_dld='$i_dld'
21103 i_dlfcn='$i_dlfcn'
21104 i_fcntl='$i_fcntl'
21105 i_float='$i_float'
21106 i_fp='$i_fp'
21107 i_fp_class='$i_fp_class'
21108 i_gdbm='$i_gdbm'
21109 i_grp='$i_grp'
21110 i_ieeefp='$i_ieeefp'
21111 i_inttypes='$i_inttypes'
21112 i_langinfo='$i_langinfo'
21113 i_libutil='$i_libutil'
21114 i_limits='$i_limits'
21115 i_locale='$i_locale'
21116 i_machcthr='$i_machcthr'
21117 i_malloc='$i_malloc'
21118 i_math='$i_math'
21119 i_memory='$i_memory'
21120 i_mntent='$i_mntent'
21121 i_ndbm='$i_ndbm'
21122 i_netdb='$i_netdb'
21123 i_neterrno='$i_neterrno'
21124 i_netinettcp='$i_netinettcp'
21125 i_niin='$i_niin'
21126 i_poll='$i_poll'
21127 i_prot='$i_prot'
21128 i_pthread='$i_pthread'
21129 i_pwd='$i_pwd'
21130 i_rpcsvcdbm='$i_rpcsvcdbm'
21131 i_sfio='$i_sfio'
21132 i_sgtty='$i_sgtty'
21133 i_shadow='$i_shadow'
21134 i_socks='$i_socks'
21135 i_stdarg='$i_stdarg'
21136 i_stddef='$i_stddef'
21137 i_stdlib='$i_stdlib'
21138 i_string='$i_string'
21139 i_sunmath='$i_sunmath'
21140 i_sysaccess='$i_sysaccess'
21141 i_sysdir='$i_sysdir'
21142 i_sysfile='$i_sysfile'
21143 i_sysfilio='$i_sysfilio'
21144 i_sysin='$i_sysin'
21145 i_sysioctl='$i_sysioctl'
21146 i_syslog='$i_syslog'
21147 i_sysmman='$i_sysmman'
21148 i_sysmode='$i_sysmode'
21149 i_sysmount='$i_sysmount'
21150 i_sysndir='$i_sysndir'
21151 i_sysparam='$i_sysparam'
21152 i_sysresrc='$i_sysresrc'
21153 i_syssecrt='$i_syssecrt'
21154 i_sysselct='$i_sysselct'
21155 i_syssockio='$i_syssockio'
21156 i_sysstat='$i_sysstat'
21157 i_sysstatfs='$i_sysstatfs'
21158 i_sysstatvfs='$i_sysstatvfs'
21159 i_systime='$i_systime'
21160 i_systimek='$i_systimek'
21161 i_systimes='$i_systimes'
21162 i_systypes='$i_systypes'
21163 i_sysuio='$i_sysuio'
21164 i_sysun='$i_sysun'
21165 i_sysutsname='$i_sysutsname'
21166 i_sysvfs='$i_sysvfs'
21167 i_syswait='$i_syswait'
21168 i_termio='$i_termio'
21169 i_termios='$i_termios'
21170 i_time='$i_time'
21171 i_unistd='$i_unistd'
21172 i_ustat='$i_ustat'
21173 i_utime='$i_utime'
21174 i_values='$i_values'
21175 i_varargs='$i_varargs'
21176 i_varhdr='$i_varhdr'
21177 i_vfork='$i_vfork'
21178 ignore_versioned_solibs='$ignore_versioned_solibs'
21179 inc_version_list='$inc_version_list'
21180 inc_version_list_init='$inc_version_list_init'
21181 incpath='$incpath'
21182 inews='$inews'
21183 installarchlib='$installarchlib'
21184 installbin='$installbin'
21185 installhtml1dir='$installhtml1dir'
21186 installhtml3dir='$installhtml3dir'
21187 installman1dir='$installman1dir'
21188 installman3dir='$installman3dir'
21189 installprefix='$installprefix'
21190 installprefixexp='$installprefixexp'
21191 installprivlib='$installprivlib'
21192 installscript='$installscript'
21193 installsitearch='$installsitearch'
21194 installsitebin='$installsitebin'
21195 installsitehtml1dir='$installsitehtml1dir'
21196 installsitehtml3dir='$installsitehtml3dir'
21197 installsitelib='$installsitelib'
21198 installsiteman1dir='$installsiteman1dir'
21199 installsiteman3dir='$installsiteman3dir'
21200 installsitescript='$installsitescript'
21201 installstyle='$installstyle'
21202 installusrbinperl='$installusrbinperl'
21203 installvendorarch='$installvendorarch'
21204 installvendorbin='$installvendorbin'
21205 installvendorhtml1dir='$installvendorhtml1dir'
21206 installvendorhtml3dir='$installvendorhtml3dir'
21207 installvendorlib='$installvendorlib'
21208 installvendorman1dir='$installvendorman1dir'
21209 installvendorman3dir='$installvendorman3dir'
21210 installvendorscript='$installvendorscript'
21211 intsize='$intsize'
21212 issymlink='$issymlink'
21213 ivdformat='$ivdformat'
21214 ivsize='$ivsize'
21215 ivtype='$ivtype'
21216 known_extensions='$known_extensions'
21217 ksh='$ksh'
21218 ld='$ld'
21219 lddlflags='$lddlflags'
21220 ldflags='$ldflags'
21221 ldflags_uselargefiles='$ldflags_uselargefiles'
21222 ldlibpthname='$ldlibpthname'
21223 less='$less'
21224 lib_ext='$lib_ext'
21225 libc='$libc'
21226 libperl='$libperl'
21227 libpth='$libpth'
21228 libs='$libs'
21229 libsdirs='$libsdirs'
21230 libsfiles='$libsfiles'
21231 libsfound='$libsfound'
21232 libspath='$libspath'
21233 libswanted='$libswanted'
21234 libswanted_uselargefiles='$libswanted_uselargefiles'
21235 line='$line'
21236 lint='$lint'
21237 lkflags='$lkflags'
21238 ln='$ln'
21239 lns='$lns'
21240 localtime_r_proto='$localtime_r_proto'
21241 locincpth='$locincpth'
21242 loclibpth='$loclibpth'
21243 longdblsize='$longdblsize'
21244 longlongsize='$longlongsize'
21245 longsize='$longsize'
21246 lp='$lp'
21247 lpr='$lpr'
21248 ls='$ls'
21249 lseeksize='$lseeksize'
21250 lseektype='$lseektype'
21251 mail='$mail'
21252 mailx='$mailx'
21253 make='$make'
21254 make_set_make='$make_set_make'
21255 mallocobj='$mallocobj'
21256 mallocsrc='$mallocsrc'
21257 malloctype='$malloctype'
21258 man1dir='$man1dir'
21259 man1direxp='$man1direxp'
21260 man1ext='$man1ext'
21261 man3dir='$man3dir'
21262 man3direxp='$man3direxp'
21263 man3ext='$man3ext'
21264 mips_type='$mips_type'
21265 mistrustnm='$mistrustnm'
21266 mkdir='$mkdir'
21267 mmaptype='$mmaptype'
21268 modetype='$modetype'
21269 more='$more'
21270 multiarch='$multiarch'
21271 mv='$mv'
21272 myarchname='$myarchname'
21273 mydomain='$mydomain'
21274 myhostname='$myhostname'
21275 myuname='$myuname'
21276 n='$n'
21277 need_va_copy='$need_va_copy'
21278 netdb_hlen_type='$netdb_hlen_type'
21279 netdb_host_type='$netdb_host_type'
21280 netdb_name_type='$netdb_name_type'
21281 netdb_net_type='$netdb_net_type'
21282 nm='$nm'
21283 nm_opt='$nm_opt'
21284 nm_so_opt='$nm_so_opt'
21285 nonxs_ext='$nonxs_ext'
21286 nroff='$nroff'
21287 nvEUformat='$nvEUformat'
21288 nvFUformat='$nvFUformat'
21289 nvGUformat='$nvGUformat'
21290 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21291 nveformat='$nveformat'
21292 nvfformat='$nvfformat'
21293 nvgformat='$nvgformat'
21294 nvsize='$nvsize'
21295 nvtype='$nvtype'
21296 o_nonblock='$o_nonblock'
21297 obj_ext='$obj_ext'
21298 old_pthread_create_joinable='$old_pthread_create_joinable'
21299 optimize='$optimize'
21300 orderlib='$orderlib'
21301 osname='$osname'
21302 osvers='$osvers'
21303 otherlibdirs='$otherlibdirs'
21304 package='$package'
21305 pager='$pager'
21306 passcat='$passcat'
21307 patchlevel='$patchlevel'
21308 path_sep='$path_sep'
21309 perl5='$perl5'
21310 perl='$perl'
21311 perl_patchlevel='$perl_patchlevel'
21312 perladmin='$perladmin'
21313 perllibs='$perllibs'
21314 perlpath='$perlpath'
21315 pg='$pg'
21316 phostname='$phostname'
21317 pidtype='$pidtype'
21318 plibpth='$plibpth'
21319 pmake='$pmake'
21320 pr='$pr'
21321 prefix='$prefix'
21322 prefixexp='$prefixexp'
21323 privlib='$privlib'
21324 privlibexp='$privlibexp'
21325 procselfexe='$procselfexe'
21326 prototype='$prototype'
21327 ptrsize='$ptrsize'
21328 quadkind='$quadkind'
21329 quadtype='$quadtype'
21330 randbits='$randbits'
21331 randfunc='$randfunc'
21332 random_r_proto='$random_r_proto'
21333 randseedtype='$randseedtype'
21334 ranlib='$ranlib'
21335 rd_nodata='$rd_nodata'
21336 readdir64_r_proto='$readdir64_r_proto'
21337 readdir_r_proto='$readdir_r_proto'
21338 revision='$revision'
21339 rm='$rm'
21340 rmail='$rmail'
21341 run='$run'
21342 runnm='$runnm'
21343 sPRIEUldbl='$sPRIEUldbl'
21344 sPRIFUldbl='$sPRIFUldbl'
21345 sPRIGUldbl='$sPRIGUldbl'
21346 sPRIXU64='$sPRIXU64'
21347 sPRId64='$sPRId64'
21348 sPRIeldbl='$sPRIeldbl'
21349 sPRIfldbl='$sPRIfldbl'
21350 sPRIgldbl='$sPRIgldbl'
21351 sPRIi64='$sPRIi64'
21352 sPRIo64='$sPRIo64'
21353 sPRIu64='$sPRIu64'
21354 sPRIx64='$sPRIx64'
21355 sSCNfldbl='$sSCNfldbl'
21356 sched_yield='$sched_yield'
21357 scriptdir='$scriptdir'
21358 scriptdirexp='$scriptdirexp'
21359 sed='$sed'
21360 seedfunc='$seedfunc'
21361 selectminbits='$selectminbits'
21362 selecttype='$selecttype'
21363 sendmail='$sendmail'
21364 setgrent_r_proto='$setgrent_r_proto'
21365 sethostent_r_proto='$sethostent_r_proto'
21366 setlocale_r_proto='$setlocale_r_proto'
21367 setnetent_r_proto='$setnetent_r_proto'
21368 setprotoent_r_proto='$setprotoent_r_proto'
21369 setpwent_r_proto='$setpwent_r_proto'
21370 setservent_r_proto='$setservent_r_proto'
21371 sh='$sh'
21372 shar='$shar'
21373 sharpbang='$sharpbang'
21374 shmattype='$shmattype'
21375 shortsize='$shortsize'
21376 shrpenv='$shrpenv'
21377 shsharp='$shsharp'
21378 sig_count='$sig_count'
21379 sig_name='$sig_name'
21380 sig_name_init='$sig_name_init'
21381 sig_num='$sig_num'
21382 sig_num_init='$sig_num_init'
21383 sig_size='$sig_size'
21384 signal_t='$signal_t'
21385 sitearch='$sitearch'
21386 sitearchexp='$sitearchexp'
21387 sitebin='$sitebin'
21388 sitebinexp='$sitebinexp'
21389 sitehtml1dir='$sitehtml1dir'
21390 sitehtml1direxp='$sitehtml1direxp'
21391 sitehtml3dir='$sitehtml3dir'
21392 sitehtml3direxp='$sitehtml3direxp'
21393 sitelib='$sitelib'
21394 sitelib_stem='$sitelib_stem'
21395 sitelibexp='$sitelibexp'
21396 siteman1dir='$siteman1dir'
21397 siteman1direxp='$siteman1direxp'
21398 siteman3dir='$siteman3dir'
21399 siteman3direxp='$siteman3direxp'
21400 siteprefix='$siteprefix'
21401 siteprefixexp='$siteprefixexp'
21402 sitescript='$sitescript'
21403 sitescriptexp='$sitescriptexp'
21404 sizesize='$sizesize'
21405 sizetype='$sizetype'
21406 sleep='$sleep'
21407 smail='$smail'
21408 so='$so'
21409 sockethdr='$sockethdr'
21410 socketlib='$socketlib'
21411 socksizetype='$socksizetype'
21412 sort='$sort'
21413 spackage='$spackage'
21414 spitshell='$spitshell'
21415 srand48_r_proto='$srand48_r_proto'
21416 srandom_r_proto='$srandom_r_proto'
21417 src='$src'
21418 ssizetype='$ssizetype'
21419 startperl='$startperl'
21420 startsh='$startsh'
21421 static_ext='$static_ext'
21422 stdchar='$stdchar'
21423 stdio_base='$stdio_base'
21424 stdio_bufsiz='$stdio_bufsiz'
21425 stdio_cnt='$stdio_cnt'
21426 stdio_filbuf='$stdio_filbuf'
21427 stdio_ptr='$stdio_ptr'
21428 stdio_stream_array='$stdio_stream_array'
21429 strerror_r_proto='$strerror_r_proto'
21430 strings='$strings'
21431 submit='$submit'
21432 subversion='$subversion'
21433 sysman='$sysman'
21434 tail='$tail'
21435 tar='$tar'
21436 targetarch='$targetarch'
21437 tbl='$tbl'
21438 tee='$tee'
21439 test='$test'
21440 timeincl='$timeincl'
21441 timetype='$timetype'
21442 tmpnam_r_proto='$tmpnam_r_proto'
21443 to='$to'
21444 touch='$touch'
21445 tr='$tr'
21446 trnl='$trnl'
21447 troff='$troff'
21448 ttyname_r_proto='$ttyname_r_proto'
21449 u16size='$u16size'
21450 u16type='$u16type'
21451 u32size='$u32size'
21452 u32type='$u32type'
21453 u64size='$u64size'
21454 u64type='$u64type'
21455 u8size='$u8size'
21456 u8type='$u8type'
21457 uidformat='$uidformat'
21458 uidsign='$uidsign'
21459 uidsize='$uidsize'
21460 uidtype='$uidtype'
21461 uname='$uname'
21462 uniq='$uniq'
21463 uquadtype='$uquadtype'
21464 use5005threads='$use5005threads'
21465 use64bitall='$use64bitall'
21466 use64bitint='$use64bitint'
21467 usecrosscompile='$usecrosscompile'
21468 usedl='$usedl'
21469 usefaststdio='$usefaststdio'
21470 useithreads='$useithreads'
21471 uselargefiles='$uselargefiles'
21472 uselongdouble='$uselongdouble'
21473 usemallocwrap='$usemallocwrap'
21474 usemorebits='$usemorebits'
21475 usemultiplicity='$usemultiplicity'
21476 usemymalloc='$usemymalloc'
21477 usenm='$usenm'
21478 useopcode='$useopcode'
21479 useperlio='$useperlio'
21480 useposix='$useposix'
21481 usereentrant='$usereentrant'
21482 userelocatableinc='$userelocatableinc'
21483 usesfio='$usesfio'
21484 useshrplib='$useshrplib'
21485 usesitecustomize='$usesitecustomize'
21486 usesocks='$usesocks'
21487 usethreads='$usethreads'
21488 usevendorprefix='$usevendorprefix'
21489 usevfork='$usevfork'
21490 usrinc='$usrinc'
21491 uuname='$uuname'
21492 uvXUformat='$uvXUformat'
21493 uvoformat='$uvoformat'
21494 uvsize='$uvsize'
21495 uvtype='$uvtype'
21496 uvuformat='$uvuformat'
21497 uvxformat='$uvxformat'
21498 vendorarch='$vendorarch'
21499 vendorarchexp='$vendorarchexp'
21500 vendorbin='$vendorbin'
21501 vendorbinexp='$vendorbinexp'
21502 vendorhtml1dir='$vendorhtml1dir'
21503 vendorhtml1direxp='$vendorhtml1direxp'
21504 vendorhtml3dir='$vendorhtml3dir'
21505 vendorhtml3direxp='$vendorhtml3direxp'
21506 vendorlib='$vendorlib'
21507 vendorlib_stem='$vendorlib_stem'
21508 vendorlibexp='$vendorlibexp'
21509 vendorman1dir='$vendorman1dir'
21510 vendorman1direxp='$vendorman1direxp'
21511 vendorman3dir='$vendorman3dir'
21512 vendorman3direxp='$vendorman3direxp'
21513 vendorprefix='$vendorprefix'
21514 vendorprefixexp='$vendorprefixexp'
21515 vendorscript='$vendorscript'
21516 vendorscriptexp='$vendorscriptexp'
21517 version='$version'
21518 version_patchlevel_string='$version_patchlevel_string'
21519 versiononly='$versiononly'
21520 vi='$vi'
21521 voidflags='$voidflags'
21522 xlibpth='$xlibpth'
21523 yacc='$yacc'
21524 yaccflags='$yaccflags'
21525 zcat='$zcat'
21526 zip='$zip'
21527 EOT
21528
21529 : Add in command line options if available
21530 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21531
21532 : add special variables
21533 $test -f $src/patchlevel.h && \
21534 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21535 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21536 echo "PERL_CONFIG_SH=true" >>config.sh
21537
21538 : propagate old symbols
21539 if $test -f UU/config.sh; then
21540         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21541         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21542         $sort | $uniq -u >UU/oldsyms
21543         set X `cat UU/oldsyms`
21544         shift
21545         case $# in
21546         0) ;;
21547         *)
21548                 cat <<EOM
21549 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21550 EOM
21551                 echo "# Variables propagated from previous config.sh file." >>config.sh
21552                 for sym in `cat UU/oldsyms`; do
21553                         echo "    Propagating $hint variable "'$'"$sym..."
21554                         eval 'tmp="$'"${sym}"'"'
21555                         echo "$tmp" | \
21556                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21557                 done
21558                 ;;
21559         esac
21560 fi
21561
21562 : Finish up by extracting the .SH files
21563 case "$alldone" in
21564 exit)
21565         $rm -rf UU
21566         echo "Extraction done."
21567         exit 0
21568         ;;
21569 cont)
21570         ;;
21571 '')
21572         dflt=''
21573         nostick=true
21574         $cat <<EOM
21575
21576 If you'd like to make any changes to the config.sh file before I begin
21577 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21578
21579 EOM
21580         rp="Press return or use a shell escape to edit config.sh:"
21581         . UU/myread
21582         nostick=''
21583         case "$ans" in
21584         '') ;;
21585         *) : in case they cannot read
21586                 sh 1>&4 -c "$ans";;
21587         esac
21588         ;;
21589 esac
21590
21591 : if this fails, just run all the .SH files by hand
21592 . ./config.sh
21593
21594 echo " "
21595 exec 1>&4
21596 pwd=`pwd`
21597 . ./UU/extract
21598 cd "$pwd"
21599
21600 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21601         dflt=y
21602         case "$silent" in
21603         true) ;;
21604         *)
21605                 $cat <<EOM
21606
21607 Now you need to generate make dependencies by running "$make depend".
21608 You might prefer to run it in background: "$make depend > makedepend.out &"
21609 It can take a while, so you might not want to run it right now.
21610
21611 EOM
21612                 ;;
21613         esac
21614         rp="Run $make depend now?"
21615         . UU/myread
21616         case "$ans" in
21617         y*)
21618                 $make depend && echo "Now you must run '$make'."
21619                 ;;
21620         *)
21621                 echo "You must run '$make depend' then '$make'."
21622                 ;;
21623         esac
21624 elif test -f [Mm]akefile; then
21625         echo " "
21626         echo "Now you must run a $make."
21627 else
21628         echo "Configure done."
21629 fi
21630
21631 if $test -f Policy.sh; then
21632     $cat <<EOM
21633
21634 If you compile $package on a different machine or from a different object
21635 directory, copy the Policy.sh file from this object directory to the
21636 new one before you run Configure -- this will help you with most of
21637 the policy defaults.
21638
21639 EOM
21640 fi
21641 if $test -f config.msg; then
21642     echo "Hmm.  I also noted the following information while running:"
21643     echo " "
21644     $cat config.msg >&4
21645     $rm -f config.msg
21646 fi
21647 $rm -f kit*isdone ark*isdone
21648 $rm -rf UU
21649
21650 : End of Configure
21651