d4336faa12b33f45393e1fcfb7ea311a50a766fc
[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 Wed Mar  5 23:02:07 EET 2003 [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:/. ; 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         elif test -n "$DJGPP"; then
80                 case "X${MACHTYPE:-nonesuchmach}" in
81                 *cygwin) ;;
82                 *) p_=\; ;;
83                 esac
84         fi
85 fi
86
87 : Proper PATH setting
88 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
89 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
90 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
91 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
92 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
93 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
94 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
95 paths="$paths /sbin /usr/sbin /usr/libexec"
96 paths="$paths /system/gnu_library/bin"
97
98 for p in $paths
99 do
100         case "$p_$PATH$p_" in
101         *$p_$p$p_*) ;;
102         *) test -d $p && PATH=$PATH$p_$p ;;
103         esac
104 done
105
106 PATH=.$p_$PATH
107 export PATH
108
109 : shall we be using ksh?
110 inksh=''
111 needksh=''
112 avoidksh=''
113 newsh=/bin/ksh
114 changesh=''
115 if (PATH=.; alias -x) >/dev/null 2>&1; then
116                 inksh=true
117 fi
118 if test -f /hp-ux -a -f /bin/ksh; then
119         needksh='to avoid sh bug in "here document" expansion'
120 fi
121 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
122         if test X`/usr/bin/uname -v` = X4; then
123                 avoidksh="to avoid AIX 4's /bin/sh"
124                 newsh=/usr/bin/bsh
125         fi
126 fi
127 if test -f /osf_boot -a -f /usr/sbin/setld; then
128         if test X`/usr/bin/uname -s` = XOSF1; then
129                 avoidksh="to avoid Digital UNIX' ksh"
130                 newsh=/bin/sh
131                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
132         fi
133 fi
134 case "$inksh/$needksh" in
135 /[a-z]*)
136                 ENV=''
137                 changesh=true
138                 reason="$needksh"
139         ;;
140 esac
141 case "$inksh/$avoidksh" in
142 true/[a-z]*)
143         changesh=true
144         reason="$avoidksh"
145         ;;
146 esac
147 case "$inksh/$needksh-$avoidksh-" in
148 true/--)
149                 cat <<EOM
150 (I see you are using the Korn shell.  Some ksh's blow up on $me,
151 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
152 EOM
153         ;;
154 esac
155 case "$changesh" in
156 true)
157         export newsh
158         echo "(Feeding myself to $newsh $reason.)"
159         case "$0" in
160         Configure|*/Configure) exec $newsh $0 "$@";;
161         *) exec $newsh Configure "$@";;
162         esac
163         ;;
164 esac
165
166 : if needed set CDPATH to a harmless value that is not chatty
167 : avoid bash 2.02 problems with empty CDPATH.
168 case "$CDPATH" in
169 '')     ;;
170 *)      case "$SHELL" in
171         *bash*) CDPATH='.' ;;
172         *)              CDPATH='' ;;
173         esac
174         ;;
175 esac
176 : Configure runs within the UU subdirectory
177 test -d UU || mkdir UU
178 cd UU && rm -f ./*
179
180 ccname=''
181 ccversion=''
182 ccsymbols=''
183 cppccsymbols=''
184 cppsymbols=''
185 from=''
186 run=''
187 targetarch=''
188 to=''
189 usecrosscompile=''
190 perllibs=''
191 dynamic_ext=''
192 extensions=''
193 known_extensions=''
194 nonxs_ext=''
195 static_ext=''
196 useopcode=''
197 useposix=''
198 extras=''
199 d_bsd=''
200 d_eunice=''
201 d_xenix=''
202 eunicefix=''
203 Mcc=''
204 ar=''
205 awk=''
206 bash=''
207 bison=''
208 byacc=''
209 cat=''
210 chgrp=''
211 chmod=''
212 chown=''
213 comm=''
214 compress=''
215 cp=''
216 cpio=''
217 cpp=''
218 csh=''
219 date=''
220 echo=''
221 egrep=''
222 emacs=''
223 expr=''
224 find=''
225 flex=''
226 gmake=''
227 grep=''
228 gzip=''
229 inews=''
230 ksh=''
231 less=''
232 line=''
233 lint=''
234 ln=''
235 lp=''
236 lpr=''
237 ls=''
238 mail=''
239 mailx=''
240 make=''
241 mkdir=''
242 more=''
243 mv=''
244 nm=''
245 nroff=''
246 perl=''
247 pg=''
248 pmake=''
249 pr=''
250 rm=''
251 rmail=''
252 sed=''
253 sendmail=''
254 shar=''
255 sleep=''
256 smail=''
257 sort=''
258 submit=''
259 tail=''
260 tar=''
261 tbl=''
262 tee=''
263 test=''
264 touch=''
265 tr=''
266 troff=''
267 uname=''
268 uniq=''
269 uuname=''
270 vi=''
271 zcat=''
272 zip=''
273 full_ar=''
274 full_sed=''
275 libswanted=''
276 hint=''
277 myuname=''
278 osname=''
279 osvers=''
280 Author=''
281 Date=''
282 Header=''
283 Id=''
284 Locker=''
285 Log=''
286 RCSfile=''
287 Revision=''
288 Source=''
289 State=''
290 _a=''
291 _exe=''
292 _o=''
293 archobjs=''
294 exe_ext=''
295 firstmakefile=''
296 lib_ext=''
297 obj_ext=''
298 path_sep=''
299 afs=''
300 afsroot=''
301 alignbytes=''
302 ansi2knr=''
303 archlib=''
304 archlibexp=''
305 d_archlib=''
306 installarchlib=''
307 archname=''
308 myarchname=''
309 d_atolf=''
310 d_atoll=''
311 baserev=''
312 bin=''
313 binexp=''
314 installbin=''
315 byteorder=''
316 cc=''
317 ccflags=''
318 cppflags=''
319 ldflags=''
320 lkflags=''
321 locincpth=''
322 optimize=''
323 cf_email=''
324 cf_by=''
325 cf_time=''
326 charsize=''
327 contains=''
328 cpp_stuff=''
329 cpplast=''
330 cppminus=''
331 cpprun=''
332 cppstdin=''
333 d__fwalk=''
334 d_access=''
335 d_accessx=''
336 d_alarm=''
337 asctime_r_proto=''
338 d_asctime_r=''
339 d_attribut=''
340 d_bcmp=''
341 d_bcopy=''
342 d_bzero=''
343 d_casti32=''
344 castflags=''
345 d_castneg=''
346 d_chown=''
347 d_chroot=''
348 d_chsize=''
349 d_class=''
350 d_closedir=''
351 d_void_closedir=''
352 d_cmsghdr_s=''
353 d_const=''
354 cryptlib=''
355 d_crypt=''
356 crypt_r_proto=''
357 d_crypt_r=''
358 d_csh=''
359 full_csh=''
360 ctermid_r_proto=''
361 d_ctermid_r=''
362 ctime_r_proto=''
363 d_ctime_r=''
364 d_cuserid=''
365 d_dbl_dig=''
366 d_dbminitproto=''
367 d_difftime=''
368 d_dirfd=''
369 d_dlerror=''
370 d_dlopen=''
371 d_dlsymun=''
372 d_dosuid=''
373 d_suidsafe=''
374 d_drand48_r=''
375 drand48_r_proto=''
376 d_drand48proto=''
377 d_dup2=''
378 d_eaccess=''
379 d_endgrent=''
380 d_endgrent_r=''
381 endgrent_r_proto=''
382 d_endhent=''
383 d_endhostent_r=''
384 endhostent_r_proto=''
385 d_endnent=''
386 d_endnetent_r=''
387 endnetent_r_proto=''
388 d_endpent=''
389 d_endprotoent_r=''
390 endprotoent_r_proto=''
391 d_endpwent=''
392 d_endpwent_r=''
393 endpwent_r_proto=''
394 d_endsent=''
395 d_endservent_r=''
396 endservent_r_proto=''
397 d_fchdir=''
398 d_fchmod=''
399 d_fchown=''
400 d_fcntl=''
401 d_fcntl_can_lock=''
402 d_fd_macros=''
403 d_fd_set=''
404 d_fds_bits=''
405 d_fgetpos=''
406 d_finite=''
407 d_finitel=''
408 d_flexfnam=''
409 d_flock=''
410 d_flockproto=''
411 d_fork=''
412 d_fp_class=''
413 d_fpclass=''
414 d_fpclassify=''
415 d_fpclassl=''
416 d_fpos64_t=''
417 d_frexpl=''
418 d_fs_data_s=''
419 d_fseeko=''
420 d_fsetpos=''
421 d_fstatfs=''
422 d_fsync=''
423 d_ftello=''
424 d_ftime=''
425 d_gettimeod=''
426 d_Gconvert=''
427 d_getcwd=''
428 d_getespwnam=''
429 d_getfsstat=''
430 d_getgrent=''
431 d_getgrent_r=''
432 getgrent_r_proto=''
433 d_getgrgid_r=''
434 getgrgid_r_proto=''
435 d_getgrnam_r=''
436 getgrnam_r_proto=''
437 d_getgrps=''
438 d_gethbyaddr=''
439 d_gethbyname=''
440 d_gethent=''
441 aphostname=''
442 d_gethname=''
443 d_phostname=''
444 d_uname=''
445 d_gethostbyaddr_r=''
446 gethostbyaddr_r_proto=''
447 d_gethostbyname_r=''
448 gethostbyname_r_proto=''
449 d_gethostent_r=''
450 gethostent_r_proto=''
451 d_gethostprotos=''
452 d_getitimer=''
453 d_getlogin=''
454 d_getlogin_r=''
455 getlogin_r_proto=''
456 d_getmnt=''
457 d_getmntent=''
458 d_getnbyaddr=''
459 d_getnbyname=''
460 d_getnent=''
461 d_getnetbyaddr_r=''
462 getnetbyaddr_r_proto=''
463 d_getnetbyname_r=''
464 getnetbyname_r_proto=''
465 d_getnetent_r=''
466 getnetent_r_proto=''
467 d_getnetprotos=''
468 d_getpagsz=''
469 d_getpent=''
470 d_getpgid=''
471 d_getpgrp2=''
472 d_bsdgetpgrp=''
473 d_getpgrp=''
474 d_getppid=''
475 d_getprior=''
476 d_getpbyname=''
477 d_getpbynumber=''
478 d_getprotobyname_r=''
479 getprotobyname_r_proto=''
480 d_getprotobynumber_r=''
481 getprotobynumber_r_proto=''
482 d_getprotoent_r=''
483 getprotoent_r_proto=''
484 d_getprotoprotos=''
485 d_getprpwnam=''
486 d_getpwent=''
487 d_getpwent_r=''
488 getpwent_r_proto=''
489 d_getpwnam_r=''
490 getpwnam_r_proto=''
491 d_getpwuid_r=''
492 getpwuid_r_proto=''
493 d_getsent=''
494 d_getservbyname_r=''
495 getservbyname_r_proto=''
496 d_getservbyport_r=''
497 getservbyport_r_proto=''
498 d_getservent_r=''
499 getservent_r_proto=''
500 d_getservprotos=''
501 d_getspnam=''
502 d_getspnam_r=''
503 getspnam_r_proto=''
504 d_getsbyname=''
505 d_getsbyport=''
506 d_gmtime_r=''
507 gmtime_r_proto=''
508 d_gnulibc=''
509 gnulibc_version=''
510 d_hasmntopt=''
511 d_htonl=''
512 d_inetaton=''
513 d_int64_t=''
514 d_isascii=''
515 d_isfinite=''
516 d_isinf=''
517 d_isnan=''
518 d_isnanl=''
519 d_killpg=''
520 d_lchown=''
521 d_ldbl_dig=''
522 d_link=''
523 d_localtime_r=''
524 localtime_r_proto=''
525 d_locconv=''
526 d_lockf=''
527 d_longdbl=''
528 longdblsize=''
529 d_longlong=''
530 longlongsize=''
531 d_lseekproto=''
532 d_lstat=''
533 d_madvise=''
534 d_mblen=''
535 d_mbstowcs=''
536 d_mbtowc=''
537 d_memchr=''
538 d_memcmp=''
539 d_memcpy=''
540 d_memmove=''
541 d_memset=''
542 d_mkdir=''
543 d_mkdtemp=''
544 d_mkfifo=''
545 d_mkstemp=''
546 d_mkstemps=''
547 d_mktime=''
548 d_mmap=''
549 mmaptype=''
550 d_modfl=''
551 d_modfl_pow32_bug=''
552 d_modflproto=''
553 d_mprotect=''
554 d_msg=''
555 d_msgctl=''
556 d_msgget=''
557 d_msghdr_s=''
558 d_msgrcv=''
559 d_msgsnd=''
560 d_msync=''
561 d_munmap=''
562 d_nanosleep=''
563 d_nice=''
564 d_nl_langinfo=''
565 d_off64_t=''
566 d_open3=''
567 d_fpathconf=''
568 d_pathconf=''
569 d_pause=''
570 d_pipe=''
571 d_poll=''
572 d_portable=''
573 d_procselfexe=''
574 procselfexe=''
575 d_old_pthread_create_joinable=''
576 old_pthread_create_joinable=''
577 d_pthread_atfork=''
578 d_pthread_yield=''
579 d_sched_yield=''
580 sched_yield=''
581 d_qgcvt=''
582 d_random_r=''
583 random_r_proto=''
584 d_readdir64_r=''
585 readdir64_r_proto=''
586 d_readdir=''
587 d_rewinddir=''
588 d_seekdir=''
589 d_telldir=''
590 d_readdir_r=''
591 readdir_r_proto=''
592 d_readlink=''
593 d_readv=''
594 d_recvmsg=''
595 d_rename=''
596 d_rmdir=''
597 d_safebcpy=''
598 d_safemcpy=''
599 d_sanemcmp=''
600 d_sbrkproto=''
601 d_select=''
602 d_sem=''
603 d_semctl=''
604 d_semget=''
605 d_semop=''
606 d_sendmsg=''
607 d_setegid=''
608 d_seteuid=''
609 d_setgrent=''
610 d_setgrent_r=''
611 setgrent_r_proto=''
612 d_setgrps=''
613 d_sethent=''
614 d_sethostent_r=''
615 sethostent_r_proto=''
616 d_setitimer=''
617 d_setlinebuf=''
618 d_setlocale=''
619 d_setlocale_r=''
620 setlocale_r_proto=''
621 d_setnent=''
622 d_setnetent_r=''
623 setnetent_r_proto=''
624 d_setpent=''
625 d_setpgid=''
626 d_setpgrp2=''
627 d_bsdsetpgrp=''
628 d_setpgrp=''
629 d_setprior=''
630 d_setproctitle=''
631 d_setprotoent_r=''
632 setprotoent_r_proto=''
633 d_setpwent=''
634 d_setpwent_r=''
635 setpwent_r_proto=''
636 d_setregid=''
637 d_setresgid=''
638 d_setresuid=''
639 d_setreuid=''
640 d_setrgid=''
641 d_setruid=''
642 d_setsent=''
643 d_setservent_r=''
644 setservent_r_proto=''
645 d_setsid=''
646 d_setvbuf=''
647 d_sfio=''
648 usesfio=''
649 d_shm=''
650 d_shmat=''
651 d_shmatprototype=''
652 shmattype=''
653 d_shmctl=''
654 d_shmdt=''
655 d_shmget=''
656 d_sigaction=''
657 d_sigprocmask=''
658 d_sigsetjmp=''
659 d_sockatmark=''
660 d_sockatmarkproto=''
661 d_msg_ctrunc=''
662 d_msg_dontroute=''
663 d_msg_oob=''
664 d_msg_peek=''
665 d_msg_proxy=''
666 d_oldsock=''
667 d_scm_rights=''
668 d_socket=''
669 d_sockpair=''
670 sockethdr=''
671 socketlib=''
672 d_socklen_t=''
673 d_socks5_init=''
674 d_sqrtl=''
675 d_srand48_r=''
676 srand48_r_proto=''
677 d_srandom_r=''
678 srandom_r_proto=''
679 d_sresgproto=''
680 d_sresuproto=''
681 d_statblks=''
682 d_statfs_f_flags=''
683 d_statfs_s=''
684 d_fstatvfs=''
685 d_statvfs=''
686 d_stdio_cnt_lval=''
687 d_stdio_ptr_lval=''
688 d_stdio_ptr_lval_nochange_cnt=''
689 d_stdio_ptr_lval_sets_cnt=''
690 d_stdiobase=''
691 d_stdstdio=''
692 stdio_base=''
693 stdio_bufsiz=''
694 stdio_cnt=''
695 stdio_filbuf=''
696 stdio_ptr=''
697 d_index=''
698 d_strchr=''
699 d_strcoll=''
700 d_strctcpy=''
701 d_strerrm=''
702 d_strerror=''
703 d_sysernlst=''
704 d_syserrlst=''
705 d_strerror_r=''
706 strerror_r_proto=''
707 d_strftime=''
708 d_strtod=''
709 d_strtol=''
710 d_strtold=''
711 d_strtoll=''
712 d_strtoq=''
713 d_strtoul=''
714 d_strtoull=''
715 d_strtouq=''
716 d_strxfrm=''
717 d_symlink=''
718 d_syscall=''
719 d_syscallproto=''
720 d_sysconf=''
721 d_system=''
722 d_tcgetpgrp=''
723 d_tcsetpgrp=''
724 d_telldirproto=''
725 d_time=''
726 timetype=''
727 clocktype=''
728 d_times=''
729 d_tmpnam_r=''
730 tmpnam_r_proto=''
731 d_truncate=''
732 d_ttyname_r=''
733 ttyname_r_proto=''
734 d_tzname=''
735 d_u32align=''
736 d_ualarm=''
737 d_umask=''
738 d_semctl_semid_ds=''
739 d_semctl_semun=''
740 d_union_semun=''
741 d_unordered=''
742 d_usleep=''
743 d_usleepproto=''
744 d_ustat=''
745 d_vfork=''
746 usevfork=''
747 d_voidsig=''
748 signal_t=''
749 d_volatile=''
750 d_charvspr=''
751 d_vprintf=''
752 d_wait4=''
753 d_waitpid=''
754 d_wcstombs=''
755 d_wctomb=''
756 d_writev=''
757 dlext=''
758 cccdlflags=''
759 ccdlflags=''
760 dlsrc=''
761 ld=''
762 lddlflags=''
763 usedl=''
764 doublesize=''
765 ebcdic=''
766 fflushNULL=''
767 fflushall=''
768 fpossize=''
769 fpostype=''
770 gccansipedantic=''
771 gccosandvers=''
772 gccversion=''
773 gidformat=''
774 gidsign=''
775 gidsize=''
776 gidtype=''
777 groupstype=''
778 h_fcntl=''
779 h_sysfile=''
780 html1dir=''
781 html1direxp=''
782 installhtml1dir=''
783 html3dir=''
784 html3direxp=''
785 installhtml3dir=''
786 i_arpainet=''
787 i_crypt=''
788 db_hashtype=''
789 db_prefixtype=''
790 db_version_major=''
791 db_version_minor=''
792 db_version_patch=''
793 i_db=''
794 i_dbm=''
795 i_rpcsvcdbm=''
796 d_dirnamlen=''
797 direntrytype=''
798 i_dirent=''
799 i_dld=''
800 i_dlfcn=''
801 i_fcntl=''
802 i_float=''
803 i_fp=''
804 i_fp_class=''
805 i_gdbm=''
806 d_grpasswd=''
807 i_grp=''
808 i_ieeefp=''
809 i_inttypes=''
810 i_langinfo=''
811 i_libutil=''
812 i_limits=''
813 i_locale=''
814 i_machcthr=''
815 i_malloc=''
816 i_math=''
817 i_memory=''
818 i_mntent=''
819 i_ndbm=''
820 i_netdb=''
821 i_neterrno=''
822 i_netinettcp=''
823 i_niin=''
824 i_sysin=''
825 i_poll=''
826 i_prot=''
827 i_pthread=''
828 d_pwage=''
829 d_pwchange=''
830 d_pwclass=''
831 d_pwcomment=''
832 d_pwexpire=''
833 d_pwgecos=''
834 d_pwpasswd=''
835 d_pwquota=''
836 i_pwd=''
837 i_sfio=''
838 i_shadow=''
839 i_socks=''
840 i_stddef=''
841 i_stdlib=''
842 i_string=''
843 strings=''
844 i_sunmath=''
845 i_sysaccess=''
846 i_sysdir=''
847 i_sysfile=''
848 d_voidtty=''
849 i_bsdioctl=''
850 i_sysfilio=''
851 i_sysioctl=''
852 i_syssockio=''
853 i_syslog=''
854 i_sysmman=''
855 i_sysmode=''
856 i_sysmount=''
857 i_sysndir=''
858 i_sysparam=''
859 i_sysresrc=''
860 i_syssecrt=''
861 i_sysselct=''
862 i_sysstat=''
863 i_sysstatfs=''
864 i_sysstatvfs=''
865 i_systimes=''
866 i_systypes=''
867 i_sysuio=''
868 i_sysun=''
869 i_sysutsname=''
870 i_sysvfs=''
871 i_syswait=''
872 i_sgtty=''
873 i_termio=''
874 i_termios=''
875 d_tm_tm_gmtoff=''
876 d_tm_tm_zone=''
877 i_systime=''
878 i_systimek=''
879 i_time=''
880 timeincl=''
881 i_unistd=''
882 i_ustat=''
883 i_utime=''
884 i_values=''
885 i_stdarg=''
886 i_varargs=''
887 i_varhdr=''
888 i_vfork=''
889 inc_version_list=''
890 inc_version_list_init=''
891 installprefix=''
892 installprefixexp=''
893 installstyle=''
894 installusrbinperl=''
895 intsize=''
896 longsize=''
897 shortsize=''
898 issymlink=''
899 libc=''
900 ldlibpthname=''
901 libperl=''
902 shrpenv=''
903 useshrplib=''
904 glibpth=''
905 libpth=''
906 loclibpth=''
907 plibpth=''
908 xlibpth=''
909 ignore_versioned_solibs=''
910 libs=''
911 libsdirs=''
912 libsfiles=''
913 libsfound=''
914 libspath=''
915 lns=''
916 d_PRIEUldbl=''
917 d_PRIFUldbl=''
918 d_PRIGUldbl=''
919 d_PRIeldbl=''
920 d_PRIfldbl=''
921 d_PRIgldbl=''
922 d_SCNfldbl=''
923 sPRIEUldbl=''
924 sPRIFUldbl=''
925 sPRIGUldbl=''
926 sPRIeldbl=''
927 sPRIfldbl=''
928 sPRIgldbl=''
929 sSCNfldbl=''
930 lseeksize=''
931 lseektype=''
932 make_set_make=''
933 d_mymalloc=''
934 freetype=''
935 mallocobj=''
936 mallocsrc=''
937 malloctype=''
938 usemymalloc=''
939 installman1dir=''
940 man1dir=''
941 man1direxp=''
942 man1ext=''
943 installman3dir=''
944 man3dir=''
945 man3direxp=''
946 man3ext=''
947 modetype=''
948 multiarch=''
949 mydomain=''
950 myhostname=''
951 phostname=''
952 c=''
953 n=''
954 d_eofnblk=''
955 eagain=''
956 o_nonblock=''
957 rd_nodata=''
958 need_va_copy=''
959 netdb_hlen_type=''
960 netdb_host_type=''
961 netdb_name_type=''
962 netdb_net_type=''
963 groupcat=''
964 hostcat=''
965 passcat=''
966 orderlib=''
967 ranlib=''
968 d_perl_otherlibdirs=''
969 otherlibdirs=''
970 package=''
971 spackage=''
972 pager=''
973 api_revision=''
974 api_subversion=''
975 api_version=''
976 api_versionstring=''
977 patchlevel=''
978 perl_patchlevel=''
979 revision=''
980 subversion=''
981 version=''
982 version_patchlevel_string=''
983 perl5=''
984 perladmin=''
985 perlpath=''
986 d_nv_preserves_uv=''
987 i16size=''
988 i16type=''
989 i32size=''
990 i32type=''
991 i64size=''
992 i64type=''
993 i8size=''
994 i8type=''
995 ivsize=''
996 ivtype=''
997 nv_preserves_uv_bits=''
998 nvsize=''
999 nvtype=''
1000 u16size=''
1001 u16type=''
1002 u32size=''
1003 u32type=''
1004 u64size=''
1005 u64type=''
1006 u8size=''
1007 u8type=''
1008 uvsize=''
1009 uvtype=''
1010 ivdformat=''
1011 nvEUformat=''
1012 nvFUformat=''
1013 nvGUformat=''
1014 nveformat=''
1015 nvfformat=''
1016 nvgformat=''
1017 uvXUformat=''
1018 uvoformat=''
1019 uvuformat=''
1020 uvxformat=''
1021 pidtype=''
1022 prefix=''
1023 prefixexp=''
1024 installprivlib=''
1025 privlib=''
1026 privlibexp=''
1027 prototype=''
1028 ptrsize=''
1029 d_PRIXU64=''
1030 d_PRId64=''
1031 d_PRIi64=''
1032 d_PRIo64=''
1033 d_PRIu64=''
1034 d_PRIx64=''
1035 sPRIXU64=''
1036 sPRId64=''
1037 sPRIi64=''
1038 sPRIo64=''
1039 sPRIu64=''
1040 sPRIx64=''
1041 d_quad=''
1042 quadkind=''
1043 quadtype=''
1044 uquadtype=''
1045 drand01=''
1046 randbits=''
1047 randfunc=''
1048 randseedtype=''
1049 seedfunc=''
1050 installscript=''
1051 scriptdir=''
1052 scriptdirexp=''
1053 selectminbits=''
1054 selecttype=''
1055 sh=''
1056 sig_count=''
1057 sig_name=''
1058 sig_name_init=''
1059 sig_num=''
1060 sig_num_init=''
1061 sig_size=''
1062 installsitearch=''
1063 sitearch=''
1064 sitearchexp=''
1065 installsitebin=''
1066 sitebin=''
1067 sitebinexp=''
1068 installsitehtml1=''
1069 sitehtml1=''
1070 sitehtml1exp=''
1071 installsitehtml3=''
1072 sitehtml3=''
1073 sitehtml3exp=''
1074 installsitelib=''
1075 sitelib=''
1076 sitelib_stem=''
1077 sitelibexp=''
1078 installsiteman1=''
1079 siteman1=''
1080 siteman1exp=''
1081 installsiteman3=''
1082 siteman3=''
1083 siteman3exp=''
1084 siteprefix=''
1085 siteprefixexp=''
1086 installsitescript=''
1087 sitescript=''
1088 sitescriptexp=''
1089 sizesize=''
1090 sizetype=''
1091 so=''
1092 socksizetype=''
1093 sharpbang=''
1094 shsharp=''
1095 spitshell=''
1096 src=''
1097 ssizetype=''
1098 startperl=''
1099 startsh=''
1100 stdchar=''
1101 d_stdio_stream_array=''
1102 stdio_stream_array=''
1103 sysman=''
1104 trnl=''
1105 uidformat=''
1106 uidsign=''
1107 uidsize=''
1108 uidtype=''
1109 archname64=''
1110 use64bitall=''
1111 use64bitint=''
1112 ccflags_uselargefiles=''
1113 ldflags_uselargefiles=''
1114 libswanted_uselargefiles=''
1115 uselargefiles=''
1116 uselongdouble=''
1117 usemorebits=''
1118 usemultiplicity=''
1119 nm_opt=''
1120 nm_so_opt=''
1121 runnm=''
1122 usenm=''
1123 useperlio=''
1124 usesocks=''
1125 d_oldpthreads=''
1126 use5005threads=''
1127 useithreads=''
1128 usereentrant=''
1129 usethreads=''
1130 incpath=''
1131 mips_type=''
1132 usrinc=''
1133 d_vendorarch=''
1134 installvendorarch=''
1135 vendorarch=''
1136 vendorarchexp=''
1137 d_vendorbin=''
1138 installvendorbin=''
1139 vendorbin=''
1140 vendorbinexp=''
1141 installvendorhtml1=''
1142 vendorhtml1=''
1143 vendorhtml1exp=''
1144 installvendorhtml3=''
1145 vendorhtml3=''
1146 vendorhtml3exp=''
1147 d_vendorlib=''
1148 installvendorlib=''
1149 vendorlib=''
1150 vendorlib_stem=''
1151 vendorlibexp=''
1152 installvendorman1=''
1153 vendorman1=''
1154 vendorman1exp=''
1155 installvendorman3=''
1156 vendorman3=''
1157 vendorman3exp=''
1158 usevendorprefix=''
1159 vendorprefix=''
1160 vendorprefixexp=''
1161 d_vendorscript=''
1162 installvendorscript=''
1163 vendorscript=''
1164 vendorscriptexp=''
1165 versiononly=''
1166 defvoidused=''
1167 voidflags=''
1168 pm_apiversion=''
1169 xs_apiversion=''
1170 yacc=''
1171 yaccflags=''
1172 CONFIG=''
1173
1174 define='define'
1175 undef='undef'
1176 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1177 rmlist=''
1178
1179 : We must find out about Eunice early
1180 eunicefix=':'
1181 if test -f /etc/unixtovms; then
1182         eunicefix=/etc/unixtovms
1183 fi
1184 if test -f /etc/unixtovms.exe; then
1185         eunicefix=/etc/unixtovms.exe
1186 fi
1187
1188 : Set executable suffix now -- needed before hints available
1189 if test -f "/libs/version.library"; then
1190 : Amiga OS
1191     _exe=""
1192 elif test -f "/system/gnu_library/bin/ar.pm"; then
1193 : Stratus VOS
1194     _exe=".pm"
1195 elif test -n "$DJGPP"; then
1196 : DOS DJGPP
1197     _exe=".exe"
1198 elif test -d c:/. ; then
1199 : OS/2 or cygwin
1200     _exe=".exe"
1201 fi
1202
1203 i_whoami=''
1204 : Possible local include directories to search.
1205 : Set locincpth to "" in a hint file to defeat local include searches.
1206 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1207 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1208 :
1209 : no include file wanted by default
1210 inclwanted=''
1211
1212 siteman1=''
1213 siteman3=''
1214 sitescript=''
1215 : Trailing extension.  Override this in a hint file, if needed.
1216 : Extra object files, if any, needed on this platform.
1217 archobjs=''
1218 groupstype=''
1219 libnames=''
1220 : change the next line if compiling for Xenix/286 on Xenix/386
1221 xlibpth='/usr/lib/386 /lib/386'
1222 : Possible local library directories to search.
1223 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1224 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1225
1226 : general looking path for locating libraries
1227 glibpth="/lib /usr/lib $xlibpth"
1228 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1229 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1230 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1231
1232 : Private path used by Configure to find libraries.  Its value
1233 : is prepended to libpth. This variable takes care of special
1234 : machines, like the mips.  Usually, it should be empty.
1235 plibpth=''
1236
1237 : default library list
1238 libswanted=''
1239 : some systems want to use only the non-versioned libso:s
1240 ignore_versioned_solibs=''
1241 : full support for void wanted by default
1242 defvoidused=15
1243
1244 ccname=''
1245 ccversion=''
1246 perllibs=''
1247 : set useposix=false in your hint file to disable the POSIX extension.
1248 useposix=true
1249 : set useopcode=false in your hint file to disable the Opcode extension.
1250 useopcode=true
1251 archname64=''
1252 ccflags_uselargefiles=''
1253 ldflags_uselargefiles=''
1254 libswanted_uselargefiles=''
1255 : set usemultiplicity on the Configure command line to enable multiplicity.
1256 : set usesocks on the Configure command line to enable socks.
1257 archname=''
1258 : set usethreads on the Configure command line to enable threads.
1259 usereentrant='undef'
1260 : List of libraries we want.
1261 : If anyone needs -lnet, put it in a hint file.
1262 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1263 libswanted="$libswanted dld ld sun m c cposix posix"
1264 libswanted="$libswanted ndir dir crypt sec"
1265 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1266 : We probably want to search /usr/shlib before most other libraries.
1267 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1268 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1269 glibpth="/usr/shlib $glibpth"
1270 : Do not use vfork unless overridden by a hint file.
1271 usevfork=false
1272
1273 : Find the basic shell for Bourne shell scripts
1274 case "$sh" in
1275 '')
1276         case "$SYSTYPE" in
1277         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1278         *) xxx='/bin/sh';;
1279         esac
1280         if test -f "$xxx"; then
1281                 sh="$xxx"
1282         else
1283                 : Build up a list and do a single loop so we can 'break' out.
1284                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1285                 for xxx in sh bash ksh pdksh ash; do
1286                         for p in $pth; do
1287                                 try="$try ${p}/${xxx}"
1288                         done
1289                 done
1290                 for xxx in $try; do
1291                         if test -f "$xxx"; then
1292                                 sh="$xxx";
1293                                 break
1294                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1295                                 sh="$xxx";
1296                                 break
1297                         elif test -f "$xxx.exe"; then
1298                                 sh="$xxx";
1299                                 break
1300                         fi
1301                 done
1302         fi
1303         ;;
1304 esac
1305
1306 case "$sh" in
1307 '')     cat >&2 <<EOM
1308 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1309
1310 Usually it's in /bin/sh.  How did you even get this far?
1311 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1312 we'll try to straighten this all out.
1313 EOM
1314         exit 1
1315         ;;
1316 esac
1317
1318 : see if sh knows # comments
1319 if `$sh -c '#' >/dev/null 2>&1`; then
1320         shsharp=true
1321         spitshell=cat
1322         xcat=/bin/cat
1323         test -f $xcat$_exe || xcat=/usr/bin/cat
1324         if test ! -f $xcat$_exe; then
1325                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1326                         if test -f $p/cat$_exe; then
1327                                 xcat=$p/cat
1328                                 break
1329                         fi
1330                 done
1331                 if test ! -f $xcat$_exe; then
1332                         echo "Can't find cat anywhere!"
1333                         exit 1
1334                 fi
1335         fi
1336         echo "#!$xcat" >sharp
1337         $eunicefix sharp
1338         chmod +x sharp
1339         ./sharp > today
1340         if test -s today; then
1341                 sharpbang='#!'
1342         else
1343                 echo "#! $xcat" > sharp
1344                 $eunicefix sharp
1345                 chmod +x sharp
1346                 ./sharp > today
1347                 if test -s today; then
1348                         sharpbang='#! '
1349                 else
1350                         sharpbang=': use '
1351                 fi
1352         fi
1353 else
1354         echo " "
1355         echo "Your $sh doesn't grok # comments--I will strip them later on."
1356         shsharp=false
1357         cd ..
1358         echo "exec grep -v '^[  ]*#'" >spitshell
1359         chmod +x spitshell
1360         $eunicefix spitshell
1361         spitshell=`pwd`/spitshell
1362         cd UU
1363         echo "I presume that if # doesn't work, #! won't work either!"
1364         sharpbang=': use '
1365 fi
1366 rm -f sharp today
1367
1368 : figure out how to guarantee sh startup
1369 case "$startsh" in
1370 '') startsh=${sharpbang}${sh} ;;
1371 *)
1372 esac
1373 cat >sharp <<EOSS
1374 $startsh
1375 set abc
1376 test "$?abc" != 1
1377 EOSS
1378
1379 chmod +x sharp
1380 $eunicefix sharp
1381 if ./sharp; then
1382         : echo "Yup, it does."
1383 else
1384         echo "Hmm... '$startsh' does not guarantee sh startup..."
1385         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1386 fi
1387 rm -f sharp
1388
1389
1390 : Save command line options in file UU/cmdline.opt for later use in
1391 : generating config.sh.
1392 cat > cmdline.opt <<EOSH
1393 # Configure command line arguments.
1394 config_arg0='$0'
1395 config_args='$*'
1396 config_argc=$#
1397 EOSH
1398 argn=1
1399 args_exp=''
1400 args_sep=''
1401 for arg in "$@"; do
1402         cat >>cmdline.opt <<EOSH
1403 config_arg$argn='$arg'
1404 EOSH
1405         # Extreme backslashitis: replace each ' by '"'"'
1406         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1407 $arg
1408 EOC
1409         arg_exp=`cat cmdl.opt`
1410         args_exp="$args_exp$args_sep'$arg_exp'"
1411         argn=`expr $argn + 1`
1412         args_sep=' '
1413 done
1414 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1415 # used by ./hints/os2.sh
1416 rm -f cmdl.opt
1417
1418 : produce awk script to parse command line options
1419 cat >options.awk <<'EOF'
1420 BEGIN {
1421         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1422
1423         len = length(optstr);
1424         for (i = 1; i <= len; i++) {
1425                 c = substr(optstr, i, 1);
1426                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1427                 if (a == ":") {
1428                         arg[c] = 1;
1429                         i++;
1430                 }
1431                 opt[c] = 1;
1432         }
1433 }
1434 {
1435         expect = 0;
1436         str = $0;
1437         if (substr(str, 1, 1) != "-") {
1438                 printf("'%s'\n", str);
1439                 next;
1440         }
1441         len = length($0);
1442         for (i = 2; i <= len; i++) {
1443                 c = substr(str, i, 1);
1444                 if (!opt[c]) {
1445                         printf("-%s\n", substr(str, i));
1446                         next;
1447                 }
1448                 printf("-%s\n", c);
1449                 if (arg[c]) {
1450                         if (i < len)
1451                                 printf("'%s'\n", substr(str, i + 1));
1452                         else
1453                                 expect = 1;
1454                         next;
1455                 }
1456         }
1457 }
1458 END {
1459         if (expect)
1460                 print "?";
1461 }
1462 EOF
1463
1464 : process the command line options
1465 set X `for arg in "$@"; do echo "X$arg"; done |
1466         sed -e s/X// | awk -f options.awk`
1467 eval "set $*"
1468 shift
1469 rm -f options.awk
1470
1471 : set up default values
1472 fastread=''
1473 reuseval=false
1474 config_sh=''
1475 alldone=''
1476 error=''
1477 silent=''
1478 extractsh=''
1479 override=''
1480 knowitall=''
1481 rm -f optdef.sh posthint.sh
1482 cat >optdef.sh <<EOS
1483 $startsh
1484 EOS
1485
1486
1487 : option parsing
1488 while test $# -gt 0; do
1489         case "$1" in
1490         -d) shift; fastread=yes;;
1491         -e) shift; alldone=cont;;
1492         -f)
1493                 shift
1494                 cd ..
1495                 if test -r "$1"; then
1496                         config_sh="$1"
1497                 else
1498                         echo "$me: cannot read config file $1." >&2
1499                         error=true
1500                 fi
1501                 cd UU
1502                 shift;;
1503         -h) shift; error=true;;
1504         -r) shift; reuseval=true;;
1505         -s) shift; silent=true; realsilent=true;;
1506         -E) shift; alldone=exit;;
1507         -K) shift; knowitall=true;;
1508         -O) shift; override=true;;
1509         -S) shift; silent=true; extractsh=true;;
1510         -D)
1511                 shift
1512                 case "$1" in
1513                 *=)
1514                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1515                         echo "$me: ignoring -D $1" >&2
1516                         ;;
1517                 *=*) echo "$1" | \
1518                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1519                 *) echo "$1='define'" >> optdef.sh;;
1520                 esac
1521                 shift
1522                 ;;
1523         -U)
1524                 shift
1525                 case "$1" in
1526                 *=) echo "$1" >> optdef.sh;;
1527                 *=*)
1528                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1529                         echo "$me: ignoring -U $1" >&2
1530                         ;;
1531                 *) echo "$1='undef'" >> optdef.sh;;
1532                 esac
1533                 shift
1534                 ;;
1535         -A)
1536             shift
1537             xxx=''
1538             yyy="$1"
1539             zzz=''
1540             uuu=undef
1541             case "$yyy" in
1542             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1543                  case "$zzz" in
1544                  *:*) zzz='' ;;
1545                  *)   xxx=append
1546                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1547                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1548                  esac
1549                  ;;
1550             esac
1551             case "$xxx" in
1552             '')  case "$yyy" in
1553                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1554                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1555                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1556                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1557                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1558                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1559                  esac
1560                  ;;       
1561             esac
1562             case "$xxx" in
1563             append)
1564                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1565             clear)
1566                 echo "$yyy=''"                  >> posthint.sh ;;
1567             define)
1568                 case "$zzz" in
1569                 '') zzz=define ;;
1570                 esac
1571                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1572             eval)
1573                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1574             prepend)
1575                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1576             undef)
1577                 case "$zzz" in
1578                 '') zzz="$uuu" ;;
1579                 esac
1580                 echo "$yyy=$zzz"                >> posthint.sh ;;
1581             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1582             esac
1583             shift
1584             ;;
1585         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1586             exit 0;;
1587         --) break;;
1588         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1589         *) break;;
1590         esac
1591 done
1592
1593 case "$error" in
1594 true)
1595         cat >&2 <<EOM
1596 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1597                  [-U symbol] [-U symbol=] [-A command:symbol...]
1598   -d : use defaults for all answers.
1599   -e : go on without questioning past the production of config.sh.
1600   -f : specify an alternate default configuration file.
1601   -h : print this help message and exit (with an error status).
1602   -r : reuse C symbols value if possible (skips costly nm extraction).
1603   -s : silent mode, only echoes questions and essential information.
1604   -D : define symbol to have some value:
1605          -D symbol         symbol gets the value 'define'
1606          -D symbol=value   symbol gets the value 'value'
1607   -E : stop at the end of questions, after having produced config.sh.
1608   -K : do not use unless you know what you are doing.
1609   -O : let -D and -U override definitions from loaded configuration file.
1610   -S : perform variable substitutions on all .SH files (can mix with -f)
1611   -U : undefine symbol:
1612          -U symbol    symbol gets the value 'undef'
1613          -U symbol=   symbol gets completely empty
1614   -A : manipulate symbol after the platform specific hints have been applied:
1615          -A symbol=value                append " "value to symbol
1616          -A append:symbol=value         append value to symbol
1617          -A define:symbol=value         define symbol to have value
1618          -A clear:symbol                define symbol to be ''
1619          -A define:symbol               define symbol to be 'define'
1620          -A eval:symbol=value           define symbol to be eval of value
1621          -A prepend:symbol=value        prepend value to symbol
1622          -A undef:symbol                define symbol to be 'undef'
1623          -A undef:symbol=               define symbol to be ''
1624   -V : print version number and exit (with a zero status).
1625 EOM
1626         exit 1
1627         ;;
1628 esac
1629
1630 : Sanity checks
1631 case "$fastread$alldone" in
1632 yescont|yesexit) ;;
1633 *)
1634         case "$extractsh" in
1635         true) ;;
1636         *)
1637                 if test ! -t 0; then
1638                         echo "Say 'sh Configure', not 'sh <Configure'"
1639                         exit 1
1640                 fi
1641                 ;;
1642         esac
1643         ;;
1644 esac
1645
1646 exec 4>&1
1647 case "$silent" in
1648 true) exec 1>/dev/null;;
1649 esac
1650
1651 : run the defines and the undefines, if any, but leave the file out there...
1652 touch optdef.sh
1653 . ./optdef.sh
1654 : create the posthint manipulation script and leave the file out there...
1655 touch posthint.sh
1656
1657 : set package name
1658 package=perl5
1659 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1660 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1661 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1662 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1663 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1664 esac
1665
1666 : Some greps do not return status, grrr.
1667 echo "grimblepritz" >grimble
1668 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1669         contains=contains
1670 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1671         contains=grep
1672 else
1673         contains=contains
1674 fi
1675 rm -f grimble
1676 : the following should work in any shell
1677 case "$contains" in
1678 contains*)
1679         echo " "
1680         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1681         cat >contains <<'EOSS'
1682 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1683 EOSS
1684 chmod +x contains
1685 esac
1686
1687 : Find the path to the source tree
1688 case "$src" in
1689 '') case "$0" in
1690     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1691          case "$src" in
1692          /*)    ;;
1693          .)     ;;
1694          *)     src=`cd ../$src && pwd` ;;
1695          esac
1696          ;;
1697     *)   src='.';;
1698     esac;;
1699 esac
1700 case "$src" in
1701 '')     src=/
1702         rsrc=/
1703         ;;
1704 /*) rsrc="$src";;
1705 *) rsrc="../$src";;
1706 esac
1707 if test -f $rsrc/Configure && \
1708         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1709 then
1710    : found it, so we are ok.
1711 else
1712         rsrc=''
1713         for src in . .. ../.. ../../.. ../../../..; do
1714                 if test -f ../$src/Configure && \
1715                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1716                 then
1717                         rsrc=../$src
1718                         break
1719                 fi
1720         done
1721 fi
1722 case "$rsrc" in
1723 '')
1724         cat <<EOM >&4
1725
1726 Sorry, I can't seem to locate the source dir for $package.  Please start
1727 Configure with an explicit path -- i.e. /some/path/Configure.
1728
1729 EOM
1730         exit 1
1731         ;;
1732 ../.)   rsrc='..';;
1733 *)
1734         echo " "
1735         echo "Sources for $package found in \"$src\"." >&4
1736         ;;
1737 esac
1738
1739 : script used to extract .SH files with variable substitutions
1740 cat >extract <<'EOS'
1741 PERL_CONFIG_SH=true
1742 echo "Doing variable substitutions on .SH files..."
1743 if test -f MANIFEST; then
1744         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1745 else
1746         echo "(Looking for .SH files under the source directory.)"
1747         set x `(cd "$src"; find . -name "*.SH" -print)`
1748 fi
1749 shift
1750 case $# in
1751 0) set x `(cd "$src"; echo *.SH)`; shift;;
1752 esac
1753 if test ! -f "$src/$1"; then
1754         shift
1755 fi
1756 mkdir_p='
1757 name=$1;
1758 create="";
1759 while test $name; do
1760         if test ! -d "$name"; then
1761                 create="$name $create";
1762                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1763                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1764         else
1765                 name="";
1766         fi;
1767 done;
1768 for file in $create; do
1769         mkdir $file;
1770 done
1771 '
1772 for file in $*; do
1773         case "$src" in
1774         ".")
1775                 case "$file" in
1776                 */*)
1777                         dir=`expr X$file : 'X\(.*\)/'`
1778                         file=`expr X$file : 'X.*/\(.*\)'`
1779                         (cd "$dir" && . ./$file)
1780                         ;;
1781                 *)
1782                         . ./$file
1783                         ;;
1784                 esac
1785                 ;;
1786         *)
1787                 case "$file" in
1788                 */*)
1789                         dir=`expr X$file : 'X\(.*\)/'`
1790                         file=`expr X$file : 'X.*/\(.*\)'`
1791                         (set x $dir; shift; eval $mkdir_p)
1792                         sh <"$src/$dir/$file"
1793                         ;;
1794                 *)
1795                         sh <"$src/$file"
1796                         ;;
1797                 esac
1798                 ;;
1799         esac
1800 done
1801 if test -f "$src/config_h.SH"; then
1802         if test ! -f config.h; then
1803         : oops, they left it out of MANIFEST, probably, so do it anyway.
1804         . "$src/config_h.SH"
1805         fi
1806 fi
1807 EOS
1808
1809 : extract files and exit if asked to do so
1810 case "$extractsh" in
1811 true)
1812         case "$realsilent" in
1813         true) ;;
1814         *) exec 1>&4;;
1815         esac
1816         case "$config_sh" in
1817         '') config_sh='config.sh';;
1818         esac
1819         echo " "
1820         echo "Fetching answers from $config_sh..."
1821         cd ..
1822         . $config_sh
1823         test "$override" && . ./optdef.sh
1824         echo " "
1825         . UU/extract
1826         rm -rf UU
1827         echo "Extraction done."
1828         exit 0
1829         ;;
1830 esac
1831
1832 : Eunice requires " " instead of "", can you believe it
1833 echo " "
1834 : Here we go...
1835 echo "Beginning of configuration questions for $package."
1836
1837 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1838
1839 : first determine how to suppress newline on echo command
1840 echo " "
1841 echo "Checking echo to see how to suppress newlines..."
1842 (echo "hi there\c" ; echo " ") >.echotmp
1843 if $contains c .echotmp >/dev/null 2>&1 ; then
1844         echo "...using -n."
1845         n='-n'
1846         c=''
1847 else
1848         cat <<'EOM'
1849 ...using \c
1850 EOM
1851         n=''
1852         c='\c'
1853 fi
1854 echo $n "The star should be here-->$c"
1855 echo '*'
1856 rm -f .echotmp
1857
1858 : Now test for existence of everything in MANIFEST
1859 echo " "
1860 if test -f "$rsrc/MANIFEST"; then
1861         echo "First let's make sure your kit is complete.  Checking..." >&4
1862         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1863         rm -f missing
1864         tmppwd=`pwd`
1865         for filelist in x??; do
1866                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1867         done
1868         if test -s missing; then
1869                 cat missing >&4
1870                 cat >&4 <<'EOM'
1871
1872 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1873
1874 You have the option of continuing the configuration process, despite the
1875 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1876 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1877 and contact the author (perlbug@perl.org).
1878
1879 EOM
1880                 echo $n "Continue? [n] $c" >&4
1881                 read ans
1882                 case "$ans" in
1883                 y*)
1884                         echo "Continuing..." >&4
1885                         rm -f missing
1886                         ;;
1887                 *)
1888                         echo "ABORTING..." >&4
1889                         kill $$
1890                         ;;
1891                 esac
1892         else
1893                 echo "Looks good..."
1894         fi
1895 else
1896         echo "There is no MANIFEST file.  I hope your kit is complete !"
1897 fi
1898 rm -f missing x??
1899
1900 echo " "
1901 : Find the appropriate value for a newline for tr
1902 if test -n "$DJGPP"; then
1903        trnl='\012'
1904 fi
1905 if test X"$trnl" = X; then
1906         case "`echo foo|tr '\n' x 2>/dev/null`" in
1907         foox) trnl='\n' ;;
1908         esac
1909 fi
1910 if test X"$trnl" = X; then
1911         case "`echo foo|tr '\012' x 2>/dev/null`" in
1912         foox) trnl='\012' ;;
1913         esac
1914 fi
1915 if test X"$trnl" = X; then
1916        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1917        fooxy) trnl='\n\r' ;;
1918        esac
1919 fi
1920 if test X"$trnl" = X; then
1921         cat <<EOM >&2
1922
1923 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1924
1925 EOM
1926         exit 1
1927 fi
1928
1929 : compute the number of columns on the terminal for proper question formatting
1930 case "$COLUMNS" in
1931 '') COLUMNS='80';;
1932 esac
1933
1934 : set up the echo used in my read
1935 myecho="case \"\$xxxm\" in
1936 '') echo $n \"\$rp $c\" >&4;;
1937 *) case \"\$rp\" in
1938         '') echo $n \"[\$xxxm] $c\";;
1939         *)
1940                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1941                         echo \"\$rp\" >&4
1942                         echo $n \"[\$xxxm] $c\" >&4
1943                 else
1944                         echo $n \"\$rp [\$xxxm] $c\" >&4
1945                 fi
1946                 ;;
1947         esac;;
1948 esac"
1949
1950 : now set up to do reads with possible shell escape and default assignment
1951 cat <<EOSC >myread
1952 $startsh
1953 xxxm=\$dflt
1954 $myecho
1955 ans='!'
1956 case "\$fastread" in
1957 yes) case "\$dflt" in
1958         '') ;;
1959         *) ans='';
1960                 case "\$silent-\$rp" in
1961                 true-) ;;
1962                 *) echo " " >&4;;
1963                 esac;;
1964         esac;;
1965 *) case "\$silent" in
1966         true) case "\$rp" in
1967                 '') ans='';;
1968                 esac;;
1969         esac;;
1970 esac
1971 while expr "X\$ans" : "X!" >/dev/null; do
1972         read answ
1973         set x \$xxxm
1974         shift
1975         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1976         case  "\$answ" in
1977         "!")
1978                 sh 1>&4
1979                 echo " "
1980                 $myecho
1981                 ;;
1982         !*)
1983                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1984                 shift
1985                 sh 1>&4 -c "\$*"
1986                 echo " "
1987                 $myecho
1988                 ;;
1989         "\$ans")
1990                 case "\$ans" in
1991                 \\&*)
1992                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1993                         shift
1994                         case "\$1" in
1995                         -d)
1996                                 fastread=yes
1997                                 echo "(OK, I'll run with -d after this question.)" >&4
1998                                 ;;
1999                         -*)
2000                                 echo "*** Sorry, \$1 not supported yet." >&4
2001                                 ;;
2002                         esac
2003                         $myecho
2004                         ans=!
2005                         ;;
2006                 esac;;
2007         *)
2008                 case "\$aok" in
2009                 y)
2010                         echo "*** Substitution done -- please confirm."
2011                         xxxm="\$ans"
2012                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2013                         xxxm="\$ans"
2014                         ans=!
2015                         ;;
2016                 *)
2017                         echo "*** Error -- try again."
2018                         ans=!
2019                         ;;
2020                 esac
2021                 $myecho
2022                 ;;
2023         esac
2024         case "\$ans\$xxxm\$nostick" in
2025         '')
2026                 ans=!
2027                 $myecho
2028                 ;;
2029         esac
2030 done
2031 case "\$ans" in
2032 '') ans="\$xxxm";;
2033 esac
2034 EOSC
2035
2036 : create .config dir to save info across Configure sessions
2037 test -d ../.config || mkdir ../.config
2038 cat >../.config/README <<EOF
2039 This directory created by Configure to save information that should
2040 persist across sessions for $package.
2041
2042 You may safely delete it if you wish.
2043 EOF
2044
2045 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2046 case "$usedevel" in
2047 $define|true|[yY]*) ;;
2048 *) case "$xversion" in
2049    *[13579])
2050         cat >&4 <<EOH
2051 *** WHOA THERE!!! ***
2052
2053     This is an UNSTABLE DEVELOPMENT release.
2054     The version of this $package distribution is $xversion, that is, odd,
2055     (as opposed to even) and that signifies a development release.
2056     If you want a maintenance release, you want an even-numbered version.
2057
2058     Do ***NOT*** install this into production use.
2059     Data corruption and crashes are possible.
2060
2061     It is most seriously suggested that you do not continue any further
2062     unless you want to help in developing and debugging Perl.
2063
2064     If you *still* want to build perl, you can answer 'y' now,
2065     or pass -Dusedevel to Configure.
2066
2067 EOH
2068         rp='Do you really want to continue?'
2069         dflt='n'
2070         . ./myread
2071         case "$ans" in
2072         [yY]) echo >&4 "Okay, continuing."
2073               usedevel="$define" ;;
2074         *) echo >&4 "Okay, bye."
2075            exit 1
2076            ;;
2077         esac
2078         ;;
2079     esac
2080     ;;
2081 esac
2082 case "$usedevel" in
2083 $define|true|[yY]*)
2084         case "$versiononly" in
2085         '') versiononly="$define" ;;
2086         esac
2087         case "$installusrbinperl" in
2088         '') installusrbinperl="$undef" ;;
2089         esac
2090         ;;
2091 esac
2092
2093 : general instructions
2094 needman=true
2095 firsttime=true
2096 user=`(logname) 2>/dev/null`
2097 case "$user" in
2098 '') user=`whoami 2>&1`;;
2099 esac
2100 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2101         firsttime=false
2102         echo " "
2103         rp='Would you like to see the instructions?'
2104         dflt=n
2105         . ./myread
2106         case "$ans" in
2107         [yY]*) ;;
2108         *) needman=false;;
2109         esac
2110 fi
2111 if $needman; then
2112         cat <<EOH
2113
2114 This installation shell script will examine your system and ask you questions
2115 to determine how the perl5 package should be installed. If you get
2116 stuck on a question, you may use a ! shell escape to start a subshell or
2117 execute a command.  Many of the questions will have default answers in square
2118 brackets; typing carriage return will give you the default.
2119
2120 On some of the questions which ask for file or directory names you are allowed
2121 to use the ~name construct to specify the login directory belonging to "name",
2122 even if you don't have a shell which knows about that.  Questions where this is
2123 allowed will be marked "(~name ok)".
2124
2125 EOH
2126         rp=''
2127         dflt='Type carriage return to continue'
2128         . ./myread
2129         cat <<'EOH'
2130
2131 The prompter used in this script allows you to use shell variables and
2132 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2133 in the default answer, as if the default line was a set of arguments given to a
2134 script shell.  This means you may also use $* to repeat the whole default line,
2135 so you do not have to re-type everything to add something to the default.
2136
2137 Everytime there is a substitution, you will have to confirm.  If there is an
2138 error (e.g. an unmatched backtick), the default answer will remain unchanged
2139 and you will be prompted again.
2140
2141 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2142 the questions and use the computed defaults (or the previous answers if there
2143 was already a config.sh file). Type 'Configure -h' for a list of options.
2144 You may also start interactively and then answer '& -d' at any prompt to turn
2145 on the non-interactive behaviour for the remainder of the execution.
2146
2147 EOH
2148         . ./myread
2149         cat <<EOH
2150
2151 Much effort has been expended to ensure that this shell script will run on any
2152 Unix system.  If despite that it blows up on yours, your best bet is to edit
2153 Configure and run it again.  If you can't run Configure for some reason,
2154 you'll have to generate a config.sh file by hand.  Whatever problems you
2155 have, let me (perlbug@perl.org) know how I blew it.
2156
2157 This installation script affects things in two ways:
2158
2159 1) it may do direct variable substitutions on some of the files included
2160    in this kit.
2161 2) it builds a config.h file for inclusion in C programs.  You may edit
2162    any of these files as the need arises after running this script.
2163
2164 If you make a mistake on a question, there is no easy way to back up to it
2165 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2166 files.  Configure will offer to let you do this before it runs the SH files.
2167
2168 EOH
2169         dflt='Type carriage return to continue'
2170         . ./myread
2171         case "$firsttime" in
2172         true) echo $user >>../.config/instruct;;
2173         esac
2174 fi
2175
2176 : find out where common programs are
2177 echo " "
2178 echo "Locating common programs..." >&4
2179 cat <<EOSC >loc
2180 $startsh
2181 case \$# in
2182 0) exit 1;;
2183 esac
2184 thing=\$1
2185 shift
2186 dflt=\$1
2187 shift
2188 for dir in \$*; do
2189         case "\$thing" in
2190         .)
2191         if test -d \$dir/\$thing; then
2192                 echo \$dir
2193                 exit 0
2194         fi
2195         ;;
2196         *)
2197         for thisthing in \$dir/\$thing; do
2198                 : just loop through to pick last item
2199         done
2200         if test -f \$thisthing; then
2201                 echo \$thisthing
2202                 exit 0
2203         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2204                 echo \$thisthing
2205                 exit 0
2206         elif test -f \$dir/\$thing.exe; then
2207                 if test -n "$DJGPP"; then
2208                         echo \$dir/\$thing.exe
2209                 elif test "$eunicefix" != ":"; then
2210                         : on Eunice apparently
2211                         echo \$dir/\$thing
2212                         exit 0
2213                 fi
2214                 exit 0
2215         fi
2216         ;;
2217         esac
2218 done
2219 echo \$dflt
2220 exit 1
2221 EOSC
2222 chmod +x loc
2223 $eunicefix loc
2224 loclist="
2225 awk
2226 cat
2227 chmod
2228 comm
2229 cp
2230 echo
2231 expr
2232 grep
2233 ls
2234 mkdir
2235 rm
2236 sed
2237 sort
2238 touch
2239 tr
2240 uniq
2241 "
2242 trylist="
2243 Mcc
2244 ar
2245 bison
2246 byacc
2247 cpp
2248 csh
2249 date
2250 egrep
2251 gmake
2252 gzip
2253 less
2254 ln
2255 make
2256 more
2257 nm
2258 nroff
2259 pg
2260 test
2261 uname
2262 zip
2263 "
2264 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2265 pth="$pth /lib /usr/lib"
2266 for file in $loclist; do
2267         eval xxx=\$$file
2268         case "$xxx" in
2269         /*|?:[\\/]*)
2270                 if test -f "$xxx"; then
2271                         : ok
2272                 else
2273                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2274                         xxx=`./loc $file $file $pth`
2275                 fi
2276                 ;;
2277         '') xxx=`./loc $file $file $pth`;;
2278         *) xxx=`./loc $xxx $xxx $pth`;;
2279         esac
2280         eval $file=$xxx$_exe
2281         eval _$file=$xxx
2282         case "$xxx" in
2283         /*)
2284                 echo $file is in $xxx.
2285                 ;;
2286         ?:[\\/]*)
2287                 echo $file is in $xxx.
2288                 ;;
2289         *)
2290                 echo "I don't know where '$file' is, and my life depends on it." >&4
2291                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2292                 exit 1
2293                 ;;
2294         esac
2295 done
2296 echo " "
2297 echo "Don't worry if any of the following aren't found..."
2298 say=offhand
2299 for file in $trylist; do
2300         eval xxx=\$$file
2301         case "$xxx" in
2302         /*|?:[\\/]*)
2303                 if test -f "$xxx"; then
2304                         : ok
2305                 else
2306                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2307                         xxx=`./loc $file $file $pth`
2308                 fi
2309                 ;;
2310         '') xxx=`./loc $file $file $pth`;;
2311         *) xxx=`./loc $xxx $xxx $pth`;;
2312         esac
2313         eval $file=$xxx$_exe
2314         eval _$file=$xxx
2315         case "$xxx" in
2316         /*)
2317                 echo $file is in $xxx.
2318                 ;;
2319         ?:[\\/]*)
2320                 echo $file is in $xxx.
2321                 ;;
2322         *)
2323                 echo "I don't see $file out there, $say."
2324                 say=either
2325                 ;;
2326         esac
2327 done
2328 case "$egrep" in
2329 egrep)
2330         echo "Substituting grep for egrep."
2331         egrep=$grep
2332         _egrep=$grep
2333         ;;
2334 esac
2335 case "$ln" in
2336 ln)
2337         echo "Substituting cp for ln."
2338         ln=$cp
2339         _ln=$cp
2340         ;;
2341 esac
2342 case "$make" in
2343 make)   
2344         case "$gmake" in
2345         gmake)
2346         echo "I can't find make or gmake, and my life depends on it." >&4
2347         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2348         exit 1
2349         ;;
2350         esac
2351         ;;
2352 esac    
2353 case "$gmake" in
2354 gmake)  ;;
2355 *)      # We can't have osname yet.
2356         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2357                 # Assume that gmake, if found, is definitely GNU make
2358                 # and prefer it over the system make.
2359                 echo "Substituting gmake for make."
2360                 make=$gmake
2361                 _make=$gmake
2362         fi
2363         ;;
2364 esac
2365 case "$test" in
2366 test)
2367         echo "Hopefully test is built into your sh."
2368         ;;
2369 *)
2370         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2371                 echo "Using the test built into your sh."
2372                 test=test
2373                 _test=test
2374         fi
2375         ;;
2376 esac
2377 case "$echo" in
2378 echo)
2379         echo "Hopefully echo is built into your sh."
2380         ;;
2381 '') ;;
2382 *)
2383         echo " "
2384 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2385         $echo $n "hi there$c" >foo1
2386         echo $n "hi there$c" >foo2
2387         if cmp foo1 foo2 >/dev/null 2>&1; then
2388                 echo "They are compatible.  In fact, they may be identical."
2389         else
2390                 case "$n" in
2391                 '-n') n='' c='\c';;
2392                 *) n='-n' c='';;
2393                 esac
2394                 cat <<FOO
2395 They are not compatible!  You are probably running ksh on a non-USG system.
2396 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2397 have echo built in and we may have to run some Bourne shell scripts.  That
2398 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2399
2400 FOO
2401                 $echo $n "The star should be here-->$c"
2402                 $echo "*"
2403         fi
2404         $rm -f foo1 foo2
2405         ;;
2406 esac
2407
2408 cat <<EOS >trygcc
2409 $startsh
2410 EOS
2411 cat <<'EOSC' >>trygcc
2412 case "$cc" in
2413 '') ;;
2414 *)  $rm -f try try.*
2415     $cat >try.c <<EOM
2416 int main(int argc, char *argv[]) {
2417   return 0;
2418 }
2419 EOM
2420     if $cc -o try $ccflags $ldflags try.c; then
2421        :
2422     else
2423         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2424         despair=yes
2425         trygcc=yes
2426         case "$cc" in
2427         *gcc*) trygcc=no ;;
2428         esac
2429         case "`$cc -v -c try.c 2>&1`" in
2430         *gcc*) trygcc=no ;;
2431         esac
2432         if $test X"$trygcc" = Xyes; then
2433             if gcc -o try -c try.c; then
2434                 echo " "
2435                 echo "You seem to have a working gcc, though." >&4
2436                 rp="Would you like to use it?"
2437                 dflt=y
2438                 if $test -f myread; then
2439                     . ./myread
2440                 else
2441                     if $test -f UU/myread; then
2442                         . ./UU/myread
2443                     else
2444                         echo "Cannot find myread, sorry.  Aborting." >&2
2445                         exit 1
2446                     fi
2447                 fi  
2448                 case "$ans" in
2449                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2450                        if $test -f usethreads.cbu; then
2451                            $cat >&4 <<EOM 
2452
2453 *** However, any setting of the C compiler flags (e.g. for thread support)
2454 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2455 *** (together with e.g. -Dusethreads).
2456
2457 EOM
2458                        fi;;
2459                 esac
2460             fi
2461         fi
2462     fi
2463     $rm -f try try.*
2464     ;;
2465 esac
2466 EOSC
2467
2468 cat <<EOS >checkcc
2469 $startsh
2470 EOS
2471 cat <<'EOSC' >>checkcc
2472 case "$cc" in        
2473 '') ;;
2474 *)  $rm -f try try.*              
2475     $cat >try.c <<EOM
2476 int main(int argc, char *argv[]) {
2477   return 0;
2478 }
2479 EOM
2480     if $cc -o try $ccflags $ldflags try.c; then
2481        :
2482     else
2483         if $test X"$despair" = Xyes; then
2484            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2485         fi
2486         $cat >&4 <<EOM         
2487 You need to find a working C compiler.
2488 Either (purchase and) install the C compiler supplied by your OS vendor,
2489 or for a free C compiler try http://gcc.gnu.org/
2490 I cannot continue any further, aborting.
2491 EOM
2492         exit 1
2493     fi
2494     $rm -f try try.*
2495     ;;
2496 esac
2497 EOSC
2498
2499 : determine whether symbolic links are supported
2500 echo " "
2501 $touch blurfl
2502 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2503         echo "Symbolic links are supported." >&4
2504         lns="$ln -s"
2505 else
2506         echo "Symbolic links are NOT supported." >&4
2507         lns="$ln"
2508 fi
2509 $rm -f blurfl sym
2510
2511 : determine whether symbolic links are supported
2512 echo " "
2513 case "$lns" in
2514 *"ln"*" -s")
2515         echo "Checking how to test for symbolic links..." >&4
2516         $lns blurfl sym
2517         if $test "X$issymlink" = X; then
2518                 case "$newsh" in
2519                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2520                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2521                 esac
2522                 if test $? = 0; then
2523                         issymlink="test -h"
2524                 else
2525                         echo "Your builtin 'test -h' may be broken." >&4
2526                         case "$test" in
2527                         /*)     ;;
2528                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2529                                 for p in $pth
2530                                 do
2531                                         if test -f "$p/$test"; then
2532                                                 test="$p/$test"
2533                                                 break
2534                                         fi
2535                                 done
2536                                 ;;
2537                         esac
2538                         case "$test" in
2539                         /*)
2540                                 echo "Trying external '$test -h'." >&4
2541                                 issymlink="$test -h"
2542                                 if $test ! -h sym >/dev/null 2>&1; then
2543                                         echo "External '$test -h' is broken, too." >&4
2544                                         issymlink=''
2545                                 fi
2546                                 ;;
2547                         *)      issymlink='' ;;
2548                         esac
2549                 fi              
2550         fi
2551         if $test "X$issymlink" = X; then
2552                 if $test -L sym 2>/dev/null; then
2553                         issymlink="$test -L"
2554                         echo "The builtin '$test -L' worked." >&4
2555                 fi
2556         fi
2557         if $test "X$issymlink" != X; then
2558                 echo "You can test for symbolic links with '$issymlink'." >&4
2559         else
2560                 echo "I do not know how you can test for symbolic links." >&4
2561         fi
2562         $rm -f blurfl sym
2563         ;;
2564 *)      echo "No symbolic links, so not testing for their testing..." >&4
2565         ;;
2566 esac
2567 echo " "
2568
2569
2570 case "$mksymlinks" in
2571 $define|true|[yY]*)
2572         case "$src" in
2573         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2574                 exit 1
2575                 ;;
2576         *)      case "$lns:$issymlink" in
2577                 *"ln"*" -s:"*"test -"?)
2578                         echo "Creating the symbolic links..." >&4
2579                         echo "(First creating the subdirectories...)" >&4
2580                         cd ..
2581                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2582                                 read directory
2583                                 test -z "$directory" && break
2584                                 mkdir -p $directory
2585                         done
2586                         # Sanity check 1.
2587                         if test ! -d t/base; then
2588                                 echo "Failed to create the subdirectories.  Aborting." >&4
2589                                 exit 1
2590                         fi
2591                         echo "(Then creating the symlinks...)" >&4
2592                         awk '{print $1}' $src/MANIFEST | while true; do
2593                                 read filename
2594                                 test -z "$filename" && break
2595                                 if test -f $filename; then
2596                                         if $issymlink $filename; then
2597                                                 rm -f $filename
2598                                         fi
2599                                 fi
2600                                 if test -f $filename; then
2601                                         echo "$filename already exists, not symlinking."
2602                                 else
2603                                         ln -s $src/$filename $filename
2604                                 fi
2605                         done
2606                         # Sanity check 2.
2607                         if test ! -f t/base/lex.t; then
2608                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2609                                 exit 1
2610                         fi
2611                         cd UU
2612                         ;;
2613                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2614                         ;;
2615                 esac
2616                 ;;
2617         esac
2618         ;;
2619 esac
2620
2621
2622 case "$usecrosscompile" in
2623 $define|true|[yY]*)
2624         $echo "Cross-compiling..."
2625         croak=''
2626         case "$cc" in
2627         *-*-gcc) # A cross-compiling gcc, probably.
2628             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2629             ar=$targetarch-ar
2630             # leave out ld, choosing it is more complex
2631             nm=$targetarch-nm
2632             ranlib=$targetarch-ranlib
2633             $echo 'extern int foo;' > try.c
2634             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2635             shift
2636             if $test $# -gt 0; then
2637                 incpth="$incpth $*"
2638                 incpth="`$echo $incpth|$sed 's/^ //'`"
2639                 echo "Guessing incpth '$incpth'." >&4
2640                 for i in $*; do
2641                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2642                     if $test -d $j; then
2643                         libpth="$libpth $j"
2644                     fi
2645                 done   
2646                 libpth="`$echo $libpth|$sed 's/^ //'`"
2647                 echo "Guessing libpth '$libpth'." >&4
2648             fi
2649             $rm -f try.c
2650             ;;
2651         esac
2652         case "$targetarch" in
2653         '') echo "Targetarch not defined." >&4; croak=y ;;
2654         *)  echo "Using targetarch $targetarch." >&4 ;;
2655         esac
2656         case "$incpth" in
2657         '') echo "Incpth not defined." >&4; croak=y ;;
2658         *)  echo "Using incpth '$incpth'." >&4 ;;
2659         esac
2660         case "$libpth" in
2661         '') echo "Libpth not defined." >&4; croak=y ;;
2662         *)  echo "Using libpth '$libpth'." >&4 ;;
2663         esac
2664         case "$usrinc" in
2665         '') for i in $incpth; do
2666                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2667                     usrinc=$i
2668                     echo "Guessing usrinc $usrinc." >&4
2669                     break
2670                 fi
2671             done
2672             case "$usrinc" in
2673             '') echo "Usrinc not defined." >&4; croak=y ;;
2674             esac
2675             ;;
2676         *)  echo "Using usrinc $usrinc." >&4 ;;
2677         esac
2678         case "$targethost" in
2679         '') echo "Targethost not defined." >&4; croak=y ;;
2680         *)  echo "Using targethost $targethost." >&4
2681         esac
2682         locincpth=' '
2683         loclibpth=' '
2684         case "$croak" in
2685         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2686         esac
2687         case "$src" in
2688         /*) run=$src/Cross/run
2689             targetmkdir=$src/Cross/mkdir
2690             to=$src/Cross/to
2691             from=$src/Cross/from
2692             ;;
2693         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2694             run=$pwd/Cross/run
2695             targetmkdir=$pwd/Cross/mkdir
2696             to=$pwd/Cross/to
2697             from=$pwd/Cross/from
2698             ;;
2699         esac
2700         case "$targetrun" in
2701         '') targetrun=ssh ;;
2702         esac
2703         case "$targetto" in
2704         '') targetto=scp ;;
2705         esac
2706         case "$targetfrom" in
2707         '') targetfrom=scp ;;
2708         esac
2709         run=$run-$targetrun
2710         to=$to-$targetto
2711         from=$from-$targetfrom
2712         case "$targetdir" in
2713         '')  targetdir=/tmp
2714              echo "Guessing targetdir $targetdir." >&4
2715              ;;
2716         esac
2717         case "$targetuser" in
2718         '')  targetuser=root
2719              echo "Guessing targetuser $targetuser." >&4
2720              ;;
2721         esac
2722         case "$targetfrom" in
2723         scp)    q=-q ;;
2724         *)      q='' ;;
2725         esac
2726         case "$targetrun" in
2727         ssh|rsh)
2728             cat >$run <<EOF
2729 #!/bin/sh
2730 case "\$1" in
2731 -cwd)
2732   shift
2733   cwd=\$1
2734   shift
2735   ;;
2736 esac
2737 case "\$cwd" in
2738 '') cwd=$targetdir ;;
2739 esac
2740 exe=\$1
2741 shift
2742 if $test ! -f \$exe.xok; then
2743   $to \$exe
2744   $touch \$exe.xok
2745 fi
2746 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2747 EOF
2748             ;;
2749         *)  echo "Unknown targetrun '$targetrun'" >&4
2750             exit 1
2751             ;;
2752         esac
2753         case "$targetmkdir" in
2754         */Cross/mkdir)
2755             cat >$targetmkdir <<EOF
2756 #!/bin/sh
2757 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2758 EOF
2759             $chmod a+rx $targetmkdir
2760             ;;
2761         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2762             exit 1
2763             ;;
2764         esac
2765         case "$targetto" in
2766         scp|rcp)
2767             cat >$to <<EOF
2768 #!/bin/sh
2769 for f in \$@
2770 do
2771   case "\$f" in
2772   /*)
2773     $targetmkdir \`dirname \$f\`
2774     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2775     ;;
2776   *)
2777     $targetmkdir $targetdir/\`dirname \$f\`
2778     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2779     ;;
2780   esac
2781 done
2782 exit 0
2783 EOF
2784             ;;
2785         cp) cat >$to <<EOF
2786 #!/bin/sh
2787 for f in \$@
2788 do
2789   case "\$f" in
2790   /*)
2791     $mkdir -p $targetdir/\`dirname \$f\`
2792     $cp \$f $targetdir/\$f || exit 1
2793     ;;
2794   *)
2795     $targetmkdir $targetdir/\`dirname \$f\`
2796     $cp \$f $targetdir/\$f || exit 1
2797     ;;
2798   esac
2799 done
2800 exit 0
2801 EOF
2802             ;;
2803         *)  echo "Unknown targetto '$targetto'" >&4
2804             exit 1
2805             ;;
2806         esac
2807         case "$targetfrom" in
2808         scp|rcp)
2809           cat >$from <<EOF
2810 #!/bin/sh
2811 for f in \$@
2812 do
2813   $rm -f \$f
2814   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2815 done
2816 exit 0
2817 EOF
2818             ;;
2819         cp) cat >$from <<EOF
2820 #!/bin/sh
2821 for f in \$@
2822 do
2823   $rm -f \$f
2824   cp $targetdir/\$f . || exit 1
2825 done
2826 exit 0
2827 EOF
2828             ;;
2829         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2830             exit 1
2831             ;;
2832         esac
2833         if $test ! -f $run; then
2834             echo "Target 'run' script '$run' not found." >&4
2835         else
2836             $chmod a+rx $run
2837         fi
2838         if $test ! -f $to; then
2839             echo "Target 'to' script '$to' not found." >&4
2840         else
2841             $chmod a+rx $to
2842         fi
2843         if $test ! -f $from; then
2844             echo "Target 'from' script '$from' not found." >&4
2845         else
2846             $chmod a+rx $from
2847         fi
2848         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2849             exit 1
2850         fi
2851         cat >&4 <<EOF
2852 Using '$run' for remote execution,
2853 and '$from' and '$to'
2854 for remote file transfer.
2855 EOF
2856         ;;
2857 *)      run=''
2858         to=:
2859         from=:
2860         usecrosscompile='undef'
2861         targetarch=''
2862         ;;
2863 esac
2864
2865 : see whether [:lower:] and [:upper:] are supported character classes
2866 echo " "
2867 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2868 ABYZ)
2869         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2870         up='[:upper:]'
2871         low='[:lower:]'
2872         ;;
2873 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2874         # (0xc9 and 0xd1), therefore that is a nice testing point.
2875         if test "X$up" = X -o "X$low" = X; then
2876             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2877             ij) up='[A-Z]'
2878                 low='[a-z]'
2879                 ;;
2880             esac
2881         fi
2882         if test "X$up" = X -o "X$low" = X; then
2883             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2884             ij) up='A-Z'
2885                 low='a-z'
2886                 ;;
2887             esac
2888         fi
2889         if test "X$up" = X -o "X$low" = X; then
2890             case "`echo IJ | od -x 2>/dev/null`" in
2891             *C9D1*|*c9d1*)
2892                 echo "Hey, this might be EBCDIC." >&4
2893                 if test "X$up" = X -o "X$low" = X; then
2894                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2895                     ij) up='[A-IJ-RS-Z]'
2896                         low='[a-ij-rs-z]'
2897                         ;;
2898                     esac
2899                 fi
2900                 if test "X$up" = X -o "X$low" = X; then
2901                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2902                     ij) up='A-IJ-RS-Z'
2903                         low='a-ij-rs-z'
2904                         ;;
2905                     esac
2906                 fi
2907                 ;;
2908             esac
2909         fi
2910 esac
2911 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2912 ij)
2913     echo "Using $up and $low to convert case." >&4
2914     ;;
2915 *)
2916     echo "I don't know how to translate letters from upper to lower case." >&4
2917     echo "Your tr is not acting any way I know of." >&4
2918     exit 1
2919     ;;
2920 esac
2921 : set up the translation script tr, must be called with ./tr of course
2922 cat >tr <<EOSC
2923 $startsh
2924 case "\$1\$2" in
2925 '[A-Z][a-z]') exec $tr '$up' '$low';;
2926 '[a-z][A-Z]') exec $tr '$low' '$up';;
2927 esac
2928 exec $tr "\$@"
2929 EOSC
2930 chmod +x tr
2931 $eunicefix tr
2932
2933 : Try to determine whether config.sh was made on this system
2934 case "$config_sh" in
2935 '')
2936 myuname=`$uname -a 2>/dev/null`
2937 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2938 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2939 # because the A-Z/a-z are not consecutive.
2940 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2941         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2942 newmyuname="$myuname"
2943 dflt=n
2944 case "$knowitall" in
2945 '')
2946         if test -f ../config.sh; then
2947                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2948                         eval "`grep myuname= ../config.sh`"
2949                 fi
2950                 if test "X$myuname" = "X$newmyuname"; then
2951                         dflt=y
2952                 fi
2953         fi
2954         ;;
2955 *) dflt=y;;
2956 esac
2957
2958 : Get old answers from old config file if Configure was run on the
2959 : same system, otherwise use the hints.
2960 hint=default
2961 cd ..
2962 if test -f config.sh; then
2963         echo " "
2964         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2965         . UU/myread
2966         case "$ans" in
2967         n*|N*) echo "OK, I'll ignore it."
2968                 mv config.sh config.sh.old
2969                 myuname="$newmyuname"
2970                 ;;
2971         *)  echo "Fetching default answers from your old config.sh file..." >&4
2972                 tmp_n="$n"
2973                 tmp_c="$c"
2974                 tmp_sh="$sh"
2975                 . ./config.sh
2976                 cp config.sh UU
2977                 n="$tmp_n"
2978                 c="$tmp_c"
2979                 : Older versions did not always set $sh.  Catch re-use of such
2980                 : an old config.sh.
2981                 case "$sh" in
2982                 '') sh="$tmp_sh" ;;
2983                 esac
2984                 hint=previous
2985                 ;;
2986         esac
2987 fi
2988 . ./UU/checkcc
2989 if test ! -f config.sh; then
2990         $cat <<EOM
2991
2992 First time through, eh?  I have some defaults handy for some systems
2993 that need some extra help getting the Configure answers right:
2994
2995 EOM
2996         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2997         dflt=''
2998         : Half the following guesses are probably wrong... If you have better
2999         : tests or hints, please send them to perlbug@perl.org
3000         : The metaconfig authors would also appreciate a copy...
3001         $test -f /irix && osname=irix
3002         $test -f /xenix && osname=sco_xenix
3003         $test -f /dynix && osname=dynix
3004         $test -f /dnix && osname=dnix
3005         $test -f /lynx.os && osname=lynxos
3006         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3007         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3008         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3009         $test -f /bin/mips && /bin/mips && osname=mips
3010         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3011                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3012         $test -d /usr/apollo/bin && osname=apollo
3013         $test -f /etc/saf/_sactab && osname=svr4
3014         $test -d /usr/include/minix && osname=minix
3015         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3016         if $test -d /MachTen -o -d /MachTen_Folder; then
3017                 osname=machten
3018                 if $test -x /sbin/version; then
3019                         osvers=`/sbin/version | $awk '{print $2}' |
3020                         $sed -e 's/[A-Za-z]$//'`
3021                 elif $test -x /usr/etc/version; then
3022                         osvers=`/usr/etc/version | $awk '{print $2}' |
3023                         $sed -e 's/[A-Za-z]$//'`
3024                 else
3025                         osvers="$2.$3"
3026                 fi
3027         fi
3028
3029         $test -f /sys/posix.dll &&
3030                 $test -f /usr/bin/what &&
3031                 set X `/usr/bin/what /sys/posix.dll` &&
3032                 $test "$3" = UWIN &&
3033                 osname=uwin &&
3034                 osvers="$5"
3035
3036         if $test -f $uname; then
3037                 set X $myuname
3038                 shift
3039
3040                 case "$5" in
3041                 fps*) osname=fps ;;
3042                 mips*)
3043                         case "$4" in
3044                         umips) osname=umips ;;
3045                         *) osname=mips ;;
3046                         esac;;
3047                 [23]100) osname=mips ;;
3048                 next*) osname=next ;;
3049                 i386*)
3050                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3051                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3052                                 osname='sco'
3053                                 osvers=$tmp
3054                         elif $test -f /etc/kconfig; then
3055                                 osname=isc
3056                                 if test "$lns" = "$ln -s"; then
3057                                         osvers=4
3058                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3059                                         osvers=3
3060                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3061                                         osvers=2
3062                                 fi
3063                         fi
3064                         tmp=''
3065                         ;;
3066                 pc*)
3067                         if test -n "$DJGPP"; then
3068                                 osname=dos
3069                                 osvers=djgpp
3070                         fi
3071                         ;;
3072                 esac
3073
3074                 case "$1" in
3075                 aix) osname=aix
3076                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3077                         case "$tmp" in
3078                         'not found') osvers="$4"."$3" ;;
3079                         '<3240'|'<>3240') osvers=3.2.0 ;;
3080                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3081                         '=3250'|'>3250') osvers=3.2.5 ;;
3082                         *) osvers=$tmp;;
3083                         esac
3084                         ;;
3085                 bsd386) osname=bsd386
3086                         osvers=`$uname -r`
3087                         ;;
3088                 cygwin*) osname=cygwin
3089                         osvers="$3"
3090                         ;;
3091                 *dc.osx) osname=dcosx
3092                         osvers="$3"
3093                         ;;
3094                 dnix) osname=dnix
3095                         osvers="$3"
3096                         ;;
3097                 domainos) osname=apollo
3098                         osvers="$3"
3099                         ;;
3100                 dgux) osname=dgux 
3101                         osvers="$3"
3102                         ;;
3103                 dynixptx*) osname=dynixptx
3104                         osvers=`echo "$4"|sed 's/^v//'`
3105                         ;;
3106                 freebsd) osname=freebsd 
3107                         osvers="$3" ;;
3108                 genix) osname=genix ;;
3109                 hp*) osname=hpux 
3110                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3111                         ;;
3112                 irix*) osname=irix
3113                         case "$3" in
3114                         4*) osvers=4 ;;
3115                         5*) osvers=5 ;;
3116                         *)      osvers="$3" ;;
3117                         esac
3118                         ;;
3119                 linux) osname=linux
3120                         case "$3" in
3121                         *)      osvers="$3" ;;
3122                         esac
3123                         ;;
3124                 MiNT) osname=mint
3125                         ;;
3126                 netbsd*) osname=netbsd
3127                         osvers="$3"
3128                         ;;
3129                 news-os) osvers="$3"
3130                         case "$3" in
3131                         4*) osname=newsos4 ;;
3132                         *) osname=newsos ;;
3133                         esac
3134                         ;;
3135                 next*) osname=next ;;
3136                 nonstop-ux) osname=nonstopux ;;
3137                 openbsd) osname=openbsd
3138                         osvers="$3"
3139                         ;;
3140                 POSIX-BC | posix-bc ) osname=posix-bc
3141                         osvers="$3"
3142                         ;;
3143                 powerux | power_ux | powermax_os | powermaxos | \
3144                 powerunix | power_unix) osname=powerux
3145                         osvers="$3"
3146                         ;;
3147                 qnx) osname=qnx
3148                         osvers="$4"
3149                         ;;
3150                 solaris) osname=solaris
3151                         case "$3" in
3152                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3153                         *)      osvers="$3" ;;
3154                         esac
3155                         ;;
3156                 sunos) osname=sunos
3157                         case "$3" in
3158                         5*) osname=solaris
3159                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3160                         *)      osvers="$3" ;;
3161                         esac
3162                         ;;
3163                 titanos) osname=titanos
3164                         case "$3" in
3165                         1*) osvers=1 ;;
3166                         2*) osvers=2 ;;
3167                         3*) osvers=3 ;;
3168                         4*) osvers=4 ;;
3169                         *)      osvers="$3" ;;
3170                         esac
3171                         ;;
3172                 ultrix) osname=ultrix
3173                         osvers="$3"
3174                         ;;
3175                 osf1|mls+)      case "$5" in
3176                                 alpha)
3177                                         osname=dec_osf
3178                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3179                                         case "$osvers" in
3180                                         [1-9].[0-9]*) ;;
3181                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3182                                         esac
3183                                         ;;
3184                         hp*)    osname=hp_osf1  ;;
3185                         mips)   osname=mips_osf1 ;;
3186                         esac
3187                         ;;
3188                 unixware) osname=svr5
3189                         osvers="$4"
3190                         ;;
3191                 uts)    osname=uts
3192                         osvers="$3"
3193                         ;;
3194                 vos) osvers="$3"
3195                         ;;
3196                 $2) case "$osname" in
3197                         *isc*) ;;
3198                         *freebsd*) ;;
3199                         svr*)
3200                                 : svr4.x or possibly later
3201                                 case "svr$3" in 
3202                                 ${osname}*)
3203                                         osname=svr$3
3204                                         osvers=$4
3205                                         ;;
3206                                 esac
3207                                 case "$osname" in
3208                                 svr4.0)
3209                                         : Check for ESIX
3210                                         if test -f /stand/boot ; then
3211                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3212                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3213                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3214                                                         if test -n "$isesix"; then
3215                                                                 osname=esix4
3216                                                         fi
3217                                                 fi
3218                                         fi
3219                                         ;;
3220                                 esac
3221                                 ;;
3222                         *)      if test -f /etc/systemid; then
3223                                         osname=sco
3224                                         set `echo $3 | $sed 's/\./ /g'` $4
3225                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3226                                                 osvers=$1.$2.$3
3227                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3228                                                 osvers=$1.$2
3229                                         elif $test -f $src/hints/sco_$1.sh; then
3230                                                 osvers=$1
3231                                         fi
3232                                 else
3233                                         case "$osname" in
3234                                         '') : Still unknown.  Probably a generic Sys V.
3235                                                 osname="sysv"
3236                                                 osvers="$3"
3237                                                 ;;
3238                                         esac
3239                                 fi
3240                                 ;;
3241                         esac
3242                         ;;
3243                 *)      case "$osname" in
3244                         '') : Still unknown.  Probably a generic BSD.
3245                                 osname="$1"
3246                                 osvers="$3"
3247                                 ;;
3248                         esac
3249                         ;;
3250                 esac
3251         else
3252                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3253                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3254                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3255                                 osname=news_os
3256                         fi
3257                         $rm -f UU/kernel.what
3258                 elif test -d c:/.; then
3259                         set X $myuname
3260                         osname=os2
3261                         osvers="$5"
3262                 fi
3263         fi
3264         
3265         case "$targetarch" in
3266         '') ;;
3267         *)  hostarch=$osname
3268             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3269             osvers=''
3270             ;;
3271         esac
3272
3273         : Now look for a hint file osname_osvers, unless one has been
3274         : specified already.
3275         case "$hintfile" in
3276         ''|' ')
3277                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3278                 : Also try without trailing minor version numbers.
3279                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3280                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3281                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3282                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3283                 case "$file" in
3284                 '') dflt=none ;;
3285                 *)  case "$osvers" in
3286                         '') dflt=$file
3287                                 ;;
3288                         *)  if $test -f $src/hints/$file.sh ; then
3289                                         dflt=$file
3290                                 elif $test -f $src/hints/$xfile.sh ; then
3291                                         dflt=$xfile
3292                                 elif $test -f $src/hints/$xxfile.sh ; then
3293                                         dflt=$xxfile
3294                                 elif $test -f $src/hints/$xxxfile.sh ; then
3295                                         dflt=$xxxfile
3296                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3297                                         dflt=$xxxxfile
3298                                 elif $test -f "$src/hints/${osname}.sh" ; then
3299                                         dflt="${osname}"
3300                                 else
3301                                         dflt=none
3302                                 fi
3303                                 ;;
3304                         esac
3305                         ;;
3306                 esac
3307                 if $test -f Policy.sh ; then
3308                         case "$dflt" in
3309                         *Policy*) ;;
3310                         none) dflt="Policy" ;;
3311                         *) dflt="Policy $dflt" ;;
3312                         esac
3313                 fi
3314                 ;;
3315         *)
3316                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3317                 ;;
3318         esac
3319
3320         if $test -f Policy.sh ; then
3321                 $cat <<EOM
3322
3323 There's also a Policy hint file available, which should make the
3324 site-specific (policy) questions easier to answer.
3325 EOM
3326
3327         fi
3328
3329         $cat <<EOM
3330
3331 You may give one or more space-separated answers, or "none" if appropriate.
3332 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3333 is a good thing.  DO NOT give a wrong version or a wrong OS.
3334
3335 EOM
3336
3337         rp="Which of these apply, if any?"
3338         . UU/myread
3339         tans=$ans
3340         for file in $tans; do
3341                 if $test X$file = XPolicy -a -f Policy.sh; then
3342                         . Policy.sh
3343                         $cat Policy.sh >> UU/config.sh
3344                 elif $test -f $src/hints/$file.sh; then
3345                         . $src/hints/$file.sh
3346                         $cat $src/hints/$file.sh >> UU/config.sh
3347                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3348                         : nothing
3349                 else
3350                         : Give one chance to correct a possible typo.
3351                         echo "$file.sh does not exist"
3352                         dflt=$file
3353                         rp="hint to use instead?"
3354                         . UU/myread
3355                         for file in $ans; do
3356                                 if $test -f "$src/hints/$file.sh"; then
3357                                         . $src/hints/$file.sh
3358                                         $cat $src/hints/$file.sh >> UU/config.sh
3359                                 elif $test X$ans = X -o X$ans = Xnone ; then
3360                                         : nothing
3361                                 else
3362                                         echo "$file.sh does not exist -- ignored."
3363                                 fi
3364                         done
3365                 fi
3366         done
3367
3368         hint=recommended
3369         : Remember our hint file for later.
3370         if $test -f "$src/hints/$file.sh" ; then
3371                 hintfile="$file"
3372         else
3373                 hintfile=''
3374         fi
3375 fi
3376 cd UU
3377 ;;
3378 *)
3379         echo " "
3380         echo "Fetching default answers from $config_sh..." >&4
3381         tmp_n="$n"
3382         tmp_c="$c"
3383         cd ..
3384         cp $config_sh config.sh 2>/dev/null
3385         chmod +w config.sh
3386         . ./config.sh
3387         cd UU
3388         cp ../config.sh .
3389         n="$tmp_n"
3390         c="$tmp_c"
3391         hint=previous
3392         ;;
3393 esac
3394 test "$override" && . ./optdef.sh
3395
3396 : Restore computed paths
3397 for file in $loclist $trylist; do
3398         eval $file="\$_$file"
3399 done
3400
3401 cat << EOM
3402
3403 Configure uses the operating system name and version to set some defaults.
3404 The default value is probably right if the name rings a bell. Otherwise,
3405 since spelling matters for me, either accept the default or answer "none"
3406 to leave it blank.
3407
3408 EOM
3409 case "$osname" in
3410         ''|' ')
3411                 case "$hintfile" in
3412                 ''|' '|none) dflt=none ;;
3413                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3414                 esac
3415                 ;;
3416         *) dflt="$osname" ;;
3417 esac
3418 rp="Operating system name?"
3419 . ./myread
3420 case "$ans" in
3421 none)  osname='' ;;
3422 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3423 esac
3424 echo " "
3425 case "$osvers" in
3426         ''|' ')
3427                 case "$hintfile" in
3428                 ''|' '|none) dflt=none ;;
3429                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3430                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3431                         case "$dflt" in
3432                         ''|' ') dflt=none ;;
3433                         esac
3434                         ;;
3435                 esac
3436                 ;;
3437         *) dflt="$osvers" ;;
3438 esac
3439 rp="Operating system version?"
3440 . ./myread
3441 case "$ans" in
3442 none)  osvers='' ;;
3443 *) osvers="$ans" ;;
3444 esac
3445
3446
3447 . ./posthint.sh
3448
3449 : who configured the system
3450 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3451 cf_by=`(logname) 2>/dev/null`
3452 case "$cf_by" in
3453 "")
3454         cf_by=`(whoami) 2>/dev/null`
3455         case "$cf_by" in
3456         "") cf_by=unknown ;;
3457         esac ;;
3458 esac
3459
3460 : set up the script used to warn in case of inconsistency
3461 cat <<EOS >whoa
3462 $startsh
3463 EOS
3464 cat <<'EOSC' >>whoa
3465 dflt=y
3466 echo " "
3467 echo "*** WHOA THERE!!! ***" >&4
3468 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3469 rp="    Keep the $hint value?"
3470 . ./myread
3471 case "$ans" in
3472 y) td=$was; tu=$was;;
3473 esac
3474 EOSC
3475
3476 : function used to set $1 to $val
3477 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3478 case "$val$was" in
3479 $define$undef) . ./whoa; eval "$var=\$td";;
3480 $undef$define) . ./whoa; eval "$var=\$tu";;
3481 *) eval "$var=$val";;
3482 esac'
3483
3484 case "$usesocks" in
3485 $define|true|[yY]*)     dflt='y';;
3486 *) dflt='n';;
3487 esac
3488 cat <<EOM
3489
3490 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3491 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3492 to use the PerlIO abstraction layer, this will be implicitly selected.
3493
3494 If this doesn't make any sense to you, just accept the default '$dflt'.
3495 EOM
3496 rp='Build Perl for SOCKS?'
3497 . ./myread
3498 case "$ans" in
3499 y|Y)    val="$define" ;;     
3500 *)      val="$undef" ;;
3501 esac
3502 set usesocks
3503 eval $setvar
3504
3505 case "$usesocks" in
3506 $define|true|[yY]*) useperlio="$define";;
3507 esac
3508
3509 case "$useperlio" in
3510 $define|true|[yY]*|'')  dflt='y';;
3511 *) dflt='n';;
3512 esac
3513 cat <<EOM
3514
3515 Previous version of $package used the standard IO mechanisms as
3516 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3517 alternate IO mechanisms via the PerlIO abstraction layer, but the
3518 stdio mechanism is still available if needed.  The abstraction layer
3519 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3520 Using PerlIO with sfio may cause problems with some extension modules.
3521
3522 If this doesn't make any sense to you, just accept the default '$dflt'.
3523 EOM
3524 rp='Use the PerlIO abstraction layer?'
3525 . ./myread
3526 case "$ans" in
3527 y|Y) 
3528         val="$define"
3529         ;;
3530 *)      
3531         echo "Ok, doing things the stdio way."
3532         val="$undef"
3533         ;;
3534 esac
3535 set useperlio
3536 eval $setvar 
3537
3538 case "$usesocks" in
3539 $define|true|[yY]*)
3540         case "$useperlio" in
3541         $define|true|[yY]*) ;;
3542         *)      cat >&4 <<EOM
3543
3544 You are using the SOCKS proxy protocol library which means that you
3545 should also use the PerlIO layer.  You may be headed for trouble.
3546
3547 EOM
3548                 ;;
3549         esac
3550         ;;
3551 esac
3552
3553         
3554 case "$usethreads" in
3555 $define|true|[yY]*)     dflt='y';;
3556 *)     # Catch case where user specified ithreads or 5005threads but
3557        # forgot -Dusethreads (A.D. 4/2002)
3558        case "$useithreads$use5005threads" in
3559        *$define*)      
3560                 case "$useperlio" in
3561                 "$define")      dflt='y' ;;
3562                 *)              dflt='n' ;;
3563                 esac
3564                 ;;
3565        *)       dflt='n';;
3566        esac
3567        ;;
3568 esac
3569 cat <<EOM
3570
3571 Perl can be built to take advantage of threads on some systems.
3572 To do so, Configure can be run with -Dusethreads.
3573
3574 Note that Perl built with threading support runs slightly slower
3575 and uses more memory than plain Perl. The current implementation
3576 is believed to be stable, but it is fairly new, and so should be
3577 treated with caution.
3578
3579 If this doesn't make any sense to you, just accept the default '$dflt'.
3580 EOM
3581 rp='Build a threading Perl?'
3582 . ./myread
3583 case "$ans" in
3584 y|Y)    val="$define" ;;
3585 *)      val="$undef" ;;
3586 esac
3587 set usethreads
3588 eval $setvar
3589
3590 case "$usethreads" in
3591 $define)
3592         $cat <<EOM
3593
3594 Since release 5.6, Perl has had two different threading implementations,
3595 the newer interpreter-based version (ithreads) with one interpreter per
3596 thread, and the older 5.005 version (5005threads).
3597 The 5005threads version is effectively unmaintained and will probably be
3598 removed in Perl 5.10, so there should be no need to build a Perl using it
3599 unless needed for backwards compatibility with some existing 5.005threads
3600 code.
3601
3602 EOM
3603         : Default to ithreads unless overridden on command line or with
3604         : old config.sh
3605         dflt='y'
3606         case "$use5005threads" in
3607                 $define|true|[yY]*) dflt='n';;
3608         esac
3609         case "$useithreads" in
3610                 $undef|false|[nN]*) dflt='n';;
3611         esac
3612         rp='Use the newer interpreter-based ithreads?'
3613         . ./myread
3614         case "$ans" in
3615         y|Y)    val="$define" ;;
3616         *)      val="$undef" ;;
3617         esac
3618         set useithreads
3619         eval $setvar
3620         : Now set use5005threads to the opposite value.
3621         case "$useithreads" in
3622         $define) val="$undef" ;;
3623         *) val="$define" ;;
3624         esac
3625         set use5005threads
3626         eval $setvar
3627         ;;
3628 *)
3629         useithreads="$undef"
3630         use5005threads="$undef"
3631         ;;
3632 esac
3633
3634 case "$useithreads$use5005threads" in
3635 "$define$define")
3636         $cat >&4 <<EOM
3637
3638 You cannot have both the ithreads and the 5.005 threads enabled
3639 at the same time.  Disabling the 5.005 threads since they are
3640 much less stable than the ithreads.
3641
3642 EOM
3643         use5005threads="$undef"
3644         ;;
3645 esac
3646
3647 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3648         cat >&4 <<EOF
3649 ***
3650 *** To build with ithreads you must also use the PerlIO layer.
3651 *** Cannot continue, aborting.
3652 ***
3653 EOF
3654         exit 1
3655 fi
3656
3657 case "$d_oldpthreads" in
3658 '')     : Configure tests would be welcome here.  For now, assume undef.
3659         val="$undef" ;;
3660 *)      val="$d_oldpthreads" ;;
3661 esac
3662 set d_oldpthreads
3663 eval $setvar
3664
3665
3666 case "$usethreads" in
3667 "$define"|true|[yY]*)
3668 : Look for a hint-file generated 'call-back-unit'.  If the
3669 : user has specified that a threading perl is to be built,
3670 : we may need to set or change some other defaults.
3671         if $test -f usethreads.cbu; then
3672                 echo "Your platform has some specific hints for threaded builds, using them..."
3673                 . ./usethreads.cbu
3674         else
3675                 $cat <<EOM
3676 (Your platform doesn't have any specific hints for threaded builds.
3677  Assuming POSIX threads, then.)
3678 EOM
3679         fi
3680         ;;
3681 esac
3682
3683 cat <<EOM
3684
3685 Perl can be built so that multiple Perl interpreters can coexist
3686 within the same Perl executable.
3687 EOM
3688
3689 case "$useithreads" in
3690 $define)
3691         cat <<EOM
3692 This multiple interpreter support is required for interpreter-based threads.
3693 EOM
3694         val="$define"
3695         ;;
3696 *)      case "$usemultiplicity" in
3697         $define|true|[yY]*)     dflt='y';;
3698         *) dflt='n';;
3699         esac
3700         echo " "
3701         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3702         rp='Build Perl for multiplicity?'
3703         . ./myread
3704         case "$ans" in
3705         y|Y)    val="$define" ;;
3706         *)      val="$undef" ;;
3707         esac
3708         ;;
3709 esac
3710 set usemultiplicity
3711 eval $setvar
3712
3713
3714 case "$usemorebits" in
3715 "$define"|true|[yY]*)
3716         use64bitint="$define"
3717         uselongdouble="$define"
3718         usemorebits="$define"
3719         ;;
3720 *)      usemorebits="$undef"
3721         ;;
3722 esac
3723
3724 : make some quick guesses about what we are up against
3725 echo " "
3726 $echo $n "Hmm...  $c"
3727 echo exit 1 >bsd
3728 echo exit 1 >usg
3729 echo exit 1 >v7
3730 echo exit 1 >osf1
3731 echo exit 1 >eunice
3732 echo exit 1 >xenix
3733 echo exit 1 >venix
3734 echo exit 1 >os2
3735 d_bsd="$undef"
3736 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3737 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3738 then
3739         echo "Looks kind of like an OSF/1 system, but we'll see..."
3740         echo exit 0 >osf1
3741 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3742         xxx=`./loc addbib blurfl $pth`
3743         if $test -f $xxx; then
3744         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3745                 echo exit 0 >bsd
3746                 echo exit 0 >usg
3747         else
3748                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3749                         echo "Looks kind of like an extended USG system, but we'll see..."
3750                 else
3751                         echo "Looks kind of like a USG system, but we'll see..."
3752                 fi
3753                 echo exit 0 >usg
3754         fi
3755 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3756         echo "Looks kind of like a BSD system, but we'll see..."
3757         d_bsd="$define"
3758         echo exit 0 >bsd
3759 else
3760         echo "Looks kind of like a Version 7 system, but we'll see..."
3761         echo exit 0 >v7
3762 fi
3763 case "$eunicefix" in
3764 *unixtovms*)
3765         $cat <<'EOI'
3766 There is, however, a strange, musty smell in the air that reminds me of
3767 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3768 EOI
3769         echo exit 0 >eunice
3770         d_eunice="$define"
3771 : it so happens the Eunice I know will not run shell scripts in Unix format
3772         ;;
3773 *)
3774         echo " "
3775         echo "Congratulations.  You aren't running Eunice."
3776         d_eunice="$undef"
3777         ;;
3778 esac
3779 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3780 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3781 : semicolon as a patch separator
3782 case "$p_" in
3783 :) ;;
3784 *)
3785         $cat <<'EOI'
3786 I have the feeling something is not exactly right, however...don't tell me...
3787 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3788 (Or you may be running DOS with DJGPP.)
3789 EOI
3790         echo exit 0 >os2
3791         ;;
3792 esac
3793 if test -f /xenix; then
3794         echo "Actually, this looks more like a XENIX system..."
3795         echo exit 0 >xenix
3796         d_xenix="$define"
3797 else
3798         echo " "
3799         echo "It's not Xenix..."
3800         d_xenix="$undef"
3801 fi
3802 chmod +x xenix
3803 $eunicefix xenix
3804 if test -f /venix; then
3805         echo "Actually, this looks more like a VENIX system..."
3806         echo exit 0 >venix
3807 else
3808         echo " "
3809         if ./xenix; then
3810                 : null
3811         else
3812                 echo "Nor is it Venix..."
3813         fi
3814 fi
3815 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3816 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3817 $rm -f foo
3818
3819 case "$cc" in
3820 '') dflt=cc;;
3821 *) dflt="$cc";;
3822 esac
3823 rp="Use which C compiler?"
3824 . ./myread
3825 cc="$ans"
3826
3827 : See if they have not cc but they do have gcc
3828 . ./trygcc
3829 : Look for a hint-file generated 'call-back-unit'.  Now that the
3830 : user has specified the compiler, we may need to set or change some
3831 : other defaults.
3832 if $test -f cc.cbu; then
3833     . ./cc.cbu
3834 fi
3835 . ./checkcc
3836
3837 echo " "
3838 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3839 $cat >try.c <<EOM
3840 #include <stdio.h>
3841 int main() {
3842 #ifdef __GNUC__
3843 #ifdef __VERSION__
3844         printf("%s\n", __VERSION__);
3845 #else
3846         printf("%s\n", "1");
3847 #endif
3848 #endif
3849         exit(0);
3850 }
3851 EOM
3852 if $cc -o try $ccflags $ldflags try.c; then
3853         gccversion=`$run ./try`
3854         case "$gccversion" in
3855         '') echo "You are not using GNU cc." ;;
3856         *)  echo "You are using GNU cc $gccversion."
3857             ccname=gcc
3858             ;;
3859         esac
3860 else
3861         echo " "
3862         echo "*** WHOA THERE!!! ***" >&4
3863         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3864         case "$knowitall" in
3865         '')
3866         echo "    You'd better start hunting for one and let me know about it." >&4
3867                 exit 1
3868                 ;;
3869         esac
3870 fi
3871 $rm -f try try.*
3872 case "$gccversion" in
3873 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3874 esac
3875 case "$gccversion" in
3876 '') gccosandvers='' ;;
3877 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3878    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3879    gccshortvers=''
3880    case "$gccosandvers" in
3881    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3882    $osname$osvers) ;; # looking good
3883    $osname*) cat <<EOM >&4
3884
3885 *** WHOA THERE!!! ***
3886
3887     Your gcc has not been compiled for the exact release of
3888     your operating system ($gccosandvers versus $osname$osvers).
3889
3890     In general it is a good idea to keep gcc synchronized with
3891     the operating system because otherwise serious problems
3892     may ensue when trying to compile software, like Perl.
3893
3894     I'm trying to be optimistic here, though, and will continue.
3895     If later during the configuration and build icky compilation
3896     problems appear (headerfile conflicts being the most common
3897     manifestation), I suggest reinstalling the gcc to match
3898     your operating system release.
3899
3900 EOM
3901       ;;
3902    *) gccosandvers='' ;; # failed to parse, better be silent
3903    esac
3904    ;;
3905 esac
3906 case "$ccname" in
3907 '') ccname="$cc" ;;
3908 esac
3909
3910 # gcc 3.* complain about adding -Idirectories that they already know about,
3911 # so we will take those off from locincpth.
3912 case "$gccversion" in
3913 3*)
3914     echo "main(){}">try.c
3915     for incdir in $locincpth; do
3916        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3917              grep '^c[cp]p*[01]: warning: changing search order '`
3918        if test "X$warn" != X; then
3919            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3920        fi
3921     done
3922     $rm -f try try.*
3923 esac
3924
3925 : decide how portable to be.  Allow command line overrides.
3926 case "$d_portable" in
3927 "$undef") ;;
3928 *)      d_portable="$define" ;;
3929 esac
3930
3931 : set up shell script to do ~ expansion
3932 cat >filexp <<EOSS
3933 $startsh
3934 : expand filename
3935 case "\$1" in
3936  ~/*|~)
3937         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3938         ;;
3939  ~*)
3940         if $test -f /bin/csh; then
3941                 /bin/csh -f -c "glob \$1"
3942                 failed=\$?
3943                 echo ""
3944                 exit \$failed
3945         else
3946                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3947                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3948                 if $test ! -d "\$dir"; then
3949                         me=\`basename \$0\`
3950                         echo "\$me: can't locate home directory for: \$name" >&2
3951                         exit 1
3952                 fi
3953                 case "\$1" in
3954                 */*)
3955                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3956                         ;;
3957                 *)
3958                         echo \$dir
3959                         ;;
3960                 esac
3961         fi
3962         ;;
3963 *)
3964         echo \$1
3965         ;;
3966 esac
3967 EOSS
3968 chmod +x filexp
3969 $eunicefix filexp
3970
3971 : now set up to get a file name
3972 cat <<EOS >getfile
3973 $startsh
3974 EOS
3975 cat <<'EOSC' >>getfile
3976 tilde=''
3977 fullpath=''
3978 already=''
3979 skip=''
3980 none_ok=''
3981 exp_file=''
3982 nopath_ok=''
3983 orig_rp="$rp"
3984 orig_dflt="$dflt"
3985 case "$gfpth" in
3986 '') gfpth='.' ;;
3987 esac
3988
3989 case "$fn" in
3990 *\(*)
3991         : getfile will accept an answer from the comma-separated list
3992         : enclosed in parentheses even if it does not meet other criteria.
3993         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3994         fn=`echo $fn | sed 's/(.*)//'`
3995         ;;
3996 esac
3997
3998 case "$fn" in
3999 *:*)
4000         loc_file=`expr $fn : '.*:\(.*\)'`
4001         fn=`expr $fn : '\(.*\):.*'`
4002         ;;
4003 esac
4004
4005 case "$fn" in
4006 *~*) tilde=true;;
4007 esac
4008 case "$fn" in
4009 */*) fullpath=true;;
4010 esac
4011 case "$fn" in
4012 *+*) skip=true;;
4013 esac
4014 case "$fn" in
4015 *n*) none_ok=true;;
4016 esac
4017 case "$fn" in
4018 *e*) exp_file=true;;
4019 esac
4020 case "$fn" in
4021 *p*) nopath_ok=true;;
4022 esac
4023
4024 case "$fn" in
4025 *f*) type='File';;
4026 *d*) type='Directory';;
4027 *l*) type='Locate';;
4028 esac
4029
4030 what="$type"
4031 case "$what" in
4032 Locate) what='File';;
4033 esac
4034
4035 case "$exp_file" in
4036 '')
4037         case "$d_portable" in
4038         "$define") ;;
4039         *) exp_file=true;;
4040         esac
4041         ;;
4042 esac
4043
4044 cd ..
4045 while test "$type"; do
4046         redo=''
4047         rp="$orig_rp"
4048         dflt="$orig_dflt"
4049         case "$tilde" in
4050         true) rp="$rp (~name ok)";;
4051         esac
4052         . UU/myread
4053         if test -f UU/getfile.ok && \
4054                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4055         then
4056                 value="$ans"
4057                 ansexp="$ans"
4058                 break
4059         fi
4060         case "$ans" in
4061         none)
4062                 value=''
4063                 ansexp=''
4064                 case "$none_ok" in
4065                 true) type='';;
4066                 esac
4067                 ;;
4068         *)
4069                 case "$tilde" in
4070                 '') value="$ans"
4071                         ansexp="$ans";;
4072                 *)
4073                         value=`UU/filexp $ans`
4074                         case $? in
4075                         0)
4076                                 if test "$ans" != "$value"; then
4077                                         echo "(That expands to $value on this system.)"
4078                                 fi
4079                                 ;;
4080                         *) value="$ans";;
4081                         esac
4082                         ansexp="$value"
4083                         case "$exp_file" in
4084                         '') value="$ans";;
4085                         esac
4086                         ;;
4087                 esac
4088                 case "$fullpath" in
4089                 true)
4090                         case "$ansexp" in
4091                         /*) value="$ansexp" ;;
4092                         [a-zA-Z]:/*) value="$ansexp" ;;
4093                         *)
4094                                 redo=true
4095                                 case "$already" in
4096                                 true)
4097                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4098                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4099                                         ;;
4100                                 *)
4101                                 echo "Please give a full path name, starting with slash." >&4
4102                                         case "$tilde" in
4103                                         true)
4104                                 echo "Note that using ~name is ok provided it expands well." >&4
4105                                                 already=true
4106                                                 ;;
4107                                         esac
4108                                 esac
4109                                 ;;
4110                         esac
4111                         ;;
4112                 esac
4113                 case "$redo" in
4114                 '')
4115                         case "$type" in
4116                         File)
4117                                 for fp in $gfpth; do
4118                                         if test "X$fp" = X.; then
4119                                             pf="$ansexp"
4120                                         else    
4121                                             pf="$fp/$ansexp"
4122                                         fi
4123                                         if test -f "$pf"; then
4124                                                 type=''
4125                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4126                                         then
4127                                                 echo "($value is not a plain file, but that's ok.)"
4128                                                 type=''
4129                                         fi
4130                                         if test X"$type" = X; then
4131                                             value="$pf"
4132                                             break
4133                                         fi
4134                                 done
4135                                 ;;
4136                         Directory)
4137                                 for fp in $gfpth; do
4138                                         if test "X$fp" = X.; then
4139                                             dir="$ans"
4140                                             direxp="$ansexp"
4141                                         else    
4142                                             dir="$fp/$ansexp"
4143                                             direxp="$fp/$ansexp"
4144                                         fi
4145                                         if test -d "$direxp"; then
4146                                                 type=''
4147                                                 value="$dir"
4148                                                 break
4149                                         fi
4150                                 done
4151                                 ;;
4152                         Locate)
4153                                 if test -d "$ansexp"; then
4154                                         echo "(Looking for $loc_file in directory $value.)"
4155                                         value="$value/$loc_file"
4156                                         ansexp="$ansexp/$loc_file"
4157                                 fi
4158                                 if test -f "$ansexp"; then
4159                                         type=''
4160                                 fi
4161                                 case "$nopath_ok" in
4162                                 true)   case "$value" in
4163                                         */*) ;;
4164                                         *)      echo "Assuming $value will be in people's path."
4165                                                 type=''
4166                                                 ;;
4167                                         esac
4168                                         ;;
4169                                 esac
4170                                 ;;
4171                         esac
4172
4173                         case "$skip" in
4174                         true) type='';
4175                         esac
4176
4177                         case "$type" in
4178                         '') ;;
4179                         *)
4180                                 if test "$fastread" = yes; then
4181                                         dflt=y
4182                                 else
4183                                         dflt=n
4184                                 fi
4185                                 rp="$what $value doesn't exist.  Use that name anyway?"
4186                                 . UU/myread
4187                                 dflt=''
4188                                 case "$ans" in
4189                                 y*) type='';;
4190                                 *) echo " ";;
4191                                 esac
4192                                 ;;
4193                         esac
4194                         ;;
4195                 esac
4196                 ;;
4197         esac
4198 done
4199 cd UU
4200 ans="$value"
4201 rp="$orig_rp"
4202 dflt="$orig_dflt"
4203 rm -f getfile.ok
4204 test "X$gfpthkeep" != Xy && gfpth=""
4205 EOSC
4206
4207 : What should the include directory be ?
4208 echo " "
4209 $echo $n "Hmm...  $c"
4210 dflt='/usr/include'
4211 incpath=''
4212 mips_type=''
4213 if $test -f /bin/mips && /bin/mips; then
4214         echo "Looks like a MIPS system..."
4215         $cat >usr.c <<'EOCP'
4216 #ifdef SYSTYPE_BSD43
4217 /bsd43
4218 #endif
4219 EOCP
4220         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4221                 dflt='/bsd43/usr/include'
4222                 incpath='/bsd43'
4223                 mips_type='BSD 4.3'
4224         else
4225                 mips_type='System V'
4226         fi
4227         $rm -f usr.c usr.out
4228         echo "and you're compiling with the $mips_type compiler and libraries."
4229         xxx_prompt=y
4230         echo "exit 0" >mips
4231 else
4232         echo "Doesn't look like a MIPS system."
4233         xxx_prompt=n
4234         echo "exit 1" >mips
4235 fi
4236 chmod +x mips
4237 $eunicefix mips
4238 case "$usrinc" in
4239 '') ;;
4240 *) dflt="$usrinc";;
4241 esac
4242 case "$xxx_prompt" in
4243 y)      fn=d/
4244         echo " "
4245         rp='Where are the include files you want to use?'
4246         . ./getfile
4247         usrinc="$ans"
4248         ;;
4249 *)      usrinc="$dflt"
4250         ;;
4251 esac
4252
4253 : see how we invoke the C preprocessor
4254 echo " "
4255 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4256 cat <<'EOT' >testcpp.c
4257 #define ABC abc
4258 #define XYZ xyz
4259 ABC.XYZ
4260 EOT
4261 cd ..
4262 if test ! -f cppstdin; then
4263         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4264                 # AIX cc -E doesn't show the absolute headerfile
4265                 # locations but we'll cheat by using the -M flag.
4266                 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
4267         else
4268                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4269         fi
4270 else
4271         echo "Keeping your $hint cppstdin wrapper."
4272 fi
4273 chmod 755 cppstdin
4274 wrapper=`pwd`/cppstdin
4275 ok='false'
4276 cd UU
4277
4278 if $test "X$cppstdin" != "X" && \
4279         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4280         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4281 then
4282         echo "You used to use $cppstdin $cppminus so we'll use that again."
4283         case "$cpprun" in
4284         '') echo "But let's see if we can live without a wrapper..." ;;
4285         *)
4286                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4287                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4288                 then
4289                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4290                         ok='true'
4291                 else
4292                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4293                 fi
4294                 ;;
4295         esac
4296 else
4297         case "$cppstdin" in
4298         '') ;;
4299         *)
4300                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4301                 ;;
4302         esac
4303 fi
4304
4305 if $ok; then
4306         : nothing
4307 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4308         $cc -E <testcpp.c >testcpp.out 2>&1; \
4309         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4310         echo "Yup, it does."
4311         x_cpp="$cc -E"
4312         x_minus='';
4313 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4314         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4315         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4316         echo "Yup, it does."
4317         x_cpp="$cc -E"
4318         x_minus='-';
4319 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4320         $cc -P <testcpp.c >testcpp.out 2>&1; \
4321         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4322         echo "Yipee, that works!"
4323         x_cpp="$cc -P"
4324         x_minus='';
4325 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4326         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4327         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4328         echo "At long last!"
4329         x_cpp="$cc -P"
4330         x_minus='-';
4331 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4332         $cpp <testcpp.c >testcpp.out 2>&1; \
4333         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4334         echo "It works!"
4335         x_cpp="$cpp"
4336         x_minus='';
4337 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4338         $cpp - <testcpp.c >testcpp.out 2>&1; \
4339         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4340         echo "Hooray, it works!  I was beginning to wonder."
4341         x_cpp="$cpp"
4342         x_minus='-';
4343 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4344         $wrapper <testcpp.c >testcpp.out 2>&1; \
4345         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346         x_cpp="$wrapper"
4347         x_minus=''
4348         echo "Eureka!"
4349 else
4350         dflt=''
4351         rp="No dice.  I can't find a C preprocessor.  Name one:"
4352         . ./myread
4353         x_cpp="$ans"
4354         x_minus=''
4355         $x_cpp <testcpp.c >testcpp.out 2>&1
4356         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4357                 echo "OK, that will do." >&4
4358         else
4359 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4360                 exit 1
4361         fi
4362 fi
4363
4364 case "$ok" in
4365 false)
4366         cppstdin="$x_cpp"
4367         cppminus="$x_minus"
4368         cpprun="$x_cpp"
4369         cpplast="$x_minus"
4370         set X $x_cpp
4371         shift
4372         case "$1" in
4373         "$cpp")
4374                 echo "Perhaps can we force $cc -E using a wrapper..."
4375                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4376                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4377                 then
4378                         echo "Yup, we can."
4379                         cppstdin="$wrapper"
4380                         cppminus='';
4381                 else
4382                         echo "Nope, we'll have to live without it..."
4383                 fi
4384                 ;;
4385         esac
4386         case "$cpprun" in
4387         "$wrapper")
4388                 cpprun=''
4389                 cpplast=''
4390                 ;;
4391         esac
4392         ;;
4393 esac
4394
4395 case "$cppstdin" in
4396 "$wrapper"|'cppstdin') ;;
4397 *) $rm -f $wrapper;;
4398 esac
4399 $rm -f testcpp.c testcpp.out
4400
4401 : Set private lib path
4402 case "$plibpth" in
4403 '') if ./mips; then
4404                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4405         fi;;
4406 esac
4407 case "$libpth" in
4408 ' ') dlist='';;
4409 '') dlist="$loclibpth $plibpth $glibpth";;
4410 *) dlist="$libpth";;
4411 esac
4412
4413 : Now check and see which directories actually exist, avoiding duplicates
4414 libpth=''
4415 for xxx in $dlist
4416 do
4417     if $test -d $xxx; then
4418                 case " $libpth " in
4419                 *" $xxx "*) ;;
4420                 *) libpth="$libpth $xxx";;
4421                 esac
4422     fi
4423 done
4424 $cat <<'EOM'
4425
4426 Some systems have incompatible or broken versions of libraries.  Among
4427 the directories listed in the question below, please remove any you
4428 know not to be holding relevant libraries, and add any that are needed.
4429 Say "none" for none.
4430
4431 EOM
4432 case "$libpth" in
4433 '') dflt='none';;
4434 *)
4435         set X $libpth
4436         shift
4437         dflt=${1+"$@"}
4438         ;;
4439 esac
4440 rp="Directories to use for library searches?"
4441 . ./myread
4442 case "$ans" in
4443 none) libpth=' ';;
4444 *) libpth="$ans";;
4445 esac
4446
4447 : compute shared library extension
4448 case "$so" in
4449 '')
4450         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4451                 dflt='sl'
4452         else
4453                 dflt='so'
4454         fi
4455         ;;
4456 *) dflt="$so";;
4457 esac
4458 $cat <<EOM
4459
4460 On some systems, shared libraries may be available.  Answer 'none' if
4461 you want to suppress searching of shared libraries for the remainder
4462 of this configuration.
4463
4464 EOM
4465 rp='What is the file extension used for shared libraries?'
4466 . ./myread
4467 so="$ans"
4468
4469 : Define several unixisms.
4470 : Hints files or command line option can be used to override them.
4471 : The convoluted testing is in case hints files set either the old
4472 : or the new name.
4473 case "$_exe" in
4474 '')     case "$exe_ext" in
4475         '')     ;;
4476         *)      _exe="$exe_ext" ;;
4477         esac
4478         ;;
4479 esac
4480 case "$_a" in
4481 '')     case "$lib_ext" in
4482     '') _a='.a';;
4483         *)      _a="$lib_ext" ;;
4484         esac
4485         ;;
4486 esac
4487 case "$_o" in
4488 '') case "$obj_ext" in
4489         '')     _o='.o';;
4490         *)      _o="$obj_ext";;
4491         esac
4492         ;;
4493 esac
4494 case "$p_" in
4495 '') case "$path_sep" in
4496         '')     p_=':';;
4497         *)      p_="$path_sep";;
4498         esac
4499         ;;
4500 esac
4501 exe_ext=$_exe
4502 lib_ext=$_a
4503 obj_ext=$_o
4504 path_sep=$p_
4505
4506 : Which makefile gets called first.  This is used by make depend.
4507 case "$firstmakefile" in
4508 '') firstmakefile='makefile';;
4509 esac
4510
4511 : Looking for optional libraries
4512 echo " "
4513 echo "Checking for optional libraries..." >&4
4514 case "$libs" in
4515 ' '|'') dflt='';;
4516 *) dflt="$libs";;
4517 esac
4518 case "$libswanted" in
4519 '') libswanted='c_s';;
4520 esac
4521 case "$usesocks" in
4522 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4523 esac
4524 libsfound=''
4525 libsfiles=''
4526 libsdirs=''
4527 libspath=''
4528 for thisdir in $libpth $xlibpth; do
4529   test -d $thisdir && libspath="$libspath $thisdir"
4530 done
4531 for thislib in $libswanted; do
4532         for thisdir in $libspath; do
4533             xxx=''
4534             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4535                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4536                 $test -f "$xxx" && eval $libscheck
4537                 $test -f "$xxx" && libstyle=shared
4538             fi
4539             if test ! -f "$xxx"; then
4540                 xxx=$thisdir/lib$thislib.$so
4541                 $test -f "$xxx" && eval $libscheck
4542                 $test -f "$xxx" && libstyle=shared
4543             fi  
4544             if test ! -f "$xxx"; then
4545                 xxx=$thisdir/lib$thislib$_a
4546                 $test -f "$xxx" && eval $libscheck
4547                 $test -f "$xxx" && libstyle=static
4548             fi
4549             if test ! -f "$xxx"; then
4550                 xxx=$thisdir/$thislib$_a
4551                 $test -f "$xxx" && eval $libscheck
4552                 $test -f "$xxx" && libstyle=static
4553             fi
4554             if test ! -f "$xxx"; then
4555                 xxx=$thisdir/lib${thislib}_s$_a
4556                 $test -f "$xxx" && eval $libscheck
4557                 $test -f "$xxx" && libstyle=static
4558                 $test -f "$xxx" && thislib=${thislib}_s
4559             fi
4560             if test ! -f "$xxx"; then
4561                 xxx=$thisdir/Slib$thislib$_a
4562                 $test -f "$xxx" && eval $libscheck
4563                 $test -f "$xxx" && libstyle=static
4564             fi
4565             if $test -f "$xxx"; then
4566                 case "$libstyle" in
4567                 shared) echo "Found -l$thislib (shared)." ;;
4568                 static) echo "Found -l$thislib." ;;
4569                 *)      echo "Found -l$thislib ($libstyle)." ;;
4570                 esac
4571                 case " $dflt " in
4572                 *"-l$thislib "*);;
4573                 *) dflt="$dflt -l$thislib"
4574                    libsfound="$libsfound $xxx"
4575                    yyy=`basename $xxx`
4576                    libsfiles="$libsfiles $yyy"
4577                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4578                    case " $libsdirs " in
4579                    *" $yyy "*) ;;
4580                    *) libsdirs="$libsdirs $yyy" ;;
4581                    esac
4582                    ;;
4583                 esac
4584                 break
4585             fi  
4586         done
4587         if $test ! -f "$xxx"; then
4588             echo "No -l$thislib."
4589         fi
4590 done
4591 set X $dflt
4592 shift
4593 dflt="$*"
4594 case "$libs" in
4595 '') dflt="$dflt";;
4596 *) dflt="$libs";;
4597 esac
4598 case "$dflt" in
4599 ' '|'') dflt='none';;
4600 esac
4601
4602 $cat <<EOM
4603
4604 In order to compile $package on your machine, a number of libraries
4605 are usually needed.  Include any other special libraries here as well.
4606 Say "none" for none.  The default list is almost always right.
4607 EOM
4608
4609 echo " "
4610 rp="What libraries to use?"
4611 . ./myread
4612 case "$ans" in
4613 none) libs=' ';;
4614 *) libs="$ans";;
4615 esac
4616
4617 : determine optimization, if desired, or use for debug flag also
4618 case "$optimize" in
4619 ' '|$undef) dflt='none';;
4620 '') dflt='-O';;
4621 *) dflt="$optimize";;
4622 esac
4623 $cat <<EOH
4624
4625 By default, $package compiles with the -O flag to use the optimizer.
4626 Alternately, you might want to use the symbolic debugger, which uses
4627 the -g flag (on traditional Unix systems).  Either flag can be
4628 specified here.  To use neither flag, specify the word "none".
4629
4630 EOH
4631 rp="What optimizer/debugger flag should be used?"
4632 . ./myread
4633 optimize="$ans"
4634 case "$optimize" in
4635 'none') optimize=" ";;
4636 esac
4637
4638 dflt=''
4639 : We will not override a previous value, but we might want to
4640 : augment a hint file
4641 case "$hint" in
4642 default|recommended)
4643         case "$gccversion" in
4644         1*) dflt='-fpcc-struct-return' ;;
4645         esac
4646         case "$optimize" in
4647         *-g*) dflt="$dflt -DDEBUGGING";;
4648         esac
4649         case "$gccversion" in
4650         2*) if test -d /etc/conf/kconfig.d &&
4651                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4652                 then
4653                         dflt="$dflt -posix"
4654                 fi
4655                 ;;
4656         esac
4657         case "$gccversion" in
4658         1*) ;;
4659         2.[0-8]*) ;;
4660         ?*)     echo " "
4661                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4662                 echo 'int main(void) { return 0; }' > gcctest.c
4663                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4664                         echo "Yes, it does." 2>&1
4665                         case "$ccflags" in
4666                         *strict-aliasing*) 
4667                                 echo "Leaving current flags $ccflags alone." 2>&1
4668                                 ;;
4669                         *) dflt="$dflt -fno-strict-aliasing" ;;
4670                         esac
4671                 else
4672                         echo "Nope, it doesn't, but that's ok." 2>&1
4673                 fi
4674                 ;;
4675         esac
4676         ;;
4677 esac
4678
4679 case "$mips_type" in
4680 *BSD*|'') inclwanted="$locincpth $usrinc";;
4681 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4682 esac
4683 for thisincl in $inclwanted; do
4684         if $test -d $thisincl; then
4685                 if $test x$thisincl != x$usrinc; then
4686                         case "$dflt" in
4687                         *" -I$thisincl "*);;
4688                         *) dflt="$dflt -I$thisincl ";;
4689                         esac
4690                 fi
4691         fi
4692 done
4693
4694 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4695         xxx=true;
4696 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4697         xxx=true;
4698 else
4699         xxx=false;
4700 fi;
4701 if $xxx; then
4702         case "$dflt" in
4703         *$2*);;
4704         *) dflt="$dflt -D$2";;
4705         esac;
4706 fi'
4707
4708 set signal.h LANGUAGE_C; eval $inctest
4709
4710 case "$usesocks" in
4711 $define)
4712         ccflags="$ccflags -DSOCKS"
4713         ;;
4714 esac
4715
4716 case "$hint" in
4717 default|recommended) dflt="$ccflags $dflt" ;;
4718 *) dflt="$ccflags";;
4719 esac
4720
4721 case "$dflt" in
4722 ''|' ') dflt=none;;
4723 esac
4724
4725 $cat <<EOH
4726
4727 Your C compiler may want other flags.  For this question you should include
4728 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4729 but you should NOT include libraries or ld flags like -lwhatever.  If you
4730 want $package to honor its debug switch, you should include -DDEBUGGING here.
4731 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4732
4733 To use no flags, specify the word "none".
4734
4735 EOH
4736 set X $dflt
4737 shift
4738 dflt=${1+"$@"}
4739 rp="Any additional cc flags?"
4740 . ./myread
4741 case "$ans" in
4742 none) ccflags='';;
4743 *) ccflags="$ans";;
4744 esac
4745
4746 : the following weeds options from ccflags that are of no interest to cpp
4747 case "$cppflags" in
4748 '') cppflags="$ccflags" ;;
4749 *)  cppflags="$cppflags $ccflags" ;;
4750 esac
4751 case "$gccversion" in
4752 1*) cppflags="$cppflags -D__GNUC__"
4753 esac
4754 case "$mips_type" in
4755 '');;
4756 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4757 esac
4758 case "$cppflags" in
4759 '');;
4760 *)
4761         echo " "
4762         echo "Let me guess what the preprocessor flags are..." >&4
4763         set X $cppflags
4764         shift
4765         cppflags=''
4766         $cat >cpp.c <<'EOM'
4767 #define BLURFL foo
4768
4769 BLURFL xx LFRULB
4770 EOM
4771         previous=''
4772         for flag in $*
4773         do
4774                 case "$flag" in
4775                 -*) ftry="$flag";;
4776                 *) ftry="$previous $flag";;
4777                 esac
4778                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4779                         >cpp1.out 2>/dev/null && \
4780                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4781                         >cpp2.out 2>/dev/null && \
4782                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4783                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4784                 then
4785                         cppflags="$cppflags $ftry"
4786                         previous=''
4787                 else
4788                         previous="$flag"
4789                 fi
4790         done
4791         set X $cppflags
4792         shift
4793         cppflags=${1+"$@"}
4794         case "$cppflags" in
4795         *-*)  echo "They appear to be: $cppflags";;
4796         esac
4797         $rm -f cpp.c cpp?.out
4798         ;;
4799 esac
4800
4801 : flags used in final linking phase
4802 case "$ldflags" in
4803 '') if ./venix; then
4804                 dflt='-i -z'
4805         else
4806                 dflt=''
4807         fi
4808         case "$ccflags" in
4809         *-posix*) dflt="$dflt -posix" ;;
4810         esac
4811         ;;
4812 *) dflt="$ldflags";;
4813 esac
4814
4815 : Try to guess additional flags to pick up local libraries.
4816 for thislibdir in $libpth; do
4817         case " $loclibpth " in
4818         *" $thislibdir "*)
4819                 case "$dflt " in 
4820                 *"-L$thislibdir "*) ;;
4821                 *)  dflt="$dflt -L$thislibdir" ;;
4822                 esac
4823                 ;;
4824         esac
4825 done
4826
4827 case "$dflt" in
4828 '') dflt='none' ;;
4829 esac
4830
4831 $cat <<EOH
4832
4833 Your C linker may need flags.  For this question you should
4834 include -L/whatever and any other flags used by the C linker, but you
4835 should NOT include libraries like -lwhatever.
4836
4837 Make sure you include the appropriate -L/path flags if your C linker
4838 does not normally search all of the directories you specified above,
4839 namely
4840         $libpth
4841 To use no flags, specify the word "none".
4842
4843 EOH
4844
4845 rp="Any additional ld flags (NOT including libraries)?"
4846 . ./myread
4847 case "$ans" in
4848 none) ldflags='';;
4849 *) ldflags="$ans";;
4850 esac
4851 rmlist="$rmlist pdp11"
4852
4853 : coherency check
4854 echo " "
4855 echo "Checking your choice of C compiler and flags for coherency..." >&4
4856 $cat > try.c <<'EOF'
4857 #include <stdio.h>
4858 int main() { printf("Ok\n"); exit(0); }
4859 EOF
4860 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4861 shift
4862 $cat >try.msg <<'EOM'
4863 I've tried to compile and run the following simple program:
4864
4865 EOM
4866 $cat try.c >> try.msg
4867
4868 $cat >> try.msg <<EOM
4869
4870 I used the command:
4871
4872         $*
4873         $run ./try
4874
4875 and I got the following output:
4876
4877 EOM
4878 dflt=y
4879 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4880         if $sh -c "$run ./try" >>try.msg 2>&1; then
4881                 xxx=`$run ./try`
4882                 case "$xxx" in
4883                 "Ok") dflt=n ;;
4884                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4885                         case " $libs " in
4886                         *" -lsfio "*)
4887                                 cat >> try.msg <<'EOQS'
4888 If $libs contains -lsfio, and sfio is mis-configured, then it
4889 sometimes (apparently) runs and exits with a 0 status, but with no
4890 output!  It may have to do with sfio's use of _exit vs. exit.
4891
4892 EOQS
4893                                 rp="You have a big problem.  Shall I abort Configure"
4894                                 dflt=y
4895                                 ;;
4896                         esac
4897                         ;;
4898                 esac
4899         else
4900                 echo "The program compiled OK, but exited with status $?." >>try.msg
4901                 rp="You have a problem.  Shall I abort Configure"
4902                 dflt=y
4903         fi
4904 else
4905         echo "I can't compile the test program." >>try.msg
4906         rp="You have a BIG problem.  Shall I abort Configure"
4907         dflt=y
4908 fi
4909 case "$dflt" in
4910 y)
4911         $cat try.msg >&4
4912         case "$knowitall" in
4913         '')
4914                 echo "(The supplied flags or libraries might be incorrect.)"
4915                 ;;
4916         *) dflt=n;;
4917         esac
4918         echo " "
4919         . ./myread
4920         case "$ans" in
4921         n*|N*) ;;
4922         *)      echo "Ok.  Stopping Configure." >&4
4923                 exit 1
4924                 ;;
4925         esac
4926         ;;
4927 n) echo "OK, that should do.";;
4928 esac
4929 $rm -f try try.* core
4930
4931 : define a shorthand compile call
4932 compile='
4933 mc_file=$1;
4934 shift;
4935 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4936 : define a shorthand compile call for compilations that should be ok.
4937 compile_ok='
4938 mc_file=$1;
4939 shift;
4940 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4941
4942 : check for lengths of integral types
4943 echo " "
4944 case "$intsize" in
4945 '')
4946         echo "Checking to see how big your integers are..." >&4
4947         $cat >try.c <<'EOCP'
4948 #include <stdio.h>
4949 int main()
4950 {
4951         printf("intsize=%d;\n", (int)sizeof(int));
4952         printf("longsize=%d;\n", (int)sizeof(long));
4953         printf("shortsize=%d;\n", (int)sizeof(short));
4954         exit(0);
4955 }
4956 EOCP
4957         set try
4958         if eval $compile_ok && $run ./try > /dev/null; then
4959                 eval `$run ./try`
4960                 echo "Your integers are $intsize bytes long."
4961                 echo "Your long integers are $longsize bytes long."
4962                 echo "Your short integers are $shortsize bytes long."
4963         else
4964                 $cat >&4 <<EOM
4965 !
4966 Help! I can't compile and run the intsize test program: please enlighten me!
4967 (This is probably a misconfiguration in your system or libraries, and
4968 you really ought to fix it.  Still, I'll try anyway.)
4969 !
4970 EOM
4971                 dflt=4
4972                 rp="What is the size of an integer (in bytes)?"
4973                 . ./myread
4974                 intsize="$ans"
4975                 dflt=$intsize
4976                 rp="What is the size of a long integer (in bytes)?"
4977                 . ./myread
4978                 longsize="$ans"
4979                 dflt=2
4980                 rp="What is the size of a short integer (in bytes)?"
4981                 . ./myread
4982                 shortsize="$ans"
4983         fi
4984         ;;
4985 esac
4986 $rm -f try try.*
4987
4988 : check for long long
4989 echo " "
4990 echo "Checking to see if you have long long..." >&4
4991 echo 'int main() { long long x = 7; return 0; }' > try.c
4992 set try
4993 if eval $compile; then
4994         val="$define"
4995         echo "You have long long."
4996 else
4997         val="$undef"
4998         echo "You do not have long long."
4999 fi
5000 $rm try.*
5001 set d_longlong
5002 eval $setvar
5003
5004 : check for length of long long
5005 case "${d_longlong}${longlongsize}" in
5006 $define)
5007         echo " "
5008         echo "Checking to see how big your long longs are..." >&4
5009         $cat >try.c <<'EOCP'
5010 #include <stdio.h>
5011 int main()
5012 {
5013     printf("%d\n", (int)sizeof(long long));
5014     return(0);
5015 }
5016 EOCP
5017         set try
5018         if eval $compile_ok; then
5019                 longlongsize=`$run ./try`
5020                 echo "Your long longs are $longlongsize bytes long."
5021         else
5022                 dflt='8'
5023                 echo " "
5024                 echo "(I can't seem to compile the test program.  Guessing...)"
5025                 rp="What is the size of a long long (in bytes)?"
5026                 . ./myread
5027                 longlongsize="$ans"
5028         fi
5029         if $test "X$longsize" = "X$longlongsize"; then
5030                 echo "(That isn't any different from an ordinary long.)"
5031         fi      
5032         ;;
5033 esac
5034 $rm -f try.* try
5035
5036 : determine filename position in cpp output
5037 echo " "
5038 echo "Computing filename position in cpp output for #include directives..." >&4
5039 case "$osname" in
5040 vos) testaccess=-e ;;
5041 *)   testaccess=-r ;;
5042 esac
5043 echo '#include <stdio.h>' > foo.c
5044 $cat >fieldn <<EOF
5045 $startsh
5046 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5047 $grep '^[       ]*#.*stdio\.h' | \
5048 while read cline; do
5049         pos=1
5050         set \$cline
5051         while $test \$# -gt 0; do
5052                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5053                         echo "\$pos"
5054                         exit 0
5055                 fi
5056                 shift
5057                 pos=\`expr \$pos + 1\`
5058         done
5059 done
5060 EOF
5061 chmod +x fieldn
5062 fieldn=`./fieldn`
5063 $rm -f foo.c fieldn
5064 case $fieldn in
5065 '') pos='???';;
5066 1) pos=first;;
5067 2) pos=second;;
5068 3) pos=third;;
5069 *) pos="${fieldn}th";;
5070 esac
5071 echo "Your cpp writes the filename in the $pos field of the line."
5072
5073 case "$osname" in
5074 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5075 *)   cppfilter='' ;;
5076 esac
5077 : locate header file
5078 $cat >findhdr <<EOF
5079 $startsh
5080 wanted=\$1
5081 name=''
5082 for usrincdir in $usrinc
5083 do
5084         if test -f \$usrincdir/\$wanted; then
5085                 echo "\$usrincdir/\$wanted"
5086                 exit 0
5087         fi
5088 done
5089 awkprg='{ print \$$fieldn }'
5090 echo "#include <\$wanted>" > foo\$\$.c
5091 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5092 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5093 while read cline; do
5094         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5095         case "\$name" in
5096         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5097         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5098         *) exit 2;;
5099         esac;
5100 done;
5101 #
5102 # status = 0: grep returned 0 lines, case statement not executed
5103 # status = 1: headerfile found
5104 # status = 2: while loop executed, no headerfile found
5105 #
5106 status=\$?
5107 $rm -f foo\$\$.c;
5108 if test \$status -eq 1; then
5109         exit 0;
5110 fi
5111 exit 1
5112 EOF
5113 chmod +x findhdr
5114
5115 : define an alternate in-header-list? function
5116 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5117 cont=true; xxf="echo \"<\$1> found.\" >&4";
5118 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5119 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5120 esac;
5121 case $# in 4) instead=instead;; *) instead="at last";; esac;
5122 while $test "$cont"; do
5123         xxx=`./findhdr $1`
5124         var=$2; eval "was=\$$2";
5125         if $test "$xxx" && $test -r "$xxx";
5126         then eval $xxf;
5127         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5128                 cont="";
5129         else eval $xxnf;
5130         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5131         set $yyy; shift; shift; yyy=$@;
5132         case $# in 0) cont="";;
5133         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5134                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5135         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5136                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5137         esac;
5138 done;
5139 while $test "$yyy";
5140 do set $yyy; var=$2; eval "was=\$$2";
5141         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5142         set $yyy; shift; shift; yyy=$@;
5143 done'
5144
5145 : see if inttypes.h is available
5146 : we want a real compile instead of Inhdr because some systems
5147 : have an inttypes.h which includes non-existent headers
5148 echo " "
5149 $cat >try.c <<EOCP
5150 #include <inttypes.h>
5151 int main() {
5152         static int32_t foo32 = 0x12345678;
5153 }
5154 EOCP
5155 set try
5156 if eval $compile; then
5157         echo "<inttypes.h> found." >&4
5158         val="$define"
5159 else
5160         echo "<inttypes.h> NOT found." >&4
5161         val="$undef"
5162 fi
5163 $rm -f try.c try
5164 set i_inttypes
5165 eval $setvar
5166
5167 : check for int64_t
5168 echo " "
5169 echo "Checking to see if you have int64_t..." >&4
5170 $cat >try.c <<EOCP
5171 #include <sys/types.h>
5172 #$i_inttypes I_INTTYPES
5173 #ifdef I_INTTYPES
5174 #include <inttypes.h>
5175 #endif
5176 int main() { int64_t x = 7; }
5177 EOCP
5178 set try
5179 if eval $compile; then
5180         val="$define"
5181         echo "You have int64_t."
5182 else
5183         val="$undef"
5184         echo "You do not have int64_t."
5185 fi
5186 $rm -f try try.*
5187 set d_int64_t
5188 eval $setvar
5189
5190
5191 echo " "
5192 echo "Checking which 64-bit integer type we could use..." >&4
5193
5194 case "$intsize" in
5195 8) val=int
5196    set quadtype
5197    eval $setvar
5198    val='"unsigned int"'
5199    set uquadtype
5200    eval $setvar
5201    quadkind=1
5202    ;;
5203 *) case "$longsize" in
5204    8) val=long
5205       set quadtype
5206       eval $setvar
5207       val='"unsigned long"'
5208       set uquadtype
5209       eval $setvar
5210       quadkind=2
5211       ;;
5212    *) case "$d_longlong:$longlongsize" in
5213       define:8)
5214         val='"long long"'
5215         set quadtype
5216         eval $setvar
5217         val='"unsigned long long"'
5218         set uquadtype
5219         eval $setvar
5220         quadkind=3
5221         ;;
5222       *) case "$d_int64_t" in
5223          define)
5224            val=int64_t
5225            set quadtype
5226            eval $setvar
5227            val=uint64_t
5228            set uquadtype
5229            eval $setvar
5230            quadkind=4
5231            ;;
5232          esac
5233          ;;
5234       esac
5235       ;;
5236    esac
5237    ;;
5238 esac
5239
5240 case "$quadtype" in
5241 '')     echo "Alas, no 64-bit integer types in sight." >&4
5242         d_quad="$undef"
5243         ;;
5244 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5245         d_quad="$define"
5246         ;;
5247 esac
5248
5249
5250 case "$uselonglong" in
5251 "$define"|true|[yY]*)
5252         cat <<EOM >&4
5253
5254 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5255 EOM
5256         use64bitint="$define"
5257         ;;
5258 esac                          
5259 case "$use64bits" in
5260 "$define"|true|[yY]*)
5261         cat <<EOM >&4
5262
5263 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5264 EOM
5265         use64bitint="$define"
5266         ;;
5267 esac                          
5268 case "$use64bitints" in
5269 "$define"|true|[yY]*)
5270         cat <<EOM >&4
5271
5272 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5273 EOM
5274         use64bitint="$define"
5275         ;;
5276 esac                          
5277 case "$use64bitsint" in
5278 "$define"|true|[yY]*)
5279         cat <<EOM >&4
5280
5281 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5282 EOM
5283         use64bitint="$define"
5284         ;;
5285 esac                          
5286 case "$uselonglongs" in
5287 "$define"|true|[yY]*)
5288         cat <<EOM >&4
5289
5290 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5291 EOM
5292         use64bitint="$define"
5293         ;;
5294 esac                          
5295 case "$use64bitsall" in
5296 "$define"|true|[yY]*)
5297         cat <<EOM >&4
5298
5299 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5300 EOM
5301         use64bitall="$define"
5302         ;;
5303 esac                          
5304
5305 case "$ccflags" in
5306 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5307 esac
5308 case "$use64bitall" in
5309 "$define"|true|[yY]*) use64bitint="$define" ;;
5310 esac
5311
5312 case "$longsize" in
5313 8) cat <<EOM
5314
5315 You have natively 64-bit long integers.
5316 EOM
5317    val="$define"
5318    ;;
5319 *) case "$use64bitint" in
5320    "$define"|true|[yY]*) dflt='y';;
5321    *) dflt='n';;
5322    esac
5323    case "$d_quad" in
5324    "$define") ;;
5325    *) dflt='n' ;;
5326    esac
5327    cat <<EOM
5328
5329 Perl can be built to take advantage of 64-bit integer types
5330 on some systems.  To do so, Configure can be run with -Duse64bitint.
5331 Choosing this option will most probably introduce binary incompatibilities.
5332
5333 If this doesn't make any sense to you, just accept the default '$dflt'.
5334 (The default has been chosen based on your configuration.)
5335 EOM
5336    rp='Try to use 64-bit integers, if available?'
5337    . ./myread
5338    case "$ans" in
5339    [yY]*) val="$define" ;;
5340    *)     val="$undef"  ;;
5341    esac
5342    ;;
5343 esac
5344 set use64bitint
5345 eval $setvar
5346
5347 case "$use64bitall" in
5348 "$define"|true|[yY]*) dflt='y' ;;
5349 *) case "$longsize" in
5350    8) dflt='y' ;;
5351    *) dflt='n' ;;
5352    esac
5353    ;;
5354 esac    
5355 cat <<EOM
5356
5357 You may also choose to try maximal 64-bitness.  It means using as much
5358 64-bitness as possible on the platform.  This in turn means even more
5359 binary incompatibilities.  On the other hand, your platform may not
5360 have any more 64-bitness available than what you already have chosen.
5361
5362 If this doesn't make any sense to you, just accept the default '$dflt'.
5363 (The default has been chosen based on your configuration.)
5364 EOM
5365 rp='Try to use maximal 64-bit support, if available?'
5366 . ./myread
5367 case "$ans" in
5368 [yY]*) val="$define" ;;
5369 *)     val="$undef"  ;;
5370 esac
5371 set use64bitall
5372 eval $setvar
5373 case "$use64bitall" in
5374 "$define")
5375         case "$use64bitint" in
5376         "$undef")
5377                 cat <<EOM
5378
5379 Since you have chosen a maximally 64-bit build, I'm also turning on
5380 the use of 64-bit integers.
5381 EOM
5382                 use64bitint="$define" ;;
5383         esac
5384         ;;
5385 esac
5386
5387 case "$use64bitint" in
5388 "$define"|true|[yY]*)
5389 : Look for a hint-file generated 'call-back-unit'.  If the
5390 : user has specified that a 64-bit perl is to be built,
5391 : we may need to set or change some other defaults.
5392         if $test -f use64bitint.cbu; then
5393                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5394                 . ./use64bitint.cbu
5395         fi
5396         case "$longsize" in
5397         4) case "$archname64" in
5398            '') archname64=64int ;;
5399            esac
5400            ;;
5401         esac
5402         ;;
5403 esac
5404
5405 case "$use64bitall" in
5406 "$define"|true|[yY]*)
5407 : Look for a hint-file generated 'call-back-unit'.  If the
5408 : user has specified that a maximally 64-bit perl is to be built,
5409 : we may need to set or change some other defaults.
5410         if $test -f use64bitall.cbu; then
5411                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5412                 . ./use64bitall.cbu
5413         fi
5414         case "$longsize" in
5415         4) case "$archname64" in
5416            ''|64int) archname64=64all ;;
5417            esac
5418            ;;
5419         esac
5420         ;;
5421 esac
5422
5423 echo " "
5424 echo "Checking for GNU C Library..." >&4
5425 cat >try.c <<'EOCP'
5426 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5427    alone are insufficient to distinguish different versions, such as
5428    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5429    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5430 */
5431 #include <stdio.h>
5432 int main(void)
5433 {
5434 #ifdef __GLIBC__
5435 #   ifdef __GLIBC_MINOR__
5436 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5437 #           include <gnu/libc-version.h>
5438             printf("%s\n",  gnu_get_libc_version());
5439 #       else
5440             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5441 #       endif
5442 #   else
5443         printf("%d\n",  __GLIBC__);
5444 #   endif
5445     return 0;
5446 #else
5447     return 1;
5448 #endif
5449 }
5450 EOCP
5451 set try
5452 if eval $compile_ok && $run ./try > glibc.ver; then
5453         val="$define"
5454         gnulibc_version=`$cat glibc.ver`
5455         echo "You are using the GNU C Library version $gnulibc_version"
5456 else
5457         val="$undef"
5458         gnulibc_version=''
5459         echo "You are not using the GNU C Library"
5460 fi
5461 $rm -f try try.* glibc.ver
5462 set d_gnulibc
5463 eval $setvar
5464
5465 : see if nm is to be used to determine whether a symbol is defined or not
5466 case "$usenm" in
5467 '')
5468         dflt=''
5469         case "$d_gnulibc" in
5470         "$define")
5471                 echo " "
5472                 echo "nm probably won't work on the GNU C Library." >&4
5473                 dflt=n
5474                 ;;
5475         esac
5476         case "$dflt" in
5477         '') 
5478                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5479                         echo " "
5480                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5481                         echo "'nm' won't be sufficient on this sytem." >&4
5482                         dflt=n
5483                 fi
5484                 ;;
5485         esac
5486         case "$dflt" in
5487         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5488                 if $test $dflt -gt 20; then
5489                         dflt=y
5490                 else
5491                         dflt=n
5492                 fi
5493                 ;;
5494         esac
5495         ;;
5496 *)
5497         case "$usenm" in
5498         true|$define) dflt=y;;
5499         *) dflt=n;;
5500         esac
5501         ;;
5502 esac
5503 $cat <<EOM
5504
5505 I can use $nm to extract the symbols from your C libraries. This
5506 is a time consuming task which may generate huge output on the disk (up
5507 to 3 megabytes) but that should make the symbols extraction faster. The
5508 alternative is to skip the 'nm' extraction part and to compile a small
5509 test program instead to determine whether each symbol is present. If
5510 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5511 this may be the best solution.
5512
5513 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5514
5515 EOM
5516 rp="Shall I use $nm to extract C symbols from the libraries?"
5517 . ./myread
5518 case "$ans" in
5519 [Nn]*) usenm=false;;
5520 *) usenm=true;;
5521 esac
5522
5523 runnm=$usenm
5524 case "$reuseval" in
5525 true) runnm=false;;
5526 esac
5527
5528 : nm options which may be necessary
5529 case "$nm_opt" in
5530 '') if $test -f /mach_boot; then
5531                 nm_opt=''       # Mach
5532         elif $test -d /usr/ccs/lib; then
5533                 nm_opt='-p'     # Solaris (and SunOS?)
5534         elif $test -f /dgux; then
5535                 nm_opt='-p'     # DG-UX
5536         elif $test -f /lib64/rld; then
5537                 nm_opt='-p'     # 64-bit Irix
5538         else
5539                 nm_opt=''
5540         fi;;
5541 esac
5542
5543 : nm options which may be necessary for shared libraries but illegal
5544 : for archive libraries.  Thank you, Linux.
5545 case "$nm_so_opt" in
5546 '')     case "$myuname" in
5547         *linux*)
5548                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5549                         nm_so_opt='--dynamic'
5550                 fi
5551                 ;;
5552         esac
5553         ;;
5554 esac
5555
5556 case "$runnm" in
5557 true)
5558 : get list of predefined functions in a handy place
5559 echo " "
5560 case "$libc" in
5561 '') libc=unknown
5562         case "$libs" in
5563         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5564         esac
5565         ;;
5566 esac
5567 case "$libs" in
5568 '') ;;
5569 *)  for thislib in $libs; do
5570         case "$thislib" in
5571         -lc|-lc_s)
5572                 : Handle C library specially below.
5573                 ;;
5574         -l*)
5575                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5576                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5577                         :
5578                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5579                         :
5580                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5581                         :
5582                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5583                         :
5584                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5585                         :
5586                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5587                         :
5588                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5589                         :
5590                 else
5591                         try=''
5592                 fi
5593                 libnames="$libnames $try"
5594                 ;;
5595         *) libnames="$libnames $thislib" ;;
5596         esac
5597         done
5598         ;;
5599 esac
5600 xxx=normal
5601 case "$libc" in
5602 unknown)
5603         set /lib/libc.$so
5604         for xxx in $libpth; do
5605                 $test -r $1 || set $xxx/libc.$so
5606                 : The messy sed command sorts on library version numbers.
5607                 $test -r $1 || \
5608                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5609                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5610                                 h
5611                                 s/[0-9][0-9]*/0000&/g
5612                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5613                                 G
5614                                 s/\n/ /' | \
5615                          $sort | $sed -e 's/^.* //'`
5616                 eval set \$$#
5617         done
5618         $test -r $1 || set /usr/ccs/lib/libc.$so
5619         $test -r $1 || set /lib/libsys_s$_a
5620         ;;
5621 *)
5622         set blurfl
5623         ;;
5624 esac
5625 if $test -r "$1"; then
5626         echo "Your (shared) C library seems to be in $1."
5627         libc="$1"
5628 elif $test -r /lib/libc && $test -r /lib/clib; then
5629         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5630         xxx=apollo
5631         libc='/lib/clib /lib/libc'
5632         if $test -r /lib/syslib; then
5633                 echo "(Your math library is in /lib/syslib.)"
5634                 libc="$libc /lib/syslib"
5635         fi
5636 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5637         echo "Your C library seems to be in $libc, as you said before."
5638 elif $test -r $incpath/usr/lib/libc$_a; then
5639         libc=$incpath/usr/lib/libc$_a;
5640         echo "Your C library seems to be in $libc.  That's fine."
5641 elif $test -r /lib/libc$_a; then
5642         libc=/lib/libc$_a;
5643         echo "Your C library seems to be in $libc.  You're normal."
5644 else
5645         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5646                 :
5647         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5648                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5649         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5650                 :
5651         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5652                 :
5653         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5654                 :
5655         else
5656                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5657         fi
5658         if $test -r "$tans"; then
5659                 echo "Your C library seems to be in $tans, of all places."
5660                 libc=$tans
5661         else
5662                 libc='blurfl'
5663         fi
5664 fi
5665 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5666         dflt="$libc"
5667         cat <<EOM
5668
5669 If the guess above is wrong (which it might be if you're using a strange
5670 compiler, or your machine supports multiple models), you can override it here.
5671
5672 EOM
5673 else
5674         dflt=''
5675         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5676         cat >&4 <<EOM
5677 I can't seem to find your C library.  I've looked in the following places:
5678
5679 EOM
5680         $sed 's/^/      /' libpath
5681         cat <<EOM
5682
5683 None of these seems to contain your C library. I need to get its name...
5684
5685 EOM
5686 fi
5687 fn=f
5688 rp='Where is your C library?'
5689 . ./getfile
5690 libc="$ans"
5691
5692 echo " "
5693 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5694 set X `cat libnames`
5695 shift
5696 xxx=files
5697 case $# in 1) xxx=file; esac
5698 echo "Extracting names from the following $xxx for later perusal:" >&4
5699 echo " "
5700 $sed 's/^/      /' libnames >&4
5701 echo " "
5702 $echo $n "This may take a while...$c" >&4
5703
5704 for file in $*; do
5705         case $file in
5706         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5707         *) $nm $nm_opt $file 2>/dev/null;;
5708         esac
5709 done >libc.tmp
5710
5711 $echo $n ".$c"
5712 $grep fprintf libc.tmp > libc.ptf
5713 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5714 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5715 xxx='[ADTSIW]'
5716 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5717         eval $xscan;\
5718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719                 eval $xrun
5720 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5721         eval $xscan;\
5722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723                 eval $xrun
5724 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5741                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5750         eval $xscan;\
5751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752                 eval $xrun
5753 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5754         eval $xscan;\
5755         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756                 eval $xrun
5757 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5758         eval $xscan;\
5759         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760                 eval $xrun
5761 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5762         eval $xscan;\
5763         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764                 eval $xrun
5765 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5766         eval $xscan;\
5767         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768                 eval $xrun
5769 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5770         eval $xscan;\
5771         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772                 eval $xrun
5773 else
5774         $nm -p $* 2>/dev/null >libc.tmp
5775         $grep fprintf libc.tmp > libc.ptf
5776         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5777                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5778         then
5779                 nm_opt='-p'
5780                 eval $xrun
5781         else
5782                 echo " "
5783                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5784                 com=''
5785                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5786                         for thisname in $libnames $libc; do
5787                                 $ar t $thisname >>libc.tmp
5788                         done
5789                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5790                         echo "Ok." >&4
5791                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5792                         # Repeat libc to extract forwarders to DLL entries too
5793                         for thisname in $libnames $libc; do
5794                                 $ar tv $thisname >>libc.tmp
5795                                 # Revision 50 of EMX has bug in $ar.
5796                                 # it will not extract forwarders to DLL entries
5797                                 # Use emximp which will extract exactly them.
5798                                 emximp -o tmp.imp $thisname \
5799                                     2>/dev/null && \
5800                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5801                                     < tmp.imp >>libc.tmp
5802                                 $rm tmp.imp
5803                         done
5804                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5805                         echo "Ok." >&4
5806                 else
5807                         echo "$ar didn't seem to work right." >&4
5808                         echo "Maybe this is a Cray...trying bld instead..." >&4
5809                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5810                         then
5811                                 for thisname in $libnames; do
5812                                         bld t $libnames | \
5813                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5814                                         $ar t $thisname >>libc.tmp
5815                                 done
5816                                 echo "Ok." >&4
5817                         else
5818                                 echo "That didn't work either.  Giving up." >&4
5819                                 exit 1
5820                         fi
5821                 fi
5822         fi
5823 fi
5824 nm_extract="$com"
5825 case "$PASE" in
5826 define)
5827     echo " "
5828     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5829     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5830     ;;
5831 *)  if $test -f /lib/syscalls.exp; then
5832         echo " "
5833         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5834         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5835     fi
5836     ;;
5837 esac
5838 ;;
5839 esac
5840 $rm -f libnames libpath
5841
5842 : is a C symbol defined?
5843 csym='tlook=$1;
5844 case "$3" in
5845 -v) tf=libc.tmp; tc=""; tdc="";;
5846 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5847 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5848 esac;
5849 tx=yes;
5850 case "$reuseval-$4" in
5851 true-) ;;
5852 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5853 esac;
5854 case "$tx" in
5855 yes)
5856         case "$runnm" in
5857         true)
5858                 if $contains $tlook $tf >/dev/null 2>&1;
5859                 then tval=true;
5860                 else tval=false;
5861                 fi;;
5862         *)
5863                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5864                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5865                 then tval=true;
5866                 else tval=false;
5867                 fi;
5868                 $rm -f t t.c;;
5869         esac;;
5870 *)
5871         case "$tval" in
5872         $define) tval=true;;
5873         *) tval=false;;
5874         esac;;
5875 esac;
5876 eval "$2=$tval"'
5877
5878 : define an is-in-libc? function
5879 inlibc='echo " "; td=$define; tu=$undef;
5880 sym=$1; var=$2; eval "was=\$$2";
5881 tx=yes;
5882 case "$reuseval$was" in
5883 true) ;;
5884 true*) tx=no;;
5885 esac;
5886 case "$tx" in
5887 yes)
5888         set $sym tres -f;
5889         eval $csym;
5890         case "$tres" in
5891         true)
5892                 echo "$sym() found." >&4;
5893                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5894         *)
5895                 echo "$sym() NOT found." >&4;
5896                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5897         esac;;
5898 *)
5899         case "$was" in
5900         $define) echo "$sym() found." >&4;;
5901         *) echo "$sym() NOT found." >&4;;
5902         esac;;
5903 esac'
5904
5905 : see if sqrtl exists
5906 set sqrtl d_sqrtl
5907 eval $inlibc
5908
5909 hasproto='varname=$1; func=$2; shift; shift;
5910 while $test $# -ge 2; do
5911         case "$1" in
5912         $define) echo "#include <$2>";;
5913         esac ;
5914     shift 2;
5915 done > try.c;
5916 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5917 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5918         echo "$func() prototype found.";
5919         val="$define";
5920 else
5921         echo "$func() prototype NOT found.";
5922         val="$undef";
5923 fi;
5924 set $varname;
5925 eval $setvar;
5926 $rm -f try.c tryout.c'
5927
5928 : check for length of double
5929 echo " "
5930 case "$doublesize" in
5931 '')
5932         echo "Checking to see how big your double precision numbers are..." >&4
5933         $cat >try.c <<'EOCP'
5934 #include <stdio.h>
5935 int main()
5936 {
5937     printf("%d\n", (int)sizeof(double));
5938     exit(0);
5939 }
5940 EOCP
5941         set try
5942         if eval $compile_ok; then
5943                 doublesize=`$run ./try`
5944                 echo "Your double is $doublesize bytes long."
5945         else
5946                 dflt='8'
5947                 echo "(I can't seem to compile the test program.  Guessing...)"
5948                 rp="What is the size of a double precision number (in bytes)?"
5949                 . ./myread
5950                 doublesize="$ans"
5951         fi
5952         ;;
5953 esac
5954 $rm -f try.c try
5955
5956 : check for long doubles
5957 echo " "
5958 echo "Checking to see if you have long double..." >&4
5959 echo 'int main() { long double x = 7.0; }' > try.c
5960 set try
5961 if eval $compile; then
5962         val="$define"
5963         echo "You have long double."
5964 else
5965         val="$undef"
5966         echo "You do not have long double."
5967 fi
5968 $rm try.*
5969 set d_longdbl
5970 eval $setvar
5971
5972 : check for length of long double
5973 case "${d_longdbl}${longdblsize}" in
5974 $define)
5975         echo " "
5976         echo "Checking to see how big your long doubles are..." >&4
5977         $cat >try.c <<'EOCP'
5978 #include <stdio.h>
5979 int main()
5980 {
5981         printf("%d\n", sizeof(long double));
5982 }
5983 EOCP
5984         set try
5985         set try
5986         if eval $compile; then
5987                 longdblsize=`$run ./try`
5988                 echo "Your long doubles are $longdblsize bytes long."
5989         else
5990                 dflt='8'
5991                 echo " "
5992                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5993                 rp="What is the size of a long double (in bytes)?"
5994                 . ./myread
5995                 longdblsize="$ans"
5996         fi
5997         if $test "X$doublesize" = "X$longdblsize"; then
5998                 echo "(That isn't any different from an ordinary double.)"
5999         fi      
6000         ;;
6001 esac
6002 $rm -f try.* try
6003
6004 echo " "
6005
6006 if $test X"$d_longdbl" = X"$define"; then
6007
6008 echo "Checking how to print long doubles..." >&4
6009
6010 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6011         $cat >try.c <<'EOCP'
6012 #include <sys/types.h>
6013 #include <stdio.h>
6014 int main() {
6015   double d = 123.456;
6016   printf("%.3f\n", d);
6017 }
6018 EOCP
6019         set try
6020         if eval $compile; then
6021                 yyy=`$run ./try`
6022                 case "$yyy" in
6023                 123.456)
6024                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6025                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
6026                         echo "We will use %f."
6027                         ;;
6028                 esac
6029         fi
6030 fi
6031
6032 if $test X"$sPRIfldbl" = X; then
6033         $cat >try.c <<'EOCP'
6034 #include <sys/types.h>
6035 #include <stdio.h>
6036 int main() {
6037   long double d = 123.456;
6038   printf("%.3Lf\n", d);
6039 }
6040 EOCP
6041         set try
6042         if eval $compile; then
6043                 yyy=`$run ./try`
6044                 case "$yyy" in
6045                 123.456)
6046                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6047                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6048                         echo "We will use %Lf."
6049                         ;;
6050                 esac
6051         fi
6052 fi
6053
6054 if $test X"$sPRIfldbl" = X; then
6055         $cat >try.c <<'EOCP'
6056 #include <sys/types.h>
6057 #include <stdio.h>
6058 int main() {
6059   long double d = 123.456;
6060   printf("%.3llf\n", d);
6061 }
6062 EOCP
6063         set try
6064         if eval $compile; then
6065                 yyy=`$run ./try`
6066                 case "$yyy" in
6067                 123.456)
6068                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6069                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6070                         echo "We will use %llf."
6071                         ;;
6072                 esac
6073         fi
6074 fi
6075
6076 if $test X"$sPRIfldbl" = X; then
6077         $cat >try.c <<'EOCP'
6078 #include <sys/types.h>
6079 #include <stdio.h>
6080 int main() {
6081   long double d = 123.456;
6082   printf("%.3lf\n", d);
6083 }
6084 EOCP
6085         set try
6086         if eval $compile; then
6087                 yyy=`$run ./try`
6088                 case "$yyy" in
6089                 123.456)
6090                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6091                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6092                         echo "We will use %lf."
6093                         ;;
6094                 esac
6095         fi
6096 fi
6097
6098 if $test X"$sPRIfldbl" = X; then
6099         echo "Cannot figure out how to print long doubles." >&4
6100 else
6101         sSCNfldbl=$sPRIfldbl    # expect consistency
6102 fi
6103
6104 $rm -f try try.*
6105
6106 fi # d_longdbl
6107
6108 case "$sPRIfldbl" in
6109 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6110         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6111         d_SCNfldbl="$undef";
6112         ;;
6113 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6114         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6115         d_SCNfldbl="$define";
6116         ;;
6117 esac
6118
6119 : see if modfl exists
6120 set modfl d_modfl
6121 eval $inlibc
6122
6123 : see if prototype for modfl is available
6124 echo " "
6125 set d_modflproto modfl math.h
6126 eval $hasproto
6127
6128 d_modfl_pow32_bug="$undef"
6129
6130 case "$d_longdbl$d_modfl" in
6131 $define$define)
6132         $cat <<EOM
6133 Checking to see whether your modfl() is okay for large values...
6134 EOM
6135 $cat >try.c <<EOCP
6136 #include <math.h> 
6137 #include <stdio.h>
6138 EOCP
6139 if $test "X$d_modflproto" != "X$define"; then
6140         $cat >>try.c <<EOCP
6141 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6142 long double modfl (long double, long double *);
6143 EOCP
6144 fi
6145 $cat >>try.c <<EOCP
6146 int main() {
6147     long double nv = 4294967303.15;
6148     long double v, w;
6149     v = modfl(nv, &w);         
6150 #ifdef __GLIBC__
6151     printf("glibc");
6152 #endif
6153     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6154     return 0;
6155 }
6156 EOCP
6157         case "$osname:$gccversion" in
6158         aix:)   saveccflags="$ccflags"
6159                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6160         esac
6161         set try
6162         if eval $compile; then
6163                 foo=`$run ./try`
6164                 case "$foo" in
6165                 *" 4294967303.150000 1.150000 4294967302.000000")
6166                         echo >&4 "Your modfl() is broken for large values."
6167                         d_modfl_pow32_bug="$define"
6168                         case "$foo" in
6169                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6170                         ;;
6171                         esac
6172                         ;;
6173                 *" 4294967303.150000 0.150000 4294967303.000000")
6174                         echo >&4 "Your modfl() seems okay for large values."
6175                         ;;
6176                 *)      echo >&4 "I don't understand your modfl() at all."
6177                         d_modfl="$undef"
6178                         ;;
6179                 esac
6180                 $rm -f try.* try core core.try.*
6181         else
6182                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6183                 d_modfl="$undef"
6184         fi
6185         case "$osname:$gccversion" in
6186         aix:)   ccflags="$saveccflags" ;; # restore
6187         esac
6188         ;;
6189 esac
6190
6191 case "$ccflags" in
6192 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6193 esac
6194
6195 case "$uselongdouble" in
6196 $define|true|[yY]*)     dflt='y';;
6197 *) dflt='n';;
6198 esac
6199 cat <<EOM
6200
6201 Perl can be built to take advantage of long doubles which
6202 (if available) may give more accuracy and range for floating point numbers.
6203
6204 If this doesn't make any sense to you, just accept the default '$dflt'.
6205 EOM
6206 rp='Try to use long doubles if available?'
6207 . ./myread
6208 case "$ans" in
6209 y|Y)    val="$define"   ;;
6210 *)      val="$undef"    ;;
6211 esac
6212 set uselongdouble
6213 eval $setvar
6214
6215 case "$uselongdouble" in
6216 true|[yY]*) uselongdouble="$define" ;;
6217 esac
6218
6219 case "$uselongdouble" in
6220 $define)
6221 : Look for a hint-file generated 'call-back-unit'.  If the
6222 : user has specified that long doubles should be used,
6223 : we may need to set or change some other defaults.
6224         if $test -f uselongdouble.cbu; then
6225                 echo "Your platform has some specific hints for long doubles, using them..."
6226                 . ./uselongdouble.cbu
6227         else
6228                 $cat <<EOM
6229 (Your platform doesn't have any specific hints for long doubles.)
6230 EOM
6231         fi
6232         ;;
6233 esac
6234
6235 message=X
6236 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6237 $define:$define:$define)
6238         : You have both
6239         ;;
6240 $define:$define:$undef)
6241         message="I could not find modfl"
6242         ;;
6243 $define:$undef:$define)
6244         message="I could not find sqrtl"
6245         ;;
6246 $define:$undef:$undef)
6247         message="I found neither sqrtl nor modfl"
6248         ;;
6249 esac
6250
6251 if $test "$message" != X; then
6252         $cat <<EOM >&4
6253
6254 *** You requested the use of long doubles but you do not seem to have
6255 *** the mathematic functions for long doubles.
6256 *** ($message)
6257 *** I'm disabling the use of long doubles.
6258
6259 EOM
6260
6261         uselongdouble=$undef
6262 fi
6263
6264 : determine the architecture name
6265 echo " "
6266 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6267         tarch=`arch`"-$osname"
6268 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6269         if uname -m > tmparch 2>&1 ; then
6270                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6271                         -e 's/$/'"-$osname/" tmparch`
6272         else
6273                 tarch="$osname"
6274         fi
6275         $rm -f tmparch
6276 else
6277         tarch="$osname"
6278 fi
6279 case "$myarchname" in
6280 ''|"$tarch") ;;
6281 *)
6282         echo "(Your architecture name used to be $myarchname.)"
6283         archname=''
6284         ;;
6285 esac
6286 case "$targetarch" in
6287 '') ;;
6288 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6289 esac
6290 myarchname="$tarch"
6291 case "$archname" in
6292 '') dflt="$tarch";;
6293 *) dflt="$archname";;
6294 esac
6295 rp='What is your architecture name'
6296 . ./myread
6297 archname="$ans"
6298 case "$usethreads" in
6299 $define)
6300         echo "Threads selected." >&4
6301         case "$archname" in
6302         *-thread*) echo "...and architecture name already has -thread." >&4
6303                 ;;
6304         *)      archname="$archname-thread"
6305                 echo "...setting architecture name to $archname." >&4
6306                 ;;
6307         esac
6308         ;;
6309 esac
6310 case "$usemultiplicity" in
6311 $define)
6312         echo "Multiplicity selected." >&4
6313         case "$archname" in
6314         *-multi*) echo "...and architecture name already has -multi." >&4
6315                 ;;
6316         *)      archname="$archname-multi"
6317                 echo "...setting architecture name to $archname." >&4
6318                 ;;
6319         esac
6320         ;;
6321 esac
6322 case "$use64bitint$use64bitall" in
6323 *"$define"*)
6324         case "$archname64" in
6325         '')
6326                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6327                 ;;
6328         *)
6329                 case "$use64bitint" in
6330                 "$define") echo "64 bit integers selected." >&4 ;;
6331                 esac
6332                 case "$use64bitall" in
6333                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6334                 esac
6335                 case "$archname" in
6336                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6337                         ;;
6338                 *)      archname="$archname-$archname64"
6339                         echo "...setting architecture name to $archname." >&4
6340                         ;;
6341                 esac
6342                 ;;
6343         esac
6344 esac
6345 case "$uselongdouble" in
6346 $define)
6347         echo "Long doubles selected." >&4
6348         case "$longdblsize" in
6349         $doublesize)
6350                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6351                 ;;
6352         *)
6353                 case "$archname" in
6354                 *-ld*) echo "...and architecture name already has -ld." >&4
6355                         ;;
6356                 *)      archname="$archname-ld"
6357                         echo "...setting architecture name to $archname." >&4
6358                         ;;
6359                 esac
6360                 ;;
6361         esac
6362         ;;
6363 esac
6364 case "$useperlio" in
6365 $define)
6366         echo "Perlio selected." >&4
6367         ;;
6368 *)
6369         echo "Perlio not selected, using stdio." >&4
6370         case "$archname" in
6371         *-stdio*) echo "...and architecture name already has -stdio." >&4
6372                 ;;
6373         *)      archname="$archname-stdio"
6374                 echo "...setting architecture name to $archname." >&4
6375                 ;;
6376         esac
6377         ;;
6378 esac
6379
6380 : determine root of directory hierarchy where package will be installed.
6381 case "$prefix" in
6382 '')
6383         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6384         ;;
6385 *?/)
6386         dflt=`echo "$prefix" | sed 's/.$//'`
6387         ;;
6388 *)
6389         dflt="$prefix"
6390         ;;
6391 esac
6392 $cat <<EOM
6393
6394 By default, $package will be installed in $dflt/bin, manual pages
6395 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6396 installation directories. Typically this is something like /usr/local.
6397 If you wish to have binaries under /usr/bin but other parts of the
6398 installation under /usr/local, that's ok: you will be prompted
6399 separately for each of the installation directories, the prefix being
6400 only used to set the defaults.
6401
6402 EOM
6403 fn=d~
6404 rp='Installation prefix to use?'
6405 . ./getfile
6406 oldprefix=''
6407 case "$prefix" in
6408 '') ;;
6409 *)
6410         case "$ans" in
6411         "$prefix") ;;
6412         *) oldprefix="$prefix";;
6413         esac
6414         ;;
6415 esac
6416 prefix="$ans"
6417 prefixexp="$ansexp"
6418
6419 case "$afsroot" in
6420 '')     afsroot=/afs ;;
6421 *)      afsroot=$afsroot ;;
6422 esac
6423
6424 : is AFS running?
6425 echo " "
6426 case "$afs" in
6427 $define|true)   afs=true ;;
6428 $undef|false)   afs=false ;;
6429 *)      if test -d $afsroot; then
6430                 afs=true
6431         else
6432                 afs=false
6433         fi
6434         ;;
6435 esac
6436 if $afs; then
6437         echo "AFS may be running... I'll be extra cautious then..." >&4
6438 else
6439         echo "AFS does not seem to be running..." >&4
6440 fi
6441
6442 : determine installation prefix for where package is to be installed.
6443 if $afs; then 
6444 $cat <<EOM
6445
6446 Since you are running AFS, I need to distinguish the directory in which
6447 files will reside from the directory in which they are installed (and from
6448 which they are presumably copied to the former directory by occult means).
6449
6450 EOM
6451         case "$installprefix" in
6452         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6453         *) dflt="$installprefix";;
6454         esac
6455 else
6456 $cat <<EOM
6457
6458 In some special cases, particularly when building $package for distribution,
6459 it is convenient to distinguish the directory in which files should be
6460 installed from the directory ($prefix) in which they will
6461 eventually reside.  For most users, these two directories are the same.
6462
6463 EOM
6464         case "$installprefix" in
6465         '') dflt=$prefix ;;
6466         *) dflt=$installprefix;;
6467         esac
6468 fi
6469 fn=d~
6470 rp='What installation prefix should I use for installing files?'
6471 . ./getfile
6472 installprefix="$ans"
6473 installprefixexp="$ansexp"
6474
6475 : set the prefixit variable, to compute a suitable default value
6476 prefixit='case "$3" in
6477 ""|none)
6478         case "$oldprefix" in
6479         "") eval "$1=\"\$$2\"";;
6480         *)
6481                 case "$3" in
6482                 "") eval "$1=";;
6483                 none)
6484                         eval "tp=\"\$$2\"";
6485                         case "$tp" in
6486                         ""|" ") eval "$1=\"\$$2\"";;
6487                         *) eval "$1=";;
6488                         esac;;
6489                 esac;;
6490         esac;;
6491 *)
6492         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6493         case "$tp" in
6494         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6495         /*-$oldprefix/*|\~*-$oldprefix/*)
6496                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6497         *) eval "$1=\"\$$2\"";;
6498         esac;;
6499 esac'
6500
6501 : get the patchlevel
6502 echo " "
6503 echo "Getting the current patchlevel..." >&4
6504 if $test -r $rsrc/patchlevel.h;then
6505         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6506         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6507         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6508         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6509         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6510         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6511        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6512 else
6513         revision=0
6514         patchlevel=0
6515         subversion=0
6516         api_revision=0
6517         api_version=0
6518         api_subversion=0
6519         perl_patchlevel=0
6520         $echo "(You do not have patchlevel.h.  Eek.)"
6521 fi
6522 if $test -r $rsrc/.patch ; then  
6523         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6524                 perl_patchlevel=`cat $rsrc/.patch`
6525         fi
6526 fi
6527 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6528 version_patchlevel_string="version $patchlevel subversion $subversion"
6529 case "$perl_patchlevel" in
6530 0|'') ;;
6531 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6532 esac
6533
6534 $echo "(You have $package $version_patchlevel_string.)"
6535
6536 case "$osname" in
6537 dos|vms)
6538         : XXX Should be a Configure test for double-dots in filenames.
6539         version=`echo $revision $patchlevel $subversion | \
6540                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6541         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6542                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6543         ;;
6544 *)
6545         version=`echo $revision $patchlevel $subversion | \
6546                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6547         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6548                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6549         ;;
6550 esac
6551 : Special case the 5.005_xx maintenance series, which used 5.005
6552 : without any subversion label as a subdirectory in $sitelib
6553 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6554         api_versionstring='5.005'
6555 fi
6556
6557 : determine installation style
6558 : For now, try to deduce it from prefix unless it is already set.
6559 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6560 case "$installstyle" in
6561 '')     case "$prefix" in
6562                 *perl*) dflt='lib';;
6563                 *) dflt='lib/perl5' ;;
6564         esac
6565         ;;
6566 *)      dflt="$installstyle" ;;
6567 esac
6568 : Probably not worth prompting for this since we prompt for all
6569 : the directories individually, and the prompt would be too long and
6570 : confusing anyway.
6571 installstyle=$dflt
6572
6573 : determine where private library files go
6574 : Usual default is /usr/local/lib/perl5/$version.
6575 : Also allow things like /opt/perl/lib/$version, since 
6576 : /opt/perl/lib/perl5... would be redundant.
6577 : The default "style" setting is made in installstyle.U
6578 case "$installstyle" in
6579 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6580 *)       set dflt privlib lib/$version ;;
6581 esac
6582 eval $prefixit
6583 $cat <<EOM
6584
6585 There are some auxiliary files for $package that need to be put into a
6586 private library directory that is accessible by everyone.
6587
6588 EOM
6589 fn=d~+
6590 rp='Pathname where the private library files will reside?'
6591 . ./getfile
6592 privlib="$ans"
6593 privlibexp="$ansexp"
6594 : Change installation prefix, if necessary.
6595 if $test X"$prefix" != X"$installprefix"; then
6596         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6597 else
6598         installprivlib="$privlibexp"
6599 fi
6600
6601 : set the prefixup variable, to restore leading tilda escape
6602 prefixup='case "$prefixexp" in
6603 "$prefix") ;;
6604 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6605 esac'
6606
6607 : determine where public architecture dependent libraries go
6608 set archlib archlib
6609 eval $prefixit
6610 : privlib default is /usr/local/lib/$package/$version
6611 : archlib default is /usr/local/lib/$package/$version/$archname
6612 : privlib may have an optional trailing /share.
6613 tdflt=`echo $privlib | $sed 's,/share$,,'`
6614 tdflt=$tdflt/$archname
6615 case "$archlib" in
6616 '')     dflt=$tdflt
6617         ;;
6618 *)      dflt="$archlib"
6619     ;;
6620 esac
6621 $cat <<EOM
6622
6623 $spackage contains architecture-dependent library files.  If you are
6624 sharing libraries in a heterogeneous environment, you might store
6625 these files in a separate location.  Otherwise, you can just include
6626 them with the rest of the public library files.
6627
6628 EOM
6629 fn=d+~
6630 rp='Where do you want to put the public architecture-dependent libraries?'
6631 . ./getfile
6632 archlib="$ans"
6633 archlibexp="$ansexp"
6634 if $test X"$archlib" = X"$privlib"; then
6635         d_archlib="$undef"
6636 else
6637         d_archlib="$define"
6638 fi
6639 : Change installation prefix, if necessary.
6640 if $test X"$prefix" != X"$installprefix"; then
6641         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6642 else
6643         installarchlib="$archlibexp"
6644 fi
6645
6646 : see if setuid scripts can be secure
6647 $cat <<EOM
6648
6649 Some kernels have a bug that prevents setuid #! scripts from being
6650 secure.  Some sites have disabled setuid #! scripts because of this.
6651
6652 First let's decide if your kernel supports secure setuid #! scripts.
6653 (If setuid #! scripts would be secure but have been disabled anyway,
6654 don't say that they are secure if asked.)
6655
6656 EOM
6657
6658 val="$undef"
6659 if $test -d /dev/fd; then
6660         echo "#!$ls" >reflect
6661         chmod +x,u+s reflect
6662         ./reflect >flect 2>&1
6663         if $contains "/dev/fd" flect >/dev/null; then
6664                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6665                 val="$define"
6666         else
6667                 $cat <<EOM
6668 If you are not sure if they are secure, I can check but I'll need a
6669 username and password different from the one you are using right now.
6670 If you don't have such a username or don't want me to test, simply
6671 enter 'none'.
6672
6673 EOM
6674                 rp='Other username to test security of setuid scripts with?'
6675                 dflt='none'
6676                 . ./myread
6677                 case "$ans" in
6678                 n|none)
6679                         case "$d_suidsafe" in
6680                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6681                                 dflt=n;;
6682                         "$undef")
6683                                 echo "Well, the $hint value is *not* secure." >&4
6684                                 dflt=n;;
6685                         *)      echo "Well, the $hint value *is* secure." >&4
6686                                 dflt=y;;
6687                         esac
6688                         ;;
6689                 *)
6690                         $rm -f reflect flect
6691                         echo "#!$ls" >reflect
6692                         chmod +x,u+s reflect
6693                         echo >flect
6694                         chmod a+w flect
6695                         echo '"su" will (probably) prompt you for '"$ans's password."
6696                         su $ans -c './reflect >flect'
6697                         if $contains "/dev/fd" flect >/dev/null; then
6698                                 echo "Okay, it looks like setuid scripts are secure." >&4
6699                                 dflt=y
6700                         else
6701                                 echo "I don't think setuid scripts are secure." >&4
6702                                 dflt=n
6703                         fi
6704                         ;;
6705                 esac
6706                 rp='Does your kernel have *secure* setuid scripts?'
6707                 . ./myread
6708                 case "$ans" in
6709                 [yY]*)  val="$define";;
6710                 *)      val="$undef";;
6711                 esac
6712         fi
6713 else
6714         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6715         echo "(That's for file descriptors, not floppy disks.)"
6716         val="$undef"
6717 fi
6718 set d_suidsafe
6719 eval $setvar
6720
6721 $rm -f reflect flect
6722
6723 : now see if they want to do setuid emulation
6724 echo " "
6725 val="$undef"
6726 case "$d_suidsafe" in
6727 "$define")
6728         val="$undef"
6729         echo "No need to emulate SUID scripts since they are secure here." >&4
6730         ;;
6731 *)
6732         $cat <<EOM
6733 Some systems have disabled setuid scripts, especially systems where
6734 setuid scripts cannot be secure.  On systems where setuid scripts have
6735 been disabled, the setuid/setgid bits on scripts are currently
6736 useless.  It is possible for $package to detect those bits and emulate
6737 setuid/setgid in a secure fashion.  This emulation will only work if
6738 setuid scripts have been disabled in your kernel.
6739
6740 EOM
6741         case "$d_dosuid" in
6742         "$define") dflt=y ;;
6743         *) dflt=n ;;
6744         esac
6745         rp="Do you want to do setuid/setgid emulation?"
6746         . ./myread
6747         case "$ans" in
6748         [yY]*)  val="$define";;
6749         *)      val="$undef";;
6750         esac
6751         ;;
6752 esac
6753 set d_dosuid
6754 eval $setvar
6755
6756 : see if this is a malloc.h system
6757 : we want a real compile instead of Inhdr because some systems have a
6758 : malloc.h that just gives a compile error saying to use stdlib.h instead
6759 echo " "
6760 $cat >try.c <<EOCP
6761 #include <stdlib.h>
6762 #include <malloc.h>
6763 int main () { return 0; }
6764 EOCP
6765 set try
6766 if eval $compile; then
6767     echo "<malloc.h> found." >&4
6768     val="$define"
6769 else
6770     echo "<malloc.h> NOT found." >&4
6771     val="$undef"
6772 fi
6773 $rm -f try.c try
6774 set i_malloc
6775 eval $setvar
6776
6777 : see if stdlib is available
6778 set stdlib.h i_stdlib
6779 eval $inhdr
6780
6781 : check for void type
6782 echo " "
6783 echo "Checking to see how well your C compiler groks the void type..." >&4
6784 case "$voidflags" in
6785 '')
6786         $cat >try.c <<'EOCP'
6787 #if TRY & 1
6788 void sub() {
6789 #else
6790 sub() {
6791 #endif
6792         extern void moo();      /* function returning void */
6793         void (*goo)();          /* ptr to func returning void */
6794 #if TRY & 8
6795         void *hue;              /* generic ptr */
6796 #endif
6797 #if TRY & 2
6798         void (*foo[10])();
6799 #endif
6800
6801 #if TRY & 4
6802         if(goo == moo) {
6803                 exit(0);
6804         }
6805 #endif
6806         exit(0);
6807 }
6808 int main() { sub(); }
6809 EOCP
6810         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6811                 voidflags=$defvoidused
6812         echo "Good.  It appears to support void to the level $package wants.">&4
6813                 if $contains warning .out >/dev/null 2>&1; then
6814                         echo "However, you might get some warnings that look like this:"
6815                         $cat .out
6816                 fi
6817         else
6818 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6819                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6820                         echo "It supports 1..."
6821                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6822                                 echo "It also supports 2..."
6823                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6824                                         voidflags=7
6825                                         echo "And it supports 4 but not 8 definitely."
6826                                 else
6827                                         echo "It doesn't support 4..."
6828                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6829                                                 voidflags=11
6830                                                 echo "But it supports 8."
6831                                         else
6832                                                 voidflags=3
6833                                                 echo "Neither does it support 8."
6834                                         fi
6835                                 fi
6836                         else
6837                                 echo "It does not support 2..."
6838                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6839                                         voidflags=13
6840                                         echo "But it supports 4 and 8."
6841                                 else
6842                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6843                                                 voidflags=5
6844                                                 echo "And it supports 4 but has not heard about 8."
6845                                         else
6846                                                 echo "However it supports 8 but not 4."
6847                                         fi
6848                                 fi
6849                         fi
6850                 else
6851                         echo "There is no support at all for void."
6852                         voidflags=0
6853                 fi
6854         fi
6855 esac
6856 case "$voidflags" in
6857 "$defvoidused") ;;
6858 *)      $cat >&4 <<'EOM'
6859   Support flag bits are:
6860     1: basic void declarations.
6861     2: arrays of pointers to functions returning void.
6862     4: operations between pointers to and addresses of void functions.
6863     8: generic void pointers.
6864 EOM
6865         dflt="$voidflags";
6866         rp="Your void support flags add up to what?"
6867         . ./myread
6868         voidflags="$ans"
6869         ;;
6870 esac
6871 $rm -f try.* .out
6872
6873 : check for length of pointer
6874 echo " "
6875 case "$ptrsize" in
6876 '')
6877         echo "Checking to see how big your pointers are..." >&4
6878         if test "$voidflags" -gt 7; then
6879                 echo '#define VOID_PTR char *' > try.c
6880         else
6881                 echo '#define VOID_PTR void *' > try.c
6882         fi
6883         $cat >>try.c <<'EOCP'
6884 #include <stdio.h>
6885 int main()
6886 {
6887     printf("%d\n", (int)sizeof(VOID_PTR));
6888     exit(0);
6889 }
6890 EOCP
6891         set try
6892         if eval $compile_ok; then
6893                 ptrsize=`$run ./try`
6894                 echo "Your pointers are $ptrsize bytes long."
6895         else
6896                 dflt='4'
6897                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6898                 rp="What is the size of a pointer (in bytes)?"
6899                 . ./myread
6900                 ptrsize="$ans"
6901         fi
6902         ;;
6903 esac
6904 $rm -f try.c try
6905 case "$use64bitall" in
6906 "$define"|true|[yY]*)
6907         case "$ptrsize" in
6908         4)      cat <<EOM >&4
6909
6910 *** You have chosen a maximally 64-bit build, but your pointers
6911 *** are only 4 bytes wide, disabling maximal 64-bitness.
6912
6913 EOM
6914                 use64bitall="$undef"
6915                 case "$use64bitint" in
6916                 "$define"|true|[yY]*) ;;
6917                 *)      cat <<EOM >&4
6918
6919 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6920
6921 EOM
6922                         use64bitint="$define"
6923                         ;;
6924                 esac
6925                 ;;
6926         esac
6927         ;;
6928 esac
6929
6930
6931 : determine which malloc to compile in
6932 echo " "
6933 case "$usemymalloc" in
6934 [yY]*|true|$define)     dflt='y' ;;
6935 [nN]*|false|$undef)     dflt='n' ;;
6936 *)      case "$ptrsize" in
6937         4) dflt='y' ;;
6938         *) dflt='n' ;;
6939         esac
6940         ;;
6941 esac
6942 rp="Do you wish to attempt to use the malloc that comes with $package?"
6943 . ./myread
6944 usemymalloc="$ans"
6945 case "$ans" in
6946 y*|true)
6947         usemymalloc='y'
6948         mallocsrc='malloc.c'
6949         mallocobj="malloc$_o"
6950         d_mymalloc="$define"
6951         case "$libs" in
6952         *-lmalloc*)
6953                 : Remove malloc from list of libraries to use
6954                 echo "Removing unneeded -lmalloc from library list" >&4
6955                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6956                 shift
6957                 libs="$*"
6958                 echo "libs = $libs" >&4
6959                 ;;
6960         esac
6961         ;;
6962 *)
6963         usemymalloc='n'
6964         mallocsrc=''
6965         mallocobj=''
6966         d_mymalloc="$undef"
6967         ;;
6968 esac
6969
6970 : compute the return types of malloc and free
6971 echo " "
6972 $cat >malloc.c <<END
6973 #$i_malloc I_MALLOC
6974 #$i_stdlib I_STDLIB
6975 #include <stdio.h>
6976 #include <sys/types.h>
6977 #ifdef I_MALLOC
6978 #include <malloc.h>
6979 #endif
6980 #ifdef I_STDLIB
6981 #include <stdlib.h>
6982 #endif
6983 #ifdef TRY_MALLOC
6984 void *malloc();
6985 #endif
6986 #ifdef TRY_FREE
6987 void free();
6988 #endif
6989 END
6990 case "$malloctype" in
6991 '')
6992         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6993                 malloctype='void *'
6994         else
6995                 malloctype='char *'
6996         fi
6997         ;;
6998 esac
6999 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7000
7001 case "$freetype" in
7002 '')
7003         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7004                 freetype='void'
7005         else
7006                 freetype='int'
7007         fi
7008         ;;
7009 esac
7010 echo "Your system uses $freetype free(), it would seem." >&4
7011 $rm -f malloc.[co]
7012 $cat <<EOM
7013
7014 After $package is installed, you may wish to install various
7015 add-on modules and utilities.  Typically, these add-ons will
7016 be installed under $prefix with the rest
7017 of this package.  However, you may wish to install such add-ons
7018 elsewhere under a different prefix.
7019
7020 If you do not wish to put everything under a single prefix, that's
7021 ok.  You will be prompted for the individual locations; this siteprefix
7022 is only used to suggest the defaults.
7023
7024 The default should be fine for most people.
7025
7026 EOM
7027 fn=d~+
7028 rp='Installation prefix to use for add-on modules and utilities?'
7029 : XXX Here might be another good place for an installstyle setting.
7030 case "$siteprefix" in
7031 '') dflt=$prefix ;;
7032 *)  dflt=$siteprefix ;;
7033 esac
7034 . ./getfile
7035 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7036 oldsiteprefix=''
7037 case "$siteprefix" in
7038 '') ;;
7039 *)      case "$ans" in
7040         "$prefix") ;;
7041         *) oldsiteprefix="$prefix";;
7042         esac
7043         ;;
7044 esac
7045 siteprefix="$ans"
7046 siteprefixexp="$ansexp"
7047
7048 : determine where site specific libraries go.
7049 : Usual default is /usr/local/lib/perl5/site_perl/$version
7050 : The default "style" setting is made in installstyle.U
7051 : XXX No longer works with Prefixit stuff.
7052 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7053 case "$sitelib" in
7054 '') case "$installstyle" in
7055         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7056         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7057         esac
7058         ;;
7059 *)      dflt="$sitelib"
7060         ;;
7061 esac
7062 $cat <<EOM
7063
7064 The installation process will create a directory for
7065 site-specific extensions and modules.  Most users find it convenient
7066 to place all site-specific files in this directory rather than in the
7067 main distribution directory.
7068
7069 EOM
7070 fn=d~+
7071 rp='Pathname for the site-specific library files?'
7072 . ./getfile
7073 sitelib="$ans"
7074 sitelibexp="$ansexp"
7075 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7076 : Change installation prefix, if necessary.
7077 if $test X"$prefix" != X"$installprefix"; then
7078         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7079 else
7080         installsitelib="$sitelibexp"
7081 fi
7082
7083 : determine where site specific architecture-dependent libraries go.
7084 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7085 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7086 : sitelib may have an optional trailing /share.
7087 case "$sitearch" in
7088 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7089         dflt="$dflt/$archname"
7090         ;;
7091 *)      dflt="$sitearch"
7092         ;;
7093 esac
7094 set sitearch sitearch none
7095 eval $prefixit
7096 $cat <<EOM
7097
7098 The installation process will also create a directory for
7099 architecture-dependent site-specific extensions and modules.
7100
7101 EOM
7102 fn=d~+
7103 rp='Pathname for the site-specific architecture-dependent library files?'
7104 . ./getfile
7105 sitearch="$ans"
7106 sitearchexp="$ansexp"
7107 : Change installation prefix, if necessary.
7108 if $test X"$prefix" != X"$installprefix"; then
7109         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7110 else
7111         installsitearch="$sitearchexp"
7112 fi
7113
7114 $cat <<EOM
7115
7116 The installation process will also create a directory for
7117 vendor-supplied add-ons.  Vendors who supply perl with their system
7118 may find it convenient to place all vendor-supplied files in this
7119 directory rather than in the main distribution directory.  This will
7120 ease upgrades between binary-compatible maintenance versions of perl.
7121
7122 Of course you may also use these directories in whatever way you see
7123 fit.  For example, you might use them to access modules shared over a
7124 company-wide network.
7125
7126 The default answer should be fine for most people.
7127 This causes further questions about vendor add-ons to be skipped
7128 and no vendor-specific directories will be configured for perl.
7129
7130 EOM
7131 rp='Do you want to configure vendor-specific add-on directories?'
7132 case "$usevendorprefix" in
7133 define|true|[yY]*) dflt=y ;;
7134 *)      : User may have set vendorprefix directly on Configure command line.
7135         case "$vendorprefix" in
7136         ''|' ') dflt=n ;;
7137         *)      dflt=y ;;
7138         esac
7139         ;;
7140 esac
7141 . ./myread
7142 case "$ans" in
7143 [yY]*)  fn=d~+
7144         rp='Installation prefix to use for vendor-supplied add-ons?'
7145         case "$vendorprefix" in
7146         '') dflt='' ;;
7147         *)  dflt=$vendorprefix ;;
7148         esac
7149         . ./getfile
7150         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7151         oldvendorprefix=''
7152         case "$vendorprefix" in
7153         '') ;;
7154         *)      case "$ans" in
7155                 "$prefix") ;;
7156                 *) oldvendorprefix="$prefix";;
7157                 esac
7158                 ;;
7159         esac
7160         usevendorprefix="$define"
7161         vendorprefix="$ans"
7162         vendorprefixexp="$ansexp"
7163         ;;
7164 *)      usevendorprefix="$undef"
7165         vendorprefix=''
7166         vendorprefixexp=''
7167         ;;
7168 esac
7169
7170 case "$vendorprefix" in
7171 '')     d_vendorlib="$undef"
7172         vendorlib=''
7173         vendorlibexp=''
7174         ;;
7175 *)      d_vendorlib="$define"
7176         : determine where vendor-supplied modules go.
7177         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7178         case "$vendorlib" in
7179         '')
7180                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7181                 case "$installstyle" in
7182                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7183                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7184                 esac
7185                 ;;
7186         *)      dflt="$vendorlib"
7187                 ;;
7188         esac
7189         fn=d~+
7190         rp='Pathname for the vendor-supplied library files?'
7191         . ./getfile
7192         vendorlib="$ans"
7193         vendorlibexp="$ansexp"
7194         ;;
7195 esac
7196 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7197 : Change installation prefix, if necessary.
7198 if $test X"$prefix" != X"$installprefix"; then
7199         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7200 else
7201         installvendorlib="$vendorlibexp"
7202 fi
7203
7204 case "$vendorprefix" in
7205 '')     d_vendorarch="$undef"
7206         vendorarch=''
7207         vendorarchexp=''
7208         ;;
7209 *)      d_vendorarch="$define"
7210         : determine where vendor-supplied architecture-dependent libraries go.
7211         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7212         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7213         : vendorlib may have an optional trailing /share.
7214         case "$vendorarch" in
7215         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7216                 dflt="$dflt/$archname"
7217                 ;;
7218         *)      dflt="$vendorarch" ;;
7219         esac
7220         fn=d~+
7221         rp='Pathname for vendor-supplied architecture-dependent files?'
7222         . ./getfile
7223         vendorarch="$ans"
7224         vendorarchexp="$ansexp"
7225         ;;
7226 esac
7227 : Change installation prefix, if necessary.
7228 if $test X"$prefix" != X"$installprefix"; then
7229         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7230 else
7231         installvendorarch="$vendorarchexp"
7232 fi
7233
7234 : Final catch-all directories to search
7235 $cat <<EOM
7236
7237 Lastly, you can have perl look in other directories for extensions and
7238 modules in addition to those already specified.
7239 These directories will be searched after 
7240         $sitearch 
7241         $sitelib 
7242 EOM
7243 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7244 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7245 echo ' '
7246 case "$otherlibdirs" in
7247 ''|' ') dflt='none' ;;
7248 *)      dflt="$otherlibdirs" ;;
7249 esac
7250 $cat <<EOM
7251 Enter a colon-separated set of extra paths to include in perl's @INC
7252 search path, or enter 'none' for no extra paths.
7253
7254 EOM
7255
7256 rp='Colon-separated list of additional directories for perl to search?'
7257 . ./myread
7258 case "$ans" in
7259 ' '|''|none)    otherlibdirs=' ' ;;     
7260 *)      otherlibdirs="$ans" ;;
7261 esac
7262 case "$otherlibdirs" in
7263 ' ') val=$undef ;;
7264 *)      val=$define ;;
7265 esac
7266 set d_perl_otherlibdirs
7267 eval $setvar
7268
7269 : Cruising for prototypes
7270 echo " "
7271 echo "Checking out function prototypes..." >&4
7272 $cat >prototype.c <<'EOCP'
7273 int main(int argc, char *argv[]) {
7274         exit(0);}
7275 EOCP
7276 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7277         echo "Your C compiler appears to support function prototypes."
7278         val="$define"
7279 else
7280         echo "Your C compiler doesn't seem to understand function prototypes."
7281         val="$undef"
7282 fi
7283 set prototype
7284 eval $setvar
7285 $rm -f prototype*
7286
7287 case "$prototype" in
7288 "$define") ;;
7289 *)      ansi2knr='ansi2knr'
7290         echo " "
7291         cat <<EOM >&4
7292
7293 $me:  FATAL ERROR:
7294 This version of $package can only be compiled by a compiler that 
7295 understands function prototypes.  Unfortunately, your C compiler 
7296         $cc $ccflags
7297 doesn't seem to understand them.  Sorry about that.
7298
7299 If GNU cc is available for your system, perhaps you could try that instead.  
7300
7301 Eventually, we hope to support building Perl with pre-ANSI compilers.
7302 If you would like to help in that effort, please contact <perlbug@perl.org>.
7303
7304 Aborting Configure now.
7305 EOM
7306         exit 2
7307         ;;
7308 esac
7309
7310 : determine where public executables go
7311 echo " "
7312 set dflt bin bin
7313 eval $prefixit
7314 fn=d~
7315 rp='Pathname where the public executables will reside?'
7316 . ./getfile
7317 if $test "X$ansexp" != "X$binexp"; then
7318         installbin=''
7319 fi
7320 bin="$ans"
7321 binexp="$ansexp"
7322 : Change installation prefix, if necessary.
7323 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7324 if $test X"$prefix" != X"$installprefix"; then
7325         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7326 else
7327         installbin="$binexp"
7328 fi
7329
7330 echo " "
7331 case "$extras" in
7332 '') dflt='n';;
7333 *) dflt='y';;
7334 esac
7335 cat <<EOM
7336 Perl can be built with extra modules or bundles of modules which
7337 will be fetched from the CPAN and installed alongside Perl.
7338
7339 Notice that you will need access to the CPAN; either via the Internet,
7340 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7341 be asked later to configure the CPAN.pm module which will in turn do
7342 the installation of the rest of the extra modules or bundles.)
7343
7344 Notice also that if the modules require any external software such as
7345 libraries and headers (the libz library and the zlib.h header for the
7346 Compress::Zlib module, for example) you MUST have any such software
7347 already installed, this configuration process will NOT install such
7348 things for you.
7349
7350 If this doesn't make any sense to you, just accept the default '$dflt'.
7351 EOM
7352 rp='Install any extra modules (y or n)?'
7353 . ./myread
7354 case "$ans" in
7355 y|Y)
7356         cat <<EOM
7357
7358 Please list any extra modules or bundles to be installed from CPAN,
7359 with spaces between the names.  The names can be in any format the
7360 'install' command of CPAN.pm will understand.  (Answer 'none',
7361 without the quotes, to install no extra modules or bundles.)
7362 EOM
7363         rp='Extras?'
7364         dflt="$extras"
7365         . ./myread
7366         extras="$ans"
7367 esac
7368 case "$extras" in
7369 ''|'none')
7370         val=''
7371         $rm -f ../extras.lst
7372         ;;
7373 *)      echo "(Saving the list of extras for later...)"
7374         echo "$extras" > ../extras.lst
7375         val="'$extras'"
7376         ;;
7377 esac
7378 set extras
7379 eval $setvar
7380 echo " "
7381
7382 : determine where html pages for programs go
7383 set html1dir html1dir none
7384 eval $prefixit
7385 $cat <<EOM
7386
7387 If you wish to install html files for programs in $spackage, indicate 
7388 the appropriate directory here.  To skip installing html files,
7389 answer "none".
7390 EOM
7391 case "$html1dir" in
7392 ''|none|$undef|' ') dflt=none ;;
7393 *) dflt=$html1dir ;;
7394 esac
7395 fn=dn+~
7396 rp="Directory for the main $spackage html pages?"
7397 . ./getfile
7398 html1dir="$ans"
7399 html1direxp="$ansexp"
7400 : Use ' ' for none so value is preserved next time through Configure
7401 $test X"$html1dir" = "X" && html1dir=' '
7402 : Change installation prefix, if necessary.
7403 if $test X"$prefix" != X"$installprefix"; then
7404         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
7405 else
7406         installhtml1dir="$html1direxp"
7407 fi
7408
7409 : determine where html pages for libraries and modules go
7410 set html3dir html3dir none
7411 eval $prefixit
7412 $cat <<EOM
7413
7414 If you wish to install html files for modules associated with $spackage,
7415 indicate the appropriate directory here.  To skip installing html files,
7416 answer "none".
7417 EOM
7418 : There is no obvious default.  If they have specified html1dir, then
7419 : try to key off that, possibly changing .../html1 into .../html3.
7420 case "$html3dir" in
7421 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7422 *) dflt=$html3dir ;;
7423 esac
7424 fn=dn+~
7425 rp="Directory for the $spackage module html pages?"
7426 . ./getfile
7427 html3dir="$ans"
7428 html3direxp="$ansexp"
7429 : Use ' ' for none so value is preserved next time through Configure
7430 $test X"$html3dir" = "X" && html3dir=' '
7431 : Change installation prefix, if necessary.
7432 if $test X"$prefix" != X"$installprefix"; then
7433         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
7434 else
7435         installhtml3dir="$html3direxp"
7436 fi
7437
7438 : Find perl5.005 or later.
7439 echo "Looking for a previously installed perl5.005 or later... "
7440 case "$perl5" in
7441 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7442                 : Check if this perl is recent and can load a simple module
7443                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7444                         perl5=$tdir/perl
7445                         break;
7446                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7447                         perl5=$tdir/perl5
7448                         break;
7449                 fi
7450         done
7451         ;;
7452 *)      perl5="$perl5"
7453         ;;
7454 esac
7455 case "$perl5" in
7456 '')     echo "None found.  That's ok.";;
7457 *)      echo "Using $perl5." ;;
7458 esac
7459
7460 : Determine list of previous versions to include in @INC
7461 $cat > getverlist <<EOPL
7462 #!$perl5 -w
7463 use File::Basename;
7464 \$api_versionstring = "$api_versionstring";
7465 \$version = "$version";
7466 \$stem = "$sitelib_stem";
7467 \$archname = "$archname";
7468 EOPL
7469         $cat >> getverlist <<'EOPL'
7470 # Can't have leading @ because metaconfig interprets it as a command!
7471 ;@inc_version_list=();
7472 # XXX Redo to do opendir/readdir? 
7473 if (-d $stem) {
7474     chdir($stem);
7475     ;@candidates = glob("5.*");
7476 }
7477 else {
7478     ;@candidates = ();
7479 }
7480
7481 # XXX ToDo:  These comparisons must be reworked when two-digit
7482 # subversions come along, so that 5.7.10 compares as greater than
7483 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7484 # widespread that we can use the built-in version vectors rather
7485 # than reinventing them here.  For 5.6.0, however, we must
7486 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7487 foreach $d (@candidates) {
7488     if ($d lt $version) {
7489         if ($d ge $api_versionstring) {
7490             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7491         }
7492         elsif ($d ge "5.005") {
7493             unshift(@inc_version_list, grep { -d } $d);
7494         }
7495     }
7496     else {
7497         # Skip newer version.  I.e. don't look in
7498         # 5.7.0 if we're installing 5.6.1.
7499     }
7500 }
7501
7502 if (@inc_version_list) {
7503     print join(' ', @inc_version_list);
7504 }
7505 else {
7506     # Blank space to preserve value for next Configure run.
7507     print " ";
7508 }
7509 EOPL
7510 chmod +x getverlist
7511 case "$inc_version_list" in
7512 '')     if test -x "$perl5$exe_ext"; then
7513                 dflt=`$perl5 getverlist`
7514         else
7515                 dflt='none'
7516         fi
7517         ;;
7518 $undef) dflt='none' ;;
7519 *)  eval dflt=\"$inc_version_list\" ;;
7520 esac
7521 case "$dflt" in
7522 ''|' ') dflt=none ;;
7523 esac
7524 case "$dflt" in
7525 5.005) dflt=none ;;
7526 esac
7527 $cat <<EOM
7528
7529 In order to ease the process of upgrading, this version of perl 
7530 can be configured to use modules built and installed with earlier 
7531 versions of perl that were installed under $prefix.  Specify here
7532 the list of earlier versions that this version of perl should check.
7533 If Configure detected no earlier versions of perl installed under
7534 $prefix, then the list will be empty.  Answer 'none' to tell perl
7535 to not search earlier versions.
7536
7537 The default should almost always be sensible, so if you're not sure,
7538 just accept the default.
7539 EOM
7540
7541 rp='List of earlier versions to include in @INC?'
7542 . ./myread
7543 case "$ans" in
7544 [Nn]one|''|' ') inc_version_list=' ' ;;
7545 *) inc_version_list="$ans" ;;
7546 esac
7547 case "$inc_version_list" in
7548 ''|' ') 
7549         inc_version_list_init='0';;
7550 *)      inc_version_list_init=`echo $inc_version_list |
7551                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7552         ;;
7553 esac
7554 $rm -f getverlist
7555
7556 : determine whether to install perl also as /usr/bin/perl
7557
7558 echo " "
7559 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7560         $cat <<EOM
7561 Many scripts expect perl to be installed as /usr/bin/perl.
7562
7563 If you want to, I can install the perl you are about to compile
7564 as /usr/bin/perl (in addition to $bin/perl).
7565 EOM
7566         if test -f /usr/bin/perl; then
7567             $cat <<EOM
7568
7569 However, please note that because you already have a /usr/bin/perl,
7570 overwriting that with a new Perl would very probably cause problems.
7571 Therefore I'm assuming you don't want to do that (unless you insist).
7572
7573 EOM
7574             case "$installusrbinperl" in
7575             "$define"|[yY]*)    dflt='y';;
7576             *)                  dflt='n';;
7577             esac
7578         else
7579             $cat <<EOM
7580
7581 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7582
7583 EOM
7584             case "$installusrbinperl" in
7585             "$undef"|[nN]*)     dflt='n';;
7586             *)                  dflt='y';;
7587             esac
7588         fi
7589         rp="Do you want to install perl as /usr/bin/perl?"
7590         . ./myread
7591         case "$ans" in
7592         [yY]*)  val="$define";;
7593         *)      val="$undef" ;;
7594         esac
7595 else
7596         val="$undef"
7597 fi
7598 set installusrbinperl
7599 eval $setvar
7600
7601 : see if dld is available
7602 set dld.h i_dld
7603 eval $inhdr
7604
7605 : see if dlopen exists
7606 xxx_runnm="$runnm"
7607 runnm=false
7608 set dlopen d_dlopen
7609 eval $inlibc
7610 runnm="$xxx_runnm"
7611
7612 : determine which dynamic loading, if any, to compile in
7613 echo " "
7614 dldir="ext/DynaLoader"
7615 case "$usedl" in
7616 $define|y|true)
7617         dflt='y'
7618         usedl="$define"
7619         ;;
7620 $undef|n|false)
7621         dflt='n'
7622         usedl="$undef"
7623         ;;
7624 *) 
7625         dflt='n'
7626         case "$d_dlopen" in
7627             $define) dflt='y' ;;
7628         esac
7629         case "$i_dld" in
7630             $define) dflt='y' ;;
7631         esac
7632         : Does a dl_xxx.xs file exist for this operating system
7633         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7634         ;;
7635 esac
7636 rp="Do you wish to use dynamic loading?"
7637 . ./myread
7638 usedl="$ans"
7639 case "$ans" in
7640 y*) usedl="$define"
7641         case "$dlsrc" in
7642         '')
7643                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7644                         dflt="$dldir/dl_${osname}.xs"
7645                 elif $test "$d_dlopen" = "$define" ; then
7646                         dflt="$dldir/dl_dlopen.xs"
7647                 elif $test "$i_dld" = "$define" ; then
7648                         dflt="$dldir/dl_dld.xs"
7649                 else
7650                         dflt=''
7651                 fi
7652                 ;;
7653         *)      dflt="$dldir/$dlsrc"
7654                 ;;
7655         esac
7656     echo "The following dynamic loading files are available:"
7657         : Can not go over to $dldir because getfile has path hard-coded in.
7658         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7659         rp="Source file to use for dynamic loading"
7660         fn="fne"
7661         gfpth="$src"
7662         . ./getfile
7663         usedl="$define"
7664         : emulate basename
7665         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7666
7667         $cat << EOM
7668
7669 Some systems may require passing special flags to $cc -c to
7670 compile modules that will be used to create a shared library.
7671 To use no flags, say "none".
7672
7673 EOM
7674     case "$cccdlflags" in
7675     '') case "$gccversion" in
7676                 '') case "$osname" in
7677                         hpux)   dflt='+z' ;;
7678                         next)   dflt='none' ;;
7679                         irix*)  dflt='-KPIC' ;;
7680                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7681                         sunos)  dflt='-pic' ;;
7682                         *)      dflt='none' ;;
7683                     esac
7684                         ;;
7685                 *)  case "$osname" in
7686                         darwin) dflt='none' ;;
7687                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7688                         *)      dflt='-fpic' ;;
7689                     esac ;;
7690             esac ;;
7691         ' ') dflt='none' ;;
7692     *)  dflt="$cccdlflags" ;;
7693     esac
7694     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7695     . ./myread
7696     case "$ans" in
7697     none) cccdlflags=' ' ;;
7698     *) cccdlflags="$ans" ;;
7699     esac
7700
7701     cat << EOM
7702
7703 Some systems use ld to create libraries that can be dynamically loaded,
7704 while other systems (such as those using ELF) use $cc.
7705
7706 EOM
7707         case "$ld" in
7708         '')     $cat >try.c <<'EOM'
7709 /* Test for whether ELF binaries are produced */
7710 #include <fcntl.h>
7711 #include <stdlib.h>
7712 int main() {
7713         char b[4];
7714         int i = open("a.out",O_RDONLY);
7715         if(i == -1) 
7716                 exit(1); /* fail */
7717         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7718                 exit(0); /* succeed (yes, it's ELF) */
7719         else
7720                 exit(1); /* fail */
7721 }
7722 EOM
7723                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7724                         cat <<EOM
7725 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7726 EOM
7727                         dflt="$cc"
7728                 else
7729                         echo "I'll use ld to build dynamic libraries."
7730                         dflt='ld'
7731                 fi
7732                 rm -f try.c a.out
7733                 ;;
7734         *)      dflt="$ld"
7735                 ;;
7736         esac
7737
7738     rp="What command should be used to create dynamic libraries?"
7739     . ./myread
7740         ld="$ans"
7741
7742     cat << EOM
7743
7744 Some systems may require passing special flags to $ld to create a
7745 library that can be dynamically loaded.  If your ld flags include
7746 -L/other/path options to locate libraries outside your loader's normal
7747 search path, you may need to specify those -L options here as well.  To
7748 use no flags, say "none".
7749
7750 EOM
7751     case "$lddlflags" in
7752     '') case "$osname" in
7753                         beos) dflt='-nostart' ;;
7754                         hpux) dflt='-b';
7755                               case "$gccversion" in
7756                               '') dflt="$dflt +vnocompatwarnings" ;;
7757                               esac
7758                               ;;        
7759                         linux|irix*)    dflt='-shared' ;;
7760                         next)  dflt='none' ;;
7761                         solaris) dflt='-G' ;;
7762                         sunos) dflt='-assert nodefinitions' ;;
7763                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7764                 *)     dflt='none' ;;
7765                         esac
7766                         ;;
7767     *) dflt="$lddlflags" ;;
7768     esac
7769
7770         : Try to guess additional flags to pick up local libraries.
7771         : Be careful not to append to a plain 'none'
7772         case "$dflt" in
7773         none) dflt='' ;;
7774         esac
7775         for thisflag in $ldflags; do
7776                 case "$thisflag" in
7777                 -L*|-R*|-Wl,-R*)
7778                         case " $dflt " in
7779                         *" $thisflag "*) ;;
7780                         *) dflt="$dflt $thisflag" ;;
7781                         esac
7782                         ;;
7783                 esac
7784         done
7785
7786         case "$dflt" in
7787         ''|' ') dflt='none' ;;
7788         esac
7789
7790     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7791     . ./myread
7792     case "$ans" in
7793     none) lddlflags=' ' ;;
7794     *) lddlflags="$ans" ;;
7795     esac
7796
7797         cat <<EOM
7798
7799 Some systems may require passing special flags to $cc to indicate that
7800 the resulting executable will use dynamic linking.  To use no flags,
7801 say "none".
7802
7803 EOM
7804     case "$ccdlflags" in
7805     '') case "$osname" in
7806                 hpux)   dflt='-Wl,-E' ;;
7807                 linux)  dflt='-rdynamic' ;;
7808                 next)   dflt='none' ;;
7809                 sunos)  dflt='none' ;;
7810                 *)      dflt='none' ;;
7811             esac ;;
7812     ' ')  dflt='none' ;;
7813     *)  dflt="$ccdlflags" ;;
7814     esac
7815     rp="Any special flags to pass to $cc to use dynamic linking?"
7816     . ./myread
7817     case "$ans" in
7818     none) ccdlflags=' ' ;;
7819     *) ccdlflags="$ans" ;;
7820     esac
7821     ;;
7822 *)  usedl="$undef"
7823         ld='ld'
7824     dlsrc='dl_none.xs'
7825     lddlflags=''
7826     ccdlflags=''
7827     ;;
7828 esac
7829
7830 also=''
7831 case "$usedl" in
7832 $undef)
7833         # No dynamic loading being used, so don't bother even to prompt.
7834         useshrplib='false'
7835         ;;
7836 *)      case "$useshrplib" in
7837         '')     case "$osname" in
7838                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7839                         dflt=y
7840                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7841                         ;;
7842                 next*)
7843                         case "$osvers" in
7844                         4*)     dflt=y
7845                                 also='Building a shared libperl is needed for MAB support.'
7846                                 ;;
7847                         *)      dflt=n
7848                                 ;;
7849                         esac
7850                         ;;
7851                 *)      dflt=n
7852                         ;;
7853                 esac
7854                 ;;
7855         $define|true|[Yy]*)
7856                 dflt=y
7857                 ;;
7858         *)      dflt=n
7859                 ;;
7860         esac
7861         $cat << EOM
7862
7863 The perl executable is normally obtained by linking perlmain.c with
7864 libperl${_a}, any static extensions (usually just DynaLoader), and
7865 any other libraries needed on this system (such as -lm, etc.).  Since
7866 your system supports dynamic loading, it is probably possible to build
7867 a shared libperl.$so.  If you will have more than one executable linked
7868 to libperl.$so, this will significantly reduce the size of each
7869 executable, but it may have a noticeable affect on performance.  The
7870 default is probably sensible for your system.
7871 $also
7872
7873 EOM
7874         rp="Build a shared libperl.$so (y/n)"
7875         . ./myread
7876         case "$ans" in
7877         true|$define|[Yy]*)
7878                 useshrplib='true'  ;;
7879         *)      useshrplib='false' ;;
7880         esac
7881         ;;
7882 esac
7883
7884 case "$useshrplib" in
7885 true)
7886         case "$libperl" in
7887         '')
7888                 # Figure out a good name for libperl.so.  Since it gets stored in
7889                 # a version-specific architecture-dependent library, the version
7890                 # number isn't really that important, except for making cc/ld happy.
7891                 #
7892                 # A name such as libperl.so.3.1
7893                 majmin="libperl.$so.$patchlevel.$subversion"
7894                 # A name such as libperl.so.301
7895                 majonly=`echo $patchlevel $subversion |
7896                         $awk '{printf "%d%02d", $1, $2}'`
7897                 majonly=libperl.$so.$majonly
7898                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7899                 # rely on figuring it out from the naming of libc.
7900                 case "${osname}${osvers}" in
7901                 next4*)
7902                         dflt=libperl.5.$so
7903                         # XXX How handle the --version stuff for MAB?
7904                         ;;
7905                 linux*)  # ld won't link with a bare -lperl otherwise.
7906                         dflt=libperl.$so
7907                         ;;
7908                 cygwin*) # ld links against an importlib
7909                         dflt=libperl$lib_ext
7910                         ;;
7911                 *)      # Try to guess based on whether libc has major.minor.
7912                         case "$libc" in
7913                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7914                         *libc.$so.[0-9]*) dflt=$majonly ;;
7915                         *)      dflt=libperl.$so ;;
7916                         esac
7917                         ;;
7918                 esac
7919                 ;;
7920         *)      dflt=$libperl
7921                 ;;
7922         esac
7923         cat << EOM
7924
7925 I need to select a good name for the shared libperl.  If your system uses
7926 library names with major and minor numbers, then you might want something
7927 like $majmin.  Alternatively, if your system uses a single version
7928 number for shared libraries, then you might want to use $majonly.
7929 Or, your system might be quite happy with a simple libperl.$so.
7930
7931 Since the shared libperl will get installed into a version-specific
7932 architecture-dependent directory, the version number of the shared perl
7933 library probably isn't important, so the default should be o.k.
7934
7935 EOM
7936         rp='What name do you want to give to the shared libperl?'
7937         . ./myread
7938         libperl=$ans
7939         echo "Ok, I'll use $libperl"
7940         ;;
7941 *)
7942         libperl="libperl${_a}"
7943         ;;
7944 esac
7945
7946 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7947 case "$shrpdir" in
7948 '') ;;
7949 *)      $cat >&4 <<EOM
7950 WARNING:  Use of the shrpdir variable for the installation location of
7951 the shared $libperl is not supported.  It was never documented and
7952 will not work in this version.  Let me (perlbug@perl.org)
7953 know of any problems this may cause.
7954
7955 EOM
7956         case "$shrpdir" in
7957         "$archlibexp/CORE")
7958                 $cat >&4 <<EOM
7959 But your current setting of $shrpdir is
7960 the default anyway, so it's harmless.
7961 EOM
7962                 ;;
7963         *)
7964                 $cat >&4 <<EOM
7965 Further, your current attempted setting of $shrpdir
7966 conflicts with the value of $archlibexp/CORE
7967 that installperl will use.
7968 EOM
7969                 ;;
7970         esac
7971         ;;
7972 esac
7973
7974 # How will the perl executable find the installed shared $libperl?
7975 # Add $xxx to ccdlflags.
7976 # If we can't figure out a command-line option, use $shrpenv to
7977 # set env LD_RUN_PATH.  The main perl makefile uses this.
7978 shrpdir=$archlibexp/CORE
7979 xxx=''
7980 tmp_shrpenv=''
7981 if "$useshrplib"; then
7982     case "$osname" in 
7983         aix)
7984                 # We'll set it in Makefile.SH...
7985                 ;;
7986         solaris)
7987                 xxx="-R $shrpdir"
7988                 ;;
7989         freebsd|netbsd|openbsd)
7990                 xxx="-Wl,-R$shrpdir"
7991                 ;;
7992         bsdos|linux|irix*|dec_osf)
7993                 xxx="-Wl,-rpath,$shrpdir"
7994                 ;;
7995         next)
7996                 # next doesn't like the default...
7997                 ;;
7998         beos)
7999                 # beos doesn't like the default, either.
8000                 ;;
8001         hpux*)
8002                 # hpux doesn't like the default, either.
8003                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8004                 ;;
8005         *)
8006                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8007                 ;;
8008         esac
8009         case "$xxx" in
8010         '') ;;
8011         *)      
8012                 # Only add $xxx if it isn't already in ccdlflags.
8013                 case " $ccdlflags " in
8014                 *" $xxx "*)     ;;
8015                 *)      ccdlflags="$ccdlflags $xxx"
8016                         cat <<EOM >&4
8017
8018 Adding $xxx to the flags
8019 passed to $ld so that the perl executable will find the 
8020 installed shared $libperl.
8021
8022 EOM
8023                         ;;
8024                 esac
8025                 ;;
8026         esac
8027 fi
8028 # Fix ccdlflags in AIX for building external extensions.
8029 # (For building Perl itself bare -bE:perl.exp is needed,
8030 #  Makefile.SH takes care of this.)
8031 case "$osname" in
8032 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8033 esac
8034 # Respect a hint or command-line value.
8035 case "$shrpenv" in
8036 '') shrpenv="$tmp_shrpenv" ;;
8037 esac
8038 case "$ldlibpthname" in
8039 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8040 none)   ldlibpthname='' ;;
8041 esac
8042
8043 : determine where manual pages are on this system
8044 echo " "
8045 case "$sysman" in
8046 '') 
8047         syspath='/usr/share/man/man1 /usr/man/man1'
8048         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8049         syspath="$syspath /usr/man/u_man/man1"
8050         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8051         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8052         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8053         sysman=`./loc . /usr/man/man1 $syspath`
8054         ;;
8055 esac
8056 if $test -d "$sysman"; then
8057         echo "System manual is in $sysman." >&4
8058 else
8059         echo "Could not find manual pages in source form." >&4
8060 fi
8061
8062 : determine where manual pages go
8063 set man1dir man1dir none
8064 eval $prefixit
8065 $cat <<EOM
8066
8067 $spackage has manual pages available in source form.
8068 EOM
8069 case "$nroff" in
8070 nroff)
8071         echo "However, you don't have nroff, so they're probably useless to you."
8072         case "$man1dir" in
8073         '') man1dir="none";;
8074         esac;;
8075 esac
8076 echo "If you don't want the manual sources installed, answer 'none'."
8077 case "$man1dir" in
8078 ' ') dflt=none
8079         ;;
8080 '')
8081         lookpath="$prefixexp/share/man/man1"
8082         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8083         lookpath="$lookpath $prefixexp/man/p_man/man1"
8084         lookpath="$lookpath $prefixexp/man/u_man/man1"
8085         lookpath="$lookpath $prefixexp/man/man.1"
8086         case "$sysman" in
8087         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8088         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8089         esac
8090         set dflt
8091         eval $prefixup
8092         ;;
8093 *)  dflt="$man1dir"
8094         ;;
8095 esac
8096 echo " "
8097 fn=dn+~
8098 rp="Where do the main $spackage manual pages (source) go?"
8099 . ./getfile
8100 if $test "X$man1direxp" != "X$ansexp"; then
8101         installman1dir=''
8102 fi
8103 man1dir="$ans"
8104 man1direxp="$ansexp"
8105 case "$man1dir" in
8106 '')     man1dir=' '
8107         installman1dir='';;
8108 esac
8109
8110 : Change installation prefix, if necessary.
8111 if $test X"$prefix" != X"$installprefix"; then
8112         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8113 else
8114         installman1dir="$man1direxp"
8115 fi
8116
8117 : What suffix to use on installed man pages
8118
8119 case "$man1dir" in
8120 ' ')
8121         man1ext='0'
8122         ;;
8123 *)
8124         rp="What suffix should be used for the main $spackage man pages?"
8125         case "$man1ext" in
8126         '')     case "$man1dir" in
8127                 *1)  dflt=1 ;;
8128                 *1p) dflt=1p ;;
8129                 *1pm) dflt=1pm ;;
8130                 *l) dflt=l;;
8131                 *n) dflt=n;;
8132                 *o) dflt=o;;
8133                 *p) dflt=p;;
8134                 *C) dflt=C;;
8135                 *L) dflt=L;;
8136                 *L1) dflt=L1;;
8137                 *) dflt=1;;
8138                 esac
8139                 ;;
8140         *)      dflt="$man1ext";;
8141         esac
8142         . ./myread
8143         man1ext="$ans"
8144         ;;
8145 esac
8146
8147 : see if we can have long filenames
8148 echo " "
8149 first=123456789abcdef
8150 $rm -f $first
8151 if (echo hi >$first) 2>/dev/null; then
8152         if $test -f 123456789abcde; then
8153                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8154                 val="$undef"
8155         else
8156                 echo 'You can have filenames longer than 14 characters.'>&4
8157                 val="$define"
8158         fi
8159 else
8160         $cat <<'EOM'
8161 You can't have filenames longer than 14 chars.
8162 You can't even think about them!
8163 EOM
8164         val="$undef"
8165 fi 
8166 set d_flexfnam
8167 eval $setvar
8168 $rm -rf 123456789abcde*
8169
8170 : determine where library module manual pages go
8171 set man3dir man3dir none
8172 eval $prefixit
8173 $cat <<EOM
8174
8175 $spackage has manual pages for many of the library modules.
8176 EOM
8177
8178 case "$nroff" in
8179 nroff)
8180         $cat <<'EOM'
8181 However, you don't have nroff, so they're probably useless to you.
8182 EOM
8183         case "$man3dir" in
8184         '') man3dir="none";;
8185         esac;;
8186 esac
8187
8188 case "$d_flexfnam" in
8189 undef)
8190         $cat <<'EOM'
8191 However, your system can't handle the long file names like File::Basename.3. 
8192 EOM
8193         case "$man3dir" in
8194         '') man3dir="none";;
8195         esac;;
8196 esac
8197
8198 echo "If you don't want the manual sources installed, answer 'none'."
8199 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8200 case "$man3dir" in
8201 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8202         if $test -d "$privlib/man/man3"; then
8203                 cat <<EOM >&4
8204
8205 WARNING:  Previous versions of perl installed man3 pages into
8206 $privlib/man/man3.  This version will suggest a 
8207 new default of $dflt.  
8208 EOM
8209                 tdflt=$dflt
8210                 dflt='n'
8211                 rp='Do you wish to preserve the old behavior?(y/n)'
8212                 . ./myread
8213                 case "$ans" in
8214                 y*) dflt="$privlib/man/man3" ;;
8215                 *)  dflt=$tdflt ;;
8216                 esac
8217     fi
8218         ;;
8219 *)      dflt="$man3dir" ;;
8220 esac
8221 case "$dflt" in
8222 ' ') dflt=none ;;
8223 esac
8224 echo " "
8225 fn=dn+~
8226 rp="Where do the $package library man pages (source) go?"
8227 . ./getfile
8228 man3dir="$ans"
8229 man3direxp="$ansexp"
8230 case "$man3dir" in
8231 '')     man3dir=' '
8232         installman3dir='';;
8233 esac
8234
8235 : Change installation prefix, if necessary.
8236 if $test X"$prefix" != X"$installprefix"; then
8237         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8238 else
8239         installman3dir="$man3direxp"
8240 fi
8241
8242 : What suffix to use on installed man pages
8243 case "$man3dir" in
8244 ' ')
8245         man3ext='0'
8246         ;;
8247 *)
8248         rp="What suffix should be used for the $package library man pages?"
8249         case "$man3ext" in
8250         '')     case "$man3dir" in
8251                 *3)  dflt=3 ;;
8252                 *3p) dflt=3p ;;
8253                 *3pm) dflt=3pm ;;
8254                 *l) dflt=l;;
8255                 *n) dflt=n;;
8256                 *o) dflt=o;;
8257                 *p) dflt=p;;
8258                 *C) dflt=C;;
8259                 *L) dflt=L;;
8260                 *L3) dflt=L3;;
8261                 *) dflt=3;;
8262                 esac
8263                 ;;
8264         *)      dflt="$man3ext";;
8265         esac
8266         . ./myread
8267         man3ext="$ans"
8268         ;;
8269 esac
8270
8271 : see if we have to deal with yellow pages, now NIS.
8272 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8273         if $test -f /usr/etc/nibindd; then
8274                 echo " "
8275                 echo "I'm fairly confident you're on a NeXT."
8276                 echo " "
8277                 rp='Do you get the hosts file via NetInfo?'
8278                 dflt=y
8279                 case "$hostcat" in
8280                 nidump*) ;;
8281                 '') ;;
8282                 *) dflt=n;;
8283                 esac
8284                 . ./myread
8285                 case "$ans" in
8286                 y*) hostcat='nidump hosts .';;
8287                 *)      case "$hostcat" in
8288                         nidump*) hostcat='';;
8289                         esac
8290                         ;;
8291                 esac
8292         fi
8293         case "$hostcat" in
8294         nidump*) ;;
8295         *)
8296                 case "$hostcat" in
8297                 *ypcat*) dflt=y;;
8298                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8299                                 dflt=y
8300                         else
8301                                 dflt=n
8302                         fi;;
8303                 *) dflt=n;;
8304                 esac
8305                 echo " "
8306                 rp='Are you getting the hosts file via yellow pages?'
8307                 . ./myread
8308                 case "$ans" in
8309                 y*) hostcat='ypcat hosts';;
8310                 *) hostcat='cat /etc/hosts';;
8311                 esac
8312                 ;;
8313         esac
8314 fi
8315 case "$hostcat" in
8316 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8317 esac
8318 case "$groupcat" in
8319 '') test -f /etc/group && groupcat='cat /etc/group';;
8320 esac
8321 case "$passcat" in
8322 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8323 esac
8324
8325 : now get the host name
8326 echo " "
8327 echo "Figuring out host name..." >&4
8328 case "$myhostname" in
8329 '') cont=true
8330         echo 'Maybe "hostname" will work...'
8331         if tans=`sh -c hostname 2>&1` ; then
8332                 myhostname=$tans
8333                 phostname=hostname
8334                 cont=''
8335         fi
8336         ;;
8337 *) cont='';;
8338 esac
8339 if $test "$cont"; then
8340         if ./xenix; then
8341                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8342                 if tans=`cat /etc/systemid 2>&1` ; then
8343                         myhostname=$tans
8344                         phostname='cat /etc/systemid'
8345                         echo "Whadyaknow.  Xenix always was a bit strange..."
8346                         cont=''
8347                 fi
8348         elif $test -r /etc/systemid; then
8349                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8350         fi
8351 fi
8352 if $test "$cont"; then
8353         echo 'No, maybe "uuname -l" will work...'
8354         if tans=`sh -c 'uuname -l' 2>&1` ; then
8355                 myhostname=$tans
8356                 phostname='uuname -l'
8357         else
8358                 echo 'Strange.  Maybe "uname -n" will work...'
8359                 if tans=`sh -c 'uname -n' 2>&1` ; then
8360                         myhostname=$tans
8361                         phostname='uname -n'
8362                 else
8363                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8364                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8365                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8366                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8367                         else
8368                                 case "$myhostname" in
8369                                 '') echo "Does this machine have an identity crisis or something?"
8370                                         phostname='';;
8371                                 *)
8372                                         echo "Well, you said $myhostname before..."
8373                                         phostname='echo $myhostname';;
8374                                 esac
8375                         fi
8376                 fi
8377         fi
8378 fi
8379 case "$myhostname" in
8380 '') myhostname=noname ;;
8381 esac
8382 : you do not want to know about this
8383 set $myhostname
8384 myhostname=$1
8385
8386 : verify guess
8387 if $test "$myhostname" ; then
8388         dflt=y
8389         rp='Your host name appears to be "'$myhostname'".'" Right?"
8390         . ./myread
8391         case "$ans" in
8392         y*) ;;
8393         *) myhostname='';;
8394         esac
8395 fi
8396
8397 : bad guess or no guess
8398 while $test "X$myhostname" = X ; do
8399         dflt=''
8400         rp="Please type the (one word) name of your host:"
8401         . ./myread
8402         myhostname="$ans"
8403 done
8404
8405 : translate upper to lower if necessary
8406 case "$myhostname" in
8407 *[A-Z]*)
8408         echo "(Normalizing case in your host name)"
8409         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8410         ;;
8411 esac
8412
8413 case "$myhostname" in
8414 *.*)
8415         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8416         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8417         echo "(Trimming domain name from host name--host name is now $myhostname)"
8418         ;;
8419 *) case "$mydomain" in
8420         '')
8421                 {
8422                         test "X$hostcat" = "Xypcat hosts" &&
8423                         ypmatch "$myhostname" hosts 2>/dev/null |\
8424                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8425                         $test -s hosts
8426                 } || {
8427                         test "X$hostcat" != "X" &&
8428                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8429                                         /[       ]$myhostname[  . ]/p" > hosts
8430                 }
8431                 tmp_re="[       . ]"
8432                 if $test -f hosts; then
8433                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8434                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8435                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8436                                 hosts | $sort | $uniq | \
8437                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8438                         case `$echo X$dflt` in
8439                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8440                                 dflt=.
8441                                 ;;
8442                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8443                                 ;;
8444                         esac
8445                 else
8446                         echo "(I cannot locate a hosts database anywhere)"
8447                         dflt=.
8448                 fi
8449                 case "$dflt" in
8450                 .)
8451                         tans=`./loc resolv.conf X /etc /usr/etc`
8452                         if $test -f "$tans"; then
8453                                 echo "(Attempting domain name extraction from $tans)"
8454                                 dflt=.`$sed -n -e 's/   / /g' \
8455                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8456                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8457                                 case "$dflt" in
8458                                 .) dflt=.`$sed -n -e 's/        / /g' \
8459                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8460                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8461                                         ;;
8462                                 esac
8463                         fi
8464                         ;;
8465                 esac
8466                 case "$dflt" in
8467                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8468                         dflt=.`sh -c domainname 2>/dev/null`
8469                         case "$dflt" in
8470                         '') dflt='.';;
8471                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8472                         esac
8473                         ;;
8474                 esac
8475                 case "$dflt$osname" in
8476                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8477                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8478                         ;;
8479                 esac
8480                 case "$dflt" in
8481                 .) echo "(Lost all hope -- silly guess then)"
8482                         dflt='.nonet'
8483                         ;;
8484                 esac
8485                 $rm -f hosts
8486                 ;;
8487         *) dflt="$mydomain";;
8488         esac;;
8489 esac
8490 echo " "
8491 rp="What is your domain name?"
8492 . ./myread
8493 tans="$ans"
8494 case "$ans" in
8495 '') ;;
8496 .*) ;;
8497 *) tans=".$tans";;
8498 esac
8499 mydomain="$tans"
8500
8501 : translate upper to lower if necessary
8502 case "$mydomain" in
8503 *[A-Z]*)
8504         echo "(Normalizing case in your domain name)"
8505         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8506         ;;
8507 esac
8508
8509 : a little sanity check here
8510 case "$phostname" in
8511 '') ;;
8512 *)
8513         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8514         $myhostname$mydomain|$myhostname) ;;
8515         *)
8516                 case "$phostname" in
8517                 sed*)
8518                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8519                         ;;
8520                 *)
8521                         echo "(That doesn't agree with your $phostname command, by the way.)"
8522                         ;;
8523                 esac
8524         ;;
8525         esac
8526         ;;
8527 esac
8528
8529 $cat <<EOM
8530
8531 I need to get your e-mail address in Internet format if possible, i.e.
8532 something like user@host.domain. Please answer accurately since I have
8533 no easy means to double check it. The default value provided below
8534 is most probably close to reality but may not be valid from outside
8535 your organization...
8536
8537 EOM
8538 cont=x
8539 while test "$cont"; do
8540         case "$cf_email" in
8541         '') dflt="$cf_by@$myhostname$mydomain";;
8542         *) dflt="$cf_email";;
8543         esac
8544         rp='What is your e-mail address?'
8545         . ./myread
8546         cf_email="$ans"
8547         case "$cf_email" in
8548         *@*.*) cont='' ;;
8549         *)
8550                 rp='Address does not look like an Internet one.  Use it anyway?'
8551                 case "$fastread" in
8552                 yes) dflt=y ;;
8553                 *) dflt=n ;;
8554                 esac
8555                 . ./myread
8556                 case "$ans" in
8557                 y*) cont='' ;;
8558                 *) echo " " ;;
8559                 esac
8560                 ;;
8561         esac
8562 done
8563
8564 $cat <<EOM
8565
8566 If you or somebody else will be maintaining perl at your site, please
8567 fill in the correct e-mail address here so that they may be contacted
8568 if necessary. Currently, the "perlbug" program included with perl
8569 will send mail to this address in addition to perlbug@perl.org. You may
8570 enter "none" for no administrator.
8571
8572 EOM
8573 case "$perladmin" in
8574 '') dflt="$cf_email";;
8575 *) dflt="$perladmin";;
8576 esac
8577 rp='Perl administrator e-mail address'
8578 . ./myread
8579 perladmin="$ans"
8580
8581 : determine whether to only install version-specific parts.
8582 echo " "
8583 $cat <<EOM
8584 Do you want to install only the version-specific parts of the perl
8585 distribution?  Usually you do *not* want to do this.
8586 EOM
8587 case "$versiononly" in
8588 "$define"|[Yy]*|true) dflt='y' ;;
8589 *) dflt='n';
8590 esac
8591 rp="Do you want to install only the version-specific parts of perl?"
8592 . ./myread
8593 case "$ans" in
8594 [yY]*)  val="$define";;
8595 *)      val="$undef" ;;
8596 esac
8597 set versiononly
8598 eval $setvar
8599
8600 case "$versiononly" in
8601 "$define") inc_version_list=''
8602            inc_version_list_init=0
8603            ;;
8604 esac
8605
8606 : figure out how to guarantee perl startup
8607 case "$startperl" in
8608 '')
8609         case "$sharpbang" in
8610         *!)
8611                 $cat <<EOH
8612
8613 I can use the #! construct to start perl on your system. This will
8614 make startup of perl scripts faster, but may cause problems if you
8615 want to share those scripts and perl is not in a standard place
8616 ($binexp/perl) on all your platforms. The alternative is to force
8617 a shell by starting the script with a single ':' character.
8618
8619 EOH
8620                 case "$versiononly" in
8621                 "$define")      dflt="$binexp/perl$version";;  
8622                 *)              dflt="$binexp/perl";;
8623                 esac
8624                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8625                 . ./myread
8626                 case "$ans" in
8627                 none)   startperl=": # use perl";;
8628                 *)      startperl="#!$ans"
8629                         if $test 30 -lt `echo "$ans" | wc -c`; then
8630                                 $cat >&4 <<EOM
8631
8632 WARNING:  Some systems limit the #! command to 32 characters.
8633 If you experience difficulty running Perl scripts with #!, try
8634 installing Perl in a directory with a shorter pathname.
8635
8636 EOM
8637                         fi ;;
8638                 esac
8639                 ;;
8640         *) startperl=": # use perl"
8641                 ;;
8642         esac
8643         ;;
8644 esac
8645 echo "I'll use $startperl to start perl scripts."
8646
8647 : figure best path for perl in scripts
8648 case "$perlpath" in
8649 '')
8650         case "$versiononly" in
8651         "$define")      perlpath="$binexp/perl$version";;
8652         *)              perlpath="$binexp/perl";;
8653         esac
8654         case "$startperl" in
8655         *!*) ;;
8656         *)
8657                 $cat <<EOH
8658
8659 I will use the "eval 'exec'" idiom to start Perl on your system.
8660 I can use the full path of your Perl binary for this purpose, but
8661 doing so may cause problems if you want to share those scripts and
8662 Perl is not always in a standard place ($binexp/perl).
8663
8664 EOH
8665                 dflt="$binexp/perl"
8666                 rp="What path shall I use in \"eval 'exec'\"?"
8667                 . ./myread
8668                 perlpath="$ans"
8669                 ;;
8670         esac
8671         ;;
8672 esac
8673 case "$startperl" in
8674 *!*)    ;;
8675 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8676 esac
8677
8678 : determine where public executable scripts go
8679 set scriptdir scriptdir
8680 eval $prefixit
8681 case "$scriptdir" in
8682 '')
8683         dflt="$bin"
8684         : guess some guesses
8685         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8686         $test -d /usr/share/bin     && dflt=/usr/share/bin
8687         $test -d /usr/local/script  && dflt=/usr/local/script
8688         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8689         $test -d $prefixexp/script  && dflt=$prefixexp/script
8690         set dflt
8691         eval $prefixup
8692         ;;
8693 *)  dflt="$scriptdir"
8694         ;;
8695 esac
8696 $cat <<EOM
8697  
8698 Some installations have a separate directory just for executable scripts so
8699 that they can mount it across multiple architectures but keep the scripts in
8700 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8701 Or you might just lump your scripts in with all your other executables.
8702  
8703 EOM
8704 fn=d~
8705 rp='Where do you keep publicly executable scripts?'
8706 . ./getfile
8707 if $test "X$ansexp" != "X$scriptdirexp"; then
8708         installscript=''
8709 fi
8710 scriptdir="$ans"
8711 scriptdirexp="$ansexp"
8712 : Change installation prefix, if necessary.
8713 if $test X"$prefix" != X"$installprefix"; then
8714         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8715 else
8716         installscript="$scriptdirexp"
8717 fi
8718
8719 : determine where add-on public executables go
8720 case "$sitebin" in
8721 '')     dflt=$siteprefix/bin ;;
8722 *)      dflt=$sitebin ;;
8723 esac
8724 fn=d~
8725 rp='Pathname where the add-on public executables should be installed?'
8726 . ./getfile
8727 sitebin="$ans"
8728 sitebinexp="$ansexp"
8729 : Change installation prefix, if necessary.
8730 if $test X"$prefix" != X"$installprefix"; then
8731         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8732 else
8733         installsitebin="$sitebinexp"
8734 fi
8735
8736 : determine where add-on html pages go
8737 : There is no standard location, so try to copy the previously-selected 
8738 : directory structure for the core html pages.
8739 case "$sitehtml1" in
8740 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8741 *)      dflt=$sitehtml1 ;;
8742 esac
8743 case "$dflt" in
8744 ''|' ') dflt=none ;;
8745 esac
8746 fn=dn+~
8747 rp='Pathname where the site-specific html pages should be installed?'
8748 . ./getfile
8749 sitehtml1="$ans"
8750 sitehtml1exp="$ansexp"
8751 : Use ' ' for none so value is preserved next time through Configure
8752 $test X"$sitehtml1" = "X" && sitehtml1=' '
8753 : Change installation prefix, if necessary.
8754 if $test X"$prefix" != X"$installprefix"; then
8755         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8756 else
8757         installsitehtml1="$sitehtml1exp"
8758 fi
8759
8760 : determine where add-on library html pages go
8761 : There is no standard location, so try to copy the previously-selected
8762 : directory structure for the core html pages.
8763 case "$sitehtml3" in
8764 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8765 *)      dflt=$sitehtml3 ;;
8766 esac
8767 case "$dflt" in
8768 ''|' ') dflt=none ;;
8769 esac
8770 fn=dn+~
8771 rp='Pathname where the site-specific library html pages should be installed?'
8772 . ./getfile
8773 sitehtml3="$ans"
8774 sitehtml3exp="$ansexp"
8775 : Use ' ' for none so value is preserved next time through Configure
8776 $test X"$sitehtml3" = "X" && sitehtml3=' '
8777 : Change installation prefix, if necessary.
8778 if $test X"$prefix" != X"$installprefix"; then
8779         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8780 else
8781         installsitehtml3="$sitehtml3exp"
8782 fi
8783
8784 : determine where add-on manual pages go
8785 case "$siteman1" in
8786 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8787 *)      dflt=$siteman1 ;;
8788 esac
8789 case "$dflt" in
8790 ''|' ') dflt=none ;;
8791 esac
8792 fn=dn+~
8793 rp='Pathname where the site-specific manual pages should be installed?'
8794 . ./getfile
8795 siteman1="$ans"
8796 siteman1exp="$ansexp"
8797 : Use ' ' for none so value is preserved next time through Configure
8798 $test X"$siteman1" = "X" && siteman1=' '
8799 : Change installation prefix, if necessary.
8800 if $test X"$prefix" != X"$installprefix"; then
8801         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8802 else
8803         installsiteman1="$siteman1exp"
8804 fi
8805
8806 : determine where add-on library man pages go
8807 case "$siteman3" in
8808 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8809 *)      dflt=$siteman3 ;;
8810 esac
8811 case "$dflt" in
8812 ''|' ') dflt=none ;;
8813 esac
8814 fn=dn+~
8815 rp='Pathname where the site-specific library manual pages should be installed?'
8816 . ./getfile
8817 siteman3="$ans"
8818 siteman3exp="$ansexp"
8819 : Use ' ' for none so value is preserved next time through Configure
8820 $test X"$siteman3" = "X" && siteman3=' '
8821 : Change installation prefix, if necessary.
8822 if $test X"$prefix" != X"$installprefix"; then
8823         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8824 else
8825         installsiteman3="$siteman3exp"
8826 fi
8827
8828 : determine where add-on public executable scripts go
8829 case "$sitescript" in
8830 '')     dflt=$siteprefix/script
8831         $test -d $dflt || dflt=$sitebin ;;
8832 *)  dflt="$sitescript" ;;
8833 esac
8834 fn=d~+
8835 rp='Pathname where add-on public executable scripts should be installed?'
8836 . ./getfile
8837 sitescript="$ans"
8838 sitescriptexp="$ansexp"
8839 : Change installation prefix, if necessary.
8840 if $test X"$prefix" != X"$installprefix"; then
8841         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8842 else
8843         installsitescript="$sitescriptexp"
8844 fi
8845
8846 : define an is-a-typedef? function
8847 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8848 case "$inclist" in
8849 "") inclist="sys/types.h";;
8850 esac;
8851 eval "varval=\$$var";
8852 case "$varval" in
8853 "")
8854         $rm -f temp.c;
8855         for inc in $inclist; do
8856                 echo "#include <$inc>" >>temp.c;
8857         done;
8858         echo "#ifdef $type" >> temp.c;
8859         echo "printf(\"We have $type\");" >> temp.c;
8860         echo "#endif" >> temp.c;
8861         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8862         if $contains $type temp.E >/dev/null 2>&1; then
8863                 eval "$var=\$type";
8864         else
8865                 eval "$var=\$def";
8866         fi;
8867         $rm -f temp.?;;
8868 *) eval "$var=\$varval";;
8869 esac'
8870
8871 : define an is-a-typedef? function that prompts if the type is not available.
8872 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8873 case "$inclist" in
8874 "") inclist="sys/types.h";;
8875 esac;
8876 eval "varval=\$$var";
8877 case "$varval" in
8878 "")
8879         $rm -f temp.c;
8880         for inc in $inclist; do
8881                 echo "#include <$inc>" >>temp.c;
8882         done;
8883         echo "#ifdef $type" >> temp.c;
8884         echo "printf(\"We have $type\");" >> temp.c;
8885         echo "#endif" >> temp.c;
8886         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8887         echo " " ;
8888         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8889         if $contains $type temp.E >/dev/null 2>&1; then
8890                 echo "$type found." >&4;
8891                 eval "$var=\$type";
8892         else
8893                 echo "$type NOT found." >&4;
8894                 dflt="$def";
8895                 . ./myread ;
8896                 eval "$var=\$ans";
8897         fi;
8898         $rm -f temp.?;;
8899 *) eval "$var=\$varval";;
8900 esac'
8901
8902 : see what type lseek is declared as in the kernel
8903 rp="What is the type used for lseek's offset on this system?"
8904 set off_t lseektype long stdio.h sys/types.h
8905 eval $typedef_ask
8906
8907 echo " "
8908 echo "Checking to see how big your file offsets are..." >&4
8909 $cat >try.c <<EOCP
8910 #include <sys/types.h>
8911 #include <stdio.h>
8912 int main()
8913 {
8914     printf("%d\n", (int)sizeof($lseektype));
8915     return(0); 
8916 }
8917 EOCP
8918 set try
8919 if eval $compile_ok; then
8920         lseeksize=`$run ./try`
8921         echo "Your file offsets are $lseeksize bytes long."
8922 else
8923         dflt=$longsize
8924         echo " "
8925         echo "(I can't seem to compile the test program.  Guessing...)"
8926         rp="What is the size of your file offsets (in bytes)?"
8927         . ./myread
8928         lseeksize="$ans"
8929 fi
8930 $rm -f try.c try
8931
8932 : see what type file positions are declared as in the library
8933 rp="What is the type for file position used by fsetpos()?"
8934 set fpos_t fpostype long stdio.h sys/types.h
8935 eval $typedef_ask
8936
8937 echo " "
8938 case "$fpostype" in
8939 *_t) zzz="$fpostype"    ;;
8940 *)   zzz="fpos_t"       ;;
8941 esac
8942 echo "Checking the size of $zzz..." >&4 
8943 cat > try.c <<EOCP
8944 #include <sys/types.h>
8945 #include <stdio.h>
8946 int main() {
8947     printf("%d\n", (int)sizeof($fpostype));
8948     exit(0);
8949 }
8950 EOCP
8951 set try
8952 if eval $compile_ok; then
8953         yyy=`$run ./try`
8954         case "$yyy" in
8955         '')     fpossize=4
8956                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8957                 ;;
8958         *)      fpossize=$yyy
8959                 echo "Your $zzz is $fpossize bytes long."
8960                 ;;
8961         esac
8962 else
8963         dflt="$longsize"
8964         echo " " >&4
8965         echo "(I can't compile the test program.  Guessing...)" >&4
8966         rp="What is the size of your file positions (in bytes)?"
8967         . ./myread
8968         fpossize="$ans"
8969 fi
8970
8971
8972
8973 # Backward compatibility (uselfs is deprecated).
8974 case "$uselfs" in
8975 "$define"|true|[yY]*)
8976         cat <<EOM >&4
8977
8978 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8979 EOM
8980         uselargefiles="$define"
8981         ;;
8982 esac                          
8983
8984 case "$lseeksize:$fpossize" in
8985 8:8) cat <<EOM
8986
8987 You can have files larger than 2 gigabytes.
8988 EOM
8989    val="$define" ;;
8990 *)    case "$uselargefiles" in
8991    "$undef"|false|[nN]*) dflt='n' ;;
8992    *)   dflt='y' ;;
8993    esac
8994    cat <<EOM
8995
8996 Perl can be built to understand large files (files larger than 2 gigabytes)
8997 on some systems.  To do so, Configure can be run with -Duselargefiles.
8998
8999 If this doesn't make any sense to you, just accept the default '$dflt'.
9000 EOM
9001    rp='Try to understand large files, if available?'
9002    . ./myread
9003    case "$ans" in
9004    y|Y)         val="$define" ;;
9005    *)           val="$undef"  ;;
9006    esac
9007    ;;
9008 esac
9009 set uselargefiles
9010 eval $setvar
9011 case "$uselargefiles" in
9012 "$define")
9013 : Look for a hint-file generated 'call-back-unit'.  If the
9014 : user has specified that a large files perl is to be built,
9015 : we may need to set or change some other defaults.
9016         if $test -f uselargefiles.cbu; then
9017                 echo "Your platform has some specific hints for large file builds, using them..."
9018                 . ./uselargefiles.cbu
9019                 echo " "
9020                 echo "Rechecking to see how big your file offsets are..." >&4
9021                 $cat >try.c <<EOCP
9022 #include <sys/types.h>
9023 #include <stdio.h>
9024 int main()
9025 {
9026     printf("%d\n", (int)sizeof($lseektype));
9027     return(0); 
9028 }
9029 EOCP
9030                 set try
9031                 if eval $compile_ok; then
9032                         lseeksize=`$run ./try`
9033                         $echo "Your file offsets are now $lseeksize bytes long."
9034                 else
9035                         dflt="$lseeksize"
9036                         echo " "
9037                         echo "(I can't seem to compile the test program.  Guessing...)"
9038                         rp="What is the size of your file offsets (in bytes)?"
9039                         . ./myread
9040                         lseeksize="$ans"
9041                 fi
9042                 case "$fpostype" in
9043                 *_t) zzz="$fpostype"    ;;
9044                 *)   zzz="fpos_t"       ;;
9045                 esac
9046                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9047                 $cat > try.c <<EOCP
9048 #include <sys/types.h>
9049 #include <stdio.h>
9050 int main() {
9051     printf("%d\n", (int)sizeof($fpostype));
9052     exit(0);
9053 }
9054 EOCP
9055                 set try
9056                 if eval $compile_ok; then
9057                         yyy=`$run ./try`
9058                         dflt="$lseeksize"
9059                         case "$yyy" in
9060                         '')     echo " "
9061                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9062                                 ;;
9063                         *)      fpossize=$yyy
9064                                 echo " $fpossize bytes." >&4
9065                                 ;;
9066                         esac
9067                 else
9068                         dflt="$fpossize"
9069                         echo " "
9070                         echo "(I can't compile the test program.  Guessing...)" >&4
9071                         rp="What is the size of your file positions (in bytes)?"
9072                         . ./myread
9073                         fpossize="$ans"
9074                 fi
9075                 $rm -f try.c try
9076         fi
9077         ;;
9078 esac
9079
9080 case "$vendorprefix" in
9081 '')     d_vendorbin="$undef"
9082         vendorbin=''
9083         vendorbinexp=''
9084         ;;
9085 *)      d_vendorbin="$define"
9086         : determine where vendor-supplied executables go.
9087         case "$vendorbin" in
9088         '') dflt=$vendorprefix/bin ;;
9089         *)      dflt="$vendorbin" ;;
9090         esac
9091         fn=d~+
9092         rp='Pathname for the vendor-supplied executables directory?'
9093         . ./getfile
9094         vendorbin="$ans"
9095         vendorbinexp="$ansexp"
9096         ;;
9097 esac
9098 : Change installation prefix, if necessary.
9099 if $test X"$prefix" != X"$installprefix"; then
9100         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9101 else
9102         installvendorbin="$vendorbinexp"
9103 fi
9104
9105 case "$vendorprefix" in
9106 '')     vendorhtml1=''
9107         vendorhtml1exp=''
9108         ;;
9109 *)      : determine where vendor-supplied html pages go.
9110         : There is no standard location, so try to copy the previously-selected
9111         : directory structure for the core html pages.
9112         : XXX Better default suggestions would be welcome.
9113         case "$vendorhtml1" in
9114         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9115         *)      dflt=$vendorhtml1 ;;
9116         esac
9117         case "$dflt" in
9118         ''|' ') dflt=none ;;
9119         esac
9120         fn=dn+~
9121         rp='Pathname for the vendor-supplied html pages?'
9122         . ./getfile
9123         vendorhtml1="$ans"
9124         vendorhtml1exp="$ansexp"
9125         ;;
9126 esac
9127 : Use ' ' for none so value is preserved next time through Configure
9128 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
9129 : Change installation prefix, if necessary.
9130 if $test X"$prefix" != X"$installprefix"; then
9131         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
9132 else
9133         installvendorhtml1="$vendorhtml1exp"
9134 fi
9135
9136 case "$vendorprefix" in
9137 '')     vendorhtml3=''
9138         vendorhtml3exp=''
9139         ;;
9140 *)      : determine where vendor-supplied module html pages go.
9141         : There is no standard location, so try to copy the previously-selected
9142         : directory structure for the core html pages.
9143         : XXX Better default suggestions would be welcome.
9144         case "$vendorhtml3" in
9145         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9146         *)      dflt=$vendorhtml3 ;;
9147         esac
9148         case "$dflt" in
9149         ''|' ') dflt=none ;;
9150         esac
9151         fn=dn+~
9152         rp='Pathname for the vendor-supplied html pages?'
9153         . ./getfile
9154         vendorhtml3="$ans"
9155         vendorhtml3exp="$ansexp"
9156         ;;
9157 esac
9158 : Use ' ' for none so value is preserved next time through Configure
9159 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
9160 : Change installation prefix, if necessary.
9161 if $test X"$prefix" != X"$installprefix"; then
9162         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9163 else
9164         installvendorhtml3="$vendorhtml3exp"
9165 fi
9166
9167 case "$vendorprefix" in
9168 '')     vendorman1=''
9169         vendorman1exp=''
9170         ;;
9171 *)      : determine where vendor-supplied manual pages go.
9172         case "$vendorman1" in
9173         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9174         *)      dflt=$vendorman1 ;;
9175         esac
9176         case "$dflt" in
9177         ''|' ') dflt=none ;;
9178         esac
9179         fn=nd~+
9180         rp='Pathname for the vendor-supplied manual section 1 pages?'
9181         . ./getfile
9182         vendorman1="$ans"
9183         vendorman1exp="$ansexp"
9184         ;;
9185 esac
9186 : Use ' ' for none so value is preserved next time through Configure
9187 $test X"$vendorman1" = "X" && vendorman1=' '
9188 : Change installation prefix, if necessary.
9189 if $test X"$prefix" != X"$installprefix"; then
9190         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9191 else
9192         installvendorman1="$vendorman1exp"
9193 fi
9194
9195 case "$vendorprefix" in
9196 '')     vendorman3=''
9197         vendorman3exp=''
9198         ;;
9199 *)      : determine where vendor-supplied module manual pages go.
9200         case "$vendorman3" in
9201         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9202         *)      dflt=$vendorman3 ;;
9203         esac
9204         case "$dflt" in
9205         ''|' ') dflt=none ;;
9206         esac
9207         fn=nd~+
9208         rp='Pathname for the vendor-supplied manual section 3 pages?'
9209         . ./getfile
9210         vendorman3="$ans"
9211         vendorman3exp="$ansexp"
9212         ;;
9213 esac
9214 : Use ' ' for none so value is preserved next time through Configure
9215 $test X"$vendorman3" = "X" && vendorman3=' '
9216 : Change installation prefix, if necessary.
9217 if $test X"$prefix" != X"$installprefix"; then
9218         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9219 else
9220         installvendorman3="$vendorman3exp"
9221 fi
9222
9223 case "$vendorprefix" in
9224 '')     d_vendorscript="$undef"
9225         vendorscript=''
9226         vendorscriptexp=''
9227         ;;
9228 *)      d_vendorscript="$define"
9229         : determine where vendor-supplied scripts go.
9230         case "$vendorscript" in
9231         '')     dflt=$vendorprefix/script
9232                 $test -d $dflt || dflt=$vendorbin ;;
9233         *)  dflt="$vendorscript" ;;
9234         esac
9235         $cat <<EOM
9236
9237 The installation process will create a directory for 
9238 vendor-supplied scripts.
9239
9240 EOM
9241         fn=d~+
9242         rp='Pathname for the vendor-supplied scripts directory?'
9243         . ./getfile
9244         vendorscript="$ans"
9245         vendorscriptexp="$ansexp"
9246         ;;
9247 esac
9248 : Change installation prefix, if necessary.
9249 if $test X"$prefix" != X"$installprefix"; then
9250         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9251 else
9252         installvendorscript="$vendorscriptexp"
9253 fi
9254
9255 : see if qgcvt exists
9256 set qgcvt d_qgcvt
9257 eval $inlibc
9258
9259 : Check how to convert floats to strings.
9260
9261 if test "X$d_Gconvert" = X; then
9262
9263 echo " "
9264 echo "Checking for an efficient way to convert floats to strings."
9265 echo " " > try.c
9266 case "$uselongdouble" in
9267 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9268 esac
9269 case "$d_longdbl" in
9270 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9271 esac
9272 case "$d_PRIgldbl" in
9273 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9274 esac
9275 $cat >>try.c <<EOP
9276 #ifdef TRY_gconvert
9277 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9278 char *myname = "gconvert";
9279 #endif
9280 #ifdef TRY_gcvt
9281 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9282 char *myname = "gcvt";
9283 #endif
9284 #ifdef TRY_qgcvt
9285 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9286 char *myname = "qgcvt";
9287 #define DOUBLETYPE long double
9288 #endif
9289 #ifdef TRY_sprintf
9290 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9291 #ifdef HAS_PRIgldbl
9292 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9293 #else
9294 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9295 #endif
9296 #else
9297 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9298 #endif
9299 char *myname = "sprintf";
9300 #endif
9301
9302 #ifndef DOUBLETYPE
9303 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9304 #define DOUBLETYPE long double
9305 #else
9306 #define DOUBLETYPE double
9307 #endif
9308 #endif
9309
9310 #include <stdio.h>
9311
9312 #define I_STDLIB $i_stdlib
9313 #ifdef I_STDLIB
9314 #include <stdlib.h>
9315 #endif
9316
9317 int
9318 checkit(expect, got)
9319 char *expect;
9320 char *got;
9321 {
9322     if (strcmp(expect, got)) {
9323                 printf("%s oddity:  Expected %s, got %s\n",
9324                         myname, expect, got);
9325                 exit(1);
9326         }
9327 }
9328
9329 int main()
9330
9331         char buf[64]; 
9332         buf[63] = '\0';
9333
9334         /* This must be 1st test on (which?) platform */
9335         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9336         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9337         checkit("0.1", buf);
9338
9339         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9340         checkit("0.01", buf);
9341
9342         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9343         checkit("0.001", buf);
9344
9345         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9346         checkit("0.0001", buf);
9347
9348         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9349         if (strlen(buf) > 5)
9350             checkit("9e-005", buf); /* for Microsoft ?? */
9351         else
9352             checkit("9e-05", buf);
9353
9354         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9355         checkit("1", buf);
9356
9357         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9358         checkit("1.1", buf);
9359
9360         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9361         checkit("1.01", buf);
9362
9363         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9364         checkit("1.001", buf);
9365
9366         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9367         checkit("1.0001", buf);
9368
9369         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9370         checkit("1.00001", buf);
9371
9372         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9373         checkit("1.000001", buf);
9374
9375         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9376         checkit("0", buf);
9377
9378         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9379         checkit("-1", buf);
9380
9381         /* Some Linux gcvt's give 1.e+5 here. */
9382         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9383         checkit("100000", buf);
9384         
9385         /* Some Linux gcvt's give -1.e+5 here. */
9386         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9387         checkit("-100000", buf);
9388
9389         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9390         checkit("123.456", buf);
9391
9392         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9393         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9394         /* 34 should be enough to scare even long double
9395          * places into using the e notation. */
9396         if (strlen(buf) > 5)
9397             checkit("1e+034", buf); /* for Microsoft */
9398         else
9399             checkit("1e+34", buf);
9400
9401         /* For Perl, if you add additional tests here, also add them to
9402          * t/base/num.t for benefit of platforms not using Configure or
9403          * overriding d_Gconvert */
9404
9405         exit(0);
9406 }
9407 EOP
9408 : first add preferred functions to our list
9409 xxx_list=""
9410 for xxx_convert in $gconvert_preference; do
9411     case $xxx_convert in
9412     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9413     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9414     esac 
9415 done
9416 : then add any others
9417 for xxx_convert in gconvert gcvt sprintf; do
9418     case "$xxx_list" in
9419     *$xxx_convert*) ;;
9420     *) xxx_list="$xxx_list $xxx_convert" ;;
9421     esac 
9422 done
9423
9424 case "$d_longdbl$uselongdouble" in
9425 "$define$define")
9426     : again, add prefered functions to our list first
9427     xxx_ld_list=""
9428     for xxx_convert in $gconvert_ld_preference; do
9429         case $xxx_convert in
9430         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9431         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9432         esac
9433     done
9434     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9435     for xxx_convert in qgcvt sprintf $xxx_list; do
9436         case "$xxx_ld_list" in
9437         $xxx_convert*|*" $xxx_convert"*) ;;
9438         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9439         esac
9440     done
9441     : if sprintf cannot do long doubles, move it to the end
9442     if test "$d_PRIgldbl" != "$define"; then
9443         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9444     fi
9445     : if no qgcvt, remove it
9446     if test "$d_qgcvt" != "$define"; then
9447         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9448     fi
9449     : use the ld_list
9450     xxx_list="$xxx_ld_list"
9451     ;;
9452 esac
9453
9454 for xxx_convert in $xxx_list; do
9455         echo "Trying $xxx_convert..."
9456         $rm -f try try$_o
9457         set try -DTRY_$xxx_convert
9458         if eval $compile; then
9459                 echo "$xxx_convert() found." >&4
9460                 if $run ./try; then
9461                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9462                         break;
9463                 else
9464                         echo "...But $xxx_convert didn't work as I expected."
9465                         xxx_convert=''
9466                 fi
9467         else
9468                 echo "$xxx_convert NOT found." >&4
9469         fi
9470 done
9471
9472 if test X$xxx_convert = X; then
9473     echo "*** WHOA THERE!!! ***" >&4
9474     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9475     xxx_convert=sprintf
9476 fi
9477
9478 case "$xxx_convert" in
9479 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9480 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9481 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9482 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9483    "$define$define$define")
9484       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9485    "$define$define$undef")
9486       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9487    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9488    esac
9489    ;;  
9490 esac
9491
9492 fi
9493
9494 : see if _fwalk exists
9495 set fwalk d__fwalk
9496 eval $inlibc
9497
9498 : Initialize h_fcntl
9499 h_fcntl=false
9500
9501 : Initialize h_sysfile
9502 h_sysfile=false
9503
9504 : access call always available on UNIX
9505 set access d_access
9506 eval $inlibc
9507
9508 : locate the flags for 'access()'
9509 case "$d_access" in
9510 "$define")
9511         echo " "
9512         $cat >access.c <<'EOCP'
9513 #include <sys/types.h>
9514 #ifdef I_FCNTL
9515 #include <fcntl.h>
9516 #endif
9517 #ifdef I_SYS_FILE
9518 #include <sys/file.h>
9519 #endif
9520 #ifdef I_UNISTD
9521 #include <unistd.h>
9522 #endif
9523 int main() {
9524         exit(R_OK);
9525 }
9526 EOCP
9527         : check sys/file.h first, no particular reason here
9528         if $test `./findhdr sys/file.h` && \
9529                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9530                 h_sysfile=true;
9531                 echo "<sys/file.h> defines the *_OK access constants." >&4
9532         elif $test `./findhdr fcntl.h` && \
9533                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9534                 h_fcntl=true;
9535                 echo "<fcntl.h> defines the *_OK access constants." >&4
9536         elif $test `./findhdr unistd.h` && \
9537                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9538                 echo "<unistd.h> defines the *_OK access constants." >&4
9539         else
9540                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9541         fi
9542         ;;
9543 esac
9544 $rm -f access*
9545
9546 : see if accessx exists
9547 set accessx d_accessx
9548 eval $inlibc
9549
9550 : see if alarm exists
9551 set alarm d_alarm
9552 eval $inlibc
9553
9554 : see if POSIX threads are available
9555 set pthread.h i_pthread
9556 eval $inhdr
9557
9558 : define a fucntion to check prototypes
9559 $cat > protochk <<EOSH
9560 $startsh
9561 cc="$cc"
9562 optimize="$optimize"
9563 ccflags="$ccflags"
9564 prototype="$prototype"
9565 define="$define"
9566 rm=$rm
9567 usethreads=$usethreads
9568 i_pthread=$i_pthread
9569 pthread_h_first=$pthread_h_first
9570 EOSH
9571
9572 $cat >> protochk <<'EOSH'
9573
9574 $rm -f try.c
9575 foo="$1"
9576 shift
9577 while test $# -ge 2; do
9578         case "$1" in
9579                 $define) echo "#include <$2>" >> try.c ;;
9580                 literal) echo "$2" >> try.c ;;
9581         esac
9582     # Extra magic for the benefit of systems that need pthread.h
9583     # to be included early to correctly detect threadsafe functions.
9584     # Such functions must guarantee themselves, though, that the usethreads
9585     # and i_pthread have been defined, before calling protochk.
9586     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9587         echo "#include <pthread.h>" >> try.c
9588         pthread_h_done=yes
9589     fi
9590     shift 2
9591 done
9592 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9593 cat >> try.c <<'EOCP'
9594 #ifdef CAN_PROTOTYPE
9595 #define _(args) args
9596 #else
9597 #define _(args) ()
9598 #endif
9599 EOCP
9600 echo "$foo" >> try.c
9601 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9602 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9603 status=$?
9604 $rm -f try.[co]
9605 exit $status
9606 EOSH
9607 chmod +x protochk
9608 $eunicefix protochk
9609
9610 : see if sys/types.h has to be included
9611 set sys/types.h i_systypes
9612 eval $inhdr
9613
9614 : see if sys/select.h has to be included
9615 set sys/select.h i_sysselct
9616 eval $inhdr
9617
9618 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9619 while $test $# -ge 2; do
9620         case "$1" in
9621         $define) echo "#include <$2>";;
9622         esac ;
9623     shift 2;
9624 done > try.c;
9625 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9626 set try;
9627 if eval $compile; then
9628         val="$define";
9629 else
9630         val="$undef";
9631 fi;
9632 set $varname;
9633 eval $setvar;
9634 $rm -f try.c try.o'
9635
9636 : see if we should include time.h, sys/time.h, or both
9637 echo " "
9638 if test "X$timeincl" = X; then
9639         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9640         $echo $n "I'm now running the test program...$c"
9641         $cat >try.c <<'EOCP'
9642 #include <sys/types.h>
9643 #ifdef I_TIME
9644 #include <time.h>
9645 #endif
9646 #ifdef I_SYSTIME
9647 #ifdef SYSTIMEKERNEL
9648 #define KERNEL
9649 #endif
9650 #include <sys/time.h>
9651 #endif
9652 #ifdef I_SYSSELECT
9653 #include <sys/select.h>
9654 #endif
9655 int main()
9656 {
9657         struct tm foo;
9658 #ifdef S_TIMEVAL
9659         struct timeval bar;
9660 #endif
9661 #ifdef S_TIMEZONE
9662         struct timezone tzp;
9663 #endif
9664         if (foo.tm_sec == foo.tm_sec)
9665                 exit(0);
9666 #ifdef S_TIMEVAL
9667         if (bar.tv_sec == bar.tv_sec)
9668                 exit(0);
9669 #endif
9670         exit(1);
9671 }
9672 EOCP
9673         flags=''
9674         for s_timezone in '-DS_TIMEZONE' ''; do
9675         sysselect=''
9676         for s_timeval in '-DS_TIMEVAL' ''; do
9677         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9678         for i_time in '' '-DI_TIME'; do
9679         for i_systime in '-DI_SYSTIME' ''; do
9680                 case "$flags" in
9681                 '') $echo $n ".$c"
9682                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9683                         if eval $compile; then
9684                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9685                                 shift
9686                                 flags="$*"
9687                                 echo " "
9688                                 $echo $n "Succeeded with $flags$c"
9689                         fi
9690                         ;;
9691                 esac
9692         done
9693         done
9694         done
9695         done
9696         done
9697         timeincl=''
9698         echo " "
9699         case "$flags" in
9700         *SYSTIMEKERNEL*) i_systimek="$define"
9701                 timeincl=`./findhdr sys/time.h`
9702                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9703         *) i_systimek="$undef";;
9704         esac
9705         case "$flags" in
9706         *I_TIME*) i_time="$define"
9707                 timeincl=`./findhdr time.h`" $timeincl"
9708                 echo "We'll include <time.h>." >&4;;
9709         *) i_time="$undef";;
9710         esac
9711         case "$flags" in
9712         *I_SYSTIME*) i_systime="$define"
9713                 timeincl=`./findhdr sys/time.h`" $timeincl"
9714                 echo "We'll include <sys/time.h>." >&4;;
9715         *) i_systime="$undef";;
9716         esac
9717         $rm -f try.c try
9718 fi
9719 : see if struct tm knows about tm_zone
9720 case "$i_systime$i_time" in
9721 *$define*) 
9722         echo " "
9723         echo "Checking to see if your struct tm has tm_zone field..." >&4
9724         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9725         eval $hasfield
9726         ;;
9727 *)      val="$undef"
9728         set d_tm_tm_zone
9729         eval $setvar
9730         ;;
9731 esac
9732 case "$d_tm_tm_zone" in
9733 "$define")      echo "Yes, it does."   ;;
9734 *)              echo "No, it doesn't." ;;
9735 esac
9736 : see if struct tm knows about tm_gmtoff
9737 case "$i_systime$i_time" in
9738 *$define*) 
9739         echo " "
9740         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9741         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9742         eval $hasfield
9743         ;;
9744 *)      val="$undef"
9745         set d_tm_tm_gmtoff
9746         eval $setvar
9747         ;;
9748 esac
9749 case "$d_tm_tm_gmtoff" in
9750 "$define")      echo "Yes, it does."   ;;
9751 *)              echo "No, it doesn't." ;;
9752 esac
9753
9754 : see if asctime_r exists
9755 set asctime_r d_asctime_r
9756 eval $inlibc
9757 case "$d_asctime_r" in
9758 "$define")
9759         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9760         case "$d_asctime_r_proto:$usethreads" in
9761         ":define")      d_asctime_r_proto=define
9762                 set d_asctime_r_proto asctime_r $hdrs
9763                 eval $hasproto ;;
9764         *)      ;;
9765         esac
9766         case "$d_asctime_r_proto" in
9767         define)
9768         case "$asctime_r_proto" in
9769         ''|0) try='char* asctime_r(const struct tm*, char*);'
9770         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9771         esac
9772         case "$asctime_r_proto" in
9773         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9774         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9775         esac
9776         case "$asctime_r_proto" in
9777         ''|0) try='int asctime_r(const struct tm*, char*);'
9778         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9779         esac
9780         case "$asctime_r_proto" in
9781         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9782         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9783         esac
9784         case "$asctime_r_proto" in
9785         ''|0)   d_asctime_r=undef
9786                 asctime_r_proto=0
9787                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9788         * )     case "$asctime_r_proto" in
9789                 REENTRANT_PROTO*) ;;
9790                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9791                 esac
9792                 echo "Prototype: $try" ;;
9793         esac
9794         ;;
9795         *)      case "$usethreads" in
9796                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9797                 esac
9798                 d_asctime_r=undef
9799                 asctime_r_proto=0
9800                 ;;
9801         esac
9802         ;;
9803 *)      asctime_r_proto=0
9804         ;;
9805 esac
9806
9807 : see if atolf exists
9808 set atolf d_atolf
9809 eval $inlibc
9810
9811 : see if atoll exists
9812 set atoll d_atoll
9813 eval $inlibc
9814
9815 : Look for GNU-cc style attribute checking
9816 echo " "
9817 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9818 $cat >attrib.c <<'EOCP'
9819 #include <stdio.h>
9820 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9821 EOCP
9822 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9823         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9824                 echo "Your C compiler doesn't fully support __attribute__."
9825                 val="$undef"
9826         else
9827                 echo "Your C compiler supports __attribute__."
9828                 val="$define"
9829         fi
9830 else
9831         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9832         val="$undef"
9833 fi
9834 set d_attribut
9835 eval $setvar
9836 $rm -f attrib*
9837
9838 : see if bcmp exists
9839 set bcmp d_bcmp
9840 eval $inlibc
9841
9842 : see if bcopy exists
9843 set bcopy d_bcopy
9844 eval $inlibc
9845
9846 : see if this is a unistd.h system
9847 set unistd.h i_unistd
9848 eval $inhdr
9849
9850 : see if getpgrp exists
9851 set getpgrp d_getpgrp
9852 eval $inlibc
9853
9854 case "$d_getpgrp" in
9855 "$define")
9856         echo " "
9857         echo "Checking to see which flavor of getpgrp is in use..."
9858         $cat >try.c <<EOP
9859 #$i_unistd I_UNISTD
9860 #include <sys/types.h>
9861 #ifdef I_UNISTD
9862 #  include <unistd.h>
9863 #endif
9864 int main()
9865 {
9866         if (getuid() == 0) {
9867                 printf("(I see you are running Configure as super-user...)\n");
9868                 setuid(1);
9869         }
9870 #ifdef TRY_BSD_PGRP
9871         if (getpgrp(1) == 0)
9872                 exit(0);
9873 #else
9874         if (getpgrp() > 0)
9875                 exit(0);
9876 #endif
9877         exit(1);
9878 }
9879 EOP
9880         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9881                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9882                 val="$define"
9883         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9884                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9885                 val="$undef"
9886         else
9887                 echo "I can't seem to compile and run the test program."
9888                 if ./usg; then
9889                         xxx="a USG one, i.e. you use getpgrp()."
9890                 else
9891                         # SVR4 systems can appear rather BSD-ish.
9892                         case "$i_unistd" in
9893                         $undef)
9894                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9895                                 val="$define"
9896                                 ;;
9897                         $define)
9898                                 xxx="probably a USG one, i.e. you use getpgrp()."
9899                                 val="$undef"
9900                                 ;;
9901                         esac
9902                 fi
9903                 echo "Assuming your getpgrp is $xxx" >&4
9904         fi
9905         ;;
9906 *) val="$undef";;
9907 esac
9908 set d_bsdgetpgrp
9909 eval $setvar
9910 $rm -f try try.*
9911
9912 : see if setpgrp exists
9913 set setpgrp d_setpgrp
9914 eval $inlibc
9915
9916 case "$d_setpgrp" in
9917 "$define")
9918         echo " "
9919         echo "Checking to see which flavor of setpgrp is in use..."
9920         $cat >try.c <<EOP
9921 #$i_unistd I_UNISTD
9922 #include <sys/types.h>
9923 #ifdef I_UNISTD
9924 #  include <unistd.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 (-1 == setpgrp(1, 1))
9934                 exit(0);
9935 #else
9936         if (setpgrp() != -1)
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 setpgrp(pid,pgrp) instead of setpgrp().' >&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 setpgrp() instead of setpgrp(pid,pgrp).' >&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 setpgrp()."
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 setpgrp(pid,pgrp)."
9957                                 val="$define"
9958                                 ;;
9959                         $define)
9960                                 xxx="probably a USG one, i.e. you use setpgrp()."
9961                                 val="$undef"
9962                                 ;;
9963                         esac
9964                 fi
9965                 echo "Assuming your setpgrp is $xxx" >&4
9966         fi
9967         ;;
9968 *) val="$undef";;
9969 esac
9970 set d_bsdsetpgrp
9971 eval $setvar
9972 $rm -f try try.*
9973 : see if bzero exists
9974 set bzero d_bzero
9975 eval $inlibc
9976
9977 : see if signal is declared as pointer to function returning int or void
9978 echo " "
9979 xxx=`./findhdr signal.h`
9980 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9981 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9982         echo "You have int (*signal())() instead of void." >&4
9983         val="$undef"
9984 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9985         echo "You have void (*signal())()." >&4
9986         val="$define"
9987 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9988         echo "You have int (*signal())() instead of void." >&4
9989         val="$undef"
9990 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9991         echo "You have void (*signal())()." >&4
9992         val="$define"
9993 else
9994         case "$d_voidsig" in
9995         '')
9996         echo "I can't determine whether signal handler returns void or int..." >&4
9997                 dflt=void
9998                 rp="What type does your signal handler return?"
9999                 . ./myread
10000                 case "$ans" in
10001                 v*) val="$define";;
10002                 *) val="$undef";;
10003                 esac;;
10004         "$define")
10005                 echo "As you already told me, signal handler returns void." >&4
10006                 val="$define"
10007                 ;;
10008         *)      echo "As you already told me, signal handler returns int." >&4
10009                 val="$undef"
10010                 ;;
10011         esac
10012 fi
10013 set d_voidsig
10014 eval $setvar
10015 case "$d_voidsig" in
10016 "$define") signal_t="void";;
10017 *) signal_t="int";;
10018 esac
10019 $rm -f $$.tmp
10020
10021 : check for ability to cast large floats to 32-bit ints.
10022 echo " "
10023 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10024 if $test "$intsize" -ge 4; then
10025         xxx=int
10026 else
10027         xxx=long
10028 fi
10029 $cat >try.c <<EOCP
10030 #include <stdio.h>
10031 #include <sys/types.h>
10032 #include <signal.h>
10033 $signal_t blech(s) int s; { exit(3); }
10034 int main()
10035 {
10036         $xxx i32;
10037         double f, g;
10038         int result = 0;
10039         char str[16];
10040         signal(SIGFPE, blech);
10041
10042         /* Don't let compiler optimize the test away.  Store the number 
10043            in a writable string for gcc to pass to sscanf under HP/UX.
10044         */
10045         sprintf(str, "2147483647");
10046         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10047         g = 10 * f;
10048         i32  = ($xxx) g;
10049
10050         /* x86 processors will probably give 0x8000 0000, which is a
10051        sign change.  We don't want that.  We want to mimic SPARC
10052            behavior here, which is to preserve the sign and give
10053            back 0x7fff ffff.
10054         */
10055         if (i32 != ($xxx) f)
10056                 result |= 1;
10057         exit(result);
10058 }
10059 EOCP
10060 set try
10061 if eval $compile_ok; then
10062         $run ./try
10063         yyy=$?
10064 else
10065         echo "(I can't seem to compile the test program--assuming it can't)"
10066         yyy=1
10067 fi
10068 case "$yyy" in
10069 0)      val="$define"
10070         echo "Yup, it can."
10071         ;;
10072 *)      val="$undef"
10073         echo "Nope, it can't."
10074         ;;
10075 esac
10076 set d_casti32
10077 eval $setvar
10078 $rm -f try try.*
10079
10080 : check for ability to cast negative floats to unsigned
10081 echo " "
10082 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10083 $cat >try.c <<EOCP
10084 #include <stdio.h>
10085 #include <sys/types.h>
10086 #include <signal.h>
10087 $signal_t blech(s) int s; { exit(7); }
10088 $signal_t blech_in_list(s) int s; { exit(4); }
10089 unsigned long dummy_long(p) unsigned long p; { return p; }
10090 unsigned int dummy_int(p) unsigned int p; { return p; }
10091 unsigned short dummy_short(p) unsigned short p; { return p; }
10092 int main()
10093 {
10094         double f;
10095         unsigned long along;
10096         unsigned int aint;
10097         unsigned short ashort;
10098         int result = 0;
10099         char str[16];
10100         
10101         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10102            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10103            optimized the whole file away
10104         */
10105         /* Store the number in a writable string for gcc to pass to 
10106            sscanf under HP/UX.
10107         */
10108         sprintf(str, "-123");
10109         sscanf(str, "%lf", &f);  /* f = -123.; */
10110
10111         signal(SIGFPE, blech);
10112         along = (unsigned long)f;
10113         aint = (unsigned int)f;
10114         ashort = (unsigned short)f;
10115         if (along != (unsigned long)-123)
10116                 result |= 1;
10117         if (aint != (unsigned int)-123)
10118                 result |= 1;
10119         if (ashort != (unsigned short)-123)
10120                 result |= 1;
10121         sprintf(str, "1073741824.");
10122         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10123         f = f + f;
10124         along = 0;
10125         along = (unsigned long)f;
10126         if (along != 0x80000000)
10127                 result |= 2;
10128         f -= 1.;
10129         along = 0;
10130         along = (unsigned long)f;
10131         if (along != 0x7fffffff)
10132                 result |= 1;
10133         f += 2.;
10134         along = 0;
10135         along = (unsigned long)f;
10136         if (along != 0x80000001)
10137                 result |= 2;
10138         if (result)
10139                 exit(result);
10140         signal(SIGFPE, blech_in_list);
10141         sprintf(str, "123.");
10142         sscanf(str, "%lf", &f);  /* f = 123.; */
10143         along = dummy_long((unsigned long)f);
10144         aint = dummy_int((unsigned int)f);
10145         ashort = dummy_short((unsigned short)f);
10146         if (along != (unsigned long)123)
10147                 result |= 4;
10148         if (aint != (unsigned int)123)
10149                 result |= 4;
10150         if (ashort != (unsigned short)123)
10151                 result |= 4;
10152         exit(result);
10153
10154 }
10155 EOCP
10156 set try
10157 if eval $compile_ok; then
10158         $run ./try
10159         castflags=$?
10160 else
10161         echo "(I can't seem to compile the test program--assuming it can't)"
10162         castflags=7
10163 fi
10164 case "$castflags" in
10165 0)      val="$define"
10166         echo "Yup, it can."
10167         ;;
10168 *)      val="$undef"
10169         echo "Nope, it can't."
10170         ;;
10171 esac
10172 set d_castneg
10173 eval $setvar
10174 $rm -f try.*
10175
10176 : see if vprintf exists
10177 echo " "
10178 if set vprintf val -f d_vprintf; eval $csym; $val; then
10179         echo 'vprintf() found.' >&4
10180         val="$define"
10181         $cat >try.c <<'EOF'
10182 #include <varargs.h>
10183
10184 int main() { xxx("foo"); }
10185
10186 xxx(va_alist)
10187 va_dcl
10188 {
10189         va_list args;
10190         char buf[10];
10191
10192         va_start(args);
10193         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10194 }
10195 EOF
10196         set try
10197         if eval $compile && $run ./try; then
10198                 echo "Your vsprintf() returns (int)." >&4
10199                 val2="$undef"
10200         else
10201                 echo "Your vsprintf() returns (char*)." >&4
10202                 val2="$define"
10203         fi
10204 else
10205         echo 'vprintf() NOT found.' >&4
10206                 val="$undef"
10207                 val2="$undef"
10208 fi
10209 $rm -f try try.*
10210 set d_vprintf
10211 eval $setvar
10212 val=$val2
10213 set d_charvspr
10214 eval $setvar
10215
10216 : see if chown exists
10217 set chown d_chown
10218 eval $inlibc
10219
10220 : see if chroot exists
10221 set chroot d_chroot
10222 eval $inlibc
10223
10224 : see if chsize exists
10225 set chsize d_chsize
10226 eval $inlibc
10227
10228 : see if class exists
10229 set class d_class
10230 eval $inlibc
10231
10232 hasstruct='varname=$1; struct=$2; shift; shift;
10233 while $test $# -ge 2; do
10234         case "$1" in
10235         $define) echo "#include <$2>";;
10236         esac ;
10237     shift 2;
10238 done > try.c;
10239 echo "int main () { struct $struct foo; }" >> try.c;
10240 set try;
10241 if eval $compile; then
10242         val="$define";
10243 else
10244         val="$undef";
10245 fi;
10246 set $varname;
10247 eval $setvar;
10248 $rm -f try.c try.o'
10249
10250 socketlib=''
10251 sockethdr=''
10252 : see whether socket exists
10253 echo " "
10254 $echo $n "Hmm... $c" >&4
10255 if set socket val -f d_socket; eval $csym; $val; then
10256         echo "Looks like you have Berkeley networking support." >&4
10257         d_socket="$define"
10258         if set setsockopt val -f; eval $csym; $val; then
10259                 d_oldsock="$undef"
10260         else
10261                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10262                 d_oldsock="$define"
10263         fi
10264 else
10265         if $contains socklib libc.list >/dev/null 2>&1; then
10266                 echo "Looks like you have Berkeley networking support." >&4
10267                 d_socket="$define"
10268                 : we will have to assume that it supports the 4.2 BSD interface
10269                 d_oldsock="$undef"
10270         else
10271                 echo "You don't have Berkeley networking in libc$_a..." >&4
10272                 if test "X$d_socket" = "X$define"; then
10273                    echo "...but you seem to believe that you have sockets." >&4
10274                 else
10275                         for net in net socket
10276                         do
10277                                 if test -f /usr/lib/lib$net$_a; then
10278                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10279                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10280                                         if $contains socket libc.list >/dev/null 2>&1; then
10281                                                 d_socket="$define"
10282                                                 socketlib="-l$net"
10283                                                 case "$net" in
10284                                                 net)
10285                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10286                                                         sockethdr="-I/usr/netinclude"
10287                                                         ;;
10288                                                 esac
10289                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10290                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10291                                                         d_oldsock="$undef"
10292                                                 else
10293                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10294                                                         d_oldsock="$define"
10295                                                 fi
10296                                                 break
10297                                         fi
10298                                 fi
10299                         done
10300                         if test "X$d_socket" != "X$define"; then
10301                            echo "or anywhere else I see." >&4
10302                            d_socket="$undef"
10303                            d_oldsock="$undef"
10304                         fi
10305                 fi
10306         fi
10307 fi
10308
10309 : see if socketpair exists
10310 set socketpair d_sockpair
10311 eval $inlibc
10312
10313
10314 echo " "
10315 echo "Checking the availability of certain socket constants..." >&4
10316 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10317         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10318         $cat >try.c <<EOF
10319 #include <sys/types.h>
10320 #include <sys/socket.h>
10321 int main() {
10322     int i = $ENUM;
10323 }
10324 EOF
10325         val="$undef"
10326         set try; if eval $compile; then
10327                 val="$define"
10328         fi
10329         set d_${enum}; eval $setvar
10330         $rm -f try.c try
10331 done
10332
10333 : see if this is a sys/uio.h system
10334 set sys/uio.h i_sysuio
10335 eval $inhdr
10336
10337
10338 echo " "
10339 echo "Checking to see if your system supports struct cmsghdr..." >&4
10340 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10341 eval $hasstruct
10342 case "$d_cmsghdr_s" in
10343 "$define")      echo "Yes, it does."   ;;
10344 *)              echo "No, it doesn't." ;;
10345 esac
10346
10347
10348 : check for const keyword
10349 echo " "
10350 echo 'Checking to see if your C compiler knows about "const"...' >&4
10351 $cat >const.c <<'EOCP'
10352 typedef struct spug { int drokk; } spug;
10353 int main()
10354 {
10355         const char *foo;
10356         const spug y;
10357 }
10358 EOCP
10359 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10360         val="$define"
10361         echo "Yup, it does."
10362 else
10363         val="$undef"
10364         echo "Nope, it doesn't."
10365 fi
10366 set d_const
10367 eval $setvar
10368
10369 : see if crypt exists
10370 echo " "
10371 set crypt d_crypt
10372 eval $inlibc
10373 case "$d_crypt" in
10374 $define) cryptlib='' ;;
10375 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10376                 echo 'crypt() found.' >&4
10377                 val="$define"
10378                 cryptlib=''
10379         else
10380                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10381                 if $test -z "$cryptlib"; then
10382                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10383                 else
10384                         cryptlib=-lcrypt
10385                 fi
10386                 if $test -z "$cryptlib"; then
10387                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10388                 else
10389                         cryptlib=-lcrypt
10390                 fi
10391                 if $test -z "$cryptlib"; then
10392                         cryptlib=`./loc libcrypt$_a "" $libpth`
10393                 else
10394                         cryptlib=-lcrypt
10395                 fi
10396                 if $test -z "$cryptlib"; then
10397                         echo 'crypt() NOT found.' >&4
10398                         val="$undef"
10399                 else
10400                         val="$define"
10401                 fi
10402         fi
10403         set d_crypt
10404         eval $setvar
10405         ;;
10406 esac
10407
10408 : see if this is a crypt.h system
10409 set crypt.h i_crypt
10410 eval $inhdr
10411
10412 : see if crypt_r exists
10413 set crypt_r d_crypt_r
10414 eval $inlibc
10415 case "$d_crypt_r" in
10416 "$define")
10417         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10418         case "$d_crypt_r_proto:$usethreads" in
10419         ":define")      d_crypt_r_proto=define
10420                 set d_crypt_r_proto crypt_r $hdrs
10421                 eval $hasproto ;;
10422         *)      ;;
10423         esac
10424         case "$d_crypt_r_proto" in
10425         define)
10426         case "$crypt_r_proto" in
10427         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10428         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10429         esac
10430         case "$crypt_r_proto" in
10431         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10432         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10433         esac
10434         case "$crypt_r_proto" in
10435         ''|0)   d_crypt_r=undef
10436                 crypt_r_proto=0
10437                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10438         * )     case "$crypt_r_proto" in
10439                 REENTRANT_PROTO*) ;;
10440                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10441                 esac
10442                 echo "Prototype: $try" ;;
10443         esac
10444         ;;
10445         *)      case "$usethreads" in
10446                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10447                 esac
10448                 d_crypt_r=undef
10449                 crypt_r_proto=0
10450                 ;;
10451         esac
10452         ;;
10453 *)      crypt_r_proto=0
10454         ;;
10455 esac
10456
10457 : get csh whereabouts
10458 case "$csh" in
10459 'csh') val="$undef" ;;
10460 *) val="$define" ;;
10461 esac
10462 set d_csh
10463 eval $setvar
10464 : Respect a hint or command line value for full_csh.
10465 case "$full_csh" in
10466 '') full_csh=$csh ;;
10467 esac
10468
10469 : see if ctermid_r exists
10470 set ctermid_r d_ctermid_r
10471 eval $inlibc
10472 case "$d_ctermid_r" in
10473 "$define")
10474         hdrs="$i_systypes sys/types.h define stdio.h "
10475         case "$d_ctermid_r_proto:$usethreads" in
10476         ":define")      d_ctermid_r_proto=define
10477                 set d_ctermid_r_proto ctermid_r $hdrs
10478                 eval $hasproto ;;
10479         *)      ;;
10480         esac
10481         case "$d_ctermid_r_proto" in
10482         define)
10483         case "$ctermid_r_proto" in
10484         ''|0) try='char* ctermid_r(char*);'
10485         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10486         esac
10487         case "$ctermid_r_proto" in
10488         ''|0)   d_ctermid_r=undef
10489                 ctermid_r_proto=0
10490                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10491         * )     case "$ctermid_r_proto" in
10492                 REENTRANT_PROTO*) ;;
10493                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10494                 esac
10495                 echo "Prototype: $try" ;;
10496         esac
10497         ;;
10498         *)      case "$usethreads" in
10499                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10500                 esac
10501                 d_ctermid_r=undef
10502                 ctermid_r_proto=0
10503                 ;;
10504         esac
10505         ;;
10506 *)      ctermid_r_proto=0
10507         ;;
10508 esac
10509
10510 : see if ctime_r exists
10511 set ctime_r d_ctime_r
10512 eval $inlibc
10513 case "$d_ctime_r" in
10514 "$define")
10515         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10516         case "$d_ctime_r_proto:$usethreads" in
10517         ":define")      d_ctime_r_proto=define
10518                 set d_ctime_r_proto ctime_r $hdrs
10519                 eval $hasproto ;;
10520         *)      ;;
10521         esac
10522         case "$d_ctime_r_proto" in
10523         define)
10524         case "$ctime_r_proto" in
10525         ''|0) try='char* ctime_r(const time_t*, char*);'
10526         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10527         esac
10528         case "$ctime_r_proto" in
10529         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10530         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10531         esac
10532         case "$ctime_r_proto" in
10533         ''|0) try='int ctime_r(const time_t*, char*);'
10534         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10535         esac
10536         case "$ctime_r_proto" in
10537         ''|0) try='int ctime_r(const time_t*, char*, int);'
10538         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10539         esac
10540         case "$ctime_r_proto" in
10541         ''|0)   d_ctime_r=undef
10542                 ctime_r_proto=0
10543                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10544         * )     case "$ctime_r_proto" in
10545                 REENTRANT_PROTO*) ;;
10546                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10547                 esac
10548                 echo "Prototype: $try" ;;
10549         esac
10550         ;;
10551         *)      case "$usethreads" in
10552                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10553                 esac
10554                 d_ctime_r=undef
10555                 ctime_r_proto=0
10556                 ;;
10557         esac
10558         ;;
10559 *)      ctime_r_proto=0
10560         ;;
10561 esac
10562
10563 : see if cuserid exists
10564 set cuserid d_cuserid
10565 eval $inlibc
10566
10567 : see if this is a limits.h system
10568 set limits.h i_limits
10569 eval $inhdr
10570
10571 : see if this is a float.h system
10572 set float.h i_float
10573 eval $inhdr
10574
10575 : See if number of significant digits in a double precision number is known
10576 echo " "
10577 $cat >dbl_dig.c <<EOM
10578 #$i_limits I_LIMITS
10579 #$i_float I_FLOAT
10580 #ifdef I_LIMITS
10581 #include <limits.h>
10582 #endif
10583 #ifdef I_FLOAT
10584 #include <float.h>
10585 #endif
10586 #ifdef DBL_DIG
10587 printf("Contains DBL_DIG");
10588 #endif
10589 EOM
10590 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10591 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10592         echo "DBL_DIG found." >&4
10593         val="$define"
10594 else
10595         echo "DBL_DIG NOT found." >&4
10596         val="$undef"
10597 fi
10598 $rm -f dbl_dig.?
10599 set d_dbl_dig
10600 eval $setvar
10601
10602 : see if dbm.h is available
10603 : see if dbmclose exists
10604 set dbmclose d_dbmclose
10605 eval $inlibc
10606
10607 case "$d_dbmclose" in
10608 $define)
10609         set dbm.h i_dbm
10610         eval $inhdr
10611         case "$i_dbm" in
10612         $define)
10613                 val="$undef"
10614                 set i_rpcsvcdbm
10615                 eval $setvar
10616                 ;;
10617         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10618                 eval $inhdr
10619                 ;;
10620         esac
10621         ;;
10622 *)      echo "We won't be including <dbm.h>"
10623         val="$undef"
10624         set i_dbm
10625         eval $setvar
10626         val="$undef"
10627         set i_rpcsvcdbm
10628         eval $setvar
10629         ;;
10630 esac
10631
10632 : see if prototype for dbminit is available
10633 echo " "
10634 set d_dbminitproto dbminit $i_dbm dbm.h
10635 eval $hasproto
10636
10637 : see if difftime exists
10638 set difftime d_difftime
10639 eval $inlibc
10640
10641 : see if this is a dirent system
10642 echo " "
10643 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10644         val="$define"
10645         echo "<dirent.h> found." >&4
10646 else
10647         val="$undef"
10648         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10649                 echo "<sys/dir.h> found." >&4
10650                 echo " "
10651         else
10652                 xinc=`./findhdr sys/ndir.h`
10653         fi
10654         echo "<dirent.h> NOT found." >&4
10655 fi
10656 set i_dirent
10657 eval $setvar
10658
10659 : Look for type of directory structure.
10660 echo " "
10661 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10662
10663 case "$direntrytype" in
10664 ''|' ')
10665         case "$i_dirent" in
10666         $define) guess1='struct dirent' ;;
10667         *) guess1='struct direct'  ;;
10668         esac
10669         ;;
10670 *)      guess1="$direntrytype"
10671         ;;
10672 esac
10673
10674 case "$guess1" in
10675 'struct dirent') guess2='struct direct' ;;
10676 *) guess2='struct dirent' ;;
10677 esac
10678                 
10679 if $contains "$guess1" try.c >/dev/null 2>&1; then
10680         direntrytype="$guess1"
10681         echo "Your directory entries are $direntrytype." >&4
10682 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10683         direntrytype="$guess2"
10684         echo "Your directory entries seem to be $direntrytype." >&4
10685 else
10686         echo "I don't recognize your system's directory entries." >&4
10687         rp="What type is used for directory entries on this system?"
10688         dflt="$guess1"
10689         . ./myread
10690         direntrytype="$ans"
10691 fi
10692 $rm -f try.c
10693
10694
10695 : see if the directory entry stores field length
10696 echo " "
10697 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10698 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10699         echo "Good, your directory entry keeps length information in d_namlen." >&4
10700         val="$define"
10701 else
10702         echo "Your directory entry does not know about the d_namlen field." >&4
10703         val="$undef"
10704 fi
10705 set d_dirnamlen
10706 eval $setvar
10707 $rm -f try.c
10708
10709 : see if this is an sysdir system
10710 set sys/dir.h i_sysdir
10711 eval $inhdr
10712
10713 : see if this is an sysndir system
10714 set sys/ndir.h i_sysndir
10715 eval $inhdr
10716
10717 : Look for dirfd
10718 echo " "
10719 $cat >dirfd.c <<EOM
10720 #include <stdio.h>
10721 #$i_dirent I_DIRENT             /**/
10722 #$i_sysdir I_SYS_DIR            /**/
10723 #$i_sysndir I_SYS_NDIR          /**/
10724 #$i_systypes I_SYS_TYPES        /**/
10725 #if defined(I_SYS_TYPES)
10726 #include <sys/types.h>
10727 #endif
10728 #if defined(I_DIRENT)
10729 #include <dirent.h>
10730 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10731 #include <sys/dir.h>
10732 #endif
10733 #else
10734 #ifdef I_SYS_NDIR
10735 #include <sys/ndir.h>
10736 #else
10737 #ifdef I_SYS_DIR
10738 #ifdef hp9000s500
10739 #include <ndir.h>       /* may be wrong in the future */
10740 #else
10741 #include <sys/dir.h>
10742 #endif
10743 #endif
10744 #endif
10745 #endif 
10746 int main() {
10747         DIR *dirp = opendir(".");
10748         if (dirfd(dirp) >= 0)
10749                 exit(0);
10750         else
10751                 exit(1);
10752 }
10753 EOM
10754 set dirfd
10755 if eval $compile; then
10756         val="$define"
10757 fi
10758 case "$val" in
10759 $define)        echo "dirfd() found." >&4       ;;
10760 *)              echo "dirfd() NOT found." >&4   ;;
10761 esac
10762 set d_dirfd
10763 eval $setvar
10764 $rm -f dirfd*
10765
10766 : see if dlerror exists
10767 xxx_runnm="$runnm"
10768 runnm=false
10769 set dlerror d_dlerror
10770 eval $inlibc
10771 runnm="$xxx_runnm"
10772
10773 : see if dlfcn is available
10774 set dlfcn.h i_dlfcn
10775 eval $inhdr
10776
10777 case "$usedl" in
10778 $define|y|true)
10779         $cat << EOM
10780
10781 On a few systems, the dynamically loaded modules that perl generates and uses
10782 will need a different extension than shared libs. The default will probably
10783 be appropriate.
10784
10785 EOM
10786         case "$dlext" in
10787         '')     dflt="$so" ;;
10788         *)      dflt="$dlext" ;;
10789         esac
10790         rp='What is the extension of dynamically loaded modules'
10791         . ./myread
10792         dlext="$ans"
10793         ;;
10794 *)
10795         dlext="none"
10796         ;;
10797 esac
10798
10799 : Check if dlsym need a leading underscore
10800 echo " "
10801 val="$undef"
10802
10803 case "$dlsrc" in
10804 dl_dlopen.xs)
10805         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10806         $cat >dyna.c <<'EOM'
10807 fred () { }
10808 EOM
10809
10810 $cat >fred.c<<EOM
10811
10812 #include <stdio.h>
10813 #$i_dlfcn I_DLFCN
10814 #ifdef I_DLFCN
10815 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10816 #else
10817 #include <sys/types.h>
10818 #include <nlist.h>
10819 #include <link.h>
10820 #endif
10821
10822 extern int fred() ;
10823
10824 int main()
10825 {
10826     void * handle ;
10827     void * symbol ;
10828 #ifndef RTLD_LAZY
10829     int mode = 1 ;
10830 #else
10831     int mode = RTLD_LAZY ;
10832 #endif
10833     handle = dlopen("./dyna.$dlext", mode) ;
10834     if (handle == NULL) {
10835         printf ("1\n") ;
10836         fflush (stdout) ;
10837         exit(0);
10838     }
10839     symbol = dlsym(handle, "fred") ;
10840     if (symbol == NULL) {
10841         /* try putting a leading underscore */
10842         symbol = dlsym(handle, "_fred") ;
10843         if (symbol == NULL) {
10844             printf ("2\n") ;
10845             fflush (stdout) ;
10846             exit(0);
10847         }
10848         printf ("3\n") ;
10849     }
10850     else
10851         printf ("4\n") ;
10852     fflush (stdout) ;
10853     exit(0);
10854 }
10855 EOM
10856         : Call the object file tmp-dyna.o in case dlext=o.
10857         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10858                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10859                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10860                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10861                 xxx=`$run ./fred`
10862                 case $xxx in
10863                 1)      echo "Test program failed using dlopen." >&4
10864                         echo "Perhaps you should not use dynamic loading." >&4;;
10865                 2)      echo "Test program failed using dlsym." >&4
10866                         echo "Perhaps you should not use dynamic loading." >&4;;
10867                 3)      echo "dlsym needs a leading underscore" >&4
10868                         val="$define" ;;
10869                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10870                 esac
10871         else
10872                 echo "I can't compile and run the test program." >&4
10873                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10874         fi
10875         ;;
10876 esac
10877                 
10878 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10879
10880 set d_dlsymun
10881 eval $setvar
10882
10883 : see if drand48_r exists
10884 set drand48_r d_drand48_r
10885 eval $inlibc
10886 case "$d_drand48_r" in
10887 "$define")
10888         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10889         case "$d_drand48_r_proto:$usethreads" in
10890         ":define")      d_drand48_r_proto=define
10891                 set d_drand48_r_proto drand48_r $hdrs
10892                 eval $hasproto ;;
10893         *)      ;;
10894         esac
10895         case "$d_drand48_r_proto" in
10896         define)
10897         case "$drand48_r_proto" in
10898         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10899         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10900         esac
10901         case "$drand48_r_proto" in
10902         ''|0)   d_drand48_r=undef
10903                 drand48_r_proto=0
10904                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10905         * )     case "$drand48_r_proto" in
10906                 REENTRANT_PROTO*) ;;
10907                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10908                 esac
10909                 echo "Prototype: $try" ;;
10910         esac
10911         ;;
10912         *)      case "$usethreads" in
10913                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10914                 esac
10915                 d_drand48_r=undef
10916                 drand48_r_proto=0
10917                 ;;
10918         esac
10919         ;;
10920 *)      drand48_r_proto=0
10921         ;;
10922 esac
10923
10924 : see if prototype for drand48 is available
10925 echo " "
10926 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10927 eval $hasproto
10928
10929 : see if dup2 exists
10930 set dup2 d_dup2
10931 eval $inlibc
10932
10933 : see if eaccess exists
10934 set eaccess d_eaccess
10935 eval $inlibc
10936
10937 : see if endgrent exists
10938 set endgrent d_endgrent
10939 eval $inlibc
10940
10941 : see if this is an grp system
10942 set grp.h i_grp
10943 eval $inhdr
10944
10945 case "$i_grp" in
10946 $define)
10947         xxx=`./findhdr grp.h`
10948         $cppstdin $cppflags $cppminus < $xxx >$$.h
10949
10950         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10951                 val="$define"
10952         else
10953                 val="$undef"
10954         fi
10955         set d_grpasswd
10956         eval $setvar
10957
10958         $rm -f $$.h
10959         ;;
10960 *)
10961         val="$undef";
10962         set d_grpasswd; eval $setvar
10963         ;;
10964 esac
10965
10966 : see if endgrent_r exists
10967 set endgrent_r d_endgrent_r
10968 eval $inlibc
10969 case "$d_endgrent_r" in
10970 "$define")
10971         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10972         case "$d_endgrent_r_proto:$usethreads" in
10973         ":define")      d_endgrent_r_proto=define
10974                 set d_endgrent_r_proto endgrent_r $hdrs
10975                 eval $hasproto ;;
10976         *)      ;;
10977         esac
10978         case "$d_endgrent_r_proto" in
10979         define)
10980         case "$endgrent_r_proto" in
10981         ''|0) try='int endgrent_r(FILE**);'
10982         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10983         esac
10984         case "$endgrent_r_proto" in
10985         ''|0) try='void endgrent_r(FILE**);'
10986         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10987         esac
10988         case "$endgrent_r_proto" in
10989         ''|0)   d_endgrent_r=undef
10990                 endgrent_r_proto=0
10991                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10992         * )     case "$endgrent_r_proto" in
10993                 REENTRANT_PROTO*) ;;
10994                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10995                 esac
10996                 echo "Prototype: $try" ;;
10997         esac
10998         ;;
10999         *)      case "$usethreads" in
11000                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11001                 esac
11002                 d_endgrent_r=undef
11003                 endgrent_r_proto=0
11004                 ;;
11005         esac
11006         ;;
11007 *)      endgrent_r_proto=0
11008         ;;
11009 esac
11010
11011 : see if endhostent exists
11012 set endhostent d_endhent
11013 eval $inlibc
11014
11015 : see if this is a netdb.h system
11016 set netdb.h i_netdb
11017 eval $inhdr
11018
11019 : see if endhostent_r exists
11020 set endhostent_r d_endhostent_r
11021 eval $inlibc
11022 case "$d_endhostent_r" in
11023 "$define")
11024         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11025         case "$d_endhostent_r_proto:$usethreads" in
11026         ":define")      d_endhostent_r_proto=define
11027                 set d_endhostent_r_proto endhostent_r $hdrs
11028                 eval $hasproto ;;
11029         *)      ;;
11030         esac
11031         case "$d_endhostent_r_proto" in
11032         define)
11033         case "$endhostent_r_proto" in
11034         ''|0) try='int endhostent_r(struct hostent_data*);'
11035         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11036         esac
11037         case "$endhostent_r_proto" in
11038         ''|0) try='void endhostent_r(struct hostent_data*);'
11039         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11040         esac
11041         case "$endhostent_r_proto" in
11042         ''|0)   d_endhostent_r=undef
11043                 endhostent_r_proto=0
11044                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11045         * )     case "$endhostent_r_proto" in
11046                 REENTRANT_PROTO*) ;;
11047                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11048                 esac
11049                 echo "Prototype: $try" ;;
11050         esac
11051         ;;
11052         *)      case "$usethreads" in
11053                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11054                 esac
11055                 d_endhostent_r=undef
11056                 endhostent_r_proto=0
11057                 ;;
11058         esac
11059         ;;
11060 *)      endhostent_r_proto=0
11061         ;;
11062 esac
11063
11064 : see if endnetent exists
11065 set endnetent d_endnent
11066 eval $inlibc
11067
11068 : see if endnetent_r exists
11069 set endnetent_r d_endnetent_r
11070 eval $inlibc
11071 case "$d_endnetent_r" in
11072 "$define")
11073         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11074         case "$d_endnetent_r_proto:$usethreads" in
11075         ":define")      d_endnetent_r_proto=define
11076                 set d_endnetent_r_proto endnetent_r $hdrs
11077                 eval $hasproto ;;
11078         *)      ;;
11079         esac
11080         case "$d_endnetent_r_proto" in
11081         define)
11082         case "$endnetent_r_proto" in
11083         ''|0) try='int endnetent_r(struct netent_data*);'
11084         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11085         esac
11086         case "$endnetent_r_proto" in
11087         ''|0) try='void endnetent_r(struct netent_data*);'
11088         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11089         esac
11090         case "$endnetent_r_proto" in
11091         ''|0)   d_endnetent_r=undef
11092                 endnetent_r_proto=0
11093                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11094         * )     case "$endnetent_r_proto" in
11095                 REENTRANT_PROTO*) ;;
11096                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11097                 esac
11098                 echo "Prototype: $try" ;;
11099         esac
11100         ;;
11101         *)      case "$usethreads" in
11102                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11103                 esac
11104                 d_endnetent_r=undef
11105                 endnetent_r_proto=0
11106                 ;;
11107         esac
11108         ;;
11109 *)      endnetent_r_proto=0
11110         ;;
11111 esac
11112
11113 : see if endprotoent exists
11114 set endprotoent d_endpent
11115 eval $inlibc
11116
11117 : see if endprotoent_r exists
11118 set endprotoent_r d_endprotoent_r
11119 eval $inlibc
11120 case "$d_endprotoent_r" in
11121 "$define")
11122         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11123         case "$d_endprotoent_r_proto:$usethreads" in
11124         ":define")      d_endprotoent_r_proto=define
11125                 set d_endprotoent_r_proto endprotoent_r $hdrs
11126                 eval $hasproto ;;
11127         *)      ;;
11128         esac
11129         case "$d_endprotoent_r_proto" in
11130         define)
11131         case "$endprotoent_r_proto" in
11132         ''|0) try='int endprotoent_r(struct protoent_data*);'
11133         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11134         esac
11135         case "$endprotoent_r_proto" in
11136         ''|0) try='void endprotoent_r(struct protoent_data*);'
11137         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11138         esac
11139         case "$endprotoent_r_proto" in
11140         ''|0)   d_endprotoent_r=undef
11141                 endprotoent_r_proto=0
11142                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11143         * )     case "$endprotoent_r_proto" in
11144                 REENTRANT_PROTO*) ;;
11145                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11146                 esac
11147                 echo "Prototype: $try" ;;
11148         esac
11149         ;;
11150         *)      case "$usethreads" in
11151                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11152                 esac
11153                 d_endprotoent_r=undef
11154                 endprotoent_r_proto=0
11155                 ;;
11156         esac
11157         ;;
11158 *)      endprotoent_r_proto=0
11159         ;;
11160 esac
11161
11162 : see if endpwent exists
11163 set endpwent d_endpwent
11164 eval $inlibc
11165
11166 : see if this is a pwd.h system
11167 set pwd.h i_pwd
11168 eval $inhdr
11169
11170 case "$i_pwd" in
11171 $define)
11172         xxx=`./findhdr pwd.h`
11173         $cppstdin $cppflags $cppminus < $xxx >$$.h
11174
11175         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11176                 val="$define"
11177         else
11178                 val="$undef"
11179         fi
11180         set d_pwquota
11181         eval $setvar
11182
11183         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11184                 val="$define"
11185         else
11186                 val="$undef"
11187         fi
11188         set d_pwage
11189         eval $setvar
11190
11191         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11192                 val="$define"
11193         else
11194                 val="$undef"
11195         fi
11196         set d_pwchange
11197         eval $setvar
11198
11199         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11200                 val="$define"
11201         else
11202                 val="$undef"
11203         fi
11204         set d_pwclass
11205         eval $setvar
11206
11207         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11208                 val="$define"
11209         else
11210                 val="$undef"
11211         fi
11212         set d_pwexpire
11213         eval $setvar
11214
11215         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11216                 val="$define"
11217         else
11218                 val="$undef"
11219         fi
11220         set d_pwcomment
11221         eval $setvar
11222
11223         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11224                 val="$define"
11225         else
11226                 val="$undef"
11227         fi
11228         set d_pwgecos
11229         eval $setvar
11230
11231         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11232                 val="$define"
11233         else
11234                 val="$undef"
11235         fi
11236         set d_pwpasswd
11237         eval $setvar
11238
11239         $rm -f $$.h
11240         ;;
11241 *)
11242         val="$undef"; 
11243         set d_pwquota; eval $setvar
11244         set d_pwage; eval $setvar
11245         set d_pwchange; eval $setvar
11246         set d_pwclass; eval $setvar
11247         set d_pwexpire; eval $setvar
11248         set d_pwcomment; eval $setvar
11249         set d_pwgecos; eval $setvar
11250         set d_pwpasswd; eval $setvar
11251         ;;
11252 esac
11253
11254 : see if endpwent_r exists
11255 set endpwent_r d_endpwent_r
11256 eval $inlibc
11257 case "$d_endpwent_r" in
11258 "$define")
11259         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11260         case "$d_endpwent_r_proto:$usethreads" in
11261         ":define")      d_endpwent_r_proto=define
11262                 set d_endpwent_r_proto endpwent_r $hdrs
11263                 eval $hasproto ;;
11264         *)      ;;
11265         esac
11266         case "$d_endpwent_r_proto" in
11267         define)
11268         case "$endpwent_r_proto" in
11269         ''|0) try='int endpwent_r(FILE**);'
11270         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11271         esac
11272         case "$endpwent_r_proto" in
11273         ''|0) try='void endpwent_r(FILE**);'
11274         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11275         esac
11276         case "$endpwent_r_proto" in
11277         ''|0)   d_endpwent_r=undef
11278                 endpwent_r_proto=0
11279                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11280         * )     case "$endpwent_r_proto" in
11281                 REENTRANT_PROTO*) ;;
11282                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11283                 esac
11284                 echo "Prototype: $try" ;;
11285         esac
11286         ;;
11287         *)      case "$usethreads" in
11288                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11289                 esac
11290                 d_endpwent_r=undef
11291                 endpwent_r_proto=0
11292                 ;;
11293         esac
11294         ;;
11295 *)      endpwent_r_proto=0
11296         ;;
11297 esac
11298
11299 : see if endservent exists
11300 set endservent d_endsent
11301 eval $inlibc
11302
11303 : see if endservent_r exists
11304 set endservent_r d_endservent_r
11305 eval $inlibc
11306 case "$d_endservent_r" in
11307 "$define")
11308         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11309         case "$d_endservent_r_proto:$usethreads" in
11310         ":define")      d_endservent_r_proto=define
11311                 set d_endservent_r_proto endservent_r $hdrs
11312                 eval $hasproto ;;
11313         *)      ;;
11314         esac
11315         case "$d_endservent_r_proto" in
11316         define)
11317         case "$endservent_r_proto" in
11318         ''|0) try='int endservent_r(struct servent_data*);'
11319         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11320         esac
11321         case "$endservent_r_proto" in
11322         ''|0) try='void endservent_r(struct servent_data*);'
11323         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11324         esac
11325         case "$endservent_r_proto" in
11326         ''|0)   d_endservent_r=undef
11327                 endservent_r_proto=0
11328                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11329         * )     case "$endservent_r_proto" in
11330                 REENTRANT_PROTO*) ;;
11331                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11332                 esac
11333                 echo "Prototype: $try" ;;
11334         esac
11335         ;;
11336         *)      case "$usethreads" in
11337                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11338                 esac
11339                 d_endservent_r=undef
11340                 endservent_r_proto=0
11341                 ;;
11342         esac
11343         ;;
11344 *)      endservent_r_proto=0
11345         ;;
11346 esac
11347
11348 : Locate the flags for 'open()'
11349 echo " "
11350 $cat >try.c <<'EOCP'
11351 #include <sys/types.h>
11352 #ifdef I_FCNTL
11353 #include <fcntl.h>
11354 #endif
11355 #ifdef I_SYS_FILE
11356 #include <sys/file.h>
11357 #endif
11358 int main() {
11359         if(O_RDONLY);
11360 #ifdef O_TRUNC
11361         exit(0);
11362 #else
11363         exit(1);
11364 #endif
11365 }
11366 EOCP
11367 : check sys/file.h first to get FREAD on Sun
11368 if $test `./findhdr sys/file.h` && \
11369                 set try -DI_SYS_FILE && eval $compile; then
11370         h_sysfile=true;
11371         echo "<sys/file.h> defines the O_* constants..." >&4
11372         if $run ./try; then
11373                 echo "and you have the 3 argument form of open()." >&4
11374                 val="$define"
11375         else
11376                 echo "but not the 3 argument form of open().  Oh, well." >&4
11377                 val="$undef"
11378         fi
11379 elif $test `./findhdr fcntl.h` && \
11380                 set try -DI_FCNTL && eval $compile; then
11381         h_fcntl=true;
11382         echo "<fcntl.h> defines the O_* constants..." >&4
11383         if $run ./try; then
11384                 echo "and you have the 3 argument form of open()." >&4
11385                 val="$define"
11386         else
11387                 echo "but not the 3 argument form of open().  Oh, well." >&4
11388                 val="$undef"
11389         fi
11390 else
11391         val="$undef"
11392         echo "I can't find the O_* constant definitions!  You got problems." >&4
11393 fi
11394 set d_open3
11395 eval $setvar
11396 $rm -f try try.*
11397
11398 : see which of string.h or strings.h is needed
11399 echo " "
11400 strings=`./findhdr string.h`
11401 if $test "$strings" && $test -r "$strings"; then
11402         echo "Using <string.h> instead of <strings.h>." >&4
11403         val="$define"
11404 else
11405         val="$undef"
11406         strings=`./findhdr strings.h`
11407         if $test "$strings" && $test -r "$strings"; then
11408                 echo "Using <strings.h> instead of <string.h>." >&4
11409         else
11410                 echo "No string header found -- You'll surely have problems." >&4
11411         fi
11412 fi
11413 set i_string
11414 eval $setvar
11415 case "$i_string" in
11416 "$undef") strings=`./findhdr strings.h`;;
11417 *)        strings=`./findhdr string.h`;;
11418 esac
11419
11420 : see if this is a sys/file.h system
11421 val=''
11422 set sys/file.h val
11423 eval $inhdr
11424
11425 : do we need to include sys/file.h ?
11426 case "$val" in
11427 "$define")
11428         echo " "
11429         if $h_sysfile; then
11430                 val="$define"
11431                 echo "We'll be including <sys/file.h>." >&4
11432         else
11433                 val="$undef"
11434                 echo "We won't be including <sys/file.h>." >&4
11435         fi
11436         ;;
11437 *)
11438         h_sysfile=false
11439         ;;
11440 esac
11441 set i_sysfile
11442 eval $setvar
11443
11444 : see if fcntl.h is there
11445 val=''
11446 set fcntl.h val
11447 eval $inhdr
11448
11449 : see if we can include fcntl.h
11450 case "$val" in
11451 "$define")
11452         echo " "
11453         if $h_fcntl; then
11454                 val="$define"
11455                 echo "We'll be including <fcntl.h>." >&4
11456         else
11457                 val="$undef"
11458                 if $h_sysfile; then
11459         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11460                 else
11461                         echo "We won't be including <fcntl.h>." >&4
11462                 fi
11463         fi
11464         ;;
11465 *)
11466         h_fcntl=false
11467         val="$undef"
11468         ;;
11469 esac
11470 set i_fcntl
11471 eval $setvar
11472
11473 : check for non-blocking I/O stuff
11474 case "$h_sysfile" in
11475 true) echo "#include <sys/file.h>" > head.c;;
11476 *)
11477        case "$h_fcntl" in
11478        true) echo "#include <fcntl.h>" > head.c;;
11479        *) echo "#include <sys/fcntl.h>" > head.c;;
11480        esac
11481        ;;
11482 esac
11483 echo " "
11484 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11485 case "$o_nonblock" in
11486 '')
11487         $cat head.c > try.c
11488         $cat >>try.c <<EOCP
11489 #include <stdio.h>
11490 #include <stdlib.h>
11491 #$i_fcntl I_FCNTL
11492 #ifdef I_FCNTL
11493 #include <fcntl.h>
11494 #endif
11495 int main() {
11496 #ifdef O_NONBLOCK
11497         printf("O_NONBLOCK\n");
11498         exit(0);
11499 #endif
11500 #ifdef O_NDELAY
11501         printf("O_NDELAY\n");
11502         exit(0);
11503 #endif
11504 #ifdef FNDELAY
11505         printf("FNDELAY\n");
11506         exit(0);
11507 #endif
11508         exit(0);
11509 }
11510 EOCP
11511         set try
11512         if eval $compile_ok; then
11513                 o_nonblock=`$run ./try`
11514                 case "$o_nonblock" in
11515                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11516                 *) echo "Seems like we can use $o_nonblock.";;
11517                 esac
11518         else
11519                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11520         fi
11521         ;;
11522 *) echo "Using $hint value $o_nonblock.";;
11523 esac
11524 $rm -f try try.* .out core
11525
11526 echo " "
11527 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11528 case "$eagain" in
11529 '')
11530         $cat head.c > try.c
11531         $cat >>try.c <<EOCP
11532 #include <errno.h>
11533 #include <sys/types.h>
11534 #include <signal.h>
11535 #include <stdio.h> 
11536 #include <stdlib.h> 
11537 #$i_fcntl I_FCNTL
11538 #ifdef I_FCNTL
11539 #include <fcntl.h>
11540 #endif
11541 #define MY_O_NONBLOCK $o_nonblock
11542 #ifndef errno  /* XXX need better Configure test */
11543 extern int errno;
11544 #endif
11545 #$i_unistd I_UNISTD
11546 #ifdef I_UNISTD
11547 #include <unistd.h>
11548 #endif
11549 #$i_string I_STRING
11550 #ifdef I_STRING
11551 #include <string.h>
11552 #else
11553 #include <strings.h>
11554 #endif
11555 $signal_t blech(x) int x; { exit(3); }
11556 EOCP
11557         $cat >> try.c <<'EOCP'
11558 int main()
11559 {
11560         int pd[2];
11561         int pu[2];
11562         char buf[1];
11563         char string[100];
11564
11565         pipe(pd);       /* Down: child -> parent */
11566         pipe(pu);       /* Up: parent -> child */
11567         if (0 != fork()) {
11568                 int ret;
11569                 close(pd[1]);   /* Parent reads from pd[0] */
11570                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11571 #ifdef F_SETFL
11572                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11573                         exit(1);
11574 #else
11575                 exit(4);
11576 #endif
11577                 signal(SIGALRM, blech);
11578                 alarm(5);
11579                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11580                         exit(2);
11581                 sprintf(string, "%d\n", ret);
11582                 write(2, string, strlen(string));
11583                 alarm(0);
11584 #ifdef EAGAIN
11585                 if (errno == EAGAIN) {
11586                         printf("EAGAIN\n");
11587                         goto ok;
11588                 }
11589 #endif
11590 #ifdef EWOULDBLOCK
11591                 if (errno == EWOULDBLOCK)
11592                         printf("EWOULDBLOCK\n");
11593 #endif
11594         ok:
11595                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11596                 sleep(2);                               /* Give it time to close our pipe */
11597                 alarm(5);
11598                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11599                 alarm(0);
11600                 sprintf(string, "%d\n", ret);
11601                 write(4, string, strlen(string));
11602                 exit(0);
11603         }
11604
11605         close(pd[0]);                   /* We write to pd[1] */
11606         close(pu[1]);                   /* We read from pu[0] */
11607         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11608         close(pd[1]);                   /* Pipe pd is now fully closed! */
11609         exit(0);                                /* Bye bye, thank you for playing! */
11610 }
11611 EOCP
11612         set try
11613         if eval $compile_ok; then
11614                 echo "$startsh" >mtry
11615                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11616                 chmod +x mtry
11617                 ./mtry >/dev/null 2>&1
11618                 case $? in
11619                 0) eagain=`$cat try.out`;;
11620                 1) echo "Could not perform non-blocking setting!";;
11621                 2) echo "I did a successful read() for something that was not there!";;
11622                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11623                 4) echo "Could not find F_SETFL!";;
11624                 *) echo "Something terribly wrong happened during testing.";;
11625                 esac
11626                 rd_nodata=`$cat try.ret`
11627                 echo "A read() system call with no data present returns $rd_nodata."
11628                 case "$rd_nodata" in
11629                 0|-1) ;;
11630                 *)
11631                         echo "(That's peculiar, fixing that to be -1.)"
11632                         rd_nodata=-1
11633                         ;;
11634                 esac
11635                 case "$eagain" in
11636                 '')
11637                         echo "Forcing errno EAGAIN on read() with no data available."
11638                         eagain=EAGAIN
11639                         ;;
11640                 *)
11641                         echo "Your read() sets errno to $eagain when no data is available."
11642                         ;;
11643                 esac
11644                 status=`$cat try.err`
11645                 case "$status" in
11646                 0) echo "And it correctly returns 0 to signal EOF.";;
11647                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11648                 *) echo "However, your read() returns '$status' on EOF??";;
11649                 esac
11650                 val="$define"
11651                 if test "$status" = "$rd_nodata"; then
11652                         echo "WARNING: you can't distinguish between EOF and no data!"
11653                         val="$undef"
11654                 fi
11655         else
11656                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11657                 eagain=EAGAIN
11658         fi
11659         set d_eofnblk
11660         eval $setvar
11661         ;;
11662 *)
11663         echo "Using $hint value $eagain."
11664         echo "Your read() returns $rd_nodata when no data is present."
11665         case "$d_eofnblk" in
11666         "$define") echo "And you can see EOF because read() returns 0.";;
11667         "$undef") echo "But you can't see EOF status from read() returned value.";;
11668         *)
11669                 echo "(Assuming you can't see EOF status from read anyway.)"
11670                 d_eofnblk=$undef
11671                 ;;
11672         esac
11673         ;;
11674 esac
11675 $rm -f try try.* .out core head.c mtry
11676
11677 : see if fchdir exists
11678 set fchdir d_fchdir
11679 eval $inlibc
11680
11681 : see if fchmod exists
11682 set fchmod d_fchmod
11683 eval $inlibc
11684
11685 : see if fchown exists
11686 set fchown d_fchown
11687 eval $inlibc
11688
11689 : see if this is an fcntl system
11690 set fcntl d_fcntl
11691 eval $inlibc
11692
11693 echo " "
11694 : See if fcntl-based locking works.
11695 $cat >try.c <<EOCP
11696 #include <stdlib.h>
11697 #include <unistd.h>
11698 #include <fcntl.h>
11699 #include <signal.h>
11700 $signal_t blech(x) int x; { exit(3); }
11701 int main() {
11702 #if defined(F_SETLK) && defined(F_SETLKW)
11703      struct flock flock;
11704      int retval, fd;
11705      fd = open("try.c", O_RDONLY);
11706      flock.l_type = F_RDLCK;
11707      flock.l_whence = SEEK_SET;
11708      flock.l_start = flock.l_len = 0;
11709      signal(SIGALRM, blech);
11710      alarm(10);
11711      retval = fcntl(fd, F_SETLK, &flock);
11712      close(fd);
11713      (retval < 0 ? exit(2) : exit(0));
11714 #else
11715      exit(2);
11716 #endif
11717 }
11718 EOCP
11719 echo "Checking if fcntl-based file locking works... "
11720 case "$d_fcntl" in
11721 "$define")
11722         set try
11723         if eval $compile_ok; then
11724                 if $run ./try; then
11725                         echo "Yes, it seems to work."
11726                         val="$define"
11727                 else
11728                         echo "Nope, it didn't work."
11729                         val="$undef"
11730                         case "$?" in
11731                         3) $cat >&4 <<EOM
11732 ***
11733 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11734 *** This is (almost) impossible.
11735 *** If your NFS lock daemons are not feeling well, something like
11736 *** this may happen, please investigate.  Cannot continue, aborting.
11737 ***
11738 EOM
11739                                 exit 1
11740                                 ;;
11741                         esac
11742                 fi
11743         else
11744                 echo "I'm unable to compile the test program, so I'll assume not."
11745                 val="$undef"
11746         fi
11747         ;;
11748 *) val="$undef";
11749         echo "Nope, since you don't even have fcntl()."
11750         ;;
11751 esac
11752 set d_fcntl_can_lock
11753 eval $setvar
11754 $rm -f try*
11755
11756
11757 : check for fd_set items
11758 $cat <<EOM
11759
11760 Checking to see how well your C compiler handles fd_set and friends ...
11761 EOM
11762 $cat >try.c <<EOCP
11763 #$i_systime I_SYS_TIME
11764 #$i_sysselct I_SYS_SELECT
11765 #$d_socket HAS_SOCKET
11766 #include <sys/types.h>
11767 #ifdef HAS_SOCKET
11768 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11769 #endif
11770 #ifdef I_SYS_TIME
11771 #include <sys/time.h>
11772 #endif
11773 #ifdef I_SYS_SELECT
11774 #include <sys/select.h>
11775 #endif
11776 int main() {
11777         fd_set fds;
11778
11779 #ifdef TRYBITS
11780         if(fds.fds_bits);
11781 #endif
11782
11783 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11784         exit(0);
11785 #else
11786         exit(1);
11787 #endif
11788 }
11789 EOCP
11790 set try -DTRYBITS
11791 if eval $compile; then
11792         d_fds_bits="$define"
11793         d_fd_set="$define"
11794         echo "Well, your system knows about the normal fd_set typedef..." >&4
11795         if $run ./try; then
11796                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11797                 d_fd_macros="$define"
11798         else
11799                 $cat >&4 <<'EOM'
11800 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11801 EOM
11802                 d_fd_macros="$undef"
11803         fi
11804 else
11805         $cat <<'EOM'
11806 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11807 EOM
11808         set try
11809         if eval $compile; then
11810                 d_fds_bits="$undef"
11811                 d_fd_set="$define"
11812                 echo "Well, your system has some sort of fd_set available..." >&4
11813                 if $run ./try; then
11814                         echo "and you have the normal fd_set macros." >&4
11815                         d_fd_macros="$define"
11816                 else
11817                         $cat <<'EOM'
11818 but not the normal fd_set macros!  Gross!  More work for me...
11819 EOM
11820                         d_fd_macros="$undef"
11821                 fi
11822         else
11823         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11824                 d_fd_set="$undef"
11825                 d_fds_bits="$undef"
11826                 d_fd_macros="$undef"
11827         fi
11828 fi
11829 $rm -f try try.*
11830
11831 : see if fgetpos exists
11832 set fgetpos d_fgetpos
11833 eval $inlibc
11834
11835 : see if finite exists
11836 set finite d_finite
11837 eval $inlibc
11838
11839 : see if finitel exists
11840 set finitel d_finitel
11841 eval $inlibc
11842
11843 : see if flock exists
11844 set flock d_flock
11845 eval $inlibc
11846
11847 : see if prototype for flock is available
11848 echo " "
11849 set d_flockproto flock $i_sysfile sys/file.h
11850 eval $hasproto
11851
11852 : see if fork exists
11853 set fork d_fork
11854 eval $inlibc
11855
11856 : see if fp_class exists
11857 set fp_class d_fp_class
11858 eval $inlibc
11859
11860 : see if pathconf exists
11861 set pathconf d_pathconf
11862 eval $inlibc
11863
11864 : see if fpathconf exists
11865 set fpathconf d_fpathconf
11866 eval $inlibc
11867
11868 : see if fpclass exists
11869 set fpclass d_fpclass
11870 eval $inlibc
11871
11872 : see if fpclassify exists
11873 set fpclassify d_fpclassify
11874 eval $inlibc
11875
11876 : see if fpclassl exists
11877 set fpclassl d_fpclassl
11878 eval $inlibc
11879
11880
11881 : check for fpos64_t
11882 echo " "
11883 echo "Checking to see if you have fpos64_t..." >&4
11884 $cat >try.c <<EOCP
11885 #include <stdio.h>
11886 int main() { fpos64_t x = 7; }
11887 EOCP
11888 set try
11889 if eval $compile; then
11890         val="$define"
11891         echo "You have fpos64_t."
11892 else
11893         val="$undef"
11894         echo "You do not have fpos64_t."
11895         case "$fpossize" in
11896         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11897         esac
11898 fi
11899 $rm -f try.* try
11900 set d_fpos64_t
11901 eval $setvar
11902
11903 : see if frexpl exists
11904 set frexpl d_frexpl
11905 eval $inlibc
11906
11907 : see if this is a sys/param system
11908 set sys/param.h i_sysparam
11909 eval $inhdr
11910
11911 : see if this is a sys/mount.h system
11912 set sys/mount.h i_sysmount
11913 eval $inhdr
11914
11915
11916 echo " "
11917 echo "Checking to see if your system supports struct fs_data..." >&4
11918 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11919 eval $hasstruct
11920 case "$d_fs_data_s" in
11921 "$define")      echo "Yes, it does."   ;;
11922 *)              echo "No, it doesn't." ;;
11923 esac
11924
11925 : see if fseeko exists
11926 set fseeko d_fseeko
11927 eval $inlibc
11928 case "$longsize" in
11929 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11930 esac
11931
11932 : see if fsetpos exists
11933 set fsetpos d_fsetpos
11934 eval $inlibc
11935
11936
11937 : see if fstatfs exists
11938 set fstatfs d_fstatfs
11939 eval $inlibc
11940
11941
11942 : see if statvfs exists
11943 set statvfs d_statvfs
11944 eval $inlibc
11945
11946 : see if fstatvfs exists
11947 set fstatvfs d_fstatvfs
11948 eval $inlibc
11949
11950
11951 : see if fsync exists
11952 set fsync d_fsync
11953 eval $inlibc
11954
11955 : see if ftello exists
11956 set ftello d_ftello
11957 eval $inlibc
11958 case "$longsize" in
11959 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11960 esac
11961
11962 : see if getcwd exists
11963 set getcwd d_getcwd
11964 eval $inlibc
11965
11966 : see if getespwnam exists
11967 set getespwnam d_getespwnam
11968 eval $inlibc
11969
11970
11971 : see if getfsstat exists
11972 set getfsstat d_getfsstat
11973 eval $inlibc
11974
11975 : see if getgrent exists
11976 set getgrent d_getgrent
11977 eval $inlibc
11978
11979 : see if getgrent_r exists
11980 set getgrent_r d_getgrent_r
11981 eval $inlibc
11982 case "$d_getgrent_r" in
11983 "$define")
11984         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11985         case "$d_getgrent_r_proto:$usethreads" in
11986         ":define")      d_getgrent_r_proto=define
11987                 set d_getgrent_r_proto getgrent_r $hdrs
11988                 eval $hasproto ;;
11989         *)      ;;
11990         esac
11991         case "$d_getgrent_r_proto" in
11992         define)
11993         case "$getgrent_r_proto" in
11994         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11995         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11996         esac
11997         case "$getgrent_r_proto" in
11998         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11999         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12000         esac
12001         case "$getgrent_r_proto" in
12002         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12003         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12004         esac
12005         case "$getgrent_r_proto" in
12006         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12007         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12008         esac
12009         case "$getgrent_r_proto" in
12010         ''|0) try='int getgrent_r(struct group*, char*, int);'
12011         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12012         esac
12013         case "$getgrent_r_proto" in
12014         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12015         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12016         esac
12017         case "$getgrent_r_proto" in
12018         ''|0)   d_getgrent_r=undef
12019                 getgrent_r_proto=0
12020                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12021         * )     case "$getgrent_r_proto" in
12022                 REENTRANT_PROTO*) ;;
12023                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12024                 esac
12025                 echo "Prototype: $try" ;;
12026         esac
12027         ;;
12028         *)      case "$usethreads" in
12029                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12030                 esac
12031                 d_getgrent_r=undef
12032                 getgrent_r_proto=0
12033                 ;;
12034         esac
12035         ;;
12036 *)      getgrent_r_proto=0
12037         ;;
12038 esac
12039
12040 : see if getgrgid_r exists
12041 set getgrgid_r d_getgrgid_r
12042 eval $inlibc
12043 case "$d_getgrgid_r" in
12044 "$define")
12045         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12046         case "$d_getgrgid_r_proto:$usethreads" in
12047         ":define")      d_getgrgid_r_proto=define
12048                 set d_getgrgid_r_proto getgrgid_r $hdrs
12049                 eval $hasproto ;;
12050         *)      ;;
12051         esac
12052         case "$d_getgrgid_r_proto" in
12053         define)
12054         case "$getgrgid_r_proto" in
12055         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12056         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12057         esac
12058         case "$getgrgid_r_proto" in
12059         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12060         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12061         esac
12062         case "$getgrgid_r_proto" in
12063         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12064         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12065         esac
12066         case "$getgrgid_r_proto" in
12067         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12068         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12069         esac
12070         case "$getgrgid_r_proto" in
12071         ''|0)   d_getgrgid_r=undef
12072                 getgrgid_r_proto=0
12073                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12074         * )     case "$getgrgid_r_proto" in
12075                 REENTRANT_PROTO*) ;;
12076                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12077                 esac
12078                 echo "Prototype: $try" ;;
12079         esac
12080         ;;
12081         *)      case "$usethreads" in
12082                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12083                 esac
12084                 d_getgrgid_r=undef
12085                 getgrgid_r_proto=0
12086                 ;;
12087         esac
12088         ;;
12089 *)      getgrgid_r_proto=0
12090         ;;
12091 esac
12092
12093 : see if getgrnam_r exists
12094 set getgrnam_r d_getgrnam_r
12095 eval $inlibc
12096 case "$d_getgrnam_r" in
12097 "$define")
12098         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12099         case "$d_getgrnam_r_proto:$usethreads" in
12100         ":define")      d_getgrnam_r_proto=define
12101                 set d_getgrnam_r_proto getgrnam_r $hdrs
12102                 eval $hasproto ;;
12103         *)      ;;
12104         esac
12105         case "$d_getgrnam_r_proto" in
12106         define)
12107         case "$getgrnam_r_proto" in
12108         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12109         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12110         esac
12111         case "$getgrnam_r_proto" in
12112         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12113         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12114         esac
12115         case "$getgrnam_r_proto" in
12116         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12117         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12118         esac
12119         case "$getgrnam_r_proto" in
12120         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12121         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12122         esac
12123         case "$getgrnam_r_proto" in
12124         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12125         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12126         esac
12127         case "$getgrnam_r_proto" in
12128         ''|0)   d_getgrnam_r=undef
12129                 getgrnam_r_proto=0
12130                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12131         * )     case "$getgrnam_r_proto" in
12132                 REENTRANT_PROTO*) ;;
12133                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12134                 esac
12135                 echo "Prototype: $try" ;;
12136         esac
12137         ;;
12138         *)      case "$usethreads" in
12139                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12140                 esac
12141                 d_getgrnam_r=undef
12142                 getgrnam_r_proto=0
12143                 ;;
12144         esac
12145         ;;
12146 *)      getgrnam_r_proto=0
12147         ;;
12148 esac
12149
12150 : see if gethostbyaddr exists
12151 set gethostbyaddr d_gethbyaddr
12152 eval $inlibc
12153
12154 : see if gethostbyname exists
12155 set gethostbyname d_gethbyname
12156 eval $inlibc
12157
12158 : see if gethostent exists
12159 set gethostent d_gethent
12160 eval $inlibc
12161
12162 : see how we will look up host name
12163 echo " "
12164 call=''
12165 if set gethostname val -f d_gethname; eval $csym; $val; then
12166         echo 'gethostname() found.' >&4
12167         d_gethname="$define"
12168         call=gethostname
12169 fi
12170 if set uname val -f d_uname; eval $csym; $val; then
12171         if ./xenix; then
12172                 $cat <<'EOM'
12173 uname() was found, but you're running xenix, and older versions of xenix
12174 have a broken uname(). If you don't really know whether your xenix is old
12175 enough to have a broken system call, use the default answer.
12176
12177 EOM
12178                 dflt=y
12179                 case "$d_uname" in
12180                 "$define") dflt=n;;
12181                 esac
12182                 rp='Is your uname() broken?'
12183                 . ./myread
12184                 case "$ans" in
12185                 n*) d_uname="$define"; call=uname;;
12186                 esac
12187         else
12188                 echo 'uname() found.' >&4
12189                 d_uname="$define"
12190                 case "$call" in
12191                 '') call=uname ;;
12192                 esac
12193         fi
12194 fi
12195 case "$d_gethname" in
12196 '') d_gethname="$undef";;
12197 esac
12198 case "$d_uname" in
12199 '') d_uname="$undef";;
12200 esac
12201 case "$d_uname$d_gethname" in
12202 *define*)
12203         dflt=n
12204         cat <<EOM
12205  
12206 Every now and then someone has a $call() that lies about the hostname
12207 but can't be fixed for political or economic reasons.  If you wish, I can
12208 pretend $call() isn't there and maybe compute hostname at run-time
12209 thanks to the '$phostname' command.
12210
12211 EOM
12212         rp="Shall I ignore $call() from now on?"
12213         . ./myread
12214         case "$ans" in
12215         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12216         esac;;
12217 esac
12218 case "$phostname" in
12219 '') aphostname='';;
12220 *) case "$aphostname" in
12221         /*) ;;
12222         *) set X $phostname
12223                 shift
12224                 file=$1
12225                 shift
12226                 file=`./loc $file $file $pth`
12227                 aphostname=`echo $file $*`
12228                 ;;
12229         esac
12230         ;;
12231 esac
12232 case "$d_uname$d_gethname" in
12233 *define*) ;;
12234 *)
12235         case "$phostname" in
12236         '')
12237                 echo "There will be no way for $package to get your hostname." >&4;;
12238         *)
12239         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12240                 ;;
12241         esac;;
12242 esac
12243 case "$d_phostname" in
12244 '') d_phostname="$undef";;
12245 esac
12246
12247 : see if gethostbyaddr_r exists
12248 set gethostbyaddr_r d_gethostbyaddr_r
12249 eval $inlibc
12250 case "$d_gethostbyaddr_r" in
12251 "$define")
12252         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12253         case "$d_gethostbyaddr_r_proto:$usethreads" in
12254         ":define")      d_gethostbyaddr_r_proto=define
12255                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12256                 eval $hasproto ;;
12257         *)      ;;
12258         esac
12259         case "$d_gethostbyaddr_r_proto" in
12260         define)
12261         case "$gethostbyaddr_r_proto" in
12262         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12263         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12264         esac
12265         case "$gethostbyaddr_r_proto" in
12266         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12267         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12268         esac
12269         case "$gethostbyaddr_r_proto" in
12270         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12271         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12272         esac
12273         case "$gethostbyaddr_r_proto" in
12274         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12275         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12276         esac
12277         case "$gethostbyaddr_r_proto" in
12278         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12279         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12280         esac
12281         case "$gethostbyaddr_r_proto" in
12282         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12283         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12284         esac
12285         case "$gethostbyaddr_r_proto" in
12286         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12287         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12288         esac
12289         case "$gethostbyaddr_r_proto" in
12290         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12291         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12292         esac
12293         case "$gethostbyaddr_r_proto" in
12294         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12295         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12296         esac
12297         case "$gethostbyaddr_r_proto" in
12298         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12299         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12300         esac
12301         case "$gethostbyaddr_r_proto" in
12302         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12303         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12304         esac
12305         case "$gethostbyaddr_r_proto" in
12306         ''|0)   d_gethostbyaddr_r=undef
12307                 gethostbyaddr_r_proto=0
12308                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12309         * )     case "$gethostbyaddr_r_proto" in
12310                 REENTRANT_PROTO*) ;;
12311                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12312                 esac
12313                 echo "Prototype: $try" ;;
12314         esac
12315         ;;
12316         *)      case "$usethreads" in
12317                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12318                 esac
12319                 d_gethostbyaddr_r=undef
12320                 gethostbyaddr_r_proto=0
12321                 ;;
12322         esac
12323         ;;
12324 *)      gethostbyaddr_r_proto=0
12325         ;;
12326 esac
12327
12328 : see if gethostbyname_r exists
12329 set gethostbyname_r d_gethostbyname_r
12330 eval $inlibc
12331 case "$d_gethostbyname_r" in
12332 "$define")
12333         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12334         case "$d_gethostbyname_r_proto:$usethreads" in
12335         ":define")      d_gethostbyname_r_proto=define
12336                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12337                 eval $hasproto ;;
12338         *)      ;;
12339         esac
12340         case "$d_gethostbyname_r_proto" in
12341         define)
12342         case "$gethostbyname_r_proto" in
12343         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12344         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12345         esac
12346         case "$gethostbyname_r_proto" in
12347         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12348         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12349         esac
12350         case "$gethostbyname_r_proto" in
12351         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12352         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12353         esac
12354         case "$gethostbyname_r_proto" in
12355         ''|0)   d_gethostbyname_r=undef
12356                 gethostbyname_r_proto=0
12357                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12358         * )     case "$gethostbyname_r_proto" in
12359                 REENTRANT_PROTO*) ;;
12360                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12361                 esac
12362                 echo "Prototype: $try" ;;
12363         esac
12364         ;;
12365         *)      case "$usethreads" in
12366                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12367                 esac
12368                 d_gethostbyname_r=undef
12369                 gethostbyname_r_proto=0
12370                 ;;
12371         esac
12372         ;;
12373 *)      gethostbyname_r_proto=0
12374         ;;
12375 esac
12376
12377 : see if gethostent_r exists
12378 set gethostent_r d_gethostent_r
12379 eval $inlibc
12380 case "$d_gethostent_r" in
12381 "$define")
12382         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12383         case "$d_gethostent_r_proto:$usethreads" in
12384         ":define")      d_gethostent_r_proto=define
12385                 set d_gethostent_r_proto gethostent_r $hdrs
12386                 eval $hasproto ;;
12387         *)      ;;
12388         esac
12389         case "$d_gethostent_r_proto" in
12390         define)
12391         case "$gethostent_r_proto" in
12392         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12393         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12394         esac
12395         case "$gethostent_r_proto" in
12396         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12397         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12398         esac
12399         case "$gethostent_r_proto" in
12400         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12401         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12402         esac
12403         case "$gethostent_r_proto" in
12404         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12405         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12406         esac
12407         case "$gethostent_r_proto" in
12408         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12409         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12410         esac
12411         case "$gethostent_r_proto" in
12412         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12413         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12414         esac
12415         case "$gethostent_r_proto" in
12416         ''|0)   d_gethostent_r=undef
12417                 gethostent_r_proto=0
12418                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12419         * )     case "$gethostent_r_proto" in
12420                 REENTRANT_PROTO*) ;;
12421                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12422                 esac
12423                 echo "Prototype: $try" ;;
12424         esac
12425         ;;
12426         *)      case "$usethreads" in
12427                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12428                 esac
12429                 d_gethostent_r=undef
12430                 gethostent_r_proto=0
12431                 ;;
12432         esac
12433         ;;
12434 *)      gethostent_r_proto=0
12435         ;;
12436 esac
12437
12438 : see if prototypes for various gethostxxx netdb.h functions are available
12439 echo " "
12440 set d_gethostprotos gethostent $i_netdb netdb.h
12441 eval $hasproto
12442
12443 : see if getitimer exists
12444 set getitimer d_getitimer
12445 eval $inlibc
12446
12447 : see if getlogin exists
12448 set getlogin d_getlogin
12449 eval $inlibc
12450
12451 : see if getlogin_r exists
12452 set getlogin_r d_getlogin_r
12453 eval $inlibc
12454 case "$d_getlogin_r" in
12455 "$define")
12456         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12457         case "$d_getlogin_r_proto:$usethreads" in
12458         ":define")      d_getlogin_r_proto=define
12459                 set d_getlogin_r_proto getlogin_r $hdrs
12460                 eval $hasproto ;;
12461         *)      ;;
12462         esac
12463         case "$d_getlogin_r_proto" in
12464         define)
12465         case "$getlogin_r_proto" in
12466         ''|0) try='int getlogin_r(char*, size_t);'
12467         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12468         esac
12469         case "$getlogin_r_proto" in
12470         ''|0) try='int getlogin_r(char*, int);'
12471         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12472         esac
12473         case "$getlogin_r_proto" in
12474         ''|0) try='char* getlogin_r(char*, size_t);'
12475         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12476         esac
12477         case "$getlogin_r_proto" in
12478         ''|0) try='char* getlogin_r(char*, int);'
12479         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12480         esac
12481         case "$getlogin_r_proto" in
12482         ''|0)   d_getlogin_r=undef
12483                 getlogin_r_proto=0
12484                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12485         * )     case "$getlogin_r_proto" in
12486                 REENTRANT_PROTO*) ;;
12487                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12488                 esac
12489                 echo "Prototype: $try" ;;
12490         esac
12491         ;;
12492         *)      case "$usethreads" in
12493                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12494                 esac
12495                 d_getlogin_r=undef
12496                 getlogin_r_proto=0
12497                 ;;
12498         esac
12499         ;;
12500 *)      getlogin_r_proto=0
12501         ;;
12502 esac
12503
12504 : see if getmnt exists
12505 set getmnt d_getmnt
12506 eval $inlibc
12507
12508 : see if getmntent exists
12509 set getmntent d_getmntent
12510 eval $inlibc
12511
12512 : see if getnetbyaddr exists
12513 set getnetbyaddr d_getnbyaddr
12514 eval $inlibc
12515
12516 : see if getnetbyname exists
12517 set getnetbyname d_getnbyname
12518 eval $inlibc
12519
12520 : see if getnetent exists
12521 set getnetent d_getnent
12522 eval $inlibc
12523
12524 : see if getnetbyaddr_r exists
12525 set getnetbyaddr_r d_getnetbyaddr_r
12526 eval $inlibc
12527 case "$d_getnetbyaddr_r" in
12528 "$define")
12529         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12530         case "$d_getnetbyaddr_r_proto:$usethreads" in
12531         ":define")      d_getnetbyaddr_r_proto=define
12532                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12533                 eval $hasproto ;;
12534         *)      ;;
12535         esac
12536         case "$d_getnetbyaddr_r_proto" in
12537         define)
12538         case "$getnetbyaddr_r_proto" in
12539         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12540         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12541         esac
12542         case "$getnetbyaddr_r_proto" in
12543         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12544         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12545         esac
12546         case "$getnetbyaddr_r_proto" in
12547         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12548         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12549         esac
12550         case "$getnetbyaddr_r_proto" in
12551         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12552         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12553         esac
12554         case "$getnetbyaddr_r_proto" in
12555         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12556         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12557         esac
12558         case "$getnetbyaddr_r_proto" in
12559         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12560         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12561         esac
12562         case "$getnetbyaddr_r_proto" in
12563         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12564         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12565         esac
12566         case "$getnetbyaddr_r_proto" in
12567         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12568         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12569         esac
12570         case "$getnetbyaddr_r_proto" in
12571         ''|0)   d_getnetbyaddr_r=undef
12572                 getnetbyaddr_r_proto=0
12573                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12574         * )     case "$getnetbyaddr_r_proto" in
12575                 REENTRANT_PROTO*) ;;
12576                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12577                 esac
12578                 echo "Prototype: $try" ;;
12579         esac
12580         ;;
12581         *)      case "$usethreads" in
12582                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12583                 esac
12584                 d_getnetbyaddr_r=undef
12585                 getnetbyaddr_r_proto=0
12586                 ;;
12587         esac
12588         ;;
12589 *)      getnetbyaddr_r_proto=0
12590         ;;
12591 esac
12592
12593 : see if getnetbyname_r exists
12594 set getnetbyname_r d_getnetbyname_r
12595 eval $inlibc
12596 case "$d_getnetbyname_r" in
12597 "$define")
12598         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12599         case "$d_getnetbyname_r_proto:$usethreads" in
12600         ":define")      d_getnetbyname_r_proto=define
12601                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12602                 eval $hasproto ;;
12603         *)      ;;
12604         esac
12605         case "$d_getnetbyname_r_proto" in
12606         define)
12607         case "$getnetbyname_r_proto" in
12608         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12609         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12610         esac
12611         case "$getnetbyname_r_proto" in
12612         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12613         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12614         esac
12615         case "$getnetbyname_r_proto" in
12616         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12617         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12618         esac
12619         case "$getnetbyname_r_proto" in
12620         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12621         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12622         esac
12623         case "$getnetbyname_r_proto" in
12624         ''|0)   d_getnetbyname_r=undef
12625                 getnetbyname_r_proto=0
12626                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12627         * )     case "$getnetbyname_r_proto" in
12628                 REENTRANT_PROTO*) ;;
12629                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12630                 esac
12631                 echo "Prototype: $try" ;;
12632         esac
12633         ;;
12634         *)      case "$usethreads" in
12635                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12636                 esac
12637                 d_getnetbyname_r=undef
12638                 getnetbyname_r_proto=0
12639                 ;;
12640         esac
12641         ;;
12642 *)      getnetbyname_r_proto=0
12643         ;;
12644 esac
12645
12646 : see if getnetent_r exists
12647 set getnetent_r d_getnetent_r
12648 eval $inlibc
12649 case "$d_getnetent_r" in
12650 "$define")
12651         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12652         case "$d_getnetent_r_proto:$usethreads" in
12653         ":define")      d_getnetent_r_proto=define
12654                 set d_getnetent_r_proto getnetent_r $hdrs
12655                 eval $hasproto ;;
12656         *)      ;;
12657         esac
12658         case "$d_getnetent_r_proto" in
12659         define)
12660         case "$getnetent_r_proto" in
12661         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12662         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12663         esac
12664         case "$getnetent_r_proto" in
12665         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12666         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12667         esac
12668         case "$getnetent_r_proto" in
12669         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12670         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12671         esac
12672         case "$getnetent_r_proto" in
12673         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12674         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12675         esac
12676         case "$getnetent_r_proto" in
12677         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12678         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12679         esac
12680         case "$getnetent_r_proto" in
12681         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12682         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12683         esac
12684         case "$getnetent_r_proto" in
12685         ''|0)   d_getnetent_r=undef
12686                 getnetent_r_proto=0
12687                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12688         * )     case "$getnetent_r_proto" in
12689                 REENTRANT_PROTO*) ;;
12690                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12691                 esac
12692                 echo "Prototype: $try" ;;
12693         esac
12694         ;;
12695         *)      case "$usethreads" in
12696                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12697                 esac
12698                 d_getnetent_r=undef
12699                 getnetent_r_proto=0
12700                 ;;
12701         esac
12702         ;;
12703 *)      getnetent_r_proto=0
12704         ;;
12705 esac
12706
12707 : see if prototypes for various getnetxxx netdb.h functions are available
12708 echo " "
12709 set d_getnetprotos getnetent $i_netdb netdb.h
12710 eval $hasproto
12711
12712 : see if getpagesize exists
12713 set getpagesize d_getpagsz
12714 eval $inlibc
12715
12716
12717 : see if getprotobyname exists
12718 set getprotobyname d_getpbyname
12719 eval $inlibc
12720
12721 : see if getprotobynumber exists
12722 set getprotobynumber d_getpbynumber
12723 eval $inlibc
12724
12725 : see if getprotoent exists
12726 set getprotoent d_getpent
12727 eval $inlibc
12728
12729 : see if getpgid exists
12730 set getpgid d_getpgid
12731 eval $inlibc
12732
12733 : see if getpgrp2 exists
12734 set getpgrp2 d_getpgrp2
12735 eval $inlibc
12736
12737 : see if getppid exists
12738 set getppid d_getppid
12739 eval $inlibc
12740
12741 : see if getpriority exists
12742 set getpriority d_getprior
12743 eval $inlibc
12744
12745 : see if getprotobyname_r exists
12746 set getprotobyname_r d_getprotobyname_r
12747 eval $inlibc
12748 case "$d_getprotobyname_r" in
12749 "$define")
12750         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12751         case "$d_getprotobyname_r_proto:$usethreads" in
12752         ":define")      d_getprotobyname_r_proto=define
12753                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12754                 eval $hasproto ;;
12755         *)      ;;
12756         esac
12757         case "$d_getprotobyname_r_proto" in
12758         define)
12759         case "$getprotobyname_r_proto" in
12760         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12761         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12762         esac
12763         case "$getprotobyname_r_proto" in
12764         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12765         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12766         esac
12767         case "$getprotobyname_r_proto" in
12768         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12769         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12770         esac
12771         case "$getprotobyname_r_proto" in
12772         ''|0)   d_getprotobyname_r=undef
12773                 getprotobyname_r_proto=0
12774                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12775         * )     case "$getprotobyname_r_proto" in
12776                 REENTRANT_PROTO*) ;;
12777                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12778                 esac
12779                 echo "Prototype: $try" ;;
12780         esac
12781         ;;
12782         *)      case "$usethreads" in
12783                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12784                 esac
12785                 d_getprotobyname_r=undef
12786                 getprotobyname_r_proto=0
12787                 ;;
12788         esac
12789         ;;
12790 *)      getprotobyname_r_proto=0
12791         ;;
12792 esac
12793
12794 : see if getprotobynumber_r exists
12795 set getprotobynumber_r d_getprotobynumber_r
12796 eval $inlibc
12797 case "$d_getprotobynumber_r" in
12798 "$define")
12799         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12800         case "$d_getprotobynumber_r_proto:$usethreads" in
12801         ":define")      d_getprotobynumber_r_proto=define
12802                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12803                 eval $hasproto ;;
12804         *)      ;;
12805         esac
12806         case "$d_getprotobynumber_r_proto" in
12807         define)
12808         case "$getprotobynumber_r_proto" in
12809         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12810         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12811         esac
12812         case "$getprotobynumber_r_proto" in
12813         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12814         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12815         esac
12816         case "$getprotobynumber_r_proto" in
12817         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12818         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12819         esac
12820         case "$getprotobynumber_r_proto" in
12821         ''|0)   d_getprotobynumber_r=undef
12822                 getprotobynumber_r_proto=0
12823                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12824         * )     case "$getprotobynumber_r_proto" in
12825                 REENTRANT_PROTO*) ;;
12826                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12827                 esac
12828                 echo "Prototype: $try" ;;
12829         esac
12830         ;;
12831         *)      case "$usethreads" in
12832                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12833                 esac
12834                 d_getprotobynumber_r=undef
12835                 getprotobynumber_r_proto=0
12836                 ;;
12837         esac
12838         ;;
12839 *)      getprotobynumber_r_proto=0
12840         ;;
12841 esac
12842
12843 : see if getprotoent_r exists
12844 set getprotoent_r d_getprotoent_r
12845 eval $inlibc
12846 case "$d_getprotoent_r" in
12847 "$define")
12848         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12849         case "$d_getprotoent_r_proto:$usethreads" in
12850         ":define")      d_getprotoent_r_proto=define
12851                 set d_getprotoent_r_proto getprotoent_r $hdrs
12852                 eval $hasproto ;;
12853         *)      ;;
12854         esac
12855         case "$d_getprotoent_r_proto" in
12856         define)
12857         case "$getprotoent_r_proto" in
12858         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12859         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12860         esac
12861         case "$getprotoent_r_proto" in
12862         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12863         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12864         esac
12865         case "$getprotoent_r_proto" in
12866         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12867         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12868         esac
12869         case "$getprotoent_r_proto" in
12870         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12871         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12872         esac
12873         case "$getprotoent_r_proto" in
12874         ''|0)   d_getprotoent_r=undef
12875                 getprotoent_r_proto=0
12876                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12877         * )     case "$getprotoent_r_proto" in
12878                 REENTRANT_PROTO*) ;;
12879                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12880                 esac
12881                 echo "Prototype: $try" ;;
12882         esac
12883         ;;
12884         *)      case "$usethreads" in
12885                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12886                 esac
12887                 d_getprotoent_r=undef
12888                 getprotoent_r_proto=0
12889                 ;;
12890         esac
12891         ;;
12892 *)      getprotoent_r_proto=0
12893         ;;
12894 esac
12895
12896 : see if prototypes for various getprotoxxx netdb.h functions are available
12897 echo " "
12898 set d_getprotoprotos getprotoent $i_netdb netdb.h
12899 eval $hasproto
12900
12901 : see if getprpwnam exists
12902 set getprpwnam d_getprpwnam
12903 eval $inlibc
12904
12905 : see if getpwent exists
12906 set getpwent d_getpwent
12907 eval $inlibc
12908
12909 : see if getpwent_r exists
12910 set getpwent_r d_getpwent_r
12911 eval $inlibc
12912 case "$d_getpwent_r" in
12913 "$define")
12914         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12915         case "$d_getpwent_r_proto:$usethreads" in
12916         ":define")      d_getpwent_r_proto=define
12917                 set d_getpwent_r_proto getpwent_r $hdrs
12918                 eval $hasproto ;;
12919         *)      ;;
12920         esac
12921         case "$d_getpwent_r_proto" in
12922         define)
12923         case "$getpwent_r_proto" in
12924         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12925         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12926         esac
12927         case "$getpwent_r_proto" in
12928         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12929         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12930         esac
12931         case "$getpwent_r_proto" in
12932         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12933         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12934         esac
12935         case "$getpwent_r_proto" in
12936         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12937         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12938         esac
12939         case "$getpwent_r_proto" in
12940         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12941         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12942         esac
12943         case "$getpwent_r_proto" in
12944         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12945         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12946         esac
12947         case "$getpwent_r_proto" in
12948         ''|0)   d_getpwent_r=undef
12949                 getpwent_r_proto=0
12950                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12951         * )     case "$getpwent_r_proto" in
12952                 REENTRANT_PROTO*) ;;
12953                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12954                 esac
12955                 echo "Prototype: $try" ;;
12956         esac
12957         ;;
12958         *)      case "$usethreads" in
12959                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12960                 esac
12961                 d_getpwent_r=undef
12962                 getpwent_r_proto=0
12963                 ;;
12964         esac
12965         ;;
12966 *)      getpwent_r_proto=0
12967         ;;
12968 esac
12969
12970 : see if getpwnam_r exists
12971 set getpwnam_r d_getpwnam_r
12972 eval $inlibc
12973 case "$d_getpwnam_r" in
12974 "$define")
12975         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12976         case "$d_getpwnam_r_proto:$usethreads" in
12977         ":define")      d_getpwnam_r_proto=define
12978                 set d_getpwnam_r_proto getpwnam_r $hdrs
12979                 eval $hasproto ;;
12980         *)      ;;
12981         esac
12982         case "$d_getpwnam_r_proto" in
12983         define)
12984         case "$getpwnam_r_proto" in
12985         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12986         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12987         esac
12988         case "$getpwnam_r_proto" in
12989         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12990         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12991         esac
12992         case "$getpwnam_r_proto" in
12993         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12994         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12995         esac
12996         case "$getpwnam_r_proto" in
12997         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12998         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12999         esac
13000         case "$getpwnam_r_proto" in
13001         ''|0)   d_getpwnam_r=undef
13002                 getpwnam_r_proto=0
13003                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13004         * )     case "$getpwnam_r_proto" in
13005                 REENTRANT_PROTO*) ;;
13006                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13007                 esac
13008                 echo "Prototype: $try" ;;
13009         esac
13010         ;;
13011         *)      case "$usethreads" in
13012                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13013                 esac
13014                 d_getpwnam_r=undef
13015                 getpwnam_r_proto=0
13016                 ;;
13017         esac
13018         ;;
13019 *)      getpwnam_r_proto=0
13020         ;;
13021 esac
13022
13023 : see if getpwuid_r exists
13024 set getpwuid_r d_getpwuid_r
13025 eval $inlibc
13026 case "$d_getpwuid_r" in
13027 "$define")
13028         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13029         case "$d_getpwuid_r_proto:$usethreads" in
13030         ":define")      d_getpwuid_r_proto=define
13031                 set d_getpwuid_r_proto getpwuid_r $hdrs
13032                 eval $hasproto ;;
13033         *)      ;;
13034         esac
13035         case "$d_getpwuid_r_proto" in
13036         define)
13037         case "$getpwuid_r_proto" in
13038         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13039         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13040         esac
13041         case "$getpwuid_r_proto" in
13042         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13043         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13044         esac
13045         case "$getpwuid_r_proto" in
13046         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13047         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13048         esac
13049         case "$getpwuid_r_proto" in
13050         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13051         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13052         esac
13053         case "$getpwuid_r_proto" in
13054         ''|0)   d_getpwuid_r=undef
13055                 getpwuid_r_proto=0
13056                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13057         * )     case "$getpwuid_r_proto" in
13058                 REENTRANT_PROTO*) ;;
13059                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13060                 esac
13061                 echo "Prototype: $try" ;;
13062         esac
13063         ;;
13064         *)      case "$usethreads" in
13065                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13066                 esac
13067                 d_getpwuid_r=undef
13068                 getpwuid_r_proto=0
13069                 ;;
13070         esac
13071         ;;
13072 *)      getpwuid_r_proto=0
13073         ;;
13074 esac
13075
13076
13077 : see if getservbyname exists
13078 set getservbyname d_getsbyname
13079 eval $inlibc
13080
13081 : see if getservbyport exists
13082 set getservbyport d_getsbyport
13083 eval $inlibc
13084
13085 : see if getservent exists
13086 set getservent d_getsent
13087 eval $inlibc
13088
13089 : see if getservbyname_r exists
13090 set getservbyname_r d_getservbyname_r
13091 eval $inlibc
13092 case "$d_getservbyname_r" in
13093 "$define")
13094         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13095         case "$d_getservbyname_r_proto:$usethreads" in
13096         ":define")      d_getservbyname_r_proto=define
13097                 set d_getservbyname_r_proto getservbyname_r $hdrs
13098                 eval $hasproto ;;
13099         *)      ;;
13100         esac
13101         case "$d_getservbyname_r_proto" in
13102         define)
13103         case "$getservbyname_r_proto" in
13104         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13105         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13106         esac
13107         case "$getservbyname_r_proto" in
13108         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13109         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13110         esac
13111         case "$getservbyname_r_proto" in
13112         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13113         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13114         esac
13115         case "$getservbyname_r_proto" in
13116         ''|0)   d_getservbyname_r=undef
13117                 getservbyname_r_proto=0
13118                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13119         * )     case "$getservbyname_r_proto" in
13120                 REENTRANT_PROTO*) ;;
13121                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13122                 esac
13123                 echo "Prototype: $try" ;;
13124         esac
13125         ;;
13126         *)      case "$usethreads" in
13127                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13128                 esac
13129                 d_getservbyname_r=undef
13130                 getservbyname_r_proto=0
13131                 ;;
13132         esac
13133         ;;
13134 *)      getservbyname_r_proto=0
13135         ;;
13136 esac
13137
13138 : see if getservbyport_r exists
13139 set getservbyport_r d_getservbyport_r
13140 eval $inlibc
13141 case "$d_getservbyport_r" in
13142 "$define")
13143         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13144         case "$d_getservbyport_r_proto:$usethreads" in
13145         ":define")      d_getservbyport_r_proto=define
13146                 set d_getservbyport_r_proto getservbyport_r $hdrs
13147                 eval $hasproto ;;
13148         *)      ;;
13149         esac
13150         case "$d_getservbyport_r_proto" in
13151         define)
13152         case "$getservbyport_r_proto" in
13153         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13154         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13155         esac
13156         case "$getservbyport_r_proto" in
13157         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13158         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13159         esac
13160         case "$getservbyport_r_proto" in
13161         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13162         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13163         esac
13164         case "$getservbyport_r_proto" in
13165         ''|0)   d_getservbyport_r=undef
13166                 getservbyport_r_proto=0
13167                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13168         * )     case "$getservbyport_r_proto" in
13169                 REENTRANT_PROTO*) ;;
13170                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13171                 esac
13172                 echo "Prototype: $try" ;;
13173         esac
13174         ;;
13175         *)      case "$usethreads" in
13176                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13177                 esac
13178                 d_getservbyport_r=undef
13179                 getservbyport_r_proto=0
13180                 ;;
13181         esac
13182         ;;
13183 *)      getservbyport_r_proto=0
13184         ;;
13185 esac
13186
13187 : see if getservent_r exists
13188 set getservent_r d_getservent_r
13189 eval $inlibc
13190 case "$d_getservent_r" in
13191 "$define")
13192         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13193         case "$d_getservent_r_proto:$usethreads" in
13194         ":define")      d_getservent_r_proto=define
13195                 set d_getservent_r_proto getservent_r $hdrs
13196                 eval $hasproto ;;
13197         *)      ;;
13198         esac
13199         case "$d_getservent_r_proto" in
13200         define)
13201         case "$getservent_r_proto" in
13202         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13203         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13204         esac
13205         case "$getservent_r_proto" in
13206         ''|0) try='int getservent_r(struct servent*, char*, int);'
13207         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13208         esac
13209         case "$getservent_r_proto" in
13210         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13211         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13212         esac
13213         case "$getservent_r_proto" in
13214         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13215         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13216         esac
13217         case "$getservent_r_proto" in
13218         ''|0)   d_getservent_r=undef
13219                 getservent_r_proto=0
13220                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13221         * )     case "$getservent_r_proto" in
13222                 REENTRANT_PROTO*) ;;
13223                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13224                 esac
13225                 echo "Prototype: $try" ;;
13226         esac
13227         ;;
13228         *)      case "$usethreads" in
13229                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13230                 esac
13231                 d_getservent_r=undef
13232                 getservent_r_proto=0
13233                 ;;
13234         esac
13235         ;;
13236 *)      getservent_r_proto=0
13237         ;;
13238 esac
13239
13240 : see if prototypes for various getservxxx netdb.h functions are available
13241 echo " "
13242 set d_getservprotos getservent $i_netdb netdb.h
13243 eval $hasproto
13244
13245 : see if getspnam exists
13246 set getspnam d_getspnam
13247 eval $inlibc
13248
13249 : see if this is a shadow.h system
13250 set shadow.h i_shadow
13251 eval $inhdr
13252
13253 : see if getspnam_r exists
13254 set getspnam_r d_getspnam_r
13255 eval $inlibc
13256 case "$d_getspnam_r" in
13257 "$define")
13258         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13259         case "$d_getspnam_r_proto:$usethreads" in
13260         ":define")      d_getspnam_r_proto=define
13261                 set d_getspnam_r_proto getspnam_r $hdrs
13262                 eval $hasproto ;;
13263         *)      ;;
13264         esac
13265         case "$d_getspnam_r_proto" in
13266         define)
13267         case "$getspnam_r_proto" in
13268         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13269         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13270         esac
13271         case "$getspnam_r_proto" in
13272         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13273         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13274         esac
13275         case "$getspnam_r_proto" in
13276         ''|0)   d_getspnam_r=undef
13277                 getspnam_r_proto=0
13278                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13279         * )     case "$getspnam_r_proto" in
13280                 REENTRANT_PROTO*) ;;
13281                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13282                 esac
13283                 echo "Prototype: $try" ;;
13284         esac
13285         ;;
13286         *)      case "$usethreads" in
13287                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13288                 esac
13289                 d_getspnam_r=undef
13290                 getspnam_r_proto=0
13291                 ;;
13292         esac
13293         ;;
13294 *)      getspnam_r_proto=0
13295         ;;
13296 esac
13297
13298 : see if gettimeofday or ftime exists
13299 set gettimeofday d_gettimeod
13300 eval $inlibc
13301 case "$d_gettimeod" in
13302 "$undef")
13303         set ftime d_ftime 
13304         eval $inlibc
13305         ;;
13306 *)
13307         val="$undef"; set d_ftime; eval $setvar
13308         ;;
13309 esac
13310 case "$d_gettimeod$d_ftime" in
13311 "$undef$undef")
13312         echo " "
13313         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13314         ;;
13315 esac
13316
13317 : see if gmtime_r exists
13318 set gmtime_r d_gmtime_r
13319 eval $inlibc
13320 case "$d_gmtime_r" in
13321 "$define")
13322         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13323         case "$d_gmtime_r_proto:$usethreads" in
13324         ":define")      d_gmtime_r_proto=define
13325                 set d_gmtime_r_proto gmtime_r $hdrs
13326                 eval $hasproto ;;
13327         *)      ;;
13328         esac
13329         case "$d_gmtime_r_proto" in
13330         define)
13331         case "$gmtime_r_proto" in
13332         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13333         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13334         esac
13335         case "$gmtime_r_proto" in
13336         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13337         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13338         esac
13339         case "$gmtime_r_proto" in
13340         ''|0)   d_gmtime_r=undef
13341                 gmtime_r_proto=0
13342                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13343         * )     case "$gmtime_r_proto" in
13344                 REENTRANT_PROTO*) ;;
13345                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13346                 esac
13347                 echo "Prototype: $try" ;;
13348         esac
13349         ;;
13350         *)      case "$usethreads" in
13351                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13352                 esac
13353                 d_gmtime_r=undef
13354                 gmtime_r_proto=0
13355                 ;;
13356         esac
13357         ;;
13358 *)      gmtime_r_proto=0
13359         ;;
13360 esac
13361
13362 : see if hasmntopt exists
13363 set hasmntopt d_hasmntopt
13364 eval $inlibc
13365
13366 : see if this is a netinet/in.h or sys/in.h system
13367 set netinet/in.h i_niin sys/in.h i_sysin
13368 eval $inhdr
13369
13370 : see if arpa/inet.h has to be included
13371 set arpa/inet.h i_arpainet
13372 eval $inhdr
13373
13374 : see if htonl --and friends-- exists
13375 val=''
13376 set htonl val
13377 eval $inlibc
13378
13379 : Maybe they are macros.
13380 case "$val" in
13381 $undef)
13382         $cat >htonl.c <<EOM
13383 #include <stdio.h>
13384 #include <sys/types.h>
13385 #$i_niin I_NETINET_IN
13386 #$i_sysin I_SYS_IN
13387 #$i_arpainet I_ARPA_INET
13388 #ifdef I_NETINET_IN
13389 #include <netinet/in.h>
13390 #endif
13391 #ifdef I_SYS_IN
13392 #include <sys/in.h>
13393 #endif
13394 #ifdef I_ARPA_INET
13395 #include <arpa/inet.h>
13396 #endif
13397 #ifdef htonl
13398 printf("Defined as a macro.");
13399 #endif
13400 EOM
13401         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13402         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13403                 val="$define"
13404                 echo "But it seems to be defined as a macro." >&4
13405         fi
13406         $rm -f htonl.?
13407         ;;
13408 esac
13409 set d_htonl
13410 eval $setvar
13411
13412 : index or strchr
13413 echo " "
13414 if set index val -f; eval $csym; $val; then
13415         if set strchr val -f d_strchr; eval $csym; $val; then
13416                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13417                         val="$define"
13418                         vali="$undef"
13419                         echo "strchr() found." >&4
13420                 else
13421                         val="$undef"
13422                         vali="$define"
13423                         echo "index() found." >&4
13424                 fi
13425         else
13426                 val="$undef"
13427                 vali="$define"
13428                 echo "index() found." >&4
13429         fi
13430 else
13431         if set strchr val -f d_strchr; eval $csym; $val; then
13432                 val="$define"
13433                 vali="$undef"
13434                 echo "strchr() found." >&4
13435         else
13436                 echo "No index() or strchr() found!" >&4
13437                 val="$undef"
13438                 vali="$undef"
13439         fi
13440 fi
13441 set d_strchr; eval $setvar
13442 val="$vali"
13443 set d_index; eval $setvar
13444
13445 : check whether inet_aton exists
13446 set inet_aton d_inetaton
13447 eval $inlibc
13448
13449 : Look for isascii
13450 echo " "
13451 $cat >isascii.c <<'EOCP'
13452 #include <stdio.h>
13453 #include <ctype.h>
13454 int main() {
13455         int c = 'A';
13456         if (isascii(c))
13457                 exit(0);
13458         else
13459                 exit(1);
13460 }
13461 EOCP
13462 set isascii
13463 if eval $compile; then
13464         echo "isascii() found." >&4
13465         val="$define"
13466 else
13467         echo "isascii() NOT found." >&4
13468         val="$undef"
13469 fi
13470 set d_isascii
13471 eval $setvar
13472 $rm -f isascii*
13473
13474 : see if isfinite exists
13475 set isfinite d_isfinite
13476 eval $inlibc
13477
13478 : see if isinf exists
13479 set isinf d_isinf
13480 eval $inlibc
13481
13482 : see if isnan exists
13483 set isnan d_isnan
13484 eval $inlibc
13485
13486 : see if isnanl exists
13487 set isnanl d_isnanl
13488 eval $inlibc
13489
13490 : see if killpg exists
13491 set killpg d_killpg
13492 eval $inlibc
13493
13494 : see if lchown exists
13495 echo " "
13496 $cat > try.c <<'EOCP'
13497 /* System header to define __stub macros and hopefully few prototypes,
13498     which can conflict with char lchown(); below.  */
13499 #include <assert.h>
13500 /* Override any gcc2 internal prototype to avoid an error.  */
13501 /* We use char because int might match the return type of a gcc2
13502    builtin and then its argument prototype would still apply.  */
13503 char lchown();
13504 int main() {
13505     /*  The GNU C library defines this for functions which it implements
13506         to always fail with ENOSYS.  Some functions are actually named
13507         something starting with __ and the normal name is an alias.  */
13508 #if defined (__stub_lchown) || defined (__stub___lchown)
13509 choke me
13510 #else
13511 lchown();
13512 #endif
13513 ; return 0; }
13514 EOCP
13515 set try
13516 if eval $compile; then
13517     $echo "lchown() found." >&4
13518     val="$define"
13519 else
13520     $echo "lchown() NOT found." >&4
13521     val="$undef"
13522 fi
13523 set d_lchown
13524 eval $setvar
13525
13526 : See if number of significant digits in a double precision number is known
13527 echo " "
13528 $cat >ldbl_dig.c <<EOM
13529 #$i_limits I_LIMITS
13530 #$i_float I_FLOAT
13531 #ifdef I_LIMITS
13532 #include <limits.h>
13533 #endif
13534 #ifdef I_FLOAT
13535 #include <float.h>
13536 #endif
13537 #ifdef LDBL_DIG
13538 printf("Contains LDBL_DIG");
13539 #endif
13540 EOM
13541 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13542 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13543         echo "LDBL_DIG found." >&4
13544         val="$define"
13545 else
13546         echo "LDBL_DIG NOT found." >&4
13547         val="$undef"
13548 fi
13549 $rm -f ldbl_dig.?
13550 set d_ldbl_dig
13551 eval $setvar
13552
13553 : see if link exists
13554 set link d_link
13555 eval $inlibc
13556
13557 : see if localtime_r exists
13558 set localtime_r d_localtime_r
13559 eval $inlibc
13560 case "$d_localtime_r" in
13561 "$define")
13562         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13563         case "$d_localtime_r_proto:$usethreads" in
13564         ":define")      d_localtime_r_proto=define
13565                 set d_localtime_r_proto localtime_r $hdrs
13566                 eval $hasproto ;;
13567         *)      ;;
13568         esac
13569         case "$d_localtime_r_proto" in
13570         define)
13571         case "$localtime_r_proto" in
13572         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13573         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13574         esac
13575         case "$localtime_r_proto" in
13576         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13577         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13578         esac
13579         case "$localtime_r_proto" in
13580         ''|0)   d_localtime_r=undef
13581                 localtime_r_proto=0
13582                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13583         * )     case "$localtime_r_proto" in
13584                 REENTRANT_PROTO*) ;;
13585                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13586                 esac
13587                 echo "Prototype: $try" ;;
13588         esac
13589         ;;
13590         *)      case "$usethreads" in
13591                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13592                 esac
13593                 d_localtime_r=undef
13594                 localtime_r_proto=0
13595                 ;;
13596         esac
13597         ;;
13598 *)      localtime_r_proto=0
13599         ;;
13600 esac
13601
13602 : see if localeconv exists
13603 set localeconv d_locconv
13604 eval $inlibc
13605
13606 : see if lockf exists
13607 set lockf d_lockf
13608 eval $inlibc
13609
13610 : see if prototype for lseek is available
13611 echo " "
13612 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13613 eval $hasproto
13614
13615 : see if lstat exists
13616 set lstat d_lstat
13617 eval $inlibc
13618
13619 : see if madvise exists
13620 set madvise d_madvise
13621 eval $inlibc
13622
13623 : see if mblen exists
13624 set mblen d_mblen
13625 eval $inlibc
13626
13627 : see if mbstowcs exists
13628 set mbstowcs d_mbstowcs
13629 eval $inlibc
13630
13631 : see if mbtowc exists
13632 set mbtowc d_mbtowc
13633 eval $inlibc
13634
13635 : see if memchr exists
13636 set memchr d_memchr
13637 eval $inlibc
13638
13639 : see if memcmp exists
13640 set memcmp d_memcmp
13641 eval $inlibc
13642
13643 : see if memcpy exists
13644 set memcpy d_memcpy
13645 eval $inlibc
13646
13647 : see if memmove exists
13648 set memmove d_memmove
13649 eval $inlibc
13650
13651 : see if memset exists
13652 set memset d_memset
13653 eval $inlibc
13654
13655 : see if mkdir exists
13656 set mkdir d_mkdir
13657 eval $inlibc
13658
13659 : see if mkdtemp exists
13660 set mkdtemp d_mkdtemp
13661 eval $inlibc
13662
13663 : see if mkfifo exists
13664 set mkfifo d_mkfifo
13665 eval $inlibc
13666
13667 : see if mkstemp exists
13668 set mkstemp d_mkstemp
13669 eval $inlibc
13670
13671 : see if mkstemps exists
13672 set mkstemps d_mkstemps
13673 eval $inlibc
13674
13675 : see if mktime exists
13676 set mktime d_mktime
13677 eval $inlibc
13678
13679 : see if this is a sys/mman.h system
13680 set sys/mman.h i_sysmman
13681 eval $inhdr
13682
13683 : see if mmap exists
13684 set mmap d_mmap
13685 eval $inlibc
13686 : see what shmat returns
13687 : default to something harmless
13688 mmaptype='void *'
13689 case "$i_sysmman$d_mmap" in
13690 "$define$define")
13691         $cat >mmap.c <<'END'
13692 #include <sys/mman.h>
13693 void *mmap();
13694 END
13695         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13696                 mmaptype='void *'
13697         else
13698                 mmaptype='caddr_t'
13699         fi
13700         echo "and it returns ($mmaptype)." >&4
13701         ;;
13702 esac
13703
13704
13705
13706 : see if mprotect exists
13707 set mprotect d_mprotect
13708 eval $inlibc
13709
13710 : see if msgctl exists
13711 set msgctl d_msgctl
13712 eval $inlibc
13713
13714 : see if msgget exists
13715 set msgget d_msgget
13716 eval $inlibc
13717
13718 : see if msgsnd exists
13719 set msgsnd d_msgsnd
13720 eval $inlibc
13721
13722 : see if msgrcv exists
13723 set msgrcv d_msgrcv
13724 eval $inlibc
13725
13726 : see how much of the 'msg*(2)' library is present.
13727 h_msg=true
13728 echo " "
13729 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13730 *"$undef"*) h_msg=false;;
13731 esac
13732 case "$osname" in
13733 freebsd)
13734     case "`ipcs 2>&1`" in
13735     "SVID messages"*"not configured"*)
13736         echo "Your $osname does not have the msg*(2) configured." >&4
13737         h_msg=false
13738         val="$undef"
13739         set msgctl d_msgctl
13740         eval $setvar
13741         set msgget d_msgget
13742         eval $setvar
13743         set msgsnd d_msgsnd
13744         eval $setvar
13745         set msgrcv d_msgrcv
13746         eval $setvar
13747         ;;
13748     esac
13749     ;;
13750 esac
13751 : we could also check for sys/ipc.h ...
13752 if $h_msg && $test `./findhdr sys/msg.h`; then
13753         echo "You have the full msg*(2) library." >&4
13754         val="$define"
13755 else
13756         echo "You don't have the full msg*(2) library." >&4
13757         val="$undef"
13758 fi
13759 set d_msg
13760 eval $setvar
13761
13762
13763 echo " "
13764 echo "Checking to see if your system supports struct msghdr..." >&4
13765 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13766 eval $hasstruct
13767 case "$d_msghdr_s" in
13768 "$define")      echo "Yes, it does."   ;;
13769 *)              echo "No, it doesn't." ;;
13770 esac
13771
13772
13773 : see if msync exists
13774 set msync d_msync
13775 eval $inlibc
13776
13777 : see if munmap exists
13778 set munmap d_munmap
13779 eval $inlibc
13780
13781 : see if nanosleep exists
13782 set nanosleep d_nanosleep
13783 eval $inlibc
13784
13785 : see if nice exists
13786 set nice d_nice
13787 eval $inlibc
13788
13789 : see if this is a langinfo.h system
13790 set langinfo.h i_langinfo
13791 eval $inhdr
13792
13793 : see if nl_langinfo exists
13794 set nl_langinfo d_nl_langinfo
13795 eval $inlibc
13796
13797 : check for length of character
13798 echo " "
13799 case "$charsize" in
13800 '')
13801         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13802         $cat >try.c <<'EOCP'
13803 #include <stdio.h>
13804 int main()
13805 {
13806     printf("%d\n", (int)sizeof(char));
13807     exit(0);
13808 }
13809 EOCP
13810         set try
13811         if eval $compile_ok; then
13812                 dflt=`$run ./try`
13813         else
13814                 dflt='1'
13815                 echo "(I can't seem to compile the test program.  Guessing...)"
13816         fi
13817         ;;
13818 *)
13819         dflt="$charsize"
13820         ;;
13821 esac
13822 rp="What is the size of a character (in bytes)?"
13823 . ./myread
13824 charsize="$ans"
13825 $rm -f try.c try
13826
13827 : check for volatile keyword
13828 echo " "
13829 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13830 $cat >try.c <<'EOCP'
13831 int main()
13832 {
13833         typedef struct _goo_struct goo_struct;
13834         goo_struct * volatile goo = ((goo_struct *)0);
13835         struct _goo_struct {
13836                 long long_int;
13837                 int reg_int;
13838                 char char_var;
13839         };
13840         typedef unsigned short foo_t;
13841         char *volatile foo;
13842         volatile int bar;
13843         volatile foo_t blech;
13844         foo = foo;
13845 }
13846 EOCP
13847 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13848         val="$define"
13849         echo "Yup, it does."
13850 else
13851         val="$undef"
13852         echo "Nope, it doesn't."
13853 fi
13854 set d_volatile
13855 eval $setvar
13856 $rm -f try.*
13857
13858
13859 echo " "
13860 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13861
13862 case "$use64bitint:$d_quad:$quadtype" in
13863 define:define:?*)
13864         ivtype="$quadtype"
13865         uvtype="$uquadtype"
13866         ivsize=8
13867         uvsize=8
13868         ;;
13869 *)      ivtype="long"
13870         uvtype="unsigned long"
13871         ivsize=$longsize
13872         uvsize=$longsize
13873         ;;
13874 esac
13875
13876 case "$uselongdouble:$d_longdbl" in
13877 define:define)
13878         nvtype="long double"
13879         nvsize=$longdblsize
13880         ;;
13881 *)      nvtype=double
13882         nvsize=$doublesize
13883         ;;
13884 esac
13885
13886 $echo "(IV will be "$ivtype", $ivsize bytes)"
13887 $echo "(UV will be "$uvtype", $uvsize bytes)"
13888 $echo "(NV will be "$nvtype", $nvsize bytes)"
13889
13890 $cat >try.c <<EOCP
13891 #$i_inttypes I_INTTYPES
13892 #ifdef I_INTTYPES
13893 #include <inttypes.h>
13894 #endif
13895 #include <stdio.h>
13896 int main() {
13897 #ifdef INT8
13898    int8_t i =  INT8_MAX;
13899   uint8_t u = UINT8_MAX;
13900   printf("int8_t\n");
13901 #endif
13902 #ifdef INT16
13903    int16_t i =  INT16_MAX;
13904   uint16_t i = UINT16_MAX;
13905   printf("int16_t\n");
13906 #endif
13907 #ifdef INT32
13908    int32_t i =  INT32_MAX;
13909   uint32_t u = UINT32_MAX;
13910   printf("int32_t\n");
13911 #endif
13912 }
13913 EOCP
13914
13915 case "$i8type" in
13916 '')     case "$charsize" in
13917         1)      i8type=char
13918                 u8type="unsigned char"
13919                 i8size=$charsize
13920                 u8size=$charsize
13921                 ;;
13922         esac
13923         ;;
13924 esac
13925 case "$i8type" in
13926 '')     set try -DINT8
13927         if eval $compile; then
13928                 case "`$run ./try`" in
13929                 int8_t) i8type=int8_t
13930                         u8type=uint8_t
13931                         i8size=1
13932                         u8size=1
13933                         ;;
13934                 esac
13935         fi
13936         ;;
13937 esac
13938 case "$i8type" in
13939 '')     if $test $charsize -ge 1; then
13940                 i8type=char
13941                 u8type="unsigned char"
13942                 i8size=$charsize
13943                 u8size=$charsize
13944         fi
13945         ;;
13946 esac
13947
13948 case "$i16type" in
13949 '')     case "$shortsize" in
13950         2)      i16type=short
13951                 u16type="unsigned short"
13952                 i16size=$shortsize
13953                 u16size=$shortsize
13954                 ;;
13955         esac
13956         ;;
13957 esac
13958 case "$i16type" in
13959 '')     set try -DINT16
13960         if eval $compile; then
13961                 case "`$run ./try`" in
13962                 int16_t)
13963                         i16type=int16_t
13964                         u16type=uint16_t
13965                         i16size=2
13966                         u16size=2
13967                         ;;
13968                 esac
13969         fi
13970         ;;
13971 esac
13972 case "$i16type" in
13973 '')     if $test $shortsize -ge 2; then
13974                 i16type=short
13975                 u16type="unsigned short"
13976                 i16size=$shortsize
13977                 u16size=$shortsize
13978         fi
13979         ;;
13980 esac
13981
13982 case "$i32type" in
13983 '')     case "$longsize" in
13984         4)      i32type=long
13985                 u32type="unsigned long"
13986                 i32size=$longsize
13987                 u32size=$longsize
13988                 ;;
13989         *)      case "$intsize" in
13990                 4)      i32type=int
13991                         u32type="unsigned int"
13992                         i32size=$intsize
13993                         u32size=$intsize
13994                         ;;
13995                 esac
13996                 ;;
13997         esac
13998         ;;
13999 esac
14000 case "$i32type" in
14001 '')     set try -DINT32
14002         if eval $compile; then
14003                 case "`$run ./try`" in
14004                 int32_t)
14005                         i32type=int32_t
14006                         u32type=uint32_t
14007                         i32size=4
14008                         u32size=4
14009                         ;;
14010                 esac
14011         fi
14012         ;;
14013 esac
14014 case "$i32type" in
14015 '')     if $test $intsize -ge 4; then
14016                 i32type=int
14017                 u32type="unsigned int"
14018                 i32size=$intsize
14019                 u32size=$intsize
14020         fi
14021         ;;
14022 esac
14023
14024 case "$i64type" in
14025 '')     case "$d_quad:$quadtype" in
14026         define:?*)
14027                 i64type="$quadtype"
14028                 u64type="$uquadtype"
14029                 i64size=8
14030                 u64size=8
14031                 ;;
14032         esac
14033         ;;
14034 esac
14035
14036 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14037 : volatile so that the compiler has to store it out to memory.
14038 if test X"$d_volatile" = X"$define"; then
14039         volatile=volatile
14040 fi
14041 $cat <<EOP >try.c
14042 #include <stdio.h>
14043 #include <sys/types.h>
14044 #include <signal.h>
14045 #ifdef SIGFPE
14046 $volatile int bletched = 0;
14047 $signal_t blech(s) int s; { bletched = 1; }
14048 #endif
14049 int main() {
14050     $uvtype u = 0;
14051     $nvtype d;
14052     int     n = 8 * $uvsize;
14053     int     i;
14054 #ifdef SIGFPE
14055     signal(SIGFPE, blech);
14056 #endif
14057
14058     for (i = 0; i < n; i++) {
14059       u = u << 1 | ($uvtype)1;
14060       d = ($nvtype)u;
14061       if (($uvtype)d != u)
14062         break;
14063       if (d <= 0)
14064         break;
14065       d = ($nvtype)(u - 1);
14066       if (($uvtype)d != (u - 1))
14067         break;
14068 #ifdef SIGFPE
14069       if (bletched) {
14070         break;
14071 #endif
14072       } 
14073     }
14074     printf("%d\n", ((i == n) ? -n : i));
14075     exit(0);
14076 }
14077 EOP
14078 set try
14079
14080 d_nv_preserves_uv="$undef"
14081 if eval $compile; then
14082         nv_preserves_uv_bits="`$run ./try`"
14083 fi
14084 case "$nv_preserves_uv_bits" in
14085 \-[1-9]*)       
14086         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14087         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14088         d_nv_preserves_uv="$define"
14089         ;;
14090 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14091         d_nv_preserves_uv="$undef" ;;
14092 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14093         nv_preserves_uv_bits="$undef" ;;
14094 esac
14095
14096 $rm -f try.* try
14097
14098
14099 : check for off64_t
14100 echo " "
14101 echo "Checking to see if you have off64_t..." >&4
14102 $cat >try.c <<EOCP
14103 #include <sys/types.h>
14104 #include <unistd.h>
14105 int main() { off64_t x = 7; }
14106 EOCP
14107 set try
14108 if eval $compile; then
14109         val="$define"
14110         echo "You have off64_t."
14111 else
14112         val="$undef"
14113         echo "You do not have off64_t."
14114         case "$lseeksize" in
14115         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14116         esac
14117 fi
14118 $rm -f try.* try
14119 set d_off64_t
14120 eval $setvar
14121
14122 : how to create joinable pthreads
14123 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14124         echo " "
14125         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14126         $cat >try.c <<'EOCP'
14127 #include <pthread.h>
14128 int main() {
14129     int detachstate = JOINABLE;
14130 }
14131 EOCP
14132         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14133         if eval $compile; then
14134                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14135                 val="$undef" # Yes, undef.
14136                 set d_old_pthread_create_joinable
14137                 eval $setvar
14138                 val=""
14139                 set old_pthread_create_joinable
14140                 eval $setvar
14141         else
14142                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14143                 if eval $compile; then
14144                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14145                         val="$define"
14146                         set d_old_pthread_create_joinable
14147                         eval $setvar
14148                         val=PTHREAD_CREATE_UNDETACHED
14149                         set old_pthread_create_joinable
14150                         eval $setvar
14151                 else            
14152                         set try -DJOINABLE=__UNDETACHED
14153                         if eval $compile; then
14154                                 echo "You seem to use __UNDETACHED." >&4
14155                                 val="$define"
14156                                 set d_old_pthread_create_joinable
14157                                 eval $setvar
14158                                 val=__UNDETACHED
14159                                 set old_pthread_create_joinable
14160                                 eval $setvar
14161                         else
14162                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14163                                 val="$define"
14164                                 set d_old_pthread_create_joinable
14165                                 eval $setvar
14166                                 val=0
14167                                 set old_pthread_create_joinable
14168                                 eval $setvar
14169                         fi
14170                 fi
14171         fi
14172         $rm -f try try.*
14173 else
14174     d_old_pthread_create_joinable="$undef"
14175     old_pthread_create_joinable=""
14176 fi
14177
14178 : see if pause exists
14179 set pause d_pause
14180 eval $inlibc
14181
14182 : see if pipe exists
14183 set pipe d_pipe
14184 eval $inlibc
14185
14186 : see if poll exists
14187 set poll d_poll
14188 eval $inlibc
14189
14190 : see if readlink exists
14191 set readlink d_readlink
14192 eval $inlibc
14193
14194 echo " "
14195 procselfexe=''
14196 val="$undef"
14197 case "$d_readlink" in
14198 "$define")
14199         if $issymlink /proc/self/exe ; then
14200                 $ls -l /proc/self/exe > reflect
14201                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14202                         echo "You have Linux-like /proc/self/exe."
14203                         procselfexe='"/proc/self/exe"'
14204                         val="$define"
14205                 fi
14206         fi
14207         if $issymlink /proc/curproc/file ; then
14208                 $ls -l /proc/curproc/file > reflect
14209                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14210                         echo "You have BSD-like /proc/curproc/file."
14211                         procselfexe='"/proc/curproc/file"'
14212                         val="$define"
14213                 fi
14214         fi
14215         ;;
14216 esac
14217 $rm -f reflect
14218 set d_procselfexe
14219 eval $setvar
14220
14221 : see whether the pthread_atfork exists
14222 $cat >try.c <<EOP
14223 #include <pthread.h>
14224 #include <stdio.h>
14225 int main() {
14226 #ifdef  PTHREAD_ATFORK
14227         pthread_atfork(NULL,NULL,NULL);
14228 #endif
14229 }
14230 EOP
14231
14232 : see if pthread_atfork exists
14233 set try -DPTHREAD_ATFORK
14234 if eval $compile; then
14235     val="$define"
14236 else
14237     val="$undef"
14238 fi
14239 case "$usethreads" in
14240 $define)
14241         case "$val" in
14242         $define) echo 'pthread_atfork found.' >&4        ;;
14243         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14244         esac
14245 esac
14246 set d_pthread_atfork
14247 eval $setvar
14248
14249
14250 : see whether the various POSIXish _yields exist
14251 $cat >try.c <<EOP
14252 #include <pthread.h>
14253 #include <stdio.h>
14254 int main() {
14255 #ifdef SCHED_YIELD
14256         sched_yield();
14257 #else
14258 #ifdef PTHREAD_YIELD
14259         pthread_yield();
14260 #else
14261 #ifdef PTHREAD_YIELD_NULL
14262         pthread_yield(NULL);
14263 #endif
14264 #endif
14265 #endif
14266 }
14267 EOP
14268 : see if sched_yield exists
14269 set try -DSCHED_YIELD
14270 if eval $compile; then
14271     val="$define"
14272     sched_yield='sched_yield()'
14273 else
14274     val="$undef"
14275 fi
14276 case "$usethreads" in
14277 $define)
14278         case "$val" in
14279         $define) echo 'sched_yield() found.' >&4        ;;
14280         *)       echo 'sched_yield() NOT found.' >&4    ;;
14281         esac
14282 esac
14283 set d_sched_yield
14284 eval $setvar
14285
14286 : see if pthread_yield exists
14287 set try -DPTHREAD_YIELD
14288 if eval $compile; then
14289     val="$define"
14290     case "$sched_yield" in
14291     '') sched_yield='pthread_yield()' ;;
14292     esac
14293 else
14294     set try -DPTHREAD_YIELD_NULL
14295     if eval $compile; then
14296         val="$define"
14297         case "$sched_yield" in
14298         '') sched_yield='pthread_yield(NULL)' ;;
14299         esac
14300     else
14301         val="$undef"
14302     fi
14303 fi
14304 case "$usethreads" in
14305 $define)
14306         case "$val" in
14307         $define) echo 'pthread_yield() found.' >&4      ;;
14308         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14309         esac
14310         ;;
14311 esac
14312 set d_pthread_yield
14313 eval $setvar
14314
14315 case "$sched_yield" in
14316 '') sched_yield=undef ;;
14317 esac
14318
14319 $rm -f try try.*
14320
14321 : see if random_r exists
14322 set random_r d_random_r
14323 eval $inlibc
14324 case "$d_random_r" in
14325 "$define")
14326         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14327         case "$d_random_r_proto:$usethreads" in
14328         ":define")      d_random_r_proto=define
14329                 set d_random_r_proto random_r $hdrs
14330                 eval $hasproto ;;
14331         *)      ;;
14332         esac
14333         case "$d_random_r_proto" in
14334         define)
14335         case "$random_r_proto" in
14336         ''|0) try='int random_r(int*, struct random_data*);'
14337         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14338         esac
14339         case "$random_r_proto" in
14340         ''|0) try='int random_r(long*, struct random_data*);'
14341         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14342         esac
14343         case "$random_r_proto" in
14344         ''|0) try='int random_r(struct random_data*, int32_t*);'
14345         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
14346         esac
14347         case "$random_r_proto" in
14348         ''|0)   d_random_r=undef
14349                 random_r_proto=0
14350                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14351         * )     case "$random_r_proto" in
14352                 REENTRANT_PROTO*) ;;
14353                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14354                 esac
14355                 echo "Prototype: $try" ;;
14356         esac
14357         ;;
14358         *)      case "$usethreads" in
14359                 define) echo "random_r has no prototype, not using it." >&4 ;;
14360                 esac
14361                 d_random_r=undef
14362                 random_r_proto=0
14363                 ;;
14364         esac
14365         ;;
14366 *)      random_r_proto=0
14367         ;;
14368 esac
14369
14370 : see if readdir and friends exist
14371 set readdir d_readdir
14372 eval $inlibc
14373 set seekdir d_seekdir
14374 eval $inlibc
14375 set telldir d_telldir
14376 eval $inlibc
14377 set rewinddir d_rewinddir
14378 eval $inlibc
14379
14380 : see if readdir64_r exists
14381 set readdir64_r d_readdir64_r
14382 eval $inlibc
14383 case "$d_readdir64_r" in
14384 "$define")
14385         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14386         case "$d_readdir64_r_proto:$usethreads" in
14387         ":define")      d_readdir64_r_proto=define
14388                 set d_readdir64_r_proto readdir64_r $hdrs
14389                 eval $hasproto ;;
14390         *)      ;;
14391         esac
14392         case "$d_readdir64_r_proto" in
14393         define)
14394         case "$readdir64_r_proto" in
14395         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14396         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14397         esac
14398         case "$readdir64_r_proto" in
14399         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14400         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14401         esac
14402         case "$readdir64_r_proto" in
14403         ''|0)   d_readdir64_r=undef
14404                 readdir64_r_proto=0
14405                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14406         * )     case "$readdir64_r_proto" in
14407                 REENTRANT_PROTO*) ;;
14408                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14409                 esac
14410                 echo "Prototype: $try" ;;
14411         esac
14412         ;;
14413         *)      case "$usethreads" in
14414                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14415                 esac
14416                 d_readdir64_r=undef
14417                 readdir64_r_proto=0
14418                 ;;
14419         esac
14420         ;;
14421 *)      readdir64_r_proto=0
14422         ;;
14423 esac
14424
14425 : see if readdir_r exists
14426 set readdir_r d_readdir_r
14427 eval $inlibc
14428 case "$d_readdir_r" in
14429 "$define")
14430         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14431         case "$d_readdir_r_proto:$usethreads" in
14432         ":define")      d_readdir_r_proto=define
14433                 set d_readdir_r_proto readdir_r $hdrs
14434                 eval $hasproto ;;
14435         *)      ;;
14436         esac
14437         case "$d_readdir_r_proto" in
14438         define)
14439         case "$readdir_r_proto" in
14440         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14441         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14442         esac
14443         case "$readdir_r_proto" in
14444         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14445         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14446         esac
14447         case "$readdir_r_proto" in
14448         ''|0)   d_readdir_r=undef
14449                 readdir_r_proto=0
14450                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14451         * )     case "$readdir_r_proto" in
14452                 REENTRANT_PROTO*) ;;
14453                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14454                 esac
14455                 echo "Prototype: $try" ;;
14456         esac
14457         ;;
14458         *)      case "$usethreads" in
14459                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14460                 esac
14461                 d_readdir_r=undef
14462                 readdir_r_proto=0
14463                 ;;
14464         esac
14465         ;;
14466 *)      readdir_r_proto=0
14467         ;;
14468 esac
14469
14470 : see if readv exists
14471 set readv d_readv
14472 eval $inlibc
14473
14474 : see if recvmsg exists
14475 set recvmsg d_recvmsg
14476 eval $inlibc
14477
14478 : see if rename exists
14479 set rename d_rename
14480 eval $inlibc
14481
14482 : see if rmdir exists
14483 set rmdir d_rmdir
14484 eval $inlibc
14485
14486 : see if memory.h is available.
14487 val=''
14488 set memory.h val
14489 eval $inhdr
14490
14491 : See if it conflicts with string.h
14492 case "$val" in
14493 $define)
14494         case "$strings" in
14495         '') ;;
14496         *)
14497                 $cppstdin $cppflags $cppminus < $strings > mem.h
14498                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14499                         echo " "
14500                         echo "We won't be including <memory.h>."
14501                         val="$undef"
14502                 fi
14503                 $rm -f mem.h
14504                 ;;
14505         esac
14506 esac
14507 set i_memory
14508 eval $setvar
14509
14510 : can bcopy handle overlapping blocks?
14511 echo " "
14512 val="$undef"
14513 case "$d_memmove" in
14514 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14515 *)      case "$d_bcopy" in
14516         "$define")
14517                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14518                 $cat >try.c <<EOCP
14519 #$i_memory I_MEMORY
14520 #$i_stdlib I_STDLIB
14521 #$i_string I_STRING
14522 #$i_unistd I_UNISTD
14523 EOCP
14524         $cat >>try.c <<'EOCP'
14525 #include <stdio.h>
14526 #ifdef I_MEMORY
14527 #  include <memory.h>
14528 #endif
14529 #ifdef I_STDLIB
14530 #  include <stdlib.h>
14531 #endif
14532 #ifdef I_STRING
14533 #  include <string.h>
14534 #else
14535 #  include <strings.h>
14536 #endif
14537 #ifdef I_UNISTD
14538 #  include <unistd.h>  /* Needed for NetBSD */
14539 #endif
14540 int main()
14541 {
14542 char buf[128], abc[128];
14543 char *b;
14544 int len;
14545 int off;
14546 int align;
14547
14548 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14549    try to store the string in read-only memory. */
14550 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14551
14552 for (align = 7; align >= 0; align--) {
14553         for (len = 36; len; len--) {
14554                 b = buf+align;
14555                 bcopy(abc, b, len);
14556                 for (off = 1; off <= len; off++) {
14557                         bcopy(b, b+off, len);
14558                         bcopy(b+off, b, len);
14559                         if (bcmp(b, abc, len))
14560                                 exit(1);
14561                 }
14562         }
14563 }
14564 exit(0);
14565 }
14566 EOCP
14567                 set try
14568                 if eval $compile_ok; then
14569                         if ./try 2>/dev/null; then
14570                                 echo "Yes, it can."
14571                                 val="$define"
14572                         else
14573                                 echo "It can't, sorry."
14574                         fi
14575                 else
14576                         echo "(I can't compile the test program, so we'll assume not...)"
14577                 fi
14578                 ;;
14579         esac
14580         $rm -f try.* try core
14581         ;;
14582 esac
14583 set d_safebcpy
14584 eval $setvar
14585
14586 : can memcpy handle overlapping blocks?
14587 echo " "
14588 val="$undef"
14589 case "$d_memmove" in
14590 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14591 *)      case "$d_memcpy" in
14592         "$define")
14593                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14594                 $cat >try.c <<EOCP
14595 #$i_memory I_MEMORY
14596 #$i_stdlib I_STDLIB
14597 #$i_string I_STRING
14598 #$i_unistd I_UNISTD
14599 EOCP
14600         $cat >>try.c <<'EOCP'
14601 #include <stdio.h>
14602 #ifdef I_MEMORY
14603 #  include <memory.h>
14604 #endif
14605 #ifdef I_STDLIB
14606 #  include <stdlib.h>
14607 #endif
14608 #ifdef I_STRING
14609 #  include <string.h>
14610 #else
14611 #  include <strings.h>
14612 #endif
14613 #ifdef I_UNISTD
14614 #  include <unistd.h>  /* Needed for NetBSD */
14615 #endif
14616 int main()
14617 {
14618 char buf[128], abc[128];
14619 char *b;
14620 int len;
14621 int off;
14622 int align;
14623
14624 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14625    try to store the string in read-only memory. */
14626 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14627
14628 for (align = 7; align >= 0; align--) {
14629         for (len = 36; len; len--) {
14630                 b = buf+align;
14631                 memcpy(b, abc, len);
14632                 for (off = 1; off <= len; off++) {
14633                         memcpy(b+off, b, len);
14634                         memcpy(b, b+off, len);
14635                         if (memcmp(b, abc, len))
14636                                 exit(1);
14637                 }
14638         }
14639 }
14640 exit(0);
14641 }
14642 EOCP
14643                 set try
14644                 if eval $compile_ok; then
14645                         if ./try 2>/dev/null; then
14646                                 echo "Yes, it can."
14647                                 val="$define"
14648                         else
14649                                 echo "It can't, sorry."
14650                         fi
14651                 else
14652                         echo "(I can't compile the test program, so we'll assume not...)"
14653                 fi
14654                 ;;
14655         esac
14656         $rm -f try.* try core
14657         ;;
14658 esac
14659 set d_safemcpy
14660 eval $setvar
14661
14662 : can memcmp be trusted to compare relative magnitude?
14663 val="$undef"
14664 case "$d_memcmp" in
14665 "$define")
14666         echo " "
14667         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14668         $cat >try.c <<EOCP
14669 #$i_memory I_MEMORY
14670 #$i_stdlib I_STDLIB
14671 #$i_string I_STRING
14672 #$i_unistd I_UNISTD
14673 EOCP
14674         $cat >>try.c <<'EOCP'
14675 #include <stdio.h>
14676 #ifdef I_MEMORY
14677 #  include <memory.h>
14678 #endif
14679 #ifdef I_STDLIB
14680 #  include <stdlib.h>
14681 #endif
14682 #ifdef I_STRING
14683 #  include <string.h>
14684 #else
14685 #  include <strings.h>
14686 #endif
14687 #ifdef I_UNISTD
14688 #  include <unistd.h>  /* Needed for NetBSD */
14689 #endif
14690 int main()
14691 {
14692 char a = -1;
14693 char b = 0;
14694 if ((a < b) && memcmp(&a, &b, 1) < 0)
14695         exit(1);
14696 exit(0);
14697 }
14698 EOCP
14699         set try
14700         if eval $compile_ok; then
14701                 if $run ./try 2>/dev/null; then
14702                         echo "Yes, it can."
14703                         val="$define"
14704                 else
14705                         echo "No, it can't (it uses signed chars)."
14706                 fi
14707         else
14708                 echo "(I can't compile the test program, so we'll assume not...)"
14709         fi
14710         ;;
14711 esac
14712 $rm -f try.* try core
14713 set d_sanemcmp
14714 eval $setvar
14715
14716 : see if prototype for sbrk is available
14717 echo " "
14718 set d_sbrkproto sbrk $i_unistd unistd.h
14719 eval $hasproto
14720
14721 : see if select exists
14722 set select d_select
14723 eval $inlibc
14724
14725 : see if semctl exists
14726 set semctl d_semctl
14727 eval $inlibc
14728
14729 : see if semget exists
14730 set semget d_semget
14731 eval $inlibc
14732
14733 : see if semop exists
14734 set semop d_semop
14735 eval $inlibc
14736
14737 : see how much of the 'sem*(2)' library is present.
14738 h_sem=true
14739 echo " "
14740 case "$d_semctl$d_semget$d_semop" in
14741 *"$undef"*) h_sem=false;;
14742 esac
14743 case "$osname" in
14744 freebsd)
14745     case "`ipcs 2>&1`" in
14746     "SVID messages"*"not configured"*)
14747         echo "Your $osname does not have the sem*(2) configured." >&4
14748         h_sem=false
14749         val="$undef"
14750         set semctl d_semctl
14751         eval $setvar
14752         set semget d_semget
14753         eval $setvar
14754         set semop d_semop
14755         eval $setvar
14756         ;;
14757     esac
14758     ;;
14759 esac
14760 : we could also check for sys/ipc.h ...
14761 if $h_sem && $test `./findhdr sys/sem.h`; then
14762         echo "You have the full sem*(2) library." >&4
14763         val="$define"
14764 else
14765         echo "You don't have the full sem*(2) library." >&4
14766         val="$undef"
14767 fi
14768 set d_sem
14769 eval $setvar
14770
14771 : see whether sys/sem.h defines union semun
14772 echo " "
14773 $cat > try.c <<'END'
14774 #include <sys/types.h>
14775 #include <sys/ipc.h>
14776 #include <sys/sem.h>
14777 int main () { union semun semun; semun.buf = 0; }
14778 END
14779 set try
14780 if eval $compile; then
14781     echo "You have union semun in <sys/sem.h>." >&4
14782     val="$define"
14783 else
14784     echo "You do not have union semun in <sys/sem.h>." >&4
14785     val="$undef"
14786 fi
14787 $rm -f try try.c try.h
14788 set d_union_semun
14789 eval $setvar
14790
14791 : see how to do semctl IPC_STAT
14792 case "$d_sem" in
14793 $define)
14794     : see whether semctl IPC_STAT can use union semun
14795     echo " "
14796     $cat > try.h <<END
14797 #ifndef S_IRUSR
14798 #   ifdef S_IREAD
14799 #       define S_IRUSR S_IREAD
14800 #       define S_IWUSR S_IWRITE
14801 #       define S_IXUSR S_IEXEC
14802 #   else
14803 #       define S_IRUSR 0400
14804 #       define S_IWUSR 0200
14805 #       define S_IXUSR 0100
14806 #   endif
14807 #   define S_IRGRP (S_IRUSR>>3)
14808 #   define S_IWGRP (S_IWUSR>>3)
14809 #   define S_IXGRP (S_IXUSR>>3)
14810 #   define S_IROTH (S_IRUSR>>6)
14811 #   define S_IWOTH (S_IWUSR>>6)
14812 #   define S_IXOTH (S_IXUSR>>6)
14813 #endif
14814 #ifndef S_IRWXU
14815 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14816 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14817 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14818 #endif
14819 END
14820
14821     $cat > try.c <<END
14822 #include <sys/types.h>
14823 #include <sys/ipc.h>
14824 #include <sys/sem.h>
14825 #include <sys/stat.h>
14826 #include <stdio.h>
14827 #include <errno.h>
14828 #include "try.h"
14829 #ifndef errno
14830 extern int errno;
14831 #endif
14832 #$d_union_semun HAS_UNION_SEMUN
14833 int main() {
14834     union semun
14835 #ifndef HAS_UNION_SEMUN
14836     {
14837         int val;
14838         struct semid_ds *buf;
14839         unsigned short *array;
14840     }
14841 #endif
14842     arg;
14843     int sem, st;
14844
14845 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14846     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14847     if (sem > -1) {
14848         struct semid_ds argbuf;
14849         arg.buf = &argbuf;
14850 #       ifdef IPC_STAT
14851         st = semctl(sem, 0, IPC_STAT, arg);
14852         if (st == 0)
14853             printf("semun\n");
14854         else
14855 #       endif /* IPC_STAT */
14856             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14857 #       ifdef IPC_RMID
14858         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14859 #       endif /* IPC_RMID */
14860             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14861     } else
14862 #endif /* IPC_PRIVATE && ... */
14863         printf("semget failed: errno = %d\n", errno);
14864   return 0;
14865 }
14866 END
14867     val="$undef"
14868     set try
14869     if eval $compile; then
14870         xxx=`$run ./try`
14871         case "$xxx" in
14872         semun) val="$define" ;;
14873         esac
14874     fi
14875     $rm -f try try.c
14876     set d_semctl_semun
14877     eval $setvar
14878     case "$d_semctl_semun" in
14879     $define)
14880         echo "You can use union semun for semctl IPC_STAT." >&4
14881         also='also'
14882         ;;
14883     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14884         also=''
14885         ;;
14886     esac
14887
14888     : see whether semctl IPC_STAT can use struct semid_ds pointer
14889     $cat > try.c <<'END'
14890 #include <sys/types.h>
14891 #include <sys/ipc.h>
14892 #include <sys/sem.h>
14893 #include <sys/stat.h>
14894 #include "try.h"
14895 #include <stdio.h>
14896 #include <errno.h>
14897 #ifndef errno
14898 extern int errno;
14899 #endif
14900 int main() {
14901     struct semid_ds arg;
14902     int sem, st;
14903
14904 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14905     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14906     if (sem > -1) {
14907 #       ifdef IPC_STAT
14908         st = semctl(sem, 0, IPC_STAT, &arg);
14909         if (st == 0)
14910             printf("semid_ds\n");
14911         else
14912 #       endif /* IPC_STAT */
14913             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14914 #       ifdef IPC_RMID
14915         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14916 #       endif /* IPC_RMID */
14917             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14918     } else
14919 #endif /* IPC_PRIVATE && ... */
14920         printf("semget failed: errno = %d\n", errno);
14921
14922     return 0;
14923 }
14924 END
14925     val="$undef"
14926     set try
14927     if eval $compile; then
14928         xxx=`$run ./try`
14929         case "$xxx" in
14930         semid_ds) val="$define" ;;
14931         esac
14932     fi
14933     $rm -f try try.c
14934     set d_semctl_semid_ds
14935     eval $setvar
14936     case "$d_semctl_semid_ds" in
14937     $define)
14938         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14939         ;;
14940     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14941         ;;
14942     esac
14943     $rm -f try.h
14944     ;;
14945 *)  val="$undef"
14946
14947     # We do not have the full sem*(2) library, so assume we can not
14948     # use either.
14949
14950     set d_semctl_semun
14951     eval $setvar
14952
14953     set d_semctl_semid_ds
14954     eval $setvar
14955     ;;
14956 esac
14957
14958 : see if sendmsg exists
14959 set sendmsg d_sendmsg
14960 eval $inlibc
14961
14962 : see if setegid exists
14963 set setegid d_setegid
14964 eval $inlibc
14965
14966 : see if seteuid exists
14967 set seteuid d_seteuid
14968 eval $inlibc
14969
14970 : see if setgrent exists
14971 set setgrent d_setgrent
14972 eval $inlibc
14973
14974 : see if setgrent_r exists
14975 set setgrent_r d_setgrent_r
14976 eval $inlibc
14977 case "$d_setgrent_r" in
14978 "$define")
14979         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14980         case "$d_setgrent_r_proto:$usethreads" in
14981         ":define")      d_setgrent_r_proto=define
14982                 set d_setgrent_r_proto setgrent_r $hdrs
14983                 eval $hasproto ;;
14984         *)      ;;
14985         esac
14986         case "$d_setgrent_r_proto" in
14987         define)
14988         case "$setgrent_r_proto" in
14989         ''|0) try='int setgrent_r(FILE**);'
14990         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14991         esac
14992         case "$setgrent_r_proto" in
14993         ''|0) try='void setgrent_r(FILE**);'
14994         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14995         esac
14996         case "$setgrent_r_proto" in
14997         ''|0)   d_setgrent_r=undef
14998                 setgrent_r_proto=0
14999                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15000         * )     case "$setgrent_r_proto" in
15001                 REENTRANT_PROTO*) ;;
15002                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15003                 esac
15004                 echo "Prototype: $try" ;;
15005         esac
15006         ;;
15007         *)      case "$usethreads" in
15008                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15009                 esac
15010                 d_setgrent_r=undef
15011                 setgrent_r_proto=0
15012                 ;;
15013         esac
15014         ;;
15015 *)      setgrent_r_proto=0
15016         ;;
15017 esac
15018
15019 : see if sethostent exists
15020 set sethostent d_sethent
15021 eval $inlibc
15022
15023 : see if sethostent_r exists
15024 set sethostent_r d_sethostent_r
15025 eval $inlibc
15026 case "$d_sethostent_r" in
15027 "$define")
15028         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15029         case "$d_sethostent_r_proto:$usethreads" in
15030         ":define")      d_sethostent_r_proto=define
15031                 set d_sethostent_r_proto sethostent_r $hdrs
15032                 eval $hasproto ;;
15033         *)      ;;
15034         esac
15035         case "$d_sethostent_r_proto" in
15036         define)
15037         case "$sethostent_r_proto" in
15038         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15039         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15040         esac
15041         case "$sethostent_r_proto" in
15042         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15043         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15044         esac
15045         case "$sethostent_r_proto" in
15046         ''|0)   d_sethostent_r=undef
15047                 sethostent_r_proto=0
15048                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15049         * )     case "$sethostent_r_proto" in
15050                 REENTRANT_PROTO*) ;;
15051                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15052                 esac
15053                 echo "Prototype: $try" ;;
15054         esac
15055         ;;
15056         *)      case "$usethreads" in
15057                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15058                 esac
15059                 d_sethostent_r=undef
15060                 sethostent_r_proto=0
15061                 ;;
15062         esac
15063         ;;
15064 *)      sethostent_r_proto=0
15065         ;;
15066 esac
15067
15068 : see if setitimer exists
15069 set setitimer d_setitimer
15070 eval $inlibc
15071
15072 : see if setlinebuf exists
15073 set setlinebuf d_setlinebuf
15074 eval $inlibc
15075
15076 : see if setlocale exists
15077 set setlocale d_setlocale
15078 eval $inlibc
15079
15080 : see if locale.h is available
15081 set locale.h i_locale
15082 eval $inhdr
15083
15084 : see if setlocale_r exists
15085 set setlocale_r d_setlocale_r
15086 eval $inlibc
15087 case "$d_setlocale_r" in
15088 "$define")
15089         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15090         case "$d_setlocale_r_proto:$usethreads" in
15091         ":define")      d_setlocale_r_proto=define
15092                 set d_setlocale_r_proto setlocale_r $hdrs
15093                 eval $hasproto ;;
15094         *)      ;;
15095         esac
15096         case "$d_setlocale_r_proto" in
15097         define)
15098         case "$setlocale_r_proto" in
15099         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15100         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15101         esac
15102         case "$setlocale_r_proto" in
15103         ''|0)   d_setlocale_r=undef
15104                 setlocale_r_proto=0
15105                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15106         * )     case "$setlocale_r_proto" in
15107                 REENTRANT_PROTO*) ;;
15108                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15109                 esac
15110                 echo "Prototype: $try" ;;
15111         esac
15112         ;;
15113         *)      case "$usethreads" in
15114                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15115                 esac
15116                 d_setlocale_r=undef
15117                 setlocale_r_proto=0
15118                 ;;
15119         esac
15120         ;;
15121 *)      setlocale_r_proto=0
15122         ;;
15123 esac
15124
15125 : see if setnetent exists
15126 set setnetent d_setnent
15127 eval $inlibc
15128
15129 : see if setnetent_r exists
15130 set setnetent_r d_setnetent_r
15131 eval $inlibc
15132 case "$d_setnetent_r" in
15133 "$define")
15134         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15135         case "$d_setnetent_r_proto:$usethreads" in
15136         ":define")      d_setnetent_r_proto=define
15137                 set d_setnetent_r_proto setnetent_r $hdrs
15138                 eval $hasproto ;;
15139         *)      ;;
15140         esac
15141         case "$d_setnetent_r_proto" in
15142         define)
15143         case "$setnetent_r_proto" in
15144         ''|0) try='int setnetent_r(int, struct netent_data*);'
15145         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15146         esac
15147         case "$setnetent_r_proto" in
15148         ''|0) try='void setnetent_r(int, struct netent_data*);'
15149         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15150         esac
15151         case "$setnetent_r_proto" in
15152         ''|0)   d_setnetent_r=undef
15153                 setnetent_r_proto=0
15154                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15155         * )     case "$setnetent_r_proto" in
15156                 REENTRANT_PROTO*) ;;
15157                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15158                 esac
15159                 echo "Prototype: $try" ;;
15160         esac
15161         ;;
15162         *)      case "$usethreads" in
15163                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15164                 esac
15165                 d_setnetent_r=undef
15166                 setnetent_r_proto=0
15167                 ;;
15168         esac
15169         ;;
15170 *)      setnetent_r_proto=0
15171         ;;
15172 esac
15173
15174 : see if setprotoent exists
15175 set setprotoent d_setpent
15176 eval $inlibc
15177
15178 : see if setpgid exists
15179 set setpgid d_setpgid
15180 eval $inlibc
15181
15182 : see if setpgrp2 exists
15183 set setpgrp2 d_setpgrp2
15184 eval $inlibc
15185
15186 : see if setpriority exists
15187 set setpriority d_setprior
15188 eval $inlibc
15189
15190 : see if setproctitle exists
15191 set setproctitle d_setproctitle
15192 eval $inlibc
15193
15194 : see if setprotoent_r exists
15195 set setprotoent_r d_setprotoent_r
15196 eval $inlibc
15197 case "$d_setprotoent_r" in
15198 "$define")
15199         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15200         case "$d_setprotoent_r_proto:$usethreads" in
15201         ":define")      d_setprotoent_r_proto=define
15202                 set d_setprotoent_r_proto setprotoent_r $hdrs
15203                 eval $hasproto ;;
15204         *)      ;;
15205         esac
15206         case "$d_setprotoent_r_proto" in
15207         define)
15208         case "$setprotoent_r_proto" in
15209         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15210         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15211         esac
15212         case "$setprotoent_r_proto" in
15213         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15214         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15215         esac
15216         case "$setprotoent_r_proto" in
15217         ''|0)   d_setprotoent_r=undef
15218                 setprotoent_r_proto=0
15219                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15220         * )     case "$setprotoent_r_proto" in
15221                 REENTRANT_PROTO*) ;;
15222                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15223                 esac
15224                 echo "Prototype: $try" ;;
15225         esac
15226         ;;
15227         *)      case "$usethreads" in
15228                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15229                 esac
15230                 d_setprotoent_r=undef
15231                 setprotoent_r_proto=0
15232                 ;;
15233         esac
15234         ;;
15235 *)      setprotoent_r_proto=0
15236         ;;
15237 esac
15238
15239 : see if setpwent exists
15240 set setpwent d_setpwent
15241 eval $inlibc
15242
15243 : see if setpwent_r exists
15244 set setpwent_r d_setpwent_r
15245 eval $inlibc
15246 case "$d_setpwent_r" in
15247 "$define")
15248         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15249         case "$d_setpwent_r_proto:$usethreads" in
15250         ":define")      d_setpwent_r_proto=define
15251                 set d_setpwent_r_proto setpwent_r $hdrs
15252                 eval $hasproto ;;
15253         *)      ;;
15254         esac
15255         case "$d_setpwent_r_proto" in
15256         define)
15257         case "$setpwent_r_proto" in
15258         ''|0) try='int setpwent_r(FILE**);'
15259         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15260         esac
15261         case "$setpwent_r_proto" in
15262         ''|0) try='void setpwent_r(FILE**);'
15263         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15264         esac
15265         case "$setpwent_r_proto" in
15266         ''|0)   d_setpwent_r=undef
15267                 setpwent_r_proto=0
15268                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15269         * )     case "$setpwent_r_proto" in
15270                 REENTRANT_PROTO*) ;;
15271                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15272                 esac
15273                 echo "Prototype: $try" ;;
15274         esac
15275         ;;
15276         *)      case "$usethreads" in
15277                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15278                 esac
15279                 d_setpwent_r=undef
15280                 setpwent_r_proto=0
15281                 ;;
15282         esac
15283         ;;
15284 *)      setpwent_r_proto=0
15285         ;;
15286 esac
15287
15288 : see if setregid exists
15289 set setregid d_setregid
15290 eval $inlibc
15291 set setresgid d_setresgid
15292 eval $inlibc
15293
15294 : see if setreuid exists
15295 set setreuid d_setreuid
15296 eval $inlibc
15297 set setresuid d_setresuid
15298 eval $inlibc
15299
15300 : see if setrgid exists
15301 set setrgid d_setrgid
15302 eval $inlibc
15303
15304 : see if setruid exists
15305 set setruid d_setruid
15306 eval $inlibc
15307
15308 : see if setservent exists
15309 set setservent d_setsent
15310 eval $inlibc
15311
15312 : see if setservent_r exists
15313 set setservent_r d_setservent_r
15314 eval $inlibc
15315 case "$d_setservent_r" in
15316 "$define")
15317         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15318         case "$d_setservent_r_proto:$usethreads" in
15319         ":define")      d_setservent_r_proto=define
15320                 set d_setservent_r_proto setservent_r $hdrs
15321                 eval $hasproto ;;
15322         *)      ;;
15323         esac
15324         case "$d_setservent_r_proto" in
15325         define)
15326         case "$setservent_r_proto" in
15327         ''|0) try='int setservent_r(int, struct servent_data*);'
15328         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15329         esac
15330         case "$setservent_r_proto" in
15331         ''|0) try='void setservent_r(int, struct servent_data*);'
15332         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15333         esac
15334         case "$setservent_r_proto" in
15335         ''|0)   d_setservent_r=undef
15336                 setservent_r_proto=0
15337                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15338         * )     case "$setservent_r_proto" in
15339                 REENTRANT_PROTO*) ;;
15340                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15341                 esac
15342                 echo "Prototype: $try" ;;
15343         esac
15344         ;;
15345         *)      case "$usethreads" in
15346                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15347                 esac
15348                 d_setservent_r=undef
15349                 setservent_r_proto=0
15350                 ;;
15351         esac
15352         ;;
15353 *)      setservent_r_proto=0
15354         ;;
15355 esac
15356
15357 : see if setsid exists
15358 set setsid d_setsid
15359 eval $inlibc
15360
15361 : see if setvbuf exists
15362 set setvbuf d_setvbuf
15363 eval $inlibc
15364
15365 : see if sfio.h is available
15366 set sfio.h i_sfio
15367 eval $inhdr
15368
15369
15370 : see if sfio library is available
15371 case "$i_sfio" in
15372 $define)
15373         val=''
15374         set sfreserve val
15375         eval $inlibc
15376         ;;
15377 *)
15378         val="$undef"
15379         ;;
15380 esac
15381 : Ok, but do we want to use it.
15382 case "$val" in
15383 $define)
15384         case "$usesfio" in
15385         true|$define|[yY]*) dflt='y';;
15386         *) dflt='n';;
15387         esac
15388         echo "$package can use the sfio library, but it is experimental."
15389         case "$useperlio" in
15390         "$undef")
15391             echo "For sfio also the PerlIO abstraction layer is needed."
15392             echo "Earlier you said you wouldn't want that."
15393             ;;
15394         esac
15395         rp="You seem to have sfio available, do you want to try using it?"
15396         . ./myread
15397         case "$ans" in
15398         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15399                 useperlio="$define"
15400                 val="$define"
15401                 ;;
15402         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15403                 val="$undef"
15404                 ;;
15405         esac
15406         ;;
15407 *)      case "$usesfio" in
15408         true|$define|[yY]*)
15409                 echo "Sorry, cannot find sfio on this machine." >&4
15410                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15411                 val="$undef"
15412                 ;;
15413         esac
15414         ;;
15415 esac
15416 set d_sfio
15417 eval $setvar
15418 case "$d_sfio" in
15419 $define) usesfio='true';;
15420 *) usesfio='false';;
15421 esac
15422 case "$d_sfio" in
15423 $define) ;;
15424 *)      : Remove sfio from list of libraries to use
15425         case "$libs" in
15426         *-lsfio*)
15427                 echo "Removing unneeded -lsfio from library list" >&4
15428                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15429                 shift
15430                 libs="$*"
15431                 echo "libs = $libs" >&4
15432                 ;;
15433         esac
15434 ;;
15435 esac
15436
15437
15438 : see if shmctl exists
15439 set shmctl d_shmctl
15440 eval $inlibc
15441
15442 : see if shmget exists
15443 set shmget d_shmget
15444 eval $inlibc
15445
15446 : see if shmat exists
15447 set shmat d_shmat
15448 eval $inlibc
15449 : see what shmat returns
15450 case "$d_shmat" in
15451 "$define")
15452         $cat >shmat.c <<'END'
15453 #include <sys/shm.h>
15454 void *shmat();
15455 END
15456         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15457                 shmattype='void *'
15458         else
15459                 shmattype='char *'
15460         fi
15461         echo "and it returns ($shmattype)." >&4
15462         : see if a prototype for shmat is available
15463         xxx=`./findhdr sys/shm.h`
15464         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15465         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15466                 val="$define"
15467         else
15468                 val="$undef"
15469         fi
15470         $rm -f shmat.[co]
15471         ;;
15472 *)
15473         val="$undef"
15474         ;;
15475 esac
15476 set d_shmatprototype
15477 eval $setvar
15478
15479 : see if shmdt exists
15480 set shmdt d_shmdt
15481 eval $inlibc
15482
15483 : see how much of the 'shm*(2)' library is present.
15484 h_shm=true
15485 echo " "
15486 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15487 *"$undef"*) h_shm=false;;
15488 esac
15489 case "$osname" in
15490 freebsd)
15491     case "`ipcs 2>&1`" in
15492     "SVID shared memory"*"not configured"*)
15493         echo "Your $osname does not have the shm*(2) configured." >&4
15494         h_shm=false
15495         val="$undef"
15496         set shmctl d_shmctl
15497         evat $setvar
15498         set shmget d_shmget
15499         evat $setvar
15500         set shmat d_shmat
15501         evat $setvar
15502         set shmdt d_shmdt
15503         evat $setvar
15504         ;;
15505     esac
15506     ;;
15507 esac
15508 : we could also check for sys/ipc.h ...
15509 if $h_shm && $test `./findhdr sys/shm.h`; then
15510         echo "You have the full shm*(2) library." >&4
15511         val="$define"
15512 else
15513         echo "You don't have the full shm*(2) library." >&4
15514         val="$undef"
15515 fi
15516 set d_shm
15517 eval $setvar
15518
15519 echo " "
15520 : see if we have sigaction
15521 if set sigaction val -f d_sigaction; eval $csym; $val; then
15522         echo 'sigaction() found.' >&4
15523         $cat > try.c <<'EOP'
15524 #include <stdio.h>
15525 #include <sys/types.h>
15526 #include <signal.h>
15527 int main()
15528 {
15529     struct sigaction act, oact;
15530     act.sa_flags = 0;
15531     oact.sa_handler = 0;
15532     /* so that act and oact are used */
15533     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15534 }
15535 EOP
15536         set try
15537         if eval $compile_ok; then
15538                 val="$define"
15539         else
15540                 echo "But you don't seem to have a useable struct sigaction." >&4
15541                 val="$undef"
15542         fi
15543 else
15544         echo 'sigaction NOT found.' >&4
15545         val="$undef"
15546 fi
15547 set d_sigaction; eval $setvar
15548 $rm -f try try$_o try.c
15549
15550 : see if sigprocmask exists
15551 set sigprocmask d_sigprocmask
15552 eval $inlibc
15553
15554 : see if sigsetjmp exists
15555 echo " "
15556 case "$d_sigsetjmp" in
15557 '')
15558         $cat >try.c <<'EOP'
15559 #include <setjmp.h>
15560 sigjmp_buf env;
15561 int set = 1;
15562 int main()
15563 {
15564         if (sigsetjmp(env,1))
15565                 exit(set);
15566         set = 0;
15567         siglongjmp(env, 1);
15568         exit(1);
15569 }
15570 EOP
15571         set try
15572         if eval $compile; then
15573                 if $run ./try >/dev/null 2>&1; then
15574                         echo "POSIX sigsetjmp found." >&4
15575                         val="$define"
15576                 else
15577                         $cat >&4 <<EOM
15578 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15579 I'll ignore them.
15580 EOM
15581                         val="$undef"
15582                 fi
15583         else
15584                 echo "sigsetjmp not found." >&4
15585                 val="$undef"
15586         fi
15587         ;;
15588 *) val="$d_sigsetjmp"
15589         case "$d_sigsetjmp" in
15590         $define) echo "POSIX sigsetjmp found." >&4;;
15591         $undef) echo "sigsetjmp not found." >&4;;
15592         esac
15593         ;;
15594 esac
15595 set d_sigsetjmp
15596 eval $setvar
15597 $rm -f try.c try
15598
15599 : see if sockatmark exists
15600 set sockatmark d_sockatmark
15601 eval $inlibc
15602
15603 : see if prototype for sockatmark is available
15604 echo " "
15605 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15606 eval $hasproto
15607
15608 : see if socks5_init exists
15609 set socks5_init d_socks5_init
15610 eval $inlibc
15611
15612 : see if srand48_r exists
15613 set srand48_r d_srand48_r
15614 eval $inlibc
15615 case "$d_srand48_r" in
15616 "$define")
15617         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15618         case "$d_srand48_r_proto:$usethreads" in
15619         ":define")      d_srand48_r_proto=define
15620                 set d_srand48_r_proto srand48_r $hdrs
15621                 eval $hasproto ;;
15622         *)      ;;
15623         esac
15624         case "$d_srand48_r_proto" in
15625         define)
15626         case "$srand48_r_proto" in
15627         ''|0) try='int srand48_r(long, struct drand48_data*);'
15628         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15629         esac
15630         case "$srand48_r_proto" in
15631         ''|0)   d_srand48_r=undef
15632                 srand48_r_proto=0
15633                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15634         * )     case "$srand48_r_proto" in
15635                 REENTRANT_PROTO*) ;;
15636                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15637                 esac
15638                 echo "Prototype: $try" ;;
15639         esac
15640         ;;
15641         *)      case "$usethreads" in
15642                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15643                 esac
15644                 d_srand48_r=undef
15645                 srand48_r_proto=0
15646                 ;;
15647         esac
15648         ;;
15649 *)      srand48_r_proto=0
15650         ;;
15651 esac
15652
15653 : see if srandom_r exists
15654 set srandom_r d_srandom_r
15655 eval $inlibc
15656 case "$d_srandom_r" in
15657 "$define")
15658         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15659         case "$d_srandom_r_proto:$usethreads" in
15660         ":define")      d_srandom_r_proto=define
15661                 set d_srandom_r_proto srandom_r $hdrs
15662                 eval $hasproto ;;
15663         *)      ;;
15664         esac
15665         case "$d_srandom_r_proto" in
15666         define)
15667         case "$srandom_r_proto" in
15668         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15669         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15670         esac
15671         case "$srandom_r_proto" in
15672         ''|0)   d_srandom_r=undef
15673                 srandom_r_proto=0
15674                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15675         * )     case "$srandom_r_proto" in
15676                 REENTRANT_PROTO*) ;;
15677                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15678                 esac
15679                 echo "Prototype: $try" ;;
15680         esac
15681         ;;
15682         *)      case "$usethreads" in
15683                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15684                 esac
15685                 d_srandom_r=undef
15686                 srandom_r_proto=0
15687                 ;;
15688         esac
15689         ;;
15690 *)      srandom_r_proto=0
15691         ;;
15692 esac
15693
15694 : see if prototype for setresgid is available
15695 echo " "
15696 set d_sresgproto setresgid $i_unistd unistd.h
15697 eval $hasproto
15698
15699 : see if prototype for setresuid is available
15700 echo " "
15701 set d_sresuproto setresuid $i_unistd unistd.h
15702 eval $hasproto
15703
15704 : see if sys/stat.h is available
15705 set sys/stat.h i_sysstat
15706 eval $inhdr
15707
15708
15709 : see if stat knows about block sizes
15710 echo " "
15711 echo "Checking to see if your struct stat has st_blocks field..." >&4
15712 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15713 eval $hasfield
15714
15715
15716 : see if this is a sys/vfs.h system
15717 set sys/vfs.h i_sysvfs
15718 eval $inhdr
15719
15720
15721 : see if this is a sys/statfs.h system
15722 set sys/statfs.h i_sysstatfs
15723 eval $inhdr
15724
15725
15726 echo " "
15727 echo "Checking to see if your system supports struct statfs..." >&4
15728 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
15729 eval $hasstruct
15730 case "$d_statfs_s" in
15731 "$define")      echo "Yes, it does."   ;;
15732 *)              echo "No, it doesn't." ;;
15733 esac
15734
15735
15736
15737 : see if struct statfs knows about f_flags
15738 case "$d_statfs_s" in
15739 define) 
15740         echo " "
15741         echo "Checking to see if your struct statfs has f_flags field..." >&4
15742         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
15743         eval $hasfield
15744         ;;
15745 *)      val="$undef"
15746         set d_statfs_f_flags
15747         eval $setvar
15748         ;;
15749 esac
15750 case "$d_statfs_f_flags" in
15751 "$define")      echo "Yes, it does."   ;;
15752 *)              echo "No, it doesn't." ;;
15753 esac
15754
15755 : see if _ptr and _cnt from stdio act std
15756 echo " "
15757
15758 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15759         echo "(Looks like you have stdio.h from BSD.)"
15760         case "$stdio_ptr" in
15761         '') stdio_ptr='((fp)->_p)'
15762                 ptr_lval=$define
15763                 ;;
15764         *)      ptr_lval=$d_stdio_ptr_lval;;
15765         esac
15766         case "$stdio_cnt" in
15767         '') stdio_cnt='((fp)->_r)'
15768                 cnt_lval=$define
15769                 ;;
15770         *)      cnt_lval=$d_stdio_cnt_lval;;
15771         esac
15772         case "$stdio_base" in
15773         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15774         esac
15775         case "$stdio_bufsiz" in
15776         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15777         esac
15778 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15779         echo "(Looks like you have stdio.h from Linux.)"
15780         case "$stdio_ptr" in
15781         '') stdio_ptr='((fp)->_IO_read_ptr)'
15782                 ptr_lval=$define
15783                 ;;
15784         *)      ptr_lval=$d_stdio_ptr_lval;;
15785         esac
15786         case "$stdio_cnt" in
15787         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15788                 cnt_lval=$undef
15789                 ;;
15790         *)      cnt_lval=$d_stdio_cnt_lval;;
15791         esac
15792         case "$stdio_base" in
15793         '') stdio_base='((fp)->_IO_read_base)';;
15794         esac
15795         case "$stdio_bufsiz" in
15796         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15797         esac
15798 else
15799         case "$stdio_ptr" in
15800         '') stdio_ptr='((fp)->_ptr)'
15801                 ptr_lval=$define
15802                 ;;
15803         *)      ptr_lval=$d_stdio_ptr_lval;;
15804         esac
15805         case "$stdio_cnt" in
15806         '') stdio_cnt='((fp)->_cnt)'
15807                 cnt_lval=$define
15808                 ;;
15809         *)      cnt_lval=$d_stdio_cnt_lval;;
15810         esac
15811         case "$stdio_base" in
15812         '') stdio_base='((fp)->_base)';;
15813         esac
15814         case "$stdio_bufsiz" in
15815         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15816         esac
15817 fi
15818
15819 : test whether _ptr and _cnt really work
15820 echo "Checking how std your stdio is..." >&4
15821 $cat >try.c <<EOP
15822 #include <stdio.h>
15823 #define FILE_ptr(fp)    $stdio_ptr
15824 #define FILE_cnt(fp)    $stdio_cnt
15825 int main() {
15826         FILE *fp = fopen("try.c", "r");
15827         char c = getc(fp);
15828         if (
15829                 18 <= FILE_cnt(fp) &&
15830                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15831         )
15832                 exit(0);
15833         exit(1);
15834 }
15835 EOP
15836 val="$undef"
15837 set try
15838 if eval $compile && $to try.c; then
15839         if $run ./try; then
15840                 echo "Your stdio acts pretty std."
15841                 val="$define"
15842         else
15843                 echo "Your stdio isn't very std."
15844         fi
15845 else
15846         echo "Your stdio doesn't appear very std."
15847 fi
15848 $rm -f try.c try
15849
15850 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15851 # direct buffer manipulation no longer works.  The Configure tests
15852 # should be changed to correctly detect this, but until then,
15853 # the following check should at least let perl compile and run.
15854 # (This quick fix should be updated before 5.8.1.)
15855 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15856 # A. Dougherty, June 3, 2002.
15857 case "$d_gnulibc" in
15858 $define)
15859         case "$gnulibc_version" in
15860         2.[01]*)  ;;
15861         2.2) ;;
15862         2.2.[0-9]) ;;
15863         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15864                 val="$undef"
15865                 ;;
15866         esac
15867         ;;
15868 esac
15869 set d_stdstdio
15870 eval $setvar
15871
15872 : Can _ptr be used as an lvalue?
15873 case "$d_stdstdio$ptr_lval" in
15874 $define$define) val=$define ;;
15875 *) val=$undef ;;
15876 esac
15877 set d_stdio_ptr_lval
15878 eval $setvar
15879
15880 : Can _cnt be used as an lvalue?
15881 case "$d_stdstdio$cnt_lval" in
15882 $define$define) val=$define ;;
15883 *) val=$undef ;;
15884 esac
15885 set d_stdio_cnt_lval
15886 eval $setvar
15887
15888
15889 : test whether setting _ptr sets _cnt as a side effect
15890 d_stdio_ptr_lval_sets_cnt="$undef"
15891 d_stdio_ptr_lval_nochange_cnt="$undef"
15892 case "$d_stdio_ptr_lval$d_stdstdio" in
15893 $define$define)
15894         echo "Checking to see what happens if we set the stdio ptr..." >&4
15895 $cat >try.c <<EOP
15896 #include <stdio.h>
15897 /* Can we scream? */
15898 /* Eat dust sed :-) */
15899 /* In the buffer space, no one can hear you scream. */
15900 #define FILE_ptr(fp)    $stdio_ptr
15901 #define FILE_cnt(fp)    $stdio_cnt
15902 #include <sys/types.h>
15903 int main() {
15904         FILE *fp = fopen("try.c", "r");
15905         int c;
15906         char *ptr;
15907         size_t cnt;
15908         if (!fp) {
15909             puts("Fail even to read");
15910             exit(1);
15911         }
15912         c = getc(fp); /* Read away the first # */
15913         if (c == EOF) {
15914             puts("Fail even to read");
15915             exit(1);
15916         }
15917         if (!(
15918                 18 <= FILE_cnt(fp) &&
15919                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15920         )) {
15921                 puts("Fail even to read");
15922                 exit (1);
15923         }
15924         ptr = (char*) FILE_ptr(fp);
15925         cnt = (size_t)FILE_cnt(fp);
15926
15927         FILE_ptr(fp) += 42;
15928
15929         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15930                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15931                 exit (1);
15932         }
15933         if (FILE_cnt(fp) <= 20) {
15934                 printf ("Fail (<20 chars to test)");
15935                 exit (1);
15936         }
15937         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15938                 puts("Fail compare");
15939                 exit (1);
15940         }
15941         if (cnt == FILE_cnt(fp)) {
15942                 puts("Pass_unchanged");
15943                 exit (0);
15944         }       
15945         if (FILE_cnt(fp) == (cnt - 42)) {
15946                 puts("Pass_changed");
15947                 exit (0);
15948         }
15949         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15950         return 1;
15951
15952 }
15953 EOP
15954         set try
15955         if eval $compile && $to try.c; then
15956                 case `$run ./try` in
15957                 Pass_changed)
15958                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15959                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15960                 Pass_unchanged)
15961                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15962                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15963                 Fail*)
15964                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15965                 *)
15966                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15967         esac
15968         else
15969                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15970         fi
15971         $rm -f try.c try
15972         ;;
15973 esac
15974
15975 : see if _base is also standard
15976 val="$undef"
15977 case "$d_stdstdio" in
15978 $define)
15979         $cat >try.c <<EOP
15980 #include <stdio.h>
15981 #define FILE_base(fp)   $stdio_base
15982 #define FILE_bufsiz(fp) $stdio_bufsiz
15983 int main() {
15984         FILE *fp = fopen("try.c", "r");
15985         char c = getc(fp);
15986         if (
15987                 19 <= FILE_bufsiz(fp) &&
15988                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15989         )
15990                 exit(0);
15991         exit(1);
15992 }
15993 EOP
15994         set try
15995         if eval $compile && $to try.c; then
15996                 if $run ./try; then
15997                         echo "And its _base field acts std."
15998                         val="$define"
15999                 else
16000                         echo "But its _base field isn't std."
16001                 fi
16002         else
16003                 echo "However, it seems to be lacking the _base field."
16004         fi
16005         $rm -f try.c try
16006         ;;
16007 esac
16008 set d_stdiobase
16009 eval $setvar
16010
16011 $cat >&4 <<EOM
16012 Checking how to access stdio streams by file descriptor number...
16013 EOM
16014 case "$stdio_stream_array" in
16015 '')     $cat >try.c <<EOCP
16016 #include <stdio.h>
16017 int main() {
16018   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16019     printf("yes\n");
16020 }
16021 EOCP
16022         for s in _iob __iob __sF
16023         do
16024                 set try -DSTDIO_STREAM_ARRAY=$s
16025                 if eval $compile; then
16026                         case "`$run ./try`" in
16027                         yes)    stdio_stream_array=$s; break ;;
16028                         esac
16029                 fi
16030         done
16031         $rm -f try.* try$exe_ext
16032 esac
16033 case "$stdio_stream_array" in
16034 '')     $cat >&4 <<EOM
16035 I can't figure out how to access stdio streams by file descriptor number.
16036 EOM
16037         d_stdio_stream_array="$undef"
16038         ;;
16039 *)      $cat >&4 <<EOM
16040 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16041 EOM
16042         d_stdio_stream_array="$define"
16043         ;;
16044 esac
16045
16046 : see if strcoll exists
16047 set strcoll d_strcoll
16048 eval $inlibc
16049
16050 : check for structure copying
16051 echo " "
16052 echo "Checking to see if your C compiler can copy structs..." >&4
16053 $cat >try.c <<'EOCP'
16054 int main()
16055 {
16056         struct blurfl {
16057                 int dyick;
16058         } foo, bar;
16059
16060         foo = bar;
16061 }
16062 EOCP
16063 if $cc -c try.c >/dev/null 2>&1 ; then
16064         val="$define"
16065         echo "Yup, it can."
16066 else
16067         val="$undef"
16068         echo "Nope, it can't."
16069 fi
16070 set d_strctcpy
16071 eval $setvar
16072 $rm -f try.*
16073
16074 : see if strerror and/or sys_errlist[] exist
16075 echo " "
16076 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16077     if set strerror val -f d_strerror; eval $csym; $val; then
16078                 echo 'strerror() found.' >&4
16079                 d_strerror="$define"
16080                 d_strerrm='strerror(e)'
16081                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16082                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16083                         d_syserrlst="$define"
16084                 else
16085                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16086                         d_syserrlst="$undef"
16087                 fi
16088     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16089                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16090                 echo 'strerror() found in string header.' >&4
16091                 d_strerror="$define"
16092                 d_strerrm='strerror(e)'
16093                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16094                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16095                                 d_syserrlst="$define"
16096                 else
16097                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16098                         d_syserrlst="$undef"
16099                 fi
16100     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16101                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16102                 d_strerror="$undef"
16103                 d_syserrlst="$define"
16104                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16105     else
16106                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16107                 d_strerror="$undef"
16108                 d_syserrlst="$undef"
16109                 d_strerrm='"unknown"'
16110     fi
16111 fi
16112
16113 : see if strerror_r exists
16114 set strerror_r d_strerror_r
16115 eval $inlibc
16116 case "$d_strerror_r" in
16117 "$define")
16118         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16119         case "$d_strerror_r_proto:$usethreads" in
16120         ":define")      d_strerror_r_proto=define
16121                 set d_strerror_r_proto strerror_r $hdrs
16122                 eval $hasproto ;;
16123         *)      ;;
16124         esac
16125         case "$d_strerror_r_proto" in
16126         define)
16127         case "$strerror_r_proto" in
16128         ''|0) try='int strerror_r(int, char*, size_t);'
16129         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16130         esac
16131         case "$strerror_r_proto" in
16132         ''|0) try='int strerror_r(int, char*, int);'
16133         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16134         esac
16135         case "$strerror_r_proto" in
16136         ''|0) try='char* strerror_r(int, char*, size_t);'
16137         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16138         esac
16139         case "$strerror_r_proto" in
16140         ''|0)   d_strerror_r=undef
16141                 strerror_r_proto=0
16142                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16143         * )     case "$strerror_r_proto" in
16144                 REENTRANT_PROTO*) ;;
16145                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16146                 esac
16147                 echo "Prototype: $try" ;;
16148         esac
16149         ;;
16150         *)      case "$usethreads" in
16151                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16152                 esac
16153                 d_strerror_r=undef
16154                 strerror_r_proto=0
16155                 ;;
16156         esac
16157         ;;
16158 *)      strerror_r_proto=0
16159         ;;
16160 esac
16161
16162 : see if strftime exists
16163 set strftime d_strftime
16164 eval $inlibc
16165
16166 : see if strtod exists
16167 set strtod d_strtod
16168 eval $inlibc
16169
16170 : see if strtol exists
16171 set strtol d_strtol
16172 eval $inlibc
16173
16174 : see if strtold exists
16175 set strtold d_strtold
16176 eval $inlibc
16177
16178 : see if strtoll exists
16179 set strtoll d_strtoll
16180 eval $inlibc
16181
16182 case "$d_longlong-$d_strtoll" in
16183 "$define-$define")
16184         $cat <<EOM
16185 Checking whether your strtoll() works okay...
16186 EOM
16187         $cat >try.c <<'EOCP'
16188 #include <errno.h>
16189 #ifdef __hpux
16190 #define strtoll __strtoll
16191 #endif
16192 #ifdef __EMX__
16193 #define strtoll _strtoll
16194 #endif
16195 #include <stdio.h>
16196 extern long long int strtoll(char *s, char **, int); 
16197 static int bad = 0;
16198 int check(char *s, long long ell, int een) {
16199         long long gll;
16200         errno = 0;
16201         gll = strtoll(s, 0, 10);
16202         if (!((gll == ell) && (errno == een)))
16203                 bad++;
16204 }
16205 int main() {
16206         check(" 1",                                      1LL, 0);
16207         check(" 0",                                      0LL, 0);
16208         check("-1",                                     -1LL, 0);
16209         check("-9223372036854775808", -9223372036854775808LL, 0);
16210         check("-9223372036854775808", -9223372036854775808LL, 0);
16211         check(" 9223372036854775807",  9223372036854775807LL, 0);
16212         check("-9223372036854775808", -9223372036854775808LL, 0);
16213         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16214         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16215         if (!bad)
16216                 printf("ok\n");
16217 }
16218 EOCP
16219         set try
16220         if eval $compile; then
16221                 yyy=`$run ./try`
16222                 case "$yyy" in
16223                 ok) echo "Your strtoll() seems to be working okay." ;;
16224                 *) cat <<EOM >&4
16225 Your strtoll() doesn't seem to be working okay.
16226 EOM
16227                    d_strtoll="$undef"
16228                    ;;
16229                 esac
16230         else
16231                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16232                 d_strtoll="$undef"
16233         fi
16234         ;;
16235 esac
16236
16237 : see if strtoq exists
16238 set strtoq d_strtoq
16239 eval $inlibc
16240
16241 : see if strtoul exists
16242 set strtoul d_strtoul
16243 eval $inlibc
16244
16245 case "$d_strtoul" in
16246 "$define")
16247         $cat <<EOM
16248 Checking whether your strtoul() works okay...
16249 EOM
16250         $cat >try.c <<'EOCP'
16251 #include <errno.h>
16252 #include <stdio.h>
16253 extern unsigned long int strtoul(char *s, char **, int); 
16254 static int bad = 0;
16255 void check(char *s, unsigned long eul, int een) {
16256         unsigned long gul;
16257         errno = 0;
16258         gul = strtoul(s, 0, 10);
16259         if (!((gul == eul) && (errno == een)))
16260                 bad++;
16261 }
16262 int main() {
16263         check(" 1", 1L, 0);
16264         check(" 0", 0L, 0);
16265 EOCP
16266         case "$longsize" in
16267         8)
16268             $cat >>try.c <<'EOCP'
16269         check("18446744073709551615", 18446744073709551615UL, 0);
16270         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16271 #if 0 /* strtoul() for /^-/ strings is undefined. */
16272         check("-1", 18446744073709551615UL, 0);
16273         check("-18446744073709551614", 2, 0);
16274         check("-18446744073709551615", 1, 0);
16275         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16276         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16277 #endif
16278 EOCP
16279                 ;;
16280         4)
16281                     $cat >>try.c <<'EOCP'
16282         check("4294967295", 4294967295UL, 0);
16283         check("4294967296", 4294967295UL, ERANGE);
16284 #if 0 /* strtoul() for /^-/ strings is undefined. */
16285         check("-1", 4294967295UL, 0);
16286         check("-4294967294", 2, 0);
16287         check("-4294967295", 1, 0);
16288         check("-4294967296", 4294967295UL, ERANGE);
16289         check("-4294967297", 4294967295UL, ERANGE);
16290 #endif
16291 EOCP
16292                 ;;
16293         *)
16294 : Should we write these tests to be more portable by sprintf-ing
16295 : ~0 and then manipulating that char string as input for strtol?
16296                 ;;
16297         esac
16298         $cat >>try.c <<'EOCP'
16299         if (!bad)
16300                 printf("ok\n");
16301         return 0;
16302 }
16303 EOCP
16304         set try
16305         if eval $compile; then
16306                 case "`$run ./try`" in
16307                 ok) echo "Your strtoul() seems to be working okay." ;;
16308                 *) cat <<EOM >&4
16309 Your strtoul() doesn't seem to be working okay.
16310 EOM
16311                    d_strtoul="$undef"
16312                    ;;
16313                 esac
16314         fi
16315         ;;
16316 esac
16317
16318 : see if strtoull exists
16319 set strtoull d_strtoull
16320 eval $inlibc
16321
16322 case "$d_longlong-$d_strtoull" in
16323 "$define-$define")
16324         $cat <<EOM
16325 Checking whether your strtoull() works okay...
16326 EOM
16327         $cat >try.c <<'EOCP'
16328 #include <errno.h>
16329 #ifdef __hpux
16330 #define strtoull __strtoull
16331 #endif
16332 #include <stdio.h>
16333 extern unsigned long long int strtoull(char *s, char **, int); 
16334 static int bad = 0;
16335 int check(char *s, long long eull, int een) {
16336         long long gull;
16337         errno = 0;
16338         gull = strtoull(s, 0, 10);
16339         if (!((gull == eull) && (errno == een)))
16340                 bad++;
16341 }
16342 int main() {
16343         check(" 1",                                        1LL, 0);
16344         check(" 0",                                        0LL, 0);
16345         check("18446744073709551615",  18446744073709551615ULL, 0);
16346         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16347 #if 0 /* strtoull() for /^-/ strings is undefined. */
16348         check("-1",                    18446744073709551615ULL, 0);
16349         check("-18446744073709551614",                     2LL, 0);
16350         check("-18446744073709551615",                     1LL, 0);
16351         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16352         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16353 #endif
16354         if (!bad)
16355                 printf("ok\n");
16356 }
16357 EOCP
16358         set try
16359         if eval $compile; then
16360                 case "`$run ./try`" in
16361                 ok) echo "Your strtoull() seems to be working okay." ;;
16362                 *) cat <<EOM >&4
16363 Your strtoull() doesn't seem to be working okay.
16364 EOM
16365                    d_strtoull="$undef"
16366                    ;;
16367                 esac
16368         fi
16369         ;;
16370 esac
16371
16372 : see if strtouq exists
16373 set strtouq d_strtouq
16374 eval $inlibc
16375
16376 case "$d_strtouq" in
16377 "$define")
16378         $cat <<EOM
16379 Checking whether your strtouq() works okay...
16380 EOM
16381         $cat >try.c <<'EOCP'
16382 #include <errno.h>
16383 #include <stdio.h>
16384 extern unsigned long long int strtouq(char *s, char **, int); 
16385 static int bad = 0;
16386 void check(char *s, unsigned long long eull, int een) {
16387         unsigned long long gull;
16388         errno = 0;
16389         gull = strtouq(s, 0, 10);
16390         if (!((gull == eull) && (errno == een)))
16391                 bad++;
16392 }
16393 int main() {
16394         check(" 1",                                        1LL, 0);
16395         check(" 0",                                        0LL, 0);
16396         check("18446744073709551615",  18446744073709551615ULL, 0);
16397         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16398 #if 0 /* strtouq() for /^-/ strings is undefined. */
16399         check("-1",                    18446744073709551615ULL, 0);
16400         check("-18446744073709551614",                     2LL, 0);
16401         check("-18446744073709551615",                     1LL, 0);
16402         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16403         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16404 #endif
16405         if (!bad)
16406                 printf("ok\n");
16407         return 0;
16408 }
16409 EOCP
16410         set try
16411         if eval $compile; then
16412                 case "`$run ./try`" in
16413                 ok) echo "Your strtouq() seems to be working okay." ;;
16414                 *) cat <<EOM >&4
16415 Your strtouq() doesn't seem to be working okay.
16416 EOM
16417                    d_strtouq="$undef"
16418                    ;;
16419                 esac
16420         fi
16421         ;;
16422 esac
16423
16424 : see if strxfrm exists
16425 set strxfrm d_strxfrm
16426 eval $inlibc
16427
16428 : see if symlink exists
16429 set symlink d_symlink
16430 eval $inlibc
16431
16432 : see if syscall exists
16433 set syscall d_syscall
16434 eval $inlibc
16435
16436 : see if prototype for syscall is available
16437 echo " "
16438 set d_syscallproto syscall $i_unistd unistd.h
16439 eval $hasproto
16440
16441 : see if sysconf exists
16442 set sysconf d_sysconf
16443 eval $inlibc
16444
16445 : see if system exists
16446 set system d_system
16447 eval $inlibc
16448
16449 : see if tcgetpgrp exists
16450 set tcgetpgrp d_tcgetpgrp
16451 eval $inlibc
16452
16453 : see if tcsetpgrp exists
16454 set tcsetpgrp d_tcsetpgrp
16455 eval $inlibc
16456
16457 : see if prototype for telldir is available
16458 echo " "
16459 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16460 eval $hasproto
16461
16462 : see if time exists
16463 echo " "
16464 if test "X$d_time" = X -o X"$timetype" = X; then
16465     if set time val -f d_time; eval $csym; $val; then
16466                 echo 'time() found.' >&4
16467                 val="$define"
16468                 rp="What is the type returned by time() on this system?"
16469                 set time_t timetype long stdio.h sys/types.h
16470                 eval $typedef_ask
16471     else
16472                 echo 'time() not found, hope that will do.' >&4
16473                 val="$undef"
16474                 timetype='int';
16475     fi
16476     set d_time
16477     eval $setvar
16478 fi
16479
16480 : see if this is a sys/times.h system
16481 set sys/times.h i_systimes
16482 eval $inhdr
16483
16484 : see if times exists
16485 echo " "
16486 if set times val -f d_times; eval $csym; $val; then
16487         echo 'times() found.' >&4
16488         d_times="$define"
16489         inc=''
16490         case "$i_systimes" in
16491         "$define") inc='sys/times.h';;
16492         esac
16493         rp="What is the type returned by times() on this system?"
16494         set clock_t clocktype long stdio.h sys/types.h $inc
16495         eval $typedef_ask
16496 else
16497         echo 'times() NOT found, hope that will do.' >&4
16498         d_times="$undef"
16499         clocktype='int'
16500 fi
16501
16502 : see if tmpnam_r exists
16503 set tmpnam_r d_tmpnam_r
16504 eval $inlibc
16505 case "$d_tmpnam_r" in
16506 "$define")
16507         hdrs="$i_systypes sys/types.h define stdio.h "
16508         case "$d_tmpnam_r_proto:$usethreads" in
16509         ":define")      d_tmpnam_r_proto=define
16510                 set d_tmpnam_r_proto tmpnam_r $hdrs
16511                 eval $hasproto ;;
16512         *)      ;;
16513         esac
16514         case "$d_tmpnam_r_proto" in
16515         define)
16516         case "$tmpnam_r_proto" in
16517         ''|0) try='char* tmpnam_r(char*);'
16518         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16519         esac
16520         case "$tmpnam_r_proto" in
16521         ''|0)   d_tmpnam_r=undef
16522                 tmpnam_r_proto=0
16523                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16524         * )     case "$tmpnam_r_proto" in
16525                 REENTRANT_PROTO*) ;;
16526                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16527                 esac
16528                 echo "Prototype: $try" ;;
16529         esac
16530         ;;
16531         *)      case "$usethreads" in
16532                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16533                 esac
16534                 d_tmpnam_r=undef
16535                 tmpnam_r_proto=0
16536                 ;;
16537         esac
16538         ;;
16539 *)      tmpnam_r_proto=0
16540         ;;
16541 esac
16542
16543 : see if truncate exists
16544 set truncate d_truncate
16545 eval $inlibc
16546
16547 : see if ttyname_r exists
16548 set ttyname_r d_ttyname_r
16549 eval $inlibc
16550 case "$d_ttyname_r" in
16551 "$define")
16552         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16553         case "$d_ttyname_r_proto:$usethreads" in
16554         ":define")      d_ttyname_r_proto=define
16555                 set d_ttyname_r_proto ttyname_r $hdrs
16556                 eval $hasproto ;;
16557         *)      ;;
16558         esac
16559         case "$d_ttyname_r_proto" in
16560         define)
16561         case "$ttyname_r_proto" in
16562         ''|0) try='int ttyname_r(int, char*, size_t);'
16563         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16564         esac
16565         case "$ttyname_r_proto" in
16566         ''|0) try='int ttyname_r(int, char*, int);'
16567         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16568         esac
16569         case "$ttyname_r_proto" in
16570         ''|0) try='char* ttyname_r(int, char*, int);'
16571         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16572         esac
16573         case "$ttyname_r_proto" in
16574         ''|0)   d_ttyname_r=undef
16575                 ttyname_r_proto=0
16576                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16577         * )     case "$ttyname_r_proto" in
16578                 REENTRANT_PROTO*) ;;
16579                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16580                 esac
16581                 echo "Prototype: $try" ;;
16582         esac
16583         ;;
16584         *)      case "$usethreads" in
16585                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16586                 esac
16587                 d_ttyname_r=undef
16588                 ttyname_r_proto=0
16589                 ;;
16590         esac
16591         ;;
16592 *)      ttyname_r_proto=0
16593         ;;
16594 esac
16595
16596 : see if tzname[] exists
16597 echo " "
16598 if set tzname val -a d_tzname; eval $csym; $val; then
16599         val="$define"
16600         echo 'tzname[] found.' >&4
16601 else
16602         val="$undef"
16603         echo 'tzname[] NOT found.' >&4
16604 fi
16605 set d_tzname
16606 eval $setvar
16607
16608 case "$osname" in
16609 next|rhapsody|darwin) multiarch="$define" ;;
16610 esac
16611 case "$multiarch" in
16612 ''|[nN]*) multiarch="$undef" ;;
16613 esac
16614
16615 : check for ordering of bytes in a UV
16616 echo " "
16617 case "$usecrosscompile$multiarch" in
16618 *$define*)
16619         $cat <<EOM
16620 You seem to be either cross-compiling or doing a multiarchitecture build,
16621 skipping the byteorder check.
16622
16623 EOM
16624         byteorder='ffff'
16625         ;;
16626 *)
16627         case "$byteorder" in
16628         '')
16629                 $cat <<'EOM'
16630 In the following, larger digits indicate more significance.  A big-endian
16631 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16632 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16633 machines may have weird orders like 3412.  A Cray will report 87654321,
16634 an Alpha will report 12345678. If the test program works the default is
16635 probably right.
16636 I'm now running the test program...
16637 EOM
16638                 $cat >try.c <<EOCP
16639 #include <stdio.h>
16640 #include <sys/types.h>
16641 typedef $uvtype UV;
16642 int main()
16643 {
16644         int i;
16645         union {
16646                 UV l;
16647                 char c[$uvsize];
16648         } u;
16649
16650         if ($uvsize > 4)
16651                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16652         else
16653                 u.l = (UV)0x04030201;
16654         for (i = 0; i < $uvsize; i++)
16655                 printf("%c", u.c[i]+'0');
16656         printf("\n");
16657         exit(0);
16658 }
16659 EOCP
16660                 xxx_prompt=y
16661                 set try
16662                 if eval $compile && ./try > /dev/null; then
16663                         dflt=`$run ./try`
16664                         case "$dflt" in
16665                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16666                                 echo "(The test program ran ok.)"
16667                                 echo "byteorder=$dflt"
16668                                 xxx_prompt=n
16669                         ;;
16670                         ????|????????) echo "(The test program ran ok.)" ;;
16671                         *) echo "(The test program didn't run right for some reason.)" ;;
16672                         esac
16673                 else
16674                         dflt='4321'
16675                         cat <<'EOM'
16676 (I can't seem to compile the test program.  Guessing big-endian...)
16677 EOM
16678                 fi
16679                 case "$xxx_prompt" in
16680                 y)
16681                         rp="What is the order of bytes in $uvtype?"
16682                         . ./myread
16683                         byteorder="$ans"
16684                         ;;
16685                 *)      byteorder=$dflt
16686                         ;;
16687                 esac
16688                 ;;
16689         esac
16690         $rm -f try.c try
16691         ;;
16692 esac
16693
16694
16695 $cat <<EOM
16696
16697 Checking to see whether you can access character data unalignedly...
16698 EOM
16699 case "$d_u32align" in
16700 '')   $cat >try.c <<EOCP
16701 #include <stdio.h>
16702 #define U32 $u32type
16703 #define BYTEORDER 0x$byteorder
16704 #define U8 $u8type
16705 #include <signal.h>
16706 #ifdef SIGBUS
16707 $signal_t bletch(s) int s; { exit(4); }
16708 #endif
16709 int main() {
16710 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16711     U8 buf[8];
16712     U32 *up;
16713     int i;
16714
16715     if (sizeof(U32) != 4) {
16716         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16717         exit(1);
16718     }
16719
16720     fflush(stdout);
16721
16722 #ifdef SIGBUS
16723     signal(SIGBUS, bletch);
16724 #endif
16725
16726     buf[0] = 0;
16727     buf[1] = 0;
16728     buf[2] = 0;
16729     buf[3] = 1;
16730     buf[5] = 0;
16731     buf[6] = 0;
16732     buf[7] = 0;
16733     buf[8] = 1;
16734
16735     for (i = 0; i < 4; i++) {
16736         up = (U32*)(buf + i);
16737         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16738                (*up == 1 << (8*(3-i)))  /* little-endian */
16739               )
16740            )
16741         {
16742             printf("read failed (%x)\n", *up);
16743             exit(2);
16744         }
16745     }
16746
16747     /* write test */
16748     for (i = 0; i < 4; i++) {
16749         up = (U32*)(buf + i);
16750         *up = 0xBeef;
16751         if (*up != 0xBeef) {
16752             printf("write failed (%x)\n", *up);
16753             exit(3);
16754         }
16755     }
16756
16757     exit(0);
16758 #else
16759     printf("1\n");
16760     exit(1);
16761 #endif
16762     return 0;
16763 }
16764 EOCP
16765 set try
16766 if eval $compile_ok; then
16767         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16768         $run ./try 2>&1 >/dev/null
16769         case "$?" in
16770         0)      cat >&4 <<EOM
16771 You can access character data pretty unalignedly.
16772 EOM
16773                 d_u32align="$undef"
16774                 ;;
16775         *)      cat >&4 <<EOM
16776 It seems that you must access character data in an aligned manner.
16777 EOM
16778                 d_u32align="$define"
16779                 ;;
16780         esac
16781 else
16782         rp='Can you access character data at unaligned addresses?'
16783         dflt='n'
16784         . ./myread
16785         case "$ans" in
16786         [yY]*)  d_u32align="$undef"  ;;
16787         *)      d_u32align="$define" ;;
16788         esac
16789 fi
16790 $rm -f core core.try.* try.core
16791 ;;
16792 esac
16793
16794 : see if ualarm exists
16795 set ualarm d_ualarm
16796 eval $inlibc
16797
16798 : see if umask exists
16799 set umask d_umask
16800 eval $inlibc
16801
16802 : see if unordered exists
16803 set unordered d_unordered
16804 eval $inlibc
16805
16806 : see if usleep exists
16807 set usleep d_usleep
16808 eval $inlibc
16809
16810 : see if prototype for usleep is available
16811 echo " "
16812 set d_usleepproto usleep $i_unistd unistd.h
16813 eval $hasproto
16814
16815 : see if ustat exists
16816 set ustat d_ustat
16817 eval $inlibc
16818
16819 : backward compatibility for d_hvfork
16820 if test X$d_hvfork != X; then
16821         d_vfork="$d_hvfork"
16822         d_hvfork=''
16823 fi
16824 : see if there is a vfork
16825 val=''
16826 set vfork val
16827 eval $inlibc
16828
16829 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16830 : perl on Solaris 2.x, and probably elsewhere.
16831 case "$val" in
16832 $define)
16833         echo " "
16834         case "$usevfork" in
16835         false) dflt='n';;
16836         *) dflt='y';;
16837         esac
16838         cat <<'EOM'
16839  
16840 Perl can only use a vfork() that doesn't suffer from strict
16841 restrictions on calling functions or modifying global data in
16842 the child.  For example, glibc-2.1 contains such a vfork()
16843 that is unsuitable.  If your system provides a proper fork()
16844 call, chances are that you do NOT want perl to use vfork().
16845
16846 EOM
16847         rp="Do you still want to use vfork()?"
16848         . ./myread
16849         case "$ans" in
16850         y|Y) ;;
16851         *)
16852                 echo "Ok, we won't use vfork()."
16853                 val="$undef"
16854                 ;;
16855         esac
16856         ;;
16857 esac
16858 set d_vfork
16859 eval $setvar
16860 case "$d_vfork" in
16861 $define) usevfork='true';;
16862 *) usevfork='false';;
16863 esac
16864
16865 : see if closedir exists
16866 set closedir d_closedir
16867 eval $inlibc
16868
16869 case "$d_closedir" in
16870 "$define")
16871         echo " "
16872         echo "Checking whether closedir() returns a status..." >&4
16873         cat > try.c <<EOM
16874 #$i_dirent I_DIRENT             /**/
16875 #$i_sysdir I_SYS_DIR            /**/
16876 #$i_sysndir I_SYS_NDIR          /**/
16877 #$i_systypes I_SYS_TYPES        /**/
16878
16879 #if defined(I_SYS_TYPES)
16880 #include <sys/types.h>
16881 #endif
16882 #if defined(I_DIRENT)
16883 #include <dirent.h>
16884 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16885 #include <sys/dir.h>
16886 #endif
16887 #else
16888 #ifdef I_SYS_NDIR
16889 #include <sys/ndir.h>
16890 #else
16891 #ifdef I_SYS_DIR
16892 #ifdef hp9000s500
16893 #include <ndir.h>       /* may be wrong in the future */
16894 #else
16895 #include <sys/dir.h>
16896 #endif
16897 #endif
16898 #endif
16899 #endif 
16900 int main() { return closedir(opendir(".")); }
16901 EOM
16902         set try
16903         if eval $compile_ok; then
16904                 if $run ./try > /dev/null 2>&1 ; then
16905                         echo "Yes, it does."
16906                         val="$undef"
16907                 else
16908                         echo "No, it doesn't."
16909                         val="$define"
16910                 fi
16911         else
16912                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16913                 val="$define"
16914         fi
16915         ;;
16916 *)
16917         val="$undef";
16918         ;;
16919 esac
16920 set d_void_closedir
16921 eval $setvar
16922 $rm -f try try.*
16923 : see if there is a wait4
16924 set wait4 d_wait4
16925 eval $inlibc
16926
16927 : see if waitpid exists
16928 set waitpid d_waitpid
16929 eval $inlibc
16930
16931 : see if wcstombs exists
16932 set wcstombs d_wcstombs
16933 eval $inlibc
16934
16935 : see if wctomb exists
16936 set wctomb d_wctomb
16937 eval $inlibc
16938
16939 : see if writev exists
16940 set writev d_writev
16941 eval $inlibc
16942
16943 : preserve RCS keywords in files with variable substitution, grrr
16944 Date='$Date'
16945 Id='$Id'
16946 Log='$Log'
16947 RCSfile='$RCSfile'
16948 Revision='$Revision'
16949
16950 : check for alignment requirements
16951 echo " "
16952 case "$usecrosscompile$multiarch" in
16953 *$define*)
16954         $cat <<EOM
16955 You seem to be either cross-compiling or doing a multiarchitecture build,
16956 skipping the memory alignment check.
16957
16958 EOM
16959         case "$alignbytes" in
16960         '') alignbytes=8 ;;
16961         esac
16962         ;;
16963 *)
16964         case "$alignbytes" in
16965         '') echo "Checking alignment constraints..." >&4
16966                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16967                         $cat >try.c <<'EOCP'
16968 typedef long double NV;
16969 EOCP
16970                 else
16971                         $cat >try.c <<'EOCP'
16972 typedef double NV;
16973 EOCP
16974                 fi
16975                 $cat >>try.c <<'EOCP'
16976 #include <stdio.h>
16977 struct foobar {
16978         char foo;
16979         NV bar;
16980 } try_algn;
16981 int main()
16982 {
16983     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16984     return(0);
16985 }
16986 EOCP
16987                 set try
16988                 if eval $compile_ok; then
16989                         dflt=`$run ./try`
16990                 else
16991                         dflt='8'
16992                         echo "(I can't seem to compile the test program...)"
16993                 fi
16994                 ;;
16995         *) dflt="$alignbytes"
16996                 ;;
16997         esac
16998         rp="Doubles must be aligned on a how-many-byte boundary?"
16999         . ./myread
17000         alignbytes="$ans"
17001         $rm -f try.c try
17002         ;;
17003 esac
17004
17005
17006 : set the base revision
17007 baserev=5.0
17008
17009 : how do we catenate cpp tokens here?
17010 echo " "
17011 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
17012 $cat >cpp_stuff.c <<'EOCP'
17013 #define RCAT(a,b)a/**/b
17014 #define ACAT(a,b)a ## b
17015 RCAT(Rei,ser)
17016 ACAT(Cir,cus)
17017 EOCP
17018 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17019 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17020         echo "Oh!  Smells like ANSI's been here." >&4
17021         echo "We can catify or stringify, separately or together!"
17022         cpp_stuff=42
17023 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17024         echo "Ah, yes!  The good old days!" >&4
17025         echo "However, in the good old days we don't know how to stringify and"
17026         echo "catify at the same time."
17027         cpp_stuff=1
17028 else
17029         $cat >&4 <<EOM
17030 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
17031 to have to edit the values of CAT[2-5] in config.h...
17032 EOM
17033         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17034 fi
17035 $rm -f cpp_stuff.*
17036
17037 : see if this is a db.h system
17038 set db.h i_db
17039 eval $inhdr
17040
17041 case "$i_db" in
17042 $define)
17043         : Check db version.
17044         echo " "
17045         echo "Checking Berkeley DB version ..." >&4
17046         $cat >try.c <<EOCP
17047 #$d_const HASCONST
17048 #ifndef HASCONST
17049 #define const
17050 #endif
17051 #include <sys/types.h>
17052 #include <stdio.h>
17053 #include <db.h>
17054 int main(int argc, char *argv[])
17055 {
17056 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17057     int Major, Minor, Patch ;
17058     unsigned long Version ;
17059     (void)db_version(&Major, &Minor, &Patch) ;
17060     if (argc == 2) {
17061         printf("%d %d %d %d %d %d\n",
17062                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17063                Major, Minor, Patch);
17064         exit(0);
17065     }
17066     printf("You have Berkeley DB Version 2 or greater.\n");
17067
17068     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17069                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17070     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17071                 Major, Minor, Patch) ;
17072
17073     /* check that db.h & libdb are compatible */
17074     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17075         printf("db.h and libdb are incompatible.\n") ;
17076         exit(3);        
17077     }
17078
17079     printf("db.h and libdb are compatible.\n") ;
17080
17081     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17082                 + DB_VERSION_PATCH ;
17083
17084     /* needs to be >= 2.3.4 */
17085     if (Version < 2003004) {
17086     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17087         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17088         exit(2);        
17089     }
17090
17091     exit(0);
17092 #else
17093 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17094     if (argc == 2) {
17095         printf("1 0 0\n");
17096         exit(0);
17097     }
17098     printf("You have Berkeley DB Version 1.\n");
17099     exit(0);    /* DB version < 2: the coast is clear. */
17100 #else
17101     exit(1);    /* <db.h> not Berkeley DB? */
17102 #endif
17103 #endif
17104 }
17105 EOCP
17106         set try
17107         if eval $compile_ok && $run ./try; then
17108                 echo 'Looks OK.' >&4
17109                 set `$run ./try 1`
17110                 db_version_major=$1
17111                 db_version_minor=$2
17112                 db_version_patch=$3
17113         else
17114                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17115                 i_db=$undef
17116                 case " $libs " in
17117                 *"-ldb "*)
17118                         : Remove db from list of libraries to use
17119                         echo "Removing unusable -ldb from library list" >&4
17120                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17121                         shift
17122                         libs="$*"
17123                         echo "libs = $libs" >&4
17124                         ;;
17125                 esac
17126         fi
17127         $rm -f try.*
17128         ;;
17129 esac
17130
17131 case "$i_db" in
17132 define)
17133         : Check the return type needed for hash 
17134         echo " "
17135         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17136         $cat >try.c <<EOCP
17137 #$d_const HASCONST
17138 #ifndef HASCONST
17139 #define const
17140 #endif
17141 #include <sys/types.h>
17142 #include <db.h>
17143
17144 #ifndef DB_VERSION_MAJOR
17145 u_int32_t hash_cb (ptr, size)
17146 const void *ptr;
17147 size_t size;
17148 {
17149 }
17150 HASHINFO info;
17151 int main()
17152 {
17153         info.hash = hash_cb;
17154 }
17155 #endif
17156 EOCP
17157         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17158                 if $contains warning try.out >>/dev/null 2>&1 ; then
17159                         db_hashtype='int'
17160                 else
17161                         db_hashtype='u_int32_t'
17162                 fi
17163         else
17164                 : XXX Maybe we should just give up here.
17165                 db_hashtype=u_int32_t
17166                 $cat try.out >&4
17167                 echo "Help:  I can't seem to compile the db test program." >&4
17168                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17169         fi
17170         $rm -f try.*
17171         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17172         ;;
17173 *)      db_hashtype=u_int32_t
17174         ;;
17175 esac
17176 case "$i_db" in
17177 define)
17178         : Check the return type needed for prefix 
17179         echo " "
17180         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17181         cat >try.c <<EOCP
17182 #$d_const HASCONST
17183 #ifndef HASCONST
17184 #define const
17185 #endif
17186 #include <sys/types.h>
17187 #include <db.h>
17188
17189 #ifndef DB_VERSION_MAJOR
17190 size_t prefix_cb (key1, key2)
17191 const DBT *key1;
17192 const DBT *key2;
17193 {
17194 }
17195 BTREEINFO info;
17196 int main()
17197 {
17198         info.prefix = prefix_cb;
17199 }
17200 #endif
17201 EOCP
17202         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17203                 if $contains warning try.out >>/dev/null 2>&1 ; then
17204                         db_prefixtype='int'
17205                 else
17206                         db_prefixtype='size_t'
17207                 fi
17208         else
17209                 db_prefixtype='size_t'
17210                 : XXX Maybe we should just give up here.
17211                 $cat try.out >&4
17212                 echo "Help:  I can't seem to compile the db test program." >&4
17213                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17214         fi
17215         $rm -f try.*
17216         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17217         ;;
17218 *)      db_prefixtype='size_t'
17219         ;;
17220 esac
17221
17222
17223 : How can we generate normalized random numbers ?
17224 echo " "
17225 echo "Looking for a random number function..." >&4
17226 case "$randfunc" in
17227 '')
17228         if set drand48 val -f; eval $csym; $val; then
17229                 dflt="drand48"
17230                 echo "Good, found drand48()." >&4
17231         elif set random val -f; eval $csym; $val; then
17232                 dflt="random"
17233                 echo "OK, found random()." >&4
17234         else
17235                 dflt="rand"
17236                 echo "Yick, looks like I have to use rand()." >&4
17237         fi
17238         echo " "
17239         ;;
17240 *)
17241         dflt="$randfunc"
17242         ;;
17243 esac
17244 cont=true
17245
17246 case "$ccflags" in
17247 *-Dmy_rand=*|*-Dmy_srand=*)
17248         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17249         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17250         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17251         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17252         ;;
17253 esac
17254
17255 while $test "$cont"; do
17256         rp="Use which function to generate random numbers?"
17257         . ./myread
17258         if $test "$ans" = "$dflt"; then
17259                 : null
17260         else
17261                 randbits=''
17262         fi
17263         randfunc="$ans"
17264         if set $ans val -f; eval $csym; $val; then
17265                 cont=''
17266         else
17267                 dflt=y
17268                 rp="I cannot find function $ans. Use that name anyway?"
17269                 . ./myread
17270                 dflt=rand
17271                 case "$ans" in
17272                         [yY]*) cont='';;
17273                 esac
17274         fi
17275         case "$cont" in
17276         '')
17277                 case "$randfunc" in
17278                 drand48)
17279                         drand01="drand48()"
17280                         seedfunc="srand48"
17281                         randbits=48
17282                         randseedtype=long
17283                         ;;
17284                 rand|random)
17285                         case "$randbits" in
17286                         '')
17287 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17288                                 $cat >try.c <<EOCP
17289 #$i_unistd I_UNISTD
17290 #$i_stdlib I_STDLIB
17291 #include <stdio.h>
17292 #ifdef I_UNISTD
17293 #  include <unistd.h>
17294 #endif
17295 #ifdef I_STDLIB
17296 #  include <stdlib.h>
17297 #endif
17298 int main()
17299 {
17300         register int i;
17301         register unsigned long tmp;
17302         register unsigned long max = 0L;
17303
17304         for (i = 1000; i; i--) {
17305                 tmp = (unsigned long) $randfunc();
17306                 if (tmp > max) max = tmp;
17307         }
17308         for (i = 0; max; i++)
17309                 max /= 2;
17310         printf("%d\n",i);
17311 }
17312 EOCP
17313                                 set try
17314                                 if eval $compile_ok; then
17315                                         dflt=`try`
17316                                 else
17317                                         dflt='?'
17318                                         echo "(I can't seem to compile the test program...)"
17319                                 fi
17320                                 ;;
17321                         *)
17322                                 dflt="$randbits"
17323                                 ;;
17324                         esac
17325                         rp="How many bits does your $randfunc() function produce?"
17326                         . ./myread
17327                         randbits="$ans"
17328                         $rm -f try.c try
17329                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17330                         seedfunc="s$randfunc"
17331                         randseedtype=unsigned
17332                         ;;
17333                 *)
17334                         dflt="31"
17335                         rp="How many bits does your $randfunc() function produce?"
17336                         . ./myread
17337                         randbits="$ans"
17338                         seedfunc="s$randfunc"
17339                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17340                         if set $seedfunc val -f; eval $csym; $val; then
17341                                 echo "(Using $seedfunc() to seed random generator)"
17342                         else
17343                                 echo "(Warning: no $seedfunc() to seed random generator)"
17344                                 seedfunc=rand
17345                         fi
17346                         randseedtype=unsigned
17347                         ;;
17348                 esac
17349                 ;;
17350         esac
17351 done
17352
17353 echo " "
17354 echo "Determining whether or not we are on an EBCDIC system..." >&4
17355 $cat >try.c <<'EOM'
17356 int main()
17357 {
17358   if ('M'==0xd4) return 0;
17359   return 1;
17360 }
17361 EOM
17362
17363 val=$undef
17364 set try
17365 if eval $compile_ok; then
17366         if $run ./try; then
17367                 echo "You seem to speak EBCDIC." >&4
17368                 val="$define"
17369         else
17370                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17371         fi
17372 else
17373         echo "I'm unable to compile the test program." >&4
17374         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17375 fi
17376 $rm -f try try.*
17377 set ebcdic
17378 eval $setvar
17379
17380 echo " "
17381 $cat >&4 <<EOM
17382 Checking how to flush all pending stdio output...
17383 EOM
17384 # I only know how to find the first 32 possibly open files on SunOS.
17385 # See also hints/sunos_4_1.sh and util.c  --AD
17386 case "$osname" in
17387 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17388 esac
17389 $cat >>try.c <<EOCP
17390 #include <stdio.h>
17391 #$i_unistd I_UNISTD
17392 #ifdef I_UNISTD
17393 # include <unistd.h>
17394 #endif
17395 #$d_sysconf HAS_SYSCONF
17396 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17397 #ifdef HAS_STDIO_STREAM_ARRAY
17398 # define STDIO_STREAM_ARRAY $stdio_stream_array
17399 #endif
17400 int main() {
17401   FILE* p;
17402   unlink("try.out");
17403   p = fopen("try.out", "w");
17404 #ifdef TRY_FPUTC
17405   fputc('x', p);
17406 #else
17407 # ifdef TRY_FPRINTF
17408   fprintf(p, "x");
17409 # endif
17410 #endif
17411 #ifdef TRY_FFLUSH_NULL
17412   fflush(NULL);
17413 #endif
17414 #ifdef TRY_FFLUSH_ALL
17415   {
17416     long open_max = -1;
17417 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17418     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17419 # else
17420 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17421     open_max = sysconf(_SC_OPEN_MAX);
17422 #  else
17423 #   ifdef FOPEN_MAX
17424     open_max = FOPEN_MAX;
17425 #   else
17426 #    ifdef OPEN_MAX
17427     open_max = OPEN_MAX;
17428 #    else
17429 #     ifdef _NFILE
17430     open_max = _NFILE;
17431 #     endif
17432 #    endif
17433 #   endif
17434 #  endif
17435 # endif 
17436 # ifdef HAS_STDIO_STREAM_ARRAY
17437     if (open_max > 0) {
17438       long i;
17439       for (i = 0; i < open_max; i++)
17440             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17441                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17442                 STDIO_STREAM_ARRAY[i]._flag)
17443                 fflush(&STDIO_STREAM_ARRAY[i]);
17444     }   
17445   }
17446 # endif
17447 #endif
17448   _exit(42);
17449 }
17450 EOCP
17451 : first we have to find out how _not_ to flush
17452 $to try.c
17453 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17454     output=''
17455     set try -DTRY_FPUTC
17456     if eval $compile; then
17457             $run ./try 2>/dev/null
17458             code="$?"
17459             $from try.out
17460             if $test ! -s try.out -a "X$code" = X42; then
17461                 output=-DTRY_FPUTC
17462             fi
17463     fi
17464     case "$output" in
17465     '')
17466             set try -DTRY_FPRINTF
17467             if eval $compile; then
17468                     $run ./try 2>/dev/null
17469                     code="$?"
17470                     $from try.out
17471                     if $test ! -s try.out -a "X$code" = X42; then
17472                         output=-DTRY_FPRINTF
17473                     fi
17474             fi
17475         ;;
17476     esac
17477 fi
17478 : check for fflush NULL behaviour
17479 case "$fflushNULL" in
17480 '')     set try -DTRY_FFLUSH_NULL $output
17481         if eval $compile; then
17482                 $run ./try 2>/dev/null
17483                 code="$?"
17484                 $from try.out
17485                 if $test -s try.out -a "X$code" = X42; then
17486                         fflushNULL="`$cat try.out`"
17487                 else
17488                         if $test "X$code" != X42; then
17489                                 $cat >&4 <<EOM
17490 (If this test failed, don't worry, we'll try another method shortly.)
17491 EOM
17492                         fi
17493                 fi
17494         fi
17495         $rm -f core try.core core.try.*
17496         case "$fflushNULL" in
17497         x)      $cat >&4 <<EOM
17498 Your fflush(NULL) works okay for output streams.
17499 Let's see if it clobbers input pipes...
17500 EOM
17501 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17502 # bug that improperly flushes the input end of pipes.  So we avoid the
17503 # autoflush on fork/system/exec support for now. :-(
17504 $cat >tryp.c <<EOCP
17505 #include <stdio.h>
17506 int
17507 main(int argc, char **argv)
17508 {
17509     char buf[1024];
17510     int i;
17511     char *bp = buf;
17512     while (1) {
17513         while ((i = getc(stdin)) != -1
17514                && (*bp++ = i) != '\n'
17515                && bp < &buf[1024])
17516         /* DO NOTHING */ ;
17517         *bp = '\0';
17518         fprintf(stdout, "%s", buf);
17519         fflush(NULL);
17520         if (i == -1)
17521             return 0;
17522         bp = buf;
17523     }
17524 }
17525 EOCP
17526                 fflushNULL="$define"
17527                 set tryp
17528                 if eval $compile; then
17529                     $rm -f tryp.out
17530                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17531                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17532                        $cat >&4 <<EOM
17533 fflush(NULL) seems to behave okay with input streams.
17534 EOM
17535                         fflushNULL="$define"
17536                     else
17537                         $cat >&4 <<EOM
17538 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17539 EOM
17540                         fflushNULL="$undef"
17541                     fi
17542                 fi
17543                 $rm -f core tryp.c tryp.core core.tryp.*
17544                 ;;
17545         '')     $cat >&4 <<EOM
17546 Your fflush(NULL) isn't working (contrary to ANSI C).
17547 EOM
17548                 fflushNULL="$undef"
17549                 ;;
17550         *)      $cat >&4 <<EOM
17551 Cannot figure out whether your fflush(NULL) works or not.
17552 I'm assuming it doesn't (contrary to ANSI C).
17553 EOM
17554                 fflushNULL="$undef"
17555                 ;;
17556         esac
17557         ;;
17558 $define|true|[yY]*)
17559         fflushNULL="$define"
17560         ;;
17561 *)
17562         fflushNULL="$undef"
17563         ;;
17564 esac
17565 : check explicit looping only if NULL did not work, and if the pipe
17566 : bug does not show up on an explicit flush too
17567 case "$fflushNULL" in
17568 "$undef")
17569         $cat >tryp.c <<EOCP
17570 #include <stdio.h>
17571 int
17572 main(int argc, char **argv)
17573 {
17574     char buf[1024];
17575     int i;
17576     char *bp = buf;
17577     while (1) {
17578         while ((i = getc(stdin)) != -1
17579                && (*bp++ = i) != '\n'
17580                && bp < &buf[1024])
17581         /* DO NOTHING */ ;
17582         *bp = '\0';
17583         fprintf(stdout, "%s", buf);
17584         fflush(stdin);
17585         if (i == -1)
17586             return 0;
17587         bp = buf;
17588     }
17589 }
17590 EOCP
17591         set tryp
17592         if eval $compile; then
17593             $rm -f tryp.out
17594             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17595             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17596                $cat >&4 <<EOM
17597 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17598 EOM
17599                 : now check for fflushall behaviour
17600                 case "$fflushall" in
17601                 '')     set try -DTRY_FFLUSH_ALL $output
17602                         if eval $compile; then
17603                                 $cat >&4 <<EOM
17604 (Now testing the other method--but note that this also may fail.)
17605 EOM
17606                                 $run ./try 2>/dev/null
17607                                 code=$?
17608                                 $from try.out
17609                                 if $test -s try.out -a "X$code" = X42; then
17610                                         fflushall="`$cat try.out`"
17611                                 fi
17612                         fi
17613                         $rm -f core try.core core.try.*
17614                         case "$fflushall" in
17615                         x)      $cat >&4 <<EOM
17616 Whew. Flushing explicitly all the stdio streams works.
17617 EOM
17618                                 fflushall="$define"
17619                                 ;;
17620                         '')     $cat >&4 <<EOM
17621 Sigh. Flushing explicitly all the stdio streams doesn't work.
17622 EOM
17623                                 fflushall="$undef"
17624                                 ;;
17625                         *)      $cat >&4 <<EOM
17626 Cannot figure out whether flushing stdio streams explicitly works or not.
17627 I'm assuming it doesn't.
17628 EOM
17629                                 fflushall="$undef"
17630                                 ;;
17631                         esac
17632                         ;;
17633                 "$define"|true|[yY]*)
17634                         fflushall="$define"
17635                         ;;
17636                 *)
17637                         fflushall="$undef"
17638                         ;;
17639                 esac
17640             else
17641                 $cat >&4 <<EOM
17642 All is futile.  Even fflush(stdin) clobbers input pipes!
17643 EOM
17644                 fflushall="$undef"
17645             fi
17646         else
17647             fflushall="$undef"
17648         fi
17649         $rm -f core tryp.c tryp.core core.tryp.*
17650         ;;
17651 *)      fflushall="$undef"
17652         ;;
17653 esac
17654
17655 case "$fflushNULL$fflushall" in
17656 undefundef)
17657         $cat <<EOM
17658 OK, I give up.  I cannot figure out how to flush pending stdio output.
17659 We won't be flushing handles at all before fork/exec/popen.
17660 EOM
17661         ;;
17662 esac
17663 $rm -f try.* try$exe_ext
17664
17665 : Store the full pathname to the ar program for use in the C program
17666 : Respect a hint or command line value for full_ar.
17667 case "$full_ar" in
17668 '') full_ar=$ar ;;
17669 esac
17670
17671 : Store the full pathname to the sed program for use in the C program
17672 full_sed=$sed
17673
17674 : see what type gids are declared as in the kernel
17675 echo " "
17676 echo "Looking for the type for group ids returned by getgid()."
17677 set gid_t gidtype xxx stdio.h sys/types.h
17678 eval $typedef
17679 case "$gidtype" in
17680 xxx)
17681         xxx=`./findhdr sys/user.h`
17682         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17683         case $1 in
17684         unsigned) dflt="$1 $2" ;;
17685         *) dflt="$1" ;;
17686         esac
17687         ;;
17688 *) dflt="$gidtype";;
17689 esac
17690 case "$gidtype" in
17691 gid_t) echo "gid_t found." ;;
17692 *)      rp="What is the type for group ids returned by getgid()?"
17693         . ./myread
17694         gidtype="$ans"
17695         ;;
17696 esac
17697
17698 echo " "
17699 case "$gidtype" in
17700 *_t) zzz="$gidtype"     ;;
17701 *)   zzz="gid"          ;;
17702 esac
17703 echo "Checking the size of $zzz..." >&4 
17704 cat > try.c <<EOCP
17705 #include <sys/types.h>
17706 #include <stdio.h>
17707 int main() {
17708     printf("%d\n", (int)sizeof($gidtype));
17709     exit(0);
17710 }
17711 EOCP
17712 set try
17713 if eval $compile_ok; then
17714         yyy=`$run ./try`
17715         case "$yyy" in
17716         '')     gidsize=4
17717                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17718                 ;;
17719         *)      gidsize=$yyy
17720                 echo "Your $zzz is $gidsize bytes long."
17721                 ;;
17722         esac
17723 else
17724         gidsize=4
17725         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17726 fi
17727
17728
17729 echo " "
17730 case "$gidtype" in
17731 *_t) zzz="$gidtype"     ;;
17732 *)   zzz="gid"          ;;
17733 esac
17734 echo "Checking the sign of $zzz..." >&4 
17735 cat > try.c <<EOCP
17736 #include <sys/types.h>
17737 #include <stdio.h>
17738 int main() {
17739         $gidtype foo = -1;
17740         if (foo < 0)
17741                 printf("-1\n");
17742         else
17743                 printf("1\n");
17744 }
17745 EOCP
17746 set try
17747 if eval $compile; then
17748         yyy=`$run ./try`
17749         case "$yyy" in
17750         '')     gidsign=1
17751                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17752                 ;;
17753         *)      gidsign=$yyy
17754                 case "$gidsign" in
17755                  1) echo "Your $zzz is unsigned." ;;
17756                 -1) echo "Your $zzz is signed."   ;;
17757                 esac
17758                 ;;
17759         esac
17760 else
17761         gidsign=1
17762         echo "(I can't compile the test program--guessing unsigned.)" >&4
17763 fi
17764
17765
17766 echo " "
17767
17768 if $test X"$quadtype" != X; then
17769
17770 echo "Checking how to print 64-bit integers..." >&4
17771
17772 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17773         $cat >try.c <<'EOCP'
17774 #include <sys/types.h>
17775 #include <stdio.h>
17776 int main() {
17777   int q = 12345678901;
17778   printf("%ld\n", q);
17779 }
17780 EOCP
17781         set try
17782         if eval $compile; then
17783                 yyy=`$run ./try`
17784                 case "$yyy" in
17785                 12345678901)
17786                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17787                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17788                         echo "We will use %d."
17789                         ;;
17790                 esac
17791         fi
17792 fi
17793
17794 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17795         $cat >try.c <<'EOCP'
17796 #include <sys/types.h>
17797 #include <stdio.h>
17798 int main() {
17799   long q = 12345678901;
17800   printf("%ld\n", q);
17801 }
17802 EOCP
17803         set try
17804         if eval $compile; then
17805                 yyy=`$run ./try`
17806                 case "$yyy" in
17807                 12345678901)
17808                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17809                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17810                         echo "We will use %ld."
17811                         ;;
17812                 esac
17813         fi
17814 fi
17815
17816 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17817         $cat >try.c <<'EOCP'
17818 #include <sys/types.h>
17819 #include <inttypes.h>
17820 #include <stdio.h>
17821 int main() {
17822   int64_t q = 12345678901;
17823   printf("%" PRId64 "\n", q);
17824 }
17825 EOCP
17826         set try
17827         if eval $compile; then
17828                 yyy=`$run ./try`
17829                 case "$yyy" in
17830                 12345678901)
17831                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17832                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17833                         echo "We will use the C9X style."
17834                         ;;
17835                 esac
17836         fi
17837 fi
17838
17839 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17840         $cat >try.c <<EOCP
17841 #include <sys/types.h>
17842 #include <stdio.h>
17843 int main() {
17844   $quadtype q = 12345678901;
17845   printf("%Ld\n", q);
17846 }
17847 EOCP
17848         set try
17849         if eval $compile; then
17850                 yyy=`$run ./try`
17851                 case "$yyy" in
17852                 12345678901)
17853                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17854                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17855                         echo "We will use %Ld."
17856                         ;;
17857                 esac
17858         fi
17859 fi
17860
17861 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17862         $cat >try.c <<'EOCP'
17863 #include <sys/types.h>
17864 #include <stdio.h>
17865 int main() {
17866   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17867   printf("%lld\n", q);
17868 }
17869 EOCP
17870         set try
17871         if eval $compile; then
17872                 yyy=`$run ./try`
17873                 case "$yyy" in
17874                 12345678901)
17875                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17876                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17877                         echo "We will use the %lld style."
17878                         ;;
17879                 esac
17880         fi
17881 fi
17882
17883 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17884         $cat >try.c <<EOCP
17885 #include <sys/types.h>
17886 #include <stdio.h>
17887 int main() {
17888   $quadtype q = 12345678901;
17889   printf("%qd\n", q);
17890 }
17891 EOCP
17892         set try
17893         if eval $compile; then
17894                 yyy=`$run ./try`
17895                 case "$yyy" in
17896                 12345678901)
17897                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17898                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17899                         echo "We will use %qd."
17900                         ;;
17901                 esac
17902         fi
17903 fi
17904
17905 if $test X"$sPRId64" = X; then
17906         echo "Cannot figure out how to print 64-bit integers." >&4
17907 fi
17908
17909 $rm -f try try.*
17910
17911 fi
17912
17913 case "$sPRId64" in
17914 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17915         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17916         ;;
17917 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17918         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17919         ;;
17920 esac
17921
17922
17923 echo " "
17924 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17925
17926 if $test X"$ivsize" = X8; then
17927         ivdformat="$sPRId64"
17928         uvuformat="$sPRIu64"
17929         uvoformat="$sPRIo64"
17930         uvxformat="$sPRIx64"
17931         uvXUformat="$sPRIXU64"
17932 else
17933         if $test X"$ivsize" = X"$longsize"; then
17934                 ivdformat='"ld"'
17935                 uvuformat='"lu"'
17936                 uvoformat='"lo"'
17937                 uvxformat='"lx"'
17938                 uvXUformat='"lX"'
17939         else
17940                 if $test X"$ivsize" = X"$intsize"; then
17941                         ivdformat='"d"'
17942                         uvuformat='"u"'
17943                         uvoformat='"o"'
17944                         uvxformat='"x"'
17945                         uvXUformat='"X"'
17946                 else
17947                         : far out
17948                         if $test X"$ivsize" = X"$shortsize"; then
17949                                 ivdformat='"hd"'
17950                                 uvuformat='"hu"'
17951                                 uvoformat='"ho"'
17952                                 uvxformat='"hx"'
17953                                 uvXUformat='"hX"'
17954                         fi
17955                 fi
17956         fi
17957 fi
17958
17959 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17960         nveformat="$sPRIeldbl"
17961         nvfformat="$sPRIfldbl"
17962         nvgformat="$sPRIgldbl"
17963         nvEUformat="$sPRIEUldbl"
17964         nvFUformat="$sPRIFUldbl"
17965         nvGUformat="$sPRIGUldbl"
17966 else
17967         nveformat='"e"'
17968         nvfformat='"f"'
17969         nvgformat='"g"'
17970         nvEUformat='"E"'
17971         nvFUformat='"F"'
17972         nvGUformat='"G"'
17973 fi
17974
17975 case "$ivdformat" in
17976 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17977     exit 1
17978     ;;
17979 esac
17980
17981
17982 echo " "
17983 $echo "Checking the format string to be used for gids..." >&4
17984
17985 case "$gidsign" in
17986 -1)     if $test X"$gidsize" = X"$ivsize"; then
17987                 gidformat="$ivdformat"
17988         else
17989                 if $test X"$gidsize" = X"$longsize"; then
17990                         gidformat='"ld"'
17991                 else
17992                         if $test X"$gidsize" = X"$intsize"; then
17993                                 gidformat='"d"'
17994                         else
17995                                 if $test X"$gidsize" = X"$shortsize"; then
17996                                         gidformat='"hd"'
17997                                 fi
17998                         fi
17999                 fi
18000         fi
18001         ;;
18002 *)      if $test X"$gidsize" = X"$uvsize"; then
18003                 gidformat="$uvuformat"
18004         else
18005                 if $test X"$gidsize" = X"$longsize"; then
18006                         gidformat='"lu"'
18007                 else
18008                         if $test X"$gidsize" = X"$intsize"; then
18009                                 gidformat='"u"'
18010                         else
18011                                 if $test X"$gidsize" = X"$shortsize"; then
18012                                         gidformat='"hu"'
18013                                 fi
18014                         fi
18015                 fi
18016         fi
18017         ;;
18018 esac
18019
18020 : see if getgroups exists
18021 set getgroups d_getgrps
18022 eval $inlibc
18023
18024 : see if setgroups exists
18025 set setgroups d_setgrps
18026 eval $inlibc
18027
18028
18029 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18030 echo " "
18031 case "$d_getgrps$d_setgrps" in
18032 *define*)
18033         case "$groupstype" in
18034         '') dflt="$gidtype" ;;
18035         *)  dflt="$groupstype" ;;
18036         esac
18037         $cat <<EOM
18038 What type of pointer is the second argument to getgroups() and setgroups()?
18039 Usually this is the same as group ids, $gidtype, but not always.
18040
18041 EOM
18042         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18043         . ./myread
18044         groupstype="$ans"
18045         ;;
18046 *)  groupstype="$gidtype";;
18047 esac
18048
18049 echo " "
18050 echo "Checking if your $make program sets \$(MAKE)..." >&4
18051 case "$make_set_make" in
18052 '')
18053         $sed 's/^X //' > testmake.mak << 'EOF'
18054 Xall:
18055 X       @echo 'maketemp="$(MAKE)"'
18056 EOF
18057         case "`$make -f testmake.mak 2>/dev/null`" in
18058         *maketemp=*) make_set_make='#' ;;
18059         *)      make_set_make="MAKE=$make" ;;
18060         esac
18061         $rm -f testmake.mak
18062         ;;
18063 esac
18064 case "$make_set_make" in
18065 '#') echo "Yup, it does.";;
18066 *) echo "Nope, it doesn't.";;
18067 esac
18068
18069 : see what type is used for mode_t
18070 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18071 set mode_t modetype int stdio.h sys/types.h
18072 eval $typedef_ask
18073
18074 : see if stdarg is available
18075 echo " "
18076 if $test `./findhdr stdarg.h`; then
18077         echo "<stdarg.h> found." >&4
18078         valstd="$define"
18079 else
18080         echo "<stdarg.h> NOT found." >&4
18081         valstd="$undef"
18082 fi
18083
18084 : see if varags is available
18085 echo " "
18086 if $test `./findhdr varargs.h`; then
18087         echo "<varargs.h> found." >&4
18088 else
18089         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18090 fi
18091
18092 : set up the varargs testing programs
18093 $cat > varargs.c <<EOP
18094 #ifdef I_STDARG
18095 #include <stdarg.h>
18096 #endif
18097 #ifdef I_VARARGS
18098 #include <varargs.h>
18099 #endif
18100
18101 #ifdef I_STDARG
18102 int f(char *p, ...)
18103 #else
18104 int f(va_alist)
18105 va_dcl
18106 #endif
18107 {
18108         va_list ap;
18109 #ifndef I_STDARG
18110         char *p;
18111 #endif
18112 #ifdef I_STDARG
18113         va_start(ap,p);
18114 #else
18115         va_start(ap);
18116         p = va_arg(ap, char *);
18117 #endif
18118         va_end(ap);
18119 }
18120 EOP
18121 $cat > varargs <<EOP
18122 $startsh
18123 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18124         echo "true"
18125 else
18126         echo "false"
18127 fi
18128 $rm -f varargs$_o
18129 EOP
18130 chmod +x varargs
18131
18132 : now check which varargs header should be included
18133 echo " "
18134 i_varhdr=''
18135 case "$valstd" in
18136 "$define")
18137         if `./varargs I_STDARG`; then
18138                 val='stdarg.h'
18139         elif `./varargs I_VARARGS`; then
18140                 val='varargs.h'
18141         fi
18142         ;;
18143 *)
18144         if `./varargs I_VARARGS`; then
18145                 val='varargs.h'
18146         fi
18147         ;;
18148 esac
18149 case "$val" in
18150 '')
18151 echo "I could not find the definition for va_dcl... You have problems..." >&4
18152         val="$undef"; set i_stdarg; eval $setvar
18153         val="$undef"; set i_varargs; eval $setvar
18154         ;;
18155 *) 
18156         set i_varhdr
18157         eval $setvar
18158         case "$i_varhdr" in
18159         stdarg.h)
18160                 val="$define"; set i_stdarg; eval $setvar
18161                 val="$undef"; set i_varargs; eval $setvar
18162                 ;;
18163         varargs.h)
18164                 val="$undef"; set i_stdarg; eval $setvar
18165                 val="$define"; set i_varargs; eval $setvar
18166                 ;;
18167         esac
18168         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18169 esac
18170 $rm -f varargs*
18171
18172 : see if we need va_copy
18173 echo " "
18174 case "$i_stdarg" in
18175 "$define")
18176         $cat >try.c <<EOCP
18177 #include <stdarg.h>
18178 #include <stdio.h>
18179 #$i_stdlib I_STDLIB
18180 #ifdef I_STDLIB
18181 #include <stdlib.h>
18182 #endif
18183 #include <signal.h>
18184
18185 int
18186 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18187 {
18188   return vfprintf(f, fmt, *valp);
18189 }
18190  
18191 int    
18192 myvfprintf(FILE *f, const  char *fmt, va_list val)
18193 {
18194   return ivfprintf(f, fmt, &val);
18195 }
18196       
18197 int
18198 myprintf(char *fmt, ...) 
18199 {
18200   va_list val;
18201   va_start(val, fmt);
18202   return myvfprintf(stdout, fmt, val); 
18203 }         
18204
18205 int
18206 main(int ac, char **av)
18207 {
18208   signal(SIGSEGV, exit);
18209
18210   myprintf("%s%cs all right, then\n", "that", '\'');                            
18211   exit(0);      
18212 }
18213 EOCP
18214         set try
18215         if eval $compile && $run ./try 2>&1 >/dev/null; then
18216                 case "`$run ./try`" in
18217                 "that's all right, then")
18218                         okay=yes
18219                         ;;
18220                 esac
18221         fi
18222         case "$okay" in
18223         yes)    echo "It seems that you don't need va_copy()." >&4
18224                 need_va_copy="$undef"
18225                 ;;
18226         *)      echo "It seems that va_copy() or similar will be needed." >&4
18227                 need_va_copy="$define"
18228                 ;;
18229         esac
18230         $rm -f try.* core core.* *.core *.core.*
18231         ;;
18232 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18233         ;;
18234 esac
18235
18236 : see what type is used for size_t
18237 rp="What is the type used for the length parameter for string functions?"
18238 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18239 eval $typedef_ask
18240
18241 : check for type of arguments to gethostbyaddr. 
18242 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18243         case "$d_gethbyaddr" in
18244         $define)
18245                 $cat <<EOM
18246
18247 Checking to see what type of arguments are accepted by gethostbyaddr().
18248 EOM
18249                 hdrs="$define sys/types.h
18250                         $d_socket sys/socket.h 
18251                         $i_niin netinet/in.h 
18252                         $i_netdb netdb.h
18253                         $i_unistd unistd.h"
18254                 : The first arg can 'char *' or 'void *'
18255                 : The second arg is some of integral type
18256                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18257                         for yyy in size_t long int; do
18258                                 case "$netdb_host_type" in
18259                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18260                                         if ./protochk "$try" $hdrs; then
18261                                                 echo "Your system accepts $xxx for the first arg."
18262                                                 echo "...and $yyy for the second arg."
18263                                                 netdb_host_type="$xxx"
18264                                                 netdb_hlen_type="$yyy"
18265                                         fi
18266                                         ;;
18267                                 esac
18268                         done
18269                 done
18270                 : In case none of those worked, prompt the user.
18271                 case "$netdb_host_type" in
18272                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18273                         dflt='char *'
18274                         . ./myread
18275                         netdb_host_type=$ans
18276                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18277                         dflt="$sizetype"
18278                         . ./myread
18279                         netdb_hlen_type=$ans
18280                         ;;
18281                 esac
18282                 ;;
18283         *)      : no gethostbyaddr, so pick harmless defaults
18284                 netdb_host_type='char *'
18285                 netdb_hlen_type="$sizetype"
18286                 ;;
18287         esac
18288         # Remove the "const" if needed. -- but then we'll have a 
18289         # prototype clash!
18290         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18291 fi
18292
18293 : check for type of argument to gethostbyname. 
18294 if test "X$netdb_name_type" = X ; then
18295         case "$d_gethbyname" in
18296         $define)
18297                 $cat <<EOM
18298
18299 Checking to see what type of argument is accepted by gethostbyname().
18300 EOM
18301                 hdrs="$define sys/types.h
18302                         $d_socket sys/socket.h 
18303                         $i_niin netinet/in.h 
18304                         $i_netdb netdb.h
18305                         $i_unistd unistd.h"
18306                 for xxx in "const char *" "char *"; do
18307                         case "$netdb_name_type" in
18308                         '')     try="extern struct hostent *gethostbyname($xxx);"
18309                                 if ./protochk "$try" $hdrs; then
18310                                         echo "Your system accepts $xxx."
18311                                         netdb_name_type="$xxx"
18312                                 fi
18313                                 ;;
18314                         esac
18315                 done
18316                 : In case none of those worked, prompt the user.
18317                 case "$netdb_name_type" in
18318                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18319                         dflt='char *'
18320                         . ./myread
18321                         netdb_name_type=$ans
18322                         ;;
18323                 esac
18324                 ;;
18325         *)      : no gethostbyname, so pick harmless default
18326                 netdb_name_type='char *'
18327                 ;;
18328         esac
18329 fi
18330
18331 : check for type of 1st argument to getnetbyaddr. 
18332 if test "X$netdb_net_type" = X ; then
18333         case "$d_getnbyaddr" in
18334         $define)
18335                 $cat <<EOM
18336
18337 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18338 EOM
18339                 hdrs="$define sys/types.h
18340                         $d_socket sys/socket.h 
18341                         $i_niin netinet/in.h 
18342                         $i_netdb netdb.h
18343                         $i_unistd unistd.h"
18344                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18345                         case "$netdb_net_type" in
18346                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18347                                 if ./protochk "$try" $hdrs; then
18348                                         echo "Your system accepts $xxx."
18349                                         netdb_net_type="$xxx"
18350                                 fi
18351                                 ;;
18352                         esac
18353                 done
18354                 : In case none of those worked, prompt the user.
18355                 case "$netdb_net_type" in
18356                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18357                         dflt='long'
18358                         . ./myread
18359                         netdb_net_type=$ans
18360                         ;;
18361                 esac
18362                 ;;
18363         *)      : no getnetbyaddr, so pick harmless default
18364                 netdb_net_type='long'
18365                 ;;
18366         esac
18367 fi
18368 : locate the preferred pager for this system
18369 fn=f/
18370 case "$pager" in
18371 '')
18372         dflt=''
18373         case "$pg" in
18374         /*) dflt=$pg;;
18375         [a-zA-Z]:/*) dflt=$pg;;
18376         esac
18377         case "$more" in
18378         /*) dflt=$more;;
18379         [a-zA-Z]:/*) dflt=$more;;
18380         esac
18381         case "$less" in
18382         /*) dflt=$less;;
18383         [a-zA-Z]:/*) dflt=$less;;
18384         esac
18385         case "$dflt" in
18386         '') dflt=/usr/ucb/more;;
18387         esac
18388         ;;
18389 *)      dflt="$pager"
18390         : Instruct ./getfile to trust the hinted or previous pager value,
18391         : even if it does not begin with a slash.  For example, on os2,
18392         : pager might be cmd /c more.  See comments in UU/getfile.
18393         fn="f/($pager)"
18394         ;;
18395 esac
18396 echo " "
18397 rp='What pager is used on your system?'
18398 . ./getfile
18399 pager="$ans"
18400
18401 : see what type pids are declared as in the kernel
18402 rp="What is the type of process ids on this system?"
18403 set pid_t pidtype int stdio.h sys/types.h
18404 eval $typedef_ask
18405
18406 : Find earliest binary compatible site_perl subdirectory perl can use.
18407 xs_apiversion=$version # The current site_perl version.
18408 : Find earliest pure perl site_perl subdirectory perl can use.
18409 : The versioned directories started at 5.005.
18410 pm_apiversion='5.005'
18411
18412 : see if ar generates random libraries by itself
18413 echo " "
18414 echo "Checking how to generate random libraries on your machine..." >&4
18415 echo 'int bar1() { return bar2(); }' > bar1.c
18416 echo 'int bar2() { return 2; }' > bar2.c
18417 $cat > foo.c <<'EOP'
18418 int main() { printf("%d\n", bar1()); exit(0); }
18419 EOP
18420 $cc $ccflags -c bar1.c >/dev/null 2>&1
18421 $cc $ccflags -c bar2.c >/dev/null 2>&1
18422 $cc $ccflags -c foo.c >/dev/null 2>&1
18423 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18424 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18425         $run ./foobar >/dev/null 2>&1; then
18426         echo "$ar appears to generate random libraries itself."
18427         orderlib=false
18428         ranlib=":"
18429 elif $ar ts bar$_a >/dev/null 2>&1 &&
18430         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18431         $run ./foobar >/dev/null 2>&1; then
18432                 echo "a table of contents needs to be added with '$ar ts'."
18433                 orderlib=false
18434                 ranlib="$ar ts"
18435 else
18436         case "$ranlib" in
18437         :) ranlib='';;
18438         '')
18439                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18440                 $test -f $ranlib || ranlib=''
18441                 ;;
18442         esac
18443         if $test -n "$ranlib"; then
18444                 echo "your system has '$ranlib'; we'll use that."
18445                 orderlib=false
18446         else
18447                 echo "your system doesn't seem to support random libraries"
18448                 echo "so we'll use lorder and tsort to order the libraries."
18449                 orderlib=true
18450                 ranlib=":"
18451         fi
18452 fi
18453 $rm -f foo* bar* 
18454
18455 : check for type of arguments to select. 
18456 case "$selecttype" in
18457 '') case "$d_select" in
18458         $define)
18459                 echo " "
18460                 $cat <<EOM
18461 Checking to see what type of arguments are accepted by select().
18462 EOM
18463                 hdrs="$define sys/types.h
18464                         $i_systime sys/time.h 
18465                         $i_sysselct sys/select.h
18466                         $d_socket sys/socket.h"
18467                 : The first arg can be int, unsigned, or size_t
18468                 : The last arg may or may not be 'const'
18469                 val=''
18470                 : void pointer has been seen but using that
18471                 : breaks the selectminbits test
18472                 for xxx in 'fd_set *' 'int *'; do
18473                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18474                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18475                                         case "$val" in
18476                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18477                                                 if ./protochk "$try" $hdrs; then
18478                                                         echo "Your system accepts $xxx."
18479                                                         val="$xxx"
18480                                                 fi
18481                                                 ;;
18482                                         esac
18483                                 done
18484                         done
18485                 done
18486                 case "$val" in
18487                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18488                         case "$d_fd_set" in
18489                                 $define) dflt="fd_set *" ;;
18490                                 *)              dflt="int *" ;;
18491                         esac
18492                         . ./myread
18493                         val=$ans
18494                         ;;
18495                 esac
18496                 selecttype="$val"
18497                 ;;
18498         *)      : no select, so pick a harmless default
18499                 selecttype='int *'
18500                 ;;
18501         esac
18502         ;;
18503 esac
18504
18505 : check for the select 'width'
18506 case "$selectminbits" in
18507 '') case "$d_select" in
18508         $define)
18509                 $cat <<EOM
18510
18511 Checking to see on how many bits at a time your select() operates...
18512 EOM
18513                 $cat >try.c <<EOCP
18514 #include <sys/types.h>
18515 #$i_time I_TIME
18516 #$i_systime I_SYS_TIME
18517 #$i_systimek I_SYS_TIME_KERNEL
18518 #ifdef I_TIME
18519 #   include <time.h>
18520 #endif
18521 #ifdef I_SYS_TIME
18522 #   ifdef I_SYS_TIME_KERNEL
18523 #       define KERNEL
18524 #   endif
18525 #   include <sys/time.h>
18526 #   ifdef I_SYS_TIME_KERNEL
18527 #       undef KERNEL
18528 #   endif
18529 #endif
18530 #$i_sysselct I_SYS_SELECT
18531 #ifdef I_SYS_SELECT
18532 #include <sys/select.h>
18533 #endif
18534 #$d_socket HAS_SOCKET
18535 #ifdef HAS_SOCKET
18536 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18537 #endif
18538 #include <stdio.h>
18539 $selecttype b;
18540 #define S sizeof(*(b))
18541 #define MINBITS 64
18542 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18543 #define NBITS  (NBYTES * 8)
18544 int main() {
18545     char s[NBYTES];
18546     struct timeval t;
18547     int i;
18548     FILE* fp;
18549     int fd;
18550
18551     fclose(stdin);
18552     fp = fopen("try.c", "r");
18553     if (fp == 0)
18554       exit(1);
18555     fd = fileno(fp);
18556     if (fd < 0)
18557       exit(2);
18558     b = ($selecttype)s;
18559     for (i = 0; i < NBITS; i++)
18560         FD_SET(i, b);
18561     t.tv_sec  = 0;
18562     t.tv_usec = 0;
18563     select(fd + 1, b, 0, 0, &t);
18564     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18565     printf("%d\n", i + 1);
18566     return 0;
18567 }
18568 EOCP
18569                 set try
18570                 if eval $compile_ok; then
18571                         selectminbits=`$run ./try`
18572                         case "$selectminbits" in
18573                         '')     cat >&4 <<EOM
18574 Cannot figure out on how many bits at a time your select() operates.
18575 I'll play safe and guess it is 32 bits.
18576 EOM
18577                                 selectminbits=32
18578                                 bits="32 bits"
18579                                 ;;
18580                         1)      bits="1 bit" ;;
18581                         *)      bits="$selectminbits bits" ;;
18582                         esac
18583                         echo "Your select() operates on $bits at a time." >&4
18584                 else
18585                         rp='What is the minimum number of bits your select() operates on?'
18586                         case "$byteorder" in
18587                         1234|12345678)  dflt=32 ;;
18588                         *)              dflt=1  ;;
18589                         esac
18590                         . ./myread
18591                         val=$ans
18592                         selectminbits="$val"
18593                 fi
18594                 $rm -f try.* try
18595                 ;;
18596         *)      : no select, so pick a harmless default
18597                 selectminbits='32'
18598                 ;;
18599         esac
18600         ;;
18601 esac
18602
18603 : Trace out the files included by signal.h, then look for SIGxxx names.
18604 : Remove SIGARRAYSIZE used by HPUX.
18605 : Remove SIGSTKSIZE used by Linux.
18606 : Remove SIGSTKSZ used by Posix.
18607 : Remove SIGTYP void lines used by OS2.
18608 : Some cpps, like os390, dont give the file name anywhere
18609 if [ "X$fieldn" = X ]; then
18610         : Just make some guesses.  We check them later.
18611         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18612 else
18613         xxx=`echo '#include <signal.h>' |
18614         $cppstdin $cppminus $cppflags 2>/dev/null |
18615         $grep '^[       ]*#.*include' | 
18616         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18617 fi
18618 : Check this list of files to be sure we have parsed the cpp output ok.
18619 : This will also avoid potentially non-existent files, such 
18620 : as ../foo/bar.h
18621 xxxfiles=''
18622 for xx in $xxx /dev/null ; do
18623         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18624 done
18625 : If we have found no files, at least try signal.h
18626 case "$xxxfiles" in
18627 '')     xxxfiles=`./findhdr signal.h` ;;
18628 esac
18629 xxx=`awk '
18630 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18631         print substr($2, 4, 20)
18632 }
18633 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18634         print substr($3, 4, 20)
18635 }' $xxxfiles`
18636 : Append some common names just in case the awk scan failed.
18637 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18638 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18639 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18640 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18641 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18642
18643 : generate a few handy files for later
18644 $cat > signal.c <<'EOCP'
18645 #include <sys/types.h>
18646 #include <signal.h>
18647 #include <stdio.h>
18648 int main() {
18649
18650 /* Strange style to avoid deeply-nested #if/#else/#endif */
18651 #ifndef NSIG
18652 #  ifdef _NSIG
18653 #    define NSIG (_NSIG)
18654 #  endif
18655 #endif
18656
18657 #ifndef NSIG
18658 #  ifdef SIGMAX
18659 #    define NSIG (SIGMAX+1)
18660 #  endif
18661 #endif
18662
18663 #ifndef NSIG
18664 #  ifdef SIG_MAX
18665 #    define NSIG (SIG_MAX+1)
18666 #  endif
18667 #endif
18668
18669 #ifndef NSIG
18670 #  ifdef MAXSIG
18671 #    define NSIG (MAXSIG+1)
18672 #  endif
18673 #endif
18674
18675 #ifndef NSIG
18676 #  ifdef MAX_SIG
18677 #    define NSIG (MAX_SIG+1)
18678 #  endif
18679 #endif
18680
18681 #ifndef NSIG
18682 #  ifdef SIGARRAYSIZE
18683 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18684 #  endif
18685 #endif
18686
18687 #ifndef NSIG
18688 #  ifdef _sys_nsig
18689 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18690 #  endif
18691 #endif
18692
18693 /* Default to some arbitrary number that's big enough to get most
18694    of the common signals.
18695 */
18696 #ifndef NSIG
18697 #    define NSIG 50
18698 #endif
18699
18700 printf("NSIG %d\n", NSIG);
18701
18702 #ifndef JUST_NSIG
18703
18704 EOCP
18705
18706 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18707 {
18708         printf "#ifdef SIG"; printf $1; printf "\n"
18709         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18710         printf $1; printf ");\n"
18711         printf "#endif\n"
18712 }
18713 END {
18714         printf "#endif /* JUST_NSIG */\n";
18715         printf "exit(0);\n}\n";
18716 }
18717 ' >>signal.c
18718 $cat >signal.awk <<'EOP'
18719 BEGIN { ndups = 0 }
18720 $1 ~ /^NSIG$/ { nsig = $2 }
18721 ($1 !~ /^NSIG$/) && (NF == 2) {
18722     if ($2 > maxsig) { maxsig = $2 }
18723     if (sig_name[$2]) {
18724         dup_name[ndups] = $1
18725         dup_num[ndups] = $2
18726         ndups++ 
18727     }
18728     else {
18729         sig_name[$2] = $1
18730         sig_num[$2] = $2
18731     }
18732 }
18733 END { 
18734     if (nsig == 0) {
18735         nsig = maxsig + 1
18736     }
18737     printf("NSIG %d\n", nsig);
18738     for (n = 1; n < nsig; n++) {
18739         if (sig_name[n]) {
18740             printf("%s %d\n", sig_name[n], sig_num[n])
18741         }
18742         else {
18743             printf("NUM%d %d\n", n, n) 
18744         }
18745     }
18746     for (n = 0; n < ndups; n++) {
18747         printf("%s %d\n", dup_name[n], dup_num[n])
18748     }
18749 }
18750 EOP
18751 $cat >signal_cmd <<EOS
18752 $startsh
18753 if $test -s signal.lst; then
18754     echo "Using your existing signal.lst file"
18755         exit 0
18756 fi
18757 xxx="$xxx"
18758 EOS
18759 $cat >>signal_cmd <<'EOS'
18760
18761 set signal
18762 if eval $compile_ok; then
18763         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18764 else
18765         echo "(I can't seem be able to compile the whole test program)" >&4
18766         echo "(I'll try it in little pieces.)" >&4
18767         set signal -DJUST_NSIG
18768         if eval $compile_ok; then
18769                 $run ./signal$_exe > signal.nsg
18770                 $cat signal.nsg
18771         else
18772                 echo "I can't seem to figure out how many signals you have." >&4
18773                 echo "Guessing 50." >&4
18774                 echo 'NSIG 50' > signal.nsg
18775         fi
18776         : Now look at all the signal names, one at a time.
18777         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18778                 $cat > signal.c <<EOCP
18779 #include <sys/types.h>
18780 #include <signal.h>
18781 #include <stdio.h>
18782 int main() {
18783 printf("$xx %d\n", SIG${xx});
18784 return 0;
18785 }
18786 EOCP
18787                 set signal
18788                 if eval $compile; then
18789                         echo "SIG${xx} found."
18790                         $run ./signal$_exe  >> signal.ls1
18791                 else
18792                         echo "SIG${xx} NOT found."
18793                 fi
18794         done
18795         if $test -s signal.ls1; then
18796                 $cat signal.nsg signal.ls1 |
18797                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18798         fi
18799
18800 fi
18801 if $test -s signal.lst; then
18802         :
18803 else
18804         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18805         echo 'kill -l' >signal
18806         set X `csh -f <signal`
18807         $rm -f signal
18808         shift
18809         case $# in
18810         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18811         esac
18812         echo $@ | $tr ' ' $trnl | \
18813             $awk '{ printf "%s %d\n", $1, ++s; }
18814                   END { printf "NSIG %d\n", ++s }' >signal.lst
18815 fi
18816 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18817 EOS
18818 chmod a+x signal_cmd
18819 $eunicefix signal_cmd
18820
18821 : generate list of signal names
18822 echo " "
18823 case "$sig_name_init" in
18824 '') doinit=yes ;;
18825 *)  case "$sig_num_init" in
18826     ''|*,*) doinit=yes ;;
18827     esac ;;
18828 esac
18829 case "$doinit" in
18830 yes)
18831         echo "Generating a list of signal names and numbers..." >&4
18832         . ./signal_cmd
18833         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18834         sig_name=`$awk 'BEGIN { printf "ZERO " }
18835                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18836         sig_num=`$awk  'BEGIN { printf "0 " }
18837                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18838         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18839                              !/^NSIG/   { printf "\"%s\", ", $1 }
18840                              END        { printf "0\n" }' signal.lst`
18841         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18842                              !/^NSIG/   { printf "%d, ", $2}
18843                              END        { printf "0\n"}' signal.lst`
18844         ;;
18845 esac
18846 echo "The following $sig_count signals are available:"
18847 echo " "
18848 echo $sig_name | $awk \
18849 'BEGIN { linelen = 0 }
18850 {
18851         for (i = 1; i <= NF; i++) {
18852                 name = "SIG" $i " "
18853                 linelen = linelen + length(name)
18854                 if (linelen > 70) {
18855                         printf "\n"
18856                         linelen = length(name)
18857                 }
18858                 printf "%s", name
18859         }
18860         printf "\n"
18861 }'
18862 sig_size=`echo $sig_name | awk '{print NF}'`
18863 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18864
18865 echo " "
18866 case "$sizetype" in
18867 *_t) zzz="$sizetype"    ;;
18868 *)   zzz="filesize"     ;;
18869 esac
18870 echo "Checking the size of $zzz..." >&4 
18871 cat > try.c <<EOCP
18872 #include <sys/types.h>
18873 #include <stdio.h>
18874 int main() {
18875     printf("%d\n", (int)sizeof($sizetype));
18876     exit(0);
18877 }
18878 EOCP
18879 set try
18880 if eval $compile_ok; then
18881         yyy=`$run ./try`
18882         case "$yyy" in
18883         '')     sizesize=4
18884                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18885                 ;;
18886         *)      sizesize=$yyy
18887                 echo "Your $zzz size is $sizesize bytes."
18888                 ;;
18889         esac
18890 else
18891         sizesize=4
18892         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18893 fi
18894
18895
18896 : check for socklen_t
18897 echo " "
18898 echo "Checking to see if you have socklen_t..." >&4
18899 $cat >try.c <<EOCP
18900 #include <sys/types.h>
18901 #$d_socket HAS_SOCKET
18902 #ifdef HAS_SOCKET
18903 #include <sys/socket.h>
18904 #endif
18905 int main() { socklen_t x = 16; }
18906 EOCP
18907 set try
18908 if eval $compile; then
18909         val="$define"
18910         echo "You have socklen_t."
18911 else
18912         val="$undef"
18913         echo "You do not have socklen_t."
18914         case "$sizetype" in
18915         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18916         esac
18917 fi
18918 $rm -f try try.*
18919 set d_socklen_t
18920 eval $setvar
18921
18922 : see if this is a socks.h system
18923 set socks.h i_socks
18924 eval $inhdr
18925
18926 : check for type of the size argument to socket calls
18927 case "$d_socket" in
18928 "$define")
18929         $cat <<EOM
18930
18931 Checking to see what type is the last argument of accept().
18932 EOM
18933         yyy=''
18934         case "$d_socklen_t" in
18935         "$define") yyy="$yyy socklen_t"
18936         esac
18937         yyy="$yyy $sizetype int long unsigned"
18938         for xxx in $yyy; do
18939                 case "$socksizetype" in
18940                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18941                         case "$usesocks" in
18942                         "$define")
18943                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18944                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18945                                         socksizetype="$xxx"
18946                                 fi
18947                                 ;;
18948                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18949                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18950                                         socksizetype="$xxx"
18951                                 fi
18952                                 ;;
18953                         esac
18954                         ;;
18955                 esac
18956         done
18957 : In case none of those worked, prompt the user.
18958         case "$socksizetype" in
18959         '')     rp='What is the type for socket address structure sizes?'
18960                 dflt='int'
18961                 . ./myread
18962                 socksizetype=$ans
18963                 ;;
18964         esac
18965         ;;
18966 *)      : no sockets, so pick relatively harmless default
18967         socksizetype='int'
18968         ;;
18969 esac
18970
18971 : see what type is used for signed size_t
18972 set ssize_t ssizetype int stdio.h sys/types.h
18973 eval $typedef
18974 dflt="$ssizetype"
18975 $cat > try.c <<EOM
18976 #include <stdio.h>
18977 #include <sys/types.h>
18978 #define Size_t $sizetype
18979 #define SSize_t $dflt
18980 int main()
18981 {
18982         if (sizeof(Size_t) == sizeof(SSize_t))
18983                 printf("$dflt\n");
18984         else if (sizeof(Size_t) == sizeof(int))
18985                 printf("int\n");
18986         else 
18987                 printf("long\n");
18988         exit(0);
18989 }
18990 EOM
18991 echo " "
18992 set try
18993 if eval $compile_ok && $run ./try > /dev/null; then
18994         ssizetype=`$run ./try`
18995         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18996 else
18997         $cat >&4 <<EOM
18998 Help! I can't compile and run the ssize_t test program: please enlighten me!
18999 (This is probably a misconfiguration in your system or libraries, and
19000 you really ought to fix it.  Still, I'll try anyway.)
19001
19002 I need a type that is the same size as $sizetype, but is guaranteed to
19003 be signed.  Common values are ssize_t, int and long.
19004
19005 EOM
19006         rp="What signed type is the same size as $sizetype?"
19007         . ./myread
19008         ssizetype="$ans"
19009 fi
19010 $rm -f try try.*
19011
19012 : see what type of char stdio uses.
19013 echo " "
19014 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19015 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19016         echo "Your stdio uses unsigned chars." >&4
19017         stdchar="unsigned char"
19018 else
19019         echo "Your stdio uses signed chars." >&4
19020         stdchar="char"
19021 fi
19022 $rm -f stdioh
19023
19024
19025
19026 : see what type uids are declared as in the kernel
19027 echo " "
19028 echo "Looking for the type for user ids returned by getuid()."
19029 set uid_t uidtype xxx stdio.h sys/types.h
19030 eval $typedef
19031 case "$uidtype" in
19032 xxx)
19033         xxx=`./findhdr sys/user.h`
19034         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19035         case $1 in
19036         unsigned) dflt="$1 $2" ;;
19037         *) dflt="$1" ;;
19038         esac
19039         ;;
19040 *) dflt="$uidtype";;
19041 esac
19042 case "$uidtype" in
19043 uid_t)  echo "uid_t found." ;;
19044 *)      rp="What is the type for user ids returned by getuid()?"
19045         . ./myread
19046         uidtype="$ans"
19047         ;;
19048 esac
19049
19050 echo " "
19051 case "$uidtype" in
19052 *_t) zzz="$uidtype"     ;;
19053 *)   zzz="uid"          ;;
19054 esac
19055 echo "Checking the size of $zzz..." >&4 
19056 cat > try.c <<EOCP
19057 #include <sys/types.h>
19058 #include <stdio.h>
19059 int main() {
19060     printf("%d\n", (int)sizeof($uidtype));
19061     exit(0);
19062 }
19063 EOCP
19064 set try
19065 if eval $compile_ok; then
19066         yyy=`$run ./try`
19067         case "$yyy" in
19068         '')     uidsize=4
19069                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19070                 ;;
19071         *)      uidsize=$yyy
19072                 echo "Your $zzz is $uidsize bytes long."
19073                 ;;
19074         esac
19075 else
19076         uidsize=4
19077         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19078 fi
19079
19080 echo " "
19081 case "$uidtype" in
19082 *_t) zzz="$uidtype"     ;;
19083 *)   zzz="uid"          ;;
19084 esac
19085 echo "Checking the sign of $zzz..." >&4
19086 cat > try.c <<EOCP
19087 #include <sys/types.h>
19088 #include <stdio.h>
19089 int main() {
19090         $uidtype foo = -1;
19091         if (foo < 0)
19092                 printf("-1\n");
19093         else
19094                 printf("1\n");
19095 }
19096 EOCP
19097 set try
19098 if eval $compile; then
19099         yyy=`$run ./try`
19100         case "$yyy" in
19101         '')     uidsign=1
19102                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19103                 ;;
19104         *)      uidsign=$yyy
19105                 case "$uidsign" in
19106                  1) echo "Your $zzz is unsigned." ;;
19107                 -1) echo "Your $zzz is signed."   ;;
19108                 esac
19109                 ;;
19110         esac
19111 else
19112         uidsign=1
19113         echo "(I can't compile the test program--guessing unsigned.)" >&4
19114 fi
19115
19116
19117
19118 echo " "
19119 $echo "Checking the format string to be used for uids..." >&4
19120
19121 case "$uidsign" in
19122 -1)     if $test X"$uidsize" = X"$ivsize"; then
19123                 uidformat="$ivdformat"
19124         else
19125                 if $test X"$uidsize" = X"$longsize"; then
19126                         uidformat='"ld"'
19127                 else
19128                         if $test X"$uidsize" = X"$intsize"; then
19129                                 uidformat='"d"'
19130                         else
19131                                 if $test X"$uidsize" = X"$shortsize"; then
19132                                         uidformat='"hd"'
19133                                 fi
19134                         fi
19135                 fi
19136         fi
19137         ;;
19138 *)      if $test X"$uidsize" = X"$uvsize"; then
19139                 uidformat="$uvuformat"
19140         else
19141                 if $test X"$uidsize" = X"$longsize"; then
19142                         uidformat='"lu"'
19143                 else
19144                         if $test X"$uidsize" = X"$intsize"; then
19145                                 uidformat='"u"'
19146                         else
19147                                 if $test X"$uidsize" = X"$shortsize"; then
19148                                         uidformat='"hu"'
19149                                 fi
19150                         fi
19151                 fi
19152         fi
19153         ;;
19154 esac
19155
19156 : determine compiler compiler
19157 case "$yacc" in
19158 '')
19159         dflt=yacc;;
19160 *)
19161         dflt="$yacc";;
19162 esac
19163 echo " "
19164 comp='yacc'
19165 if $test -f "$byacc$_exe"; then
19166         dflt="$byacc"
19167         comp="byacc or $comp"
19168 fi
19169 if $test -f "$bison$_exe"; then
19170         comp="$comp or bison -y"
19171 fi
19172 rp="Which compiler compiler ($comp) shall I use?"
19173 . ./myread
19174 yacc="$ans"
19175 case "$yacc" in
19176 *bis*)
19177         case "$yacc" in
19178         *-y*) ;;
19179         *)
19180                 yacc="$yacc -y"
19181                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19182                 ;;
19183         esac
19184         ;;
19185 esac
19186
19187 : see if this is a fp.h system
19188 set fp.h i_fp
19189 eval $inhdr
19190
19191 : see if this is a fp_class.h system
19192 set fp_class.h i_fp_class
19193 eval $inhdr
19194
19195 : see if this is a ieeefp.h system
19196 case "$i_ieeefp" in
19197 '' ) set ieeefp.h i_ieeefp
19198      eval $inhdr
19199      ;;
19200 esac
19201
19202 : see if this is a libutil.h system
19203 set libutil.h i_libutil
19204 eval $inhdr
19205
19206 : see if mach cthreads are available
19207 if test "X$usethreads" = "X$define"; then
19208         set mach/cthreads.h i_machcthr
19209         eval $inhdr
19210 else
19211         i_machcthr="$undef"
19212 fi
19213
19214
19215
19216 : see if this is a math.h system
19217 set math.h i_math
19218 eval $inhdr
19219
19220 : see if this is a mntent.h system
19221 set mntent.h i_mntent
19222 eval $inhdr
19223
19224 : see if ndbm.h is available
19225 set ndbm.h t_ndbm
19226 eval $inhdr
19227
19228 case "$t_ndbm" in
19229 $undef)
19230     # Some Linux distributions such as RedHat 7.1 put the
19231     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19232     if $test -f /usr/include/gdbm/ndbm.h; then
19233         echo '<gdbm/ndbm.h> found.'
19234         ccflags="$ccflags -I/usr/include/gdbm"
19235         cppflags="$cppflags -I/usr/include/gdbm"
19236         t_ndbm=$define
19237     fi
19238     ;;
19239 esac
19240
19241 case "$t_ndbm" in
19242 $define)
19243         : see if dbm_open exists
19244         set dbm_open d_dbm_open
19245         eval $inlibc
19246         case "$d_dbm_open" in
19247         $undef)
19248                 t_ndbm="$undef"
19249                 echo "We won't be including <ndbm.h>"
19250                 ;;
19251         esac
19252         ;;
19253 esac
19254 val="$t_ndbm"
19255 set i_ndbm
19256 eval $setvar
19257
19258 : see if net/errno.h is available
19259 val=''
19260 set net/errno.h val
19261 eval $inhdr
19262
19263 : Unfortunately, it causes problems on some systems.  Arrgh.
19264 case "$val" in
19265 $define)
19266         cat > try.c <<'EOM'
19267 #include <stdio.h>
19268 #include <errno.h>
19269 #include <net/errno.h>
19270 int func()
19271 {
19272         return ENOTSOCK;
19273 }
19274 EOM
19275         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19276                 echo "We'll be including <net/errno.h>." >&4
19277         else
19278                 echo "We won't be including <net/errno.h>." >&4
19279                 val="$undef"
19280         fi
19281         $rm -f try.* try
19282         ;;
19283 esac
19284 set i_neterrno
19285 eval $setvar
19286
19287 : see if netinet/tcp.h is available
19288 set netinet/tcp.h i_netinettcp
19289 eval $inhdr
19290
19291 : see if this is a poll.h system
19292 set poll.h i_poll
19293 eval $inhdr
19294
19295 : see if this is a prot.h system
19296 set prot.h i_prot
19297 eval $inhdr
19298
19299 echo " "
19300 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19301 $cat <<'EOSH' > Cppsym.know
19302 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19303 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19304 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19305 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19306 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19307 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19308 bull c cadmus clipper CMU COFF COMPILER_VERSION
19309 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19310 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19311 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19312 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19313 GLIBC GLIBC_MINOR
19314 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19315 H3050R H3050RX hbullx20 hcx host_mips
19316 hp200 hp300 hp700 HP700 hp800 hp9000
19317 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19318 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19319 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19320 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19321 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19322 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19323 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19324 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19325 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19326 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19327 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19328 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19329 MATH_HAS_NO_SIDE_EFFECTS
19330 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19331 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19332 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19333 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19334 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19335 NetBSD news1500 news1700 news1800 news1900 news3700
19336 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19337 ns32016 ns32332 ns32k nsc32000
19338 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19339 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19340 pc532 pdp11 PGC PIC plexus PORTAR posix
19341 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19342 POSIX_C_SOURCE POSIX_SOURCE POWER
19343 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19344 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19345 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19346 sony sony_news sonyrisc sparc sparclite spectrum
19347 stardent stdc STDC_EXT stratos sun sun3 sun386
19348 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19349 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19350 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19351 sysV68 sysV88 Tek4132 Tek4300 titan
19352 TM3200 TM5400 TM5600
19353 tower tower32 tower32_200 tower32_600 tower32_700
19354 tower32_800 tower32_850 tss
19355 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19356 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19357 unix UNIX95 UNIX99 unixpc unos
19358 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19359 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19360 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19361 USGr4 USGr4_2
19362 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19363 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19364 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19365 z8000
19366 EOSH
19367 # Maybe put other stuff here too.
19368 cat <<EOSH >>Cppsym.know
19369 $osname
19370 EOSH
19371 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19372 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19373 $cat Cppsym.know > Cppsym.c
19374 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19375 $rm -f Cppsym.a Cppsym.b Cppsym.c
19376 cat <<EOSH > Cppsym
19377 $startsh
19378 if $test \$# -gt 0; then
19379     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19380     if $test -s Cppsym.got; then
19381         $rm -f Cppsym.got
19382         exit 0
19383     fi
19384     $rm -f Cppsym.got
19385     exit 1
19386 else
19387     $tr " " "$trnl" | ./Cppsym.try
19388     exit 0
19389 fi
19390 EOSH
19391 chmod +x Cppsym
19392 $eunicefix Cppsym
19393 cat <<EOSH > Cppsym.try
19394 $startsh
19395 cat <<'EOCP' > try.c
19396 #include <stdio.h>
19397 int main() {
19398 EOCP
19399 $awk \\
19400 EOSH
19401 cat <<'EOSH' >> Cppsym.try
19402 'length($1) > 0 {
19403     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
19404     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
19405     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
19406     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
19407 }'       >> try.c
19408 echo 'return 0;}' >> try.c
19409 EOSH
19410 cat <<EOSH >> Cppsym.try
19411 ccflags="$ccflags"
19412 case "$osname-$gccversion" in
19413 irix-) ccflags="\$ccflags -woff 1178" ;;
19414 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19415 esac
19416 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19417 EOSH
19418 chmod +x Cppsym.try
19419 $eunicefix Cppsym.try
19420 ./Cppsym < Cppsym.know > Cppsym.true
19421 : now check the C compiler for additional symbols
19422 postprocess_cc_v=''
19423 case "$osname" in
19424 aix) postprocess_cc_v="|$tr , ' '" ;;
19425 esac
19426 $cat >ccsym <<EOS
19427 $startsh
19428 $cat >tmp.c <<EOF
19429 extern int foo;
19430 EOF
19431 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19432 do
19433         case "\$i" in
19434         -D*) echo "\$i" | $sed 's/^-D//';;
19435         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19436         esac
19437 done
19438 $rm -f try.c
19439 EOS
19440 postprocess_cc_v=''
19441 chmod +x ccsym
19442 $eunicefix ccsym
19443 ./ccsym > ccsym1.raw
19444 if $test -s ccsym1.raw; then
19445        $sort ccsym1.raw | $uniq >ccsym.raw
19446 else
19447        mv ccsym1.raw ccsym.raw
19448 fi
19449
19450 $awk '/\=/ { print $0; next }
19451         { print $0"=1" }' ccsym.raw >ccsym.list
19452 $awk '/\=/ { print $0; next }
19453         { print $0"=1" }' Cppsym.true >ccsym.true
19454 $comm -13 ccsym.true ccsym.list >ccsym.own
19455 $comm -12 ccsym.true ccsym.list >ccsym.com
19456 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19457 also=''
19458 if $test -z ccsym.raw; then
19459         echo "Your C compiler doesn't seem to define any symbols!" >&4
19460         echo " "
19461         echo "However, your C preprocessor defines the following symbols:"
19462         $cat Cppsym.true
19463         ccsymbols=''
19464         cppsymbols=`$cat Cppsym.true`
19465         cppsymbols=`echo $cppsymbols`
19466         cppccsymbols="$cppsymbols"
19467 else
19468         if $test -s ccsym.com; then
19469                 echo "Your C compiler and pre-processor define these symbols:"
19470                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19471                 also='also '
19472                 symbols='ones'
19473                 cppccsymbols=`$cat ccsym.com`
19474                 cppccsymbols=`echo $cppccsymbols`
19475                 $test "$silent" || sleep 1
19476         fi
19477         if $test -s ccsym.cpp; then
19478                 $test "$also" && echo " "
19479                 echo "Your C pre-processor ${also}defines the following symbols:"
19480                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19481                 also='further '
19482                 cppsymbols=`$cat ccsym.cpp`
19483                 cppsymbols=`echo $cppsymbols`
19484                 $test "$silent" || sleep 1
19485         fi
19486         if $test -s ccsym.own; then
19487                 $test "$also" && echo " "
19488                 echo "Your C compiler ${also}defines the following cpp symbols:"
19489                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19490                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19491                 ccsymbols=`$cat ccsym.own`
19492                 ccsymbols=`echo $ccsymbols`
19493                 $test "$silent" || sleep 1
19494         fi
19495 fi
19496
19497 : see if this is a termio system
19498 val="$undef"
19499 val2="$undef"
19500 val3="$undef"
19501 if $test `./findhdr termios.h`; then
19502         set tcsetattr i_termios
19503         eval $inlibc
19504         val3="$i_termios"
19505 fi
19506 echo " "
19507 case "$val3" in
19508 "$define") echo "You have POSIX termios.h... good!" >&4;;
19509 *) if ./Cppsym pyr; then
19510                 case "`/bin/universe`" in
19511                 ucb) if $test `./findhdr sgtty.h`; then
19512                                 val2="$define"
19513                                 echo "<sgtty.h> found." >&4
19514                         else
19515                                 echo "System is pyramid with BSD universe."
19516                                 echo "<sgtty.h> not found--you could have problems." >&4
19517                         fi;;
19518                 *) if $test `./findhdr termio.h`; then
19519                                 val="$define"
19520                                 echo "<termio.h> found." >&4
19521                         else
19522                                 echo "System is pyramid with USG universe."
19523                                 echo "<termio.h> not found--you could have problems." >&4
19524                         fi;;
19525                 esac
19526         elif ./usg; then
19527                 if $test `./findhdr termio.h`; then
19528                         echo "<termio.h> found." >&4
19529                         val="$define"
19530                 elif $test `./findhdr sgtty.h`; then
19531                         echo "<sgtty.h> found." >&4
19532                         val2="$define"
19533                 else
19534 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19535                 fi
19536         else
19537                 if $test `./findhdr sgtty.h`; then
19538                         echo "<sgtty.h> found." >&4
19539                         val2="$define"
19540                 elif $test `./findhdr termio.h`; then
19541                         echo "<termio.h> found." >&4
19542                         val="$define"
19543                 else
19544 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19545                 fi
19546         fi;;
19547 esac
19548 set i_termio; eval $setvar
19549 val=$val2; set i_sgtty; eval $setvar
19550 val=$val3; set i_termios; eval $setvar
19551
19552 : see if stddef is available
19553 set stddef.h i_stddef
19554 eval $inhdr
19555
19556 : see if this is a sunmath.h system
19557 set sunmath.h i_sunmath
19558 eval $inhdr
19559
19560 : see if sys/access.h is available
19561 set sys/access.h i_sysaccess
19562 eval $inhdr
19563
19564 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19565 set sys/filio.h i_sysfilio
19566 eval $inhdr
19567 echo " "
19568 if $test `./findhdr sys/ioctl.h`; then
19569         val="$define"
19570         echo '<sys/ioctl.h> found.' >&4
19571 else
19572         val="$undef"
19573         if $test $i_sysfilio = "$define"; then
19574             echo '<sys/ioctl.h> NOT found.' >&4
19575         else
19576                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19577                 $test $i_termio = "$define" && xxx="termio.h"
19578                 $test $i_termios = "$define" && xxx="termios.h"
19579 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19580         fi
19581 fi
19582 set i_sysioctl
19583 eval $setvar
19584
19585 : see if socket ioctl defs are in sys/sockio.h
19586 echo " "
19587 xxx=`./findhdr sys/sockio.h`
19588 if $test "$xxx"; then
19589         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19590                 val="$define"
19591                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19592         else
19593                 val="$undef"
19594                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19595         fi
19596 else
19597         val="$undef"
19598         $cat <<EOM
19599 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19600 EOM
19601 fi
19602 set i_syssockio
19603 eval $setvar
19604
19605
19606 : see if this is a syslog.h system
19607 set syslog.h i_syslog
19608 eval $inhdr
19609
19610
19611 : see if this is a sys/mode.h system
19612 set sys/mode.h i_sysmode
19613 eval $inhdr
19614
19615 : see if sys/resource.h has to be included
19616 set sys/resource.h i_sysresrc
19617 eval $inhdr
19618
19619 : see if sys/security.h is available
19620 set sys/security.h i_syssecrt
19621 eval $inhdr
19622
19623 : see if this is a sys/statvfs.h system
19624 set sys/statvfs.h i_sysstatvfs
19625 eval $inhdr
19626
19627 : see if this is a sys/un.h system
19628 set sys/un.h i_sysun
19629 eval $inhdr
19630
19631
19632 : see if this is a sys/utsname.h system
19633 set sys/utsname.h i_sysutsname
19634 eval $inhdr
19635
19636 : see if this is a syswait system
19637 set sys/wait.h i_syswait
19638 eval $inhdr
19639
19640 : see if this is a ustat.h system
19641 set ustat.h i_ustat
19642 eval $inhdr
19643
19644 : see if this is an utime system
19645 set utime.h i_utime
19646 eval $inhdr
19647
19648 : see if this is a values.h system
19649 set values.h i_values
19650 eval $inhdr
19651
19652 : see if this is a vfork system
19653 case "$d_vfork" in
19654 "$define")
19655         set vfork.h i_vfork
19656         eval $inhdr
19657         ;;
19658 *)
19659         i_vfork="$undef"
19660         ;;
19661 esac
19662
19663 : see if gdbm.h is available
19664 set gdbm.h t_gdbm
19665 eval $inhdr
19666 case "$t_gdbm" in
19667 $define)
19668         : see if gdbm_open exists
19669         set gdbm_open d_gdbm_open
19670         eval $inlibc
19671         case "$d_gdbm_open" in
19672         $undef)
19673                 t_gdbm="$undef"
19674                 echo "We won't be including <gdbm.h>"
19675                 ;;
19676         esac
19677         ;;
19678 esac
19679 val="$t_gdbm"
19680 set i_gdbm
19681 eval $setvar
19682
19683 echo " "
19684 echo "Looking for extensions..." >&4
19685 : If we are using the old config.sh, known_extensions may contain
19686 : old or inaccurate or duplicate values.
19687 known_extensions=''
19688 nonxs_extensions=''
19689 : We do not use find because it might not be available.
19690 : We do not just use MANIFEST because the user may have dropped
19691 : some additional extensions into the source tree and expect them
19692 : to be built.
19693
19694 : Function to recursively find available extensions, ignoring DynaLoader
19695 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19696 find_extensions='
19697     for xxx in *; do
19698        case "$xxx" in
19699            DynaLoader|dynaload) ;;
19700            *)
19701            if $test -f $xxx/$xxx.xs; then
19702                known_extensions="$known_extensions $1$xxx";
19703            elif $test -f $xxx/Makefile.PL; then
19704                nonxs_extensions="$nonxs_extensions $1$xxx";
19705            else
19706                if $test -d $xxx -a $# -lt 10; then
19707                    set $1$xxx/ $*;
19708                    cd "$xxx";
19709                    eval $find_extensions;
19710                    cd ..;
19711                    shift;
19712                fi;
19713            fi
19714            ;;
19715        esac;
19716     done'
19717 tdir=`pwd`
19718 cd "$rsrc/ext"
19719 set X
19720 shift
19721 eval $find_extensions
19722 # Special case:  Add in threads/shared since it is not picked up by the
19723 # recursive find above (and adding in general recursive finding breaks
19724 # SDBM_File/sdbm).  A.D.  10/25/2001.
19725 known_extensions="$known_extensions threads/shared"
19726 set X $nonxs_extensions
19727 shift
19728 nonxs_extensions="$*"
19729 set X $known_extensions
19730 shift
19731 known_extensions="$*"
19732 cd "$tdir"
19733
19734 : Now see which are supported on this system.
19735 avail_ext=''
19736 for xxx in $known_extensions ; do
19737         case "$xxx" in
19738         DB_File|db_file)
19739                 case "$i_db" in
19740                 $define) avail_ext="$avail_ext $xxx" ;;
19741                 esac
19742                 ;;
19743         GDBM_File|gdbm_fil)
19744                 case "$i_gdbm" in 
19745                 $define) avail_ext="$avail_ext $xxx" ;;
19746                 esac
19747                 ;;
19748         I18N/Langinfo|i18n_lan)
19749                 case "$i_langinfo$d_nl_langinfo" in 
19750                 $define$define) avail_ext="$avail_ext $xxx" ;;
19751                 esac
19752                 ;;
19753         NDBM_File|ndbm_fil)
19754                 case "$i_ndbm" in
19755                 $define)
19756                     case "$osname-$use64bitint" in
19757                     hpux-define)
19758                         case "$libs" in
19759                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19760                         esac
19761                         ;;
19762                     *) avail_ext="$avail_ext $xxx" ;;
19763                     esac
19764                     ;;
19765                 esac
19766                 ;;
19767         ODBM_File|odbm_fil) 
19768                 case "${i_dbm}${i_rpcsvcdbm}" in
19769                 *"${define}"*)
19770                     case "$osname-$use64bitint" in
19771                     hpux-define)
19772                         case "$libs" in
19773                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19774                         esac
19775                         ;;
19776                     *) avail_ext="$avail_ext $xxx" ;;
19777                     esac
19778                     ;;
19779                 esac
19780                 ;;
19781         POSIX|posix)
19782                 case "$useposix" in
19783                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19784                 esac
19785                 ;;
19786         Opcode|opcode)
19787                 case "$useopcode" in
19788                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19789                 esac
19790                 ;;
19791         Socket|socket)
19792                 case "$d_socket" in 
19793                 true|$define|y)
19794                     case "$osname" in
19795                     beos) ;; # not unless BONE
19796                     *) avail_ext="$avail_ext $xxx" ;;
19797                     esac
19798                     ;;
19799                 esac
19800                 ;;
19801         Sys/Syslog|sys/syslog)
19802                 : XXX syslog requires socket
19803                 case "$d_socket" in 
19804                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19805                 esac
19806                 ;;
19807         Thread|thread)
19808                 case "$usethreads" in
19809                 true|$define|y)
19810                         case "$useithreads" in
19811                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19812                         esac
19813                 esac
19814                 ;;
19815         XS/APItest|xs/apitest)
19816                 # This is just for testing.  Skip it unless we have dynamic loading.
19817
19818                 case "$usedl" in
19819                 $define) avail_ext="$avail_ext $xxx" ;;
19820                 esac
19821                 ;;
19822         XS/Typemap|xs/typemap)
19823                 # This is just for testing.  Skip it unless we have dynamic loading.
19824                 case "$usedl" in
19825                 $define) avail_ext="$avail_ext $xxx" ;;
19826                 esac
19827                 ;;
19828         threads|threads/shared)
19829                 # threads and threads::shared are special cases.
19830                 # To stop people from asking "Perl 5.8.0 was supposed
19831                 # to have this new fancy threads implementation but my
19832                 # perl doesn't have it" and from people trying to
19833                 # (re)install the threads module using CPAN.pm and
19834                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19835                 # the threads.pm and threads/shared.pm will always be
19836                 # there, croaking informatively ("you need to rebuild
19837                 # all of Perl with threads, sorry") when threads haven't
19838                 # been compiled in.
19839                 # --jhi
19840                 avail_ext="$avail_ext $xxx"
19841                 ;;
19842         IPC/SysV|ipc/sysv)
19843                 : XXX Do we need a useipcsysv variable here
19844                 case "${d_msg}${d_sem}${d_shm}" in 
19845                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19846                 esac
19847                 ;;
19848         *)      avail_ext="$avail_ext $xxx"
19849                 ;;
19850         esac
19851 done
19852
19853 set X $avail_ext
19854 shift
19855 avail_ext="$*"
19856
19857 : Now see which nonxs extensions are supported on this system.
19858 : For now assume all are.
19859 nonxs_ext=''
19860 for xxx in $nonxs_extensions ; do
19861         case "$xxx" in
19862         *)      nonxs_ext="$nonxs_ext $xxx"
19863                 ;;
19864         esac
19865 done
19866
19867 set X $nonxs_ext
19868 shift
19869 nonxs_ext="$*"
19870
19871 case $usedl in
19872 $define)
19873         $cat <<EOM
19874 A number of extensions are supplied with $package.  You may choose to
19875 compile these extensions for dynamic loading (the default), compile
19876 them into the $package executable (static loading), or not include
19877 them at all.  Answer "none" to include no extensions.
19878 Note that DynaLoader is always built and need not be mentioned here.
19879
19880 EOM
19881         case "$dynamic_ext" in
19882         '')
19883                 : Exclude those listed in static_ext
19884                 dflt=''
19885                 for xxx in $avail_ext; do
19886                         case " $static_ext " in
19887                         *" $xxx "*) ;;
19888                         *) dflt="$dflt $xxx" ;;
19889                         esac
19890                 done
19891                 set X $dflt
19892                 shift
19893                 dflt="$*"
19894                 ;;
19895         *)      dflt="$dynamic_ext"
19896                 # Perhaps we are reusing an old out-of-date config.sh.
19897                 case "$hint" in
19898                 previous)
19899                         if test X"$dynamic_ext" != X"$avail_ext"; then
19900                                 $cat <<EOM
19901 NOTICE:  Your previous config.sh list may be incorrect. 
19902 The extensions now available to you are 
19903         ${avail_ext}
19904 but the default list from your previous config.sh is
19905         ${dynamic_ext} 
19906
19907 EOM
19908                         fi
19909                         ;;
19910                 esac
19911                 ;;
19912         esac
19913         case "$dflt" in
19914         '')     dflt=none;;
19915         esac
19916         rp="What extensions do you wish to load dynamically?"
19917         . ./myread
19918         case "$ans" in
19919         none) dynamic_ext=' ' ;;
19920         *) dynamic_ext="$ans" ;;
19921         esac
19922
19923         case "$static_ext" in
19924         '')
19925                 : Exclude those already listed in dynamic linking
19926                 dflt=''
19927                 for xxx in $avail_ext; do
19928                         case " $dynamic_ext " in
19929                         *" $xxx "*) ;;
19930                         *) dflt="$dflt $xxx" ;;
19931                         esac
19932                 done
19933                 set X $dflt
19934                 shift
19935                 dflt="$*"
19936                 ;;
19937         *)  dflt="$static_ext" 
19938                 ;;
19939         esac
19940
19941         case "$dflt" in
19942         '')     dflt=none;;
19943         esac
19944         rp="What extensions do you wish to load statically?"
19945         . ./myread
19946         case "$ans" in
19947         none) static_ext=' ' ;;
19948         *) static_ext="$ans" ;;
19949         esac
19950         ;;
19951 *)
19952         $cat <<EOM
19953 A number of extensions are supplied with $package.  Answer "none" 
19954 to include no extensions. 
19955 Note that DynaLoader is always built and need not be mentioned here.
19956
19957 EOM
19958         case "$static_ext" in
19959         '') dflt="$avail_ext" ;;
19960         *)      dflt="$static_ext"
19961                 # Perhaps we are reusing an old out-of-date config.sh.
19962                 case "$hint" in
19963                 previous)
19964                         if test X"$static_ext" != X"$avail_ext"; then
19965                                 $cat <<EOM
19966 NOTICE:  Your previous config.sh list may be incorrect. 
19967 The extensions now available to you are 
19968         ${avail_ext}
19969 but the default list from your previous config.sh is
19970         ${static_ext} 
19971
19972 EOM
19973                         fi
19974                         ;;
19975                 esac
19976                 ;;
19977         esac
19978         : Exclude those that are not xs extensions
19979         case "$dflt" in
19980         '')     dflt=none;;
19981         esac
19982         rp="What extensions do you wish to include?"
19983         . ./myread
19984         case "$ans" in
19985         none) static_ext=' ' ;;
19986         *) static_ext="$ans" ;;
19987         esac
19988         ;;
19989 esac
19990 #        
19991 # Encode is a special case.  If we are building Encode as a static
19992 # extension, we need to explicitly list its subextensions as well.
19993 # For other nested extensions, this is handled automatically by
19994 # the appropriate Makefile.PL.
19995 case " $static_ext " in
19996         *" Encode "*) # Add the subextensions of Encode
19997         cd "$rsrc/ext"
19998         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19999                 static_ext="$static_ext Encode/$xxx"
20000         done
20001         cd "$tdir"
20002         ;;
20003 esac
20004
20005 set X $dynamic_ext $static_ext $nonxs_ext
20006 shift
20007 extensions="$*"
20008
20009 : Remove libraries needed only for extensions
20010 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20011 : The exception is SunOS 4.x, which needs them.
20012 case "${osname}X${osvers}" in
20013 sunos*X4*)
20014     perllibs="$libs"
20015     ;;
20016 *) case "$usedl" in
20017     $define|true|[yY]*)
20018             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20019             shift
20020             perllibs="$*"
20021             ;;
20022     *)  perllibs="$libs"
20023             ;;
20024     esac
20025     ;;
20026 esac
20027
20028 : Remove build directory name from cppstdin so it can be used from
20029 : either the present location or the final installed location.
20030 echo " "
20031 : Get out of the UU directory to get correct path name.
20032 cd ..
20033 case "$cppstdin" in
20034 `pwd`/cppstdin)
20035         echo "Stripping down cppstdin path name"
20036         cppstdin=cppstdin
20037         ;;
20038 esac
20039 cd UU
20040
20041 : end of configuration questions
20042 echo " "
20043 echo "End of configuration questions."
20044 echo " "
20045
20046 : back to where it started
20047 if test -d ../UU; then
20048         cd ..
20049 fi
20050
20051 : configuration may be patched via a 'config.arch' file
20052 if $test -f config.arch; then
20053         echo "I see a config.arch file, loading it."
20054         . ./config.arch
20055 fi
20056
20057 : configuration may be patched via a 'config.over' file
20058 if $test -f config.over; then
20059         echo " "
20060         dflt=y
20061         rp='I see a config.over file.  Do you wish to load it?'
20062         . UU/myread
20063         case "$ans" in
20064         n*) echo "OK, I'll ignore it.";;
20065         *)      . ./config.over
20066                 echo "Configuration override changes have been loaded."
20067                 ;;
20068         esac
20069 fi
20070
20071 : in case they want portability, strip down executable paths
20072 case "$d_portable" in
20073 "$define")
20074         echo " "
20075         echo "Stripping down executable paths..." >&4
20076         for file in $loclist $trylist; do
20077                 eval temp=\$$file
20078                 eval $file=`basename $temp`
20079         done
20080         ;;
20081 esac
20082
20083 : create config.sh file
20084 echo " "
20085 echo "Creating config.sh..." >&4
20086 $spitshell <<EOT >config.sh
20087 $startsh
20088 #
20089 # This file was produced by running the Configure script. It holds all the
20090 # definitions figured out by Configure. Should you modify one of these values,
20091 # do not forget to propagate your changes by running "Configure -der". You may
20092 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20093 #
20094
20095 # Package name      : $package
20096 # Source directory  : $src
20097 # Configuration time: $cf_time
20098 # Configured by     : $cf_by
20099 # Target system     : $myuname
20100
20101 Author='$Author'
20102 Date='$Date'
20103 Header='$Header'
20104 Id='$Id'
20105 Locker='$Locker'
20106 Log='$Log'
20107 Mcc='$Mcc'
20108 RCSfile='$RCSfile'
20109 Revision='$Revision'
20110 Source='$Source'
20111 State='$State'
20112 _a='$_a'
20113 _exe='$_exe'
20114 _o='$_o'
20115 afs='$afs'
20116 afsroot='$afsroot'
20117 alignbytes='$alignbytes'
20118 ansi2knr='$ansi2knr'
20119 aphostname='$aphostname'
20120 api_revision='$api_revision'
20121 api_subversion='$api_subversion'
20122 api_version='$api_version'
20123 api_versionstring='$api_versionstring'
20124 ar='$ar'
20125 archlib='$archlib'
20126 archlibexp='$archlibexp'
20127 archname64='$archname64'
20128 archname='$archname'
20129 archobjs='$archobjs'
20130 asctime_r_proto='$asctime_r_proto'
20131 awk='$awk'
20132 baserev='$baserev'
20133 bash='$bash'
20134 bin='$bin'
20135 binexp='$binexp'
20136 bison='$bison'
20137 byacc='$byacc'
20138 byteorder='$byteorder'
20139 c='$c'
20140 castflags='$castflags'
20141 cat='$cat'
20142 cc='$cc'
20143 cccdlflags='$cccdlflags'
20144 ccdlflags='$ccdlflags'
20145 ccflags='$ccflags'
20146 ccflags_uselargefiles='$ccflags_uselargefiles'
20147 ccname='$ccname'
20148 ccsymbols='$ccsymbols'
20149 ccversion='$ccversion'
20150 cf_by='$cf_by'
20151 cf_email='$cf_email'
20152 cf_time='$cf_time'
20153 charsize='$charsize'
20154 chgrp='$chgrp'
20155 chmod='$chmod'
20156 chown='$chown'
20157 clocktype='$clocktype'
20158 comm='$comm'
20159 compress='$compress'
20160 contains='$contains'
20161 cp='$cp'
20162 cpio='$cpio'
20163 cpp='$cpp'
20164 cpp_stuff='$cpp_stuff'
20165 cppccsymbols='$cppccsymbols'
20166 cppflags='$cppflags'
20167 cpplast='$cpplast'
20168 cppminus='$cppminus'
20169 cpprun='$cpprun'
20170 cppstdin='$cppstdin'
20171 cppsymbols='$cppsymbols'
20172 crypt_r_proto='$crypt_r_proto'
20173 cryptlib='$cryptlib'
20174 csh='$csh'
20175 ctermid_r_proto='$ctermid_r_proto'
20176 ctime_r_proto='$ctime_r_proto'
20177 d_Gconvert='$d_Gconvert'
20178 d_PRIEUldbl='$d_PRIEUldbl'
20179 d_PRIFUldbl='$d_PRIFUldbl'
20180 d_PRIGUldbl='$d_PRIGUldbl'
20181 d_PRIXU64='$d_PRIXU64'
20182 d_PRId64='$d_PRId64'
20183 d_PRIeldbl='$d_PRIeldbl'
20184 d_PRIfldbl='$d_PRIfldbl'
20185 d_PRIgldbl='$d_PRIgldbl'
20186 d_PRIi64='$d_PRIi64'
20187 d_PRIo64='$d_PRIo64'
20188 d_PRIu64='$d_PRIu64'
20189 d_PRIx64='$d_PRIx64'
20190 d_SCNfldbl='$d_SCNfldbl'
20191 d__fwalk='$d__fwalk'
20192 d_access='$d_access'
20193 d_accessx='$d_accessx'
20194 d_alarm='$d_alarm'
20195 d_archlib='$d_archlib'
20196 d_asctime_r='$d_asctime_r'
20197 d_atolf='$d_atolf'
20198 d_atoll='$d_atoll'
20199 d_attribut='$d_attribut'
20200 d_bcmp='$d_bcmp'
20201 d_bcopy='$d_bcopy'
20202 d_bsd='$d_bsd'
20203 d_bsdgetpgrp='$d_bsdgetpgrp'
20204 d_bsdsetpgrp='$d_bsdsetpgrp'
20205 d_bzero='$d_bzero'
20206 d_casti32='$d_casti32'
20207 d_castneg='$d_castneg'
20208 d_charvspr='$d_charvspr'
20209 d_chown='$d_chown'
20210 d_chroot='$d_chroot'
20211 d_chsize='$d_chsize'
20212 d_class='$d_class'
20213 d_closedir='$d_closedir'
20214 d_cmsghdr_s='$d_cmsghdr_s'
20215 d_const='$d_const'
20216 d_crypt='$d_crypt'
20217 d_crypt_r='$d_crypt_r'
20218 d_csh='$d_csh'
20219 d_ctermid_r='$d_ctermid_r'
20220 d_ctime_r='$d_ctime_r'
20221 d_cuserid='$d_cuserid'
20222 d_dbl_dig='$d_dbl_dig'
20223 d_dbminitproto='$d_dbminitproto'
20224 d_difftime='$d_difftime'
20225 d_dirfd='$d_dirfd'
20226 d_dirnamlen='$d_dirnamlen'
20227 d_dlerror='$d_dlerror'
20228 d_dlopen='$d_dlopen'
20229 d_dlsymun='$d_dlsymun'
20230 d_dosuid='$d_dosuid'
20231 d_drand48_r='$d_drand48_r'
20232 d_drand48proto='$d_drand48proto'
20233 d_dup2='$d_dup2'
20234 d_eaccess='$d_eaccess'
20235 d_endgrent='$d_endgrent'
20236 d_endgrent_r='$d_endgrent_r'
20237 d_endhent='$d_endhent'
20238 d_endhostent_r='$d_endhostent_r'
20239 d_endnent='$d_endnent'
20240 d_endnetent_r='$d_endnetent_r'
20241 d_endpent='$d_endpent'
20242 d_endprotoent_r='$d_endprotoent_r'
20243 d_endpwent='$d_endpwent'
20244 d_endpwent_r='$d_endpwent_r'
20245 d_endsent='$d_endsent'
20246 d_endservent_r='$d_endservent_r'
20247 d_eofnblk='$d_eofnblk'
20248 d_eunice='$d_eunice'
20249 d_fchdir='$d_fchdir'
20250 d_fchmod='$d_fchmod'
20251 d_fchown='$d_fchown'
20252 d_fcntl='$d_fcntl'
20253 d_fcntl_can_lock='$d_fcntl_can_lock'
20254 d_fd_macros='$d_fd_macros'
20255 d_fd_set='$d_fd_set'
20256 d_fds_bits='$d_fds_bits'
20257 d_fgetpos='$d_fgetpos'
20258 d_finite='$d_finite'
20259 d_finitel='$d_finitel'
20260 d_flexfnam='$d_flexfnam'
20261 d_flock='$d_flock'
20262 d_flockproto='$d_flockproto'
20263 d_fork='$d_fork'
20264 d_fp_class='$d_fp_class'
20265 d_fpathconf='$d_fpathconf'
20266 d_fpclass='$d_fpclass'
20267 d_fpclassify='$d_fpclassify'
20268 d_fpclassl='$d_fpclassl'
20269 d_fpos64_t='$d_fpos64_t'
20270 d_frexpl='$d_frexpl'
20271 d_fs_data_s='$d_fs_data_s'
20272 d_fseeko='$d_fseeko'
20273 d_fsetpos='$d_fsetpos'
20274 d_fstatfs='$d_fstatfs'
20275 d_fstatvfs='$d_fstatvfs'
20276 d_fsync='$d_fsync'
20277 d_ftello='$d_ftello'
20278 d_ftime='$d_ftime'
20279 d_getcwd='$d_getcwd'
20280 d_getespwnam='$d_getespwnam'
20281 d_getfsstat='$d_getfsstat'
20282 d_getgrent='$d_getgrent'
20283 d_getgrent_r='$d_getgrent_r'
20284 d_getgrgid_r='$d_getgrgid_r'
20285 d_getgrnam_r='$d_getgrnam_r'
20286 d_getgrps='$d_getgrps'
20287 d_gethbyaddr='$d_gethbyaddr'
20288 d_gethbyname='$d_gethbyname'
20289 d_gethent='$d_gethent'
20290 d_gethname='$d_gethname'
20291 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20292 d_gethostbyname_r='$d_gethostbyname_r'
20293 d_gethostent_r='$d_gethostent_r'
20294 d_gethostprotos='$d_gethostprotos'
20295 d_getitimer='$d_getitimer'
20296 d_getlogin='$d_getlogin'
20297 d_getlogin_r='$d_getlogin_r'
20298 d_getmnt='$d_getmnt'
20299 d_getmntent='$d_getmntent'
20300 d_getnbyaddr='$d_getnbyaddr'
20301 d_getnbyname='$d_getnbyname'
20302 d_getnent='$d_getnent'
20303 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20304 d_getnetbyname_r='$d_getnetbyname_r'
20305 d_getnetent_r='$d_getnetent_r'
20306 d_getnetprotos='$d_getnetprotos'
20307 d_getpagsz='$d_getpagsz'
20308 d_getpbyname='$d_getpbyname'
20309 d_getpbynumber='$d_getpbynumber'
20310 d_getpent='$d_getpent'
20311 d_getpgid='$d_getpgid'
20312 d_getpgrp2='$d_getpgrp2'
20313 d_getpgrp='$d_getpgrp'
20314 d_getppid='$d_getppid'
20315 d_getprior='$d_getprior'
20316 d_getprotobyname_r='$d_getprotobyname_r'
20317 d_getprotobynumber_r='$d_getprotobynumber_r'
20318 d_getprotoent_r='$d_getprotoent_r'
20319 d_getprotoprotos='$d_getprotoprotos'
20320 d_getprpwnam='$d_getprpwnam'
20321 d_getpwent='$d_getpwent'
20322 d_getpwent_r='$d_getpwent_r'
20323 d_getpwnam_r='$d_getpwnam_r'
20324 d_getpwuid_r='$d_getpwuid_r'
20325 d_getsbyname='$d_getsbyname'
20326 d_getsbyport='$d_getsbyport'
20327 d_getsent='$d_getsent'
20328 d_getservbyname_r='$d_getservbyname_r'
20329 d_getservbyport_r='$d_getservbyport_r'
20330 d_getservent_r='$d_getservent_r'
20331 d_getservprotos='$d_getservprotos'
20332 d_getspnam='$d_getspnam'
20333 d_getspnam_r='$d_getspnam_r'
20334 d_gettimeod='$d_gettimeod'
20335 d_gmtime_r='$d_gmtime_r'
20336 d_gnulibc='$d_gnulibc'
20337 d_grpasswd='$d_grpasswd'
20338 d_hasmntopt='$d_hasmntopt'
20339 d_htonl='$d_htonl'
20340 d_index='$d_index'
20341 d_inetaton='$d_inetaton'
20342 d_int64_t='$d_int64_t'
20343 d_isascii='$d_isascii'
20344 d_isfinite='$d_isfinite'
20345 d_isinf='$d_isinf'
20346 d_isnan='$d_isnan'
20347 d_isnanl='$d_isnanl'
20348 d_killpg='$d_killpg'
20349 d_lchown='$d_lchown'
20350 d_ldbl_dig='$d_ldbl_dig'
20351 d_link='$d_link'
20352 d_localtime_r='$d_localtime_r'
20353 d_locconv='$d_locconv'
20354 d_lockf='$d_lockf'
20355 d_longdbl='$d_longdbl'
20356 d_longlong='$d_longlong'
20357 d_lseekproto='$d_lseekproto'
20358 d_lstat='$d_lstat'
20359 d_madvise='$d_madvise'
20360 d_mblen='$d_mblen'
20361 d_mbstowcs='$d_mbstowcs'
20362 d_mbtowc='$d_mbtowc'
20363 d_memchr='$d_memchr'
20364 d_memcmp='$d_memcmp'
20365 d_memcpy='$d_memcpy'
20366 d_memmove='$d_memmove'
20367 d_memset='$d_memset'
20368 d_mkdir='$d_mkdir'
20369 d_mkdtemp='$d_mkdtemp'
20370 d_mkfifo='$d_mkfifo'
20371 d_mkstemp='$d_mkstemp'
20372 d_mkstemps='$d_mkstemps'
20373 d_mktime='$d_mktime'
20374 d_mmap='$d_mmap'
20375 d_modfl='$d_modfl'
20376 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20377 d_modflproto='$d_modflproto'
20378 d_mprotect='$d_mprotect'
20379 d_msg='$d_msg'
20380 d_msg_ctrunc='$d_msg_ctrunc'
20381 d_msg_dontroute='$d_msg_dontroute'
20382 d_msg_oob='$d_msg_oob'
20383 d_msg_peek='$d_msg_peek'
20384 d_msg_proxy='$d_msg_proxy'
20385 d_msgctl='$d_msgctl'
20386 d_msgget='$d_msgget'
20387 d_msghdr_s='$d_msghdr_s'
20388 d_msgrcv='$d_msgrcv'
20389 d_msgsnd='$d_msgsnd'
20390 d_msync='$d_msync'
20391 d_munmap='$d_munmap'
20392 d_mymalloc='$d_mymalloc'
20393 d_nanosleep='$d_nanosleep'
20394 d_nice='$d_nice'
20395 d_nl_langinfo='$d_nl_langinfo'
20396 d_nv_preserves_uv='$d_nv_preserves_uv'
20397 d_off64_t='$d_off64_t'
20398 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20399 d_oldpthreads='$d_oldpthreads'
20400 d_oldsock='$d_oldsock'
20401 d_open3='$d_open3'
20402 d_pathconf='$d_pathconf'
20403 d_pause='$d_pause'
20404 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20405 d_phostname='$d_phostname'
20406 d_pipe='$d_pipe'
20407 d_poll='$d_poll'
20408 d_portable='$d_portable'
20409 d_procselfexe='$d_procselfexe'
20410 d_pthread_atfork='$d_pthread_atfork'
20411 d_pthread_yield='$d_pthread_yield'
20412 d_pwage='$d_pwage'
20413 d_pwchange='$d_pwchange'
20414 d_pwclass='$d_pwclass'
20415 d_pwcomment='$d_pwcomment'
20416 d_pwexpire='$d_pwexpire'
20417 d_pwgecos='$d_pwgecos'
20418 d_pwpasswd='$d_pwpasswd'
20419 d_pwquota='$d_pwquota'
20420 d_qgcvt='$d_qgcvt'
20421 d_quad='$d_quad'
20422 d_random_r='$d_random_r'
20423 d_readdir64_r='$d_readdir64_r'
20424 d_readdir='$d_readdir'
20425 d_readdir_r='$d_readdir_r'
20426 d_readlink='$d_readlink'
20427 d_readv='$d_readv'
20428 d_recvmsg='$d_recvmsg'
20429 d_rename='$d_rename'
20430 d_rewinddir='$d_rewinddir'
20431 d_rmdir='$d_rmdir'
20432 d_safebcpy='$d_safebcpy'
20433 d_safemcpy='$d_safemcpy'
20434 d_sanemcmp='$d_sanemcmp'
20435 d_sbrkproto='$d_sbrkproto'
20436 d_sched_yield='$d_sched_yield'
20437 d_scm_rights='$d_scm_rights'
20438 d_seekdir='$d_seekdir'
20439 d_select='$d_select'
20440 d_sem='$d_sem'
20441 d_semctl='$d_semctl'
20442 d_semctl_semid_ds='$d_semctl_semid_ds'
20443 d_semctl_semun='$d_semctl_semun'
20444 d_semget='$d_semget'
20445 d_semop='$d_semop'
20446 d_sendmsg='$d_sendmsg'
20447 d_setegid='$d_setegid'
20448 d_seteuid='$d_seteuid'
20449 d_setgrent='$d_setgrent'
20450 d_setgrent_r='$d_setgrent_r'
20451 d_setgrps='$d_setgrps'
20452 d_sethent='$d_sethent'
20453 d_sethostent_r='$d_sethostent_r'
20454 d_setitimer='$d_setitimer'
20455 d_setlinebuf='$d_setlinebuf'
20456 d_setlocale='$d_setlocale'
20457 d_setlocale_r='$d_setlocale_r'
20458 d_setnent='$d_setnent'
20459 d_setnetent_r='$d_setnetent_r'
20460 d_setpent='$d_setpent'
20461 d_setpgid='$d_setpgid'
20462 d_setpgrp2='$d_setpgrp2'
20463 d_setpgrp='$d_setpgrp'
20464 d_setprior='$d_setprior'
20465 d_setproctitle='$d_setproctitle'
20466 d_setprotoent_r='$d_setprotoent_r'
20467 d_setpwent='$d_setpwent'
20468 d_setpwent_r='$d_setpwent_r'
20469 d_setregid='$d_setregid'
20470 d_setresgid='$d_setresgid'
20471 d_setresuid='$d_setresuid'
20472 d_setreuid='$d_setreuid'
20473 d_setrgid='$d_setrgid'
20474 d_setruid='$d_setruid'
20475 d_setsent='$d_setsent'
20476 d_setservent_r='$d_setservent_r'
20477 d_setsid='$d_setsid'
20478 d_setvbuf='$d_setvbuf'
20479 d_sfio='$d_sfio'
20480 d_shm='$d_shm'
20481 d_shmat='$d_shmat'
20482 d_shmatprototype='$d_shmatprototype'
20483 d_shmctl='$d_shmctl'
20484 d_shmdt='$d_shmdt'
20485 d_shmget='$d_shmget'
20486 d_sigaction='$d_sigaction'
20487 d_sigprocmask='$d_sigprocmask'
20488 d_sigsetjmp='$d_sigsetjmp'
20489 d_sockatmark='$d_sockatmark'
20490 d_sockatmarkproto='$d_sockatmarkproto'
20491 d_socket='$d_socket'
20492 d_socklen_t='$d_socklen_t'
20493 d_sockpair='$d_sockpair'
20494 d_socks5_init='$d_socks5_init'
20495 d_sqrtl='$d_sqrtl'
20496 d_srand48_r='$d_srand48_r'
20497 d_srandom_r='$d_srandom_r'
20498 d_sresgproto='$d_sresgproto'
20499 d_sresuproto='$d_sresuproto'
20500 d_statblks='$d_statblks'
20501 d_statfs_f_flags='$d_statfs_f_flags'
20502 d_statfs_s='$d_statfs_s'
20503 d_statvfs='$d_statvfs'
20504 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20505 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20506 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20507 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20508 d_stdio_stream_array='$d_stdio_stream_array'
20509 d_stdiobase='$d_stdiobase'
20510 d_stdstdio='$d_stdstdio'
20511 d_strchr='$d_strchr'
20512 d_strcoll='$d_strcoll'
20513 d_strctcpy='$d_strctcpy'
20514 d_strerrm='$d_strerrm'
20515 d_strerror='$d_strerror'
20516 d_strerror_r='$d_strerror_r'
20517 d_strftime='$d_strftime'
20518 d_strtod='$d_strtod'
20519 d_strtol='$d_strtol'
20520 d_strtold='$d_strtold'
20521 d_strtoll='$d_strtoll'
20522 d_strtoq='$d_strtoq'
20523 d_strtoul='$d_strtoul'
20524 d_strtoull='$d_strtoull'
20525 d_strtouq='$d_strtouq'
20526 d_strxfrm='$d_strxfrm'
20527 d_suidsafe='$d_suidsafe'
20528 d_symlink='$d_symlink'
20529 d_syscall='$d_syscall'
20530 d_syscallproto='$d_syscallproto'
20531 d_sysconf='$d_sysconf'
20532 d_sysernlst='$d_sysernlst'
20533 d_syserrlst='$d_syserrlst'
20534 d_system='$d_system'
20535 d_tcgetpgrp='$d_tcgetpgrp'
20536 d_tcsetpgrp='$d_tcsetpgrp'
20537 d_telldir='$d_telldir'
20538 d_telldirproto='$d_telldirproto'
20539 d_time='$d_time'
20540 d_times='$d_times'
20541 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20542 d_tm_tm_zone='$d_tm_tm_zone'
20543 d_tmpnam_r='$d_tmpnam_r'
20544 d_truncate='$d_truncate'
20545 d_ttyname_r='$d_ttyname_r'
20546 d_tzname='$d_tzname'
20547 d_u32align='$d_u32align'
20548 d_ualarm='$d_ualarm'
20549 d_umask='$d_umask'
20550 d_uname='$d_uname'
20551 d_union_semun='$d_union_semun'
20552 d_unordered='$d_unordered'
20553 d_usleep='$d_usleep'
20554 d_usleepproto='$d_usleepproto'
20555 d_ustat='$d_ustat'
20556 d_vendorarch='$d_vendorarch'
20557 d_vendorbin='$d_vendorbin'
20558 d_vendorlib='$d_vendorlib'
20559 d_vendorscript='$d_vendorscript'
20560 d_vfork='$d_vfork'
20561 d_void_closedir='$d_void_closedir'
20562 d_voidsig='$d_voidsig'
20563 d_voidtty='$d_voidtty'
20564 d_volatile='$d_volatile'
20565 d_vprintf='$d_vprintf'
20566 d_wait4='$d_wait4'
20567 d_waitpid='$d_waitpid'
20568 d_wcstombs='$d_wcstombs'
20569 d_wctomb='$d_wctomb'
20570 d_writev='$d_writev'
20571 d_xenix='$d_xenix'
20572 date='$date'
20573 db_hashtype='$db_hashtype'
20574 db_prefixtype='$db_prefixtype'
20575 db_version_major='$db_version_major'
20576 db_version_minor='$db_version_minor'
20577 db_version_patch='$db_version_patch'
20578 defvoidused='$defvoidused'
20579 direntrytype='$direntrytype'
20580 dlext='$dlext'
20581 dlsrc='$dlsrc'
20582 doublesize='$doublesize'
20583 drand01='$drand01'
20584 drand48_r_proto='$drand48_r_proto'
20585 dynamic_ext='$dynamic_ext'
20586 eagain='$eagain'
20587 ebcdic='$ebcdic'
20588 echo='$echo'
20589 egrep='$egrep'
20590 emacs='$emacs'
20591 endgrent_r_proto='$endgrent_r_proto'
20592 endhostent_r_proto='$endhostent_r_proto'
20593 endnetent_r_proto='$endnetent_r_proto'
20594 endprotoent_r_proto='$endprotoent_r_proto'
20595 endpwent_r_proto='$endpwent_r_proto'
20596 endservent_r_proto='$endservent_r_proto'
20597 eunicefix='$eunicefix'
20598 exe_ext='$exe_ext'
20599 expr='$expr'
20600 extensions='$extensions'
20601 extras='$extras'
20602 fflushNULL='$fflushNULL'
20603 fflushall='$fflushall'
20604 find='$find'
20605 firstmakefile='$firstmakefile'
20606 flex='$flex'
20607 fpossize='$fpossize'
20608 fpostype='$fpostype'
20609 freetype='$freetype'
20610 from='$from'
20611 full_ar='$full_ar'
20612 full_csh='$full_csh'
20613 full_sed='$full_sed'
20614 gccansipedantic='$gccansipedantic'
20615 gccosandvers='$gccosandvers'
20616 gccversion='$gccversion'
20617 getgrent_r_proto='$getgrent_r_proto'
20618 getgrgid_r_proto='$getgrgid_r_proto'
20619 getgrnam_r_proto='$getgrnam_r_proto'
20620 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20621 gethostbyname_r_proto='$gethostbyname_r_proto'
20622 gethostent_r_proto='$gethostent_r_proto'
20623 getlogin_r_proto='$getlogin_r_proto'
20624 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20625 getnetbyname_r_proto='$getnetbyname_r_proto'
20626 getnetent_r_proto='$getnetent_r_proto'
20627 getprotobyname_r_proto='$getprotobyname_r_proto'
20628 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20629 getprotoent_r_proto='$getprotoent_r_proto'
20630 getpwent_r_proto='$getpwent_r_proto'
20631 getpwnam_r_proto='$getpwnam_r_proto'
20632 getpwuid_r_proto='$getpwuid_r_proto'
20633 getservbyname_r_proto='$getservbyname_r_proto'
20634 getservbyport_r_proto='$getservbyport_r_proto'
20635 getservent_r_proto='$getservent_r_proto'
20636 getspnam_r_proto='$getspnam_r_proto'
20637 gidformat='$gidformat'
20638 gidsign='$gidsign'
20639 gidsize='$gidsize'
20640 gidtype='$gidtype'
20641 glibpth='$glibpth'
20642 gmake='$gmake'
20643 gmtime_r_proto='$gmtime_r_proto'
20644 gnulibc_version='$gnulibc_version'
20645 grep='$grep'
20646 groupcat='$groupcat'
20647 groupstype='$groupstype'
20648 gzip='$gzip'
20649 h_fcntl='$h_fcntl'
20650 h_sysfile='$h_sysfile'
20651 hint='$hint'
20652 hostcat='$hostcat'
20653 html1dir='$html1dir'
20654 html1direxp='$html1direxp'
20655 html3dir='$html3dir'
20656 html3direxp='$html3direxp'
20657 i16size='$i16size'
20658 i16type='$i16type'
20659 i32size='$i32size'
20660 i32type='$i32type'
20661 i64size='$i64size'
20662 i64type='$i64type'
20663 i8size='$i8size'
20664 i8type='$i8type'
20665 i_arpainet='$i_arpainet'
20666 i_bsdioctl='$i_bsdioctl'
20667 i_crypt='$i_crypt'
20668 i_db='$i_db'
20669 i_dbm='$i_dbm'
20670 i_dirent='$i_dirent'
20671 i_dld='$i_dld'
20672 i_dlfcn='$i_dlfcn'
20673 i_fcntl='$i_fcntl'
20674 i_float='$i_float'
20675 i_fp='$i_fp'
20676 i_fp_class='$i_fp_class'
20677 i_gdbm='$i_gdbm'
20678 i_grp='$i_grp'
20679 i_ieeefp='$i_ieeefp'
20680 i_inttypes='$i_inttypes'
20681 i_langinfo='$i_langinfo'
20682 i_libutil='$i_libutil'
20683 i_limits='$i_limits'
20684 i_locale='$i_locale'
20685 i_machcthr='$i_machcthr'
20686 i_malloc='$i_malloc'
20687 i_math='$i_math'
20688 i_memory='$i_memory'
20689 i_mntent='$i_mntent'
20690 i_ndbm='$i_ndbm'
20691 i_netdb='$i_netdb'
20692 i_neterrno='$i_neterrno'
20693 i_netinettcp='$i_netinettcp'
20694 i_niin='$i_niin'
20695 i_poll='$i_poll'
20696 i_prot='$i_prot'
20697 i_pthread='$i_pthread'
20698 i_pwd='$i_pwd'
20699 i_rpcsvcdbm='$i_rpcsvcdbm'
20700 i_sfio='$i_sfio'
20701 i_sgtty='$i_sgtty'
20702 i_shadow='$i_shadow'
20703 i_socks='$i_socks'
20704 i_stdarg='$i_stdarg'
20705 i_stddef='$i_stddef'
20706 i_stdlib='$i_stdlib'
20707 i_string='$i_string'
20708 i_sunmath='$i_sunmath'
20709 i_sysaccess='$i_sysaccess'
20710 i_sysdir='$i_sysdir'
20711 i_sysfile='$i_sysfile'
20712 i_sysfilio='$i_sysfilio'
20713 i_sysin='$i_sysin'
20714 i_sysioctl='$i_sysioctl'
20715 i_syslog='$i_syslog'
20716 i_sysmman='$i_sysmman'
20717 i_sysmode='$i_sysmode'
20718 i_sysmount='$i_sysmount'
20719 i_sysndir='$i_sysndir'
20720 i_sysparam='$i_sysparam'
20721 i_sysresrc='$i_sysresrc'
20722 i_syssecrt='$i_syssecrt'
20723 i_sysselct='$i_sysselct'
20724 i_syssockio='$i_syssockio'
20725 i_sysstat='$i_sysstat'
20726 i_sysstatfs='$i_sysstatfs'
20727 i_sysstatvfs='$i_sysstatvfs'
20728 i_systime='$i_systime'
20729 i_systimek='$i_systimek'
20730 i_systimes='$i_systimes'
20731 i_systypes='$i_systypes'
20732 i_sysuio='$i_sysuio'
20733 i_sysun='$i_sysun'
20734 i_sysutsname='$i_sysutsname'
20735 i_sysvfs='$i_sysvfs'
20736 i_syswait='$i_syswait'
20737 i_termio='$i_termio'
20738 i_termios='$i_termios'
20739 i_time='$i_time'
20740 i_unistd='$i_unistd'
20741 i_ustat='$i_ustat'
20742 i_utime='$i_utime'
20743 i_values='$i_values'
20744 i_varargs='$i_varargs'
20745 i_varhdr='$i_varhdr'
20746 i_vfork='$i_vfork'
20747 ignore_versioned_solibs='$ignore_versioned_solibs'
20748 inc_version_list='$inc_version_list'
20749 inc_version_list_init='$inc_version_list_init'
20750 incpath='$incpath'
20751 inews='$inews'
20752 installarchlib='$installarchlib'
20753 installbin='$installbin'
20754 installhtml1dir='$installhtml1dir'
20755 installhtml3dir='$installhtml3dir'
20756 installman1dir='$installman1dir'
20757 installman3dir='$installman3dir'
20758 installprefix='$installprefix'
20759 installprefixexp='$installprefixexp'
20760 installprivlib='$installprivlib'
20761 installscript='$installscript'
20762 installsitearch='$installsitearch'
20763 installsitebin='$installsitebin'
20764 installsitehtml1='$installsitehtml1'
20765 installsitehtml3='$installsitehtml3'
20766 installsitelib='$installsitelib'
20767 installsiteman1='$installsiteman1'
20768 installsiteman3='$installsiteman3'
20769 installsitescript='$installsitescript'
20770 installstyle='$installstyle'
20771 installusrbinperl='$installusrbinperl'
20772 installvendorarch='$installvendorarch'
20773 installvendorbin='$installvendorbin'
20774 installvendorhtml1='$installvendorhtml1'
20775 installvendorhtml3='$installvendorhtml3'
20776 installvendorlib='$installvendorlib'
20777 installvendorman1='$installvendorman1'
20778 installvendorman3='$installvendorman3'
20779 installvendorscript='$installvendorscript'
20780 intsize='$intsize'
20781 issymlink='$issymlink'
20782 ivdformat='$ivdformat'
20783 ivsize='$ivsize'
20784 ivtype='$ivtype'
20785 known_extensions='$known_extensions'
20786 ksh='$ksh'
20787 ld='$ld'
20788 lddlflags='$lddlflags'
20789 ldflags='$ldflags'
20790 ldflags_uselargefiles='$ldflags_uselargefiles'
20791 ldlibpthname='$ldlibpthname'
20792 less='$less'
20793 lib_ext='$lib_ext'
20794 libc='$libc'
20795 libperl='$libperl'
20796 libpth='$libpth'
20797 libs='$libs'
20798 libsdirs='$libsdirs'
20799 libsfiles='$libsfiles'
20800 libsfound='$libsfound'
20801 libspath='$libspath'
20802 libswanted='$libswanted'
20803 libswanted_uselargefiles='$libswanted_uselargefiles'
20804 line='$line'
20805 lint='$lint'
20806 lkflags='$lkflags'
20807 ln='$ln'
20808 lns='$lns'
20809 localtime_r_proto='$localtime_r_proto'
20810 locincpth='$locincpth'
20811 loclibpth='$loclibpth'
20812 longdblsize='$longdblsize'
20813 longlongsize='$longlongsize'
20814 longsize='$longsize'
20815 lp='$lp'
20816 lpr='$lpr'
20817 ls='$ls'
20818 lseeksize='$lseeksize'
20819 lseektype='$lseektype'
20820 mail='$mail'
20821 mailx='$mailx'
20822 make='$make'
20823 make_set_make='$make_set_make'
20824 mallocobj='$mallocobj'
20825 mallocsrc='$mallocsrc'
20826 malloctype='$malloctype'
20827 man1dir='$man1dir'
20828 man1direxp='$man1direxp'
20829 man1ext='$man1ext'
20830 man3dir='$man3dir'
20831 man3direxp='$man3direxp'
20832 man3ext='$man3ext'
20833 mips_type='$mips_type'
20834 mkdir='$mkdir'
20835 mmaptype='$mmaptype'
20836 modetype='$modetype'
20837 more='$more'
20838 multiarch='$multiarch'
20839 mv='$mv'
20840 myarchname='$myarchname'
20841 mydomain='$mydomain'
20842 myhostname='$myhostname'
20843 myuname='$myuname'
20844 n='$n'
20845 need_va_copy='$need_va_copy'
20846 netdb_hlen_type='$netdb_hlen_type'
20847 netdb_host_type='$netdb_host_type'
20848 netdb_name_type='$netdb_name_type'
20849 netdb_net_type='$netdb_net_type'
20850 nm='$nm'
20851 nm_opt='$nm_opt'
20852 nm_so_opt='$nm_so_opt'
20853 nonxs_ext='$nonxs_ext'
20854 nroff='$nroff'
20855 nvEUformat='$nvEUformat'
20856 nvFUformat='$nvFUformat'
20857 nvGUformat='$nvGUformat'
20858 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20859 nveformat='$nveformat'
20860 nvfformat='$nvfformat'
20861 nvgformat='$nvgformat'
20862 nvsize='$nvsize'
20863 nvtype='$nvtype'
20864 o_nonblock='$o_nonblock'
20865 obj_ext='$obj_ext'
20866 old_pthread_create_joinable='$old_pthread_create_joinable'
20867 optimize='$optimize'
20868 orderlib='$orderlib'
20869 osname='$osname'
20870 osvers='$osvers'
20871 otherlibdirs='$otherlibdirs'
20872 package='$package'
20873 pager='$pager'
20874 passcat='$passcat'
20875 patchlevel='$patchlevel'
20876 path_sep='$path_sep'
20877 perl5='$perl5'
20878 perl='$perl'
20879 perl_patchlevel='$perl_patchlevel'
20880 perladmin='$perladmin'
20881 perllibs='$perllibs'
20882 perlpath='$perlpath'
20883 pg='$pg'
20884 phostname='$phostname'
20885 pidtype='$pidtype'
20886 plibpth='$plibpth'
20887 pm_apiversion='$pm_apiversion'
20888 pmake='$pmake'
20889 pr='$pr'
20890 prefix='$prefix'
20891 prefixexp='$prefixexp'
20892 privlib='$privlib'
20893 privlibexp='$privlibexp'
20894 procselfexe='$procselfexe'
20895 prototype='$prototype'
20896 ptrsize='$ptrsize'
20897 quadkind='$quadkind'
20898 quadtype='$quadtype'
20899 randbits='$randbits'
20900 randfunc='$randfunc'
20901 random_r_proto='$random_r_proto'
20902 randseedtype='$randseedtype'
20903 ranlib='$ranlib'
20904 rd_nodata='$rd_nodata'
20905 readdir64_r_proto='$readdir64_r_proto'
20906 readdir_r_proto='$readdir_r_proto'
20907 revision='$revision'
20908 rm='$rm'
20909 rmail='$rmail'
20910 run='$run'
20911 runnm='$runnm'
20912 sPRIEUldbl='$sPRIEUldbl'
20913 sPRIFUldbl='$sPRIFUldbl'
20914 sPRIGUldbl='$sPRIGUldbl'
20915 sPRIXU64='$sPRIXU64'
20916 sPRId64='$sPRId64'
20917 sPRIeldbl='$sPRIeldbl'
20918 sPRIfldbl='$sPRIfldbl'
20919 sPRIgldbl='$sPRIgldbl'
20920 sPRIi64='$sPRIi64'
20921 sPRIo64='$sPRIo64'
20922 sPRIu64='$sPRIu64'
20923 sPRIx64='$sPRIx64'
20924 sSCNfldbl='$sSCNfldbl'
20925 sched_yield='$sched_yield'
20926 scriptdir='$scriptdir'
20927 scriptdirexp='$scriptdirexp'
20928 sed='$sed'
20929 seedfunc='$seedfunc'
20930 selectminbits='$selectminbits'
20931 selecttype='$selecttype'
20932 sendmail='$sendmail'
20933 setgrent_r_proto='$setgrent_r_proto'
20934 sethostent_r_proto='$sethostent_r_proto'
20935 setlocale_r_proto='$setlocale_r_proto'
20936 setnetent_r_proto='$setnetent_r_proto'
20937 setprotoent_r_proto='$setprotoent_r_proto'
20938 setpwent_r_proto='$setpwent_r_proto'
20939 setservent_r_proto='$setservent_r_proto'
20940 sh='$sh'
20941 shar='$shar'
20942 sharpbang='$sharpbang'
20943 shmattype='$shmattype'
20944 shortsize='$shortsize'
20945 shrpenv='$shrpenv'
20946 shsharp='$shsharp'
20947 sig_count='$sig_count'
20948 sig_name='$sig_name'
20949 sig_name_init='$sig_name_init'
20950 sig_num='$sig_num'
20951 sig_num_init='$sig_num_init'
20952 sig_size='$sig_size'
20953 signal_t='$signal_t'
20954 sitearch='$sitearch'
20955 sitearchexp='$sitearchexp'
20956 sitebin='$sitebin'
20957 sitebinexp='$sitebinexp'
20958 sitehtml1='$sitehtml1'
20959 sitehtml1exp='$sitehtml1exp'
20960 sitehtml3='$sitehtml3'
20961 sitehtml3exp='$sitehtml3exp'
20962 sitelib='$sitelib'
20963 sitelib_stem='$sitelib_stem'
20964 sitelibexp='$sitelibexp'
20965 siteman1='$siteman1'
20966 siteman1exp='$siteman1exp'
20967 siteman3='$siteman3'
20968 siteman3exp='$siteman3exp'
20969 siteprefix='$siteprefix'
20970 siteprefixexp='$siteprefixexp'
20971 sitescript='$sitescript'
20972 sitescriptexp='$sitescriptexp'
20973 sizesize='$sizesize'
20974 sizetype='$sizetype'
20975 sleep='$sleep'
20976 smail='$smail'
20977 so='$so'
20978 sockethdr='$sockethdr'
20979 socketlib='$socketlib'
20980 socksizetype='$socksizetype'
20981 sort='$sort'
20982 spackage='$spackage'
20983 spitshell='$spitshell'
20984 srand48_r_proto='$srand48_r_proto'
20985 srandom_r_proto='$srandom_r_proto'
20986 src='$src'
20987 ssizetype='$ssizetype'
20988 startperl='$startperl'
20989 startsh='$startsh'
20990 static_ext='$static_ext'
20991 stdchar='$stdchar'
20992 stdio_base='$stdio_base'
20993 stdio_bufsiz='$stdio_bufsiz'
20994 stdio_cnt='$stdio_cnt'
20995 stdio_filbuf='$stdio_filbuf'
20996 stdio_ptr='$stdio_ptr'
20997 stdio_stream_array='$stdio_stream_array'
20998 strerror_r_proto='$strerror_r_proto'
20999 strings='$strings'
21000 submit='$submit'
21001 subversion='$subversion'
21002 sysman='$sysman'
21003 tail='$tail'
21004 tar='$tar'
21005 targetarch='$targetarch'
21006 tbl='$tbl'
21007 tee='$tee'
21008 test='$test'
21009 timeincl='$timeincl'
21010 timetype='$timetype'
21011 tmpnam_r_proto='$tmpnam_r_proto'
21012 to='$to'
21013 touch='$touch'
21014 tr='$tr'
21015 trnl='$trnl'
21016 troff='$troff'
21017 ttyname_r_proto='$ttyname_r_proto'
21018 u16size='$u16size'
21019 u16type='$u16type'
21020 u32size='$u32size'
21021 u32type='$u32type'
21022 u64size='$u64size'
21023 u64type='$u64type'
21024 u8size='$u8size'
21025 u8type='$u8type'
21026 uidformat='$uidformat'
21027 uidsign='$uidsign'
21028 uidsize='$uidsize'
21029 uidtype='$uidtype'
21030 uname='$uname'
21031 uniq='$uniq'
21032 uquadtype='$uquadtype'
21033 use5005threads='$use5005threads'
21034 use64bitall='$use64bitall'
21035 use64bitint='$use64bitint'
21036 usecrosscompile='$usecrosscompile'
21037 usedl='$usedl'
21038 useithreads='$useithreads'
21039 uselargefiles='$uselargefiles'
21040 uselongdouble='$uselongdouble'
21041 usemorebits='$usemorebits'
21042 usemultiplicity='$usemultiplicity'
21043 usemymalloc='$usemymalloc'
21044 usenm='$usenm'
21045 useopcode='$useopcode'
21046 useperlio='$useperlio'
21047 useposix='$useposix'
21048 usereentrant='$usereentrant'
21049 usesfio='$usesfio'
21050 useshrplib='$useshrplib'
21051 usesocks='$usesocks'
21052 usethreads='$usethreads'
21053 usevendorprefix='$usevendorprefix'
21054 usevfork='$usevfork'
21055 usrinc='$usrinc'
21056 uuname='$uuname'
21057 uvXUformat='$uvXUformat'
21058 uvoformat='$uvoformat'
21059 uvsize='$uvsize'
21060 uvtype='$uvtype'
21061 uvuformat='$uvuformat'
21062 uvxformat='$uvxformat'
21063 vendorarch='$vendorarch'
21064 vendorarchexp='$vendorarchexp'
21065 vendorbin='$vendorbin'
21066 vendorbinexp='$vendorbinexp'
21067 vendorhtml1='$vendorhtml1'
21068 vendorhtml1exp='$vendorhtml1exp'
21069 vendorhtml3='$vendorhtml3'
21070 vendorhtml3exp='$vendorhtml3exp'
21071 vendorlib='$vendorlib'
21072 vendorlib_stem='$vendorlib_stem'
21073 vendorlibexp='$vendorlibexp'
21074 vendorman1='$vendorman1'
21075 vendorman1exp='$vendorman1exp'
21076 vendorman3='$vendorman3'
21077 vendorman3exp='$vendorman3exp'
21078 vendorprefix='$vendorprefix'
21079 vendorprefixexp='$vendorprefixexp'
21080 vendorscript='$vendorscript'
21081 vendorscriptexp='$vendorscriptexp'
21082 version='$version'
21083 version_patchlevel_string='$version_patchlevel_string'
21084 versiononly='$versiononly'
21085 vi='$vi'
21086 voidflags='$voidflags'
21087 xlibpth='$xlibpth'
21088 xs_apiversion='$xs_apiversion'
21089 yacc='$yacc'
21090 yaccflags='$yaccflags'
21091 zcat='$zcat'
21092 zip='$zip'
21093 EOT
21094
21095 : Add in command line options if available
21096 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21097
21098 : add special variables
21099 $test -f $src/patchlevel.h && \
21100 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21101 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21102 echo "PERL_CONFIG_SH=true" >>config.sh
21103
21104 : propagate old symbols
21105 if $test -f UU/config.sh; then
21106         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21107         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21108         $sort | $uniq -u >UU/oldsyms
21109         set X `cat UU/oldsyms`
21110         shift
21111         case $# in
21112         0) ;;
21113         *)
21114                 cat <<EOM
21115 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21116 EOM
21117                 echo "# Variables propagated from previous config.sh file." >>config.sh
21118                 for sym in `cat UU/oldsyms`; do
21119                         echo "    Propagating $hint variable "'$'"$sym..."
21120                         eval 'tmp="$'"${sym}"'"'
21121                         echo "$tmp" | \
21122                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21123                 done
21124                 ;;
21125         esac
21126 fi
21127
21128 : Finish up by extracting the .SH files
21129 case "$alldone" in
21130 exit)
21131         $rm -rf UU
21132         echo "Extraction done."
21133         exit 0
21134         ;;
21135 cont)
21136         ;;
21137 '')
21138         dflt=''
21139         nostick=true
21140         $cat <<EOM
21141
21142 If you'd like to make any changes to the config.sh file before I begin
21143 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21144
21145 EOM
21146         rp="Press return or use a shell escape to edit config.sh:"
21147         . UU/myread
21148         nostick=''
21149         case "$ans" in
21150         '') ;;
21151         *) : in case they cannot read
21152                 sh 1>&4 -c "$ans";;
21153         esac
21154         ;;
21155 esac
21156
21157 : if this fails, just run all the .SH files by hand
21158 . ./config.sh
21159
21160 echo " "
21161 exec 1>&4
21162 pwd=`pwd`
21163 . ./UU/extract
21164 cd "$pwd"
21165
21166 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21167         dflt=y
21168         case "$silent" in
21169         true) ;;
21170         *)
21171                 $cat <<EOM
21172
21173 Now you need to generate make dependencies by running "$make depend".
21174 You might prefer to run it in background: "$make depend > makedepend.out &"
21175 It can take a while, so you might not want to run it right now.
21176
21177 EOM
21178                 ;;
21179         esac
21180         rp="Run $make depend now?"
21181         . UU/myread
21182         case "$ans" in
21183         y*)
21184                 $make depend && echo "Now you must run '$make'."
21185                 ;;
21186         *)
21187                 echo "You must run '$make depend' then '$make'."
21188                 ;;
21189         esac
21190 elif test -f [Mm]akefile; then
21191         echo " "
21192         echo "Now you must run a $make."
21193 else
21194         echo "Configure done."
21195 fi
21196
21197 if $test -f Policy.sh; then
21198     $cat <<EOM
21199
21200 If you compile $package on a different machine or from a different object
21201 directory, copy the Policy.sh file from this object directory to the
21202 new one before you run Configure -- this will help you with most of
21203 the policy defaults.
21204
21205 EOM
21206 fi
21207 if $test -f config.msg; then
21208     echo "Hmm.  I also noted the following information while running:"
21209     echo " "
21210     $cat config.msg >&4
21211     $rm -f config.msg
21212 fi
21213 $rm -f kit*isdone ark*isdone
21214 $rm -rf UU
21215
21216 : End of Configure
21217