Integrate:
[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 Tue Apr  1 20:39:33 EET DST 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:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
75     if test -n "$OS2_SHELL"; then
76                 p_=\;
77                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
79                 is_os2=yes
80         elif test -n "$DJGPP"; then
81                 case "X${MACHTYPE:-nonesuchmach}" in
82                 *cygwin) ;;
83                 *) p_=\; ;;
84                 esac
85         fi
86 fi
87
88 : Proper PATH setting
89 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
90 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
91 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
92 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
93 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
94 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
95 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
96 paths="$paths /sbin /usr/sbin /usr/libexec"
97 paths="$paths /system/gnu_library/bin"
98
99 for p in $paths
100 do
101         case "$p_$PATH$p_" in
102         *$p_$p$p_*) ;;
103         *) test -d $p && PATH=$PATH$p_$p ;;
104         esac
105 done
106
107 PATH=.$p_$PATH
108 export PATH
109
110 : shall we be using ksh?
111 inksh=''
112 needksh=''
113 avoidksh=''
114 newsh=/bin/ksh
115 changesh=''
116 if (PATH=.; alias -x) >/dev/null 2>&1; then
117                 inksh=true
118 fi
119 if test -f /hp-ux -a -f /bin/ksh; then
120         needksh='to avoid sh bug in "here document" expansion'
121 fi
122 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
123         if test X`/usr/bin/uname -v` = X4; then
124                 avoidksh="to avoid AIX 4's /bin/sh"
125                 newsh=/usr/bin/bsh
126         fi
127 fi
128 if test -f /osf_boot -a -f /usr/sbin/setld; then
129         if test X`/usr/bin/uname -s` = XOSF1; then
130                 avoidksh="to avoid Digital UNIX' ksh"
131                 newsh=/bin/sh
132                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
133         fi
134 fi
135 case "$inksh/$needksh" in
136 /[a-z]*)
137                 ENV=''
138                 changesh=true
139                 reason="$needksh"
140         ;;
141 esac
142 case "$inksh/$avoidksh" in
143 true/[a-z]*)
144         changesh=true
145         reason="$avoidksh"
146         ;;
147 esac
148 case "$inksh/$needksh-$avoidksh-" in
149 true/--)
150                 cat <<EOM
151 (I see you are using the Korn shell.  Some ksh's blow up on $me,
152 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
153 EOM
154         ;;
155 esac
156 case "$changesh" in
157 true)
158         export newsh
159         echo "(Feeding myself to $newsh $reason.)"
160         case "$0" in
161         Configure|*/Configure) exec $newsh $0 "$@";;
162         *) exec $newsh Configure "$@";;
163         esac
164         ;;
165 esac
166
167 : if needed set CDPATH to a harmless value that is not chatty
168 : avoid bash 2.02 problems with empty CDPATH.
169 case "$CDPATH" in
170 '')     ;;
171 *)      case "$SHELL" in
172         *bash*) CDPATH='.' ;;
173         *)              CDPATH='' ;;
174         esac
175         ;;
176 esac
177 : Configure runs within the UU subdirectory
178 test -d UU || mkdir UU
179 cd UU && rm -f ./*
180
181 ccname=''
182 ccversion=''
183 ccsymbols=''
184 cppccsymbols=''
185 cppsymbols=''
186 from=''
187 run=''
188 targetarch=''
189 to=''
190 usecrosscompile=''
191 perllibs=''
192 dynamic_ext=''
193 extensions=''
194 known_extensions=''
195 nonxs_ext=''
196 static_ext=''
197 useopcode=''
198 useposix=''
199 extras=''
200 d_bsd=''
201 d_eunice=''
202 d_xenix=''
203 eunicefix=''
204 Mcc=''
205 ar=''
206 awk=''
207 bash=''
208 bison=''
209 byacc=''
210 cat=''
211 chgrp=''
212 chmod=''
213 chown=''
214 comm=''
215 compress=''
216 cp=''
217 cpio=''
218 cpp=''
219 csh=''
220 date=''
221 echo=''
222 egrep=''
223 emacs=''
224 expr=''
225 find=''
226 flex=''
227 gmake=''
228 grep=''
229 gzip=''
230 inews=''
231 ksh=''
232 less=''
233 line=''
234 lint=''
235 ln=''
236 lp=''
237 lpr=''
238 ls=''
239 mail=''
240 mailx=''
241 make=''
242 mkdir=''
243 more=''
244 mv=''
245 nm=''
246 nroff=''
247 perl=''
248 pg=''
249 pmake=''
250 pr=''
251 rm=''
252 rmail=''
253 sed=''
254 sendmail=''
255 shar=''
256 sleep=''
257 smail=''
258 sort=''
259 submit=''
260 tail=''
261 tar=''
262 tbl=''
263 tee=''
264 test=''
265 touch=''
266 tr=''
267 troff=''
268 uname=''
269 uniq=''
270 uuname=''
271 vi=''
272 zcat=''
273 zip=''
274 full_ar=''
275 full_sed=''
276 libswanted=''
277 hint=''
278 myuname=''
279 osname=''
280 osvers=''
281 Author=''
282 Date=''
283 Header=''
284 Id=''
285 Locker=''
286 Log=''
287 RCSfile=''
288 Revision=''
289 Source=''
290 State=''
291 _a=''
292 _exe=''
293 _o=''
294 archobjs=''
295 exe_ext=''
296 firstmakefile=''
297 lib_ext=''
298 obj_ext=''
299 path_sep=''
300 afs=''
301 afsroot=''
302 alignbytes=''
303 ansi2knr=''
304 archlib=''
305 archlibexp=''
306 d_archlib=''
307 installarchlib=''
308 archname=''
309 myarchname=''
310 d_atolf=''
311 d_atoll=''
312 baserev=''
313 bin=''
314 binexp=''
315 installbin=''
316 byteorder=''
317 cc=''
318 ccflags=''
319 cppflags=''
320 ldflags=''
321 lkflags=''
322 locincpth=''
323 optimize=''
324 cf_email=''
325 cf_by=''
326 cf_time=''
327 charsize=''
328 contains=''
329 cpp_stuff=''
330 cpplast=''
331 cppminus=''
332 cpprun=''
333 cppstdin=''
334 d__fwalk=''
335 d_access=''
336 d_accessx=''
337 d_alarm=''
338 asctime_r_proto=''
339 d_asctime_r=''
340 d_attribut=''
341 d_bcmp=''
342 d_bcopy=''
343 d_bzero=''
344 d_casti32=''
345 castflags=''
346 d_castneg=''
347 d_chown=''
348 d_chroot=''
349 d_chsize=''
350 d_class=''
351 d_closedir=''
352 d_void_closedir=''
353 d_cmsghdr_s=''
354 d_const=''
355 cryptlib=''
356 d_crypt=''
357 crypt_r_proto=''
358 d_crypt_r=''
359 d_csh=''
360 full_csh=''
361 ctermid_r_proto=''
362 d_ctermid_r=''
363 ctime_r_proto=''
364 d_ctime_r=''
365 d_cuserid=''
366 d_dbl_dig=''
367 d_dbminitproto=''
368 d_difftime=''
369 d_dirfd=''
370 d_dlerror=''
371 d_dlopen=''
372 d_dlsymun=''
373 d_dosuid=''
374 d_suidsafe=''
375 d_drand48_r=''
376 drand48_r_proto=''
377 d_drand48proto=''
378 d_dup2=''
379 d_eaccess=''
380 d_endgrent=''
381 d_endgrent_r=''
382 endgrent_r_proto=''
383 d_endhent=''
384 d_endhostent_r=''
385 endhostent_r_proto=''
386 d_endnent=''
387 d_endnetent_r=''
388 endnetent_r_proto=''
389 d_endpent=''
390 d_endprotoent_r=''
391 endprotoent_r_proto=''
392 d_endpwent=''
393 d_endpwent_r=''
394 endpwent_r_proto=''
395 d_endsent=''
396 d_endservent_r=''
397 endservent_r_proto=''
398 d_fchdir=''
399 d_fchmod=''
400 d_fchown=''
401 d_fcntl=''
402 d_fcntl_can_lock=''
403 d_fd_macros=''
404 d_fd_set=''
405 d_fds_bits=''
406 d_fgetpos=''
407 d_finite=''
408 d_finitel=''
409 d_flexfnam=''
410 d_flock=''
411 d_flockproto=''
412 d_fork=''
413 d_fp_class=''
414 d_fpclass=''
415 d_fpclassify=''
416 d_fpclassl=''
417 d_fpos64_t=''
418 d_frexpl=''
419 d_fs_data_s=''
420 d_fseeko=''
421 d_fsetpos=''
422 d_fstatfs=''
423 d_fsync=''
424 d_ftello=''
425 d_ftime=''
426 d_gettimeod=''
427 d_Gconvert=''
428 d_getcwd=''
429 d_getespwnam=''
430 d_getfsstat=''
431 d_getgrent=''
432 d_getgrent_r=''
433 getgrent_r_proto=''
434 d_getgrgid_r=''
435 getgrgid_r_proto=''
436 d_getgrnam_r=''
437 getgrnam_r_proto=''
438 d_getgrps=''
439 d_gethbyaddr=''
440 d_gethbyname=''
441 d_gethent=''
442 aphostname=''
443 d_gethname=''
444 d_phostname=''
445 d_uname=''
446 d_gethostbyaddr_r=''
447 gethostbyaddr_r_proto=''
448 d_gethostbyname_r=''
449 gethostbyname_r_proto=''
450 d_gethostent_r=''
451 gethostent_r_proto=''
452 d_gethostprotos=''
453 d_getitimer=''
454 d_getlogin=''
455 d_getlogin_r=''
456 getlogin_r_proto=''
457 d_getmnt=''
458 d_getmntent=''
459 d_getnbyaddr=''
460 d_getnbyname=''
461 d_getnent=''
462 d_getnetbyaddr_r=''
463 getnetbyaddr_r_proto=''
464 d_getnetbyname_r=''
465 getnetbyname_r_proto=''
466 d_getnetent_r=''
467 getnetent_r_proto=''
468 d_getnetprotos=''
469 d_getpagsz=''
470 d_getpent=''
471 d_getpgid=''
472 d_getpgrp2=''
473 d_bsdgetpgrp=''
474 d_getpgrp=''
475 d_getppid=''
476 d_getprior=''
477 d_getpbyname=''
478 d_getpbynumber=''
479 d_getprotobyname_r=''
480 getprotobyname_r_proto=''
481 d_getprotobynumber_r=''
482 getprotobynumber_r_proto=''
483 d_getprotoent_r=''
484 getprotoent_r_proto=''
485 d_getprotoprotos=''
486 d_getprpwnam=''
487 d_getpwent=''
488 d_getpwent_r=''
489 getpwent_r_proto=''
490 d_getpwnam_r=''
491 getpwnam_r_proto=''
492 d_getpwuid_r=''
493 getpwuid_r_proto=''
494 d_getsent=''
495 d_getservbyname_r=''
496 getservbyname_r_proto=''
497 d_getservbyport_r=''
498 getservbyport_r_proto=''
499 d_getservent_r=''
500 getservent_r_proto=''
501 d_getservprotos=''
502 d_getspnam=''
503 d_getspnam_r=''
504 getspnam_r_proto=''
505 d_getsbyname=''
506 d_getsbyport=''
507 d_gmtime_r=''
508 gmtime_r_proto=''
509 d_gnulibc=''
510 gnulibc_version=''
511 d_hasmntopt=''
512 d_htonl=''
513 d_inetaton=''
514 d_int64_t=''
515 d_isascii=''
516 d_isfinite=''
517 d_isinf=''
518 d_isnan=''
519 d_isnanl=''
520 d_killpg=''
521 d_lchown=''
522 d_ldbl_dig=''
523 d_link=''
524 d_localtime_r=''
525 localtime_r_proto=''
526 d_locconv=''
527 d_lockf=''
528 d_longdbl=''
529 longdblsize=''
530 d_longlong=''
531 longlongsize=''
532 d_lseekproto=''
533 d_lstat=''
534 d_madvise=''
535 d_mblen=''
536 d_mbstowcs=''
537 d_mbtowc=''
538 d_memchr=''
539 d_memcmp=''
540 d_memcpy=''
541 d_memmove=''
542 d_memset=''
543 d_mkdir=''
544 d_mkdtemp=''
545 d_mkfifo=''
546 d_mkstemp=''
547 d_mkstemps=''
548 d_mktime=''
549 d_mmap=''
550 mmaptype=''
551 d_modfl=''
552 d_modfl_pow32_bug=''
553 d_modflproto=''
554 d_mprotect=''
555 d_msg=''
556 d_msgctl=''
557 d_msgget=''
558 d_msghdr_s=''
559 d_msgrcv=''
560 d_msgsnd=''
561 d_msync=''
562 d_munmap=''
563 d_nanosleep=''
564 d_nice=''
565 d_nl_langinfo=''
566 d_off64_t=''
567 d_open3=''
568 d_fpathconf=''
569 d_pathconf=''
570 d_pause=''
571 d_pipe=''
572 d_poll=''
573 d_portable=''
574 d_procselfexe=''
575 procselfexe=''
576 d_old_pthread_create_joinable=''
577 old_pthread_create_joinable=''
578 d_pthread_atfork=''
579 d_pthread_yield=''
580 d_sched_yield=''
581 sched_yield=''
582 d_qgcvt=''
583 d_random_r=''
584 random_r_proto=''
585 d_readdir64_r=''
586 readdir64_r_proto=''
587 d_readdir=''
588 d_rewinddir=''
589 d_seekdir=''
590 d_telldir=''
591 d_readdir_r=''
592 readdir_r_proto=''
593 d_readlink=''
594 d_readv=''
595 d_recvmsg=''
596 d_rename=''
597 d_rmdir=''
598 d_safebcpy=''
599 d_safemcpy=''
600 d_sanemcmp=''
601 d_sbrkproto=''
602 d_select=''
603 d_sem=''
604 d_semctl=''
605 d_semget=''
606 d_semop=''
607 d_sendmsg=''
608 d_setegid=''
609 d_seteuid=''
610 d_setgrent=''
611 d_setgrent_r=''
612 setgrent_r_proto=''
613 d_setgrps=''
614 d_sethent=''
615 d_sethostent_r=''
616 sethostent_r_proto=''
617 d_setitimer=''
618 d_setlinebuf=''
619 d_setlocale=''
620 d_setlocale_r=''
621 setlocale_r_proto=''
622 d_setnent=''
623 d_setnetent_r=''
624 setnetent_r_proto=''
625 d_setpent=''
626 d_setpgid=''
627 d_setpgrp2=''
628 d_bsdsetpgrp=''
629 d_setpgrp=''
630 d_setprior=''
631 d_setproctitle=''
632 d_setprotoent_r=''
633 setprotoent_r_proto=''
634 d_setpwent=''
635 d_setpwent_r=''
636 setpwent_r_proto=''
637 d_setregid=''
638 d_setresgid=''
639 d_setresuid=''
640 d_setreuid=''
641 d_setrgid=''
642 d_setruid=''
643 d_setsent=''
644 d_setservent_r=''
645 setservent_r_proto=''
646 d_setsid=''
647 d_setvbuf=''
648 d_sfio=''
649 usesfio=''
650 d_shm=''
651 d_shmat=''
652 d_shmatprototype=''
653 shmattype=''
654 d_shmctl=''
655 d_shmdt=''
656 d_shmget=''
657 d_sigaction=''
658 d_sigprocmask=''
659 d_sigsetjmp=''
660 d_sockatmark=''
661 d_sockatmarkproto=''
662 d_msg_ctrunc=''
663 d_msg_dontroute=''
664 d_msg_oob=''
665 d_msg_peek=''
666 d_msg_proxy=''
667 d_oldsock=''
668 d_scm_rights=''
669 d_socket=''
670 d_sockpair=''
671 sockethdr=''
672 socketlib=''
673 d_socklen_t=''
674 d_socks5_init=''
675 d_sqrtl=''
676 d_srand48_r=''
677 srand48_r_proto=''
678 d_srandom_r=''
679 srandom_r_proto=''
680 d_sresgproto=''
681 d_sresuproto=''
682 d_statblks=''
683 d_statfs_f_flags=''
684 d_statfs_s=''
685 d_fstatvfs=''
686 d_statvfs=''
687 d_stdio_cnt_lval=''
688 d_stdio_ptr_lval=''
689 d_stdio_ptr_lval_nochange_cnt=''
690 d_stdio_ptr_lval_sets_cnt=''
691 d_stdiobase=''
692 d_stdstdio=''
693 stdio_base=''
694 stdio_bufsiz=''
695 stdio_cnt=''
696 stdio_filbuf=''
697 stdio_ptr=''
698 d_index=''
699 d_strchr=''
700 d_strcoll=''
701 d_strctcpy=''
702 d_strerrm=''
703 d_strerror=''
704 d_sysernlst=''
705 d_syserrlst=''
706 d_strerror_r=''
707 strerror_r_proto=''
708 d_strftime=''
709 d_strtod=''
710 d_strtol=''
711 d_strtold=''
712 d_strtoll=''
713 d_strtoq=''
714 d_strtoul=''
715 d_strtoull=''
716 d_strtouq=''
717 d_strxfrm=''
718 d_symlink=''
719 d_syscall=''
720 d_syscallproto=''
721 d_sysconf=''
722 d_system=''
723 d_tcgetpgrp=''
724 d_tcsetpgrp=''
725 d_telldirproto=''
726 d_time=''
727 timetype=''
728 clocktype=''
729 d_times=''
730 d_tmpnam_r=''
731 tmpnam_r_proto=''
732 d_truncate=''
733 d_ttyname_r=''
734 ttyname_r_proto=''
735 d_tzname=''
736 d_u32align=''
737 d_ualarm=''
738 d_umask=''
739 d_semctl_semid_ds=''
740 d_semctl_semun=''
741 d_union_semun=''
742 d_unordered=''
743 d_usleep=''
744 d_usleepproto=''
745 d_ustat=''
746 d_vfork=''
747 usevfork=''
748 d_voidsig=''
749 signal_t=''
750 d_volatile=''
751 d_charvspr=''
752 d_vprintf=''
753 d_wait4=''
754 d_waitpid=''
755 d_wcstombs=''
756 d_wctomb=''
757 d_writev=''
758 dlext=''
759 cccdlflags=''
760 ccdlflags=''
761 dlsrc=''
762 ld=''
763 lddlflags=''
764 usedl=''
765 doublesize=''
766 ebcdic=''
767 fflushNULL=''
768 fflushall=''
769 fpossize=''
770 fpostype=''
771 gccansipedantic=''
772 gccosandvers=''
773 gccversion=''
774 gidformat=''
775 gidsign=''
776 gidsize=''
777 gidtype=''
778 groupstype=''
779 h_fcntl=''
780 h_sysfile=''
781 html1dir=''
782 html1direxp=''
783 installhtml1dir=''
784 html3dir=''
785 html3direxp=''
786 installhtml3dir=''
787 i_arpainet=''
788 i_crypt=''
789 db_hashtype=''
790 db_prefixtype=''
791 db_version_major=''
792 db_version_minor=''
793 db_version_patch=''
794 i_db=''
795 i_dbm=''
796 i_rpcsvcdbm=''
797 d_dirnamlen=''
798 direntrytype=''
799 i_dirent=''
800 i_dld=''
801 i_dlfcn=''
802 i_fcntl=''
803 i_float=''
804 i_fp=''
805 i_fp_class=''
806 i_gdbm=''
807 d_grpasswd=''
808 i_grp=''
809 i_ieeefp=''
810 i_inttypes=''
811 i_langinfo=''
812 i_libutil=''
813 i_limits=''
814 i_locale=''
815 i_machcthr=''
816 i_malloc=''
817 i_math=''
818 i_memory=''
819 i_mntent=''
820 i_ndbm=''
821 i_netdb=''
822 i_neterrno=''
823 i_netinettcp=''
824 i_niin=''
825 i_sysin=''
826 i_poll=''
827 i_prot=''
828 i_pthread=''
829 d_pwage=''
830 d_pwchange=''
831 d_pwclass=''
832 d_pwcomment=''
833 d_pwexpire=''
834 d_pwgecos=''
835 d_pwpasswd=''
836 d_pwquota=''
837 i_pwd=''
838 i_sfio=''
839 i_shadow=''
840 i_socks=''
841 i_stddef=''
842 i_stdlib=''
843 i_string=''
844 strings=''
845 i_sunmath=''
846 i_sysaccess=''
847 i_sysdir=''
848 i_sysfile=''
849 d_voidtty=''
850 i_bsdioctl=''
851 i_sysfilio=''
852 i_sysioctl=''
853 i_syssockio=''
854 i_syslog=''
855 i_sysmman=''
856 i_sysmode=''
857 i_sysmount=''
858 i_sysndir=''
859 i_sysparam=''
860 i_sysresrc=''
861 i_syssecrt=''
862 i_sysselct=''
863 i_sysstat=''
864 i_sysstatfs=''
865 i_sysstatvfs=''
866 i_systimes=''
867 i_systypes=''
868 i_sysuio=''
869 i_sysun=''
870 i_sysutsname=''
871 i_sysvfs=''
872 i_syswait=''
873 i_sgtty=''
874 i_termio=''
875 i_termios=''
876 d_tm_tm_gmtoff=''
877 d_tm_tm_zone=''
878 i_systime=''
879 i_systimek=''
880 i_time=''
881 timeincl=''
882 i_unistd=''
883 i_ustat=''
884 i_utime=''
885 i_values=''
886 i_stdarg=''
887 i_varargs=''
888 i_varhdr=''
889 i_vfork=''
890 inc_version_list=''
891 inc_version_list_init=''
892 installprefix=''
893 installprefixexp=''
894 installstyle=''
895 installusrbinperl=''
896 intsize=''
897 longsize=''
898 shortsize=''
899 issymlink=''
900 libc=''
901 ldlibpthname=''
902 libperl=''
903 shrpenv=''
904 useshrplib=''
905 glibpth=''
906 libpth=''
907 loclibpth=''
908 plibpth=''
909 xlibpth=''
910 ignore_versioned_solibs=''
911 libs=''
912 libsdirs=''
913 libsfiles=''
914 libsfound=''
915 libspath=''
916 lns=''
917 d_PRIEUldbl=''
918 d_PRIFUldbl=''
919 d_PRIGUldbl=''
920 d_PRIeldbl=''
921 d_PRIfldbl=''
922 d_PRIgldbl=''
923 d_SCNfldbl=''
924 sPRIEUldbl=''
925 sPRIFUldbl=''
926 sPRIGUldbl=''
927 sPRIeldbl=''
928 sPRIfldbl=''
929 sPRIgldbl=''
930 sSCNfldbl=''
931 lseeksize=''
932 lseektype=''
933 make_set_make=''
934 d_mymalloc=''
935 freetype=''
936 mallocobj=''
937 mallocsrc=''
938 malloctype=''
939 usemymalloc=''
940 installman1dir=''
941 man1dir=''
942 man1direxp=''
943 man1ext=''
944 installman3dir=''
945 man3dir=''
946 man3direxp=''
947 man3ext=''
948 modetype=''
949 multiarch=''
950 mydomain=''
951 myhostname=''
952 phostname=''
953 c=''
954 n=''
955 d_eofnblk=''
956 eagain=''
957 o_nonblock=''
958 rd_nodata=''
959 need_va_copy=''
960 netdb_hlen_type=''
961 netdb_host_type=''
962 netdb_name_type=''
963 netdb_net_type=''
964 groupcat=''
965 hostcat=''
966 passcat=''
967 orderlib=''
968 ranlib=''
969 d_perl_otherlibdirs=''
970 otherlibdirs=''
971 package=''
972 spackage=''
973 pager=''
974 api_revision=''
975 api_subversion=''
976 api_version=''
977 api_versionstring=''
978 patchlevel=''
979 perl_patchlevel=''
980 revision=''
981 subversion=''
982 version=''
983 version_patchlevel_string=''
984 perl5=''
985 perladmin=''
986 perlpath=''
987 d_nv_preserves_uv=''
988 i16size=''
989 i16type=''
990 i32size=''
991 i32type=''
992 i64size=''
993 i64type=''
994 i8size=''
995 i8type=''
996 ivsize=''
997 ivtype=''
998 nv_preserves_uv_bits=''
999 nvsize=''
1000 nvtype=''
1001 u16size=''
1002 u16type=''
1003 u32size=''
1004 u32type=''
1005 u64size=''
1006 u64type=''
1007 u8size=''
1008 u8type=''
1009 uvsize=''
1010 uvtype=''
1011 ivdformat=''
1012 nvEUformat=''
1013 nvFUformat=''
1014 nvGUformat=''
1015 nveformat=''
1016 nvfformat=''
1017 nvgformat=''
1018 uvXUformat=''
1019 uvoformat=''
1020 uvuformat=''
1021 uvxformat=''
1022 pidtype=''
1023 prefix=''
1024 prefixexp=''
1025 installprivlib=''
1026 privlib=''
1027 privlibexp=''
1028 prototype=''
1029 ptrsize=''
1030 d_PRIXU64=''
1031 d_PRId64=''
1032 d_PRIi64=''
1033 d_PRIo64=''
1034 d_PRIu64=''
1035 d_PRIx64=''
1036 sPRIXU64=''
1037 sPRId64=''
1038 sPRIi64=''
1039 sPRIo64=''
1040 sPRIu64=''
1041 sPRIx64=''
1042 d_quad=''
1043 quadkind=''
1044 quadtype=''
1045 uquadtype=''
1046 drand01=''
1047 randbits=''
1048 randfunc=''
1049 randseedtype=''
1050 seedfunc=''
1051 installscript=''
1052 scriptdir=''
1053 scriptdirexp=''
1054 selectminbits=''
1055 selecttype=''
1056 sh=''
1057 sig_count=''
1058 sig_name=''
1059 sig_name_init=''
1060 sig_num=''
1061 sig_num_init=''
1062 sig_size=''
1063 installsitearch=''
1064 sitearch=''
1065 sitearchexp=''
1066 installsitebin=''
1067 sitebin=''
1068 sitebinexp=''
1069 installsitehtml1=''
1070 sitehtml1=''
1071 sitehtml1exp=''
1072 installsitehtml3=''
1073 sitehtml3=''
1074 sitehtml3exp=''
1075 installsitelib=''
1076 sitelib=''
1077 sitelib_stem=''
1078 sitelibexp=''
1079 installsiteman1=''
1080 siteman1=''
1081 siteman1exp=''
1082 installsiteman3=''
1083 siteman3=''
1084 siteman3exp=''
1085 siteprefix=''
1086 siteprefixexp=''
1087 installsitescript=''
1088 sitescript=''
1089 sitescriptexp=''
1090 sizesize=''
1091 sizetype=''
1092 so=''
1093 socksizetype=''
1094 sharpbang=''
1095 shsharp=''
1096 spitshell=''
1097 src=''
1098 ssizetype=''
1099 startperl=''
1100 startsh=''
1101 stdchar=''
1102 d_stdio_stream_array=''
1103 stdio_stream_array=''
1104 sysman=''
1105 trnl=''
1106 uidformat=''
1107 uidsign=''
1108 uidsize=''
1109 uidtype=''
1110 archname64=''
1111 use64bitall=''
1112 use64bitint=''
1113 ccflags_uselargefiles=''
1114 ldflags_uselargefiles=''
1115 libswanted_uselargefiles=''
1116 uselargefiles=''
1117 uselongdouble=''
1118 usemorebits=''
1119 usemultiplicity=''
1120 nm_opt=''
1121 nm_so_opt=''
1122 runnm=''
1123 usenm=''
1124 useperlio=''
1125 usesocks=''
1126 d_oldpthreads=''
1127 use5005threads=''
1128 useithreads=''
1129 usereentrant=''
1130 usethreads=''
1131 incpath=''
1132 mips_type=''
1133 usrinc=''
1134 d_vendorarch=''
1135 installvendorarch=''
1136 vendorarch=''
1137 vendorarchexp=''
1138 d_vendorbin=''
1139 installvendorbin=''
1140 vendorbin=''
1141 vendorbinexp=''
1142 installvendorhtml1=''
1143 vendorhtml1=''
1144 vendorhtml1exp=''
1145 installvendorhtml3=''
1146 vendorhtml3=''
1147 vendorhtml3exp=''
1148 d_vendorlib=''
1149 installvendorlib=''
1150 vendorlib=''
1151 vendorlib_stem=''
1152 vendorlibexp=''
1153 installvendorman1=''
1154 vendorman1=''
1155 vendorman1exp=''
1156 installvendorman3=''
1157 vendorman3=''
1158 vendorman3exp=''
1159 usevendorprefix=''
1160 vendorprefix=''
1161 vendorprefixexp=''
1162 d_vendorscript=''
1163 installvendorscript=''
1164 vendorscript=''
1165 vendorscriptexp=''
1166 versiononly=''
1167 defvoidused=''
1168 voidflags=''
1169 pm_apiversion=''
1170 xs_apiversion=''
1171 yacc=''
1172 yaccflags=''
1173 CONFIG=''
1174
1175 define='define'
1176 undef='undef'
1177 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1178 rmlist=''
1179
1180 : We must find out about Eunice early
1181 eunicefix=':'
1182 if test -f /etc/unixtovms; then
1183         eunicefix=/etc/unixtovms
1184 fi
1185 if test -f /etc/unixtovms.exe; then
1186         eunicefix=/etc/unixtovms.exe
1187 fi
1188
1189 : Set executable suffix now -- needed before hints available
1190 if test -f "/libs/version.library"; then
1191 : Amiga OS
1192     _exe=""
1193 elif test -f "/system/gnu_library/bin/ar.pm"; then
1194 : Stratus VOS
1195     _exe=".pm"
1196 elif test -n "$DJGPP"; then
1197 : DOS DJGPP
1198     _exe=".exe"
1199 elif test -d c:/. -o -n "$is_os2" ; then
1200 : OS/2 or cygwin
1201     _exe=".exe"
1202 fi
1203
1204 i_whoami=''
1205 : Possible local include directories to search.
1206 : Set locincpth to "" in a hint file to defeat local include searches.
1207 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1208 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1209 :
1210 : no include file wanted by default
1211 inclwanted=''
1212
1213 siteman1=''
1214 siteman3=''
1215 sitescript=''
1216 : Trailing extension.  Override this in a hint file, if needed.
1217 : Extra object files, if any, needed on this platform.
1218 archobjs=''
1219 groupstype=''
1220 libnames=''
1221 : change the next line if compiling for Xenix/286 on Xenix/386
1222 xlibpth='/usr/lib/386 /lib/386'
1223 : Possible local library directories to search.
1224 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1225 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1226
1227 : general looking path for locating libraries
1228 glibpth="/lib /usr/lib $xlibpth"
1229 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1230 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1231 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1232
1233 : Private path used by Configure to find libraries.  Its value
1234 : is prepended to libpth. This variable takes care of special
1235 : machines, like the mips.  Usually, it should be empty.
1236 plibpth=''
1237
1238 : default library list
1239 libswanted=''
1240 : some systems want to use only the non-versioned libso:s
1241 ignore_versioned_solibs=''
1242 : full support for void wanted by default
1243 defvoidused=15
1244
1245 ccname=''
1246 ccversion=''
1247 perllibs=''
1248 : set useposix=false in your hint file to disable the POSIX extension.
1249 useposix=true
1250 : set useopcode=false in your hint file to disable the Opcode extension.
1251 useopcode=true
1252 archname64=''
1253 ccflags_uselargefiles=''
1254 ldflags_uselargefiles=''
1255 libswanted_uselargefiles=''
1256 : set usemultiplicity on the Configure command line to enable multiplicity.
1257 : set usesocks on the Configure command line to enable socks.
1258 archname=''
1259 : set usethreads on the Configure command line to enable threads.
1260 usereentrant='undef'
1261 : List of libraries we want.
1262 : If anyone needs -lnet, put it in a hint file.
1263 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1264 libswanted="$libswanted dld ld sun m c cposix posix"
1265 libswanted="$libswanted ndir dir crypt sec"
1266 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1267 : We probably want to search /usr/shlib before most other libraries.
1268 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1269 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1270 glibpth="/usr/shlib $glibpth"
1271 : Do not use vfork unless overridden by a hint file.
1272 usevfork=false
1273
1274 : Find the basic shell for Bourne shell scripts
1275 case "$sh" in
1276 '')
1277         case "$SYSTYPE" in
1278         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1279         *) xxx='/bin/sh';;
1280         esac
1281         if test -f "$xxx"; then
1282                 sh="$xxx"
1283         else
1284                 : Build up a list and do a single loop so we can 'break' out.
1285                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1286                 for xxx in sh bash ksh pdksh ash; do
1287                         for p in $pth; do
1288                                 try="$try ${p}/${xxx}"
1289                         done
1290                 done
1291                 for xxx in $try; do
1292                         if test -f "$xxx"; then
1293                                 sh="$xxx";
1294                                 break
1295                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1296                                 sh="$xxx";
1297                                 break
1298                         elif test -f "$xxx.exe"; then
1299                                 sh="$xxx";
1300                                 break
1301                         fi
1302                 done
1303         fi
1304         ;;
1305 esac
1306
1307 case "$sh" in
1308 '')     cat >&2 <<EOM
1309 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1310
1311 Usually it's in /bin/sh.  How did you even get this far?
1312 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1313 we'll try to straighten this all out.
1314 EOM
1315         exit 1
1316         ;;
1317 esac
1318
1319 : see if sh knows # comments
1320 if `$sh -c '#' >/dev/null 2>&1`; then
1321         shsharp=true
1322         spitshell=cat
1323         xcat=/bin/cat
1324         test -f $xcat$_exe || xcat=/usr/bin/cat
1325         if test ! -f $xcat$_exe; then
1326                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1327                         if test -f $p/cat$_exe; then
1328                                 xcat=$p/cat
1329                                 break
1330                         fi
1331                 done
1332                 if test ! -f $xcat$_exe; then
1333                         echo "Can't find cat anywhere!"
1334                         exit 1
1335                 fi
1336         fi
1337         echo "#!$xcat" >sharp
1338         $eunicefix sharp
1339         chmod +x sharp
1340         ./sharp > today
1341         if test -s today; then
1342                 sharpbang='#!'
1343         else
1344                 echo "#! $xcat" > sharp
1345                 $eunicefix sharp
1346                 chmod +x sharp
1347                 ./sharp > today
1348                 if test -s today; then
1349                         sharpbang='#! '
1350                 else
1351                         sharpbang=': use '
1352                 fi
1353         fi
1354 else
1355         echo " "
1356         echo "Your $sh doesn't grok # comments--I will strip them later on."
1357         shsharp=false
1358         cd ..
1359         echo "exec grep -v '^[  ]*#'" >spitshell
1360         chmod +x spitshell
1361         $eunicefix spitshell
1362         spitshell=`pwd`/spitshell
1363         cd UU
1364         echo "I presume that if # doesn't work, #! won't work either!"
1365         sharpbang=': use '
1366 fi
1367 rm -f sharp today
1368
1369 : figure out how to guarantee sh startup
1370 case "$startsh" in
1371 '') startsh=${sharpbang}${sh} ;;
1372 *)
1373 esac
1374 cat >sharp <<EOSS
1375 $startsh
1376 set abc
1377 test "$?abc" != 1
1378 EOSS
1379
1380 chmod +x sharp
1381 $eunicefix sharp
1382 if ./sharp; then
1383         : echo "Yup, it does."
1384 else
1385         echo "Hmm... '$startsh' does not guarantee sh startup..."
1386         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1387 fi
1388 rm -f sharp
1389
1390
1391 : Save command line options in file UU/cmdline.opt for later use in
1392 : generating config.sh.
1393 cat > cmdline.opt <<EOSH
1394 # Configure command line arguments.
1395 config_arg0='$0'
1396 config_args='$*'
1397 config_argc=$#
1398 EOSH
1399 argn=1
1400 args_exp=''
1401 args_sep=''
1402 for arg in "$@"; do
1403         cat >>cmdline.opt <<EOSH
1404 config_arg$argn='$arg'
1405 EOSH
1406         # Extreme backslashitis: replace each ' by '"'"'
1407         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1408 $arg
1409 EOC
1410         arg_exp=`cat cmdl.opt`
1411         args_exp="$args_exp$args_sep'$arg_exp'"
1412         argn=`expr $argn + 1`
1413         args_sep=' '
1414 done
1415 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1416 # used by ./hints/os2.sh
1417 rm -f cmdl.opt
1418
1419 : produce awk script to parse command line options
1420 cat >options.awk <<'EOF'
1421 BEGIN {
1422         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1423
1424         len = length(optstr);
1425         for (i = 1; i <= len; i++) {
1426                 c = substr(optstr, i, 1);
1427                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1428                 if (a == ":") {
1429                         arg[c] = 1;
1430                         i++;
1431                 }
1432                 opt[c] = 1;
1433         }
1434 }
1435 {
1436         expect = 0;
1437         str = $0;
1438         if (substr(str, 1, 1) != "-") {
1439                 printf("'%s'\n", str);
1440                 next;
1441         }
1442         len = length($0);
1443         for (i = 2; i <= len; i++) {
1444                 c = substr(str, i, 1);
1445                 if (!opt[c]) {
1446                         printf("-%s\n", substr(str, i));
1447                         next;
1448                 }
1449                 printf("-%s\n", c);
1450                 if (arg[c]) {
1451                         if (i < len)
1452                                 printf("'%s'\n", substr(str, i + 1));
1453                         else
1454                                 expect = 1;
1455                         next;
1456                 }
1457         }
1458 }
1459 END {
1460         if (expect)
1461                 print "?";
1462 }
1463 EOF
1464
1465 : process the command line options
1466 set X `for arg in "$@"; do echo "X$arg"; done |
1467         sed -e s/X// | awk -f options.awk`
1468 eval "set $*"
1469 shift
1470 rm -f options.awk
1471
1472 : set up default values
1473 fastread=''
1474 reuseval=false
1475 config_sh=''
1476 alldone=''
1477 error=''
1478 silent=''
1479 extractsh=''
1480 override=''
1481 knowitall=''
1482 rm -f optdef.sh posthint.sh
1483 cat >optdef.sh <<EOS
1484 $startsh
1485 EOS
1486
1487
1488 : option parsing
1489 while test $# -gt 0; do
1490         case "$1" in
1491         -d) shift; fastread=yes;;
1492         -e) shift; alldone=cont;;
1493         -f)
1494                 shift
1495                 cd ..
1496                 if test -r "$1"; then
1497                         config_sh="$1"
1498                 else
1499                         echo "$me: cannot read config file $1." >&2
1500                         error=true
1501                 fi
1502                 cd UU
1503                 shift;;
1504         -h) shift; error=true;;
1505         -r) shift; reuseval=true;;
1506         -s) shift; silent=true; realsilent=true;;
1507         -E) shift; alldone=exit;;
1508         -K) shift; knowitall=true;;
1509         -O) shift; override=true;;
1510         -S) shift; silent=true; extractsh=true;;
1511         -D)
1512                 shift
1513                 case "$1" in
1514                 *=)
1515                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1516                         echo "$me: ignoring -D $1" >&2
1517                         ;;
1518                 *=*) echo "$1" | \
1519                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1520                 *) echo "$1='define'" >> optdef.sh;;
1521                 esac
1522                 shift
1523                 ;;
1524         -U)
1525                 shift
1526                 case "$1" in
1527                 *=) echo "$1" >> optdef.sh;;
1528                 *=*)
1529                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1530                         echo "$me: ignoring -U $1" >&2
1531                         ;;
1532                 *) echo "$1='undef'" >> optdef.sh;;
1533                 esac
1534                 shift
1535                 ;;
1536         -A)
1537             shift
1538             xxx=''
1539             yyy="$1"
1540             zzz=''
1541             uuu=undef
1542             case "$yyy" in
1543             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1544                  case "$zzz" in
1545                  *:*) zzz='' ;;
1546                  *)   xxx=append
1547                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1548                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1549                  esac
1550                  ;;
1551             esac
1552             case "$xxx" in
1553             '')  case "$yyy" in
1554                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1555                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1556                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1557                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1558                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1559                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1560                  esac
1561                  ;;       
1562             esac
1563             case "$xxx" in
1564             append)
1565                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1566             clear)
1567                 echo "$yyy=''"                  >> posthint.sh ;;
1568             define)
1569                 case "$zzz" in
1570                 '') zzz=define ;;
1571                 esac
1572                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1573             eval)
1574                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1575             prepend)
1576                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1577             undef)
1578                 case "$zzz" in
1579                 '') zzz="$uuu" ;;
1580                 esac
1581                 echo "$yyy=$zzz"                >> posthint.sh ;;
1582             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1583             esac
1584             shift
1585             ;;
1586         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1587             exit 0;;
1588         --) break;;
1589         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1590         *) break;;
1591         esac
1592 done
1593
1594 case "$error" in
1595 true)
1596         cat >&2 <<EOM
1597 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1598                  [-U symbol] [-U symbol=] [-A command:symbol...]
1599   -d : use defaults for all answers.
1600   -e : go on without questioning past the production of config.sh.
1601   -f : specify an alternate default configuration file.
1602   -h : print this help message and exit (with an error status).
1603   -r : reuse C symbols value if possible (skips costly nm extraction).
1604   -s : silent mode, only echoes questions and essential information.
1605   -D : define symbol to have some value:
1606          -D symbol         symbol gets the value 'define'
1607          -D symbol=value   symbol gets the value 'value'
1608   -E : stop at the end of questions, after having produced config.sh.
1609   -K : do not use unless you know what you are doing.
1610   -O : let -D and -U override definitions from loaded configuration file.
1611   -S : perform variable substitutions on all .SH files (can mix with -f)
1612   -U : undefine symbol:
1613          -U symbol    symbol gets the value 'undef'
1614          -U symbol=   symbol gets completely empty
1615   -A : manipulate symbol after the platform specific hints have been applied:
1616          -A symbol=value                append " "value to symbol
1617          -A append:symbol=value         append value to symbol
1618          -A define:symbol=value         define symbol to have value
1619          -A clear:symbol                define symbol to be ''
1620          -A define:symbol               define symbol to be 'define'
1621          -A eval:symbol=value           define symbol to be eval of value
1622          -A prepend:symbol=value        prepend value to symbol
1623          -A undef:symbol                define symbol to be 'undef'
1624          -A undef:symbol=               define symbol to be ''
1625   -V : print version number and exit (with a zero status).
1626 EOM
1627         exit 1
1628         ;;
1629 esac
1630
1631 : Sanity checks
1632 case "$fastread$alldone" in
1633 yescont|yesexit) ;;
1634 *)
1635         case "$extractsh" in
1636         true) ;;
1637         *)
1638                 if test ! -t 0; then
1639                         echo "Say 'sh Configure', not 'sh <Configure'"
1640                         exit 1
1641                 fi
1642                 ;;
1643         esac
1644         ;;
1645 esac
1646
1647 exec 4>&1
1648 case "$silent" in
1649 true) exec 1>/dev/null;;
1650 esac
1651
1652 : run the defines and the undefines, if any, but leave the file out there...
1653 touch optdef.sh
1654 . ./optdef.sh
1655 : create the posthint manipulation script and leave the file out there...
1656 touch posthint.sh
1657
1658 : set package name
1659 package=perl5
1660 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1661 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1662 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1663 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1664 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1665 esac
1666
1667 : Some greps do not return status, grrr.
1668 echo "grimblepritz" >grimble
1669 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1670         contains=contains
1671 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1672         contains=grep
1673 else
1674         contains=contains
1675 fi
1676 rm -f grimble
1677 : the following should work in any shell
1678 case "$contains" in
1679 contains*)
1680         echo " "
1681         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1682         cat >contains <<'EOSS'
1683 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1684 EOSS
1685 chmod +x contains
1686 esac
1687
1688 : Find the path to the source tree
1689 case "$src" in
1690 '') case "$0" in
1691     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1692          case "$src" in
1693          /*)    ;;
1694          .)     ;;
1695          *)     src=`cd ../$src && pwd` ;;
1696          esac
1697          ;;
1698     *)   src='.';;
1699     esac;;
1700 esac
1701 case "$src" in
1702 '')     src=/
1703         rsrc=/
1704         ;;
1705 /*) rsrc="$src";;
1706 *) rsrc="../$src";;
1707 esac
1708 if test -f $rsrc/Configure && \
1709         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1710 then
1711    : found it, so we are ok.
1712 else
1713         rsrc=''
1714         for src in . .. ../.. ../../.. ../../../..; do
1715                 if test -f ../$src/Configure && \
1716                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1717                 then
1718                         rsrc=../$src
1719                         break
1720                 fi
1721         done
1722 fi
1723 case "$rsrc" in
1724 '')
1725         cat <<EOM >&4
1726
1727 Sorry, I can't seem to locate the source dir for $package.  Please start
1728 Configure with an explicit path -- i.e. /some/path/Configure.
1729
1730 EOM
1731         exit 1
1732         ;;
1733 ../.)   rsrc='..';;
1734 *)
1735         echo " "
1736         echo "Sources for $package found in \"$src\"." >&4
1737         ;;
1738 esac
1739
1740 : script used to extract .SH files with variable substitutions
1741 cat >extract <<'EOS'
1742 PERL_CONFIG_SH=true
1743 echo "Doing variable substitutions on .SH files..."
1744 if test -f MANIFEST; then
1745         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1746 else
1747         echo "(Looking for .SH files under the source directory.)"
1748         set x `(cd "$src"; find . -name "*.SH" -print)`
1749 fi
1750 shift
1751 case $# in
1752 0) set x `(cd "$src"; echo *.SH)`; shift;;
1753 esac
1754 if test ! -f "$src/$1"; then
1755         shift
1756 fi
1757 mkdir_p='
1758 name=$1;
1759 create="";
1760 while test $name; do
1761         if test ! -d "$name"; then
1762                 create="$name $create";
1763                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1764                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1765         else
1766                 name="";
1767         fi;
1768 done;
1769 for file in $create; do
1770         mkdir $file;
1771 done
1772 '
1773 for file in $*; do
1774         case "$src" in
1775         ".")
1776                 case "$file" in
1777                 */*)
1778                         dir=`expr X$file : 'X\(.*\)/'`
1779                         file=`expr X$file : 'X.*/\(.*\)'`
1780                         (cd "$dir" && . ./$file)
1781                         ;;
1782                 *)
1783                         . ./$file
1784                         ;;
1785                 esac
1786                 ;;
1787         *)
1788                 case "$file" in
1789                 */*)
1790                         dir=`expr X$file : 'X\(.*\)/'`
1791                         file=`expr X$file : 'X.*/\(.*\)'`
1792                         (set x $dir; shift; eval $mkdir_p)
1793                         sh <"$src/$dir/$file"
1794                         ;;
1795                 *)
1796                         sh <"$src/$file"
1797                         ;;
1798                 esac
1799                 ;;
1800         esac
1801 done
1802 if test -f "$src/config_h.SH"; then
1803         if test ! -f config.h; then
1804         : oops, they left it out of MANIFEST, probably, so do it anyway.
1805         . "$src/config_h.SH"
1806         fi
1807 fi
1808 EOS
1809
1810 : extract files and exit if asked to do so
1811 case "$extractsh" in
1812 true)
1813         case "$realsilent" in
1814         true) ;;
1815         *) exec 1>&4;;
1816         esac
1817         case "$config_sh" in
1818         '') config_sh='config.sh';;
1819         esac
1820         echo " "
1821         echo "Fetching answers from $config_sh..."
1822         cd ..
1823         . $config_sh
1824         test "$override" && . ./optdef.sh
1825         echo " "
1826         . UU/extract
1827         rm -rf UU
1828         echo "Extraction done."
1829         exit 0
1830         ;;
1831 esac
1832
1833 : Eunice requires " " instead of "", can you believe it
1834 echo " "
1835 : Here we go...
1836 echo "Beginning of configuration questions for $package."
1837
1838 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1839
1840 : first determine how to suppress newline on echo command
1841 echo " "
1842 echo "Checking echo to see how to suppress newlines..."
1843 (echo "hi there\c" ; echo " ") >.echotmp
1844 if $contains c .echotmp >/dev/null 2>&1 ; then
1845         echo "...using -n."
1846         n='-n'
1847         c=''
1848 else
1849         cat <<'EOM'
1850 ...using \c
1851 EOM
1852         n=''
1853         c='\c'
1854 fi
1855 echo $n "The star should be here-->$c"
1856 echo '*'
1857 rm -f .echotmp
1858
1859 : Now test for existence of everything in MANIFEST
1860 echo " "
1861 if test -f "$rsrc/MANIFEST"; then
1862         echo "First let's make sure your kit is complete.  Checking..." >&4
1863         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1864         rm -f missing
1865         tmppwd=`pwd`
1866         for filelist in x??; do
1867                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1868         done
1869         if test -s missing; then
1870                 cat missing >&4
1871                 cat >&4 <<'EOM'
1872
1873 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1874
1875 You have the option of continuing the configuration process, despite the
1876 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1877 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1878 and contact the author (perlbug@perl.org).
1879
1880 EOM
1881                 echo $n "Continue? [n] $c" >&4
1882                 read ans
1883                 case "$ans" in
1884                 y*)
1885                         echo "Continuing..." >&4
1886                         rm -f missing
1887                         ;;
1888                 *)
1889                         echo "ABORTING..." >&4
1890                         kill $$
1891                         ;;
1892                 esac
1893         else
1894                 echo "Looks good..."
1895         fi
1896 else
1897         echo "There is no MANIFEST file.  I hope your kit is complete !"
1898 fi
1899 rm -f missing x??
1900
1901 echo " "
1902 : Find the appropriate value for a newline for tr
1903 if test -n "$DJGPP"; then
1904        trnl='\012'
1905 fi
1906 if test X"$trnl" = X; then
1907         case "`echo foo|tr '\n' x 2>/dev/null`" in
1908         foox) trnl='\n' ;;
1909         esac
1910 fi
1911 if test X"$trnl" = X; then
1912         case "`echo foo|tr '\012' x 2>/dev/null`" in
1913         foox) trnl='\012' ;;
1914         esac
1915 fi
1916 if test X"$trnl" = X; then
1917        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1918        fooxy) trnl='\n\r' ;;
1919        esac
1920 fi
1921 if test X"$trnl" = X; then
1922         cat <<EOM >&2
1923
1924 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1925
1926 EOM
1927         exit 1
1928 fi
1929
1930 : compute the number of columns on the terminal for proper question formatting
1931 case "$COLUMNS" in
1932 '') COLUMNS='80';;
1933 esac
1934
1935 : set up the echo used in my read
1936 myecho="case \"\$xxxm\" in
1937 '') echo $n \"\$rp $c\" >&4;;
1938 *) case \"\$rp\" in
1939         '') echo $n \"[\$xxxm] $c\";;
1940         *)
1941                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1942                         echo \"\$rp\" >&4
1943                         echo $n \"[\$xxxm] $c\" >&4
1944                 else
1945                         echo $n \"\$rp [\$xxxm] $c\" >&4
1946                 fi
1947                 ;;
1948         esac;;
1949 esac"
1950
1951 : now set up to do reads with possible shell escape and default assignment
1952 cat <<EOSC >myread
1953 $startsh
1954 xxxm=\$dflt
1955 $myecho
1956 ans='!'
1957 case "\$fastread" in
1958 yes) case "\$dflt" in
1959         '') ;;
1960         *) ans='';
1961                 case "\$silent-\$rp" in
1962                 true-) ;;
1963                 *) echo " " >&4;;
1964                 esac;;
1965         esac;;
1966 *) case "\$silent" in
1967         true) case "\$rp" in
1968                 '') ans='';;
1969                 esac;;
1970         esac;;
1971 esac
1972 while expr "X\$ans" : "X!" >/dev/null; do
1973         read answ
1974         set x \$xxxm
1975         shift
1976         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1977         case  "\$answ" in
1978         "!")
1979                 sh 1>&4
1980                 echo " "
1981                 $myecho
1982                 ;;
1983         !*)
1984                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1985                 shift
1986                 sh 1>&4 -c "\$*"
1987                 echo " "
1988                 $myecho
1989                 ;;
1990         "\$ans")
1991                 case "\$ans" in
1992                 \\&*)
1993                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1994                         shift
1995                         case "\$1" in
1996                         -d)
1997                                 fastread=yes
1998                                 echo "(OK, I'll run with -d after this question.)" >&4
1999                                 ;;
2000                         -*)
2001                                 echo "*** Sorry, \$1 not supported yet." >&4
2002                                 ;;
2003                         esac
2004                         $myecho
2005                         ans=!
2006                         ;;
2007                 esac;;
2008         *)
2009                 case "\$aok" in
2010                 y)
2011                         echo "*** Substitution done -- please confirm."
2012                         xxxm="\$ans"
2013                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2014                         xxxm="\$ans"
2015                         ans=!
2016                         ;;
2017                 *)
2018                         echo "*** Error -- try again."
2019                         ans=!
2020                         ;;
2021                 esac
2022                 $myecho
2023                 ;;
2024         esac
2025         case "\$ans\$xxxm\$nostick" in
2026         '')
2027                 ans=!
2028                 $myecho
2029                 ;;
2030         esac
2031 done
2032 case "\$ans" in
2033 '') ans="\$xxxm";;
2034 esac
2035 EOSC
2036
2037 : create .config dir to save info across Configure sessions
2038 test -d ../.config || mkdir ../.config
2039 cat >../.config/README <<EOF
2040 This directory created by Configure to save information that should
2041 persist across sessions for $package.
2042
2043 You may safely delete it if you wish.
2044 EOF
2045
2046 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2047 case "$usedevel" in
2048 $define|true|[yY]*) ;;
2049 *) case "$xversion" in
2050    *[13579])
2051         cat >&4 <<EOH
2052 *** WHOA THERE!!! ***
2053
2054     This is an UNSTABLE DEVELOPMENT release.
2055     The version of this $package distribution is $xversion, that is, odd,
2056     (as opposed to even) and that signifies a development release.
2057     If you want a maintenance release, you want an even-numbered version.
2058
2059     Do ***NOT*** install this into production use.
2060     Data corruption and crashes are possible.
2061
2062     It is most seriously suggested that you do not continue any further
2063     unless you want to help in developing and debugging Perl.
2064
2065     If you *still* want to build perl, you can answer 'y' now,
2066     or pass -Dusedevel to Configure.
2067
2068 EOH
2069         rp='Do you really want to continue?'
2070         dflt='n'
2071         . ./myread
2072         case "$ans" in
2073         [yY]) echo >&4 "Okay, continuing."
2074               usedevel="$define" ;;
2075         *) echo >&4 "Okay, bye."
2076            exit 1
2077            ;;
2078         esac
2079         ;;
2080     esac
2081     ;;
2082 esac
2083 case "$usedevel" in
2084 $define|true|[yY]*)
2085         case "$versiononly" in
2086         '') versiononly="$define" ;;
2087         esac
2088         case "$installusrbinperl" in
2089         '') installusrbinperl="$undef" ;;
2090         esac
2091         ;;
2092 esac
2093
2094 : general instructions
2095 needman=true
2096 firsttime=true
2097 user=`(logname) 2>/dev/null`
2098 case "$user" in
2099 '') user=`whoami 2>&1`;;
2100 esac
2101 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2102         firsttime=false
2103         echo " "
2104         rp='Would you like to see the instructions?'
2105         dflt=n
2106         . ./myread
2107         case "$ans" in
2108         [yY]*) ;;
2109         *) needman=false;;
2110         esac
2111 fi
2112 if $needman; then
2113         cat <<EOH
2114
2115 This installation shell script will examine your system and ask you questions
2116 to determine how the perl5 package should be installed. If you get
2117 stuck on a question, you may use a ! shell escape to start a subshell or
2118 execute a command.  Many of the questions will have default answers in square
2119 brackets; typing carriage return will give you the default.
2120
2121 On some of the questions which ask for file or directory names you are allowed
2122 to use the ~name construct to specify the login directory belonging to "name",
2123 even if you don't have a shell which knows about that.  Questions where this is
2124 allowed will be marked "(~name ok)".
2125
2126 EOH
2127         rp=''
2128         dflt='Type carriage return to continue'
2129         . ./myread
2130         cat <<'EOH'
2131
2132 The prompter used in this script allows you to use shell variables and
2133 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2134 in the default answer, as if the default line was a set of arguments given to a
2135 script shell.  This means you may also use $* to repeat the whole default line,
2136 so you do not have to re-type everything to add something to the default.
2137
2138 Everytime there is a substitution, you will have to confirm.  If there is an
2139 error (e.g. an unmatched backtick), the default answer will remain unchanged
2140 and you will be prompted again.
2141
2142 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2143 the questions and use the computed defaults (or the previous answers if there
2144 was already a config.sh file). Type 'Configure -h' for a list of options.
2145 You may also start interactively and then answer '& -d' at any prompt to turn
2146 on the non-interactive behaviour for the remainder of the execution.
2147
2148 EOH
2149         . ./myread
2150         cat <<EOH
2151
2152 Much effort has been expended to ensure that this shell script will run on any
2153 Unix system.  If despite that it blows up on yours, your best bet is to edit
2154 Configure and run it again.  If you can't run Configure for some reason,
2155 you'll have to generate a config.sh file by hand.  Whatever problems you
2156 have, let me (perlbug@perl.org) know how I blew it.
2157
2158 This installation script affects things in two ways:
2159
2160 1) it may do direct variable substitutions on some of the files included
2161    in this kit.
2162 2) it builds a config.h file for inclusion in C programs.  You may edit
2163    any of these files as the need arises after running this script.
2164
2165 If you make a mistake on a question, there is no easy way to back up to it
2166 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2167 files.  Configure will offer to let you do this before it runs the SH files.
2168
2169 EOH
2170         dflt='Type carriage return to continue'
2171         . ./myread
2172         case "$firsttime" in
2173         true) echo $user >>../.config/instruct;;
2174         esac
2175 fi
2176
2177 : find out where common programs are
2178 echo " "
2179 echo "Locating common programs..." >&4
2180 cat <<EOSC >loc
2181 $startsh
2182 case \$# in
2183 0) exit 1;;
2184 esac
2185 thing=\$1
2186 shift
2187 dflt=\$1
2188 shift
2189 for dir in \$*; do
2190         case "\$thing" in
2191         .)
2192         if test -d \$dir/\$thing; then
2193                 echo \$dir
2194                 exit 0
2195         fi
2196         ;;
2197         *)
2198         for thisthing in \$dir/\$thing; do
2199                 : just loop through to pick last item
2200         done
2201         if test -f \$thisthing; then
2202                 echo \$thisthing
2203                 exit 0
2204         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2205                 echo \$thisthing
2206                 exit 0
2207         elif test -f \$dir/\$thing.exe; then
2208                 if test -n "$DJGPP"; then
2209                         echo \$dir/\$thing.exe
2210                 elif test "$eunicefix" != ":"; then
2211                         : on Eunice apparently
2212                         echo \$dir/\$thing
2213                         exit 0
2214                 fi
2215                 exit 0
2216         fi
2217         ;;
2218         esac
2219 done
2220 echo \$dflt
2221 exit 1
2222 EOSC
2223 chmod +x loc
2224 $eunicefix loc
2225 loclist="
2226 awk
2227 cat
2228 chmod
2229 comm
2230 cp
2231 echo
2232 expr
2233 grep
2234 ls
2235 mkdir
2236 rm
2237 sed
2238 sort
2239 touch
2240 tr
2241 uniq
2242 "
2243 trylist="
2244 Mcc
2245 ar
2246 bison
2247 byacc
2248 cpp
2249 csh
2250 date
2251 egrep
2252 gmake
2253 gzip
2254 less
2255 ln
2256 make
2257 more
2258 nm
2259 nroff
2260 pg
2261 test
2262 uname
2263 zip
2264 "
2265 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2266 pth="$pth /lib /usr/lib"
2267 for file in $loclist; do
2268         eval xxx=\$$file
2269         case "$xxx" in
2270         /*|?:[\\/]*)
2271                 if test -f "$xxx"; then
2272                         : ok
2273                 else
2274                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2275                         xxx=`./loc $file $file $pth`
2276                 fi
2277                 ;;
2278         '') xxx=`./loc $file $file $pth`;;
2279         *) xxx=`./loc $xxx $xxx $pth`;;
2280         esac
2281         eval $file=$xxx$_exe
2282         eval _$file=$xxx
2283         case "$xxx" in
2284         /*)
2285                 echo $file is in $xxx.
2286                 ;;
2287         ?:[\\/]*)
2288                 echo $file is in $xxx.
2289                 ;;
2290         *)
2291                 echo "I don't know where '$file' is, and my life depends on it." >&4
2292                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2293                 exit 1
2294                 ;;
2295         esac
2296 done
2297 echo " "
2298 echo "Don't worry if any of the following aren't found..."
2299 say=offhand
2300 for file in $trylist; do
2301         eval xxx=\$$file
2302         case "$xxx" in
2303         /*|?:[\\/]*)
2304                 if test -f "$xxx"; then
2305                         : ok
2306                 else
2307                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2308                         xxx=`./loc $file $file $pth`
2309                 fi
2310                 ;;
2311         '') xxx=`./loc $file $file $pth`;;
2312         *) xxx=`./loc $xxx $xxx $pth`;;
2313         esac
2314         eval $file=$xxx$_exe
2315         eval _$file=$xxx
2316         case "$xxx" in
2317         /*)
2318                 echo $file is in $xxx.
2319                 ;;
2320         ?:[\\/]*)
2321                 echo $file is in $xxx.
2322                 ;;
2323         *)
2324                 echo "I don't see $file out there, $say."
2325                 say=either
2326                 ;;
2327         esac
2328 done
2329 case "$egrep" in
2330 egrep)
2331         echo "Substituting grep for egrep."
2332         egrep=$grep
2333         _egrep=$grep
2334         ;;
2335 esac
2336 case "$ln" in
2337 ln)
2338         echo "Substituting cp for ln."
2339         ln=$cp
2340         _ln=$cp
2341         ;;
2342 esac
2343 case "$make" in
2344 make)   
2345         case "$gmake" in
2346         gmake)
2347         echo "I can't find make or gmake, and my life depends on it." >&4
2348         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2349         exit 1
2350         ;;
2351         esac
2352         ;;
2353 esac    
2354 case "$gmake" in
2355 gmake)  ;;
2356 *)      # We can't have osname yet.
2357         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2358                 # Assume that gmake, if found, is definitely GNU make
2359                 # and prefer it over the system make.
2360                 echo "Substituting gmake for make."
2361                 make=$gmake
2362                 _make=$gmake
2363         fi
2364         ;;
2365 esac
2366 case "$test" in
2367 test)
2368         echo "Hopefully test is built into your sh."
2369         ;;
2370 *)
2371         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2372                 echo "Using the test built into your sh."
2373                 test=test
2374                 _test=test
2375         fi
2376         ;;
2377 esac
2378 case "$echo" in
2379 echo)
2380         echo "Hopefully echo is built into your sh."
2381         ;;
2382 '') ;;
2383 *)
2384         echo " "
2385 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2386         $echo $n "hi there$c" >foo1
2387         echo $n "hi there$c" >foo2
2388         if cmp foo1 foo2 >/dev/null 2>&1; then
2389                 echo "They are compatible.  In fact, they may be identical."
2390         else
2391                 case "$n" in
2392                 '-n') n='' c='\c';;
2393                 *) n='-n' c='';;
2394                 esac
2395                 cat <<FOO
2396 They are not compatible!  You are probably running ksh on a non-USG system.
2397 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2398 have echo built in and we may have to run some Bourne shell scripts.  That
2399 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2400
2401 FOO
2402                 $echo $n "The star should be here-->$c"
2403                 $echo "*"
2404         fi
2405         $rm -f foo1 foo2
2406         ;;
2407 esac
2408
2409 cat <<EOS >trygcc
2410 $startsh
2411 EOS
2412 cat <<'EOSC' >>trygcc
2413 case "$cc" in
2414 '') ;;
2415 *)  $rm -f try try.*
2416     $cat >try.c <<EOM
2417 int main(int argc, char *argv[]) {
2418   return 0;
2419 }
2420 EOM
2421     if $cc -o try $ccflags $ldflags try.c; then
2422        :
2423     else
2424         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2425         despair=yes
2426         trygcc=yes
2427         case "$cc" in
2428         *gcc*) trygcc=no ;;
2429         esac
2430         case "`$cc -v -c try.c 2>&1`" in
2431         *gcc*) trygcc=no ;;
2432         esac
2433         if $test X"$trygcc" = Xyes; then
2434             if gcc -o try -c try.c; then
2435                 echo " "
2436                 echo "You seem to have a working gcc, though." >&4
2437                 rp="Would you like to use it?"
2438                 dflt=y
2439                 if $test -f myread; then
2440                     . ./myread
2441                 else
2442                     if $test -f UU/myread; then
2443                         . ./UU/myread
2444                     else
2445                         echo "Cannot find myread, sorry.  Aborting." >&2
2446                         exit 1
2447                     fi
2448                 fi  
2449                 case "$ans" in
2450                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2451                        if $test -f usethreads.cbu; then
2452                            $cat >&4 <<EOM 
2453
2454 *** However, any setting of the C compiler flags (e.g. for thread support)
2455 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2456 *** (together with e.g. -Dusethreads).
2457
2458 EOM
2459                        fi;;
2460                 esac
2461             fi
2462         fi
2463     fi
2464     $rm -f try try.*
2465     ;;
2466 esac
2467 EOSC
2468
2469 cat <<EOS >checkcc
2470 $startsh
2471 EOS
2472 cat <<'EOSC' >>checkcc
2473 case "$cc" in        
2474 '') ;;
2475 *)  $rm -f try try.*              
2476     $cat >try.c <<EOM
2477 int main(int argc, char *argv[]) {
2478   return 0;
2479 }
2480 EOM
2481     if $cc -o try $ccflags $ldflags try.c; then
2482        :
2483     else
2484         if $test X"$despair" = Xyes; then
2485            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2486         fi
2487         $cat >&4 <<EOM         
2488 You need to find a working C compiler.
2489 Either (purchase and) install the C compiler supplied by your OS vendor,
2490 or for a free C compiler try http://gcc.gnu.org/
2491 I cannot continue any further, aborting.
2492 EOM
2493         exit 1
2494     fi
2495     $rm -f try try.*
2496     ;;
2497 esac
2498 EOSC
2499
2500 : determine whether symbolic links are supported
2501 echo " "
2502 $touch blurfl
2503 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2504         echo "Symbolic links are supported." >&4
2505         lns="$ln -s"
2506 else
2507         echo "Symbolic links are NOT supported." >&4
2508         lns="$ln"
2509 fi
2510 $rm -f blurfl sym
2511
2512 : determine whether symbolic links are supported
2513 echo " "
2514 case "$lns" in
2515 *"ln"*" -s")
2516         echo "Checking how to test for symbolic links..." >&4
2517         $lns blurfl sym
2518         if $test "X$issymlink" = X; then
2519                 case "$newsh" in
2520                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2521                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2522                 esac
2523                 if test $? = 0; then
2524                         issymlink="test -h"
2525                 else
2526                         echo "Your builtin 'test -h' may be broken." >&4
2527                         case "$test" in
2528                         /*)     ;;
2529                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2530                                 for p in $pth
2531                                 do
2532                                         if test -f "$p/$test"; then
2533                                                 test="$p/$test"
2534                                                 break
2535                                         fi
2536                                 done
2537                                 ;;
2538                         esac
2539                         case "$test" in
2540                         /*)
2541                                 echo "Trying external '$test -h'." >&4
2542                                 issymlink="$test -h"
2543                                 if $test ! -h sym >/dev/null 2>&1; then
2544                                         echo "External '$test -h' is broken, too." >&4
2545                                         issymlink=''
2546                                 fi
2547                                 ;;
2548                         *)      issymlink='' ;;
2549                         esac
2550                 fi              
2551         fi
2552         if $test "X$issymlink" = X; then
2553                 if $test -L sym 2>/dev/null; then
2554                         issymlink="$test -L"
2555                         echo "The builtin '$test -L' worked." >&4
2556                 fi
2557         fi
2558         if $test "X$issymlink" != X; then
2559                 echo "You can test for symbolic links with '$issymlink'." >&4
2560         else
2561                 echo "I do not know how you can test for symbolic links." >&4
2562         fi
2563         $rm -f blurfl sym
2564         ;;
2565 *)      echo "No symbolic links, so not testing for their testing..." >&4
2566         ;;
2567 esac
2568 echo " "
2569
2570
2571 case "$mksymlinks" in
2572 $define|true|[yY]*)
2573         case "$src" in
2574         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2575                 exit 1
2576                 ;;
2577         *)      case "$lns:$issymlink" in
2578                 *"ln"*" -s:"*"test -"?)
2579                         echo "Creating the symbolic links..." >&4
2580                         echo "(First creating the subdirectories...)" >&4
2581                         cd ..
2582                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2583                                 read directory
2584                                 test -z "$directory" && break
2585                                 mkdir -p $directory
2586                         done
2587                         # Sanity check 1.
2588                         if test ! -d t/base; then
2589                                 echo "Failed to create the subdirectories.  Aborting." >&4
2590                                 exit 1
2591                         fi
2592                         echo "(Then creating the symlinks...)" >&4
2593                         awk '{print $1}' $src/MANIFEST | while true; do
2594                                 read filename
2595                                 test -z "$filename" && break
2596                                 if test -f $filename; then
2597                                         if $issymlink $filename; then
2598                                                 rm -f $filename
2599                                         fi
2600                                 fi
2601                                 if test -f $filename; then
2602                                         echo "$filename already exists, not symlinking."
2603                                 else
2604                                         ln -s $src/$filename $filename
2605                                 fi
2606                         done
2607                         # Sanity check 2.
2608                         if test ! -f t/base/lex.t; then
2609                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2610                                 exit 1
2611                         fi
2612                         cd UU
2613                         ;;
2614                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2615                         ;;
2616                 esac
2617                 ;;
2618         esac
2619         ;;
2620 esac
2621
2622
2623 case "$usecrosscompile" in
2624 $define|true|[yY]*)
2625         $echo "Cross-compiling..."
2626         croak=''
2627         case "$cc" in
2628         *-*-gcc) # A cross-compiling gcc, probably.
2629             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2630             ar=$targetarch-ar
2631             # leave out ld, choosing it is more complex
2632             nm=$targetarch-nm
2633             ranlib=$targetarch-ranlib
2634             $echo 'extern int foo;' > try.c
2635             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2636             shift
2637             if $test $# -gt 0; then
2638                 incpth="$incpth $*"
2639                 incpth="`$echo $incpth|$sed 's/^ //'`"
2640                 echo "Guessing incpth '$incpth'." >&4
2641                 for i in $*; do
2642                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2643                     if $test -d $j; then
2644                         libpth="$libpth $j"
2645                     fi
2646                 done   
2647                 libpth="`$echo $libpth|$sed 's/^ //'`"
2648                 echo "Guessing libpth '$libpth'." >&4
2649             fi
2650             $rm -f try.c
2651             ;;
2652         esac
2653         case "$targetarch" in
2654         '') echo "Targetarch not defined." >&4; croak=y ;;
2655         *)  echo "Using targetarch $targetarch." >&4 ;;
2656         esac
2657         case "$incpth" in
2658         '') echo "Incpth not defined." >&4; croak=y ;;
2659         *)  echo "Using incpth '$incpth'." >&4 ;;
2660         esac
2661         case "$libpth" in
2662         '') echo "Libpth not defined." >&4; croak=y ;;
2663         *)  echo "Using libpth '$libpth'." >&4 ;;
2664         esac
2665         case "$usrinc" in
2666         '') for i in $incpth; do
2667                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2668                     usrinc=$i
2669                     echo "Guessing usrinc $usrinc." >&4
2670                     break
2671                 fi
2672             done
2673             case "$usrinc" in
2674             '') echo "Usrinc not defined." >&4; croak=y ;;
2675             esac
2676             ;;
2677         *)  echo "Using usrinc $usrinc." >&4 ;;
2678         esac
2679         case "$targethost" in
2680         '') echo "Targethost not defined." >&4; croak=y ;;
2681         *)  echo "Using targethost $targethost." >&4
2682         esac
2683         locincpth=' '
2684         loclibpth=' '
2685         case "$croak" in
2686         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2687         esac
2688         case "$src" in
2689         /*) run=$src/Cross/run
2690             targetmkdir=$src/Cross/mkdir
2691             to=$src/Cross/to
2692             from=$src/Cross/from
2693             ;;
2694         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2695             run=$pwd/Cross/run
2696             targetmkdir=$pwd/Cross/mkdir
2697             to=$pwd/Cross/to
2698             from=$pwd/Cross/from
2699             ;;
2700         esac
2701         case "$targetrun" in
2702         '') targetrun=ssh ;;
2703         esac
2704         case "$targetto" in
2705         '') targetto=scp ;;
2706         esac
2707         case "$targetfrom" in
2708         '') targetfrom=scp ;;
2709         esac
2710         run=$run-$targetrun
2711         to=$to-$targetto
2712         from=$from-$targetfrom
2713         case "$targetdir" in
2714         '')  targetdir=/tmp
2715              echo "Guessing targetdir $targetdir." >&4
2716              ;;
2717         esac
2718         case "$targetuser" in
2719         '')  targetuser=root
2720              echo "Guessing targetuser $targetuser." >&4
2721              ;;
2722         esac
2723         case "$targetfrom" in
2724         scp)    q=-q ;;
2725         *)      q='' ;;
2726         esac
2727         case "$targetrun" in
2728         ssh|rsh)
2729             cat >$run <<EOF
2730 #!/bin/sh
2731 case "\$1" in
2732 -cwd)
2733   shift
2734   cwd=\$1
2735   shift
2736   ;;
2737 esac
2738 case "\$cwd" in
2739 '') cwd=$targetdir ;;
2740 esac
2741 exe=\$1
2742 shift
2743 if $test ! -f \$exe.xok; then
2744   $to \$exe
2745   $touch \$exe.xok
2746 fi
2747 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2748 EOF
2749             ;;
2750         *)  echo "Unknown targetrun '$targetrun'" >&4
2751             exit 1
2752             ;;
2753         esac
2754         case "$targetmkdir" in
2755         */Cross/mkdir)
2756             cat >$targetmkdir <<EOF
2757 #!/bin/sh
2758 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2759 EOF
2760             $chmod a+rx $targetmkdir
2761             ;;
2762         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2763             exit 1
2764             ;;
2765         esac
2766         case "$targetto" in
2767         scp|rcp)
2768             cat >$to <<EOF
2769 #!/bin/sh
2770 for f in \$@
2771 do
2772   case "\$f" in
2773   /*)
2774     $targetmkdir \`dirname \$f\`
2775     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2776     ;;
2777   *)
2778     $targetmkdir $targetdir/\`dirname \$f\`
2779     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2780     ;;
2781   esac
2782 done
2783 exit 0
2784 EOF
2785             ;;
2786         cp) cat >$to <<EOF
2787 #!/bin/sh
2788 for f in \$@
2789 do
2790   case "\$f" in
2791   /*)
2792     $mkdir -p $targetdir/\`dirname \$f\`
2793     $cp \$f $targetdir/\$f || exit 1
2794     ;;
2795   *)
2796     $targetmkdir $targetdir/\`dirname \$f\`
2797     $cp \$f $targetdir/\$f || exit 1
2798     ;;
2799   esac
2800 done
2801 exit 0
2802 EOF
2803             ;;
2804         *)  echo "Unknown targetto '$targetto'" >&4
2805             exit 1
2806             ;;
2807         esac
2808         case "$targetfrom" in
2809         scp|rcp)
2810           cat >$from <<EOF
2811 #!/bin/sh
2812 for f in \$@
2813 do
2814   $rm -f \$f
2815   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2816 done
2817 exit 0
2818 EOF
2819             ;;
2820         cp) cat >$from <<EOF
2821 #!/bin/sh
2822 for f in \$@
2823 do
2824   $rm -f \$f
2825   cp $targetdir/\$f . || exit 1
2826 done
2827 exit 0
2828 EOF
2829             ;;
2830         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2831             exit 1
2832             ;;
2833         esac
2834         if $test ! -f $run; then
2835             echo "Target 'run' script '$run' not found." >&4
2836         else
2837             $chmod a+rx $run
2838         fi
2839         if $test ! -f $to; then
2840             echo "Target 'to' script '$to' not found." >&4
2841         else
2842             $chmod a+rx $to
2843         fi
2844         if $test ! -f $from; then
2845             echo "Target 'from' script '$from' not found." >&4
2846         else
2847             $chmod a+rx $from
2848         fi
2849         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2850             exit 1
2851         fi
2852         cat >&4 <<EOF
2853 Using '$run' for remote execution,
2854 and '$from' and '$to'
2855 for remote file transfer.
2856 EOF
2857         ;;
2858 *)      run=''
2859         to=:
2860         from=:
2861         usecrosscompile='undef'
2862         targetarch=''
2863         ;;
2864 esac
2865
2866 : see whether [:lower:] and [:upper:] are supported character classes
2867 echo " "
2868 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2869 ABYZ)
2870         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2871         up='[:upper:]'
2872         low='[:lower:]'
2873         ;;
2874 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2875         # (0xc9 and 0xd1), therefore that is a nice testing point.
2876         if test "X$up" = X -o "X$low" = X; then
2877             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2878             ij) up='[A-Z]'
2879                 low='[a-z]'
2880                 ;;
2881             esac
2882         fi
2883         if test "X$up" = X -o "X$low" = X; then
2884             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2885             ij) up='A-Z'
2886                 low='a-z'
2887                 ;;
2888             esac
2889         fi
2890         if test "X$up" = X -o "X$low" = X; then
2891             case "`echo IJ | od -x 2>/dev/null`" in
2892             *C9D1*|*c9d1*)
2893                 echo "Hey, this might be EBCDIC." >&4
2894                 if test "X$up" = X -o "X$low" = X; then
2895                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2896                     ij) up='[A-IJ-RS-Z]'
2897                         low='[a-ij-rs-z]'
2898                         ;;
2899                     esac
2900                 fi
2901                 if test "X$up" = X -o "X$low" = X; then
2902                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2903                     ij) up='A-IJ-RS-Z'
2904                         low='a-ij-rs-z'
2905                         ;;
2906                     esac
2907                 fi
2908                 ;;
2909             esac
2910         fi
2911 esac
2912 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2913 ij)
2914     echo "Using $up and $low to convert case." >&4
2915     ;;
2916 *)
2917     echo "I don't know how to translate letters from upper to lower case." >&4
2918     echo "Your tr is not acting any way I know of." >&4
2919     exit 1
2920     ;;
2921 esac
2922 : set up the translation script tr, must be called with ./tr of course
2923 cat >tr <<EOSC
2924 $startsh
2925 case "\$1\$2" in
2926 '[A-Z][a-z]') exec $tr '$up' '$low';;
2927 '[a-z][A-Z]') exec $tr '$low' '$up';;
2928 esac
2929 exec $tr "\$@"
2930 EOSC
2931 chmod +x tr
2932 $eunicefix tr
2933
2934 : Try to determine whether config.sh was made on this system
2935 case "$config_sh" in
2936 '')
2937 myuname=`$uname -a 2>/dev/null`
2938 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2939 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2940 # because the A-Z/a-z are not consecutive.
2941 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2942         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2943 newmyuname="$myuname"
2944 dflt=n
2945 case "$knowitall" in
2946 '')
2947         if test -f ../config.sh; then
2948                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2949                         eval "`grep myuname= ../config.sh`"
2950                 fi
2951                 if test "X$myuname" = "X$newmyuname"; then
2952                         dflt=y
2953                 fi
2954         fi
2955         ;;
2956 *) dflt=y;;
2957 esac
2958
2959 : Get old answers from old config file if Configure was run on the
2960 : same system, otherwise use the hints.
2961 hint=default
2962 cd ..
2963 if test -f config.sh; then
2964         echo " "
2965         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2966         . UU/myread
2967         case "$ans" in
2968         n*|N*) echo "OK, I'll ignore it."
2969                 mv config.sh config.sh.old
2970                 myuname="$newmyuname"
2971                 ;;
2972         *)  echo "Fetching default answers from your old config.sh file..." >&4
2973                 tmp_n="$n"
2974                 tmp_c="$c"
2975                 tmp_sh="$sh"
2976                 . ./config.sh
2977                 cp config.sh UU
2978                 n="$tmp_n"
2979                 c="$tmp_c"
2980                 : Older versions did not always set $sh.  Catch re-use of such
2981                 : an old config.sh.
2982                 case "$sh" in
2983                 '') sh="$tmp_sh" ;;
2984                 esac
2985                 hint=previous
2986                 ;;
2987         esac
2988 fi
2989 . ./UU/checkcc
2990 if test ! -f config.sh; then
2991         $cat <<EOM
2992
2993 First time through, eh?  I have some defaults handy for some systems
2994 that need some extra help getting the Configure answers right:
2995
2996 EOM
2997         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2998         dflt=''
2999         : Half the following guesses are probably wrong... If you have better
3000         : tests or hints, please send them to perlbug@perl.org
3001         : The metaconfig authors would also appreciate a copy...
3002         $test -f /irix && osname=irix
3003         $test -f /xenix && osname=sco_xenix
3004         $test -f /dynix && osname=dynix
3005         $test -f /dnix && osname=dnix
3006         $test -f /lynx.os && osname=lynxos
3007         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3008         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3009         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3010         $test -f /bin/mips && /bin/mips && osname=mips
3011         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3012                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3013         $test -d /usr/apollo/bin && osname=apollo
3014         $test -f /etc/saf/_sactab && osname=svr4
3015         $test -d /usr/include/minix && osname=minix
3016         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3017         if $test -d /MachTen -o -d /MachTen_Folder; then
3018                 osname=machten
3019                 if $test -x /sbin/version; then
3020                         osvers=`/sbin/version | $awk '{print $2}' |
3021                         $sed -e 's/[A-Za-z]$//'`
3022                 elif $test -x /usr/etc/version; then
3023                         osvers=`/usr/etc/version | $awk '{print $2}' |
3024                         $sed -e 's/[A-Za-z]$//'`
3025                 else
3026                         osvers="$2.$3"
3027                 fi
3028         fi
3029
3030         $test -f /sys/posix.dll &&
3031                 $test -f /usr/bin/what &&
3032                 set X `/usr/bin/what /sys/posix.dll` &&
3033                 $test "$3" = UWIN &&
3034                 osname=uwin &&
3035                 osvers="$5"
3036
3037         if $test -f $uname; then
3038                 set X $myuname
3039                 shift
3040
3041                 case "$5" in
3042                 fps*) osname=fps ;;
3043                 mips*)
3044                         case "$4" in
3045                         umips) osname=umips ;;
3046                         *) osname=mips ;;
3047                         esac;;
3048                 [23]100) osname=mips ;;
3049                 next*) osname=next ;;
3050                 i386*)
3051                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3052                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3053                                 osname='sco'
3054                                 osvers=$tmp
3055                         elif $test -f /etc/kconfig; then
3056                                 osname=isc
3057                                 if test "$lns" = "$ln -s"; then
3058                                         osvers=4
3059                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3060                                         osvers=3
3061                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3062                                         osvers=2
3063                                 fi
3064                         fi
3065                         tmp=''
3066                         ;;
3067                 pc*)
3068                         if test -n "$DJGPP"; then
3069                                 osname=dos
3070                                 osvers=djgpp
3071                         fi
3072                         ;;
3073                 esac
3074
3075                 case "$1" in
3076                 aix) osname=aix
3077                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3078                         case "$tmp" in
3079                         'not found') osvers="$4"."$3" ;;
3080                         '<3240'|'<>3240') osvers=3.2.0 ;;
3081                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3082                         '=3250'|'>3250') osvers=3.2.5 ;;
3083                         *) osvers=$tmp;;
3084                         esac
3085                         ;;
3086                 bsd386) osname=bsd386
3087                         osvers=`$uname -r`
3088                         ;;
3089                 cygwin*) osname=cygwin
3090                         osvers="$3"
3091                         ;;
3092                 *dc.osx) osname=dcosx
3093                         osvers="$3"
3094                         ;;
3095                 dnix) osname=dnix
3096                         osvers="$3"
3097                         ;;
3098                 domainos) osname=apollo
3099                         osvers="$3"
3100                         ;;
3101                 dgux) osname=dgux 
3102                         osvers="$3"
3103                         ;;
3104                 dynixptx*) osname=dynixptx
3105                         osvers=`echo "$4"|sed 's/^v//'`
3106                         ;;
3107                 freebsd) osname=freebsd 
3108                         osvers="$3" ;;
3109                 genix) osname=genix ;;
3110                 hp*) osname=hpux 
3111                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3112                         ;;
3113                 irix*) osname=irix
3114                         case "$3" in
3115                         4*) osvers=4 ;;
3116                         5*) osvers=5 ;;
3117                         *)      osvers="$3" ;;
3118                         esac
3119                         ;;
3120                 linux) osname=linux
3121                         case "$3" in
3122                         *)      osvers="$3" ;;
3123                         esac
3124                         ;;
3125                 MiNT) osname=mint
3126                         ;;
3127                 netbsd*) osname=netbsd
3128                         osvers="$3"
3129                         ;;
3130                 news-os) osvers="$3"
3131                         case "$3" in
3132                         4*) osname=newsos4 ;;
3133                         *) osname=newsos ;;
3134                         esac
3135                         ;;
3136                 next*) osname=next ;;
3137                 nonstop-ux) osname=nonstopux ;;
3138                 openbsd) osname=openbsd
3139                         osvers="$3"
3140                         ;;
3141                 os2)    osname=os2
3142                         osvers="$4"
3143                         ;;
3144                 POSIX-BC | posix-bc ) osname=posix-bc
3145                         osvers="$3"
3146                         ;;
3147                 powerux | power_ux | powermax_os | powermaxos | \
3148                 powerunix | power_unix) osname=powerux
3149                         osvers="$3"
3150                         ;;
3151                 qnx) osname=qnx
3152                         osvers="$4"
3153                         ;;
3154                 solaris) osname=solaris
3155                         case "$3" in
3156                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3157                         *)      osvers="$3" ;;
3158                         esac
3159                         ;;
3160                 sunos) osname=sunos
3161                         case "$3" in
3162                         5*) osname=solaris
3163                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3164                         *)      osvers="$3" ;;
3165                         esac
3166                         ;;
3167                 titanos) osname=titanos
3168                         case "$3" in
3169                         1*) osvers=1 ;;
3170                         2*) osvers=2 ;;
3171                         3*) osvers=3 ;;
3172                         4*) osvers=4 ;;
3173                         *)      osvers="$3" ;;
3174                         esac
3175                         ;;
3176                 ultrix) osname=ultrix
3177                         osvers="$3"
3178                         ;;
3179                 osf1|mls+)      case "$5" in
3180                                 alpha)
3181                                         osname=dec_osf
3182                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3183                                         case "$osvers" in
3184                                         [1-9].[0-9]*) ;;
3185                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3186                                         esac
3187                                         ;;
3188                         hp*)    osname=hp_osf1  ;;
3189                         mips)   osname=mips_osf1 ;;
3190                         esac
3191                         ;;
3192                 unixware) osname=svr5
3193                         osvers="$4"
3194                         ;;
3195                 uts)    osname=uts
3196                         osvers="$3"
3197                         ;;
3198                 vos) osvers="$3"
3199                         ;;
3200                 $2) case "$osname" in
3201                         *isc*) ;;
3202                         *freebsd*) ;;
3203                         svr*)
3204                                 : svr4.x or possibly later
3205                                 case "svr$3" in 
3206                                 ${osname}*)
3207                                         osname=svr$3
3208                                         osvers=$4
3209                                         ;;
3210                                 esac
3211                                 case "$osname" in
3212                                 svr4.0)
3213                                         : Check for ESIX
3214                                         if test -f /stand/boot ; then
3215                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3216                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3217                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3218                                                         if test -n "$isesix"; then
3219                                                                 osname=esix4
3220                                                         fi
3221                                                 fi
3222                                         fi
3223                                         ;;
3224                                 esac
3225                                 ;;
3226                         *)      if test -f /etc/systemid; then
3227                                         osname=sco
3228                                         set `echo $3 | $sed 's/\./ /g'` $4
3229                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3230                                                 osvers=$1.$2.$3
3231                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3232                                                 osvers=$1.$2
3233                                         elif $test -f $src/hints/sco_$1.sh; then
3234                                                 osvers=$1
3235                                         fi
3236                                 else
3237                                         case "$osname" in
3238                                         '') : Still unknown.  Probably a generic Sys V.
3239                                                 osname="sysv"
3240                                                 osvers="$3"
3241                                                 ;;
3242                                         esac
3243                                 fi
3244                                 ;;
3245                         esac
3246                         ;;
3247                 *)      case "$osname" in
3248                         '') : Still unknown.  Probably a generic BSD.
3249                                 osname="$1"
3250                                 osvers="$3"
3251                                 ;;
3252                         esac
3253                         ;;
3254                 esac
3255         else
3256                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3257                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3258                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3259                                 osname=news_os
3260                         fi
3261                         $rm -f UU/kernel.what
3262                 elif test -d c:/. -o -n "$is_os2" ; then
3263                         set X $myuname
3264                         osname=os2
3265                         osvers="$5"
3266                 fi
3267         fi
3268         
3269         case "$targetarch" in
3270         '') ;;
3271         *)  hostarch=$osname
3272             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3273             osvers=''
3274             ;;
3275         esac
3276
3277         : Now look for a hint file osname_osvers, unless one has been
3278         : specified already.
3279         case "$hintfile" in
3280         ''|' ')
3281                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3282                 : Also try without trailing minor version numbers.
3283                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3284                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3285                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3286                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3287                 case "$file" in
3288                 '') dflt=none ;;
3289                 *)  case "$osvers" in
3290                         '') dflt=$file
3291                                 ;;
3292                         *)  if $test -f $src/hints/$file.sh ; then
3293                                         dflt=$file
3294                                 elif $test -f $src/hints/$xfile.sh ; then
3295                                         dflt=$xfile
3296                                 elif $test -f $src/hints/$xxfile.sh ; then
3297                                         dflt=$xxfile
3298                                 elif $test -f $src/hints/$xxxfile.sh ; then
3299                                         dflt=$xxxfile
3300                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3301                                         dflt=$xxxxfile
3302                                 elif $test -f "$src/hints/${osname}.sh" ; then
3303                                         dflt="${osname}"
3304                                 else
3305                                         dflt=none
3306                                 fi
3307                                 ;;
3308                         esac
3309                         ;;
3310                 esac
3311                 if $test -f Policy.sh ; then
3312                         case "$dflt" in
3313                         *Policy*) ;;
3314                         none) dflt="Policy" ;;
3315                         *) dflt="Policy $dflt" ;;
3316                         esac
3317                 fi
3318                 ;;
3319         *)
3320                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3321                 ;;
3322         esac
3323
3324         if $test -f Policy.sh ; then
3325                 $cat <<EOM
3326
3327 There's also a Policy hint file available, which should make the
3328 site-specific (policy) questions easier to answer.
3329 EOM
3330
3331         fi
3332
3333         $cat <<EOM
3334
3335 You may give one or more space-separated answers, or "none" if appropriate.
3336 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3337 is a good thing.  DO NOT give a wrong version or a wrong OS.
3338
3339 EOM
3340
3341         rp="Which of these apply, if any?"
3342         . UU/myread
3343         tans=$ans
3344         for file in $tans; do
3345                 if $test X$file = XPolicy -a -f Policy.sh; then
3346                         . Policy.sh
3347                         $cat Policy.sh >> UU/config.sh
3348                 elif $test -f $src/hints/$file.sh; then
3349                         . $src/hints/$file.sh
3350                         $cat $src/hints/$file.sh >> UU/config.sh
3351                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3352                         : nothing
3353                 else
3354                         : Give one chance to correct a possible typo.
3355                         echo "$file.sh does not exist"
3356                         dflt=$file
3357                         rp="hint to use instead?"
3358                         . UU/myread
3359                         for file in $ans; do
3360                                 if $test -f "$src/hints/$file.sh"; then
3361                                         . $src/hints/$file.sh
3362                                         $cat $src/hints/$file.sh >> UU/config.sh
3363                                 elif $test X$ans = X -o X$ans = Xnone ; then
3364                                         : nothing
3365                                 else
3366                                         echo "$file.sh does not exist -- ignored."
3367                                 fi
3368                         done
3369                 fi
3370         done
3371
3372         hint=recommended
3373         : Remember our hint file for later.
3374         if $test -f "$src/hints/$file.sh" ; then
3375                 hintfile="$file"
3376         else
3377                 hintfile=''
3378         fi
3379 fi
3380 cd UU
3381 ;;
3382 *)
3383         echo " "
3384         echo "Fetching default answers from $config_sh..." >&4
3385         tmp_n="$n"
3386         tmp_c="$c"
3387         cd ..
3388         cp $config_sh config.sh 2>/dev/null
3389         chmod +w config.sh
3390         . ./config.sh
3391         cd UU
3392         cp ../config.sh .
3393         n="$tmp_n"
3394         c="$tmp_c"
3395         hint=previous
3396         ;;
3397 esac
3398 test "$override" && . ./optdef.sh
3399
3400 : Restore computed paths
3401 for file in $loclist $trylist; do
3402         eval $file="\$_$file"
3403 done
3404
3405 cat << EOM
3406
3407 Configure uses the operating system name and version to set some defaults.
3408 The default value is probably right if the name rings a bell. Otherwise,
3409 since spelling matters for me, either accept the default or answer "none"
3410 to leave it blank.
3411
3412 EOM
3413 case "$osname" in
3414         ''|' ')
3415                 case "$hintfile" in
3416                 ''|' '|none) dflt=none ;;
3417                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3418                 esac
3419                 ;;
3420         *) dflt="$osname" ;;
3421 esac
3422 rp="Operating system name?"
3423 . ./myread
3424 case "$ans" in
3425 none)  osname='' ;;
3426 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3427 esac
3428 echo " "
3429 case "$osvers" in
3430         ''|' ')
3431                 case "$hintfile" in
3432                 ''|' '|none) dflt=none ;;
3433                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3434                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3435                         case "$dflt" in
3436                         ''|' ') dflt=none ;;
3437                         esac
3438                         ;;
3439                 esac
3440                 ;;
3441         *) dflt="$osvers" ;;
3442 esac
3443 rp="Operating system version?"
3444 . ./myread
3445 case "$ans" in
3446 none)  osvers='' ;;
3447 *) osvers="$ans" ;;
3448 esac
3449
3450
3451 . ./posthint.sh
3452
3453 : who configured the system
3454 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3455 cf_by=`(logname) 2>/dev/null`
3456 case "$cf_by" in
3457 "")
3458         cf_by=`(whoami) 2>/dev/null`
3459         case "$cf_by" in
3460         "") cf_by=unknown ;;
3461         esac ;;
3462 esac
3463
3464 : set up the script used to warn in case of inconsistency
3465 cat <<EOS >whoa
3466 $startsh
3467 EOS
3468 cat <<'EOSC' >>whoa
3469 dflt=y
3470 echo " "
3471 echo "*** WHOA THERE!!! ***" >&4
3472 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3473 rp="    Keep the $hint value?"
3474 . ./myread
3475 case "$ans" in
3476 y) td=$was; tu=$was;;
3477 esac
3478 EOSC
3479
3480 : function used to set $1 to $val
3481 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3482 case "$val$was" in
3483 $define$undef) . ./whoa; eval "$var=\$td";;
3484 $undef$define) . ./whoa; eval "$var=\$tu";;
3485 *) eval "$var=$val";;
3486 esac'
3487
3488 case "$usesocks" in
3489 $define|true|[yY]*)     dflt='y';;
3490 *) dflt='n';;
3491 esac
3492 cat <<EOM
3493
3494 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3495 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3496 to use the PerlIO abstraction layer, this will be implicitly selected.
3497
3498 If this doesn't make any sense to you, just accept the default '$dflt'.
3499 EOM
3500 rp='Build Perl for SOCKS?'
3501 . ./myread
3502 case "$ans" in
3503 y|Y)    val="$define" ;;     
3504 *)      val="$undef" ;;
3505 esac
3506 set usesocks
3507 eval $setvar
3508
3509 case "$usesocks" in
3510 $define|true|[yY]*) useperlio="$define";;
3511 esac
3512
3513 case "$useperlio" in
3514 $define|true|[yY]*|'')  dflt='y';;
3515 *) dflt='n';;
3516 esac
3517 cat <<EOM
3518
3519 Previous version of $package used the standard IO mechanisms as
3520 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3521 alternate IO mechanisms via the PerlIO abstraction layer, but the
3522 stdio mechanism is still available if needed.  The abstraction layer
3523 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3524 Using PerlIO with sfio may cause problems with some extension modules.
3525
3526 If this doesn't make any sense to you, just accept the default '$dflt'.
3527 EOM
3528 rp='Use the PerlIO abstraction layer?'
3529 . ./myread
3530 case "$ans" in
3531 y|Y) 
3532         val="$define"
3533         ;;
3534 *)      
3535         echo "Ok, doing things the stdio way."
3536         val="$undef"
3537         ;;
3538 esac
3539 set useperlio
3540 eval $setvar 
3541
3542 case "$usesocks" in
3543 $define|true|[yY]*)
3544         case "$useperlio" in
3545         $define|true|[yY]*) ;;
3546         *)      cat >&4 <<EOM
3547
3548 You are using the SOCKS proxy protocol library which means that you
3549 should also use the PerlIO layer.  You may be headed for trouble.
3550
3551 EOM
3552                 ;;
3553         esac
3554         ;;
3555 esac
3556
3557         
3558 case "$usethreads" in
3559 $define|true|[yY]*)     dflt='y';;
3560 *)     # Catch case where user specified ithreads or 5005threads but
3561        # forgot -Dusethreads (A.D. 4/2002)
3562        case "$useithreads$use5005threads" in
3563        *$define*)      
3564                 case "$useperlio" in
3565                 "$define")      dflt='y' ;;
3566                 *)              dflt='n' ;;
3567                 esac
3568                 ;;
3569        *)       dflt='n';;
3570        esac
3571        ;;
3572 esac
3573 cat <<EOM
3574
3575 Perl can be built to take advantage of threads on some systems.
3576 To do so, Configure can be run with -Dusethreads.
3577
3578 Note that Perl built with threading support runs slightly slower
3579 and uses more memory than plain Perl. The current implementation
3580 is believed to be stable, but it is fairly new, and so should be
3581 treated with caution.
3582
3583 If this doesn't make any sense to you, just accept the default '$dflt'.
3584 EOM
3585 rp='Build a threading Perl?'
3586 . ./myread
3587 case "$ans" in
3588 y|Y)    val="$define" ;;
3589 *)      val="$undef" ;;
3590 esac
3591 set usethreads
3592 eval $setvar
3593
3594 case "$usethreads" in
3595 $define)
3596         $cat <<EOM
3597
3598 Since release 5.6, Perl has had two different threading implementations,
3599 the newer interpreter-based version (ithreads) with one interpreter per
3600 thread, and the older 5.005 version (5005threads).
3601 The 5005threads version is effectively unmaintained and will probably be
3602 removed in Perl 5.10, so there should be no need to build a Perl using it
3603 unless needed for backwards compatibility with some existing 5.005threads
3604 code.
3605
3606 EOM
3607         : Default to ithreads unless overridden on command line or with
3608         : old config.sh
3609         dflt='y'
3610         case "$use5005threads" in
3611                 $define|true|[yY]*) dflt='n';;
3612         esac
3613         case "$useithreads" in
3614                 $undef|false|[nN]*) dflt='n';;
3615         esac
3616         rp='Use the newer interpreter-based ithreads?'
3617         . ./myread
3618         case "$ans" in
3619         y|Y)    val="$define" ;;
3620         *)      val="$undef" ;;
3621         esac
3622         set useithreads
3623         eval $setvar
3624         : Now set use5005threads to the opposite value.
3625         case "$useithreads" in
3626         $define) val="$undef" ;;
3627         *) val="$define" ;;
3628         esac
3629         set use5005threads
3630         eval $setvar
3631         ;;
3632 *)
3633         useithreads="$undef"
3634         use5005threads="$undef"
3635         ;;
3636 esac
3637
3638 case "$useithreads$use5005threads" in
3639 "$define$define")
3640         $cat >&4 <<EOM
3641
3642 You cannot have both the ithreads and the 5.005 threads enabled
3643 at the same time.  Disabling the 5.005 threads since they are
3644 much less stable than the ithreads.
3645
3646 EOM
3647         use5005threads="$undef"
3648         ;;
3649 esac
3650
3651 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3652         cat >&4 <<EOF
3653 ***
3654 *** To build with ithreads you must also use the PerlIO layer.
3655 *** Cannot continue, aborting.
3656 ***
3657 EOF
3658         exit 1
3659 fi
3660
3661 case "$d_oldpthreads" in
3662 '')     : Configure tests would be welcome here.  For now, assume undef.
3663         val="$undef" ;;
3664 *)      val="$d_oldpthreads" ;;
3665 esac
3666 set d_oldpthreads
3667 eval $setvar
3668
3669
3670 case "$usethreads" in
3671 "$define"|true|[yY]*)
3672 : Look for a hint-file generated 'call-back-unit'.  If the
3673 : user has specified that a threading perl is to be built,
3674 : we may need to set or change some other defaults.
3675         if $test -f usethreads.cbu; then
3676                 echo "Your platform has some specific hints for threaded builds, using them..."
3677                 . ./usethreads.cbu
3678         else
3679                 $cat <<EOM
3680 (Your platform doesn't have any specific hints for threaded builds.
3681  Assuming POSIX threads, then.)
3682 EOM
3683         fi
3684         ;;
3685 esac
3686
3687 cat <<EOM
3688
3689 Perl can be built so that multiple Perl interpreters can coexist
3690 within the same Perl executable.
3691 EOM
3692
3693 case "$useithreads" in
3694 $define)
3695         cat <<EOM
3696 This multiple interpreter support is required for interpreter-based threads.
3697 EOM
3698         val="$define"
3699         ;;
3700 *)      case "$usemultiplicity" in
3701         $define|true|[yY]*)     dflt='y';;
3702         *) dflt='n';;
3703         esac
3704         echo " "
3705         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3706         rp='Build Perl for multiplicity?'
3707         . ./myread
3708         case "$ans" in
3709         y|Y)    val="$define" ;;
3710         *)      val="$undef" ;;
3711         esac
3712         ;;
3713 esac
3714 set usemultiplicity
3715 eval $setvar
3716
3717
3718 case "$usemorebits" in
3719 "$define"|true|[yY]*)
3720         use64bitint="$define"
3721         uselongdouble="$define"
3722         usemorebits="$define"
3723         ;;
3724 *)      usemorebits="$undef"
3725         ;;
3726 esac
3727
3728 : make some quick guesses about what we are up against
3729 echo " "
3730 $echo $n "Hmm...  $c"
3731 echo exit 1 >bsd
3732 echo exit 1 >usg
3733 echo exit 1 >v7
3734 echo exit 1 >osf1
3735 echo exit 1 >eunice
3736 echo exit 1 >xenix
3737 echo exit 1 >venix
3738 echo exit 1 >os2
3739 d_bsd="$undef"
3740 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3741 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3742 then
3743         echo "Looks kind of like an OSF/1 system, but we'll see..."
3744         echo exit 0 >osf1
3745 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3746         xxx=`./loc addbib blurfl $pth`
3747         if $test -f $xxx; then
3748         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3749                 echo exit 0 >bsd
3750                 echo exit 0 >usg
3751         else
3752                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3753                         echo "Looks kind of like an extended USG system, but we'll see..."
3754                 else
3755                         echo "Looks kind of like a USG system, but we'll see..."
3756                 fi
3757                 echo exit 0 >usg
3758         fi
3759 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3760         echo "Looks kind of like a BSD system, but we'll see..."
3761         d_bsd="$define"
3762         echo exit 0 >bsd
3763 else
3764         echo "Looks kind of like a Version 7 system, but we'll see..."
3765         echo exit 0 >v7
3766 fi
3767 case "$eunicefix" in
3768 *unixtovms*)
3769         $cat <<'EOI'
3770 There is, however, a strange, musty smell in the air that reminds me of
3771 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3772 EOI
3773         echo exit 0 >eunice
3774         d_eunice="$define"
3775 : it so happens the Eunice I know will not run shell scripts in Unix format
3776         ;;
3777 *)
3778         echo " "
3779         echo "Congratulations.  You aren't running Eunice."
3780         d_eunice="$undef"
3781         ;;
3782 esac
3783 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3784 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3785 : semicolon as a patch separator
3786 case "$p_" in
3787 :) ;;
3788 *)
3789         $cat <<'EOI'
3790 I have the feeling something is not exactly right, however...don't tell me...
3791 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3792 (Or you may be running DOS with DJGPP.)
3793 EOI
3794         echo exit 0 >os2
3795         ;;
3796 esac
3797 if test -f /xenix; then
3798         echo "Actually, this looks more like a XENIX system..."
3799         echo exit 0 >xenix
3800         d_xenix="$define"
3801 else
3802         echo " "
3803         echo "It's not Xenix..."
3804         d_xenix="$undef"
3805 fi
3806 chmod +x xenix
3807 $eunicefix xenix
3808 if test -f /venix; then
3809         echo "Actually, this looks more like a VENIX system..."
3810         echo exit 0 >venix
3811 else
3812         echo " "
3813         if ./xenix; then
3814                 : null
3815         else
3816                 echo "Nor is it Venix..."
3817         fi
3818 fi
3819 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3820 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3821 $rm -f foo
3822
3823 case "$cc" in
3824 '') dflt=cc;;
3825 *) dflt="$cc";;
3826 esac
3827 rp="Use which C compiler?"
3828 . ./myread
3829 cc="$ans"
3830
3831 : See if they have not cc but they do have gcc
3832 . ./trygcc
3833 : Look for a hint-file generated 'call-back-unit'.  Now that the
3834 : user has specified the compiler, we may need to set or change some
3835 : other defaults.
3836 if $test -f cc.cbu; then
3837     . ./cc.cbu
3838 fi
3839 . ./checkcc
3840
3841 echo " "
3842 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3843 $cat >try.c <<EOM
3844 #include <stdio.h>
3845 int main() {
3846 #ifdef __GNUC__
3847 #ifdef __VERSION__
3848         printf("%s\n", __VERSION__);
3849 #else
3850         printf("%s\n", "1");
3851 #endif
3852 #endif
3853         return(0);
3854 }
3855 EOM
3856 if $cc -o try $ccflags $ldflags try.c; then
3857         gccversion=`$run ./try`
3858         case "$gccversion" in
3859         '') echo "You are not using GNU cc." ;;
3860         *)  echo "You are using GNU cc $gccversion."
3861             ccname=gcc
3862             ;;
3863         esac
3864 else
3865         echo " "
3866         echo "*** WHOA THERE!!! ***" >&4
3867         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3868         case "$knowitall" in
3869         '')
3870         echo "    You'd better start hunting for one and let me know about it." >&4
3871                 exit 1
3872                 ;;
3873         esac
3874 fi
3875 $rm -f try try.*
3876 case "$gccversion" in
3877 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3878 esac
3879 case "$gccversion" in
3880 '') gccosandvers='' ;;
3881 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3882    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3883    gccshortvers=''
3884    case "$gccosandvers" in
3885    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3886    $osname$osvers) ;; # looking good
3887    $osname*) cat <<EOM >&4
3888
3889 *** WHOA THERE!!! ***
3890
3891     Your gcc has not been compiled for the exact release of
3892     your operating system ($gccosandvers versus $osname$osvers).
3893
3894     In general it is a good idea to keep gcc synchronized with
3895     the operating system because otherwise serious problems
3896     may ensue when trying to compile software, like Perl.
3897
3898     I'm trying to be optimistic here, though, and will continue.
3899     If later during the configuration and build icky compilation
3900     problems appear (headerfile conflicts being the most common
3901     manifestation), I suggest reinstalling the gcc to match
3902     your operating system release.
3903
3904 EOM
3905       ;;
3906    *) gccosandvers='' ;; # failed to parse, better be silent
3907    esac
3908    ;;
3909 esac
3910 case "$ccname" in
3911 '') ccname="$cc" ;;
3912 esac
3913
3914 # gcc 3.* complain about adding -Idirectories that they already know about,
3915 # so we will take those off from locincpth.
3916 case "$gccversion" in
3917 3*)
3918     echo "main(){}">try.c
3919     for incdir in $locincpth; do
3920        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3921              grep '^c[cp]p*[01]: warning: changing search order '`
3922        if test "X$warn" != X; then
3923            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3924        fi
3925     done
3926     $rm -f try try.*
3927 esac
3928
3929 : decide how portable to be.  Allow command line overrides.
3930 case "$d_portable" in
3931 "$undef") ;;
3932 *)      d_portable="$define" ;;
3933 esac
3934
3935 : set up shell script to do ~ expansion
3936 cat >filexp <<EOSS
3937 $startsh
3938 : expand filename
3939 case "\$1" in
3940  ~/*|~)
3941         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3942         ;;
3943  ~*)
3944         if $test -f /bin/csh; then
3945                 /bin/csh -f -c "glob \$1"
3946                 failed=\$?
3947                 echo ""
3948                 exit \$failed
3949         else
3950                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3951                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3952                 if $test ! -d "\$dir"; then
3953                         me=\`basename \$0\`
3954                         echo "\$me: can't locate home directory for: \$name" >&2
3955                         exit 1
3956                 fi
3957                 case "\$1" in
3958                 */*)
3959                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3960                         ;;
3961                 *)
3962                         echo \$dir
3963                         ;;
3964                 esac
3965         fi
3966         ;;
3967 *)
3968         echo \$1
3969         ;;
3970 esac
3971 EOSS
3972 chmod +x filexp
3973 $eunicefix filexp
3974
3975 : now set up to get a file name
3976 cat <<EOS >getfile
3977 $startsh
3978 EOS
3979 cat <<'EOSC' >>getfile
3980 tilde=''
3981 fullpath=''
3982 already=''
3983 skip=''
3984 none_ok=''
3985 exp_file=''
3986 nopath_ok=''
3987 orig_rp="$rp"
3988 orig_dflt="$dflt"
3989 case "$gfpth" in
3990 '') gfpth='.' ;;
3991 esac
3992
3993 case "$fn" in
3994 *\(*)
3995         : getfile will accept an answer from the comma-separated list
3996         : enclosed in parentheses even if it does not meet other criteria.
3997         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3998         fn=`echo $fn | sed 's/(.*)//'`
3999         ;;
4000 esac
4001
4002 case "$fn" in
4003 *:*)
4004         loc_file=`expr $fn : '.*:\(.*\)'`
4005         fn=`expr $fn : '\(.*\):.*'`
4006         ;;
4007 esac
4008
4009 case "$fn" in
4010 *~*) tilde=true;;
4011 esac
4012 case "$fn" in
4013 */*) fullpath=true;;
4014 esac
4015 case "$fn" in
4016 *+*) skip=true;;
4017 esac
4018 case "$fn" in
4019 *n*) none_ok=true;;
4020 esac
4021 case "$fn" in
4022 *e*) exp_file=true;;
4023 esac
4024 case "$fn" in
4025 *p*) nopath_ok=true;;
4026 esac
4027
4028 case "$fn" in
4029 *f*) type='File';;
4030 *d*) type='Directory';;
4031 *l*) type='Locate';;
4032 esac
4033
4034 what="$type"
4035 case "$what" in
4036 Locate) what='File';;
4037 esac
4038
4039 case "$exp_file" in
4040 '')
4041         case "$d_portable" in
4042         "$define") ;;
4043         *) exp_file=true;;
4044         esac
4045         ;;
4046 esac
4047
4048 cd ..
4049 while test "$type"; do
4050         redo=''
4051         rp="$orig_rp"
4052         dflt="$orig_dflt"
4053         case "$tilde" in
4054         true) rp="$rp (~name ok)";;
4055         esac
4056         . UU/myread
4057         if test -f UU/getfile.ok && \
4058                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4059         then
4060                 value="$ans"
4061                 ansexp="$ans"
4062                 break
4063         fi
4064         case "$ans" in
4065         none)
4066                 value=''
4067                 ansexp=''
4068                 case "$none_ok" in
4069                 true) type='';;
4070                 esac
4071                 ;;
4072         *)
4073                 case "$tilde" in
4074                 '') value="$ans"
4075                         ansexp="$ans";;
4076                 *)
4077                         value=`UU/filexp $ans`
4078                         case $? in
4079                         0)
4080                                 if test "$ans" != "$value"; then
4081                                         echo "(That expands to $value on this system.)"
4082                                 fi
4083                                 ;;
4084                         *) value="$ans";;
4085                         esac
4086                         ansexp="$value"
4087                         case "$exp_file" in
4088                         '') value="$ans";;
4089                         esac
4090                         ;;
4091                 esac
4092                 case "$fullpath" in
4093                 true)
4094                         case "$ansexp" in
4095                         /*) value="$ansexp" ;;
4096                         [a-zA-Z]:/*) value="$ansexp" ;;
4097                         *)
4098                                 redo=true
4099                                 case "$already" in
4100                                 true)
4101                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4102                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4103                                         ;;
4104                                 *)
4105                                 echo "Please give a full path name, starting with slash." >&4
4106                                         case "$tilde" in
4107                                         true)
4108                                 echo "Note that using ~name is ok provided it expands well." >&4
4109                                                 already=true
4110                                                 ;;
4111                                         esac
4112                                 esac
4113                                 ;;
4114                         esac
4115                         ;;
4116                 esac
4117                 case "$redo" in
4118                 '')
4119                         case "$type" in
4120                         File)
4121                                 for fp in $gfpth; do
4122                                         if test "X$fp" = X.; then
4123                                             pf="$ansexp"
4124                                         else    
4125                                             pf="$fp/$ansexp"
4126                                         fi
4127                                         if test -f "$pf"; then
4128                                                 type=''
4129                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4130                                         then
4131                                                 echo "($value is not a plain file, but that's ok.)"
4132                                                 type=''
4133                                         fi
4134                                         if test X"$type" = X; then
4135                                             value="$pf"
4136                                             break
4137                                         fi
4138                                 done
4139                                 ;;
4140                         Directory)
4141                                 for fp in $gfpth; do
4142                                         if test "X$fp" = X.; then
4143                                             dir="$ans"
4144                                             direxp="$ansexp"
4145                                         else    
4146                                             dir="$fp/$ansexp"
4147                                             direxp="$fp/$ansexp"
4148                                         fi
4149                                         if test -d "$direxp"; then
4150                                                 type=''
4151                                                 value="$dir"
4152                                                 break
4153                                         fi
4154                                 done
4155                                 ;;
4156                         Locate)
4157                                 if test -d "$ansexp"; then
4158                                         echo "(Looking for $loc_file in directory $value.)"
4159                                         value="$value/$loc_file"
4160                                         ansexp="$ansexp/$loc_file"
4161                                 fi
4162                                 if test -f "$ansexp"; then
4163                                         type=''
4164                                 fi
4165                                 case "$nopath_ok" in
4166                                 true)   case "$value" in
4167                                         */*) ;;
4168                                         *)      echo "Assuming $value will be in people's path."
4169                                                 type=''
4170                                                 ;;
4171                                         esac
4172                                         ;;
4173                                 esac
4174                                 ;;
4175                         esac
4176
4177                         case "$skip" in
4178                         true) type='';
4179                         esac
4180
4181                         case "$type" in
4182                         '') ;;
4183                         *)
4184                                 if test "$fastread" = yes; then
4185                                         dflt=y
4186                                 else
4187                                         dflt=n
4188                                 fi
4189                                 rp="$what $value doesn't exist.  Use that name anyway?"
4190                                 . UU/myread
4191                                 dflt=''
4192                                 case "$ans" in
4193                                 y*) type='';;
4194                                 *) echo " ";;
4195                                 esac
4196                                 ;;
4197                         esac
4198                         ;;
4199                 esac
4200                 ;;
4201         esac
4202 done
4203 cd UU
4204 ans="$value"
4205 rp="$orig_rp"
4206 dflt="$orig_dflt"
4207 rm -f getfile.ok
4208 test "X$gfpthkeep" != Xy && gfpth=""
4209 EOSC
4210
4211 : What should the include directory be ?
4212 echo " "
4213 $echo $n "Hmm...  $c"
4214 dflt='/usr/include'
4215 incpath=''
4216 mips_type=''
4217 if $test -f /bin/mips && /bin/mips; then
4218         echo "Looks like a MIPS system..."
4219         $cat >usr.c <<'EOCP'
4220 #ifdef SYSTYPE_BSD43
4221 /bsd43
4222 #endif
4223 EOCP
4224         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4225                 dflt='/bsd43/usr/include'
4226                 incpath='/bsd43'
4227                 mips_type='BSD 4.3'
4228         else
4229                 mips_type='System V'
4230         fi
4231         $rm -f usr.c usr.out
4232         echo "and you're compiling with the $mips_type compiler and libraries."
4233         xxx_prompt=y
4234         echo "exit 0" >mips
4235 else
4236         echo "Doesn't look like a MIPS system."
4237         xxx_prompt=n
4238         echo "exit 1" >mips
4239 fi
4240 chmod +x mips
4241 $eunicefix mips
4242 case "$usrinc" in
4243 '') ;;
4244 *) dflt="$usrinc";;
4245 esac
4246 case "$xxx_prompt" in
4247 y)      fn=d/
4248         echo " "
4249         rp='Where are the include files you want to use?'
4250         . ./getfile
4251         usrinc="$ans"
4252         ;;
4253 *)      usrinc="$dflt"
4254         ;;
4255 esac
4256
4257 : see how we invoke the C preprocessor
4258 echo " "
4259 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4260 cat <<'EOT' >testcpp.c
4261 #define ABC abc
4262 #define XYZ xyz
4263 ABC.XYZ
4264 EOT
4265 cd ..
4266 if test ! -f cppstdin; then
4267         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4268                 # AIX cc -E doesn't show the absolute headerfile
4269                 # locations but we'll cheat by using the -M flag.
4270                 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
4271         else
4272                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4273         fi
4274 else
4275         echo "Keeping your $hint cppstdin wrapper."
4276 fi
4277 chmod 755 cppstdin
4278 wrapper=`pwd`/cppstdin
4279 ok='false'
4280 cd UU
4281
4282 if $test "X$cppstdin" != "X" && \
4283         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4284         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4285 then
4286         echo "You used to use $cppstdin $cppminus so we'll use that again."
4287         case "$cpprun" in
4288         '') echo "But let's see if we can live without a wrapper..." ;;
4289         *)
4290                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4291                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4292                 then
4293                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4294                         ok='true'
4295                 else
4296                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4297                 fi
4298                 ;;
4299         esac
4300 else
4301         case "$cppstdin" in
4302         '') ;;
4303         *)
4304                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4305                 ;;
4306         esac
4307 fi
4308
4309 if $ok; then
4310         : nothing
4311 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4312         $cc -E <testcpp.c >testcpp.out 2>&1; \
4313         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4314         echo "Yup, it does."
4315         x_cpp="$cc -E"
4316         x_minus='';
4317 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4318         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4319         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4320         echo "Yup, it does."
4321         x_cpp="$cc -E"
4322         x_minus='-';
4323 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4324         $cc -P <testcpp.c >testcpp.out 2>&1; \
4325         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4326         echo "Yipee, that works!"
4327         x_cpp="$cc -P"
4328         x_minus='';
4329 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4330         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4331         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4332         echo "At long last!"
4333         x_cpp="$cc -P"
4334         x_minus='-';
4335 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4336         $cpp <testcpp.c >testcpp.out 2>&1; \
4337         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4338         echo "It works!"
4339         x_cpp="$cpp"
4340         x_minus='';
4341 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4342         $cpp - <testcpp.c >testcpp.out 2>&1; \
4343         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4344         echo "Hooray, it works!  I was beginning to wonder."
4345         x_cpp="$cpp"
4346         x_minus='-';
4347 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4348         $wrapper <testcpp.c >testcpp.out 2>&1; \
4349         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350         x_cpp="$wrapper"
4351         x_minus=''
4352         echo "Eureka!"
4353 else
4354         dflt=''
4355         rp="No dice.  I can't find a C preprocessor.  Name one:"
4356         . ./myread
4357         x_cpp="$ans"
4358         x_minus=''
4359         $x_cpp <testcpp.c >testcpp.out 2>&1
4360         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4361                 echo "OK, that will do." >&4
4362         else
4363 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4364                 exit 1
4365         fi
4366 fi
4367
4368 case "$ok" in
4369 false)
4370         cppstdin="$x_cpp"
4371         cppminus="$x_minus"
4372         cpprun="$x_cpp"
4373         cpplast="$x_minus"
4374         set X $x_cpp
4375         shift
4376         case "$1" in
4377         "$cpp")
4378                 echo "Perhaps can we force $cc -E using a wrapper..."
4379                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4380                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4381                 then
4382                         echo "Yup, we can."
4383                         cppstdin="$wrapper"
4384                         cppminus='';
4385                 else
4386                         echo "Nope, we'll have to live without it..."
4387                 fi
4388                 ;;
4389         esac
4390         case "$cpprun" in
4391         "$wrapper")
4392                 cpprun=''
4393                 cpplast=''
4394                 ;;
4395         esac
4396         ;;
4397 esac
4398
4399 case "$cppstdin" in
4400 "$wrapper"|'cppstdin') ;;
4401 *) $rm -f $wrapper;;
4402 esac
4403 $rm -f testcpp.c testcpp.out
4404
4405 : Set private lib path
4406 case "$plibpth" in
4407 '') if ./mips; then
4408                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4409         fi;;
4410 esac
4411 case "$libpth" in
4412 ' ') dlist='';;
4413 '') dlist="$loclibpth $plibpth $glibpth";;
4414 *) dlist="$libpth";;
4415 esac
4416
4417 : Now check and see which directories actually exist, avoiding duplicates
4418 libpth=''
4419 for xxx in $dlist
4420 do
4421     if $test -d $xxx; then
4422                 case " $libpth " in
4423                 *" $xxx "*) ;;
4424                 *) libpth="$libpth $xxx";;
4425                 esac
4426     fi
4427 done
4428 $cat <<'EOM'
4429
4430 Some systems have incompatible or broken versions of libraries.  Among
4431 the directories listed in the question below, please remove any you
4432 know not to be holding relevant libraries, and add any that are needed.
4433 Say "none" for none.
4434
4435 EOM
4436 case "$libpth" in
4437 '') dflt='none';;
4438 *)
4439         set X $libpth
4440         shift
4441         dflt=${1+"$@"}
4442         ;;
4443 esac
4444 rp="Directories to use for library searches?"
4445 . ./myread
4446 case "$ans" in
4447 none) libpth=' ';;
4448 *) libpth="$ans";;
4449 esac
4450
4451 : compute shared library extension
4452 case "$so" in
4453 '')
4454         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4455                 dflt='sl'
4456         else
4457                 dflt='so'
4458         fi
4459         ;;
4460 *) dflt="$so";;
4461 esac
4462 $cat <<EOM
4463
4464 On some systems, shared libraries may be available.  Answer 'none' if
4465 you want to suppress searching of shared libraries for the remainder
4466 of this configuration.
4467
4468 EOM
4469 rp='What is the file extension used for shared libraries?'
4470 . ./myread
4471 so="$ans"
4472
4473 : Define several unixisms.
4474 : Hints files or command line option can be used to override them.
4475 : The convoluted testing is in case hints files set either the old
4476 : or the new name.
4477 case "$_exe" in
4478 '')     case "$exe_ext" in
4479         '')     ;;
4480         *)      _exe="$exe_ext" ;;
4481         esac
4482         ;;
4483 esac
4484 case "$_a" in
4485 '')     case "$lib_ext" in
4486     '') _a='.a';;
4487         *)      _a="$lib_ext" ;;
4488         esac
4489         ;;
4490 esac
4491 case "$_o" in
4492 '') case "$obj_ext" in
4493         '')     _o='.o';;
4494         *)      _o="$obj_ext";;
4495         esac
4496         ;;
4497 esac
4498 case "$p_" in
4499 '') case "$path_sep" in
4500         '')     p_=':';;
4501         *)      p_="$path_sep";;
4502         esac
4503         ;;
4504 esac
4505 exe_ext=$_exe
4506 lib_ext=$_a
4507 obj_ext=$_o
4508 path_sep=$p_
4509
4510 : Which makefile gets called first.  This is used by make depend.
4511 case "$firstmakefile" in
4512 '') firstmakefile='makefile';;
4513 esac
4514
4515 : Looking for optional libraries
4516 echo " "
4517 echo "Checking for optional libraries..." >&4
4518 case "$libs" in
4519 ' '|'') dflt='';;
4520 *) dflt="$libs";;
4521 esac
4522 case "$libswanted" in
4523 '') libswanted='c_s';;
4524 esac
4525 case "$usesocks" in
4526 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4527 esac
4528 libsfound=''
4529 libsfiles=''
4530 libsdirs=''
4531 libspath=''
4532 for thisdir in $libpth $xlibpth; do
4533   test -d $thisdir && libspath="$libspath $thisdir"
4534 done
4535 for thislib in $libswanted; do
4536         for thisdir in $libspath; do
4537             xxx=''
4538             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4539                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4540                 $test -f "$xxx" && eval $libscheck
4541                 $test -f "$xxx" && libstyle=shared
4542             fi
4543             if test ! -f "$xxx"; then
4544                 xxx=$thisdir/lib$thislib.$so
4545                 $test -f "$xxx" && eval $libscheck
4546                 $test -f "$xxx" && libstyle=shared
4547             fi  
4548             if test ! -f "$xxx"; then
4549                 xxx=$thisdir/lib$thislib$_a
4550                 $test -f "$xxx" && eval $libscheck
4551                 $test -f "$xxx" && libstyle=static
4552             fi
4553             if test ! -f "$xxx"; then
4554                 xxx=$thisdir/$thislib$_a
4555                 $test -f "$xxx" && eval $libscheck
4556                 $test -f "$xxx" && libstyle=static
4557             fi
4558             if test ! -f "$xxx"; then
4559                 xxx=$thisdir/lib${thislib}_s$_a
4560                 $test -f "$xxx" && eval $libscheck
4561                 $test -f "$xxx" && libstyle=static
4562                 $test -f "$xxx" && thislib=${thislib}_s
4563             fi
4564             if test ! -f "$xxx"; then
4565                 xxx=$thisdir/Slib$thislib$_a
4566                 $test -f "$xxx" && eval $libscheck
4567                 $test -f "$xxx" && libstyle=static
4568             fi
4569             if $test -f "$xxx"; then
4570                 case "$libstyle" in
4571                 shared) echo "Found -l$thislib (shared)." ;;
4572                 static) echo "Found -l$thislib." ;;
4573                 *)      echo "Found -l$thislib ($libstyle)." ;;
4574                 esac
4575                 case " $dflt " in
4576                 *"-l$thislib "*);;
4577                 *) dflt="$dflt -l$thislib"
4578                    libsfound="$libsfound $xxx"
4579                    yyy=`basename $xxx`
4580                    libsfiles="$libsfiles $yyy"
4581                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4582                    case " $libsdirs " in
4583                    *" $yyy "*) ;;
4584                    *) libsdirs="$libsdirs $yyy" ;;
4585                    esac
4586                    ;;
4587                 esac
4588                 break
4589             fi  
4590         done
4591         if $test ! -f "$xxx"; then
4592             echo "No -l$thislib."
4593         fi
4594 done
4595 set X $dflt
4596 shift
4597 dflt="$*"
4598 case "$libs" in
4599 '') dflt="$dflt";;
4600 *) dflt="$libs";;
4601 esac
4602 case "$dflt" in
4603 ' '|'') dflt='none';;
4604 esac
4605
4606 $cat <<EOM
4607
4608 In order to compile $package on your machine, a number of libraries
4609 are usually needed.  Include any other special libraries here as well.
4610 Say "none" for none.  The default list is almost always right.
4611 EOM
4612
4613 echo " "
4614 rp="What libraries to use?"
4615 . ./myread
4616 case "$ans" in
4617 none) libs=' ';;
4618 *) libs="$ans";;
4619 esac
4620
4621 : determine optimization, if desired, or use for debug flag also
4622 case "$optimize" in
4623 ' '|$undef) dflt='none';;
4624 '') dflt='-O';;
4625 *) dflt="$optimize";;
4626 esac
4627 $cat <<EOH
4628
4629 By default, $package compiles with the -O flag to use the optimizer.
4630 Alternately, you might want to use the symbolic debugger, which uses
4631 the -g flag (on traditional Unix systems).  Either flag can be
4632 specified here.  To use neither flag, specify the word "none".
4633
4634 EOH
4635 rp="What optimizer/debugger flag should be used?"
4636 . ./myread
4637 optimize="$ans"
4638 case "$optimize" in
4639 'none') optimize=" ";;
4640 esac
4641
4642 dflt=''
4643 : We will not override a previous value, but we might want to
4644 : augment a hint file
4645 case "$hint" in
4646 default|recommended)
4647         case "$gccversion" in
4648         1*) dflt='-fpcc-struct-return' ;;
4649         esac
4650         case "$optimize" in
4651         *-g*) dflt="$dflt -DDEBUGGING";;
4652         esac
4653         case "$gccversion" in
4654         2*) if test -d /etc/conf/kconfig.d &&
4655                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4656                 then
4657                         dflt="$dflt -posix"
4658                 fi
4659                 ;;
4660         esac
4661         case "$gccversion" in
4662         1*) ;;
4663         2.[0-8]*) ;;
4664         ?*)     echo " "
4665                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4666                 echo 'int main(void) { return 0; }' > gcctest.c
4667                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4668                         echo "Yes, it does." 2>&1
4669                         case "$ccflags" in
4670                         *strict-aliasing*) 
4671                                 echo "Leaving current flags $ccflags alone." 2>&1
4672                                 ;;
4673                         *) dflt="$dflt -fno-strict-aliasing" ;;
4674                         esac
4675                 else
4676                         echo "Nope, it doesn't, but that's ok." 2>&1
4677                 fi
4678                 ;;
4679         esac
4680         ;;
4681 esac
4682
4683 case "$mips_type" in
4684 *BSD*|'') inclwanted="$locincpth $usrinc";;
4685 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4686 esac
4687 for thisincl in $inclwanted; do
4688         if $test -d $thisincl; then
4689                 if $test x$thisincl != x$usrinc; then
4690                         case "$dflt" in
4691                         *" -I$thisincl "*);;
4692                         *) dflt="$dflt -I$thisincl ";;
4693                         esac
4694                 fi
4695         fi
4696 done
4697
4698 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4699         xxx=true;
4700 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4701         xxx=true;
4702 else
4703         xxx=false;
4704 fi;
4705 if $xxx; then
4706         case "$dflt" in
4707         *$2*);;
4708         *) dflt="$dflt -D$2";;
4709         esac;
4710 fi'
4711
4712 set signal.h LANGUAGE_C; eval $inctest
4713
4714 case "$usesocks" in
4715 $define)
4716         ccflags="$ccflags -DSOCKS"
4717         ;;
4718 esac
4719
4720 case "$hint" in
4721 default|recommended) dflt="$ccflags $dflt" ;;
4722 *) dflt="$ccflags";;
4723 esac
4724
4725 case "$dflt" in
4726 ''|' ') dflt=none;;
4727 esac
4728
4729 $cat <<EOH
4730
4731 Your C compiler may want other flags.  For this question you should include
4732 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4733 but you should NOT include libraries or ld flags like -lwhatever.  If you
4734 want $package to honor its debug switch, you should include -DDEBUGGING here.
4735 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4736
4737 To use no flags, specify the word "none".
4738
4739 EOH
4740 set X $dflt
4741 shift
4742 dflt=${1+"$@"}
4743 rp="Any additional cc flags?"
4744 . ./myread
4745 case "$ans" in
4746 none) ccflags='';;
4747 *) ccflags="$ans";;
4748 esac
4749
4750 : the following weeds options from ccflags that are of no interest to cpp
4751 case "$cppflags" in
4752 '') cppflags="$ccflags" ;;
4753 *)  cppflags="$cppflags $ccflags" ;;
4754 esac
4755 case "$gccversion" in
4756 1*) cppflags="$cppflags -D__GNUC__"
4757 esac
4758 case "$mips_type" in
4759 '');;
4760 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4761 esac
4762 case "$cppflags" in
4763 '');;
4764 *)
4765         echo " "
4766         echo "Let me guess what the preprocessor flags are..." >&4
4767         set X $cppflags
4768         shift
4769         cppflags=''
4770         $cat >cpp.c <<'EOM'
4771 #define BLURFL foo
4772
4773 BLURFL xx LFRULB
4774 EOM
4775         previous=''
4776         for flag in $*
4777         do
4778                 case "$flag" in
4779                 -*) ftry="$flag";;
4780                 *) ftry="$previous $flag";;
4781                 esac
4782                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4783                         >cpp1.out 2>/dev/null && \
4784                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4785                         >cpp2.out 2>/dev/null && \
4786                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4787                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4788                 then
4789                         cppflags="$cppflags $ftry"
4790                         previous=''
4791                 else
4792                         previous="$flag"
4793                 fi
4794         done
4795         set X $cppflags
4796         shift
4797         cppflags=${1+"$@"}
4798         case "$cppflags" in
4799         *-*)  echo "They appear to be: $cppflags";;
4800         esac
4801         $rm -f cpp.c cpp?.out
4802         ;;
4803 esac
4804
4805 : flags used in final linking phase
4806 case "$ldflags" in
4807 '') if ./venix; then
4808                 dflt='-i -z'
4809         else
4810                 dflt=''
4811         fi
4812         case "$ccflags" in
4813         *-posix*) dflt="$dflt -posix" ;;
4814         esac
4815         ;;
4816 *) dflt="$ldflags";;
4817 esac
4818
4819 : Try to guess additional flags to pick up local libraries.
4820 for thislibdir in $libpth; do
4821         case " $loclibpth " in
4822         *" $thislibdir "*)
4823                 case "$dflt " in 
4824                 *"-L$thislibdir "*) ;;
4825                 *)  dflt="$dflt -L$thislibdir" ;;
4826                 esac
4827                 ;;
4828         esac
4829 done
4830
4831 case "$dflt" in
4832 '') dflt='none' ;;
4833 esac
4834
4835 $cat <<EOH
4836
4837 Your C linker may need flags.  For this question you should
4838 include -L/whatever and any other flags used by the C linker, but you
4839 should NOT include libraries like -lwhatever.
4840
4841 Make sure you include the appropriate -L/path flags if your C linker
4842 does not normally search all of the directories you specified above,
4843 namely
4844         $libpth
4845 To use no flags, specify the word "none".
4846
4847 EOH
4848
4849 rp="Any additional ld flags (NOT including libraries)?"
4850 . ./myread
4851 case "$ans" in
4852 none) ldflags='';;
4853 *) ldflags="$ans";;
4854 esac
4855 rmlist="$rmlist pdp11"
4856
4857 : coherency check
4858 echo " "
4859 echo "Checking your choice of C compiler and flags for coherency..." >&4
4860 $cat > try.c <<'EOF'
4861 #include <stdio.h>
4862 int main() { printf("Ok\n"); exit(0); }
4863 EOF
4864 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4865 shift
4866 $cat >try.msg <<'EOM'
4867 I've tried to compile and run the following simple program:
4868
4869 EOM
4870 $cat try.c >> try.msg
4871
4872 $cat >> try.msg <<EOM
4873
4874 I used the command:
4875
4876         $*
4877         $run ./try
4878
4879 and I got the following output:
4880
4881 EOM
4882 dflt=y
4883 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4884         if $sh -c "$run ./try" >>try.msg 2>&1; then
4885                 xxx=`$run ./try`
4886                 case "$xxx" in
4887                 "Ok") dflt=n ;;
4888                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4889                         case " $libs " in
4890                         *" -lsfio "*)
4891                                 cat >> try.msg <<'EOQS'
4892 If $libs contains -lsfio, and sfio is mis-configured, then it
4893 sometimes (apparently) runs and exits with a 0 status, but with no
4894 output!  It may have to do with sfio's use of _exit vs. exit.
4895
4896 EOQS
4897                                 rp="You have a big problem.  Shall I abort Configure"
4898                                 dflt=y
4899                                 ;;
4900                         esac
4901                         ;;
4902                 esac
4903         else
4904                 echo "The program compiled OK, but exited with status $?." >>try.msg
4905                 rp="You have a problem.  Shall I abort Configure"
4906                 dflt=y
4907         fi
4908 else
4909         echo "I can't compile the test program." >>try.msg
4910         rp="You have a BIG problem.  Shall I abort Configure"
4911         dflt=y
4912 fi
4913 case "$dflt" in
4914 y)
4915         $cat try.msg >&4
4916         case "$knowitall" in
4917         '')
4918                 echo "(The supplied flags or libraries might be incorrect.)"
4919                 ;;
4920         *) dflt=n;;
4921         esac
4922         echo " "
4923         . ./myread
4924         case "$ans" in
4925         n*|N*) ;;
4926         *)      echo "Ok.  Stopping Configure." >&4
4927                 exit 1
4928                 ;;
4929         esac
4930         ;;
4931 n) echo "OK, that should do.";;
4932 esac
4933 $rm -f try try.* core
4934
4935 : define a shorthand compile call
4936 compile='
4937 mc_file=$1;
4938 shift;
4939 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4940 : define a shorthand compile call for compilations that should be ok.
4941 compile_ok='
4942 mc_file=$1;
4943 shift;
4944 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4945
4946 : determine filename position in cpp output
4947 echo " "
4948 echo "Computing filename position in cpp output for #include directives..." >&4
4949 case "$osname" in
4950 vos) testaccess=-e ;;
4951 *)   testaccess=-r ;;
4952 esac
4953 echo '#include <stdio.h>' > foo.c
4954 $cat >fieldn <<EOF
4955 $startsh
4956 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4957 $grep '^[       ]*#.*stdio\.h' | \
4958 while read cline; do
4959         pos=1
4960         set \$cline
4961         while $test \$# -gt 0; do
4962                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4963                         echo "\$pos"
4964                         exit 0
4965                 fi
4966                 shift
4967                 pos=\`expr \$pos + 1\`
4968         done
4969 done
4970 EOF
4971 chmod +x fieldn
4972 fieldn=`./fieldn`
4973 $rm -f foo.c fieldn
4974 case $fieldn in
4975 '') pos='???';;
4976 1) pos=first;;
4977 2) pos=second;;
4978 3) pos=third;;
4979 *) pos="${fieldn}th";;
4980 esac
4981 echo "Your cpp writes the filename in the $pos field of the line."
4982
4983 case "$osname" in
4984 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4985 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4986 *)   cppfilter='' ;;
4987 esac
4988 : locate header file
4989 $cat >findhdr <<EOF
4990 $startsh
4991 wanted=\$1
4992 name=''
4993 for usrincdir in $usrinc
4994 do
4995         if test -f \$usrincdir/\$wanted; then
4996                 echo "\$usrincdir/\$wanted"
4997                 exit 0
4998         fi
4999 done
5000 awkprg='{ print \$$fieldn }'
5001 echo "#include <\$wanted>" > foo\$\$.c
5002 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5003 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5004 while read cline; do
5005         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5006         case "\$name" in
5007         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5008         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5009         *) exit 2;;
5010         esac;
5011 done;
5012 #
5013 # status = 0: grep returned 0 lines, case statement not executed
5014 # status = 1: headerfile found
5015 # status = 2: while loop executed, no headerfile found
5016 #
5017 status=\$?
5018 $rm -f foo\$\$.c;
5019 if test \$status -eq 1; then
5020         exit 0;
5021 fi
5022 exit 1
5023 EOF
5024 chmod +x findhdr
5025
5026 : define an alternate in-header-list? function
5027 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5028 cont=true; xxf="echo \"<\$1> found.\" >&4";
5029 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5030 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5031 esac;
5032 case $# in 4) instead=instead;; *) instead="at last";; esac;
5033 while $test "$cont"; do
5034         xxx=`./findhdr $1`
5035         var=$2; eval "was=\$$2";
5036         if $test "$xxx" && $test -r "$xxx";
5037         then eval $xxf;
5038         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5039                 cont="";
5040         else eval $xxnf;
5041         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5042         set $yyy; shift; shift; yyy=$@;
5043         case $# in 0) cont="";;
5044         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5045                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5046         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5047                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5048         esac;
5049 done;
5050 while $test "$yyy";
5051 do set $yyy; var=$2; eval "was=\$$2";
5052         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5053         set $yyy; shift; shift; yyy=$@;
5054 done'
5055
5056 : see if stdlib is available
5057 set stdlib.h i_stdlib
5058 eval $inhdr
5059
5060 : check for lengths of integral types
5061 echo " "
5062 case "$intsize" in
5063 '')
5064         echo "Checking to see how big your integers are..." >&4
5065         $cat >try.c <<EOCP
5066 #include <stdio.h>
5067 #$i_stdlib I_STDLIB
5068 #ifdef I_STDLIB
5069 #include <stdlib.h>
5070 #endif
5071 int main()
5072 {
5073         printf("intsize=%d;\n", (int)sizeof(int));
5074         printf("longsize=%d;\n", (int)sizeof(long));
5075         printf("shortsize=%d;\n", (int)sizeof(short));
5076         exit(0);
5077 }
5078 EOCP
5079         set try
5080         if eval $compile_ok && $run ./try > /dev/null; then
5081                 eval `$run ./try`
5082                 echo "Your integers are $intsize bytes long."
5083                 echo "Your long integers are $longsize bytes long."
5084                 echo "Your short integers are $shortsize bytes long."
5085         else
5086                 $cat >&4 <<EOM
5087 !
5088 Help! I can't compile and run the intsize test program: please enlighten me!
5089 (This is probably a misconfiguration in your system or libraries, and
5090 you really ought to fix it.  Still, I'll try anyway.)
5091 !
5092 EOM
5093                 dflt=4
5094                 rp="What is the size of an integer (in bytes)?"
5095                 . ./myread
5096                 intsize="$ans"
5097                 dflt=$intsize
5098                 rp="What is the size of a long integer (in bytes)?"
5099                 . ./myread
5100                 longsize="$ans"
5101                 dflt=2
5102                 rp="What is the size of a short integer (in bytes)?"
5103                 . ./myread
5104                 shortsize="$ans"
5105         fi
5106         ;;
5107 esac
5108 $rm -f try try.*
5109
5110 : check for long long
5111 echo " "
5112 echo "Checking to see if you have long long..." >&4
5113 echo 'int main() { long long x = 7; return 0; }' > try.c
5114 set try
5115 if eval $compile; then
5116         val="$define"
5117         echo "You have long long."
5118 else
5119         val="$undef"
5120         echo "You do not have long long."
5121 fi
5122 $rm try.*
5123 set d_longlong
5124 eval $setvar
5125
5126 : check for length of long long
5127 case "${d_longlong}${longlongsize}" in
5128 $define)
5129         echo " "
5130         echo "Checking to see how big your long longs are..." >&4
5131         $cat >try.c <<'EOCP'
5132 #include <stdio.h>
5133 int main()
5134 {
5135     printf("%d\n", (int)sizeof(long long));
5136     return(0);
5137 }
5138 EOCP
5139         set try
5140         if eval $compile_ok; then
5141                 longlongsize=`$run ./try`
5142                 echo "Your long longs are $longlongsize bytes long."
5143         else
5144                 dflt='8'
5145                 echo " "
5146                 echo "(I can't seem to compile the test program.  Guessing...)"
5147                 rp="What is the size of a long long (in bytes)?"
5148                 . ./myread
5149                 longlongsize="$ans"
5150         fi
5151         if $test "X$longsize" = "X$longlongsize"; then
5152                 echo "(That isn't any different from an ordinary long.)"
5153         fi      
5154         ;;
5155 esac
5156 $rm -f try.* try
5157
5158 : see if inttypes.h is available
5159 : we want a real compile instead of Inhdr because some systems
5160 : have an inttypes.h which includes non-existent headers
5161 echo " "
5162 $cat >try.c <<EOCP
5163 #include <inttypes.h>
5164 int main() {
5165         static int32_t foo32 = 0x12345678;
5166 }
5167 EOCP
5168 set try
5169 if eval $compile; then
5170         echo "<inttypes.h> found." >&4
5171         val="$define"
5172 else
5173         echo "<inttypes.h> NOT found." >&4
5174         val="$undef"
5175 fi
5176 $rm -f try.c try
5177 set i_inttypes
5178 eval $setvar
5179
5180 : check for int64_t
5181 echo " "
5182 echo "Checking to see if you have int64_t..." >&4
5183 $cat >try.c <<EOCP
5184 #include <sys/types.h>
5185 #$i_inttypes I_INTTYPES
5186 #ifdef I_INTTYPES
5187 #include <inttypes.h>
5188 #endif
5189 int main() { int64_t x = 7; }
5190 EOCP
5191 set try
5192 if eval $compile; then
5193         val="$define"
5194         echo "You have int64_t."
5195 else
5196         val="$undef"
5197         echo "You do not have int64_t."
5198 fi
5199 $rm -f try try.*
5200 set d_int64_t
5201 eval $setvar
5202
5203
5204 echo " "
5205 echo "Checking which 64-bit integer type we could use..." >&4
5206
5207 case "$intsize" in
5208 8) val=int
5209    set quadtype
5210    eval $setvar
5211    val='"unsigned int"'
5212    set uquadtype
5213    eval $setvar
5214    quadkind=1
5215    ;;
5216 *) case "$longsize" in
5217    8) val=long
5218       set quadtype
5219       eval $setvar
5220       val='"unsigned long"'
5221       set uquadtype
5222       eval $setvar
5223       quadkind=2
5224       ;;
5225    *) case "$d_longlong:$longlongsize" in
5226       define:8)
5227         val='"long long"'
5228         set quadtype
5229         eval $setvar
5230         val='"unsigned long long"'
5231         set uquadtype
5232         eval $setvar
5233         quadkind=3
5234         ;;
5235       *) case "$d_int64_t" in
5236          define)
5237            val=int64_t
5238            set quadtype
5239            eval $setvar
5240            val=uint64_t
5241            set uquadtype
5242            eval $setvar
5243            quadkind=4
5244            ;;
5245          esac
5246          ;;
5247       esac
5248       ;;
5249    esac
5250    ;;
5251 esac
5252
5253 case "$quadtype" in
5254 '')     echo "Alas, no 64-bit integer types in sight." >&4
5255         d_quad="$undef"
5256         ;;
5257 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5258         d_quad="$define"
5259         ;;
5260 esac
5261
5262
5263 case "$uselonglong" in
5264 "$define"|true|[yY]*)
5265         cat <<EOM >&4
5266
5267 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5268 EOM
5269         use64bitint="$define"
5270         ;;
5271 esac                          
5272 case "$use64bits" in
5273 "$define"|true|[yY]*)
5274         cat <<EOM >&4
5275
5276 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5277 EOM
5278         use64bitint="$define"
5279         ;;
5280 esac                          
5281 case "$use64bitints" in
5282 "$define"|true|[yY]*)
5283         cat <<EOM >&4
5284
5285 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5286 EOM
5287         use64bitint="$define"
5288         ;;
5289 esac                          
5290 case "$use64bitsint" in
5291 "$define"|true|[yY]*)
5292         cat <<EOM >&4
5293
5294 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5295 EOM
5296         use64bitint="$define"
5297         ;;
5298 esac                          
5299 case "$uselonglongs" in
5300 "$define"|true|[yY]*)
5301         cat <<EOM >&4
5302
5303 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5304 EOM
5305         use64bitint="$define"
5306         ;;
5307 esac                          
5308 case "$use64bitsall" in
5309 "$define"|true|[yY]*)
5310         cat <<EOM >&4
5311
5312 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5313 EOM
5314         use64bitall="$define"
5315         ;;
5316 esac                          
5317
5318 case "$ccflags" in
5319 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5320 esac
5321 case "$use64bitall" in
5322 "$define"|true|[yY]*) use64bitint="$define" ;;
5323 esac
5324
5325 case "$longsize" in
5326 8) cat <<EOM
5327
5328 You have natively 64-bit long integers.
5329 EOM
5330    val="$define"
5331    ;;
5332 *) case "$use64bitint" in
5333    "$define"|true|[yY]*) dflt='y';;
5334    *) dflt='n';;
5335    esac
5336    case "$d_quad" in
5337    "$define") ;;
5338    *) dflt='n' ;;
5339    esac
5340    cat <<EOM
5341
5342 Perl can be built to take advantage of 64-bit integer types
5343 on some systems.  To do so, Configure can be run with -Duse64bitint.
5344 Choosing this option will most probably introduce binary incompatibilities.
5345
5346 If this doesn't make any sense to you, just accept the default '$dflt'.
5347 (The default has been chosen based on your configuration.)
5348 EOM
5349    rp='Try to use 64-bit integers, if available?'
5350    . ./myread
5351    case "$ans" in
5352    [yY]*) val="$define" ;;
5353    *)     val="$undef"  ;;
5354    esac
5355    ;;
5356 esac
5357 set use64bitint
5358 eval $setvar
5359
5360 case "$use64bitall" in
5361 "$define"|true|[yY]*) dflt='y' ;;
5362 *) case "$longsize" in
5363    8) dflt='y' ;;
5364    *) dflt='n' ;;
5365    esac
5366    ;;
5367 esac    
5368 cat <<EOM
5369
5370 You may also choose to try maximal 64-bitness.  It means using as much
5371 64-bitness as possible on the platform.  This in turn means even more
5372 binary incompatibilities.  On the other hand, your platform may not
5373 have any more 64-bitness available than what you already have chosen.
5374
5375 If this doesn't make any sense to you, just accept the default '$dflt'.
5376 (The default has been chosen based on your configuration.)
5377 EOM
5378 rp='Try to use maximal 64-bit support, if available?'
5379 . ./myread
5380 case "$ans" in
5381 [yY]*) val="$define" ;;
5382 *)     val="$undef"  ;;
5383 esac
5384 set use64bitall
5385 eval $setvar
5386 case "$use64bitall" in
5387 "$define")
5388         case "$use64bitint" in
5389         "$undef")
5390                 cat <<EOM
5391
5392 Since you have chosen a maximally 64-bit build, I'm also turning on
5393 the use of 64-bit integers.
5394 EOM
5395                 use64bitint="$define" ;;
5396         esac
5397         ;;
5398 esac
5399
5400 case "$use64bitint" in
5401 "$define"|true|[yY]*)
5402 : Look for a hint-file generated 'call-back-unit'.  If the
5403 : user has specified that a 64-bit perl is to be built,
5404 : we may need to set or change some other defaults.
5405         if $test -f use64bitint.cbu; then
5406                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5407                 . ./use64bitint.cbu
5408         fi
5409         case "$longsize" in
5410         4) case "$archname64" in
5411            '') archname64=64int ;;
5412            esac
5413            ;;
5414         esac
5415         ;;
5416 esac
5417
5418 case "$use64bitall" in
5419 "$define"|true|[yY]*)
5420 : Look for a hint-file generated 'call-back-unit'.  If the
5421 : user has specified that a maximally 64-bit perl is to be built,
5422 : we may need to set or change some other defaults.
5423         if $test -f use64bitall.cbu; then
5424                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5425                 . ./use64bitall.cbu
5426         fi
5427         case "$longsize" in
5428         4) case "$archname64" in
5429            ''|64int) archname64=64all ;;
5430            esac
5431            ;;
5432         esac
5433         ;;
5434 esac
5435
5436 echo " "
5437 echo "Checking for GNU C Library..." >&4
5438 cat >try.c <<'EOCP'
5439 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5440    alone are insufficient to distinguish different versions, such as
5441    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5442    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5443 */
5444 #include <stdio.h>
5445 int main(void)
5446 {
5447 #ifdef __GLIBC__
5448 #   ifdef __GLIBC_MINOR__
5449 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5450 #           include <gnu/libc-version.h>
5451             printf("%s\n",  gnu_get_libc_version());
5452 #       else
5453             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5454 #       endif
5455 #   else
5456         printf("%d\n",  __GLIBC__);
5457 #   endif
5458     return 0;
5459 #else
5460     return 1;
5461 #endif
5462 }
5463 EOCP
5464 set try
5465 if eval $compile_ok && $run ./try > glibc.ver; then
5466         val="$define"
5467         gnulibc_version=`$cat glibc.ver`
5468         echo "You are using the GNU C Library version $gnulibc_version"
5469 else
5470         val="$undef"
5471         gnulibc_version=''
5472         echo "You are not using the GNU C Library"
5473 fi
5474 $rm -f try try.* glibc.ver
5475 set d_gnulibc
5476 eval $setvar
5477
5478 : see if nm is to be used to determine whether a symbol is defined or not
5479 case "$usenm" in
5480 '')
5481         dflt=''
5482         case "$d_gnulibc" in
5483         "$define")
5484                 echo " "
5485                 echo "nm probably won't work on the GNU C Library." >&4
5486                 dflt=n
5487                 ;;
5488         esac
5489         case "$dflt" in
5490         '') 
5491                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5492                         echo " "
5493                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5494                         echo "'nm' won't be sufficient on this sytem." >&4
5495                         dflt=n
5496                 fi
5497                 ;;
5498         esac
5499         case "$dflt" in
5500         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5501                 if $test $dflt -gt 20; then
5502                         dflt=y
5503                 else
5504                         dflt=n
5505                 fi
5506                 ;;
5507         esac
5508         ;;
5509 *)
5510         case "$usenm" in
5511         true|$define) dflt=y;;
5512         *) dflt=n;;
5513         esac
5514         ;;
5515 esac
5516 $cat <<EOM
5517
5518 I can use $nm to extract the symbols from your C libraries. This
5519 is a time consuming task which may generate huge output on the disk (up
5520 to 3 megabytes) but that should make the symbols extraction faster. The
5521 alternative is to skip the 'nm' extraction part and to compile a small
5522 test program instead to determine whether each symbol is present. If
5523 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5524 this may be the best solution.
5525
5526 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5527
5528 EOM
5529 rp="Shall I use $nm to extract C symbols from the libraries?"
5530 . ./myread
5531 case "$ans" in
5532 [Nn]*) usenm=false;;
5533 *) usenm=true;;
5534 esac
5535
5536 runnm=$usenm
5537 case "$reuseval" in
5538 true) runnm=false;;
5539 esac
5540
5541 : nm options which may be necessary
5542 case "$nm_opt" in
5543 '') if $test -f /mach_boot; then
5544                 nm_opt=''       # Mach
5545         elif $test -d /usr/ccs/lib; then
5546                 nm_opt='-p'     # Solaris (and SunOS?)
5547         elif $test -f /dgux; then
5548                 nm_opt='-p'     # DG-UX
5549         elif $test -f /lib64/rld; then
5550                 nm_opt='-p'     # 64-bit Irix
5551         else
5552                 nm_opt=''
5553         fi;;
5554 esac
5555
5556 : nm options which may be necessary for shared libraries but illegal
5557 : for archive libraries.  Thank you, Linux.
5558 case "$nm_so_opt" in
5559 '')     case "$myuname" in
5560         *linux*)
5561                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5562                         nm_so_opt='--dynamic'
5563                 fi
5564                 ;;
5565         esac
5566         ;;
5567 esac
5568
5569 case "$runnm" in
5570 true)
5571 : get list of predefined functions in a handy place
5572 echo " "
5573 case "$libc" in
5574 '') libc=unknown
5575         case "$libs" in
5576         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5577         esac
5578         ;;
5579 esac
5580 case "$libs" in
5581 '') ;;
5582 *)  for thislib in $libs; do
5583         case "$thislib" in
5584         -lc|-lc_s)
5585                 : Handle C library specially below.
5586                 ;;
5587         -l*)
5588                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5589                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5590                         :
5591                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5592                         :
5593                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5594                         :
5595                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5596                         :
5597                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5598                         :
5599                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5600                         :
5601                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5602                         :
5603                 else
5604                         try=''
5605                 fi
5606                 libnames="$libnames $try"
5607                 ;;
5608         *) libnames="$libnames $thislib" ;;
5609         esac
5610         done
5611         ;;
5612 esac
5613 xxx=normal
5614 case "$libc" in
5615 unknown)
5616         set /lib/libc.$so
5617         for xxx in $libpth; do
5618                 $test -r $1 || set $xxx/libc.$so
5619                 : The messy sed command sorts on library version numbers.
5620                 $test -r $1 || \
5621                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5622                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5623                                 h
5624                                 s/[0-9][0-9]*/0000&/g
5625                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5626                                 G
5627                                 s/\n/ /' | \
5628                          $sort | $sed -e 's/^.* //'`
5629                 eval set \$$#
5630         done
5631         $test -r $1 || set /usr/ccs/lib/libc.$so
5632         $test -r $1 || set /lib/libsys_s$_a
5633         ;;
5634 *)
5635         set blurfl
5636         ;;
5637 esac
5638 if $test -r "$1"; then
5639         echo "Your (shared) C library seems to be in $1."
5640         libc="$1"
5641 elif $test -r /lib/libc && $test -r /lib/clib; then
5642         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5643         xxx=apollo
5644         libc='/lib/clib /lib/libc'
5645         if $test -r /lib/syslib; then
5646                 echo "(Your math library is in /lib/syslib.)"
5647                 libc="$libc /lib/syslib"
5648         fi
5649 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5650         echo "Your C library seems to be in $libc, as you said before."
5651 elif $test -r $incpath/usr/lib/libc$_a; then
5652         libc=$incpath/usr/lib/libc$_a;
5653         echo "Your C library seems to be in $libc.  That's fine."
5654 elif $test -r /lib/libc$_a; then
5655         libc=/lib/libc$_a;
5656         echo "Your C library seems to be in $libc.  You're normal."
5657 else
5658         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5659                 :
5660         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5661                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5662         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5663                 :
5664         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5665                 :
5666         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5667                 :
5668         else
5669                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5670         fi
5671         if $test -r "$tans"; then
5672                 echo "Your C library seems to be in $tans, of all places."
5673                 libc=$tans
5674         else
5675                 libc='blurfl'
5676         fi
5677 fi
5678 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5679         dflt="$libc"
5680         cat <<EOM
5681
5682 If the guess above is wrong (which it might be if you're using a strange
5683 compiler, or your machine supports multiple models), you can override it here.
5684
5685 EOM
5686 else
5687         dflt=''
5688         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5689         cat >&4 <<EOM
5690 I can't seem to find your C library.  I've looked in the following places:
5691
5692 EOM
5693         $sed 's/^/      /' libpath
5694         cat <<EOM
5695
5696 None of these seems to contain your C library. I need to get its name...
5697
5698 EOM
5699 fi
5700 fn=f
5701 rp='Where is your C library?'
5702 . ./getfile
5703 libc="$ans"
5704
5705 echo " "
5706 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5707 set X `cat libnames`
5708 shift
5709 xxx=files
5710 case $# in 1) xxx=file; esac
5711 echo "Extracting names from the following $xxx for later perusal:" >&4
5712 echo " "
5713 $sed 's/^/      /' libnames >&4
5714 echo " "
5715 $echo $n "This may take a while...$c" >&4
5716
5717 for file in $*; do
5718         case $file in
5719         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5720         *) $nm $nm_opt $file 2>/dev/null;;
5721         esac
5722 done >libc.tmp
5723
5724 $echo $n ".$c"
5725 $grep fprintf libc.tmp > libc.ptf
5726 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5727 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5728 xxx='[ADTSIW]'
5729 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5730         eval $xscan;\
5731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732                 eval $xrun
5733 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5734         eval $xscan;\
5735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736                 eval $xrun
5737 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5738         eval $xscan;\
5739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740                 eval $xrun
5741 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5750         eval $xscan;\
5751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752                 eval $xrun
5753 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5754                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5755         eval $xscan;\
5756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757                 eval $xrun
5758 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5759         eval $xscan;\
5760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761                 eval $xrun
5762 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5763         eval $xscan;\
5764         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5765                 eval $xrun
5766 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5767         eval $xscan;\
5768         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5769                 eval $xrun
5770 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5771         eval $xscan;\
5772         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5773                 eval $xrun
5774 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5775         eval $xscan;\
5776         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5777                 eval $xrun
5778 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5779         eval $xscan;\
5780         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5781                 eval $xrun
5782 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5783         eval $xscan;\
5784         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5785                 eval $xrun
5786 else
5787         $nm -p $* 2>/dev/null >libc.tmp
5788         $grep fprintf libc.tmp > libc.ptf
5789         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5790                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5791         then
5792                 nm_opt='-p'
5793                 eval $xrun
5794         else
5795                 echo " "
5796                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5797                 com=''
5798                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5799                         for thisname in $libnames $libc; do
5800                                 $ar t $thisname >>libc.tmp
5801                         done
5802                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5803                         echo "Ok." >&4
5804                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5805                         # Repeat libc to extract forwarders to DLL entries too
5806                         for thisname in $libnames $libc; do
5807                                 $ar tv $thisname >>libc.tmp
5808                                 # Revision 50 of EMX has bug in $ar.
5809                                 # it will not extract forwarders to DLL entries
5810                                 # Use emximp which will extract exactly them.
5811                                 emximp -o tmp.imp $thisname \
5812                                     2>/dev/null && \
5813                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5814                                     < tmp.imp >>libc.tmp
5815                                 $rm tmp.imp
5816                         done
5817                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5818                         echo "Ok." >&4
5819                 else
5820                         echo "$ar didn't seem to work right." >&4
5821                         echo "Maybe this is a Cray...trying bld instead..." >&4
5822                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5823                         then
5824                                 for thisname in $libnames; do
5825                                         bld t $libnames | \
5826                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5827                                         $ar t $thisname >>libc.tmp
5828                                 done
5829                                 echo "Ok." >&4
5830                         else
5831                                 echo "That didn't work either.  Giving up." >&4
5832                                 exit 1
5833                         fi
5834                 fi
5835         fi
5836 fi
5837 nm_extract="$com"
5838 case "$PASE" in
5839 define)
5840     echo " "
5841     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5842     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5843     ;;
5844 *)  if $test -f /lib/syscalls.exp; then
5845         echo " "
5846         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5847         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5848     fi
5849     ;;
5850 esac
5851 ;;
5852 esac
5853 $rm -f libnames libpath
5854
5855 : is a C symbol defined?
5856 csym='tlook=$1;
5857 case "$3" in
5858 -v) tf=libc.tmp; tc=""; tdc="";;
5859 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5860 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5861 esac;
5862 tx=yes;
5863 case "$reuseval-$4" in
5864 true-) ;;
5865 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5866 esac;
5867 case "$tx" in
5868 yes)
5869         case "$runnm" in
5870         true)
5871                 if $contains $tlook $tf >/dev/null 2>&1;
5872                 then tval=true;
5873                 else tval=false;
5874                 fi;;
5875         *)
5876                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5877                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5878                 then tval=true;
5879                 else tval=false;
5880                 fi;
5881                 $rm -f t t.c;;
5882         esac;;
5883 *)
5884         case "$tval" in
5885         $define) tval=true;;
5886         *) tval=false;;
5887         esac;;
5888 esac;
5889 eval "$2=$tval"'
5890
5891 : define an is-in-libc? function
5892 inlibc='echo " "; td=$define; tu=$undef;
5893 sym=$1; var=$2; eval "was=\$$2";
5894 tx=yes;
5895 case "$reuseval$was" in
5896 true) ;;
5897 true*) tx=no;;
5898 esac;
5899 case "$tx" in
5900 yes)
5901         set $sym tres -f;
5902         eval $csym;
5903         case "$tres" in
5904         true)
5905                 echo "$sym() found." >&4;
5906                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5907         *)
5908                 echo "$sym() NOT found." >&4;
5909                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5910         esac;;
5911 *)
5912         case "$was" in
5913         $define) echo "$sym() found." >&4;;
5914         *) echo "$sym() NOT found." >&4;;
5915         esac;;
5916 esac'
5917
5918 : see if sqrtl exists
5919 set sqrtl d_sqrtl
5920 eval $inlibc
5921
5922 hasproto='varname=$1; func=$2; shift; shift;
5923 while $test $# -ge 2; do
5924         case "$1" in
5925         $define) echo "#include <$2>";;
5926         esac ;
5927     shift 2;
5928 done > try.c;
5929 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5930 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5931         echo "$func() prototype found.";
5932         val="$define";
5933 else
5934         echo "$func() prototype NOT found.";
5935         val="$undef";
5936 fi;
5937 set $varname;
5938 eval $setvar;
5939 $rm -f try.c tryout.c'
5940
5941 : check for length of double
5942 echo " "
5943 case "$doublesize" in
5944 '')
5945         echo "Checking to see how big your double precision numbers are..." >&4
5946         $cat >try.c <<EOCP
5947 #include <stdio.h>
5948 #$i_stdlib I_STDLIB
5949 #ifdef I_STDLIB
5950 #include <stdlib.h>
5951 #endif
5952 int main()
5953 {
5954     printf("%d\n", (int)sizeof(double));
5955     exit(0);
5956 }
5957 EOCP
5958         set try
5959         if eval $compile_ok; then
5960                 doublesize=`$run ./try`
5961                 echo "Your double is $doublesize bytes long."
5962         else
5963                 dflt='8'
5964                 echo "(I can't seem to compile the test program.  Guessing...)"
5965                 rp="What is the size of a double precision number (in bytes)?"
5966                 . ./myread
5967                 doublesize="$ans"
5968         fi
5969         ;;
5970 esac
5971 $rm -f try.c try
5972
5973 : check for long doubles
5974 echo " "
5975 echo "Checking to see if you have long double..." >&4
5976 echo 'int main() { long double x = 7.0; }' > try.c
5977 set try
5978 if eval $compile; then
5979         val="$define"
5980         echo "You have long double."
5981 else
5982         val="$undef"
5983         echo "You do not have long double."
5984 fi
5985 $rm try.*
5986 set d_longdbl
5987 eval $setvar
5988
5989 : check for length of long double
5990 case "${d_longdbl}${longdblsize}" in
5991 $define)
5992         echo " "
5993         echo "Checking to see how big your long doubles are..." >&4
5994         $cat >try.c <<'EOCP'
5995 #include <stdio.h>
5996 int main()
5997 {
5998         printf("%d\n", sizeof(long double));
5999 }
6000 EOCP
6001         set try
6002         set try
6003         if eval $compile; then
6004                 longdblsize=`$run ./try`
6005                 echo "Your long doubles are $longdblsize bytes long."
6006         else
6007                 dflt='8'
6008                 echo " "
6009                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6010                 rp="What is the size of a long double (in bytes)?"
6011                 . ./myread
6012                 longdblsize="$ans"
6013         fi
6014         if $test "X$doublesize" = "X$longdblsize"; then
6015                 echo "(That isn't any different from an ordinary double.)"
6016         fi      
6017         ;;
6018 esac
6019 $rm -f try.* try
6020
6021 echo " "
6022
6023 if $test X"$d_longdbl" = X"$define"; then
6024
6025 echo "Checking how to print long doubles..." >&4
6026
6027 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6028         $cat >try.c <<'EOCP'
6029 #include <sys/types.h>
6030 #include <stdio.h>
6031 int main() {
6032   double d = 123.456;
6033   printf("%.3f\n", d);
6034 }
6035 EOCP
6036         set try
6037         if eval $compile; then
6038                 yyy=`$run ./try`
6039                 case "$yyy" in
6040                 123.456)
6041                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6042                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
6043                         echo "We will use %f."
6044                         ;;
6045                 esac
6046         fi
6047 fi
6048
6049 if $test X"$sPRIfldbl" = X; then
6050         $cat >try.c <<'EOCP'
6051 #include <sys/types.h>
6052 #include <stdio.h>
6053 int main() {
6054   long double d = 123.456;
6055   printf("%.3Lf\n", d);
6056 }
6057 EOCP
6058         set try
6059         if eval $compile; then
6060                 yyy=`$run ./try`
6061                 case "$yyy" in
6062                 123.456)
6063                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6064                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6065                         echo "We will use %Lf."
6066                         ;;
6067                 esac
6068         fi
6069 fi
6070
6071 if $test X"$sPRIfldbl" = X; then
6072         $cat >try.c <<'EOCP'
6073 #include <sys/types.h>
6074 #include <stdio.h>
6075 int main() {
6076   long double d = 123.456;
6077   printf("%.3llf\n", d);
6078 }
6079 EOCP
6080         set try
6081         if eval $compile; then
6082                 yyy=`$run ./try`
6083                 case "$yyy" in
6084                 123.456)
6085                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6086                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6087                         echo "We will use %llf."
6088                         ;;
6089                 esac
6090         fi
6091 fi
6092
6093 if $test X"$sPRIfldbl" = X; then
6094         $cat >try.c <<'EOCP'
6095 #include <sys/types.h>
6096 #include <stdio.h>
6097 int main() {
6098   long double d = 123.456;
6099   printf("%.3lf\n", d);
6100 }
6101 EOCP
6102         set try
6103         if eval $compile; then
6104                 yyy=`$run ./try`
6105                 case "$yyy" in
6106                 123.456)
6107                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6108                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6109                         echo "We will use %lf."
6110                         ;;
6111                 esac
6112         fi
6113 fi
6114
6115 if $test X"$sPRIfldbl" = X; then
6116         echo "Cannot figure out how to print long doubles." >&4
6117 else
6118         sSCNfldbl=$sPRIfldbl    # expect consistency
6119 fi
6120
6121 $rm -f try try.*
6122
6123 fi # d_longdbl
6124
6125 case "$sPRIfldbl" in
6126 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6127         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6128         d_SCNfldbl="$undef";
6129         ;;
6130 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6131         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6132         d_SCNfldbl="$define";
6133         ;;
6134 esac
6135
6136 : see if modfl exists
6137 set modfl d_modfl
6138 eval $inlibc
6139
6140 : see if prototype for modfl is available
6141 echo " "
6142 set d_modflproto modfl math.h
6143 eval $hasproto
6144
6145 d_modfl_pow32_bug="$undef"
6146
6147 case "$d_longdbl$d_modfl" in
6148 $define$define)
6149         $cat <<EOM
6150 Checking to see whether your modfl() is okay for large values...
6151 EOM
6152 $cat >try.c <<EOCP
6153 #include <math.h> 
6154 #include <stdio.h>
6155 EOCP
6156 if $test "X$d_modflproto" != "X$define"; then
6157         $cat >>try.c <<EOCP
6158 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6159 long double modfl (long double, long double *);
6160 EOCP
6161 fi
6162 $cat >>try.c <<EOCP
6163 int main() {
6164     long double nv = 4294967303.15;
6165     long double v, w;
6166     v = modfl(nv, &w);         
6167 #ifdef __GLIBC__
6168     printf("glibc");
6169 #endif
6170     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6171     return 0;
6172 }
6173 EOCP
6174         case "$osname:$gccversion" in
6175         aix:)   saveccflags="$ccflags"
6176                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6177         esac
6178         set try
6179         if eval $compile; then
6180                 foo=`$run ./try`
6181                 case "$foo" in
6182                 *" 4294967303.150000 1.150000 4294967302.000000")
6183                         echo >&4 "Your modfl() is broken for large values."
6184                         d_modfl_pow32_bug="$define"
6185                         case "$foo" in
6186                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6187                         ;;
6188                         esac
6189                         ;;
6190                 *" 4294967303.150000 0.150000 4294967303.000000")
6191                         echo >&4 "Your modfl() seems okay for large values."
6192                         ;;
6193                 *)      echo >&4 "I don't understand your modfl() at all."
6194                         d_modfl="$undef"
6195                         ;;
6196                 esac
6197                 $rm -f try.* try core core.try.*
6198         else
6199                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6200                 d_modfl="$undef"
6201         fi
6202         case "$osname:$gccversion" in
6203         aix:)   ccflags="$saveccflags" ;; # restore
6204         esac
6205         ;;
6206 esac
6207
6208 case "$ccflags" in
6209 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6210 esac
6211
6212 case "$uselongdouble" in
6213 $define|true|[yY]*)     dflt='y';;
6214 *) dflt='n';;
6215 esac
6216 cat <<EOM
6217
6218 Perl can be built to take advantage of long doubles which
6219 (if available) may give more accuracy and range for floating point numbers.
6220
6221 If this doesn't make any sense to you, just accept the default '$dflt'.
6222 EOM
6223 rp='Try to use long doubles if available?'
6224 . ./myread
6225 case "$ans" in
6226 y|Y)    val="$define"   ;;
6227 *)      val="$undef"    ;;
6228 esac
6229 set uselongdouble
6230 eval $setvar
6231
6232 case "$uselongdouble" in
6233 true|[yY]*) uselongdouble="$define" ;;
6234 esac
6235
6236 case "$uselongdouble" in
6237 $define)
6238 : Look for a hint-file generated 'call-back-unit'.  If the
6239 : user has specified that long doubles should be used,
6240 : we may need to set or change some other defaults.
6241         if $test -f uselongdouble.cbu; then
6242                 echo "Your platform has some specific hints for long doubles, using them..."
6243                 . ./uselongdouble.cbu
6244         else
6245                 $cat <<EOM
6246 (Your platform doesn't have any specific hints for long doubles.)
6247 EOM
6248         fi
6249         ;;
6250 esac
6251
6252 message=X
6253 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6254 $define:$define:$define)
6255         : You have both
6256         ;;
6257 $define:$define:$undef)
6258         message="I could not find modfl"
6259         ;;
6260 $define:$undef:$define)
6261         message="I could not find sqrtl"
6262         ;;
6263 $define:$undef:$undef)
6264         message="I found neither sqrtl nor modfl"
6265         ;;
6266 esac
6267
6268 if $test "$message" != X; then
6269         $cat <<EOM >&4
6270
6271 *** You requested the use of long doubles but you do not seem to have
6272 *** the mathematic functions for long doubles.
6273 *** ($message)
6274 *** I'm disabling the use of long doubles.
6275
6276 EOM
6277
6278         uselongdouble=$undef
6279 fi
6280
6281 : determine the architecture name
6282 echo " "
6283 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6284         tarch=`arch`"-$osname"
6285 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6286         if uname -m > tmparch 2>&1 ; then
6287                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6288                         -e 's/$/'"-$osname/" tmparch`
6289         else
6290                 tarch="$osname"
6291         fi
6292         $rm -f tmparch
6293 else
6294         tarch="$osname"
6295 fi
6296 case "$myarchname" in
6297 ''|"$tarch") ;;
6298 *)
6299         echo "(Your architecture name used to be $myarchname.)"
6300         archname=''
6301         ;;
6302 esac
6303 case "$targetarch" in
6304 '') ;;
6305 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6306 esac
6307 myarchname="$tarch"
6308 case "$archname" in
6309 '') dflt="$tarch";;
6310 *) dflt="$archname";;
6311 esac
6312 rp='What is your architecture name'
6313 . ./myread
6314 archname="$ans"
6315 case "$usethreads" in
6316 $define)
6317         echo "Threads selected." >&4
6318         case "$archname" in
6319         *-thread*) echo "...and architecture name already has -thread." >&4
6320                 ;;
6321         *)      archname="$archname-thread"
6322                 echo "...setting architecture name to $archname." >&4
6323                 ;;
6324         esac
6325         ;;
6326 esac
6327 case "$usemultiplicity" in
6328 $define)
6329         echo "Multiplicity selected." >&4
6330         case "$archname" in
6331         *-multi*) echo "...and architecture name already has -multi." >&4
6332                 ;;
6333         *)      archname="$archname-multi"
6334                 echo "...setting architecture name to $archname." >&4
6335                 ;;
6336         esac
6337         ;;
6338 esac
6339 case "$use64bitint$use64bitall" in
6340 *"$define"*)
6341         case "$archname64" in
6342         '')
6343                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6344                 ;;
6345         *)
6346                 case "$use64bitint" in
6347                 "$define") echo "64 bit integers selected." >&4 ;;
6348                 esac
6349                 case "$use64bitall" in
6350                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6351                 esac
6352                 case "$archname" in
6353                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6354                         ;;
6355                 *)      archname="$archname-$archname64"
6356                         echo "...setting architecture name to $archname." >&4
6357                         ;;
6358                 esac
6359                 ;;
6360         esac
6361 esac
6362 case "$uselongdouble" in
6363 $define)
6364         echo "Long doubles selected." >&4
6365         case "$longdblsize" in
6366         $doublesize)
6367                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6368                 ;;
6369         *)
6370                 case "$archname" in
6371                 *-ld*) echo "...and architecture name already has -ld." >&4
6372                         ;;
6373                 *)      archname="$archname-ld"
6374                         echo "...setting architecture name to $archname." >&4
6375                         ;;
6376                 esac
6377                 ;;
6378         esac
6379         ;;
6380 esac
6381 case "$useperlio" in
6382 $define)
6383         echo "Perlio selected." >&4
6384         ;;
6385 *)
6386         echo "Perlio not selected, using stdio." >&4
6387         case "$archname" in
6388         *-stdio*) echo "...and architecture name already has -stdio." >&4
6389                 ;;
6390         *)      archname="$archname-stdio"
6391                 echo "...setting architecture name to $archname." >&4
6392                 ;;
6393         esac
6394         ;;
6395 esac
6396
6397 : determine root of directory hierarchy where package will be installed.
6398 case "$prefix" in
6399 '')
6400         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6401         ;;
6402 *?/)
6403         dflt=`echo "$prefix" | sed 's/.$//'`
6404         ;;
6405 *)
6406         dflt="$prefix"
6407         ;;
6408 esac
6409 $cat <<EOM
6410
6411 By default, $package will be installed in $dflt/bin, manual pages
6412 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6413 installation directories. Typically this is something like /usr/local.
6414 If you wish to have binaries under /usr/bin but other parts of the
6415 installation under /usr/local, that's ok: you will be prompted
6416 separately for each of the installation directories, the prefix being
6417 only used to set the defaults.
6418
6419 EOM
6420 fn=d~
6421 rp='Installation prefix to use?'
6422 . ./getfile
6423 oldprefix=''
6424 case "$prefix" in
6425 '') ;;
6426 *)
6427         case "$ans" in
6428         "$prefix") ;;
6429         *) oldprefix="$prefix";;
6430         esac
6431         ;;
6432 esac
6433 prefix="$ans"
6434 prefixexp="$ansexp"
6435
6436 case "$afsroot" in
6437 '')     afsroot=/afs ;;
6438 *)      afsroot=$afsroot ;;
6439 esac
6440
6441 : is AFS running?
6442 echo " "
6443 case "$afs" in
6444 $define|true)   afs=true ;;
6445 $undef|false)   afs=false ;;
6446 *)      if test -d $afsroot; then
6447                 afs=true
6448         else
6449                 afs=false
6450         fi
6451         ;;
6452 esac
6453 if $afs; then
6454         echo "AFS may be running... I'll be extra cautious then..." >&4
6455 else
6456         echo "AFS does not seem to be running..." >&4
6457 fi
6458
6459 : determine installation prefix for where package is to be installed.
6460 if $afs; then 
6461 $cat <<EOM
6462
6463 Since you are running AFS, I need to distinguish the directory in which
6464 files will reside from the directory in which they are installed (and from
6465 which they are presumably copied to the former directory by occult means).
6466
6467 EOM
6468         case "$installprefix" in
6469         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6470         *) dflt="$installprefix";;
6471         esac
6472 else
6473 $cat <<EOM
6474
6475 In some special cases, particularly when building $package for distribution,
6476 it is convenient to distinguish the directory in which files should be
6477 installed from the directory ($prefix) in which they will
6478 eventually reside.  For most users, these two directories are the same.
6479
6480 EOM
6481         case "$installprefix" in
6482         '') dflt=$prefix ;;
6483         *) dflt=$installprefix;;
6484         esac
6485 fi
6486 fn=d~
6487 rp='What installation prefix should I use for installing files?'
6488 . ./getfile
6489 installprefix="$ans"
6490 installprefixexp="$ansexp"
6491
6492 : set the prefixit variable, to compute a suitable default value
6493 prefixit='case "$3" in
6494 ""|none)
6495         case "$oldprefix" in
6496         "") eval "$1=\"\$$2\"";;
6497         *)
6498                 case "$3" in
6499                 "") eval "$1=";;
6500                 none)
6501                         eval "tp=\"\$$2\"";
6502                         case "$tp" in
6503                         ""|" ") eval "$1=\"\$$2\"";;
6504                         *) eval "$1=";;
6505                         esac;;
6506                 esac;;
6507         esac;;
6508 *)
6509         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6510         case "$tp" in
6511         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6512         /*-$oldprefix/*|\~*-$oldprefix/*)
6513                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6514         *) eval "$1=\"\$$2\"";;
6515         esac;;
6516 esac'
6517
6518 : get the patchlevel
6519 echo " "
6520 echo "Getting the current patchlevel..." >&4
6521 if $test -r $rsrc/patchlevel.h;then
6522         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6523         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6524         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6525         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6526         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6527         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6528        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6529 else
6530         revision=0
6531         patchlevel=0
6532         subversion=0
6533         api_revision=0
6534         api_version=0
6535         api_subversion=0
6536         perl_patchlevel=0
6537         $echo "(You do not have patchlevel.h.  Eek.)"
6538 fi
6539 if $test -r $rsrc/.patch ; then  
6540         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6541                 perl_patchlevel=`cat $rsrc/.patch`
6542         fi
6543 fi
6544 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6545 version_patchlevel_string="version $patchlevel subversion $subversion"
6546 case "$perl_patchlevel" in
6547 0|'') ;;
6548 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6549 esac
6550
6551 $echo "(You have $package $version_patchlevel_string.)"
6552
6553 case "$osname" in
6554 dos|vms)
6555         : XXX Should be a Configure test for double-dots in filenames.
6556         version=`echo $revision $patchlevel $subversion | \
6557                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6558         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6559                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6560         ;;
6561 *)
6562         version=`echo $revision $patchlevel $subversion | \
6563                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6564         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6565                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6566         ;;
6567 esac
6568 : Special case the 5.005_xx maintenance series, which used 5.005
6569 : without any subversion label as a subdirectory in $sitelib
6570 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6571         api_versionstring='5.005'
6572 fi
6573
6574 : determine installation style
6575 : For now, try to deduce it from prefix unless it is already set.
6576 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6577 case "$installstyle" in
6578 '')     case "$prefix" in
6579                 *perl*) dflt='lib';;
6580                 *) dflt='lib/perl5' ;;
6581         esac
6582         ;;
6583 *)      dflt="$installstyle" ;;
6584 esac
6585 : Probably not worth prompting for this since we prompt for all
6586 : the directories individually, and the prompt would be too long and
6587 : confusing anyway.
6588 installstyle=$dflt
6589
6590 : determine where private library files go
6591 : Usual default is /usr/local/lib/perl5/$version.
6592 : Also allow things like /opt/perl/lib/$version, since 
6593 : /opt/perl/lib/perl5... would be redundant.
6594 : The default "style" setting is made in installstyle.U
6595 case "$installstyle" in
6596 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6597 *)       set dflt privlib lib/$version ;;
6598 esac
6599 eval $prefixit
6600 $cat <<EOM
6601
6602 There are some auxiliary files for $package that need to be put into a
6603 private library directory that is accessible by everyone.
6604
6605 EOM
6606 fn=d~+
6607 rp='Pathname where the private library files will reside?'
6608 . ./getfile
6609 privlib="$ans"
6610 privlibexp="$ansexp"
6611 : Change installation prefix, if necessary.
6612 if $test X"$prefix" != X"$installprefix"; then
6613         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6614 else
6615         installprivlib="$privlibexp"
6616 fi
6617
6618 : set the prefixup variable, to restore leading tilda escape
6619 prefixup='case "$prefixexp" in
6620 "$prefix") ;;
6621 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6622 esac'
6623
6624 : determine where public architecture dependent libraries go
6625 set archlib archlib
6626 eval $prefixit
6627 : privlib default is /usr/local/lib/$package/$version
6628 : archlib default is /usr/local/lib/$package/$version/$archname
6629 : privlib may have an optional trailing /share.
6630 tdflt=`echo $privlib | $sed 's,/share$,,'`
6631 tdflt=$tdflt/$archname
6632 case "$archlib" in
6633 '')     dflt=$tdflt
6634         ;;
6635 *)      dflt="$archlib"
6636     ;;
6637 esac
6638 $cat <<EOM
6639
6640 $spackage contains architecture-dependent library files.  If you are
6641 sharing libraries in a heterogeneous environment, you might store
6642 these files in a separate location.  Otherwise, you can just include
6643 them with the rest of the public library files.
6644
6645 EOM
6646 fn=d+~
6647 rp='Where do you want to put the public architecture-dependent libraries?'
6648 . ./getfile
6649 archlib="$ans"
6650 archlibexp="$ansexp"
6651 if $test X"$archlib" = X"$privlib"; then
6652         d_archlib="$undef"
6653 else
6654         d_archlib="$define"
6655 fi
6656 : Change installation prefix, if necessary.
6657 if $test X"$prefix" != X"$installprefix"; then
6658         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6659 else
6660         installarchlib="$archlibexp"
6661 fi
6662
6663 : see if setuid scripts can be secure
6664 $cat <<EOM
6665
6666 Some kernels have a bug that prevents setuid #! scripts from being
6667 secure.  Some sites have disabled setuid #! scripts because of this.
6668
6669 First let's decide if your kernel supports secure setuid #! scripts.
6670 (If setuid #! scripts would be secure but have been disabled anyway,
6671 don't say that they are secure if asked.)
6672
6673 EOM
6674
6675 val="$undef"
6676 if $test -d /dev/fd; then
6677         echo "#!$ls" >reflect
6678         chmod +x,u+s reflect
6679         ./reflect >flect 2>&1
6680         if $contains "/dev/fd" flect >/dev/null; then
6681                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6682                 val="$define"
6683         else
6684                 $cat <<EOM
6685 If you are not sure if they are secure, I can check but I'll need a
6686 username and password different from the one you are using right now.
6687 If you don't have such a username or don't want me to test, simply
6688 enter 'none'.
6689
6690 EOM
6691                 rp='Other username to test security of setuid scripts with?'
6692                 dflt='none'
6693                 . ./myread
6694                 case "$ans" in
6695                 n|none)
6696                         case "$d_suidsafe" in
6697                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6698                                 dflt=n;;
6699                         "$undef")
6700                                 echo "Well, the $hint value is *not* secure." >&4
6701                                 dflt=n;;
6702                         *)      echo "Well, the $hint value *is* secure." >&4
6703                                 dflt=y;;
6704                         esac
6705                         ;;
6706                 *)
6707                         $rm -f reflect flect
6708                         echo "#!$ls" >reflect
6709                         chmod +x,u+s reflect
6710                         echo >flect
6711                         chmod a+w flect
6712                         echo '"su" will (probably) prompt you for '"$ans's password."
6713                         su $ans -c './reflect >flect'
6714                         if $contains "/dev/fd" flect >/dev/null; then
6715                                 echo "Okay, it looks like setuid scripts are secure." >&4
6716                                 dflt=y
6717                         else
6718                                 echo "I don't think setuid scripts are secure." >&4
6719                                 dflt=n
6720                         fi
6721                         ;;
6722                 esac
6723                 rp='Does your kernel have *secure* setuid scripts?'
6724                 . ./myread
6725                 case "$ans" in
6726                 [yY]*)  val="$define";;
6727                 *)      val="$undef";;
6728                 esac
6729         fi
6730 else
6731         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6732         echo "(That's for file descriptors, not floppy disks.)"
6733         val="$undef"
6734 fi
6735 set d_suidsafe
6736 eval $setvar
6737
6738 $rm -f reflect flect
6739
6740 : now see if they want to do setuid emulation
6741 echo " "
6742 val="$undef"
6743 case "$d_suidsafe" in
6744 "$define")
6745         val="$undef"
6746         echo "No need to emulate SUID scripts since they are secure here." >&4
6747         ;;
6748 *)
6749         $cat <<EOM
6750 Some systems have disabled setuid scripts, especially systems where
6751 setuid scripts cannot be secure.  On systems where setuid scripts have
6752 been disabled, the setuid/setgid bits on scripts are currently
6753 useless.  It is possible for $package to detect those bits and emulate
6754 setuid/setgid in a secure fashion.  This emulation will only work if
6755 setuid scripts have been disabled in your kernel.
6756
6757 EOM
6758         case "$d_dosuid" in
6759         "$define") dflt=y ;;
6760         *) dflt=n ;;
6761         esac
6762         rp="Do you want to do setuid/setgid emulation?"
6763         . ./myread
6764         case "$ans" in
6765         [yY]*)  val="$define";;
6766         *)      val="$undef";;
6767         esac
6768         ;;
6769 esac
6770 set d_dosuid
6771 eval $setvar
6772
6773 : see if this is a malloc.h system
6774 : we want a real compile instead of Inhdr because some systems have a
6775 : malloc.h that just gives a compile error saying to use stdlib.h instead
6776 echo " "
6777 $cat >try.c <<EOCP
6778 #include <stdlib.h>
6779 #include <malloc.h>
6780 int main () { return 0; }
6781 EOCP
6782 set try
6783 if eval $compile; then
6784     echo "<malloc.h> found." >&4
6785     val="$define"
6786 else
6787     echo "<malloc.h> NOT found." >&4
6788     val="$undef"
6789 fi
6790 $rm -f try.c try
6791 set i_malloc
6792 eval $setvar
6793
6794 : check for void type
6795 echo " "
6796 echo "Checking to see how well your C compiler groks the void type..." >&4
6797 case "$voidflags" in
6798 '')
6799         $cat >try.c <<EOCP
6800 #$i_stdlib I_STDLIB
6801 #ifdef I_STDLIB
6802 #include <stdlib.h>
6803 #endif
6804 #if TRY & 1
6805 void sub() {
6806 #else
6807 sub() {
6808 #endif
6809         extern void moo();      /* function returning void */
6810         void (*goo)();          /* ptr to func returning void */
6811 #if TRY & 8
6812         void *hue;              /* generic ptr */
6813 #endif
6814 #if TRY & 2
6815         void (*foo[10])();
6816 #endif
6817
6818 #if TRY & 4
6819         if(goo == moo) {
6820                 exit(0);
6821         }
6822 #endif
6823         exit(0);
6824 }
6825 int main() { sub(); }
6826 EOCP
6827         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6828                 voidflags=$defvoidused
6829         echo "Good.  It appears to support void to the level $package wants.">&4
6830                 if $contains warning .out >/dev/null 2>&1; then
6831                         echo "However, you might get some warnings that look like this:"
6832                         $cat .out
6833                 fi
6834         else
6835 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6836                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6837                         echo "It supports 1..."
6838                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6839                                 echo "It also supports 2..."
6840                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6841                                         voidflags=7
6842                                         echo "And it supports 4 but not 8 definitely."
6843                                 else
6844                                         echo "It doesn't support 4..."
6845                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6846                                                 voidflags=11
6847                                                 echo "But it supports 8."
6848                                         else
6849                                                 voidflags=3
6850                                                 echo "Neither does it support 8."
6851                                         fi
6852                                 fi
6853                         else
6854                                 echo "It does not support 2..."
6855                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6856                                         voidflags=13
6857                                         echo "But it supports 4 and 8."
6858                                 else
6859                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6860                                                 voidflags=5
6861                                                 echo "And it supports 4 but has not heard about 8."
6862                                         else
6863                                                 echo "However it supports 8 but not 4."
6864                                         fi
6865                                 fi
6866                         fi
6867                 else
6868                         echo "There is no support at all for void."
6869                         voidflags=0
6870                 fi
6871         fi
6872 esac
6873 case "$voidflags" in
6874 "$defvoidused") ;;
6875 *)      $cat >&4 <<'EOM'
6876   Support flag bits are:
6877     1: basic void declarations.
6878     2: arrays of pointers to functions returning void.
6879     4: operations between pointers to and addresses of void functions.
6880     8: generic void pointers.
6881 EOM
6882         dflt="$voidflags";
6883         rp="Your void support flags add up to what?"
6884         . ./myread
6885         voidflags="$ans"
6886         ;;
6887 esac
6888 $rm -f try.* .out
6889
6890 : check for length of pointer
6891 echo " "
6892 case "$ptrsize" in
6893 '')
6894         echo "Checking to see how big your pointers are..." >&4
6895         if test "$voidflags" -gt 7; then
6896                 echo '#define VOID_PTR char *' > try.c
6897         else
6898                 echo '#define VOID_PTR void *' > try.c
6899         fi
6900         $cat >>try.c <<EOCP
6901 #include <stdio.h>
6902 #$i_stdlib I_STDLIB
6903 #ifdef I_STDLIB
6904 #include <stdlib.h>
6905 #endif
6906 int main()
6907 {
6908     printf("%d\n", (int)sizeof(VOID_PTR));
6909     exit(0);
6910 }
6911 EOCP
6912         set try
6913         if eval $compile_ok; then
6914                 ptrsize=`$run ./try`
6915                 echo "Your pointers are $ptrsize bytes long."
6916         else
6917                 dflt='4'
6918                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6919                 rp="What is the size of a pointer (in bytes)?"
6920                 . ./myread
6921                 ptrsize="$ans"
6922         fi
6923         ;;
6924 esac
6925 $rm -f try.c try
6926 case "$use64bitall" in
6927 "$define"|true|[yY]*)
6928         case "$ptrsize" in
6929         4)      cat <<EOM >&4
6930
6931 *** You have chosen a maximally 64-bit build, but your pointers
6932 *** are only 4 bytes wide, disabling maximal 64-bitness.
6933
6934 EOM
6935                 use64bitall="$undef"
6936                 case "$use64bitint" in
6937                 "$define"|true|[yY]*) ;;
6938                 *)      cat <<EOM >&4
6939
6940 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6941
6942 EOM
6943                         use64bitint="$define"
6944                         ;;
6945                 esac
6946                 ;;
6947         esac
6948         ;;
6949 esac
6950
6951
6952 : determine which malloc to compile in
6953 echo " "
6954 case "$usemymalloc" in
6955 [yY]*|true|$define)     dflt='y' ;;
6956 [nN]*|false|$undef)     dflt='n' ;;
6957 *)      case "$ptrsize" in
6958         4) dflt='y' ;;
6959         *) dflt='n' ;;
6960         esac
6961         ;;
6962 esac
6963 rp="Do you wish to attempt to use the malloc that comes with $package?"
6964 . ./myread
6965 usemymalloc="$ans"
6966 case "$ans" in
6967 y*|true)
6968         usemymalloc='y'
6969         mallocsrc='malloc.c'
6970         mallocobj="malloc$_o"
6971         d_mymalloc="$define"
6972         case "$libs" in
6973         *-lmalloc*)
6974                 : Remove malloc from list of libraries to use
6975                 echo "Removing unneeded -lmalloc from library list" >&4
6976                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6977                 shift
6978                 libs="$*"
6979                 echo "libs = $libs" >&4
6980                 ;;
6981         esac
6982         ;;
6983 *)
6984         usemymalloc='n'
6985         mallocsrc=''
6986         mallocobj=''
6987         d_mymalloc="$undef"
6988         ;;
6989 esac
6990
6991 : compute the return types of malloc and free
6992 echo " "
6993 $cat >malloc.c <<END
6994 #$i_malloc I_MALLOC
6995 #$i_stdlib I_STDLIB
6996 #include <stdio.h>
6997 #include <sys/types.h>
6998 #ifdef I_MALLOC
6999 #include <malloc.h>
7000 #endif
7001 #ifdef I_STDLIB
7002 #include <stdlib.h>
7003 #endif
7004 #ifdef TRY_MALLOC
7005 void *malloc();
7006 #endif
7007 #ifdef TRY_FREE
7008 void free();
7009 #endif
7010 END
7011 case "$malloctype" in
7012 '')
7013         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7014                 malloctype='void *'
7015         else
7016                 malloctype='char *'
7017         fi
7018         ;;
7019 esac
7020 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7021
7022 case "$freetype" in
7023 '')
7024         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7025                 freetype='void'
7026         else
7027                 freetype='int'
7028         fi
7029         ;;
7030 esac
7031 echo "Your system uses $freetype free(), it would seem." >&4
7032 $rm -f malloc.[co]
7033 $cat <<EOM
7034
7035 After $package is installed, you may wish to install various
7036 add-on modules and utilities.  Typically, these add-ons will
7037 be installed under $prefix with the rest
7038 of this package.  However, you may wish to install such add-ons
7039 elsewhere under a different prefix.
7040
7041 If you do not wish to put everything under a single prefix, that's
7042 ok.  You will be prompted for the individual locations; this siteprefix
7043 is only used to suggest the defaults.
7044
7045 The default should be fine for most people.
7046
7047 EOM
7048 fn=d~+
7049 rp='Installation prefix to use for add-on modules and utilities?'
7050 : XXX Here might be another good place for an installstyle setting.
7051 case "$siteprefix" in
7052 '') dflt=$prefix ;;
7053 *)  dflt=$siteprefix ;;
7054 esac
7055 . ./getfile
7056 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7057 oldsiteprefix=''
7058 case "$siteprefix" in
7059 '') ;;
7060 *)      case "$ans" in
7061         "$prefix") ;;
7062         *) oldsiteprefix="$prefix";;
7063         esac
7064         ;;
7065 esac
7066 siteprefix="$ans"
7067 siteprefixexp="$ansexp"
7068
7069 : determine where site specific libraries go.
7070 : Usual default is /usr/local/lib/perl5/site_perl/$version
7071 : The default "style" setting is made in installstyle.U
7072 : XXX No longer works with Prefixit stuff.
7073 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7074 case "$sitelib" in
7075 '') case "$installstyle" in
7076         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7077         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7078         esac
7079         ;;
7080 *)      dflt="$sitelib"
7081         ;;
7082 esac
7083 $cat <<EOM
7084
7085 The installation process will create a directory for
7086 site-specific extensions and modules.  Most users find it convenient
7087 to place all site-specific files in this directory rather than in the
7088 main distribution directory.
7089
7090 EOM
7091 fn=d~+
7092 rp='Pathname for the site-specific library files?'
7093 . ./getfile
7094 sitelib="$ans"
7095 sitelibexp="$ansexp"
7096 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7097 : Change installation prefix, if necessary.
7098 if $test X"$prefix" != X"$installprefix"; then
7099         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7100 else
7101         installsitelib="$sitelibexp"
7102 fi
7103
7104 : determine where site specific architecture-dependent libraries go.
7105 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7106 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7107 : sitelib may have an optional trailing /share.
7108 case "$sitearch" in
7109 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7110         dflt="$dflt/$archname"
7111         ;;
7112 *)      dflt="$sitearch"
7113         ;;
7114 esac
7115 set sitearch sitearch none
7116 eval $prefixit
7117 $cat <<EOM
7118
7119 The installation process will also create a directory for
7120 architecture-dependent site-specific extensions and modules.
7121
7122 EOM
7123 fn=d~+
7124 rp='Pathname for the site-specific architecture-dependent library files?'
7125 . ./getfile
7126 sitearch="$ans"
7127 sitearchexp="$ansexp"
7128 : Change installation prefix, if necessary.
7129 if $test X"$prefix" != X"$installprefix"; then
7130         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7131 else
7132         installsitearch="$sitearchexp"
7133 fi
7134
7135 $cat <<EOM
7136
7137 The installation process will also create a directory for
7138 vendor-supplied add-ons.  Vendors who supply perl with their system
7139 may find it convenient to place all vendor-supplied files in this
7140 directory rather than in the main distribution directory.  This will
7141 ease upgrades between binary-compatible maintenance versions of perl.
7142
7143 Of course you may also use these directories in whatever way you see
7144 fit.  For example, you might use them to access modules shared over a
7145 company-wide network.
7146
7147 The default answer should be fine for most people.
7148 This causes further questions about vendor add-ons to be skipped
7149 and no vendor-specific directories will be configured for perl.
7150
7151 EOM
7152 rp='Do you want to configure vendor-specific add-on directories?'
7153 case "$usevendorprefix" in
7154 define|true|[yY]*) dflt=y ;;
7155 *)      : User may have set vendorprefix directly on Configure command line.
7156         case "$vendorprefix" in
7157         ''|' ') dflt=n ;;
7158         *)      dflt=y ;;
7159         esac
7160         ;;
7161 esac
7162 . ./myread
7163 case "$ans" in
7164 [yY]*)  fn=d~+
7165         rp='Installation prefix to use for vendor-supplied add-ons?'
7166         case "$vendorprefix" in
7167         '') dflt='' ;;
7168         *)  dflt=$vendorprefix ;;
7169         esac
7170         . ./getfile
7171         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7172         oldvendorprefix=''
7173         case "$vendorprefix" in
7174         '') ;;
7175         *)      case "$ans" in
7176                 "$prefix") ;;
7177                 *) oldvendorprefix="$prefix";;
7178                 esac
7179                 ;;
7180         esac
7181         usevendorprefix="$define"
7182         vendorprefix="$ans"
7183         vendorprefixexp="$ansexp"
7184         ;;
7185 *)      usevendorprefix="$undef"
7186         vendorprefix=''
7187         vendorprefixexp=''
7188         ;;
7189 esac
7190
7191 case "$vendorprefix" in
7192 '')     d_vendorlib="$undef"
7193         vendorlib=''
7194         vendorlibexp=''
7195         ;;
7196 *)      d_vendorlib="$define"
7197         : determine where vendor-supplied modules go.
7198         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7199         case "$vendorlib" in
7200         '')
7201                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7202                 case "$installstyle" in
7203                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7204                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7205                 esac
7206                 ;;
7207         *)      dflt="$vendorlib"
7208                 ;;
7209         esac
7210         fn=d~+
7211         rp='Pathname for the vendor-supplied library files?'
7212         . ./getfile
7213         vendorlib="$ans"
7214         vendorlibexp="$ansexp"
7215         ;;
7216 esac
7217 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7218 : Change installation prefix, if necessary.
7219 if $test X"$prefix" != X"$installprefix"; then
7220         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7221 else
7222         installvendorlib="$vendorlibexp"
7223 fi
7224
7225 case "$vendorprefix" in
7226 '')     d_vendorarch="$undef"
7227         vendorarch=''
7228         vendorarchexp=''
7229         ;;
7230 *)      d_vendorarch="$define"
7231         : determine where vendor-supplied architecture-dependent libraries go.
7232         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7233         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7234         : vendorlib may have an optional trailing /share.
7235         case "$vendorarch" in
7236         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7237                 dflt="$dflt/$archname"
7238                 ;;
7239         *)      dflt="$vendorarch" ;;
7240         esac
7241         fn=d~+
7242         rp='Pathname for vendor-supplied architecture-dependent files?'
7243         . ./getfile
7244         vendorarch="$ans"
7245         vendorarchexp="$ansexp"
7246         ;;
7247 esac
7248 : Change installation prefix, if necessary.
7249 if $test X"$prefix" != X"$installprefix"; then
7250         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7251 else
7252         installvendorarch="$vendorarchexp"
7253 fi
7254
7255 : Final catch-all directories to search
7256 $cat <<EOM
7257
7258 Lastly, you can have perl look in other directories for extensions and
7259 modules in addition to those already specified.
7260 These directories will be searched after 
7261         $sitearch 
7262         $sitelib 
7263 EOM
7264 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7265 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7266 echo ' '
7267 case "$otherlibdirs" in
7268 ''|' ') dflt='none' ;;
7269 *)      dflt="$otherlibdirs" ;;
7270 esac
7271 $cat <<EOM
7272 Enter a colon-separated set of extra paths to include in perl's @INC
7273 search path, or enter 'none' for no extra paths.
7274
7275 EOM
7276
7277 rp='Colon-separated list of additional directories for perl to search?'
7278 . ./myread
7279 case "$ans" in
7280 ' '|''|none)    otherlibdirs=' ' ;;     
7281 *)      otherlibdirs="$ans" ;;
7282 esac
7283 case "$otherlibdirs" in
7284 ' ') val=$undef ;;
7285 *)      val=$define ;;
7286 esac
7287 set d_perl_otherlibdirs
7288 eval $setvar
7289
7290 : Cruising for prototypes
7291 echo " "
7292 echo "Checking out function prototypes..." >&4
7293 $cat >prototype.c <<'EOCP'
7294 int main(int argc, char *argv[]) {
7295         exit(0);}
7296 EOCP
7297 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7298         echo "Your C compiler appears to support function prototypes."
7299         val="$define"
7300 else
7301         echo "Your C compiler doesn't seem to understand function prototypes."
7302         val="$undef"
7303 fi
7304 set prototype
7305 eval $setvar
7306 $rm -f prototype*
7307
7308 case "$prototype" in
7309 "$define") ;;
7310 *)      ansi2knr='ansi2knr'
7311         echo " "
7312         cat <<EOM >&4
7313
7314 $me:  FATAL ERROR:
7315 This version of $package can only be compiled by a compiler that 
7316 understands function prototypes.  Unfortunately, your C compiler 
7317         $cc $ccflags
7318 doesn't seem to understand them.  Sorry about that.
7319
7320 If GNU cc is available for your system, perhaps you could try that instead.  
7321
7322 Eventually, we hope to support building Perl with pre-ANSI compilers.
7323 If you would like to help in that effort, please contact <perlbug@perl.org>.
7324
7325 Aborting Configure now.
7326 EOM
7327         exit 2
7328         ;;
7329 esac
7330
7331 : determine where public executables go
7332 echo " "
7333 set dflt bin bin
7334 eval $prefixit
7335 fn=d~
7336 rp='Pathname where the public executables will reside?'
7337 . ./getfile
7338 if $test "X$ansexp" != "X$binexp"; then
7339         installbin=''
7340 fi
7341 bin="$ans"
7342 binexp="$ansexp"
7343 : Change installation prefix, if necessary.
7344 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7345 if $test X"$prefix" != X"$installprefix"; then
7346         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7347 else
7348         installbin="$binexp"
7349 fi
7350
7351 echo " "
7352 case "$extras" in
7353 '') dflt='n';;
7354 *) dflt='y';;
7355 esac
7356 cat <<EOM
7357 Perl can be built with extra modules or bundles of modules which
7358 will be fetched from the CPAN and installed alongside Perl.
7359
7360 Notice that you will need access to the CPAN; either via the Internet,
7361 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7362 be asked later to configure the CPAN.pm module which will in turn do
7363 the installation of the rest of the extra modules or bundles.)
7364
7365 Notice also that if the modules require any external software such as
7366 libraries and headers (the libz library and the zlib.h header for the
7367 Compress::Zlib module, for example) you MUST have any such software
7368 already installed, this configuration process will NOT install such
7369 things for you.
7370
7371 If this doesn't make any sense to you, just accept the default '$dflt'.
7372 EOM
7373 rp='Install any extra modules (y or n)?'
7374 . ./myread
7375 case "$ans" in
7376 y|Y)
7377         cat <<EOM
7378
7379 Please list any extra modules or bundles to be installed from CPAN,
7380 with spaces between the names.  The names can be in any format the
7381 'install' command of CPAN.pm will understand.  (Answer 'none',
7382 without the quotes, to install no extra modules or bundles.)
7383 EOM
7384         rp='Extras?'
7385         dflt="$extras"
7386         . ./myread
7387         extras="$ans"
7388 esac
7389 case "$extras" in
7390 ''|'none')
7391         val=''
7392         $rm -f ../extras.lst
7393         ;;
7394 *)      echo "(Saving the list of extras for later...)"
7395         echo "$extras" > ../extras.lst
7396         val="'$extras'"
7397         ;;
7398 esac
7399 set extras
7400 eval $setvar
7401 echo " "
7402
7403 : determine where html pages for programs go
7404 set html1dir html1dir none
7405 eval $prefixit
7406 $cat <<EOM
7407
7408 If you wish to install html files for programs in $spackage, indicate 
7409 the appropriate directory here.  To skip installing html files,
7410 answer "none".
7411 EOM
7412 case "$html1dir" in
7413 ''|none|$undef|' ') dflt=none ;;
7414 *) dflt=$html1dir ;;
7415 esac
7416 fn=dn+~
7417 rp="Directory for the main $spackage html pages?"
7418 . ./getfile
7419 html1dir="$ans"
7420 html1direxp="$ansexp"
7421 : Use ' ' for none so value is preserved next time through Configure
7422 $test X"$html1dir" = "X" && html1dir=' '
7423 : Change installation prefix, if necessary.
7424 if $test X"$prefix" != X"$installprefix"; then
7425         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
7426 else
7427         installhtml1dir="$html1direxp"
7428 fi
7429
7430 : determine where html pages for libraries and modules go
7431 set html3dir html3dir none
7432 eval $prefixit
7433 $cat <<EOM
7434
7435 If you wish to install html files for modules associated with $spackage,
7436 indicate the appropriate directory here.  To skip installing html files,
7437 answer "none".
7438 EOM
7439 : There is no obvious default.  If they have specified html1dir, then
7440 : try to key off that, possibly changing .../html1 into .../html3.
7441 case "$html3dir" in
7442 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7443 *) dflt=$html3dir ;;
7444 esac
7445 fn=dn+~
7446 rp="Directory for the $spackage module html pages?"
7447 . ./getfile
7448 html3dir="$ans"
7449 html3direxp="$ansexp"
7450 : Use ' ' for none so value is preserved next time through Configure
7451 $test X"$html3dir" = "X" && html3dir=' '
7452 : Change installation prefix, if necessary.
7453 if $test X"$prefix" != X"$installprefix"; then
7454         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
7455 else
7456         installhtml3dir="$html3direxp"
7457 fi
7458
7459 : Find perl5.005 or later.
7460 echo "Looking for a previously installed perl5.005 or later... "
7461 case "$perl5" in
7462 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7463                 : Check if this perl is recent and can load a simple module
7464                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7465                         perl5=$tdir/perl
7466                         break;
7467                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7468                         perl5=$tdir/perl5
7469                         break;
7470                 fi
7471         done
7472         ;;
7473 *)      perl5="$perl5"
7474         ;;
7475 esac
7476 case "$perl5" in
7477 '')     echo "None found.  That's ok.";;
7478 *)      echo "Using $perl5." ;;
7479 esac
7480
7481 : Determine list of previous versions to include in @INC
7482 $cat > getverlist <<EOPL
7483 #!$perl5 -w
7484 use File::Basename;
7485 \$api_versionstring = "$api_versionstring";
7486 \$version = "$version";
7487 \$stem = "$sitelib_stem";
7488 \$archname = "$archname";
7489 EOPL
7490         $cat >> getverlist <<'EOPL'
7491 # Can't have leading @ because metaconfig interprets it as a command!
7492 ;@inc_version_list=();
7493 # XXX Redo to do opendir/readdir? 
7494 if (-d $stem) {
7495     chdir($stem);
7496     ;@candidates = glob("5.*");
7497 }
7498 else {
7499     ;@candidates = ();
7500 }
7501
7502 # XXX ToDo:  These comparisons must be reworked when two-digit
7503 # subversions come along, so that 5.7.10 compares as greater than
7504 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7505 # widespread that we can use the built-in version vectors rather
7506 # than reinventing them here.  For 5.6.0, however, we must
7507 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7508 foreach $d (@candidates) {
7509     if ($d lt $version) {
7510         if ($d ge $api_versionstring) {
7511             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7512         }
7513         elsif ($d ge "5.005") {
7514             unshift(@inc_version_list, grep { -d } $d);
7515         }
7516     }
7517     else {
7518         # Skip newer version.  I.e. don't look in
7519         # 5.7.0 if we're installing 5.6.1.
7520     }
7521 }
7522
7523 if (@inc_version_list) {
7524     print join(' ', @inc_version_list);
7525 }
7526 else {
7527     # Blank space to preserve value for next Configure run.
7528     print " ";
7529 }
7530 EOPL
7531 chmod +x getverlist
7532 case "$inc_version_list" in
7533 '')     if test -x "$perl5$exe_ext"; then
7534                 dflt=`$perl5 getverlist`
7535         else
7536                 dflt='none'
7537         fi
7538         ;;
7539 $undef) dflt='none' ;;
7540 *)  eval dflt=\"$inc_version_list\" ;;
7541 esac
7542 case "$dflt" in
7543 ''|' ') dflt=none ;;
7544 esac
7545 case "$dflt" in
7546 5.005) dflt=none ;;
7547 esac
7548 $cat <<EOM
7549
7550 In order to ease the process of upgrading, this version of perl 
7551 can be configured to use modules built and installed with earlier 
7552 versions of perl that were installed under $prefix.  Specify here
7553 the list of earlier versions that this version of perl should check.
7554 If Configure detected no earlier versions of perl installed under
7555 $prefix, then the list will be empty.  Answer 'none' to tell perl
7556 to not search earlier versions.
7557
7558 The default should almost always be sensible, so if you're not sure,
7559 just accept the default.
7560 EOM
7561
7562 rp='List of earlier versions to include in @INC?'
7563 . ./myread
7564 case "$ans" in
7565 [Nn]one|''|' ') inc_version_list=' ' ;;
7566 *) inc_version_list="$ans" ;;
7567 esac
7568 case "$inc_version_list" in
7569 ''|' ') 
7570         inc_version_list_init='0';;
7571 *)      inc_version_list_init=`echo $inc_version_list |
7572                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7573         ;;
7574 esac
7575 $rm -f getverlist
7576
7577 : determine whether to install perl also as /usr/bin/perl
7578
7579 echo " "
7580 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7581         $cat <<EOM
7582 Many scripts expect perl to be installed as /usr/bin/perl.
7583
7584 If you want to, I can install the perl you are about to compile
7585 as /usr/bin/perl (in addition to $bin/perl).
7586 EOM
7587         if test -f /usr/bin/perl; then
7588             $cat <<EOM
7589
7590 However, please note that because you already have a /usr/bin/perl,
7591 overwriting that with a new Perl would very probably cause problems.
7592 Therefore I'm assuming you don't want to do that (unless you insist).
7593
7594 EOM
7595             case "$installusrbinperl" in
7596             "$define"|[yY]*)    dflt='y';;
7597             *)                  dflt='n';;
7598             esac
7599         else
7600             $cat <<EOM
7601
7602 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7603
7604 EOM
7605             case "$installusrbinperl" in
7606             "$undef"|[nN]*)     dflt='n';;
7607             *)                  dflt='y';;
7608             esac
7609         fi
7610         rp="Do you want to install perl as /usr/bin/perl?"
7611         . ./myread
7612         case "$ans" in
7613         [yY]*)  val="$define";;
7614         *)      val="$undef" ;;
7615         esac
7616 else
7617         val="$undef"
7618 fi
7619 set installusrbinperl
7620 eval $setvar
7621
7622 : see if dld is available
7623 set dld.h i_dld
7624 eval $inhdr
7625
7626 : see if dlopen exists
7627 xxx_runnm="$runnm"
7628 runnm=false
7629 set dlopen d_dlopen
7630 eval $inlibc
7631 runnm="$xxx_runnm"
7632
7633 : determine which dynamic loading, if any, to compile in
7634 echo " "
7635 dldir="ext/DynaLoader"
7636 case "$usedl" in
7637 $define|y|true)
7638         dflt='y'
7639         usedl="$define"
7640         ;;
7641 $undef|n|false)
7642         dflt='n'
7643         usedl="$undef"
7644         ;;
7645 *) 
7646         dflt='n'
7647         case "$d_dlopen" in
7648             $define) dflt='y' ;;
7649         esac
7650         case "$i_dld" in
7651             $define) dflt='y' ;;
7652         esac
7653         : Does a dl_xxx.xs file exist for this operating system
7654         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7655         ;;
7656 esac
7657 rp="Do you wish to use dynamic loading?"
7658 . ./myread
7659 usedl="$ans"
7660 case "$ans" in
7661 y*) usedl="$define"
7662         case "$dlsrc" in
7663         '')
7664                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7665                         dflt="$dldir/dl_${osname}.xs"
7666                 elif $test "$d_dlopen" = "$define" ; then
7667                         dflt="$dldir/dl_dlopen.xs"
7668                 elif $test "$i_dld" = "$define" ; then
7669                         dflt="$dldir/dl_dld.xs"
7670                 else
7671                         dflt=''
7672                 fi
7673                 ;;
7674         *)      dflt="$dldir/$dlsrc"
7675                 ;;
7676         esac
7677     echo "The following dynamic loading files are available:"
7678         : Can not go over to $dldir because getfile has path hard-coded in.
7679         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7680         rp="Source file to use for dynamic loading"
7681         fn="fne"
7682         gfpth="$src"
7683         . ./getfile
7684         usedl="$define"
7685         : emulate basename
7686         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7687
7688         $cat << EOM
7689
7690 Some systems may require passing special flags to $cc -c to
7691 compile modules that will be used to create a shared library.
7692 To use no flags, say "none".
7693
7694 EOM
7695     case "$cccdlflags" in
7696     '') case "$gccversion" in
7697                 '') case "$osname" in
7698                         hpux)   dflt='+z' ;;
7699                         next)   dflt='none' ;;
7700                         irix*)  dflt='-KPIC' ;;
7701                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7702                         sunos)  dflt='-pic' ;;
7703                         *)      dflt='none' ;;
7704                     esac
7705                         ;;
7706                 *)  case "$osname" in
7707                         darwin) dflt='none' ;;
7708                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7709                         *)      dflt='-fpic' ;;
7710                     esac ;;
7711             esac ;;
7712         ' ') dflt='none' ;;
7713     *)  dflt="$cccdlflags" ;;
7714     esac
7715     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7716     . ./myread
7717     case "$ans" in
7718     none) cccdlflags=' ' ;;
7719     *) cccdlflags="$ans" ;;
7720     esac
7721
7722     cat << EOM
7723
7724 Some systems use ld to create libraries that can be dynamically loaded,
7725 while other systems (such as those using ELF) use $cc.
7726
7727 EOM
7728         case "$ld" in
7729         '')     $cat >try.c <<'EOM'
7730 /* Test for whether ELF binaries are produced */
7731 #include <fcntl.h>
7732 #include <stdlib.h>
7733 int main() {
7734         char b[4];
7735         int i = open("a.out",O_RDONLY);
7736         if(i == -1) 
7737                 exit(1); /* fail */
7738         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7739                 exit(0); /* succeed (yes, it's ELF) */
7740         else
7741                 exit(1); /* fail */
7742 }
7743 EOM
7744                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7745                         cat <<EOM
7746 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7747 EOM
7748                         dflt="$cc"
7749                 else
7750                         echo "I'll use ld to build dynamic libraries."
7751                         dflt='ld'
7752                 fi
7753                 rm -f try.c a.out
7754                 ;;
7755         *)      dflt="$ld"
7756                 ;;
7757         esac
7758
7759     rp="What command should be used to create dynamic libraries?"
7760     . ./myread
7761         ld="$ans"
7762
7763     cat << EOM
7764
7765 Some systems may require passing special flags to $ld to create a
7766 library that can be dynamically loaded.  If your ld flags include
7767 -L/other/path options to locate libraries outside your loader's normal
7768 search path, you may need to specify those -L options here as well.  To
7769 use no flags, say "none".
7770
7771 EOM
7772     case "$lddlflags" in
7773     '') case "$osname" in
7774                         beos) dflt='-nostart' ;;
7775                         hpux) dflt='-b';
7776                               case "$gccversion" in
7777                               '') dflt="$dflt +vnocompatwarnings" ;;
7778                               esac
7779                               ;;        
7780                         linux|irix*)    dflt='-shared' ;;
7781                         next)  dflt='none' ;;
7782                         solaris) dflt='-G' ;;
7783                         sunos) dflt='-assert nodefinitions' ;;
7784                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7785                 *)     dflt='none' ;;
7786                         esac
7787                         ;;
7788     *) dflt="$lddlflags" ;;
7789     esac
7790
7791         : Try to guess additional flags to pick up local libraries.
7792         : Be careful not to append to a plain 'none'
7793         case "$dflt" in
7794         none) dflt='' ;;
7795         esac
7796         for thisflag in $ldflags; do
7797                 case "$thisflag" in
7798                 -L*|-R*|-Wl,-R*)
7799                         case " $dflt " in
7800                         *" $thisflag "*) ;;
7801                         *) dflt="$dflt $thisflag" ;;
7802                         esac
7803                         ;;
7804                 esac
7805         done
7806
7807         case "$dflt" in
7808         ''|' ') dflt='none' ;;
7809         esac
7810
7811     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7812     . ./myread
7813     case "$ans" in
7814     none) lddlflags=' ' ;;
7815     *) lddlflags="$ans" ;;
7816     esac
7817
7818         cat <<EOM
7819
7820 Some systems may require passing special flags to $cc to indicate that
7821 the resulting executable will use dynamic linking.  To use no flags,
7822 say "none".
7823
7824 EOM
7825     case "$ccdlflags" in
7826     '') case "$osname" in
7827                 hpux)   dflt='-Wl,-E' ;;
7828                 linux)  dflt='-rdynamic' ;;
7829                 next)   dflt='none' ;;
7830                 sunos)  dflt='none' ;;
7831                 *)      dflt='none' ;;
7832             esac ;;
7833     ' ')  dflt='none' ;;
7834     *)  dflt="$ccdlflags" ;;
7835     esac
7836     rp="Any special flags to pass to $cc to use dynamic linking?"
7837     . ./myread
7838     case "$ans" in
7839     none) ccdlflags=' ' ;;
7840     *) ccdlflags="$ans" ;;
7841     esac
7842     ;;
7843 *)  usedl="$undef"
7844         ld='ld'
7845     dlsrc='dl_none.xs'
7846     lddlflags=''
7847     ccdlflags=''
7848     ;;
7849 esac
7850
7851 also=''
7852 case "$usedl" in
7853 $undef)
7854         # No dynamic loading being used, so don't bother even to prompt.
7855         useshrplib='false'
7856         ;;
7857 *)      case "$useshrplib" in
7858         '')     case "$osname" in
7859                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7860                         dflt=y
7861                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7862                         ;;
7863                 next*)
7864                         case "$osvers" in
7865                         4*)     dflt=y
7866                                 also='Building a shared libperl is needed for MAB support.'
7867                                 ;;
7868                         *)      dflt=n
7869                                 ;;
7870                         esac
7871                         ;;
7872                 *)      dflt=n
7873                         ;;
7874                 esac
7875                 ;;
7876         $define|true|[Yy]*)
7877                 dflt=y
7878                 ;;
7879         *)      dflt=n
7880                 ;;
7881         esac
7882         $cat << EOM
7883
7884 The perl executable is normally obtained by linking perlmain.c with
7885 libperl${_a}, any static extensions (usually just DynaLoader), and
7886 any other libraries needed on this system (such as -lm, etc.).  Since
7887 your system supports dynamic loading, it is probably possible to build
7888 a shared libperl.$so.  If you will have more than one executable linked
7889 to libperl.$so, this will significantly reduce the size of each
7890 executable, but it may have a noticeable affect on performance.  The
7891 default is probably sensible for your system.
7892 $also
7893
7894 EOM
7895         rp="Build a shared libperl.$so (y/n)"
7896         . ./myread
7897         case "$ans" in
7898         true|$define|[Yy]*)
7899                 useshrplib='true'  ;;
7900         *)      useshrplib='false' ;;
7901         esac
7902         ;;
7903 esac
7904
7905 case "$useshrplib" in
7906 true)
7907         case "$libperl" in
7908         '')
7909                 # Figure out a good name for libperl.so.  Since it gets stored in
7910                 # a version-specific architecture-dependent library, the version
7911                 # number isn't really that important, except for making cc/ld happy.
7912                 #
7913                 # A name such as libperl.so.3.1
7914                 majmin="libperl.$so.$patchlevel.$subversion"
7915                 # A name such as libperl.so.301
7916                 majonly=`echo $patchlevel $subversion |
7917                         $awk '{printf "%d%02d", $1, $2}'`
7918                 majonly=libperl.$so.$majonly
7919                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7920                 # rely on figuring it out from the naming of libc.
7921                 case "${osname}${osvers}" in
7922                 next4*)
7923                         dflt=libperl.5.$so
7924                         # XXX How handle the --version stuff for MAB?
7925                         ;;
7926                 linux*)  # ld won't link with a bare -lperl otherwise.
7927                         dflt=libperl.$so
7928                         ;;
7929                 cygwin*) # ld links against an importlib
7930                         dflt=libperl$lib_ext
7931                         ;;
7932                 *)      # Try to guess based on whether libc has major.minor.
7933                         case "$libc" in
7934                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7935                         *libc.$so.[0-9]*) dflt=$majonly ;;
7936                         *)      dflt=libperl.$so ;;
7937                         esac
7938                         ;;
7939                 esac
7940                 ;;
7941         *)      dflt=$libperl
7942                 ;;
7943         esac
7944         cat << EOM
7945
7946 I need to select a good name for the shared libperl.  If your system uses
7947 library names with major and minor numbers, then you might want something
7948 like $majmin.  Alternatively, if your system uses a single version
7949 number for shared libraries, then you might want to use $majonly.
7950 Or, your system might be quite happy with a simple libperl.$so.
7951
7952 Since the shared libperl will get installed into a version-specific
7953 architecture-dependent directory, the version number of the shared perl
7954 library probably isn't important, so the default should be o.k.
7955
7956 EOM
7957         rp='What name do you want to give to the shared libperl?'
7958         . ./myread
7959         libperl=$ans
7960         echo "Ok, I'll use $libperl"
7961         ;;
7962 *)
7963         libperl="libperl${_a}"
7964         ;;
7965 esac
7966
7967 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7968 case "$shrpdir" in
7969 '') ;;
7970 *)      $cat >&4 <<EOM
7971 WARNING:  Use of the shrpdir variable for the installation location of
7972 the shared $libperl is not supported.  It was never documented and
7973 will not work in this version.  Let me (perlbug@perl.org)
7974 know of any problems this may cause.
7975
7976 EOM
7977         case "$shrpdir" in
7978         "$archlibexp/CORE")
7979                 $cat >&4 <<EOM
7980 But your current setting of $shrpdir is
7981 the default anyway, so it's harmless.
7982 EOM
7983                 ;;
7984         *)
7985                 $cat >&4 <<EOM
7986 Further, your current attempted setting of $shrpdir
7987 conflicts with the value of $archlibexp/CORE
7988 that installperl will use.
7989 EOM
7990                 ;;
7991         esac
7992         ;;
7993 esac
7994
7995 # How will the perl executable find the installed shared $libperl?
7996 # Add $xxx to ccdlflags.
7997 # If we can't figure out a command-line option, use $shrpenv to
7998 # set env LD_RUN_PATH.  The main perl makefile uses this.
7999 shrpdir=$archlibexp/CORE
8000 xxx=''
8001 tmp_shrpenv=''
8002 if "$useshrplib"; then
8003     case "$osname" in 
8004         aix)
8005                 # We'll set it in Makefile.SH...
8006                 ;;
8007         solaris)
8008                 xxx="-R $shrpdir"
8009                 ;;
8010         freebsd|netbsd|openbsd)
8011                 xxx="-Wl,-R$shrpdir"
8012                 ;;
8013         bsdos|linux|irix*|dec_osf)
8014                 xxx="-Wl,-rpath,$shrpdir"
8015                 ;;
8016         next)
8017                 # next doesn't like the default...
8018                 ;;
8019         beos)
8020                 # beos doesn't like the default, either.
8021                 ;;
8022         hpux*)
8023                 # hpux doesn't like the default, either.
8024                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8025                 ;;
8026         *)
8027                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8028                 ;;
8029         esac
8030         case "$xxx" in
8031         '') ;;
8032         *)      
8033                 # Only add $xxx if it isn't already in ccdlflags.
8034                 case " $ccdlflags " in
8035                 *" $xxx "*)     ;;
8036                 *)      ccdlflags="$ccdlflags $xxx"
8037                         cat <<EOM >&4
8038
8039 Adding $xxx to the flags
8040 passed to $ld so that the perl executable will find the 
8041 installed shared $libperl.
8042
8043 EOM
8044                         ;;
8045                 esac
8046                 ;;
8047         esac
8048 fi
8049 # Fix ccdlflags in AIX for building external extensions.
8050 # (For building Perl itself bare -bE:perl.exp is needed,
8051 #  Makefile.SH takes care of this.)
8052 case "$osname" in
8053 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8054 esac
8055 # Respect a hint or command-line value.
8056 case "$shrpenv" in
8057 '') shrpenv="$tmp_shrpenv" ;;
8058 esac
8059 case "$ldlibpthname" in
8060 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8061 none)   ldlibpthname='' ;;
8062 esac
8063
8064 : determine where manual pages are on this system
8065 echo " "
8066 case "$sysman" in
8067 '') 
8068         syspath='/usr/share/man/man1 /usr/man/man1'
8069         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8070         syspath="$syspath /usr/man/u_man/man1"
8071         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8072         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8073         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8074         sysman=`./loc . /usr/man/man1 $syspath`
8075         ;;
8076 esac
8077 if $test -d "$sysman"; then
8078         echo "System manual is in $sysman." >&4
8079 else
8080         echo "Could not find manual pages in source form." >&4
8081 fi
8082
8083 : determine where manual pages go
8084 set man1dir man1dir none
8085 eval $prefixit
8086 $cat <<EOM
8087
8088 $spackage has manual pages available in source form.
8089 EOM
8090 case "$nroff" in
8091 nroff)
8092         echo "However, you don't have nroff, so they're probably useless to you."
8093         case "$man1dir" in
8094         '') man1dir="none";;
8095         esac;;
8096 esac
8097 echo "If you don't want the manual sources installed, answer 'none'."
8098 case "$man1dir" in
8099 ' ') dflt=none
8100         ;;
8101 '')
8102         lookpath="$prefixexp/share/man/man1"
8103         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8104         lookpath="$lookpath $prefixexp/man/p_man/man1"
8105         lookpath="$lookpath $prefixexp/man/u_man/man1"
8106         lookpath="$lookpath $prefixexp/man/man.1"
8107         case "$sysman" in
8108         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8109         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8110         esac
8111         set dflt
8112         eval $prefixup
8113         ;;
8114 *)  dflt="$man1dir"
8115         ;;
8116 esac
8117 echo " "
8118 fn=dn+~
8119 rp="Where do the main $spackage manual pages (source) go?"
8120 . ./getfile
8121 if $test "X$man1direxp" != "X$ansexp"; then
8122         installman1dir=''
8123 fi
8124 man1dir="$ans"
8125 man1direxp="$ansexp"
8126 case "$man1dir" in
8127 '')     man1dir=' '
8128         installman1dir='';;
8129 esac
8130
8131 : Change installation prefix, if necessary.
8132 if $test X"$prefix" != X"$installprefix"; then
8133         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8134 else
8135         installman1dir="$man1direxp"
8136 fi
8137
8138 : What suffix to use on installed man pages
8139
8140 case "$man1dir" in
8141 ' ')
8142         man1ext='0'
8143         ;;
8144 *)
8145         rp="What suffix should be used for the main $spackage man pages?"
8146         case "$man1ext" in
8147         '')     case "$man1dir" in
8148                 *1)  dflt=1 ;;
8149                 *1p) dflt=1p ;;
8150                 *1pm) dflt=1pm ;;
8151                 *l) dflt=l;;
8152                 *n) dflt=n;;
8153                 *o) dflt=o;;
8154                 *p) dflt=p;;
8155                 *C) dflt=C;;
8156                 *L) dflt=L;;
8157                 *L1) dflt=L1;;
8158                 *) dflt=1;;
8159                 esac
8160                 ;;
8161         *)      dflt="$man1ext";;
8162         esac
8163         . ./myread
8164         man1ext="$ans"
8165         ;;
8166 esac
8167
8168 : see if we can have long filenames
8169 echo " "
8170 first=123456789abcdef
8171 $rm -f $first
8172 if (echo hi >$first) 2>/dev/null; then
8173         if $test -f 123456789abcde; then
8174                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8175                 val="$undef"
8176         else
8177                 echo 'You can have filenames longer than 14 characters.'>&4
8178                 val="$define"
8179         fi
8180 else
8181         $cat <<'EOM'
8182 You can't have filenames longer than 14 chars.
8183 You can't even think about them!
8184 EOM
8185         val="$undef"
8186 fi 
8187 set d_flexfnam
8188 eval $setvar
8189 $rm -rf 123456789abcde*
8190
8191 : determine where library module manual pages go
8192 set man3dir man3dir none
8193 eval $prefixit
8194 $cat <<EOM
8195
8196 $spackage has manual pages for many of the library modules.
8197 EOM
8198
8199 case "$nroff" in
8200 nroff)
8201         $cat <<'EOM'
8202 However, you don't have nroff, so they're probably useless to you.
8203 EOM
8204         case "$man3dir" in
8205         '') man3dir="none";;
8206         esac;;
8207 esac
8208
8209 case "$d_flexfnam" in
8210 undef)
8211         $cat <<'EOM'
8212 However, your system can't handle the long file names like File::Basename.3. 
8213 EOM
8214         case "$man3dir" in
8215         '') man3dir="none";;
8216         esac;;
8217 esac
8218
8219 echo "If you don't want the manual sources installed, answer 'none'."
8220 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8221 case "$man3dir" in
8222 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8223         if $test -d "$privlib/man/man3"; then
8224                 cat <<EOM >&4
8225
8226 WARNING:  Previous versions of perl installed man3 pages into
8227 $privlib/man/man3.  This version will suggest a 
8228 new default of $dflt.  
8229 EOM
8230                 tdflt=$dflt
8231                 dflt='n'
8232                 rp='Do you wish to preserve the old behavior?(y/n)'
8233                 . ./myread
8234                 case "$ans" in
8235                 y*) dflt="$privlib/man/man3" ;;
8236                 *)  dflt=$tdflt ;;
8237                 esac
8238     fi
8239         ;;
8240 *)      dflt="$man3dir" ;;
8241 esac
8242 case "$dflt" in
8243 ' ') dflt=none ;;
8244 esac
8245 echo " "
8246 fn=dn+~
8247 rp="Where do the $package library man pages (source) go?"
8248 . ./getfile
8249 man3dir="$ans"
8250 man3direxp="$ansexp"
8251 case "$man3dir" in
8252 '')     man3dir=' '
8253         installman3dir='';;
8254 esac
8255
8256 : Change installation prefix, if necessary.
8257 if $test X"$prefix" != X"$installprefix"; then
8258         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8259 else
8260         installman3dir="$man3direxp"
8261 fi
8262
8263 : What suffix to use on installed man pages
8264 case "$man3dir" in
8265 ' ')
8266         man3ext='0'
8267         ;;
8268 *)
8269         rp="What suffix should be used for the $package library man pages?"
8270         case "$man3ext" in
8271         '')     case "$man3dir" in
8272                 *3)  dflt=3 ;;
8273                 *3p) dflt=3p ;;
8274                 *3pm) dflt=3pm ;;
8275                 *l) dflt=l;;
8276                 *n) dflt=n;;
8277                 *o) dflt=o;;
8278                 *p) dflt=p;;
8279                 *C) dflt=C;;
8280                 *L) dflt=L;;
8281                 *L3) dflt=L3;;
8282                 *) dflt=3;;
8283                 esac
8284                 ;;
8285         *)      dflt="$man3ext";;
8286         esac
8287         . ./myread
8288         man3ext="$ans"
8289         ;;
8290 esac
8291
8292 : see if we have to deal with yellow pages, now NIS.
8293 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8294         if $test -f /usr/etc/nibindd; then
8295                 echo " "
8296                 echo "I'm fairly confident you're on a NeXT."
8297                 echo " "
8298                 rp='Do you get the hosts file via NetInfo?'
8299                 dflt=y
8300                 case "$hostcat" in
8301                 nidump*) ;;
8302                 '') ;;
8303                 *) dflt=n;;
8304                 esac
8305                 . ./myread
8306                 case "$ans" in
8307                 y*) hostcat='nidump hosts .';;
8308                 *)      case "$hostcat" in
8309                         nidump*) hostcat='';;
8310                         esac
8311                         ;;
8312                 esac
8313         fi
8314         case "$hostcat" in
8315         nidump*) ;;
8316         *)
8317                 case "$hostcat" in
8318                 *ypcat*) dflt=y;;
8319                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8320                                 dflt=y
8321                         else
8322                                 dflt=n
8323                         fi;;
8324                 *) dflt=n;;
8325                 esac
8326                 echo " "
8327                 rp='Are you getting the hosts file via yellow pages?'
8328                 . ./myread
8329                 case "$ans" in
8330                 y*) hostcat='ypcat hosts';;
8331                 *) hostcat='cat /etc/hosts';;
8332                 esac
8333                 ;;
8334         esac
8335 fi
8336 case "$hostcat" in
8337 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8338 esac
8339 case "$groupcat" in
8340 '') test -f /etc/group && groupcat='cat /etc/group';;
8341 esac
8342 case "$passcat" in
8343 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8344 esac
8345
8346 : now get the host name
8347 echo " "
8348 echo "Figuring out host name..." >&4
8349 case "$myhostname" in
8350 '') cont=true
8351         echo 'Maybe "hostname" will work...'
8352         if tans=`sh -c hostname 2>&1` ; then
8353                 myhostname=$tans
8354                 phostname=hostname
8355                 cont=''
8356         fi
8357         ;;
8358 *) cont='';;
8359 esac
8360 if $test "$cont"; then
8361         if ./xenix; then
8362                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8363                 if tans=`cat /etc/systemid 2>&1` ; then
8364                         myhostname=$tans
8365                         phostname='cat /etc/systemid'
8366                         echo "Whadyaknow.  Xenix always was a bit strange..."
8367                         cont=''
8368                 fi
8369         elif $test -r /etc/systemid; then
8370                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8371         fi
8372 fi
8373 if $test "$cont"; then
8374         echo 'No, maybe "uuname -l" will work...'
8375         if tans=`sh -c 'uuname -l' 2>&1` ; then
8376                 myhostname=$tans
8377                 phostname='uuname -l'
8378         else
8379                 echo 'Strange.  Maybe "uname -n" will work...'
8380                 if tans=`sh -c 'uname -n' 2>&1` ; then
8381                         myhostname=$tans
8382                         phostname='uname -n'
8383                 else
8384                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8385                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8386                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8387                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8388                         else
8389                                 case "$myhostname" in
8390                                 '') echo "Does this machine have an identity crisis or something?"
8391                                         phostname='';;
8392                                 *)
8393                                         echo "Well, you said $myhostname before..."
8394                                         phostname='echo $myhostname';;
8395                                 esac
8396                         fi
8397                 fi
8398         fi
8399 fi
8400 case "$myhostname" in
8401 '') myhostname=noname ;;
8402 esac
8403 : you do not want to know about this
8404 set $myhostname
8405 myhostname=$1
8406
8407 : verify guess
8408 if $test "$myhostname" ; then
8409         dflt=y
8410         rp='Your host name appears to be "'$myhostname'".'" Right?"
8411         . ./myread
8412         case "$ans" in
8413         y*) ;;
8414         *) myhostname='';;
8415         esac
8416 fi
8417
8418 : bad guess or no guess
8419 while $test "X$myhostname" = X ; do
8420         dflt=''
8421         rp="Please type the (one word) name of your host:"
8422         . ./myread
8423         myhostname="$ans"
8424 done
8425
8426 : translate upper to lower if necessary
8427 case "$myhostname" in
8428 *[A-Z]*)
8429         echo "(Normalizing case in your host name)"
8430         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8431         ;;
8432 esac
8433
8434 case "$myhostname" in
8435 *.*)
8436         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8437         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8438         echo "(Trimming domain name from host name--host name is now $myhostname)"
8439         ;;
8440 *) case "$mydomain" in
8441         '')
8442                 {
8443                         test "X$hostcat" = "Xypcat hosts" &&
8444                         ypmatch "$myhostname" hosts 2>/dev/null |\
8445                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8446                         $test -s hosts
8447                 } || {
8448                         test "X$hostcat" != "X" &&
8449                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8450                                         /[       ]$myhostname[  . ]/p" > hosts
8451                 }
8452                 tmp_re="[       . ]"
8453                 if $test -f hosts; then
8454                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8455                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8456                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8457                                 hosts | $sort | $uniq | \
8458                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8459                         case `$echo X$dflt` in
8460                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8461                                 dflt=.
8462                                 ;;
8463                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8464                                 ;;
8465                         esac
8466                 else
8467                         echo "(I cannot locate a hosts database anywhere)"
8468                         dflt=.
8469                 fi
8470                 case "$dflt" in
8471                 .)
8472                         tans=`./loc resolv.conf X /etc /usr/etc`
8473                         if $test -f "$tans"; then
8474                                 echo "(Attempting domain name extraction from $tans)"
8475                                 dflt=.`$sed -n -e 's/   / /g' \
8476                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8477                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8478                                 case "$dflt" in
8479                                 .) dflt=.`$sed -n -e 's/        / /g' \
8480                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8481                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8482                                         ;;
8483                                 esac
8484                         fi
8485                         ;;
8486                 esac
8487                 case "$dflt" in
8488                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8489                         dflt=.`sh -c domainname 2>/dev/null`
8490                         case "$dflt" in
8491                         '') dflt='.';;
8492                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8493                         esac
8494                         ;;
8495                 esac
8496                 case "$dflt$osname" in
8497                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8498                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8499                         ;;
8500                 esac
8501                 case "$dflt" in
8502                 .) echo "(Lost all hope -- silly guess then)"
8503                         dflt='.nonet'
8504                         ;;
8505                 esac
8506                 $rm -f hosts
8507                 ;;
8508         *) dflt="$mydomain";;
8509         esac;;
8510 esac
8511 echo " "
8512 rp="What is your domain name?"
8513 . ./myread
8514 tans="$ans"
8515 case "$ans" in
8516 '') ;;
8517 .*) ;;
8518 *) tans=".$tans";;
8519 esac
8520 mydomain="$tans"
8521
8522 : translate upper to lower if necessary
8523 case "$mydomain" in
8524 *[A-Z]*)
8525         echo "(Normalizing case in your domain name)"
8526         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8527         ;;
8528 esac
8529
8530 : a little sanity check here
8531 case "$phostname" in
8532 '') ;;
8533 *)
8534         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8535         $myhostname$mydomain|$myhostname) ;;
8536         *)
8537                 case "$phostname" in
8538                 sed*)
8539                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8540                         ;;
8541                 *)
8542                         echo "(That doesn't agree with your $phostname command, by the way.)"
8543                         ;;
8544                 esac
8545         ;;
8546         esac
8547         ;;
8548 esac
8549
8550 $cat <<EOM
8551
8552 I need to get your e-mail address in Internet format if possible, i.e.
8553 something like user@host.domain. Please answer accurately since I have
8554 no easy means to double check it. The default value provided below
8555 is most probably close to reality but may not be valid from outside
8556 your organization...
8557
8558 EOM
8559 cont=x
8560 while test "$cont"; do
8561         case "$cf_email" in
8562         '') dflt="$cf_by@$myhostname$mydomain";;
8563         *) dflt="$cf_email";;
8564         esac
8565         rp='What is your e-mail address?'
8566         . ./myread
8567         cf_email="$ans"
8568         case "$cf_email" in
8569         *@*.*) cont='' ;;
8570         *)
8571                 rp='Address does not look like an Internet one.  Use it anyway?'
8572                 case "$fastread" in
8573                 yes) dflt=y ;;
8574                 *) dflt=n ;;
8575                 esac
8576                 . ./myread
8577                 case "$ans" in
8578                 y*) cont='' ;;
8579                 *) echo " " ;;
8580                 esac
8581                 ;;
8582         esac
8583 done
8584
8585 $cat <<EOM
8586
8587 If you or somebody else will be maintaining perl at your site, please
8588 fill in the correct e-mail address here so that they may be contacted
8589 if necessary. Currently, the "perlbug" program included with perl
8590 will send mail to this address in addition to perlbug@perl.org. You may
8591 enter "none" for no administrator.
8592
8593 EOM
8594 case "$perladmin" in
8595 '') dflt="$cf_email";;
8596 *) dflt="$perladmin";;
8597 esac
8598 rp='Perl administrator e-mail address'
8599 . ./myread
8600 perladmin="$ans"
8601
8602 : determine whether to only install version-specific parts.
8603 echo " "
8604 $cat <<EOM
8605 Do you want to install only the version-specific parts of the perl
8606 distribution?  Usually you do *not* want to do this.
8607 EOM
8608 case "$versiononly" in
8609 "$define"|[Yy]*|true) dflt='y' ;;
8610 *) dflt='n';
8611 esac
8612 rp="Do you want to install only the version-specific parts of perl?"
8613 . ./myread
8614 case "$ans" in
8615 [yY]*)  val="$define";;
8616 *)      val="$undef" ;;
8617 esac
8618 set versiononly
8619 eval $setvar
8620
8621 case "$versiononly" in
8622 "$define") inc_version_list=''
8623            inc_version_list_init=0
8624            ;;
8625 esac
8626
8627 : figure out how to guarantee perl startup
8628 case "$startperl" in
8629 '')
8630         case "$sharpbang" in
8631         *!)
8632                 $cat <<EOH
8633
8634 I can use the #! construct to start perl on your system. This will
8635 make startup of perl scripts faster, but may cause problems if you
8636 want to share those scripts and perl is not in a standard place
8637 ($binexp/perl) on all your platforms. The alternative is to force
8638 a shell by starting the script with a single ':' character.
8639
8640 EOH
8641                 case "$versiononly" in
8642                 "$define")      dflt="$binexp/perl$version";;  
8643                 *)              dflt="$binexp/perl";;
8644                 esac
8645                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8646                 . ./myread
8647                 case "$ans" in
8648                 none)   startperl=": # use perl";;
8649                 *)      startperl="#!$ans"
8650                         if $test 30 -lt `echo "$ans" | wc -c`; then
8651                                 $cat >&4 <<EOM
8652
8653 WARNING:  Some systems limit the #! command to 32 characters.
8654 If you experience difficulty running Perl scripts with #!, try
8655 installing Perl in a directory with a shorter pathname.
8656
8657 EOM
8658                         fi ;;
8659                 esac
8660                 ;;
8661         *) startperl=": # use perl"
8662                 ;;
8663         esac
8664         ;;
8665 esac
8666 echo "I'll use $startperl to start perl scripts."
8667
8668 : figure best path for perl in scripts
8669 case "$perlpath" in
8670 '')
8671         case "$versiononly" in
8672         "$define")      perlpath="$binexp/perl$version";;
8673         *)              perlpath="$binexp/perl";;
8674         esac
8675         case "$startperl" in
8676         *!*) ;;
8677         *)
8678                 $cat <<EOH
8679
8680 I will use the "eval 'exec'" idiom to start Perl on your system.
8681 I can use the full path of your Perl binary for this purpose, but
8682 doing so may cause problems if you want to share those scripts and
8683 Perl is not always in a standard place ($binexp/perl).
8684
8685 EOH
8686                 dflt="$binexp/perl"
8687                 rp="What path shall I use in \"eval 'exec'\"?"
8688                 . ./myread
8689                 perlpath="$ans"
8690                 ;;
8691         esac
8692         ;;
8693 esac
8694 case "$startperl" in
8695 *!*)    ;;
8696 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8697 esac
8698
8699 : determine where public executable scripts go
8700 set scriptdir scriptdir
8701 eval $prefixit
8702 case "$scriptdir" in
8703 '')
8704         dflt="$bin"
8705         : guess some guesses
8706         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8707         $test -d /usr/share/bin     && dflt=/usr/share/bin
8708         $test -d /usr/local/script  && dflt=/usr/local/script
8709         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8710         $test -d $prefixexp/script  && dflt=$prefixexp/script
8711         set dflt
8712         eval $prefixup
8713         ;;
8714 *)  dflt="$scriptdir"
8715         ;;
8716 esac
8717 $cat <<EOM
8718  
8719 Some installations have a separate directory just for executable scripts so
8720 that they can mount it across multiple architectures but keep the scripts in
8721 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8722 Or you might just lump your scripts in with all your other executables.
8723  
8724 EOM
8725 fn=d~
8726 rp='Where do you keep publicly executable scripts?'
8727 . ./getfile
8728 if $test "X$ansexp" != "X$scriptdirexp"; then
8729         installscript=''
8730 fi
8731 scriptdir="$ans"
8732 scriptdirexp="$ansexp"
8733 : Change installation prefix, if necessary.
8734 if $test X"$prefix" != X"$installprefix"; then
8735         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8736 else
8737         installscript="$scriptdirexp"
8738 fi
8739
8740 : determine where add-on public executables go
8741 case "$sitebin" in
8742 '')     dflt=$siteprefix/bin ;;
8743 *)      dflt=$sitebin ;;
8744 esac
8745 fn=d~
8746 rp='Pathname where the add-on public executables should be installed?'
8747 . ./getfile
8748 sitebin="$ans"
8749 sitebinexp="$ansexp"
8750 : Change installation prefix, if necessary.
8751 if $test X"$prefix" != X"$installprefix"; then
8752         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8753 else
8754         installsitebin="$sitebinexp"
8755 fi
8756
8757 : determine where add-on html pages go
8758 : There is no standard location, so try to copy the previously-selected 
8759 : directory structure for the core html pages.
8760 case "$sitehtml1" in
8761 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8762 *)      dflt=$sitehtml1 ;;
8763 esac
8764 case "$dflt" in
8765 ''|' ') dflt=none ;;
8766 esac
8767 fn=dn+~
8768 rp='Pathname where the site-specific html pages should be installed?'
8769 . ./getfile
8770 sitehtml1="$ans"
8771 sitehtml1exp="$ansexp"
8772 : Use ' ' for none so value is preserved next time through Configure
8773 $test X"$sitehtml1" = "X" && sitehtml1=' '
8774 : Change installation prefix, if necessary.
8775 if $test X"$prefix" != X"$installprefix"; then
8776         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8777 else
8778         installsitehtml1="$sitehtml1exp"
8779 fi
8780
8781 : determine where add-on library html pages go
8782 : There is no standard location, so try to copy the previously-selected
8783 : directory structure for the core html pages.
8784 case "$sitehtml3" in
8785 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8786 *)      dflt=$sitehtml3 ;;
8787 esac
8788 case "$dflt" in
8789 ''|' ') dflt=none ;;
8790 esac
8791 fn=dn+~
8792 rp='Pathname where the site-specific library html pages should be installed?'
8793 . ./getfile
8794 sitehtml3="$ans"
8795 sitehtml3exp="$ansexp"
8796 : Use ' ' for none so value is preserved next time through Configure
8797 $test X"$sitehtml3" = "X" && sitehtml3=' '
8798 : Change installation prefix, if necessary.
8799 if $test X"$prefix" != X"$installprefix"; then
8800         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8801 else
8802         installsitehtml3="$sitehtml3exp"
8803 fi
8804
8805 : determine where add-on manual pages go
8806 case "$siteman1" in
8807 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8808 *)      dflt=$siteman1 ;;
8809 esac
8810 case "$dflt" in
8811 ''|' ') dflt=none ;;
8812 esac
8813 fn=dn+~
8814 rp='Pathname where the site-specific manual pages should be installed?'
8815 . ./getfile
8816 siteman1="$ans"
8817 siteman1exp="$ansexp"
8818 : Use ' ' for none so value is preserved next time through Configure
8819 $test X"$siteman1" = "X" && siteman1=' '
8820 : Change installation prefix, if necessary.
8821 if $test X"$prefix" != X"$installprefix"; then
8822         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8823 else
8824         installsiteman1="$siteman1exp"
8825 fi
8826
8827 : determine where add-on library man pages go
8828 case "$siteman3" in
8829 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8830 *)      dflt=$siteman3 ;;
8831 esac
8832 case "$dflt" in
8833 ''|' ') dflt=none ;;
8834 esac
8835 fn=dn+~
8836 rp='Pathname where the site-specific library manual pages should be installed?'
8837 . ./getfile
8838 siteman3="$ans"
8839 siteman3exp="$ansexp"
8840 : Use ' ' for none so value is preserved next time through Configure
8841 $test X"$siteman3" = "X" && siteman3=' '
8842 : Change installation prefix, if necessary.
8843 if $test X"$prefix" != X"$installprefix"; then
8844         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8845 else
8846         installsiteman3="$siteman3exp"
8847 fi
8848
8849 : determine where add-on public executable scripts go
8850 case "$sitescript" in
8851 '')     dflt=$siteprefix/script
8852         $test -d $dflt || dflt=$sitebin ;;
8853 *)  dflt="$sitescript" ;;
8854 esac
8855 fn=d~+
8856 rp='Pathname where add-on public executable scripts should be installed?'
8857 . ./getfile
8858 sitescript="$ans"
8859 sitescriptexp="$ansexp"
8860 : Change installation prefix, if necessary.
8861 if $test X"$prefix" != X"$installprefix"; then
8862         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8863 else
8864         installsitescript="$sitescriptexp"
8865 fi
8866
8867 : define an is-a-typedef? function
8868 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8869 case "$inclist" in
8870 "") inclist="sys/types.h";;
8871 esac;
8872 eval "varval=\$$var";
8873 case "$varval" in
8874 "")
8875         $rm -f temp.c;
8876         for inc in $inclist; do
8877                 echo "#include <$inc>" >>temp.c;
8878         done;
8879         echo "#ifdef $type" >> temp.c;
8880         echo "printf(\"We have $type\");" >> temp.c;
8881         echo "#endif" >> temp.c;
8882         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8883         if $contains $type temp.E >/dev/null 2>&1; then
8884                 eval "$var=\$type";
8885         else
8886                 eval "$var=\$def";
8887         fi;
8888         $rm -f temp.?;;
8889 *) eval "$var=\$varval";;
8890 esac'
8891
8892 : define an is-a-typedef? function that prompts if the type is not available.
8893 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8894 case "$inclist" in
8895 "") inclist="sys/types.h";;
8896 esac;
8897 eval "varval=\$$var";
8898 case "$varval" in
8899 "")
8900         $rm -f temp.c;
8901         for inc in $inclist; do
8902                 echo "#include <$inc>" >>temp.c;
8903         done;
8904         echo "#ifdef $type" >> temp.c;
8905         echo "printf(\"We have $type\");" >> temp.c;
8906         echo "#endif" >> temp.c;
8907         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8908         echo " " ;
8909         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8910         if $contains $type temp.E >/dev/null 2>&1; then
8911                 echo "$type found." >&4;
8912                 eval "$var=\$type";
8913         else
8914                 echo "$type NOT found." >&4;
8915                 dflt="$def";
8916                 . ./myread ;
8917                 eval "$var=\$ans";
8918         fi;
8919         $rm -f temp.?;;
8920 *) eval "$var=\$varval";;
8921 esac'
8922
8923 : see what type lseek is declared as in the kernel
8924 rp="What is the type used for lseek's offset on this system?"
8925 set off_t lseektype long stdio.h sys/types.h
8926 eval $typedef_ask
8927
8928 echo " "
8929 echo "Checking to see how big your file offsets are..." >&4
8930 $cat >try.c <<EOCP
8931 #include <sys/types.h>
8932 #include <stdio.h>
8933 int main()
8934 {
8935     printf("%d\n", (int)sizeof($lseektype));
8936     return(0); 
8937 }
8938 EOCP
8939 set try
8940 if eval $compile_ok; then
8941         lseeksize=`$run ./try`
8942         echo "Your file offsets are $lseeksize bytes long."
8943 else
8944         dflt=$longsize
8945         echo " "
8946         echo "(I can't seem to compile the test program.  Guessing...)"
8947         rp="What is the size of your file offsets (in bytes)?"
8948         . ./myread
8949         lseeksize="$ans"
8950 fi
8951 $rm -f try.c try
8952
8953 : see what type file positions are declared as in the library
8954 rp="What is the type for file position used by fsetpos()?"
8955 set fpos_t fpostype long stdio.h sys/types.h
8956 eval $typedef_ask
8957
8958 echo " "
8959 case "$fpostype" in
8960 *_t) zzz="$fpostype"    ;;
8961 *)   zzz="fpos_t"       ;;
8962 esac
8963 echo "Checking the size of $zzz..." >&4 
8964 cat > try.c <<EOCP
8965 #include <sys/types.h>
8966 #include <stdio.h>
8967 #$i_stdlib I_STDLIB
8968 #ifdef I_STDLIB
8969 #include <stdlib.h>
8970 #endif
8971 int main() {
8972     printf("%d\n", (int)sizeof($fpostype));
8973     exit(0);
8974 }
8975 EOCP
8976 set try
8977 if eval $compile_ok; then
8978         yyy=`$run ./try`
8979         case "$yyy" in
8980         '')     fpossize=4
8981                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8982                 ;;
8983         *)      fpossize=$yyy
8984                 echo "Your $zzz is $fpossize bytes long."
8985                 ;;
8986         esac
8987 else
8988         dflt="$longsize"
8989         echo " " >&4
8990         echo "(I can't compile the test program.  Guessing...)" >&4
8991         rp="What is the size of your file positions (in bytes)?"
8992         . ./myread
8993         fpossize="$ans"
8994 fi
8995
8996
8997
8998 # Backward compatibility (uselfs is deprecated).
8999 case "$uselfs" in
9000 "$define"|true|[yY]*)
9001         cat <<EOM >&4
9002
9003 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9004 EOM
9005         uselargefiles="$define"
9006         ;;
9007 esac                          
9008
9009 case "$lseeksize:$fpossize" in
9010 8:8) cat <<EOM
9011
9012 You can have files larger than 2 gigabytes.
9013 EOM
9014    val="$define" ;;
9015 *)    case "$uselargefiles" in
9016    "$undef"|false|[nN]*) dflt='n' ;;
9017    *)   dflt='y' ;;
9018    esac
9019    cat <<EOM
9020
9021 Perl can be built to understand large files (files larger than 2 gigabytes)
9022 on some systems.  To do so, Configure can be run with -Duselargefiles.
9023
9024 If this doesn't make any sense to you, just accept the default '$dflt'.
9025 EOM
9026    rp='Try to understand large files, if available?'
9027    . ./myread
9028    case "$ans" in
9029    y|Y)         val="$define" ;;
9030    *)           val="$undef"  ;;
9031    esac
9032    ;;
9033 esac
9034 set uselargefiles
9035 eval $setvar
9036 case "$uselargefiles" in
9037 "$define")
9038 : Look for a hint-file generated 'call-back-unit'.  If the
9039 : user has specified that a large files perl is to be built,
9040 : we may need to set or change some other defaults.
9041         if $test -f uselargefiles.cbu; then
9042                 echo "Your platform has some specific hints for large file builds, using them..."
9043                 . ./uselargefiles.cbu
9044                 echo " "
9045                 echo "Rechecking to see how big your file offsets are..." >&4
9046                 $cat >try.c <<EOCP
9047 #include <sys/types.h>
9048 #include <stdio.h>
9049 int main()
9050 {
9051     printf("%d\n", (int)sizeof($lseektype));
9052     return(0); 
9053 }
9054 EOCP
9055                 set try
9056                 if eval $compile_ok; then
9057                         lseeksize=`$run ./try`
9058                         $echo "Your file offsets are now $lseeksize bytes long."
9059                 else
9060                         dflt="$lseeksize"
9061                         echo " "
9062                         echo "(I can't seem to compile the test program.  Guessing...)"
9063                         rp="What is the size of your file offsets (in bytes)?"
9064                         . ./myread
9065                         lseeksize="$ans"
9066                 fi
9067                 case "$fpostype" in
9068                 *_t) zzz="$fpostype"    ;;
9069                 *)   zzz="fpos_t"       ;;
9070                 esac
9071                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9072                 $cat > try.c <<EOCP
9073 #include <sys/types.h>
9074 #include <stdio.h>
9075 int main() {
9076     printf("%d\n", (int)sizeof($fpostype));
9077     return(0);
9078 }
9079 EOCP
9080                 set try
9081                 if eval $compile_ok; then
9082                         yyy=`$run ./try`
9083                         dflt="$lseeksize"
9084                         case "$yyy" in
9085                         '')     echo " "
9086                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9087                                 ;;
9088                         *)      fpossize=$yyy
9089                                 echo " $fpossize bytes." >&4
9090                                 ;;
9091                         esac
9092                 else
9093                         dflt="$fpossize"
9094                         echo " "
9095                         echo "(I can't compile the test program.  Guessing...)" >&4
9096                         rp="What is the size of your file positions (in bytes)?"
9097                         . ./myread
9098                         fpossize="$ans"
9099                 fi
9100                 $rm -f try.c try
9101         fi
9102         ;;
9103 esac
9104
9105 case "$vendorprefix" in
9106 '')     d_vendorbin="$undef"
9107         vendorbin=''
9108         vendorbinexp=''
9109         ;;
9110 *)      d_vendorbin="$define"
9111         : determine where vendor-supplied executables go.
9112         case "$vendorbin" in
9113         '') dflt=$vendorprefix/bin ;;
9114         *)      dflt="$vendorbin" ;;
9115         esac
9116         fn=d~+
9117         rp='Pathname for the vendor-supplied executables directory?'
9118         . ./getfile
9119         vendorbin="$ans"
9120         vendorbinexp="$ansexp"
9121         ;;
9122 esac
9123 : Change installation prefix, if necessary.
9124 if $test X"$prefix" != X"$installprefix"; then
9125         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9126 else
9127         installvendorbin="$vendorbinexp"
9128 fi
9129
9130 case "$vendorprefix" in
9131 '')     vendorhtml1=''
9132         vendorhtml1exp=''
9133         ;;
9134 *)      : determine where vendor-supplied html pages go.
9135         : There is no standard location, so try to copy the previously-selected
9136         : directory structure for the core html pages.
9137         : XXX Better default suggestions would be welcome.
9138         case "$vendorhtml1" in
9139         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9140         *)      dflt=$vendorhtml1 ;;
9141         esac
9142         case "$dflt" in
9143         ''|' ') dflt=none ;;
9144         esac
9145         fn=dn+~
9146         rp='Pathname for the vendor-supplied html pages?'
9147         . ./getfile
9148         vendorhtml1="$ans"
9149         vendorhtml1exp="$ansexp"
9150         ;;
9151 esac
9152 : Use ' ' for none so value is preserved next time through Configure
9153 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
9154 : Change installation prefix, if necessary.
9155 if $test X"$prefix" != X"$installprefix"; then
9156         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
9157 else
9158         installvendorhtml1="$vendorhtml1exp"
9159 fi
9160
9161 case "$vendorprefix" in
9162 '')     vendorhtml3=''
9163         vendorhtml3exp=''
9164         ;;
9165 *)      : determine where vendor-supplied module html pages go.
9166         : There is no standard location, so try to copy the previously-selected
9167         : directory structure for the core html pages.
9168         : XXX Better default suggestions would be welcome.
9169         case "$vendorhtml3" in
9170         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9171         *)      dflt=$vendorhtml3 ;;
9172         esac
9173         case "$dflt" in
9174         ''|' ') dflt=none ;;
9175         esac
9176         fn=dn+~
9177         rp='Pathname for the vendor-supplied html pages?'
9178         . ./getfile
9179         vendorhtml3="$ans"
9180         vendorhtml3exp="$ansexp"
9181         ;;
9182 esac
9183 : Use ' ' for none so value is preserved next time through Configure
9184 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
9185 : Change installation prefix, if necessary.
9186 if $test X"$prefix" != X"$installprefix"; then
9187         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9188 else
9189         installvendorhtml3="$vendorhtml3exp"
9190 fi
9191
9192 case "$vendorprefix" in
9193 '')     vendorman1=''
9194         vendorman1exp=''
9195         ;;
9196 *)      : determine where vendor-supplied manual pages go.
9197         case "$vendorman1" in
9198         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9199         *)      dflt=$vendorman1 ;;
9200         esac
9201         case "$dflt" in
9202         ''|' ') dflt=none ;;
9203         esac
9204         fn=nd~+
9205         rp='Pathname for the vendor-supplied manual section 1 pages?'
9206         . ./getfile
9207         vendorman1="$ans"
9208         vendorman1exp="$ansexp"
9209         ;;
9210 esac
9211 : Use ' ' for none so value is preserved next time through Configure
9212 $test X"$vendorman1" = "X" && vendorman1=' '
9213 : Change installation prefix, if necessary.
9214 if $test X"$prefix" != X"$installprefix"; then
9215         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9216 else
9217         installvendorman1="$vendorman1exp"
9218 fi
9219
9220 case "$vendorprefix" in
9221 '')     vendorman3=''
9222         vendorman3exp=''
9223         ;;
9224 *)      : determine where vendor-supplied module manual pages go.
9225         case "$vendorman3" in
9226         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9227         *)      dflt=$vendorman3 ;;
9228         esac
9229         case "$dflt" in
9230         ''|' ') dflt=none ;;
9231         esac
9232         fn=nd~+
9233         rp='Pathname for the vendor-supplied manual section 3 pages?'
9234         . ./getfile
9235         vendorman3="$ans"
9236         vendorman3exp="$ansexp"
9237         ;;
9238 esac
9239 : Use ' ' for none so value is preserved next time through Configure
9240 $test X"$vendorman3" = "X" && vendorman3=' '
9241 : Change installation prefix, if necessary.
9242 if $test X"$prefix" != X"$installprefix"; then
9243         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9244 else
9245         installvendorman3="$vendorman3exp"
9246 fi
9247
9248 case "$vendorprefix" in
9249 '')     d_vendorscript="$undef"
9250         vendorscript=''
9251         vendorscriptexp=''
9252         ;;
9253 *)      d_vendorscript="$define"
9254         : determine where vendor-supplied scripts go.
9255         case "$vendorscript" in
9256         '')     dflt=$vendorprefix/script
9257                 $test -d $dflt || dflt=$vendorbin ;;
9258         *)  dflt="$vendorscript" ;;
9259         esac
9260         $cat <<EOM
9261
9262 The installation process will create a directory for 
9263 vendor-supplied scripts.
9264
9265 EOM
9266         fn=d~+
9267         rp='Pathname for the vendor-supplied scripts directory?'
9268         . ./getfile
9269         vendorscript="$ans"
9270         vendorscriptexp="$ansexp"
9271         ;;
9272 esac
9273 : Change installation prefix, if necessary.
9274 if $test X"$prefix" != X"$installprefix"; then
9275         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9276 else
9277         installvendorscript="$vendorscriptexp"
9278 fi
9279
9280 : see if qgcvt exists
9281 set qgcvt d_qgcvt
9282 eval $inlibc
9283
9284 : Check how to convert floats to strings.
9285
9286 if test "X$d_Gconvert" = X; then
9287
9288 echo " "
9289 echo "Checking for an efficient way to convert floats to strings."
9290 echo " " > try.c
9291 case "$uselongdouble" in
9292 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9293 esac
9294 case "$d_longdbl" in
9295 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9296 esac
9297 case "$d_PRIgldbl" in
9298 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9299 esac
9300 $cat >>try.c <<EOP
9301 #ifdef TRY_gconvert
9302 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9303 char *myname = "gconvert";
9304 #endif
9305 #ifdef TRY_gcvt
9306 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9307 char *myname = "gcvt";
9308 #endif
9309 #ifdef TRY_qgcvt
9310 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9311 char *myname = "qgcvt";
9312 #define DOUBLETYPE long double
9313 #endif
9314 #ifdef TRY_sprintf
9315 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9316 #ifdef HAS_PRIgldbl
9317 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9318 #else
9319 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9320 #endif
9321 #else
9322 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9323 #endif
9324 char *myname = "sprintf";
9325 #endif
9326
9327 #ifndef DOUBLETYPE
9328 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9329 #define DOUBLETYPE long double
9330 #else
9331 #define DOUBLETYPE double
9332 #endif
9333 #endif
9334
9335 #include <stdio.h>
9336
9337 #define I_STDLIB $i_stdlib
9338 #ifdef I_STDLIB
9339 #include <stdlib.h>
9340 #endif
9341
9342 int
9343 checkit(expect, got)
9344 char *expect;
9345 char *got;
9346 {
9347     if (strcmp(expect, got)) {
9348                 printf("%s oddity:  Expected %s, got %s\n",
9349                         myname, expect, got);
9350                 exit(1);
9351         }
9352 }
9353
9354 int main()
9355
9356         char buf[64]; 
9357         buf[63] = '\0';
9358
9359         /* This must be 1st test on (which?) platform */
9360         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9361         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9362         checkit("0.1", buf);
9363
9364         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9365         checkit("0.01", buf);
9366
9367         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9368         checkit("0.001", buf);
9369
9370         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9371         checkit("0.0001", buf);
9372
9373         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9374         if (strlen(buf) > 5)
9375             checkit("9e-005", buf); /* for Microsoft ?? */
9376         else
9377             checkit("9e-05", buf);
9378
9379         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9380         checkit("1", buf);
9381
9382         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9383         checkit("1.1", buf);
9384
9385         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9386         checkit("1.01", buf);
9387
9388         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9389         checkit("1.001", buf);
9390
9391         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9392         checkit("1.0001", buf);
9393
9394         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9395         checkit("1.00001", buf);
9396
9397         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9398         checkit("1.000001", buf);
9399
9400         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9401         checkit("0", buf);
9402
9403         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9404         checkit("-1", buf);
9405
9406         /* Some Linux gcvt's give 1.e+5 here. */
9407         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9408         checkit("100000", buf);
9409         
9410         /* Some Linux gcvt's give -1.e+5 here. */
9411         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9412         checkit("-100000", buf);
9413
9414         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9415         checkit("123.456", buf);
9416
9417         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9418         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9419         /* 34 should be enough to scare even long double
9420          * places into using the e notation. */
9421         if (strlen(buf) > 5)
9422             checkit("1e+034", buf); /* for Microsoft */
9423         else
9424             checkit("1e+34", buf);
9425
9426         /* For Perl, if you add additional tests here, also add them to
9427          * t/base/num.t for benefit of platforms not using Configure or
9428          * overriding d_Gconvert */
9429
9430         exit(0);
9431 }
9432 EOP
9433 : first add preferred functions to our list
9434 xxx_list=""
9435 for xxx_convert in $gconvert_preference; do
9436     case $xxx_convert in
9437     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9438     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9439     esac 
9440 done
9441 : then add any others
9442 for xxx_convert in gconvert gcvt sprintf; do
9443     case "$xxx_list" in
9444     *$xxx_convert*) ;;
9445     *) xxx_list="$xxx_list $xxx_convert" ;;
9446     esac 
9447 done
9448
9449 case "$d_longdbl$uselongdouble" in
9450 "$define$define")
9451     : again, add prefered functions to our list first
9452     xxx_ld_list=""
9453     for xxx_convert in $gconvert_ld_preference; do
9454         case $xxx_convert in
9455         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9456         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9457         esac
9458     done
9459     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9460     for xxx_convert in qgcvt sprintf $xxx_list; do
9461         case "$xxx_ld_list" in
9462         $xxx_convert*|*" $xxx_convert"*) ;;
9463         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9464         esac
9465     done
9466     : if sprintf cannot do long doubles, move it to the end
9467     if test "$d_PRIgldbl" != "$define"; then
9468         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9469     fi
9470     : if no qgcvt, remove it
9471     if test "$d_qgcvt" != "$define"; then
9472         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9473     fi
9474     : use the ld_list
9475     xxx_list="$xxx_ld_list"
9476     ;;
9477 esac
9478
9479 for xxx_convert in $xxx_list; do
9480         echo "Trying $xxx_convert..."
9481         $rm -f try try$_o
9482         set try -DTRY_$xxx_convert
9483         if eval $compile; then
9484                 echo "$xxx_convert() found." >&4
9485                 if $run ./try; then
9486                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9487                         break;
9488                 else
9489                         echo "...But $xxx_convert didn't work as I expected."
9490                         xxx_convert=''
9491                 fi
9492         else
9493                 echo "$xxx_convert NOT found." >&4
9494         fi
9495 done
9496
9497 if test X$xxx_convert = X; then
9498     echo "*** WHOA THERE!!! ***" >&4
9499     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9500     xxx_convert=sprintf
9501 fi
9502
9503 case "$xxx_convert" in
9504 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9505 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9506 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9507 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9508    "$define$define$define")
9509       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9510    "$define$define$undef")
9511       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9512    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9513    esac
9514    ;;  
9515 esac
9516
9517 fi
9518
9519 : see if _fwalk exists
9520 set fwalk d__fwalk
9521 eval $inlibc
9522
9523 : Initialize h_fcntl
9524 h_fcntl=false
9525
9526 : Initialize h_sysfile
9527 h_sysfile=false
9528
9529 : access call always available on UNIX
9530 set access d_access
9531 eval $inlibc
9532
9533 : locate the flags for 'access()'
9534 case "$d_access" in
9535 "$define")
9536         echo " "
9537         $cat >access.c <<'EOCP'
9538 #include <sys/types.h>
9539 #ifdef I_FCNTL
9540 #include <fcntl.h>
9541 #endif
9542 #ifdef I_SYS_FILE
9543 #include <sys/file.h>
9544 #endif
9545 #ifdef I_UNISTD
9546 #include <unistd.h>
9547 #endif
9548 int main() {
9549         exit(R_OK);
9550 }
9551 EOCP
9552         : check sys/file.h first, no particular reason here
9553         if $test `./findhdr sys/file.h` && \
9554                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9555                 h_sysfile=true;
9556                 echo "<sys/file.h> defines the *_OK access constants." >&4
9557         elif $test `./findhdr fcntl.h` && \
9558                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9559                 h_fcntl=true;
9560                 echo "<fcntl.h> defines the *_OK access constants." >&4
9561         elif $test `./findhdr unistd.h` && \
9562                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9563                 echo "<unistd.h> defines the *_OK access constants." >&4
9564         else
9565                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9566         fi
9567         ;;
9568 esac
9569 $rm -f access*
9570
9571 : see if accessx exists
9572 set accessx d_accessx
9573 eval $inlibc
9574
9575 : see if alarm exists
9576 set alarm d_alarm
9577 eval $inlibc
9578
9579 : see if POSIX threads are available
9580 set pthread.h i_pthread
9581 eval $inhdr
9582
9583 : define a fucntion to check prototypes
9584 $cat > protochk <<EOSH
9585 $startsh
9586 cc="$cc"
9587 optimize="$optimize"
9588 ccflags="$ccflags"
9589 prototype="$prototype"
9590 define="$define"
9591 rm=$rm
9592 usethreads=$usethreads
9593 i_pthread=$i_pthread
9594 pthread_h_first=$pthread_h_first
9595 EOSH
9596
9597 $cat >> protochk <<'EOSH'
9598
9599 $rm -f try.c
9600 foo="$1"
9601 shift
9602 while test $# -ge 2; do
9603         case "$1" in
9604                 $define) echo "#include <$2>" >> try.c ;;
9605                 literal) echo "$2" >> try.c ;;
9606         esac
9607     # Extra magic for the benefit of systems that need pthread.h
9608     # to be included early to correctly detect threadsafe functions.
9609     # Such functions must guarantee themselves, though, that the usethreads
9610     # and i_pthread have been defined, before calling protochk.
9611     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9612         echo "#include <pthread.h>" >> try.c
9613         pthread_h_done=yes
9614     fi
9615     shift 2
9616 done
9617 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9618 cat >> try.c <<'EOCP'
9619 #ifdef CAN_PROTOTYPE
9620 #define _(args) args
9621 #else
9622 #define _(args) ()
9623 #endif
9624 EOCP
9625 echo "$foo" >> try.c
9626 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9627 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9628 status=$?
9629 $rm -f try.[co]
9630 exit $status
9631 EOSH
9632 chmod +x protochk
9633 $eunicefix protochk
9634
9635 : see if sys/types.h has to be included
9636 set sys/types.h i_systypes
9637 eval $inhdr
9638
9639 : see if sys/select.h has to be included
9640 set sys/select.h i_sysselct
9641 eval $inhdr
9642
9643 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9644 while $test $# -ge 2; do
9645         case "$1" in
9646         $define) echo "#include <$2>";;
9647         esac ;
9648     shift 2;
9649 done > try.c;
9650 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9651 set try;
9652 if eval $compile; then
9653         val="$define";
9654 else
9655         val="$undef";
9656 fi;
9657 set $varname;
9658 eval $setvar;
9659 $rm -f try.c try.o'
9660
9661 : see if we should include time.h, sys/time.h, or both
9662 echo " "
9663 if test "X$timeincl" = X; then
9664         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9665         $echo $n "I'm now running the test program...$c"
9666         $cat >try.c <<'EOCP'
9667 #include <sys/types.h>
9668 #ifdef I_TIME
9669 #include <time.h>
9670 #endif
9671 #ifdef I_SYSTIME
9672 #ifdef SYSTIMEKERNEL
9673 #define KERNEL
9674 #endif
9675 #include <sys/time.h>
9676 #endif
9677 #ifdef I_SYSSELECT
9678 #include <sys/select.h>
9679 #endif
9680 int main()
9681 {
9682         struct tm foo;
9683 #ifdef S_TIMEVAL
9684         struct timeval bar;
9685 #endif
9686 #ifdef S_TIMEZONE
9687         struct timezone tzp;
9688 #endif
9689         if (foo.tm_sec == foo.tm_sec)
9690                 exit(0);
9691 #ifdef S_TIMEVAL
9692         if (bar.tv_sec == bar.tv_sec)
9693                 exit(0);
9694 #endif
9695         exit(1);
9696 }
9697 EOCP
9698         flags=''
9699         for s_timezone in '-DS_TIMEZONE' ''; do
9700         sysselect=''
9701         for s_timeval in '-DS_TIMEVAL' ''; do
9702         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9703         for i_time in '' '-DI_TIME'; do
9704         for i_systime in '-DI_SYSTIME' ''; do
9705                 case "$flags" in
9706                 '') $echo $n ".$c"
9707                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9708                         if eval $compile; then
9709                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9710                                 shift
9711                                 flags="$*"
9712                                 echo " "
9713                                 $echo $n "Succeeded with $flags$c"
9714                         fi
9715                         ;;
9716                 esac
9717         done
9718         done
9719         done
9720         done
9721         done
9722         timeincl=''
9723         echo " "
9724         case "$flags" in
9725         *SYSTIMEKERNEL*) i_systimek="$define"
9726                 timeincl=`./findhdr sys/time.h`
9727                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9728         *) i_systimek="$undef";;
9729         esac
9730         case "$flags" in
9731         *I_TIME*) i_time="$define"
9732                 timeincl=`./findhdr time.h`" $timeincl"
9733                 echo "We'll include <time.h>." >&4;;
9734         *) i_time="$undef";;
9735         esac
9736         case "$flags" in
9737         *I_SYSTIME*) i_systime="$define"
9738                 timeincl=`./findhdr sys/time.h`" $timeincl"
9739                 echo "We'll include <sys/time.h>." >&4;;
9740         *) i_systime="$undef";;
9741         esac
9742         $rm -f try.c try
9743 fi
9744 : see if struct tm knows about tm_zone
9745 case "$i_systime$i_time" in
9746 *$define*) 
9747         echo " "
9748         echo "Checking to see if your struct tm has tm_zone field..." >&4
9749         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9750         eval $hasfield
9751         ;;
9752 *)      val="$undef"
9753         set d_tm_tm_zone
9754         eval $setvar
9755         ;;
9756 esac
9757 case "$d_tm_tm_zone" in
9758 "$define")      echo "Yes, it does."   ;;
9759 *)              echo "No, it doesn't." ;;
9760 esac
9761 : see if struct tm knows about tm_gmtoff
9762 case "$i_systime$i_time" in
9763 *$define*) 
9764         echo " "
9765         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9766         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9767         eval $hasfield
9768         ;;
9769 *)      val="$undef"
9770         set d_tm_tm_gmtoff
9771         eval $setvar
9772         ;;
9773 esac
9774 case "$d_tm_tm_gmtoff" in
9775 "$define")      echo "Yes, it does."   ;;
9776 *)              echo "No, it doesn't." ;;
9777 esac
9778
9779 : see if asctime_r exists
9780 set asctime_r d_asctime_r
9781 eval $inlibc
9782 case "$d_asctime_r" in
9783 "$define")
9784         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9785         case "$d_asctime_r_proto:$usethreads" in
9786         ":define")      d_asctime_r_proto=define
9787                 set d_asctime_r_proto asctime_r $hdrs
9788                 eval $hasproto ;;
9789         *)      ;;
9790         esac
9791         case "$d_asctime_r_proto" in
9792         define)
9793         case "$asctime_r_proto" in
9794         ''|0) try='char* asctime_r(const struct tm*, char*);'
9795         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9796         esac
9797         case "$asctime_r_proto" in
9798         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9799         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9800         esac
9801         case "$asctime_r_proto" in
9802         ''|0) try='int asctime_r(const struct tm*, char*);'
9803         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9804         esac
9805         case "$asctime_r_proto" in
9806         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9807         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9808         esac
9809         case "$asctime_r_proto" in
9810         ''|0)   d_asctime_r=undef
9811                 asctime_r_proto=0
9812                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9813         * )     case "$asctime_r_proto" in
9814                 REENTRANT_PROTO*) ;;
9815                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9816                 esac
9817                 echo "Prototype: $try" ;;
9818         esac
9819         ;;
9820         *)      case "$usethreads" in
9821                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9822                 esac
9823                 d_asctime_r=undef
9824                 asctime_r_proto=0
9825                 ;;
9826         esac
9827         ;;
9828 *)      asctime_r_proto=0
9829         ;;
9830 esac
9831
9832 : see if atolf exists
9833 set atolf d_atolf
9834 eval $inlibc
9835
9836 : see if atoll exists
9837 set atoll d_atoll
9838 eval $inlibc
9839
9840 : Look for GNU-cc style attribute checking
9841 echo " "
9842 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9843 $cat >attrib.c <<'EOCP'
9844 #include <stdio.h>
9845 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9846 EOCP
9847 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9848         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9849                 echo "Your C compiler doesn't fully support __attribute__."
9850                 val="$undef"
9851         else
9852                 echo "Your C compiler supports __attribute__."
9853                 val="$define"
9854         fi
9855 else
9856         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9857         val="$undef"
9858 fi
9859 set d_attribut
9860 eval $setvar
9861 $rm -f attrib*
9862
9863 : see if bcmp exists
9864 set bcmp d_bcmp
9865 eval $inlibc
9866
9867 : see if bcopy exists
9868 set bcopy d_bcopy
9869 eval $inlibc
9870
9871 : see if this is a unistd.h system
9872 set unistd.h i_unistd
9873 eval $inhdr
9874
9875 : see if getpgrp exists
9876 set getpgrp d_getpgrp
9877 eval $inlibc
9878
9879 case "$d_getpgrp" in
9880 "$define")
9881         echo " "
9882         echo "Checking to see which flavor of getpgrp is in use..."
9883         $cat >try.c <<EOP
9884 #$i_unistd I_UNISTD
9885 #include <sys/types.h>
9886 #ifdef I_UNISTD
9887 #  include <unistd.h>
9888 #endif
9889 int main()
9890 {
9891         if (getuid() == 0) {
9892                 printf("(I see you are running Configure as super-user...)\n");
9893                 setuid(1);
9894         }
9895 #ifdef TRY_BSD_PGRP
9896         if (getpgrp(1) == 0)
9897                 exit(0);
9898 #else
9899         if (getpgrp() > 0)
9900                 exit(0);
9901 #endif
9902         exit(1);
9903 }
9904 EOP
9905         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9906                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9907                 val="$define"
9908         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9909                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9910                 val="$undef"
9911         else
9912                 echo "I can't seem to compile and run the test program."
9913                 if ./usg; then
9914                         xxx="a USG one, i.e. you use getpgrp()."
9915                 else
9916                         # SVR4 systems can appear rather BSD-ish.
9917                         case "$i_unistd" in
9918                         $undef)
9919                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9920                                 val="$define"
9921                                 ;;
9922                         $define)
9923                                 xxx="probably a USG one, i.e. you use getpgrp()."
9924                                 val="$undef"
9925                                 ;;
9926                         esac
9927                 fi
9928                 echo "Assuming your getpgrp is $xxx" >&4
9929         fi
9930         ;;
9931 *) val="$undef";;
9932 esac
9933 set d_bsdgetpgrp
9934 eval $setvar
9935 $rm -f try try.*
9936
9937 : see if setpgrp exists
9938 set setpgrp d_setpgrp
9939 eval $inlibc
9940
9941 case "$d_setpgrp" in
9942 "$define")
9943         echo " "
9944         echo "Checking to see which flavor of setpgrp is in use..."
9945         $cat >try.c <<EOP
9946 #$i_unistd I_UNISTD
9947 #include <sys/types.h>
9948 #ifdef I_UNISTD
9949 #  include <unistd.h>
9950 #endif
9951 int main()
9952 {
9953         if (getuid() == 0) {
9954                 printf("(I see you are running Configure as super-user...)\n");
9955                 setuid(1);
9956         }
9957 #ifdef TRY_BSD_PGRP
9958         if (-1 == setpgrp(1, 1))
9959                 exit(0);
9960 #else
9961         if (setpgrp() != -1)
9962                 exit(0);
9963 #endif
9964         exit(1);
9965 }
9966 EOP
9967         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9968                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9969                 val="$define"
9970         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9971                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9972                 val="$undef"
9973         else
9974                 echo "(I can't seem to compile and run the test program.)"
9975                 if ./usg; then
9976                         xxx="a USG one, i.e. you use setpgrp()."
9977                 else
9978                         # SVR4 systems can appear rather BSD-ish.
9979                         case "$i_unistd" in
9980                         $undef)
9981                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9982                                 val="$define"
9983                                 ;;
9984                         $define)
9985                                 xxx="probably a USG one, i.e. you use setpgrp()."
9986                                 val="$undef"
9987                                 ;;
9988                         esac
9989                 fi
9990                 echo "Assuming your setpgrp is $xxx" >&4
9991         fi
9992         ;;
9993 *) val="$undef";;
9994 esac
9995 set d_bsdsetpgrp
9996 eval $setvar
9997 $rm -f try try.*
9998 : see if bzero exists
9999 set bzero d_bzero
10000 eval $inlibc
10001
10002 : see if signal is declared as pointer to function returning int or void
10003 echo " "
10004 xxx=`./findhdr signal.h`
10005 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10006 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10007         echo "You have int (*signal())() instead of void." >&4
10008         val="$undef"
10009 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10010         echo "You have void (*signal())()." >&4
10011         val="$define"
10012 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10013         echo "You have int (*signal())() instead of void." >&4
10014         val="$undef"
10015 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10016         echo "You have void (*signal())()." >&4
10017         val="$define"
10018 else
10019         case "$d_voidsig" in
10020         '')
10021         echo "I can't determine whether signal handler returns void or int..." >&4
10022                 dflt=void
10023                 rp="What type does your signal handler return?"
10024                 . ./myread
10025                 case "$ans" in
10026                 v*) val="$define";;
10027                 *) val="$undef";;
10028                 esac;;
10029         "$define")
10030                 echo "As you already told me, signal handler returns void." >&4
10031                 val="$define"
10032                 ;;
10033         *)      echo "As you already told me, signal handler returns int." >&4
10034                 val="$undef"
10035                 ;;
10036         esac
10037 fi
10038 set d_voidsig
10039 eval $setvar
10040 case "$d_voidsig" in
10041 "$define") signal_t="void";;
10042 *) signal_t="int";;
10043 esac
10044 $rm -f $$.tmp
10045
10046 : check for ability to cast large floats to 32-bit ints.
10047 echo " "
10048 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10049 if $test "$intsize" -ge 4; then
10050         xxx=int
10051 else
10052         xxx=long
10053 fi
10054 $cat >try.c <<EOCP
10055 #include <stdio.h>
10056 #$i_stdlib I_STDLIB
10057 #ifdef I_STDLIB
10058 #include <stdlib.h>
10059 #endif
10060 #include <sys/types.h>
10061 #include <signal.h>
10062 $signal_t blech(s) int s; { exit(3); }
10063 int main()
10064 {
10065         $xxx i32;
10066         double f, g;
10067         int result = 0;
10068         char str[16];
10069         signal(SIGFPE, blech);
10070
10071         /* Don't let compiler optimize the test away.  Store the number 
10072            in a writable string for gcc to pass to sscanf under HP/UX.
10073         */
10074         sprintf(str, "2147483647");
10075         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10076         g = 10 * f;
10077         i32  = ($xxx) g;
10078
10079         /* x86 processors will probably give 0x8000 0000, which is a
10080        sign change.  We don't want that.  We want to mimic SPARC
10081            behavior here, which is to preserve the sign and give
10082            back 0x7fff ffff.
10083         */
10084         if (i32 != ($xxx) f)
10085                 result |= 1;
10086         exit(result);
10087 }
10088 EOCP
10089 set try
10090 if eval $compile_ok; then
10091         $run ./try
10092         yyy=$?
10093 else
10094         echo "(I can't seem to compile the test program--assuming it can't)"
10095         yyy=1
10096 fi
10097 case "$yyy" in
10098 0)      val="$define"
10099         echo "Yup, it can."
10100         ;;
10101 *)      val="$undef"
10102         echo "Nope, it can't."
10103         ;;
10104 esac
10105 set d_casti32
10106 eval $setvar
10107 $rm -f try try.*
10108
10109 : check for ability to cast negative floats to unsigned
10110 echo " "
10111 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10112 $cat >try.c <<EOCP
10113 #include <stdio.h>
10114 #$i_stdlib I_STDLIB
10115 #ifdef I_STDLIB
10116 #include <stdlib.h>
10117 #endif
10118 #include <sys/types.h>
10119 #include <signal.h>
10120 $signal_t blech(s) int s; { exit(7); }
10121 $signal_t blech_in_list(s) int s; { exit(4); }
10122 unsigned long dummy_long(p) unsigned long p; { return p; }
10123 unsigned int dummy_int(p) unsigned int p; { return p; }
10124 unsigned short dummy_short(p) unsigned short p; { return p; }
10125 int main()
10126 {
10127         double f;
10128         unsigned long along;
10129         unsigned int aint;
10130         unsigned short ashort;
10131         int result = 0;
10132         char str[16];
10133         
10134         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10135            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10136            optimized the whole file away
10137         */
10138         /* Store the number in a writable string for gcc to pass to 
10139            sscanf under HP/UX.
10140         */
10141         sprintf(str, "-123");
10142         sscanf(str, "%lf", &f);  /* f = -123.; */
10143
10144         signal(SIGFPE, blech);
10145         along = (unsigned long)f;
10146         aint = (unsigned int)f;
10147         ashort = (unsigned short)f;
10148         if (along != (unsigned long)-123)
10149                 result |= 1;
10150         if (aint != (unsigned int)-123)
10151                 result |= 1;
10152         if (ashort != (unsigned short)-123)
10153                 result |= 1;
10154         sprintf(str, "1073741824.");
10155         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10156         f = f + f;
10157         along = 0;
10158         along = (unsigned long)f;
10159         if (along != 0x80000000)
10160                 result |= 2;
10161         f -= 1.;
10162         along = 0;
10163         along = (unsigned long)f;
10164         if (along != 0x7fffffff)
10165                 result |= 1;
10166         f += 2.;
10167         along = 0;
10168         along = (unsigned long)f;
10169         if (along != 0x80000001)
10170                 result |= 2;
10171         if (result)
10172                 exit(result);
10173         signal(SIGFPE, blech_in_list);
10174         sprintf(str, "123.");
10175         sscanf(str, "%lf", &f);  /* f = 123.; */
10176         along = dummy_long((unsigned long)f);
10177         aint = dummy_int((unsigned int)f);
10178         ashort = dummy_short((unsigned short)f);
10179         if (along != (unsigned long)123)
10180                 result |= 4;
10181         if (aint != (unsigned int)123)
10182                 result |= 4;
10183         if (ashort != (unsigned short)123)
10184                 result |= 4;
10185         exit(result);
10186
10187 }
10188 EOCP
10189 set try
10190 if eval $compile_ok; then
10191         $run ./try
10192         castflags=$?
10193 else
10194         echo "(I can't seem to compile the test program--assuming it can't)"
10195         castflags=7
10196 fi
10197 case "$castflags" in
10198 0)      val="$define"
10199         echo "Yup, it can."
10200         ;;
10201 *)      val="$undef"
10202         echo "Nope, it can't."
10203         ;;
10204 esac
10205 set d_castneg
10206 eval $setvar
10207 $rm -f try.*
10208
10209 : see if vprintf exists
10210 echo " "
10211 if set vprintf val -f d_vprintf; eval $csym; $val; then
10212         echo 'vprintf() found.' >&4
10213         val="$define"
10214         $cat >try.c <<'EOF'
10215 #include <varargs.h>
10216
10217 int main() { xxx("foo"); }
10218
10219 xxx(va_alist)
10220 va_dcl
10221 {
10222         va_list args;
10223         char buf[10];
10224
10225         va_start(args);
10226         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10227 }
10228 EOF
10229         set try
10230         if eval $compile && $run ./try; then
10231                 echo "Your vsprintf() returns (int)." >&4
10232                 val2="$undef"
10233         else
10234                 echo "Your vsprintf() returns (char*)." >&4
10235                 val2="$define"
10236         fi
10237 else
10238         echo 'vprintf() NOT found.' >&4
10239                 val="$undef"
10240                 val2="$undef"
10241 fi
10242 $rm -f try try.*
10243 set d_vprintf
10244 eval $setvar
10245 val=$val2
10246 set d_charvspr
10247 eval $setvar
10248
10249 : see if chown exists
10250 set chown d_chown
10251 eval $inlibc
10252
10253 : see if chroot exists
10254 set chroot d_chroot
10255 eval $inlibc
10256
10257 : see if chsize exists
10258 set chsize d_chsize
10259 eval $inlibc
10260
10261 : see if class exists
10262 set class d_class
10263 eval $inlibc
10264
10265 hasstruct='varname=$1; struct=$2; shift; shift;
10266 while $test $# -ge 2; do
10267         case "$1" in
10268         $define) echo "#include <$2>";;
10269         esac ;
10270     shift 2;
10271 done > try.c;
10272 echo "int main () { struct $struct foo; }" >> try.c;
10273 set try;
10274 if eval $compile; then
10275         val="$define";
10276 else
10277         val="$undef";
10278 fi;
10279 set $varname;
10280 eval $setvar;
10281 $rm -f try.c try.o'
10282
10283 socketlib=''
10284 sockethdr=''
10285 : see whether socket exists
10286 echo " "
10287 $echo $n "Hmm... $c" >&4
10288 if set socket val -f d_socket; eval $csym; $val; then
10289         echo "Looks like you have Berkeley networking support." >&4
10290         d_socket="$define"
10291         if set setsockopt val -f; eval $csym; $val; then
10292                 d_oldsock="$undef"
10293         else
10294                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10295                 d_oldsock="$define"
10296         fi
10297 else
10298         if $contains socklib libc.list >/dev/null 2>&1; then
10299                 echo "Looks like you have Berkeley networking support." >&4
10300                 d_socket="$define"
10301                 : we will have to assume that it supports the 4.2 BSD interface
10302                 d_oldsock="$undef"
10303         else
10304                 echo "You don't have Berkeley networking in libc$_a..." >&4
10305                 if test "X$d_socket" = "X$define"; then
10306                    echo "...but you seem to believe that you have sockets." >&4
10307                 else
10308                         for net in net socket
10309                         do
10310                                 if test -f /usr/lib/lib$net$_a; then
10311                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10312                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10313                                         if $contains socket libc.list >/dev/null 2>&1; then
10314                                                 d_socket="$define"
10315                                                 socketlib="-l$net"
10316                                                 case "$net" in
10317                                                 net)
10318                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10319                                                         sockethdr="-I/usr/netinclude"
10320                                                         ;;
10321                                                 esac
10322                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10323                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10324                                                         d_oldsock="$undef"
10325                                                 else
10326                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10327                                                         d_oldsock="$define"
10328                                                 fi
10329                                                 break
10330                                         fi
10331                                 fi
10332                         done
10333                         if test "X$d_socket" != "X$define"; then
10334                            echo "or anywhere else I see." >&4
10335                            d_socket="$undef"
10336                            d_oldsock="$undef"
10337                         fi
10338                 fi
10339         fi
10340 fi
10341
10342 : see if socketpair exists
10343 set socketpair d_sockpair
10344 eval $inlibc
10345
10346
10347 echo " "
10348 echo "Checking the availability of certain socket constants..." >&4
10349 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10350         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10351         $cat >try.c <<EOF
10352 #include <sys/types.h>
10353 #include <sys/socket.h>
10354 int main() {
10355     int i = $ENUM;
10356 }
10357 EOF
10358         val="$undef"
10359         set try; if eval $compile; then
10360                 val="$define"
10361         fi
10362         set d_${enum}; eval $setvar
10363         $rm -f try.c try
10364 done
10365
10366 : see if this is a sys/uio.h system
10367 set sys/uio.h i_sysuio
10368 eval $inhdr
10369
10370
10371 echo " "
10372 echo "Checking to see if your system supports struct cmsghdr..." >&4
10373 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10374 eval $hasstruct
10375 case "$d_cmsghdr_s" in
10376 "$define")      echo "Yes, it does."   ;;
10377 *)              echo "No, it doesn't." ;;
10378 esac
10379
10380
10381 : check for const keyword
10382 echo " "
10383 echo 'Checking to see if your C compiler knows about "const"...' >&4
10384 $cat >const.c <<'EOCP'
10385 typedef struct spug { int drokk; } spug;
10386 int main()
10387 {
10388         const char *foo;
10389         const spug y;
10390 }
10391 EOCP
10392 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10393         val="$define"
10394         echo "Yup, it does."
10395 else
10396         val="$undef"
10397         echo "Nope, it doesn't."
10398 fi
10399 set d_const
10400 eval $setvar
10401
10402 : see if crypt exists
10403 echo " "
10404 set crypt d_crypt
10405 eval $inlibc
10406 case "$d_crypt" in
10407 $define) cryptlib='' ;;
10408 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10409                 echo 'crypt() found.' >&4
10410                 val="$define"
10411                 cryptlib=''
10412         else
10413                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10414                 if $test -z "$cryptlib"; then
10415                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10416                 else
10417                         cryptlib=-lcrypt
10418                 fi
10419                 if $test -z "$cryptlib"; then
10420                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10421                 else
10422                         cryptlib=-lcrypt
10423                 fi
10424                 if $test -z "$cryptlib"; then
10425                         cryptlib=`./loc libcrypt$_a "" $libpth`
10426                 else
10427                         cryptlib=-lcrypt
10428                 fi
10429                 if $test -z "$cryptlib"; then
10430                         echo 'crypt() NOT found.' >&4
10431                         val="$undef"
10432                 else
10433                         val="$define"
10434                 fi
10435         fi
10436         set d_crypt
10437         eval $setvar
10438         ;;
10439 esac
10440
10441 : see if this is a crypt.h system
10442 set crypt.h i_crypt
10443 eval $inhdr
10444
10445 : see if crypt_r exists
10446 set crypt_r d_crypt_r
10447 eval $inlibc
10448 case "$d_crypt_r" in
10449 "$define")
10450         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10451         case "$d_crypt_r_proto:$usethreads" in
10452         ":define")      d_crypt_r_proto=define
10453                 set d_crypt_r_proto crypt_r $hdrs
10454                 eval $hasproto ;;
10455         *)      ;;
10456         esac
10457         case "$d_crypt_r_proto" in
10458         define)
10459         case "$crypt_r_proto" in
10460         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10461         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10462         esac
10463         case "$crypt_r_proto" in
10464         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10465         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10466         esac
10467         case "$crypt_r_proto" in
10468         ''|0)   d_crypt_r=undef
10469                 crypt_r_proto=0
10470                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10471         * )     case "$crypt_r_proto" in
10472                 REENTRANT_PROTO*) ;;
10473                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10474                 esac
10475                 echo "Prototype: $try" ;;
10476         esac
10477         ;;
10478         *)      case "$usethreads" in
10479                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10480                 esac
10481                 d_crypt_r=undef
10482                 crypt_r_proto=0
10483                 ;;
10484         esac
10485         ;;
10486 *)      crypt_r_proto=0
10487         ;;
10488 esac
10489
10490 : get csh whereabouts
10491 case "$csh" in
10492 'csh') val="$undef" ;;
10493 *) val="$define" ;;
10494 esac
10495 set d_csh
10496 eval $setvar
10497 : Respect a hint or command line value for full_csh.
10498 case "$full_csh" in
10499 '') full_csh=$csh ;;
10500 esac
10501
10502 : see if ctermid_r exists
10503 set ctermid_r d_ctermid_r
10504 eval $inlibc
10505 case "$d_ctermid_r" in
10506 "$define")
10507         hdrs="$i_systypes sys/types.h define stdio.h "
10508         case "$d_ctermid_r_proto:$usethreads" in
10509         ":define")      d_ctermid_r_proto=define
10510                 set d_ctermid_r_proto ctermid_r $hdrs
10511                 eval $hasproto ;;
10512         *)      ;;
10513         esac
10514         case "$d_ctermid_r_proto" in
10515         define)
10516         case "$ctermid_r_proto" in
10517         ''|0) try='char* ctermid_r(char*);'
10518         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10519         esac
10520         case "$ctermid_r_proto" in
10521         ''|0)   d_ctermid_r=undef
10522                 ctermid_r_proto=0
10523                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10524         * )     case "$ctermid_r_proto" in
10525                 REENTRANT_PROTO*) ;;
10526                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10527                 esac
10528                 echo "Prototype: $try" ;;
10529         esac
10530         ;;
10531         *)      case "$usethreads" in
10532                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10533                 esac
10534                 d_ctermid_r=undef
10535                 ctermid_r_proto=0
10536                 ;;
10537         esac
10538         ;;
10539 *)      ctermid_r_proto=0
10540         ;;
10541 esac
10542
10543 : see if ctime_r exists
10544 set ctime_r d_ctime_r
10545 eval $inlibc
10546 case "$d_ctime_r" in
10547 "$define")
10548         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10549         case "$d_ctime_r_proto:$usethreads" in
10550         ":define")      d_ctime_r_proto=define
10551                 set d_ctime_r_proto ctime_r $hdrs
10552                 eval $hasproto ;;
10553         *)      ;;
10554         esac
10555         case "$d_ctime_r_proto" in
10556         define)
10557         case "$ctime_r_proto" in
10558         ''|0) try='char* ctime_r(const time_t*, char*);'
10559         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10560         esac
10561         case "$ctime_r_proto" in
10562         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10563         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10564         esac
10565         case "$ctime_r_proto" in
10566         ''|0) try='int ctime_r(const time_t*, char*);'
10567         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10568         esac
10569         case "$ctime_r_proto" in
10570         ''|0) try='int ctime_r(const time_t*, char*, int);'
10571         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10572         esac
10573         case "$ctime_r_proto" in
10574         ''|0)   d_ctime_r=undef
10575                 ctime_r_proto=0
10576                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10577         * )     case "$ctime_r_proto" in
10578                 REENTRANT_PROTO*) ;;
10579                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10580                 esac
10581                 echo "Prototype: $try" ;;
10582         esac
10583         ;;
10584         *)      case "$usethreads" in
10585                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10586                 esac
10587                 d_ctime_r=undef
10588                 ctime_r_proto=0
10589                 ;;
10590         esac
10591         ;;
10592 *)      ctime_r_proto=0
10593         ;;
10594 esac
10595
10596 : see if cuserid exists
10597 set cuserid d_cuserid
10598 eval $inlibc
10599
10600 : see if this is a limits.h system
10601 set limits.h i_limits
10602 eval $inhdr
10603
10604 : see if this is a float.h system
10605 set float.h i_float
10606 eval $inhdr
10607
10608 : See if number of significant digits in a double precision number is known
10609 echo " "
10610 $cat >dbl_dig.c <<EOM
10611 #$i_limits I_LIMITS
10612 #$i_float I_FLOAT
10613 #ifdef I_LIMITS
10614 #include <limits.h>
10615 #endif
10616 #ifdef I_FLOAT
10617 #include <float.h>
10618 #endif
10619 #ifdef DBL_DIG
10620 printf("Contains DBL_DIG");
10621 #endif
10622 EOM
10623 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10624 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10625         echo "DBL_DIG found." >&4
10626         val="$define"
10627 else
10628         echo "DBL_DIG NOT found." >&4
10629         val="$undef"
10630 fi
10631 $rm -f dbl_dig.?
10632 set d_dbl_dig
10633 eval $setvar
10634
10635 : see if dbm.h is available
10636 : see if dbmclose exists
10637 set dbmclose d_dbmclose
10638 eval $inlibc
10639
10640 case "$d_dbmclose" in
10641 $define)
10642         set dbm.h i_dbm
10643         eval $inhdr
10644         case "$i_dbm" in
10645         $define)
10646                 val="$undef"
10647                 set i_rpcsvcdbm
10648                 eval $setvar
10649                 ;;
10650         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10651                 eval $inhdr
10652                 ;;
10653         esac
10654         ;;
10655 *)      echo "We won't be including <dbm.h>"
10656         val="$undef"
10657         set i_dbm
10658         eval $setvar
10659         val="$undef"
10660         set i_rpcsvcdbm
10661         eval $setvar
10662         ;;
10663 esac
10664
10665 : see if prototype for dbminit is available
10666 echo " "
10667 set d_dbminitproto dbminit $i_dbm dbm.h
10668 eval $hasproto
10669
10670 : see if difftime exists
10671 set difftime d_difftime
10672 eval $inlibc
10673
10674 : see if this is a dirent system
10675 echo " "
10676 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10677         val="$define"
10678         echo "<dirent.h> found." >&4
10679 else
10680         val="$undef"
10681         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10682                 echo "<sys/dir.h> found." >&4
10683                 echo " "
10684         else
10685                 xinc=`./findhdr sys/ndir.h`
10686         fi
10687         echo "<dirent.h> NOT found." >&4
10688 fi
10689 set i_dirent
10690 eval $setvar
10691
10692 : Look for type of directory structure.
10693 echo " "
10694 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10695
10696 case "$direntrytype" in
10697 ''|' ')
10698         case "$i_dirent" in
10699         $define) guess1='struct dirent' ;;
10700         *) guess1='struct direct'  ;;
10701         esac
10702         ;;
10703 *)      guess1="$direntrytype"
10704         ;;
10705 esac
10706
10707 case "$guess1" in
10708 'struct dirent') guess2='struct direct' ;;
10709 *) guess2='struct dirent' ;;
10710 esac
10711                 
10712 if $contains "$guess1" try.c >/dev/null 2>&1; then
10713         direntrytype="$guess1"
10714         echo "Your directory entries are $direntrytype." >&4
10715 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10716         direntrytype="$guess2"
10717         echo "Your directory entries seem to be $direntrytype." >&4
10718 else
10719         echo "I don't recognize your system's directory entries." >&4
10720         rp="What type is used for directory entries on this system?"
10721         dflt="$guess1"
10722         . ./myread
10723         direntrytype="$ans"
10724 fi
10725 $rm -f try.c
10726
10727
10728 : see if the directory entry stores field length
10729 echo " "
10730 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10731 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10732         echo "Good, your directory entry keeps length information in d_namlen." >&4
10733         val="$define"
10734 else
10735         echo "Your directory entry does not know about the d_namlen field." >&4
10736         val="$undef"
10737 fi
10738 set d_dirnamlen
10739 eval $setvar
10740 $rm -f try.c
10741
10742 : see if this is an sysdir system
10743 set sys/dir.h i_sysdir
10744 eval $inhdr
10745
10746 : see if this is an sysndir system
10747 set sys/ndir.h i_sysndir
10748 eval $inhdr
10749
10750 : Look for dirfd
10751 echo " "
10752 $cat >dirfd.c <<EOM
10753 #include <stdio.h>
10754 #$i_dirent I_DIRENT             /**/
10755 #$i_sysdir I_SYS_DIR            /**/
10756 #$i_sysndir I_SYS_NDIR          /**/
10757 #$i_systypes I_SYS_TYPES        /**/
10758 #if defined(I_SYS_TYPES)
10759 #include <sys/types.h>
10760 #endif
10761 #if defined(I_DIRENT)
10762 #include <dirent.h>
10763 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10764 #include <sys/dir.h>
10765 #endif
10766 #else
10767 #ifdef I_SYS_NDIR
10768 #include <sys/ndir.h>
10769 #else
10770 #ifdef I_SYS_DIR
10771 #ifdef hp9000s500
10772 #include <ndir.h>       /* may be wrong in the future */
10773 #else
10774 #include <sys/dir.h>
10775 #endif
10776 #endif
10777 #endif
10778 #endif 
10779 int main() {
10780         DIR *dirp = opendir(".");
10781         if (dirfd(dirp) >= 0)
10782                 exit(0);
10783         else
10784                 exit(1);
10785 }
10786 EOM
10787 set dirfd
10788 if eval $compile; then
10789         val="$define"
10790 fi
10791 case "$val" in
10792 $define)        echo "dirfd() found." >&4       ;;
10793 *)              echo "dirfd() NOT found." >&4   ;;
10794 esac
10795 set d_dirfd
10796 eval $setvar
10797 $rm -f dirfd*
10798
10799 : see if dlerror exists
10800 xxx_runnm="$runnm"
10801 runnm=false
10802 set dlerror d_dlerror
10803 eval $inlibc
10804 runnm="$xxx_runnm"
10805
10806 : see if dlfcn is available
10807 set dlfcn.h i_dlfcn
10808 eval $inhdr
10809
10810 case "$usedl" in
10811 $define|y|true)
10812         $cat << EOM
10813
10814 On a few systems, the dynamically loaded modules that perl generates and uses
10815 will need a different extension than shared libs. The default will probably
10816 be appropriate.
10817
10818 EOM
10819         case "$dlext" in
10820         '')     dflt="$so" ;;
10821         *)      dflt="$dlext" ;;
10822         esac
10823         rp='What is the extension of dynamically loaded modules'
10824         . ./myread
10825         dlext="$ans"
10826         ;;
10827 *)
10828         dlext="none"
10829         ;;
10830 esac
10831
10832 : Check if dlsym need a leading underscore
10833 echo " "
10834 val="$undef"
10835
10836 case "$dlsrc" in
10837 dl_dlopen.xs)
10838         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10839         $cat >dyna.c <<'EOM'
10840 fred () { }
10841 EOM
10842
10843 $cat >fred.c<<EOM
10844
10845 #include <stdio.h>
10846 #$i_dlfcn I_DLFCN
10847 #ifdef I_DLFCN
10848 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10849 #else
10850 #include <sys/types.h>
10851 #include <nlist.h>
10852 #include <link.h>
10853 #endif
10854
10855 extern int fred() ;
10856
10857 int main()
10858 {
10859     void * handle ;
10860     void * symbol ;
10861 #ifndef RTLD_LAZY
10862     int mode = 1 ;
10863 #else
10864     int mode = RTLD_LAZY ;
10865 #endif
10866     handle = dlopen("./dyna.$dlext", mode) ;
10867     if (handle == NULL) {
10868         printf ("1\n") ;
10869         fflush (stdout) ;
10870         exit(0);
10871     }
10872     symbol = dlsym(handle, "fred") ;
10873     if (symbol == NULL) {
10874         /* try putting a leading underscore */
10875         symbol = dlsym(handle, "_fred") ;
10876         if (symbol == NULL) {
10877             printf ("2\n") ;
10878             fflush (stdout) ;
10879             exit(0);
10880         }
10881         printf ("3\n") ;
10882     }
10883     else
10884         printf ("4\n") ;
10885     fflush (stdout) ;
10886     exit(0);
10887 }
10888 EOM
10889         : Call the object file tmp-dyna.o in case dlext=o.
10890         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10891                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10892                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10893                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10894                 xxx=`$run ./fred`
10895                 case $xxx in
10896                 1)      echo "Test program failed using dlopen." >&4
10897                         echo "Perhaps you should not use dynamic loading." >&4;;
10898                 2)      echo "Test program failed using dlsym." >&4
10899                         echo "Perhaps you should not use dynamic loading." >&4;;
10900                 3)      echo "dlsym needs a leading underscore" >&4
10901                         val="$define" ;;
10902                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10903                 esac
10904         else
10905                 echo "I can't compile and run the test program." >&4
10906                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10907         fi
10908         ;;
10909 esac
10910                 
10911 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10912
10913 set d_dlsymun
10914 eval $setvar
10915
10916 : see if drand48_r exists
10917 set drand48_r d_drand48_r
10918 eval $inlibc
10919 case "$d_drand48_r" in
10920 "$define")
10921         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10922         case "$d_drand48_r_proto:$usethreads" in
10923         ":define")      d_drand48_r_proto=define
10924                 set d_drand48_r_proto drand48_r $hdrs
10925                 eval $hasproto ;;
10926         *)      ;;
10927         esac
10928         case "$d_drand48_r_proto" in
10929         define)
10930         case "$drand48_r_proto" in
10931         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10932         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10933         esac
10934         case "$drand48_r_proto" in
10935         ''|0)   d_drand48_r=undef
10936                 drand48_r_proto=0
10937                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10938         * )     case "$drand48_r_proto" in
10939                 REENTRANT_PROTO*) ;;
10940                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10941                 esac
10942                 echo "Prototype: $try" ;;
10943         esac
10944         ;;
10945         *)      case "$usethreads" in
10946                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10947                 esac
10948                 d_drand48_r=undef
10949                 drand48_r_proto=0
10950                 ;;
10951         esac
10952         ;;
10953 *)      drand48_r_proto=0
10954         ;;
10955 esac
10956
10957 : see if prototype for drand48 is available
10958 echo " "
10959 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10960 eval $hasproto
10961
10962 : see if dup2 exists
10963 set dup2 d_dup2
10964 eval $inlibc
10965
10966 : see if eaccess exists
10967 set eaccess d_eaccess
10968 eval $inlibc
10969
10970 : see if endgrent exists
10971 set endgrent d_endgrent
10972 eval $inlibc
10973
10974 : see if this is an grp system
10975 set grp.h i_grp
10976 eval $inhdr
10977
10978 case "$i_grp" in
10979 $define)
10980         xxx=`./findhdr grp.h`
10981         $cppstdin $cppflags $cppminus < $xxx >$$.h
10982
10983         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10984                 val="$define"
10985         else
10986                 val="$undef"
10987         fi
10988         set d_grpasswd
10989         eval $setvar
10990
10991         $rm -f $$.h
10992         ;;
10993 *)
10994         val="$undef";
10995         set d_grpasswd; eval $setvar
10996         ;;
10997 esac
10998
10999 : see if endgrent_r exists
11000 set endgrent_r d_endgrent_r
11001 eval $inlibc
11002 case "$d_endgrent_r" in
11003 "$define")
11004         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11005         case "$d_endgrent_r_proto:$usethreads" in
11006         ":define")      d_endgrent_r_proto=define
11007                 set d_endgrent_r_proto endgrent_r $hdrs
11008                 eval $hasproto ;;
11009         *)      ;;
11010         esac
11011         case "$d_endgrent_r_proto" in
11012         define)
11013         case "$endgrent_r_proto" in
11014         ''|0) try='int endgrent_r(FILE**);'
11015         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11016         esac
11017         case "$endgrent_r_proto" in
11018         ''|0) try='void endgrent_r(FILE**);'
11019         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11020         esac
11021         case "$endgrent_r_proto" in
11022         ''|0)   d_endgrent_r=undef
11023                 endgrent_r_proto=0
11024                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11025         * )     case "$endgrent_r_proto" in
11026                 REENTRANT_PROTO*) ;;
11027                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11028                 esac
11029                 echo "Prototype: $try" ;;
11030         esac
11031         ;;
11032         *)      case "$usethreads" in
11033                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11034                 esac
11035                 d_endgrent_r=undef
11036                 endgrent_r_proto=0
11037                 ;;
11038         esac
11039         ;;
11040 *)      endgrent_r_proto=0
11041         ;;
11042 esac
11043
11044 : see if endhostent exists
11045 set endhostent d_endhent
11046 eval $inlibc
11047
11048 : see if this is a netdb.h system
11049 set netdb.h i_netdb
11050 eval $inhdr
11051
11052 : see if endhostent_r exists
11053 set endhostent_r d_endhostent_r
11054 eval $inlibc
11055 case "$d_endhostent_r" in
11056 "$define")
11057         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11058         case "$d_endhostent_r_proto:$usethreads" in
11059         ":define")      d_endhostent_r_proto=define
11060                 set d_endhostent_r_proto endhostent_r $hdrs
11061                 eval $hasproto ;;
11062         *)      ;;
11063         esac
11064         case "$d_endhostent_r_proto" in
11065         define)
11066         case "$endhostent_r_proto" in
11067         ''|0) try='int endhostent_r(struct hostent_data*);'
11068         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11069         esac
11070         case "$endhostent_r_proto" in
11071         ''|0) try='void endhostent_r(struct hostent_data*);'
11072         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11073         esac
11074         case "$endhostent_r_proto" in
11075         ''|0)   d_endhostent_r=undef
11076                 endhostent_r_proto=0
11077                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11078         * )     case "$endhostent_r_proto" in
11079                 REENTRANT_PROTO*) ;;
11080                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11081                 esac
11082                 echo "Prototype: $try" ;;
11083         esac
11084         ;;
11085         *)      case "$usethreads" in
11086                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11087                 esac
11088                 d_endhostent_r=undef
11089                 endhostent_r_proto=0
11090                 ;;
11091         esac
11092         ;;
11093 *)      endhostent_r_proto=0
11094         ;;
11095 esac
11096
11097 : see if endnetent exists
11098 set endnetent d_endnent
11099 eval $inlibc
11100
11101 : see if endnetent_r exists
11102 set endnetent_r d_endnetent_r
11103 eval $inlibc
11104 case "$d_endnetent_r" in
11105 "$define")
11106         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11107         case "$d_endnetent_r_proto:$usethreads" in
11108         ":define")      d_endnetent_r_proto=define
11109                 set d_endnetent_r_proto endnetent_r $hdrs
11110                 eval $hasproto ;;
11111         *)      ;;
11112         esac
11113         case "$d_endnetent_r_proto" in
11114         define)
11115         case "$endnetent_r_proto" in
11116         ''|0) try='int endnetent_r(struct netent_data*);'
11117         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11118         esac
11119         case "$endnetent_r_proto" in
11120         ''|0) try='void endnetent_r(struct netent_data*);'
11121         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11122         esac
11123         case "$endnetent_r_proto" in
11124         ''|0)   d_endnetent_r=undef
11125                 endnetent_r_proto=0
11126                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11127         * )     case "$endnetent_r_proto" in
11128                 REENTRANT_PROTO*) ;;
11129                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11130                 esac
11131                 echo "Prototype: $try" ;;
11132         esac
11133         ;;
11134         *)      case "$usethreads" in
11135                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11136                 esac
11137                 d_endnetent_r=undef
11138                 endnetent_r_proto=0
11139                 ;;
11140         esac
11141         ;;
11142 *)      endnetent_r_proto=0
11143         ;;
11144 esac
11145
11146 : see if endprotoent exists
11147 set endprotoent d_endpent
11148 eval $inlibc
11149
11150 : see if endprotoent_r exists
11151 set endprotoent_r d_endprotoent_r
11152 eval $inlibc
11153 case "$d_endprotoent_r" in
11154 "$define")
11155         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11156         case "$d_endprotoent_r_proto:$usethreads" in
11157         ":define")      d_endprotoent_r_proto=define
11158                 set d_endprotoent_r_proto endprotoent_r $hdrs
11159                 eval $hasproto ;;
11160         *)      ;;
11161         esac
11162         case "$d_endprotoent_r_proto" in
11163         define)
11164         case "$endprotoent_r_proto" in
11165         ''|0) try='int endprotoent_r(struct protoent_data*);'
11166         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11167         esac
11168         case "$endprotoent_r_proto" in
11169         ''|0) try='void endprotoent_r(struct protoent_data*);'
11170         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11171         esac
11172         case "$endprotoent_r_proto" in
11173         ''|0)   d_endprotoent_r=undef
11174                 endprotoent_r_proto=0
11175                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11176         * )     case "$endprotoent_r_proto" in
11177                 REENTRANT_PROTO*) ;;
11178                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11179                 esac
11180                 echo "Prototype: $try" ;;
11181         esac
11182         ;;
11183         *)      case "$usethreads" in
11184                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11185                 esac
11186                 d_endprotoent_r=undef
11187                 endprotoent_r_proto=0
11188                 ;;
11189         esac
11190         ;;
11191 *)      endprotoent_r_proto=0
11192         ;;
11193 esac
11194
11195 : see if endpwent exists
11196 set endpwent d_endpwent
11197 eval $inlibc
11198
11199 : see if this is a pwd.h system
11200 set pwd.h i_pwd
11201 eval $inhdr
11202
11203 case "$i_pwd" in
11204 $define)
11205         xxx=`./findhdr pwd.h`
11206         $cppstdin $cppflags $cppminus < $xxx >$$.h
11207
11208         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11209                 val="$define"
11210         else
11211                 val="$undef"
11212         fi
11213         set d_pwquota
11214         eval $setvar
11215
11216         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11217                 val="$define"
11218         else
11219                 val="$undef"
11220         fi
11221         set d_pwage
11222         eval $setvar
11223
11224         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11225                 val="$define"
11226         else
11227                 val="$undef"
11228         fi
11229         set d_pwchange
11230         eval $setvar
11231
11232         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11233                 val="$define"
11234         else
11235                 val="$undef"
11236         fi
11237         set d_pwclass
11238         eval $setvar
11239
11240         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11241                 val="$define"
11242         else
11243                 val="$undef"
11244         fi
11245         set d_pwexpire
11246         eval $setvar
11247
11248         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11249                 val="$define"
11250         else
11251                 val="$undef"
11252         fi
11253         set d_pwcomment
11254         eval $setvar
11255
11256         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11257                 val="$define"
11258         else
11259                 val="$undef"
11260         fi
11261         set d_pwgecos
11262         eval $setvar
11263
11264         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11265                 val="$define"
11266         else
11267                 val="$undef"
11268         fi
11269         set d_pwpasswd
11270         eval $setvar
11271
11272         $rm -f $$.h
11273         ;;
11274 *)
11275         val="$undef"; 
11276         set d_pwquota; eval $setvar
11277         set d_pwage; eval $setvar
11278         set d_pwchange; eval $setvar
11279         set d_pwclass; eval $setvar
11280         set d_pwexpire; eval $setvar
11281         set d_pwcomment; eval $setvar
11282         set d_pwgecos; eval $setvar
11283         set d_pwpasswd; eval $setvar
11284         ;;
11285 esac
11286
11287 : see if endpwent_r exists
11288 set endpwent_r d_endpwent_r
11289 eval $inlibc
11290 case "$d_endpwent_r" in
11291 "$define")
11292         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11293         case "$d_endpwent_r_proto:$usethreads" in
11294         ":define")      d_endpwent_r_proto=define
11295                 set d_endpwent_r_proto endpwent_r $hdrs
11296                 eval $hasproto ;;
11297         *)      ;;
11298         esac
11299         case "$d_endpwent_r_proto" in
11300         define)
11301         case "$endpwent_r_proto" in
11302         ''|0) try='int endpwent_r(FILE**);'
11303         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11304         esac
11305         case "$endpwent_r_proto" in
11306         ''|0) try='void endpwent_r(FILE**);'
11307         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11308         esac
11309         case "$endpwent_r_proto" in
11310         ''|0)   d_endpwent_r=undef
11311                 endpwent_r_proto=0
11312                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11313         * )     case "$endpwent_r_proto" in
11314                 REENTRANT_PROTO*) ;;
11315                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11316                 esac
11317                 echo "Prototype: $try" ;;
11318         esac
11319         ;;
11320         *)      case "$usethreads" in
11321                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11322                 esac
11323                 d_endpwent_r=undef
11324                 endpwent_r_proto=0
11325                 ;;
11326         esac
11327         ;;
11328 *)      endpwent_r_proto=0
11329         ;;
11330 esac
11331
11332 : see if endservent exists
11333 set endservent d_endsent
11334 eval $inlibc
11335
11336 : see if endservent_r exists
11337 set endservent_r d_endservent_r
11338 eval $inlibc
11339 case "$d_endservent_r" in
11340 "$define")
11341         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11342         case "$d_endservent_r_proto:$usethreads" in
11343         ":define")      d_endservent_r_proto=define
11344                 set d_endservent_r_proto endservent_r $hdrs
11345                 eval $hasproto ;;
11346         *)      ;;
11347         esac
11348         case "$d_endservent_r_proto" in
11349         define)
11350         case "$endservent_r_proto" in
11351         ''|0) try='int endservent_r(struct servent_data*);'
11352         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11353         esac
11354         case "$endservent_r_proto" in
11355         ''|0) try='void endservent_r(struct servent_data*);'
11356         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11357         esac
11358         case "$endservent_r_proto" in
11359         ''|0)   d_endservent_r=undef
11360                 endservent_r_proto=0
11361                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11362         * )     case "$endservent_r_proto" in
11363                 REENTRANT_PROTO*) ;;
11364                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11365                 esac
11366                 echo "Prototype: $try" ;;
11367         esac
11368         ;;
11369         *)      case "$usethreads" in
11370                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11371                 esac
11372                 d_endservent_r=undef
11373                 endservent_r_proto=0
11374                 ;;
11375         esac
11376         ;;
11377 *)      endservent_r_proto=0
11378         ;;
11379 esac
11380
11381 : Locate the flags for 'open()'
11382 echo " "
11383 $cat >try.c <<'EOCP'
11384 #include <sys/types.h>
11385 #ifdef I_FCNTL
11386 #include <fcntl.h>
11387 #endif
11388 #ifdef I_SYS_FILE
11389 #include <sys/file.h>
11390 #endif
11391 int main() {
11392         if(O_RDONLY);
11393 #ifdef O_TRUNC
11394         exit(0);
11395 #else
11396         exit(1);
11397 #endif
11398 }
11399 EOCP
11400 : check sys/file.h first to get FREAD on Sun
11401 if $test `./findhdr sys/file.h` && \
11402                 set try -DI_SYS_FILE && eval $compile; then
11403         h_sysfile=true;
11404         echo "<sys/file.h> defines the O_* constants..." >&4
11405         if $run ./try; then
11406                 echo "and you have the 3 argument form of open()." >&4
11407                 val="$define"
11408         else
11409                 echo "but not the 3 argument form of open().  Oh, well." >&4
11410                 val="$undef"
11411         fi
11412 elif $test `./findhdr fcntl.h` && \
11413                 set try -DI_FCNTL && eval $compile; then
11414         h_fcntl=true;
11415         echo "<fcntl.h> defines the O_* constants..." >&4
11416         if $run ./try; then
11417                 echo "and you have the 3 argument form of open()." >&4
11418                 val="$define"
11419         else
11420                 echo "but not the 3 argument form of open().  Oh, well." >&4
11421                 val="$undef"
11422         fi
11423 else
11424         val="$undef"
11425         echo "I can't find the O_* constant definitions!  You got problems." >&4
11426 fi
11427 set d_open3
11428 eval $setvar
11429 $rm -f try try.*
11430
11431 : see which of string.h or strings.h is needed
11432 echo " "
11433 strings=`./findhdr string.h`
11434 if $test "$strings" && $test -r "$strings"; then
11435         echo "Using <string.h> instead of <strings.h>." >&4
11436         val="$define"
11437 else
11438         val="$undef"
11439         strings=`./findhdr strings.h`
11440         if $test "$strings" && $test -r "$strings"; then
11441                 echo "Using <strings.h> instead of <string.h>." >&4
11442         else
11443                 echo "No string header found -- You'll surely have problems." >&4
11444         fi
11445 fi
11446 set i_string
11447 eval $setvar
11448 case "$i_string" in
11449 "$undef") strings=`./findhdr strings.h`;;
11450 *)        strings=`./findhdr string.h`;;
11451 esac
11452
11453 : see if this is a sys/file.h system
11454 val=''
11455 set sys/file.h val
11456 eval $inhdr
11457
11458 : do we need to include sys/file.h ?
11459 case "$val" in
11460 "$define")
11461         echo " "
11462         if $h_sysfile; then
11463                 val="$define"
11464                 echo "We'll be including <sys/file.h>." >&4
11465         else
11466                 val="$undef"
11467                 echo "We won't be including <sys/file.h>." >&4
11468         fi
11469         ;;
11470 *)
11471         h_sysfile=false
11472         ;;
11473 esac
11474 set i_sysfile
11475 eval $setvar
11476
11477 : see if fcntl.h is there
11478 val=''
11479 set fcntl.h val
11480 eval $inhdr
11481
11482 : see if we can include fcntl.h
11483 case "$val" in
11484 "$define")
11485         echo " "
11486         if $h_fcntl; then
11487                 val="$define"
11488                 echo "We'll be including <fcntl.h>." >&4
11489         else
11490                 val="$undef"
11491                 if $h_sysfile; then
11492         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11493                 else
11494                         echo "We won't be including <fcntl.h>." >&4
11495                 fi
11496         fi
11497         ;;
11498 *)
11499         h_fcntl=false
11500         val="$undef"
11501         ;;
11502 esac
11503 set i_fcntl
11504 eval $setvar
11505
11506 : check for non-blocking I/O stuff
11507 case "$h_sysfile" in
11508 true) echo "#include <sys/file.h>" > head.c;;
11509 *)
11510        case "$h_fcntl" in
11511        true) echo "#include <fcntl.h>" > head.c;;
11512        *) echo "#include <sys/fcntl.h>" > head.c;;
11513        esac
11514        ;;
11515 esac
11516 echo " "
11517 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11518 case "$o_nonblock" in
11519 '')
11520         $cat head.c > try.c
11521         $cat >>try.c <<EOCP
11522 #include <stdio.h>
11523 #include <stdlib.h>
11524 #$i_fcntl I_FCNTL
11525 #ifdef I_FCNTL
11526 #include <fcntl.h>
11527 #endif
11528 int main() {
11529 #ifdef O_NONBLOCK
11530         printf("O_NONBLOCK\n");
11531         exit(0);
11532 #endif
11533 #ifdef O_NDELAY
11534         printf("O_NDELAY\n");
11535         exit(0);
11536 #endif
11537 #ifdef FNDELAY
11538         printf("FNDELAY\n");
11539         exit(0);
11540 #endif
11541         exit(0);
11542 }
11543 EOCP
11544         set try
11545         if eval $compile_ok; then
11546                 o_nonblock=`$run ./try`
11547                 case "$o_nonblock" in
11548                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11549                 *) echo "Seems like we can use $o_nonblock.";;
11550                 esac
11551         else
11552                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11553         fi
11554         ;;
11555 *) echo "Using $hint value $o_nonblock.";;
11556 esac
11557 $rm -f try try.* .out core
11558
11559 echo " "
11560 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11561 case "$eagain" in
11562 '')
11563         $cat head.c > try.c
11564         $cat >>try.c <<EOCP
11565 #include <errno.h>
11566 #include <sys/types.h>
11567 #include <signal.h>
11568 #include <stdio.h> 
11569 #include <stdlib.h> 
11570 #$i_fcntl I_FCNTL
11571 #ifdef I_FCNTL
11572 #include <fcntl.h>
11573 #endif
11574 #define MY_O_NONBLOCK $o_nonblock
11575 #ifndef errno  /* XXX need better Configure test */
11576 extern int errno;
11577 #endif
11578 #$i_unistd I_UNISTD
11579 #ifdef I_UNISTD
11580 #include <unistd.h>
11581 #endif
11582 #$i_string I_STRING
11583 #ifdef I_STRING
11584 #include <string.h>
11585 #else
11586 #include <strings.h>
11587 #endif
11588 $signal_t blech(x) int x; { exit(3); }
11589 EOCP
11590         $cat >> try.c <<'EOCP'
11591 int main()
11592 {
11593         int pd[2];
11594         int pu[2];
11595         char buf[1];
11596         char string[100];
11597
11598         pipe(pd);       /* Down: child -> parent */
11599         pipe(pu);       /* Up: parent -> child */
11600         if (0 != fork()) {
11601                 int ret;
11602                 close(pd[1]);   /* Parent reads from pd[0] */
11603                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11604 #ifdef F_SETFL
11605                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11606                         exit(1);
11607 #else
11608                 exit(4);
11609 #endif
11610                 signal(SIGALRM, blech);
11611                 alarm(5);
11612                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11613                         exit(2);
11614                 sprintf(string, "%d\n", ret);
11615                 write(2, string, strlen(string));
11616                 alarm(0);
11617 #ifdef EAGAIN
11618                 if (errno == EAGAIN) {
11619                         printf("EAGAIN\n");
11620                         goto ok;
11621                 }
11622 #endif
11623 #ifdef EWOULDBLOCK
11624                 if (errno == EWOULDBLOCK)
11625                         printf("EWOULDBLOCK\n");
11626 #endif
11627         ok:
11628                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11629                 sleep(2);                               /* Give it time to close our pipe */
11630                 alarm(5);
11631                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11632                 alarm(0);
11633                 sprintf(string, "%d\n", ret);
11634                 write(4, string, strlen(string));
11635                 exit(0);
11636         }
11637
11638         close(pd[0]);                   /* We write to pd[1] */
11639         close(pu[1]);                   /* We read from pu[0] */
11640         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11641         close(pd[1]);                   /* Pipe pd is now fully closed! */
11642         exit(0);                                /* Bye bye, thank you for playing! */
11643 }
11644 EOCP
11645         set try
11646         if eval $compile_ok; then
11647                 echo "$startsh" >mtry
11648                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11649                 chmod +x mtry
11650                 ./mtry >/dev/null 2>&1
11651                 case $? in
11652                 0) eagain=`$cat try.out`;;
11653                 1) echo "Could not perform non-blocking setting!";;
11654                 2) echo "I did a successful read() for something that was not there!";;
11655                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11656                 4) echo "Could not find F_SETFL!";;
11657                 *) echo "Something terribly wrong happened during testing.";;
11658                 esac
11659                 rd_nodata=`$cat try.ret`
11660                 echo "A read() system call with no data present returns $rd_nodata."
11661                 case "$rd_nodata" in
11662                 0|-1) ;;
11663                 *)
11664                         echo "(That's peculiar, fixing that to be -1.)"
11665                         rd_nodata=-1
11666                         ;;
11667                 esac
11668                 case "$eagain" in
11669                 '')
11670                         echo "Forcing errno EAGAIN on read() with no data available."
11671                         eagain=EAGAIN
11672                         ;;
11673                 *)
11674                         echo "Your read() sets errno to $eagain when no data is available."
11675                         ;;
11676                 esac
11677                 status=`$cat try.err`
11678                 case "$status" in
11679                 0) echo "And it correctly returns 0 to signal EOF.";;
11680                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11681                 *) echo "However, your read() returns '$status' on EOF??";;
11682                 esac
11683                 val="$define"
11684                 if test "$status" = "$rd_nodata"; then
11685                         echo "WARNING: you can't distinguish between EOF and no data!"
11686                         val="$undef"
11687                 fi
11688         else
11689                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11690                 eagain=EAGAIN
11691         fi
11692         set d_eofnblk
11693         eval $setvar
11694         ;;
11695 *)
11696         echo "Using $hint value $eagain."
11697         echo "Your read() returns $rd_nodata when no data is present."
11698         case "$d_eofnblk" in
11699         "$define") echo "And you can see EOF because read() returns 0.";;
11700         "$undef") echo "But you can't see EOF status from read() returned value.";;
11701         *)
11702                 echo "(Assuming you can't see EOF status from read anyway.)"
11703                 d_eofnblk=$undef
11704                 ;;
11705         esac
11706         ;;
11707 esac
11708 $rm -f try try.* .out core head.c mtry
11709
11710 : see if fchdir exists
11711 set fchdir d_fchdir
11712 eval $inlibc
11713
11714 : see if fchmod exists
11715 set fchmod d_fchmod
11716 eval $inlibc
11717
11718 : see if fchown exists
11719 set fchown d_fchown
11720 eval $inlibc
11721
11722 : see if this is an fcntl system
11723 set fcntl d_fcntl
11724 eval $inlibc
11725
11726 echo " "
11727 : See if fcntl-based locking works.
11728 $cat >try.c <<EOCP
11729 #include <stdlib.h>
11730 #include <unistd.h>
11731 #include <fcntl.h>
11732 #include <signal.h>
11733 $signal_t blech(x) int x; { exit(3); }
11734 int main() {
11735 #if defined(F_SETLK) && defined(F_SETLKW)
11736      struct flock flock;
11737      int retval, fd;
11738      fd = open("try.c", O_RDONLY);
11739      flock.l_type = F_RDLCK;
11740      flock.l_whence = SEEK_SET;
11741      flock.l_start = flock.l_len = 0;
11742      signal(SIGALRM, blech);
11743      alarm(10);
11744      retval = fcntl(fd, F_SETLK, &flock);
11745      close(fd);
11746      (retval < 0 ? exit(2) : exit(0));
11747 #else
11748      exit(2);
11749 #endif
11750 }
11751 EOCP
11752 echo "Checking if fcntl-based file locking works... "
11753 case "$d_fcntl" in
11754 "$define")
11755         set try
11756         if eval $compile_ok; then
11757                 if $run ./try; then
11758                         echo "Yes, it seems to work."
11759                         val="$define"
11760                 else
11761                         echo "Nope, it didn't work."
11762                         val="$undef"
11763                         case "$?" in
11764                         3) $cat >&4 <<EOM
11765 ***
11766 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11767 *** This is (almost) impossible.
11768 *** If your NFS lock daemons are not feeling well, something like
11769 *** this may happen, please investigate.  Cannot continue, aborting.
11770 ***
11771 EOM
11772                                 exit 1
11773                                 ;;
11774                         esac
11775                 fi
11776         else
11777                 echo "I'm unable to compile the test program, so I'll assume not."
11778                 val="$undef"
11779         fi
11780         ;;
11781 *) val="$undef";
11782         echo "Nope, since you don't even have fcntl()."
11783         ;;
11784 esac
11785 set d_fcntl_can_lock
11786 eval $setvar
11787 $rm -f try*
11788
11789
11790 : check for fd_set items
11791 $cat <<EOM
11792
11793 Checking to see how well your C compiler handles fd_set and friends ...
11794 EOM
11795 $cat >try.c <<EOCP
11796 #$i_systime I_SYS_TIME
11797 #$i_sysselct I_SYS_SELECT
11798 #$d_socket HAS_SOCKET
11799 #include <sys/types.h>
11800 #ifdef HAS_SOCKET
11801 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11802 #endif
11803 #ifdef I_SYS_TIME
11804 #include <sys/time.h>
11805 #endif
11806 #ifdef I_SYS_SELECT
11807 #include <sys/select.h>
11808 #endif
11809 int main() {
11810         fd_set fds;
11811
11812 #ifdef TRYBITS
11813         if(fds.fds_bits);
11814 #endif
11815
11816 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11817         exit(0);
11818 #else
11819         exit(1);
11820 #endif
11821 }
11822 EOCP
11823 set try -DTRYBITS
11824 if eval $compile; then
11825         d_fds_bits="$define"
11826         d_fd_set="$define"
11827         echo "Well, your system knows about the normal fd_set typedef..." >&4
11828         if $run ./try; then
11829                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11830                 d_fd_macros="$define"
11831         else
11832                 $cat >&4 <<'EOM'
11833 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11834 EOM
11835                 d_fd_macros="$undef"
11836         fi
11837 else
11838         $cat <<'EOM'
11839 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11840 EOM
11841         set try
11842         if eval $compile; then
11843                 d_fds_bits="$undef"
11844                 d_fd_set="$define"
11845                 echo "Well, your system has some sort of fd_set available..." >&4
11846                 if $run ./try; then
11847                         echo "and you have the normal fd_set macros." >&4
11848                         d_fd_macros="$define"
11849                 else
11850                         $cat <<'EOM'
11851 but not the normal fd_set macros!  Gross!  More work for me...
11852 EOM
11853                         d_fd_macros="$undef"
11854                 fi
11855         else
11856         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11857                 d_fd_set="$undef"
11858                 d_fds_bits="$undef"
11859                 d_fd_macros="$undef"
11860         fi
11861 fi
11862 $rm -f try try.*
11863
11864 : see if fgetpos exists
11865 set fgetpos d_fgetpos
11866 eval $inlibc
11867
11868 : see if finite exists
11869 set finite d_finite
11870 eval $inlibc
11871
11872 : see if finitel exists
11873 set finitel d_finitel
11874 eval $inlibc
11875
11876 : see if flock exists
11877 set flock d_flock
11878 eval $inlibc
11879
11880 : see if prototype for flock is available
11881 echo " "
11882 set d_flockproto flock $i_sysfile sys/file.h
11883 eval $hasproto
11884
11885 : see if fork exists
11886 set fork d_fork
11887 eval $inlibc
11888
11889 : see if fp_class exists
11890 set fp_class d_fp_class
11891 eval $inlibc
11892
11893 : see if pathconf exists
11894 set pathconf d_pathconf
11895 eval $inlibc
11896
11897 : see if fpathconf exists
11898 set fpathconf d_fpathconf
11899 eval $inlibc
11900
11901 : see if fpclass exists
11902 set fpclass d_fpclass
11903 eval $inlibc
11904
11905 : see if fpclassify exists
11906 set fpclassify d_fpclassify
11907 eval $inlibc
11908
11909 : see if fpclassl exists
11910 set fpclassl d_fpclassl
11911 eval $inlibc
11912
11913
11914 : check for fpos64_t
11915 echo " "
11916 echo "Checking to see if you have fpos64_t..." >&4
11917 $cat >try.c <<EOCP
11918 #include <stdio.h>
11919 int main() { fpos64_t x = 7; }
11920 EOCP
11921 set try
11922 if eval $compile; then
11923         val="$define"
11924         echo "You have fpos64_t."
11925 else
11926         val="$undef"
11927         echo "You do not have fpos64_t."
11928         case "$fpossize" in
11929         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11930         esac
11931 fi
11932 $rm -f try.* try
11933 set d_fpos64_t
11934 eval $setvar
11935
11936 : see if frexpl exists
11937 set frexpl d_frexpl
11938 eval $inlibc
11939
11940 : see if this is a sys/param system
11941 set sys/param.h i_sysparam
11942 eval $inhdr
11943
11944 : see if this is a sys/mount.h system
11945 set sys/mount.h i_sysmount
11946 eval $inhdr
11947
11948
11949 echo " "
11950 echo "Checking to see if your system supports struct fs_data..." >&4
11951 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11952 eval $hasstruct
11953 case "$d_fs_data_s" in
11954 "$define")      echo "Yes, it does."   ;;
11955 *)              echo "No, it doesn't." ;;
11956 esac
11957
11958 : see if fseeko exists
11959 set fseeko d_fseeko
11960 eval $inlibc
11961 case "$longsize" in
11962 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11963 esac
11964
11965 : see if fsetpos exists
11966 set fsetpos d_fsetpos
11967 eval $inlibc
11968
11969
11970 : see if fstatfs exists
11971 set fstatfs d_fstatfs
11972 eval $inlibc
11973
11974
11975 : see if statvfs exists
11976 set statvfs d_statvfs
11977 eval $inlibc
11978
11979 : see if fstatvfs exists
11980 set fstatvfs d_fstatvfs
11981 eval $inlibc
11982
11983
11984 : see if fsync exists
11985 set fsync d_fsync
11986 eval $inlibc
11987
11988 : see if ftello exists
11989 set ftello d_ftello
11990 eval $inlibc
11991 case "$longsize" in
11992 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11993 esac
11994
11995 : see if getcwd exists
11996 set getcwd d_getcwd
11997 eval $inlibc
11998
11999 : see if getespwnam exists
12000 set getespwnam d_getespwnam
12001 eval $inlibc
12002
12003
12004 : see if getfsstat exists
12005 set getfsstat d_getfsstat
12006 eval $inlibc
12007
12008 : see if getgrent exists
12009 set getgrent d_getgrent
12010 eval $inlibc
12011
12012 : see if getgrent_r exists
12013 set getgrent_r d_getgrent_r
12014 eval $inlibc
12015 case "$d_getgrent_r" in
12016 "$define")
12017         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12018         case "$d_getgrent_r_proto:$usethreads" in
12019         ":define")      d_getgrent_r_proto=define
12020                 set d_getgrent_r_proto getgrent_r $hdrs
12021                 eval $hasproto ;;
12022         *)      ;;
12023         esac
12024         case "$d_getgrent_r_proto" in
12025         define)
12026         case "$getgrent_r_proto" in
12027         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12028         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12029         esac
12030         case "$getgrent_r_proto" in
12031         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12032         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12033         esac
12034         case "$getgrent_r_proto" in
12035         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12036         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12037         esac
12038         case "$getgrent_r_proto" in
12039         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12040         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12041         esac
12042         case "$getgrent_r_proto" in
12043         ''|0) try='int getgrent_r(struct group*, char*, int);'
12044         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12045         esac
12046         case "$getgrent_r_proto" in
12047         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12048         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12049         esac
12050         case "$getgrent_r_proto" in
12051         ''|0)   d_getgrent_r=undef
12052                 getgrent_r_proto=0
12053                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12054         * )     case "$getgrent_r_proto" in
12055                 REENTRANT_PROTO*) ;;
12056                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12057                 esac
12058                 echo "Prototype: $try" ;;
12059         esac
12060         ;;
12061         *)      case "$usethreads" in
12062                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12063                 esac
12064                 d_getgrent_r=undef
12065                 getgrent_r_proto=0
12066                 ;;
12067         esac
12068         ;;
12069 *)      getgrent_r_proto=0
12070         ;;
12071 esac
12072
12073 : see if getgrgid_r exists
12074 set getgrgid_r d_getgrgid_r
12075 eval $inlibc
12076 case "$d_getgrgid_r" in
12077 "$define")
12078         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12079         case "$d_getgrgid_r_proto:$usethreads" in
12080         ":define")      d_getgrgid_r_proto=define
12081                 set d_getgrgid_r_proto getgrgid_r $hdrs
12082                 eval $hasproto ;;
12083         *)      ;;
12084         esac
12085         case "$d_getgrgid_r_proto" in
12086         define)
12087         case "$getgrgid_r_proto" in
12088         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12089         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12090         esac
12091         case "$getgrgid_r_proto" in
12092         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12093         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12094         esac
12095         case "$getgrgid_r_proto" in
12096         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12097         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12098         esac
12099         case "$getgrgid_r_proto" in
12100         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12101         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12102         esac
12103         case "$getgrgid_r_proto" in
12104         ''|0)   d_getgrgid_r=undef
12105                 getgrgid_r_proto=0
12106                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12107         * )     case "$getgrgid_r_proto" in
12108                 REENTRANT_PROTO*) ;;
12109                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12110                 esac
12111                 echo "Prototype: $try" ;;
12112         esac
12113         ;;
12114         *)      case "$usethreads" in
12115                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12116                 esac
12117                 d_getgrgid_r=undef
12118                 getgrgid_r_proto=0
12119                 ;;
12120         esac
12121         ;;
12122 *)      getgrgid_r_proto=0
12123         ;;
12124 esac
12125
12126 : see if getgrnam_r exists
12127 set getgrnam_r d_getgrnam_r
12128 eval $inlibc
12129 case "$d_getgrnam_r" in
12130 "$define")
12131         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12132         case "$d_getgrnam_r_proto:$usethreads" in
12133         ":define")      d_getgrnam_r_proto=define
12134                 set d_getgrnam_r_proto getgrnam_r $hdrs
12135                 eval $hasproto ;;
12136         *)      ;;
12137         esac
12138         case "$d_getgrnam_r_proto" in
12139         define)
12140         case "$getgrnam_r_proto" in
12141         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12142         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12143         esac
12144         case "$getgrnam_r_proto" in
12145         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12146         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12147         esac
12148         case "$getgrnam_r_proto" in
12149         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12150         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12151         esac
12152         case "$getgrnam_r_proto" in
12153         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12154         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12155         esac
12156         case "$getgrnam_r_proto" in
12157         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12158         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12159         esac
12160         case "$getgrnam_r_proto" in
12161         ''|0)   d_getgrnam_r=undef
12162                 getgrnam_r_proto=0
12163                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12164         * )     case "$getgrnam_r_proto" in
12165                 REENTRANT_PROTO*) ;;
12166                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12167                 esac
12168                 echo "Prototype: $try" ;;
12169         esac
12170         ;;
12171         *)      case "$usethreads" in
12172                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12173                 esac
12174                 d_getgrnam_r=undef
12175                 getgrnam_r_proto=0
12176                 ;;
12177         esac
12178         ;;
12179 *)      getgrnam_r_proto=0
12180         ;;
12181 esac
12182
12183 : see if gethostbyaddr exists
12184 set gethostbyaddr d_gethbyaddr
12185 eval $inlibc
12186
12187 : see if gethostbyname exists
12188 set gethostbyname d_gethbyname
12189 eval $inlibc
12190
12191 : see if gethostent exists
12192 set gethostent d_gethent
12193 eval $inlibc
12194
12195 : see how we will look up host name
12196 echo " "
12197 call=''
12198 if set gethostname val -f d_gethname; eval $csym; $val; then
12199         echo 'gethostname() found.' >&4
12200         d_gethname="$define"
12201         call=gethostname
12202 fi
12203 if set uname val -f d_uname; eval $csym; $val; then
12204         if ./xenix; then
12205                 $cat <<'EOM'
12206 uname() was found, but you're running xenix, and older versions of xenix
12207 have a broken uname(). If you don't really know whether your xenix is old
12208 enough to have a broken system call, use the default answer.
12209
12210 EOM
12211                 dflt=y
12212                 case "$d_uname" in
12213                 "$define") dflt=n;;
12214                 esac
12215                 rp='Is your uname() broken?'
12216                 . ./myread
12217                 case "$ans" in
12218                 n*) d_uname="$define"; call=uname;;
12219                 esac
12220         else
12221                 echo 'uname() found.' >&4
12222                 d_uname="$define"
12223                 case "$call" in
12224                 '') call=uname ;;
12225                 esac
12226         fi
12227 fi
12228 case "$d_gethname" in
12229 '') d_gethname="$undef";;
12230 esac
12231 case "$d_uname" in
12232 '') d_uname="$undef";;
12233 esac
12234 case "$d_uname$d_gethname" in
12235 *define*)
12236         dflt=n
12237         cat <<EOM
12238  
12239 Every now and then someone has a $call() that lies about the hostname
12240 but can't be fixed for political or economic reasons.  If you wish, I can
12241 pretend $call() isn't there and maybe compute hostname at run-time
12242 thanks to the '$phostname' command.
12243
12244 EOM
12245         rp="Shall I ignore $call() from now on?"
12246         . ./myread
12247         case "$ans" in
12248         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12249         esac;;
12250 esac
12251 case "$phostname" in
12252 '') aphostname='';;
12253 *) case "$aphostname" in
12254         /*) ;;
12255         *) set X $phostname
12256                 shift
12257                 file=$1
12258                 shift
12259                 file=`./loc $file $file $pth`
12260                 aphostname=`echo $file $*`
12261                 ;;
12262         esac
12263         ;;
12264 esac
12265 case "$d_uname$d_gethname" in
12266 *define*) ;;
12267 *)
12268         case "$phostname" in
12269         '')
12270                 echo "There will be no way for $package to get your hostname." >&4;;
12271         *)
12272         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12273                 ;;
12274         esac;;
12275 esac
12276 case "$d_phostname" in
12277 '') d_phostname="$undef";;
12278 esac
12279
12280 : see if gethostbyaddr_r exists
12281 set gethostbyaddr_r d_gethostbyaddr_r
12282 eval $inlibc
12283 case "$d_gethostbyaddr_r" in
12284 "$define")
12285         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12286         case "$d_gethostbyaddr_r_proto:$usethreads" in
12287         ":define")      d_gethostbyaddr_r_proto=define
12288                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12289                 eval $hasproto ;;
12290         *)      ;;
12291         esac
12292         case "$d_gethostbyaddr_r_proto" in
12293         define)
12294         case "$gethostbyaddr_r_proto" in
12295         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12296         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12297         esac
12298         case "$gethostbyaddr_r_proto" in
12299         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12300         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12301         esac
12302         case "$gethostbyaddr_r_proto" in
12303         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12304         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12305         esac
12306         case "$gethostbyaddr_r_proto" in
12307         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12308         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12309         esac
12310         case "$gethostbyaddr_r_proto" in
12311         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12312         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12313         esac
12314         case "$gethostbyaddr_r_proto" in
12315         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12316         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12317         esac
12318         case "$gethostbyaddr_r_proto" in
12319         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12320         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12321         esac
12322         case "$gethostbyaddr_r_proto" in
12323         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12324         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12325         esac
12326         case "$gethostbyaddr_r_proto" in
12327         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12328         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12329         esac
12330         case "$gethostbyaddr_r_proto" in
12331         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12332         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12333         esac
12334         case "$gethostbyaddr_r_proto" in
12335         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12336         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12337         esac
12338         case "$gethostbyaddr_r_proto" in
12339         ''|0)   d_gethostbyaddr_r=undef
12340                 gethostbyaddr_r_proto=0
12341                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12342         * )     case "$gethostbyaddr_r_proto" in
12343                 REENTRANT_PROTO*) ;;
12344                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12345                 esac
12346                 echo "Prototype: $try" ;;
12347         esac
12348         ;;
12349         *)      case "$usethreads" in
12350                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12351                 esac
12352                 d_gethostbyaddr_r=undef
12353                 gethostbyaddr_r_proto=0
12354                 ;;
12355         esac
12356         ;;
12357 *)      gethostbyaddr_r_proto=0
12358         ;;
12359 esac
12360
12361 : see if gethostbyname_r exists
12362 set gethostbyname_r d_gethostbyname_r
12363 eval $inlibc
12364 case "$d_gethostbyname_r" in
12365 "$define")
12366         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12367         case "$d_gethostbyname_r_proto:$usethreads" in
12368         ":define")      d_gethostbyname_r_proto=define
12369                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12370                 eval $hasproto ;;
12371         *)      ;;
12372         esac
12373         case "$d_gethostbyname_r_proto" in
12374         define)
12375         case "$gethostbyname_r_proto" in
12376         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12377         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12378         esac
12379         case "$gethostbyname_r_proto" in
12380         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12381         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12382         esac
12383         case "$gethostbyname_r_proto" in
12384         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12385         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12386         esac
12387         case "$gethostbyname_r_proto" in
12388         ''|0)   d_gethostbyname_r=undef
12389                 gethostbyname_r_proto=0
12390                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12391         * )     case "$gethostbyname_r_proto" in
12392                 REENTRANT_PROTO*) ;;
12393                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12394                 esac
12395                 echo "Prototype: $try" ;;
12396         esac
12397         ;;
12398         *)      case "$usethreads" in
12399                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12400                 esac
12401                 d_gethostbyname_r=undef
12402                 gethostbyname_r_proto=0
12403                 ;;
12404         esac
12405         ;;
12406 *)      gethostbyname_r_proto=0
12407         ;;
12408 esac
12409
12410 : see if gethostent_r exists
12411 set gethostent_r d_gethostent_r
12412 eval $inlibc
12413 case "$d_gethostent_r" in
12414 "$define")
12415         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12416         case "$d_gethostent_r_proto:$usethreads" in
12417         ":define")      d_gethostent_r_proto=define
12418                 set d_gethostent_r_proto gethostent_r $hdrs
12419                 eval $hasproto ;;
12420         *)      ;;
12421         esac
12422         case "$d_gethostent_r_proto" in
12423         define)
12424         case "$gethostent_r_proto" in
12425         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12426         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12427         esac
12428         case "$gethostent_r_proto" in
12429         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12430         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12431         esac
12432         case "$gethostent_r_proto" in
12433         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12434         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12435         esac
12436         case "$gethostent_r_proto" in
12437         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12438         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12439         esac
12440         case "$gethostent_r_proto" in
12441         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12442         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12443         esac
12444         case "$gethostent_r_proto" in
12445         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12446         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12447         esac
12448         case "$gethostent_r_proto" in
12449         ''|0)   d_gethostent_r=undef
12450                 gethostent_r_proto=0
12451                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12452         * )     case "$gethostent_r_proto" in
12453                 REENTRANT_PROTO*) ;;
12454                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12455                 esac
12456                 echo "Prototype: $try" ;;
12457         esac
12458         ;;
12459         *)      case "$usethreads" in
12460                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12461                 esac
12462                 d_gethostent_r=undef
12463                 gethostent_r_proto=0
12464                 ;;
12465         esac
12466         ;;
12467 *)      gethostent_r_proto=0
12468         ;;
12469 esac
12470
12471 : see if prototypes for various gethostxxx netdb.h functions are available
12472 echo " "
12473 set d_gethostprotos gethostent $i_netdb netdb.h
12474 eval $hasproto
12475
12476 : see if getitimer exists
12477 set getitimer d_getitimer
12478 eval $inlibc
12479
12480 : see if getlogin exists
12481 set getlogin d_getlogin
12482 eval $inlibc
12483
12484 : see if getlogin_r exists
12485 set getlogin_r d_getlogin_r
12486 eval $inlibc
12487 case "$d_getlogin_r" in
12488 "$define")
12489         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12490         case "$d_getlogin_r_proto:$usethreads" in
12491         ":define")      d_getlogin_r_proto=define
12492                 set d_getlogin_r_proto getlogin_r $hdrs
12493                 eval $hasproto ;;
12494         *)      ;;
12495         esac
12496         case "$d_getlogin_r_proto" in
12497         define)
12498         case "$getlogin_r_proto" in
12499         ''|0) try='int getlogin_r(char*, size_t);'
12500         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12501         esac
12502         case "$getlogin_r_proto" in
12503         ''|0) try='int getlogin_r(char*, int);'
12504         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12505         esac
12506         case "$getlogin_r_proto" in
12507         ''|0) try='char* getlogin_r(char*, size_t);'
12508         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12509         esac
12510         case "$getlogin_r_proto" in
12511         ''|0) try='char* getlogin_r(char*, int);'
12512         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12513         esac
12514         case "$getlogin_r_proto" in
12515         ''|0)   d_getlogin_r=undef
12516                 getlogin_r_proto=0
12517                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12518         * )     case "$getlogin_r_proto" in
12519                 REENTRANT_PROTO*) ;;
12520                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12521                 esac
12522                 echo "Prototype: $try" ;;
12523         esac
12524         ;;
12525         *)      case "$usethreads" in
12526                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12527                 esac
12528                 d_getlogin_r=undef
12529                 getlogin_r_proto=0
12530                 ;;
12531         esac
12532         ;;
12533 *)      getlogin_r_proto=0
12534         ;;
12535 esac
12536
12537 : see if getmnt exists
12538 set getmnt d_getmnt
12539 eval $inlibc
12540
12541 : see if getmntent exists
12542 set getmntent d_getmntent
12543 eval $inlibc
12544
12545 : see if getnetbyaddr exists
12546 set getnetbyaddr d_getnbyaddr
12547 eval $inlibc
12548
12549 : see if getnetbyname exists
12550 set getnetbyname d_getnbyname
12551 eval $inlibc
12552
12553 : see if getnetent exists
12554 set getnetent d_getnent
12555 eval $inlibc
12556
12557 : see if getnetbyaddr_r exists
12558 set getnetbyaddr_r d_getnetbyaddr_r
12559 eval $inlibc
12560 case "$d_getnetbyaddr_r" in
12561 "$define")
12562         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12563         case "$d_getnetbyaddr_r_proto:$usethreads" in
12564         ":define")      d_getnetbyaddr_r_proto=define
12565                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12566                 eval $hasproto ;;
12567         *)      ;;
12568         esac
12569         case "$d_getnetbyaddr_r_proto" in
12570         define)
12571         case "$getnetbyaddr_r_proto" in
12572         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12573         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12574         esac
12575         case "$getnetbyaddr_r_proto" in
12576         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12577         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12578         esac
12579         case "$getnetbyaddr_r_proto" in
12580         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12581         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12582         esac
12583         case "$getnetbyaddr_r_proto" in
12584         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12585         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12586         esac
12587         case "$getnetbyaddr_r_proto" in
12588         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12589         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12590         esac
12591         case "$getnetbyaddr_r_proto" in
12592         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12593         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12594         esac
12595         case "$getnetbyaddr_r_proto" in
12596         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12597         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12598         esac
12599         case "$getnetbyaddr_r_proto" in
12600         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12601         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12602         esac
12603         case "$getnetbyaddr_r_proto" in
12604         ''|0)   d_getnetbyaddr_r=undef
12605                 getnetbyaddr_r_proto=0
12606                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12607         * )     case "$getnetbyaddr_r_proto" in
12608                 REENTRANT_PROTO*) ;;
12609                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12610                 esac
12611                 echo "Prototype: $try" ;;
12612         esac
12613         ;;
12614         *)      case "$usethreads" in
12615                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12616                 esac
12617                 d_getnetbyaddr_r=undef
12618                 getnetbyaddr_r_proto=0
12619                 ;;
12620         esac
12621         ;;
12622 *)      getnetbyaddr_r_proto=0
12623         ;;
12624 esac
12625
12626 : see if getnetbyname_r exists
12627 set getnetbyname_r d_getnetbyname_r
12628 eval $inlibc
12629 case "$d_getnetbyname_r" in
12630 "$define")
12631         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12632         case "$d_getnetbyname_r_proto:$usethreads" in
12633         ":define")      d_getnetbyname_r_proto=define
12634                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12635                 eval $hasproto ;;
12636         *)      ;;
12637         esac
12638         case "$d_getnetbyname_r_proto" in
12639         define)
12640         case "$getnetbyname_r_proto" in
12641         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12642         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12643         esac
12644         case "$getnetbyname_r_proto" in
12645         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12646         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12647         esac
12648         case "$getnetbyname_r_proto" in
12649         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12650         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12651         esac
12652         case "$getnetbyname_r_proto" in
12653         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12654         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12655         esac
12656         case "$getnetbyname_r_proto" in
12657         ''|0)   d_getnetbyname_r=undef
12658                 getnetbyname_r_proto=0
12659                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12660         * )     case "$getnetbyname_r_proto" in
12661                 REENTRANT_PROTO*) ;;
12662                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12663                 esac
12664                 echo "Prototype: $try" ;;
12665         esac
12666         ;;
12667         *)      case "$usethreads" in
12668                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12669                 esac
12670                 d_getnetbyname_r=undef
12671                 getnetbyname_r_proto=0
12672                 ;;
12673         esac
12674         ;;
12675 *)      getnetbyname_r_proto=0
12676         ;;
12677 esac
12678
12679 : see if getnetent_r exists
12680 set getnetent_r d_getnetent_r
12681 eval $inlibc
12682 case "$d_getnetent_r" in
12683 "$define")
12684         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12685         case "$d_getnetent_r_proto:$usethreads" in
12686         ":define")      d_getnetent_r_proto=define
12687                 set d_getnetent_r_proto getnetent_r $hdrs
12688                 eval $hasproto ;;
12689         *)      ;;
12690         esac
12691         case "$d_getnetent_r_proto" in
12692         define)
12693         case "$getnetent_r_proto" in
12694         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12695         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12696         esac
12697         case "$getnetent_r_proto" in
12698         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12699         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12700         esac
12701         case "$getnetent_r_proto" in
12702         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12703         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12704         esac
12705         case "$getnetent_r_proto" in
12706         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12707         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12708         esac
12709         case "$getnetent_r_proto" in
12710         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12711         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12712         esac
12713         case "$getnetent_r_proto" in
12714         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12715         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12716         esac
12717         case "$getnetent_r_proto" in
12718         ''|0)   d_getnetent_r=undef
12719                 getnetent_r_proto=0
12720                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12721         * )     case "$getnetent_r_proto" in
12722                 REENTRANT_PROTO*) ;;
12723                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12724                 esac
12725                 echo "Prototype: $try" ;;
12726         esac
12727         ;;
12728         *)      case "$usethreads" in
12729                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12730                 esac
12731                 d_getnetent_r=undef
12732                 getnetent_r_proto=0
12733                 ;;
12734         esac
12735         ;;
12736 *)      getnetent_r_proto=0
12737         ;;
12738 esac
12739
12740 : see if prototypes for various getnetxxx netdb.h functions are available
12741 echo " "
12742 set d_getnetprotos getnetent $i_netdb netdb.h
12743 eval $hasproto
12744
12745 : see if getpagesize exists
12746 set getpagesize d_getpagsz
12747 eval $inlibc
12748
12749
12750 : see if getprotobyname exists
12751 set getprotobyname d_getpbyname
12752 eval $inlibc
12753
12754 : see if getprotobynumber exists
12755 set getprotobynumber d_getpbynumber
12756 eval $inlibc
12757
12758 : see if getprotoent exists
12759 set getprotoent d_getpent
12760 eval $inlibc
12761
12762 : see if getpgid exists
12763 set getpgid d_getpgid
12764 eval $inlibc
12765
12766 : see if getpgrp2 exists
12767 set getpgrp2 d_getpgrp2
12768 eval $inlibc
12769
12770 : see if getppid exists
12771 set getppid d_getppid
12772 eval $inlibc
12773
12774 : see if getpriority exists
12775 set getpriority d_getprior
12776 eval $inlibc
12777
12778 : see if getprotobyname_r exists
12779 set getprotobyname_r d_getprotobyname_r
12780 eval $inlibc
12781 case "$d_getprotobyname_r" in
12782 "$define")
12783         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12784         case "$d_getprotobyname_r_proto:$usethreads" in
12785         ":define")      d_getprotobyname_r_proto=define
12786                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12787                 eval $hasproto ;;
12788         *)      ;;
12789         esac
12790         case "$d_getprotobyname_r_proto" in
12791         define)
12792         case "$getprotobyname_r_proto" in
12793         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12794         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12795         esac
12796         case "$getprotobyname_r_proto" in
12797         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12798         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12799         esac
12800         case "$getprotobyname_r_proto" in
12801         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12802         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12803         esac
12804         case "$getprotobyname_r_proto" in
12805         ''|0)   d_getprotobyname_r=undef
12806                 getprotobyname_r_proto=0
12807                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12808         * )     case "$getprotobyname_r_proto" in
12809                 REENTRANT_PROTO*) ;;
12810                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12811                 esac
12812                 echo "Prototype: $try" ;;
12813         esac
12814         ;;
12815         *)      case "$usethreads" in
12816                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12817                 esac
12818                 d_getprotobyname_r=undef
12819                 getprotobyname_r_proto=0
12820                 ;;
12821         esac
12822         ;;
12823 *)      getprotobyname_r_proto=0
12824         ;;
12825 esac
12826
12827 : see if getprotobynumber_r exists
12828 set getprotobynumber_r d_getprotobynumber_r
12829 eval $inlibc
12830 case "$d_getprotobynumber_r" in
12831 "$define")
12832         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12833         case "$d_getprotobynumber_r_proto:$usethreads" in
12834         ":define")      d_getprotobynumber_r_proto=define
12835                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12836                 eval $hasproto ;;
12837         *)      ;;
12838         esac
12839         case "$d_getprotobynumber_r_proto" in
12840         define)
12841         case "$getprotobynumber_r_proto" in
12842         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12843         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12844         esac
12845         case "$getprotobynumber_r_proto" in
12846         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12847         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12848         esac
12849         case "$getprotobynumber_r_proto" in
12850         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12851         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12852         esac
12853         case "$getprotobynumber_r_proto" in
12854         ''|0)   d_getprotobynumber_r=undef
12855                 getprotobynumber_r_proto=0
12856                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12857         * )     case "$getprotobynumber_r_proto" in
12858                 REENTRANT_PROTO*) ;;
12859                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12860                 esac
12861                 echo "Prototype: $try" ;;
12862         esac
12863         ;;
12864         *)      case "$usethreads" in
12865                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12866                 esac
12867                 d_getprotobynumber_r=undef
12868                 getprotobynumber_r_proto=0
12869                 ;;
12870         esac
12871         ;;
12872 *)      getprotobynumber_r_proto=0
12873         ;;
12874 esac
12875
12876 : see if getprotoent_r exists
12877 set getprotoent_r d_getprotoent_r
12878 eval $inlibc
12879 case "$d_getprotoent_r" in
12880 "$define")
12881         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12882         case "$d_getprotoent_r_proto:$usethreads" in
12883         ":define")      d_getprotoent_r_proto=define
12884                 set d_getprotoent_r_proto getprotoent_r $hdrs
12885                 eval $hasproto ;;
12886         *)      ;;
12887         esac
12888         case "$d_getprotoent_r_proto" in
12889         define)
12890         case "$getprotoent_r_proto" in
12891         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12892         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12893         esac
12894         case "$getprotoent_r_proto" in
12895         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12896         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12897         esac
12898         case "$getprotoent_r_proto" in
12899         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12900         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12901         esac
12902         case "$getprotoent_r_proto" in
12903         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12904         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12905         esac
12906         case "$getprotoent_r_proto" in
12907         ''|0)   d_getprotoent_r=undef
12908                 getprotoent_r_proto=0
12909                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12910         * )     case "$getprotoent_r_proto" in
12911                 REENTRANT_PROTO*) ;;
12912                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12913                 esac
12914                 echo "Prototype: $try" ;;
12915         esac
12916         ;;
12917         *)      case "$usethreads" in
12918                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12919                 esac
12920                 d_getprotoent_r=undef
12921                 getprotoent_r_proto=0
12922                 ;;
12923         esac
12924         ;;
12925 *)      getprotoent_r_proto=0
12926         ;;
12927 esac
12928
12929 : see if prototypes for various getprotoxxx netdb.h functions are available
12930 echo " "
12931 set d_getprotoprotos getprotoent $i_netdb netdb.h
12932 eval $hasproto
12933
12934 : see if getprpwnam exists
12935 set getprpwnam d_getprpwnam
12936 eval $inlibc
12937
12938 : see if getpwent exists
12939 set getpwent d_getpwent
12940 eval $inlibc
12941
12942 : see if getpwent_r exists
12943 set getpwent_r d_getpwent_r
12944 eval $inlibc
12945 case "$d_getpwent_r" in
12946 "$define")
12947         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12948         case "$d_getpwent_r_proto:$usethreads" in
12949         ":define")      d_getpwent_r_proto=define
12950                 set d_getpwent_r_proto getpwent_r $hdrs
12951                 eval $hasproto ;;
12952         *)      ;;
12953         esac
12954         case "$d_getpwent_r_proto" in
12955         define)
12956         case "$getpwent_r_proto" in
12957         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12958         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12959         esac
12960         case "$getpwent_r_proto" in
12961         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12962         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12963         esac
12964         case "$getpwent_r_proto" in
12965         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12966         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12967         esac
12968         case "$getpwent_r_proto" in
12969         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12970         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12971         esac
12972         case "$getpwent_r_proto" in
12973         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12974         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12975         esac
12976         case "$getpwent_r_proto" in
12977         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12978         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12979         esac
12980         case "$getpwent_r_proto" in
12981         ''|0)   d_getpwent_r=undef
12982                 getpwent_r_proto=0
12983                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12984         * )     case "$getpwent_r_proto" in
12985                 REENTRANT_PROTO*) ;;
12986                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12987                 esac
12988                 echo "Prototype: $try" ;;
12989         esac
12990         ;;
12991         *)      case "$usethreads" in
12992                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12993                 esac
12994                 d_getpwent_r=undef
12995                 getpwent_r_proto=0
12996                 ;;
12997         esac
12998         ;;
12999 *)      getpwent_r_proto=0
13000         ;;
13001 esac
13002
13003 : see if getpwnam_r exists
13004 set getpwnam_r d_getpwnam_r
13005 eval $inlibc
13006 case "$d_getpwnam_r" in
13007 "$define")
13008         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13009         case "$d_getpwnam_r_proto:$usethreads" in
13010         ":define")      d_getpwnam_r_proto=define
13011                 set d_getpwnam_r_proto getpwnam_r $hdrs
13012                 eval $hasproto ;;
13013         *)      ;;
13014         esac
13015         case "$d_getpwnam_r_proto" in
13016         define)
13017         case "$getpwnam_r_proto" in
13018         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13019         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13020         esac
13021         case "$getpwnam_r_proto" in
13022         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13023         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13024         esac
13025         case "$getpwnam_r_proto" in
13026         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13027         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13028         esac
13029         case "$getpwnam_r_proto" in
13030         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13031         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13032         esac
13033         case "$getpwnam_r_proto" in
13034         ''|0)   d_getpwnam_r=undef
13035                 getpwnam_r_proto=0
13036                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13037         * )     case "$getpwnam_r_proto" in
13038                 REENTRANT_PROTO*) ;;
13039                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13040                 esac
13041                 echo "Prototype: $try" ;;
13042         esac
13043         ;;
13044         *)      case "$usethreads" in
13045                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13046                 esac
13047                 d_getpwnam_r=undef
13048                 getpwnam_r_proto=0
13049                 ;;
13050         esac
13051         ;;
13052 *)      getpwnam_r_proto=0
13053         ;;
13054 esac
13055
13056 : see if getpwuid_r exists
13057 set getpwuid_r d_getpwuid_r
13058 eval $inlibc
13059 case "$d_getpwuid_r" in
13060 "$define")
13061         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13062         case "$d_getpwuid_r_proto:$usethreads" in
13063         ":define")      d_getpwuid_r_proto=define
13064                 set d_getpwuid_r_proto getpwuid_r $hdrs
13065                 eval $hasproto ;;
13066         *)      ;;
13067         esac
13068         case "$d_getpwuid_r_proto" in
13069         define)
13070         case "$getpwuid_r_proto" in
13071         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13072         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13073         esac
13074         case "$getpwuid_r_proto" in
13075         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13076         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13077         esac
13078         case "$getpwuid_r_proto" in
13079         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13080         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13081         esac
13082         case "$getpwuid_r_proto" in
13083         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13084         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13085         esac
13086         case "$getpwuid_r_proto" in
13087         ''|0)   d_getpwuid_r=undef
13088                 getpwuid_r_proto=0
13089                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13090         * )     case "$getpwuid_r_proto" in
13091                 REENTRANT_PROTO*) ;;
13092                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13093                 esac
13094                 echo "Prototype: $try" ;;
13095         esac
13096         ;;
13097         *)      case "$usethreads" in
13098                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13099                 esac
13100                 d_getpwuid_r=undef
13101                 getpwuid_r_proto=0
13102                 ;;
13103         esac
13104         ;;
13105 *)      getpwuid_r_proto=0
13106         ;;
13107 esac
13108
13109
13110 : see if getservbyname exists
13111 set getservbyname d_getsbyname
13112 eval $inlibc
13113
13114 : see if getservbyport exists
13115 set getservbyport d_getsbyport
13116 eval $inlibc
13117
13118 : see if getservent exists
13119 set getservent d_getsent
13120 eval $inlibc
13121
13122 : see if getservbyname_r exists
13123 set getservbyname_r d_getservbyname_r
13124 eval $inlibc
13125 case "$d_getservbyname_r" in
13126 "$define")
13127         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13128         case "$d_getservbyname_r_proto:$usethreads" in
13129         ":define")      d_getservbyname_r_proto=define
13130                 set d_getservbyname_r_proto getservbyname_r $hdrs
13131                 eval $hasproto ;;
13132         *)      ;;
13133         esac
13134         case "$d_getservbyname_r_proto" in
13135         define)
13136         case "$getservbyname_r_proto" in
13137         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13138         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13139         esac
13140         case "$getservbyname_r_proto" in
13141         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13142         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13143         esac
13144         case "$getservbyname_r_proto" in
13145         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13146         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13147         esac
13148         case "$getservbyname_r_proto" in
13149         ''|0)   d_getservbyname_r=undef
13150                 getservbyname_r_proto=0
13151                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13152         * )     case "$getservbyname_r_proto" in
13153                 REENTRANT_PROTO*) ;;
13154                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13155                 esac
13156                 echo "Prototype: $try" ;;
13157         esac
13158         ;;
13159         *)      case "$usethreads" in
13160                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13161                 esac
13162                 d_getservbyname_r=undef
13163                 getservbyname_r_proto=0
13164                 ;;
13165         esac
13166         ;;
13167 *)      getservbyname_r_proto=0
13168         ;;
13169 esac
13170
13171 : see if getservbyport_r exists
13172 set getservbyport_r d_getservbyport_r
13173 eval $inlibc
13174 case "$d_getservbyport_r" in
13175 "$define")
13176         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13177         case "$d_getservbyport_r_proto:$usethreads" in
13178         ":define")      d_getservbyport_r_proto=define
13179                 set d_getservbyport_r_proto getservbyport_r $hdrs
13180                 eval $hasproto ;;
13181         *)      ;;
13182         esac
13183         case "$d_getservbyport_r_proto" in
13184         define)
13185         case "$getservbyport_r_proto" in
13186         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13187         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13188         esac
13189         case "$getservbyport_r_proto" in
13190         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13191         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13192         esac
13193         case "$getservbyport_r_proto" in
13194         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13195         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13196         esac
13197         case "$getservbyport_r_proto" in
13198         ''|0)   d_getservbyport_r=undef
13199                 getservbyport_r_proto=0
13200                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13201         * )     case "$getservbyport_r_proto" in
13202                 REENTRANT_PROTO*) ;;
13203                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13204                 esac
13205                 echo "Prototype: $try" ;;
13206         esac
13207         ;;
13208         *)      case "$usethreads" in
13209                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13210                 esac
13211                 d_getservbyport_r=undef
13212                 getservbyport_r_proto=0
13213                 ;;
13214         esac
13215         ;;
13216 *)      getservbyport_r_proto=0
13217         ;;
13218 esac
13219
13220 : see if getservent_r exists
13221 set getservent_r d_getservent_r
13222 eval $inlibc
13223 case "$d_getservent_r" in
13224 "$define")
13225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13226         case "$d_getservent_r_proto:$usethreads" in
13227         ":define")      d_getservent_r_proto=define
13228                 set d_getservent_r_proto getservent_r $hdrs
13229                 eval $hasproto ;;
13230         *)      ;;
13231         esac
13232         case "$d_getservent_r_proto" in
13233         define)
13234         case "$getservent_r_proto" in
13235         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13236         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13237         esac
13238         case "$getservent_r_proto" in
13239         ''|0) try='int getservent_r(struct servent*, char*, int);'
13240         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13241         esac
13242         case "$getservent_r_proto" in
13243         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13244         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13245         esac
13246         case "$getservent_r_proto" in
13247         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13248         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13249         esac
13250         case "$getservent_r_proto" in
13251         ''|0)   d_getservent_r=undef
13252                 getservent_r_proto=0
13253                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13254         * )     case "$getservent_r_proto" in
13255                 REENTRANT_PROTO*) ;;
13256                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13257                 esac
13258                 echo "Prototype: $try" ;;
13259         esac
13260         ;;
13261         *)      case "$usethreads" in
13262                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13263                 esac
13264                 d_getservent_r=undef
13265                 getservent_r_proto=0
13266                 ;;
13267         esac
13268         ;;
13269 *)      getservent_r_proto=0
13270         ;;
13271 esac
13272
13273 : see if prototypes for various getservxxx netdb.h functions are available
13274 echo " "
13275 set d_getservprotos getservent $i_netdb netdb.h
13276 eval $hasproto
13277
13278 : see if getspnam exists
13279 set getspnam d_getspnam
13280 eval $inlibc
13281
13282 : see if this is a shadow.h system
13283 set shadow.h i_shadow
13284 eval $inhdr
13285
13286 : see if getspnam_r exists
13287 set getspnam_r d_getspnam_r
13288 eval $inlibc
13289 case "$d_getspnam_r" in
13290 "$define")
13291         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13292         case "$d_getspnam_r_proto:$usethreads" in
13293         ":define")      d_getspnam_r_proto=define
13294                 set d_getspnam_r_proto getspnam_r $hdrs
13295                 eval $hasproto ;;
13296         *)      ;;
13297         esac
13298         case "$d_getspnam_r_proto" in
13299         define)
13300         case "$getspnam_r_proto" in
13301         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13302         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13303         esac
13304         case "$getspnam_r_proto" in
13305         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13306         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13307         esac
13308         case "$getspnam_r_proto" in
13309         ''|0)   d_getspnam_r=undef
13310                 getspnam_r_proto=0
13311                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13312         * )     case "$getspnam_r_proto" in
13313                 REENTRANT_PROTO*) ;;
13314                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13315                 esac
13316                 echo "Prototype: $try" ;;
13317         esac
13318         ;;
13319         *)      case "$usethreads" in
13320                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13321                 esac
13322                 d_getspnam_r=undef
13323                 getspnam_r_proto=0
13324                 ;;
13325         esac
13326         ;;
13327 *)      getspnam_r_proto=0
13328         ;;
13329 esac
13330
13331 : see if gettimeofday or ftime exists
13332 set gettimeofday d_gettimeod
13333 eval $inlibc
13334 case "$d_gettimeod" in
13335 "$undef")
13336         set ftime d_ftime 
13337         eval $inlibc
13338         ;;
13339 *)
13340         val="$undef"; set d_ftime; eval $setvar
13341         ;;
13342 esac
13343 case "$d_gettimeod$d_ftime" in
13344 "$undef$undef")
13345         echo " "
13346         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13347         ;;
13348 esac
13349
13350 : see if gmtime_r exists
13351 set gmtime_r d_gmtime_r
13352 eval $inlibc
13353 case "$d_gmtime_r" in
13354 "$define")
13355         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13356         case "$d_gmtime_r_proto:$usethreads" in
13357         ":define")      d_gmtime_r_proto=define
13358                 set d_gmtime_r_proto gmtime_r $hdrs
13359                 eval $hasproto ;;
13360         *)      ;;
13361         esac
13362         case "$d_gmtime_r_proto" in
13363         define)
13364         case "$gmtime_r_proto" in
13365         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13366         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13367         esac
13368         case "$gmtime_r_proto" in
13369         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13370         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13371         esac
13372         case "$gmtime_r_proto" in
13373         ''|0)   d_gmtime_r=undef
13374                 gmtime_r_proto=0
13375                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13376         * )     case "$gmtime_r_proto" in
13377                 REENTRANT_PROTO*) ;;
13378                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13379                 esac
13380                 echo "Prototype: $try" ;;
13381         esac
13382         ;;
13383         *)      case "$usethreads" in
13384                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13385                 esac
13386                 d_gmtime_r=undef
13387                 gmtime_r_proto=0
13388                 ;;
13389         esac
13390         ;;
13391 *)      gmtime_r_proto=0
13392         ;;
13393 esac
13394
13395 : see if hasmntopt exists
13396 set hasmntopt d_hasmntopt
13397 eval $inlibc
13398
13399 : see if this is a netinet/in.h or sys/in.h system
13400 set netinet/in.h i_niin sys/in.h i_sysin
13401 eval $inhdr
13402
13403 : see if arpa/inet.h has to be included
13404 set arpa/inet.h i_arpainet
13405 eval $inhdr
13406
13407 : see if htonl --and friends-- exists
13408 val=''
13409 set htonl val
13410 eval $inlibc
13411
13412 : Maybe they are macros.
13413 case "$val" in
13414 $undef)
13415         $cat >htonl.c <<EOM
13416 #include <stdio.h>
13417 #include <sys/types.h>
13418 #$i_niin I_NETINET_IN
13419 #$i_sysin I_SYS_IN
13420 #$i_arpainet I_ARPA_INET
13421 #ifdef I_NETINET_IN
13422 #include <netinet/in.h>
13423 #endif
13424 #ifdef I_SYS_IN
13425 #include <sys/in.h>
13426 #endif
13427 #ifdef I_ARPA_INET
13428 #include <arpa/inet.h>
13429 #endif
13430 #ifdef htonl
13431 printf("Defined as a macro.");
13432 #endif
13433 EOM
13434         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13435         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13436                 val="$define"
13437                 echo "But it seems to be defined as a macro." >&4
13438         fi
13439         $rm -f htonl.?
13440         ;;
13441 esac
13442 set d_htonl
13443 eval $setvar
13444
13445 : index or strchr
13446 echo " "
13447 if set index val -f; eval $csym; $val; then
13448         if set strchr val -f d_strchr; eval $csym; $val; then
13449                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13450                         val="$define"
13451                         vali="$undef"
13452                         echo "strchr() found." >&4
13453                 else
13454                         val="$undef"
13455                         vali="$define"
13456                         echo "index() found." >&4
13457                 fi
13458         else
13459                 val="$undef"
13460                 vali="$define"
13461                 echo "index() found." >&4
13462         fi
13463 else
13464         if set strchr val -f d_strchr; eval $csym; $val; then
13465                 val="$define"
13466                 vali="$undef"
13467                 echo "strchr() found." >&4
13468         else
13469                 echo "No index() or strchr() found!" >&4
13470                 val="$undef"
13471                 vali="$undef"
13472         fi
13473 fi
13474 set d_strchr; eval $setvar
13475 val="$vali"
13476 set d_index; eval $setvar
13477
13478 : check whether inet_aton exists
13479 set inet_aton d_inetaton
13480 eval $inlibc
13481
13482 : Look for isascii
13483 echo " "
13484 $cat >isascii.c <<'EOCP'
13485 #include <stdio.h>
13486 #include <ctype.h>
13487 int main() {
13488         int c = 'A';
13489         if (isascii(c))
13490                 exit(0);
13491         else
13492                 exit(1);
13493 }
13494 EOCP
13495 set isascii
13496 if eval $compile; then
13497         echo "isascii() found." >&4
13498         val="$define"
13499 else
13500         echo "isascii() NOT found." >&4
13501         val="$undef"
13502 fi
13503 set d_isascii
13504 eval $setvar
13505 $rm -f isascii*
13506
13507 : see if isfinite exists
13508 set isfinite d_isfinite
13509 eval $inlibc
13510
13511 : see if isinf exists
13512 set isinf d_isinf
13513 eval $inlibc
13514
13515 : see if isnan exists
13516 set isnan d_isnan
13517 eval $inlibc
13518
13519 : see if isnanl exists
13520 set isnanl d_isnanl
13521 eval $inlibc
13522
13523 : see if killpg exists
13524 set killpg d_killpg
13525 eval $inlibc
13526
13527 : see if lchown exists
13528 echo " "
13529 $cat > try.c <<'EOCP'
13530 /* System header to define __stub macros and hopefully few prototypes,
13531     which can conflict with char lchown(); below.  */
13532 #include <assert.h>
13533 /* Override any gcc2 internal prototype to avoid an error.  */
13534 /* We use char because int might match the return type of a gcc2
13535    builtin and then its argument prototype would still apply.  */
13536 char lchown();
13537 int main() {
13538     /*  The GNU C library defines this for functions which it implements
13539         to always fail with ENOSYS.  Some functions are actually named
13540         something starting with __ and the normal name is an alias.  */
13541 #if defined (__stub_lchown) || defined (__stub___lchown)
13542 choke me
13543 #else
13544 lchown();
13545 #endif
13546 ; return 0; }
13547 EOCP
13548 set try
13549 if eval $compile; then
13550     $echo "lchown() found." >&4
13551     val="$define"
13552 else
13553     $echo "lchown() NOT found." >&4
13554     val="$undef"
13555 fi
13556 set d_lchown
13557 eval $setvar
13558
13559 : See if number of significant digits in a double precision number is known
13560 echo " "
13561 $cat >ldbl_dig.c <<EOM
13562 #$i_limits I_LIMITS
13563 #$i_float I_FLOAT
13564 #ifdef I_LIMITS
13565 #include <limits.h>
13566 #endif
13567 #ifdef I_FLOAT
13568 #include <float.h>
13569 #endif
13570 #ifdef LDBL_DIG
13571 printf("Contains LDBL_DIG");
13572 #endif
13573 EOM
13574 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13575 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13576         echo "LDBL_DIG found." >&4
13577         val="$define"
13578 else
13579         echo "LDBL_DIG NOT found." >&4
13580         val="$undef"
13581 fi
13582 $rm -f ldbl_dig.?
13583 set d_ldbl_dig
13584 eval $setvar
13585
13586 : see if link exists
13587 set link d_link
13588 eval $inlibc
13589
13590 : see if localtime_r exists
13591 set localtime_r d_localtime_r
13592 eval $inlibc
13593 case "$d_localtime_r" in
13594 "$define")
13595         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13596         case "$d_localtime_r_proto:$usethreads" in
13597         ":define")      d_localtime_r_proto=define
13598                 set d_localtime_r_proto localtime_r $hdrs
13599                 eval $hasproto ;;
13600         *)      ;;
13601         esac
13602         case "$d_localtime_r_proto" in
13603         define)
13604         case "$localtime_r_proto" in
13605         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13606         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13607         esac
13608         case "$localtime_r_proto" in
13609         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13610         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13611         esac
13612         case "$localtime_r_proto" in
13613         ''|0)   d_localtime_r=undef
13614                 localtime_r_proto=0
13615                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13616         * )     case "$localtime_r_proto" in
13617                 REENTRANT_PROTO*) ;;
13618                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13619                 esac
13620                 echo "Prototype: $try" ;;
13621         esac
13622         ;;
13623         *)      case "$usethreads" in
13624                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13625                 esac
13626                 d_localtime_r=undef
13627                 localtime_r_proto=0
13628                 ;;
13629         esac
13630         ;;
13631 *)      localtime_r_proto=0
13632         ;;
13633 esac
13634
13635 : see if localeconv exists
13636 set localeconv d_locconv
13637 eval $inlibc
13638
13639 : see if lockf exists
13640 set lockf d_lockf
13641 eval $inlibc
13642
13643 : see if prototype for lseek is available
13644 echo " "
13645 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13646 eval $hasproto
13647
13648 : see if lstat exists
13649 set lstat d_lstat
13650 eval $inlibc
13651
13652 : see if madvise exists
13653 set madvise d_madvise
13654 eval $inlibc
13655
13656 : see if mblen exists
13657 set mblen d_mblen
13658 eval $inlibc
13659
13660 : see if mbstowcs exists
13661 set mbstowcs d_mbstowcs
13662 eval $inlibc
13663
13664 : see if mbtowc exists
13665 set mbtowc d_mbtowc
13666 eval $inlibc
13667
13668 : see if memchr exists
13669 set memchr d_memchr
13670 eval $inlibc
13671
13672 : see if memcmp exists
13673 set memcmp d_memcmp
13674 eval $inlibc
13675
13676 : see if memcpy exists
13677 set memcpy d_memcpy
13678 eval $inlibc
13679
13680 : see if memmove exists
13681 set memmove d_memmove
13682 eval $inlibc
13683
13684 : see if memset exists
13685 set memset d_memset
13686 eval $inlibc
13687
13688 : see if mkdir exists
13689 set mkdir d_mkdir
13690 eval $inlibc
13691
13692 : see if mkdtemp exists
13693 set mkdtemp d_mkdtemp
13694 eval $inlibc
13695
13696 : see if mkfifo exists
13697 set mkfifo d_mkfifo
13698 eval $inlibc
13699
13700 : see if mkstemp exists
13701 set mkstemp d_mkstemp
13702 eval $inlibc
13703
13704 : see if mkstemps exists
13705 set mkstemps d_mkstemps
13706 eval $inlibc
13707
13708 : see if mktime exists
13709 set mktime d_mktime
13710 eval $inlibc
13711
13712 : see if this is a sys/mman.h system
13713 set sys/mman.h i_sysmman
13714 eval $inhdr
13715
13716 : see if mmap exists
13717 set mmap d_mmap
13718 eval $inlibc
13719 : see what shmat returns
13720 : default to something harmless
13721 mmaptype='void *'
13722 case "$i_sysmman$d_mmap" in
13723 "$define$define")
13724         $cat >mmap.c <<'END'
13725 #include <sys/mman.h>
13726 void *mmap();
13727 END
13728         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13729                 mmaptype='void *'
13730         else
13731                 mmaptype='caddr_t'
13732         fi
13733         echo "and it returns ($mmaptype)." >&4
13734         ;;
13735 esac
13736
13737
13738
13739 : see if mprotect exists
13740 set mprotect d_mprotect
13741 eval $inlibc
13742
13743 : see if msgctl exists
13744 set msgctl d_msgctl
13745 eval $inlibc
13746
13747 : see if msgget exists
13748 set msgget d_msgget
13749 eval $inlibc
13750
13751 : see if msgsnd exists
13752 set msgsnd d_msgsnd
13753 eval $inlibc
13754
13755 : see if msgrcv exists
13756 set msgrcv d_msgrcv
13757 eval $inlibc
13758
13759 : see how much of the 'msg*(2)' library is present.
13760 h_msg=true
13761 echo " "
13762 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13763 *"$undef"*) h_msg=false;;
13764 esac
13765 case "$osname" in
13766 freebsd)
13767     case "`ipcs 2>&1`" in
13768     "SVID messages"*"not configured"*)
13769         echo "Your $osname does not have the msg*(2) configured." >&4
13770         h_msg=false
13771         val="$undef"
13772         set msgctl d_msgctl
13773         eval $setvar
13774         set msgget d_msgget
13775         eval $setvar
13776         set msgsnd d_msgsnd
13777         eval $setvar
13778         set msgrcv d_msgrcv
13779         eval $setvar
13780         ;;
13781     esac
13782     ;;
13783 esac
13784 : we could also check for sys/ipc.h ...
13785 if $h_msg && $test `./findhdr sys/msg.h`; then
13786         echo "You have the full msg*(2) library." >&4
13787         val="$define"
13788 else
13789         echo "You don't have the full msg*(2) library." >&4
13790         val="$undef"
13791 fi
13792 set d_msg
13793 eval $setvar
13794
13795
13796 echo " "
13797 echo "Checking to see if your system supports struct msghdr..." >&4
13798 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13799 eval $hasstruct
13800 case "$d_msghdr_s" in
13801 "$define")      echo "Yes, it does."   ;;
13802 *)              echo "No, it doesn't." ;;
13803 esac
13804
13805
13806 : see if msync exists
13807 set msync d_msync
13808 eval $inlibc
13809
13810 : see if munmap exists
13811 set munmap d_munmap
13812 eval $inlibc
13813
13814 : see if nanosleep exists
13815 set nanosleep d_nanosleep
13816 eval $inlibc
13817
13818 : see if nice exists
13819 set nice d_nice
13820 eval $inlibc
13821
13822 : see if this is a langinfo.h system
13823 set langinfo.h i_langinfo
13824 eval $inhdr
13825
13826 : see if nl_langinfo exists
13827 set nl_langinfo d_nl_langinfo
13828 eval $inlibc
13829
13830 : check for length of character
13831 echo " "
13832 case "$charsize" in
13833 '')
13834         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13835         $cat >try.c <<EOCP
13836 #include <stdio.h>
13837 #$i_stdlib I_STDLIB
13838 #ifdef I_STDLIB
13839 #include <stdlib.h>
13840 #endif
13841 int main()
13842 {
13843     printf("%d\n", (int)sizeof(char));
13844     exit(0);
13845 }
13846 EOCP
13847         set try
13848         if eval $compile_ok; then
13849                 dflt=`$run ./try`
13850         else
13851                 dflt='1'
13852                 echo "(I can't seem to compile the test program.  Guessing...)"
13853         fi
13854         ;;
13855 *)
13856         dflt="$charsize"
13857         ;;
13858 esac
13859 rp="What is the size of a character (in bytes)?"
13860 . ./myread
13861 charsize="$ans"
13862 $rm -f try.c try
13863
13864 : check for volatile keyword
13865 echo " "
13866 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13867 $cat >try.c <<'EOCP'
13868 int main()
13869 {
13870         typedef struct _goo_struct goo_struct;
13871         goo_struct * volatile goo = ((goo_struct *)0);
13872         struct _goo_struct {
13873                 long long_int;
13874                 int reg_int;
13875                 char char_var;
13876         };
13877         typedef unsigned short foo_t;
13878         char *volatile foo;
13879         volatile int bar;
13880         volatile foo_t blech;
13881         foo = foo;
13882 }
13883 EOCP
13884 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13885         val="$define"
13886         echo "Yup, it does."
13887 else
13888         val="$undef"
13889         echo "Nope, it doesn't."
13890 fi
13891 set d_volatile
13892 eval $setvar
13893 $rm -f try.*
13894
13895
13896 echo " "
13897 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13898
13899 case "$use64bitint:$d_quad:$quadtype" in
13900 define:define:?*)
13901         ivtype="$quadtype"
13902         uvtype="$uquadtype"
13903         ivsize=8
13904         uvsize=8
13905         ;;
13906 *)      ivtype="long"
13907         uvtype="unsigned long"
13908         ivsize=$longsize
13909         uvsize=$longsize
13910         ;;
13911 esac
13912
13913 case "$uselongdouble:$d_longdbl" in
13914 define:define)
13915         nvtype="long double"
13916         nvsize=$longdblsize
13917         ;;
13918 *)      nvtype=double
13919         nvsize=$doublesize
13920         ;;
13921 esac
13922
13923 $echo "(IV will be "$ivtype", $ivsize bytes)"
13924 $echo "(UV will be "$uvtype", $uvsize bytes)"
13925 $echo "(NV will be "$nvtype", $nvsize bytes)"
13926
13927 $cat >try.c <<EOCP
13928 #$i_inttypes I_INTTYPES
13929 #ifdef I_INTTYPES
13930 #include <inttypes.h>
13931 #endif
13932 #include <stdio.h>
13933 int main() {
13934 #ifdef INT8
13935    int8_t i =  INT8_MAX;
13936   uint8_t u = UINT8_MAX;
13937   printf("int8_t\n");
13938 #endif
13939 #ifdef INT16
13940    int16_t i =  INT16_MAX;
13941   uint16_t i = UINT16_MAX;
13942   printf("int16_t\n");
13943 #endif
13944 #ifdef INT32
13945    int32_t i =  INT32_MAX;
13946   uint32_t u = UINT32_MAX;
13947   printf("int32_t\n");
13948 #endif
13949 }
13950 EOCP
13951
13952 case "$i8type" in
13953 '')     case "$charsize" in
13954         1)      i8type=char
13955                 u8type="unsigned char"
13956                 i8size=$charsize
13957                 u8size=$charsize
13958                 ;;
13959         esac
13960         ;;
13961 esac
13962 case "$i8type" in
13963 '')     set try -DINT8
13964         if eval $compile; then
13965                 case "`$run ./try`" in
13966                 int8_t) i8type=int8_t
13967                         u8type=uint8_t
13968                         i8size=1
13969                         u8size=1
13970                         ;;
13971                 esac
13972         fi
13973         ;;
13974 esac
13975 case "$i8type" in
13976 '')     if $test $charsize -ge 1; then
13977                 i8type=char
13978                 u8type="unsigned char"
13979                 i8size=$charsize
13980                 u8size=$charsize
13981         fi
13982         ;;
13983 esac
13984
13985 case "$i16type" in
13986 '')     case "$shortsize" in
13987         2)      i16type=short
13988                 u16type="unsigned short"
13989                 i16size=$shortsize
13990                 u16size=$shortsize
13991                 ;;
13992         esac
13993         ;;
13994 esac
13995 case "$i16type" in
13996 '')     set try -DINT16
13997         if eval $compile; then
13998                 case "`$run ./try`" in
13999                 int16_t)
14000                         i16type=int16_t
14001                         u16type=uint16_t
14002                         i16size=2
14003                         u16size=2
14004                         ;;
14005                 esac
14006         fi
14007         ;;
14008 esac
14009 case "$i16type" in
14010 '')     if $test $shortsize -ge 2; then
14011                 i16type=short
14012                 u16type="unsigned short"
14013                 i16size=$shortsize
14014                 u16size=$shortsize
14015         fi
14016         ;;
14017 esac
14018
14019 case "$i32type" in
14020 '')     case "$longsize" in
14021         4)      i32type=long
14022                 u32type="unsigned long"
14023                 i32size=$longsize
14024                 u32size=$longsize
14025                 ;;
14026         *)      case "$intsize" in
14027                 4)      i32type=int
14028                         u32type="unsigned int"
14029                         i32size=$intsize
14030                         u32size=$intsize
14031                         ;;
14032                 esac
14033                 ;;
14034         esac
14035         ;;
14036 esac
14037 case "$i32type" in
14038 '')     set try -DINT32
14039         if eval $compile; then
14040                 case "`$run ./try`" in
14041                 int32_t)
14042                         i32type=int32_t
14043                         u32type=uint32_t
14044                         i32size=4
14045                         u32size=4
14046                         ;;
14047                 esac
14048         fi
14049         ;;
14050 esac
14051 case "$i32type" in
14052 '')     if $test $intsize -ge 4; then
14053                 i32type=int
14054                 u32type="unsigned int"
14055                 i32size=$intsize
14056                 u32size=$intsize
14057         fi
14058         ;;
14059 esac
14060
14061 case "$i64type" in
14062 '')     case "$d_quad:$quadtype" in
14063         define:?*)
14064                 i64type="$quadtype"
14065                 u64type="$uquadtype"
14066                 i64size=8
14067                 u64size=8
14068                 ;;
14069         esac
14070         ;;
14071 esac
14072
14073 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14074 : volatile so that the compiler has to store it out to memory.
14075 if test X"$d_volatile" = X"$define"; then
14076         volatile=volatile
14077 fi
14078 $cat <<EOP >try.c
14079 #include <stdio.h>
14080 #include <sys/types.h>
14081 #include <signal.h>
14082 #ifdef SIGFPE
14083 $volatile int bletched = 0;
14084 $signal_t blech(s) int s; { bletched = 1; }
14085 #endif
14086 int main() {
14087     $uvtype u = 0;
14088     $nvtype d;
14089     int     n = 8 * $uvsize;
14090     int     i;
14091 #ifdef SIGFPE
14092     signal(SIGFPE, blech);
14093 #endif
14094
14095     for (i = 0; i < n; i++) {
14096       u = u << 1 | ($uvtype)1;
14097       d = ($nvtype)u;
14098       if (($uvtype)d != u)
14099         break;
14100       if (d <= 0)
14101         break;
14102       d = ($nvtype)(u - 1);
14103       if (($uvtype)d != (u - 1))
14104         break;
14105 #ifdef SIGFPE
14106       if (bletched) {
14107         break;
14108 #endif
14109       } 
14110     }
14111     printf("%d\n", ((i == n) ? -n : i));
14112     exit(0);
14113 }
14114 EOP
14115 set try
14116
14117 d_nv_preserves_uv="$undef"
14118 if eval $compile; then
14119         nv_preserves_uv_bits="`$run ./try`"
14120 fi
14121 case "$nv_preserves_uv_bits" in
14122 \-[1-9]*)       
14123         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14124         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14125         d_nv_preserves_uv="$define"
14126         ;;
14127 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14128         d_nv_preserves_uv="$undef" ;;
14129 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14130         nv_preserves_uv_bits="$undef" ;;
14131 esac
14132
14133 $rm -f try.* try
14134
14135
14136 : check for off64_t
14137 echo " "
14138 echo "Checking to see if you have off64_t..." >&4
14139 $cat >try.c <<EOCP
14140 #include <sys/types.h>
14141 #include <unistd.h>
14142 int main() { off64_t x = 7; }
14143 EOCP
14144 set try
14145 if eval $compile; then
14146         val="$define"
14147         echo "You have off64_t."
14148 else
14149         val="$undef"
14150         echo "You do not have off64_t."
14151         case "$lseeksize" in
14152         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14153         esac
14154 fi
14155 $rm -f try.* try
14156 set d_off64_t
14157 eval $setvar
14158
14159 : how to create joinable pthreads
14160 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14161         echo " "
14162         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14163         $cat >try.c <<'EOCP'
14164 #include <pthread.h>
14165 int main() {
14166     int detachstate = JOINABLE;
14167 }
14168 EOCP
14169         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14170         if eval $compile; then
14171                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14172                 val="$undef" # Yes, undef.
14173                 set d_old_pthread_create_joinable
14174                 eval $setvar
14175                 val=""
14176                 set old_pthread_create_joinable
14177                 eval $setvar
14178         else
14179                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14180                 if eval $compile; then
14181                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14182                         val="$define"
14183                         set d_old_pthread_create_joinable
14184                         eval $setvar
14185                         val=PTHREAD_CREATE_UNDETACHED
14186                         set old_pthread_create_joinable
14187                         eval $setvar
14188                 else            
14189                         set try -DJOINABLE=__UNDETACHED
14190                         if eval $compile; then
14191                                 echo "You seem to use __UNDETACHED." >&4
14192                                 val="$define"
14193                                 set d_old_pthread_create_joinable
14194                                 eval $setvar
14195                                 val=__UNDETACHED
14196                                 set old_pthread_create_joinable
14197                                 eval $setvar
14198                         else
14199                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14200                                 val="$define"
14201                                 set d_old_pthread_create_joinable
14202                                 eval $setvar
14203                                 val=0
14204                                 set old_pthread_create_joinable
14205                                 eval $setvar
14206                         fi
14207                 fi
14208         fi
14209         $rm -f try try.*
14210 else
14211     d_old_pthread_create_joinable="$undef"
14212     old_pthread_create_joinable=""
14213 fi
14214
14215 : see if pause exists
14216 set pause d_pause
14217 eval $inlibc
14218
14219 : see if pipe exists
14220 set pipe d_pipe
14221 eval $inlibc
14222
14223 : see if poll exists
14224 set poll d_poll
14225 eval $inlibc
14226
14227 : see if readlink exists
14228 set readlink d_readlink
14229 eval $inlibc
14230
14231 echo " "
14232 procselfexe=''
14233 val="$undef"
14234 case "$d_readlink" in
14235 "$define")
14236         if $issymlink /proc/self/exe ; then
14237                 $ls -l /proc/self/exe > reflect
14238                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14239                         echo "You have Linux-like /proc/self/exe."
14240                         procselfexe='"/proc/self/exe"'
14241                         val="$define"
14242                 fi
14243         fi
14244         if $issymlink /proc/curproc/file ; then
14245                 $ls -l /proc/curproc/file > reflect
14246                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14247                         echo "You have BSD-like /proc/curproc/file."
14248                         procselfexe='"/proc/curproc/file"'
14249                         val="$define"
14250                 fi
14251         fi
14252         ;;
14253 esac
14254 $rm -f reflect
14255 set d_procselfexe
14256 eval $setvar
14257
14258 : see whether the pthread_atfork exists
14259 $cat >try.c <<EOP
14260 #include <pthread.h>
14261 #include <stdio.h>
14262 int main() {
14263 #ifdef  PTHREAD_ATFORK
14264         pthread_atfork(NULL,NULL,NULL);
14265 #endif
14266 }
14267 EOP
14268
14269 : see if pthread_atfork exists
14270 set try -DPTHREAD_ATFORK
14271 if eval $compile; then
14272     val="$define"
14273 else
14274     val="$undef"
14275 fi
14276 case "$usethreads" in
14277 $define)
14278         case "$val" in
14279         $define) echo 'pthread_atfork found.' >&4        ;;
14280         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14281         esac
14282 esac
14283 set d_pthread_atfork
14284 eval $setvar
14285
14286
14287 : see whether the various POSIXish _yields exist
14288 $cat >try.c <<EOP
14289 #include <pthread.h>
14290 #include <stdio.h>
14291 int main() {
14292 #ifdef SCHED_YIELD
14293         sched_yield();
14294 #else
14295 #ifdef PTHREAD_YIELD
14296         pthread_yield();
14297 #else
14298 #ifdef PTHREAD_YIELD_NULL
14299         pthread_yield(NULL);
14300 #endif
14301 #endif
14302 #endif
14303 }
14304 EOP
14305 : see if sched_yield exists
14306 set try -DSCHED_YIELD
14307 if eval $compile; then
14308     val="$define"
14309     sched_yield='sched_yield()'
14310 else
14311     val="$undef"
14312 fi
14313 case "$usethreads" in
14314 $define)
14315         case "$val" in
14316         $define) echo 'sched_yield() found.' >&4        ;;
14317         *)       echo 'sched_yield() NOT found.' >&4    ;;
14318         esac
14319 esac
14320 set d_sched_yield
14321 eval $setvar
14322
14323 : see if pthread_yield exists
14324 set try -DPTHREAD_YIELD
14325 if eval $compile; then
14326     val="$define"
14327     case "$sched_yield" in
14328     '') sched_yield='pthread_yield()' ;;
14329     esac
14330 else
14331     set try -DPTHREAD_YIELD_NULL
14332     if eval $compile; then
14333         val="$define"
14334         case "$sched_yield" in
14335         '') sched_yield='pthread_yield(NULL)' ;;
14336         esac
14337     else
14338         val="$undef"
14339     fi
14340 fi
14341 case "$usethreads" in
14342 $define)
14343         case "$val" in
14344         $define) echo 'pthread_yield() found.' >&4      ;;
14345         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14346         esac
14347         ;;
14348 esac
14349 set d_pthread_yield
14350 eval $setvar
14351
14352 case "$sched_yield" in
14353 '') sched_yield=undef ;;
14354 esac
14355
14356 $rm -f try try.*
14357
14358 : see if random_r exists
14359 set random_r d_random_r
14360 eval $inlibc
14361 case "$d_random_r" in
14362 "$define")
14363         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14364         case "$d_random_r_proto:$usethreads" in
14365         ":define")      d_random_r_proto=define
14366                 set d_random_r_proto random_r $hdrs
14367                 eval $hasproto ;;
14368         *)      ;;
14369         esac
14370         case "$d_random_r_proto" in
14371         define)
14372         case "$random_r_proto" in
14373         ''|0) try='int random_r(int*, struct random_data*);'
14374         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14375         esac
14376         case "$random_r_proto" in
14377         ''|0) try='int random_r(long*, struct random_data*);'
14378         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14379         esac
14380         case "$random_r_proto" in
14381         ''|0) try='int random_r(struct random_data*, int32_t*);'
14382         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
14383         esac
14384         case "$random_r_proto" in
14385         ''|0)   d_random_r=undef
14386                 random_r_proto=0
14387                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14388         * )     case "$random_r_proto" in
14389                 REENTRANT_PROTO*) ;;
14390                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14391                 esac
14392                 echo "Prototype: $try" ;;
14393         esac
14394         ;;
14395         *)      case "$usethreads" in
14396                 define) echo "random_r has no prototype, not using it." >&4 ;;
14397                 esac
14398                 d_random_r=undef
14399                 random_r_proto=0
14400                 ;;
14401         esac
14402         ;;
14403 *)      random_r_proto=0
14404         ;;
14405 esac
14406
14407 : see if readdir and friends exist
14408 set readdir d_readdir
14409 eval $inlibc
14410 set seekdir d_seekdir
14411 eval $inlibc
14412 set telldir d_telldir
14413 eval $inlibc
14414 set rewinddir d_rewinddir
14415 eval $inlibc
14416
14417 : see if readdir64_r exists
14418 set readdir64_r d_readdir64_r
14419 eval $inlibc
14420 case "$d_readdir64_r" in
14421 "$define")
14422         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14423         case "$d_readdir64_r_proto:$usethreads" in
14424         ":define")      d_readdir64_r_proto=define
14425                 set d_readdir64_r_proto readdir64_r $hdrs
14426                 eval $hasproto ;;
14427         *)      ;;
14428         esac
14429         case "$d_readdir64_r_proto" in
14430         define)
14431         case "$readdir64_r_proto" in
14432         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14433         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14434         esac
14435         case "$readdir64_r_proto" in
14436         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14437         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14438         esac
14439         case "$readdir64_r_proto" in
14440         ''|0)   d_readdir64_r=undef
14441                 readdir64_r_proto=0
14442                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14443         * )     case "$readdir64_r_proto" in
14444                 REENTRANT_PROTO*) ;;
14445                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14446                 esac
14447                 echo "Prototype: $try" ;;
14448         esac
14449         ;;
14450         *)      case "$usethreads" in
14451                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14452                 esac
14453                 d_readdir64_r=undef
14454                 readdir64_r_proto=0
14455                 ;;
14456         esac
14457         ;;
14458 *)      readdir64_r_proto=0
14459         ;;
14460 esac
14461
14462 : see if readdir_r exists
14463 set readdir_r d_readdir_r
14464 eval $inlibc
14465 case "$d_readdir_r" in
14466 "$define")
14467         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14468         case "$d_readdir_r_proto:$usethreads" in
14469         ":define")      d_readdir_r_proto=define
14470                 set d_readdir_r_proto readdir_r $hdrs
14471                 eval $hasproto ;;
14472         *)      ;;
14473         esac
14474         case "$d_readdir_r_proto" in
14475         define)
14476         case "$readdir_r_proto" in
14477         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14478         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14479         esac
14480         case "$readdir_r_proto" in
14481         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14482         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14483         esac
14484         case "$readdir_r_proto" in
14485         ''|0)   d_readdir_r=undef
14486                 readdir_r_proto=0
14487                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14488         * )     case "$readdir_r_proto" in
14489                 REENTRANT_PROTO*) ;;
14490                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14491                 esac
14492                 echo "Prototype: $try" ;;
14493         esac
14494         ;;
14495         *)      case "$usethreads" in
14496                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14497                 esac
14498                 d_readdir_r=undef
14499                 readdir_r_proto=0
14500                 ;;
14501         esac
14502         ;;
14503 *)      readdir_r_proto=0
14504         ;;
14505 esac
14506
14507 : see if readv exists
14508 set readv d_readv
14509 eval $inlibc
14510
14511 : see if recvmsg exists
14512 set recvmsg d_recvmsg
14513 eval $inlibc
14514
14515 : see if rename exists
14516 set rename d_rename
14517 eval $inlibc
14518
14519 : see if rmdir exists
14520 set rmdir d_rmdir
14521 eval $inlibc
14522
14523 : see if memory.h is available.
14524 val=''
14525 set memory.h val
14526 eval $inhdr
14527
14528 : See if it conflicts with string.h
14529 case "$val" in
14530 $define)
14531         case "$strings" in
14532         '') ;;
14533         *)
14534                 $cppstdin $cppflags $cppminus < $strings > mem.h
14535                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14536                         echo " "
14537                         echo "We won't be including <memory.h>."
14538                         val="$undef"
14539                 fi
14540                 $rm -f mem.h
14541                 ;;
14542         esac
14543 esac
14544 set i_memory
14545 eval $setvar
14546
14547 : can bcopy handle overlapping blocks?
14548 echo " "
14549 val="$undef"
14550 case "$d_memmove" in
14551 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14552 *)      case "$d_bcopy" in
14553         "$define")
14554                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14555                 $cat >try.c <<EOCP
14556 #$i_memory I_MEMORY
14557 #$i_stdlib I_STDLIB
14558 #$i_string I_STRING
14559 #$i_unistd I_UNISTD
14560 EOCP
14561         $cat >>try.c <<'EOCP'
14562 #include <stdio.h>
14563 #ifdef I_MEMORY
14564 #  include <memory.h>
14565 #endif
14566 #ifdef I_STDLIB
14567 #  include <stdlib.h>
14568 #endif
14569 #ifdef I_STRING
14570 #  include <string.h>
14571 #else
14572 #  include <strings.h>
14573 #endif
14574 #ifdef I_UNISTD
14575 #  include <unistd.h>  /* Needed for NetBSD */
14576 #endif
14577 int main()
14578 {
14579 char buf[128], abc[128];
14580 char *b;
14581 int len;
14582 int off;
14583 int align;
14584
14585 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14586    try to store the string in read-only memory. */
14587 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14588
14589 for (align = 7; align >= 0; align--) {
14590         for (len = 36; len; len--) {
14591                 b = buf+align;
14592                 bcopy(abc, b, len);
14593                 for (off = 1; off <= len; off++) {
14594                         bcopy(b, b+off, len);
14595                         bcopy(b+off, b, len);
14596                         if (bcmp(b, abc, len))
14597                                 exit(1);
14598                 }
14599         }
14600 }
14601 exit(0);
14602 }
14603 EOCP
14604                 set try
14605                 if eval $compile_ok; then
14606                         if ./try 2>/dev/null; then
14607                                 echo "Yes, it can."
14608                                 val="$define"
14609                         else
14610                                 echo "It can't, sorry."
14611                         fi
14612                 else
14613                         echo "(I can't compile the test program, so we'll assume not...)"
14614                 fi
14615                 ;;
14616         esac
14617         $rm -f try.* try core
14618         ;;
14619 esac
14620 set d_safebcpy
14621 eval $setvar
14622
14623 : can memcpy handle overlapping blocks?
14624 echo " "
14625 val="$undef"
14626 case "$d_memmove" in
14627 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14628 *)      case "$d_memcpy" in
14629         "$define")
14630                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14631                 $cat >try.c <<EOCP
14632 #$i_memory I_MEMORY
14633 #$i_stdlib I_STDLIB
14634 #$i_string I_STRING
14635 #$i_unistd I_UNISTD
14636 EOCP
14637         $cat >>try.c <<'EOCP'
14638 #include <stdio.h>
14639 #ifdef I_MEMORY
14640 #  include <memory.h>
14641 #endif
14642 #ifdef I_STDLIB
14643 #  include <stdlib.h>
14644 #endif
14645 #ifdef I_STRING
14646 #  include <string.h>
14647 #else
14648 #  include <strings.h>
14649 #endif
14650 #ifdef I_UNISTD
14651 #  include <unistd.h>  /* Needed for NetBSD */
14652 #endif
14653 int main()
14654 {
14655 char buf[128], abc[128];
14656 char *b;
14657 int len;
14658 int off;
14659 int align;
14660
14661 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14662    try to store the string in read-only memory. */
14663 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14664
14665 for (align = 7; align >= 0; align--) {
14666         for (len = 36; len; len--) {
14667                 b = buf+align;
14668                 memcpy(b, abc, len);
14669                 for (off = 1; off <= len; off++) {
14670                         memcpy(b+off, b, len);
14671                         memcpy(b, b+off, len);
14672                         if (memcmp(b, abc, len))
14673                                 exit(1);
14674                 }
14675         }
14676 }
14677 exit(0);
14678 }
14679 EOCP
14680                 set try
14681                 if eval $compile_ok; then
14682                         if ./try 2>/dev/null; then
14683                                 echo "Yes, it can."
14684                                 val="$define"
14685                         else
14686                                 echo "It can't, sorry."
14687                         fi
14688                 else
14689                         echo "(I can't compile the test program, so we'll assume not...)"
14690                 fi
14691                 ;;
14692         esac
14693         $rm -f try.* try core
14694         ;;
14695 esac
14696 set d_safemcpy
14697 eval $setvar
14698
14699 : can memcmp be trusted to compare relative magnitude?
14700 val="$undef"
14701 case "$d_memcmp" in
14702 "$define")
14703         echo " "
14704         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14705         $cat >try.c <<EOCP
14706 #$i_memory I_MEMORY
14707 #$i_stdlib I_STDLIB
14708 #$i_string I_STRING
14709 #$i_unistd I_UNISTD
14710 EOCP
14711         $cat >>try.c <<'EOCP'
14712 #include <stdio.h>
14713 #ifdef I_MEMORY
14714 #  include <memory.h>
14715 #endif
14716 #ifdef I_STDLIB
14717 #  include <stdlib.h>
14718 #endif
14719 #ifdef I_STRING
14720 #  include <string.h>
14721 #else
14722 #  include <strings.h>
14723 #endif
14724 #ifdef I_UNISTD
14725 #  include <unistd.h>  /* Needed for NetBSD */
14726 #endif
14727 int main()
14728 {
14729 char a = -1;
14730 char b = 0;
14731 if ((a < b) && memcmp(&a, &b, 1) < 0)
14732         exit(1);
14733 exit(0);
14734 }
14735 EOCP
14736         set try
14737         if eval $compile_ok; then
14738                 if $run ./try 2>/dev/null; then
14739                         echo "Yes, it can."
14740                         val="$define"
14741                 else
14742                         echo "No, it can't (it uses signed chars)."
14743                 fi
14744         else
14745                 echo "(I can't compile the test program, so we'll assume not...)"
14746         fi
14747         ;;
14748 esac
14749 $rm -f try.* try core
14750 set d_sanemcmp
14751 eval $setvar
14752
14753 : see if prototype for sbrk is available
14754 echo " "
14755 set d_sbrkproto sbrk $i_unistd unistd.h
14756 eval $hasproto
14757
14758 : see if select exists
14759 set select d_select
14760 eval $inlibc
14761
14762 : see if semctl exists
14763 set semctl d_semctl
14764 eval $inlibc
14765
14766 : see if semget exists
14767 set semget d_semget
14768 eval $inlibc
14769
14770 : see if semop exists
14771 set semop d_semop
14772 eval $inlibc
14773
14774 : see how much of the 'sem*(2)' library is present.
14775 h_sem=true
14776 echo " "
14777 case "$d_semctl$d_semget$d_semop" in
14778 *"$undef"*) h_sem=false;;
14779 esac
14780 case "$osname" in
14781 freebsd)
14782     case "`ipcs 2>&1`" in
14783     "SVID messages"*"not configured"*)
14784         echo "Your $osname does not have the sem*(2) configured." >&4
14785         h_sem=false
14786         val="$undef"
14787         set semctl d_semctl
14788         eval $setvar
14789         set semget d_semget
14790         eval $setvar
14791         set semop d_semop
14792         eval $setvar
14793         ;;
14794     esac
14795     ;;
14796 esac
14797 : we could also check for sys/ipc.h ...
14798 if $h_sem && $test `./findhdr sys/sem.h`; then
14799         echo "You have the full sem*(2) library." >&4
14800         val="$define"
14801 else
14802         echo "You don't have the full sem*(2) library." >&4
14803         val="$undef"
14804 fi
14805 set d_sem
14806 eval $setvar
14807
14808 : see whether sys/sem.h defines union semun
14809 echo " "
14810 $cat > try.c <<'END'
14811 #include <sys/types.h>
14812 #include <sys/ipc.h>
14813 #include <sys/sem.h>
14814 int main () { union semun semun; semun.buf = 0; }
14815 END
14816 set try
14817 if eval $compile; then
14818     echo "You have union semun in <sys/sem.h>." >&4
14819     val="$define"
14820 else
14821     echo "You do not have union semun in <sys/sem.h>." >&4
14822     val="$undef"
14823 fi
14824 $rm -f try try.c try.h
14825 set d_union_semun
14826 eval $setvar
14827
14828 : see how to do semctl IPC_STAT
14829 case "$d_sem" in
14830 $define)
14831     : see whether semctl IPC_STAT can use union semun
14832     echo " "
14833     $cat > try.h <<END
14834 #ifndef S_IRUSR
14835 #   ifdef S_IREAD
14836 #       define S_IRUSR S_IREAD
14837 #       define S_IWUSR S_IWRITE
14838 #       define S_IXUSR S_IEXEC
14839 #   else
14840 #       define S_IRUSR 0400
14841 #       define S_IWUSR 0200
14842 #       define S_IXUSR 0100
14843 #   endif
14844 #   define S_IRGRP (S_IRUSR>>3)
14845 #   define S_IWGRP (S_IWUSR>>3)
14846 #   define S_IXGRP (S_IXUSR>>3)
14847 #   define S_IROTH (S_IRUSR>>6)
14848 #   define S_IWOTH (S_IWUSR>>6)
14849 #   define S_IXOTH (S_IXUSR>>6)
14850 #endif
14851 #ifndef S_IRWXU
14852 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14853 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14854 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14855 #endif
14856 END
14857
14858     $cat > try.c <<END
14859 #include <sys/types.h>
14860 #include <sys/ipc.h>
14861 #include <sys/sem.h>
14862 #include <sys/stat.h>
14863 #include <stdio.h>
14864 #include <errno.h>
14865 #include "try.h"
14866 #ifndef errno
14867 extern int errno;
14868 #endif
14869 #$d_union_semun HAS_UNION_SEMUN
14870 int main() {
14871     union semun
14872 #ifndef HAS_UNION_SEMUN
14873     {
14874         int val;
14875         struct semid_ds *buf;
14876         unsigned short *array;
14877     }
14878 #endif
14879     arg;
14880     int sem, st;
14881
14882 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14883     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14884     if (sem > -1) {
14885         struct semid_ds argbuf;
14886         arg.buf = &argbuf;
14887 #       ifdef IPC_STAT
14888         st = semctl(sem, 0, IPC_STAT, arg);
14889         if (st == 0)
14890             printf("semun\n");
14891         else
14892 #       endif /* IPC_STAT */
14893             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14894 #       ifdef IPC_RMID
14895         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14896 #       endif /* IPC_RMID */
14897             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14898     } else
14899 #endif /* IPC_PRIVATE && ... */
14900         printf("semget failed: errno = %d\n", errno);
14901   return 0;
14902 }
14903 END
14904     val="$undef"
14905     set try
14906     if eval $compile; then
14907         xxx=`$run ./try`
14908         case "$xxx" in
14909         semun) val="$define" ;;
14910         esac
14911     fi
14912     $rm -f try try.c
14913     set d_semctl_semun
14914     eval $setvar
14915     case "$d_semctl_semun" in
14916     $define)
14917         echo "You can use union semun for semctl IPC_STAT." >&4
14918         also='also'
14919         ;;
14920     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14921         also=''
14922         ;;
14923     esac
14924
14925     : see whether semctl IPC_STAT can use struct semid_ds pointer
14926     $cat > try.c <<'END'
14927 #include <sys/types.h>
14928 #include <sys/ipc.h>
14929 #include <sys/sem.h>
14930 #include <sys/stat.h>
14931 #include "try.h"
14932 #include <stdio.h>
14933 #include <errno.h>
14934 #ifndef errno
14935 extern int errno;
14936 #endif
14937 int main() {
14938     struct semid_ds arg;
14939     int sem, st;
14940
14941 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14942     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14943     if (sem > -1) {
14944 #       ifdef IPC_STAT
14945         st = semctl(sem, 0, IPC_STAT, &arg);
14946         if (st == 0)
14947             printf("semid_ds\n");
14948         else
14949 #       endif /* IPC_STAT */
14950             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14951 #       ifdef IPC_RMID
14952         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14953 #       endif /* IPC_RMID */
14954             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14955     } else
14956 #endif /* IPC_PRIVATE && ... */
14957         printf("semget failed: errno = %d\n", errno);
14958
14959     return 0;
14960 }
14961 END
14962     val="$undef"
14963     set try
14964     if eval $compile; then
14965         xxx=`$run ./try`
14966         case "$xxx" in
14967         semid_ds) val="$define" ;;
14968         esac
14969     fi
14970     $rm -f try try.c
14971     set d_semctl_semid_ds
14972     eval $setvar
14973     case "$d_semctl_semid_ds" in
14974     $define)
14975         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14976         ;;
14977     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14978         ;;
14979     esac
14980     $rm -f try.h
14981     ;;
14982 *)  val="$undef"
14983
14984     # We do not have the full sem*(2) library, so assume we can not
14985     # use either.
14986
14987     set d_semctl_semun
14988     eval $setvar
14989
14990     set d_semctl_semid_ds
14991     eval $setvar
14992     ;;
14993 esac
14994
14995 : see if sendmsg exists
14996 set sendmsg d_sendmsg
14997 eval $inlibc
14998
14999 : see if setegid exists
15000 set setegid d_setegid
15001 eval $inlibc
15002
15003 : see if seteuid exists
15004 set seteuid d_seteuid
15005 eval $inlibc
15006
15007 : see if setgrent exists
15008 set setgrent d_setgrent
15009 eval $inlibc
15010
15011 : see if setgrent_r exists
15012 set setgrent_r d_setgrent_r
15013 eval $inlibc
15014 case "$d_setgrent_r" in
15015 "$define")
15016         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15017         case "$d_setgrent_r_proto:$usethreads" in
15018         ":define")      d_setgrent_r_proto=define
15019                 set d_setgrent_r_proto setgrent_r $hdrs
15020                 eval $hasproto ;;
15021         *)      ;;
15022         esac
15023         case "$d_setgrent_r_proto" in
15024         define)
15025         case "$setgrent_r_proto" in
15026         ''|0) try='int setgrent_r(FILE**);'
15027         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15028         esac
15029         case "$setgrent_r_proto" in
15030         ''|0) try='void setgrent_r(FILE**);'
15031         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15032         esac
15033         case "$setgrent_r_proto" in
15034         ''|0)   d_setgrent_r=undef
15035                 setgrent_r_proto=0
15036                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15037         * )     case "$setgrent_r_proto" in
15038                 REENTRANT_PROTO*) ;;
15039                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15040                 esac
15041                 echo "Prototype: $try" ;;
15042         esac
15043         ;;
15044         *)      case "$usethreads" in
15045                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15046                 esac
15047                 d_setgrent_r=undef
15048                 setgrent_r_proto=0
15049                 ;;
15050         esac
15051         ;;
15052 *)      setgrent_r_proto=0
15053         ;;
15054 esac
15055
15056 : see if sethostent exists
15057 set sethostent d_sethent
15058 eval $inlibc
15059
15060 : see if sethostent_r exists
15061 set sethostent_r d_sethostent_r
15062 eval $inlibc
15063 case "$d_sethostent_r" in
15064 "$define")
15065         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15066         case "$d_sethostent_r_proto:$usethreads" in
15067         ":define")      d_sethostent_r_proto=define
15068                 set d_sethostent_r_proto sethostent_r $hdrs
15069                 eval $hasproto ;;
15070         *)      ;;
15071         esac
15072         case "$d_sethostent_r_proto" in
15073         define)
15074         case "$sethostent_r_proto" in
15075         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15076         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15077         esac
15078         case "$sethostent_r_proto" in
15079         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15080         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15081         esac
15082         case "$sethostent_r_proto" in
15083         ''|0)   d_sethostent_r=undef
15084                 sethostent_r_proto=0
15085                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15086         * )     case "$sethostent_r_proto" in
15087                 REENTRANT_PROTO*) ;;
15088                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15089                 esac
15090                 echo "Prototype: $try" ;;
15091         esac
15092         ;;
15093         *)      case "$usethreads" in
15094                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15095                 esac
15096                 d_sethostent_r=undef
15097                 sethostent_r_proto=0
15098                 ;;
15099         esac
15100         ;;
15101 *)      sethostent_r_proto=0
15102         ;;
15103 esac
15104
15105 : see if setitimer exists
15106 set setitimer d_setitimer
15107 eval $inlibc
15108
15109 : see if setlinebuf exists
15110 set setlinebuf d_setlinebuf
15111 eval $inlibc
15112
15113 : see if setlocale exists
15114 set setlocale d_setlocale
15115 eval $inlibc
15116
15117 : see if locale.h is available
15118 set locale.h i_locale
15119 eval $inhdr
15120
15121 : see if setlocale_r exists
15122 set setlocale_r d_setlocale_r
15123 eval $inlibc
15124 case "$d_setlocale_r" in
15125 "$define")
15126         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15127         case "$d_setlocale_r_proto:$usethreads" in
15128         ":define")      d_setlocale_r_proto=define
15129                 set d_setlocale_r_proto setlocale_r $hdrs
15130                 eval $hasproto ;;
15131         *)      ;;
15132         esac
15133         case "$d_setlocale_r_proto" in
15134         define)
15135         case "$setlocale_r_proto" in
15136         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15137         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15138         esac
15139         case "$setlocale_r_proto" in
15140         ''|0)   d_setlocale_r=undef
15141                 setlocale_r_proto=0
15142                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15143         * )     case "$setlocale_r_proto" in
15144                 REENTRANT_PROTO*) ;;
15145                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15146                 esac
15147                 echo "Prototype: $try" ;;
15148         esac
15149         ;;
15150         *)      case "$usethreads" in
15151                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15152                 esac
15153                 d_setlocale_r=undef
15154                 setlocale_r_proto=0
15155                 ;;
15156         esac
15157         ;;
15158 *)      setlocale_r_proto=0
15159         ;;
15160 esac
15161
15162 : see if setnetent exists
15163 set setnetent d_setnent
15164 eval $inlibc
15165
15166 : see if setnetent_r exists
15167 set setnetent_r d_setnetent_r
15168 eval $inlibc
15169 case "$d_setnetent_r" in
15170 "$define")
15171         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15172         case "$d_setnetent_r_proto:$usethreads" in
15173         ":define")      d_setnetent_r_proto=define
15174                 set d_setnetent_r_proto setnetent_r $hdrs
15175                 eval $hasproto ;;
15176         *)      ;;
15177         esac
15178         case "$d_setnetent_r_proto" in
15179         define)
15180         case "$setnetent_r_proto" in
15181         ''|0) try='int setnetent_r(int, struct netent_data*);'
15182         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15183         esac
15184         case "$setnetent_r_proto" in
15185         ''|0) try='void setnetent_r(int, struct netent_data*);'
15186         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15187         esac
15188         case "$setnetent_r_proto" in
15189         ''|0)   d_setnetent_r=undef
15190                 setnetent_r_proto=0
15191                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15192         * )     case "$setnetent_r_proto" in
15193                 REENTRANT_PROTO*) ;;
15194                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15195                 esac
15196                 echo "Prototype: $try" ;;
15197         esac
15198         ;;
15199         *)      case "$usethreads" in
15200                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15201                 esac
15202                 d_setnetent_r=undef
15203                 setnetent_r_proto=0
15204                 ;;
15205         esac
15206         ;;
15207 *)      setnetent_r_proto=0
15208         ;;
15209 esac
15210
15211 : see if setprotoent exists
15212 set setprotoent d_setpent
15213 eval $inlibc
15214
15215 : see if setpgid exists
15216 set setpgid d_setpgid
15217 eval $inlibc
15218
15219 : see if setpgrp2 exists
15220 set setpgrp2 d_setpgrp2
15221 eval $inlibc
15222
15223 : see if setpriority exists
15224 set setpriority d_setprior
15225 eval $inlibc
15226
15227 : see if setproctitle exists
15228 set setproctitle d_setproctitle
15229 eval $inlibc
15230
15231 : see if setprotoent_r exists
15232 set setprotoent_r d_setprotoent_r
15233 eval $inlibc
15234 case "$d_setprotoent_r" in
15235 "$define")
15236         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15237         case "$d_setprotoent_r_proto:$usethreads" in
15238         ":define")      d_setprotoent_r_proto=define
15239                 set d_setprotoent_r_proto setprotoent_r $hdrs
15240                 eval $hasproto ;;
15241         *)      ;;
15242         esac
15243         case "$d_setprotoent_r_proto" in
15244         define)
15245         case "$setprotoent_r_proto" in
15246         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15247         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15248         esac
15249         case "$setprotoent_r_proto" in
15250         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15251         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15252         esac
15253         case "$setprotoent_r_proto" in
15254         ''|0)   d_setprotoent_r=undef
15255                 setprotoent_r_proto=0
15256                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15257         * )     case "$setprotoent_r_proto" in
15258                 REENTRANT_PROTO*) ;;
15259                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15260                 esac
15261                 echo "Prototype: $try" ;;
15262         esac
15263         ;;
15264         *)      case "$usethreads" in
15265                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15266                 esac
15267                 d_setprotoent_r=undef
15268                 setprotoent_r_proto=0
15269                 ;;
15270         esac
15271         ;;
15272 *)      setprotoent_r_proto=0
15273         ;;
15274 esac
15275
15276 : see if setpwent exists
15277 set setpwent d_setpwent
15278 eval $inlibc
15279
15280 : see if setpwent_r exists
15281 set setpwent_r d_setpwent_r
15282 eval $inlibc
15283 case "$d_setpwent_r" in
15284 "$define")
15285         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15286         case "$d_setpwent_r_proto:$usethreads" in
15287         ":define")      d_setpwent_r_proto=define
15288                 set d_setpwent_r_proto setpwent_r $hdrs
15289                 eval $hasproto ;;
15290         *)      ;;
15291         esac
15292         case "$d_setpwent_r_proto" in
15293         define)
15294         case "$setpwent_r_proto" in
15295         ''|0) try='int setpwent_r(FILE**);'
15296         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15297         esac
15298         case "$setpwent_r_proto" in
15299         ''|0) try='void setpwent_r(FILE**);'
15300         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15301         esac
15302         case "$setpwent_r_proto" in
15303         ''|0)   d_setpwent_r=undef
15304                 setpwent_r_proto=0
15305                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15306         * )     case "$setpwent_r_proto" in
15307                 REENTRANT_PROTO*) ;;
15308                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15309                 esac
15310                 echo "Prototype: $try" ;;
15311         esac
15312         ;;
15313         *)      case "$usethreads" in
15314                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15315                 esac
15316                 d_setpwent_r=undef
15317                 setpwent_r_proto=0
15318                 ;;
15319         esac
15320         ;;
15321 *)      setpwent_r_proto=0
15322         ;;
15323 esac
15324
15325 : see if setregid exists
15326 set setregid d_setregid
15327 eval $inlibc
15328 set setresgid d_setresgid
15329 eval $inlibc
15330
15331 : see if setreuid exists
15332 set setreuid d_setreuid
15333 eval $inlibc
15334 set setresuid d_setresuid
15335 eval $inlibc
15336
15337 : see if setrgid exists
15338 set setrgid d_setrgid
15339 eval $inlibc
15340
15341 : see if setruid exists
15342 set setruid d_setruid
15343 eval $inlibc
15344
15345 : see if setservent exists
15346 set setservent d_setsent
15347 eval $inlibc
15348
15349 : see if setservent_r exists
15350 set setservent_r d_setservent_r
15351 eval $inlibc
15352 case "$d_setservent_r" in
15353 "$define")
15354         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15355         case "$d_setservent_r_proto:$usethreads" in
15356         ":define")      d_setservent_r_proto=define
15357                 set d_setservent_r_proto setservent_r $hdrs
15358                 eval $hasproto ;;
15359         *)      ;;
15360         esac
15361         case "$d_setservent_r_proto" in
15362         define)
15363         case "$setservent_r_proto" in
15364         ''|0) try='int setservent_r(int, struct servent_data*);'
15365         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15366         esac
15367         case "$setservent_r_proto" in
15368         ''|0) try='void setservent_r(int, struct servent_data*);'
15369         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15370         esac
15371         case "$setservent_r_proto" in
15372         ''|0)   d_setservent_r=undef
15373                 setservent_r_proto=0
15374                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15375         * )     case "$setservent_r_proto" in
15376                 REENTRANT_PROTO*) ;;
15377                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15378                 esac
15379                 echo "Prototype: $try" ;;
15380         esac
15381         ;;
15382         *)      case "$usethreads" in
15383                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15384                 esac
15385                 d_setservent_r=undef
15386                 setservent_r_proto=0
15387                 ;;
15388         esac
15389         ;;
15390 *)      setservent_r_proto=0
15391         ;;
15392 esac
15393
15394 : see if setsid exists
15395 set setsid d_setsid
15396 eval $inlibc
15397
15398 : see if setvbuf exists
15399 set setvbuf d_setvbuf
15400 eval $inlibc
15401
15402 : see if sfio.h is available
15403 set sfio.h i_sfio
15404 eval $inhdr
15405
15406
15407 : see if sfio library is available
15408 case "$i_sfio" in
15409 $define)
15410         val=''
15411         set sfreserve val
15412         eval $inlibc
15413         ;;
15414 *)
15415         val="$undef"
15416         ;;
15417 esac
15418 : Ok, but do we want to use it.
15419 case "$val" in
15420 $define)
15421         case "$usesfio" in
15422         true|$define|[yY]*) dflt='y';;
15423         *) dflt='n';;
15424         esac
15425         echo "$package can use the sfio library, but it is experimental."
15426         case "$useperlio" in
15427         "$undef")
15428             echo "For sfio also the PerlIO abstraction layer is needed."
15429             echo "Earlier you said you wouldn't want that."
15430             ;;
15431         esac
15432         rp="You seem to have sfio available, do you want to try using it?"
15433         . ./myread
15434         case "$ans" in
15435         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15436                 useperlio="$define"
15437                 val="$define"
15438                 ;;
15439         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15440                 val="$undef"
15441                 ;;
15442         esac
15443         ;;
15444 *)      case "$usesfio" in
15445         true|$define|[yY]*)
15446                 echo "Sorry, cannot find sfio on this machine." >&4
15447                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15448                 val="$undef"
15449                 ;;
15450         esac
15451         ;;
15452 esac
15453 set d_sfio
15454 eval $setvar
15455 case "$d_sfio" in
15456 $define) usesfio='true';;
15457 *) usesfio='false';;
15458 esac
15459 case "$d_sfio" in
15460 $define) ;;
15461 *)      : Remove sfio from list of libraries to use
15462         case "$libs" in
15463         *-lsfio*)
15464                 echo "Removing unneeded -lsfio from library list" >&4
15465                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15466                 shift
15467                 libs="$*"
15468                 echo "libs = $libs" >&4
15469                 ;;
15470         esac
15471 ;;
15472 esac
15473
15474
15475 : see if shmctl exists
15476 set shmctl d_shmctl
15477 eval $inlibc
15478
15479 : see if shmget exists
15480 set shmget d_shmget
15481 eval $inlibc
15482
15483 : see if shmat exists
15484 set shmat d_shmat
15485 eval $inlibc
15486 : see what shmat returns
15487 case "$d_shmat" in
15488 "$define")
15489         $cat >shmat.c <<'END'
15490 #include <sys/shm.h>
15491 void *shmat();
15492 END
15493         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15494                 shmattype='void *'
15495         else
15496                 shmattype='char *'
15497         fi
15498         echo "and it returns ($shmattype)." >&4
15499         : see if a prototype for shmat is available
15500         xxx=`./findhdr sys/shm.h`
15501         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15502         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15503                 val="$define"
15504         else
15505                 val="$undef"
15506         fi
15507         $rm -f shmat.[co]
15508         ;;
15509 *)
15510         val="$undef"
15511         ;;
15512 esac
15513 set d_shmatprototype
15514 eval $setvar
15515
15516 : see if shmdt exists
15517 set shmdt d_shmdt
15518 eval $inlibc
15519
15520 : see how much of the 'shm*(2)' library is present.
15521 h_shm=true
15522 echo " "
15523 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15524 *"$undef"*) h_shm=false;;
15525 esac
15526 case "$osname" in
15527 freebsd)
15528     case "`ipcs 2>&1`" in
15529     "SVID shared memory"*"not configured"*)
15530         echo "Your $osname does not have the shm*(2) configured." >&4
15531         h_shm=false
15532         val="$undef"
15533         set shmctl d_shmctl
15534         evat $setvar
15535         set shmget d_shmget
15536         evat $setvar
15537         set shmat d_shmat
15538         evat $setvar
15539         set shmdt d_shmdt
15540         evat $setvar
15541         ;;
15542     esac
15543     ;;
15544 esac
15545 : we could also check for sys/ipc.h ...
15546 if $h_shm && $test `./findhdr sys/shm.h`; then
15547         echo "You have the full shm*(2) library." >&4
15548         val="$define"
15549 else
15550         echo "You don't have the full shm*(2) library." >&4
15551         val="$undef"
15552 fi
15553 set d_shm
15554 eval $setvar
15555
15556 echo " "
15557 : see if we have sigaction
15558 if set sigaction val -f d_sigaction; eval $csym; $val; then
15559         echo 'sigaction() found.' >&4
15560         $cat > try.c <<EOP
15561 #include <stdio.h>
15562 #include <sys/types.h>
15563 #include <signal.h>
15564 #$i_stdlib I_STDLIB
15565 #ifdef I_STDLIB
15566 #include <stdlib.h>
15567 #endif
15568 int main()
15569 {
15570     struct sigaction act, oact;
15571     act.sa_flags = 0;
15572     oact.sa_handler = 0;
15573     /* so that act and oact are used */
15574     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15575 }
15576 EOP
15577         set try
15578         if eval $compile_ok; then
15579                 val="$define"
15580         else
15581                 echo "But you don't seem to have a useable struct sigaction." >&4
15582                 val="$undef"
15583         fi
15584 else
15585         echo 'sigaction NOT found.' >&4
15586         val="$undef"
15587 fi
15588 set d_sigaction; eval $setvar
15589 $rm -f try try$_o try.c
15590
15591 : see if sigprocmask exists
15592 set sigprocmask d_sigprocmask
15593 eval $inlibc
15594
15595 : see if sigsetjmp exists
15596 echo " "
15597 case "$d_sigsetjmp" in
15598 '')
15599         $cat >try.c <<EOP
15600 #include <setjmp.h>
15601 #$i_stdlib I_STDLIB
15602 #ifdef I_STDLIB
15603 #include <stdlib.h>
15604 #endif
15605 sigjmp_buf env;
15606 int set = 1;
15607 int main()
15608 {
15609         if (sigsetjmp(env,1))
15610                 exit(set);
15611         set = 0;
15612         siglongjmp(env, 1);
15613         exit(1);
15614 }
15615 EOP
15616         set try
15617         if eval $compile; then
15618                 if $run ./try >/dev/null 2>&1; then
15619                         echo "POSIX sigsetjmp found." >&4
15620                         val="$define"
15621                 else
15622                         $cat >&4 <<EOM
15623 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15624 I'll ignore them.
15625 EOM
15626                         val="$undef"
15627                 fi
15628         else
15629                 echo "sigsetjmp not found." >&4
15630                 val="$undef"
15631         fi
15632         ;;
15633 *) val="$d_sigsetjmp"
15634         case "$d_sigsetjmp" in
15635         $define) echo "POSIX sigsetjmp found." >&4;;
15636         $undef) echo "sigsetjmp not found." >&4;;
15637         esac
15638         ;;
15639 esac
15640 set d_sigsetjmp
15641 eval $setvar
15642 $rm -f try.c try
15643
15644 : see if sockatmark exists
15645 set sockatmark d_sockatmark
15646 eval $inlibc
15647
15648 : see if prototype for sockatmark is available
15649 echo " "
15650 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15651 eval $hasproto
15652
15653 : see if socks5_init exists
15654 set socks5_init d_socks5_init
15655 eval $inlibc
15656
15657 : see if srand48_r exists
15658 set srand48_r d_srand48_r
15659 eval $inlibc
15660 case "$d_srand48_r" in
15661 "$define")
15662         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15663         case "$d_srand48_r_proto:$usethreads" in
15664         ":define")      d_srand48_r_proto=define
15665                 set d_srand48_r_proto srand48_r $hdrs
15666                 eval $hasproto ;;
15667         *)      ;;
15668         esac
15669         case "$d_srand48_r_proto" in
15670         define)
15671         case "$srand48_r_proto" in
15672         ''|0) try='int srand48_r(long, struct drand48_data*);'
15673         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15674         esac
15675         case "$srand48_r_proto" in
15676         ''|0)   d_srand48_r=undef
15677                 srand48_r_proto=0
15678                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15679         * )     case "$srand48_r_proto" in
15680                 REENTRANT_PROTO*) ;;
15681                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15682                 esac
15683                 echo "Prototype: $try" ;;
15684         esac
15685         ;;
15686         *)      case "$usethreads" in
15687                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15688                 esac
15689                 d_srand48_r=undef
15690                 srand48_r_proto=0
15691                 ;;
15692         esac
15693         ;;
15694 *)      srand48_r_proto=0
15695         ;;
15696 esac
15697
15698 : see if srandom_r exists
15699 set srandom_r d_srandom_r
15700 eval $inlibc
15701 case "$d_srandom_r" in
15702 "$define")
15703         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15704         case "$d_srandom_r_proto:$usethreads" in
15705         ":define")      d_srandom_r_proto=define
15706                 set d_srandom_r_proto srandom_r $hdrs
15707                 eval $hasproto ;;
15708         *)      ;;
15709         esac
15710         case "$d_srandom_r_proto" in
15711         define)
15712         case "$srandom_r_proto" in
15713         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15714         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15715         esac
15716         case "$srandom_r_proto" in
15717         ''|0)   d_srandom_r=undef
15718                 srandom_r_proto=0
15719                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15720         * )     case "$srandom_r_proto" in
15721                 REENTRANT_PROTO*) ;;
15722                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15723                 esac
15724                 echo "Prototype: $try" ;;
15725         esac
15726         ;;
15727         *)      case "$usethreads" in
15728                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15729                 esac
15730                 d_srandom_r=undef
15731                 srandom_r_proto=0
15732                 ;;
15733         esac
15734         ;;
15735 *)      srandom_r_proto=0
15736         ;;
15737 esac
15738
15739 : see if prototype for setresgid is available
15740 echo " "
15741 set d_sresgproto setresgid $i_unistd unistd.h
15742 eval $hasproto
15743
15744 : see if prototype for setresuid is available
15745 echo " "
15746 set d_sresuproto setresuid $i_unistd unistd.h
15747 eval $hasproto
15748
15749 : see if sys/stat.h is available
15750 set sys/stat.h i_sysstat
15751 eval $inhdr
15752
15753
15754 : see if stat knows about block sizes
15755 echo " "
15756 echo "Checking to see if your struct stat has st_blocks field..." >&4
15757 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15758 eval $hasfield
15759
15760
15761 : see if this is a sys/vfs.h system
15762 set sys/vfs.h i_sysvfs
15763 eval $inhdr
15764
15765
15766 : see if this is a sys/statfs.h system
15767 set sys/statfs.h i_sysstatfs
15768 eval $inhdr
15769
15770
15771 echo " "
15772 echo "Checking to see if your system supports struct statfs..." >&4
15773 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
15774 eval $hasstruct
15775 case "$d_statfs_s" in
15776 "$define")      echo "Yes, it does."   ;;
15777 *)              echo "No, it doesn't." ;;
15778 esac
15779
15780
15781
15782 : see if struct statfs knows about f_flags
15783 case "$d_statfs_s" in
15784 define) 
15785         echo " "
15786         echo "Checking to see if your struct statfs has f_flags field..." >&4
15787         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
15788         eval $hasfield
15789         ;;
15790 *)      val="$undef"
15791         set d_statfs_f_flags
15792         eval $setvar
15793         ;;
15794 esac
15795 case "$d_statfs_f_flags" in
15796 "$define")      echo "Yes, it does."   ;;
15797 *)              echo "No, it doesn't." ;;
15798 esac
15799
15800 : see if _ptr and _cnt from stdio act std
15801 echo " "
15802
15803 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15804         echo "(Looks like you have stdio.h from BSD.)"
15805         case "$stdio_ptr" in
15806         '') stdio_ptr='((fp)->_p)'
15807                 ptr_lval=$define
15808                 ;;
15809         *)      ptr_lval=$d_stdio_ptr_lval;;
15810         esac
15811         case "$stdio_cnt" in
15812         '') stdio_cnt='((fp)->_r)'
15813                 cnt_lval=$define
15814                 ;;
15815         *)      cnt_lval=$d_stdio_cnt_lval;;
15816         esac
15817         case "$stdio_base" in
15818         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15819         esac
15820         case "$stdio_bufsiz" in
15821         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15822         esac
15823 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15824         echo "(Looks like you have stdio.h from Linux.)"
15825         case "$stdio_ptr" in
15826         '') stdio_ptr='((fp)->_IO_read_ptr)'
15827                 ptr_lval=$define
15828                 ;;
15829         *)      ptr_lval=$d_stdio_ptr_lval;;
15830         esac
15831         case "$stdio_cnt" in
15832         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15833                 cnt_lval=$undef
15834                 ;;
15835         *)      cnt_lval=$d_stdio_cnt_lval;;
15836         esac
15837         case "$stdio_base" in
15838         '') stdio_base='((fp)->_IO_read_base)';;
15839         esac
15840         case "$stdio_bufsiz" in
15841         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15842         esac
15843 else
15844         case "$stdio_ptr" in
15845         '') stdio_ptr='((fp)->_ptr)'
15846                 ptr_lval=$define
15847                 ;;
15848         *)      ptr_lval=$d_stdio_ptr_lval;;
15849         esac
15850         case "$stdio_cnt" in
15851         '') stdio_cnt='((fp)->_cnt)'
15852                 cnt_lval=$define
15853                 ;;
15854         *)      cnt_lval=$d_stdio_cnt_lval;;
15855         esac
15856         case "$stdio_base" in
15857         '') stdio_base='((fp)->_base)';;
15858         esac
15859         case "$stdio_bufsiz" in
15860         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15861         esac
15862 fi
15863
15864 : test whether _ptr and _cnt really work
15865 echo "Checking how std your stdio is..." >&4
15866 $cat >try.c <<EOP
15867 #include <stdio.h>
15868 #define FILE_ptr(fp)    $stdio_ptr
15869 #define FILE_cnt(fp)    $stdio_cnt
15870 int main() {
15871         FILE *fp = fopen("try.c", "r");
15872         char c = getc(fp);
15873         if (
15874                 18 <= FILE_cnt(fp) &&
15875                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15876         )
15877                 exit(0);
15878         exit(1);
15879 }
15880 EOP
15881 val="$undef"
15882 set try
15883 if eval $compile && $to try.c; then
15884         if $run ./try; then
15885                 echo "Your stdio acts pretty std."
15886                 val="$define"
15887         else
15888                 echo "Your stdio isn't very std."
15889         fi
15890 else
15891         echo "Your stdio doesn't appear very std."
15892 fi
15893 $rm -f try.c try
15894
15895 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15896 # direct buffer manipulation no longer works.  The Configure tests
15897 # should be changed to correctly detect this, but until then,
15898 # the following check should at least let perl compile and run.
15899 # (This quick fix should be updated before 5.8.1.)
15900 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15901 # A. Dougherty, June 3, 2002.
15902 case "$d_gnulibc" in
15903 $define)
15904         case "$gnulibc_version" in
15905         2.[01]*)  ;;
15906         2.2) ;;
15907         2.2.[0-9]) ;;
15908         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15909                 val="$undef"
15910                 ;;
15911         esac
15912         ;;
15913 esac
15914 set d_stdstdio
15915 eval $setvar
15916
15917 : Can _ptr be used as an lvalue?
15918 case "$d_stdstdio$ptr_lval" in
15919 $define$define) val=$define ;;
15920 *) val=$undef ;;
15921 esac
15922 set d_stdio_ptr_lval
15923 eval $setvar
15924
15925 : Can _cnt be used as an lvalue?
15926 case "$d_stdstdio$cnt_lval" in
15927 $define$define) val=$define ;;
15928 *) val=$undef ;;
15929 esac
15930 set d_stdio_cnt_lval
15931 eval $setvar
15932
15933
15934 : test whether setting _ptr sets _cnt as a side effect
15935 d_stdio_ptr_lval_sets_cnt="$undef"
15936 d_stdio_ptr_lval_nochange_cnt="$undef"
15937 case "$d_stdio_ptr_lval$d_stdstdio" in
15938 $define$define)
15939         echo "Checking to see what happens if we set the stdio ptr..." >&4
15940 $cat >try.c <<EOP
15941 #include <stdio.h>
15942 /* Can we scream? */
15943 /* Eat dust sed :-) */
15944 /* In the buffer space, no one can hear you scream. */
15945 #define FILE_ptr(fp)    $stdio_ptr
15946 #define FILE_cnt(fp)    $stdio_cnt
15947 #include <sys/types.h>
15948 int main() {
15949         FILE *fp = fopen("try.c", "r");
15950         int c;
15951         char *ptr;
15952         size_t cnt;
15953         if (!fp) {
15954             puts("Fail even to read");
15955             exit(1);
15956         }
15957         c = getc(fp); /* Read away the first # */
15958         if (c == EOF) {
15959             puts("Fail even to read");
15960             exit(1);
15961         }
15962         if (!(
15963                 18 <= FILE_cnt(fp) &&
15964                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15965         )) {
15966                 puts("Fail even to read");
15967                 exit (1);
15968         }
15969         ptr = (char*) FILE_ptr(fp);
15970         cnt = (size_t)FILE_cnt(fp);
15971
15972         FILE_ptr(fp) += 42;
15973
15974         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15975                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15976                 exit (1);
15977         }
15978         if (FILE_cnt(fp) <= 20) {
15979                 printf ("Fail (<20 chars to test)");
15980                 exit (1);
15981         }
15982         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15983                 puts("Fail compare");
15984                 exit (1);
15985         }
15986         if (cnt == FILE_cnt(fp)) {
15987                 puts("Pass_unchanged");
15988                 exit (0);
15989         }       
15990         if (FILE_cnt(fp) == (cnt - 42)) {
15991                 puts("Pass_changed");
15992                 exit (0);
15993         }
15994         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15995         return 1;
15996
15997 }
15998 EOP
15999         set try
16000         if eval $compile && $to try.c; then
16001                 case `$run ./try` in
16002                 Pass_changed)
16003                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
16004                         d_stdio_ptr_lval_sets_cnt="$define" ;;
16005                 Pass_unchanged)
16006                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
16007                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
16008                 Fail*)
16009                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
16010                 *)
16011                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
16012         esac
16013         else
16014                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
16015         fi
16016         $rm -f try.c try
16017         ;;
16018 esac
16019
16020 : see if _base is also standard
16021 val="$undef"
16022 case "$d_stdstdio" in
16023 $define)
16024         $cat >try.c <<EOP
16025 #include <stdio.h>
16026 #define FILE_base(fp)   $stdio_base
16027 #define FILE_bufsiz(fp) $stdio_bufsiz
16028 int main() {
16029         FILE *fp = fopen("try.c", "r");
16030         char c = getc(fp);
16031         if (
16032                 19 <= FILE_bufsiz(fp) &&
16033                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
16034         )
16035                 exit(0);
16036         exit(1);
16037 }
16038 EOP
16039         set try
16040         if eval $compile && $to try.c; then
16041                 if $run ./try; then
16042                         echo "And its _base field acts std."
16043                         val="$define"
16044                 else
16045                         echo "But its _base field isn't std."
16046                 fi
16047         else
16048                 echo "However, it seems to be lacking the _base field."
16049         fi
16050         $rm -f try.c try
16051         ;;
16052 esac
16053 set d_stdiobase
16054 eval $setvar
16055
16056 $cat >&4 <<EOM
16057 Checking how to access stdio streams by file descriptor number...
16058 EOM
16059 case "$stdio_stream_array" in
16060 '')     $cat >try.c <<EOCP
16061 #include <stdio.h>
16062 int main() {
16063   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16064     printf("yes\n");
16065 }
16066 EOCP
16067         for s in _iob __iob __sF
16068         do
16069                 set try -DSTDIO_STREAM_ARRAY=$s
16070                 if eval $compile; then
16071                         case "`$run ./try`" in
16072                         yes)    stdio_stream_array=$s; break ;;
16073                         esac
16074                 fi
16075         done
16076         $rm -f try.* try$exe_ext
16077 esac
16078 case "$stdio_stream_array" in
16079 '')     $cat >&4 <<EOM
16080 I can't figure out how to access stdio streams by file descriptor number.
16081 EOM
16082         d_stdio_stream_array="$undef"
16083         ;;
16084 *)      $cat >&4 <<EOM
16085 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16086 EOM
16087         d_stdio_stream_array="$define"
16088         ;;
16089 esac
16090
16091 : see if strcoll exists
16092 set strcoll d_strcoll
16093 eval $inlibc
16094
16095 : check for structure copying
16096 echo " "
16097 echo "Checking to see if your C compiler can copy structs..." >&4
16098 $cat >try.c <<'EOCP'
16099 int main()
16100 {
16101         struct blurfl {
16102                 int dyick;
16103         } foo, bar;
16104
16105         foo = bar;
16106 }
16107 EOCP
16108 if $cc -c try.c >/dev/null 2>&1 ; then
16109         val="$define"
16110         echo "Yup, it can."
16111 else
16112         val="$undef"
16113         echo "Nope, it can't."
16114 fi
16115 set d_strctcpy
16116 eval $setvar
16117 $rm -f try.*
16118
16119 : see if strerror and/or sys_errlist[] exist
16120 echo " "
16121 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16122     if set strerror val -f d_strerror; eval $csym; $val; then
16123                 echo 'strerror() found.' >&4
16124                 d_strerror="$define"
16125                 d_strerrm='strerror(e)'
16126                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16127                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16128                         d_syserrlst="$define"
16129                 else
16130                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16131                         d_syserrlst="$undef"
16132                 fi
16133     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16134                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16135                 echo 'strerror() found in string header.' >&4
16136                 d_strerror="$define"
16137                 d_strerrm='strerror(e)'
16138                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16139                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16140                                 d_syserrlst="$define"
16141                 else
16142                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16143                         d_syserrlst="$undef"
16144                 fi
16145     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16146                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16147                 d_strerror="$undef"
16148                 d_syserrlst="$define"
16149                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16150     else
16151                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16152                 d_strerror="$undef"
16153                 d_syserrlst="$undef"
16154                 d_strerrm='"unknown"'
16155     fi
16156 fi
16157
16158 : see if strerror_r exists
16159 set strerror_r d_strerror_r
16160 eval $inlibc
16161 case "$d_strerror_r" in
16162 "$define")
16163         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16164         case "$d_strerror_r_proto:$usethreads" in
16165         ":define")      d_strerror_r_proto=define
16166                 set d_strerror_r_proto strerror_r $hdrs
16167                 eval $hasproto ;;
16168         *)      ;;
16169         esac
16170         case "$d_strerror_r_proto" in
16171         define)
16172         case "$strerror_r_proto" in
16173         ''|0) try='int strerror_r(int, char*, size_t);'
16174         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16175         esac
16176         case "$strerror_r_proto" in
16177         ''|0) try='int strerror_r(int, char*, int);'
16178         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16179         esac
16180         case "$strerror_r_proto" in
16181         ''|0) try='char* strerror_r(int, char*, size_t);'
16182         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16183         esac
16184         case "$strerror_r_proto" in
16185         ''|0)   d_strerror_r=undef
16186                 strerror_r_proto=0
16187                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16188         * )     case "$strerror_r_proto" in
16189                 REENTRANT_PROTO*) ;;
16190                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16191                 esac
16192                 echo "Prototype: $try" ;;
16193         esac
16194         ;;
16195         *)      case "$usethreads" in
16196                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16197                 esac
16198                 d_strerror_r=undef
16199                 strerror_r_proto=0
16200                 ;;
16201         esac
16202         ;;
16203 *)      strerror_r_proto=0
16204         ;;
16205 esac
16206
16207 : see if strftime exists
16208 set strftime d_strftime
16209 eval $inlibc
16210
16211 : see if strtod exists
16212 set strtod d_strtod
16213 eval $inlibc
16214
16215 : see if strtol exists
16216 set strtol d_strtol
16217 eval $inlibc
16218
16219 : see if strtold exists
16220 set strtold d_strtold
16221 eval $inlibc
16222
16223 : see if strtoll exists
16224 set strtoll d_strtoll
16225 eval $inlibc
16226
16227 case "$d_longlong-$d_strtoll" in
16228 "$define-$define")
16229         $cat <<EOM
16230 Checking whether your strtoll() works okay...
16231 EOM
16232         $cat >try.c <<'EOCP'
16233 #include <errno.h>
16234 #ifdef __hpux
16235 #define strtoll __strtoll
16236 #endif
16237 #ifdef __EMX__
16238 #define strtoll _strtoll
16239 #endif
16240 #include <stdio.h>
16241 extern long long int strtoll(char *s, char **, int); 
16242 static int bad = 0;
16243 int check(char *s, long long ell, int een) {
16244         long long gll;
16245         errno = 0;
16246         gll = strtoll(s, 0, 10);
16247         if (!((gll == ell) && (errno == een)))
16248                 bad++;
16249 }
16250 int main() {
16251         check(" 1",                                      1LL, 0);
16252         check(" 0",                                      0LL, 0);
16253         check("-1",                                     -1LL, 0);
16254         check("-9223372036854775808", -9223372036854775808LL, 0);
16255         check("-9223372036854775808", -9223372036854775808LL, 0);
16256         check(" 9223372036854775807",  9223372036854775807LL, 0);
16257         check("-9223372036854775808", -9223372036854775808LL, 0);
16258         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16259         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16260         if (!bad)
16261                 printf("ok\n");
16262 }
16263 EOCP
16264         set try
16265         if eval $compile; then
16266                 yyy=`$run ./try`
16267                 case "$yyy" in
16268                 ok) echo "Your strtoll() seems to be working okay." ;;
16269                 *) cat <<EOM >&4
16270 Your strtoll() doesn't seem to be working okay.
16271 EOM
16272                    d_strtoll="$undef"
16273                    ;;
16274                 esac
16275         else
16276                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16277                 d_strtoll="$undef"
16278         fi
16279         ;;
16280 esac
16281
16282 : see if strtoq exists
16283 set strtoq d_strtoq
16284 eval $inlibc
16285
16286 : see if strtoul exists
16287 set strtoul d_strtoul
16288 eval $inlibc
16289
16290 case "$d_strtoul" in
16291 "$define")
16292         $cat <<EOM
16293 Checking whether your strtoul() works okay...
16294 EOM
16295         $cat >try.c <<'EOCP'
16296 #include <errno.h>
16297 #include <stdio.h>
16298 extern unsigned long int strtoul(char *s, char **, int); 
16299 static int bad = 0;
16300 void check(char *s, unsigned long eul, int een) {
16301         unsigned long gul;
16302         errno = 0;
16303         gul = strtoul(s, 0, 10);
16304         if (!((gul == eul) && (errno == een)))
16305                 bad++;
16306 }
16307 int main() {
16308         check(" 1", 1L, 0);
16309         check(" 0", 0L, 0);
16310 EOCP
16311         case "$longsize" in
16312         8)
16313             $cat >>try.c <<'EOCP'
16314         check("18446744073709551615", 18446744073709551615UL, 0);
16315         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16316 #if 0 /* strtoul() for /^-/ strings is undefined. */
16317         check("-1", 18446744073709551615UL, 0);
16318         check("-18446744073709551614", 2, 0);
16319         check("-18446744073709551615", 1, 0);
16320         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16321         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16322 #endif
16323 EOCP
16324                 ;;
16325         4)
16326                     $cat >>try.c <<'EOCP'
16327         check("4294967295", 4294967295UL, 0);
16328         check("4294967296", 4294967295UL, ERANGE);
16329 #if 0 /* strtoul() for /^-/ strings is undefined. */
16330         check("-1", 4294967295UL, 0);
16331         check("-4294967294", 2, 0);
16332         check("-4294967295", 1, 0);
16333         check("-4294967296", 4294967295UL, ERANGE);
16334         check("-4294967297", 4294967295UL, ERANGE);
16335 #endif
16336 EOCP
16337                 ;;
16338         *)
16339 : Should we write these tests to be more portable by sprintf-ing
16340 : ~0 and then manipulating that char string as input for strtol?
16341                 ;;
16342         esac
16343         $cat >>try.c <<'EOCP'
16344         if (!bad)
16345                 printf("ok\n");
16346         return 0;
16347 }
16348 EOCP
16349         set try
16350         if eval $compile; then
16351                 case "`$run ./try`" in
16352                 ok) echo "Your strtoul() seems to be working okay." ;;
16353                 *) cat <<EOM >&4
16354 Your strtoul() doesn't seem to be working okay.
16355 EOM
16356                    d_strtoul="$undef"
16357                    ;;
16358                 esac
16359         fi
16360         ;;
16361 esac
16362
16363 : see if strtoull exists
16364 set strtoull d_strtoull
16365 eval $inlibc
16366
16367 case "$d_longlong-$d_strtoull" in
16368 "$define-$define")
16369         $cat <<EOM
16370 Checking whether your strtoull() works okay...
16371 EOM
16372         $cat >try.c <<'EOCP'
16373 #include <errno.h>
16374 #ifdef __hpux
16375 #define strtoull __strtoull
16376 #endif
16377 #include <stdio.h>
16378 extern unsigned long long int strtoull(char *s, char **, int); 
16379 static int bad = 0;
16380 int check(char *s, long long eull, int een) {
16381         long long gull;
16382         errno = 0;
16383         gull = strtoull(s, 0, 10);
16384         if (!((gull == eull) && (errno == een)))
16385                 bad++;
16386 }
16387 int main() {
16388         check(" 1",                                        1LL, 0);
16389         check(" 0",                                        0LL, 0);
16390         check("18446744073709551615",  18446744073709551615ULL, 0);
16391         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16392 #if 0 /* strtoull() for /^-/ strings is undefined. */
16393         check("-1",                    18446744073709551615ULL, 0);
16394         check("-18446744073709551614",                     2LL, 0);
16395         check("-18446744073709551615",                     1LL, 0);
16396         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16397         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16398 #endif
16399         if (!bad)
16400                 printf("ok\n");
16401 }
16402 EOCP
16403         set try
16404         if eval $compile; then
16405                 case "`$run ./try`" in
16406                 ok) echo "Your strtoull() seems to be working okay." ;;
16407                 *) cat <<EOM >&4
16408 Your strtoull() doesn't seem to be working okay.
16409 EOM
16410                    d_strtoull="$undef"
16411                    ;;
16412                 esac
16413         fi
16414         ;;
16415 esac
16416
16417 : see if strtouq exists
16418 set strtouq d_strtouq
16419 eval $inlibc
16420
16421 case "$d_strtouq" in
16422 "$define")
16423         $cat <<EOM
16424 Checking whether your strtouq() works okay...
16425 EOM
16426         $cat >try.c <<'EOCP'
16427 #include <errno.h>
16428 #include <stdio.h>
16429 extern unsigned long long int strtouq(char *s, char **, int); 
16430 static int bad = 0;
16431 void check(char *s, unsigned long long eull, int een) {
16432         unsigned long long gull;
16433         errno = 0;
16434         gull = strtouq(s, 0, 10);
16435         if (!((gull == eull) && (errno == een)))
16436                 bad++;
16437 }
16438 int main() {
16439         check(" 1",                                        1LL, 0);
16440         check(" 0",                                        0LL, 0);
16441         check("18446744073709551615",  18446744073709551615ULL, 0);
16442         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16443 #if 0 /* strtouq() for /^-/ strings is undefined. */
16444         check("-1",                    18446744073709551615ULL, 0);
16445         check("-18446744073709551614",                     2LL, 0);
16446         check("-18446744073709551615",                     1LL, 0);
16447         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16448         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16449 #endif
16450         if (!bad)
16451                 printf("ok\n");
16452         return 0;
16453 }
16454 EOCP
16455         set try
16456         if eval $compile; then
16457                 case "`$run ./try`" in
16458                 ok) echo "Your strtouq() seems to be working okay." ;;
16459                 *) cat <<EOM >&4
16460 Your strtouq() doesn't seem to be working okay.
16461 EOM
16462                    d_strtouq="$undef"
16463                    ;;
16464                 esac
16465         fi
16466         ;;
16467 esac
16468
16469 : see if strxfrm exists
16470 set strxfrm d_strxfrm
16471 eval $inlibc
16472
16473 : see if symlink exists
16474 set symlink d_symlink
16475 eval $inlibc
16476
16477 : see if syscall exists
16478 set syscall d_syscall
16479 eval $inlibc
16480
16481 : see if prototype for syscall is available
16482 echo " "
16483 set d_syscallproto syscall $i_unistd unistd.h
16484 eval $hasproto
16485
16486 : see if sysconf exists
16487 set sysconf d_sysconf
16488 eval $inlibc
16489
16490 : see if system exists
16491 set system d_system
16492 eval $inlibc
16493
16494 : see if tcgetpgrp exists
16495 set tcgetpgrp d_tcgetpgrp
16496 eval $inlibc
16497
16498 : see if tcsetpgrp exists
16499 set tcsetpgrp d_tcsetpgrp
16500 eval $inlibc
16501
16502 : see if prototype for telldir is available
16503 echo " "
16504 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16505 eval $hasproto
16506
16507 : see if time exists
16508 echo " "
16509 if test "X$d_time" = X -o X"$timetype" = X; then
16510     if set time val -f d_time; eval $csym; $val; then
16511                 echo 'time() found.' >&4
16512                 val="$define"
16513                 rp="What is the type returned by time() on this system?"
16514                 set time_t timetype long stdio.h sys/types.h
16515                 eval $typedef_ask
16516     else
16517                 echo 'time() not found, hope that will do.' >&4
16518                 val="$undef"
16519                 timetype='int';
16520     fi
16521     set d_time
16522     eval $setvar
16523 fi
16524
16525 : see if this is a sys/times.h system
16526 set sys/times.h i_systimes
16527 eval $inhdr
16528
16529 : see if times exists
16530 echo " "
16531 if set times val -f d_times; eval $csym; $val; then
16532         echo 'times() found.' >&4
16533         d_times="$define"
16534         inc=''
16535         case "$i_systimes" in
16536         "$define") inc='sys/times.h';;
16537         esac
16538         rp="What is the type returned by times() on this system?"
16539         set clock_t clocktype long stdio.h sys/types.h $inc
16540         eval $typedef_ask
16541 else
16542         echo 'times() NOT found, hope that will do.' >&4
16543         d_times="$undef"
16544         clocktype='int'
16545 fi
16546
16547 : see if tmpnam_r exists
16548 set tmpnam_r d_tmpnam_r
16549 eval $inlibc
16550 case "$d_tmpnam_r" in
16551 "$define")
16552         hdrs="$i_systypes sys/types.h define stdio.h "
16553         case "$d_tmpnam_r_proto:$usethreads" in
16554         ":define")      d_tmpnam_r_proto=define
16555                 set d_tmpnam_r_proto tmpnam_r $hdrs
16556                 eval $hasproto ;;
16557         *)      ;;
16558         esac
16559         case "$d_tmpnam_r_proto" in
16560         define)
16561         case "$tmpnam_r_proto" in
16562         ''|0) try='char* tmpnam_r(char*);'
16563         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16564         esac
16565         case "$tmpnam_r_proto" in
16566         ''|0)   d_tmpnam_r=undef
16567                 tmpnam_r_proto=0
16568                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16569         * )     case "$tmpnam_r_proto" in
16570                 REENTRANT_PROTO*) ;;
16571                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16572                 esac
16573                 echo "Prototype: $try" ;;
16574         esac
16575         ;;
16576         *)      case "$usethreads" in
16577                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16578                 esac
16579                 d_tmpnam_r=undef
16580                 tmpnam_r_proto=0
16581                 ;;
16582         esac
16583         ;;
16584 *)      tmpnam_r_proto=0
16585         ;;
16586 esac
16587
16588 : see if truncate exists
16589 set truncate d_truncate
16590 eval $inlibc
16591
16592 : see if ttyname_r exists
16593 set ttyname_r d_ttyname_r
16594 eval $inlibc
16595 case "$d_ttyname_r" in
16596 "$define")
16597         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16598         case "$d_ttyname_r_proto:$usethreads" in
16599         ":define")      d_ttyname_r_proto=define
16600                 set d_ttyname_r_proto ttyname_r $hdrs
16601                 eval $hasproto ;;
16602         *)      ;;
16603         esac
16604         case "$d_ttyname_r_proto" in
16605         define)
16606         case "$ttyname_r_proto" in
16607         ''|0) try='int ttyname_r(int, char*, size_t);'
16608         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16609         esac
16610         case "$ttyname_r_proto" in
16611         ''|0) try='int ttyname_r(int, char*, int);'
16612         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16613         esac
16614         case "$ttyname_r_proto" in
16615         ''|0) try='char* ttyname_r(int, char*, int);'
16616         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16617         esac
16618         case "$ttyname_r_proto" in
16619         ''|0)   d_ttyname_r=undef
16620                 ttyname_r_proto=0
16621                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16622         * )     case "$ttyname_r_proto" in
16623                 REENTRANT_PROTO*) ;;
16624                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16625                 esac
16626                 echo "Prototype: $try" ;;
16627         esac
16628         ;;
16629         *)      case "$usethreads" in
16630                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16631                 esac
16632                 d_ttyname_r=undef
16633                 ttyname_r_proto=0
16634                 ;;
16635         esac
16636         ;;
16637 *)      ttyname_r_proto=0
16638         ;;
16639 esac
16640
16641 : see if tzname[] exists
16642 echo " "
16643 if set tzname val -a d_tzname; eval $csym; $val; then
16644         val="$define"
16645         echo 'tzname[] found.' >&4
16646 else
16647         val="$undef"
16648         echo 'tzname[] NOT found.' >&4
16649 fi
16650 set d_tzname
16651 eval $setvar
16652
16653 case "$osname" in
16654 next|rhapsody|darwin) multiarch="$define" ;;
16655 esac
16656 case "$multiarch" in
16657 ''|[nN]*) multiarch="$undef" ;;
16658 esac
16659
16660 : check for ordering of bytes in a UV
16661 echo " "
16662 case "$usecrosscompile$multiarch" in
16663 *$define*)
16664         $cat <<EOM
16665 You seem to be either cross-compiling or doing a multiarchitecture build,
16666 skipping the byteorder check.
16667
16668 EOM
16669         byteorder='ffff'
16670         ;;
16671 *)
16672         case "$byteorder" in
16673         '')
16674                 $cat <<'EOM'
16675 In the following, larger digits indicate more significance.  A big-endian
16676 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16677 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16678 machines may have weird orders like 3412.  A Cray will report 87654321,
16679 an Alpha will report 12345678. If the test program works the default is
16680 probably right.
16681 I'm now running the test program...
16682 EOM
16683                 $cat >try.c <<EOCP
16684 #include <stdio.h>
16685 #include <sys/types.h>
16686 typedef $uvtype UV;
16687 int main()
16688 {
16689         int i;
16690         union {
16691                 UV l;
16692                 char c[$uvsize];
16693         } u;
16694
16695         if ($uvsize > 4)
16696                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16697         else
16698                 u.l = (UV)0x04030201;
16699         for (i = 0; i < $uvsize; i++)
16700                 printf("%c", u.c[i]+'0');
16701         printf("\n");
16702         exit(0);
16703 }
16704 EOCP
16705                 xxx_prompt=y
16706                 set try
16707                 if eval $compile && ./try > /dev/null; then
16708                         dflt=`$run ./try`
16709                         case "$dflt" in
16710                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16711                                 echo "(The test program ran ok.)"
16712                                 echo "byteorder=$dflt"
16713                                 xxx_prompt=n
16714                         ;;
16715                         ????|????????) echo "(The test program ran ok.)" ;;
16716                         *) echo "(The test program didn't run right for some reason.)" ;;
16717                         esac
16718                 else
16719                         dflt='4321'
16720                         cat <<'EOM'
16721 (I can't seem to compile the test program.  Guessing big-endian...)
16722 EOM
16723                 fi
16724                 case "$xxx_prompt" in
16725                 y)
16726                         rp="What is the order of bytes in $uvtype?"
16727                         . ./myread
16728                         byteorder="$ans"
16729                         ;;
16730                 *)      byteorder=$dflt
16731                         ;;
16732                 esac
16733                 ;;
16734         esac
16735         $rm -f try.c try
16736         ;;
16737 esac
16738
16739
16740 $cat <<EOM
16741
16742 Checking to see whether you can access character data unalignedly...
16743 EOM
16744 case "$d_u32align" in
16745 '')   $cat >try.c <<EOCP
16746 #include <stdio.h>
16747 #$i_stdlib I_STDLIB
16748 #ifdef I_STDLIB
16749 #include <stdlib.h>
16750 #endif
16751 #define U32 $u32type
16752 #define BYTEORDER 0x$byteorder
16753 #define U8 $u8type
16754 #include <signal.h>
16755 #ifdef SIGBUS
16756 $signal_t bletch(s) int s; { exit(4); }
16757 #endif
16758 int main() {
16759 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16760     U8 buf[8];
16761     U32 *up;
16762     int i;
16763
16764     if (sizeof(U32) != 4) {
16765         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16766         exit(1);
16767     }
16768
16769     fflush(stdout);
16770
16771 #ifdef SIGBUS
16772     signal(SIGBUS, bletch);
16773 #endif
16774
16775     buf[0] = 0;
16776     buf[1] = 0;
16777     buf[2] = 0;
16778     buf[3] = 1;
16779     buf[5] = 0;
16780     buf[6] = 0;
16781     buf[7] = 0;
16782     buf[8] = 1;
16783
16784     for (i = 0; i < 4; i++) {
16785         up = (U32*)(buf + i);
16786         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16787                (*up == 1 << (8*(3-i)))  /* little-endian */
16788               )
16789            )
16790         {
16791             printf("read failed (%x)\n", *up);
16792             exit(2);
16793         }
16794     }
16795
16796     /* write test */
16797     for (i = 0; i < 4; i++) {
16798         up = (U32*)(buf + i);
16799         *up = 0xBeef;
16800         if (*up != 0xBeef) {
16801             printf("write failed (%x)\n", *up);
16802             exit(3);
16803         }
16804     }
16805
16806     exit(0);
16807 #else
16808     printf("1\n");
16809     exit(1);
16810 #endif
16811     return 0;
16812 }
16813 EOCP
16814 set try
16815 if eval $compile_ok; then
16816         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16817         $run ./try 2>&1 >/dev/null
16818         case "$?" in
16819         0)      cat >&4 <<EOM
16820 You can access character data pretty unalignedly.
16821 EOM
16822                 d_u32align="$undef"
16823                 ;;
16824         *)      cat >&4 <<EOM
16825 It seems that you must access character data in an aligned manner.
16826 EOM
16827                 d_u32align="$define"
16828                 ;;
16829         esac
16830 else
16831         rp='Can you access character data at unaligned addresses?'
16832         dflt='n'
16833         . ./myread
16834         case "$ans" in
16835         [yY]*)  d_u32align="$undef"  ;;
16836         *)      d_u32align="$define" ;;
16837         esac
16838 fi
16839 $rm -f core core.try.* try.core
16840 ;;
16841 esac
16842
16843 : see if ualarm exists
16844 set ualarm d_ualarm
16845 eval $inlibc
16846
16847 : see if umask exists
16848 set umask d_umask
16849 eval $inlibc
16850
16851 : see if unordered exists
16852 set unordered d_unordered
16853 eval $inlibc
16854
16855 : see if usleep exists
16856 set usleep d_usleep
16857 eval $inlibc
16858
16859 : see if prototype for usleep is available
16860 echo " "
16861 set d_usleepproto usleep $i_unistd unistd.h
16862 eval $hasproto
16863
16864 : see if ustat exists
16865 set ustat d_ustat
16866 eval $inlibc
16867
16868 : backward compatibility for d_hvfork
16869 if test X$d_hvfork != X; then
16870         d_vfork="$d_hvfork"
16871         d_hvfork=''
16872 fi
16873 : see if there is a vfork
16874 val=''
16875 set vfork val
16876 eval $inlibc
16877
16878 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16879 : perl on Solaris 2.x, and probably elsewhere.
16880 case "$val" in
16881 $define)
16882         echo " "
16883         case "$usevfork" in
16884         false) dflt='n';;
16885         *) dflt='y';;
16886         esac
16887         cat <<'EOM'
16888  
16889 Perl can only use a vfork() that doesn't suffer from strict
16890 restrictions on calling functions or modifying global data in
16891 the child.  For example, glibc-2.1 contains such a vfork()
16892 that is unsuitable.  If your system provides a proper fork()
16893 call, chances are that you do NOT want perl to use vfork().
16894
16895 EOM
16896         rp="Do you still want to use vfork()?"
16897         . ./myread
16898         case "$ans" in
16899         y|Y) ;;
16900         *)
16901                 echo "Ok, we won't use vfork()."
16902                 val="$undef"
16903                 ;;
16904         esac
16905         ;;
16906 esac
16907 set d_vfork
16908 eval $setvar
16909 case "$d_vfork" in
16910 $define) usevfork='true';;
16911 *) usevfork='false';;
16912 esac
16913
16914 : see if closedir exists
16915 set closedir d_closedir
16916 eval $inlibc
16917
16918 case "$d_closedir" in
16919 "$define")
16920         echo " "
16921         echo "Checking whether closedir() returns a status..." >&4
16922         cat > try.c <<EOM
16923 #$i_dirent I_DIRENT             /**/
16924 #$i_sysdir I_SYS_DIR            /**/
16925 #$i_sysndir I_SYS_NDIR          /**/
16926 #$i_systypes I_SYS_TYPES        /**/
16927
16928 #if defined(I_SYS_TYPES)
16929 #include <sys/types.h>
16930 #endif
16931 #if defined(I_DIRENT)
16932 #include <dirent.h>
16933 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16934 #include <sys/dir.h>
16935 #endif
16936 #else
16937 #ifdef I_SYS_NDIR
16938 #include <sys/ndir.h>
16939 #else
16940 #ifdef I_SYS_DIR
16941 #ifdef hp9000s500
16942 #include <ndir.h>       /* may be wrong in the future */
16943 #else
16944 #include <sys/dir.h>
16945 #endif
16946 #endif
16947 #endif
16948 #endif 
16949 int main() { return closedir(opendir(".")); }
16950 EOM
16951         set try
16952         if eval $compile_ok; then
16953                 if $run ./try > /dev/null 2>&1 ; then
16954                         echo "Yes, it does."
16955                         val="$undef"
16956                 else
16957                         echo "No, it doesn't."
16958                         val="$define"
16959                 fi
16960         else
16961                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16962                 val="$define"
16963         fi
16964         ;;
16965 *)
16966         val="$undef";
16967         ;;
16968 esac
16969 set d_void_closedir
16970 eval $setvar
16971 $rm -f try try.*
16972 : see if there is a wait4
16973 set wait4 d_wait4
16974 eval $inlibc
16975
16976 : see if waitpid exists
16977 set waitpid d_waitpid
16978 eval $inlibc
16979
16980 : see if wcstombs exists
16981 set wcstombs d_wcstombs
16982 eval $inlibc
16983
16984 : see if wctomb exists
16985 set wctomb d_wctomb
16986 eval $inlibc
16987
16988 : see if writev exists
16989 set writev d_writev
16990 eval $inlibc
16991
16992 : preserve RCS keywords in files with variable substitution, grrr
16993 Date='$Date'
16994 Id='$Id'
16995 Log='$Log'
16996 RCSfile='$RCSfile'
16997 Revision='$Revision'
16998
16999 : check for alignment requirements
17000 echo " "
17001 case "$usecrosscompile$multiarch" in
17002 *$define*)
17003         $cat <<EOM
17004 You seem to be either cross-compiling or doing a multiarchitecture build,
17005 skipping the memory alignment check.
17006
17007 EOM
17008         case "$alignbytes" in
17009         '') alignbytes=8 ;;
17010         esac
17011         ;;
17012 *)
17013         case "$alignbytes" in
17014         '') echo "Checking alignment constraints..." >&4
17015                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17016                         $cat >try.c <<'EOCP'
17017 typedef long double NV;
17018 EOCP
17019                 else
17020                         $cat >try.c <<'EOCP'
17021 typedef double NV;
17022 EOCP
17023                 fi
17024                 $cat >>try.c <<'EOCP'
17025 #include <stdio.h>
17026 struct foobar {
17027         char foo;
17028         NV bar;
17029 } try_algn;
17030 int main()
17031 {
17032     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17033     return(0);
17034 }
17035 EOCP
17036                 set try
17037                 if eval $compile_ok; then
17038                         dflt=`$run ./try`
17039                 else
17040                         dflt='8'
17041                         echo "(I can't seem to compile the test program...)"
17042                 fi
17043                 ;;
17044         *) dflt="$alignbytes"
17045                 ;;
17046         esac
17047         rp="Doubles must be aligned on a how-many-byte boundary?"
17048         . ./myread
17049         alignbytes="$ans"
17050         $rm -f try.c try
17051         ;;
17052 esac
17053
17054
17055 : set the base revision
17056 baserev=5.0
17057
17058 : how do we catenate cpp tokens here?
17059 echo " "
17060 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
17061 $cat >cpp_stuff.c <<'EOCP'
17062 #define RCAT(a,b)a/**/b
17063 #define ACAT(a,b)a ## b
17064 RCAT(Rei,ser)
17065 ACAT(Cir,cus)
17066 EOCP
17067 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17068 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17069         echo "Oh!  Smells like ANSI's been here." >&4
17070         echo "We can catify or stringify, separately or together!"
17071         cpp_stuff=42
17072 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17073         echo "Ah, yes!  The good old days!" >&4
17074         echo "However, in the good old days we don't know how to stringify and"
17075         echo "catify at the same time."
17076         cpp_stuff=1
17077 else
17078         $cat >&4 <<EOM
17079 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
17080 to have to edit the values of CAT[2-5] in config.h...
17081 EOM
17082         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17083 fi
17084 $rm -f cpp_stuff.*
17085
17086 : see if this is a db.h system
17087 set db.h i_db
17088 eval $inhdr
17089
17090 case "$i_db" in
17091 $define)
17092         : Check db version.
17093         echo " "
17094         echo "Checking Berkeley DB version ..." >&4
17095         $cat >try.c <<EOCP
17096 #$d_const HASCONST
17097 #ifndef HASCONST
17098 #define const
17099 #endif
17100 #include <sys/types.h>
17101 #include <stdio.h>
17102 #include <db.h>
17103 int main(int argc, char *argv[])
17104 {
17105 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17106     int Major, Minor, Patch ;
17107     unsigned long Version ;
17108     (void)db_version(&Major, &Minor, &Patch) ;
17109     if (argc == 2) {
17110         printf("%d %d %d %d %d %d\n",
17111                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17112                Major, Minor, Patch);
17113         exit(0);
17114     }
17115     printf("You have Berkeley DB Version 2 or greater.\n");
17116
17117     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17118                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17119     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17120                 Major, Minor, Patch) ;
17121
17122     /* check that db.h & libdb are compatible */
17123     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17124         printf("db.h and libdb are incompatible.\n") ;
17125         exit(3);        
17126     }
17127
17128     printf("db.h and libdb are compatible.\n") ;
17129
17130     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17131                 + DB_VERSION_PATCH ;
17132
17133     /* needs to be >= 2.3.4 */
17134     if (Version < 2003004) {
17135     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17136         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17137         exit(2);        
17138     }
17139
17140     exit(0);
17141 #else
17142 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17143     if (argc == 2) {
17144         printf("1 0 0\n");
17145         exit(0);
17146     }
17147     printf("You have Berkeley DB Version 1.\n");
17148     exit(0);    /* DB version < 2: the coast is clear. */
17149 #else
17150     exit(1);    /* <db.h> not Berkeley DB? */
17151 #endif
17152 #endif
17153 }
17154 EOCP
17155         set try
17156         if eval $compile_ok && $run ./try; then
17157                 echo 'Looks OK.' >&4
17158                 set `$run ./try 1`
17159                 db_version_major=$1
17160                 db_version_minor=$2
17161                 db_version_patch=$3
17162         else
17163                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17164                 i_db=$undef
17165                 case " $libs " in
17166                 *"-ldb "*)
17167                         : Remove db from list of libraries to use
17168                         echo "Removing unusable -ldb from library list" >&4
17169                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17170                         shift
17171                         libs="$*"
17172                         echo "libs = $libs" >&4
17173                         ;;
17174                 esac
17175         fi
17176         $rm -f try.*
17177         ;;
17178 esac
17179
17180 case "$i_db" in
17181 define)
17182         : Check the return type needed for hash 
17183         echo " "
17184         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17185         $cat >try.c <<EOCP
17186 #$d_const HASCONST
17187 #ifndef HASCONST
17188 #define const
17189 #endif
17190 #include <sys/types.h>
17191 #include <db.h>
17192
17193 #ifndef DB_VERSION_MAJOR
17194 u_int32_t hash_cb (ptr, size)
17195 const void *ptr;
17196 size_t size;
17197 {
17198 }
17199 HASHINFO info;
17200 int main()
17201 {
17202         info.hash = hash_cb;
17203 }
17204 #endif
17205 EOCP
17206         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17207                 if $contains warning try.out >>/dev/null 2>&1 ; then
17208                         db_hashtype='int'
17209                 else
17210                         db_hashtype='u_int32_t'
17211                 fi
17212         else
17213                 : XXX Maybe we should just give up here.
17214                 db_hashtype=u_int32_t
17215                 $cat try.out >&4
17216                 echo "Help:  I can't seem to compile the db test program." >&4
17217                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17218         fi
17219         $rm -f try.*
17220         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17221         ;;
17222 *)      db_hashtype=u_int32_t
17223         ;;
17224 esac
17225 case "$i_db" in
17226 define)
17227         : Check the return type needed for prefix 
17228         echo " "
17229         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17230         cat >try.c <<EOCP
17231 #$d_const HASCONST
17232 #ifndef HASCONST
17233 #define const
17234 #endif
17235 #include <sys/types.h>
17236 #include <db.h>
17237
17238 #ifndef DB_VERSION_MAJOR
17239 size_t prefix_cb (key1, key2)
17240 const DBT *key1;
17241 const DBT *key2;
17242 {
17243 }
17244 BTREEINFO info;
17245 int main()
17246 {
17247         info.prefix = prefix_cb;
17248 }
17249 #endif
17250 EOCP
17251         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17252                 if $contains warning try.out >>/dev/null 2>&1 ; then
17253                         db_prefixtype='int'
17254                 else
17255                         db_prefixtype='size_t'
17256                 fi
17257         else
17258                 db_prefixtype='size_t'
17259                 : XXX Maybe we should just give up here.
17260                 $cat try.out >&4
17261                 echo "Help:  I can't seem to compile the db test program." >&4
17262                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17263         fi
17264         $rm -f try.*
17265         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17266         ;;
17267 *)      db_prefixtype='size_t'
17268         ;;
17269 esac
17270
17271
17272 : How can we generate normalized random numbers ?
17273 echo " "
17274 echo "Looking for a random number function..." >&4
17275 case "$randfunc" in
17276 '')
17277         if set drand48 val -f; eval $csym; $val; then
17278                 dflt="drand48"
17279                 echo "Good, found drand48()." >&4
17280         elif set random val -f; eval $csym; $val; then
17281                 dflt="random"
17282                 echo "OK, found random()." >&4
17283         else
17284                 dflt="rand"
17285                 echo "Yick, looks like I have to use rand()." >&4
17286         fi
17287         echo " "
17288         ;;
17289 *)
17290         dflt="$randfunc"
17291         ;;
17292 esac
17293 cont=true
17294
17295 case "$ccflags" in
17296 *-Dmy_rand=*|*-Dmy_srand=*)
17297         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17298         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17299         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17300         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17301         ;;
17302 esac
17303
17304 while $test "$cont"; do
17305         rp="Use which function to generate random numbers?"
17306         . ./myread
17307         if $test "$ans" = "$dflt"; then
17308                 : null
17309         else
17310                 randbits=''
17311         fi
17312         randfunc="$ans"
17313         if set $ans val -f; eval $csym; $val; then
17314                 cont=''
17315         else
17316                 dflt=y
17317                 rp="I cannot find function $ans. Use that name anyway?"
17318                 . ./myread
17319                 dflt=rand
17320                 case "$ans" in
17321                         [yY]*) cont='';;
17322                 esac
17323         fi
17324         case "$cont" in
17325         '')
17326                 case "$randfunc" in
17327                 drand48)
17328                         drand01="drand48()"
17329                         seedfunc="srand48"
17330                         randbits=48
17331                         randseedtype=long
17332                         ;;
17333                 rand|random)
17334                         case "$randbits" in
17335                         '')
17336 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17337                                 $cat >try.c <<EOCP
17338 #$i_unistd I_UNISTD
17339 #$i_stdlib I_STDLIB
17340 #include <stdio.h>
17341 #ifdef I_UNISTD
17342 #  include <unistd.h>
17343 #endif
17344 #ifdef I_STDLIB
17345 #  include <stdlib.h>
17346 #endif
17347 int main()
17348 {
17349         register int i;
17350         register unsigned long tmp;
17351         register unsigned long max = 0L;
17352
17353         for (i = 1000; i; i--) {
17354                 tmp = (unsigned long) $randfunc();
17355                 if (tmp > max) max = tmp;
17356         }
17357         for (i = 0; max; i++)
17358                 max /= 2;
17359         printf("%d\n",i);
17360 }
17361 EOCP
17362                                 set try
17363                                 if eval $compile_ok; then
17364                                         dflt=`try`
17365                                 else
17366                                         dflt='?'
17367                                         echo "(I can't seem to compile the test program...)"
17368                                 fi
17369                                 ;;
17370                         *)
17371                                 dflt="$randbits"
17372                                 ;;
17373                         esac
17374                         rp="How many bits does your $randfunc() function produce?"
17375                         . ./myread
17376                         randbits="$ans"
17377                         $rm -f try.c try
17378                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17379                         seedfunc="s$randfunc"
17380                         randseedtype=unsigned
17381                         ;;
17382                 *)
17383                         dflt="31"
17384                         rp="How many bits does your $randfunc() function produce?"
17385                         . ./myread
17386                         randbits="$ans"
17387                         seedfunc="s$randfunc"
17388                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17389                         if set $seedfunc val -f; eval $csym; $val; then
17390                                 echo "(Using $seedfunc() to seed random generator)"
17391                         else
17392                                 echo "(Warning: no $seedfunc() to seed random generator)"
17393                                 seedfunc=rand
17394                         fi
17395                         randseedtype=unsigned
17396                         ;;
17397                 esac
17398                 ;;
17399         esac
17400 done
17401
17402 echo " "
17403 echo "Determining whether or not we are on an EBCDIC system..." >&4
17404 $cat >try.c <<'EOM'
17405 int main()
17406 {
17407   if ('M'==0xd4) return 0;
17408   return 1;
17409 }
17410 EOM
17411
17412 val=$undef
17413 set try
17414 if eval $compile_ok; then
17415         if $run ./try; then
17416                 echo "You seem to speak EBCDIC." >&4
17417                 val="$define"
17418         else
17419                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17420         fi
17421 else
17422         echo "I'm unable to compile the test program." >&4
17423         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17424 fi
17425 $rm -f try try.*
17426 set ebcdic
17427 eval $setvar
17428
17429 echo " "
17430 $cat >&4 <<EOM
17431 Checking how to flush all pending stdio output...
17432 EOM
17433 # I only know how to find the first 32 possibly open files on SunOS.
17434 # See also hints/sunos_4_1.sh and util.c  --AD
17435 case "$osname" in
17436 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17437 esac
17438 $cat >>try.c <<EOCP
17439 #include <stdio.h>
17440 #$i_unistd I_UNISTD
17441 #ifdef I_UNISTD
17442 # include <unistd.h>
17443 #endif
17444 #$d_sysconf HAS_SYSCONF
17445 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17446 #ifdef HAS_STDIO_STREAM_ARRAY
17447 # define STDIO_STREAM_ARRAY $stdio_stream_array
17448 #endif
17449 int main() {
17450   FILE* p;
17451   unlink("try.out");
17452   p = fopen("try.out", "w");
17453 #ifdef TRY_FPUTC
17454   fputc('x', p);
17455 #else
17456 # ifdef TRY_FPRINTF
17457   fprintf(p, "x");
17458 # endif
17459 #endif
17460 #ifdef TRY_FFLUSH_NULL
17461   fflush(NULL);
17462 #endif
17463 #ifdef TRY_FFLUSH_ALL
17464   {
17465     long open_max = -1;
17466 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17467     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17468 # else
17469 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17470     open_max = sysconf(_SC_OPEN_MAX);
17471 #  else
17472 #   ifdef FOPEN_MAX
17473     open_max = FOPEN_MAX;
17474 #   else
17475 #    ifdef OPEN_MAX
17476     open_max = OPEN_MAX;
17477 #    else
17478 #     ifdef _NFILE
17479     open_max = _NFILE;
17480 #     endif
17481 #    endif
17482 #   endif
17483 #  endif
17484 # endif 
17485 # ifdef HAS_STDIO_STREAM_ARRAY
17486     if (open_max > 0) {
17487       long i;
17488       for (i = 0; i < open_max; i++)
17489             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17490                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17491                 STDIO_STREAM_ARRAY[i]._flag)
17492                 fflush(&STDIO_STREAM_ARRAY[i]);
17493     }   
17494   }
17495 # endif
17496 #endif
17497   _exit(42);
17498 }
17499 EOCP
17500 : first we have to find out how _not_ to flush
17501 $to try.c
17502 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17503     output=''
17504     set try -DTRY_FPUTC
17505     if eval $compile; then
17506             $run ./try 2>/dev/null
17507             code="$?"
17508             $from try.out
17509             if $test ! -s try.out -a "X$code" = X42; then
17510                 output=-DTRY_FPUTC
17511             fi
17512     fi
17513     case "$output" in
17514     '')
17515             set try -DTRY_FPRINTF
17516             if eval $compile; then
17517                     $run ./try 2>/dev/null
17518                     code="$?"
17519                     $from try.out
17520                     if $test ! -s try.out -a "X$code" = X42; then
17521                         output=-DTRY_FPRINTF
17522                     fi
17523             fi
17524         ;;
17525     esac
17526 fi
17527 : check for fflush NULL behaviour
17528 case "$fflushNULL" in
17529 '')     set try -DTRY_FFLUSH_NULL $output
17530         if eval $compile; then
17531                 $run ./try 2>/dev/null
17532                 code="$?"
17533                 $from try.out
17534                 if $test -s try.out -a "X$code" = X42; then
17535                         fflushNULL="`$cat try.out`"
17536                 else
17537                         if $test "X$code" != X42; then
17538                                 $cat >&4 <<EOM
17539 (If this test failed, don't worry, we'll try another method shortly.)
17540 EOM
17541                         fi
17542                 fi
17543         fi
17544         $rm -f core try.core core.try.*
17545         case "$fflushNULL" in
17546         x)      $cat >&4 <<EOM
17547 Your fflush(NULL) works okay for output streams.
17548 Let's see if it clobbers input pipes...
17549 EOM
17550 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17551 # bug that improperly flushes the input end of pipes.  So we avoid the
17552 # autoflush on fork/system/exec support for now. :-(
17553 $cat >tryp.c <<EOCP
17554 #include <stdio.h>
17555 int
17556 main(int argc, char **argv)
17557 {
17558     char buf[1024];
17559     int i;
17560     char *bp = buf;
17561     while (1) {
17562         while ((i = getc(stdin)) != -1
17563                && (*bp++ = i) != '\n'
17564                && bp < &buf[1024])
17565         /* DO NOTHING */ ;
17566         *bp = '\0';
17567         fprintf(stdout, "%s", buf);
17568         fflush(NULL);
17569         if (i == -1)
17570             return 0;
17571         bp = buf;
17572     }
17573 }
17574 EOCP
17575                 fflushNULL="$define"
17576                 set tryp
17577                 if eval $compile; then
17578                     $rm -f tryp.out
17579                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17580                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17581                        $cat >&4 <<EOM
17582 fflush(NULL) seems to behave okay with input streams.
17583 EOM
17584                         fflushNULL="$define"
17585                     else
17586                         $cat >&4 <<EOM
17587 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17588 EOM
17589                         fflushNULL="$undef"
17590                     fi
17591                 fi
17592                 $rm -f core tryp.c tryp.core core.tryp.*
17593                 ;;
17594         '')     $cat >&4 <<EOM
17595 Your fflush(NULL) isn't working (contrary to ANSI C).
17596 EOM
17597                 fflushNULL="$undef"
17598                 ;;
17599         *)      $cat >&4 <<EOM
17600 Cannot figure out whether your fflush(NULL) works or not.
17601 I'm assuming it doesn't (contrary to ANSI C).
17602 EOM
17603                 fflushNULL="$undef"
17604                 ;;
17605         esac
17606         ;;
17607 $define|true|[yY]*)
17608         fflushNULL="$define"
17609         ;;
17610 *)
17611         fflushNULL="$undef"
17612         ;;
17613 esac
17614 : check explicit looping only if NULL did not work, and if the pipe
17615 : bug does not show up on an explicit flush too
17616 case "$fflushNULL" in
17617 "$undef")
17618         $cat >tryp.c <<EOCP
17619 #include <stdio.h>
17620 int
17621 main(int argc, char **argv)
17622 {
17623     char buf[1024];
17624     int i;
17625     char *bp = buf;
17626     while (1) {
17627         while ((i = getc(stdin)) != -1
17628                && (*bp++ = i) != '\n'
17629                && bp < &buf[1024])
17630         /* DO NOTHING */ ;
17631         *bp = '\0';
17632         fprintf(stdout, "%s", buf);
17633         fflush(stdin);
17634         if (i == -1)
17635             return 0;
17636         bp = buf;
17637     }
17638 }
17639 EOCP
17640         set tryp
17641         if eval $compile; then
17642             $rm -f tryp.out
17643             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17644             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17645                $cat >&4 <<EOM
17646 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17647 EOM
17648                 : now check for fflushall behaviour
17649                 case "$fflushall" in
17650                 '')     set try -DTRY_FFLUSH_ALL $output
17651                         if eval $compile; then
17652                                 $cat >&4 <<EOM
17653 (Now testing the other method--but note that this also may fail.)
17654 EOM
17655                                 $run ./try 2>/dev/null
17656                                 code=$?
17657                                 $from try.out
17658                                 if $test -s try.out -a "X$code" = X42; then
17659                                         fflushall="`$cat try.out`"
17660                                 fi
17661                         fi
17662                         $rm -f core try.core core.try.*
17663                         case "$fflushall" in
17664                         x)      $cat >&4 <<EOM
17665 Whew. Flushing explicitly all the stdio streams works.
17666 EOM
17667                                 fflushall="$define"
17668                                 ;;
17669                         '')     $cat >&4 <<EOM
17670 Sigh. Flushing explicitly all the stdio streams doesn't work.
17671 EOM
17672                                 fflushall="$undef"
17673                                 ;;
17674                         *)      $cat >&4 <<EOM
17675 Cannot figure out whether flushing stdio streams explicitly works or not.
17676 I'm assuming it doesn't.
17677 EOM
17678                                 fflushall="$undef"
17679                                 ;;
17680                         esac
17681                         ;;
17682                 "$define"|true|[yY]*)
17683                         fflushall="$define"
17684                         ;;
17685                 *)
17686                         fflushall="$undef"
17687                         ;;
17688                 esac
17689             else
17690                 $cat >&4 <<EOM
17691 All is futile.  Even fflush(stdin) clobbers input pipes!
17692 EOM
17693                 fflushall="$undef"
17694             fi
17695         else
17696             fflushall="$undef"
17697         fi
17698         $rm -f core tryp.c tryp.core core.tryp.*
17699         ;;
17700 *)      fflushall="$undef"
17701         ;;
17702 esac
17703
17704 case "$fflushNULL$fflushall" in
17705 undefundef)
17706         $cat <<EOM
17707 OK, I give up.  I cannot figure out how to flush pending stdio output.
17708 We won't be flushing handles at all before fork/exec/popen.
17709 EOM
17710         ;;
17711 esac
17712 $rm -f try.* try$exe_ext
17713
17714 : Store the full pathname to the ar program for use in the C program
17715 : Respect a hint or command line value for full_ar.
17716 case "$full_ar" in
17717 '') full_ar=$ar ;;
17718 esac
17719
17720 : Store the full pathname to the sed program for use in the C program
17721 full_sed=$sed
17722
17723 : see what type gids are declared as in the kernel
17724 echo " "
17725 echo "Looking for the type for group ids returned by getgid()."
17726 set gid_t gidtype xxx stdio.h sys/types.h
17727 eval $typedef
17728 case "$gidtype" in
17729 xxx)
17730         xxx=`./findhdr sys/user.h`
17731         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17732         case $1 in
17733         unsigned) dflt="$1 $2" ;;
17734         *) dflt="$1" ;;
17735         esac
17736         ;;
17737 *) dflt="$gidtype";;
17738 esac
17739 case "$gidtype" in
17740 gid_t) echo "gid_t found." ;;
17741 *)      rp="What is the type for group ids returned by getgid()?"
17742         . ./myread
17743         gidtype="$ans"
17744         ;;
17745 esac
17746
17747 echo " "
17748 case "$gidtype" in
17749 *_t) zzz="$gidtype"     ;;
17750 *)   zzz="gid"          ;;
17751 esac
17752 echo "Checking the size of $zzz..." >&4 
17753 cat > try.c <<EOCP
17754 #include <sys/types.h>
17755 #include <stdio.h>
17756 #$i_stdlib I_STDLIB
17757 #ifdef I_STDLIB
17758 #include <stdlib.h>
17759 #endif
17760 int main() {
17761     printf("%d\n", (int)sizeof($gidtype));
17762     exit(0);
17763 }
17764 EOCP
17765 set try
17766 if eval $compile_ok; then
17767         yyy=`$run ./try`
17768         case "$yyy" in
17769         '')     gidsize=4
17770                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17771                 ;;
17772         *)      gidsize=$yyy
17773                 echo "Your $zzz is $gidsize bytes long."
17774                 ;;
17775         esac
17776 else
17777         gidsize=4
17778         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17779 fi
17780
17781
17782 echo " "
17783 case "$gidtype" in
17784 *_t) zzz="$gidtype"     ;;
17785 *)   zzz="gid"          ;;
17786 esac
17787 echo "Checking the sign of $zzz..." >&4 
17788 cat > try.c <<EOCP
17789 #include <sys/types.h>
17790 #include <stdio.h>
17791 int main() {
17792         $gidtype foo = -1;
17793         if (foo < 0)
17794                 printf("-1\n");
17795         else
17796                 printf("1\n");
17797 }
17798 EOCP
17799 set try
17800 if eval $compile; then
17801         yyy=`$run ./try`
17802         case "$yyy" in
17803         '')     gidsign=1
17804                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17805                 ;;
17806         *)      gidsign=$yyy
17807                 case "$gidsign" in
17808                  1) echo "Your $zzz is unsigned." ;;
17809                 -1) echo "Your $zzz is signed."   ;;
17810                 esac
17811                 ;;
17812         esac
17813 else
17814         gidsign=1
17815         echo "(I can't compile the test program--guessing unsigned.)" >&4
17816 fi
17817
17818
17819 echo " "
17820
17821 if $test X"$quadtype" != X; then
17822
17823 echo "Checking how to print 64-bit integers..." >&4
17824
17825 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17826         $cat >try.c <<'EOCP'
17827 #include <sys/types.h>
17828 #include <stdio.h>
17829 int main() {
17830   int q = 12345678901;
17831   printf("%ld\n", q);
17832 }
17833 EOCP
17834         set try
17835         if eval $compile; then
17836                 yyy=`$run ./try`
17837                 case "$yyy" in
17838                 12345678901)
17839                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17840                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17841                         echo "We will use %d."
17842                         ;;
17843                 esac
17844         fi
17845 fi
17846
17847 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17848         $cat >try.c <<'EOCP'
17849 #include <sys/types.h>
17850 #include <stdio.h>
17851 int main() {
17852   long q = 12345678901;
17853   printf("%ld\n", q);
17854 }
17855 EOCP
17856         set try
17857         if eval $compile; then
17858                 yyy=`$run ./try`
17859                 case "$yyy" in
17860                 12345678901)
17861                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17862                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17863                         echo "We will use %ld."
17864                         ;;
17865                 esac
17866         fi
17867 fi
17868
17869 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17870         $cat >try.c <<'EOCP'
17871 #include <sys/types.h>
17872 #include <inttypes.h>
17873 #include <stdio.h>
17874 int main() {
17875   int64_t q = 12345678901;
17876   printf("%" PRId64 "\n", q);
17877 }
17878 EOCP
17879         set try
17880         if eval $compile; then
17881                 yyy=`$run ./try`
17882                 case "$yyy" in
17883                 12345678901)
17884                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17885                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17886                         echo "We will use the C9X style."
17887                         ;;
17888                 esac
17889         fi
17890 fi
17891
17892 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17893         $cat >try.c <<EOCP
17894 #include <sys/types.h>
17895 #include <stdio.h>
17896 int main() {
17897   $quadtype q = 12345678901;
17898   printf("%Ld\n", q);
17899 }
17900 EOCP
17901         set try
17902         if eval $compile; then
17903                 yyy=`$run ./try`
17904                 case "$yyy" in
17905                 12345678901)
17906                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17907                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17908                         echo "We will use %Ld."
17909                         ;;
17910                 esac
17911         fi
17912 fi
17913
17914 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17915         $cat >try.c <<'EOCP'
17916 #include <sys/types.h>
17917 #include <stdio.h>
17918 int main() {
17919   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17920   printf("%lld\n", q);
17921 }
17922 EOCP
17923         set try
17924         if eval $compile; then
17925                 yyy=`$run ./try`
17926                 case "$yyy" in
17927                 12345678901)
17928                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17929                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17930                         echo "We will use the %lld style."
17931                         ;;
17932                 esac
17933         fi
17934 fi
17935
17936 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17937         $cat >try.c <<EOCP
17938 #include <sys/types.h>
17939 #include <stdio.h>
17940 int main() {
17941   $quadtype q = 12345678901;
17942   printf("%qd\n", q);
17943 }
17944 EOCP
17945         set try
17946         if eval $compile; then
17947                 yyy=`$run ./try`
17948                 case "$yyy" in
17949                 12345678901)
17950                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17951                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17952                         echo "We will use %qd."
17953                         ;;
17954                 esac
17955         fi
17956 fi
17957
17958 if $test X"$sPRId64" = X; then
17959         echo "Cannot figure out how to print 64-bit integers." >&4
17960 fi
17961
17962 $rm -f try try.*
17963
17964 fi
17965
17966 case "$sPRId64" in
17967 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17968         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17969         ;;
17970 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17971         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17972         ;;
17973 esac
17974
17975
17976 echo " "
17977 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17978
17979 if $test X"$ivsize" = X8; then
17980         ivdformat="$sPRId64"
17981         uvuformat="$sPRIu64"
17982         uvoformat="$sPRIo64"
17983         uvxformat="$sPRIx64"
17984         uvXUformat="$sPRIXU64"
17985 else
17986         if $test X"$ivsize" = X"$longsize"; then
17987                 ivdformat='"ld"'
17988                 uvuformat='"lu"'
17989                 uvoformat='"lo"'
17990                 uvxformat='"lx"'
17991                 uvXUformat='"lX"'
17992         else
17993                 if $test X"$ivsize" = X"$intsize"; then
17994                         ivdformat='"d"'
17995                         uvuformat='"u"'
17996                         uvoformat='"o"'
17997                         uvxformat='"x"'
17998                         uvXUformat='"X"'
17999                 else
18000                         : far out
18001                         if $test X"$ivsize" = X"$shortsize"; then
18002                                 ivdformat='"hd"'
18003                                 uvuformat='"hu"'
18004                                 uvoformat='"ho"'
18005                                 uvxformat='"hx"'
18006                                 uvXUformat='"hX"'
18007                         fi
18008                 fi
18009         fi
18010 fi
18011
18012 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18013         nveformat="$sPRIeldbl"
18014         nvfformat="$sPRIfldbl"
18015         nvgformat="$sPRIgldbl"
18016         nvEUformat="$sPRIEUldbl"
18017         nvFUformat="$sPRIFUldbl"
18018         nvGUformat="$sPRIGUldbl"
18019 else
18020         nveformat='"e"'
18021         nvfformat='"f"'
18022         nvgformat='"g"'
18023         nvEUformat='"E"'
18024         nvFUformat='"F"'
18025         nvGUformat='"G"'
18026 fi
18027
18028 case "$ivdformat" in
18029 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18030     exit 1
18031     ;;
18032 esac
18033
18034
18035 echo " "
18036 $echo "Checking the format string to be used for gids..." >&4
18037
18038 case "$gidsign" in
18039 -1)     if $test X"$gidsize" = X"$ivsize"; then
18040                 gidformat="$ivdformat"
18041         else
18042                 if $test X"$gidsize" = X"$longsize"; then
18043                         gidformat='"ld"'
18044                 else
18045                         if $test X"$gidsize" = X"$intsize"; then
18046                                 gidformat='"d"'
18047                         else
18048                                 if $test X"$gidsize" = X"$shortsize"; then
18049                                         gidformat='"hd"'
18050                                 fi
18051                         fi
18052                 fi
18053         fi
18054         ;;
18055 *)      if $test X"$gidsize" = X"$uvsize"; then
18056                 gidformat="$uvuformat"
18057         else
18058                 if $test X"$gidsize" = X"$longsize"; then
18059                         gidformat='"lu"'
18060                 else
18061                         if $test X"$gidsize" = X"$intsize"; then
18062                                 gidformat='"u"'
18063                         else
18064                                 if $test X"$gidsize" = X"$shortsize"; then
18065                                         gidformat='"hu"'
18066                                 fi
18067                         fi
18068                 fi
18069         fi
18070         ;;
18071 esac
18072
18073 : see if getgroups exists
18074 set getgroups d_getgrps
18075 eval $inlibc
18076
18077 : see if setgroups exists
18078 set setgroups d_setgrps
18079 eval $inlibc
18080
18081
18082 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18083 echo " "
18084 case "$d_getgrps$d_setgrps" in
18085 *define*)
18086         case "$groupstype" in
18087         '') dflt="$gidtype" ;;
18088         *)  dflt="$groupstype" ;;
18089         esac
18090         $cat <<EOM
18091 What type of pointer is the second argument to getgroups() and setgroups()?
18092 Usually this is the same as group ids, $gidtype, but not always.
18093
18094 EOM
18095         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18096         . ./myread
18097         groupstype="$ans"
18098         ;;
18099 *)  groupstype="$gidtype";;
18100 esac
18101
18102 echo " "
18103 echo "Checking if your $make program sets \$(MAKE)..." >&4
18104 case "$make_set_make" in
18105 '')
18106         $sed 's/^X //' > testmake.mak << 'EOF'
18107 Xall:
18108 X       @echo 'maketemp="$(MAKE)"'
18109 EOF
18110         case "`$make -f testmake.mak 2>/dev/null`" in
18111         *maketemp=*) make_set_make='#' ;;
18112         *)      make_set_make="MAKE=$make" ;;
18113         esac
18114         $rm -f testmake.mak
18115         ;;
18116 esac
18117 case "$make_set_make" in
18118 '#') echo "Yup, it does.";;
18119 *) echo "Nope, it doesn't.";;
18120 esac
18121
18122 : see what type is used for mode_t
18123 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18124 set mode_t modetype int stdio.h sys/types.h
18125 eval $typedef_ask
18126
18127 : see if stdarg is available
18128 echo " "
18129 if $test `./findhdr stdarg.h`; then
18130         echo "<stdarg.h> found." >&4
18131         valstd="$define"
18132 else
18133         echo "<stdarg.h> NOT found." >&4
18134         valstd="$undef"
18135 fi
18136
18137 : see if varags is available
18138 echo " "
18139 if $test `./findhdr varargs.h`; then
18140         echo "<varargs.h> found." >&4
18141 else
18142         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18143 fi
18144
18145 : set up the varargs testing programs
18146 $cat > varargs.c <<EOP
18147 #ifdef I_STDARG
18148 #include <stdarg.h>
18149 #endif
18150 #ifdef I_VARARGS
18151 #include <varargs.h>
18152 #endif
18153
18154 #ifdef I_STDARG
18155 int f(char *p, ...)
18156 #else
18157 int f(va_alist)
18158 va_dcl
18159 #endif
18160 {
18161         va_list ap;
18162 #ifndef I_STDARG
18163         char *p;
18164 #endif
18165 #ifdef I_STDARG
18166         va_start(ap,p);
18167 #else
18168         va_start(ap);
18169         p = va_arg(ap, char *);
18170 #endif
18171         va_end(ap);
18172 }
18173 EOP
18174 $cat > varargs <<EOP
18175 $startsh
18176 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18177         echo "true"
18178 else
18179         echo "false"
18180 fi
18181 $rm -f varargs$_o
18182 EOP
18183 chmod +x varargs
18184
18185 : now check which varargs header should be included
18186 echo " "
18187 i_varhdr=''
18188 case "$valstd" in
18189 "$define")
18190         if `./varargs I_STDARG`; then
18191                 val='stdarg.h'
18192         elif `./varargs I_VARARGS`; then
18193                 val='varargs.h'
18194         fi
18195         ;;
18196 *)
18197         if `./varargs I_VARARGS`; then
18198                 val='varargs.h'
18199         fi
18200         ;;
18201 esac
18202 case "$val" in
18203 '')
18204 echo "I could not find the definition for va_dcl... You have problems..." >&4
18205         val="$undef"; set i_stdarg; eval $setvar
18206         val="$undef"; set i_varargs; eval $setvar
18207         ;;
18208 *) 
18209         set i_varhdr
18210         eval $setvar
18211         case "$i_varhdr" in
18212         stdarg.h)
18213                 val="$define"; set i_stdarg; eval $setvar
18214                 val="$undef"; set i_varargs; eval $setvar
18215                 ;;
18216         varargs.h)
18217                 val="$undef"; set i_stdarg; eval $setvar
18218                 val="$define"; set i_varargs; eval $setvar
18219                 ;;
18220         esac
18221         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18222 esac
18223 $rm -f varargs*
18224
18225 : see if we need va_copy
18226 echo " "
18227 case "$i_stdarg" in
18228 "$define")
18229         $cat >try.c <<EOCP
18230 #include <stdarg.h>
18231 #include <stdio.h>
18232 #$i_stdlib I_STDLIB
18233 #ifdef I_STDLIB
18234 #include <stdlib.h>
18235 #endif
18236 #include <signal.h>
18237
18238 int
18239 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18240 {
18241   return vfprintf(f, fmt, *valp);
18242 }
18243  
18244 int    
18245 myvfprintf(FILE *f, const  char *fmt, va_list val)
18246 {
18247   return ivfprintf(f, fmt, &val);
18248 }
18249       
18250 int
18251 myprintf(char *fmt, ...) 
18252 {
18253   va_list val;
18254   va_start(val, fmt);
18255   return myvfprintf(stdout, fmt, val); 
18256 }         
18257
18258 int
18259 main(int ac, char **av)
18260 {
18261   signal(SIGSEGV, exit);
18262
18263   myprintf("%s%cs all right, then\n", "that", '\'');                            
18264   exit(0);      
18265 }
18266 EOCP
18267         set try
18268         if eval $compile && $run ./try 2>&1 >/dev/null; then
18269                 case "`$run ./try`" in
18270                 "that's all right, then")
18271                         okay=yes
18272                         ;;
18273                 esac
18274         fi
18275         case "$okay" in
18276         yes)    echo "It seems that you don't need va_copy()." >&4
18277                 need_va_copy="$undef"
18278                 ;;
18279         *)      echo "It seems that va_copy() or similar will be needed." >&4
18280                 need_va_copy="$define"
18281                 ;;
18282         esac
18283         $rm -f try.* core core.* *.core *.core.*
18284         ;;
18285 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18286         ;;
18287 esac
18288
18289 : see what type is used for size_t
18290 rp="What is the type used for the length parameter for string functions?"
18291 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18292 eval $typedef_ask
18293
18294 : check for type of arguments to gethostbyaddr. 
18295 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18296         case "$d_gethbyaddr" in
18297         $define)
18298                 $cat <<EOM
18299
18300 Checking to see what type of arguments are accepted by gethostbyaddr().
18301 EOM
18302                 hdrs="$define sys/types.h
18303                         $d_socket sys/socket.h 
18304                         $i_niin netinet/in.h 
18305                         $i_netdb netdb.h
18306                         $i_unistd unistd.h"
18307                 : The first arg can 'char *' or 'void *'
18308                 : The second arg is some of integral type
18309                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18310                         for yyy in size_t long int; do
18311                                 case "$netdb_host_type" in
18312                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18313                                         if ./protochk "$try" $hdrs; then
18314                                                 echo "Your system accepts $xxx for the first arg."
18315                                                 echo "...and $yyy for the second arg."
18316                                                 netdb_host_type="$xxx"
18317                                                 netdb_hlen_type="$yyy"
18318                                         fi
18319                                         ;;
18320                                 esac
18321                         done
18322                 done
18323                 : In case none of those worked, prompt the user.
18324                 case "$netdb_host_type" in
18325                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18326                         dflt='char *'
18327                         . ./myread
18328                         netdb_host_type=$ans
18329                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18330                         dflt="$sizetype"
18331                         . ./myread
18332                         netdb_hlen_type=$ans
18333                         ;;
18334                 esac
18335                 ;;
18336         *)      : no gethostbyaddr, so pick harmless defaults
18337                 netdb_host_type='char *'
18338                 netdb_hlen_type="$sizetype"
18339                 ;;
18340         esac
18341         # Remove the "const" if needed. -- but then we'll have a 
18342         # prototype clash!
18343         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18344 fi
18345
18346 : check for type of argument to gethostbyname. 
18347 if test "X$netdb_name_type" = X ; then
18348         case "$d_gethbyname" in
18349         $define)
18350                 $cat <<EOM
18351
18352 Checking to see what type of argument is accepted by gethostbyname().
18353 EOM
18354                 hdrs="$define sys/types.h
18355                         $d_socket sys/socket.h 
18356                         $i_niin netinet/in.h 
18357                         $i_netdb netdb.h
18358                         $i_unistd unistd.h"
18359                 for xxx in "const char *" "char *"; do
18360                         case "$netdb_name_type" in
18361                         '')     try="extern struct hostent *gethostbyname($xxx);"
18362                                 if ./protochk "$try" $hdrs; then
18363                                         echo "Your system accepts $xxx."
18364                                         netdb_name_type="$xxx"
18365                                 fi
18366                                 ;;
18367                         esac
18368                 done
18369                 : In case none of those worked, prompt the user.
18370                 case "$netdb_name_type" in
18371                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18372                         dflt='char *'
18373                         . ./myread
18374                         netdb_name_type=$ans
18375                         ;;
18376                 esac
18377                 ;;
18378         *)      : no gethostbyname, so pick harmless default
18379                 netdb_name_type='char *'
18380                 ;;
18381         esac
18382 fi
18383
18384 : check for type of 1st argument to getnetbyaddr. 
18385 if test "X$netdb_net_type" = X ; then
18386         case "$d_getnbyaddr" in
18387         $define)
18388                 $cat <<EOM
18389
18390 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18391 EOM
18392                 hdrs="$define sys/types.h
18393                         $d_socket sys/socket.h 
18394                         $i_niin netinet/in.h 
18395                         $i_netdb netdb.h
18396                         $i_unistd unistd.h"
18397                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18398                         case "$netdb_net_type" in
18399                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18400                                 if ./protochk "$try" $hdrs; then
18401                                         echo "Your system accepts $xxx."
18402                                         netdb_net_type="$xxx"
18403                                 fi
18404                                 ;;
18405                         esac
18406                 done
18407                 : In case none of those worked, prompt the user.
18408                 case "$netdb_net_type" in
18409                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18410                         dflt='long'
18411                         . ./myread
18412                         netdb_net_type=$ans
18413                         ;;
18414                 esac
18415                 ;;
18416         *)      : no getnetbyaddr, so pick harmless default
18417                 netdb_net_type='long'
18418                 ;;
18419         esac
18420 fi
18421 : locate the preferred pager for this system
18422 fn=f/
18423 case "$pager" in
18424 '')
18425         dflt=''
18426         case "$pg" in
18427         /*) dflt=$pg;;
18428         [a-zA-Z]:/*) dflt=$pg;;
18429         esac
18430         case "$more" in
18431         /*) dflt=$more;;
18432         [a-zA-Z]:/*) dflt=$more;;
18433         esac
18434         case "$less" in
18435         /*) dflt=$less;;
18436         [a-zA-Z]:/*) dflt=$less;;
18437         esac
18438         case "$dflt" in
18439         '') dflt=/usr/ucb/more;;
18440         esac
18441         ;;
18442 *)      dflt="$pager"
18443         : Instruct ./getfile to trust the hinted or previous pager value,
18444         : even if it does not begin with a slash.  For example, on os2,
18445         : pager might be cmd /c more.  See comments in UU/getfile.
18446         fn="f/($pager)"
18447         ;;
18448 esac
18449 echo " "
18450 rp='What pager is used on your system?'
18451 . ./getfile
18452 pager="$ans"
18453
18454 : see what type pids are declared as in the kernel
18455 rp="What is the type of process ids on this system?"
18456 set pid_t pidtype int stdio.h sys/types.h
18457 eval $typedef_ask
18458
18459 : Find earliest binary compatible site_perl subdirectory perl can use.
18460 xs_apiversion=$version # The current site_perl version.
18461 : Find earliest pure perl site_perl subdirectory perl can use.
18462 : The versioned directories started at 5.005.
18463 pm_apiversion='5.005'
18464
18465 : see if ar generates random libraries by itself
18466 echo " "
18467 echo "Checking how to generate random libraries on your machine..." >&4
18468 echo 'int bar1() { return bar2(); }' > bar1.c
18469 echo 'int bar2() { return 2; }' > bar2.c
18470 $cat > foo.c <<'EOP'
18471 int main() { printf("%d\n", bar1()); exit(0); }
18472 EOP
18473 $cc $ccflags -c bar1.c >/dev/null 2>&1
18474 $cc $ccflags -c bar2.c >/dev/null 2>&1
18475 $cc $ccflags -c foo.c >/dev/null 2>&1
18476 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18477 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18478         $run ./foobar >/dev/null 2>&1; then
18479         echo "$ar appears to generate random libraries itself."
18480         orderlib=false
18481         ranlib=":"
18482 elif $ar ts bar$_a >/dev/null 2>&1 &&
18483         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18484         $run ./foobar >/dev/null 2>&1; then
18485                 echo "a table of contents needs to be added with '$ar ts'."
18486                 orderlib=false
18487                 ranlib="$ar ts"
18488 else
18489         case "$ranlib" in
18490         :) ranlib='';;
18491         '')
18492                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18493                 $test -f $ranlib || ranlib=''
18494                 ;;
18495         esac
18496         if $test -n "$ranlib"; then
18497                 echo "your system has '$ranlib'; we'll use that."
18498                 orderlib=false
18499         else
18500                 echo "your system doesn't seem to support random libraries"
18501                 echo "so we'll use lorder and tsort to order the libraries."
18502                 orderlib=true
18503                 ranlib=":"
18504         fi
18505 fi
18506 $rm -f foo* bar* 
18507
18508 : check for type of arguments to select. 
18509 case "$selecttype" in
18510 '') case "$d_select" in
18511         $define)
18512                 echo " "
18513                 $cat <<EOM
18514 Checking to see what type of arguments are accepted by select().
18515 EOM
18516                 hdrs="$define sys/types.h
18517                         $i_systime sys/time.h 
18518                         $i_sysselct sys/select.h
18519                         $d_socket sys/socket.h"
18520                 : The first arg can be int, unsigned, or size_t
18521                 : The last arg may or may not be 'const'
18522                 val=''
18523                 : void pointer has been seen but using that
18524                 : breaks the selectminbits test
18525                 for xxx in 'fd_set *' 'int *'; do
18526                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18527                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18528                                         case "$val" in
18529                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18530                                                 if ./protochk "$try" $hdrs; then
18531                                                         echo "Your system accepts $xxx."
18532                                                         val="$xxx"
18533                                                 fi
18534                                                 ;;
18535                                         esac
18536                                 done
18537                         done
18538                 done
18539                 case "$val" in
18540                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18541                         case "$d_fd_set" in
18542                                 $define) dflt="fd_set *" ;;
18543                                 *)              dflt="int *" ;;
18544                         esac
18545                         . ./myread
18546                         val=$ans
18547                         ;;
18548                 esac
18549                 selecttype="$val"
18550                 ;;
18551         *)      : no select, so pick a harmless default
18552                 selecttype='int *'
18553                 ;;
18554         esac
18555         ;;
18556 esac
18557
18558 : check for the select 'width'
18559 case "$selectminbits" in
18560 '') case "$d_select" in
18561         $define)
18562                 $cat <<EOM
18563
18564 Checking to see on how many bits at a time your select() operates...
18565 EOM
18566                 $cat >try.c <<EOCP
18567 #include <sys/types.h>
18568 #$i_time I_TIME
18569 #$i_systime I_SYS_TIME
18570 #$i_systimek I_SYS_TIME_KERNEL
18571 #ifdef I_TIME
18572 #   include <time.h>
18573 #endif
18574 #ifdef I_SYS_TIME
18575 #   ifdef I_SYS_TIME_KERNEL
18576 #       define KERNEL
18577 #   endif
18578 #   include <sys/time.h>
18579 #   ifdef I_SYS_TIME_KERNEL
18580 #       undef KERNEL
18581 #   endif
18582 #endif
18583 #$i_sysselct I_SYS_SELECT
18584 #ifdef I_SYS_SELECT
18585 #include <sys/select.h>
18586 #endif
18587 #$d_socket HAS_SOCKET
18588 #ifdef HAS_SOCKET
18589 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18590 #endif
18591 #include <stdio.h>
18592 #$i_stdlib I_STDLIB
18593 #ifdef I_STDLIB
18594 #include <stdlib.h>
18595 #endif
18596 $selecttype b;
18597 #define S sizeof(*(b))
18598 #define MINBITS 64
18599 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18600 #define NBITS  (NBYTES * 8)
18601 int main() {
18602     char s[NBYTES];
18603     struct timeval t;
18604     int i;
18605     FILE* fp;
18606     int fd;
18607
18608     fclose(stdin);
18609     fp = fopen("try.c", "r");
18610     if (fp == 0)
18611       exit(1);
18612     fd = fileno(fp);
18613     if (fd < 0)
18614       exit(2);
18615     b = ($selecttype)s;
18616     for (i = 0; i < NBITS; i++)
18617         FD_SET(i, b);
18618     t.tv_sec  = 0;
18619     t.tv_usec = 0;
18620     select(fd + 1, b, 0, 0, &t);
18621     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18622     printf("%d\n", i + 1);
18623     return 0;
18624 }
18625 EOCP
18626                 set try
18627                 if eval $compile_ok; then
18628                         selectminbits=`$run ./try`
18629                         case "$selectminbits" in
18630                         '')     cat >&4 <<EOM
18631 Cannot figure out on how many bits at a time your select() operates.
18632 I'll play safe and guess it is 32 bits.
18633 EOM
18634                                 selectminbits=32
18635                                 bits="32 bits"
18636                                 ;;
18637                         1)      bits="1 bit" ;;
18638                         *)      bits="$selectminbits bits" ;;
18639                         esac
18640                         echo "Your select() operates on $bits at a time." >&4
18641                 else
18642                         rp='What is the minimum number of bits your select() operates on?'
18643                         case "$byteorder" in
18644                         1234|12345678)  dflt=32 ;;
18645                         *)              dflt=1  ;;
18646                         esac
18647                         . ./myread
18648                         val=$ans
18649                         selectminbits="$val"
18650                 fi
18651                 $rm -f try.* try
18652                 ;;
18653         *)      : no select, so pick a harmless default
18654                 selectminbits='32'
18655                 ;;
18656         esac
18657         ;;
18658 esac
18659
18660 : Trace out the files included by signal.h, then look for SIGxxx names.
18661 : Remove SIGARRAYSIZE used by HPUX.
18662 : Remove SIGSTKSIZE used by Linux.
18663 : Remove SIGSTKSZ used by Posix.
18664 : Remove SIGTYP void lines used by OS2.
18665 : Some cpps, like os390, dont give the file name anywhere
18666 if [ "X$fieldn" = X ]; then
18667         : Just make some guesses.  We check them later.
18668         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18669 else
18670         xxx=`echo '#include <signal.h>' |
18671         $cppstdin $cppminus $cppflags 2>/dev/null |
18672         $grep '^[       ]*#.*include' | 
18673         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18674 fi
18675 : Check this list of files to be sure we have parsed the cpp output ok.
18676 : This will also avoid potentially non-existent files, such 
18677 : as ../foo/bar.h
18678 xxxfiles=''
18679 for xx in $xxx /dev/null ; do
18680         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18681 done
18682 : If we have found no files, at least try signal.h
18683 case "$xxxfiles" in
18684 '')     xxxfiles=`./findhdr signal.h` ;;
18685 esac
18686 xxx=`awk '
18687 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18688         print substr($2, 4, 20)
18689 }
18690 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18691         print substr($3, 4, 20)
18692 }' $xxxfiles`
18693 : Append some common names just in case the awk scan failed.
18694 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18695 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18696 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18697 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18698 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18699
18700 : generate a few handy files for later
18701 $cat > signal.c <<'EOCP'
18702 #include <sys/types.h>
18703 #include <signal.h>
18704 #include <stdio.h>
18705 int main() {
18706
18707 /* Strange style to avoid deeply-nested #if/#else/#endif */
18708 #ifndef NSIG
18709 #  ifdef _NSIG
18710 #    define NSIG (_NSIG)
18711 #  endif
18712 #endif
18713
18714 #ifndef NSIG
18715 #  ifdef SIGMAX
18716 #    define NSIG (SIGMAX+1)
18717 #  endif
18718 #endif
18719
18720 #ifndef NSIG
18721 #  ifdef SIG_MAX
18722 #    define NSIG (SIG_MAX+1)
18723 #  endif
18724 #endif
18725
18726 #ifndef NSIG
18727 #  ifdef MAXSIG
18728 #    define NSIG (MAXSIG+1)
18729 #  endif
18730 #endif
18731
18732 #ifndef NSIG
18733 #  ifdef MAX_SIG
18734 #    define NSIG (MAX_SIG+1)
18735 #  endif
18736 #endif
18737
18738 #ifndef NSIG
18739 #  ifdef SIGARRAYSIZE
18740 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18741 #  endif
18742 #endif
18743
18744 #ifndef NSIG
18745 #  ifdef _sys_nsig
18746 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18747 #  endif
18748 #endif
18749
18750 /* Default to some arbitrary number that's big enough to get most
18751    of the common signals.
18752 */
18753 #ifndef NSIG
18754 #    define NSIG 50
18755 #endif
18756
18757 printf("NSIG %d\n", NSIG);
18758
18759 #ifndef JUST_NSIG
18760
18761 EOCP
18762
18763 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18764 {
18765         printf "#ifdef SIG"; printf $1; printf "\n"
18766         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18767         printf $1; printf ");\n"
18768         printf "#endif\n"
18769 }
18770 END {
18771         printf "#endif /* JUST_NSIG */\n";
18772         printf "exit(0);\n}\n";
18773 }
18774 ' >>signal.c
18775 $cat >signal.awk <<'EOP'
18776 BEGIN { ndups = 0 }
18777 $1 ~ /^NSIG$/ { nsig = $2 }
18778 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
18779     if ($2 > maxsig) { maxsig = $2 }
18780     if (sig_name[$2]) {
18781         dup_name[ndups] = $1
18782         dup_num[ndups] = $2
18783         ndups++ 
18784     }
18785     else {
18786         sig_name[$2] = $1
18787         sig_num[$2] = $2
18788     }
18789 }
18790 END { 
18791     if (nsig == 0) {
18792         nsig = maxsig + 1
18793     }
18794     printf("NSIG %d\n", nsig);
18795     for (n = 1; n < nsig; n++) {
18796         if (sig_name[n]) {
18797             printf("%s %d\n", sig_name[n], sig_num[n])
18798         }
18799         else {
18800             printf("NUM%d %d\n", n, n) 
18801         }
18802     }
18803     for (n = 0; n < ndups; n++) {
18804         printf("%s %d\n", dup_name[n], dup_num[n])
18805     }
18806 }
18807 EOP
18808 $cat >signal_cmd <<EOS
18809 $startsh
18810 if $test -s signal.lst; then
18811     echo "Using your existing signal.lst file"
18812         exit 0
18813 fi
18814 xxx="$xxx"
18815 EOS
18816 $cat >>signal_cmd <<'EOS'
18817
18818 set signal
18819 if eval $compile_ok; then
18820         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18821 else
18822         echo "(I can't seem be able to compile the whole test program)" >&4
18823         echo "(I'll try it in little pieces.)" >&4
18824         set signal -DJUST_NSIG
18825         if eval $compile_ok; then
18826                 $run ./signal$_exe > signal.nsg
18827                 $cat signal.nsg
18828         else
18829                 echo "I can't seem to figure out how many signals you have." >&4
18830                 echo "Guessing 50." >&4
18831                 echo 'NSIG 50' > signal.nsg
18832         fi
18833         : Now look at all the signal names, one at a time.
18834         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18835                 $cat > signal.c <<EOCP
18836 #include <sys/types.h>
18837 #include <signal.h>
18838 #include <stdio.h>
18839 int main() {
18840 printf("$xx %d\n", SIG${xx});
18841 return 0;
18842 }
18843 EOCP
18844                 set signal
18845                 if eval $compile; then
18846                         echo "SIG${xx} found."
18847                         $run ./signal$_exe  >> signal.ls1
18848                 else
18849                         echo "SIG${xx} NOT found."
18850                 fi
18851         done
18852         if $test -s signal.ls1; then
18853                 $cat signal.nsg signal.ls1 |
18854                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18855         fi
18856
18857 fi
18858 if $test -s signal.lst; then
18859         :
18860 else
18861         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18862         echo 'kill -l' >signal
18863         set X `csh -f <signal`
18864         $rm -f signal
18865         shift
18866         case $# in
18867         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18868         esac
18869         echo $@ | $tr ' ' $trnl | \
18870             $awk '{ printf "%s %d\n", $1, ++s; }
18871                   END { printf "NSIG %d\n", ++s }' >signal.lst
18872 fi
18873 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18874 EOS
18875 chmod a+x signal_cmd
18876 $eunicefix signal_cmd
18877
18878 : generate list of signal names
18879 echo " "
18880 case "$sig_name_init" in
18881 '') doinit=yes ;;
18882 *)  case "$sig_num_init" in
18883     ''|*,*) doinit=yes ;;
18884     esac ;;
18885 esac
18886 case "$doinit" in
18887 yes)
18888         echo "Generating a list of signal names and numbers..." >&4
18889         . ./signal_cmd
18890         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18891         sig_name=`$awk 'BEGIN { printf "ZERO " }
18892                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18893         sig_num=`$awk  'BEGIN { printf "0 " }
18894                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18895         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18896                              !/^NSIG/   { printf "\"%s\", ", $1 }
18897                              END        { printf "0\n" }' signal.lst`
18898         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18899                              !/^NSIG/   { printf "%d, ", $2}
18900                              END        { printf "0\n"}' signal.lst`
18901         ;;
18902 esac
18903 echo "The following $sig_count signals are available:"
18904 echo " "
18905 echo $sig_name | $awk \
18906 'BEGIN { linelen = 0 }
18907 {
18908         for (i = 1; i <= NF; i++) {
18909                 name = "SIG" $i " "
18910                 linelen = linelen + length(name)
18911                 if (linelen > 70) {
18912                         printf "\n"
18913                         linelen = length(name)
18914                 }
18915                 printf "%s", name
18916         }
18917         printf "\n"
18918 }'
18919 sig_size=`echo $sig_name | awk '{print NF}'`
18920 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18921
18922 echo " "
18923 case "$sizetype" in
18924 *_t) zzz="$sizetype"    ;;
18925 *)   zzz="filesize"     ;;
18926 esac
18927 echo "Checking the size of $zzz..." >&4 
18928 cat > try.c <<EOCP
18929 #include <sys/types.h>
18930 #include <stdio.h>
18931 #$i_stdlib I_STDLIB
18932 #ifdef I_STDLIB
18933 #include <stdlib.h>
18934 #endif
18935 int main() {
18936     printf("%d\n", (int)sizeof($sizetype));
18937     exit(0);
18938 }
18939 EOCP
18940 set try
18941 if eval $compile_ok; then
18942         yyy=`$run ./try`
18943         case "$yyy" in
18944         '')     sizesize=4
18945                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18946                 ;;
18947         *)      sizesize=$yyy
18948                 echo "Your $zzz size is $sizesize bytes."
18949                 ;;
18950         esac
18951 else
18952         sizesize=4
18953         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18954 fi
18955
18956
18957 : check for socklen_t
18958 echo " "
18959 echo "Checking to see if you have socklen_t..." >&4
18960 $cat >try.c <<EOCP
18961 #include <sys/types.h>
18962 #$d_socket HAS_SOCKET
18963 #ifdef HAS_SOCKET
18964 #include <sys/socket.h>
18965 #endif
18966 int main() { socklen_t x = 16; }
18967 EOCP
18968 set try
18969 if eval $compile; then
18970         val="$define"
18971         echo "You have socklen_t."
18972 else
18973         val="$undef"
18974         echo "You do not have socklen_t."
18975         case "$sizetype" in
18976         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18977         esac
18978 fi
18979 $rm -f try try.*
18980 set d_socklen_t
18981 eval $setvar
18982
18983 : see if this is a socks.h system
18984 set socks.h i_socks
18985 eval $inhdr
18986
18987 : check for type of the size argument to socket calls
18988 case "$d_socket" in
18989 "$define")
18990         $cat <<EOM
18991
18992 Checking to see what type is the last argument of accept().
18993 EOM
18994         yyy=''
18995         case "$d_socklen_t" in
18996         "$define") yyy="$yyy socklen_t"
18997         esac
18998         yyy="$yyy $sizetype int long unsigned"
18999         for xxx in $yyy; do
19000                 case "$socksizetype" in
19001                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19002                         case "$usesocks" in
19003                         "$define")
19004                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19005                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19006                                         socksizetype="$xxx"
19007                                 fi
19008                                 ;;
19009                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19010                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19011                                         socksizetype="$xxx"
19012                                 fi
19013                                 ;;
19014                         esac
19015                         ;;
19016                 esac
19017         done
19018 : In case none of those worked, prompt the user.
19019         case "$socksizetype" in
19020         '')     rp='What is the type for socket address structure sizes?'
19021                 dflt='int'
19022                 . ./myread
19023                 socksizetype=$ans
19024                 ;;
19025         esac
19026         ;;
19027 *)      : no sockets, so pick relatively harmless default
19028         socksizetype='int'
19029         ;;
19030 esac
19031
19032 : see what type is used for signed size_t
19033 set ssize_t ssizetype int stdio.h sys/types.h
19034 eval $typedef
19035 dflt="$ssizetype"
19036 $cat > try.c <<EOM
19037 #include <stdio.h>
19038 #$i_stdlib I_STDLIB
19039 #ifdef I_STDLIB
19040 #include <stdlib.h>
19041 #endif
19042 #include <sys/types.h>
19043 #define Size_t $sizetype
19044 #define SSize_t $dflt
19045 int main()
19046 {
19047         if (sizeof(Size_t) == sizeof(SSize_t))
19048                 printf("$dflt\n");
19049         else if (sizeof(Size_t) == sizeof(int))
19050                 printf("int\n");
19051         else 
19052                 printf("long\n");
19053         exit(0);
19054 }
19055 EOM
19056 echo " "
19057 set try
19058 if eval $compile_ok && $run ./try > /dev/null; then
19059         ssizetype=`$run ./try`
19060         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19061 else
19062         $cat >&4 <<EOM
19063 Help! I can't compile and run the ssize_t test program: please enlighten me!
19064 (This is probably a misconfiguration in your system or libraries, and
19065 you really ought to fix it.  Still, I'll try anyway.)
19066
19067 I need a type that is the same size as $sizetype, but is guaranteed to
19068 be signed.  Common values are ssize_t, int and long.
19069
19070 EOM
19071         rp="What signed type is the same size as $sizetype?"
19072         . ./myread
19073         ssizetype="$ans"
19074 fi
19075 $rm -f try try.*
19076
19077 : see what type of char stdio uses.
19078 echo " "
19079 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19080 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19081         echo "Your stdio uses unsigned chars." >&4
19082         stdchar="unsigned char"
19083 else
19084         echo "Your stdio uses signed chars." >&4
19085         stdchar="char"
19086 fi
19087 $rm -f stdioh
19088
19089
19090
19091 : see what type uids are declared as in the kernel
19092 echo " "
19093 echo "Looking for the type for user ids returned by getuid()."
19094 set uid_t uidtype xxx stdio.h sys/types.h
19095 eval $typedef
19096 case "$uidtype" in
19097 xxx)
19098         xxx=`./findhdr sys/user.h`
19099         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19100         case $1 in
19101         unsigned) dflt="$1 $2" ;;
19102         *) dflt="$1" ;;
19103         esac
19104         ;;
19105 *) dflt="$uidtype";;
19106 esac
19107 case "$uidtype" in
19108 uid_t)  echo "uid_t found." ;;
19109 *)      rp="What is the type for user ids returned by getuid()?"
19110         . ./myread
19111         uidtype="$ans"
19112         ;;
19113 esac
19114
19115 echo " "
19116 case "$uidtype" in
19117 *_t) zzz="$uidtype"     ;;
19118 *)   zzz="uid"          ;;
19119 esac
19120 echo "Checking the size of $zzz..." >&4 
19121 cat > try.c <<EOCP
19122 #include <sys/types.h>
19123 #include <stdio.h>
19124 #$i_stdlib I_STDLIB
19125 #ifdef I_STDLIB
19126 #include <stdlib.h>
19127 #endif
19128 int main() {
19129     printf("%d\n", (int)sizeof($uidtype));
19130     exit(0);
19131 }
19132 EOCP
19133 set try
19134 if eval $compile_ok; then
19135         yyy=`$run ./try`
19136         case "$yyy" in
19137         '')     uidsize=4
19138                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19139                 ;;
19140         *)      uidsize=$yyy
19141                 echo "Your $zzz is $uidsize bytes long."
19142                 ;;
19143         esac
19144 else
19145         uidsize=4
19146         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19147 fi
19148
19149 echo " "
19150 case "$uidtype" in
19151 *_t) zzz="$uidtype"     ;;
19152 *)   zzz="uid"          ;;
19153 esac
19154 echo "Checking the sign of $zzz..." >&4
19155 cat > try.c <<EOCP
19156 #include <sys/types.h>
19157 #include <stdio.h>
19158 int main() {
19159         $uidtype foo = -1;
19160         if (foo < 0)
19161                 printf("-1\n");
19162         else
19163                 printf("1\n");
19164 }
19165 EOCP
19166 set try
19167 if eval $compile; then
19168         yyy=`$run ./try`
19169         case "$yyy" in
19170         '')     uidsign=1
19171                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19172                 ;;
19173         *)      uidsign=$yyy
19174                 case "$uidsign" in
19175                  1) echo "Your $zzz is unsigned." ;;
19176                 -1) echo "Your $zzz is signed."   ;;
19177                 esac
19178                 ;;
19179         esac
19180 else
19181         uidsign=1
19182         echo "(I can't compile the test program--guessing unsigned.)" >&4
19183 fi
19184
19185
19186
19187 echo " "
19188 $echo "Checking the format string to be used for uids..." >&4
19189
19190 case "$uidsign" in
19191 -1)     if $test X"$uidsize" = X"$ivsize"; then
19192                 uidformat="$ivdformat"
19193         else
19194                 if $test X"$uidsize" = X"$longsize"; then
19195                         uidformat='"ld"'
19196                 else
19197                         if $test X"$uidsize" = X"$intsize"; then
19198                                 uidformat='"d"'
19199                         else
19200                                 if $test X"$uidsize" = X"$shortsize"; then
19201                                         uidformat='"hd"'
19202                                 fi
19203                         fi
19204                 fi
19205         fi
19206         ;;
19207 *)      if $test X"$uidsize" = X"$uvsize"; then
19208                 uidformat="$uvuformat"
19209         else
19210                 if $test X"$uidsize" = X"$longsize"; then
19211                         uidformat='"lu"'
19212                 else
19213                         if $test X"$uidsize" = X"$intsize"; then
19214                                 uidformat='"u"'
19215                         else
19216                                 if $test X"$uidsize" = X"$shortsize"; then
19217                                         uidformat='"hu"'
19218                                 fi
19219                         fi
19220                 fi
19221         fi
19222         ;;
19223 esac
19224
19225 : determine compiler compiler
19226 case "$yacc" in
19227 '')
19228         dflt=yacc;;
19229 *)
19230         dflt="$yacc";;
19231 esac
19232 echo " "
19233 comp='yacc'
19234 if $test -f "$byacc$_exe"; then
19235         dflt="$byacc"
19236         comp="byacc or $comp"
19237 fi
19238 if $test -f "$bison$_exe"; then
19239         comp="$comp or bison -y"
19240 fi
19241 rp="Which compiler compiler ($comp) shall I use?"
19242 . ./myread
19243 yacc="$ans"
19244 case "$yacc" in
19245 *bis*)
19246         case "$yacc" in
19247         *-y*) ;;
19248         *)
19249                 yacc="$yacc -y"
19250                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19251                 ;;
19252         esac
19253         ;;
19254 esac
19255
19256 : see if this is a fp.h system
19257 set fp.h i_fp
19258 eval $inhdr
19259
19260 : see if this is a fp_class.h system
19261 set fp_class.h i_fp_class
19262 eval $inhdr
19263
19264 : see if this is a ieeefp.h system
19265 case "$i_ieeefp" in
19266 '' ) set ieeefp.h i_ieeefp
19267      eval $inhdr
19268      ;;
19269 esac
19270
19271 : see if this is a libutil.h system
19272 set libutil.h i_libutil
19273 eval $inhdr
19274
19275 : see if mach cthreads are available
19276 if test "X$usethreads" = "X$define"; then
19277         set mach/cthreads.h i_machcthr
19278         eval $inhdr
19279 else
19280         i_machcthr="$undef"
19281 fi
19282
19283
19284
19285 : see if this is a math.h system
19286 set math.h i_math
19287 eval $inhdr
19288
19289 : see if this is a mntent.h system
19290 set mntent.h i_mntent
19291 eval $inhdr
19292
19293 : see if ndbm.h is available
19294 set ndbm.h t_ndbm
19295 eval $inhdr
19296
19297 case "$t_ndbm" in
19298 $undef)
19299     # Some Linux distributions such as RedHat 7.1 put the
19300     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19301     if $test -f /usr/include/gdbm/ndbm.h; then
19302         echo '<gdbm/ndbm.h> found.'
19303         ccflags="$ccflags -I/usr/include/gdbm"
19304         cppflags="$cppflags -I/usr/include/gdbm"
19305         t_ndbm=$define
19306     fi
19307     ;;
19308 esac
19309
19310 case "$t_ndbm" in
19311 $define)
19312         : see if dbm_open exists
19313         set dbm_open d_dbm_open
19314         eval $inlibc
19315         case "$d_dbm_open" in
19316         $undef)
19317                 t_ndbm="$undef"
19318                 echo "We won't be including <ndbm.h>"
19319                 ;;
19320         esac
19321         ;;
19322 esac
19323 val="$t_ndbm"
19324 set i_ndbm
19325 eval $setvar
19326
19327 : see if net/errno.h is available
19328 val=''
19329 set net/errno.h val
19330 eval $inhdr
19331
19332 : Unfortunately, it causes problems on some systems.  Arrgh.
19333 case "$val" in
19334 $define)
19335         cat > try.c <<'EOM'
19336 #include <stdio.h>
19337 #include <errno.h>
19338 #include <net/errno.h>
19339 int func()
19340 {
19341         return ENOTSOCK;
19342 }
19343 EOM
19344         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19345                 echo "We'll be including <net/errno.h>." >&4
19346         else
19347                 echo "We won't be including <net/errno.h>." >&4
19348                 val="$undef"
19349         fi
19350         $rm -f try.* try
19351         ;;
19352 esac
19353 set i_neterrno
19354 eval $setvar
19355
19356 : see if netinet/tcp.h is available
19357 set netinet/tcp.h i_netinettcp
19358 eval $inhdr
19359
19360 : see if this is a poll.h system
19361 set poll.h i_poll
19362 eval $inhdr
19363
19364 : see if this is a prot.h system
19365 set prot.h i_prot
19366 eval $inhdr
19367
19368 echo " "
19369 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19370 $cat <<'EOSH' > Cppsym.know
19371 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19372 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19373 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19374 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19375 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19376 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19377 bull c cadmus clipper CMU COFF COMPILER_VERSION
19378 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19379 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19380 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19381 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19382 GLIBC GLIBC_MINOR
19383 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19384 H3050R H3050RX hbullx20 hcx host_mips
19385 hp200 hp300 hp700 HP700 hp800 hp9000
19386 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19387 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19388 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19389 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19390 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19391 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19392 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19393 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19394 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19395 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19396 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19397 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19398 MATH_HAS_NO_SIDE_EFFECTS
19399 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19400 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19401 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19402 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19403 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19404 NetBSD news1500 news1700 news1800 news1900 news3700
19405 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19406 ns32016 ns32332 ns32k nsc32000
19407 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19408 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19409 pc532 pdp11 PGC PIC plexus PORTAR posix
19410 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19411 POSIX_C_SOURCE POSIX_SOURCE POWER
19412 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19413 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19414 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19415 sony sony_news sonyrisc sparc sparclite spectrum
19416 stardent stdc STDC_EXT stratos sun sun3 sun386
19417 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19418 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19419 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19420 sysV68 sysV88 Tek4132 Tek4300 titan
19421 TM3200 TM5400 TM5600
19422 tower tower32 tower32_200 tower32_600 tower32_700
19423 tower32_800 tower32_850 tss
19424 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19425 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19426 unix UNIX95 UNIX99 unixpc unos
19427 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19428 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19429 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19430 USGr4 USGr4_2
19431 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19432 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19433 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19434 z8000
19435 EOSH
19436 # Maybe put other stuff here too.
19437 cat <<EOSH >>Cppsym.know
19438 $osname
19439 EOSH
19440 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19441 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19442 $cat Cppsym.know > Cppsym.c
19443 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19444 $rm -f Cppsym.a Cppsym.b Cppsym.c
19445 cat <<EOSH > Cppsym
19446 $startsh
19447 if $test \$# -gt 0; then
19448     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19449     if $test -s Cppsym.got; then
19450         $rm -f Cppsym.got
19451         exit 0
19452     fi
19453     $rm -f Cppsym.got
19454     exit 1
19455 else
19456     $tr " " "$trnl" | ./Cppsym.try
19457     exit 0
19458 fi
19459 EOSH
19460 chmod +x Cppsym
19461 $eunicefix Cppsym
19462 cat <<EOSH > Cppsym.try
19463 $startsh
19464 cat <<'EOCP' > try.c
19465 #include <stdio.h>
19466 int main() {
19467 EOCP
19468 $awk \\
19469 EOSH
19470 cat <<'EOSH' >> Cppsym.try
19471 'length($1) > 0 {
19472     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
19473     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
19474     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
19475     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
19476 }'       >> try.c
19477 echo 'return 0;}' >> try.c
19478 EOSH
19479 cat <<EOSH >> Cppsym.try
19480 ccflags="$ccflags"
19481 case "$osname-$gccversion" in
19482 irix-) ccflags="\$ccflags -woff 1178" ;;
19483 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19484 esac
19485 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19486 EOSH
19487 chmod +x Cppsym.try
19488 $eunicefix Cppsym.try
19489 ./Cppsym < Cppsym.know > Cppsym.true
19490 : now check the C compiler for additional symbols
19491 postprocess_cc_v=''
19492 case "$osname" in
19493 aix) postprocess_cc_v="|$tr , ' '" ;;
19494 esac
19495 $cat >ccsym <<EOS
19496 $startsh
19497 $cat >tmp.c <<EOF
19498 extern int foo;
19499 EOF
19500 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19501 do
19502         case "\$i" in
19503         -D*) echo "\$i" | $sed 's/^-D//';;
19504         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19505         esac
19506 done
19507 $rm -f try.c
19508 EOS
19509 postprocess_cc_v=''
19510 chmod +x ccsym
19511 $eunicefix ccsym
19512 ./ccsym > ccsym1.raw
19513 if $test -s ccsym1.raw; then
19514        $sort ccsym1.raw | $uniq >ccsym.raw
19515 else
19516        mv ccsym1.raw ccsym.raw
19517 fi
19518
19519 $awk '/\=/ { print $0; next }
19520         { print $0"=1" }' ccsym.raw >ccsym.list
19521 $awk '/\=/ { print $0; next }
19522         { print $0"=1" }' Cppsym.true >ccsym.true
19523 $comm -13 ccsym.true ccsym.list >ccsym.own
19524 $comm -12 ccsym.true ccsym.list >ccsym.com
19525 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19526 also=''
19527 if $test -z ccsym.raw; then
19528         echo "Your C compiler doesn't seem to define any symbols!" >&4
19529         echo " "
19530         echo "However, your C preprocessor defines the following symbols:"
19531         $cat Cppsym.true
19532         ccsymbols=''
19533         cppsymbols=`$cat Cppsym.true`
19534         cppsymbols=`echo $cppsymbols`
19535         cppccsymbols="$cppsymbols"
19536 else
19537         if $test -s ccsym.com; then
19538                 echo "Your C compiler and pre-processor define these symbols:"
19539                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19540                 also='also '
19541                 symbols='ones'
19542                 cppccsymbols=`$cat ccsym.com`
19543                 cppccsymbols=`echo $cppccsymbols`
19544                 $test "$silent" || sleep 1
19545         fi
19546         if $test -s ccsym.cpp; then
19547                 $test "$also" && echo " "
19548                 echo "Your C pre-processor ${also}defines the following symbols:"
19549                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19550                 also='further '
19551                 cppsymbols=`$cat ccsym.cpp`
19552                 cppsymbols=`echo $cppsymbols`
19553                 $test "$silent" || sleep 1
19554         fi
19555         if $test -s ccsym.own; then
19556                 $test "$also" && echo " "
19557                 echo "Your C compiler ${also}defines the following cpp symbols:"
19558                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19559                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19560                 ccsymbols=`$cat ccsym.own`
19561                 ccsymbols=`echo $ccsymbols`
19562                 $test "$silent" || sleep 1
19563         fi
19564 fi
19565
19566 : see if this is a termio system
19567 val="$undef"
19568 val2="$undef"
19569 val3="$undef"
19570 if $test `./findhdr termios.h`; then
19571         set tcsetattr i_termios
19572         eval $inlibc
19573         val3="$i_termios"
19574 fi
19575 echo " "
19576 case "$val3" in
19577 "$define") echo "You have POSIX termios.h... good!" >&4;;
19578 *) if ./Cppsym pyr; then
19579                 case "`/bin/universe`" in
19580                 ucb) if $test `./findhdr sgtty.h`; then
19581                                 val2="$define"
19582                                 echo "<sgtty.h> found." >&4
19583                         else
19584                                 echo "System is pyramid with BSD universe."
19585                                 echo "<sgtty.h> not found--you could have problems." >&4
19586                         fi;;
19587                 *) if $test `./findhdr termio.h`; then
19588                                 val="$define"
19589                                 echo "<termio.h> found." >&4
19590                         else
19591                                 echo "System is pyramid with USG universe."
19592                                 echo "<termio.h> not found--you could have problems." >&4
19593                         fi;;
19594                 esac
19595         elif ./usg; then
19596                 if $test `./findhdr termio.h`; then
19597                         echo "<termio.h> found." >&4
19598                         val="$define"
19599                 elif $test `./findhdr sgtty.h`; then
19600                         echo "<sgtty.h> found." >&4
19601                         val2="$define"
19602                 else
19603 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19604                 fi
19605         else
19606                 if $test `./findhdr sgtty.h`; then
19607                         echo "<sgtty.h> found." >&4
19608                         val2="$define"
19609                 elif $test `./findhdr termio.h`; then
19610                         echo "<termio.h> found." >&4
19611                         val="$define"
19612                 else
19613 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19614                 fi
19615         fi;;
19616 esac
19617 set i_termio; eval $setvar
19618 val=$val2; set i_sgtty; eval $setvar
19619 val=$val3; set i_termios; eval $setvar
19620
19621 : see if stddef is available
19622 set stddef.h i_stddef
19623 eval $inhdr
19624
19625 : see if this is a sunmath.h system
19626 set sunmath.h i_sunmath
19627 eval $inhdr
19628
19629 : see if sys/access.h is available
19630 set sys/access.h i_sysaccess
19631 eval $inhdr
19632
19633 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19634 set sys/filio.h i_sysfilio
19635 eval $inhdr
19636 echo " "
19637 if $test `./findhdr sys/ioctl.h`; then
19638         val="$define"
19639         echo '<sys/ioctl.h> found.' >&4
19640 else
19641         val="$undef"
19642         if $test $i_sysfilio = "$define"; then
19643             echo '<sys/ioctl.h> NOT found.' >&4
19644         else
19645                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19646                 $test $i_termio = "$define" && xxx="termio.h"
19647                 $test $i_termios = "$define" && xxx="termios.h"
19648 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19649         fi
19650 fi
19651 set i_sysioctl
19652 eval $setvar
19653
19654 : see if socket ioctl defs are in sys/sockio.h
19655 echo " "
19656 xxx=`./findhdr sys/sockio.h`
19657 if $test "$xxx"; then
19658         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19659                 val="$define"
19660                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19661         else
19662                 val="$undef"
19663                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19664         fi
19665 else
19666         val="$undef"
19667         $cat <<EOM
19668 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19669 EOM
19670 fi
19671 set i_syssockio
19672 eval $setvar
19673
19674
19675 : see if this is a syslog.h system
19676 set syslog.h i_syslog
19677 eval $inhdr
19678
19679
19680 : see if this is a sys/mode.h system
19681 set sys/mode.h i_sysmode
19682 eval $inhdr
19683
19684 : see if sys/resource.h has to be included
19685 set sys/resource.h i_sysresrc
19686 eval $inhdr
19687
19688 : see if sys/security.h is available
19689 set sys/security.h i_syssecrt
19690 eval $inhdr
19691
19692 : see if this is a sys/statvfs.h system
19693 set sys/statvfs.h i_sysstatvfs
19694 eval $inhdr
19695
19696 : see if this is a sys/un.h system
19697 set sys/un.h i_sysun
19698 eval $inhdr
19699
19700
19701 : see if this is a sys/utsname.h system
19702 set sys/utsname.h i_sysutsname
19703 eval $inhdr
19704
19705 : see if this is a syswait system
19706 set sys/wait.h i_syswait
19707 eval $inhdr
19708
19709 : see if this is a ustat.h system
19710 set ustat.h i_ustat
19711 eval $inhdr
19712
19713 : see if this is an utime system
19714 set utime.h i_utime
19715 eval $inhdr
19716
19717 : see if this is a values.h system
19718 set values.h i_values
19719 eval $inhdr
19720
19721 : see if this is a vfork system
19722 case "$d_vfork" in
19723 "$define")
19724         set vfork.h i_vfork
19725         eval $inhdr
19726         ;;
19727 *)
19728         i_vfork="$undef"
19729         ;;
19730 esac
19731
19732 : see if gdbm.h is available
19733 set gdbm.h t_gdbm
19734 eval $inhdr
19735 case "$t_gdbm" in
19736 $define)
19737         : see if gdbm_open exists
19738         set gdbm_open d_gdbm_open
19739         eval $inlibc
19740         case "$d_gdbm_open" in
19741         $undef)
19742                 t_gdbm="$undef"
19743                 echo "We won't be including <gdbm.h>"
19744                 ;;
19745         esac
19746         ;;
19747 esac
19748 val="$t_gdbm"
19749 set i_gdbm
19750 eval $setvar
19751
19752 echo " "
19753 echo "Looking for extensions..." >&4
19754 : If we are using the old config.sh, known_extensions may contain
19755 : old or inaccurate or duplicate values.
19756 known_extensions=''
19757 nonxs_extensions=''
19758 : We do not use find because it might not be available.
19759 : We do not just use MANIFEST because the user may have dropped
19760 : some additional extensions into the source tree and expect them
19761 : to be built.
19762
19763 : Function to recursively find available extensions, ignoring DynaLoader
19764 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19765 find_extensions='
19766     for xxx in *; do
19767        case "$xxx" in
19768            DynaLoader|dynaload) ;;
19769            *)
19770            if $test -f $xxx/$xxx.xs; then
19771                known_extensions="$known_extensions $1$xxx";
19772            elif $test -f $xxx/Makefile.PL; then
19773                nonxs_extensions="$nonxs_extensions $1$xxx";
19774            else
19775                if $test -d $xxx -a $# -lt 10; then
19776                    set $1$xxx/ $*;
19777                    cd "$xxx";
19778                    eval $find_extensions;
19779                    cd ..;
19780                    shift;
19781                fi;
19782            fi
19783            ;;
19784        esac;
19785     done'
19786 tdir=`pwd`
19787 cd "$rsrc/ext"
19788 set X
19789 shift
19790 eval $find_extensions
19791 # Special case:  Add in threads/shared since it is not picked up by the
19792 # recursive find above (and adding in general recursive finding breaks
19793 # SDBM_File/sdbm).  A.D.  10/25/2001.
19794 known_extensions="$known_extensions threads/shared"
19795 set X $nonxs_extensions
19796 shift
19797 nonxs_extensions="$*"
19798 set X $known_extensions
19799 shift
19800 known_extensions="$*"
19801 cd "$tdir"
19802
19803 : Now see which are supported on this system.
19804 avail_ext=''
19805 for xxx in $known_extensions ; do
19806         case "$xxx" in
19807         DB_File|db_file)
19808                 case "$i_db" in
19809                 $define) avail_ext="$avail_ext $xxx" ;;
19810                 esac
19811                 ;;
19812         GDBM_File|gdbm_fil)
19813                 case "$i_gdbm" in 
19814                 $define) avail_ext="$avail_ext $xxx" ;;
19815                 esac
19816                 ;;
19817         I18N/Langinfo|i18n_lan)
19818                 case "$i_langinfo$d_nl_langinfo" in 
19819                 $define$define) avail_ext="$avail_ext $xxx" ;;
19820                 esac
19821                 ;;
19822         NDBM_File|ndbm_fil)
19823                 case "$i_ndbm" in
19824                 $define)
19825                     case "$osname-$use64bitint" in
19826                     hpux-define)
19827                         case "$libs" in
19828                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19829                         esac
19830                         ;;
19831                     *) avail_ext="$avail_ext $xxx" ;;
19832                     esac
19833                     ;;
19834                 esac
19835                 ;;
19836         ODBM_File|odbm_fil) 
19837                 case "${i_dbm}${i_rpcsvcdbm}" in
19838                 *"${define}"*)
19839                     case "$osname-$use64bitint" in
19840                     hpux-define)
19841                         case "$libs" in
19842                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19843                         esac
19844                         ;;
19845                     *) avail_ext="$avail_ext $xxx" ;;
19846                     esac
19847                     ;;
19848                 esac
19849                 ;;
19850         POSIX|posix)
19851                 case "$useposix" in
19852                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19853                 esac
19854                 ;;
19855         Opcode|opcode)
19856                 case "$useopcode" in
19857                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19858                 esac
19859                 ;;
19860         Socket|socket)
19861                 case "$d_socket" in 
19862                 true|$define|y)
19863                     case "$osname" in
19864                     beos) ;; # not unless BONE
19865                     *) avail_ext="$avail_ext $xxx" ;;
19866                     esac
19867                     ;;
19868                 esac
19869                 ;;
19870         Sys/Syslog|sys/syslog)
19871                 : XXX syslog requires socket
19872                 case "$d_socket" in 
19873                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19874                 esac
19875                 ;;
19876         Thread|thread)
19877                 case "$usethreads" in
19878                 true|$define|y)
19879                         case "$useithreads" in
19880                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19881                         esac
19882                 esac
19883                 ;;
19884         XS/APItest|xs/apitest)
19885                 # This is just for testing.  Skip it unless we have dynamic loading.
19886
19887                 case "$usedl" in
19888                 $define) avail_ext="$avail_ext $xxx" ;;
19889                 esac
19890                 ;;
19891         XS/Typemap|xs/typemap)
19892                 # This is just for testing.  Skip it unless we have dynamic loading.
19893                 case "$usedl" in
19894                 $define) avail_ext="$avail_ext $xxx" ;;
19895                 esac
19896                 ;;
19897         threads|threads/shared)
19898                 # threads and threads::shared are special cases.
19899                 # To stop people from asking "Perl 5.8.0 was supposed
19900                 # to have this new fancy threads implementation but my
19901                 # perl doesn't have it" and from people trying to
19902                 # (re)install the threads module using CPAN.pm and
19903                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19904                 # the threads.pm and threads/shared.pm will always be
19905                 # there, croaking informatively ("you need to rebuild
19906                 # all of Perl with threads, sorry") when threads haven't
19907                 # been compiled in.
19908                 # --jhi
19909                 avail_ext="$avail_ext $xxx"
19910                 ;;
19911         IPC/SysV|ipc/sysv)
19912                 : XXX Do we need a useipcsysv variable here
19913                 case "${d_msg}${d_sem}${d_shm}" in 
19914                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19915                 esac
19916                 ;;
19917         *)      avail_ext="$avail_ext $xxx"
19918                 ;;
19919         esac
19920 done
19921
19922 set X $avail_ext
19923 shift
19924 avail_ext="$*"
19925
19926 : Now see which nonxs extensions are supported on this system.
19927 : For now assume all are.
19928 nonxs_ext=''
19929 for xxx in $nonxs_extensions ; do
19930         case "$xxx" in
19931         *)      nonxs_ext="$nonxs_ext $xxx"
19932                 ;;
19933         esac
19934 done
19935
19936 set X $nonxs_ext
19937 shift
19938 nonxs_ext="$*"
19939
19940 case $usedl in
19941 $define)
19942         $cat <<EOM
19943 A number of extensions are supplied with $package.  You may choose to
19944 compile these extensions for dynamic loading (the default), compile
19945 them into the $package executable (static loading), or not include
19946 them at all.  Answer "none" to include no extensions.
19947 Note that DynaLoader is always built and need not be mentioned here.
19948
19949 EOM
19950         case "$dynamic_ext" in
19951         '')
19952                 : Exclude those listed in static_ext
19953                 dflt=''
19954                 for xxx in $avail_ext; do
19955                         case " $static_ext " in
19956                         *" $xxx "*) ;;
19957                         *) dflt="$dflt $xxx" ;;
19958                         esac
19959                 done
19960                 set X $dflt
19961                 shift
19962                 dflt="$*"
19963                 ;;
19964         *)      dflt="$dynamic_ext"
19965                 # Perhaps we are reusing an old out-of-date config.sh.
19966                 case "$hint" in
19967                 previous)
19968                         if test X"$dynamic_ext" != X"$avail_ext"; then
19969                                 $cat <<EOM
19970 NOTICE:  Your previous config.sh list may be incorrect. 
19971 The extensions now available to you are 
19972         ${avail_ext}
19973 but the default list from your previous config.sh is
19974         ${dynamic_ext} 
19975
19976 EOM
19977                         fi
19978                         ;;
19979                 esac
19980                 ;;
19981         esac
19982         case "$dflt" in
19983         '')     dflt=none;;
19984         esac
19985         rp="What extensions do you wish to load dynamically?"
19986         . ./myread
19987         case "$ans" in
19988         none) dynamic_ext=' ' ;;
19989         *) dynamic_ext="$ans" ;;
19990         esac
19991
19992         case "$static_ext" in
19993         '')
19994                 : Exclude those already listed in dynamic linking
19995                 dflt=''
19996                 for xxx in $avail_ext; do
19997                         case " $dynamic_ext " in
19998                         *" $xxx "*) ;;
19999                         *) dflt="$dflt $xxx" ;;
20000                         esac
20001                 done
20002                 set X $dflt
20003                 shift
20004                 dflt="$*"
20005                 ;;
20006         *)  dflt="$static_ext" 
20007                 ;;
20008         esac
20009
20010         case "$dflt" in
20011         '')     dflt=none;;
20012         esac
20013         rp="What extensions do you wish to load statically?"
20014         . ./myread
20015         case "$ans" in
20016         none) static_ext=' ' ;;
20017         *) static_ext="$ans" ;;
20018         esac
20019         ;;
20020 *)
20021         $cat <<EOM
20022 A number of extensions are supplied with $package.  Answer "none" 
20023 to include no extensions. 
20024 Note that DynaLoader is always built and need not be mentioned here.
20025
20026 EOM
20027         case "$static_ext" in
20028         '') dflt="$avail_ext" ;;
20029         *)      dflt="$static_ext"
20030                 # Perhaps we are reusing an old out-of-date config.sh.
20031                 case "$hint" in
20032                 previous)
20033                         if test X"$static_ext" != X"$avail_ext"; then
20034                                 $cat <<EOM
20035 NOTICE:  Your previous config.sh list may be incorrect. 
20036 The extensions now available to you are 
20037         ${avail_ext}
20038 but the default list from your previous config.sh is
20039         ${static_ext} 
20040
20041 EOM
20042                         fi
20043                         ;;
20044                 esac
20045                 ;;
20046         esac
20047         : Exclude those that are not xs extensions
20048         case "$dflt" in
20049         '')     dflt=none;;
20050         esac
20051         rp="What extensions do you wish to include?"
20052         . ./myread
20053         case "$ans" in
20054         none) static_ext=' ' ;;
20055         *) static_ext="$ans" ;;
20056         esac
20057         ;;
20058 esac
20059 #        
20060 # Encode is a special case.  If we are building Encode as a static
20061 # extension, we need to explicitly list its subextensions as well.
20062 # For other nested extensions, this is handled automatically by
20063 # the appropriate Makefile.PL.
20064 case " $static_ext " in
20065         *" Encode "*) # Add the subextensions of Encode
20066         cd "$rsrc/ext"
20067         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20068                 static_ext="$static_ext Encode/$xxx"
20069         done
20070         cd "$tdir"
20071         ;;
20072 esac
20073
20074 set X $dynamic_ext $static_ext $nonxs_ext
20075 shift
20076 extensions="$*"
20077
20078 : Remove libraries needed only for extensions
20079 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20080 : The exception is SunOS 4.x, which needs them.
20081 case "${osname}X${osvers}" in
20082 sunos*X4*)
20083     perllibs="$libs"
20084     ;;
20085 *) case "$usedl" in
20086     $define|true|[yY]*)
20087             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20088             shift
20089             perllibs="$*"
20090             ;;
20091     *)  perllibs="$libs"
20092             ;;
20093     esac
20094     ;;
20095 esac
20096
20097 : Remove build directory name from cppstdin so it can be used from
20098 : either the present location or the final installed location.
20099 echo " "
20100 : Get out of the UU directory to get correct path name.
20101 cd ..
20102 case "$cppstdin" in
20103 `pwd`/cppstdin)
20104         echo "Stripping down cppstdin path name"
20105         cppstdin=cppstdin
20106         ;;
20107 esac
20108 cd UU
20109
20110 : end of configuration questions
20111 echo " "
20112 echo "End of configuration questions."
20113 echo " "
20114
20115 : back to where it started
20116 if test -d ../UU; then
20117         cd ..
20118 fi
20119
20120 : configuration may be patched via a 'config.arch' file
20121 if $test -f config.arch; then
20122         echo "I see a config.arch file, loading it."
20123         . ./config.arch
20124 fi
20125
20126 : configuration may be patched via a 'config.over' file
20127 if $test -f config.over; then
20128         echo " "
20129         dflt=y
20130         rp='I see a config.over file.  Do you wish to load it?'
20131         . UU/myread
20132         case "$ans" in
20133         n*) echo "OK, I'll ignore it.";;
20134         *)      . ./config.over
20135                 echo "Configuration override changes have been loaded."
20136                 ;;
20137         esac
20138 fi
20139
20140 : in case they want portability, strip down executable paths
20141 case "$d_portable" in
20142 "$define")
20143         echo " "
20144         echo "Stripping down executable paths..." >&4
20145         for file in $loclist $trylist; do
20146                 eval temp=\$$file
20147                 eval $file=`basename $temp`
20148         done
20149         ;;
20150 esac
20151
20152 : create config.sh file
20153 echo " "
20154 echo "Creating config.sh..." >&4
20155 $spitshell <<EOT >config.sh
20156 $startsh
20157 #
20158 # This file was produced by running the Configure script. It holds all the
20159 # definitions figured out by Configure. Should you modify one of these values,
20160 # do not forget to propagate your changes by running "Configure -der". You may
20161 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20162 #
20163
20164 # Package name      : $package
20165 # Source directory  : $src
20166 # Configuration time: $cf_time
20167 # Configured by     : $cf_by
20168 # Target system     : $myuname
20169
20170 Author='$Author'
20171 Date='$Date'
20172 Header='$Header'
20173 Id='$Id'
20174 Locker='$Locker'
20175 Log='$Log'
20176 Mcc='$Mcc'
20177 RCSfile='$RCSfile'
20178 Revision='$Revision'
20179 Source='$Source'
20180 State='$State'
20181 _a='$_a'
20182 _exe='$_exe'
20183 _o='$_o'
20184 afs='$afs'
20185 afsroot='$afsroot'
20186 alignbytes='$alignbytes'
20187 ansi2knr='$ansi2knr'
20188 aphostname='$aphostname'
20189 api_revision='$api_revision'
20190 api_subversion='$api_subversion'
20191 api_version='$api_version'
20192 api_versionstring='$api_versionstring'
20193 ar='$ar'
20194 archlib='$archlib'
20195 archlibexp='$archlibexp'
20196 archname64='$archname64'
20197 archname='$archname'
20198 archobjs='$archobjs'
20199 asctime_r_proto='$asctime_r_proto'
20200 awk='$awk'
20201 baserev='$baserev'
20202 bash='$bash'
20203 bin='$bin'
20204 binexp='$binexp'
20205 bison='$bison'
20206 byacc='$byacc'
20207 byteorder='$byteorder'
20208 c='$c'
20209 castflags='$castflags'
20210 cat='$cat'
20211 cc='$cc'
20212 cccdlflags='$cccdlflags'
20213 ccdlflags='$ccdlflags'
20214 ccflags='$ccflags'
20215 ccflags_uselargefiles='$ccflags_uselargefiles'
20216 ccname='$ccname'
20217 ccsymbols='$ccsymbols'
20218 ccversion='$ccversion'
20219 cf_by='$cf_by'
20220 cf_email='$cf_email'
20221 cf_time='$cf_time'
20222 charsize='$charsize'
20223 chgrp='$chgrp'
20224 chmod='$chmod'
20225 chown='$chown'
20226 clocktype='$clocktype'
20227 comm='$comm'
20228 compress='$compress'
20229 contains='$contains'
20230 cp='$cp'
20231 cpio='$cpio'
20232 cpp='$cpp'
20233 cpp_stuff='$cpp_stuff'
20234 cppccsymbols='$cppccsymbols'
20235 cppflags='$cppflags'
20236 cpplast='$cpplast'
20237 cppminus='$cppminus'
20238 cpprun='$cpprun'
20239 cppstdin='$cppstdin'
20240 cppsymbols='$cppsymbols'
20241 crypt_r_proto='$crypt_r_proto'
20242 cryptlib='$cryptlib'
20243 csh='$csh'
20244 ctermid_r_proto='$ctermid_r_proto'
20245 ctime_r_proto='$ctime_r_proto'
20246 d_Gconvert='$d_Gconvert'
20247 d_PRIEUldbl='$d_PRIEUldbl'
20248 d_PRIFUldbl='$d_PRIFUldbl'
20249 d_PRIGUldbl='$d_PRIGUldbl'
20250 d_PRIXU64='$d_PRIXU64'
20251 d_PRId64='$d_PRId64'
20252 d_PRIeldbl='$d_PRIeldbl'
20253 d_PRIfldbl='$d_PRIfldbl'
20254 d_PRIgldbl='$d_PRIgldbl'
20255 d_PRIi64='$d_PRIi64'
20256 d_PRIo64='$d_PRIo64'
20257 d_PRIu64='$d_PRIu64'
20258 d_PRIx64='$d_PRIx64'
20259 d_SCNfldbl='$d_SCNfldbl'
20260 d__fwalk='$d__fwalk'
20261 d_access='$d_access'
20262 d_accessx='$d_accessx'
20263 d_alarm='$d_alarm'
20264 d_archlib='$d_archlib'
20265 d_asctime_r='$d_asctime_r'
20266 d_atolf='$d_atolf'
20267 d_atoll='$d_atoll'
20268 d_attribut='$d_attribut'
20269 d_bcmp='$d_bcmp'
20270 d_bcopy='$d_bcopy'
20271 d_bsd='$d_bsd'
20272 d_bsdgetpgrp='$d_bsdgetpgrp'
20273 d_bsdsetpgrp='$d_bsdsetpgrp'
20274 d_bzero='$d_bzero'
20275 d_casti32='$d_casti32'
20276 d_castneg='$d_castneg'
20277 d_charvspr='$d_charvspr'
20278 d_chown='$d_chown'
20279 d_chroot='$d_chroot'
20280 d_chsize='$d_chsize'
20281 d_class='$d_class'
20282 d_closedir='$d_closedir'
20283 d_cmsghdr_s='$d_cmsghdr_s'
20284 d_const='$d_const'
20285 d_crypt='$d_crypt'
20286 d_crypt_r='$d_crypt_r'
20287 d_csh='$d_csh'
20288 d_ctermid_r='$d_ctermid_r'
20289 d_ctime_r='$d_ctime_r'
20290 d_cuserid='$d_cuserid'
20291 d_dbl_dig='$d_dbl_dig'
20292 d_dbminitproto='$d_dbminitproto'
20293 d_difftime='$d_difftime'
20294 d_dirfd='$d_dirfd'
20295 d_dirnamlen='$d_dirnamlen'
20296 d_dlerror='$d_dlerror'
20297 d_dlopen='$d_dlopen'
20298 d_dlsymun='$d_dlsymun'
20299 d_dosuid='$d_dosuid'
20300 d_drand48_r='$d_drand48_r'
20301 d_drand48proto='$d_drand48proto'
20302 d_dup2='$d_dup2'
20303 d_eaccess='$d_eaccess'
20304 d_endgrent='$d_endgrent'
20305 d_endgrent_r='$d_endgrent_r'
20306 d_endhent='$d_endhent'
20307 d_endhostent_r='$d_endhostent_r'
20308 d_endnent='$d_endnent'
20309 d_endnetent_r='$d_endnetent_r'
20310 d_endpent='$d_endpent'
20311 d_endprotoent_r='$d_endprotoent_r'
20312 d_endpwent='$d_endpwent'
20313 d_endpwent_r='$d_endpwent_r'
20314 d_endsent='$d_endsent'
20315 d_endservent_r='$d_endservent_r'
20316 d_eofnblk='$d_eofnblk'
20317 d_eunice='$d_eunice'
20318 d_fchdir='$d_fchdir'
20319 d_fchmod='$d_fchmod'
20320 d_fchown='$d_fchown'
20321 d_fcntl='$d_fcntl'
20322 d_fcntl_can_lock='$d_fcntl_can_lock'
20323 d_fd_macros='$d_fd_macros'
20324 d_fd_set='$d_fd_set'
20325 d_fds_bits='$d_fds_bits'
20326 d_fgetpos='$d_fgetpos'
20327 d_finite='$d_finite'
20328 d_finitel='$d_finitel'
20329 d_flexfnam='$d_flexfnam'
20330 d_flock='$d_flock'
20331 d_flockproto='$d_flockproto'
20332 d_fork='$d_fork'
20333 d_fp_class='$d_fp_class'
20334 d_fpathconf='$d_fpathconf'
20335 d_fpclass='$d_fpclass'
20336 d_fpclassify='$d_fpclassify'
20337 d_fpclassl='$d_fpclassl'
20338 d_fpos64_t='$d_fpos64_t'
20339 d_frexpl='$d_frexpl'
20340 d_fs_data_s='$d_fs_data_s'
20341 d_fseeko='$d_fseeko'
20342 d_fsetpos='$d_fsetpos'
20343 d_fstatfs='$d_fstatfs'
20344 d_fstatvfs='$d_fstatvfs'
20345 d_fsync='$d_fsync'
20346 d_ftello='$d_ftello'
20347 d_ftime='$d_ftime'
20348 d_getcwd='$d_getcwd'
20349 d_getespwnam='$d_getespwnam'
20350 d_getfsstat='$d_getfsstat'
20351 d_getgrent='$d_getgrent'
20352 d_getgrent_r='$d_getgrent_r'
20353 d_getgrgid_r='$d_getgrgid_r'
20354 d_getgrnam_r='$d_getgrnam_r'
20355 d_getgrps='$d_getgrps'
20356 d_gethbyaddr='$d_gethbyaddr'
20357 d_gethbyname='$d_gethbyname'
20358 d_gethent='$d_gethent'
20359 d_gethname='$d_gethname'
20360 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20361 d_gethostbyname_r='$d_gethostbyname_r'
20362 d_gethostent_r='$d_gethostent_r'
20363 d_gethostprotos='$d_gethostprotos'
20364 d_getitimer='$d_getitimer'
20365 d_getlogin='$d_getlogin'
20366 d_getlogin_r='$d_getlogin_r'
20367 d_getmnt='$d_getmnt'
20368 d_getmntent='$d_getmntent'
20369 d_getnbyaddr='$d_getnbyaddr'
20370 d_getnbyname='$d_getnbyname'
20371 d_getnent='$d_getnent'
20372 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20373 d_getnetbyname_r='$d_getnetbyname_r'
20374 d_getnetent_r='$d_getnetent_r'
20375 d_getnetprotos='$d_getnetprotos'
20376 d_getpagsz='$d_getpagsz'
20377 d_getpbyname='$d_getpbyname'
20378 d_getpbynumber='$d_getpbynumber'
20379 d_getpent='$d_getpent'
20380 d_getpgid='$d_getpgid'
20381 d_getpgrp2='$d_getpgrp2'
20382 d_getpgrp='$d_getpgrp'
20383 d_getppid='$d_getppid'
20384 d_getprior='$d_getprior'
20385 d_getprotobyname_r='$d_getprotobyname_r'
20386 d_getprotobynumber_r='$d_getprotobynumber_r'
20387 d_getprotoent_r='$d_getprotoent_r'
20388 d_getprotoprotos='$d_getprotoprotos'
20389 d_getprpwnam='$d_getprpwnam'
20390 d_getpwent='$d_getpwent'
20391 d_getpwent_r='$d_getpwent_r'
20392 d_getpwnam_r='$d_getpwnam_r'
20393 d_getpwuid_r='$d_getpwuid_r'
20394 d_getsbyname='$d_getsbyname'
20395 d_getsbyport='$d_getsbyport'
20396 d_getsent='$d_getsent'
20397 d_getservbyname_r='$d_getservbyname_r'
20398 d_getservbyport_r='$d_getservbyport_r'
20399 d_getservent_r='$d_getservent_r'
20400 d_getservprotos='$d_getservprotos'
20401 d_getspnam='$d_getspnam'
20402 d_getspnam_r='$d_getspnam_r'
20403 d_gettimeod='$d_gettimeod'
20404 d_gmtime_r='$d_gmtime_r'
20405 d_gnulibc='$d_gnulibc'
20406 d_grpasswd='$d_grpasswd'
20407 d_hasmntopt='$d_hasmntopt'
20408 d_htonl='$d_htonl'
20409 d_index='$d_index'
20410 d_inetaton='$d_inetaton'
20411 d_int64_t='$d_int64_t'
20412 d_isascii='$d_isascii'
20413 d_isfinite='$d_isfinite'
20414 d_isinf='$d_isinf'
20415 d_isnan='$d_isnan'
20416 d_isnanl='$d_isnanl'
20417 d_killpg='$d_killpg'
20418 d_lchown='$d_lchown'
20419 d_ldbl_dig='$d_ldbl_dig'
20420 d_link='$d_link'
20421 d_localtime_r='$d_localtime_r'
20422 d_locconv='$d_locconv'
20423 d_lockf='$d_lockf'
20424 d_longdbl='$d_longdbl'
20425 d_longlong='$d_longlong'
20426 d_lseekproto='$d_lseekproto'
20427 d_lstat='$d_lstat'
20428 d_madvise='$d_madvise'
20429 d_mblen='$d_mblen'
20430 d_mbstowcs='$d_mbstowcs'
20431 d_mbtowc='$d_mbtowc'
20432 d_memchr='$d_memchr'
20433 d_memcmp='$d_memcmp'
20434 d_memcpy='$d_memcpy'
20435 d_memmove='$d_memmove'
20436 d_memset='$d_memset'
20437 d_mkdir='$d_mkdir'
20438 d_mkdtemp='$d_mkdtemp'
20439 d_mkfifo='$d_mkfifo'
20440 d_mkstemp='$d_mkstemp'
20441 d_mkstemps='$d_mkstemps'
20442 d_mktime='$d_mktime'
20443 d_mmap='$d_mmap'
20444 d_modfl='$d_modfl'
20445 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20446 d_modflproto='$d_modflproto'
20447 d_mprotect='$d_mprotect'
20448 d_msg='$d_msg'
20449 d_msg_ctrunc='$d_msg_ctrunc'
20450 d_msg_dontroute='$d_msg_dontroute'
20451 d_msg_oob='$d_msg_oob'
20452 d_msg_peek='$d_msg_peek'
20453 d_msg_proxy='$d_msg_proxy'
20454 d_msgctl='$d_msgctl'
20455 d_msgget='$d_msgget'
20456 d_msghdr_s='$d_msghdr_s'
20457 d_msgrcv='$d_msgrcv'
20458 d_msgsnd='$d_msgsnd'
20459 d_msync='$d_msync'
20460 d_munmap='$d_munmap'
20461 d_mymalloc='$d_mymalloc'
20462 d_nanosleep='$d_nanosleep'
20463 d_nice='$d_nice'
20464 d_nl_langinfo='$d_nl_langinfo'
20465 d_nv_preserves_uv='$d_nv_preserves_uv'
20466 d_off64_t='$d_off64_t'
20467 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20468 d_oldpthreads='$d_oldpthreads'
20469 d_oldsock='$d_oldsock'
20470 d_open3='$d_open3'
20471 d_pathconf='$d_pathconf'
20472 d_pause='$d_pause'
20473 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20474 d_phostname='$d_phostname'
20475 d_pipe='$d_pipe'
20476 d_poll='$d_poll'
20477 d_portable='$d_portable'
20478 d_procselfexe='$d_procselfexe'
20479 d_pthread_atfork='$d_pthread_atfork'
20480 d_pthread_yield='$d_pthread_yield'
20481 d_pwage='$d_pwage'
20482 d_pwchange='$d_pwchange'
20483 d_pwclass='$d_pwclass'
20484 d_pwcomment='$d_pwcomment'
20485 d_pwexpire='$d_pwexpire'
20486 d_pwgecos='$d_pwgecos'
20487 d_pwpasswd='$d_pwpasswd'
20488 d_pwquota='$d_pwquota'
20489 d_qgcvt='$d_qgcvt'
20490 d_quad='$d_quad'
20491 d_random_r='$d_random_r'
20492 d_readdir64_r='$d_readdir64_r'
20493 d_readdir='$d_readdir'
20494 d_readdir_r='$d_readdir_r'
20495 d_readlink='$d_readlink'
20496 d_readv='$d_readv'
20497 d_recvmsg='$d_recvmsg'
20498 d_rename='$d_rename'
20499 d_rewinddir='$d_rewinddir'
20500 d_rmdir='$d_rmdir'
20501 d_safebcpy='$d_safebcpy'
20502 d_safemcpy='$d_safemcpy'
20503 d_sanemcmp='$d_sanemcmp'
20504 d_sbrkproto='$d_sbrkproto'
20505 d_sched_yield='$d_sched_yield'
20506 d_scm_rights='$d_scm_rights'
20507 d_seekdir='$d_seekdir'
20508 d_select='$d_select'
20509 d_sem='$d_sem'
20510 d_semctl='$d_semctl'
20511 d_semctl_semid_ds='$d_semctl_semid_ds'
20512 d_semctl_semun='$d_semctl_semun'
20513 d_semget='$d_semget'
20514 d_semop='$d_semop'
20515 d_sendmsg='$d_sendmsg'
20516 d_setegid='$d_setegid'
20517 d_seteuid='$d_seteuid'
20518 d_setgrent='$d_setgrent'
20519 d_setgrent_r='$d_setgrent_r'
20520 d_setgrps='$d_setgrps'
20521 d_sethent='$d_sethent'
20522 d_sethostent_r='$d_sethostent_r'
20523 d_setitimer='$d_setitimer'
20524 d_setlinebuf='$d_setlinebuf'
20525 d_setlocale='$d_setlocale'
20526 d_setlocale_r='$d_setlocale_r'
20527 d_setnent='$d_setnent'
20528 d_setnetent_r='$d_setnetent_r'
20529 d_setpent='$d_setpent'
20530 d_setpgid='$d_setpgid'
20531 d_setpgrp2='$d_setpgrp2'
20532 d_setpgrp='$d_setpgrp'
20533 d_setprior='$d_setprior'
20534 d_setproctitle='$d_setproctitle'
20535 d_setprotoent_r='$d_setprotoent_r'
20536 d_setpwent='$d_setpwent'
20537 d_setpwent_r='$d_setpwent_r'
20538 d_setregid='$d_setregid'
20539 d_setresgid='$d_setresgid'
20540 d_setresuid='$d_setresuid'
20541 d_setreuid='$d_setreuid'
20542 d_setrgid='$d_setrgid'
20543 d_setruid='$d_setruid'
20544 d_setsent='$d_setsent'
20545 d_setservent_r='$d_setservent_r'
20546 d_setsid='$d_setsid'
20547 d_setvbuf='$d_setvbuf'
20548 d_sfio='$d_sfio'
20549 d_shm='$d_shm'
20550 d_shmat='$d_shmat'
20551 d_shmatprototype='$d_shmatprototype'
20552 d_shmctl='$d_shmctl'
20553 d_shmdt='$d_shmdt'
20554 d_shmget='$d_shmget'
20555 d_sigaction='$d_sigaction'
20556 d_sigprocmask='$d_sigprocmask'
20557 d_sigsetjmp='$d_sigsetjmp'
20558 d_sockatmark='$d_sockatmark'
20559 d_sockatmarkproto='$d_sockatmarkproto'
20560 d_socket='$d_socket'
20561 d_socklen_t='$d_socklen_t'
20562 d_sockpair='$d_sockpair'
20563 d_socks5_init='$d_socks5_init'
20564 d_sqrtl='$d_sqrtl'
20565 d_srand48_r='$d_srand48_r'
20566 d_srandom_r='$d_srandom_r'
20567 d_sresgproto='$d_sresgproto'
20568 d_sresuproto='$d_sresuproto'
20569 d_statblks='$d_statblks'
20570 d_statfs_f_flags='$d_statfs_f_flags'
20571 d_statfs_s='$d_statfs_s'
20572 d_statvfs='$d_statvfs'
20573 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20574 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20575 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20576 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20577 d_stdio_stream_array='$d_stdio_stream_array'
20578 d_stdiobase='$d_stdiobase'
20579 d_stdstdio='$d_stdstdio'
20580 d_strchr='$d_strchr'
20581 d_strcoll='$d_strcoll'
20582 d_strctcpy='$d_strctcpy'
20583 d_strerrm='$d_strerrm'
20584 d_strerror='$d_strerror'
20585 d_strerror_r='$d_strerror_r'
20586 d_strftime='$d_strftime'
20587 d_strtod='$d_strtod'
20588 d_strtol='$d_strtol'
20589 d_strtold='$d_strtold'
20590 d_strtoll='$d_strtoll'
20591 d_strtoq='$d_strtoq'
20592 d_strtoul='$d_strtoul'
20593 d_strtoull='$d_strtoull'
20594 d_strtouq='$d_strtouq'
20595 d_strxfrm='$d_strxfrm'
20596 d_suidsafe='$d_suidsafe'
20597 d_symlink='$d_symlink'
20598 d_syscall='$d_syscall'
20599 d_syscallproto='$d_syscallproto'
20600 d_sysconf='$d_sysconf'
20601 d_sysernlst='$d_sysernlst'
20602 d_syserrlst='$d_syserrlst'
20603 d_system='$d_system'
20604 d_tcgetpgrp='$d_tcgetpgrp'
20605 d_tcsetpgrp='$d_tcsetpgrp'
20606 d_telldir='$d_telldir'
20607 d_telldirproto='$d_telldirproto'
20608 d_time='$d_time'
20609 d_times='$d_times'
20610 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20611 d_tm_tm_zone='$d_tm_tm_zone'
20612 d_tmpnam_r='$d_tmpnam_r'
20613 d_truncate='$d_truncate'
20614 d_ttyname_r='$d_ttyname_r'
20615 d_tzname='$d_tzname'
20616 d_u32align='$d_u32align'
20617 d_ualarm='$d_ualarm'
20618 d_umask='$d_umask'
20619 d_uname='$d_uname'
20620 d_union_semun='$d_union_semun'
20621 d_unordered='$d_unordered'
20622 d_usleep='$d_usleep'
20623 d_usleepproto='$d_usleepproto'
20624 d_ustat='$d_ustat'
20625 d_vendorarch='$d_vendorarch'
20626 d_vendorbin='$d_vendorbin'
20627 d_vendorlib='$d_vendorlib'
20628 d_vendorscript='$d_vendorscript'
20629 d_vfork='$d_vfork'
20630 d_void_closedir='$d_void_closedir'
20631 d_voidsig='$d_voidsig'
20632 d_voidtty='$d_voidtty'
20633 d_volatile='$d_volatile'
20634 d_vprintf='$d_vprintf'
20635 d_wait4='$d_wait4'
20636 d_waitpid='$d_waitpid'
20637 d_wcstombs='$d_wcstombs'
20638 d_wctomb='$d_wctomb'
20639 d_writev='$d_writev'
20640 d_xenix='$d_xenix'
20641 date='$date'
20642 db_hashtype='$db_hashtype'
20643 db_prefixtype='$db_prefixtype'
20644 db_version_major='$db_version_major'
20645 db_version_minor='$db_version_minor'
20646 db_version_patch='$db_version_patch'
20647 defvoidused='$defvoidused'
20648 direntrytype='$direntrytype'
20649 dlext='$dlext'
20650 dlsrc='$dlsrc'
20651 doublesize='$doublesize'
20652 drand01='$drand01'
20653 drand48_r_proto='$drand48_r_proto'
20654 dynamic_ext='$dynamic_ext'
20655 eagain='$eagain'
20656 ebcdic='$ebcdic'
20657 echo='$echo'
20658 egrep='$egrep'
20659 emacs='$emacs'
20660 endgrent_r_proto='$endgrent_r_proto'
20661 endhostent_r_proto='$endhostent_r_proto'
20662 endnetent_r_proto='$endnetent_r_proto'
20663 endprotoent_r_proto='$endprotoent_r_proto'
20664 endpwent_r_proto='$endpwent_r_proto'
20665 endservent_r_proto='$endservent_r_proto'
20666 eunicefix='$eunicefix'
20667 exe_ext='$exe_ext'
20668 expr='$expr'
20669 extensions='$extensions'
20670 extras='$extras'
20671 fflushNULL='$fflushNULL'
20672 fflushall='$fflushall'
20673 find='$find'
20674 firstmakefile='$firstmakefile'
20675 flex='$flex'
20676 fpossize='$fpossize'
20677 fpostype='$fpostype'
20678 freetype='$freetype'
20679 from='$from'
20680 full_ar='$full_ar'
20681 full_csh='$full_csh'
20682 full_sed='$full_sed'
20683 gccansipedantic='$gccansipedantic'
20684 gccosandvers='$gccosandvers'
20685 gccversion='$gccversion'
20686 getgrent_r_proto='$getgrent_r_proto'
20687 getgrgid_r_proto='$getgrgid_r_proto'
20688 getgrnam_r_proto='$getgrnam_r_proto'
20689 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20690 gethostbyname_r_proto='$gethostbyname_r_proto'
20691 gethostent_r_proto='$gethostent_r_proto'
20692 getlogin_r_proto='$getlogin_r_proto'
20693 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20694 getnetbyname_r_proto='$getnetbyname_r_proto'
20695 getnetent_r_proto='$getnetent_r_proto'
20696 getprotobyname_r_proto='$getprotobyname_r_proto'
20697 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20698 getprotoent_r_proto='$getprotoent_r_proto'
20699 getpwent_r_proto='$getpwent_r_proto'
20700 getpwnam_r_proto='$getpwnam_r_proto'
20701 getpwuid_r_proto='$getpwuid_r_proto'
20702 getservbyname_r_proto='$getservbyname_r_proto'
20703 getservbyport_r_proto='$getservbyport_r_proto'
20704 getservent_r_proto='$getservent_r_proto'
20705 getspnam_r_proto='$getspnam_r_proto'
20706 gidformat='$gidformat'
20707 gidsign='$gidsign'
20708 gidsize='$gidsize'
20709 gidtype='$gidtype'
20710 glibpth='$glibpth'
20711 gmake='$gmake'
20712 gmtime_r_proto='$gmtime_r_proto'
20713 gnulibc_version='$gnulibc_version'
20714 grep='$grep'
20715 groupcat='$groupcat'
20716 groupstype='$groupstype'
20717 gzip='$gzip'
20718 h_fcntl='$h_fcntl'
20719 h_sysfile='$h_sysfile'
20720 hint='$hint'
20721 hostcat='$hostcat'
20722 html1dir='$html1dir'
20723 html1direxp='$html1direxp'
20724 html3dir='$html3dir'
20725 html3direxp='$html3direxp'
20726 i16size='$i16size'
20727 i16type='$i16type'
20728 i32size='$i32size'
20729 i32type='$i32type'
20730 i64size='$i64size'
20731 i64type='$i64type'
20732 i8size='$i8size'
20733 i8type='$i8type'
20734 i_arpainet='$i_arpainet'
20735 i_bsdioctl='$i_bsdioctl'
20736 i_crypt='$i_crypt'
20737 i_db='$i_db'
20738 i_dbm='$i_dbm'
20739 i_dirent='$i_dirent'
20740 i_dld='$i_dld'
20741 i_dlfcn='$i_dlfcn'
20742 i_fcntl='$i_fcntl'
20743 i_float='$i_float'
20744 i_fp='$i_fp'
20745 i_fp_class='$i_fp_class'
20746 i_gdbm='$i_gdbm'
20747 i_grp='$i_grp'
20748 i_ieeefp='$i_ieeefp'
20749 i_inttypes='$i_inttypes'
20750 i_langinfo='$i_langinfo'
20751 i_libutil='$i_libutil'
20752 i_limits='$i_limits'
20753 i_locale='$i_locale'
20754 i_machcthr='$i_machcthr'
20755 i_malloc='$i_malloc'
20756 i_math='$i_math'
20757 i_memory='$i_memory'
20758 i_mntent='$i_mntent'
20759 i_ndbm='$i_ndbm'
20760 i_netdb='$i_netdb'
20761 i_neterrno='$i_neterrno'
20762 i_netinettcp='$i_netinettcp'
20763 i_niin='$i_niin'
20764 i_poll='$i_poll'
20765 i_prot='$i_prot'
20766 i_pthread='$i_pthread'
20767 i_pwd='$i_pwd'
20768 i_rpcsvcdbm='$i_rpcsvcdbm'
20769 i_sfio='$i_sfio'
20770 i_sgtty='$i_sgtty'
20771 i_shadow='$i_shadow'
20772 i_socks='$i_socks'
20773 i_stdarg='$i_stdarg'
20774 i_stddef='$i_stddef'
20775 i_stdlib='$i_stdlib'
20776 i_string='$i_string'
20777 i_sunmath='$i_sunmath'
20778 i_sysaccess='$i_sysaccess'
20779 i_sysdir='$i_sysdir'
20780 i_sysfile='$i_sysfile'
20781 i_sysfilio='$i_sysfilio'
20782 i_sysin='$i_sysin'
20783 i_sysioctl='$i_sysioctl'
20784 i_syslog='$i_syslog'
20785 i_sysmman='$i_sysmman'
20786 i_sysmode='$i_sysmode'
20787 i_sysmount='$i_sysmount'
20788 i_sysndir='$i_sysndir'
20789 i_sysparam='$i_sysparam'
20790 i_sysresrc='$i_sysresrc'
20791 i_syssecrt='$i_syssecrt'
20792 i_sysselct='$i_sysselct'
20793 i_syssockio='$i_syssockio'
20794 i_sysstat='$i_sysstat'
20795 i_sysstatfs='$i_sysstatfs'
20796 i_sysstatvfs='$i_sysstatvfs'
20797 i_systime='$i_systime'
20798 i_systimek='$i_systimek'
20799 i_systimes='$i_systimes'
20800 i_systypes='$i_systypes'
20801 i_sysuio='$i_sysuio'
20802 i_sysun='$i_sysun'
20803 i_sysutsname='$i_sysutsname'
20804 i_sysvfs='$i_sysvfs'
20805 i_syswait='$i_syswait'
20806 i_termio='$i_termio'
20807 i_termios='$i_termios'
20808 i_time='$i_time'
20809 i_unistd='$i_unistd'
20810 i_ustat='$i_ustat'
20811 i_utime='$i_utime'
20812 i_values='$i_values'
20813 i_varargs='$i_varargs'
20814 i_varhdr='$i_varhdr'
20815 i_vfork='$i_vfork'
20816 ignore_versioned_solibs='$ignore_versioned_solibs'
20817 inc_version_list='$inc_version_list'
20818 inc_version_list_init='$inc_version_list_init'
20819 incpath='$incpath'
20820 inews='$inews'
20821 installarchlib='$installarchlib'
20822 installbin='$installbin'
20823 installhtml1dir='$installhtml1dir'
20824 installhtml3dir='$installhtml3dir'
20825 installman1dir='$installman1dir'
20826 installman3dir='$installman3dir'
20827 installprefix='$installprefix'
20828 installprefixexp='$installprefixexp'
20829 installprivlib='$installprivlib'
20830 installscript='$installscript'
20831 installsitearch='$installsitearch'
20832 installsitebin='$installsitebin'
20833 installsitehtml1='$installsitehtml1'
20834 installsitehtml3='$installsitehtml3'
20835 installsitelib='$installsitelib'
20836 installsiteman1='$installsiteman1'
20837 installsiteman3='$installsiteman3'
20838 installsitescript='$installsitescript'
20839 installstyle='$installstyle'
20840 installusrbinperl='$installusrbinperl'
20841 installvendorarch='$installvendorarch'
20842 installvendorbin='$installvendorbin'
20843 installvendorhtml1='$installvendorhtml1'
20844 installvendorhtml3='$installvendorhtml3'
20845 installvendorlib='$installvendorlib'
20846 installvendorman1='$installvendorman1'
20847 installvendorman3='$installvendorman3'
20848 installvendorscript='$installvendorscript'
20849 intsize='$intsize'
20850 issymlink='$issymlink'
20851 ivdformat='$ivdformat'
20852 ivsize='$ivsize'
20853 ivtype='$ivtype'
20854 known_extensions='$known_extensions'
20855 ksh='$ksh'
20856 ld='$ld'
20857 lddlflags='$lddlflags'
20858 ldflags='$ldflags'
20859 ldflags_uselargefiles='$ldflags_uselargefiles'
20860 ldlibpthname='$ldlibpthname'
20861 less='$less'
20862 lib_ext='$lib_ext'
20863 libc='$libc'
20864 libperl='$libperl'
20865 libpth='$libpth'
20866 libs='$libs'
20867 libsdirs='$libsdirs'
20868 libsfiles='$libsfiles'
20869 libsfound='$libsfound'
20870 libspath='$libspath'
20871 libswanted='$libswanted'
20872 libswanted_uselargefiles='$libswanted_uselargefiles'
20873 line='$line'
20874 lint='$lint'
20875 lkflags='$lkflags'
20876 ln='$ln'
20877 lns='$lns'
20878 localtime_r_proto='$localtime_r_proto'
20879 locincpth='$locincpth'
20880 loclibpth='$loclibpth'
20881 longdblsize='$longdblsize'
20882 longlongsize='$longlongsize'
20883 longsize='$longsize'
20884 lp='$lp'
20885 lpr='$lpr'
20886 ls='$ls'
20887 lseeksize='$lseeksize'
20888 lseektype='$lseektype'
20889 mail='$mail'
20890 mailx='$mailx'
20891 make='$make'
20892 make_set_make='$make_set_make'
20893 mallocobj='$mallocobj'
20894 mallocsrc='$mallocsrc'
20895 malloctype='$malloctype'
20896 man1dir='$man1dir'
20897 man1direxp='$man1direxp'
20898 man1ext='$man1ext'
20899 man3dir='$man3dir'
20900 man3direxp='$man3direxp'
20901 man3ext='$man3ext'
20902 mips_type='$mips_type'
20903 mkdir='$mkdir'
20904 mmaptype='$mmaptype'
20905 modetype='$modetype'
20906 more='$more'
20907 multiarch='$multiarch'
20908 mv='$mv'
20909 myarchname='$myarchname'
20910 mydomain='$mydomain'
20911 myhostname='$myhostname'
20912 myuname='$myuname'
20913 n='$n'
20914 need_va_copy='$need_va_copy'
20915 netdb_hlen_type='$netdb_hlen_type'
20916 netdb_host_type='$netdb_host_type'
20917 netdb_name_type='$netdb_name_type'
20918 netdb_net_type='$netdb_net_type'
20919 nm='$nm'
20920 nm_opt='$nm_opt'
20921 nm_so_opt='$nm_so_opt'
20922 nonxs_ext='$nonxs_ext'
20923 nroff='$nroff'
20924 nvEUformat='$nvEUformat'
20925 nvFUformat='$nvFUformat'
20926 nvGUformat='$nvGUformat'
20927 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20928 nveformat='$nveformat'
20929 nvfformat='$nvfformat'
20930 nvgformat='$nvgformat'
20931 nvsize='$nvsize'
20932 nvtype='$nvtype'
20933 o_nonblock='$o_nonblock'
20934 obj_ext='$obj_ext'
20935 old_pthread_create_joinable='$old_pthread_create_joinable'
20936 optimize='$optimize'
20937 orderlib='$orderlib'
20938 osname='$osname'
20939 osvers='$osvers'
20940 otherlibdirs='$otherlibdirs'
20941 package='$package'
20942 pager='$pager'
20943 passcat='$passcat'
20944 patchlevel='$patchlevel'
20945 path_sep='$path_sep'
20946 perl5='$perl5'
20947 perl='$perl'
20948 perl_patchlevel='$perl_patchlevel'
20949 perladmin='$perladmin'
20950 perllibs='$perllibs'
20951 perlpath='$perlpath'
20952 pg='$pg'
20953 phostname='$phostname'
20954 pidtype='$pidtype'
20955 plibpth='$plibpth'
20956 pm_apiversion='$pm_apiversion'
20957 pmake='$pmake'
20958 pr='$pr'
20959 prefix='$prefix'
20960 prefixexp='$prefixexp'
20961 privlib='$privlib'
20962 privlibexp='$privlibexp'
20963 procselfexe='$procselfexe'
20964 prototype='$prototype'
20965 ptrsize='$ptrsize'
20966 quadkind='$quadkind'
20967 quadtype='$quadtype'
20968 randbits='$randbits'
20969 randfunc='$randfunc'
20970 random_r_proto='$random_r_proto'
20971 randseedtype='$randseedtype'
20972 ranlib='$ranlib'
20973 rd_nodata='$rd_nodata'
20974 readdir64_r_proto='$readdir64_r_proto'
20975 readdir_r_proto='$readdir_r_proto'
20976 revision='$revision'
20977 rm='$rm'
20978 rmail='$rmail'
20979 run='$run'
20980 runnm='$runnm'
20981 sPRIEUldbl='$sPRIEUldbl'
20982 sPRIFUldbl='$sPRIFUldbl'
20983 sPRIGUldbl='$sPRIGUldbl'
20984 sPRIXU64='$sPRIXU64'
20985 sPRId64='$sPRId64'
20986 sPRIeldbl='$sPRIeldbl'
20987 sPRIfldbl='$sPRIfldbl'
20988 sPRIgldbl='$sPRIgldbl'
20989 sPRIi64='$sPRIi64'
20990 sPRIo64='$sPRIo64'
20991 sPRIu64='$sPRIu64'
20992 sPRIx64='$sPRIx64'
20993 sSCNfldbl='$sSCNfldbl'
20994 sched_yield='$sched_yield'
20995 scriptdir='$scriptdir'
20996 scriptdirexp='$scriptdirexp'
20997 sed='$sed'
20998 seedfunc='$seedfunc'
20999 selectminbits='$selectminbits'
21000 selecttype='$selecttype'
21001 sendmail='$sendmail'
21002 setgrent_r_proto='$setgrent_r_proto'
21003 sethostent_r_proto='$sethostent_r_proto'
21004 setlocale_r_proto='$setlocale_r_proto'
21005 setnetent_r_proto='$setnetent_r_proto'
21006 setprotoent_r_proto='$setprotoent_r_proto'
21007 setpwent_r_proto='$setpwent_r_proto'
21008 setservent_r_proto='$setservent_r_proto'
21009 sh='$sh'
21010 shar='$shar'
21011 sharpbang='$sharpbang'
21012 shmattype='$shmattype'
21013 shortsize='$shortsize'
21014 shrpenv='$shrpenv'
21015 shsharp='$shsharp'
21016 sig_count='$sig_count'
21017 sig_name='$sig_name'
21018 sig_name_init='$sig_name_init'
21019 sig_num='$sig_num'
21020 sig_num_init='$sig_num_init'
21021 sig_size='$sig_size'
21022 signal_t='$signal_t'
21023 sitearch='$sitearch'
21024 sitearchexp='$sitearchexp'
21025 sitebin='$sitebin'
21026 sitebinexp='$sitebinexp'
21027 sitehtml1='$sitehtml1'
21028 sitehtml1exp='$sitehtml1exp'
21029 sitehtml3='$sitehtml3'
21030 sitehtml3exp='$sitehtml3exp'
21031 sitelib='$sitelib'
21032 sitelib_stem='$sitelib_stem'
21033 sitelibexp='$sitelibexp'
21034 siteman1='$siteman1'
21035 siteman1exp='$siteman1exp'
21036 siteman3='$siteman3'
21037 siteman3exp='$siteman3exp'
21038 siteprefix='$siteprefix'
21039 siteprefixexp='$siteprefixexp'
21040 sitescript='$sitescript'
21041 sitescriptexp='$sitescriptexp'
21042 sizesize='$sizesize'
21043 sizetype='$sizetype'
21044 sleep='$sleep'
21045 smail='$smail'
21046 so='$so'
21047 sockethdr='$sockethdr'
21048 socketlib='$socketlib'
21049 socksizetype='$socksizetype'
21050 sort='$sort'
21051 spackage='$spackage'
21052 spitshell='$spitshell'
21053 srand48_r_proto='$srand48_r_proto'
21054 srandom_r_proto='$srandom_r_proto'
21055 src='$src'
21056 ssizetype='$ssizetype'
21057 startperl='$startperl'
21058 startsh='$startsh'
21059 static_ext='$static_ext'
21060 stdchar='$stdchar'
21061 stdio_base='$stdio_base'
21062 stdio_bufsiz='$stdio_bufsiz'
21063 stdio_cnt='$stdio_cnt'
21064 stdio_filbuf='$stdio_filbuf'
21065 stdio_ptr='$stdio_ptr'
21066 stdio_stream_array='$stdio_stream_array'
21067 strerror_r_proto='$strerror_r_proto'
21068 strings='$strings'
21069 submit='$submit'
21070 subversion='$subversion'
21071 sysman='$sysman'
21072 tail='$tail'
21073 tar='$tar'
21074 targetarch='$targetarch'
21075 tbl='$tbl'
21076 tee='$tee'
21077 test='$test'
21078 timeincl='$timeincl'
21079 timetype='$timetype'
21080 tmpnam_r_proto='$tmpnam_r_proto'
21081 to='$to'
21082 touch='$touch'
21083 tr='$tr'
21084 trnl='$trnl'
21085 troff='$troff'
21086 ttyname_r_proto='$ttyname_r_proto'
21087 u16size='$u16size'
21088 u16type='$u16type'
21089 u32size='$u32size'
21090 u32type='$u32type'
21091 u64size='$u64size'
21092 u64type='$u64type'
21093 u8size='$u8size'
21094 u8type='$u8type'
21095 uidformat='$uidformat'
21096 uidsign='$uidsign'
21097 uidsize='$uidsize'
21098 uidtype='$uidtype'
21099 uname='$uname'
21100 uniq='$uniq'
21101 uquadtype='$uquadtype'
21102 use5005threads='$use5005threads'
21103 use64bitall='$use64bitall'
21104 use64bitint='$use64bitint'
21105 usecrosscompile='$usecrosscompile'
21106 usedl='$usedl'
21107 useithreads='$useithreads'
21108 uselargefiles='$uselargefiles'
21109 uselongdouble='$uselongdouble'
21110 usemorebits='$usemorebits'
21111 usemultiplicity='$usemultiplicity'
21112 usemymalloc='$usemymalloc'
21113 usenm='$usenm'
21114 useopcode='$useopcode'
21115 useperlio='$useperlio'
21116 useposix='$useposix'
21117 usereentrant='$usereentrant'
21118 usesfio='$usesfio'
21119 useshrplib='$useshrplib'
21120 usesocks='$usesocks'
21121 usethreads='$usethreads'
21122 usevendorprefix='$usevendorprefix'
21123 usevfork='$usevfork'
21124 usrinc='$usrinc'
21125 uuname='$uuname'
21126 uvXUformat='$uvXUformat'
21127 uvoformat='$uvoformat'
21128 uvsize='$uvsize'
21129 uvtype='$uvtype'
21130 uvuformat='$uvuformat'
21131 uvxformat='$uvxformat'
21132 vendorarch='$vendorarch'
21133 vendorarchexp='$vendorarchexp'
21134 vendorbin='$vendorbin'
21135 vendorbinexp='$vendorbinexp'
21136 vendorhtml1='$vendorhtml1'
21137 vendorhtml1exp='$vendorhtml1exp'
21138 vendorhtml3='$vendorhtml3'
21139 vendorhtml3exp='$vendorhtml3exp'
21140 vendorlib='$vendorlib'
21141 vendorlib_stem='$vendorlib_stem'
21142 vendorlibexp='$vendorlibexp'
21143 vendorman1='$vendorman1'
21144 vendorman1exp='$vendorman1exp'
21145 vendorman3='$vendorman3'
21146 vendorman3exp='$vendorman3exp'
21147 vendorprefix='$vendorprefix'
21148 vendorprefixexp='$vendorprefixexp'
21149 vendorscript='$vendorscript'
21150 vendorscriptexp='$vendorscriptexp'
21151 version='$version'
21152 version_patchlevel_string='$version_patchlevel_string'
21153 versiononly='$versiononly'
21154 vi='$vi'
21155 voidflags='$voidflags'
21156 xlibpth='$xlibpth'
21157 xs_apiversion='$xs_apiversion'
21158 yacc='$yacc'
21159 yaccflags='$yaccflags'
21160 zcat='$zcat'
21161 zip='$zip'
21162 EOT
21163
21164 : Add in command line options if available
21165 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21166
21167 : add special variables
21168 $test -f $src/patchlevel.h && \
21169 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21170 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21171 echo "PERL_CONFIG_SH=true" >>config.sh
21172
21173 : propagate old symbols
21174 if $test -f UU/config.sh; then
21175         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21176         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21177         $sort | $uniq -u >UU/oldsyms
21178         set X `cat UU/oldsyms`
21179         shift
21180         case $# in
21181         0) ;;
21182         *)
21183                 cat <<EOM
21184 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21185 EOM
21186                 echo "# Variables propagated from previous config.sh file." >>config.sh
21187                 for sym in `cat UU/oldsyms`; do
21188                         echo "    Propagating $hint variable "'$'"$sym..."
21189                         eval 'tmp="$'"${sym}"'"'
21190                         echo "$tmp" | \
21191                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21192                 done
21193                 ;;
21194         esac
21195 fi
21196
21197 : Finish up by extracting the .SH files
21198 case "$alldone" in
21199 exit)
21200         $rm -rf UU
21201         echo "Extraction done."
21202         exit 0
21203         ;;
21204 cont)
21205         ;;
21206 '')
21207         dflt=''
21208         nostick=true
21209         $cat <<EOM
21210
21211 If you'd like to make any changes to the config.sh file before I begin
21212 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21213
21214 EOM
21215         rp="Press return or use a shell escape to edit config.sh:"
21216         . UU/myread
21217         nostick=''
21218         case "$ans" in
21219         '') ;;
21220         *) : in case they cannot read
21221                 sh 1>&4 -c "$ans";;
21222         esac
21223         ;;
21224 esac
21225
21226 : if this fails, just run all the .SH files by hand
21227 . ./config.sh
21228
21229 echo " "
21230 exec 1>&4
21231 pwd=`pwd`
21232 . ./UU/extract
21233 cd "$pwd"
21234
21235 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21236         dflt=y
21237         case "$silent" in
21238         true) ;;
21239         *)
21240                 $cat <<EOM
21241
21242 Now you need to generate make dependencies by running "$make depend".
21243 You might prefer to run it in background: "$make depend > makedepend.out &"
21244 It can take a while, so you might not want to run it right now.
21245
21246 EOM
21247                 ;;
21248         esac
21249         rp="Run $make depend now?"
21250         . UU/myread
21251         case "$ans" in
21252         y*)
21253                 $make depend && echo "Now you must run '$make'."
21254                 ;;
21255         *)
21256                 echo "You must run '$make depend' then '$make'."
21257                 ;;
21258         esac
21259 elif test -f [Mm]akefile; then
21260         echo " "
21261         echo "Now you must run a $make."
21262 else
21263         echo "Configure done."
21264 fi
21265
21266 if $test -f Policy.sh; then
21267     $cat <<EOM
21268
21269 If you compile $package on a different machine or from a different object
21270 directory, copy the Policy.sh file from this object directory to the
21271 new one before you run Configure -- this will help you with most of
21272 the policy defaults.
21273
21274 EOM
21275 fi
21276 if $test -f config.msg; then
21277     echo "Hmm.  I also noted the following information while running:"
21278     echo " "
21279     $cat config.msg >&4
21280     $rm -f config.msg
21281 fi
21282 $rm -f kit*isdone ark*isdone
21283 $rm -rf UU
21284
21285 : End of Configure
21286