Fix bug #21347 (segfault in UNIVERSAL::AUTOLOAD with qr//)
[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 Sat Apr 19 21:10:39 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_aintl=''
338 d_alarm=''
339 asctime_r_proto=''
340 d_asctime_r=''
341 d_attribut=''
342 d_bcmp=''
343 d_bcopy=''
344 d_bzero=''
345 d_casti32=''
346 castflags=''
347 d_castneg=''
348 d_chown=''
349 d_chroot=''
350 d_chsize=''
351 d_class=''
352 d_closedir=''
353 d_void_closedir=''
354 d_cmsghdr_s=''
355 d_const=''
356 d_copysignl=''
357 cryptlib=''
358 d_crypt=''
359 crypt_r_proto=''
360 d_crypt_r=''
361 d_csh=''
362 full_csh=''
363 ctermid_r_proto=''
364 d_ctermid_r=''
365 ctime_r_proto=''
366 d_ctime_r=''
367 d_cuserid=''
368 d_dbl_dig=''
369 d_dbminitproto=''
370 d_difftime=''
371 d_dirfd=''
372 d_dlerror=''
373 d_dlopen=''
374 d_dlsymun=''
375 d_dosuid=''
376 d_suidsafe=''
377 d_drand48_r=''
378 drand48_r_proto=''
379 d_drand48proto=''
380 d_dup2=''
381 d_eaccess=''
382 d_endgrent=''
383 d_endgrent_r=''
384 endgrent_r_proto=''
385 d_endhent=''
386 d_endhostent_r=''
387 endhostent_r_proto=''
388 d_endnent=''
389 d_endnetent_r=''
390 endnetent_r_proto=''
391 d_endpent=''
392 d_endprotoent_r=''
393 endprotoent_r_proto=''
394 d_endpwent=''
395 d_endpwent_r=''
396 endpwent_r_proto=''
397 d_endsent=''
398 d_endservent_r=''
399 endservent_r_proto=''
400 d_fchdir=''
401 d_fchmod=''
402 d_fchown=''
403 d_fcntl=''
404 d_fcntl_can_lock=''
405 d_fd_macros=''
406 d_fd_set=''
407 d_fds_bits=''
408 d_fgetpos=''
409 d_finite=''
410 d_finitel=''
411 d_flexfnam=''
412 d_flock=''
413 d_flockproto=''
414 d_fork=''
415 d_fp_class=''
416 d_fpclass=''
417 d_fpclassify=''
418 d_fpclassl=''
419 d_fpos64_t=''
420 d_frexpl=''
421 d_fs_data_s=''
422 d_fseeko=''
423 d_fsetpos=''
424 d_fstatfs=''
425 d_fsync=''
426 d_ftello=''
427 d_ftime=''
428 d_gettimeod=''
429 d_Gconvert=''
430 d_getcwd=''
431 d_getespwnam=''
432 d_getfsstat=''
433 d_getgrent=''
434 d_getgrent_r=''
435 getgrent_r_proto=''
436 d_getgrgid_r=''
437 getgrgid_r_proto=''
438 d_getgrnam_r=''
439 getgrnam_r_proto=''
440 d_getgrps=''
441 d_gethbyaddr=''
442 d_gethbyname=''
443 d_gethent=''
444 aphostname=''
445 d_gethname=''
446 d_phostname=''
447 d_uname=''
448 d_gethostbyaddr_r=''
449 gethostbyaddr_r_proto=''
450 d_gethostbyname_r=''
451 gethostbyname_r_proto=''
452 d_gethostent_r=''
453 gethostent_r_proto=''
454 d_gethostprotos=''
455 d_getitimer=''
456 d_getlogin=''
457 d_getlogin_r=''
458 getlogin_r_proto=''
459 d_getmnt=''
460 d_getmntent=''
461 d_getnbyaddr=''
462 d_getnbyname=''
463 d_getnent=''
464 d_getnetbyaddr_r=''
465 getnetbyaddr_r_proto=''
466 d_getnetbyname_r=''
467 getnetbyname_r_proto=''
468 d_getnetent_r=''
469 getnetent_r_proto=''
470 d_getnetprotos=''
471 d_getpagsz=''
472 d_getpent=''
473 d_getpgid=''
474 d_getpgrp2=''
475 d_bsdgetpgrp=''
476 d_getpgrp=''
477 d_getppid=''
478 d_getprior=''
479 d_getpbyname=''
480 d_getpbynumber=''
481 d_getprotobyname_r=''
482 getprotobyname_r_proto=''
483 d_getprotobynumber_r=''
484 getprotobynumber_r_proto=''
485 d_getprotoent_r=''
486 getprotoent_r_proto=''
487 d_getprotoprotos=''
488 d_getprpwnam=''
489 d_getpwent=''
490 d_getpwent_r=''
491 getpwent_r_proto=''
492 d_getpwnam_r=''
493 getpwnam_r_proto=''
494 d_getpwuid_r=''
495 getpwuid_r_proto=''
496 d_getsent=''
497 d_getservbyname_r=''
498 getservbyname_r_proto=''
499 d_getservbyport_r=''
500 getservbyport_r_proto=''
501 d_getservent_r=''
502 getservent_r_proto=''
503 d_getservprotos=''
504 d_getspnam=''
505 d_getspnam_r=''
506 getspnam_r_proto=''
507 d_getsbyname=''
508 d_getsbyport=''
509 d_gmtime_r=''
510 gmtime_r_proto=''
511 d_gnulibc=''
512 gnulibc_version=''
513 d_hasmntopt=''
514 d_htonl=''
515 d_ilogbl=''
516 d_inetaton=''
517 d_int64_t=''
518 d_isascii=''
519 d_isfinite=''
520 d_isinf=''
521 d_isnan=''
522 d_isnanl=''
523 d_killpg=''
524 d_lchown=''
525 d_ldbl_dig=''
526 d_link=''
527 d_localtime_r=''
528 localtime_r_proto=''
529 d_locconv=''
530 d_lockf=''
531 d_longdbl=''
532 longdblsize=''
533 d_longlong=''
534 longlongsize=''
535 d_lseekproto=''
536 d_lstat=''
537 d_madvise=''
538 d_mblen=''
539 d_mbstowcs=''
540 d_mbtowc=''
541 d_memchr=''
542 d_memcmp=''
543 d_memcpy=''
544 d_memmove=''
545 d_memset=''
546 d_mkdir=''
547 d_mkdtemp=''
548 d_mkfifo=''
549 d_mkstemp=''
550 d_mkstemps=''
551 d_mktime=''
552 d_mmap=''
553 mmaptype=''
554 d_modfl=''
555 d_modfl_pow32_bug=''
556 d_modflproto=''
557 d_mprotect=''
558 d_msg=''
559 d_msgctl=''
560 d_msgget=''
561 d_msghdr_s=''
562 d_msgrcv=''
563 d_msgsnd=''
564 d_msync=''
565 d_munmap=''
566 d_nanosleep=''
567 d_nice=''
568 d_nl_langinfo=''
569 d_off64_t=''
570 d_open3=''
571 d_fpathconf=''
572 d_pathconf=''
573 d_pause=''
574 d_pipe=''
575 d_poll=''
576 d_portable=''
577 d_procselfexe=''
578 procselfexe=''
579 d_old_pthread_create_joinable=''
580 old_pthread_create_joinable=''
581 d_pthread_atfork=''
582 d_pthread_yield=''
583 d_sched_yield=''
584 sched_yield=''
585 d_qgcvt=''
586 d_random_r=''
587 random_r_proto=''
588 d_readdir64_r=''
589 readdir64_r_proto=''
590 d_readdir=''
591 d_rewinddir=''
592 d_seekdir=''
593 d_telldir=''
594 d_readdir_r=''
595 readdir_r_proto=''
596 d_readlink=''
597 d_readv=''
598 d_recvmsg=''
599 d_rename=''
600 d_rmdir=''
601 d_safebcpy=''
602 d_safemcpy=''
603 d_sanemcmp=''
604 d_sbrkproto=''
605 d_scalbnl=''
606 d_select=''
607 d_sem=''
608 d_semctl=''
609 d_semget=''
610 d_semop=''
611 d_sendmsg=''
612 d_setegid=''
613 d_seteuid=''
614 d_setgrent=''
615 d_setgrent_r=''
616 setgrent_r_proto=''
617 d_setgrps=''
618 d_sethent=''
619 d_sethostent_r=''
620 sethostent_r_proto=''
621 d_setitimer=''
622 d_setlinebuf=''
623 d_setlocale=''
624 d_setlocale_r=''
625 setlocale_r_proto=''
626 d_setnent=''
627 d_setnetent_r=''
628 setnetent_r_proto=''
629 d_setpent=''
630 d_setpgid=''
631 d_setpgrp2=''
632 d_bsdsetpgrp=''
633 d_setpgrp=''
634 d_setprior=''
635 d_setproctitle=''
636 d_setprotoent_r=''
637 setprotoent_r_proto=''
638 d_setpwent=''
639 d_setpwent_r=''
640 setpwent_r_proto=''
641 d_setregid=''
642 d_setresgid=''
643 d_setresuid=''
644 d_setreuid=''
645 d_setrgid=''
646 d_setruid=''
647 d_setsent=''
648 d_setservent_r=''
649 setservent_r_proto=''
650 d_setsid=''
651 d_setvbuf=''
652 d_sfio=''
653 usesfio=''
654 d_shm=''
655 d_shmat=''
656 d_shmatprototype=''
657 shmattype=''
658 d_shmctl=''
659 d_shmdt=''
660 d_shmget=''
661 d_sigaction=''
662 d_sigprocmask=''
663 d_sigsetjmp=''
664 d_sockatmark=''
665 d_sockatmarkproto=''
666 d_msg_ctrunc=''
667 d_msg_dontroute=''
668 d_msg_oob=''
669 d_msg_peek=''
670 d_msg_proxy=''
671 d_oldsock=''
672 d_scm_rights=''
673 d_socket=''
674 d_sockpair=''
675 sockethdr=''
676 socketlib=''
677 d_socklen_t=''
678 d_socks5_init=''
679 d_sqrtl=''
680 d_srand48_r=''
681 srand48_r_proto=''
682 d_srandom_r=''
683 srandom_r_proto=''
684 d_sresgproto=''
685 d_sresuproto=''
686 d_statblks=''
687 d_statfs_f_flags=''
688 d_statfs_s=''
689 d_fstatvfs=''
690 d_statvfs=''
691 d_stdio_cnt_lval=''
692 d_stdio_ptr_lval=''
693 d_stdio_ptr_lval_nochange_cnt=''
694 d_stdio_ptr_lval_sets_cnt=''
695 d_stdiobase=''
696 d_stdstdio=''
697 stdio_base=''
698 stdio_bufsiz=''
699 stdio_cnt=''
700 stdio_filbuf=''
701 stdio_ptr=''
702 d_index=''
703 d_strchr=''
704 d_strcoll=''
705 d_strctcpy=''
706 d_strerrm=''
707 d_strerror=''
708 d_sysernlst=''
709 d_syserrlst=''
710 d_strerror_r=''
711 strerror_r_proto=''
712 d_strftime=''
713 d_strtod=''
714 d_strtol=''
715 d_strtold=''
716 d_strtoll=''
717 d_strtoq=''
718 d_strtoul=''
719 d_strtoull=''
720 d_strtouq=''
721 d_strxfrm=''
722 d_symlink=''
723 d_syscall=''
724 d_syscallproto=''
725 d_sysconf=''
726 d_system=''
727 d_tcgetpgrp=''
728 d_tcsetpgrp=''
729 d_telldirproto=''
730 d_time=''
731 timetype=''
732 clocktype=''
733 d_times=''
734 d_tmpnam_r=''
735 tmpnam_r_proto=''
736 d_truncate=''
737 d_ttyname_r=''
738 ttyname_r_proto=''
739 d_tzname=''
740 d_u32align=''
741 d_ualarm=''
742 d_umask=''
743 d_semctl_semid_ds=''
744 d_semctl_semun=''
745 d_union_semun=''
746 d_unordered=''
747 d_usleep=''
748 d_usleepproto=''
749 d_ustat=''
750 d_vfork=''
751 usevfork=''
752 d_voidsig=''
753 signal_t=''
754 d_volatile=''
755 d_charvspr=''
756 d_vprintf=''
757 d_wait4=''
758 d_waitpid=''
759 d_wcstombs=''
760 d_wctomb=''
761 d_writev=''
762 dlext=''
763 cccdlflags=''
764 ccdlflags=''
765 dlsrc=''
766 ld=''
767 lddlflags=''
768 usedl=''
769 doublesize=''
770 ebcdic=''
771 fflushNULL=''
772 fflushall=''
773 fpossize=''
774 fpostype=''
775 gccansipedantic=''
776 gccosandvers=''
777 gccversion=''
778 gidformat=''
779 gidsign=''
780 gidsize=''
781 gidtype=''
782 groupstype=''
783 h_fcntl=''
784 h_sysfile=''
785 html1dir=''
786 html1direxp=''
787 installhtml1dir=''
788 html3dir=''
789 html3direxp=''
790 installhtml3dir=''
791 i_arpainet=''
792 i_crypt=''
793 db_hashtype=''
794 db_prefixtype=''
795 db_version_major=''
796 db_version_minor=''
797 db_version_patch=''
798 i_db=''
799 i_dbm=''
800 i_rpcsvcdbm=''
801 d_dirnamlen=''
802 direntrytype=''
803 i_dirent=''
804 i_dld=''
805 i_dlfcn=''
806 i_fcntl=''
807 i_float=''
808 i_fp=''
809 i_fp_class=''
810 i_gdbm=''
811 d_grpasswd=''
812 i_grp=''
813 i_ieeefp=''
814 i_inttypes=''
815 i_langinfo=''
816 i_libutil=''
817 i_limits=''
818 i_locale=''
819 i_machcthr=''
820 i_malloc=''
821 i_math=''
822 i_memory=''
823 i_mntent=''
824 i_ndbm=''
825 i_netdb=''
826 i_neterrno=''
827 i_netinettcp=''
828 i_niin=''
829 i_sysin=''
830 i_poll=''
831 i_prot=''
832 i_pthread=''
833 d_pwage=''
834 d_pwchange=''
835 d_pwclass=''
836 d_pwcomment=''
837 d_pwexpire=''
838 d_pwgecos=''
839 d_pwpasswd=''
840 d_pwquota=''
841 i_pwd=''
842 i_sfio=''
843 i_shadow=''
844 i_socks=''
845 i_stddef=''
846 i_stdlib=''
847 i_string=''
848 strings=''
849 i_sunmath=''
850 i_sysaccess=''
851 i_sysdir=''
852 i_sysfile=''
853 d_voidtty=''
854 i_bsdioctl=''
855 i_sysfilio=''
856 i_sysioctl=''
857 i_syssockio=''
858 i_syslog=''
859 i_sysmman=''
860 i_sysmode=''
861 i_sysmount=''
862 i_sysndir=''
863 i_sysparam=''
864 i_sysresrc=''
865 i_syssecrt=''
866 i_sysselct=''
867 i_sysstat=''
868 i_sysstatfs=''
869 i_sysstatvfs=''
870 i_systimes=''
871 i_systypes=''
872 i_sysuio=''
873 i_sysun=''
874 i_sysutsname=''
875 i_sysvfs=''
876 i_syswait=''
877 i_sgtty=''
878 i_termio=''
879 i_termios=''
880 d_tm_tm_gmtoff=''
881 d_tm_tm_zone=''
882 i_systime=''
883 i_systimek=''
884 i_time=''
885 timeincl=''
886 i_unistd=''
887 i_ustat=''
888 i_utime=''
889 i_values=''
890 i_stdarg=''
891 i_varargs=''
892 i_varhdr=''
893 i_vfork=''
894 inc_version_list=''
895 inc_version_list_init=''
896 installprefix=''
897 installprefixexp=''
898 installstyle=''
899 installusrbinperl=''
900 intsize=''
901 longsize=''
902 shortsize=''
903 issymlink=''
904 libc=''
905 ldlibpthname=''
906 libperl=''
907 shrpenv=''
908 useshrplib=''
909 glibpth=''
910 libpth=''
911 loclibpth=''
912 plibpth=''
913 xlibpth=''
914 ignore_versioned_solibs=''
915 libs=''
916 libsdirs=''
917 libsfiles=''
918 libsfound=''
919 libspath=''
920 lns=''
921 d_PRIEUldbl=''
922 d_PRIFUldbl=''
923 d_PRIGUldbl=''
924 d_PRIeldbl=''
925 d_PRIfldbl=''
926 d_PRIgldbl=''
927 d_SCNfldbl=''
928 sPRIEUldbl=''
929 sPRIFUldbl=''
930 sPRIGUldbl=''
931 sPRIeldbl=''
932 sPRIfldbl=''
933 sPRIgldbl=''
934 sSCNfldbl=''
935 lseeksize=''
936 lseektype=''
937 make_set_make=''
938 d_mymalloc=''
939 freetype=''
940 mallocobj=''
941 mallocsrc=''
942 malloctype=''
943 usemymalloc=''
944 installman1dir=''
945 man1dir=''
946 man1direxp=''
947 man1ext=''
948 installman3dir=''
949 man3dir=''
950 man3direxp=''
951 man3ext=''
952 modetype=''
953 multiarch=''
954 mydomain=''
955 myhostname=''
956 phostname=''
957 c=''
958 n=''
959 d_eofnblk=''
960 eagain=''
961 o_nonblock=''
962 rd_nodata=''
963 need_va_copy=''
964 netdb_hlen_type=''
965 netdb_host_type=''
966 netdb_name_type=''
967 netdb_net_type=''
968 groupcat=''
969 hostcat=''
970 passcat=''
971 orderlib=''
972 ranlib=''
973 d_perl_otherlibdirs=''
974 otherlibdirs=''
975 package=''
976 spackage=''
977 pager=''
978 api_revision=''
979 api_subversion=''
980 api_version=''
981 api_versionstring=''
982 patchlevel=''
983 perl_patchlevel=''
984 revision=''
985 subversion=''
986 version=''
987 version_patchlevel_string=''
988 perl5=''
989 perladmin=''
990 perlpath=''
991 d_nv_preserves_uv=''
992 i16size=''
993 i16type=''
994 i32size=''
995 i32type=''
996 i64size=''
997 i64type=''
998 i8size=''
999 i8type=''
1000 ivsize=''
1001 ivtype=''
1002 nv_preserves_uv_bits=''
1003 nvsize=''
1004 nvtype=''
1005 u16size=''
1006 u16type=''
1007 u32size=''
1008 u32type=''
1009 u64size=''
1010 u64type=''
1011 u8size=''
1012 u8type=''
1013 uvsize=''
1014 uvtype=''
1015 ivdformat=''
1016 nvEUformat=''
1017 nvFUformat=''
1018 nvGUformat=''
1019 nveformat=''
1020 nvfformat=''
1021 nvgformat=''
1022 uvXUformat=''
1023 uvoformat=''
1024 uvuformat=''
1025 uvxformat=''
1026 pidtype=''
1027 prefix=''
1028 prefixexp=''
1029 installprivlib=''
1030 privlib=''
1031 privlibexp=''
1032 prototype=''
1033 ptrsize=''
1034 d_PRIXU64=''
1035 d_PRId64=''
1036 d_PRIi64=''
1037 d_PRIo64=''
1038 d_PRIu64=''
1039 d_PRIx64=''
1040 sPRIXU64=''
1041 sPRId64=''
1042 sPRIi64=''
1043 sPRIo64=''
1044 sPRIu64=''
1045 sPRIx64=''
1046 d_quad=''
1047 quadkind=''
1048 quadtype=''
1049 uquadtype=''
1050 drand01=''
1051 randbits=''
1052 randfunc=''
1053 randseedtype=''
1054 seedfunc=''
1055 installscript=''
1056 scriptdir=''
1057 scriptdirexp=''
1058 selectminbits=''
1059 selecttype=''
1060 sh=''
1061 sig_count=''
1062 sig_name=''
1063 sig_name_init=''
1064 sig_num=''
1065 sig_num_init=''
1066 sig_size=''
1067 installsitearch=''
1068 sitearch=''
1069 sitearchexp=''
1070 installsitebin=''
1071 sitebin=''
1072 sitebinexp=''
1073 installsitehtml1=''
1074 sitehtml1=''
1075 sitehtml1exp=''
1076 installsitehtml3=''
1077 sitehtml3=''
1078 sitehtml3exp=''
1079 installsitelib=''
1080 sitelib=''
1081 sitelib_stem=''
1082 sitelibexp=''
1083 installsiteman1=''
1084 siteman1=''
1085 siteman1exp=''
1086 installsiteman3=''
1087 siteman3=''
1088 siteman3exp=''
1089 siteprefix=''
1090 siteprefixexp=''
1091 installsitescript=''
1092 sitescript=''
1093 sitescriptexp=''
1094 sizesize=''
1095 sizetype=''
1096 so=''
1097 socksizetype=''
1098 sharpbang=''
1099 shsharp=''
1100 spitshell=''
1101 src=''
1102 ssizetype=''
1103 startperl=''
1104 startsh=''
1105 stdchar=''
1106 d_stdio_stream_array=''
1107 stdio_stream_array=''
1108 sysman=''
1109 trnl=''
1110 uidformat=''
1111 uidsign=''
1112 uidsize=''
1113 uidtype=''
1114 archname64=''
1115 use64bitall=''
1116 use64bitint=''
1117 ccflags_uselargefiles=''
1118 ldflags_uselargefiles=''
1119 libswanted_uselargefiles=''
1120 uselargefiles=''
1121 uselongdouble=''
1122 usemorebits=''
1123 usemultiplicity=''
1124 nm_opt=''
1125 nm_so_opt=''
1126 runnm=''
1127 usenm=''
1128 useperlio=''
1129 usesocks=''
1130 d_oldpthreads=''
1131 use5005threads=''
1132 useithreads=''
1133 usereentrant=''
1134 usethreads=''
1135 incpath=''
1136 mips_type=''
1137 usrinc=''
1138 d_vendorarch=''
1139 installvendorarch=''
1140 vendorarch=''
1141 vendorarchexp=''
1142 d_vendorbin=''
1143 installvendorbin=''
1144 vendorbin=''
1145 vendorbinexp=''
1146 installvendorhtml1=''
1147 vendorhtml1=''
1148 vendorhtml1exp=''
1149 installvendorhtml3=''
1150 vendorhtml3=''
1151 vendorhtml3exp=''
1152 d_vendorlib=''
1153 installvendorlib=''
1154 vendorlib=''
1155 vendorlib_stem=''
1156 vendorlibexp=''
1157 installvendorman1=''
1158 vendorman1=''
1159 vendorman1exp=''
1160 installvendorman3=''
1161 vendorman3=''
1162 vendorman3exp=''
1163 usevendorprefix=''
1164 vendorprefix=''
1165 vendorprefixexp=''
1166 d_vendorscript=''
1167 installvendorscript=''
1168 vendorscript=''
1169 vendorscriptexp=''
1170 versiononly=''
1171 defvoidused=''
1172 voidflags=''
1173 pm_apiversion=''
1174 xs_apiversion=''
1175 yacc=''
1176 yaccflags=''
1177 CONFIG=''
1178
1179 define='define'
1180 undef='undef'
1181 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1182 rmlist=''
1183
1184 : We must find out about Eunice early
1185 eunicefix=':'
1186 if test -f /etc/unixtovms; then
1187         eunicefix=/etc/unixtovms
1188 fi
1189 if test -f /etc/unixtovms.exe; then
1190         eunicefix=/etc/unixtovms.exe
1191 fi
1192
1193 : Set executable suffix now -- needed before hints available
1194 if test -f "/libs/version.library"; then
1195 : Amiga OS
1196     _exe=""
1197 elif test -f "/system/gnu_library/bin/ar.pm"; then
1198 : Stratus VOS
1199     _exe=".pm"
1200 elif test -n "$DJGPP"; then
1201 : DOS DJGPP
1202     _exe=".exe"
1203 elif test -d c:/. -o -n "$is_os2" ; then
1204 : OS/2 or cygwin
1205     _exe=".exe"
1206 fi
1207
1208 i_whoami=''
1209 : Possible local include directories to search.
1210 : Set locincpth to "" in a hint file to defeat local include searches.
1211 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1212 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1213 :
1214 : no include file wanted by default
1215 inclwanted=''
1216
1217 siteman1=''
1218 siteman3=''
1219 sitescript=''
1220 : Trailing extension.  Override this in a hint file, if needed.
1221 : Extra object files, if any, needed on this platform.
1222 archobjs=''
1223 groupstype=''
1224 libnames=''
1225 : change the next line if compiling for Xenix/286 on Xenix/386
1226 xlibpth='/usr/lib/386 /lib/386'
1227 : Possible local library directories to search.
1228 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1229 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1230
1231 : general looking path for locating libraries
1232 glibpth="/lib /usr/lib $xlibpth"
1233 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1234 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1235 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1236
1237 : Private path used by Configure to find libraries.  Its value
1238 : is prepended to libpth. This variable takes care of special
1239 : machines, like the mips.  Usually, it should be empty.
1240 plibpth=''
1241
1242 : default library list
1243 libswanted=''
1244 : some systems want to use only the non-versioned libso:s
1245 ignore_versioned_solibs=''
1246 : full support for void wanted by default
1247 defvoidused=15
1248
1249 ccname=''
1250 ccversion=''
1251 perllibs=''
1252 : set useposix=false in your hint file to disable the POSIX extension.
1253 useposix=true
1254 : set useopcode=false in your hint file to disable the Opcode extension.
1255 useopcode=true
1256 archname64=''
1257 ccflags_uselargefiles=''
1258 ldflags_uselargefiles=''
1259 libswanted_uselargefiles=''
1260 : set usemultiplicity on the Configure command line to enable multiplicity.
1261 : set usesocks on the Configure command line to enable socks.
1262 archname=''
1263 : set usethreads on the Configure command line to enable threads.
1264 usereentrant='undef'
1265 : List of libraries we want.
1266 : If anyone needs -lnet, put it in a hint file.
1267 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1268 libswanted="$libswanted dld ld sun m c cposix posix"
1269 libswanted="$libswanted ndir dir crypt sec"
1270 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1271 : We probably want to search /usr/shlib before most other libraries.
1272 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1273 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1274 glibpth="/usr/shlib $glibpth"
1275 : Do not use vfork unless overridden by a hint file.
1276 usevfork=false
1277
1278 : Find the basic shell for Bourne shell scripts
1279 case "$sh" in
1280 '')
1281         case "$SYSTYPE" in
1282         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1283         *) xxx='/bin/sh';;
1284         esac
1285         if test -f "$xxx"; then
1286                 sh="$xxx"
1287         else
1288                 : Build up a list and do a single loop so we can 'break' out.
1289                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1290                 for xxx in sh bash ksh pdksh ash; do
1291                         for p in $pth; do
1292                                 try="$try ${p}/${xxx}"
1293                         done
1294                 done
1295                 for xxx in $try; do
1296                         if test -f "$xxx"; then
1297                                 sh="$xxx";
1298                                 break
1299                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1300                                 sh="$xxx";
1301                                 break
1302                         elif test -f "$xxx.exe"; then
1303                                 sh="$xxx";
1304                                 break
1305                         fi
1306                 done
1307         fi
1308         ;;
1309 esac
1310
1311 case "$sh" in
1312 '')     cat >&2 <<EOM
1313 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1314
1315 Usually it's in /bin/sh.  How did you even get this far?
1316 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1317 we'll try to straighten this all out.
1318 EOM
1319         exit 1
1320         ;;
1321 esac
1322
1323 : see if sh knows # comments
1324 if `$sh -c '#' >/dev/null 2>&1`; then
1325         shsharp=true
1326         spitshell=cat
1327         xcat=/bin/cat
1328         test -f $xcat$_exe || xcat=/usr/bin/cat
1329         if test ! -f $xcat$_exe; then
1330                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1331                         if test -f $p/cat$_exe; then
1332                                 xcat=$p/cat
1333                                 break
1334                         fi
1335                 done
1336                 if test ! -f $xcat$_exe; then
1337                         echo "Can't find cat anywhere!"
1338                         exit 1
1339                 fi
1340         fi
1341         echo "#!$xcat" >sharp
1342         $eunicefix sharp
1343         chmod +x sharp
1344         ./sharp > today
1345         if test -s today; then
1346                 sharpbang='#!'
1347         else
1348                 echo "#! $xcat" > sharp
1349                 $eunicefix sharp
1350                 chmod +x sharp
1351                 ./sharp > today
1352                 if test -s today; then
1353                         sharpbang='#! '
1354                 else
1355                         sharpbang=': use '
1356                 fi
1357         fi
1358 else
1359         echo " "
1360         echo "Your $sh doesn't grok # comments--I will strip them later on."
1361         shsharp=false
1362         cd ..
1363         echo "exec grep -v '^[  ]*#'" >spitshell
1364         chmod +x spitshell
1365         $eunicefix spitshell
1366         spitshell=`pwd`/spitshell
1367         cd UU
1368         echo "I presume that if # doesn't work, #! won't work either!"
1369         sharpbang=': use '
1370 fi
1371 rm -f sharp today
1372
1373 : figure out how to guarantee sh startup
1374 case "$startsh" in
1375 '') startsh=${sharpbang}${sh} ;;
1376 *)
1377 esac
1378 cat >sharp <<EOSS
1379 $startsh
1380 set abc
1381 test "$?abc" != 1
1382 EOSS
1383
1384 chmod +x sharp
1385 $eunicefix sharp
1386 if ./sharp; then
1387         : echo "Yup, it does."
1388 else
1389         echo "Hmm... '$startsh' does not guarantee sh startup..."
1390         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1391 fi
1392 rm -f sharp
1393
1394
1395 : Save command line options in file UU/cmdline.opt for later use in
1396 : generating config.sh.
1397 cat > cmdline.opt <<EOSH
1398 # Configure command line arguments.
1399 config_arg0='$0'
1400 config_args='$*'
1401 config_argc=$#
1402 EOSH
1403 argn=1
1404 args_exp=''
1405 args_sep=''
1406 for arg in "$@"; do
1407         cat >>cmdline.opt <<EOSH
1408 config_arg$argn='$arg'
1409 EOSH
1410         # Extreme backslashitis: replace each ' by '"'"'
1411         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1412 $arg
1413 EOC
1414         arg_exp=`cat cmdl.opt`
1415         args_exp="$args_exp$args_sep'$arg_exp'"
1416         argn=`expr $argn + 1`
1417         args_sep=' '
1418 done
1419 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1420 # used by ./hints/os2.sh
1421 rm -f cmdl.opt
1422
1423 : produce awk script to parse command line options
1424 cat >options.awk <<'EOF'
1425 BEGIN {
1426         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1427
1428         len = length(optstr);
1429         for (i = 1; i <= len; i++) {
1430                 c = substr(optstr, i, 1);
1431                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1432                 if (a == ":") {
1433                         arg[c] = 1;
1434                         i++;
1435                 }
1436                 opt[c] = 1;
1437         }
1438 }
1439 {
1440         expect = 0;
1441         str = $0;
1442         if (substr(str, 1, 1) != "-") {
1443                 printf("'%s'\n", str);
1444                 next;
1445         }
1446         len = length($0);
1447         for (i = 2; i <= len; i++) {
1448                 c = substr(str, i, 1);
1449                 if (!opt[c]) {
1450                         printf("-%s\n", substr(str, i));
1451                         next;
1452                 }
1453                 printf("-%s\n", c);
1454                 if (arg[c]) {
1455                         if (i < len)
1456                                 printf("'%s'\n", substr(str, i + 1));
1457                         else
1458                                 expect = 1;
1459                         next;
1460                 }
1461         }
1462 }
1463 END {
1464         if (expect)
1465                 print "?";
1466 }
1467 EOF
1468
1469 : process the command line options
1470 set X `for arg in "$@"; do echo "X$arg"; done |
1471         sed -e s/X// | awk -f options.awk`
1472 eval "set $*"
1473 shift
1474 rm -f options.awk
1475
1476 : set up default values
1477 fastread=''
1478 reuseval=false
1479 config_sh=''
1480 alldone=''
1481 error=''
1482 silent=''
1483 extractsh=''
1484 override=''
1485 knowitall=''
1486 rm -f optdef.sh posthint.sh
1487 cat >optdef.sh <<EOS
1488 $startsh
1489 EOS
1490
1491
1492 : option parsing
1493 while test $# -gt 0; do
1494         case "$1" in
1495         -d) shift; fastread=yes;;
1496         -e) shift; alldone=cont;;
1497         -f)
1498                 shift
1499                 cd ..
1500                 if test -r "$1"; then
1501                         config_sh="$1"
1502                 else
1503                         echo "$me: cannot read config file $1." >&2
1504                         error=true
1505                 fi
1506                 cd UU
1507                 shift;;
1508         -h) shift; error=true;;
1509         -r) shift; reuseval=true;;
1510         -s) shift; silent=true; realsilent=true;;
1511         -E) shift; alldone=exit;;
1512         -K) shift; knowitall=true;;
1513         -O) shift; override=true;;
1514         -S) shift; silent=true; extractsh=true;;
1515         -D)
1516                 shift
1517                 case "$1" in
1518                 *=)
1519                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1520                         echo "$me: ignoring -D $1" >&2
1521                         ;;
1522                 *=*) echo "$1" | \
1523                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1524                 *) echo "$1='define'" >> optdef.sh;;
1525                 esac
1526                 shift
1527                 ;;
1528         -U)
1529                 shift
1530                 case "$1" in
1531                 *=) echo "$1" >> optdef.sh;;
1532                 *=*)
1533                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1534                         echo "$me: ignoring -U $1" >&2
1535                         ;;
1536                 *) echo "$1='undef'" >> optdef.sh;;
1537                 esac
1538                 shift
1539                 ;;
1540         -A)
1541             shift
1542             xxx=''
1543             yyy="$1"
1544             zzz=''
1545             uuu=undef
1546             case "$yyy" in
1547             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1548                  case "$zzz" in
1549                  *:*) zzz='' ;;
1550                  *)   xxx=append
1551                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1552                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1553                  esac
1554                  ;;
1555             esac
1556             case "$xxx" in
1557             '')  case "$yyy" in
1558                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1559                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1560                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1561                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1562                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1563                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1564                  esac
1565                  ;;       
1566             esac
1567             case "$xxx" in
1568             append)
1569                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1570             clear)
1571                 echo "$yyy=''"                  >> posthint.sh ;;
1572             define)
1573                 case "$zzz" in
1574                 '') zzz=define ;;
1575                 esac
1576                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1577             eval)
1578                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1579             prepend)
1580                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1581             undef)
1582                 case "$zzz" in
1583                 '') zzz="$uuu" ;;
1584                 esac
1585                 echo "$yyy=$zzz"                >> posthint.sh ;;
1586             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1587             esac
1588             shift
1589             ;;
1590         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1591             exit 0;;
1592         --) break;;
1593         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1594         *) break;;
1595         esac
1596 done
1597
1598 case "$error" in
1599 true)
1600         cat >&2 <<EOM
1601 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1602                  [-U symbol] [-U symbol=] [-A command:symbol...]
1603   -d : use defaults for all answers.
1604   -e : go on without questioning past the production of config.sh.
1605   -f : specify an alternate default configuration file.
1606   -h : print this help message and exit (with an error status).
1607   -r : reuse C symbols value if possible (skips costly nm extraction).
1608   -s : silent mode, only echoes questions and essential information.
1609   -D : define symbol to have some value:
1610          -D symbol         symbol gets the value 'define'
1611          -D symbol=value   symbol gets the value 'value'
1612   -E : stop at the end of questions, after having produced config.sh.
1613   -K : do not use unless you know what you are doing.
1614   -O : let -D and -U override definitions from loaded configuration file.
1615   -S : perform variable substitutions on all .SH files (can mix with -f)
1616   -U : undefine symbol:
1617          -U symbol    symbol gets the value 'undef'
1618          -U symbol=   symbol gets completely empty
1619   -A : manipulate symbol after the platform specific hints have been applied:
1620          -A symbol=value                append " "value to symbol
1621          -A append:symbol=value         append value to symbol
1622          -A define:symbol=value         define symbol to have value
1623          -A clear:symbol                define symbol to be ''
1624          -A define:symbol               define symbol to be 'define'
1625          -A eval:symbol=value           define symbol to be eval of value
1626          -A prepend:symbol=value        prepend value to symbol
1627          -A undef:symbol                define symbol to be 'undef'
1628          -A undef:symbol=               define symbol to be ''
1629   -V : print version number and exit (with a zero status).
1630 EOM
1631         exit 1
1632         ;;
1633 esac
1634
1635 : Sanity checks
1636 case "$fastread$alldone" in
1637 yescont|yesexit) ;;
1638 *)
1639         case "$extractsh" in
1640         true) ;;
1641         *)
1642                 if test ! -t 0; then
1643                         echo "Say 'sh Configure', not 'sh <Configure'"
1644                         exit 1
1645                 fi
1646                 ;;
1647         esac
1648         ;;
1649 esac
1650
1651 exec 4>&1
1652 case "$silent" in
1653 true) exec 1>/dev/null;;
1654 esac
1655
1656 : run the defines and the undefines, if any, but leave the file out there...
1657 touch optdef.sh
1658 . ./optdef.sh
1659 : create the posthint manipulation script and leave the file out there...
1660 touch posthint.sh
1661
1662 : set package name
1663 package=perl5
1664 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1665 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1666 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1667 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1668 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1669 esac
1670
1671 : Some greps do not return status, grrr.
1672 echo "grimblepritz" >grimble
1673 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1674         contains=contains
1675 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1676         contains=grep
1677 else
1678         contains=contains
1679 fi
1680 rm -f grimble
1681 : the following should work in any shell
1682 case "$contains" in
1683 contains*)
1684         echo " "
1685         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1686         cat >contains <<'EOSS'
1687 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1688 EOSS
1689 chmod +x contains
1690 esac
1691
1692 : Find the path to the source tree
1693 case "$src" in
1694 '') case "$0" in
1695     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1696          case "$src" in
1697          /*)    ;;
1698          .)     ;;
1699          *)     src=`cd ../$src && pwd` ;;
1700          esac
1701          ;;
1702     *)   src='.';;
1703     esac;;
1704 esac
1705 case "$src" in
1706 '')     src=/
1707         rsrc=/
1708         ;;
1709 /*) rsrc="$src";;
1710 *) rsrc="../$src";;
1711 esac
1712 if test -f $rsrc/Configure && \
1713         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1714 then
1715    : found it, so we are ok.
1716 else
1717         rsrc=''
1718         for src in . .. ../.. ../../.. ../../../..; do
1719                 if test -f ../$src/Configure && \
1720                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1721                 then
1722                         rsrc=../$src
1723                         break
1724                 fi
1725         done
1726 fi
1727 case "$rsrc" in
1728 '')
1729         cat <<EOM >&4
1730
1731 Sorry, I can't seem to locate the source dir for $package.  Please start
1732 Configure with an explicit path -- i.e. /some/path/Configure.
1733
1734 EOM
1735         exit 1
1736         ;;
1737 ../.)   rsrc='..';;
1738 *)
1739         echo " "
1740         echo "Sources for $package found in \"$src\"." >&4
1741         ;;
1742 esac
1743
1744 : script used to extract .SH files with variable substitutions
1745 cat >extract <<'EOS'
1746 PERL_CONFIG_SH=true
1747 echo "Doing variable substitutions on .SH files..."
1748 if test -f MANIFEST; then
1749         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1750 else
1751         echo "(Looking for .SH files under the source directory.)"
1752         set x `(cd "$src"; find . -name "*.SH" -print)`
1753 fi
1754 shift
1755 case $# in
1756 0) set x `(cd "$src"; echo *.SH)`; shift;;
1757 esac
1758 if test ! -f "$src/$1"; then
1759         shift
1760 fi
1761 mkdir_p='
1762 name=$1;
1763 create="";
1764 while test $name; do
1765         if test ! -d "$name"; then
1766                 create="$name $create";
1767                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1768                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1769         else
1770                 name="";
1771         fi;
1772 done;
1773 for file in $create; do
1774         mkdir $file;
1775 done
1776 '
1777 for file in $*; do
1778         case "$src" in
1779         ".")
1780                 case "$file" in
1781                 */*)
1782                         dir=`expr X$file : 'X\(.*\)/'`
1783                         file=`expr X$file : 'X.*/\(.*\)'`
1784                         (cd "$dir" && . ./$file)
1785                         ;;
1786                 *)
1787                         . ./$file
1788                         ;;
1789                 esac
1790                 ;;
1791         *)
1792                 case "$file" in
1793                 */*)
1794                         dir=`expr X$file : 'X\(.*\)/'`
1795                         file=`expr X$file : 'X.*/\(.*\)'`
1796                         (set x $dir; shift; eval $mkdir_p)
1797                         sh <"$src/$dir/$file"
1798                         ;;
1799                 *)
1800                         sh <"$src/$file"
1801                         ;;
1802                 esac
1803                 ;;
1804         esac
1805 done
1806 if test -f "$src/config_h.SH"; then
1807         if test ! -f config.h; then
1808         : oops, they left it out of MANIFEST, probably, so do it anyway.
1809         . "$src/config_h.SH"
1810         fi
1811 fi
1812 EOS
1813
1814 : extract files and exit if asked to do so
1815 case "$extractsh" in
1816 true)
1817         case "$realsilent" in
1818         true) ;;
1819         *) exec 1>&4;;
1820         esac
1821         case "$config_sh" in
1822         '') config_sh='config.sh';;
1823         esac
1824         echo " "
1825         echo "Fetching answers from $config_sh..."
1826         cd ..
1827         . $config_sh
1828         test "$override" && . ./optdef.sh
1829         echo " "
1830         . UU/extract
1831         rm -rf UU
1832         echo "Extraction done."
1833         exit 0
1834         ;;
1835 esac
1836
1837 : Eunice requires " " instead of "", can you believe it
1838 echo " "
1839 : Here we go...
1840 echo "Beginning of configuration questions for $package."
1841
1842 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1843
1844 : first determine how to suppress newline on echo command
1845 echo " "
1846 echo "Checking echo to see how to suppress newlines..."
1847 (echo "hi there\c" ; echo " ") >.echotmp
1848 if $contains c .echotmp >/dev/null 2>&1 ; then
1849         echo "...using -n."
1850         n='-n'
1851         c=''
1852 else
1853         cat <<'EOM'
1854 ...using \c
1855 EOM
1856         n=''
1857         c='\c'
1858 fi
1859 echo $n "The star should be here-->$c"
1860 echo '*'
1861 rm -f .echotmp
1862
1863 : Now test for existence of everything in MANIFEST
1864 echo " "
1865 if test -f "$rsrc/MANIFEST"; then
1866         echo "First let's make sure your kit is complete.  Checking..." >&4
1867         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1868         rm -f missing
1869         tmppwd=`pwd`
1870         for filelist in x??; do
1871                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1872         done
1873         if test -s missing; then
1874                 cat missing >&4
1875                 cat >&4 <<'EOM'
1876
1877 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1878
1879 You have the option of continuing the configuration process, despite the
1880 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1881 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1882 and contact the author (perlbug@perl.org).
1883
1884 EOM
1885                 echo $n "Continue? [n] $c" >&4
1886                 read ans
1887                 case "$ans" in
1888                 y*)
1889                         echo "Continuing..." >&4
1890                         rm -f missing
1891                         ;;
1892                 *)
1893                         echo "ABORTING..." >&4
1894                         kill $$
1895                         ;;
1896                 esac
1897         else
1898                 echo "Looks good..."
1899         fi
1900 else
1901         echo "There is no MANIFEST file.  I hope your kit is complete !"
1902 fi
1903 rm -f missing x??
1904
1905 echo " "
1906 : Find the appropriate value for a newline for tr
1907 if test -n "$DJGPP"; then
1908        trnl='\012'
1909 fi
1910 if test X"$trnl" = X; then
1911         case "`echo foo|tr '\n' x 2>/dev/null`" in
1912         foox) trnl='\n' ;;
1913         esac
1914 fi
1915 if test X"$trnl" = X; then
1916         case "`echo foo|tr '\012' x 2>/dev/null`" in
1917         foox) trnl='\012' ;;
1918         esac
1919 fi
1920 if test X"$trnl" = X; then
1921        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1922        fooxy) trnl='\n\r' ;;
1923        esac
1924 fi
1925 if test X"$trnl" = X; then
1926         cat <<EOM >&2
1927
1928 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1929
1930 EOM
1931         exit 1
1932 fi
1933
1934 : compute the number of columns on the terminal for proper question formatting
1935 case "$COLUMNS" in
1936 '') COLUMNS='80';;
1937 esac
1938
1939 : set up the echo used in my read
1940 myecho="case \"\$xxxm\" in
1941 '') echo $n \"\$rp $c\" >&4;;
1942 *) case \"\$rp\" in
1943         '') echo $n \"[\$xxxm] $c\";;
1944         *)
1945                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1946                         echo \"\$rp\" >&4
1947                         echo $n \"[\$xxxm] $c\" >&4
1948                 else
1949                         echo $n \"\$rp [\$xxxm] $c\" >&4
1950                 fi
1951                 ;;
1952         esac;;
1953 esac"
1954
1955 : now set up to do reads with possible shell escape and default assignment
1956 cat <<EOSC >myread
1957 $startsh
1958 xxxm=\$dflt
1959 $myecho
1960 ans='!'
1961 case "\$fastread" in
1962 yes) case "\$dflt" in
1963         '') ;;
1964         *) ans='';
1965                 case "\$silent-\$rp" in
1966                 true-) ;;
1967                 *) echo " " >&4;;
1968                 esac;;
1969         esac;;
1970 *) case "\$silent" in
1971         true) case "\$rp" in
1972                 '') ans='';;
1973                 esac;;
1974         esac;;
1975 esac
1976 while expr "X\$ans" : "X!" >/dev/null; do
1977         read answ
1978         set x \$xxxm
1979         shift
1980         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1981         case  "\$answ" in
1982         "!")
1983                 sh 1>&4
1984                 echo " "
1985                 $myecho
1986                 ;;
1987         !*)
1988                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1989                 shift
1990                 sh 1>&4 -c "\$*"
1991                 echo " "
1992                 $myecho
1993                 ;;
1994         "\$ans")
1995                 case "\$ans" in
1996                 \\&*)
1997                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1998                         shift
1999                         case "\$1" in
2000                         -d)
2001                                 fastread=yes
2002                                 echo "(OK, I'll run with -d after this question.)" >&4
2003                                 ;;
2004                         -*)
2005                                 echo "*** Sorry, \$1 not supported yet." >&4
2006                                 ;;
2007                         esac
2008                         $myecho
2009                         ans=!
2010                         ;;
2011                 esac;;
2012         *)
2013                 case "\$aok" in
2014                 y)
2015                         echo "*** Substitution done -- please confirm."
2016                         xxxm="\$ans"
2017                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2018                         xxxm="\$ans"
2019                         ans=!
2020                         ;;
2021                 *)
2022                         echo "*** Error -- try again."
2023                         ans=!
2024                         ;;
2025                 esac
2026                 $myecho
2027                 ;;
2028         esac
2029         case "\$ans\$xxxm\$nostick" in
2030         '')
2031                 ans=!
2032                 $myecho
2033                 ;;
2034         esac
2035 done
2036 case "\$ans" in
2037 '') ans="\$xxxm";;
2038 esac
2039 EOSC
2040
2041 : create .config dir to save info across Configure sessions
2042 test -d ../.config || mkdir ../.config
2043 cat >../.config/README <<EOF
2044 This directory created by Configure to save information that should
2045 persist across sessions for $package.
2046
2047 You may safely delete it if you wish.
2048 EOF
2049
2050 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2051 case "$usedevel" in
2052 $define|true|[yY]*) ;;
2053 *) case "$xversion" in
2054    *[13579])
2055         cat >&4 <<EOH
2056 *** WHOA THERE!!! ***
2057
2058     This is an UNSTABLE DEVELOPMENT release.
2059     The version of this $package distribution is $xversion, that is, odd,
2060     (as opposed to even) and that signifies a development release.
2061     If you want a maintenance release, you want an even-numbered version.
2062
2063     Do ***NOT*** install this into production use.
2064     Data corruption and crashes are possible.
2065
2066     It is most seriously suggested that you do not continue any further
2067     unless you want to help in developing and debugging Perl.
2068
2069     If you *still* want to build perl, you can answer 'y' now,
2070     or pass -Dusedevel to Configure.
2071
2072 EOH
2073         rp='Do you really want to continue?'
2074         dflt='n'
2075         . ./myread
2076         case "$ans" in
2077         [yY]) echo >&4 "Okay, continuing."
2078               usedevel="$define" ;;
2079         *) echo >&4 "Okay, bye."
2080            exit 1
2081            ;;
2082         esac
2083         ;;
2084     esac
2085     ;;
2086 esac
2087 case "$usedevel" in
2088 $define|true|[yY]*)
2089         case "$versiononly" in
2090         '') versiononly="$define" ;;
2091         esac
2092         case "$installusrbinperl" in
2093         '') installusrbinperl="$undef" ;;
2094         esac
2095         ;;
2096 esac
2097
2098 : general instructions
2099 needman=true
2100 firsttime=true
2101 user=`(logname) 2>/dev/null`
2102 case "$user" in
2103 '') user=`whoami 2>&1`;;
2104 esac
2105 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2106         firsttime=false
2107         echo " "
2108         rp='Would you like to see the instructions?'
2109         dflt=n
2110         . ./myread
2111         case "$ans" in
2112         [yY]*) ;;
2113         *) needman=false;;
2114         esac
2115 fi
2116 if $needman; then
2117         cat <<EOH
2118
2119 This installation shell script will examine your system and ask you questions
2120 to determine how the perl5 package should be installed. If you get
2121 stuck on a question, you may use a ! shell escape to start a subshell or
2122 execute a command.  Many of the questions will have default answers in square
2123 brackets; typing carriage return will give you the default.
2124
2125 On some of the questions which ask for file or directory names you are allowed
2126 to use the ~name construct to specify the login directory belonging to "name",
2127 even if you don't have a shell which knows about that.  Questions where this is
2128 allowed will be marked "(~name ok)".
2129
2130 EOH
2131         rp=''
2132         dflt='Type carriage return to continue'
2133         . ./myread
2134         cat <<'EOH'
2135
2136 The prompter used in this script allows you to use shell variables and
2137 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2138 in the default answer, as if the default line was a set of arguments given to a
2139 script shell.  This means you may also use $* to repeat the whole default line,
2140 so you do not have to re-type everything to add something to the default.
2141
2142 Everytime there is a substitution, you will have to confirm.  If there is an
2143 error (e.g. an unmatched backtick), the default answer will remain unchanged
2144 and you will be prompted again.
2145
2146 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2147 the questions and use the computed defaults (or the previous answers if there
2148 was already a config.sh file). Type 'Configure -h' for a list of options.
2149 You may also start interactively and then answer '& -d' at any prompt to turn
2150 on the non-interactive behaviour for the remainder of the execution.
2151
2152 EOH
2153         . ./myread
2154         cat <<EOH
2155
2156 Much effort has been expended to ensure that this shell script will run on any
2157 Unix system.  If despite that it blows up on yours, your best bet is to edit
2158 Configure and run it again.  If you can't run Configure for some reason,
2159 you'll have to generate a config.sh file by hand.  Whatever problems you
2160 have, let me (perlbug@perl.org) know how I blew it.
2161
2162 This installation script affects things in two ways:
2163
2164 1) it may do direct variable substitutions on some of the files included
2165    in this kit.
2166 2) it builds a config.h file for inclusion in C programs.  You may edit
2167    any of these files as the need arises after running this script.
2168
2169 If you make a mistake on a question, there is no easy way to back up to it
2170 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2171 files.  Configure will offer to let you do this before it runs the SH files.
2172
2173 EOH
2174         dflt='Type carriage return to continue'
2175         . ./myread
2176         case "$firsttime" in
2177         true) echo $user >>../.config/instruct;;
2178         esac
2179 fi
2180
2181 : find out where common programs are
2182 echo " "
2183 echo "Locating common programs..." >&4
2184 cat <<EOSC >loc
2185 $startsh
2186 case \$# in
2187 0) exit 1;;
2188 esac
2189 thing=\$1
2190 shift
2191 dflt=\$1
2192 shift
2193 for dir in \$*; do
2194         case "\$thing" in
2195         .)
2196         if test -d \$dir/\$thing; then
2197                 echo \$dir
2198                 exit 0
2199         fi
2200         ;;
2201         *)
2202         for thisthing in \$dir/\$thing; do
2203                 : just loop through to pick last item
2204         done
2205         if test -f \$thisthing; then
2206                 echo \$thisthing
2207                 exit 0
2208         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2209                 echo \$thisthing
2210                 exit 0
2211         elif test -f \$dir/\$thing.exe; then
2212                 if test -n "$DJGPP"; then
2213                         echo \$dir/\$thing.exe
2214                 elif test "$eunicefix" != ":"; then
2215                         : on Eunice apparently
2216                         echo \$dir/\$thing
2217                         exit 0
2218                 fi
2219                 exit 0
2220         fi
2221         ;;
2222         esac
2223 done
2224 echo \$dflt
2225 exit 1
2226 EOSC
2227 chmod +x loc
2228 $eunicefix loc
2229 loclist="
2230 awk
2231 cat
2232 chmod
2233 comm
2234 cp
2235 echo
2236 expr
2237 grep
2238 ls
2239 mkdir
2240 rm
2241 sed
2242 sort
2243 touch
2244 tr
2245 uniq
2246 "
2247 trylist="
2248 Mcc
2249 ar
2250 bison
2251 byacc
2252 cpp
2253 csh
2254 date
2255 egrep
2256 gmake
2257 gzip
2258 less
2259 ln
2260 make
2261 more
2262 nm
2263 nroff
2264 pg
2265 test
2266 uname
2267 zip
2268 "
2269 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2270 pth="$pth /lib /usr/lib"
2271 for file in $loclist; do
2272         eval xxx=\$$file
2273         case "$xxx" in
2274         /*|?:[\\/]*)
2275                 if test -f "$xxx"; then
2276                         : ok
2277                 else
2278                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2279                         xxx=`./loc $file $file $pth`
2280                 fi
2281                 ;;
2282         '') xxx=`./loc $file $file $pth`;;
2283         *) xxx=`./loc $xxx $xxx $pth`;;
2284         esac
2285         eval $file=$xxx$_exe
2286         eval _$file=$xxx
2287         case "$xxx" in
2288         /*)
2289                 echo $file is in $xxx.
2290                 ;;
2291         ?:[\\/]*)
2292                 echo $file is in $xxx.
2293                 ;;
2294         *)
2295                 echo "I don't know where '$file' is, and my life depends on it." >&4
2296                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2297                 exit 1
2298                 ;;
2299         esac
2300 done
2301 echo " "
2302 echo "Don't worry if any of the following aren't found..."
2303 say=offhand
2304 for file in $trylist; do
2305         eval xxx=\$$file
2306         case "$xxx" in
2307         /*|?:[\\/]*)
2308                 if test -f "$xxx"; then
2309                         : ok
2310                 else
2311                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2312                         xxx=`./loc $file $file $pth`
2313                 fi
2314                 ;;
2315         '') xxx=`./loc $file $file $pth`;;
2316         *) xxx=`./loc $xxx $xxx $pth`;;
2317         esac
2318         eval $file=$xxx$_exe
2319         eval _$file=$xxx
2320         case "$xxx" in
2321         /*)
2322                 echo $file is in $xxx.
2323                 ;;
2324         ?:[\\/]*)
2325                 echo $file is in $xxx.
2326                 ;;
2327         *)
2328                 echo "I don't see $file out there, $say."
2329                 say=either
2330                 ;;
2331         esac
2332 done
2333 case "$egrep" in
2334 egrep)
2335         echo "Substituting grep for egrep."
2336         egrep=$grep
2337         _egrep=$grep
2338         ;;
2339 esac
2340 case "$ln" in
2341 ln)
2342         echo "Substituting cp for ln."
2343         ln=$cp
2344         _ln=$cp
2345         ;;
2346 esac
2347 case "$make" in
2348 make)   
2349         case "$gmake" in
2350         gmake)
2351         echo "I can't find make or gmake, and my life depends on it." >&4
2352         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2353         exit 1
2354         ;;
2355         esac
2356         ;;
2357 esac    
2358 case "$gmake" in
2359 gmake)  ;;
2360 *)      # We can't have osname yet.
2361         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2362                 # Assume that gmake, if found, is definitely GNU make
2363                 # and prefer it over the system make.
2364                 echo "Substituting gmake for make."
2365                 make=$gmake
2366                 _make=$gmake
2367         fi
2368         ;;
2369 esac
2370 case "$test" in
2371 test)
2372         echo "Hopefully test is built into your sh."
2373         ;;
2374 *)
2375         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2376                 echo "Using the test built into your sh."
2377                 test=test
2378                 _test=test
2379         fi
2380         ;;
2381 esac
2382 case "$echo" in
2383 echo)
2384         echo "Hopefully echo is built into your sh."
2385         ;;
2386 '') ;;
2387 *)
2388         echo " "
2389 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2390         $echo $n "hi there$c" >foo1
2391         echo $n "hi there$c" >foo2
2392         if cmp foo1 foo2 >/dev/null 2>&1; then
2393                 echo "They are compatible.  In fact, they may be identical."
2394         else
2395                 case "$n" in
2396                 '-n') n='' c='\c';;
2397                 *) n='-n' c='';;
2398                 esac
2399                 cat <<FOO
2400 They are not compatible!  You are probably running ksh on a non-USG system.
2401 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2402 have echo built in and we may have to run some Bourne shell scripts.  That
2403 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2404
2405 FOO
2406                 $echo $n "The star should be here-->$c"
2407                 $echo "*"
2408         fi
2409         $rm -f foo1 foo2
2410         ;;
2411 esac
2412
2413 cat <<EOS >trygcc
2414 $startsh
2415 EOS
2416 cat <<'EOSC' >>trygcc
2417 case "$cc" in
2418 '') ;;
2419 *)  $rm -f try try.*
2420     $cat >try.c <<EOM
2421 int main(int argc, char *argv[]) {
2422   return 0;
2423 }
2424 EOM
2425     if $cc -o try $ccflags $ldflags try.c; then
2426        :
2427     else
2428         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2429         despair=yes
2430         trygcc=yes
2431         case "$cc" in
2432         *gcc*) trygcc=no ;;
2433         esac
2434         case "`$cc -v -c try.c 2>&1`" in
2435         *gcc*) trygcc=no ;;
2436         esac
2437         if $test X"$trygcc" = Xyes; then
2438             if gcc -o try -c try.c; then
2439                 echo " "
2440                 echo "You seem to have a working gcc, though." >&4
2441                 rp="Would you like to use it?"
2442                 dflt=y
2443                 if $test -f myread; then
2444                     . ./myread
2445                 else
2446                     if $test -f UU/myread; then
2447                         . ./UU/myread
2448                     else
2449                         echo "Cannot find myread, sorry.  Aborting." >&2
2450                         exit 1
2451                     fi
2452                 fi  
2453                 case "$ans" in
2454                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2455                        if $test -f usethreads.cbu; then
2456                            $cat >&4 <<EOM 
2457
2458 *** However, any setting of the C compiler flags (e.g. for thread support)
2459 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2460 *** (together with e.g. -Dusethreads).
2461
2462 EOM
2463                        fi;;
2464                 esac
2465             fi
2466         fi
2467     fi
2468     $rm -f try try.*
2469     ;;
2470 esac
2471 EOSC
2472
2473 cat <<EOS >checkcc
2474 $startsh
2475 EOS
2476 cat <<'EOSC' >>checkcc
2477 case "$cc" in        
2478 '') ;;
2479 *)  $rm -f try try.*              
2480     $cat >try.c <<EOM
2481 int main(int argc, char *argv[]) {
2482   return 0;
2483 }
2484 EOM
2485     if $cc -o try $ccflags $ldflags try.c; then
2486        :
2487     else
2488         if $test X"$despair" = Xyes; then
2489            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2490         fi
2491         $cat >&4 <<EOM         
2492 You need to find a working C compiler.
2493 Either (purchase and) install the C compiler supplied by your OS vendor,
2494 or for a free C compiler try http://gcc.gnu.org/
2495 I cannot continue any further, aborting.
2496 EOM
2497         exit 1
2498     fi
2499     $rm -f try try.*
2500     ;;
2501 esac
2502 EOSC
2503
2504 : determine whether symbolic links are supported
2505 echo " "
2506 $touch blurfl
2507 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2508         echo "Symbolic links are supported." >&4
2509         lns="$ln -s"
2510 else
2511         echo "Symbolic links are NOT supported." >&4
2512         lns="$ln"
2513 fi
2514 $rm -f blurfl sym
2515
2516 : determine whether symbolic links are supported
2517 echo " "
2518 case "$lns" in
2519 *"ln"*" -s")
2520         echo "Checking how to test for symbolic links..." >&4
2521         $lns blurfl sym
2522         if $test "X$issymlink" = X; then
2523                 case "$newsh" in
2524                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2525                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2526                 esac
2527                 if test $? = 0; then
2528                         issymlink="test -h"
2529                 else
2530                         echo "Your builtin 'test -h' may be broken." >&4
2531                         case "$test" in
2532                         /*)     ;;
2533                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2534                                 for p in $pth
2535                                 do
2536                                         if test -f "$p/$test"; then
2537                                                 test="$p/$test"
2538                                                 break
2539                                         fi
2540                                 done
2541                                 ;;
2542                         esac
2543                         case "$test" in
2544                         /*)
2545                                 echo "Trying external '$test -h'." >&4
2546                                 issymlink="$test -h"
2547                                 if $test ! -h sym >/dev/null 2>&1; then
2548                                         echo "External '$test -h' is broken, too." >&4
2549                                         issymlink=''
2550                                 fi
2551                                 ;;
2552                         *)      issymlink='' ;;
2553                         esac
2554                 fi              
2555         fi
2556         if $test "X$issymlink" = X; then
2557                 if $test -L sym 2>/dev/null; then
2558                         issymlink="$test -L"
2559                         echo "The builtin '$test -L' worked." >&4
2560                 fi
2561         fi
2562         if $test "X$issymlink" != X; then
2563                 echo "You can test for symbolic links with '$issymlink'." >&4
2564         else
2565                 echo "I do not know how you can test for symbolic links." >&4
2566         fi
2567         $rm -f blurfl sym
2568         ;;
2569 *)      echo "No symbolic links, so not testing for their testing..." >&4
2570         ;;
2571 esac
2572 echo " "
2573
2574
2575 case "$mksymlinks" in
2576 $define|true|[yY]*)
2577         case "$src" in
2578         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2579                 exit 1
2580                 ;;
2581         *)      case "$lns:$issymlink" in
2582                 *"ln"*" -s:"*"test -"?)
2583                         echo "Creating the symbolic links..." >&4
2584                         echo "(First creating the subdirectories...)" >&4
2585                         cd ..
2586                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2587                                 read directory
2588                                 test -z "$directory" && break
2589                                 mkdir -p $directory
2590                         done
2591                         # Sanity check 1.
2592                         if test ! -d t/base; then
2593                                 echo "Failed to create the subdirectories.  Aborting." >&4
2594                                 exit 1
2595                         fi
2596                         echo "(Then creating the symlinks...)" >&4
2597                         awk '{print $1}' $src/MANIFEST | while true; do
2598                                 read filename
2599                                 test -z "$filename" && break
2600                                 if test -f $filename; then
2601                                         if $issymlink $filename; then
2602                                                 rm -f $filename
2603                                         fi
2604                                 fi
2605                                 if test -f $filename; then
2606                                         echo "$filename already exists, not symlinking."
2607                                 else
2608                                         ln -s $src/$filename $filename
2609                                 fi
2610                         done
2611                         # Sanity check 2.
2612                         if test ! -f t/base/lex.t; then
2613                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2614                                 exit 1
2615                         fi
2616                         cd UU
2617                         ;;
2618                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2619                         ;;
2620                 esac
2621                 ;;
2622         esac
2623         ;;
2624 esac
2625
2626
2627 case "$usecrosscompile" in
2628 $define|true|[yY]*)
2629         $echo "Cross-compiling..."
2630         croak=''
2631         case "$cc" in
2632         *-*-gcc) # A cross-compiling gcc, probably.
2633             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2634             ar=$targetarch-ar
2635             # leave out ld, choosing it is more complex
2636             nm=$targetarch-nm
2637             ranlib=$targetarch-ranlib
2638             $echo 'extern int foo;' > try.c
2639             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2640             shift
2641             if $test $# -gt 0; then
2642                 incpth="$incpth $*"
2643                 incpth="`$echo $incpth|$sed 's/^ //'`"
2644                 echo "Guessing incpth '$incpth'." >&4
2645                 for i in $*; do
2646                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2647                     if $test -d $j; then
2648                         libpth="$libpth $j"
2649                     fi
2650                 done   
2651                 libpth="`$echo $libpth|$sed 's/^ //'`"
2652                 echo "Guessing libpth '$libpth'." >&4
2653             fi
2654             $rm -f try.c
2655             ;;
2656         esac
2657         case "$targetarch" in
2658         '') echo "Targetarch not defined." >&4; croak=y ;;
2659         *)  echo "Using targetarch $targetarch." >&4 ;;
2660         esac
2661         case "$incpth" in
2662         '') echo "Incpth not defined." >&4; croak=y ;;
2663         *)  echo "Using incpth '$incpth'." >&4 ;;
2664         esac
2665         case "$libpth" in
2666         '') echo "Libpth not defined." >&4; croak=y ;;
2667         *)  echo "Using libpth '$libpth'." >&4 ;;
2668         esac
2669         case "$usrinc" in
2670         '') for i in $incpth; do
2671                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2672                     usrinc=$i
2673                     echo "Guessing usrinc $usrinc." >&4
2674                     break
2675                 fi
2676             done
2677             case "$usrinc" in
2678             '') echo "Usrinc not defined." >&4; croak=y ;;
2679             esac
2680             ;;
2681         *)  echo "Using usrinc $usrinc." >&4 ;;
2682         esac
2683         case "$targethost" in
2684         '') echo "Targethost not defined." >&4; croak=y ;;
2685         *)  echo "Using targethost $targethost." >&4
2686         esac
2687         locincpth=' '
2688         loclibpth=' '
2689         case "$croak" in
2690         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2691         esac
2692         case "$src" in
2693         /*) run=$src/Cross/run
2694             targetmkdir=$src/Cross/mkdir
2695             to=$src/Cross/to
2696             from=$src/Cross/from
2697             ;;
2698         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2699             run=$pwd/Cross/run
2700             targetmkdir=$pwd/Cross/mkdir
2701             to=$pwd/Cross/to
2702             from=$pwd/Cross/from
2703             ;;
2704         esac
2705         case "$targetrun" in
2706         '') targetrun=ssh ;;
2707         esac
2708         case "$targetto" in
2709         '') targetto=scp ;;
2710         esac
2711         case "$targetfrom" in
2712         '') targetfrom=scp ;;
2713         esac
2714         run=$run-$targetrun
2715         to=$to-$targetto
2716         from=$from-$targetfrom
2717         case "$targetdir" in
2718         '')  targetdir=/tmp
2719              echo "Guessing targetdir $targetdir." >&4
2720              ;;
2721         esac
2722         case "$targetuser" in
2723         '')  targetuser=root
2724              echo "Guessing targetuser $targetuser." >&4
2725              ;;
2726         esac
2727         case "$targetfrom" in
2728         scp)    q=-q ;;
2729         *)      q='' ;;
2730         esac
2731         case "$targetrun" in
2732         ssh|rsh)
2733             cat >$run <<EOF
2734 #!/bin/sh
2735 case "\$1" in
2736 -cwd)
2737   shift
2738   cwd=\$1
2739   shift
2740   ;;
2741 esac
2742 case "\$cwd" in
2743 '') cwd=$targetdir ;;
2744 esac
2745 exe=\$1
2746 shift
2747 if $test ! -f \$exe.xok; then
2748   $to \$exe
2749   $touch \$exe.xok
2750 fi
2751 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2752 EOF
2753             ;;
2754         *)  echo "Unknown targetrun '$targetrun'" >&4
2755             exit 1
2756             ;;
2757         esac
2758         case "$targetmkdir" in
2759         */Cross/mkdir)
2760             cat >$targetmkdir <<EOF
2761 #!/bin/sh
2762 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2763 EOF
2764             $chmod a+rx $targetmkdir
2765             ;;
2766         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2767             exit 1
2768             ;;
2769         esac
2770         case "$targetto" in
2771         scp|rcp)
2772             cat >$to <<EOF
2773 #!/bin/sh
2774 for f in \$@
2775 do
2776   case "\$f" in
2777   /*)
2778     $targetmkdir \`dirname \$f\`
2779     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2780     ;;
2781   *)
2782     $targetmkdir $targetdir/\`dirname \$f\`
2783     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2784     ;;
2785   esac
2786 done
2787 exit 0
2788 EOF
2789             ;;
2790         cp) cat >$to <<EOF
2791 #!/bin/sh
2792 for f in \$@
2793 do
2794   case "\$f" in
2795   /*)
2796     $mkdir -p $targetdir/\`dirname \$f\`
2797     $cp \$f $targetdir/\$f || exit 1
2798     ;;
2799   *)
2800     $targetmkdir $targetdir/\`dirname \$f\`
2801     $cp \$f $targetdir/\$f || exit 1
2802     ;;
2803   esac
2804 done
2805 exit 0
2806 EOF
2807             ;;
2808         *)  echo "Unknown targetto '$targetto'" >&4
2809             exit 1
2810             ;;
2811         esac
2812         case "$targetfrom" in
2813         scp|rcp)
2814           cat >$from <<EOF
2815 #!/bin/sh
2816 for f in \$@
2817 do
2818   $rm -f \$f
2819   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2820 done
2821 exit 0
2822 EOF
2823             ;;
2824         cp) cat >$from <<EOF
2825 #!/bin/sh
2826 for f in \$@
2827 do
2828   $rm -f \$f
2829   cp $targetdir/\$f . || exit 1
2830 done
2831 exit 0
2832 EOF
2833             ;;
2834         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2835             exit 1
2836             ;;
2837         esac
2838         if $test ! -f $run; then
2839             echo "Target 'run' script '$run' not found." >&4
2840         else
2841             $chmod a+rx $run
2842         fi
2843         if $test ! -f $to; then
2844             echo "Target 'to' script '$to' not found." >&4
2845         else
2846             $chmod a+rx $to
2847         fi
2848         if $test ! -f $from; then
2849             echo "Target 'from' script '$from' not found." >&4
2850         else
2851             $chmod a+rx $from
2852         fi
2853         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2854             exit 1
2855         fi
2856         cat >&4 <<EOF
2857 Using '$run' for remote execution,
2858 and '$from' and '$to'
2859 for remote file transfer.
2860 EOF
2861         ;;
2862 *)      run=''
2863         to=:
2864         from=:
2865         usecrosscompile='undef'
2866         targetarch=''
2867         ;;
2868 esac
2869
2870 : see whether [:lower:] and [:upper:] are supported character classes
2871 echo " "
2872 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2873 ABYZ)
2874         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2875         up='[:upper:]'
2876         low='[:lower:]'
2877         ;;
2878 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2879         # (0xc9 and 0xd1), therefore that is a nice testing point.
2880         if test "X$up" = X -o "X$low" = X; then
2881             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2882             ij) up='[A-Z]'
2883                 low='[a-z]'
2884                 ;;
2885             esac
2886         fi
2887         if test "X$up" = X -o "X$low" = X; then
2888             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2889             ij) up='A-Z'
2890                 low='a-z'
2891                 ;;
2892             esac
2893         fi
2894         if test "X$up" = X -o "X$low" = X; then
2895             case "`echo IJ | od -x 2>/dev/null`" in
2896             *C9D1*|*c9d1*)
2897                 echo "Hey, this might be EBCDIC." >&4
2898                 if test "X$up" = X -o "X$low" = X; then
2899                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2900                     ij) up='[A-IJ-RS-Z]'
2901                         low='[a-ij-rs-z]'
2902                         ;;
2903                     esac
2904                 fi
2905                 if test "X$up" = X -o "X$low" = X; then
2906                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2907                     ij) up='A-IJ-RS-Z'
2908                         low='a-ij-rs-z'
2909                         ;;
2910                     esac
2911                 fi
2912                 ;;
2913             esac
2914         fi
2915 esac
2916 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2917 ij)
2918     echo "Using $up and $low to convert case." >&4
2919     ;;
2920 *)
2921     echo "I don't know how to translate letters from upper to lower case." >&4
2922     echo "Your tr is not acting any way I know of." >&4
2923     exit 1
2924     ;;
2925 esac
2926 : set up the translation script tr, must be called with ./tr of course
2927 cat >tr <<EOSC
2928 $startsh
2929 case "\$1\$2" in
2930 '[A-Z][a-z]') exec $tr '$up' '$low';;
2931 '[a-z][A-Z]') exec $tr '$low' '$up';;
2932 esac
2933 exec $tr "\$@"
2934 EOSC
2935 chmod +x tr
2936 $eunicefix tr
2937
2938 : Try to determine whether config.sh was made on this system
2939 case "$config_sh" in
2940 '')
2941 myuname=`$uname -a 2>/dev/null`
2942 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2943 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2944 # because the A-Z/a-z are not consecutive.
2945 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2946         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2947 newmyuname="$myuname"
2948 dflt=n
2949 case "$knowitall" in
2950 '')
2951         if test -f ../config.sh; then
2952                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2953                         eval "`grep myuname= ../config.sh`"
2954                 fi
2955                 if test "X$myuname" = "X$newmyuname"; then
2956                         dflt=y
2957                 fi
2958         fi
2959         ;;
2960 *) dflt=y;;
2961 esac
2962
2963 : Get old answers from old config file if Configure was run on the
2964 : same system, otherwise use the hints.
2965 hint=default
2966 cd ..
2967 if test -f config.sh; then
2968         echo " "
2969         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2970         . UU/myread
2971         case "$ans" in
2972         n*|N*) echo "OK, I'll ignore it."
2973                 mv config.sh config.sh.old
2974                 myuname="$newmyuname"
2975                 ;;
2976         *)  echo "Fetching default answers from your old config.sh file..." >&4
2977                 tmp_n="$n"
2978                 tmp_c="$c"
2979                 tmp_sh="$sh"
2980                 . ./config.sh
2981                 cp config.sh UU
2982                 n="$tmp_n"
2983                 c="$tmp_c"
2984                 : Older versions did not always set $sh.  Catch re-use of such
2985                 : an old config.sh.
2986                 case "$sh" in
2987                 '') sh="$tmp_sh" ;;
2988                 esac
2989                 hint=previous
2990                 ;;
2991         esac
2992 fi
2993 . ./UU/checkcc
2994 if test ! -f config.sh; then
2995         $cat <<EOM
2996
2997 First time through, eh?  I have some defaults handy for some systems
2998 that need some extra help getting the Configure answers right:
2999
3000 EOM
3001         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3002         dflt=''
3003         : Half the following guesses are probably wrong... If you have better
3004         : tests or hints, please send them to perlbug@perl.org
3005         : The metaconfig authors would also appreciate a copy...
3006         $test -f /irix && osname=irix
3007         $test -f /xenix && osname=sco_xenix
3008         $test -f /dynix && osname=dynix
3009         $test -f /dnix && osname=dnix
3010         $test -f /lynx.os && osname=lynxos
3011         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3012         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3013         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3014         $test -f /bin/mips && /bin/mips && osname=mips
3015         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3016                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3017         $test -d /usr/apollo/bin && osname=apollo
3018         $test -f /etc/saf/_sactab && osname=svr4
3019         $test -d /usr/include/minix && osname=minix
3020         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3021         if $test -d /MachTen -o -d /MachTen_Folder; then
3022                 osname=machten
3023                 if $test -x /sbin/version; then
3024                         osvers=`/sbin/version | $awk '{print $2}' |
3025                         $sed -e 's/[A-Za-z]$//'`
3026                 elif $test -x /usr/etc/version; then
3027                         osvers=`/usr/etc/version | $awk '{print $2}' |
3028                         $sed -e 's/[A-Za-z]$//'`
3029                 else
3030                         osvers="$2.$3"
3031                 fi
3032         fi
3033
3034         $test -f /sys/posix.dll &&
3035                 $test -f /usr/bin/what &&
3036                 set X `/usr/bin/what /sys/posix.dll` &&
3037                 $test "$3" = UWIN &&
3038                 osname=uwin &&
3039                 osvers="$5"
3040
3041         if $test -f $uname; then
3042                 set X $myuname
3043                 shift
3044
3045                 case "$5" in
3046                 fps*) osname=fps ;;
3047                 mips*)
3048                         case "$4" in
3049                         umips) osname=umips ;;
3050                         *) osname=mips ;;
3051                         esac;;
3052                 [23]100) osname=mips ;;
3053                 next*) osname=next ;;
3054                 i386*)
3055                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3056                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3057                                 osname='sco'
3058                                 osvers=$tmp
3059                         elif $test -f /etc/kconfig; then
3060                                 osname=isc
3061                                 if test "$lns" = "$ln -s"; then
3062                                         osvers=4
3063                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3064                                         osvers=3
3065                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3066                                         osvers=2
3067                                 fi
3068                         fi
3069                         tmp=''
3070                         ;;
3071                 pc*)
3072                         if test -n "$DJGPP"; then
3073                                 osname=dos
3074                                 osvers=djgpp
3075                         fi
3076                         ;;
3077                 esac
3078
3079                 case "$1" in
3080                 aix) osname=aix
3081                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3082                         case "$tmp" in
3083                         'not found') osvers="$4"."$3" ;;
3084                         '<3240'|'<>3240') osvers=3.2.0 ;;
3085                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3086                         '=3250'|'>3250') osvers=3.2.5 ;;
3087                         *) osvers=$tmp;;
3088                         esac
3089                         ;;
3090                 bsd386) osname=bsd386
3091                         osvers=`$uname -r`
3092                         ;;
3093                 cygwin*) osname=cygwin
3094                         osvers="$3"
3095                         ;;
3096                 *dc.osx) osname=dcosx
3097                         osvers="$3"
3098                         ;;
3099                 dnix) osname=dnix
3100                         osvers="$3"
3101                         ;;
3102                 domainos) osname=apollo
3103                         osvers="$3"
3104                         ;;
3105                 dgux) osname=dgux 
3106                         osvers="$3"
3107                         ;;
3108                 dynixptx*) osname=dynixptx
3109                         osvers=`echo "$4"|sed 's/^v//'`
3110                         ;;
3111                 freebsd) osname=freebsd 
3112                         osvers="$3" ;;
3113                 genix) osname=genix ;;
3114                 hp*) osname=hpux 
3115                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3116                         ;;
3117                 irix*) osname=irix
3118                         case "$3" in
3119                         4*) osvers=4 ;;
3120                         5*) osvers=5 ;;
3121                         *)      osvers="$3" ;;
3122                         esac
3123                         ;;
3124                 linux) osname=linux
3125                         case "$3" in
3126                         *)      osvers="$3" ;;
3127                         esac
3128                         ;;
3129                 MiNT) osname=mint
3130                         ;;
3131                 netbsd*) osname=netbsd
3132                         osvers="$3"
3133                         ;;
3134                 news-os) osvers="$3"
3135                         case "$3" in
3136                         4*) osname=newsos4 ;;
3137                         *) osname=newsos ;;
3138                         esac
3139                         ;;
3140                 next*) osname=next ;;
3141                 nonstop-ux) osname=nonstopux ;;
3142                 openbsd) osname=openbsd
3143                         osvers="$3"
3144                         ;;
3145                 os2)    osname=os2
3146                         osvers="$4"
3147                         ;;
3148                 POSIX-BC | posix-bc ) osname=posix-bc
3149                         osvers="$3"
3150                         ;;
3151                 powerux | power_ux | powermax_os | powermaxos | \
3152                 powerunix | power_unix) osname=powerux
3153                         osvers="$3"
3154                         ;;
3155                 qnx) osname=qnx
3156                         osvers="$4"
3157                         ;;
3158                 solaris) osname=solaris
3159                         case "$3" in
3160                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3161                         *)      osvers="$3" ;;
3162                         esac
3163                         ;;
3164                 sunos) osname=sunos
3165                         case "$3" in
3166                         5*) osname=solaris
3167                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3168                         *)      osvers="$3" ;;
3169                         esac
3170                         ;;
3171                 titanos) osname=titanos
3172                         case "$3" in
3173                         1*) osvers=1 ;;
3174                         2*) osvers=2 ;;
3175                         3*) osvers=3 ;;
3176                         4*) osvers=4 ;;
3177                         *)      osvers="$3" ;;
3178                         esac
3179                         ;;
3180                 ultrix) osname=ultrix
3181                         osvers="$3"
3182                         ;;
3183                 osf1|mls+)      case "$5" in
3184                                 alpha)
3185                                         osname=dec_osf
3186                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3187                                         case "$osvers" in
3188                                         [1-9].[0-9]*) ;;
3189                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3190                                         esac
3191                                         ;;
3192                         hp*)    osname=hp_osf1  ;;
3193                         mips)   osname=mips_osf1 ;;
3194                         esac
3195                         ;;
3196                 unixware) osname=svr5
3197                         osvers="$4"
3198                         ;;
3199                 uts)    osname=uts
3200                         osvers="$3"
3201                         ;;
3202                 vos) osvers="$3"
3203                         ;;
3204                 $2) case "$osname" in
3205                         *isc*) ;;
3206                         *freebsd*) ;;
3207                         svr*)
3208                                 : svr4.x or possibly later
3209                                 case "svr$3" in 
3210                                 ${osname}*)
3211                                         osname=svr$3
3212                                         osvers=$4
3213                                         ;;
3214                                 esac
3215                                 case "$osname" in
3216                                 svr4.0)
3217                                         : Check for ESIX
3218                                         if test -f /stand/boot ; then
3219                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3220                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3221                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3222                                                         if test -n "$isesix"; then
3223                                                                 osname=esix4
3224                                                         fi
3225                                                 fi
3226                                         fi
3227                                         ;;
3228                                 esac
3229                                 ;;
3230                         *)      if test -f /etc/systemid; then
3231                                         osname=sco
3232                                         set `echo $3 | $sed 's/\./ /g'` $4
3233                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3234                                                 osvers=$1.$2.$3
3235                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3236                                                 osvers=$1.$2
3237                                         elif $test -f $src/hints/sco_$1.sh; then
3238                                                 osvers=$1
3239                                         fi
3240                                 else
3241                                         case "$osname" in
3242                                         '') : Still unknown.  Probably a generic Sys V.
3243                                                 osname="sysv"
3244                                                 osvers="$3"
3245                                                 ;;
3246                                         esac
3247                                 fi
3248                                 ;;
3249                         esac
3250                         ;;
3251                 *)      case "$osname" in
3252                         '') : Still unknown.  Probably a generic BSD.
3253                                 osname="$1"
3254                                 osvers="$3"
3255                                 ;;
3256                         esac
3257                         ;;
3258                 esac
3259         else
3260                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3261                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3262                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3263                                 osname=news_os
3264                         fi
3265                         $rm -f UU/kernel.what
3266                 elif test -d c:/. -o -n "$is_os2" ; then
3267                         set X $myuname
3268                         osname=os2
3269                         osvers="$5"
3270                 fi
3271         fi
3272         
3273         case "$targetarch" in
3274         '') ;;
3275         *)  hostarch=$osname
3276             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3277             osvers=''
3278             ;;
3279         esac
3280
3281         : Now look for a hint file osname_osvers, unless one has been
3282         : specified already.
3283         case "$hintfile" in
3284         ''|' ')
3285                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3286                 : Also try without trailing minor version numbers.
3287                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3288                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3289                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3290                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3291                 case "$file" in
3292                 '') dflt=none ;;
3293                 *)  case "$osvers" in
3294                         '') dflt=$file
3295                                 ;;
3296                         *)  if $test -f $src/hints/$file.sh ; then
3297                                         dflt=$file
3298                                 elif $test -f $src/hints/$xfile.sh ; then
3299                                         dflt=$xfile
3300                                 elif $test -f $src/hints/$xxfile.sh ; then
3301                                         dflt=$xxfile
3302                                 elif $test -f $src/hints/$xxxfile.sh ; then
3303                                         dflt=$xxxfile
3304                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3305                                         dflt=$xxxxfile
3306                                 elif $test -f "$src/hints/${osname}.sh" ; then
3307                                         dflt="${osname}"
3308                                 else
3309                                         dflt=none
3310                                 fi
3311                                 ;;
3312                         esac
3313                         ;;
3314                 esac
3315                 if $test -f Policy.sh ; then
3316                         case "$dflt" in
3317                         *Policy*) ;;
3318                         none) dflt="Policy" ;;
3319                         *) dflt="Policy $dflt" ;;
3320                         esac
3321                 fi
3322                 ;;
3323         *)
3324                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3325                 ;;
3326         esac
3327
3328         if $test -f Policy.sh ; then
3329                 $cat <<EOM
3330
3331 There's also a Policy hint file available, which should make the
3332 site-specific (policy) questions easier to answer.
3333 EOM
3334
3335         fi
3336
3337         $cat <<EOM
3338
3339 You may give one or more space-separated answers, or "none" if appropriate.
3340 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3341 is a good thing.  DO NOT give a wrong version or a wrong OS.
3342
3343 EOM
3344
3345         rp="Which of these apply, if any?"
3346         . UU/myread
3347         tans=$ans
3348         for file in $tans; do
3349                 if $test X$file = XPolicy -a -f Policy.sh; then
3350                         . Policy.sh
3351                         $cat Policy.sh >> UU/config.sh
3352                 elif $test -f $src/hints/$file.sh; then
3353                         . $src/hints/$file.sh
3354                         $cat $src/hints/$file.sh >> UU/config.sh
3355                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3356                         : nothing
3357                 else
3358                         : Give one chance to correct a possible typo.
3359                         echo "$file.sh does not exist"
3360                         dflt=$file
3361                         rp="hint to use instead?"
3362                         . UU/myread
3363                         for file in $ans; do
3364                                 if $test -f "$src/hints/$file.sh"; then
3365                                         . $src/hints/$file.sh
3366                                         $cat $src/hints/$file.sh >> UU/config.sh
3367                                 elif $test X$ans = X -o X$ans = Xnone ; then
3368                                         : nothing
3369                                 else
3370                                         echo "$file.sh does not exist -- ignored."
3371                                 fi
3372                         done
3373                 fi
3374         done
3375
3376         hint=recommended
3377         : Remember our hint file for later.
3378         if $test -f "$src/hints/$file.sh" ; then
3379                 hintfile="$file"
3380         else
3381                 hintfile=''
3382         fi
3383 fi
3384 cd UU
3385 ;;
3386 *)
3387         echo " "
3388         echo "Fetching default answers from $config_sh..." >&4
3389         tmp_n="$n"
3390         tmp_c="$c"
3391         cd ..
3392         cp $config_sh config.sh 2>/dev/null
3393         chmod +w config.sh
3394         . ./config.sh
3395         cd UU
3396         cp ../config.sh .
3397         n="$tmp_n"
3398         c="$tmp_c"
3399         hint=previous
3400         ;;
3401 esac
3402 test "$override" && . ./optdef.sh
3403
3404 : Restore computed paths
3405 for file in $loclist $trylist; do
3406         eval $file="\$_$file"
3407 done
3408
3409 cat << EOM
3410
3411 Configure uses the operating system name and version to set some defaults.
3412 The default value is probably right if the name rings a bell. Otherwise,
3413 since spelling matters for me, either accept the default or answer "none"
3414 to leave it blank.
3415
3416 EOM
3417 case "$osname" in
3418         ''|' ')
3419                 case "$hintfile" in
3420                 ''|' '|none) dflt=none ;;
3421                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3422                 esac
3423                 ;;
3424         *) dflt="$osname" ;;
3425 esac
3426 rp="Operating system name?"
3427 . ./myread
3428 case "$ans" in
3429 none)  osname='' ;;
3430 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3431 esac
3432 echo " "
3433 case "$osvers" in
3434         ''|' ')
3435                 case "$hintfile" in
3436                 ''|' '|none) dflt=none ;;
3437                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3438                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3439                         case "$dflt" in
3440                         ''|' ') dflt=none ;;
3441                         esac
3442                         ;;
3443                 esac
3444                 ;;
3445         *) dflt="$osvers" ;;
3446 esac
3447 rp="Operating system version?"
3448 . ./myread
3449 case "$ans" in
3450 none)  osvers='' ;;
3451 *) osvers="$ans" ;;
3452 esac
3453
3454
3455 . ./posthint.sh
3456
3457 : who configured the system
3458 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3459 cf_by=`(logname) 2>/dev/null`
3460 case "$cf_by" in
3461 "")
3462         cf_by=`(whoami) 2>/dev/null`
3463         case "$cf_by" in
3464         "") cf_by=unknown ;;
3465         esac ;;
3466 esac
3467
3468 : set up the script used to warn in case of inconsistency
3469 cat <<EOS >whoa
3470 $startsh
3471 EOS
3472 cat <<'EOSC' >>whoa
3473 dflt=y
3474 echo " "
3475 echo "*** WHOA THERE!!! ***" >&4
3476 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3477 rp="    Keep the $hint value?"
3478 . ./myread
3479 case "$ans" in
3480 y) td=$was; tu=$was;;
3481 esac
3482 EOSC
3483
3484 : function used to set $1 to $val
3485 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3486 case "$val$was" in
3487 $define$undef) . ./whoa; eval "$var=\$td";;
3488 $undef$define) . ./whoa; eval "$var=\$tu";;
3489 *) eval "$var=$val";;
3490 esac'
3491
3492 case "$usesocks" in
3493 $define|true|[yY]*)     dflt='y';;
3494 *) dflt='n';;
3495 esac
3496 cat <<EOM
3497
3498 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3499 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3500 to use the PerlIO abstraction layer, this will be implicitly selected.
3501
3502 If this doesn't make any sense to you, just accept the default '$dflt'.
3503 EOM
3504 rp='Build Perl for SOCKS?'
3505 . ./myread
3506 case "$ans" in
3507 y|Y)    val="$define" ;;     
3508 *)      val="$undef" ;;
3509 esac
3510 set usesocks
3511 eval $setvar
3512
3513 case "$usesocks" in
3514 $define|true|[yY]*) useperlio="$define";;
3515 esac
3516
3517 case "$useperlio" in
3518 $define|true|[yY]*|'')  dflt='y';;
3519 *) dflt='n';;
3520 esac
3521 cat <<EOM
3522
3523 Previous version of $package used the standard IO mechanisms as
3524 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3525 alternate IO mechanisms via the PerlIO abstraction layer, but the
3526 stdio mechanism is still available if needed.  The abstraction layer
3527 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3528 Using PerlIO with sfio may cause problems with some extension modules.
3529
3530 If this doesn't make any sense to you, just accept the default '$dflt'.
3531 EOM
3532 rp='Use the PerlIO abstraction layer?'
3533 . ./myread
3534 case "$ans" in
3535 y|Y) 
3536         val="$define"
3537         ;;
3538 *)      
3539         echo "Ok, doing things the stdio way."
3540         val="$undef"
3541         ;;
3542 esac
3543 set useperlio
3544 eval $setvar 
3545
3546 case "$usesocks" in
3547 $define|true|[yY]*)
3548         case "$useperlio" in
3549         $define|true|[yY]*) ;;
3550         *)      cat >&4 <<EOM
3551
3552 You are using the SOCKS proxy protocol library which means that you
3553 should also use the PerlIO layer.  You may be headed for trouble.
3554
3555 EOM
3556                 ;;
3557         esac
3558         ;;
3559 esac
3560
3561         
3562 case "$usethreads" in
3563 $define|true|[yY]*)     dflt='y';;
3564 *)     # Catch case where user specified ithreads or 5005threads but
3565        # forgot -Dusethreads (A.D. 4/2002)
3566        case "$useithreads$use5005threads" in
3567        *$define*)      
3568                 case "$useperlio" in
3569                 "$define")      dflt='y' ;;
3570                 *)              dflt='n' ;;
3571                 esac
3572                 ;;
3573        *)       dflt='n';;
3574        esac
3575        ;;
3576 esac
3577 cat <<EOM
3578
3579 Perl can be built to take advantage of threads on some systems.
3580 To do so, Configure can be run with -Dusethreads.
3581
3582 Note that Perl built with threading support runs slightly slower
3583 and uses more memory than plain Perl. The current implementation
3584 is believed to be stable, but it is fairly new, and so should be
3585 treated with caution.
3586
3587 If this doesn't make any sense to you, just accept the default '$dflt'.
3588 EOM
3589 rp='Build a threading Perl?'
3590 . ./myread
3591 case "$ans" in
3592 y|Y)    val="$define" ;;
3593 *)      val="$undef" ;;
3594 esac
3595 set usethreads
3596 eval $setvar
3597
3598 case "$usethreads" in
3599 $define)
3600         $cat <<EOM
3601
3602 Since release 5.6, Perl has had two different threading implementations,
3603 the newer interpreter-based version (ithreads) with one interpreter per
3604 thread, and the older 5.005 version (5005threads).
3605 The 5005threads version is effectively unmaintained and will probably be
3606 removed in Perl 5.10, so there should be no need to build a Perl using it
3607 unless needed for backwards compatibility with some existing 5.005threads
3608 code.
3609
3610 EOM
3611         : Default to ithreads unless overridden on command line or with
3612         : old config.sh
3613         dflt='y'
3614         case "$use5005threads" in
3615                 $define|true|[yY]*) dflt='n';;
3616         esac
3617         case "$useithreads" in
3618                 $undef|false|[nN]*) dflt='n';;
3619         esac
3620         rp='Use the newer interpreter-based ithreads?'
3621         . ./myread
3622         case "$ans" in
3623         y|Y)    val="$define" ;;
3624         *)      val="$undef" ;;
3625         esac
3626         set useithreads
3627         eval $setvar
3628         : Now set use5005threads to the opposite value.
3629         case "$useithreads" in
3630         $define) val="$undef" ;;
3631         *) val="$define" ;;
3632         esac
3633         set use5005threads
3634         eval $setvar
3635         ;;
3636 *)
3637         useithreads="$undef"
3638         use5005threads="$undef"
3639         ;;
3640 esac
3641
3642 case "$useithreads$use5005threads" in
3643 "$define$define")
3644         $cat >&4 <<EOM
3645
3646 You cannot have both the ithreads and the 5.005 threads enabled
3647 at the same time.  Disabling the 5.005 threads since they are
3648 much less stable than the ithreads.
3649
3650 EOM
3651         use5005threads="$undef"
3652         ;;
3653 esac
3654
3655 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3656         cat >&4 <<EOF
3657 ***
3658 *** To build with ithreads you must also use the PerlIO layer.
3659 *** Cannot continue, aborting.
3660 ***
3661 EOF
3662         exit 1
3663 fi
3664
3665 case "$d_oldpthreads" in
3666 '')     : Configure tests would be welcome here.  For now, assume undef.
3667         val="$undef" ;;
3668 *)      val="$d_oldpthreads" ;;
3669 esac
3670 set d_oldpthreads
3671 eval $setvar
3672
3673
3674 case "$usethreads" in
3675 "$define"|true|[yY]*)
3676 : Look for a hint-file generated 'call-back-unit'.  If the
3677 : user has specified that a threading perl is to be built,
3678 : we may need to set or change some other defaults.
3679         if $test -f usethreads.cbu; then
3680                 echo "Your platform has some specific hints for threaded builds, using them..."
3681                 . ./usethreads.cbu
3682         else
3683                 $cat <<EOM
3684 (Your platform doesn't have any specific hints for threaded builds.
3685  Assuming POSIX threads, then.)
3686 EOM
3687         fi
3688         ;;
3689 esac
3690
3691 cat <<EOM
3692
3693 Perl can be built so that multiple Perl interpreters can coexist
3694 within the same Perl executable.
3695 EOM
3696
3697 case "$useithreads" in
3698 $define)
3699         cat <<EOM
3700 This multiple interpreter support is required for interpreter-based threads.
3701 EOM
3702         val="$define"
3703         ;;
3704 *)      case "$usemultiplicity" in
3705         $define|true|[yY]*)     dflt='y';;
3706         *) dflt='n';;
3707         esac
3708         echo " "
3709         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3710         rp='Build Perl for multiplicity?'
3711         . ./myread
3712         case "$ans" in
3713         y|Y)    val="$define" ;;
3714         *)      val="$undef" ;;
3715         esac
3716         ;;
3717 esac
3718 set usemultiplicity
3719 eval $setvar
3720
3721
3722 case "$usemorebits" in
3723 "$define"|true|[yY]*)
3724         use64bitint="$define"
3725         uselongdouble="$define"
3726         usemorebits="$define"
3727         ;;
3728 *)      usemorebits="$undef"
3729         ;;
3730 esac
3731
3732 : make some quick guesses about what we are up against
3733 echo " "
3734 $echo $n "Hmm...  $c"
3735 echo exit 1 >bsd
3736 echo exit 1 >usg
3737 echo exit 1 >v7
3738 echo exit 1 >osf1
3739 echo exit 1 >eunice
3740 echo exit 1 >xenix
3741 echo exit 1 >venix
3742 echo exit 1 >os2
3743 d_bsd="$undef"
3744 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3745 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3746 then
3747         echo "Looks kind of like an OSF/1 system, but we'll see..."
3748         echo exit 0 >osf1
3749 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3750         xxx=`./loc addbib blurfl $pth`
3751         if $test -f $xxx; then
3752         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3753                 echo exit 0 >bsd
3754                 echo exit 0 >usg
3755         else
3756                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3757                         echo "Looks kind of like an extended USG system, but we'll see..."
3758                 else
3759                         echo "Looks kind of like a USG system, but we'll see..."
3760                 fi
3761                 echo exit 0 >usg
3762         fi
3763 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3764         echo "Looks kind of like a BSD system, but we'll see..."
3765         d_bsd="$define"
3766         echo exit 0 >bsd
3767 else
3768         echo "Looks kind of like a Version 7 system, but we'll see..."
3769         echo exit 0 >v7
3770 fi
3771 case "$eunicefix" in
3772 *unixtovms*)
3773         $cat <<'EOI'
3774 There is, however, a strange, musty smell in the air that reminds me of
3775 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3776 EOI
3777         echo exit 0 >eunice
3778         d_eunice="$define"
3779 : it so happens the Eunice I know will not run shell scripts in Unix format
3780         ;;
3781 *)
3782         echo " "
3783         echo "Congratulations.  You aren't running Eunice."
3784         d_eunice="$undef"
3785         ;;
3786 esac
3787 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3788 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3789 : semicolon as a patch separator
3790 case "$p_" in
3791 :) ;;
3792 *)
3793         $cat <<'EOI'
3794 I have the feeling something is not exactly right, however...don't tell me...
3795 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3796 (Or you may be running DOS with DJGPP.)
3797 EOI
3798         echo exit 0 >os2
3799         ;;
3800 esac
3801 if test -f /xenix; then
3802         echo "Actually, this looks more like a XENIX system..."
3803         echo exit 0 >xenix
3804         d_xenix="$define"
3805 else
3806         echo " "
3807         echo "It's not Xenix..."
3808         d_xenix="$undef"
3809 fi
3810 chmod +x xenix
3811 $eunicefix xenix
3812 if test -f /venix; then
3813         echo "Actually, this looks more like a VENIX system..."
3814         echo exit 0 >venix
3815 else
3816         echo " "
3817         if ./xenix; then
3818                 : null
3819         else
3820                 echo "Nor is it Venix..."
3821         fi
3822 fi
3823 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3824 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3825 $rm -f foo
3826
3827 case "$cc" in
3828 '') dflt=cc;;
3829 *) dflt="$cc";;
3830 esac
3831 rp="Use which C compiler?"
3832 . ./myread
3833 cc="$ans"
3834
3835 : See if they have not cc but they do have gcc
3836 . ./trygcc
3837 : Look for a hint-file generated 'call-back-unit'.  Now that the
3838 : user has specified the compiler, we may need to set or change some
3839 : other defaults.
3840 if $test -f cc.cbu; then
3841     . ./cc.cbu
3842 fi
3843 . ./checkcc
3844
3845 echo " "
3846 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3847 $cat >try.c <<EOM
3848 #include <stdio.h>
3849 int main() {
3850 #ifdef __GNUC__
3851 #ifdef __VERSION__
3852         printf("%s\n", __VERSION__);
3853 #else
3854         printf("%s\n", "1");
3855 #endif
3856 #endif
3857         return(0);
3858 }
3859 EOM
3860 if $cc -o try $ccflags $ldflags try.c; then
3861         gccversion=`$run ./try`
3862         case "$gccversion" in
3863         '') echo "You are not using GNU cc." ;;
3864         *)  echo "You are using GNU cc $gccversion."
3865             ccname=gcc
3866             ;;
3867         esac
3868 else
3869         echo " "
3870         echo "*** WHOA THERE!!! ***" >&4
3871         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3872         case "$knowitall" in
3873         '')
3874         echo "    You'd better start hunting for one and let me know about it." >&4
3875                 exit 1
3876                 ;;
3877         esac
3878 fi
3879 $rm -f try try.*
3880 case "$gccversion" in
3881 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3882 esac
3883 case "$gccversion" in
3884 '') gccosandvers='' ;;
3885 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3886    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3887    gccshortvers=''
3888    case "$gccosandvers" in
3889    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3890    $osname$osvers) ;; # looking good
3891    $osname*) cat <<EOM >&4
3892
3893 *** WHOA THERE!!! ***
3894
3895     Your gcc has not been compiled for the exact release of
3896     your operating system ($gccosandvers versus $osname$osvers).
3897
3898     In general it is a good idea to keep gcc synchronized with
3899     the operating system because otherwise serious problems
3900     may ensue when trying to compile software, like Perl.
3901
3902     I'm trying to be optimistic here, though, and will continue.
3903     If later during the configuration and build icky compilation
3904     problems appear (headerfile conflicts being the most common
3905     manifestation), I suggest reinstalling the gcc to match
3906     your operating system release.
3907
3908 EOM
3909       ;;
3910    *) gccosandvers='' ;; # failed to parse, better be silent
3911    esac
3912    ;;
3913 esac
3914 case "$ccname" in
3915 '') ccname="$cc" ;;
3916 esac
3917
3918 # gcc 3.* complain about adding -Idirectories that they already know about,
3919 # so we will take those off from locincpth.
3920 case "$gccversion" in
3921 3*)
3922     echo "main(){}">try.c
3923     for incdir in $locincpth; do
3924        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3925              grep '^c[cp]p*[01]: warning: changing search order '`
3926        if test "X$warn" != X; then
3927            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3928        fi
3929     done
3930     $rm -f try try.*
3931 esac
3932
3933 : decide how portable to be.  Allow command line overrides.
3934 case "$d_portable" in
3935 "$undef") ;;
3936 *)      d_portable="$define" ;;
3937 esac
3938
3939 : set up shell script to do ~ expansion
3940 cat >filexp <<EOSS
3941 $startsh
3942 : expand filename
3943 case "\$1" in
3944  ~/*|~)
3945         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3946         ;;
3947  ~*)
3948         if $test -f /bin/csh; then
3949                 /bin/csh -f -c "glob \$1"
3950                 failed=\$?
3951                 echo ""
3952                 exit \$failed
3953         else
3954                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3955                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3956                 if $test ! -d "\$dir"; then
3957                         me=\`basename \$0\`
3958                         echo "\$me: can't locate home directory for: \$name" >&2
3959                         exit 1
3960                 fi
3961                 case "\$1" in
3962                 */*)
3963                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3964                         ;;
3965                 *)
3966                         echo \$dir
3967                         ;;
3968                 esac
3969         fi
3970         ;;
3971 *)
3972         echo \$1
3973         ;;
3974 esac
3975 EOSS
3976 chmod +x filexp
3977 $eunicefix filexp
3978
3979 : now set up to get a file name
3980 cat <<EOS >getfile
3981 $startsh
3982 EOS
3983 cat <<'EOSC' >>getfile
3984 tilde=''
3985 fullpath=''
3986 already=''
3987 skip=''
3988 none_ok=''
3989 exp_file=''
3990 nopath_ok=''
3991 orig_rp="$rp"
3992 orig_dflt="$dflt"
3993 case "$gfpth" in
3994 '') gfpth='.' ;;
3995 esac
3996
3997 case "$fn" in
3998 *\(*)
3999         : getfile will accept an answer from the comma-separated list
4000         : enclosed in parentheses even if it does not meet other criteria.
4001         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4002         fn=`echo $fn | sed 's/(.*)//'`
4003         ;;
4004 esac
4005
4006 case "$fn" in
4007 *:*)
4008         loc_file=`expr $fn : '.*:\(.*\)'`
4009         fn=`expr $fn : '\(.*\):.*'`
4010         ;;
4011 esac
4012
4013 case "$fn" in
4014 *~*) tilde=true;;
4015 esac
4016 case "$fn" in
4017 */*) fullpath=true;;
4018 esac
4019 case "$fn" in
4020 *+*) skip=true;;
4021 esac
4022 case "$fn" in
4023 *n*) none_ok=true;;
4024 esac
4025 case "$fn" in
4026 *e*) exp_file=true;;
4027 esac
4028 case "$fn" in
4029 *p*) nopath_ok=true;;
4030 esac
4031
4032 case "$fn" in
4033 *f*) type='File';;
4034 *d*) type='Directory';;
4035 *l*) type='Locate';;
4036 esac
4037
4038 what="$type"
4039 case "$what" in
4040 Locate) what='File';;
4041 esac
4042
4043 case "$exp_file" in
4044 '')
4045         case "$d_portable" in
4046         "$define") ;;
4047         *) exp_file=true;;
4048         esac
4049         ;;
4050 esac
4051
4052 cd ..
4053 while test "$type"; do
4054         redo=''
4055         rp="$orig_rp"
4056         dflt="$orig_dflt"
4057         case "$tilde" in
4058         true) rp="$rp (~name ok)";;
4059         esac
4060         . UU/myread
4061         if test -f UU/getfile.ok && \
4062                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4063         then
4064                 value="$ans"
4065                 ansexp="$ans"
4066                 break
4067         fi
4068         case "$ans" in
4069         none)
4070                 value=''
4071                 ansexp=''
4072                 case "$none_ok" in
4073                 true) type='';;
4074                 esac
4075                 ;;
4076         *)
4077                 case "$tilde" in
4078                 '') value="$ans"
4079                         ansexp="$ans";;
4080                 *)
4081                         value=`UU/filexp $ans`
4082                         case $? in
4083                         0)
4084                                 if test "$ans" != "$value"; then
4085                                         echo "(That expands to $value on this system.)"
4086                                 fi
4087                                 ;;
4088                         *) value="$ans";;
4089                         esac
4090                         ansexp="$value"
4091                         case "$exp_file" in
4092                         '') value="$ans";;
4093                         esac
4094                         ;;
4095                 esac
4096                 case "$fullpath" in
4097                 true)
4098                         case "$ansexp" in
4099                         /*) value="$ansexp" ;;
4100                         [a-zA-Z]:/*) value="$ansexp" ;;
4101                         *)
4102                                 redo=true
4103                                 case "$already" in
4104                                 true)
4105                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4106                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4107                                         ;;
4108                                 *)
4109                                 echo "Please give a full path name, starting with slash." >&4
4110                                         case "$tilde" in
4111                                         true)
4112                                 echo "Note that using ~name is ok provided it expands well." >&4
4113                                                 already=true
4114                                                 ;;
4115                                         esac
4116                                 esac
4117                                 ;;
4118                         esac
4119                         ;;
4120                 esac
4121                 case "$redo" in
4122                 '')
4123                         case "$type" in
4124                         File)
4125                                 for fp in $gfpth; do
4126                                         if test "X$fp" = X.; then
4127                                             pf="$ansexp"
4128                                         else    
4129                                             pf="$fp/$ansexp"
4130                                         fi
4131                                         if test -f "$pf"; then
4132                                                 type=''
4133                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4134                                         then
4135                                                 echo "($value is not a plain file, but that's ok.)"
4136                                                 type=''
4137                                         fi
4138                                         if test X"$type" = X; then
4139                                             value="$pf"
4140                                             break
4141                                         fi
4142                                 done
4143                                 ;;
4144                         Directory)
4145                                 for fp in $gfpth; do
4146                                         if test "X$fp" = X.; then
4147                                             dir="$ans"
4148                                             direxp="$ansexp"
4149                                         else    
4150                                             dir="$fp/$ansexp"
4151                                             direxp="$fp/$ansexp"
4152                                         fi
4153                                         if test -d "$direxp"; then
4154                                                 type=''
4155                                                 value="$dir"
4156                                                 break
4157                                         fi
4158                                 done
4159                                 ;;
4160                         Locate)
4161                                 if test -d "$ansexp"; then
4162                                         echo "(Looking for $loc_file in directory $value.)"
4163                                         value="$value/$loc_file"
4164                                         ansexp="$ansexp/$loc_file"
4165                                 fi
4166                                 if test -f "$ansexp"; then
4167                                         type=''
4168                                 fi
4169                                 case "$nopath_ok" in
4170                                 true)   case "$value" in
4171                                         */*) ;;
4172                                         *)      echo "Assuming $value will be in people's path."
4173                                                 type=''
4174                                                 ;;
4175                                         esac
4176                                         ;;
4177                                 esac
4178                                 ;;
4179                         esac
4180
4181                         case "$skip" in
4182                         true) type='';
4183                         esac
4184
4185                         case "$type" in
4186                         '') ;;
4187                         *)
4188                                 if test "$fastread" = yes; then
4189                                         dflt=y
4190                                 else
4191                                         dflt=n
4192                                 fi
4193                                 rp="$what $value doesn't exist.  Use that name anyway?"
4194                                 . UU/myread
4195                                 dflt=''
4196                                 case "$ans" in
4197                                 y*) type='';;
4198                                 *) echo " ";;
4199                                 esac
4200                                 ;;
4201                         esac
4202                         ;;
4203                 esac
4204                 ;;
4205         esac
4206 done
4207 cd UU
4208 ans="$value"
4209 rp="$orig_rp"
4210 dflt="$orig_dflt"
4211 rm -f getfile.ok
4212 test "X$gfpthkeep" != Xy && gfpth=""
4213 EOSC
4214
4215 : What should the include directory be ?
4216 echo " "
4217 $echo $n "Hmm...  $c"
4218 dflt='/usr/include'
4219 incpath=''
4220 mips_type=''
4221 if $test -f /bin/mips && /bin/mips; then
4222         echo "Looks like a MIPS system..."
4223         $cat >usr.c <<'EOCP'
4224 #ifdef SYSTYPE_BSD43
4225 /bsd43
4226 #endif
4227 EOCP
4228         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4229                 dflt='/bsd43/usr/include'
4230                 incpath='/bsd43'
4231                 mips_type='BSD 4.3'
4232         else
4233                 mips_type='System V'
4234         fi
4235         $rm -f usr.c usr.out
4236         echo "and you're compiling with the $mips_type compiler and libraries."
4237         xxx_prompt=y
4238         echo "exit 0" >mips
4239 else
4240         echo "Doesn't look like a MIPS system."
4241         xxx_prompt=n
4242         echo "exit 1" >mips
4243 fi
4244 chmod +x mips
4245 $eunicefix mips
4246 case "$usrinc" in
4247 '') ;;
4248 *) dflt="$usrinc";;
4249 esac
4250 case "$xxx_prompt" in
4251 y)      fn=d/
4252         echo " "
4253         rp='Where are the include files you want to use?'
4254         . ./getfile
4255         usrinc="$ans"
4256         ;;
4257 *)      usrinc="$dflt"
4258         ;;
4259 esac
4260
4261 : see how we invoke the C preprocessor
4262 echo " "
4263 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4264 cat <<'EOT' >testcpp.c
4265 #define ABC abc
4266 #define XYZ xyz
4267 ABC.XYZ
4268 EOT
4269 cd ..
4270 if test ! -f cppstdin; then
4271         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4272                 # AIX cc -E doesn't show the absolute headerfile
4273                 # locations but we'll cheat by using the -M flag.
4274                 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
4275         else
4276                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4277         fi
4278 else
4279         echo "Keeping your $hint cppstdin wrapper."
4280 fi
4281 chmod 755 cppstdin
4282 wrapper=`pwd`/cppstdin
4283 ok='false'
4284 cd UU
4285
4286 if $test "X$cppstdin" != "X" && \
4287         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4289 then
4290         echo "You used to use $cppstdin $cppminus so we'll use that again."
4291         case "$cpprun" in
4292         '') echo "But let's see if we can live without a wrapper..." ;;
4293         *)
4294                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4295                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4296                 then
4297                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4298                         ok='true'
4299                 else
4300                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4301                 fi
4302                 ;;
4303         esac
4304 else
4305         case "$cppstdin" in
4306         '') ;;
4307         *)
4308                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4309                 ;;
4310         esac
4311 fi
4312
4313 if $ok; then
4314         : nothing
4315 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4316         $cc -E <testcpp.c >testcpp.out 2>&1; \
4317         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4318         echo "Yup, it does."
4319         x_cpp="$cc -E"
4320         x_minus='';
4321 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4322         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4323         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4324         echo "Yup, it does."
4325         x_cpp="$cc -E"
4326         x_minus='-';
4327 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4328         $cc -P <testcpp.c >testcpp.out 2>&1; \
4329         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4330         echo "Yipee, that works!"
4331         x_cpp="$cc -P"
4332         x_minus='';
4333 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4334         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4335         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4336         echo "At long last!"
4337         x_cpp="$cc -P"
4338         x_minus='-';
4339 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4340         $cpp <testcpp.c >testcpp.out 2>&1; \
4341         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4342         echo "It works!"
4343         x_cpp="$cpp"
4344         x_minus='';
4345 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4346         $cpp - <testcpp.c >testcpp.out 2>&1; \
4347         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4348         echo "Hooray, it works!  I was beginning to wonder."
4349         x_cpp="$cpp"
4350         x_minus='-';
4351 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4352         $wrapper <testcpp.c >testcpp.out 2>&1; \
4353         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4354         x_cpp="$wrapper"
4355         x_minus=''
4356         echo "Eureka!"
4357 else
4358         dflt=''
4359         rp="No dice.  I can't find a C preprocessor.  Name one:"
4360         . ./myread
4361         x_cpp="$ans"
4362         x_minus=''
4363         $x_cpp <testcpp.c >testcpp.out 2>&1
4364         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4365                 echo "OK, that will do." >&4
4366         else
4367 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4368                 exit 1
4369         fi
4370 fi
4371
4372 case "$ok" in
4373 false)
4374         cppstdin="$x_cpp"
4375         cppminus="$x_minus"
4376         cpprun="$x_cpp"
4377         cpplast="$x_minus"
4378         set X $x_cpp
4379         shift
4380         case "$1" in
4381         "$cpp")
4382                 echo "Perhaps can we force $cc -E using a wrapper..."
4383                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4384                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4385                 then
4386                         echo "Yup, we can."
4387                         cppstdin="$wrapper"
4388                         cppminus='';
4389                 else
4390                         echo "Nope, we'll have to live without it..."
4391                 fi
4392                 ;;
4393         esac
4394         case "$cpprun" in
4395         "$wrapper")
4396                 cpprun=''
4397                 cpplast=''
4398                 ;;
4399         esac
4400         ;;
4401 esac
4402
4403 case "$cppstdin" in
4404 "$wrapper"|'cppstdin') ;;
4405 *) $rm -f $wrapper;;
4406 esac
4407 $rm -f testcpp.c testcpp.out
4408
4409 : Set private lib path
4410 case "$plibpth" in
4411 '') if ./mips; then
4412                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4413         fi;;
4414 esac
4415 case "$libpth" in
4416 ' ') dlist='';;
4417 '') dlist="$loclibpth $plibpth $glibpth";;
4418 *) dlist="$libpth";;
4419 esac
4420
4421 : Now check and see which directories actually exist, avoiding duplicates
4422 libpth=''
4423 for xxx in $dlist
4424 do
4425     if $test -d $xxx; then
4426                 case " $libpth " in
4427                 *" $xxx "*) ;;
4428                 *) libpth="$libpth $xxx";;
4429                 esac
4430     fi
4431 done
4432 $cat <<'EOM'
4433
4434 Some systems have incompatible or broken versions of libraries.  Among
4435 the directories listed in the question below, please remove any you
4436 know not to be holding relevant libraries, and add any that are needed.
4437 Say "none" for none.
4438
4439 EOM
4440 case "$libpth" in
4441 '') dflt='none';;
4442 *)
4443         set X $libpth
4444         shift
4445         dflt=${1+"$@"}
4446         ;;
4447 esac
4448 rp="Directories to use for library searches?"
4449 . ./myread
4450 case "$ans" in
4451 none) libpth=' ';;
4452 *) libpth="$ans";;
4453 esac
4454
4455 : compute shared library extension
4456 case "$so" in
4457 '')
4458         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4459                 dflt='sl'
4460         else
4461                 dflt='so'
4462         fi
4463         ;;
4464 *) dflt="$so";;
4465 esac
4466 $cat <<EOM
4467
4468 On some systems, shared libraries may be available.  Answer 'none' if
4469 you want to suppress searching of shared libraries for the remainder
4470 of this configuration.
4471
4472 EOM
4473 rp='What is the file extension used for shared libraries?'
4474 . ./myread
4475 so="$ans"
4476
4477 : Define several unixisms.
4478 : Hints files or command line option can be used to override them.
4479 : The convoluted testing is in case hints files set either the old
4480 : or the new name.
4481 case "$_exe" in
4482 '')     case "$exe_ext" in
4483         '')     ;;
4484         *)      _exe="$exe_ext" ;;
4485         esac
4486         ;;
4487 esac
4488 case "$_a" in
4489 '')     case "$lib_ext" in
4490     '') _a='.a';;
4491         *)      _a="$lib_ext" ;;
4492         esac
4493         ;;
4494 esac
4495 case "$_o" in
4496 '') case "$obj_ext" in
4497         '')     _o='.o';;
4498         *)      _o="$obj_ext";;
4499         esac
4500         ;;
4501 esac
4502 case "$p_" in
4503 '') case "$path_sep" in
4504         '')     p_=':';;
4505         *)      p_="$path_sep";;
4506         esac
4507         ;;
4508 esac
4509 exe_ext=$_exe
4510 lib_ext=$_a
4511 obj_ext=$_o
4512 path_sep=$p_
4513
4514 : Which makefile gets called first.  This is used by make depend.
4515 case "$firstmakefile" in
4516 '') firstmakefile='makefile';;
4517 esac
4518
4519 case "$ccflags" in
4520 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4521 esac
4522
4523 case "$uselongdouble" in
4524 $define|true|[yY]*)     dflt='y';;
4525 *) dflt='n';;
4526 esac
4527 cat <<EOM
4528
4529 Perl can be built to take advantage of long doubles which
4530 (if available) may give more accuracy and range for floating point numbers.
4531
4532 If this doesn't make any sense to you, just accept the default '$dflt'.
4533 EOM
4534 rp='Try to use long doubles if available?'
4535 . ./myread
4536 case "$ans" in
4537 y|Y)    val="$define"   ;;
4538 *)      val="$undef"    ;;
4539 esac
4540 set uselongdouble
4541 eval $setvar
4542
4543 case "$uselongdouble" in
4544 true|[yY]*) uselongdouble="$define" ;;
4545 esac
4546
4547 case "$uselongdouble" in
4548 $define)
4549 : Look for a hint-file generated 'call-back-unit'.  If the
4550 : user has specified that long doubles should be used,
4551 : we may need to set or change some other defaults.
4552         if $test -f uselongdouble.cbu; then
4553                 echo "Your platform has some specific hints for long doubles, using them..."
4554                 . ./uselongdouble.cbu
4555         else
4556                 $cat <<EOM
4557 (Your platform doesn't have any specific hints for long doubles.)
4558 EOM
4559         fi
4560         ;;
4561 esac
4562
4563 : Looking for optional libraries
4564 echo " "
4565 echo "Checking for optional libraries..." >&4
4566 case "$libs" in
4567 ' '|'') dflt='';;
4568 *) dflt="$libs";;
4569 esac
4570 case "$libswanted" in
4571 '') libswanted='c_s';;
4572 esac
4573 case "$usesocks" in
4574 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4575 esac
4576 libsfound=''
4577 libsfiles=''
4578 libsdirs=''
4579 libspath=''
4580 for thisdir in $libpth $xlibpth; do
4581   test -d $thisdir && libspath="$libspath $thisdir"
4582 done
4583 for thislib in $libswanted; do
4584         for thisdir in $libspath; do
4585             xxx=''
4586             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4587                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4588                 $test -f "$xxx" && eval $libscheck
4589                 $test -f "$xxx" && libstyle=shared
4590             fi
4591             if test ! -f "$xxx"; then
4592                 xxx=$thisdir/lib$thislib.$so
4593                 $test -f "$xxx" && eval $libscheck
4594                 $test -f "$xxx" && libstyle=shared
4595             fi  
4596             if test ! -f "$xxx"; then
4597                 xxx=$thisdir/lib$thislib$_a
4598                 $test -f "$xxx" && eval $libscheck
4599                 $test -f "$xxx" && libstyle=static
4600             fi
4601             if test ! -f "$xxx"; then
4602                 xxx=$thisdir/$thislib$_a
4603                 $test -f "$xxx" && eval $libscheck
4604                 $test -f "$xxx" && libstyle=static
4605             fi
4606             if test ! -f "$xxx"; then
4607                 xxx=$thisdir/lib${thislib}_s$_a
4608                 $test -f "$xxx" && eval $libscheck
4609                 $test -f "$xxx" && libstyle=static
4610                 $test -f "$xxx" && thislib=${thislib}_s
4611             fi
4612             if test ! -f "$xxx"; then
4613                 xxx=$thisdir/Slib$thislib$_a
4614                 $test -f "$xxx" && eval $libscheck
4615                 $test -f "$xxx" && libstyle=static
4616             fi
4617             if $test -f "$xxx"; then
4618                 case "$libstyle" in
4619                 shared) echo "Found -l$thislib (shared)." ;;
4620                 static) echo "Found -l$thislib." ;;
4621                 *)      echo "Found -l$thislib ($libstyle)." ;;
4622                 esac
4623                 case " $dflt " in
4624                 *"-l$thislib "*);;
4625                 *) dflt="$dflt -l$thislib"
4626                    libsfound="$libsfound $xxx"
4627                    yyy=`basename $xxx`
4628                    libsfiles="$libsfiles $yyy"
4629                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4630                    case " $libsdirs " in
4631                    *" $yyy "*) ;;
4632                    *) libsdirs="$libsdirs $yyy" ;;
4633                    esac
4634                    ;;
4635                 esac
4636                 break
4637             fi  
4638         done
4639         if $test ! -f "$xxx"; then
4640             echo "No -l$thislib."
4641         fi
4642 done
4643 set X $dflt
4644 shift
4645 dflt="$*"
4646 case "$libs" in
4647 '') dflt="$dflt";;
4648 *) dflt="$libs";;
4649 esac
4650 case "$dflt" in
4651 ' '|'') dflt='none';;
4652 esac
4653
4654 $cat <<EOM
4655
4656 In order to compile $package on your machine, a number of libraries
4657 are usually needed.  Include any other special libraries here as well.
4658 Say "none" for none.  The default list is almost always right.
4659 EOM
4660
4661 echo " "
4662 rp="What libraries to use?"
4663 . ./myread
4664 case "$ans" in
4665 none) libs=' ';;
4666 *) libs="$ans";;
4667 esac
4668
4669 : determine optimization, if desired, or use for debug flag also
4670 case "$optimize" in
4671 ' '|$undef) dflt='none';;
4672 '') dflt='-O';;
4673 *) dflt="$optimize";;
4674 esac
4675 $cat <<EOH
4676
4677 By default, $package compiles with the -O flag to use the optimizer.
4678 Alternately, you might want to use the symbolic debugger, which uses
4679 the -g flag (on traditional Unix systems).  Either flag can be
4680 specified here.  To use neither flag, specify the word "none".
4681
4682 EOH
4683 rp="What optimizer/debugger flag should be used?"
4684 . ./myread
4685 optimize="$ans"
4686 case "$optimize" in
4687 'none') optimize=" ";;
4688 esac
4689
4690 dflt=''
4691 : We will not override a previous value, but we might want to
4692 : augment a hint file
4693 case "$hint" in
4694 default|recommended)
4695         case "$gccversion" in
4696         1*) dflt='-fpcc-struct-return' ;;
4697         esac
4698         case "$optimize" in
4699         *-g*) dflt="$dflt -DDEBUGGING";;
4700         esac
4701         case "$gccversion" in
4702         2*) if test -d /etc/conf/kconfig.d &&
4703                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4704                 then
4705                         dflt="$dflt -posix"
4706                 fi
4707                 ;;
4708         esac
4709         case "$gccversion" in
4710         1*) ;;
4711         2.[0-8]*) ;;
4712         ?*)     echo " "
4713                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4714                 echo 'int main(void) { return 0; }' > gcctest.c
4715                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4716                         echo "Yes, it does." 2>&1
4717                         case "$ccflags" in
4718                         *strict-aliasing*) 
4719                                 echo "Leaving current flags $ccflags alone." 2>&1
4720                                 ;;
4721                         *) dflt="$dflt -fno-strict-aliasing" ;;
4722                         esac
4723                 else
4724                         echo "Nope, it doesn't, but that's ok." 2>&1
4725                 fi
4726                 ;;
4727         esac
4728         ;;
4729 esac
4730
4731 case "$mips_type" in
4732 *BSD*|'') inclwanted="$locincpth $usrinc";;
4733 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4734 esac
4735 for thisincl in $inclwanted; do
4736         if $test -d $thisincl; then
4737                 if $test x$thisincl != x$usrinc; then
4738                         case "$dflt" in
4739                         *" -I$thisincl "*);;
4740                         *) dflt="$dflt -I$thisincl ";;
4741                         esac
4742                 fi
4743         fi
4744 done
4745
4746 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4747         xxx=true;
4748 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4749         xxx=true;
4750 else
4751         xxx=false;
4752 fi;
4753 if $xxx; then
4754         case "$dflt" in
4755         *$2*);;
4756         *) dflt="$dflt -D$2";;
4757         esac;
4758 fi'
4759
4760 set signal.h LANGUAGE_C; eval $inctest
4761
4762 case "$usesocks" in
4763 $define)
4764         ccflags="$ccflags -DSOCKS"
4765         ;;
4766 esac
4767
4768 case "$hint" in
4769 default|recommended) dflt="$ccflags $dflt" ;;
4770 *) dflt="$ccflags";;
4771 esac
4772
4773 case "$dflt" in
4774 ''|' ') dflt=none;;
4775 esac
4776
4777 $cat <<EOH
4778
4779 Your C compiler may want other flags.  For this question you should include
4780 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4781 but you should NOT include libraries or ld flags like -lwhatever.  If you
4782 want $package to honor its debug switch, you should include -DDEBUGGING here.
4783 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4784
4785 To use no flags, specify the word "none".
4786
4787 EOH
4788 set X $dflt
4789 shift
4790 dflt=${1+"$@"}
4791 rp="Any additional cc flags?"
4792 . ./myread
4793 case "$ans" in
4794 none) ccflags='';;
4795 *) ccflags="$ans";;
4796 esac
4797
4798 : the following weeds options from ccflags that are of no interest to cpp
4799 case "$cppflags" in
4800 '') cppflags="$ccflags" ;;
4801 *)  cppflags="$cppflags $ccflags" ;;
4802 esac
4803 case "$gccversion" in
4804 1*) cppflags="$cppflags -D__GNUC__"
4805 esac
4806 case "$mips_type" in
4807 '');;
4808 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4809 esac
4810 case "$cppflags" in
4811 '');;
4812 *)
4813         echo " "
4814         echo "Let me guess what the preprocessor flags are..." >&4
4815         set X $cppflags
4816         shift
4817         cppflags=''
4818         $cat >cpp.c <<'EOM'
4819 #define BLURFL foo
4820
4821 BLURFL xx LFRULB
4822 EOM
4823         previous=''
4824         for flag in $*
4825         do
4826                 case "$flag" in
4827                 -*) ftry="$flag";;
4828                 *) ftry="$previous $flag";;
4829                 esac
4830                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4831                         >cpp1.out 2>/dev/null && \
4832                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4833                         >cpp2.out 2>/dev/null && \
4834                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4835                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4836                 then
4837                         cppflags="$cppflags $ftry"
4838                         previous=''
4839                 else
4840                         previous="$flag"
4841                 fi
4842         done
4843         set X $cppflags
4844         shift
4845         cppflags=${1+"$@"}
4846         case "$cppflags" in
4847         *-*)  echo "They appear to be: $cppflags";;
4848         esac
4849         $rm -f cpp.c cpp?.out
4850         ;;
4851 esac
4852
4853 : flags used in final linking phase
4854 case "$ldflags" in
4855 '') if ./venix; then
4856                 dflt='-i -z'
4857         else
4858                 dflt=''
4859         fi
4860         case "$ccflags" in
4861         *-posix*) dflt="$dflt -posix" ;;
4862         esac
4863         ;;
4864 *) dflt="$ldflags";;
4865 esac
4866
4867 : Try to guess additional flags to pick up local libraries.
4868 for thislibdir in $libpth; do
4869         case " $loclibpth " in
4870         *" $thislibdir "*)
4871                 case "$dflt " in 
4872                 *"-L$thislibdir "*) ;;
4873                 *)  dflt="$dflt -L$thislibdir" ;;
4874                 esac
4875                 ;;
4876         esac
4877 done
4878
4879 case "$dflt" in
4880 '') dflt='none' ;;
4881 esac
4882
4883 $cat <<EOH
4884
4885 Your C linker may need flags.  For this question you should
4886 include -L/whatever and any other flags used by the C linker, but you
4887 should NOT include libraries like -lwhatever.
4888
4889 Make sure you include the appropriate -L/path flags if your C linker
4890 does not normally search all of the directories you specified above,
4891 namely
4892         $libpth
4893 To use no flags, specify the word "none".
4894
4895 EOH
4896
4897 rp="Any additional ld flags (NOT including libraries)?"
4898 . ./myread
4899 case "$ans" in
4900 none) ldflags='';;
4901 *) ldflags="$ans";;
4902 esac
4903 rmlist="$rmlist pdp11"
4904
4905 : coherency check
4906 echo " "
4907 echo "Checking your choice of C compiler and flags for coherency..." >&4
4908 $cat > try.c <<'EOF'
4909 #include <stdio.h>
4910 int main() { printf("Ok\n"); return(0); }
4911 EOF
4912 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4913 shift
4914 $cat >try.msg <<'EOM'
4915 I've tried to compile and run the following simple program:
4916
4917 EOM
4918 $cat try.c >> try.msg
4919
4920 $cat >> try.msg <<EOM
4921
4922 I used the command:
4923
4924         $*
4925         $run ./try
4926
4927 and I got the following output:
4928
4929 EOM
4930 dflt=y
4931 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4932         if $sh -c "$run ./try" >>try.msg 2>&1; then
4933                 xxx=`$run ./try`
4934                 case "$xxx" in
4935                 "Ok") dflt=n ;;
4936                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4937                         case " $libs " in
4938                         *" -lsfio "*)
4939                                 cat >> try.msg <<'EOQS'
4940 If $libs contains -lsfio, and sfio is mis-configured, then it
4941 sometimes (apparently) runs and exits with a 0 status, but with no
4942 output!  It may have to do with sfio's use of _exit vs. exit.
4943
4944 EOQS
4945                                 rp="You have a big problem.  Shall I abort Configure"
4946                                 dflt=y
4947                                 ;;
4948                         esac
4949                         ;;
4950                 esac
4951         else
4952                 echo "The program compiled OK, but exited with status $?." >>try.msg
4953                 rp="You have a problem.  Shall I abort Configure"
4954                 dflt=y
4955         fi
4956 else
4957         echo "I can't compile the test program." >>try.msg
4958         rp="You have a BIG problem.  Shall I abort Configure"
4959         dflt=y
4960 fi
4961 case "$dflt" in
4962 y)
4963         $cat try.msg >&4
4964         case "$knowitall" in
4965         '')
4966                 echo "(The supplied flags or libraries might be incorrect.)"
4967                 ;;
4968         *) dflt=n;;
4969         esac
4970         echo " "
4971         . ./myread
4972         case "$ans" in
4973         n*|N*) ;;
4974         *)      echo "Ok.  Stopping Configure." >&4
4975                 exit 1
4976                 ;;
4977         esac
4978         ;;
4979 n) echo "OK, that should do.";;
4980 esac
4981 $rm -f try try.* core
4982
4983 : define a shorthand compile call
4984 compile='
4985 mc_file=$1;
4986 shift;
4987 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4988 : define a shorthand compile call for compilations that should be ok.
4989 compile_ok='
4990 mc_file=$1;
4991 shift;
4992 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4993
4994 : determine filename position in cpp output
4995 echo " "
4996 echo "Computing filename position in cpp output for #include directives..." >&4
4997 case "$osname" in
4998 vos) testaccess=-e ;;
4999 *)   testaccess=-r ;;
5000 esac
5001 echo '#include <stdio.h>' > foo.c
5002 $cat >fieldn <<EOF
5003 $startsh
5004 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5005 $grep '^[       ]*#.*stdio\.h' | \
5006 while read cline; do
5007         pos=1
5008         set \$cline
5009         while $test \$# -gt 0; do
5010                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5011                         echo "\$pos"
5012                         exit 0
5013                 fi
5014                 shift
5015                 pos=\`expr \$pos + 1\`
5016         done
5017 done
5018 EOF
5019 chmod +x fieldn
5020 fieldn=`./fieldn`
5021 $rm -f foo.c fieldn
5022 case $fieldn in
5023 '') pos='???';;
5024 1) pos=first;;
5025 2) pos=second;;
5026 3) pos=third;;
5027 *) pos="${fieldn}th";;
5028 esac
5029 echo "Your cpp writes the filename in the $pos field of the line."
5030
5031 case "$osname" in
5032 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5033 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5034 *)   cppfilter='' ;;
5035 esac
5036 : locate header file
5037 $cat >findhdr <<EOF
5038 $startsh
5039 wanted=\$1
5040 name=''
5041 for usrincdir in $usrinc
5042 do
5043         if test -f \$usrincdir/\$wanted; then
5044                 echo "\$usrincdir/\$wanted"
5045                 exit 0
5046         fi
5047 done
5048 awkprg='{ print \$$fieldn }'
5049 echo "#include <\$wanted>" > foo\$\$.c
5050 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5051 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5052 while read cline; do
5053         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5054         case "\$name" in
5055         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5056         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5057         *) exit 2;;
5058         esac;
5059 done;
5060 #
5061 # status = 0: grep returned 0 lines, case statement not executed
5062 # status = 1: headerfile found
5063 # status = 2: while loop executed, no headerfile found
5064 #
5065 status=\$?
5066 $rm -f foo\$\$.c;
5067 if test \$status -eq 1; then
5068         exit 0;
5069 fi
5070 exit 1
5071 EOF
5072 chmod +x findhdr
5073
5074 : define an alternate in-header-list? function
5075 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5076 cont=true; xxf="echo \"<\$1> found.\" >&4";
5077 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5078 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5079 esac;
5080 case $# in 4) instead=instead;; *) instead="at last";; esac;
5081 while $test "$cont"; do
5082         xxx=`./findhdr $1`
5083         var=$2; eval "was=\$$2";
5084         if $test "$xxx" && $test -r "$xxx";
5085         then eval $xxf;
5086         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5087                 cont="";
5088         else eval $xxnf;
5089         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5090         set $yyy; shift; shift; yyy=$@;
5091         case $# in 0) cont="";;
5092         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5093                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5094         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5095                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5096         esac;
5097 done;
5098 while $test "$yyy";
5099 do set $yyy; var=$2; eval "was=\$$2";
5100         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5101         set $yyy; shift; shift; yyy=$@;
5102 done'
5103
5104 : see if stdlib is available
5105 set stdlib.h i_stdlib
5106 eval $inhdr
5107
5108 : check for lengths of integral types
5109 echo " "
5110 case "$intsize" in
5111 '')
5112         echo "Checking to see how big your integers are..." >&4
5113         $cat >try.c <<EOCP
5114 #include <stdio.h>
5115 #$i_stdlib I_STDLIB
5116 #ifdef I_STDLIB
5117 #include <stdlib.h>
5118 #endif
5119 int main()
5120 {
5121         printf("intsize=%d;\n", (int)sizeof(int));
5122         printf("longsize=%d;\n", (int)sizeof(long));
5123         printf("shortsize=%d;\n", (int)sizeof(short));
5124         exit(0);
5125 }
5126 EOCP
5127         set try
5128         if eval $compile_ok && $run ./try > /dev/null; then
5129                 eval `$run ./try`
5130                 echo "Your integers are $intsize bytes long."
5131                 echo "Your long integers are $longsize bytes long."
5132                 echo "Your short integers are $shortsize bytes long."
5133         else
5134                 $cat >&4 <<EOM
5135 !
5136 Help! I can't compile and run the intsize test program: please enlighten me!
5137 (This is probably a misconfiguration in your system or libraries, and
5138 you really ought to fix it.  Still, I'll try anyway.)
5139 !
5140 EOM
5141                 dflt=4
5142                 rp="What is the size of an integer (in bytes)?"
5143                 . ./myread
5144                 intsize="$ans"
5145                 dflt=$intsize
5146                 rp="What is the size of a long integer (in bytes)?"
5147                 . ./myread
5148                 longsize="$ans"
5149                 dflt=2
5150                 rp="What is the size of a short integer (in bytes)?"
5151                 . ./myread
5152                 shortsize="$ans"
5153         fi
5154         ;;
5155 esac
5156 $rm -f try try.*
5157
5158 : check for long long
5159 echo " "
5160 echo "Checking to see if you have long long..." >&4
5161 echo 'int main() { long long x = 7; return 0; }' > try.c
5162 set try
5163 if eval $compile; then
5164         val="$define"
5165         echo "You have long long."
5166 else
5167         val="$undef"
5168         echo "You do not have long long."
5169 fi
5170 $rm try.*
5171 set d_longlong
5172 eval $setvar
5173
5174 : check for length of long long
5175 case "${d_longlong}${longlongsize}" in
5176 $define)
5177         echo " "
5178         echo "Checking to see how big your long longs are..." >&4
5179         $cat >try.c <<'EOCP'
5180 #include <stdio.h>
5181 int main()
5182 {
5183     printf("%d\n", (int)sizeof(long long));
5184     return(0);
5185 }
5186 EOCP
5187         set try
5188         if eval $compile_ok; then
5189                 longlongsize=`$run ./try`
5190                 echo "Your long longs are $longlongsize bytes long."
5191         else
5192                 dflt='8'
5193                 echo " "
5194                 echo "(I can't seem to compile the test program.  Guessing...)"
5195                 rp="What is the size of a long long (in bytes)?"
5196                 . ./myread
5197                 longlongsize="$ans"
5198         fi
5199         if $test "X$longsize" = "X$longlongsize"; then
5200                 echo "(That isn't any different from an ordinary long.)"
5201         fi      
5202         ;;
5203 esac
5204 $rm -f try.* try
5205
5206 : see if inttypes.h is available
5207 : we want a real compile instead of Inhdr because some systems
5208 : have an inttypes.h which includes non-existent headers
5209 echo " "
5210 $cat >try.c <<EOCP
5211 #include <inttypes.h>
5212 int main() {
5213         static int32_t foo32 = 0x12345678;
5214 }
5215 EOCP
5216 set try
5217 if eval $compile; then
5218         echo "<inttypes.h> found." >&4
5219         val="$define"
5220 else
5221         echo "<inttypes.h> NOT found." >&4
5222         val="$undef"
5223 fi
5224 $rm -f try.c try
5225 set i_inttypes
5226 eval $setvar
5227
5228 : check for int64_t
5229 echo " "
5230 echo "Checking to see if you have int64_t..." >&4
5231 $cat >try.c <<EOCP
5232 #include <sys/types.h>
5233 #$i_inttypes I_INTTYPES
5234 #ifdef I_INTTYPES
5235 #include <inttypes.h>
5236 #endif
5237 int main() { int64_t x = 7; }
5238 EOCP
5239 set try
5240 if eval $compile; then
5241         val="$define"
5242         echo "You have int64_t."
5243 else
5244         val="$undef"
5245         echo "You do not have int64_t."
5246 fi
5247 $rm -f try try.*
5248 set d_int64_t
5249 eval $setvar
5250
5251
5252 echo " "
5253 echo "Checking which 64-bit integer type we could use..." >&4
5254
5255 case "$intsize" in
5256 8) val=int
5257    set quadtype
5258    eval $setvar
5259    val='"unsigned int"'
5260    set uquadtype
5261    eval $setvar
5262    quadkind=1
5263    ;;
5264 *) case "$longsize" in
5265    8) val=long
5266       set quadtype
5267       eval $setvar
5268       val='"unsigned long"'
5269       set uquadtype
5270       eval $setvar
5271       quadkind=2
5272       ;;
5273    *) case "$d_longlong:$longlongsize" in
5274       define:8)
5275         val='"long long"'
5276         set quadtype
5277         eval $setvar
5278         val='"unsigned long long"'
5279         set uquadtype
5280         eval $setvar
5281         quadkind=3
5282         ;;
5283       *) case "$d_int64_t" in
5284          define)
5285            val=int64_t
5286            set quadtype
5287            eval $setvar
5288            val=uint64_t
5289            set uquadtype
5290            eval $setvar
5291            quadkind=4
5292            ;;
5293          esac
5294          ;;
5295       esac
5296       ;;
5297    esac
5298    ;;
5299 esac
5300
5301 case "$quadtype" in
5302 '')     echo "Alas, no 64-bit integer types in sight." >&4
5303         d_quad="$undef"
5304         ;;
5305 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5306         d_quad="$define"
5307         ;;
5308 esac
5309
5310
5311 case "$uselonglong" in
5312 "$define"|true|[yY]*)
5313         cat <<EOM >&4
5314
5315 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5316 EOM
5317         use64bitint="$define"
5318         ;;
5319 esac                          
5320 case "$use64bits" in
5321 "$define"|true|[yY]*)
5322         cat <<EOM >&4
5323
5324 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5325 EOM
5326         use64bitint="$define"
5327         ;;
5328 esac                          
5329 case "$use64bitints" in
5330 "$define"|true|[yY]*)
5331         cat <<EOM >&4
5332
5333 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5334 EOM
5335         use64bitint="$define"
5336         ;;
5337 esac                          
5338 case "$use64bitsint" in
5339 "$define"|true|[yY]*)
5340         cat <<EOM >&4
5341
5342 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5343 EOM
5344         use64bitint="$define"
5345         ;;
5346 esac                          
5347 case "$uselonglongs" in
5348 "$define"|true|[yY]*)
5349         cat <<EOM >&4
5350
5351 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5352 EOM
5353         use64bitint="$define"
5354         ;;
5355 esac                          
5356 case "$use64bitsall" in
5357 "$define"|true|[yY]*)
5358         cat <<EOM >&4
5359
5360 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5361 EOM
5362         use64bitall="$define"
5363         ;;
5364 esac                          
5365
5366 case "$ccflags" in
5367 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5368 esac
5369 case "$use64bitall" in
5370 "$define"|true|[yY]*) use64bitint="$define" ;;
5371 esac
5372
5373 case "$longsize" in
5374 8) cat <<EOM
5375
5376 You have natively 64-bit long integers.
5377 EOM
5378    val="$define"
5379    ;;
5380 *) case "$use64bitint" in
5381    "$define"|true|[yY]*) dflt='y';;
5382    *) dflt='n';;
5383    esac
5384    case "$d_quad" in
5385    "$define") ;;
5386    *) dflt='n' ;;
5387    esac
5388    cat <<EOM
5389
5390 Perl can be built to take advantage of 64-bit integer types
5391 on some systems.  To do so, Configure can be run with -Duse64bitint.
5392 Choosing this option will most probably introduce binary incompatibilities.
5393
5394 If this doesn't make any sense to you, just accept the default '$dflt'.
5395 (The default has been chosen based on your configuration.)
5396 EOM
5397    rp='Try to use 64-bit integers, if available?'
5398    . ./myread
5399    case "$ans" in
5400    [yY]*) val="$define" ;;
5401    *)     val="$undef"  ;;
5402    esac
5403    ;;
5404 esac
5405 set use64bitint
5406 eval $setvar
5407
5408 case "$use64bitall" in
5409 "$define"|true|[yY]*) dflt='y' ;;
5410 *) case "$longsize" in
5411    8) dflt='y' ;;
5412    *) dflt='n' ;;
5413    esac
5414    ;;
5415 esac    
5416 cat <<EOM
5417
5418 You may also choose to try maximal 64-bitness.  It means using as much
5419 64-bitness as possible on the platform.  This in turn means even more
5420 binary incompatibilities.  On the other hand, your platform may not
5421 have any more 64-bitness available than what you already have chosen.
5422
5423 If this doesn't make any sense to you, just accept the default '$dflt'.
5424 (The default has been chosen based on your configuration.)
5425 EOM
5426 rp='Try to use maximal 64-bit support, if available?'
5427 . ./myread
5428 case "$ans" in
5429 [yY]*) val="$define" ;;
5430 *)     val="$undef"  ;;
5431 esac
5432 set use64bitall
5433 eval $setvar
5434 case "$use64bitall" in
5435 "$define")
5436         case "$use64bitint" in
5437         "$undef")
5438                 cat <<EOM
5439
5440 Since you have chosen a maximally 64-bit build, I'm also turning on
5441 the use of 64-bit integers.
5442 EOM
5443                 use64bitint="$define" ;;
5444         esac
5445         ;;
5446 esac
5447
5448 case "$use64bitint" in
5449 "$define"|true|[yY]*)
5450 : Look for a hint-file generated 'call-back-unit'.  If the
5451 : user has specified that a 64-bit perl is to be built,
5452 : we may need to set or change some other defaults.
5453         if $test -f use64bitint.cbu; then
5454                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5455                 . ./use64bitint.cbu
5456         fi
5457         case "$longsize" in
5458         4) case "$archname64" in
5459            '') archname64=64int ;;
5460            esac
5461            ;;
5462         esac
5463         ;;
5464 esac
5465
5466 case "$use64bitall" in
5467 "$define"|true|[yY]*)
5468 : Look for a hint-file generated 'call-back-unit'.  If the
5469 : user has specified that a maximally 64-bit perl is to be built,
5470 : we may need to set or change some other defaults.
5471         if $test -f use64bitall.cbu; then
5472                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5473                 . ./use64bitall.cbu
5474         fi
5475         case "$longsize" in
5476         4) case "$archname64" in
5477            ''|64int) archname64=64all ;;
5478            esac
5479            ;;
5480         esac
5481         ;;
5482 esac
5483
5484 case "$d_quad:$use64bitint" in
5485 $undef:$define)
5486         cat >&4 <<EOF
5487
5488 *** You have chosen to use 64-bit integers,
5489 *** but none cannot be found.
5490 *** Cannot continue, aborting.
5491
5492 EOF
5493         exit 1
5494         ;;
5495 esac
5496
5497 : check for length of double
5498 echo " "
5499 case "$doublesize" in
5500 '')
5501         echo "Checking to see how big your double precision numbers are..." >&4
5502         $cat >try.c <<EOCP
5503 #include <stdio.h>
5504 #$i_stdlib I_STDLIB
5505 #ifdef I_STDLIB
5506 #include <stdlib.h>
5507 #endif
5508 int main()
5509 {
5510     printf("%d\n", (int)sizeof(double));
5511     exit(0);
5512 }
5513 EOCP
5514         set try
5515         if eval $compile_ok; then
5516                 doublesize=`$run ./try`
5517                 echo "Your double is $doublesize bytes long."
5518         else
5519                 dflt='8'
5520                 echo "(I can't seem to compile the test program.  Guessing...)"
5521                 rp="What is the size of a double precision number (in bytes)?"
5522                 . ./myread
5523                 doublesize="$ans"
5524         fi
5525         ;;
5526 esac
5527 $rm -f try.c try
5528
5529 : check for long doubles
5530 echo " "
5531 echo "Checking to see if you have long double..." >&4
5532 echo 'int main() { long double x = 7.0; }' > try.c
5533 set try
5534 if eval $compile; then
5535         val="$define"
5536         echo "You have long double."
5537 else
5538         val="$undef"
5539         echo "You do not have long double."
5540 fi
5541 $rm try.*
5542 set d_longdbl
5543 eval $setvar
5544
5545 : check for length of long double
5546 case "${d_longdbl}${longdblsize}" in
5547 $define)
5548         echo " "
5549         echo "Checking to see how big your long doubles are..." >&4
5550         $cat >try.c <<'EOCP'
5551 #include <stdio.h>
5552 int main()
5553 {
5554         printf("%d\n", sizeof(long double));
5555 }
5556 EOCP
5557         set try
5558         set try
5559         if eval $compile; then
5560                 longdblsize=`$run ./try`
5561                 echo "Your long doubles are $longdblsize bytes long."
5562         else
5563                 dflt='8'
5564                 echo " "
5565                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5566                 rp="What is the size of a long double (in bytes)?"
5567                 . ./myread
5568                 longdblsize="$ans"
5569         fi
5570         if $test "X$doublesize" = "X$longdblsize"; then
5571                 echo "(That isn't any different from an ordinary double.)"
5572         fi      
5573         ;;
5574 esac
5575 $rm -f try.* try
5576
5577 : determine the architecture name
5578 echo " "
5579 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5580         tarch=`arch`"-$osname"
5581 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5582         if uname -m > tmparch 2>&1 ; then
5583                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5584                         -e 's/$/'"-$osname/" tmparch`
5585         else
5586                 tarch="$osname"
5587         fi
5588         $rm -f tmparch
5589 else
5590         tarch="$osname"
5591 fi
5592 case "$myarchname" in
5593 ''|"$tarch") ;;
5594 *)
5595         echo "(Your architecture name used to be $myarchname.)"
5596         archname=''
5597         ;;
5598 esac
5599 case "$targetarch" in
5600 '') ;;
5601 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5602 esac
5603 myarchname="$tarch"
5604 case "$archname" in
5605 '') dflt="$tarch";;
5606 *) dflt="$archname";;
5607 esac
5608 rp='What is your architecture name'
5609 . ./myread
5610 archname="$ans"
5611 case "$usethreads" in
5612 $define)
5613         echo "Threads selected." >&4
5614         case "$archname" in
5615         *-thread*) echo "...and architecture name already has -thread." >&4
5616                 ;;
5617         *)      archname="$archname-thread"
5618                 echo "...setting architecture name to $archname." >&4
5619                 ;;
5620         esac
5621         ;;
5622 esac
5623 case "$usemultiplicity" in
5624 $define)
5625         echo "Multiplicity selected." >&4
5626         case "$archname" in
5627         *-multi*) echo "...and architecture name already has -multi." >&4
5628                 ;;
5629         *)      archname="$archname-multi"
5630                 echo "...setting architecture name to $archname." >&4
5631                 ;;
5632         esac
5633         ;;
5634 esac
5635 case "$use64bitint$use64bitall" in
5636 *"$define"*)
5637         case "$archname64" in
5638         '')
5639                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5640                 ;;
5641         *)
5642                 case "$use64bitint" in
5643                 "$define") echo "64 bit integers selected." >&4 ;;
5644                 esac
5645                 case "$use64bitall" in
5646                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5647                 esac
5648                 case "$archname" in
5649                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5650                         ;;
5651                 *)      archname="$archname-$archname64"
5652                         echo "...setting architecture name to $archname." >&4
5653                         ;;
5654                 esac
5655                 ;;
5656         esac
5657 esac
5658 case "$uselongdouble" in
5659 $define)
5660         echo "Long doubles selected." >&4
5661         case "$longdblsize" in
5662         $doublesize)
5663                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5664                 ;;
5665         *)
5666                 case "$archname" in
5667                 *-ld*) echo "...and architecture name already has -ld." >&4
5668                         ;;
5669                 *)      archname="$archname-ld"
5670                         echo "...setting architecture name to $archname." >&4
5671                         ;;
5672                 esac
5673                 ;;
5674         esac
5675         ;;
5676 esac
5677 case "$useperlio" in
5678 $define)
5679         echo "Perlio selected." >&4
5680         ;;
5681 *)
5682         echo "Perlio not selected, using stdio." >&4
5683         case "$archname" in
5684         *-stdio*) echo "...and architecture name already has -stdio." >&4
5685                 ;;
5686         *)      archname="$archname-stdio"
5687                 echo "...setting architecture name to $archname." >&4
5688                 ;;
5689         esac
5690         ;;
5691 esac
5692
5693 : determine root of directory hierarchy where package will be installed.
5694 case "$prefix" in
5695 '')
5696         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5697         ;;
5698 *?/)
5699         dflt=`echo "$prefix" | sed 's/.$//'`
5700         ;;
5701 *)
5702         dflt="$prefix"
5703         ;;
5704 esac
5705 $cat <<EOM
5706
5707 By default, $package will be installed in $dflt/bin, manual pages
5708 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5709 installation directories. Typically this is something like /usr/local.
5710 If you wish to have binaries under /usr/bin but other parts of the
5711 installation under /usr/local, that's ok: you will be prompted
5712 separately for each of the installation directories, the prefix being
5713 only used to set the defaults.
5714
5715 EOM
5716 fn=d~
5717 rp='Installation prefix to use?'
5718 . ./getfile
5719 oldprefix=''
5720 case "$prefix" in
5721 '') ;;
5722 *)
5723         case "$ans" in
5724         "$prefix") ;;
5725         *) oldprefix="$prefix";;
5726         esac
5727         ;;
5728 esac
5729 prefix="$ans"
5730 prefixexp="$ansexp"
5731
5732 case "$afsroot" in
5733 '')     afsroot=/afs ;;
5734 *)      afsroot=$afsroot ;;
5735 esac
5736
5737 : is AFS running?
5738 echo " "
5739 case "$afs" in
5740 $define|true)   afs=true ;;
5741 $undef|false)   afs=false ;;
5742 *)      if test -d $afsroot; then
5743                 afs=true
5744         else
5745                 afs=false
5746         fi
5747         ;;
5748 esac
5749 if $afs; then
5750         echo "AFS may be running... I'll be extra cautious then..." >&4
5751 else
5752         echo "AFS does not seem to be running..." >&4
5753 fi
5754
5755 : determine installation prefix for where package is to be installed.
5756 if $afs; then 
5757 $cat <<EOM
5758
5759 Since you are running AFS, I need to distinguish the directory in which
5760 files will reside from the directory in which they are installed (and from
5761 which they are presumably copied to the former directory by occult means).
5762
5763 EOM
5764         case "$installprefix" in
5765         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5766         *) dflt="$installprefix";;
5767         esac
5768 else
5769 $cat <<EOM
5770
5771 In some special cases, particularly when building $package for distribution,
5772 it is convenient to distinguish the directory in which files should be
5773 installed from the directory ($prefix) in which they will
5774 eventually reside.  For most users, these two directories are the same.
5775
5776 EOM
5777         case "$installprefix" in
5778         '') dflt=$prefix ;;
5779         *) dflt=$installprefix;;
5780         esac
5781 fi
5782 fn=d~
5783 rp='What installation prefix should I use for installing files?'
5784 . ./getfile
5785 installprefix="$ans"
5786 installprefixexp="$ansexp"
5787
5788 : set the prefixit variable, to compute a suitable default value
5789 prefixit='case "$3" in
5790 ""|none)
5791         case "$oldprefix" in
5792         "") eval "$1=\"\$$2\"";;
5793         *)
5794                 case "$3" in
5795                 "") eval "$1=";;
5796                 none)
5797                         eval "tp=\"\$$2\"";
5798                         case "$tp" in
5799                         ""|" ") eval "$1=\"\$$2\"";;
5800                         *) eval "$1=";;
5801                         esac;;
5802                 esac;;
5803         esac;;
5804 *)
5805         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5806         case "$tp" in
5807         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5808         /*-$oldprefix/*|\~*-$oldprefix/*)
5809                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5810         *) eval "$1=\"\$$2\"";;
5811         esac;;
5812 esac'
5813
5814 : get the patchlevel
5815 echo " "
5816 echo "Getting the current patchlevel..." >&4
5817 if $test -r $rsrc/patchlevel.h;then
5818         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5819         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5820         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5821         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5822         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5823         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5824        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5825 else
5826         revision=0
5827         patchlevel=0
5828         subversion=0
5829         api_revision=0
5830         api_version=0
5831         api_subversion=0
5832         perl_patchlevel=0
5833         $echo "(You do not have patchlevel.h.  Eek.)"
5834 fi
5835 if $test -r $rsrc/.patch ; then  
5836         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5837                 perl_patchlevel=`cat $rsrc/.patch`
5838         fi
5839 fi
5840 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5841 version_patchlevel_string="version $patchlevel subversion $subversion"
5842 case "$perl_patchlevel" in
5843 0|'') ;;
5844 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5845 esac
5846
5847 $echo "(You have $package $version_patchlevel_string.)"
5848
5849 case "$osname" in
5850 dos|vms)
5851         : XXX Should be a Configure test for double-dots in filenames.
5852         version=`echo $revision $patchlevel $subversion | \
5853                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5854         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5855                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5856         ;;
5857 *)
5858         version=`echo $revision $patchlevel $subversion | \
5859                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5860         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5861                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5862         ;;
5863 esac
5864 : Special case the 5.005_xx maintenance series, which used 5.005
5865 : without any subversion label as a subdirectory in $sitelib
5866 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5867         api_versionstring='5.005'
5868 fi
5869
5870 : determine installation style
5871 : For now, try to deduce it from prefix unless it is already set.
5872 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5873 case "$installstyle" in
5874 '')     case "$prefix" in
5875                 *perl*) dflt='lib';;
5876                 *) dflt='lib/perl5' ;;
5877         esac
5878         ;;
5879 *)      dflt="$installstyle" ;;
5880 esac
5881 : Probably not worth prompting for this since we prompt for all
5882 : the directories individually, and the prompt would be too long and
5883 : confusing anyway.
5884 installstyle=$dflt
5885
5886 : determine where private library files go
5887 : Usual default is /usr/local/lib/perl5/$version.
5888 : Also allow things like /opt/perl/lib/$version, since 
5889 : /opt/perl/lib/perl5... would be redundant.
5890 : The default "style" setting is made in installstyle.U
5891 case "$installstyle" in
5892 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5893 *)       set dflt privlib lib/$version ;;
5894 esac
5895 eval $prefixit
5896 $cat <<EOM
5897
5898 There are some auxiliary files for $package that need to be put into a
5899 private library directory that is accessible by everyone.
5900
5901 EOM
5902 fn=d~+
5903 rp='Pathname where the private library files will reside?'
5904 . ./getfile
5905 privlib="$ans"
5906 privlibexp="$ansexp"
5907 : Change installation prefix, if necessary.
5908 if $test X"$prefix" != X"$installprefix"; then
5909         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5910 else
5911         installprivlib="$privlibexp"
5912 fi
5913
5914 : set the prefixup variable, to restore leading tilda escape
5915 prefixup='case "$prefixexp" in
5916 "$prefix") ;;
5917 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5918 esac'
5919
5920 : determine where public architecture dependent libraries go
5921 set archlib archlib
5922 eval $prefixit
5923 : privlib default is /usr/local/lib/$package/$version
5924 : archlib default is /usr/local/lib/$package/$version/$archname
5925 : privlib may have an optional trailing /share.
5926 tdflt=`echo $privlib | $sed 's,/share$,,'`
5927 tdflt=$tdflt/$archname
5928 case "$archlib" in
5929 '')     dflt=$tdflt
5930         ;;
5931 *)      dflt="$archlib"
5932     ;;
5933 esac
5934 $cat <<EOM
5935
5936 $spackage contains architecture-dependent library files.  If you are
5937 sharing libraries in a heterogeneous environment, you might store
5938 these files in a separate location.  Otherwise, you can just include
5939 them with the rest of the public library files.
5940
5941 EOM
5942 fn=d+~
5943 rp='Where do you want to put the public architecture-dependent libraries?'
5944 . ./getfile
5945 archlib="$ans"
5946 archlibexp="$ansexp"
5947 if $test X"$archlib" = X"$privlib"; then
5948         d_archlib="$undef"
5949 else
5950         d_archlib="$define"
5951 fi
5952 : Change installation prefix, if necessary.
5953 if $test X"$prefix" != X"$installprefix"; then
5954         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5955 else
5956         installarchlib="$archlibexp"
5957 fi
5958
5959 : see if setuid scripts can be secure
5960 $cat <<EOM
5961
5962 Some kernels have a bug that prevents setuid #! scripts from being
5963 secure.  Some sites have disabled setuid #! scripts because of this.
5964
5965 First let's decide if your kernel supports secure setuid #! scripts.
5966 (If setuid #! scripts would be secure but have been disabled anyway,
5967 don't say that they are secure if asked.)
5968
5969 EOM
5970
5971 val="$undef"
5972 if $test -d /dev/fd; then
5973         echo "#!$ls" >reflect
5974         chmod +x,u+s reflect
5975         ./reflect >flect 2>&1
5976         if $contains "/dev/fd" flect >/dev/null; then
5977                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5978                 val="$define"
5979         else
5980                 $cat <<EOM
5981 If you are not sure if they are secure, I can check but I'll need a
5982 username and password different from the one you are using right now.
5983 If you don't have such a username or don't want me to test, simply
5984 enter 'none'.
5985
5986 EOM
5987                 rp='Other username to test security of setuid scripts with?'
5988                 dflt='none'
5989                 . ./myread
5990                 case "$ans" in
5991                 n|none)
5992                         case "$d_suidsafe" in
5993                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5994                                 dflt=n;;
5995                         "$undef")
5996                                 echo "Well, the $hint value is *not* secure." >&4
5997                                 dflt=n;;
5998                         *)      echo "Well, the $hint value *is* secure." >&4
5999                                 dflt=y;;
6000                         esac
6001                         ;;
6002                 *)
6003                         $rm -f reflect flect
6004                         echo "#!$ls" >reflect
6005                         chmod +x,u+s reflect
6006                         echo >flect
6007                         chmod a+w flect
6008                         echo '"su" will (probably) prompt you for '"$ans's password."
6009                         su $ans -c './reflect >flect'
6010                         if $contains "/dev/fd" flect >/dev/null; then
6011                                 echo "Okay, it looks like setuid scripts are secure." >&4
6012                                 dflt=y
6013                         else
6014                                 echo "I don't think setuid scripts are secure." >&4
6015                                 dflt=n
6016                         fi
6017                         ;;
6018                 esac
6019                 rp='Does your kernel have *secure* setuid scripts?'
6020                 . ./myread
6021                 case "$ans" in
6022                 [yY]*)  val="$define";;
6023                 *)      val="$undef";;
6024                 esac
6025         fi
6026 else
6027         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6028         echo "(That's for file descriptors, not floppy disks.)"
6029         val="$undef"
6030 fi
6031 set d_suidsafe
6032 eval $setvar
6033
6034 $rm -f reflect flect
6035
6036 : now see if they want to do setuid emulation
6037 echo " "
6038 val="$undef"
6039 case "$d_suidsafe" in
6040 "$define")
6041         val="$undef"
6042         echo "No need to emulate SUID scripts since they are secure here." >&4
6043         ;;
6044 *)
6045         $cat <<EOM
6046 Some systems have disabled setuid scripts, especially systems where
6047 setuid scripts cannot be secure.  On systems where setuid scripts have
6048 been disabled, the setuid/setgid bits on scripts are currently
6049 useless.  It is possible for $package to detect those bits and emulate
6050 setuid/setgid in a secure fashion.  This emulation will only work if
6051 setuid scripts have been disabled in your kernel.
6052
6053 EOM
6054         case "$d_dosuid" in
6055         "$define") dflt=y ;;
6056         *) dflt=n ;;
6057         esac
6058         rp="Do you want to do setuid/setgid emulation?"
6059         . ./myread
6060         case "$ans" in
6061         [yY]*)  val="$define";;
6062         *)      val="$undef";;
6063         esac
6064         ;;
6065 esac
6066 set d_dosuid
6067 eval $setvar
6068
6069 : see if this is a malloc.h system
6070 : we want a real compile instead of Inhdr because some systems have a
6071 : malloc.h that just gives a compile error saying to use stdlib.h instead
6072 echo " "
6073 $cat >try.c <<EOCP
6074 #include <stdlib.h>
6075 #include <malloc.h>
6076 int main () { return 0; }
6077 EOCP
6078 set try
6079 if eval $compile; then
6080     echo "<malloc.h> found." >&4
6081     val="$define"
6082 else
6083     echo "<malloc.h> NOT found." >&4
6084     val="$undef"
6085 fi
6086 $rm -f try.c try
6087 set i_malloc
6088 eval $setvar
6089
6090 : check for void type
6091 echo " "
6092 echo "Checking to see how well your C compiler groks the void type..." >&4
6093 case "$voidflags" in
6094 '')
6095         $cat >try.c <<EOCP
6096 #$i_stdlib I_STDLIB
6097 #ifdef I_STDLIB
6098 #include <stdlib.h>
6099 #endif
6100 #if TRY & 1
6101 void sub() {
6102 #else
6103 sub() {
6104 #endif
6105         extern void moo();      /* function returning void */
6106         void (*goo)();          /* ptr to func returning void */
6107 #if TRY & 8
6108         void *hue;              /* generic ptr */
6109 #endif
6110 #if TRY & 2
6111         void (*foo[10])();
6112 #endif
6113
6114 #if TRY & 4
6115         if(goo == moo) {
6116                 exit(0);
6117         }
6118 #endif
6119         exit(0);
6120 }
6121 int main() { sub(); }
6122 EOCP
6123         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6124                 voidflags=$defvoidused
6125         echo "Good.  It appears to support void to the level $package wants.">&4
6126                 if $contains warning .out >/dev/null 2>&1; then
6127                         echo "However, you might get some warnings that look like this:"
6128                         $cat .out
6129                 fi
6130         else
6131 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6132                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6133                         echo "It supports 1..."
6134                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6135                                 echo "It also supports 2..."
6136                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6137                                         voidflags=7
6138                                         echo "And it supports 4 but not 8 definitely."
6139                                 else
6140                                         echo "It doesn't support 4..."
6141                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6142                                                 voidflags=11
6143                                                 echo "But it supports 8."
6144                                         else
6145                                                 voidflags=3
6146                                                 echo "Neither does it support 8."
6147                                         fi
6148                                 fi
6149                         else
6150                                 echo "It does not support 2..."
6151                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6152                                         voidflags=13
6153                                         echo "But it supports 4 and 8."
6154                                 else
6155                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6156                                                 voidflags=5
6157                                                 echo "And it supports 4 but has not heard about 8."
6158                                         else
6159                                                 echo "However it supports 8 but not 4."
6160                                         fi
6161                                 fi
6162                         fi
6163                 else
6164                         echo "There is no support at all for void."
6165                         voidflags=0
6166                 fi
6167         fi
6168 esac
6169 case "$voidflags" in
6170 "$defvoidused") ;;
6171 *)      $cat >&4 <<'EOM'
6172   Support flag bits are:
6173     1: basic void declarations.
6174     2: arrays of pointers to functions returning void.
6175     4: operations between pointers to and addresses of void functions.
6176     8: generic void pointers.
6177 EOM
6178         dflt="$voidflags";
6179         rp="Your void support flags add up to what?"
6180         . ./myread
6181         voidflags="$ans"
6182         ;;
6183 esac
6184 $rm -f try.* .out
6185
6186 : check for length of pointer
6187 echo " "
6188 case "$ptrsize" in
6189 '')
6190         echo "Checking to see how big your pointers are..." >&4
6191         if test "$voidflags" -gt 7; then
6192                 echo '#define VOID_PTR char *' > try.c
6193         else
6194                 echo '#define VOID_PTR void *' > try.c
6195         fi
6196         $cat >>try.c <<EOCP
6197 #include <stdio.h>
6198 #$i_stdlib I_STDLIB
6199 #ifdef I_STDLIB
6200 #include <stdlib.h>
6201 #endif
6202 int main()
6203 {
6204     printf("%d\n", (int)sizeof(VOID_PTR));
6205     exit(0);
6206 }
6207 EOCP
6208         set try
6209         if eval $compile_ok; then
6210                 ptrsize=`$run ./try`
6211                 echo "Your pointers are $ptrsize bytes long."
6212         else
6213                 dflt='4'
6214                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6215                 rp="What is the size of a pointer (in bytes)?"
6216                 . ./myread
6217                 ptrsize="$ans"
6218         fi
6219         ;;
6220 esac
6221 $rm -f try.c try
6222 case "$use64bitall" in
6223 "$define"|true|[yY]*)
6224         case "$ptrsize" in
6225         4)      cat <<EOM >&4
6226
6227 *** You have chosen a maximally 64-bit build,
6228 *** but your pointers are only 4 bytes wide.
6229 *** Cannot continue, aborting.
6230
6231 EOM
6232                 exit 1
6233                 ;;
6234         esac
6235         ;;
6236 esac
6237
6238
6239 : determine which malloc to compile in
6240 echo " "
6241 case "$usemymalloc" in
6242 [yY]*|true|$define)     dflt='y' ;;
6243 [nN]*|false|$undef)     dflt='n' ;;
6244 *)      case "$ptrsize" in
6245         4) dflt='y' ;;
6246         *) dflt='n' ;;
6247         esac
6248         ;;
6249 esac
6250 rp="Do you wish to attempt to use the malloc that comes with $package?"
6251 . ./myread
6252 usemymalloc="$ans"
6253 case "$ans" in
6254 y*|true)
6255         usemymalloc='y'
6256         mallocsrc='malloc.c'
6257         mallocobj="malloc$_o"
6258         d_mymalloc="$define"
6259         case "$libs" in
6260         *-lmalloc*)
6261                 : Remove malloc from list of libraries to use
6262                 echo "Removing unneeded -lmalloc from library list" >&4
6263                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6264                 shift
6265                 libs="$*"
6266                 echo "libs = $libs" >&4
6267                 ;;
6268         esac
6269         ;;
6270 *)
6271         usemymalloc='n'
6272         mallocsrc=''
6273         mallocobj=''
6274         d_mymalloc="$undef"
6275         ;;
6276 esac
6277
6278 : compute the return types of malloc and free
6279 echo " "
6280 $cat >malloc.c <<END
6281 #$i_malloc I_MALLOC
6282 #$i_stdlib I_STDLIB
6283 #include <stdio.h>
6284 #include <sys/types.h>
6285 #ifdef I_MALLOC
6286 #include <malloc.h>
6287 #endif
6288 #ifdef I_STDLIB
6289 #include <stdlib.h>
6290 #endif
6291 #ifdef TRY_MALLOC
6292 void *malloc();
6293 #endif
6294 #ifdef TRY_FREE
6295 void free();
6296 #endif
6297 END
6298 case "$malloctype" in
6299 '')
6300         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6301                 malloctype='void *'
6302         else
6303                 malloctype='char *'
6304         fi
6305         ;;
6306 esac
6307 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6308
6309 case "$freetype" in
6310 '')
6311         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6312                 freetype='void'
6313         else
6314                 freetype='int'
6315         fi
6316         ;;
6317 esac
6318 echo "Your system uses $freetype free(), it would seem." >&4
6319 $rm -f malloc.[co]
6320 $cat <<EOM
6321
6322 After $package is installed, you may wish to install various
6323 add-on modules and utilities.  Typically, these add-ons will
6324 be installed under $prefix with the rest
6325 of this package.  However, you may wish to install such add-ons
6326 elsewhere under a different prefix.
6327
6328 If you do not wish to put everything under a single prefix, that's
6329 ok.  You will be prompted for the individual locations; this siteprefix
6330 is only used to suggest the defaults.
6331
6332 The default should be fine for most people.
6333
6334 EOM
6335 fn=d~+
6336 rp='Installation prefix to use for add-on modules and utilities?'
6337 : XXX Here might be another good place for an installstyle setting.
6338 case "$siteprefix" in
6339 '') dflt=$prefix ;;
6340 *)  dflt=$siteprefix ;;
6341 esac
6342 . ./getfile
6343 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6344 oldsiteprefix=''
6345 case "$siteprefix" in
6346 '') ;;
6347 *)      case "$ans" in
6348         "$prefix") ;;
6349         *) oldsiteprefix="$prefix";;
6350         esac
6351         ;;
6352 esac
6353 siteprefix="$ans"
6354 siteprefixexp="$ansexp"
6355
6356 : determine where site specific libraries go.
6357 : Usual default is /usr/local/lib/perl5/site_perl/$version
6358 : The default "style" setting is made in installstyle.U
6359 : XXX No longer works with Prefixit stuff.
6360 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6361 case "$sitelib" in
6362 '') case "$installstyle" in
6363         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6364         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6365         esac
6366         ;;
6367 *)      dflt="$sitelib"
6368         ;;
6369 esac
6370 $cat <<EOM
6371
6372 The installation process will create a directory for
6373 site-specific extensions and modules.  Most users find it convenient
6374 to place all site-specific files in this directory rather than in the
6375 main distribution directory.
6376
6377 EOM
6378 fn=d~+
6379 rp='Pathname for the site-specific library files?'
6380 . ./getfile
6381 sitelib="$ans"
6382 sitelibexp="$ansexp"
6383 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6384 : Change installation prefix, if necessary.
6385 if $test X"$prefix" != X"$installprefix"; then
6386         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6387 else
6388         installsitelib="$sitelibexp"
6389 fi
6390
6391 : determine where site specific architecture-dependent libraries go.
6392 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6393 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6394 : sitelib may have an optional trailing /share.
6395 case "$sitearch" in
6396 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6397         dflt="$dflt/$archname"
6398         ;;
6399 *)      dflt="$sitearch"
6400         ;;
6401 esac
6402 set sitearch sitearch none
6403 eval $prefixit
6404 $cat <<EOM
6405
6406 The installation process will also create a directory for
6407 architecture-dependent site-specific extensions and modules.
6408
6409 EOM
6410 fn=d~+
6411 rp='Pathname for the site-specific architecture-dependent library files?'
6412 . ./getfile
6413 sitearch="$ans"
6414 sitearchexp="$ansexp"
6415 : Change installation prefix, if necessary.
6416 if $test X"$prefix" != X"$installprefix"; then
6417         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6418 else
6419         installsitearch="$sitearchexp"
6420 fi
6421
6422 $cat <<EOM
6423
6424 The installation process will also create a directory for
6425 vendor-supplied add-ons.  Vendors who supply perl with their system
6426 may find it convenient to place all vendor-supplied files in this
6427 directory rather than in the main distribution directory.  This will
6428 ease upgrades between binary-compatible maintenance versions of perl.
6429
6430 Of course you may also use these directories in whatever way you see
6431 fit.  For example, you might use them to access modules shared over a
6432 company-wide network.
6433
6434 The default answer should be fine for most people.
6435 This causes further questions about vendor add-ons to be skipped
6436 and no vendor-specific directories will be configured for perl.
6437
6438 EOM
6439 rp='Do you want to configure vendor-specific add-on directories?'
6440 case "$usevendorprefix" in
6441 define|true|[yY]*) dflt=y ;;
6442 *)      : User may have set vendorprefix directly on Configure command line.
6443         case "$vendorprefix" in
6444         ''|' ') dflt=n ;;
6445         *)      dflt=y ;;
6446         esac
6447         ;;
6448 esac
6449 . ./myread
6450 case "$ans" in
6451 [yY]*)  fn=d~+
6452         rp='Installation prefix to use for vendor-supplied add-ons?'
6453         case "$vendorprefix" in
6454         '') dflt='' ;;
6455         *)  dflt=$vendorprefix ;;
6456         esac
6457         . ./getfile
6458         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6459         oldvendorprefix=''
6460         case "$vendorprefix" in
6461         '') ;;
6462         *)      case "$ans" in
6463                 "$prefix") ;;
6464                 *) oldvendorprefix="$prefix";;
6465                 esac
6466                 ;;
6467         esac
6468         usevendorprefix="$define"
6469         vendorprefix="$ans"
6470         vendorprefixexp="$ansexp"
6471         ;;
6472 *)      usevendorprefix="$undef"
6473         vendorprefix=''
6474         vendorprefixexp=''
6475         ;;
6476 esac
6477
6478 case "$vendorprefix" in
6479 '')     d_vendorlib="$undef"
6480         vendorlib=''
6481         vendorlibexp=''
6482         ;;
6483 *)      d_vendorlib="$define"
6484         : determine where vendor-supplied modules go.
6485         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6486         case "$vendorlib" in
6487         '')
6488                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6489                 case "$installstyle" in
6490                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6491                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6492                 esac
6493                 ;;
6494         *)      dflt="$vendorlib"
6495                 ;;
6496         esac
6497         fn=d~+
6498         rp='Pathname for the vendor-supplied library files?'
6499         . ./getfile
6500         vendorlib="$ans"
6501         vendorlibexp="$ansexp"
6502         ;;
6503 esac
6504 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6505 : Change installation prefix, if necessary.
6506 if $test X"$prefix" != X"$installprefix"; then
6507         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6508 else
6509         installvendorlib="$vendorlibexp"
6510 fi
6511
6512 case "$vendorprefix" in
6513 '')     d_vendorarch="$undef"
6514         vendorarch=''
6515         vendorarchexp=''
6516         ;;
6517 *)      d_vendorarch="$define"
6518         : determine where vendor-supplied architecture-dependent libraries go.
6519         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6520         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6521         : vendorlib may have an optional trailing /share.
6522         case "$vendorarch" in
6523         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6524                 dflt="$dflt/$archname"
6525                 ;;
6526         *)      dflt="$vendorarch" ;;
6527         esac
6528         fn=d~+
6529         rp='Pathname for vendor-supplied architecture-dependent files?'
6530         . ./getfile
6531         vendorarch="$ans"
6532         vendorarchexp="$ansexp"
6533         ;;
6534 esac
6535 : Change installation prefix, if necessary.
6536 if $test X"$prefix" != X"$installprefix"; then
6537         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6538 else
6539         installvendorarch="$vendorarchexp"
6540 fi
6541
6542 : Final catch-all directories to search
6543 $cat <<EOM
6544
6545 Lastly, you can have perl look in other directories for extensions and
6546 modules in addition to those already specified.
6547 These directories will be searched after 
6548         $sitearch 
6549         $sitelib 
6550 EOM
6551 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6552 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6553 echo ' '
6554 case "$otherlibdirs" in
6555 ''|' ') dflt='none' ;;
6556 *)      dflt="$otherlibdirs" ;;
6557 esac
6558 $cat <<EOM
6559 Enter a colon-separated set of extra paths to include in perl's @INC
6560 search path, or enter 'none' for no extra paths.
6561
6562 EOM
6563
6564 rp='Colon-separated list of additional directories for perl to search?'
6565 . ./myread
6566 case "$ans" in
6567 ' '|''|none)    otherlibdirs=' ' ;;     
6568 *)      otherlibdirs="$ans" ;;
6569 esac
6570 case "$otherlibdirs" in
6571 ' ') val=$undef ;;
6572 *)      val=$define ;;
6573 esac
6574 set d_perl_otherlibdirs
6575 eval $setvar
6576
6577 : Cruising for prototypes
6578 echo " "
6579 echo "Checking out function prototypes..." >&4
6580 $cat >prototype.c <<EOCP
6581 #$i_stdlib I_STDLIB
6582 #ifdef I_STDLIB
6583 #include <stdlib.h>
6584 #endif
6585 int main(int argc, char *argv[]) {
6586         exit(0);}
6587 EOCP
6588 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6589         echo "Your C compiler appears to support function prototypes."
6590         val="$define"
6591 else
6592         echo "Your C compiler doesn't seem to understand function prototypes."
6593         val="$undef"
6594 fi
6595 set prototype
6596 eval $setvar
6597 $rm -f prototype*
6598
6599 case "$prototype" in
6600 "$define") ;;
6601 *)      ansi2knr='ansi2knr'
6602         echo " "
6603         cat <<EOM >&4
6604
6605 $me:  FATAL ERROR:
6606 This version of $package can only be compiled by a compiler that 
6607 understands function prototypes.  Unfortunately, your C compiler 
6608         $cc $ccflags
6609 doesn't seem to understand them.  Sorry about that.
6610
6611 If GNU cc is available for your system, perhaps you could try that instead.  
6612
6613 Eventually, we hope to support building Perl with pre-ANSI compilers.
6614 If you would like to help in that effort, please contact <perlbug@perl.org>.
6615
6616 Aborting Configure now.
6617 EOM
6618         exit 2
6619         ;;
6620 esac
6621
6622 : determine where public executables go
6623 echo " "
6624 set dflt bin bin
6625 eval $prefixit
6626 fn=d~
6627 rp='Pathname where the public executables will reside?'
6628 . ./getfile
6629 if $test "X$ansexp" != "X$binexp"; then
6630         installbin=''
6631 fi
6632 bin="$ans"
6633 binexp="$ansexp"
6634 : Change installation prefix, if necessary.
6635 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6636 if $test X"$prefix" != X"$installprefix"; then
6637         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6638 else
6639         installbin="$binexp"
6640 fi
6641
6642 echo " "
6643 case "$extras" in
6644 '') dflt='n';;
6645 *) dflt='y';;
6646 esac
6647 cat <<EOM
6648 Perl can be built with extra modules or bundles of modules which
6649 will be fetched from the CPAN and installed alongside Perl.
6650
6651 Notice that you will need access to the CPAN; either via the Internet,
6652 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6653 be asked later to configure the CPAN.pm module which will in turn do
6654 the installation of the rest of the extra modules or bundles.)
6655
6656 Notice also that if the modules require any external software such as
6657 libraries and headers (the libz library and the zlib.h header for the
6658 Compress::Zlib module, for example) you MUST have any such software
6659 already installed, this configuration process will NOT install such
6660 things for you.
6661
6662 If this doesn't make any sense to you, just accept the default '$dflt'.
6663 EOM
6664 rp='Install any extra modules (y or n)?'
6665 . ./myread
6666 case "$ans" in
6667 y|Y)
6668         cat <<EOM
6669
6670 Please list any extra modules or bundles to be installed from CPAN,
6671 with spaces between the names.  The names can be in any format the
6672 'install' command of CPAN.pm will understand.  (Answer 'none',
6673 without the quotes, to install no extra modules or bundles.)
6674 EOM
6675         rp='Extras?'
6676         dflt="$extras"
6677         . ./myread
6678         extras="$ans"
6679 esac
6680 case "$extras" in
6681 ''|'none')
6682         val=''
6683         $rm -f ../extras.lst
6684         ;;
6685 *)      echo "(Saving the list of extras for later...)"
6686         echo "$extras" > ../extras.lst
6687         val="'$extras'"
6688         ;;
6689 esac
6690 set extras
6691 eval $setvar
6692 echo " "
6693
6694 : determine where html pages for programs go
6695 set html1dir html1dir none
6696 eval $prefixit
6697 $cat <<EOM
6698
6699 If you wish to install html files for programs in $spackage, indicate 
6700 the appropriate directory here.  To skip installing html files,
6701 answer "none".
6702 EOM
6703 case "$html1dir" in
6704 ''|none|$undef|' ') dflt=none ;;
6705 *) dflt=$html1dir ;;
6706 esac
6707 fn=dn+~
6708 rp="Directory for the main $spackage html pages?"
6709 . ./getfile
6710 html1dir="$ans"
6711 html1direxp="$ansexp"
6712 : Use ' ' for none so value is preserved next time through Configure
6713 $test X"$html1dir" = "X" && html1dir=' '
6714 : Change installation prefix, if necessary.
6715 if $test X"$prefix" != X"$installprefix"; then
6716         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6717 else
6718         installhtml1dir="$html1direxp"
6719 fi
6720
6721 : determine where html pages for libraries and modules go
6722 set html3dir html3dir none
6723 eval $prefixit
6724 $cat <<EOM
6725
6726 If you wish to install html files for modules associated with $spackage,
6727 indicate the appropriate directory here.  To skip installing html files,
6728 answer "none".
6729 EOM
6730 : There is no obvious default.  If they have specified html1dir, then
6731 : try to key off that, possibly changing .../html1 into .../html3.
6732 case "$html3dir" in
6733 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6734 *) dflt=$html3dir ;;
6735 esac
6736 fn=dn+~
6737 rp="Directory for the $spackage module html pages?"
6738 . ./getfile
6739 html3dir="$ans"
6740 html3direxp="$ansexp"
6741 : Use ' ' for none so value is preserved next time through Configure
6742 $test X"$html3dir" = "X" && html3dir=' '
6743 : Change installation prefix, if necessary.
6744 if $test X"$prefix" != X"$installprefix"; then
6745         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6746 else
6747         installhtml3dir="$html3direxp"
6748 fi
6749
6750 : Find perl5.005 or later.
6751 echo "Looking for a previously installed perl5.005 or later... "
6752 case "$perl5" in
6753 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6754                 : Check if this perl is recent and can load a simple module
6755                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6756                         perl5=$tdir/perl
6757                         break;
6758                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6759                         perl5=$tdir/perl5
6760                         break;
6761                 fi
6762         done
6763         ;;
6764 *)      perl5="$perl5"
6765         ;;
6766 esac
6767 case "$perl5" in
6768 '')     echo "None found.  That's ok.";;
6769 *)      echo "Using $perl5." ;;
6770 esac
6771
6772 : Determine list of previous versions to include in @INC
6773 $cat > getverlist <<EOPL
6774 #!$perl5 -w
6775 use File::Basename;
6776 \$api_versionstring = "$api_versionstring";
6777 \$version = "$version";
6778 \$stem = "$sitelib_stem";
6779 \$archname = "$archname";
6780 EOPL
6781         $cat >> getverlist <<'EOPL'
6782 # Can't have leading @ because metaconfig interprets it as a command!
6783 ;@inc_version_list=();
6784 # XXX Redo to do opendir/readdir? 
6785 if (-d $stem) {
6786     chdir($stem);
6787     ;@candidates = glob("5.*");
6788 }
6789 else {
6790     ;@candidates = ();
6791 }
6792
6793 # XXX ToDo:  These comparisons must be reworked when two-digit
6794 # subversions come along, so that 5.7.10 compares as greater than
6795 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6796 # widespread that we can use the built-in version vectors rather
6797 # than reinventing them here.  For 5.6.0, however, we must
6798 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6799 foreach $d (@candidates) {
6800     if ($d lt $version) {
6801         if ($d ge $api_versionstring) {
6802             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6803         }
6804         elsif ($d ge "5.005") {
6805             unshift(@inc_version_list, grep { -d } $d);
6806         }
6807     }
6808     else {
6809         # Skip newer version.  I.e. don't look in
6810         # 5.7.0 if we're installing 5.6.1.
6811     }
6812 }
6813
6814 if (@inc_version_list) {
6815     print join(' ', @inc_version_list);
6816 }
6817 else {
6818     # Blank space to preserve value for next Configure run.
6819     print " ";
6820 }
6821 EOPL
6822 chmod +x getverlist
6823 case "$inc_version_list" in
6824 '')     if test -x "$perl5$exe_ext"; then
6825                 dflt=`$perl5 getverlist`
6826         else
6827                 dflt='none'
6828         fi
6829         ;;
6830 $undef) dflt='none' ;;
6831 *)  eval dflt=\"$inc_version_list\" ;;
6832 esac
6833 case "$dflt" in
6834 ''|' ') dflt=none ;;
6835 esac
6836 case "$dflt" in
6837 5.005) dflt=none ;;
6838 esac
6839 $cat <<EOM
6840
6841 In order to ease the process of upgrading, this version of perl 
6842 can be configured to use modules built and installed with earlier 
6843 versions of perl that were installed under $prefix.  Specify here
6844 the list of earlier versions that this version of perl should check.
6845 If Configure detected no earlier versions of perl installed under
6846 $prefix, then the list will be empty.  Answer 'none' to tell perl
6847 to not search earlier versions.
6848
6849 The default should almost always be sensible, so if you're not sure,
6850 just accept the default.
6851 EOM
6852
6853 rp='List of earlier versions to include in @INC?'
6854 . ./myread
6855 case "$ans" in
6856 [Nn]one|''|' ') inc_version_list=' ' ;;
6857 *) inc_version_list="$ans" ;;
6858 esac
6859 case "$inc_version_list" in
6860 ''|' ') 
6861         inc_version_list_init='0';;
6862 *)      inc_version_list_init=`echo $inc_version_list |
6863                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6864         ;;
6865 esac
6866 $rm -f getverlist
6867
6868 : determine whether to install perl also as /usr/bin/perl
6869
6870 echo " "
6871 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6872         $cat <<EOM
6873 Many scripts expect perl to be installed as /usr/bin/perl.
6874
6875 If you want to, I can install the perl you are about to compile
6876 as /usr/bin/perl (in addition to $bin/perl).
6877 EOM
6878         if test -f /usr/bin/perl; then
6879             $cat <<EOM
6880
6881 However, please note that because you already have a /usr/bin/perl,
6882 overwriting that with a new Perl would very probably cause problems.
6883 Therefore I'm assuming you don't want to do that (unless you insist).
6884
6885 EOM
6886             case "$installusrbinperl" in
6887             "$define"|[yY]*)    dflt='y';;
6888             *)                  dflt='n';;
6889             esac
6890         else
6891             $cat <<EOM
6892
6893 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6894
6895 EOM
6896             case "$installusrbinperl" in
6897             "$undef"|[nN]*)     dflt='n';;
6898             *)                  dflt='y';;
6899             esac
6900         fi
6901         rp="Do you want to install perl as /usr/bin/perl?"
6902         . ./myread
6903         case "$ans" in
6904         [yY]*)  val="$define";;
6905         *)      val="$undef" ;;
6906         esac
6907 else
6908         val="$undef"
6909 fi
6910 set installusrbinperl
6911 eval $setvar
6912
6913 echo " "
6914 echo "Checking for GNU C Library..." >&4
6915 cat >try.c <<'EOCP'
6916 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6917    alone are insufficient to distinguish different versions, such as
6918    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6919    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6920 */
6921 #include <stdio.h>
6922 int main(void)
6923 {
6924 #ifdef __GLIBC__
6925 #   ifdef __GLIBC_MINOR__
6926 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
6927 #           include <gnu/libc-version.h>
6928             printf("%s\n",  gnu_get_libc_version());
6929 #       else
6930             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6931 #       endif
6932 #   else
6933         printf("%d\n",  __GLIBC__);
6934 #   endif
6935     return 0;
6936 #else
6937     return 1;
6938 #endif
6939 }
6940 EOCP
6941 set try
6942 if eval $compile_ok && $run ./try > glibc.ver; then
6943         val="$define"
6944         gnulibc_version=`$cat glibc.ver`
6945         echo "You are using the GNU C Library version $gnulibc_version"
6946 else
6947         val="$undef"
6948         gnulibc_version=''
6949         echo "You are not using the GNU C Library"
6950 fi
6951 $rm -f try try.* glibc.ver
6952 set d_gnulibc
6953 eval $setvar
6954
6955 : see if nm is to be used to determine whether a symbol is defined or not
6956 case "$usenm" in
6957 '')
6958         dflt=''
6959         case "$d_gnulibc" in
6960         "$define")
6961                 echo " "
6962                 echo "nm probably won't work on the GNU C Library." >&4
6963                 dflt=n
6964                 ;;
6965         esac
6966         case "$dflt" in
6967         '') 
6968                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6969                         echo " "
6970                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6971                         echo "'nm' won't be sufficient on this sytem." >&4
6972                         dflt=n
6973                 fi
6974                 ;;
6975         esac
6976         case "$dflt" in
6977         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6978                 if $test $dflt -gt 20; then
6979                         dflt=y
6980                 else
6981                         dflt=n
6982                 fi
6983                 ;;
6984         esac
6985         ;;
6986 *)
6987         case "$usenm" in
6988         true|$define) dflt=y;;
6989         *) dflt=n;;
6990         esac
6991         ;;
6992 esac
6993 $cat <<EOM
6994
6995 I can use $nm to extract the symbols from your C libraries. This
6996 is a time consuming task which may generate huge output on the disk (up
6997 to 3 megabytes) but that should make the symbols extraction faster. The
6998 alternative is to skip the 'nm' extraction part and to compile a small
6999 test program instead to determine whether each symbol is present. If
7000 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7001 this may be the best solution.
7002
7003 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7004
7005 EOM
7006 rp="Shall I use $nm to extract C symbols from the libraries?"
7007 . ./myread
7008 case "$ans" in
7009 [Nn]*) usenm=false;;
7010 *) usenm=true;;
7011 esac
7012
7013 runnm=$usenm
7014 case "$reuseval" in
7015 true) runnm=false;;
7016 esac
7017
7018 : nm options which may be necessary
7019 case "$nm_opt" in
7020 '') if $test -f /mach_boot; then
7021                 nm_opt=''       # Mach
7022         elif $test -d /usr/ccs/lib; then
7023                 nm_opt='-p'     # Solaris (and SunOS?)
7024         elif $test -f /dgux; then
7025                 nm_opt='-p'     # DG-UX
7026         elif $test -f /lib64/rld; then
7027                 nm_opt='-p'     # 64-bit Irix
7028         else
7029                 nm_opt=''
7030         fi;;
7031 esac
7032
7033 : nm options which may be necessary for shared libraries but illegal
7034 : for archive libraries.  Thank you, Linux.
7035 case "$nm_so_opt" in
7036 '')     case "$myuname" in
7037         *linux*)
7038                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7039                         nm_so_opt='--dynamic'
7040                 fi
7041                 ;;
7042         esac
7043         ;;
7044 esac
7045
7046 case "$runnm" in
7047 true)
7048 : get list of predefined functions in a handy place
7049 echo " "
7050 case "$libc" in
7051 '') libc=unknown
7052         case "$libs" in
7053         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7054         esac
7055         ;;
7056 esac
7057 case "$libs" in
7058 '') ;;
7059 *)  for thislib in $libs; do
7060         case "$thislib" in
7061         -lc|-lc_s)
7062                 : Handle C library specially below.
7063                 ;;
7064         -l*)
7065                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7066                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7067                         :
7068                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7069                         :
7070                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7071                         :
7072                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7073                         :
7074                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7075                         :
7076                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7077                         :
7078                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7079                         :
7080                 else
7081                         try=''
7082                 fi
7083                 libnames="$libnames $try"
7084                 ;;
7085         *) libnames="$libnames $thislib" ;;
7086         esac
7087         done
7088         ;;
7089 esac
7090 xxx=normal
7091 case "$libc" in
7092 unknown)
7093         set /lib/libc.$so
7094         for xxx in $libpth; do
7095                 $test -r $1 || set $xxx/libc.$so
7096                 : The messy sed command sorts on library version numbers.
7097                 $test -r $1 || \
7098                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7099                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7100                                 h
7101                                 s/[0-9][0-9]*/0000&/g
7102                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7103                                 G
7104                                 s/\n/ /' | \
7105                          $sort | $sed -e 's/^.* //'`
7106                 eval set \$$#
7107         done
7108         $test -r $1 || set /usr/ccs/lib/libc.$so
7109         $test -r $1 || set /lib/libsys_s$_a
7110         ;;
7111 *)
7112         set blurfl
7113         ;;
7114 esac
7115 if $test -r "$1"; then
7116         echo "Your (shared) C library seems to be in $1."
7117         libc="$1"
7118 elif $test -r /lib/libc && $test -r /lib/clib; then
7119         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7120         xxx=apollo
7121         libc='/lib/clib /lib/libc'
7122         if $test -r /lib/syslib; then
7123                 echo "(Your math library is in /lib/syslib.)"
7124                 libc="$libc /lib/syslib"
7125         fi
7126 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7127         echo "Your C library seems to be in $libc, as you said before."
7128 elif $test -r $incpath/usr/lib/libc$_a; then
7129         libc=$incpath/usr/lib/libc$_a;
7130         echo "Your C library seems to be in $libc.  That's fine."
7131 elif $test -r /lib/libc$_a; then
7132         libc=/lib/libc$_a;
7133         echo "Your C library seems to be in $libc.  You're normal."
7134 else
7135         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7136                 :
7137         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7138                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7139         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7140                 :
7141         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7142                 :
7143         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7144                 :
7145         else
7146                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7147         fi
7148         if $test -r "$tans"; then
7149                 echo "Your C library seems to be in $tans, of all places."
7150                 libc=$tans
7151         else
7152                 libc='blurfl'
7153         fi
7154 fi
7155 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7156         dflt="$libc"
7157         cat <<EOM
7158
7159 If the guess above is wrong (which it might be if you're using a strange
7160 compiler, or your machine supports multiple models), you can override it here.
7161
7162 EOM
7163 else
7164         dflt=''
7165         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7166         cat >&4 <<EOM
7167 I can't seem to find your C library.  I've looked in the following places:
7168
7169 EOM
7170         $sed 's/^/      /' libpath
7171         cat <<EOM
7172
7173 None of these seems to contain your C library. I need to get its name...
7174
7175 EOM
7176 fi
7177 fn=f
7178 rp='Where is your C library?'
7179 . ./getfile
7180 libc="$ans"
7181
7182 echo " "
7183 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7184 set X `cat libnames`
7185 shift
7186 xxx=files
7187 case $# in 1) xxx=file; esac
7188 echo "Extracting names from the following $xxx for later perusal:" >&4
7189 echo " "
7190 $sed 's/^/      /' libnames >&4
7191 echo " "
7192 $echo $n "This may take a while...$c" >&4
7193
7194 for file in $*; do
7195         case $file in
7196         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7197         *) $nm $nm_opt $file 2>/dev/null;;
7198         esac
7199 done >libc.tmp
7200
7201 $echo $n ".$c"
7202 $grep fprintf libc.tmp > libc.ptf
7203 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7204 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7205 xxx='[ADTSIW]'
7206 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
7207         eval $xscan;\
7208         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7209                 eval $xrun
7210 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7211         eval $xscan;\
7212         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7213                 eval $xrun
7214 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7215         eval $xscan;\
7216         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7217                 eval $xrun
7218 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7219         eval $xscan;\
7220         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7221                 eval $xrun
7222 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7223         eval $xscan;\
7224         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7225                 eval $xrun
7226 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7227         eval $xscan;\
7228         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7229                 eval $xrun
7230 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7231                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7232         eval $xscan;\
7233         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7234                 eval $xrun
7235 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7236         eval $xscan;\
7237         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7238                 eval $xrun
7239 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7240         eval $xscan;\
7241         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7242                 eval $xrun
7243 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7244         eval $xscan;\
7245         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7246                 eval $xrun
7247 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7248         eval $xscan;\
7249         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7250                 eval $xrun
7251 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7252         eval $xscan;\
7253         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7254                 eval $xrun
7255 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7256         eval $xscan;\
7257         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7258                 eval $xrun
7259 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7260         eval $xscan;\
7261         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7262                 eval $xrun
7263 else
7264         $nm -p $* 2>/dev/null >libc.tmp
7265         $grep fprintf libc.tmp > libc.ptf
7266         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7267                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7268         then
7269                 nm_opt='-p'
7270                 eval $xrun
7271         else
7272                 echo " "
7273                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7274                 com=''
7275                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7276                         for thisname in $libnames $libc; do
7277                                 $ar t $thisname >>libc.tmp
7278                         done
7279                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7280                         echo "Ok." >&4
7281                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7282                         # Repeat libc to extract forwarders to DLL entries too
7283                         for thisname in $libnames $libc; do
7284                                 $ar tv $thisname >>libc.tmp
7285                                 # Revision 50 of EMX has bug in $ar.
7286                                 # it will not extract forwarders to DLL entries
7287                                 # Use emximp which will extract exactly them.
7288                                 emximp -o tmp.imp $thisname \
7289                                     2>/dev/null && \
7290                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7291                                     < tmp.imp >>libc.tmp
7292                                 $rm tmp.imp
7293                         done
7294                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7295                         echo "Ok." >&4
7296                 else
7297                         echo "$ar didn't seem to work right." >&4
7298                         echo "Maybe this is a Cray...trying bld instead..." >&4
7299                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7300                         then
7301                                 for thisname in $libnames; do
7302                                         bld t $libnames | \
7303                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7304                                         $ar t $thisname >>libc.tmp
7305                                 done
7306                                 echo "Ok." >&4
7307                         else
7308                                 echo "That didn't work either.  Giving up." >&4
7309                                 exit 1
7310                         fi
7311                 fi
7312         fi
7313 fi
7314 nm_extract="$com"
7315 case "$PASE" in
7316 define)
7317     echo " "
7318     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7319     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7320     ;;
7321 *)  if $test -f /lib/syscalls.exp; then
7322         echo " "
7323         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7324         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7325     fi
7326     ;;
7327 esac
7328 ;;
7329 esac
7330 $rm -f libnames libpath
7331
7332 : see if dld is available
7333 set dld.h i_dld
7334 eval $inhdr
7335
7336 : is a C symbol defined?
7337 csym='tlook=$1;
7338 case "$3" in
7339 -v) tf=libc.tmp; tc=""; tdc="";;
7340 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
7341 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
7342 esac;
7343 tx=yes;
7344 case "$reuseval-$4" in
7345 true-) ;;
7346 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7347 esac;
7348 case "$tx" in
7349 yes)
7350         case "$runnm" in
7351         true)
7352                 if $contains $tlook $tf >/dev/null 2>&1;
7353                 then tval=true;
7354                 else tval=false;
7355                 fi;;
7356         *)
7357                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
7358                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
7359                 then tval=true;
7360                 else tval=false;
7361                 fi;
7362                 $rm -f t t.c;;
7363         esac;;
7364 *)
7365         case "$tval" in
7366         $define) tval=true;;
7367         *) tval=false;;
7368         esac;;
7369 esac;
7370 eval "$2=$tval"'
7371
7372 : define an is-in-libc? function
7373 inlibc='echo " "; td=$define; tu=$undef;
7374 sym=$1; var=$2; eval "was=\$$2";
7375 tx=yes;
7376 case "$reuseval$was" in
7377 true) ;;
7378 true*) tx=no;;
7379 esac;
7380 case "$tx" in
7381 yes)
7382         set $sym tres -f;
7383         eval $csym;
7384         case "$tres" in
7385         true)
7386                 echo "$sym() found." >&4;
7387                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7388         *)
7389                 echo "$sym() NOT found." >&4;
7390                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7391         esac;;
7392 *)
7393         case "$was" in
7394         $define) echo "$sym() found." >&4;;
7395         *) echo "$sym() NOT found." >&4;;
7396         esac;;
7397 esac'
7398
7399 : see if dlopen exists
7400 xxx_runnm="$runnm"
7401 runnm=false
7402 set dlopen d_dlopen
7403 eval $inlibc
7404 runnm="$xxx_runnm"
7405
7406 : determine which dynamic loading, if any, to compile in
7407 echo " "
7408 dldir="ext/DynaLoader"
7409 case "$usedl" in
7410 $define|y|true)
7411         dflt='y'
7412         usedl="$define"
7413         ;;
7414 $undef|n|false)
7415         dflt='n'
7416         usedl="$undef"
7417         ;;
7418 *) 
7419         dflt='n'
7420         case "$d_dlopen" in
7421             $define) dflt='y' ;;
7422         esac
7423         case "$i_dld" in
7424             $define) dflt='y' ;;
7425         esac
7426         : Does a dl_xxx.xs file exist for this operating system
7427         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7428         ;;
7429 esac
7430 rp="Do you wish to use dynamic loading?"
7431 . ./myread
7432 usedl="$ans"
7433 case "$ans" in
7434 y*) usedl="$define"
7435         case "$dlsrc" in
7436         '')
7437                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7438                         dflt="$dldir/dl_${osname}.xs"
7439                 elif $test "$d_dlopen" = "$define" ; then
7440                         dflt="$dldir/dl_dlopen.xs"
7441                 elif $test "$i_dld" = "$define" ; then
7442                         dflt="$dldir/dl_dld.xs"
7443                 else
7444                         dflt=''
7445                 fi
7446                 ;;
7447         *)      dflt="$dldir/$dlsrc"
7448                 ;;
7449         esac
7450     echo "The following dynamic loading files are available:"
7451         : Can not go over to $dldir because getfile has path hard-coded in.
7452         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7453         rp="Source file to use for dynamic loading"
7454         fn="fne"
7455         gfpth="$src"
7456         . ./getfile
7457         usedl="$define"
7458         : emulate basename
7459         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7460
7461         $cat << EOM
7462
7463 Some systems may require passing special flags to $cc -c to
7464 compile modules that will be used to create a shared library.
7465 To use no flags, say "none".
7466
7467 EOM
7468     case "$cccdlflags" in
7469     '') case "$gccversion" in
7470                 '') case "$osname" in
7471                         hpux)   dflt='+z' ;;
7472                         next)   dflt='none' ;;
7473                         irix*)  dflt='-KPIC' ;;
7474                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7475                         sunos)  dflt='-pic' ;;
7476                         *)      dflt='none' ;;
7477                     esac
7478                         ;;
7479                 *)  case "$osname" in
7480                         darwin) dflt='none' ;;
7481                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7482                         *)      dflt='-fpic' ;;
7483                     esac ;;
7484             esac ;;
7485         ' ') dflt='none' ;;
7486     *)  dflt="$cccdlflags" ;;
7487     esac
7488     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7489     . ./myread
7490     case "$ans" in
7491     none) cccdlflags=' ' ;;
7492     *) cccdlflags="$ans" ;;
7493     esac
7494
7495     cat << EOM
7496
7497 Some systems use ld to create libraries that can be dynamically loaded,
7498 while other systems (such as those using ELF) use $cc.
7499
7500 EOM
7501         case "$ld" in
7502         '')     $cat >try.c <<EOM
7503 /* Test for whether ELF binaries are produced */
7504 #include <fcntl.h>
7505 #$i_stdlib I_STDLIB
7506 #ifdef I_STDLIB
7507 #include <stdlib.h>
7508 #endif
7509 int main() {
7510         char b[4];
7511         int i = open("a.out",O_RDONLY);
7512         if(i == -1) 
7513                 exit(1); /* fail */
7514         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7515                 exit(0); /* succeed (yes, it's ELF) */
7516         else
7517                 exit(1); /* fail */
7518 }
7519 EOM
7520                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7521                         cat <<EOM
7522 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7523 EOM
7524                         dflt="$cc"
7525                 else
7526                         echo "I'll use ld to build dynamic libraries."
7527                         dflt='ld'
7528                 fi
7529                 rm -f try.c a.out
7530                 ;;
7531         *)      dflt="$ld"
7532                 ;;
7533         esac
7534
7535     rp="What command should be used to create dynamic libraries?"
7536     . ./myread
7537         ld="$ans"
7538
7539     cat << EOM
7540
7541 Some systems may require passing special flags to $ld to create a
7542 library that can be dynamically loaded.  If your ld flags include
7543 -L/other/path options to locate libraries outside your loader's normal
7544 search path, you may need to specify those -L options here as well.  To
7545 use no flags, say "none".
7546
7547 EOM
7548     case "$lddlflags" in
7549     '') case "$osname" in
7550                         beos) dflt='-nostart' ;;
7551                         hpux) dflt='-b';
7552                               case "$gccversion" in
7553                               '') dflt="$dflt +vnocompatwarnings" ;;
7554                               esac
7555                               ;;        
7556                         linux|irix*)    dflt='-shared' ;;
7557                         next)  dflt='none' ;;
7558                         solaris) dflt='-G' ;;
7559                         sunos) dflt='-assert nodefinitions' ;;
7560                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7561                 *)     dflt='none' ;;
7562                         esac
7563                         ;;
7564     *) dflt="$lddlflags" ;;
7565     esac
7566
7567         : Try to guess additional flags to pick up local libraries.
7568         : Be careful not to append to a plain 'none'
7569         case "$dflt" in
7570         none) dflt='' ;;
7571         esac
7572         for thisflag in $ldflags; do
7573                 case "$thisflag" in
7574                 -L*|-R*|-Wl,-R*)
7575                         case " $dflt " in
7576                         *" $thisflag "*) ;;
7577                         *) dflt="$dflt $thisflag" ;;
7578                         esac
7579                         ;;
7580                 esac
7581         done
7582
7583         case "$dflt" in
7584         ''|' ') dflt='none' ;;
7585         esac
7586
7587     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7588     . ./myread
7589     case "$ans" in
7590     none) lddlflags=' ' ;;
7591     *) lddlflags="$ans" ;;
7592     esac
7593
7594         cat <<EOM
7595
7596 Some systems may require passing special flags to $cc to indicate that
7597 the resulting executable will use dynamic linking.  To use no flags,
7598 say "none".
7599
7600 EOM
7601     case "$ccdlflags" in
7602     '') case "$osname" in
7603                 hpux)   dflt='-Wl,-E' ;;
7604                 linux)  dflt='-rdynamic' ;;
7605                 next)   dflt='none' ;;
7606                 sunos)  dflt='none' ;;
7607                 *)      dflt='none' ;;
7608             esac ;;
7609     ' ')  dflt='none' ;;
7610     *)  dflt="$ccdlflags" ;;
7611     esac
7612     rp="Any special flags to pass to $cc to use dynamic linking?"
7613     . ./myread
7614     case "$ans" in
7615     none) ccdlflags=' ' ;;
7616     *) ccdlflags="$ans" ;;
7617     esac
7618     ;;
7619 *)  usedl="$undef"
7620         ld='ld'
7621     dlsrc='dl_none.xs'
7622     lddlflags=''
7623     ccdlflags=''
7624     ;;
7625 esac
7626
7627 also=''
7628 case "$usedl" in
7629 $undef)
7630         # No dynamic loading being used, so don't bother even to prompt.
7631         useshrplib='false'
7632         ;;
7633 *)      case "$useshrplib" in
7634         '')     case "$osname" in
7635                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7636                         dflt=y
7637                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7638                         ;;
7639                 next*)
7640                         case "$osvers" in
7641                         4*)     dflt=y
7642                                 also='Building a shared libperl is needed for MAB support.'
7643                                 ;;
7644                         *)      dflt=n
7645                                 ;;
7646                         esac
7647                         ;;
7648                 *)      dflt=n
7649                         ;;
7650                 esac
7651                 ;;
7652         $define|true|[Yy]*)
7653                 dflt=y
7654                 ;;
7655         *)      dflt=n
7656                 ;;
7657         esac
7658         $cat << EOM
7659
7660 The perl executable is normally obtained by linking perlmain.c with
7661 libperl${_a}, any static extensions (usually just DynaLoader), and
7662 any other libraries needed on this system (such as -lm, etc.).  Since
7663 your system supports dynamic loading, it is probably possible to build
7664 a shared libperl.$so.  If you will have more than one executable linked
7665 to libperl.$so, this will significantly reduce the size of each
7666 executable, but it may have a noticeable affect on performance.  The
7667 default is probably sensible for your system.
7668 $also
7669
7670 EOM
7671         rp="Build a shared libperl.$so (y/n)"
7672         . ./myread
7673         case "$ans" in
7674         true|$define|[Yy]*)
7675                 useshrplib='true'  ;;
7676         *)      useshrplib='false' ;;
7677         esac
7678         ;;
7679 esac
7680
7681 case "$useshrplib" in
7682 true)
7683         case "$libperl" in
7684         '')
7685                 # Figure out a good name for libperl.so.  Since it gets stored in
7686                 # a version-specific architecture-dependent library, the version
7687                 # number isn't really that important, except for making cc/ld happy.
7688                 #
7689                 # A name such as libperl.so.3.1
7690                 majmin="libperl.$so.$patchlevel.$subversion"
7691                 # A name such as libperl.so.301
7692                 majonly=`echo $patchlevel $subversion |
7693                         $awk '{printf "%d%02d", $1, $2}'`
7694                 majonly=libperl.$so.$majonly
7695                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7696                 # rely on figuring it out from the naming of libc.
7697                 case "${osname}${osvers}" in
7698                 next4*)
7699                         dflt=libperl.5.$so
7700                         # XXX How handle the --version stuff for MAB?
7701                         ;;
7702                 linux*)  # ld won't link with a bare -lperl otherwise.
7703                         dflt=libperl.$so
7704                         ;;
7705                 cygwin*) # ld links against an importlib
7706                         dflt=libperl$lib_ext
7707                         ;;
7708                 *)      # Try to guess based on whether libc has major.minor.
7709                         case "$libc" in
7710                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7711                         *libc.$so.[0-9]*) dflt=$majonly ;;
7712                         *)      dflt=libperl.$so ;;
7713                         esac
7714                         ;;
7715                 esac
7716                 ;;
7717         *)      dflt=$libperl
7718                 ;;
7719         esac
7720         cat << EOM
7721
7722 I need to select a good name for the shared libperl.  If your system uses
7723 library names with major and minor numbers, then you might want something
7724 like $majmin.  Alternatively, if your system uses a single version
7725 number for shared libraries, then you might want to use $majonly.
7726 Or, your system might be quite happy with a simple libperl.$so.
7727
7728 Since the shared libperl will get installed into a version-specific
7729 architecture-dependent directory, the version number of the shared perl
7730 library probably isn't important, so the default should be o.k.
7731
7732 EOM
7733         rp='What name do you want to give to the shared libperl?'
7734         . ./myread
7735         libperl=$ans
7736         echo "Ok, I'll use $libperl"
7737         ;;
7738 *)
7739         libperl="libperl${_a}"
7740         ;;
7741 esac
7742
7743 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7744 case "$shrpdir" in
7745 '') ;;
7746 *)      $cat >&4 <<EOM
7747 WARNING:  Use of the shrpdir variable for the installation location of
7748 the shared $libperl is not supported.  It was never documented and
7749 will not work in this version.  Let me (perlbug@perl.org)
7750 know of any problems this may cause.
7751
7752 EOM
7753         case "$shrpdir" in
7754         "$archlibexp/CORE")
7755                 $cat >&4 <<EOM
7756 But your current setting of $shrpdir is
7757 the default anyway, so it's harmless.
7758 EOM
7759                 ;;
7760         *)
7761                 $cat >&4 <<EOM
7762 Further, your current attempted setting of $shrpdir
7763 conflicts with the value of $archlibexp/CORE
7764 that installperl will use.
7765 EOM
7766                 ;;
7767         esac
7768         ;;
7769 esac
7770
7771 # How will the perl executable find the installed shared $libperl?
7772 # Add $xxx to ccdlflags.
7773 # If we can't figure out a command-line option, use $shrpenv to
7774 # set env LD_RUN_PATH.  The main perl makefile uses this.
7775 shrpdir=$archlibexp/CORE
7776 xxx=''
7777 tmp_shrpenv=''
7778 if "$useshrplib"; then
7779     case "$osname" in 
7780         aix)
7781                 # We'll set it in Makefile.SH...
7782                 ;;
7783         solaris)
7784                 xxx="-R $shrpdir"
7785                 ;;
7786         freebsd|netbsd|openbsd)
7787                 xxx="-Wl,-R$shrpdir"
7788                 ;;
7789         bsdos|linux|irix*|dec_osf)
7790                 xxx="-Wl,-rpath,$shrpdir"
7791                 ;;
7792         next)
7793                 # next doesn't like the default...
7794                 ;;
7795         beos)
7796                 # beos doesn't like the default, either.
7797                 ;;
7798         hpux*)
7799                 # hpux doesn't like the default, either.
7800                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7801                 ;;
7802         *)
7803                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7804                 ;;
7805         esac
7806         case "$xxx" in
7807         '') ;;
7808         *)      
7809                 # Only add $xxx if it isn't already in ccdlflags.
7810                 case " $ccdlflags " in
7811                 *" $xxx "*)     ;;
7812                 *)      ccdlflags="$ccdlflags $xxx"
7813                         cat <<EOM >&4
7814
7815 Adding $xxx to the flags
7816 passed to $ld so that the perl executable will find the 
7817 installed shared $libperl.
7818
7819 EOM
7820                         ;;
7821                 esac
7822                 ;;
7823         esac
7824 fi
7825 # Fix ccdlflags in AIX for building external extensions.
7826 # (For building Perl itself bare -bE:perl.exp is needed,
7827 #  Makefile.SH takes care of this.)
7828 case "$osname" in
7829 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7830 esac
7831 # Respect a hint or command-line value.
7832 case "$shrpenv" in
7833 '') shrpenv="$tmp_shrpenv" ;;
7834 esac
7835 case "$ldlibpthname" in
7836 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7837 none)   ldlibpthname='' ;;
7838 esac
7839
7840 : determine where manual pages are on this system
7841 echo " "
7842 case "$sysman" in
7843 '') 
7844         syspath='/usr/share/man/man1 /usr/man/man1'
7845         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7846         syspath="$syspath /usr/man/u_man/man1"
7847         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7848         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7849         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7850         sysman=`./loc . /usr/man/man1 $syspath`
7851         ;;
7852 esac
7853 if $test -d "$sysman"; then
7854         echo "System manual is in $sysman." >&4
7855 else
7856         echo "Could not find manual pages in source form." >&4
7857 fi
7858
7859 : determine where manual pages go
7860 set man1dir man1dir none
7861 eval $prefixit
7862 $cat <<EOM
7863
7864 $spackage has manual pages available in source form.
7865 EOM
7866 case "$nroff" in
7867 nroff)
7868         echo "However, you don't have nroff, so they're probably useless to you."
7869         case "$man1dir" in
7870         '') man1dir="none";;
7871         esac;;
7872 esac
7873 echo "If you don't want the manual sources installed, answer 'none'."
7874 case "$man1dir" in
7875 ' ') dflt=none
7876         ;;
7877 '')
7878         lookpath="$prefixexp/share/man/man1"
7879         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7880         lookpath="$lookpath $prefixexp/man/p_man/man1"
7881         lookpath="$lookpath $prefixexp/man/u_man/man1"
7882         lookpath="$lookpath $prefixexp/man/man.1"
7883         case "$sysman" in
7884         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7885         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7886         esac
7887         set dflt
7888         eval $prefixup
7889         ;;
7890 *)  dflt="$man1dir"
7891         ;;
7892 esac
7893 echo " "
7894 fn=dn+~
7895 rp="Where do the main $spackage manual pages (source) go?"
7896 . ./getfile
7897 if $test "X$man1direxp" != "X$ansexp"; then
7898         installman1dir=''
7899 fi
7900 man1dir="$ans"
7901 man1direxp="$ansexp"
7902 case "$man1dir" in
7903 '')     man1dir=' '
7904         installman1dir='';;
7905 esac
7906
7907 : Change installation prefix, if necessary.
7908 if $test X"$prefix" != X"$installprefix"; then
7909         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7910 else
7911         installman1dir="$man1direxp"
7912 fi
7913
7914 : What suffix to use on installed man pages
7915
7916 case "$man1dir" in
7917 ' ')
7918         man1ext='0'
7919         ;;
7920 *)
7921         rp="What suffix should be used for the main $spackage man pages?"
7922         case "$man1ext" in
7923         '')     case "$man1dir" in
7924                 *1)  dflt=1 ;;
7925                 *1p) dflt=1p ;;
7926                 *1pm) dflt=1pm ;;
7927                 *l) dflt=l;;
7928                 *n) dflt=n;;
7929                 *o) dflt=o;;
7930                 *p) dflt=p;;
7931                 *C) dflt=C;;
7932                 *L) dflt=L;;
7933                 *L1) dflt=L1;;
7934                 *) dflt=1;;
7935                 esac
7936                 ;;
7937         *)      dflt="$man1ext";;
7938         esac
7939         . ./myread
7940         man1ext="$ans"
7941         ;;
7942 esac
7943
7944 : see if we can have long filenames
7945 echo " "
7946 first=123456789abcdef
7947 $rm -f $first
7948 if (echo hi >$first) 2>/dev/null; then
7949         if $test -f 123456789abcde; then
7950                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7951                 val="$undef"
7952         else
7953                 echo 'You can have filenames longer than 14 characters.'>&4
7954                 val="$define"
7955         fi
7956 else
7957         $cat <<'EOM'
7958 You can't have filenames longer than 14 chars.
7959 You can't even think about them!
7960 EOM
7961         val="$undef"
7962 fi 
7963 set d_flexfnam
7964 eval $setvar
7965 $rm -rf 123456789abcde*
7966
7967 : determine where library module manual pages go
7968 set man3dir man3dir none
7969 eval $prefixit
7970 $cat <<EOM
7971
7972 $spackage has manual pages for many of the library modules.
7973 EOM
7974
7975 case "$nroff" in
7976 nroff)
7977         $cat <<'EOM'
7978 However, you don't have nroff, so they're probably useless to you.
7979 EOM
7980         case "$man3dir" in
7981         '') man3dir="none";;
7982         esac;;
7983 esac
7984
7985 case "$d_flexfnam" in
7986 undef)
7987         $cat <<'EOM'
7988 However, your system can't handle the long file names like File::Basename.3. 
7989 EOM
7990         case "$man3dir" in
7991         '') man3dir="none";;
7992         esac;;
7993 esac
7994
7995 echo "If you don't want the manual sources installed, answer 'none'."
7996 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7997 case "$man3dir" in
7998 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7999         if $test -d "$privlib/man/man3"; then
8000                 cat <<EOM >&4
8001
8002 WARNING:  Previous versions of perl installed man3 pages into
8003 $privlib/man/man3.  This version will suggest a 
8004 new default of $dflt.  
8005 EOM
8006                 tdflt=$dflt
8007                 dflt='n'
8008                 rp='Do you wish to preserve the old behavior?(y/n)'
8009                 . ./myread
8010                 case "$ans" in
8011                 y*) dflt="$privlib/man/man3" ;;
8012                 *)  dflt=$tdflt ;;
8013                 esac
8014     fi
8015         ;;
8016 *)      dflt="$man3dir" ;;
8017 esac
8018 case "$dflt" in
8019 ' ') dflt=none ;;
8020 esac
8021 echo " "
8022 fn=dn+~
8023 rp="Where do the $package library man pages (source) go?"
8024 . ./getfile
8025 man3dir="$ans"
8026 man3direxp="$ansexp"
8027 case "$man3dir" in
8028 '')     man3dir=' '
8029         installman3dir='';;
8030 esac
8031
8032 : Change installation prefix, if necessary.
8033 if $test X"$prefix" != X"$installprefix"; then
8034         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8035 else
8036         installman3dir="$man3direxp"
8037 fi
8038
8039 : What suffix to use on installed man pages
8040 case "$man3dir" in
8041 ' ')
8042         man3ext='0'
8043         ;;
8044 *)
8045         rp="What suffix should be used for the $package library man pages?"
8046         case "$man3ext" in
8047         '')     case "$man3dir" in
8048                 *3)  dflt=3 ;;
8049                 *3p) dflt=3p ;;
8050                 *3pm) dflt=3pm ;;
8051                 *l) dflt=l;;
8052                 *n) dflt=n;;
8053                 *o) dflt=o;;
8054                 *p) dflt=p;;
8055                 *C) dflt=C;;
8056                 *L) dflt=L;;
8057                 *L3) dflt=L3;;
8058                 *) dflt=3;;
8059                 esac
8060                 ;;
8061         *)      dflt="$man3ext";;
8062         esac
8063         . ./myread
8064         man3ext="$ans"
8065         ;;
8066 esac
8067
8068 : see if we have to deal with yellow pages, now NIS.
8069 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8070         if $test -f /usr/etc/nibindd; then
8071                 echo " "
8072                 echo "I'm fairly confident you're on a NeXT."
8073                 echo " "
8074                 rp='Do you get the hosts file via NetInfo?'
8075                 dflt=y
8076                 case "$hostcat" in
8077                 nidump*) ;;
8078                 '') ;;
8079                 *) dflt=n;;
8080                 esac
8081                 . ./myread
8082                 case "$ans" in
8083                 y*) hostcat='nidump hosts .';;
8084                 *)      case "$hostcat" in
8085                         nidump*) hostcat='';;
8086                         esac
8087                         ;;
8088                 esac
8089         fi
8090         case "$hostcat" in
8091         nidump*) ;;
8092         *)
8093                 case "$hostcat" in
8094                 *ypcat*) dflt=y;;
8095                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8096                                 dflt=y
8097                         else
8098                                 dflt=n
8099                         fi;;
8100                 *) dflt=n;;
8101                 esac
8102                 echo " "
8103                 rp='Are you getting the hosts file via yellow pages?'
8104                 . ./myread
8105                 case "$ans" in
8106                 y*) hostcat='ypcat hosts';;
8107                 *) hostcat='cat /etc/hosts';;
8108                 esac
8109                 ;;
8110         esac
8111 fi
8112 case "$hostcat" in
8113 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8114 esac
8115 case "$groupcat" in
8116 '') test -f /etc/group && groupcat='cat /etc/group';;
8117 esac
8118 case "$passcat" in
8119 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8120 esac
8121
8122 : now get the host name
8123 echo " "
8124 echo "Figuring out host name..." >&4
8125 case "$myhostname" in
8126 '') cont=true
8127         echo 'Maybe "hostname" will work...'
8128         if tans=`sh -c hostname 2>&1` ; then
8129                 myhostname=$tans
8130                 phostname=hostname
8131                 cont=''
8132         fi
8133         ;;
8134 *) cont='';;
8135 esac
8136 if $test "$cont"; then
8137         if ./xenix; then
8138                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8139                 if tans=`cat /etc/systemid 2>&1` ; then
8140                         myhostname=$tans
8141                         phostname='cat /etc/systemid'
8142                         echo "Whadyaknow.  Xenix always was a bit strange..."
8143                         cont=''
8144                 fi
8145         elif $test -r /etc/systemid; then
8146                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8147         fi
8148 fi
8149 if $test "$cont"; then
8150         echo 'No, maybe "uuname -l" will work...'
8151         if tans=`sh -c 'uuname -l' 2>&1` ; then
8152                 myhostname=$tans
8153                 phostname='uuname -l'
8154         else
8155                 echo 'Strange.  Maybe "uname -n" will work...'
8156                 if tans=`sh -c 'uname -n' 2>&1` ; then
8157                         myhostname=$tans
8158                         phostname='uname -n'
8159                 else
8160                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8161                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8162                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8163                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8164                         else
8165                                 case "$myhostname" in
8166                                 '') echo "Does this machine have an identity crisis or something?"
8167                                         phostname='';;
8168                                 *)
8169                                         echo "Well, you said $myhostname before..."
8170                                         phostname='echo $myhostname';;
8171                                 esac
8172                         fi
8173                 fi
8174         fi
8175 fi
8176 case "$myhostname" in
8177 '') myhostname=noname ;;
8178 esac
8179 : you do not want to know about this
8180 set $myhostname
8181 myhostname=$1
8182
8183 : verify guess
8184 if $test "$myhostname" ; then
8185         dflt=y
8186         rp='Your host name appears to be "'$myhostname'".'" Right?"
8187         . ./myread
8188         case "$ans" in
8189         y*) ;;
8190         *) myhostname='';;
8191         esac
8192 fi
8193
8194 : bad guess or no guess
8195 while $test "X$myhostname" = X ; do
8196         dflt=''
8197         rp="Please type the (one word) name of your host:"
8198         . ./myread
8199         myhostname="$ans"
8200 done
8201
8202 : translate upper to lower if necessary
8203 case "$myhostname" in
8204 *[A-Z]*)
8205         echo "(Normalizing case in your host name)"
8206         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8207         ;;
8208 esac
8209
8210 case "$myhostname" in
8211 *.*)
8212         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8213         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8214         echo "(Trimming domain name from host name--host name is now $myhostname)"
8215         ;;
8216 *) case "$mydomain" in
8217         '')
8218                 {
8219                         test "X$hostcat" = "Xypcat hosts" &&
8220                         ypmatch "$myhostname" hosts 2>/dev/null |\
8221                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8222                         $test -s hosts
8223                 } || {
8224                         test "X$hostcat" != "X" &&
8225                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8226                                         /[       ]$myhostname[  . ]/p" > hosts
8227                 }
8228                 tmp_re="[       . ]"
8229                 if $test -f hosts; then
8230                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8231                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8232                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8233                                 hosts | $sort | $uniq | \
8234                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8235                         case `$echo X$dflt` in
8236                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8237                                 dflt=.
8238                                 ;;
8239                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8240                                 ;;
8241                         esac
8242                 else
8243                         echo "(I cannot locate a hosts database anywhere)"
8244                         dflt=.
8245                 fi
8246                 case "$dflt" in
8247                 .)
8248                         tans=`./loc resolv.conf X /etc /usr/etc`
8249                         if $test -f "$tans"; then
8250                                 echo "(Attempting domain name extraction from $tans)"
8251                                 dflt=.`$sed -n -e 's/   / /g' \
8252                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8253                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8254                                 case "$dflt" in
8255                                 .) dflt=.`$sed -n -e 's/        / /g' \
8256                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8257                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8258                                         ;;
8259                                 esac
8260                         fi
8261                         ;;
8262                 esac
8263                 case "$dflt" in
8264                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8265                         dflt=.`sh -c domainname 2>/dev/null`
8266                         case "$dflt" in
8267                         '') dflt='.';;
8268                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8269                         esac
8270                         ;;
8271                 esac
8272                 case "$dflt$osname" in
8273                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8274                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8275                         ;;
8276                 esac
8277                 case "$dflt" in
8278                 .) echo "(Lost all hope -- silly guess then)"
8279                         dflt='.nonet'
8280                         ;;
8281                 esac
8282                 $rm -f hosts
8283                 ;;
8284         *) dflt="$mydomain";;
8285         esac;;
8286 esac
8287 echo " "
8288 rp="What is your domain name?"
8289 . ./myread
8290 tans="$ans"
8291 case "$ans" in
8292 '') ;;
8293 .*) ;;
8294 *) tans=".$tans";;
8295 esac
8296 mydomain="$tans"
8297
8298 : translate upper to lower if necessary
8299 case "$mydomain" in
8300 *[A-Z]*)
8301         echo "(Normalizing case in your domain name)"
8302         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8303         ;;
8304 esac
8305
8306 : a little sanity check here
8307 case "$phostname" in
8308 '') ;;
8309 *)
8310         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8311         $myhostname$mydomain|$myhostname) ;;
8312         *)
8313                 case "$phostname" in
8314                 sed*)
8315                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8316                         ;;
8317                 *)
8318                         echo "(That doesn't agree with your $phostname command, by the way.)"
8319                         ;;
8320                 esac
8321         ;;
8322         esac
8323         ;;
8324 esac
8325
8326 $cat <<EOM
8327
8328 I need to get your e-mail address in Internet format if possible, i.e.
8329 something like user@host.domain. Please answer accurately since I have
8330 no easy means to double check it. The default value provided below
8331 is most probably close to reality but may not be valid from outside
8332 your organization...
8333
8334 EOM
8335 cont=x
8336 while test "$cont"; do
8337         case "$cf_email" in
8338         '') dflt="$cf_by@$myhostname$mydomain";;
8339         *) dflt="$cf_email";;
8340         esac
8341         rp='What is your e-mail address?'
8342         . ./myread
8343         cf_email="$ans"
8344         case "$cf_email" in
8345         *@*.*) cont='' ;;
8346         *)
8347                 rp='Address does not look like an Internet one.  Use it anyway?'
8348                 case "$fastread" in
8349                 yes) dflt=y ;;
8350                 *) dflt=n ;;
8351                 esac
8352                 . ./myread
8353                 case "$ans" in
8354                 y*) cont='' ;;
8355                 *) echo " " ;;
8356                 esac
8357                 ;;
8358         esac
8359 done
8360
8361 $cat <<EOM
8362
8363 If you or somebody else will be maintaining perl at your site, please
8364 fill in the correct e-mail address here so that they may be contacted
8365 if necessary. Currently, the "perlbug" program included with perl
8366 will send mail to this address in addition to perlbug@perl.org. You may
8367 enter "none" for no administrator.
8368
8369 EOM
8370 case "$perladmin" in
8371 '') dflt="$cf_email";;
8372 *) dflt="$perladmin";;
8373 esac
8374 rp='Perl administrator e-mail address'
8375 . ./myread
8376 perladmin="$ans"
8377
8378 : determine whether to only install version-specific parts.
8379 echo " "
8380 $cat <<EOM
8381 Do you want to install only the version-specific parts of the perl
8382 distribution?  Usually you do *not* want to do this.
8383 EOM
8384 case "$versiononly" in
8385 "$define"|[Yy]*|true) dflt='y' ;;
8386 *) dflt='n';
8387 esac
8388 rp="Do you want to install only the version-specific parts of perl?"
8389 . ./myread
8390 case "$ans" in
8391 [yY]*)  val="$define";;
8392 *)      val="$undef" ;;
8393 esac
8394 set versiononly
8395 eval $setvar
8396
8397 case "$versiononly" in
8398 "$define") inc_version_list=''
8399            inc_version_list_init=0
8400            ;;
8401 esac
8402
8403 : figure out how to guarantee perl startup
8404 case "$startperl" in
8405 '')
8406         case "$sharpbang" in
8407         *!)
8408                 $cat <<EOH
8409
8410 I can use the #! construct to start perl on your system. This will
8411 make startup of perl scripts faster, but may cause problems if you
8412 want to share those scripts and perl is not in a standard place
8413 ($binexp/perl) on all your platforms. The alternative is to force
8414 a shell by starting the script with a single ':' character.
8415
8416 EOH
8417                 case "$versiononly" in
8418                 "$define")      dflt="$binexp/perl$version";;  
8419                 *)              dflt="$binexp/perl";;
8420                 esac
8421                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8422                 . ./myread
8423                 case "$ans" in
8424                 none)   startperl=": # use perl";;
8425                 *)      startperl="#!$ans"
8426                         if $test 30 -lt `echo "$ans" | wc -c`; then
8427                                 $cat >&4 <<EOM
8428
8429 WARNING:  Some systems limit the #! command to 32 characters.
8430 If you experience difficulty running Perl scripts with #!, try
8431 installing Perl in a directory with a shorter pathname.
8432
8433 EOM
8434                         fi ;;
8435                 esac
8436                 ;;
8437         *) startperl=": # use perl"
8438                 ;;
8439         esac
8440         ;;
8441 esac
8442 echo "I'll use $startperl to start perl scripts."
8443
8444 : figure best path for perl in scripts
8445 case "$perlpath" in
8446 '')
8447         case "$versiononly" in
8448         "$define")      perlpath="$binexp/perl$version";;
8449         *)              perlpath="$binexp/perl";;
8450         esac
8451         case "$startperl" in
8452         *!*) ;;
8453         *)
8454                 $cat <<EOH
8455
8456 I will use the "eval 'exec'" idiom to start Perl on your system.
8457 I can use the full path of your Perl binary for this purpose, but
8458 doing so may cause problems if you want to share those scripts and
8459 Perl is not always in a standard place ($binexp/perl).
8460
8461 EOH
8462                 dflt="$binexp/perl"
8463                 rp="What path shall I use in \"eval 'exec'\"?"
8464                 . ./myread
8465                 perlpath="$ans"
8466                 ;;
8467         esac
8468         ;;
8469 esac
8470 case "$startperl" in
8471 *!*)    ;;
8472 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8473 esac
8474
8475 : determine where public executable scripts go
8476 set scriptdir scriptdir
8477 eval $prefixit
8478 case "$scriptdir" in
8479 '')
8480         dflt="$bin"
8481         : guess some guesses
8482         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8483         $test -d /usr/share/bin     && dflt=/usr/share/bin
8484         $test -d /usr/local/script  && dflt=/usr/local/script
8485         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8486         $test -d $prefixexp/script  && dflt=$prefixexp/script
8487         set dflt
8488         eval $prefixup
8489         ;;
8490 *)  dflt="$scriptdir"
8491         ;;
8492 esac
8493 $cat <<EOM
8494  
8495 Some installations have a separate directory just for executable scripts so
8496 that they can mount it across multiple architectures but keep the scripts in
8497 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8498 Or you might just lump your scripts in with all your other executables.
8499  
8500 EOM
8501 fn=d~
8502 rp='Where do you keep publicly executable scripts?'
8503 . ./getfile
8504 if $test "X$ansexp" != "X$scriptdirexp"; then
8505         installscript=''
8506 fi
8507 scriptdir="$ans"
8508 scriptdirexp="$ansexp"
8509 : Change installation prefix, if necessary.
8510 if $test X"$prefix" != X"$installprefix"; then
8511         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8512 else
8513         installscript="$scriptdirexp"
8514 fi
8515
8516 : determine where add-on public executables go
8517 case "$sitebin" in
8518 '')     dflt=$siteprefix/bin ;;
8519 *)      dflt=$sitebin ;;
8520 esac
8521 fn=d~
8522 rp='Pathname where the add-on public executables should be installed?'
8523 . ./getfile
8524 sitebin="$ans"
8525 sitebinexp="$ansexp"
8526 : Change installation prefix, if necessary.
8527 if $test X"$prefix" != X"$installprefix"; then
8528         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8529 else
8530         installsitebin="$sitebinexp"
8531 fi
8532
8533 : determine where add-on html pages go
8534 : There is no standard location, so try to copy the previously-selected 
8535 : directory structure for the core html pages.
8536 case "$sitehtml1" in
8537 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8538 *)      dflt=$sitehtml1 ;;
8539 esac
8540 case "$dflt" in
8541 ''|' ') dflt=none ;;
8542 esac
8543 fn=dn+~
8544 rp='Pathname where the site-specific html pages should be installed?'
8545 . ./getfile
8546 sitehtml1="$ans"
8547 sitehtml1exp="$ansexp"
8548 : Use ' ' for none so value is preserved next time through Configure
8549 $test X"$sitehtml1" = "X" && sitehtml1=' '
8550 : Change installation prefix, if necessary.
8551 if $test X"$prefix" != X"$installprefix"; then
8552         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8553 else
8554         installsitehtml1="$sitehtml1exp"
8555 fi
8556
8557 : determine where add-on library html pages go
8558 : There is no standard location, so try to copy the previously-selected
8559 : directory structure for the core html pages.
8560 case "$sitehtml3" in
8561 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8562 *)      dflt=$sitehtml3 ;;
8563 esac
8564 case "$dflt" in
8565 ''|' ') dflt=none ;;
8566 esac
8567 fn=dn+~
8568 rp='Pathname where the site-specific library html pages should be installed?'
8569 . ./getfile
8570 sitehtml3="$ans"
8571 sitehtml3exp="$ansexp"
8572 : Use ' ' for none so value is preserved next time through Configure
8573 $test X"$sitehtml3" = "X" && sitehtml3=' '
8574 : Change installation prefix, if necessary.
8575 if $test X"$prefix" != X"$installprefix"; then
8576         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8577 else
8578         installsitehtml3="$sitehtml3exp"
8579 fi
8580
8581 : determine where add-on manual pages go
8582 case "$siteman1" in
8583 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8584 *)      dflt=$siteman1 ;;
8585 esac
8586 case "$dflt" in
8587 ''|' ') dflt=none ;;
8588 esac
8589 fn=dn+~
8590 rp='Pathname where the site-specific manual pages should be installed?'
8591 . ./getfile
8592 siteman1="$ans"
8593 siteman1exp="$ansexp"
8594 : Use ' ' for none so value is preserved next time through Configure
8595 $test X"$siteman1" = "X" && siteman1=' '
8596 : Change installation prefix, if necessary.
8597 if $test X"$prefix" != X"$installprefix"; then
8598         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8599 else
8600         installsiteman1="$siteman1exp"
8601 fi
8602
8603 : determine where add-on library man pages go
8604 case "$siteman3" in
8605 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8606 *)      dflt=$siteman3 ;;
8607 esac
8608 case "$dflt" in
8609 ''|' ') dflt=none ;;
8610 esac
8611 fn=dn+~
8612 rp='Pathname where the site-specific library manual pages should be installed?'
8613 . ./getfile
8614 siteman3="$ans"
8615 siteman3exp="$ansexp"
8616 : Use ' ' for none so value is preserved next time through Configure
8617 $test X"$siteman3" = "X" && siteman3=' '
8618 : Change installation prefix, if necessary.
8619 if $test X"$prefix" != X"$installprefix"; then
8620         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8621 else
8622         installsiteman3="$siteman3exp"
8623 fi
8624
8625 : determine where add-on public executable scripts go
8626 case "$sitescript" in
8627 '')     dflt=$siteprefix/script
8628         $test -d $dflt || dflt=$sitebin ;;
8629 *)  dflt="$sitescript" ;;
8630 esac
8631 fn=d~+
8632 rp='Pathname where add-on public executable scripts should be installed?'
8633 . ./getfile
8634 sitescript="$ans"
8635 sitescriptexp="$ansexp"
8636 : Change installation prefix, if necessary.
8637 if $test X"$prefix" != X"$installprefix"; then
8638         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8639 else
8640         installsitescript="$sitescriptexp"
8641 fi
8642
8643 : define an is-a-typedef? function
8644 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8645 case "$inclist" in
8646 "") inclist="sys/types.h";;
8647 esac;
8648 eval "varval=\$$var";
8649 case "$varval" in
8650 "")
8651         $rm -f temp.c;
8652         for inc in $inclist; do
8653                 echo "#include <$inc>" >>temp.c;
8654         done;
8655         echo "#ifdef $type" >> temp.c;
8656         echo "printf(\"We have $type\");" >> temp.c;
8657         echo "#endif" >> temp.c;
8658         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8659         if $contains $type temp.E >/dev/null 2>&1; then
8660                 eval "$var=\$type";
8661         else
8662                 eval "$var=\$def";
8663         fi;
8664         $rm -f temp.?;;
8665 *) eval "$var=\$varval";;
8666 esac'
8667
8668 : define an is-a-typedef? function that prompts if the type is not available.
8669 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8670 case "$inclist" in
8671 "") inclist="sys/types.h";;
8672 esac;
8673 eval "varval=\$$var";
8674 case "$varval" in
8675 "")
8676         $rm -f temp.c;
8677         for inc in $inclist; do
8678                 echo "#include <$inc>" >>temp.c;
8679         done;
8680         echo "#ifdef $type" >> temp.c;
8681         echo "printf(\"We have $type\");" >> temp.c;
8682         echo "#endif" >> temp.c;
8683         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8684         echo " " ;
8685         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8686         if $contains $type temp.E >/dev/null 2>&1; then
8687                 echo "$type found." >&4;
8688                 eval "$var=\$type";
8689         else
8690                 echo "$type NOT found." >&4;
8691                 dflt="$def";
8692                 . ./myread ;
8693                 eval "$var=\$ans";
8694         fi;
8695         $rm -f temp.?;;
8696 *) eval "$var=\$varval";;
8697 esac'
8698
8699 : see what type lseek is declared as in the kernel
8700 rp="What is the type used for lseek's offset on this system?"
8701 set off_t lseektype long stdio.h sys/types.h
8702 eval $typedef_ask
8703
8704 echo " "
8705 echo "Checking to see how big your file offsets are..." >&4
8706 $cat >try.c <<EOCP
8707 #include <sys/types.h>
8708 #include <stdio.h>
8709 int main()
8710 {
8711     printf("%d\n", (int)sizeof($lseektype));
8712     return(0); 
8713 }
8714 EOCP
8715 set try
8716 if eval $compile_ok; then
8717         lseeksize=`$run ./try`
8718         echo "Your file offsets are $lseeksize bytes long."
8719 else
8720         dflt=$longsize
8721         echo " "
8722         echo "(I can't seem to compile the test program.  Guessing...)"
8723         rp="What is the size of your file offsets (in bytes)?"
8724         . ./myread
8725         lseeksize="$ans"
8726 fi
8727 $rm -f try.c try
8728
8729 : see what type file positions are declared as in the library
8730 rp="What is the type for file position used by fsetpos()?"
8731 set fpos_t fpostype long stdio.h sys/types.h
8732 eval $typedef_ask
8733
8734 echo " "
8735 case "$fpostype" in
8736 *_t) zzz="$fpostype"    ;;
8737 *)   zzz="fpos_t"       ;;
8738 esac
8739 echo "Checking the size of $zzz..." >&4 
8740 cat > try.c <<EOCP
8741 #include <sys/types.h>
8742 #include <stdio.h>
8743 #$i_stdlib I_STDLIB
8744 #ifdef I_STDLIB
8745 #include <stdlib.h>
8746 #endif
8747 int main() {
8748     printf("%d\n", (int)sizeof($fpostype));
8749     exit(0);
8750 }
8751 EOCP
8752 set try
8753 if eval $compile_ok; then
8754         yyy=`$run ./try`
8755         case "$yyy" in
8756         '')     fpossize=4
8757                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8758                 ;;
8759         *)      fpossize=$yyy
8760                 echo "Your $zzz is $fpossize bytes long."
8761                 ;;
8762         esac
8763 else
8764         dflt="$longsize"
8765         echo " " >&4
8766         echo "(I can't compile the test program.  Guessing...)" >&4
8767         rp="What is the size of your file positions (in bytes)?"
8768         . ./myread
8769         fpossize="$ans"
8770 fi
8771
8772 # Backward compatibility (uselfs is deprecated).
8773 case "$uselfs" in
8774 "$define"|true|[yY]*)
8775         cat <<EOM >&4
8776
8777 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8778 EOM
8779         uselargefiles="$define"
8780         ;;
8781 esac                          
8782
8783 case "$lseeksize:$fpossize" in
8784 8:8) cat <<EOM
8785
8786 You can have files larger than 2 gigabytes.
8787 EOM
8788    val="$define" ;;
8789 *)    case "$uselargefiles" in
8790    "$undef"|false|[nN]*) dflt='n' ;;
8791    *)   dflt='y' ;;
8792    esac
8793    cat <<EOM
8794
8795 Perl can be built to understand large files (files larger than 2 gigabytes)
8796 on some systems.  To do so, Configure can be run with -Duselargefiles.
8797
8798 If this doesn't make any sense to you, just accept the default '$dflt'.
8799 EOM
8800    rp='Try to understand large files, if available?'
8801    . ./myread
8802    case "$ans" in
8803    y|Y)         val="$define" ;;
8804    *)           val="$undef"  ;;
8805    esac
8806    ;;
8807 esac
8808 set uselargefiles
8809 eval $setvar
8810 case "$uselargefiles" in
8811 "$define")
8812 : Look for a hint-file generated 'call-back-unit'.  If the
8813 : user has specified that a large files perl is to be built,
8814 : we may need to set or change some other defaults.
8815         if $test -f uselargefiles.cbu; then
8816                 echo "Your platform has some specific hints for large file builds, using them..."
8817                 . ./uselargefiles.cbu
8818                 echo " "
8819                 echo "Rechecking to see how big your file offsets are..." >&4
8820                 $cat >try.c <<EOCP
8821 #include <sys/types.h>
8822 #include <stdio.h>
8823 int main()
8824 {
8825     printf("%d\n", (int)sizeof($lseektype));
8826     return(0); 
8827 }
8828 EOCP
8829                 set try
8830                 if eval $compile_ok; then
8831                         lseeksize=`$run ./try`
8832                         $echo "Your file offsets are now $lseeksize bytes long."
8833                 else
8834                         dflt="$lseeksize"
8835                         echo " "
8836                         echo "(I can't seem to compile the test program.  Guessing...)"
8837                         rp="What is the size of your file offsets (in bytes)?"
8838                         . ./myread
8839                         lseeksize="$ans"
8840                 fi
8841                 case "$fpostype" in
8842                 *_t) zzz="$fpostype"    ;;
8843                 *)   zzz="fpos_t"       ;;
8844                 esac
8845                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8846                 $cat > try.c <<EOCP
8847 #include <sys/types.h>
8848 #include <stdio.h>
8849 #$i_stdlib I_STDLIB
8850 #ifdef I_STDLIB
8851 #include <stdlib.h>
8852 #endif
8853 int main() {
8854     printf("%d\n", (int)sizeof($fpostype));
8855     return(0);
8856 }
8857 EOCP
8858                 set try
8859                 if eval $compile_ok; then
8860                         yyy=`$run ./try`
8861                         dflt="$lseeksize"
8862                         case "$yyy" in
8863                         '')     echo " "
8864                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8865                                 ;;
8866                         *)      fpossize=$yyy
8867                                 echo " $fpossize bytes." >&4
8868                                 ;;
8869                         esac
8870                 else
8871                         dflt="$fpossize"
8872                         echo " "
8873                         echo "(I can't compile the test program.  Guessing...)" >&4
8874                         rp="What is the size of your file positions (in bytes)?"
8875                         . ./myread
8876                         fpossize="$ans"
8877                 fi
8878                 $rm -f try.c try
8879         fi
8880         ;;
8881 esac
8882
8883 case "$vendorprefix" in
8884 '')     d_vendorbin="$undef"
8885         vendorbin=''
8886         vendorbinexp=''
8887         ;;
8888 *)      d_vendorbin="$define"
8889         : determine where vendor-supplied executables go.
8890         case "$vendorbin" in
8891         '') dflt=$vendorprefix/bin ;;
8892         *)      dflt="$vendorbin" ;;
8893         esac
8894         fn=d~+
8895         rp='Pathname for the vendor-supplied executables directory?'
8896         . ./getfile
8897         vendorbin="$ans"
8898         vendorbinexp="$ansexp"
8899         ;;
8900 esac
8901 : Change installation prefix, if necessary.
8902 if $test X"$prefix" != X"$installprefix"; then
8903         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8904 else
8905         installvendorbin="$vendorbinexp"
8906 fi
8907
8908 case "$vendorprefix" in
8909 '')     vendorhtml1=''
8910         vendorhtml1exp=''
8911         ;;
8912 *)      : determine where vendor-supplied html pages go.
8913         : There is no standard location, so try to copy the previously-selected
8914         : directory structure for the core html pages.
8915         : XXX Better default suggestions would be welcome.
8916         case "$vendorhtml1" in
8917         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8918         *)      dflt=$vendorhtml1 ;;
8919         esac
8920         case "$dflt" in
8921         ''|' ') dflt=none ;;
8922         esac
8923         fn=dn+~
8924         rp='Pathname for the vendor-supplied html pages?'
8925         . ./getfile
8926         vendorhtml1="$ans"
8927         vendorhtml1exp="$ansexp"
8928         ;;
8929 esac
8930 : Use ' ' for none so value is preserved next time through Configure
8931 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
8932 : Change installation prefix, if necessary.
8933 if $test X"$prefix" != X"$installprefix"; then
8934         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
8935 else
8936         installvendorhtml1="$vendorhtml1exp"
8937 fi
8938
8939 case "$vendorprefix" in
8940 '')     vendorhtml3=''
8941         vendorhtml3exp=''
8942         ;;
8943 *)      : determine where vendor-supplied module html pages go.
8944         : There is no standard location, so try to copy the previously-selected
8945         : directory structure for the core html pages.
8946         : XXX Better default suggestions would be welcome.
8947         case "$vendorhtml3" in
8948         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8949         *)      dflt=$vendorhtml3 ;;
8950         esac
8951         case "$dflt" in
8952         ''|' ') dflt=none ;;
8953         esac
8954         fn=dn+~
8955         rp='Pathname for the vendor-supplied html pages?'
8956         . ./getfile
8957         vendorhtml3="$ans"
8958         vendorhtml3exp="$ansexp"
8959         ;;
8960 esac
8961 : Use ' ' for none so value is preserved next time through Configure
8962 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
8963 : Change installation prefix, if necessary.
8964 if $test X"$prefix" != X"$installprefix"; then
8965         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
8966 else
8967         installvendorhtml3="$vendorhtml3exp"
8968 fi
8969
8970 case "$vendorprefix" in
8971 '')     vendorman1=''
8972         vendorman1exp=''
8973         ;;
8974 *)      : determine where vendor-supplied manual pages go.
8975         case "$vendorman1" in
8976         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8977         *)      dflt=$vendorman1 ;;
8978         esac
8979         case "$dflt" in
8980         ''|' ') dflt=none ;;
8981         esac
8982         fn=nd~+
8983         rp='Pathname for the vendor-supplied manual section 1 pages?'
8984         . ./getfile
8985         vendorman1="$ans"
8986         vendorman1exp="$ansexp"
8987         ;;
8988 esac
8989 : Use ' ' for none so value is preserved next time through Configure
8990 $test X"$vendorman1" = "X" && vendorman1=' '
8991 : Change installation prefix, if necessary.
8992 if $test X"$prefix" != X"$installprefix"; then
8993         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
8994 else
8995         installvendorman1="$vendorman1exp"
8996 fi
8997
8998 case "$vendorprefix" in
8999 '')     vendorman3=''
9000         vendorman3exp=''
9001         ;;
9002 *)      : determine where vendor-supplied module manual pages go.
9003         case "$vendorman3" in
9004         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9005         *)      dflt=$vendorman3 ;;
9006         esac
9007         case "$dflt" in
9008         ''|' ') dflt=none ;;
9009         esac
9010         fn=nd~+
9011         rp='Pathname for the vendor-supplied manual section 3 pages?'
9012         . ./getfile
9013         vendorman3="$ans"
9014         vendorman3exp="$ansexp"
9015         ;;
9016 esac
9017 : Use ' ' for none so value is preserved next time through Configure
9018 $test X"$vendorman3" = "X" && vendorman3=' '
9019 : Change installation prefix, if necessary.
9020 if $test X"$prefix" != X"$installprefix"; then
9021         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9022 else
9023         installvendorman3="$vendorman3exp"
9024 fi
9025
9026 case "$vendorprefix" in
9027 '')     d_vendorscript="$undef"
9028         vendorscript=''
9029         vendorscriptexp=''
9030         ;;
9031 *)      d_vendorscript="$define"
9032         : determine where vendor-supplied scripts go.
9033         case "$vendorscript" in
9034         '')     dflt=$vendorprefix/script
9035                 $test -d $dflt || dflt=$vendorbin ;;
9036         *)  dflt="$vendorscript" ;;
9037         esac
9038         $cat <<EOM
9039
9040 The installation process will create a directory for 
9041 vendor-supplied scripts.
9042
9043 EOM
9044         fn=d~+
9045         rp='Pathname for the vendor-supplied scripts directory?'
9046         . ./getfile
9047         vendorscript="$ans"
9048         vendorscriptexp="$ansexp"
9049         ;;
9050 esac
9051 : Change installation prefix, if necessary.
9052 if $test X"$prefix" != X"$installprefix"; then
9053         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9054 else
9055         installvendorscript="$vendorscriptexp"
9056 fi
9057
9058 : see if qgcvt exists
9059 set qgcvt d_qgcvt
9060 eval $inlibc
9061
9062 echo " "
9063
9064 if $test X"$d_longdbl" = X"$define"; then
9065
9066 echo "Checking how to print long doubles..." >&4
9067
9068 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9069         $cat >try.c <<'EOCP'
9070 #include <sys/types.h>
9071 #include <stdio.h>
9072 int main() {
9073   double d = 123.456;
9074   printf("%.3f\n", d);
9075 }
9076 EOCP
9077         set try
9078         if eval $compile; then
9079                 yyy=`$run ./try`
9080                 case "$yyy" in
9081                 123.456)
9082                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9083                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9084                         echo "We will use %f."
9085                         ;;
9086                 esac
9087         fi
9088 fi
9089
9090 if $test X"$sPRIfldbl" = X; then
9091         $cat >try.c <<'EOCP'
9092 #include <sys/types.h>
9093 #include <stdio.h>
9094 int main() {
9095   long double d = 123.456;
9096   printf("%.3Lf\n", d);
9097 }
9098 EOCP
9099         set try
9100         if eval $compile; then
9101                 yyy=`$run ./try`
9102                 case "$yyy" in
9103                 123.456)
9104                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9105                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9106                         echo "We will use %Lf."
9107                         ;;
9108                 esac
9109         fi
9110 fi
9111
9112 if $test X"$sPRIfldbl" = X; then
9113         $cat >try.c <<'EOCP'
9114 #include <sys/types.h>
9115 #include <stdio.h>
9116 int main() {
9117   long double d = 123.456;
9118   printf("%.3llf\n", d);
9119 }
9120 EOCP
9121         set try
9122         if eval $compile; then
9123                 yyy=`$run ./try`
9124                 case "$yyy" in
9125                 123.456)
9126                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9127                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9128                         echo "We will use %llf."
9129                         ;;
9130                 esac
9131         fi
9132 fi
9133
9134 if $test X"$sPRIfldbl" = X; then
9135         $cat >try.c <<'EOCP'
9136 #include <sys/types.h>
9137 #include <stdio.h>
9138 int main() {
9139   long double d = 123.456;
9140   printf("%.3lf\n", d);
9141 }
9142 EOCP
9143         set try
9144         if eval $compile; then
9145                 yyy=`$run ./try`
9146                 case "$yyy" in
9147                 123.456)
9148                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9149                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9150                         echo "We will use %lf."
9151                         ;;
9152                 esac
9153         fi
9154 fi
9155
9156 if $test X"$sPRIfldbl" = X; then
9157         echo "Cannot figure out how to print long doubles." >&4
9158 else
9159         sSCNfldbl=$sPRIfldbl    # expect consistency
9160 fi
9161
9162 $rm -f try try.*
9163
9164 fi # d_longdbl
9165
9166 case "$sPRIfldbl" in
9167 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9168         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9169         d_SCNfldbl="$undef";
9170         ;;
9171 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9172         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9173         d_SCNfldbl="$define";
9174         ;;
9175 esac
9176
9177 : Check how to convert floats to strings.
9178
9179 if test "X$d_Gconvert" = X; then
9180
9181 echo " "
9182 echo "Checking for an efficient way to convert floats to strings."
9183 echo " " > try.c
9184 case "$uselongdouble" in
9185 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9186 esac
9187 case "$d_longdbl" in
9188 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9189 esac
9190 case "$d_PRIgldbl" in
9191 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9192 esac
9193 $cat >>try.c <<EOP
9194 #ifdef TRY_gconvert
9195 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9196 char *myname = "gconvert";
9197 #endif
9198 #ifdef TRY_gcvt
9199 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9200 char *myname = "gcvt";
9201 #endif
9202 #ifdef TRY_qgcvt
9203 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9204 char *myname = "qgcvt";
9205 #define DOUBLETYPE long double
9206 #endif
9207 #ifdef TRY_sprintf
9208 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9209 #ifdef HAS_PRIgldbl
9210 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9211 #else
9212 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9213 #endif
9214 #else
9215 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9216 #endif
9217 char *myname = "sprintf";
9218 #endif
9219
9220 #ifndef DOUBLETYPE
9221 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9222 #define DOUBLETYPE long double
9223 #else
9224 #define DOUBLETYPE double
9225 #endif
9226 #endif
9227
9228 #include <stdio.h>
9229
9230 #define I_STDLIB $i_stdlib
9231 #ifdef I_STDLIB
9232 #include <stdlib.h>
9233 #endif
9234
9235 int
9236 checkit(expect, got)
9237 char *expect;
9238 char *got;
9239 {
9240     if (strcmp(expect, got)) {
9241                 printf("%s oddity:  Expected %s, got %s\n",
9242                         myname, expect, got);
9243                 exit(1);
9244         }
9245 }
9246
9247 int main()
9248
9249         char buf[64]; 
9250         buf[63] = '\0';
9251
9252         /* This must be 1st test on (which?) platform */
9253         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9254         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9255         checkit("0.1", buf);
9256
9257         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9258         checkit("0.01", buf);
9259
9260         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9261         checkit("0.001", buf);
9262
9263         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9264         checkit("0.0001", buf);
9265
9266         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9267         if (strlen(buf) > 5)
9268             checkit("9e-005", buf); /* for Microsoft ?? */
9269         else
9270             checkit("9e-05", buf);
9271
9272         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9273         checkit("1", buf);
9274
9275         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9276         checkit("1.1", buf);
9277
9278         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9279         checkit("1.01", buf);
9280
9281         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9282         checkit("1.001", buf);
9283
9284         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9285         checkit("1.0001", buf);
9286
9287         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9288         checkit("1.00001", buf);
9289
9290         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9291         checkit("1.000001", buf);
9292
9293         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9294         checkit("0", buf);
9295
9296         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9297         checkit("-1", buf);
9298
9299         /* Some Linux gcvt's give 1.e+5 here. */
9300         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9301         checkit("100000", buf);
9302         
9303         /* Some Linux gcvt's give -1.e+5 here. */
9304         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9305         checkit("-100000", buf);
9306
9307         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9308         checkit("123.456", buf);
9309
9310         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9311         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9312         /* 34 should be enough to scare even long double
9313          * places into using the e notation. */
9314         if (strlen(buf) > 5)
9315             checkit("1e+034", buf); /* for Microsoft */
9316         else
9317             checkit("1e+34", buf);
9318
9319         /* For Perl, if you add additional tests here, also add them to
9320          * t/base/num.t for benefit of platforms not using Configure or
9321          * overriding d_Gconvert */
9322
9323         exit(0);
9324 }
9325 EOP
9326 : first add preferred functions to our list
9327 xxx_list=""
9328 for xxx_convert in $gconvert_preference; do
9329     case $xxx_convert in
9330     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9331     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9332     esac 
9333 done
9334 : then add any others
9335 for xxx_convert in gconvert gcvt sprintf; do
9336     case "$xxx_list" in
9337     *$xxx_convert*) ;;
9338     *) xxx_list="$xxx_list $xxx_convert" ;;
9339     esac 
9340 done
9341
9342 case "$d_longdbl$uselongdouble" in
9343 "$define$define")
9344     : again, add prefered functions to our list first
9345     xxx_ld_list=""
9346     for xxx_convert in $gconvert_ld_preference; do
9347         case $xxx_convert in
9348         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9349         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9350         esac
9351     done
9352     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9353     for xxx_convert in qgcvt sprintf $xxx_list; do
9354         case "$xxx_ld_list" in
9355         $xxx_convert*|*" $xxx_convert"*) ;;
9356         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9357         esac
9358     done
9359     : if sprintf cannot do long doubles, move it to the end
9360     if test "$d_PRIgldbl" != "$define"; then
9361         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9362     fi
9363     : if no qgcvt, remove it
9364     if test "$d_qgcvt" != "$define"; then
9365         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9366     fi
9367     : use the ld_list
9368     xxx_list="$xxx_ld_list"
9369     ;;
9370 esac
9371
9372 for xxx_convert in $xxx_list; do
9373         echo "Trying $xxx_convert..."
9374         $rm -f try try$_o
9375         set try -DTRY_$xxx_convert
9376         if eval $compile; then
9377                 echo "$xxx_convert() found." >&4
9378                 if $run ./try; then
9379                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9380                         break;
9381                 else
9382                         echo "...But $xxx_convert didn't work as I expected."
9383                         xxx_convert=''
9384                 fi
9385         else
9386                 echo "$xxx_convert NOT found." >&4
9387         fi
9388 done
9389
9390 if test X$xxx_convert = X; then
9391     echo "*** WHOA THERE!!! ***" >&4
9392     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9393     xxx_convert=sprintf
9394 fi
9395
9396 case "$xxx_convert" in
9397 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9398 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9399 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9400 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9401    "$define$define$define")
9402       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9403    "$define$define$undef")
9404       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9405    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9406    esac
9407    ;;  
9408 esac
9409
9410 fi
9411
9412 : see if _fwalk exists
9413 set fwalk d__fwalk
9414 eval $inlibc
9415
9416 : Initialize h_fcntl
9417 h_fcntl=false
9418
9419 : Initialize h_sysfile
9420 h_sysfile=false
9421
9422 : access call always available on UNIX
9423 set access d_access
9424 eval $inlibc
9425
9426 : locate the flags for 'access()'
9427 case "$d_access" in
9428 "$define")
9429         echo " "
9430         $cat >access.c <<EOCP
9431 #include <sys/types.h>
9432 #ifdef I_FCNTL
9433 #include <fcntl.h>
9434 #endif
9435 #ifdef I_SYS_FILE
9436 #include <sys/file.h>
9437 #endif
9438 #ifdef I_UNISTD
9439 #include <unistd.h>
9440 #endif
9441 #$i_stdlib I_STDLIB
9442 #ifdef I_STDLIB
9443 #include <stdlib.h>
9444 #endif
9445 int main() {
9446         exit(R_OK);
9447 }
9448 EOCP
9449         : check sys/file.h first, no particular reason here
9450         if $test `./findhdr sys/file.h` && \
9451                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9452                 h_sysfile=true;
9453                 echo "<sys/file.h> defines the *_OK access constants." >&4
9454         elif $test `./findhdr fcntl.h` && \
9455                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9456                 h_fcntl=true;
9457                 echo "<fcntl.h> defines the *_OK access constants." >&4
9458         elif $test `./findhdr unistd.h` && \
9459                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9460                 echo "<unistd.h> defines the *_OK access constants." >&4
9461         else
9462                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9463         fi
9464         ;;
9465 esac
9466 $rm -f access*
9467
9468 : see if accessx exists
9469 set accessx d_accessx
9470 eval $inlibc
9471
9472 : see if aintl exists
9473 set aintl d_aintl
9474 eval $inlibc
9475
9476 : see if alarm exists
9477 set alarm d_alarm
9478 eval $inlibc
9479
9480 : see if POSIX threads are available
9481 set pthread.h i_pthread
9482 eval $inhdr
9483
9484 : define a fucntion to check prototypes
9485 $cat > protochk <<EOSH
9486 $startsh
9487 cc="$cc"
9488 optimize="$optimize"
9489 ccflags="$ccflags"
9490 prototype="$prototype"
9491 define="$define"
9492 rm=$rm
9493 usethreads=$usethreads
9494 i_pthread=$i_pthread
9495 pthread_h_first=$pthread_h_first
9496 EOSH
9497
9498 $cat >> protochk <<'EOSH'
9499
9500 $rm -f try.c
9501 foo="$1"
9502 shift
9503 while test $# -ge 2; do
9504         case "$1" in
9505                 $define) echo "#include <$2>" >> try.c ;;
9506                 literal) echo "$2" >> try.c ;;
9507         esac
9508     # Extra magic for the benefit of systems that need pthread.h
9509     # to be included early to correctly detect threadsafe functions.
9510     # Such functions must guarantee themselves, though, that the usethreads
9511     # and i_pthread have been defined, before calling protochk.
9512     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9513         echo "#include <pthread.h>" >> try.c
9514         pthread_h_done=yes
9515     fi
9516     shift 2
9517 done
9518 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9519 cat >> try.c <<'EOCP'
9520 #ifdef CAN_PROTOTYPE
9521 #define _(args) args
9522 #else
9523 #define _(args) ()
9524 #endif
9525 EOCP
9526 echo "$foo" >> try.c
9527 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9528 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9529 status=$?
9530 $rm -f try.[co]
9531 exit $status
9532 EOSH
9533 chmod +x protochk
9534 $eunicefix protochk
9535
9536 hasproto='varname=$1; func=$2; shift; shift;
9537 while $test $# -ge 2; do
9538         case "$1" in
9539         $define) echo "#include <$2>";;
9540         esac ;
9541     shift 2;
9542 done > try.c;
9543 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9544 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9545         echo "$func() prototype found.";
9546         val="$define";
9547 else
9548         echo "$func() prototype NOT found.";
9549         val="$undef";
9550 fi;
9551 set $varname;
9552 eval $setvar;
9553 $rm -f try.c tryout.c'
9554
9555 : see if sys/types.h has to be included
9556 set sys/types.h i_systypes
9557 eval $inhdr
9558
9559 : see if sys/select.h has to be included
9560 set sys/select.h i_sysselct
9561 eval $inhdr
9562
9563 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9564 while $test $# -ge 2; do
9565         case "$1" in
9566         $define) echo "#include <$2>";;
9567         esac ;
9568     shift 2;
9569 done > try.c;
9570 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9571 set try;
9572 if eval $compile; then
9573         val="$define";
9574 else
9575         val="$undef";
9576 fi;
9577 set $varname;
9578 eval $setvar;
9579 $rm -f try.c try.o'
9580
9581 : see if we should include time.h, sys/time.h, or both
9582 echo " "
9583 if test "X$timeincl" = X; then
9584         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9585         $echo $n "I'm now running the test program...$c"
9586         $cat >try.c <<EOCP
9587 #include <sys/types.h>
9588 #ifdef I_TIME
9589 #include <time.h>
9590 #endif
9591 #ifdef I_SYSTIME
9592 #ifdef SYSTIMEKERNEL
9593 #define KERNEL
9594 #endif
9595 #include <sys/time.h>
9596 #endif
9597 #ifdef I_SYSSELECT
9598 #include <sys/select.h>
9599 #endif
9600 #$i_stdlib I_STDLIB
9601 #ifdef I_STDLIB
9602 #include <stdlib.h>
9603 #endif
9604 int main()
9605 {
9606         struct tm foo;
9607 #ifdef S_TIMEVAL
9608         struct timeval bar;
9609 #endif
9610 #ifdef S_TIMEZONE
9611         struct timezone tzp;
9612 #endif
9613         if (foo.tm_sec == foo.tm_sec)
9614                 exit(0);
9615 #ifdef S_TIMEVAL
9616         if (bar.tv_sec == bar.tv_sec)
9617                 exit(0);
9618 #endif
9619         exit(1);
9620 }
9621 EOCP
9622         flags=''
9623         for s_timezone in '-DS_TIMEZONE' ''; do
9624         sysselect=''
9625         for s_timeval in '-DS_TIMEVAL' ''; do
9626         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9627         for i_time in '' '-DI_TIME'; do
9628         for i_systime in '-DI_SYSTIME' ''; do
9629                 case "$flags" in
9630                 '') $echo $n ".$c"
9631                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9632                         if eval $compile; then
9633                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9634                                 shift
9635                                 flags="$*"
9636                                 echo " "
9637                                 $echo $n "Succeeded with $flags$c"
9638                         fi
9639                         ;;
9640                 esac
9641         done
9642         done
9643         done
9644         done
9645         done
9646         timeincl=''
9647         echo " "
9648         case "$flags" in
9649         *SYSTIMEKERNEL*) i_systimek="$define"
9650                 timeincl=`./findhdr sys/time.h`
9651                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9652         *) i_systimek="$undef";;
9653         esac
9654         case "$flags" in
9655         *I_TIME*) i_time="$define"
9656                 timeincl=`./findhdr time.h`" $timeincl"
9657                 echo "We'll include <time.h>." >&4;;
9658         *) i_time="$undef";;
9659         esac
9660         case "$flags" in
9661         *I_SYSTIME*) i_systime="$define"
9662                 timeincl=`./findhdr sys/time.h`" $timeincl"
9663                 echo "We'll include <sys/time.h>." >&4;;
9664         *) i_systime="$undef";;
9665         esac
9666         $rm -f try.c try
9667 fi
9668 : see if struct tm knows about tm_zone
9669 case "$i_systime$i_time" in
9670 *$define*) 
9671         echo " "
9672         echo "Checking to see if your struct tm has tm_zone field..." >&4
9673         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9674         eval $hasfield
9675         ;;
9676 *)      val="$undef"
9677         set d_tm_tm_zone
9678         eval $setvar
9679         ;;
9680 esac
9681 case "$d_tm_tm_zone" in
9682 "$define")      echo "Yes, it does."   ;;
9683 *)              echo "No, it doesn't." ;;
9684 esac
9685 : see if struct tm knows about tm_gmtoff
9686 case "$i_systime$i_time" in
9687 *$define*) 
9688         echo " "
9689         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9690         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9691         eval $hasfield
9692         ;;
9693 *)      val="$undef"
9694         set d_tm_tm_gmtoff
9695         eval $setvar
9696         ;;
9697 esac
9698 case "$d_tm_tm_gmtoff" in
9699 "$define")      echo "Yes, it does."   ;;
9700 *)              echo "No, it doesn't." ;;
9701 esac
9702
9703 : see if asctime_r exists
9704 set asctime_r d_asctime_r
9705 eval $inlibc
9706 case "$d_asctime_r" in
9707 "$define")
9708         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9709         case "$d_asctime_r_proto:$usethreads" in
9710         ":define")      d_asctime_r_proto=define
9711                 set d_asctime_r_proto asctime_r $hdrs
9712                 eval $hasproto ;;
9713         *)      ;;
9714         esac
9715         case "$d_asctime_r_proto" in
9716         define)
9717         case "$asctime_r_proto" in
9718         ''|0) try='char* asctime_r(const struct tm*, char*);'
9719         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9720         esac
9721         case "$asctime_r_proto" in
9722         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9723         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9724         esac
9725         case "$asctime_r_proto" in
9726         ''|0) try='int asctime_r(const struct tm*, char*);'
9727         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9728         esac
9729         case "$asctime_r_proto" in
9730         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9731         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9732         esac
9733         case "$asctime_r_proto" in
9734         ''|0)   d_asctime_r=undef
9735                 asctime_r_proto=0
9736                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9737         * )     case "$asctime_r_proto" in
9738                 REENTRANT_PROTO*) ;;
9739                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9740                 esac
9741                 echo "Prototype: $try" ;;
9742         esac
9743         ;;
9744         *)      case "$usethreads" in
9745                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9746                 esac
9747                 d_asctime_r=undef
9748                 asctime_r_proto=0
9749                 ;;
9750         esac
9751         ;;
9752 *)      asctime_r_proto=0
9753         ;;
9754 esac
9755
9756 : see if atolf exists
9757 set atolf d_atolf
9758 eval $inlibc
9759
9760 : see if atoll exists
9761 set atoll d_atoll
9762 eval $inlibc
9763
9764 : Look for GNU-cc style attribute checking
9765 echo " "
9766 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9767 $cat >attrib.c <<'EOCP'
9768 #include <stdio.h>
9769 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9770 EOCP
9771 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9772         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9773                 echo "Your C compiler doesn't fully support __attribute__."
9774                 val="$undef"
9775         else
9776                 echo "Your C compiler supports __attribute__."
9777                 val="$define"
9778         fi
9779 else
9780         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9781         val="$undef"
9782 fi
9783 set d_attribut
9784 eval $setvar
9785 $rm -f attrib*
9786
9787 : see if bcmp exists
9788 set bcmp d_bcmp
9789 eval $inlibc
9790
9791 : see if bcopy exists
9792 set bcopy d_bcopy
9793 eval $inlibc
9794
9795 : see if this is a unistd.h system
9796 set unistd.h i_unistd
9797 eval $inhdr
9798
9799 : see if getpgrp exists
9800 set getpgrp d_getpgrp
9801 eval $inlibc
9802
9803 case "$d_getpgrp" in
9804 "$define")
9805         echo " "
9806         echo "Checking to see which flavor of getpgrp is in use..."
9807         $cat >try.c <<EOP
9808 #$i_unistd I_UNISTD
9809 #include <sys/types.h>
9810 #ifdef I_UNISTD
9811 #  include <unistd.h>
9812 #endif
9813 #$i_stdlib I_STDLIB
9814 #ifdef I_STDLIB
9815 #include <stdlib.h>
9816 #endif
9817 int main()
9818 {
9819         if (getuid() == 0) {
9820                 printf("(I see you are running Configure as super-user...)\n");
9821                 setuid(1);
9822         }
9823 #ifdef TRY_BSD_PGRP
9824         if (getpgrp(1) == 0)
9825                 exit(0);
9826 #else
9827         if (getpgrp() > 0)
9828                 exit(0);
9829 #endif
9830         exit(1);
9831 }
9832 EOP
9833         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9834                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9835                 val="$define"
9836         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9837                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9838                 val="$undef"
9839         else
9840                 echo "I can't seem to compile and run the test program."
9841                 if ./usg; then
9842                         xxx="a USG one, i.e. you use getpgrp()."
9843                 else
9844                         # SVR4 systems can appear rather BSD-ish.
9845                         case "$i_unistd" in
9846                         $undef)
9847                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9848                                 val="$define"
9849                                 ;;
9850                         $define)
9851                                 xxx="probably a USG one, i.e. you use getpgrp()."
9852                                 val="$undef"
9853                                 ;;
9854                         esac
9855                 fi
9856                 echo "Assuming your getpgrp is $xxx" >&4
9857         fi
9858         ;;
9859 *) val="$undef";;
9860 esac
9861 set d_bsdgetpgrp
9862 eval $setvar
9863 $rm -f try try.*
9864
9865 : see if setpgrp exists
9866 set setpgrp d_setpgrp
9867 eval $inlibc
9868
9869 case "$d_setpgrp" in
9870 "$define")
9871         echo " "
9872         echo "Checking to see which flavor of setpgrp is in use..."
9873         $cat >try.c <<EOP
9874 #$i_unistd I_UNISTD
9875 #include <sys/types.h>
9876 #ifdef I_UNISTD
9877 #  include <unistd.h>
9878 #endif
9879 #$i_stdlib I_STDLIB
9880 #ifdef I_STDLIB
9881 #include <stdlib.h>
9882 #endif
9883 int main()
9884 {
9885         if (getuid() == 0) {
9886                 printf("(I see you are running Configure as super-user...)\n");
9887                 setuid(1);
9888         }
9889 #ifdef TRY_BSD_PGRP
9890         if (-1 == setpgrp(1, 1))
9891                 exit(0);
9892 #else
9893         if (setpgrp() != -1)
9894                 exit(0);
9895 #endif
9896         exit(1);
9897 }
9898 EOP
9899         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9900                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9901                 val="$define"
9902         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9903                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9904                 val="$undef"
9905         else
9906                 echo "(I can't seem to compile and run the test program.)"
9907                 if ./usg; then
9908                         xxx="a USG one, i.e. you use setpgrp()."
9909                 else
9910                         # SVR4 systems can appear rather BSD-ish.
9911                         case "$i_unistd" in
9912                         $undef)
9913                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9914                                 val="$define"
9915                                 ;;
9916                         $define)
9917                                 xxx="probably a USG one, i.e. you use setpgrp()."
9918                                 val="$undef"
9919                                 ;;
9920                         esac
9921                 fi
9922                 echo "Assuming your setpgrp is $xxx" >&4
9923         fi
9924         ;;
9925 *) val="$undef";;
9926 esac
9927 set d_bsdsetpgrp
9928 eval $setvar
9929 $rm -f try try.*
9930 : see if bzero exists
9931 set bzero d_bzero
9932 eval $inlibc
9933
9934 : see if signal is declared as pointer to function returning int or void
9935 echo " "
9936 xxx=`./findhdr signal.h`
9937 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9938 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9939         echo "You have int (*signal())() instead of void." >&4
9940         val="$undef"
9941 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9942         echo "You have void (*signal())()." >&4
9943         val="$define"
9944 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9945         echo "You have int (*signal())() instead of void." >&4
9946         val="$undef"
9947 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9948         echo "You have void (*signal())()." >&4
9949         val="$define"
9950 else
9951         case "$d_voidsig" in
9952         '')
9953         echo "I can't determine whether signal handler returns void or int..." >&4
9954                 dflt=void
9955                 rp="What type does your signal handler return?"
9956                 . ./myread
9957                 case "$ans" in
9958                 v*) val="$define";;
9959                 *) val="$undef";;
9960                 esac;;
9961         "$define")
9962                 echo "As you already told me, signal handler returns void." >&4
9963                 val="$define"
9964                 ;;
9965         *)      echo "As you already told me, signal handler returns int." >&4
9966                 val="$undef"
9967                 ;;
9968         esac
9969 fi
9970 set d_voidsig
9971 eval $setvar
9972 case "$d_voidsig" in
9973 "$define") signal_t="void";;
9974 *) signal_t="int";;
9975 esac
9976 $rm -f $$.tmp
9977
9978 : check for ability to cast large floats to 32-bit ints.
9979 echo " "
9980 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9981 if $test "$intsize" -ge 4; then
9982         xxx=int
9983 else
9984         xxx=long
9985 fi
9986 $cat >try.c <<EOCP
9987 #include <stdio.h>
9988 #$i_stdlib I_STDLIB
9989 #ifdef I_STDLIB
9990 #include <stdlib.h>
9991 #endif
9992 #include <sys/types.h>
9993 #include <signal.h>
9994 $signal_t blech(s) int s; { exit(3); }
9995 int main()
9996 {
9997         $xxx i32;
9998         double f, g;
9999         int result = 0;
10000         char str[16];
10001         signal(SIGFPE, blech);
10002
10003         /* Don't let compiler optimize the test away.  Store the number 
10004            in a writable string for gcc to pass to sscanf under HP/UX.
10005         */
10006         sprintf(str, "2147483647");
10007         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10008         g = 10 * f;
10009         i32  = ($xxx) g;
10010
10011         /* x86 processors will probably give 0x8000 0000, which is a
10012        sign change.  We don't want that.  We want to mimic SPARC
10013            behavior here, which is to preserve the sign and give
10014            back 0x7fff ffff.
10015         */
10016         if (i32 != ($xxx) f)
10017                 result |= 1;
10018         exit(result);
10019 }
10020 EOCP
10021 set try
10022 if eval $compile_ok; then
10023         $run ./try
10024         yyy=$?
10025 else
10026         echo "(I can't seem to compile the test program--assuming it can't)"
10027         yyy=1
10028 fi
10029 case "$yyy" in
10030 0)      val="$define"
10031         echo "Yup, it can."
10032         ;;
10033 *)      val="$undef"
10034         echo "Nope, it can't."
10035         ;;
10036 esac
10037 set d_casti32
10038 eval $setvar
10039 $rm -f try try.*
10040
10041 : check for ability to cast negative floats to unsigned
10042 echo " "
10043 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10044 $cat >try.c <<EOCP
10045 #include <stdio.h>
10046 #$i_stdlib I_STDLIB
10047 #ifdef I_STDLIB
10048 #include <stdlib.h>
10049 #endif
10050 #include <sys/types.h>
10051 #include <signal.h>
10052 $signal_t blech(s) int s; { exit(7); }
10053 $signal_t blech_in_list(s) int s; { exit(4); }
10054 unsigned long dummy_long(p) unsigned long p; { return p; }
10055 unsigned int dummy_int(p) unsigned int p; { return p; }
10056 unsigned short dummy_short(p) unsigned short p; { return p; }
10057 int main()
10058 {
10059         double f;
10060         unsigned long along;
10061         unsigned int aint;
10062         unsigned short ashort;
10063         int result = 0;
10064         char str[16];
10065         
10066         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10067            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10068            optimized the whole file away
10069         */
10070         /* Store the number in a writable string for gcc to pass to 
10071            sscanf under HP/UX.
10072         */
10073         sprintf(str, "-123");
10074         sscanf(str, "%lf", &f);  /* f = -123.; */
10075
10076         signal(SIGFPE, blech);
10077         along = (unsigned long)f;
10078         aint = (unsigned int)f;
10079         ashort = (unsigned short)f;
10080         if (along != (unsigned long)-123)
10081                 result |= 1;
10082         if (aint != (unsigned int)-123)
10083                 result |= 1;
10084         if (ashort != (unsigned short)-123)
10085                 result |= 1;
10086         sprintf(str, "1073741824.");
10087         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10088         f = f + f;
10089         along = 0;
10090         along = (unsigned long)f;
10091         if (along != 0x80000000)
10092                 result |= 2;
10093         f -= 1.;
10094         along = 0;
10095         along = (unsigned long)f;
10096         if (along != 0x7fffffff)
10097                 result |= 1;
10098         f += 2.;
10099         along = 0;
10100         along = (unsigned long)f;
10101         if (along != 0x80000001)
10102                 result |= 2;
10103         if (result)
10104                 exit(result);
10105         signal(SIGFPE, blech_in_list);
10106         sprintf(str, "123.");
10107         sscanf(str, "%lf", &f);  /* f = 123.; */
10108         along = dummy_long((unsigned long)f);
10109         aint = dummy_int((unsigned int)f);
10110         ashort = dummy_short((unsigned short)f);
10111         if (along != (unsigned long)123)
10112                 result |= 4;
10113         if (aint != (unsigned int)123)
10114                 result |= 4;
10115         if (ashort != (unsigned short)123)
10116                 result |= 4;
10117         exit(result);
10118
10119 }
10120 EOCP
10121 set try
10122 if eval $compile_ok; then
10123         $run ./try
10124         castflags=$?
10125 else
10126         echo "(I can't seem to compile the test program--assuming it can't)"
10127         castflags=7
10128 fi
10129 case "$castflags" in
10130 0)      val="$define"
10131         echo "Yup, it can."
10132         ;;
10133 *)      val="$undef"
10134         echo "Nope, it can't."
10135         ;;
10136 esac
10137 set d_castneg
10138 eval $setvar
10139 $rm -f try.*
10140
10141 : see if vprintf exists
10142 echo " "
10143 if set vprintf val -f d_vprintf; eval $csym; $val; then
10144         echo 'vprintf() found.' >&4
10145         val="$define"
10146         $cat >try.c <<EOF
10147 #include <varargs.h>
10148 #$i_stdlib I_STDLIB
10149 #ifdef I_STDLIB
10150 #include <stdlib.h>
10151 #endif
10152
10153 int main() { xxx("foo"); }
10154
10155 xxx(va_alist)
10156 va_dcl
10157 {
10158         va_list args;
10159         char buf[10];
10160
10161         va_start(args);
10162         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10163 }
10164 EOF
10165         set try
10166         if eval $compile && $run ./try; then
10167                 echo "Your vsprintf() returns (int)." >&4
10168                 val2="$undef"
10169         else
10170                 echo "Your vsprintf() returns (char*)." >&4
10171                 val2="$define"
10172         fi
10173 else
10174         echo 'vprintf() NOT found.' >&4
10175                 val="$undef"
10176                 val2="$undef"
10177 fi
10178 $rm -f try try.*
10179 set d_vprintf
10180 eval $setvar
10181 val=$val2
10182 set d_charvspr
10183 eval $setvar
10184
10185 : see if chown exists
10186 set chown d_chown
10187 eval $inlibc
10188
10189 : see if chroot exists
10190 set chroot d_chroot
10191 eval $inlibc
10192
10193 : see if chsize exists
10194 set chsize d_chsize
10195 eval $inlibc
10196
10197 : see if class exists
10198 set class d_class
10199 eval $inlibc
10200
10201 hasstruct='varname=$1; struct=$2; shift; shift;
10202 while $test $# -ge 2; do
10203         case "$1" in
10204         $define) echo "#include <$2>";;
10205         esac ;
10206     shift 2;
10207 done > try.c;
10208 echo "int main () { struct $struct foo; }" >> try.c;
10209 set try;
10210 if eval $compile; then
10211         val="$define";
10212 else
10213         val="$undef";
10214 fi;
10215 set $varname;
10216 eval $setvar;
10217 $rm -f try.c try.o'
10218
10219 socketlib=''
10220 sockethdr=''
10221 : see whether socket exists
10222 echo " "
10223 $echo $n "Hmm... $c" >&4
10224 if set socket val -f d_socket; eval $csym; $val; then
10225         echo "Looks like you have Berkeley networking support." >&4
10226         d_socket="$define"
10227         if set setsockopt val -f; eval $csym; $val; then
10228                 d_oldsock="$undef"
10229         else
10230                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10231                 d_oldsock="$define"
10232         fi
10233 else
10234         if $contains socklib libc.list >/dev/null 2>&1; then
10235                 echo "Looks like you have Berkeley networking support." >&4
10236                 d_socket="$define"
10237                 : we will have to assume that it supports the 4.2 BSD interface
10238                 d_oldsock="$undef"
10239         else
10240                 echo "You don't have Berkeley networking in libc$_a..." >&4
10241                 if test "X$d_socket" = "X$define"; then
10242                    echo "...but you seem to believe that you have sockets." >&4
10243                 else
10244                         for net in net socket
10245                         do
10246                                 if test -f /usr/lib/lib$net$_a; then
10247                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10248                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10249                                         if $contains socket libc.list >/dev/null 2>&1; then
10250                                                 d_socket="$define"
10251                                                 socketlib="-l$net"
10252                                                 case "$net" in
10253                                                 net)
10254                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10255                                                         sockethdr="-I/usr/netinclude"
10256                                                         ;;
10257                                                 esac
10258                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10259                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10260                                                         d_oldsock="$undef"
10261                                                 else
10262                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10263                                                         d_oldsock="$define"
10264                                                 fi
10265                                                 break
10266                                         fi
10267                                 fi
10268                         done
10269                         if test "X$d_socket" != "X$define"; then
10270                            echo "or anywhere else I see." >&4
10271                            d_socket="$undef"
10272                            d_oldsock="$undef"
10273                         fi
10274                 fi
10275         fi
10276 fi
10277
10278 : see if socketpair exists
10279 set socketpair d_sockpair
10280 eval $inlibc
10281
10282
10283 echo " "
10284 echo "Checking the availability of certain socket constants..." >&4
10285 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10286         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10287         $cat >try.c <<EOF
10288 #include <sys/types.h>
10289 #include <sys/socket.h>
10290 int main() {
10291     int i = $ENUM;
10292 }
10293 EOF
10294         val="$undef"
10295         set try; if eval $compile; then
10296                 val="$define"
10297         fi
10298         set d_${enum}; eval $setvar
10299         $rm -f try.c try
10300 done
10301
10302 : see if this is a sys/uio.h system
10303 set sys/uio.h i_sysuio
10304 eval $inhdr
10305
10306
10307 echo " "
10308 echo "Checking to see if your system supports struct cmsghdr..." >&4
10309 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10310 eval $hasstruct
10311 case "$d_cmsghdr_s" in
10312 "$define")      echo "Yes, it does."   ;;
10313 *)              echo "No, it doesn't." ;;
10314 esac
10315
10316
10317 : check for const keyword
10318 echo " "
10319 echo 'Checking to see if your C compiler knows about "const"...' >&4
10320 $cat >const.c <<'EOCP'
10321 typedef struct spug { int drokk; } spug;
10322 int main()
10323 {
10324         const char *foo;
10325         const spug y;
10326 }
10327 EOCP
10328 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10329         val="$define"
10330         echo "Yup, it does."
10331 else
10332         val="$undef"
10333         echo "Nope, it doesn't."
10334 fi
10335 set d_const
10336 eval $setvar
10337
10338 : see if copysignl exists
10339 set copysignl d_copysignl
10340 eval $inlibc
10341
10342 : see if crypt exists
10343 echo " "
10344 set crypt d_crypt
10345 eval $inlibc
10346 case "$d_crypt" in
10347 $define) cryptlib='' ;;
10348 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10349                 echo 'crypt() found.' >&4
10350                 val="$define"
10351                 cryptlib=''
10352         else
10353                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10354                 if $test -z "$cryptlib"; then
10355                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10356                 else
10357                         cryptlib=-lcrypt
10358                 fi
10359                 if $test -z "$cryptlib"; then
10360                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10361                 else
10362                         cryptlib=-lcrypt
10363                 fi
10364                 if $test -z "$cryptlib"; then
10365                         cryptlib=`./loc libcrypt$_a "" $libpth`
10366                 else
10367                         cryptlib=-lcrypt
10368                 fi
10369                 if $test -z "$cryptlib"; then
10370                         echo 'crypt() NOT found.' >&4
10371                         val="$undef"
10372                 else
10373                         val="$define"
10374                 fi
10375         fi
10376         set d_crypt
10377         eval $setvar
10378         ;;
10379 esac
10380
10381 : see if this is a crypt.h system
10382 set crypt.h i_crypt
10383 eval $inhdr
10384
10385 : see if crypt_r exists
10386 set crypt_r d_crypt_r
10387 eval $inlibc
10388 case "$d_crypt_r" in
10389 "$define")
10390         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10391         case "$d_crypt_r_proto:$usethreads" in
10392         ":define")      d_crypt_r_proto=define
10393                 set d_crypt_r_proto crypt_r $hdrs
10394                 eval $hasproto ;;
10395         *)      ;;
10396         esac
10397         case "$d_crypt_r_proto" in
10398         define)
10399         case "$crypt_r_proto" in
10400         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10401         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10402         esac
10403         case "$crypt_r_proto" in
10404         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10405         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10406         esac
10407         case "$crypt_r_proto" in
10408         ''|0)   d_crypt_r=undef
10409                 crypt_r_proto=0
10410                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10411         * )     case "$crypt_r_proto" in
10412                 REENTRANT_PROTO*) ;;
10413                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10414                 esac
10415                 echo "Prototype: $try" ;;
10416         esac
10417         ;;
10418         *)      case "$usethreads" in
10419                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10420                 esac
10421                 d_crypt_r=undef
10422                 crypt_r_proto=0
10423                 ;;
10424         esac
10425         ;;
10426 *)      crypt_r_proto=0
10427         ;;
10428 esac
10429
10430 : get csh whereabouts
10431 case "$csh" in
10432 'csh') val="$undef" ;;
10433 *) val="$define" ;;
10434 esac
10435 set d_csh
10436 eval $setvar
10437 : Respect a hint or command line value for full_csh.
10438 case "$full_csh" in
10439 '') full_csh=$csh ;;
10440 esac
10441
10442 : see if ctermid_r exists
10443 set ctermid_r d_ctermid_r
10444 eval $inlibc
10445 case "$d_ctermid_r" in
10446 "$define")
10447         hdrs="$i_systypes sys/types.h define stdio.h "
10448         case "$d_ctermid_r_proto:$usethreads" in
10449         ":define")      d_ctermid_r_proto=define
10450                 set d_ctermid_r_proto ctermid_r $hdrs
10451                 eval $hasproto ;;
10452         *)      ;;
10453         esac
10454         case "$d_ctermid_r_proto" in
10455         define)
10456         case "$ctermid_r_proto" in
10457         ''|0) try='char* ctermid_r(char*);'
10458         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10459         esac
10460         case "$ctermid_r_proto" in
10461         ''|0)   d_ctermid_r=undef
10462                 ctermid_r_proto=0
10463                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10464         * )     case "$ctermid_r_proto" in
10465                 REENTRANT_PROTO*) ;;
10466                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10467                 esac
10468                 echo "Prototype: $try" ;;
10469         esac
10470         ;;
10471         *)      case "$usethreads" in
10472                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10473                 esac
10474                 d_ctermid_r=undef
10475                 ctermid_r_proto=0
10476                 ;;
10477         esac
10478         ;;
10479 *)      ctermid_r_proto=0
10480         ;;
10481 esac
10482
10483 : see if ctime_r exists
10484 set ctime_r d_ctime_r
10485 eval $inlibc
10486 case "$d_ctime_r" in
10487 "$define")
10488         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10489         case "$d_ctime_r_proto:$usethreads" in
10490         ":define")      d_ctime_r_proto=define
10491                 set d_ctime_r_proto ctime_r $hdrs
10492                 eval $hasproto ;;
10493         *)      ;;
10494         esac
10495         case "$d_ctime_r_proto" in
10496         define)
10497         case "$ctime_r_proto" in
10498         ''|0) try='char* ctime_r(const time_t*, char*);'
10499         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10500         esac
10501         case "$ctime_r_proto" in
10502         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10503         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10504         esac
10505         case "$ctime_r_proto" in
10506         ''|0) try='int ctime_r(const time_t*, char*);'
10507         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10508         esac
10509         case "$ctime_r_proto" in
10510         ''|0) try='int ctime_r(const time_t*, char*, int);'
10511         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10512         esac
10513         case "$ctime_r_proto" in
10514         ''|0)   d_ctime_r=undef
10515                 ctime_r_proto=0
10516                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10517         * )     case "$ctime_r_proto" in
10518                 REENTRANT_PROTO*) ;;
10519                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10520                 esac
10521                 echo "Prototype: $try" ;;
10522         esac
10523         ;;
10524         *)      case "$usethreads" in
10525                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10526                 esac
10527                 d_ctime_r=undef
10528                 ctime_r_proto=0
10529                 ;;
10530         esac
10531         ;;
10532 *)      ctime_r_proto=0
10533         ;;
10534 esac
10535
10536 : see if cuserid exists
10537 set cuserid d_cuserid
10538 eval $inlibc
10539
10540 : see if this is a limits.h system
10541 set limits.h i_limits
10542 eval $inhdr
10543
10544 : see if this is a float.h system
10545 set float.h i_float
10546 eval $inhdr
10547
10548 : See if number of significant digits in a double precision number is known
10549 echo " "
10550 $cat >dbl_dig.c <<EOM
10551 #$i_limits I_LIMITS
10552 #$i_float I_FLOAT
10553 #ifdef I_LIMITS
10554 #include <limits.h>
10555 #endif
10556 #ifdef I_FLOAT
10557 #include <float.h>
10558 #endif
10559 #ifdef DBL_DIG
10560 printf("Contains DBL_DIG");
10561 #endif
10562 EOM
10563 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10564 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10565         echo "DBL_DIG found." >&4
10566         val="$define"
10567 else
10568         echo "DBL_DIG NOT found." >&4
10569         val="$undef"
10570 fi
10571 $rm -f dbl_dig.?
10572 set d_dbl_dig
10573 eval $setvar
10574
10575 : see if dbm.h is available
10576 : see if dbmclose exists
10577 set dbmclose d_dbmclose
10578 eval $inlibc
10579
10580 case "$d_dbmclose" in
10581 $define)
10582         set dbm.h i_dbm
10583         eval $inhdr
10584         case "$i_dbm" in
10585         $define)
10586                 val="$undef"
10587                 set i_rpcsvcdbm
10588                 eval $setvar
10589                 ;;
10590         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10591                 eval $inhdr
10592                 ;;
10593         esac
10594         ;;
10595 *)      echo "We won't be including <dbm.h>"
10596         val="$undef"
10597         set i_dbm
10598         eval $setvar
10599         val="$undef"
10600         set i_rpcsvcdbm
10601         eval $setvar
10602         ;;
10603 esac
10604
10605 : see if prototype for dbminit is available
10606 echo " "
10607 set d_dbminitproto dbminit $i_dbm dbm.h
10608 eval $hasproto
10609
10610 : see if difftime exists
10611 set difftime d_difftime
10612 eval $inlibc
10613
10614 : see if this is a dirent system
10615 echo " "
10616 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10617         val="$define"
10618         echo "<dirent.h> found." >&4
10619 else
10620         val="$undef"
10621         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10622                 echo "<sys/dir.h> found." >&4
10623                 echo " "
10624         else
10625                 xinc=`./findhdr sys/ndir.h`
10626         fi
10627         echo "<dirent.h> NOT found." >&4
10628 fi
10629 set i_dirent
10630 eval $setvar
10631
10632 : Look for type of directory structure.
10633 echo " "
10634 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10635
10636 case "$direntrytype" in
10637 ''|' ')
10638         case "$i_dirent" in
10639         $define) guess1='struct dirent' ;;
10640         *) guess1='struct direct'  ;;
10641         esac
10642         ;;
10643 *)      guess1="$direntrytype"
10644         ;;
10645 esac
10646
10647 case "$guess1" in
10648 'struct dirent') guess2='struct direct' ;;
10649 *) guess2='struct dirent' ;;
10650 esac
10651                 
10652 if $contains "$guess1" try.c >/dev/null 2>&1; then
10653         direntrytype="$guess1"
10654         echo "Your directory entries are $direntrytype." >&4
10655 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10656         direntrytype="$guess2"
10657         echo "Your directory entries seem to be $direntrytype." >&4
10658 else
10659         echo "I don't recognize your system's directory entries." >&4
10660         rp="What type is used for directory entries on this system?"
10661         dflt="$guess1"
10662         . ./myread
10663         direntrytype="$ans"
10664 fi
10665 $rm -f try.c
10666
10667
10668 : see if the directory entry stores field length
10669 echo " "
10670 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10671 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10672         echo "Good, your directory entry keeps length information in d_namlen." >&4
10673         val="$define"
10674 else
10675         echo "Your directory entry does not know about the d_namlen field." >&4
10676         val="$undef"
10677 fi
10678 set d_dirnamlen
10679 eval $setvar
10680 $rm -f try.c
10681
10682 : see if this is an sysdir system
10683 set sys/dir.h i_sysdir
10684 eval $inhdr
10685
10686 : see if this is an sysndir system
10687 set sys/ndir.h i_sysndir
10688 eval $inhdr
10689
10690 : Look for dirfd
10691 echo " "
10692 $cat >dirfd.c <<EOM
10693 #include <stdio.h>
10694 #$i_stdlib I_STDLIB
10695 #ifdef I_STDLIB
10696 #include <stdlib.h>
10697 #endif
10698 #$i_dirent I_DIRENT             /**/
10699 #$i_sysdir I_SYS_DIR            /**/
10700 #$i_sysndir I_SYS_NDIR          /**/
10701 #$i_systypes I_SYS_TYPES        /**/
10702 #if defined(I_SYS_TYPES)
10703 #include <sys/types.h>
10704 #endif
10705 #if defined(I_DIRENT)
10706 #include <dirent.h>
10707 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10708 #include <sys/dir.h>
10709 #endif
10710 #else
10711 #ifdef I_SYS_NDIR
10712 #include <sys/ndir.h>
10713 #else
10714 #ifdef I_SYS_DIR
10715 #ifdef hp9000s500
10716 #include <ndir.h>       /* may be wrong in the future */
10717 #else
10718 #include <sys/dir.h>
10719 #endif
10720 #endif
10721 #endif
10722 #endif 
10723 int main() {
10724         DIR *dirp = opendir(".");
10725         if (dirfd(dirp) >= 0)
10726                 exit(0);
10727         else
10728                 exit(1);
10729 }
10730 EOM
10731 set dirfd
10732 if eval $compile; then
10733         val="$define"
10734 fi
10735 case "$val" in
10736 $define)        echo "dirfd() found." >&4       ;;
10737 *)              echo "dirfd() NOT found." >&4   ;;
10738 esac
10739 set d_dirfd
10740 eval $setvar
10741 $rm -f dirfd*
10742
10743 : see if dlerror exists
10744 xxx_runnm="$runnm"
10745 runnm=false
10746 set dlerror d_dlerror
10747 eval $inlibc
10748 runnm="$xxx_runnm"
10749
10750 : see if dlfcn is available
10751 set dlfcn.h i_dlfcn
10752 eval $inhdr
10753
10754 case "$usedl" in
10755 $define|y|true)
10756         $cat << EOM
10757
10758 On a few systems, the dynamically loaded modules that perl generates and uses
10759 will need a different extension than shared libs. The default will probably
10760 be appropriate.
10761
10762 EOM
10763         case "$dlext" in
10764         '')     dflt="$so" ;;
10765         *)      dflt="$dlext" ;;
10766         esac
10767         rp='What is the extension of dynamically loaded modules'
10768         . ./myread
10769         dlext="$ans"
10770         ;;
10771 *)
10772         dlext="none"
10773         ;;
10774 esac
10775
10776 : Check if dlsym need a leading underscore
10777 echo " "
10778 val="$undef"
10779
10780 case "$dlsrc" in
10781 dl_dlopen.xs)
10782         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10783         $cat >dyna.c <<'EOM'
10784 fred () { }
10785 EOM
10786
10787 $cat >fred.c<<EOM
10788
10789 #include <stdio.h>
10790 #$i_stdlib I_STDLIB
10791 #ifdef I_STDLIB
10792 #include <stdlib.h>
10793 #endif
10794 #$i_dlfcn I_DLFCN
10795 #ifdef I_DLFCN
10796 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10797 #else
10798 #include <sys/types.h>
10799 #include <nlist.h>
10800 #include <link.h>
10801 #endif
10802
10803 extern int fred() ;
10804
10805 int main()
10806 {
10807     void * handle ;
10808     void * symbol ;
10809 #ifndef RTLD_LAZY
10810     int mode = 1 ;
10811 #else
10812     int mode = RTLD_LAZY ;
10813 #endif
10814     handle = dlopen("./dyna.$dlext", mode) ;
10815     if (handle == NULL) {
10816         printf ("1\n") ;
10817         fflush (stdout) ;
10818         exit(0);
10819     }
10820     symbol = dlsym(handle, "fred") ;
10821     if (symbol == NULL) {
10822         /* try putting a leading underscore */
10823         symbol = dlsym(handle, "_fred") ;
10824         if (symbol == NULL) {
10825             printf ("2\n") ;
10826             fflush (stdout) ;
10827             exit(0);
10828         }
10829         printf ("3\n") ;
10830     }
10831     else
10832         printf ("4\n") ;
10833     fflush (stdout) ;
10834     exit(0);
10835 }
10836 EOM
10837         : Call the object file tmp-dyna.o in case dlext=o.
10838         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10839                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10840                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10841                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10842                 xxx=`$run ./fred`
10843                 case $xxx in
10844                 1)      echo "Test program failed using dlopen." >&4
10845                         echo "Perhaps you should not use dynamic loading." >&4;;
10846                 2)      echo "Test program failed using dlsym." >&4
10847                         echo "Perhaps you should not use dynamic loading." >&4;;
10848                 3)      echo "dlsym needs a leading underscore" >&4
10849                         val="$define" ;;
10850                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10851                 esac
10852         else
10853                 echo "I can't compile and run the test program." >&4
10854                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10855         fi
10856         ;;
10857 esac
10858                 
10859 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10860
10861 set d_dlsymun
10862 eval $setvar
10863
10864 : see if drand48_r exists
10865 set drand48_r d_drand48_r
10866 eval $inlibc
10867 case "$d_drand48_r" in
10868 "$define")
10869         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10870         case "$d_drand48_r_proto:$usethreads" in
10871         ":define")      d_drand48_r_proto=define
10872                 set d_drand48_r_proto drand48_r $hdrs
10873                 eval $hasproto ;;
10874         *)      ;;
10875         esac
10876         case "$d_drand48_r_proto" in
10877         define)
10878         case "$drand48_r_proto" in
10879         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10880         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10881         esac
10882         case "$drand48_r_proto" in
10883         ''|0)   d_drand48_r=undef
10884                 drand48_r_proto=0
10885                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10886         * )     case "$drand48_r_proto" in
10887                 REENTRANT_PROTO*) ;;
10888                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10889                 esac
10890                 echo "Prototype: $try" ;;
10891         esac
10892         ;;
10893         *)      case "$usethreads" in
10894                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10895                 esac
10896                 d_drand48_r=undef
10897                 drand48_r_proto=0
10898                 ;;
10899         esac
10900         ;;
10901 *)      drand48_r_proto=0
10902         ;;
10903 esac
10904
10905 : see if prototype for drand48 is available
10906 echo " "
10907 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10908 eval $hasproto
10909
10910 : see if dup2 exists
10911 set dup2 d_dup2
10912 eval $inlibc
10913
10914 : see if eaccess exists
10915 set eaccess d_eaccess
10916 eval $inlibc
10917
10918 : see if endgrent exists
10919 set endgrent d_endgrent
10920 eval $inlibc
10921
10922 : see if this is an grp system
10923 set grp.h i_grp
10924 eval $inhdr
10925
10926 case "$i_grp" in
10927 $define)
10928         xxx=`./findhdr grp.h`
10929         $cppstdin $cppflags $cppminus < $xxx >$$.h
10930
10931         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10932                 val="$define"
10933         else
10934                 val="$undef"
10935         fi
10936         set d_grpasswd
10937         eval $setvar
10938
10939         $rm -f $$.h
10940         ;;
10941 *)
10942         val="$undef";
10943         set d_grpasswd; eval $setvar
10944         ;;
10945 esac
10946
10947 : see if endgrent_r exists
10948 set endgrent_r d_endgrent_r
10949 eval $inlibc
10950 case "$d_endgrent_r" in
10951 "$define")
10952         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10953         case "$d_endgrent_r_proto:$usethreads" in
10954         ":define")      d_endgrent_r_proto=define
10955                 set d_endgrent_r_proto endgrent_r $hdrs
10956                 eval $hasproto ;;
10957         *)      ;;
10958         esac
10959         case "$d_endgrent_r_proto" in
10960         define)
10961         case "$endgrent_r_proto" in
10962         ''|0) try='int endgrent_r(FILE**);'
10963         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10964         esac
10965         case "$endgrent_r_proto" in
10966         ''|0) try='void endgrent_r(FILE**);'
10967         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10968         esac
10969         case "$endgrent_r_proto" in
10970         ''|0)   d_endgrent_r=undef
10971                 endgrent_r_proto=0
10972                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10973         * )     case "$endgrent_r_proto" in
10974                 REENTRANT_PROTO*) ;;
10975                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10976                 esac
10977                 echo "Prototype: $try" ;;
10978         esac
10979         ;;
10980         *)      case "$usethreads" in
10981                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10982                 esac
10983                 d_endgrent_r=undef
10984                 endgrent_r_proto=0
10985                 ;;
10986         esac
10987         ;;
10988 *)      endgrent_r_proto=0
10989         ;;
10990 esac
10991
10992 : see if endhostent exists
10993 set endhostent d_endhent
10994 eval $inlibc
10995
10996 : see if this is a netdb.h system
10997 set netdb.h i_netdb
10998 eval $inhdr
10999
11000 : see if endhostent_r exists
11001 set endhostent_r d_endhostent_r
11002 eval $inlibc
11003 case "$d_endhostent_r" in
11004 "$define")
11005         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11006         case "$d_endhostent_r_proto:$usethreads" in
11007         ":define")      d_endhostent_r_proto=define
11008                 set d_endhostent_r_proto endhostent_r $hdrs
11009                 eval $hasproto ;;
11010         *)      ;;
11011         esac
11012         case "$d_endhostent_r_proto" in
11013         define)
11014         case "$endhostent_r_proto" in
11015         ''|0) try='int endhostent_r(struct hostent_data*);'
11016         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11017         esac
11018         case "$endhostent_r_proto" in
11019         ''|0) try='void endhostent_r(struct hostent_data*);'
11020         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11021         esac
11022         case "$endhostent_r_proto" in
11023         ''|0)   d_endhostent_r=undef
11024                 endhostent_r_proto=0
11025                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11026         * )     case "$endhostent_r_proto" in
11027                 REENTRANT_PROTO*) ;;
11028                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11029                 esac
11030                 echo "Prototype: $try" ;;
11031         esac
11032         ;;
11033         *)      case "$usethreads" in
11034                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11035                 esac
11036                 d_endhostent_r=undef
11037                 endhostent_r_proto=0
11038                 ;;
11039         esac
11040         ;;
11041 *)      endhostent_r_proto=0
11042         ;;
11043 esac
11044
11045 : see if endnetent exists
11046 set endnetent d_endnent
11047 eval $inlibc
11048
11049 : see if endnetent_r exists
11050 set endnetent_r d_endnetent_r
11051 eval $inlibc
11052 case "$d_endnetent_r" in
11053 "$define")
11054         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11055         case "$d_endnetent_r_proto:$usethreads" in
11056         ":define")      d_endnetent_r_proto=define
11057                 set d_endnetent_r_proto endnetent_r $hdrs
11058                 eval $hasproto ;;
11059         *)      ;;
11060         esac
11061         case "$d_endnetent_r_proto" in
11062         define)
11063         case "$endnetent_r_proto" in
11064         ''|0) try='int endnetent_r(struct netent_data*);'
11065         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11066         esac
11067         case "$endnetent_r_proto" in
11068         ''|0) try='void endnetent_r(struct netent_data*);'
11069         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11070         esac
11071         case "$endnetent_r_proto" in
11072         ''|0)   d_endnetent_r=undef
11073                 endnetent_r_proto=0
11074                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11075         * )     case "$endnetent_r_proto" in
11076                 REENTRANT_PROTO*) ;;
11077                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11078                 esac
11079                 echo "Prototype: $try" ;;
11080         esac
11081         ;;
11082         *)      case "$usethreads" in
11083                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11084                 esac
11085                 d_endnetent_r=undef
11086                 endnetent_r_proto=0
11087                 ;;
11088         esac
11089         ;;
11090 *)      endnetent_r_proto=0
11091         ;;
11092 esac
11093
11094 : see if endprotoent exists
11095 set endprotoent d_endpent
11096 eval $inlibc
11097
11098 : see if endprotoent_r exists
11099 set endprotoent_r d_endprotoent_r
11100 eval $inlibc
11101 case "$d_endprotoent_r" in
11102 "$define")
11103         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11104         case "$d_endprotoent_r_proto:$usethreads" in
11105         ":define")      d_endprotoent_r_proto=define
11106                 set d_endprotoent_r_proto endprotoent_r $hdrs
11107                 eval $hasproto ;;
11108         *)      ;;
11109         esac
11110         case "$d_endprotoent_r_proto" in
11111         define)
11112         case "$endprotoent_r_proto" in
11113         ''|0) try='int endprotoent_r(struct protoent_data*);'
11114         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11115         esac
11116         case "$endprotoent_r_proto" in
11117         ''|0) try='void endprotoent_r(struct protoent_data*);'
11118         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11119         esac
11120         case "$endprotoent_r_proto" in
11121         ''|0)   d_endprotoent_r=undef
11122                 endprotoent_r_proto=0
11123                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11124         * )     case "$endprotoent_r_proto" in
11125                 REENTRANT_PROTO*) ;;
11126                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11127                 esac
11128                 echo "Prototype: $try" ;;
11129         esac
11130         ;;
11131         *)      case "$usethreads" in
11132                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11133                 esac
11134                 d_endprotoent_r=undef
11135                 endprotoent_r_proto=0
11136                 ;;
11137         esac
11138         ;;
11139 *)      endprotoent_r_proto=0
11140         ;;
11141 esac
11142
11143 : see if endpwent exists
11144 set endpwent d_endpwent
11145 eval $inlibc
11146
11147 : see if this is a pwd.h system
11148 set pwd.h i_pwd
11149 eval $inhdr
11150
11151 case "$i_pwd" in
11152 $define)
11153         xxx=`./findhdr pwd.h`
11154         $cppstdin $cppflags $cppminus < $xxx >$$.h
11155
11156         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11157                 val="$define"
11158         else
11159                 val="$undef"
11160         fi
11161         set d_pwquota
11162         eval $setvar
11163
11164         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11165                 val="$define"
11166         else
11167                 val="$undef"
11168         fi
11169         set d_pwage
11170         eval $setvar
11171
11172         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11173                 val="$define"
11174         else
11175                 val="$undef"
11176         fi
11177         set d_pwchange
11178         eval $setvar
11179
11180         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11181                 val="$define"
11182         else
11183                 val="$undef"
11184         fi
11185         set d_pwclass
11186         eval $setvar
11187
11188         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11189                 val="$define"
11190         else
11191                 val="$undef"
11192         fi
11193         set d_pwexpire
11194         eval $setvar
11195
11196         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11197                 val="$define"
11198         else
11199                 val="$undef"
11200         fi
11201         set d_pwcomment
11202         eval $setvar
11203
11204         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11205                 val="$define"
11206         else
11207                 val="$undef"
11208         fi
11209         set d_pwgecos
11210         eval $setvar
11211
11212         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11213                 val="$define"
11214         else
11215                 val="$undef"
11216         fi
11217         set d_pwpasswd
11218         eval $setvar
11219
11220         $rm -f $$.h
11221         ;;
11222 *)
11223         val="$undef"; 
11224         set d_pwquota; eval $setvar
11225         set d_pwage; eval $setvar
11226         set d_pwchange; eval $setvar
11227         set d_pwclass; eval $setvar
11228         set d_pwexpire; eval $setvar
11229         set d_pwcomment; eval $setvar
11230         set d_pwgecos; eval $setvar
11231         set d_pwpasswd; eval $setvar
11232         ;;
11233 esac
11234
11235 : see if endpwent_r exists
11236 set endpwent_r d_endpwent_r
11237 eval $inlibc
11238 case "$d_endpwent_r" in
11239 "$define")
11240         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11241         case "$d_endpwent_r_proto:$usethreads" in
11242         ":define")      d_endpwent_r_proto=define
11243                 set d_endpwent_r_proto endpwent_r $hdrs
11244                 eval $hasproto ;;
11245         *)      ;;
11246         esac
11247         case "$d_endpwent_r_proto" in
11248         define)
11249         case "$endpwent_r_proto" in
11250         ''|0) try='int endpwent_r(FILE**);'
11251         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11252         esac
11253         case "$endpwent_r_proto" in
11254         ''|0) try='void endpwent_r(FILE**);'
11255         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11256         esac
11257         case "$endpwent_r_proto" in
11258         ''|0)   d_endpwent_r=undef
11259                 endpwent_r_proto=0
11260                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11261         * )     case "$endpwent_r_proto" in
11262                 REENTRANT_PROTO*) ;;
11263                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11264                 esac
11265                 echo "Prototype: $try" ;;
11266         esac
11267         ;;
11268         *)      case "$usethreads" in
11269                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11270                 esac
11271                 d_endpwent_r=undef
11272                 endpwent_r_proto=0
11273                 ;;
11274         esac
11275         ;;
11276 *)      endpwent_r_proto=0
11277         ;;
11278 esac
11279
11280 : see if endservent exists
11281 set endservent d_endsent
11282 eval $inlibc
11283
11284 : see if endservent_r exists
11285 set endservent_r d_endservent_r
11286 eval $inlibc
11287 case "$d_endservent_r" in
11288 "$define")
11289         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11290         case "$d_endservent_r_proto:$usethreads" in
11291         ":define")      d_endservent_r_proto=define
11292                 set d_endservent_r_proto endservent_r $hdrs
11293                 eval $hasproto ;;
11294         *)      ;;
11295         esac
11296         case "$d_endservent_r_proto" in
11297         define)
11298         case "$endservent_r_proto" in
11299         ''|0) try='int endservent_r(struct servent_data*);'
11300         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11301         esac
11302         case "$endservent_r_proto" in
11303         ''|0) try='void endservent_r(struct servent_data*);'
11304         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11305         esac
11306         case "$endservent_r_proto" in
11307         ''|0)   d_endservent_r=undef
11308                 endservent_r_proto=0
11309                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11310         * )     case "$endservent_r_proto" in
11311                 REENTRANT_PROTO*) ;;
11312                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11313                 esac
11314                 echo "Prototype: $try" ;;
11315         esac
11316         ;;
11317         *)      case "$usethreads" in
11318                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11319                 esac
11320                 d_endservent_r=undef
11321                 endservent_r_proto=0
11322                 ;;
11323         esac
11324         ;;
11325 *)      endservent_r_proto=0
11326         ;;
11327 esac
11328
11329 : Locate the flags for 'open()'
11330 echo " "
11331 $cat >try.c <<EOCP
11332 #include <sys/types.h>
11333 #ifdef I_FCNTL
11334 #include <fcntl.h>
11335 #endif
11336 #ifdef I_SYS_FILE
11337 #include <sys/file.h>
11338 #endif
11339 #$i_stdlib I_STDLIB
11340 #ifdef I_STDLIB
11341 #include <stdlib.h>
11342 #endif
11343 int main() {
11344         if(O_RDONLY);
11345 #ifdef O_TRUNC
11346         exit(0);
11347 #else
11348         exit(1);
11349 #endif
11350 }
11351 EOCP
11352 : check sys/file.h first to get FREAD on Sun
11353 if $test `./findhdr sys/file.h` && \
11354                 set try -DI_SYS_FILE && eval $compile; then
11355         h_sysfile=true;
11356         echo "<sys/file.h> defines the O_* constants..." >&4
11357         if $run ./try; then
11358                 echo "and you have the 3 argument form of open()." >&4
11359                 val="$define"
11360         else
11361                 echo "but not the 3 argument form of open().  Oh, well." >&4
11362                 val="$undef"
11363         fi
11364 elif $test `./findhdr fcntl.h` && \
11365                 set try -DI_FCNTL && eval $compile; then
11366         h_fcntl=true;
11367         echo "<fcntl.h> defines the O_* constants..." >&4
11368         if $run ./try; then
11369                 echo "and you have the 3 argument form of open()." >&4
11370                 val="$define"
11371         else
11372                 echo "but not the 3 argument form of open().  Oh, well." >&4
11373                 val="$undef"
11374         fi
11375 else
11376         val="$undef"
11377         echo "I can't find the O_* constant definitions!  You got problems." >&4
11378 fi
11379 set d_open3
11380 eval $setvar
11381 $rm -f try try.*
11382
11383 : see which of string.h or strings.h is needed
11384 echo " "
11385 strings=`./findhdr string.h`
11386 if $test "$strings" && $test -r "$strings"; then
11387         echo "Using <string.h> instead of <strings.h>." >&4
11388         val="$define"
11389 else
11390         val="$undef"
11391         strings=`./findhdr strings.h`
11392         if $test "$strings" && $test -r "$strings"; then
11393                 echo "Using <strings.h> instead of <string.h>." >&4
11394         else
11395                 echo "No string header found -- You'll surely have problems." >&4
11396         fi
11397 fi
11398 set i_string
11399 eval $setvar
11400 case "$i_string" in
11401 "$undef") strings=`./findhdr strings.h`;;
11402 *)        strings=`./findhdr string.h`;;
11403 esac
11404
11405 : see if this is a sys/file.h system
11406 val=''
11407 set sys/file.h val
11408 eval $inhdr
11409
11410 : do we need to include sys/file.h ?
11411 case "$val" in
11412 "$define")
11413         echo " "
11414         if $h_sysfile; then
11415                 val="$define"
11416                 echo "We'll be including <sys/file.h>." >&4
11417         else
11418                 val="$undef"
11419                 echo "We won't be including <sys/file.h>." >&4
11420         fi
11421         ;;
11422 *)
11423         h_sysfile=false
11424         ;;
11425 esac
11426 set i_sysfile
11427 eval $setvar
11428
11429 : see if fcntl.h is there
11430 val=''
11431 set fcntl.h val
11432 eval $inhdr
11433
11434 : see if we can include fcntl.h
11435 case "$val" in
11436 "$define")
11437         echo " "
11438         if $h_fcntl; then
11439                 val="$define"
11440                 echo "We'll be including <fcntl.h>." >&4
11441         else
11442                 val="$undef"
11443                 if $h_sysfile; then
11444         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11445                 else
11446                         echo "We won't be including <fcntl.h>." >&4
11447                 fi
11448         fi
11449         ;;
11450 *)
11451         h_fcntl=false
11452         val="$undef"
11453         ;;
11454 esac
11455 set i_fcntl
11456 eval $setvar
11457
11458 : check for non-blocking I/O stuff
11459 case "$h_sysfile" in
11460 true) echo "#include <sys/file.h>" > head.c;;
11461 *)
11462        case "$h_fcntl" in
11463        true) echo "#include <fcntl.h>" > head.c;;
11464        *) echo "#include <sys/fcntl.h>" > head.c;;
11465        esac
11466        ;;
11467 esac
11468 echo " "
11469 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11470 case "$o_nonblock" in
11471 '')
11472         $cat head.c > try.c
11473         $cat >>try.c <<EOCP
11474 #include <stdio.h>
11475 #$i_stdlib I_STDLIB
11476 #ifdef I_STDLIB
11477 #include <stdlib.h>
11478 #endif
11479 #$i_fcntl I_FCNTL
11480 #ifdef I_FCNTL
11481 #include <fcntl.h>
11482 #endif
11483 int main() {
11484 #ifdef O_NONBLOCK
11485         printf("O_NONBLOCK\n");
11486         exit(0);
11487 #endif
11488 #ifdef O_NDELAY
11489         printf("O_NDELAY\n");
11490         exit(0);
11491 #endif
11492 #ifdef FNDELAY
11493         printf("FNDELAY\n");
11494         exit(0);
11495 #endif
11496         exit(0);
11497 }
11498 EOCP
11499         set try
11500         if eval $compile_ok; then
11501                 o_nonblock=`$run ./try`
11502                 case "$o_nonblock" in
11503                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11504                 *) echo "Seems like we can use $o_nonblock.";;
11505                 esac
11506         else
11507                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11508         fi
11509         ;;
11510 *) echo "Using $hint value $o_nonblock.";;
11511 esac
11512 $rm -f try try.* .out core
11513
11514 echo " "
11515 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11516 case "$eagain" in
11517 '')
11518         $cat head.c > try.c
11519         $cat >>try.c <<EOCP
11520 #include <errno.h>
11521 #include <sys/types.h>
11522 #include <signal.h>
11523 #include <stdio.h> 
11524 #$i_stdlib I_STDLIB
11525 #ifdef I_STDLIB
11526 #include <stdlib.h>
11527 #endif
11528 #$i_fcntl I_FCNTL
11529 #ifdef I_FCNTL
11530 #include <fcntl.h>
11531 #endif
11532 #define MY_O_NONBLOCK $o_nonblock
11533 #ifndef errno  /* XXX need better Configure test */
11534 extern int errno;
11535 #endif
11536 #$i_unistd I_UNISTD
11537 #ifdef I_UNISTD
11538 #include <unistd.h>
11539 #endif
11540 #$i_string I_STRING
11541 #ifdef I_STRING
11542 #include <string.h>
11543 #else
11544 #include <strings.h>
11545 #endif
11546 $signal_t blech(x) int x; { exit(3); }
11547 EOCP
11548         $cat >> try.c <<'EOCP'
11549 int main()
11550 {
11551         int pd[2];
11552         int pu[2];
11553         char buf[1];
11554         char string[100];
11555
11556         pipe(pd);       /* Down: child -> parent */
11557         pipe(pu);       /* Up: parent -> child */
11558         if (0 != fork()) {
11559                 int ret;
11560                 close(pd[1]);   /* Parent reads from pd[0] */
11561                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11562 #ifdef F_SETFL
11563                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11564                         exit(1);
11565 #else
11566                 exit(4);
11567 #endif
11568                 signal(SIGALRM, blech);
11569                 alarm(5);
11570                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11571                         exit(2);
11572                 sprintf(string, "%d\n", ret);
11573                 write(2, string, strlen(string));
11574                 alarm(0);
11575 #ifdef EAGAIN
11576                 if (errno == EAGAIN) {
11577                         printf("EAGAIN\n");
11578                         goto ok;
11579                 }
11580 #endif
11581 #ifdef EWOULDBLOCK
11582                 if (errno == EWOULDBLOCK)
11583                         printf("EWOULDBLOCK\n");
11584 #endif
11585         ok:
11586                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11587                 sleep(2);                               /* Give it time to close our pipe */
11588                 alarm(5);
11589                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11590                 alarm(0);
11591                 sprintf(string, "%d\n", ret);
11592                 write(4, string, strlen(string));
11593                 exit(0);
11594         }
11595
11596         close(pd[0]);                   /* We write to pd[1] */
11597         close(pu[1]);                   /* We read from pu[0] */
11598         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11599         close(pd[1]);                   /* Pipe pd is now fully closed! */
11600         exit(0);                                /* Bye bye, thank you for playing! */
11601 }
11602 EOCP
11603         set try
11604         if eval $compile_ok; then
11605                 echo "$startsh" >mtry
11606                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11607                 chmod +x mtry
11608                 ./mtry >/dev/null 2>&1
11609                 case $? in
11610                 0) eagain=`$cat try.out`;;
11611                 1) echo "Could not perform non-blocking setting!";;
11612                 2) echo "I did a successful read() for something that was not there!";;
11613                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11614                 4) echo "Could not find F_SETFL!";;
11615                 *) echo "Something terribly wrong happened during testing.";;
11616                 esac
11617                 rd_nodata=`$cat try.ret`
11618                 echo "A read() system call with no data present returns $rd_nodata."
11619                 case "$rd_nodata" in
11620                 0|-1) ;;
11621                 *)
11622                         echo "(That's peculiar, fixing that to be -1.)"
11623                         rd_nodata=-1
11624                         ;;
11625                 esac
11626                 case "$eagain" in
11627                 '')
11628                         echo "Forcing errno EAGAIN on read() with no data available."
11629                         eagain=EAGAIN
11630                         ;;
11631                 *)
11632                         echo "Your read() sets errno to $eagain when no data is available."
11633                         ;;
11634                 esac
11635                 status=`$cat try.err`
11636                 case "$status" in
11637                 0) echo "And it correctly returns 0 to signal EOF.";;
11638                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11639                 *) echo "However, your read() returns '$status' on EOF??";;
11640                 esac
11641                 val="$define"
11642                 if test "$status" = "$rd_nodata"; then
11643                         echo "WARNING: you can't distinguish between EOF and no data!"
11644                         val="$undef"
11645                 fi
11646         else
11647                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11648                 eagain=EAGAIN
11649         fi
11650         set d_eofnblk
11651         eval $setvar
11652         ;;
11653 *)
11654         echo "Using $hint value $eagain."
11655         echo "Your read() returns $rd_nodata when no data is present."
11656         case "$d_eofnblk" in
11657         "$define") echo "And you can see EOF because read() returns 0.";;
11658         "$undef") echo "But you can't see EOF status from read() returned value.";;
11659         *)
11660                 echo "(Assuming you can't see EOF status from read anyway.)"
11661                 d_eofnblk=$undef
11662                 ;;
11663         esac
11664         ;;
11665 esac
11666 $rm -f try try.* .out core head.c mtry
11667
11668 : see if fchdir exists
11669 set fchdir d_fchdir
11670 eval $inlibc
11671
11672 : see if fchmod exists
11673 set fchmod d_fchmod
11674 eval $inlibc
11675
11676 : see if fchown exists
11677 set fchown d_fchown
11678 eval $inlibc
11679
11680 : see if this is an fcntl system
11681 set fcntl d_fcntl
11682 eval $inlibc
11683
11684 echo " "
11685 : See if fcntl-based locking works.
11686 $cat >try.c <<EOCP
11687 #$i_stdlib I_STDLIB
11688 #ifdef I_STDLIB
11689 #include <stdlib.h>
11690 #endif
11691 #include <unistd.h>
11692 #include <fcntl.h>
11693 #include <signal.h>
11694 $signal_t blech(x) int x; { exit(3); }
11695 int main() {
11696 #if defined(F_SETLK) && defined(F_SETLKW)
11697      struct flock flock;
11698      int retval, fd;
11699      fd = open("try.c", O_RDONLY);
11700      flock.l_type = F_RDLCK;
11701      flock.l_whence = SEEK_SET;
11702      flock.l_start = flock.l_len = 0;
11703      signal(SIGALRM, blech);
11704      alarm(10);
11705      retval = fcntl(fd, F_SETLK, &flock);
11706      close(fd);
11707      (retval < 0 ? exit(2) : exit(0));
11708 #else
11709      exit(2);
11710 #endif
11711 }
11712 EOCP
11713 echo "Checking if fcntl-based file locking works... "
11714 case "$d_fcntl" in
11715 "$define")
11716         set try
11717         if eval $compile_ok; then
11718                 if $run ./try; then
11719                         echo "Yes, it seems to work."
11720                         val="$define"
11721                 else
11722                         echo "Nope, it didn't work."
11723                         val="$undef"
11724                         case "$?" in
11725                         3) $cat >&4 <<EOM
11726 ***
11727 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11728 *** This is (almost) impossible.
11729 *** If your NFS lock daemons are not feeling well, something like
11730 *** this may happen, please investigate.  Cannot continue, aborting.
11731 ***
11732 EOM
11733                                 exit 1
11734                                 ;;
11735                         esac
11736                 fi
11737         else
11738                 echo "I'm unable to compile the test program, so I'll assume not."
11739                 val="$undef"
11740         fi
11741         ;;
11742 *) val="$undef";
11743         echo "Nope, since you don't even have fcntl()."
11744         ;;
11745 esac
11746 set d_fcntl_can_lock
11747 eval $setvar
11748 $rm -f try*
11749
11750
11751 : check for fd_set items
11752 $cat <<EOM
11753
11754 Checking to see how well your C compiler handles fd_set and friends ...
11755 EOM
11756 $cat >try.c <<EOCP
11757 #$i_stdlib I_STDLIB
11758 #ifdef I_STDLIB
11759 #include <stdlib.h>
11760 #endif
11761 #$i_systime I_SYS_TIME
11762 #$i_sysselct I_SYS_SELECT
11763 #$d_socket HAS_SOCKET
11764 #include <sys/types.h>
11765 #ifdef HAS_SOCKET
11766 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11767 #endif
11768 #ifdef I_SYS_TIME
11769 #include <sys/time.h>
11770 #endif
11771 #ifdef I_SYS_SELECT
11772 #include <sys/select.h>
11773 #endif
11774 int main() {
11775         fd_set fds;
11776
11777 #ifdef TRYBITS
11778         if(fds.fds_bits);
11779 #endif
11780
11781 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11782         exit(0);
11783 #else
11784         exit(1);
11785 #endif
11786 }
11787 EOCP
11788 set try -DTRYBITS
11789 if eval $compile; then
11790         d_fds_bits="$define"
11791         d_fd_set="$define"
11792         echo "Well, your system knows about the normal fd_set typedef..." >&4
11793         if $run ./try; then
11794                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11795                 d_fd_macros="$define"
11796         else
11797                 $cat >&4 <<'EOM'
11798 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11799 EOM
11800                 d_fd_macros="$undef"
11801         fi
11802 else
11803         $cat <<'EOM'
11804 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11805 EOM
11806         set try
11807         if eval $compile; then
11808                 d_fds_bits="$undef"
11809                 d_fd_set="$define"
11810                 echo "Well, your system has some sort of fd_set available..." >&4
11811                 if $run ./try; then
11812                         echo "and you have the normal fd_set macros." >&4
11813                         d_fd_macros="$define"
11814                 else
11815                         $cat <<'EOM'
11816 but not the normal fd_set macros!  Gross!  More work for me...
11817 EOM
11818                         d_fd_macros="$undef"
11819                 fi
11820         else
11821         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11822                 d_fd_set="$undef"
11823                 d_fds_bits="$undef"
11824                 d_fd_macros="$undef"
11825         fi
11826 fi
11827 $rm -f try try.*
11828
11829 : see if fgetpos exists
11830 set fgetpos d_fgetpos
11831 eval $inlibc
11832
11833 : see if finite exists
11834 set finite d_finite
11835 eval $inlibc
11836
11837 : see if finitel exists
11838 set finitel d_finitel
11839 eval $inlibc
11840
11841 : see if flock exists
11842 set flock d_flock
11843 eval $inlibc
11844
11845 : see if prototype for flock is available
11846 echo " "
11847 set d_flockproto flock $i_sysfile sys/file.h
11848 eval $hasproto
11849
11850 : see if fork exists
11851 set fork d_fork
11852 eval $inlibc
11853
11854 : see if fp_class exists
11855 set fp_class d_fp_class
11856 eval $inlibc
11857
11858 : see if pathconf exists
11859 set pathconf d_pathconf
11860 eval $inlibc
11861
11862 : see if fpathconf exists
11863 set fpathconf d_fpathconf
11864 eval $inlibc
11865
11866 : see if fpclass exists
11867 set fpclass d_fpclass
11868 eval $inlibc
11869
11870 : see if fpclassify exists
11871 set fpclassify d_fpclassify
11872 eval $inlibc
11873
11874 : see if fpclassl exists
11875 set fpclassl d_fpclassl
11876 eval $inlibc
11877
11878
11879 : check for fpos64_t
11880 echo " "
11881 echo "Checking to see if you have fpos64_t..." >&4
11882 $cat >try.c <<EOCP
11883 #include <stdio.h>
11884 int main() { fpos64_t x = 7; }
11885 EOCP
11886 set try
11887 if eval $compile; then
11888         val="$define"
11889         echo "You have fpos64_t."
11890 else
11891         val="$undef"
11892         echo "You do not have fpos64_t."
11893         case "$fpossize" in
11894         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11895         esac
11896 fi
11897 $rm -f try.* try
11898 set d_fpos64_t
11899 eval $setvar
11900
11901 : see if frexpl exists
11902 set frexpl d_frexpl
11903 eval $inlibc
11904
11905 : see if this is a sys/param system
11906 set sys/param.h i_sysparam
11907 eval $inhdr
11908
11909 : see if this is a sys/mount.h system
11910 set sys/mount.h i_sysmount
11911 eval $inhdr
11912
11913
11914 echo " "
11915 echo "Checking to see if your system supports struct fs_data..." >&4
11916 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11917 eval $hasstruct
11918 case "$d_fs_data_s" in
11919 "$define")      echo "Yes, it does."   ;;
11920 *)              echo "No, it doesn't." ;;
11921 esac
11922
11923 : see if fseeko exists
11924 set fseeko d_fseeko
11925 eval $inlibc
11926 case "$longsize" in
11927 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11928 esac
11929
11930 : see if fsetpos exists
11931 set fsetpos d_fsetpos
11932 eval $inlibc
11933
11934
11935 : see if fstatfs exists
11936 set fstatfs d_fstatfs
11937 eval $inlibc
11938
11939
11940 : see if statvfs exists
11941 set statvfs d_statvfs
11942 eval $inlibc
11943
11944 : see if fstatvfs exists
11945 set fstatvfs d_fstatvfs
11946 eval $inlibc
11947
11948
11949 : see if fsync exists
11950 set fsync d_fsync
11951 eval $inlibc
11952
11953 : see if ftello exists
11954 set ftello d_ftello
11955 eval $inlibc
11956 case "$longsize" in
11957 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11958 esac
11959
11960 : see if getcwd exists
11961 set getcwd d_getcwd
11962 eval $inlibc
11963
11964 : see if getespwnam exists
11965 set getespwnam d_getespwnam
11966 eval $inlibc
11967
11968
11969 : see if getfsstat exists
11970 set getfsstat d_getfsstat
11971 eval $inlibc
11972
11973 : see if getgrent exists
11974 set getgrent d_getgrent
11975 eval $inlibc
11976
11977 : see if getgrent_r exists
11978 set getgrent_r d_getgrent_r
11979 eval $inlibc
11980 case "$d_getgrent_r" in
11981 "$define")
11982         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11983         case "$d_getgrent_r_proto:$usethreads" in
11984         ":define")      d_getgrent_r_proto=define
11985                 set d_getgrent_r_proto getgrent_r $hdrs
11986                 eval $hasproto ;;
11987         *)      ;;
11988         esac
11989         case "$d_getgrent_r_proto" in
11990         define)
11991         case "$getgrent_r_proto" in
11992         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11993         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11994         esac
11995         case "$getgrent_r_proto" in
11996         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11997         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11998         esac
11999         case "$getgrent_r_proto" in
12000         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12001         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12002         esac
12003         case "$getgrent_r_proto" in
12004         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12005         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12006         esac
12007         case "$getgrent_r_proto" in
12008         ''|0) try='int getgrent_r(struct group*, char*, int);'
12009         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12010         esac
12011         case "$getgrent_r_proto" in
12012         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12013         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12014         esac
12015         case "$getgrent_r_proto" in
12016         ''|0)   d_getgrent_r=undef
12017                 getgrent_r_proto=0
12018                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12019         * )     case "$getgrent_r_proto" in
12020                 REENTRANT_PROTO*) ;;
12021                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12022                 esac
12023                 echo "Prototype: $try" ;;
12024         esac
12025         ;;
12026         *)      case "$usethreads" in
12027                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12028                 esac
12029                 d_getgrent_r=undef
12030                 getgrent_r_proto=0
12031                 ;;
12032         esac
12033         ;;
12034 *)      getgrent_r_proto=0
12035         ;;
12036 esac
12037
12038 : see if getgrgid_r exists
12039 set getgrgid_r d_getgrgid_r
12040 eval $inlibc
12041 case "$d_getgrgid_r" in
12042 "$define")
12043         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12044         case "$d_getgrgid_r_proto:$usethreads" in
12045         ":define")      d_getgrgid_r_proto=define
12046                 set d_getgrgid_r_proto getgrgid_r $hdrs
12047                 eval $hasproto ;;
12048         *)      ;;
12049         esac
12050         case "$d_getgrgid_r_proto" in
12051         define)
12052         case "$getgrgid_r_proto" in
12053         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12054         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12055         esac
12056         case "$getgrgid_r_proto" in
12057         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12058         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12059         esac
12060         case "$getgrgid_r_proto" in
12061         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12062         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12063         esac
12064         case "$getgrgid_r_proto" in
12065         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12066         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12067         esac
12068         case "$getgrgid_r_proto" in
12069         ''|0)   d_getgrgid_r=undef
12070                 getgrgid_r_proto=0
12071                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12072         * )     case "$getgrgid_r_proto" in
12073                 REENTRANT_PROTO*) ;;
12074                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12075                 esac
12076                 echo "Prototype: $try" ;;
12077         esac
12078         ;;
12079         *)      case "$usethreads" in
12080                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12081                 esac
12082                 d_getgrgid_r=undef
12083                 getgrgid_r_proto=0
12084                 ;;
12085         esac
12086         ;;
12087 *)      getgrgid_r_proto=0
12088         ;;
12089 esac
12090
12091 : see if getgrnam_r exists
12092 set getgrnam_r d_getgrnam_r
12093 eval $inlibc
12094 case "$d_getgrnam_r" in
12095 "$define")
12096         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12097         case "$d_getgrnam_r_proto:$usethreads" in
12098         ":define")      d_getgrnam_r_proto=define
12099                 set d_getgrnam_r_proto getgrnam_r $hdrs
12100                 eval $hasproto ;;
12101         *)      ;;
12102         esac
12103         case "$d_getgrnam_r_proto" in
12104         define)
12105         case "$getgrnam_r_proto" in
12106         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12107         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12108         esac
12109         case "$getgrnam_r_proto" in
12110         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12111         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12112         esac
12113         case "$getgrnam_r_proto" in
12114         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12115         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12116         esac
12117         case "$getgrnam_r_proto" in
12118         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12119         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12120         esac
12121         case "$getgrnam_r_proto" in
12122         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12123         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12124         esac
12125         case "$getgrnam_r_proto" in
12126         ''|0)   d_getgrnam_r=undef
12127                 getgrnam_r_proto=0
12128                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12129         * )     case "$getgrnam_r_proto" in
12130                 REENTRANT_PROTO*) ;;
12131                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12132                 esac
12133                 echo "Prototype: $try" ;;
12134         esac
12135         ;;
12136         *)      case "$usethreads" in
12137                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12138                 esac
12139                 d_getgrnam_r=undef
12140                 getgrnam_r_proto=0
12141                 ;;
12142         esac
12143         ;;
12144 *)      getgrnam_r_proto=0
12145         ;;
12146 esac
12147
12148 : see if gethostbyaddr exists
12149 set gethostbyaddr d_gethbyaddr
12150 eval $inlibc
12151
12152 : see if gethostbyname exists
12153 set gethostbyname d_gethbyname
12154 eval $inlibc
12155
12156 : see if gethostent exists
12157 set gethostent d_gethent
12158 eval $inlibc
12159
12160 : see how we will look up host name
12161 echo " "
12162 call=''
12163 if set gethostname val -f d_gethname; eval $csym; $val; then
12164         echo 'gethostname() found.' >&4
12165         d_gethname="$define"
12166         call=gethostname
12167 fi
12168 if set uname val -f d_uname; eval $csym; $val; then
12169         if ./xenix; then
12170                 $cat <<'EOM'
12171 uname() was found, but you're running xenix, and older versions of xenix
12172 have a broken uname(). If you don't really know whether your xenix is old
12173 enough to have a broken system call, use the default answer.
12174
12175 EOM
12176                 dflt=y
12177                 case "$d_uname" in
12178                 "$define") dflt=n;;
12179                 esac
12180                 rp='Is your uname() broken?'
12181                 . ./myread
12182                 case "$ans" in
12183                 n*) d_uname="$define"; call=uname;;
12184                 esac
12185         else
12186                 echo 'uname() found.' >&4
12187                 d_uname="$define"
12188                 case "$call" in
12189                 '') call=uname ;;
12190                 esac
12191         fi
12192 fi
12193 case "$d_gethname" in
12194 '') d_gethname="$undef";;
12195 esac
12196 case "$d_uname" in
12197 '') d_uname="$undef";;
12198 esac
12199 case "$d_uname$d_gethname" in
12200 *define*)
12201         dflt=n
12202         cat <<EOM
12203  
12204 Every now and then someone has a $call() that lies about the hostname
12205 but can't be fixed for political or economic reasons.  If you wish, I can
12206 pretend $call() isn't there and maybe compute hostname at run-time
12207 thanks to the '$phostname' command.
12208
12209 EOM
12210         rp="Shall I ignore $call() from now on?"
12211         . ./myread
12212         case "$ans" in
12213         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12214         esac;;
12215 esac
12216 case "$phostname" in
12217 '') aphostname='';;
12218 *) case "$aphostname" in
12219         /*) ;;
12220         *) set X $phostname
12221                 shift
12222                 file=$1
12223                 shift
12224                 file=`./loc $file $file $pth`
12225                 aphostname=`echo $file $*`
12226                 ;;
12227         esac
12228         ;;
12229 esac
12230 case "$d_uname$d_gethname" in
12231 *define*) ;;
12232 *)
12233         case "$phostname" in
12234         '')
12235                 echo "There will be no way for $package to get your hostname." >&4;;
12236         *)
12237         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12238                 ;;
12239         esac;;
12240 esac
12241 case "$d_phostname" in
12242 '') d_phostname="$undef";;
12243 esac
12244
12245 : see if gethostbyaddr_r exists
12246 set gethostbyaddr_r d_gethostbyaddr_r
12247 eval $inlibc
12248 case "$d_gethostbyaddr_r" in
12249 "$define")
12250         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12251         case "$d_gethostbyaddr_r_proto:$usethreads" in
12252         ":define")      d_gethostbyaddr_r_proto=define
12253                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12254                 eval $hasproto ;;
12255         *)      ;;
12256         esac
12257         case "$d_gethostbyaddr_r_proto" in
12258         define)
12259         case "$gethostbyaddr_r_proto" in
12260         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12261         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12262         esac
12263         case "$gethostbyaddr_r_proto" in
12264         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12265         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12266         esac
12267         case "$gethostbyaddr_r_proto" in
12268         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12269         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12270         esac
12271         case "$gethostbyaddr_r_proto" in
12272         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12273         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12274         esac
12275         case "$gethostbyaddr_r_proto" in
12276         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12277         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12278         esac
12279         case "$gethostbyaddr_r_proto" in
12280         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12281         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12282         esac
12283         case "$gethostbyaddr_r_proto" in
12284         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12285         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12286         esac
12287         case "$gethostbyaddr_r_proto" in
12288         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12289         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12290         esac
12291         case "$gethostbyaddr_r_proto" in
12292         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12293         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12294         esac
12295         case "$gethostbyaddr_r_proto" in
12296         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12297         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12298         esac
12299         case "$gethostbyaddr_r_proto" in
12300         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12301         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12302         esac
12303         case "$gethostbyaddr_r_proto" in
12304         ''|0)   d_gethostbyaddr_r=undef
12305                 gethostbyaddr_r_proto=0
12306                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12307         * )     case "$gethostbyaddr_r_proto" in
12308                 REENTRANT_PROTO*) ;;
12309                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12310                 esac
12311                 echo "Prototype: $try" ;;
12312         esac
12313         ;;
12314         *)      case "$usethreads" in
12315                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12316                 esac
12317                 d_gethostbyaddr_r=undef
12318                 gethostbyaddr_r_proto=0
12319                 ;;
12320         esac
12321         ;;
12322 *)      gethostbyaddr_r_proto=0
12323         ;;
12324 esac
12325
12326 : see if gethostbyname_r exists
12327 set gethostbyname_r d_gethostbyname_r
12328 eval $inlibc
12329 case "$d_gethostbyname_r" in
12330 "$define")
12331         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12332         case "$d_gethostbyname_r_proto:$usethreads" in
12333         ":define")      d_gethostbyname_r_proto=define
12334                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12335                 eval $hasproto ;;
12336         *)      ;;
12337         esac
12338         case "$d_gethostbyname_r_proto" in
12339         define)
12340         case "$gethostbyname_r_proto" in
12341         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12342         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12343         esac
12344         case "$gethostbyname_r_proto" in
12345         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12346         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12347         esac
12348         case "$gethostbyname_r_proto" in
12349         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12350         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12351         esac
12352         case "$gethostbyname_r_proto" in
12353         ''|0)   d_gethostbyname_r=undef
12354                 gethostbyname_r_proto=0
12355                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12356         * )     case "$gethostbyname_r_proto" in
12357                 REENTRANT_PROTO*) ;;
12358                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12359                 esac
12360                 echo "Prototype: $try" ;;
12361         esac
12362         ;;
12363         *)      case "$usethreads" in
12364                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12365                 esac
12366                 d_gethostbyname_r=undef
12367                 gethostbyname_r_proto=0
12368                 ;;
12369         esac
12370         ;;
12371 *)      gethostbyname_r_proto=0
12372         ;;
12373 esac
12374
12375 : see if gethostent_r exists
12376 set gethostent_r d_gethostent_r
12377 eval $inlibc
12378 case "$d_gethostent_r" in
12379 "$define")
12380         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12381         case "$d_gethostent_r_proto:$usethreads" in
12382         ":define")      d_gethostent_r_proto=define
12383                 set d_gethostent_r_proto gethostent_r $hdrs
12384                 eval $hasproto ;;
12385         *)      ;;
12386         esac
12387         case "$d_gethostent_r_proto" in
12388         define)
12389         case "$gethostent_r_proto" in
12390         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12391         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12392         esac
12393         case "$gethostent_r_proto" in
12394         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12395         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12396         esac
12397         case "$gethostent_r_proto" in
12398         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12399         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12400         esac
12401         case "$gethostent_r_proto" in
12402         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12403         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12404         esac
12405         case "$gethostent_r_proto" in
12406         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12407         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12408         esac
12409         case "$gethostent_r_proto" in
12410         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12411         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12412         esac
12413         case "$gethostent_r_proto" in
12414         ''|0)   d_gethostent_r=undef
12415                 gethostent_r_proto=0
12416                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12417         * )     case "$gethostent_r_proto" in
12418                 REENTRANT_PROTO*) ;;
12419                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12420                 esac
12421                 echo "Prototype: $try" ;;
12422         esac
12423         ;;
12424         *)      case "$usethreads" in
12425                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12426                 esac
12427                 d_gethostent_r=undef
12428                 gethostent_r_proto=0
12429                 ;;
12430         esac
12431         ;;
12432 *)      gethostent_r_proto=0
12433         ;;
12434 esac
12435
12436 : see if prototypes for various gethostxxx netdb.h functions are available
12437 echo " "
12438 set d_gethostprotos gethostent $i_netdb netdb.h
12439 eval $hasproto
12440
12441 : see if getitimer exists
12442 set getitimer d_getitimer
12443 eval $inlibc
12444
12445 : see if getlogin exists
12446 set getlogin d_getlogin
12447 eval $inlibc
12448
12449 : see if getlogin_r exists
12450 set getlogin_r d_getlogin_r
12451 eval $inlibc
12452 case "$d_getlogin_r" in
12453 "$define")
12454         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12455         case "$d_getlogin_r_proto:$usethreads" in
12456         ":define")      d_getlogin_r_proto=define
12457                 set d_getlogin_r_proto getlogin_r $hdrs
12458                 eval $hasproto ;;
12459         *)      ;;
12460         esac
12461         case "$d_getlogin_r_proto" in
12462         define)
12463         case "$getlogin_r_proto" in
12464         ''|0) try='int getlogin_r(char*, size_t);'
12465         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12466         esac
12467         case "$getlogin_r_proto" in
12468         ''|0) try='int getlogin_r(char*, int);'
12469         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12470         esac
12471         case "$getlogin_r_proto" in
12472         ''|0) try='char* getlogin_r(char*, size_t);'
12473         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12474         esac
12475         case "$getlogin_r_proto" in
12476         ''|0) try='char* getlogin_r(char*, int);'
12477         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12478         esac
12479         case "$getlogin_r_proto" in
12480         ''|0)   d_getlogin_r=undef
12481                 getlogin_r_proto=0
12482                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12483         * )     case "$getlogin_r_proto" in
12484                 REENTRANT_PROTO*) ;;
12485                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12486                 esac
12487                 echo "Prototype: $try" ;;
12488         esac
12489         ;;
12490         *)      case "$usethreads" in
12491                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12492                 esac
12493                 d_getlogin_r=undef
12494                 getlogin_r_proto=0
12495                 ;;
12496         esac
12497         ;;
12498 *)      getlogin_r_proto=0
12499         ;;
12500 esac
12501
12502 : see if getmnt exists
12503 set getmnt d_getmnt
12504 eval $inlibc
12505
12506 : see if getmntent exists
12507 set getmntent d_getmntent
12508 eval $inlibc
12509
12510 : see if getnetbyaddr exists
12511 set getnetbyaddr d_getnbyaddr
12512 eval $inlibc
12513
12514 : see if getnetbyname exists
12515 set getnetbyname d_getnbyname
12516 eval $inlibc
12517
12518 : see if getnetent exists
12519 set getnetent d_getnent
12520 eval $inlibc
12521
12522 : see if getnetbyaddr_r exists
12523 set getnetbyaddr_r d_getnetbyaddr_r
12524 eval $inlibc
12525 case "$d_getnetbyaddr_r" in
12526 "$define")
12527         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12528         case "$d_getnetbyaddr_r_proto:$usethreads" in
12529         ":define")      d_getnetbyaddr_r_proto=define
12530                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12531                 eval $hasproto ;;
12532         *)      ;;
12533         esac
12534         case "$d_getnetbyaddr_r_proto" in
12535         define)
12536         case "$getnetbyaddr_r_proto" in
12537         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12538         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12539         esac
12540         case "$getnetbyaddr_r_proto" in
12541         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12542         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12543         esac
12544         case "$getnetbyaddr_r_proto" in
12545         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12546         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12547         esac
12548         case "$getnetbyaddr_r_proto" in
12549         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12550         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12551         esac
12552         case "$getnetbyaddr_r_proto" in
12553         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12554         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12555         esac
12556         case "$getnetbyaddr_r_proto" in
12557         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12558         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12559         esac
12560         case "$getnetbyaddr_r_proto" in
12561         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12562         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12563         esac
12564         case "$getnetbyaddr_r_proto" in
12565         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12566         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12567         esac
12568         case "$getnetbyaddr_r_proto" in
12569         ''|0)   d_getnetbyaddr_r=undef
12570                 getnetbyaddr_r_proto=0
12571                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12572         * )     case "$getnetbyaddr_r_proto" in
12573                 REENTRANT_PROTO*) ;;
12574                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12575                 esac
12576                 echo "Prototype: $try" ;;
12577         esac
12578         ;;
12579         *)      case "$usethreads" in
12580                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12581                 esac
12582                 d_getnetbyaddr_r=undef
12583                 getnetbyaddr_r_proto=0
12584                 ;;
12585         esac
12586         ;;
12587 *)      getnetbyaddr_r_proto=0
12588         ;;
12589 esac
12590
12591 : see if getnetbyname_r exists
12592 set getnetbyname_r d_getnetbyname_r
12593 eval $inlibc
12594 case "$d_getnetbyname_r" in
12595 "$define")
12596         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12597         case "$d_getnetbyname_r_proto:$usethreads" in
12598         ":define")      d_getnetbyname_r_proto=define
12599                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12600                 eval $hasproto ;;
12601         *)      ;;
12602         esac
12603         case "$d_getnetbyname_r_proto" in
12604         define)
12605         case "$getnetbyname_r_proto" in
12606         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12607         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12608         esac
12609         case "$getnetbyname_r_proto" in
12610         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12611         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12612         esac
12613         case "$getnetbyname_r_proto" in
12614         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12615         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12616         esac
12617         case "$getnetbyname_r_proto" in
12618         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12619         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12620         esac
12621         case "$getnetbyname_r_proto" in
12622         ''|0)   d_getnetbyname_r=undef
12623                 getnetbyname_r_proto=0
12624                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12625         * )     case "$getnetbyname_r_proto" in
12626                 REENTRANT_PROTO*) ;;
12627                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12628                 esac
12629                 echo "Prototype: $try" ;;
12630         esac
12631         ;;
12632         *)      case "$usethreads" in
12633                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12634                 esac
12635                 d_getnetbyname_r=undef
12636                 getnetbyname_r_proto=0
12637                 ;;
12638         esac
12639         ;;
12640 *)      getnetbyname_r_proto=0
12641         ;;
12642 esac
12643
12644 : see if getnetent_r exists
12645 set getnetent_r d_getnetent_r
12646 eval $inlibc
12647 case "$d_getnetent_r" in
12648 "$define")
12649         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12650         case "$d_getnetent_r_proto:$usethreads" in
12651         ":define")      d_getnetent_r_proto=define
12652                 set d_getnetent_r_proto getnetent_r $hdrs
12653                 eval $hasproto ;;
12654         *)      ;;
12655         esac
12656         case "$d_getnetent_r_proto" in
12657         define)
12658         case "$getnetent_r_proto" in
12659         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12660         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12661         esac
12662         case "$getnetent_r_proto" in
12663         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12664         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12665         esac
12666         case "$getnetent_r_proto" in
12667         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12668         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12669         esac
12670         case "$getnetent_r_proto" in
12671         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12672         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12673         esac
12674         case "$getnetent_r_proto" in
12675         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12676         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12677         esac
12678         case "$getnetent_r_proto" in
12679         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12680         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12681         esac
12682         case "$getnetent_r_proto" in
12683         ''|0)   d_getnetent_r=undef
12684                 getnetent_r_proto=0
12685                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12686         * )     case "$getnetent_r_proto" in
12687                 REENTRANT_PROTO*) ;;
12688                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12689                 esac
12690                 echo "Prototype: $try" ;;
12691         esac
12692         ;;
12693         *)      case "$usethreads" in
12694                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12695                 esac
12696                 d_getnetent_r=undef
12697                 getnetent_r_proto=0
12698                 ;;
12699         esac
12700         ;;
12701 *)      getnetent_r_proto=0
12702         ;;
12703 esac
12704
12705 : see if prototypes for various getnetxxx netdb.h functions are available
12706 echo " "
12707 set d_getnetprotos getnetent $i_netdb netdb.h
12708 eval $hasproto
12709
12710 : see if getpagesize exists
12711 set getpagesize d_getpagsz
12712 eval $inlibc
12713
12714
12715 : see if getprotobyname exists
12716 set getprotobyname d_getpbyname
12717 eval $inlibc
12718
12719 : see if getprotobynumber exists
12720 set getprotobynumber d_getpbynumber
12721 eval $inlibc
12722
12723 : see if getprotoent exists
12724 set getprotoent d_getpent
12725 eval $inlibc
12726
12727 : see if getpgid exists
12728 set getpgid d_getpgid
12729 eval $inlibc
12730
12731 : see if getpgrp2 exists
12732 set getpgrp2 d_getpgrp2
12733 eval $inlibc
12734
12735 : see if getppid exists
12736 set getppid d_getppid
12737 eval $inlibc
12738
12739 : see if getpriority exists
12740 set getpriority d_getprior
12741 eval $inlibc
12742
12743 : see if getprotobyname_r exists
12744 set getprotobyname_r d_getprotobyname_r
12745 eval $inlibc
12746 case "$d_getprotobyname_r" in
12747 "$define")
12748         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12749         case "$d_getprotobyname_r_proto:$usethreads" in
12750         ":define")      d_getprotobyname_r_proto=define
12751                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12752                 eval $hasproto ;;
12753         *)      ;;
12754         esac
12755         case "$d_getprotobyname_r_proto" in
12756         define)
12757         case "$getprotobyname_r_proto" in
12758         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12759         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12760         esac
12761         case "$getprotobyname_r_proto" in
12762         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12763         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12764         esac
12765         case "$getprotobyname_r_proto" in
12766         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12767         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12768         esac
12769         case "$getprotobyname_r_proto" in
12770         ''|0)   d_getprotobyname_r=undef
12771                 getprotobyname_r_proto=0
12772                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12773         * )     case "$getprotobyname_r_proto" in
12774                 REENTRANT_PROTO*) ;;
12775                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12776                 esac
12777                 echo "Prototype: $try" ;;
12778         esac
12779         ;;
12780         *)      case "$usethreads" in
12781                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12782                 esac
12783                 d_getprotobyname_r=undef
12784                 getprotobyname_r_proto=0
12785                 ;;
12786         esac
12787         ;;
12788 *)      getprotobyname_r_proto=0
12789         ;;
12790 esac
12791
12792 : see if getprotobynumber_r exists
12793 set getprotobynumber_r d_getprotobynumber_r
12794 eval $inlibc
12795 case "$d_getprotobynumber_r" in
12796 "$define")
12797         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12798         case "$d_getprotobynumber_r_proto:$usethreads" in
12799         ":define")      d_getprotobynumber_r_proto=define
12800                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12801                 eval $hasproto ;;
12802         *)      ;;
12803         esac
12804         case "$d_getprotobynumber_r_proto" in
12805         define)
12806         case "$getprotobynumber_r_proto" in
12807         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12808         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12809         esac
12810         case "$getprotobynumber_r_proto" in
12811         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12812         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12813         esac
12814         case "$getprotobynumber_r_proto" in
12815         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12816         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12817         esac
12818         case "$getprotobynumber_r_proto" in
12819         ''|0)   d_getprotobynumber_r=undef
12820                 getprotobynumber_r_proto=0
12821                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12822         * )     case "$getprotobynumber_r_proto" in
12823                 REENTRANT_PROTO*) ;;
12824                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12825                 esac
12826                 echo "Prototype: $try" ;;
12827         esac
12828         ;;
12829         *)      case "$usethreads" in
12830                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12831                 esac
12832                 d_getprotobynumber_r=undef
12833                 getprotobynumber_r_proto=0
12834                 ;;
12835         esac
12836         ;;
12837 *)      getprotobynumber_r_proto=0
12838         ;;
12839 esac
12840
12841 : see if getprotoent_r exists
12842 set getprotoent_r d_getprotoent_r
12843 eval $inlibc
12844 case "$d_getprotoent_r" in
12845 "$define")
12846         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12847         case "$d_getprotoent_r_proto:$usethreads" in
12848         ":define")      d_getprotoent_r_proto=define
12849                 set d_getprotoent_r_proto getprotoent_r $hdrs
12850                 eval $hasproto ;;
12851         *)      ;;
12852         esac
12853         case "$d_getprotoent_r_proto" in
12854         define)
12855         case "$getprotoent_r_proto" in
12856         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12857         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12858         esac
12859         case "$getprotoent_r_proto" in
12860         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12861         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12862         esac
12863         case "$getprotoent_r_proto" in
12864         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12865         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12866         esac
12867         case "$getprotoent_r_proto" in
12868         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12869         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12870         esac
12871         case "$getprotoent_r_proto" in
12872         ''|0)   d_getprotoent_r=undef
12873                 getprotoent_r_proto=0
12874                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12875         * )     case "$getprotoent_r_proto" in
12876                 REENTRANT_PROTO*) ;;
12877                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12878                 esac
12879                 echo "Prototype: $try" ;;
12880         esac
12881         ;;
12882         *)      case "$usethreads" in
12883                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12884                 esac
12885                 d_getprotoent_r=undef
12886                 getprotoent_r_proto=0
12887                 ;;
12888         esac
12889         ;;
12890 *)      getprotoent_r_proto=0
12891         ;;
12892 esac
12893
12894 : see if prototypes for various getprotoxxx netdb.h functions are available
12895 echo " "
12896 set d_getprotoprotos getprotoent $i_netdb netdb.h
12897 eval $hasproto
12898
12899 : see if getprpwnam exists
12900 set getprpwnam d_getprpwnam
12901 eval $inlibc
12902
12903 : see if getpwent exists
12904 set getpwent d_getpwent
12905 eval $inlibc
12906
12907 : see if getpwent_r exists
12908 set getpwent_r d_getpwent_r
12909 eval $inlibc
12910 case "$d_getpwent_r" in
12911 "$define")
12912         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12913         case "$d_getpwent_r_proto:$usethreads" in
12914         ":define")      d_getpwent_r_proto=define
12915                 set d_getpwent_r_proto getpwent_r $hdrs
12916                 eval $hasproto ;;
12917         *)      ;;
12918         esac
12919         case "$d_getpwent_r_proto" in
12920         define)
12921         case "$getpwent_r_proto" in
12922         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12923         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12924         esac
12925         case "$getpwent_r_proto" in
12926         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12927         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12928         esac
12929         case "$getpwent_r_proto" in
12930         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12931         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12932         esac
12933         case "$getpwent_r_proto" in
12934         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12935         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12936         esac
12937         case "$getpwent_r_proto" in
12938         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12939         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12940         esac
12941         case "$getpwent_r_proto" in
12942         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12943         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12944         esac
12945         case "$getpwent_r_proto" in
12946         ''|0)   d_getpwent_r=undef
12947                 getpwent_r_proto=0
12948                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12949         * )     case "$getpwent_r_proto" in
12950                 REENTRANT_PROTO*) ;;
12951                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12952                 esac
12953                 echo "Prototype: $try" ;;
12954         esac
12955         ;;
12956         *)      case "$usethreads" in
12957                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12958                 esac
12959                 d_getpwent_r=undef
12960                 getpwent_r_proto=0
12961                 ;;
12962         esac
12963         ;;
12964 *)      getpwent_r_proto=0
12965         ;;
12966 esac
12967
12968 : see if getpwnam_r exists
12969 set getpwnam_r d_getpwnam_r
12970 eval $inlibc
12971 case "$d_getpwnam_r" in
12972 "$define")
12973         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12974         case "$d_getpwnam_r_proto:$usethreads" in
12975         ":define")      d_getpwnam_r_proto=define
12976                 set d_getpwnam_r_proto getpwnam_r $hdrs
12977                 eval $hasproto ;;
12978         *)      ;;
12979         esac
12980         case "$d_getpwnam_r_proto" in
12981         define)
12982         case "$getpwnam_r_proto" in
12983         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12984         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12985         esac
12986         case "$getpwnam_r_proto" in
12987         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12988         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12989         esac
12990         case "$getpwnam_r_proto" in
12991         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12992         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12993         esac
12994         case "$getpwnam_r_proto" in
12995         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12996         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12997         esac
12998         case "$getpwnam_r_proto" in
12999         ''|0)   d_getpwnam_r=undef
13000                 getpwnam_r_proto=0
13001                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13002         * )     case "$getpwnam_r_proto" in
13003                 REENTRANT_PROTO*) ;;
13004                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13005                 esac
13006                 echo "Prototype: $try" ;;
13007         esac
13008         ;;
13009         *)      case "$usethreads" in
13010                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13011                 esac
13012                 d_getpwnam_r=undef
13013                 getpwnam_r_proto=0
13014                 ;;
13015         esac
13016         ;;
13017 *)      getpwnam_r_proto=0
13018         ;;
13019 esac
13020
13021 : see if getpwuid_r exists
13022 set getpwuid_r d_getpwuid_r
13023 eval $inlibc
13024 case "$d_getpwuid_r" in
13025 "$define")
13026         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13027         case "$d_getpwuid_r_proto:$usethreads" in
13028         ":define")      d_getpwuid_r_proto=define
13029                 set d_getpwuid_r_proto getpwuid_r $hdrs
13030                 eval $hasproto ;;
13031         *)      ;;
13032         esac
13033         case "$d_getpwuid_r_proto" in
13034         define)
13035         case "$getpwuid_r_proto" in
13036         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13037         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13038         esac
13039         case "$getpwuid_r_proto" in
13040         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13041         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13042         esac
13043         case "$getpwuid_r_proto" in
13044         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13045         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13046         esac
13047         case "$getpwuid_r_proto" in
13048         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13049         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13050         esac
13051         case "$getpwuid_r_proto" in
13052         ''|0)   d_getpwuid_r=undef
13053                 getpwuid_r_proto=0
13054                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13055         * )     case "$getpwuid_r_proto" in
13056                 REENTRANT_PROTO*) ;;
13057                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13058                 esac
13059                 echo "Prototype: $try" ;;
13060         esac
13061         ;;
13062         *)      case "$usethreads" in
13063                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13064                 esac
13065                 d_getpwuid_r=undef
13066                 getpwuid_r_proto=0
13067                 ;;
13068         esac
13069         ;;
13070 *)      getpwuid_r_proto=0
13071         ;;
13072 esac
13073
13074
13075 : see if getservbyname exists
13076 set getservbyname d_getsbyname
13077 eval $inlibc
13078
13079 : see if getservbyport exists
13080 set getservbyport d_getsbyport
13081 eval $inlibc
13082
13083 : see if getservent exists
13084 set getservent d_getsent
13085 eval $inlibc
13086
13087 : see if getservbyname_r exists
13088 set getservbyname_r d_getservbyname_r
13089 eval $inlibc
13090 case "$d_getservbyname_r" in
13091 "$define")
13092         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13093         case "$d_getservbyname_r_proto:$usethreads" in
13094         ":define")      d_getservbyname_r_proto=define
13095                 set d_getservbyname_r_proto getservbyname_r $hdrs
13096                 eval $hasproto ;;
13097         *)      ;;
13098         esac
13099         case "$d_getservbyname_r_proto" in
13100         define)
13101         case "$getservbyname_r_proto" in
13102         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13103         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13104         esac
13105         case "$getservbyname_r_proto" in
13106         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13107         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13108         esac
13109         case "$getservbyname_r_proto" in
13110         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13111         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13112         esac
13113         case "$getservbyname_r_proto" in
13114         ''|0)   d_getservbyname_r=undef
13115                 getservbyname_r_proto=0
13116                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13117         * )     case "$getservbyname_r_proto" in
13118                 REENTRANT_PROTO*) ;;
13119                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13120                 esac
13121                 echo "Prototype: $try" ;;
13122         esac
13123         ;;
13124         *)      case "$usethreads" in
13125                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13126                 esac
13127                 d_getservbyname_r=undef
13128                 getservbyname_r_proto=0
13129                 ;;
13130         esac
13131         ;;
13132 *)      getservbyname_r_proto=0
13133         ;;
13134 esac
13135
13136 : see if getservbyport_r exists
13137 set getservbyport_r d_getservbyport_r
13138 eval $inlibc
13139 case "$d_getservbyport_r" in
13140 "$define")
13141         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13142         case "$d_getservbyport_r_proto:$usethreads" in
13143         ":define")      d_getservbyport_r_proto=define
13144                 set d_getservbyport_r_proto getservbyport_r $hdrs
13145                 eval $hasproto ;;
13146         *)      ;;
13147         esac
13148         case "$d_getservbyport_r_proto" in
13149         define)
13150         case "$getservbyport_r_proto" in
13151         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13152         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13153         esac
13154         case "$getservbyport_r_proto" in
13155         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13156         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13157         esac
13158         case "$getservbyport_r_proto" in
13159         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13160         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13161         esac
13162         case "$getservbyport_r_proto" in
13163         ''|0)   d_getservbyport_r=undef
13164                 getservbyport_r_proto=0
13165                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13166         * )     case "$getservbyport_r_proto" in
13167                 REENTRANT_PROTO*) ;;
13168                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13169                 esac
13170                 echo "Prototype: $try" ;;
13171         esac
13172         ;;
13173         *)      case "$usethreads" in
13174                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13175                 esac
13176                 d_getservbyport_r=undef
13177                 getservbyport_r_proto=0
13178                 ;;
13179         esac
13180         ;;
13181 *)      getservbyport_r_proto=0
13182         ;;
13183 esac
13184
13185 : see if getservent_r exists
13186 set getservent_r d_getservent_r
13187 eval $inlibc
13188 case "$d_getservent_r" in
13189 "$define")
13190         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13191         case "$d_getservent_r_proto:$usethreads" in
13192         ":define")      d_getservent_r_proto=define
13193                 set d_getservent_r_proto getservent_r $hdrs
13194                 eval $hasproto ;;
13195         *)      ;;
13196         esac
13197         case "$d_getservent_r_proto" in
13198         define)
13199         case "$getservent_r_proto" in
13200         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13201         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13202         esac
13203         case "$getservent_r_proto" in
13204         ''|0) try='int getservent_r(struct servent*, char*, int);'
13205         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13206         esac
13207         case "$getservent_r_proto" in
13208         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13209         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13210         esac
13211         case "$getservent_r_proto" in
13212         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13213         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13214         esac
13215         case "$getservent_r_proto" in
13216         ''|0)   d_getservent_r=undef
13217                 getservent_r_proto=0
13218                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13219         * )     case "$getservent_r_proto" in
13220                 REENTRANT_PROTO*) ;;
13221                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13222                 esac
13223                 echo "Prototype: $try" ;;
13224         esac
13225         ;;
13226         *)      case "$usethreads" in
13227                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13228                 esac
13229                 d_getservent_r=undef
13230                 getservent_r_proto=0
13231                 ;;
13232         esac
13233         ;;
13234 *)      getservent_r_proto=0
13235         ;;
13236 esac
13237
13238 : see if prototypes for various getservxxx netdb.h functions are available
13239 echo " "
13240 set d_getservprotos getservent $i_netdb netdb.h
13241 eval $hasproto
13242
13243 : see if getspnam exists
13244 set getspnam d_getspnam
13245 eval $inlibc
13246
13247 : see if this is a shadow.h system
13248 set shadow.h i_shadow
13249 eval $inhdr
13250
13251 : see if getspnam_r exists
13252 set getspnam_r d_getspnam_r
13253 eval $inlibc
13254 case "$d_getspnam_r" in
13255 "$define")
13256         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13257         case "$d_getspnam_r_proto:$usethreads" in
13258         ":define")      d_getspnam_r_proto=define
13259                 set d_getspnam_r_proto getspnam_r $hdrs
13260                 eval $hasproto ;;
13261         *)      ;;
13262         esac
13263         case "$d_getspnam_r_proto" in
13264         define)
13265         case "$getspnam_r_proto" in
13266         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13267         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13268         esac
13269         case "$getspnam_r_proto" in
13270         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13271         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13272         esac
13273         case "$getspnam_r_proto" in
13274         ''|0)   d_getspnam_r=undef
13275                 getspnam_r_proto=0
13276                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13277         * )     case "$getspnam_r_proto" in
13278                 REENTRANT_PROTO*) ;;
13279                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13280                 esac
13281                 echo "Prototype: $try" ;;
13282         esac
13283         ;;
13284         *)      case "$usethreads" in
13285                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13286                 esac
13287                 d_getspnam_r=undef
13288                 getspnam_r_proto=0
13289                 ;;
13290         esac
13291         ;;
13292 *)      getspnam_r_proto=0
13293         ;;
13294 esac
13295
13296 : see if gettimeofday or ftime exists
13297 set gettimeofday d_gettimeod
13298 eval $inlibc
13299 case "$d_gettimeod" in
13300 "$undef")
13301         set ftime d_ftime 
13302         eval $inlibc
13303         ;;
13304 *)
13305         val="$undef"; set d_ftime; eval $setvar
13306         ;;
13307 esac
13308 case "$d_gettimeod$d_ftime" in
13309 "$undef$undef")
13310         echo " "
13311         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13312         ;;
13313 esac
13314
13315 : see if gmtime_r exists
13316 set gmtime_r d_gmtime_r
13317 eval $inlibc
13318 case "$d_gmtime_r" in
13319 "$define")
13320         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13321         case "$d_gmtime_r_proto:$usethreads" in
13322         ":define")      d_gmtime_r_proto=define
13323                 set d_gmtime_r_proto gmtime_r $hdrs
13324                 eval $hasproto ;;
13325         *)      ;;
13326         esac
13327         case "$d_gmtime_r_proto" in
13328         define)
13329         case "$gmtime_r_proto" in
13330         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13331         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13332         esac
13333         case "$gmtime_r_proto" in
13334         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13335         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13336         esac
13337         case "$gmtime_r_proto" in
13338         ''|0)   d_gmtime_r=undef
13339                 gmtime_r_proto=0
13340                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13341         * )     case "$gmtime_r_proto" in
13342                 REENTRANT_PROTO*) ;;
13343                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13344                 esac
13345                 echo "Prototype: $try" ;;
13346         esac
13347         ;;
13348         *)      case "$usethreads" in
13349                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13350                 esac
13351                 d_gmtime_r=undef
13352                 gmtime_r_proto=0
13353                 ;;
13354         esac
13355         ;;
13356 *)      gmtime_r_proto=0
13357         ;;
13358 esac
13359
13360 : see if hasmntopt exists
13361 set hasmntopt d_hasmntopt
13362 eval $inlibc
13363
13364 : see if this is a netinet/in.h or sys/in.h system
13365 set netinet/in.h i_niin sys/in.h i_sysin
13366 eval $inhdr
13367
13368 : see if arpa/inet.h has to be included
13369 set arpa/inet.h i_arpainet
13370 eval $inhdr
13371
13372 : see if htonl --and friends-- exists
13373 val=''
13374 set htonl val
13375 eval $inlibc
13376
13377 : Maybe they are macros.
13378 case "$val" in
13379 $undef)
13380         $cat >htonl.c <<EOM
13381 #include <stdio.h>
13382 #include <sys/types.h>
13383 #$i_niin I_NETINET_IN
13384 #$i_sysin I_SYS_IN
13385 #$i_arpainet I_ARPA_INET
13386 #ifdef I_NETINET_IN
13387 #include <netinet/in.h>
13388 #endif
13389 #ifdef I_SYS_IN
13390 #include <sys/in.h>
13391 #endif
13392 #ifdef I_ARPA_INET
13393 #include <arpa/inet.h>
13394 #endif
13395 #ifdef htonl
13396 printf("Defined as a macro.");
13397 #endif
13398 EOM
13399         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13400         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13401                 val="$define"
13402                 echo "But it seems to be defined as a macro." >&4
13403         fi
13404         $rm -f htonl.?
13405         ;;
13406 esac
13407 set d_htonl
13408 eval $setvar
13409
13410 : see if ilogbl exists
13411 set ilogbl d_ilogbl
13412 eval $inlibc
13413
13414 : index or strchr
13415 echo " "
13416 if set index val -f; eval $csym; $val; then
13417         if set strchr val -f d_strchr; eval $csym; $val; then
13418                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13419                         val="$define"
13420                         vali="$undef"
13421                         echo "strchr() found." >&4
13422                 else
13423                         val="$undef"
13424                         vali="$define"
13425                         echo "index() found." >&4
13426                 fi
13427         else
13428                 val="$undef"
13429                 vali="$define"
13430                 echo "index() found." >&4
13431         fi
13432 else
13433         if set strchr val -f d_strchr; eval $csym; $val; then
13434                 val="$define"
13435                 vali="$undef"
13436                 echo "strchr() found." >&4
13437         else
13438                 echo "No index() or strchr() found!" >&4
13439                 val="$undef"
13440                 vali="$undef"
13441         fi
13442 fi
13443 set d_strchr; eval $setvar
13444 val="$vali"
13445 set d_index; eval $setvar
13446
13447 : check whether inet_aton exists
13448 set inet_aton d_inetaton
13449 eval $inlibc
13450
13451 : Look for isascii
13452 echo " "
13453 $cat >isascii.c <<EOCP
13454 #include <stdio.h>
13455 #include <ctype.h>
13456 #$i_stdlib I_STDLIB
13457 #ifdef I_STDLIB
13458 #include <stdlib.h>
13459 #endif
13460 int main() {
13461         int c = 'A';
13462         if (isascii(c))
13463                 exit(0);
13464         else
13465                 exit(1);
13466 }
13467 EOCP
13468 set isascii
13469 if eval $compile; then
13470         echo "isascii() found." >&4
13471         val="$define"
13472 else
13473         echo "isascii() NOT found." >&4
13474         val="$undef"
13475 fi
13476 set d_isascii
13477 eval $setvar
13478 $rm -f isascii*
13479
13480 : see if isfinite exists
13481 set isfinite d_isfinite
13482 eval $inlibc
13483
13484 : see if isinf exists
13485 set isinf d_isinf
13486 eval $inlibc
13487
13488 : see if isnan exists
13489 set isnan d_isnan
13490 eval $inlibc
13491
13492 : see if isnanl exists
13493 set isnanl d_isnanl
13494 eval $inlibc
13495
13496 : see if killpg exists
13497 set killpg d_killpg
13498 eval $inlibc
13499
13500 : see if lchown exists
13501 echo " "
13502 $cat > try.c <<'EOCP'
13503 /* System header to define __stub macros and hopefully few prototypes,
13504     which can conflict with char lchown(); below.  */
13505 #include <assert.h>
13506 /* Override any gcc2 internal prototype to avoid an error.  */
13507 /* We use char because int might match the return type of a gcc2
13508    builtin and then its argument prototype would still apply.  */
13509 char lchown();
13510 int main() {
13511     /*  The GNU C library defines this for functions which it implements
13512         to always fail with ENOSYS.  Some functions are actually named
13513         something starting with __ and the normal name is an alias.  */
13514 #if defined (__stub_lchown) || defined (__stub___lchown)
13515 choke me
13516 #else
13517 lchown();
13518 #endif
13519 ; return 0; }
13520 EOCP
13521 set try
13522 if eval $compile; then
13523     $echo "lchown() found." >&4
13524     val="$define"
13525 else
13526     $echo "lchown() NOT found." >&4
13527     val="$undef"
13528 fi
13529 set d_lchown
13530 eval $setvar
13531
13532 : See if number of significant digits in a double precision number is known
13533 echo " "
13534 $cat >ldbl_dig.c <<EOM
13535 #$i_limits I_LIMITS
13536 #$i_float I_FLOAT
13537 #ifdef I_LIMITS
13538 #include <limits.h>
13539 #endif
13540 #ifdef I_FLOAT
13541 #include <float.h>
13542 #endif
13543 #ifdef LDBL_DIG
13544 printf("Contains LDBL_DIG");
13545 #endif
13546 EOM
13547 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13548 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13549         echo "LDBL_DIG found." >&4
13550         val="$define"
13551 else
13552         echo "LDBL_DIG NOT found." >&4
13553         val="$undef"
13554 fi
13555 $rm -f ldbl_dig.?
13556 set d_ldbl_dig
13557 eval $setvar
13558
13559 : see if link exists
13560 set link d_link
13561 eval $inlibc
13562
13563 : see if localtime_r exists
13564 set localtime_r d_localtime_r
13565 eval $inlibc
13566 case "$d_localtime_r" in
13567 "$define")
13568         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13569         case "$d_localtime_r_proto:$usethreads" in
13570         ":define")      d_localtime_r_proto=define
13571                 set d_localtime_r_proto localtime_r $hdrs
13572                 eval $hasproto ;;
13573         *)      ;;
13574         esac
13575         case "$d_localtime_r_proto" in
13576         define)
13577         case "$localtime_r_proto" in
13578         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13579         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13580         esac
13581         case "$localtime_r_proto" in
13582         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13583         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13584         esac
13585         case "$localtime_r_proto" in
13586         ''|0)   d_localtime_r=undef
13587                 localtime_r_proto=0
13588                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13589         * )     case "$localtime_r_proto" in
13590                 REENTRANT_PROTO*) ;;
13591                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13592                 esac
13593                 echo "Prototype: $try" ;;
13594         esac
13595         ;;
13596         *)      case "$usethreads" in
13597                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13598                 esac
13599                 d_localtime_r=undef
13600                 localtime_r_proto=0
13601                 ;;
13602         esac
13603         ;;
13604 *)      localtime_r_proto=0
13605         ;;
13606 esac
13607
13608 : see if localeconv exists
13609 set localeconv d_locconv
13610 eval $inlibc
13611
13612 : see if lockf exists
13613 set lockf d_lockf
13614 eval $inlibc
13615
13616 : see if prototype for lseek is available
13617 echo " "
13618 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13619 eval $hasproto
13620
13621 : see if lstat exists
13622 set lstat d_lstat
13623 eval $inlibc
13624
13625 : see if madvise exists
13626 set madvise d_madvise
13627 eval $inlibc
13628
13629 : see if mblen exists
13630 set mblen d_mblen
13631 eval $inlibc
13632
13633 : see if mbstowcs exists
13634 set mbstowcs d_mbstowcs
13635 eval $inlibc
13636
13637 : see if mbtowc exists
13638 set mbtowc d_mbtowc
13639 eval $inlibc
13640
13641 : see if memchr exists
13642 set memchr d_memchr
13643 eval $inlibc
13644
13645 : see if memcmp exists
13646 set memcmp d_memcmp
13647 eval $inlibc
13648
13649 : see if memcpy exists
13650 set memcpy d_memcpy
13651 eval $inlibc
13652
13653 : see if memmove exists
13654 set memmove d_memmove
13655 eval $inlibc
13656
13657 : see if memset exists
13658 set memset d_memset
13659 eval $inlibc
13660
13661 : see if mkdir exists
13662 set mkdir d_mkdir
13663 eval $inlibc
13664
13665 : see if mkdtemp exists
13666 set mkdtemp d_mkdtemp
13667 eval $inlibc
13668
13669 : see if mkfifo exists
13670 set mkfifo d_mkfifo
13671 eval $inlibc
13672
13673 : see if mkstemp exists
13674 set mkstemp d_mkstemp
13675 eval $inlibc
13676
13677 : see if mkstemps exists
13678 set mkstemps d_mkstemps
13679 eval $inlibc
13680
13681 : see if mktime exists
13682 set mktime d_mktime
13683 eval $inlibc
13684
13685 : see if this is a sys/mman.h system
13686 set sys/mman.h i_sysmman
13687 eval $inhdr
13688
13689 : see if mmap exists
13690 set mmap d_mmap
13691 eval $inlibc
13692 : see what shmat returns
13693 : default to something harmless
13694 mmaptype='void *'
13695 case "$i_sysmman$d_mmap" in
13696 "$define$define")
13697         $cat >mmap.c <<'END'
13698 #include <sys/mman.h>
13699 void *mmap();
13700 END
13701         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13702                 mmaptype='void *'
13703         else
13704                 mmaptype='caddr_t'
13705         fi
13706         echo "and it returns ($mmaptype)." >&4
13707         ;;
13708 esac
13709
13710
13711
13712 : see if sqrtl exists
13713 set sqrtl d_sqrtl
13714 eval $inlibc
13715
13716 : see if modfl exists
13717 set modfl d_modfl
13718 eval $inlibc
13719
13720 : see if prototype for modfl is available
13721 echo " "
13722 set d_modflproto modfl math.h
13723 eval $hasproto
13724
13725 d_modfl_pow32_bug="$undef"
13726
13727 case "$d_longdbl$d_modfl" in
13728 $define$define)
13729         $cat <<EOM
13730 Checking to see whether your modfl() is okay for large values...
13731 EOM
13732 $cat >try.c <<EOCP
13733 #include <math.h> 
13734 #include <stdio.h>
13735 EOCP
13736 if $test "X$d_modflproto" != "X$define"; then
13737         $cat >>try.c <<EOCP
13738 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
13739 long double modfl (long double, long double *);
13740 EOCP
13741 fi
13742 $cat >>try.c <<EOCP
13743 int main() {
13744     long double nv = 4294967303.15;
13745     long double v, w;
13746     v = modfl(nv, &w);         
13747 #ifdef __GLIBC__
13748     printf("glibc");
13749 #endif
13750     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
13751     return 0;
13752 }
13753 EOCP
13754         case "$osname:$gccversion" in
13755         aix:)   saveccflags="$ccflags"
13756                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
13757         esac
13758         set try
13759         if eval $compile; then
13760                 foo=`$run ./try`
13761                 case "$foo" in
13762                 *" 4294967303.150000 1.150000 4294967302.000000")
13763                         echo >&4 "Your modfl() is broken for large values."
13764                         d_modfl_pow32_bug="$define"
13765                         case "$foo" in
13766                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
13767                         ;;
13768                         esac
13769                         ;;
13770                 *" 4294967303.150000 0.150000 4294967303.000000")
13771                         echo >&4 "Your modfl() seems okay for large values."
13772                         ;;
13773                 *)      echo >&4 "I don't understand your modfl() at all."
13774                         d_modfl="$undef"
13775                         ;;
13776                 esac
13777                 $rm -f try.* try core core.try.*
13778         else
13779                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
13780                 d_modfl="$undef"
13781         fi
13782         case "$osname:$gccversion" in
13783         aix:)   ccflags="$saveccflags" ;; # restore
13784         esac
13785         ;;
13786 esac
13787
13788 if $test "$uselongdouble" = "$define"; then
13789     message=none
13790     case "$d_sqrtl:$d_modfl" in
13791     $define:$define)
13792         : You have both
13793         ;;
13794     $define:$undef)
13795         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
13796             echo "You have both aintl and copysignl, so I can emulate modfl."
13797         else
13798             message="I could not find modfl."
13799         fi
13800         ;;
13801     $undef:$define)
13802         message="I could not find sqrtl."
13803         ;;
13804     $undef:$undef)
13805         message="I found neither sqrtl nor modfl."
13806         ;;
13807     esac
13808
13809     if $test "$message" != none; then
13810         $cat <<EOM >&4
13811
13812 *** You requested the use of long doubles but you do not seem to have
13813 *** the mathematic functions for long doubles.
13814 *** ($message)
13815 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
13816 *** Cannot continue, aborting.
13817
13818 EOM
13819
13820         exit 1
13821     fi
13822 fi
13823
13824 : see if mprotect exists
13825 set mprotect d_mprotect
13826 eval $inlibc
13827
13828 : see if msgctl exists
13829 set msgctl d_msgctl
13830 eval $inlibc
13831
13832 : see if msgget exists
13833 set msgget d_msgget
13834 eval $inlibc
13835
13836 : see if msgsnd exists
13837 set msgsnd d_msgsnd
13838 eval $inlibc
13839
13840 : see if msgrcv exists
13841 set msgrcv d_msgrcv
13842 eval $inlibc
13843
13844 : see how much of the 'msg*(2)' library is present.
13845 h_msg=true
13846 echo " "
13847 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13848 *"$undef"*) h_msg=false;;
13849 esac
13850 case "$osname" in
13851 freebsd)
13852     case "`ipcs 2>&1`" in
13853     "SVID messages"*"not configured"*)
13854         echo "Your $osname does not have the msg*(2) configured." >&4
13855         h_msg=false
13856         val="$undef"
13857         set msgctl d_msgctl
13858         eval $setvar
13859         set msgget d_msgget
13860         eval $setvar
13861         set msgsnd d_msgsnd
13862         eval $setvar
13863         set msgrcv d_msgrcv
13864         eval $setvar
13865         ;;
13866     esac
13867     ;;
13868 esac
13869 : we could also check for sys/ipc.h ...
13870 if $h_msg && $test `./findhdr sys/msg.h`; then
13871         echo "You have the full msg*(2) library." >&4
13872         val="$define"
13873 else
13874         echo "You don't have the full msg*(2) library." >&4
13875         val="$undef"
13876 fi
13877 set d_msg
13878 eval $setvar
13879
13880
13881 echo " "
13882 echo "Checking to see if your system supports struct msghdr..." >&4
13883 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13884 eval $hasstruct
13885 case "$d_msghdr_s" in
13886 "$define")      echo "Yes, it does."   ;;
13887 *)              echo "No, it doesn't." ;;
13888 esac
13889
13890
13891 : see if msync exists
13892 set msync d_msync
13893 eval $inlibc
13894
13895 : see if munmap exists
13896 set munmap d_munmap
13897 eval $inlibc
13898
13899 : see if nanosleep exists
13900 set nanosleep d_nanosleep
13901 eval $inlibc
13902
13903 : see if nice exists
13904 set nice d_nice
13905 eval $inlibc
13906
13907 : see if this is a langinfo.h system
13908 set langinfo.h i_langinfo
13909 eval $inhdr
13910
13911 : see if nl_langinfo exists
13912 set nl_langinfo d_nl_langinfo
13913 eval $inlibc
13914
13915 : check for length of character
13916 echo " "
13917 case "$charsize" in
13918 '')
13919         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13920         $cat >try.c <<EOCP
13921 #include <stdio.h>
13922 #$i_stdlib I_STDLIB
13923 #ifdef I_STDLIB
13924 #include <stdlib.h>
13925 #endif
13926 int main()
13927 {
13928     printf("%d\n", (int)sizeof(char));
13929     exit(0);
13930 }
13931 EOCP
13932         set try
13933         if eval $compile_ok; then
13934                 dflt=`$run ./try`
13935         else
13936                 dflt='1'
13937                 echo "(I can't seem to compile the test program.  Guessing...)"
13938         fi
13939         ;;
13940 *)
13941         dflt="$charsize"
13942         ;;
13943 esac
13944 rp="What is the size of a character (in bytes)?"
13945 . ./myread
13946 charsize="$ans"
13947 $rm -f try.c try
13948
13949 : check for volatile keyword
13950 echo " "
13951 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13952 $cat >try.c <<'EOCP'
13953 int main()
13954 {
13955         typedef struct _goo_struct goo_struct;
13956         goo_struct * volatile goo = ((goo_struct *)0);
13957         struct _goo_struct {
13958                 long long_int;
13959                 int reg_int;
13960                 char char_var;
13961         };
13962         typedef unsigned short foo_t;
13963         char *volatile foo;
13964         volatile int bar;
13965         volatile foo_t blech;
13966         foo = foo;
13967 }
13968 EOCP
13969 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13970         val="$define"
13971         echo "Yup, it does."
13972 else
13973         val="$undef"
13974         echo "Nope, it doesn't."
13975 fi
13976 set d_volatile
13977 eval $setvar
13978 $rm -f try.*
13979
13980
13981 echo " "
13982 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13983
13984 case "$use64bitint:$d_quad:$quadtype" in
13985 define:define:?*)
13986         ivtype="$quadtype"
13987         uvtype="$uquadtype"
13988         ivsize=8
13989         uvsize=8
13990         ;;
13991 *)      ivtype="long"
13992         uvtype="unsigned long"
13993         ivsize=$longsize
13994         uvsize=$longsize
13995         ;;
13996 esac
13997
13998 case "$uselongdouble:$d_longdbl" in
13999 define:define)
14000         nvtype="long double"
14001         nvsize=$longdblsize
14002         ;;
14003 *)      nvtype=double
14004         nvsize=$doublesize
14005         ;;
14006 esac
14007
14008 $echo "(IV will be "$ivtype", $ivsize bytes)"
14009 $echo "(UV will be "$uvtype", $uvsize bytes)"
14010 $echo "(NV will be "$nvtype", $nvsize bytes)"
14011
14012 $cat >try.c <<EOCP
14013 #$i_inttypes I_INTTYPES
14014 #ifdef I_INTTYPES
14015 #include <inttypes.h>
14016 #endif
14017 #include <stdio.h>
14018 int main() {
14019 #ifdef INT8
14020    int8_t i =  INT8_MAX;
14021   uint8_t u = UINT8_MAX;
14022   printf("int8_t\n");
14023 #endif
14024 #ifdef INT16
14025    int16_t i =  INT16_MAX;
14026   uint16_t i = UINT16_MAX;
14027   printf("int16_t\n");
14028 #endif
14029 #ifdef INT32
14030    int32_t i =  INT32_MAX;
14031   uint32_t u = UINT32_MAX;
14032   printf("int32_t\n");
14033 #endif
14034 }
14035 EOCP
14036
14037 case "$i8type" in
14038 '')     case "$charsize" in
14039         1)      i8type=char
14040                 u8type="unsigned char"
14041                 i8size=$charsize
14042                 u8size=$charsize
14043                 ;;
14044         esac
14045         ;;
14046 esac
14047 case "$i8type" in
14048 '')     set try -DINT8
14049         if eval $compile; then
14050                 case "`$run ./try`" in
14051                 int8_t) i8type=int8_t
14052                         u8type=uint8_t
14053                         i8size=1
14054                         u8size=1
14055                         ;;
14056                 esac
14057         fi
14058         ;;
14059 esac
14060 case "$i8type" in
14061 '')     if $test $charsize -ge 1; then
14062                 i8type=char
14063                 u8type="unsigned char"
14064                 i8size=$charsize
14065                 u8size=$charsize
14066         fi
14067         ;;
14068 esac
14069
14070 case "$i16type" in
14071 '')     case "$shortsize" in
14072         2)      i16type=short
14073                 u16type="unsigned short"
14074                 i16size=$shortsize
14075                 u16size=$shortsize
14076                 ;;
14077         esac
14078         ;;
14079 esac
14080 case "$i16type" in
14081 '')     set try -DINT16
14082         if eval $compile; then
14083                 case "`$run ./try`" in
14084                 int16_t)
14085                         i16type=int16_t
14086                         u16type=uint16_t
14087                         i16size=2
14088                         u16size=2
14089                         ;;
14090                 esac
14091         fi
14092         ;;
14093 esac
14094 case "$i16type" in
14095 '')     if $test $shortsize -ge 2; then
14096                 i16type=short
14097                 u16type="unsigned short"
14098                 i16size=$shortsize
14099                 u16size=$shortsize
14100         fi
14101         ;;
14102 esac
14103
14104 case "$i32type" in
14105 '')     case "$longsize" in
14106         4)      i32type=long
14107                 u32type="unsigned long"
14108                 i32size=$longsize
14109                 u32size=$longsize
14110                 ;;
14111         *)      case "$intsize" in
14112                 4)      i32type=int
14113                         u32type="unsigned int"
14114                         i32size=$intsize
14115                         u32size=$intsize
14116                         ;;
14117                 esac
14118                 ;;
14119         esac
14120         ;;
14121 esac
14122 case "$i32type" in
14123 '')     set try -DINT32
14124         if eval $compile; then
14125                 case "`$run ./try`" in
14126                 int32_t)
14127                         i32type=int32_t
14128                         u32type=uint32_t
14129                         i32size=4
14130                         u32size=4
14131                         ;;
14132                 esac
14133         fi
14134         ;;
14135 esac
14136 case "$i32type" in
14137 '')     if $test $intsize -ge 4; then
14138                 i32type=int
14139                 u32type="unsigned int"
14140                 i32size=$intsize
14141                 u32size=$intsize
14142         fi
14143         ;;
14144 esac
14145
14146 case "$i64type" in
14147 '')     case "$d_quad:$quadtype" in
14148         define:?*)
14149                 i64type="$quadtype"
14150                 u64type="$uquadtype"
14151                 i64size=8
14152                 u64size=8
14153                 ;;
14154         esac
14155         ;;
14156 esac
14157
14158 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14159 : volatile so that the compiler has to store it out to memory.
14160 if test X"$d_volatile" = X"$define"; then
14161         volatile=volatile
14162 fi
14163 $cat <<EOP >try.c
14164 #include <stdio.h>
14165 #$i_stdlib I_STDLIB
14166 #ifdef I_STDLIB
14167 #include <stdlib.h>
14168 #endif
14169 #include <sys/types.h>
14170 #include <signal.h>
14171 #ifdef SIGFPE
14172 $volatile int bletched = 0;
14173 $signal_t blech(s) int s; { bletched = 1; }
14174 #endif
14175 int main() {
14176     $uvtype u = 0;
14177     $nvtype d;
14178     int     n = 8 * $uvsize;
14179     int     i;
14180 #ifdef SIGFPE
14181     signal(SIGFPE, blech);
14182 #endif
14183
14184     for (i = 0; i < n; i++) {
14185       u = u << 1 | ($uvtype)1;
14186       d = ($nvtype)u;
14187       if (($uvtype)d != u)
14188         break;
14189       if (d <= 0)
14190         break;
14191       d = ($nvtype)(u - 1);
14192       if (($uvtype)d != (u - 1))
14193         break;
14194 #ifdef SIGFPE
14195       if (bletched) {
14196         break;
14197 #endif
14198       } 
14199     }
14200     printf("%d\n", ((i == n) ? -n : i));
14201     exit(0);
14202 }
14203 EOP
14204 set try
14205
14206 d_nv_preserves_uv="$undef"
14207 if eval $compile; then
14208         nv_preserves_uv_bits="`$run ./try`"
14209 fi
14210 case "$nv_preserves_uv_bits" in
14211 \-[1-9]*)       
14212         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14213         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14214         d_nv_preserves_uv="$define"
14215         ;;
14216 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14217         d_nv_preserves_uv="$undef" ;;
14218 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14219         nv_preserves_uv_bits="$undef" ;;
14220 esac
14221
14222 $rm -f try.* try
14223
14224
14225 : check for off64_t
14226 echo " "
14227 echo "Checking to see if you have off64_t..." >&4
14228 $cat >try.c <<EOCP
14229 #include <sys/types.h>
14230 #include <unistd.h>
14231 int main() { off64_t x = 7; }
14232 EOCP
14233 set try
14234 if eval $compile; then
14235         val="$define"
14236         echo "You have off64_t."
14237 else
14238         val="$undef"
14239         echo "You do not have off64_t."
14240         case "$lseeksize" in
14241         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14242         esac
14243 fi
14244 $rm -f try.* try
14245 set d_off64_t
14246 eval $setvar
14247
14248 : how to create joinable pthreads
14249 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14250         echo " "
14251         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14252         $cat >try.c <<'EOCP'
14253 #include <pthread.h>
14254 int main() {
14255     int detachstate = JOINABLE;
14256 }
14257 EOCP
14258         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14259         if eval $compile; then
14260                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14261                 val="$undef" # Yes, undef.
14262                 set d_old_pthread_create_joinable
14263                 eval $setvar
14264                 val=""
14265                 set old_pthread_create_joinable
14266                 eval $setvar
14267         else
14268                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14269                 if eval $compile; then
14270                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14271                         val="$define"
14272                         set d_old_pthread_create_joinable
14273                         eval $setvar
14274                         val=PTHREAD_CREATE_UNDETACHED
14275                         set old_pthread_create_joinable
14276                         eval $setvar
14277                 else            
14278                         set try -DJOINABLE=__UNDETACHED
14279                         if eval $compile; then
14280                                 echo "You seem to use __UNDETACHED." >&4
14281                                 val="$define"
14282                                 set d_old_pthread_create_joinable
14283                                 eval $setvar
14284                                 val=__UNDETACHED
14285                                 set old_pthread_create_joinable
14286                                 eval $setvar
14287                         else
14288                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14289                                 val="$define"
14290                                 set d_old_pthread_create_joinable
14291                                 eval $setvar
14292                                 val=0
14293                                 set old_pthread_create_joinable
14294                                 eval $setvar
14295                         fi
14296                 fi
14297         fi
14298         $rm -f try try.*
14299 else
14300     d_old_pthread_create_joinable="$undef"
14301     old_pthread_create_joinable=""
14302 fi
14303
14304 : see if pause exists
14305 set pause d_pause
14306 eval $inlibc
14307
14308 : see if pipe exists
14309 set pipe d_pipe
14310 eval $inlibc
14311
14312 : see if poll exists
14313 set poll d_poll
14314 eval $inlibc
14315
14316 : see if readlink exists
14317 set readlink d_readlink
14318 eval $inlibc
14319
14320 echo " "
14321 procselfexe=''
14322 val="$undef"
14323 case "$d_readlink" in
14324 "$define")
14325         if $issymlink /proc/self/exe ; then
14326                 $ls -l /proc/self/exe > reflect
14327                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14328                         echo "You have Linux-like /proc/self/exe."
14329                         procselfexe='"/proc/self/exe"'
14330                         val="$define"
14331                 fi
14332         fi
14333         if $issymlink /proc/curproc/file ; then
14334                 $ls -l /proc/curproc/file > reflect
14335                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14336                         echo "You have BSD-like /proc/curproc/file."
14337                         procselfexe='"/proc/curproc/file"'
14338                         val="$define"
14339                 fi
14340         fi
14341         ;;
14342 esac
14343 $rm -f reflect
14344 set d_procselfexe
14345 eval $setvar
14346
14347 : see whether the pthread_atfork exists
14348 $cat >try.c <<EOP
14349 #include <pthread.h>
14350 #include <stdio.h>
14351 int main() {
14352 #ifdef  PTHREAD_ATFORK
14353         pthread_atfork(NULL,NULL,NULL);
14354 #endif
14355 }
14356 EOP
14357
14358 : see if pthread_atfork exists
14359 set try -DPTHREAD_ATFORK
14360 if eval $compile; then
14361     val="$define"
14362 else
14363     val="$undef"
14364 fi
14365 case "$usethreads" in
14366 $define)
14367         case "$val" in
14368         $define) echo 'pthread_atfork found.' >&4        ;;
14369         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14370         esac
14371 esac
14372 set d_pthread_atfork
14373 eval $setvar
14374
14375
14376 : see whether the various POSIXish _yields exist
14377 $cat >try.c <<EOP
14378 #include <pthread.h>
14379 #include <stdio.h>
14380 int main() {
14381 #ifdef SCHED_YIELD
14382         sched_yield();
14383 #else
14384 #ifdef PTHREAD_YIELD
14385         pthread_yield();
14386 #else
14387 #ifdef PTHREAD_YIELD_NULL
14388         pthread_yield(NULL);
14389 #endif
14390 #endif
14391 #endif
14392 }
14393 EOP
14394 : see if sched_yield exists
14395 set try -DSCHED_YIELD
14396 if eval $compile; then
14397     val="$define"
14398     sched_yield='sched_yield()'
14399 else
14400     val="$undef"
14401 fi
14402 case "$usethreads" in
14403 $define)
14404         case "$val" in
14405         $define) echo 'sched_yield() found.' >&4        ;;
14406         *)       echo 'sched_yield() NOT found.' >&4    ;;
14407         esac
14408 esac
14409 set d_sched_yield
14410 eval $setvar
14411
14412 : see if pthread_yield exists
14413 set try -DPTHREAD_YIELD
14414 if eval $compile; then
14415     val="$define"
14416     case "$sched_yield" in
14417     '') sched_yield='pthread_yield()' ;;
14418     esac
14419 else
14420     set try -DPTHREAD_YIELD_NULL
14421     if eval $compile; then
14422         val="$define"
14423         case "$sched_yield" in
14424         '') sched_yield='pthread_yield(NULL)' ;;
14425         esac
14426     else
14427         val="$undef"
14428     fi
14429 fi
14430 case "$usethreads" in
14431 $define)
14432         case "$val" in
14433         $define) echo 'pthread_yield() found.' >&4      ;;
14434         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14435         esac
14436         ;;
14437 esac
14438 set d_pthread_yield
14439 eval $setvar
14440
14441 case "$sched_yield" in
14442 '') sched_yield=undef ;;
14443 esac
14444
14445 $rm -f try try.*
14446
14447 : see if random_r exists
14448 set random_r d_random_r
14449 eval $inlibc
14450 case "$d_random_r" in
14451 "$define")
14452         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14453         case "$d_random_r_proto:$usethreads" in
14454         ":define")      d_random_r_proto=define
14455                 set d_random_r_proto random_r $hdrs
14456                 eval $hasproto ;;
14457         *)      ;;
14458         esac
14459         case "$d_random_r_proto" in
14460         define)
14461         case "$random_r_proto" in
14462         ''|0) try='int random_r(int*, struct random_data*);'
14463         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14464         esac
14465         case "$random_r_proto" in
14466         ''|0) try='int random_r(long*, struct random_data*);'
14467         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14468         esac
14469         case "$random_r_proto" in
14470         ''|0) try='int random_r(struct random_data*, int32_t*);'
14471         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
14472         esac
14473         case "$random_r_proto" in
14474         ''|0)   d_random_r=undef
14475                 random_r_proto=0
14476                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14477         * )     case "$random_r_proto" in
14478                 REENTRANT_PROTO*) ;;
14479                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14480                 esac
14481                 echo "Prototype: $try" ;;
14482         esac
14483         ;;
14484         *)      case "$usethreads" in
14485                 define) echo "random_r has no prototype, not using it." >&4 ;;
14486                 esac
14487                 d_random_r=undef
14488                 random_r_proto=0
14489                 ;;
14490         esac
14491         ;;
14492 *)      random_r_proto=0
14493         ;;
14494 esac
14495
14496 : see if readdir and friends exist
14497 set readdir d_readdir
14498 eval $inlibc
14499 set seekdir d_seekdir
14500 eval $inlibc
14501 set telldir d_telldir
14502 eval $inlibc
14503 set rewinddir d_rewinddir
14504 eval $inlibc
14505
14506 : see if readdir64_r exists
14507 set readdir64_r d_readdir64_r
14508 eval $inlibc
14509 case "$d_readdir64_r" in
14510 "$define")
14511         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14512         case "$d_readdir64_r_proto:$usethreads" in
14513         ":define")      d_readdir64_r_proto=define
14514                 set d_readdir64_r_proto readdir64_r $hdrs
14515                 eval $hasproto ;;
14516         *)      ;;
14517         esac
14518         case "$d_readdir64_r_proto" in
14519         define)
14520         case "$readdir64_r_proto" in
14521         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14522         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14523         esac
14524         case "$readdir64_r_proto" in
14525         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14526         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14527         esac
14528         case "$readdir64_r_proto" in
14529         ''|0)   d_readdir64_r=undef
14530                 readdir64_r_proto=0
14531                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14532         * )     case "$readdir64_r_proto" in
14533                 REENTRANT_PROTO*) ;;
14534                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14535                 esac
14536                 echo "Prototype: $try" ;;
14537         esac
14538         ;;
14539         *)      case "$usethreads" in
14540                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14541                 esac
14542                 d_readdir64_r=undef
14543                 readdir64_r_proto=0
14544                 ;;
14545         esac
14546         ;;
14547 *)      readdir64_r_proto=0
14548         ;;
14549 esac
14550
14551 : see if readdir_r exists
14552 set readdir_r d_readdir_r
14553 eval $inlibc
14554 case "$d_readdir_r" in
14555 "$define")
14556         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14557         case "$d_readdir_r_proto:$usethreads" in
14558         ":define")      d_readdir_r_proto=define
14559                 set d_readdir_r_proto readdir_r $hdrs
14560                 eval $hasproto ;;
14561         *)      ;;
14562         esac
14563         case "$d_readdir_r_proto" in
14564         define)
14565         case "$readdir_r_proto" in
14566         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14567         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14568         esac
14569         case "$readdir_r_proto" in
14570         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14571         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14572         esac
14573         case "$readdir_r_proto" in
14574         ''|0)   d_readdir_r=undef
14575                 readdir_r_proto=0
14576                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14577         * )     case "$readdir_r_proto" in
14578                 REENTRANT_PROTO*) ;;
14579                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14580                 esac
14581                 echo "Prototype: $try" ;;
14582         esac
14583         ;;
14584         *)      case "$usethreads" in
14585                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14586                 esac
14587                 d_readdir_r=undef
14588                 readdir_r_proto=0
14589                 ;;
14590         esac
14591         ;;
14592 *)      readdir_r_proto=0
14593         ;;
14594 esac
14595
14596 : see if readv exists
14597 set readv d_readv
14598 eval $inlibc
14599
14600 : see if recvmsg exists
14601 set recvmsg d_recvmsg
14602 eval $inlibc
14603
14604 : see if rename exists
14605 set rename d_rename
14606 eval $inlibc
14607
14608 : see if rmdir exists
14609 set rmdir d_rmdir
14610 eval $inlibc
14611
14612 : see if memory.h is available.
14613 val=''
14614 set memory.h val
14615 eval $inhdr
14616
14617 : See if it conflicts with string.h
14618 case "$val" in
14619 $define)
14620         case "$strings" in
14621         '') ;;
14622         *)
14623                 $cppstdin $cppflags $cppminus < $strings > mem.h
14624                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14625                         echo " "
14626                         echo "We won't be including <memory.h>."
14627                         val="$undef"
14628                 fi
14629                 $rm -f mem.h
14630                 ;;
14631         esac
14632 esac
14633 set i_memory
14634 eval $setvar
14635
14636 : can bcopy handle overlapping blocks?
14637 echo " "
14638 val="$undef"
14639 case "$d_memmove" in
14640 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14641 *)      case "$d_bcopy" in
14642         "$define")
14643                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14644                 $cat >try.c <<EOCP
14645 #$i_memory I_MEMORY
14646 #$i_stdlib I_STDLIB
14647 #$i_string I_STRING
14648 #$i_unistd I_UNISTD
14649 EOCP
14650         $cat >>try.c <<'EOCP'
14651 #include <stdio.h>
14652 #ifdef I_MEMORY
14653 #  include <memory.h>
14654 #endif
14655 #ifdef I_STDLIB
14656 #  include <stdlib.h>
14657 #endif
14658 #ifdef I_STRING
14659 #  include <string.h>
14660 #else
14661 #  include <strings.h>
14662 #endif
14663 #ifdef I_UNISTD
14664 #  include <unistd.h>  /* Needed for NetBSD */
14665 #endif
14666 int main()
14667 {
14668 char buf[128], abc[128];
14669 char *b;
14670 int len;
14671 int off;
14672 int align;
14673
14674 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14675    try to store the string in read-only memory. */
14676 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14677
14678 for (align = 7; align >= 0; align--) {
14679         for (len = 36; len; len--) {
14680                 b = buf+align;
14681                 bcopy(abc, b, len);
14682                 for (off = 1; off <= len; off++) {
14683                         bcopy(b, b+off, len);
14684                         bcopy(b+off, b, len);
14685                         if (bcmp(b, abc, len))
14686                                 exit(1);
14687                 }
14688         }
14689 }
14690 exit(0);
14691 }
14692 EOCP
14693                 set try
14694                 if eval $compile_ok; then
14695                         if ./try 2>/dev/null; then
14696                                 echo "Yes, it can."
14697                                 val="$define"
14698                         else
14699                                 echo "It can't, sorry."
14700                         fi
14701                 else
14702                         echo "(I can't compile the test program, so we'll assume not...)"
14703                 fi
14704                 ;;
14705         esac
14706         $rm -f try.* try core
14707         ;;
14708 esac
14709 set d_safebcpy
14710 eval $setvar
14711
14712 : can memcpy handle overlapping blocks?
14713 echo " "
14714 val="$undef"
14715 case "$d_memmove" in
14716 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14717 *)      case "$d_memcpy" in
14718         "$define")
14719                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14720                 $cat >try.c <<EOCP
14721 #$i_memory I_MEMORY
14722 #$i_stdlib I_STDLIB
14723 #$i_string I_STRING
14724 #$i_unistd I_UNISTD
14725 EOCP
14726         $cat >>try.c <<'EOCP'
14727 #include <stdio.h>
14728 #ifdef I_MEMORY
14729 #  include <memory.h>
14730 #endif
14731 #ifdef I_STDLIB
14732 #  include <stdlib.h>
14733 #endif
14734 #ifdef I_STRING
14735 #  include <string.h>
14736 #else
14737 #  include <strings.h>
14738 #endif
14739 #ifdef I_UNISTD
14740 #  include <unistd.h>  /* Needed for NetBSD */
14741 #endif
14742 int main()
14743 {
14744 char buf[128], abc[128];
14745 char *b;
14746 int len;
14747 int off;
14748 int align;
14749
14750 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14751    try to store the string in read-only memory. */
14752 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14753
14754 for (align = 7; align >= 0; align--) {
14755         for (len = 36; len; len--) {
14756                 b = buf+align;
14757                 memcpy(b, abc, len);
14758                 for (off = 1; off <= len; off++) {
14759                         memcpy(b+off, b, len);
14760                         memcpy(b, b+off, len);
14761                         if (memcmp(b, abc, len))
14762                                 exit(1);
14763                 }
14764         }
14765 }
14766 exit(0);
14767 }
14768 EOCP
14769                 set try
14770                 if eval $compile_ok; then
14771                         if ./try 2>/dev/null; then
14772                                 echo "Yes, it can."
14773                                 val="$define"
14774                         else
14775                                 echo "It can't, sorry."
14776                         fi
14777                 else
14778                         echo "(I can't compile the test program, so we'll assume not...)"
14779                 fi
14780                 ;;
14781         esac
14782         $rm -f try.* try core
14783         ;;
14784 esac
14785 set d_safemcpy
14786 eval $setvar
14787
14788 : can memcmp be trusted to compare relative magnitude?
14789 val="$undef"
14790 case "$d_memcmp" in
14791 "$define")
14792         echo " "
14793         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14794         $cat >try.c <<EOCP
14795 #$i_memory I_MEMORY
14796 #$i_stdlib I_STDLIB
14797 #$i_string I_STRING
14798 #$i_unistd I_UNISTD
14799 EOCP
14800         $cat >>try.c <<'EOCP'
14801 #include <stdio.h>
14802 #ifdef I_MEMORY
14803 #  include <memory.h>
14804 #endif
14805 #ifdef I_STDLIB
14806 #  include <stdlib.h>
14807 #endif
14808 #ifdef I_STRING
14809 #  include <string.h>
14810 #else
14811 #  include <strings.h>
14812 #endif
14813 #ifdef I_UNISTD
14814 #  include <unistd.h>  /* Needed for NetBSD */
14815 #endif
14816 int main()
14817 {
14818 char a = -1;
14819 char b = 0;
14820 if ((a < b) && memcmp(&a, &b, 1) < 0)
14821         exit(1);
14822 exit(0);
14823 }
14824 EOCP
14825         set try
14826         if eval $compile_ok; then
14827                 if $run ./try 2>/dev/null; then
14828                         echo "Yes, it can."
14829                         val="$define"
14830                 else
14831                         echo "No, it can't (it uses signed chars)."
14832                 fi
14833         else
14834                 echo "(I can't compile the test program, so we'll assume not...)"
14835         fi
14836         ;;
14837 esac
14838 $rm -f try.* try core
14839 set d_sanemcmp
14840 eval $setvar
14841
14842 : see if prototype for sbrk is available
14843 echo " "
14844 set d_sbrkproto sbrk $i_unistd unistd.h
14845 eval $hasproto
14846
14847 : see if scalbnl exists
14848 set scalbnl d_scalbnl
14849 eval $inlibc
14850
14851 : see if select exists
14852 set select d_select
14853 eval $inlibc
14854
14855 : see if semctl exists
14856 set semctl d_semctl
14857 eval $inlibc
14858
14859 : see if semget exists
14860 set semget d_semget
14861 eval $inlibc
14862
14863 : see if semop exists
14864 set semop d_semop
14865 eval $inlibc
14866
14867 : see how much of the 'sem*(2)' library is present.
14868 h_sem=true
14869 echo " "
14870 case "$d_semctl$d_semget$d_semop" in
14871 *"$undef"*) h_sem=false;;
14872 esac
14873 case "$osname" in
14874 freebsd)
14875     case "`ipcs 2>&1`" in
14876     "SVID messages"*"not configured"*)
14877         echo "Your $osname does not have the sem*(2) configured." >&4
14878         h_sem=false
14879         val="$undef"
14880         set semctl d_semctl
14881         eval $setvar
14882         set semget d_semget
14883         eval $setvar
14884         set semop d_semop
14885         eval $setvar
14886         ;;
14887     esac
14888     ;;
14889 esac
14890 : we could also check for sys/ipc.h ...
14891 if $h_sem && $test `./findhdr sys/sem.h`; then
14892         echo "You have the full sem*(2) library." >&4
14893         val="$define"
14894 else
14895         echo "You don't have the full sem*(2) library." >&4
14896         val="$undef"
14897 fi
14898 set d_sem
14899 eval $setvar
14900
14901 : see whether sys/sem.h defines union semun
14902 echo " "
14903 $cat > try.c <<'END'
14904 #include <sys/types.h>
14905 #include <sys/ipc.h>
14906 #include <sys/sem.h>
14907 int main () { union semun semun; semun.buf = 0; }
14908 END
14909 set try
14910 if eval $compile; then
14911     echo "You have union semun in <sys/sem.h>." >&4
14912     val="$define"
14913 else
14914     echo "You do not have union semun in <sys/sem.h>." >&4
14915     val="$undef"
14916 fi
14917 $rm -f try try.c try.h
14918 set d_union_semun
14919 eval $setvar
14920
14921 : see how to do semctl IPC_STAT
14922 case "$d_sem" in
14923 $define)
14924     : see whether semctl IPC_STAT can use union semun
14925     echo " "
14926     $cat > try.h <<END
14927 #ifndef S_IRUSR
14928 #   ifdef S_IREAD
14929 #       define S_IRUSR S_IREAD
14930 #       define S_IWUSR S_IWRITE
14931 #       define S_IXUSR S_IEXEC
14932 #   else
14933 #       define S_IRUSR 0400
14934 #       define S_IWUSR 0200
14935 #       define S_IXUSR 0100
14936 #   endif
14937 #   define S_IRGRP (S_IRUSR>>3)
14938 #   define S_IWGRP (S_IWUSR>>3)
14939 #   define S_IXGRP (S_IXUSR>>3)
14940 #   define S_IROTH (S_IRUSR>>6)
14941 #   define S_IWOTH (S_IWUSR>>6)
14942 #   define S_IXOTH (S_IXUSR>>6)
14943 #endif
14944 #ifndef S_IRWXU
14945 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14946 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14947 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14948 #endif
14949 END
14950
14951     $cat > try.c <<END
14952 #include <sys/types.h>
14953 #include <sys/ipc.h>
14954 #include <sys/sem.h>
14955 #include <sys/stat.h>
14956 #include <stdio.h>
14957 #include <errno.h>
14958 #include "try.h"
14959 #ifndef errno
14960 extern int errno;
14961 #endif
14962 #$d_union_semun HAS_UNION_SEMUN
14963 int main() {
14964     union semun
14965 #ifndef HAS_UNION_SEMUN
14966     {
14967         int val;
14968         struct semid_ds *buf;
14969         unsigned short *array;
14970     }
14971 #endif
14972     arg;
14973     int sem, st;
14974
14975 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14976     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14977     if (sem > -1) {
14978         struct semid_ds argbuf;
14979         arg.buf = &argbuf;
14980 #       ifdef IPC_STAT
14981         st = semctl(sem, 0, IPC_STAT, arg);
14982         if (st == 0)
14983             printf("semun\n");
14984         else
14985 #       endif /* IPC_STAT */
14986             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14987 #       ifdef IPC_RMID
14988         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14989 #       endif /* IPC_RMID */
14990             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14991     } else
14992 #endif /* IPC_PRIVATE && ... */
14993         printf("semget failed: errno = %d\n", errno);
14994   return 0;
14995 }
14996 END
14997     val="$undef"
14998     set try
14999     if eval $compile; then
15000         xxx=`$run ./try`
15001         case "$xxx" in
15002         semun) val="$define" ;;
15003         esac
15004     fi
15005     $rm -f try try.c
15006     set d_semctl_semun
15007     eval $setvar
15008     case "$d_semctl_semun" in
15009     $define)
15010         echo "You can use union semun for semctl IPC_STAT." >&4
15011         also='also'
15012         ;;
15013     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15014         also=''
15015         ;;
15016     esac
15017
15018     : see whether semctl IPC_STAT can use struct semid_ds pointer
15019     $cat > try.c <<'END'
15020 #include <sys/types.h>
15021 #include <sys/ipc.h>
15022 #include <sys/sem.h>
15023 #include <sys/stat.h>
15024 #include "try.h"
15025 #include <stdio.h>
15026 #include <errno.h>
15027 #ifndef errno
15028 extern int errno;
15029 #endif
15030 int main() {
15031     struct semid_ds arg;
15032     int sem, st;
15033
15034 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15035     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15036     if (sem > -1) {
15037 #       ifdef IPC_STAT
15038         st = semctl(sem, 0, IPC_STAT, &arg);
15039         if (st == 0)
15040             printf("semid_ds\n");
15041         else
15042 #       endif /* IPC_STAT */
15043             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15044 #       ifdef IPC_RMID
15045         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15046 #       endif /* IPC_RMID */
15047             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15048     } else
15049 #endif /* IPC_PRIVATE && ... */
15050         printf("semget failed: errno = %d\n", errno);
15051
15052     return 0;
15053 }
15054 END
15055     val="$undef"
15056     set try
15057     if eval $compile; then
15058         xxx=`$run ./try`
15059         case "$xxx" in
15060         semid_ds) val="$define" ;;
15061         esac
15062     fi
15063     $rm -f try try.c
15064     set d_semctl_semid_ds
15065     eval $setvar
15066     case "$d_semctl_semid_ds" in
15067     $define)
15068         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15069         ;;
15070     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15071         ;;
15072     esac
15073     $rm -f try.h
15074     ;;
15075 *)  val="$undef"
15076
15077     # We do not have the full sem*(2) library, so assume we can not
15078     # use either.
15079
15080     set d_semctl_semun
15081     eval $setvar
15082
15083     set d_semctl_semid_ds
15084     eval $setvar
15085     ;;
15086 esac
15087
15088 : see if sendmsg exists
15089 set sendmsg d_sendmsg
15090 eval $inlibc
15091
15092 : see if setegid exists
15093 set setegid d_setegid
15094 eval $inlibc
15095
15096 : see if seteuid exists
15097 set seteuid d_seteuid
15098 eval $inlibc
15099
15100 : see if setgrent exists
15101 set setgrent d_setgrent
15102 eval $inlibc
15103
15104 : see if setgrent_r exists
15105 set setgrent_r d_setgrent_r
15106 eval $inlibc
15107 case "$d_setgrent_r" in
15108 "$define")
15109         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15110         case "$d_setgrent_r_proto:$usethreads" in
15111         ":define")      d_setgrent_r_proto=define
15112                 set d_setgrent_r_proto setgrent_r $hdrs
15113                 eval $hasproto ;;
15114         *)      ;;
15115         esac
15116         case "$d_setgrent_r_proto" in
15117         define)
15118         case "$setgrent_r_proto" in
15119         ''|0) try='int setgrent_r(FILE**);'
15120         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15121         esac
15122         case "$setgrent_r_proto" in
15123         ''|0) try='void setgrent_r(FILE**);'
15124         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15125         esac
15126         case "$setgrent_r_proto" in
15127         ''|0)   d_setgrent_r=undef
15128                 setgrent_r_proto=0
15129                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15130         * )     case "$setgrent_r_proto" in
15131                 REENTRANT_PROTO*) ;;
15132                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15133                 esac
15134                 echo "Prototype: $try" ;;
15135         esac
15136         ;;
15137         *)      case "$usethreads" in
15138                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15139                 esac
15140                 d_setgrent_r=undef
15141                 setgrent_r_proto=0
15142                 ;;
15143         esac
15144         ;;
15145 *)      setgrent_r_proto=0
15146         ;;
15147 esac
15148
15149 : see if sethostent exists
15150 set sethostent d_sethent
15151 eval $inlibc
15152
15153 : see if sethostent_r exists
15154 set sethostent_r d_sethostent_r
15155 eval $inlibc
15156 case "$d_sethostent_r" in
15157 "$define")
15158         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15159         case "$d_sethostent_r_proto:$usethreads" in
15160         ":define")      d_sethostent_r_proto=define
15161                 set d_sethostent_r_proto sethostent_r $hdrs
15162                 eval $hasproto ;;
15163         *)      ;;
15164         esac
15165         case "$d_sethostent_r_proto" in
15166         define)
15167         case "$sethostent_r_proto" in
15168         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15169         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15170         esac
15171         case "$sethostent_r_proto" in
15172         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15173         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15174         esac
15175         case "$sethostent_r_proto" in
15176         ''|0)   d_sethostent_r=undef
15177                 sethostent_r_proto=0
15178                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15179         * )     case "$sethostent_r_proto" in
15180                 REENTRANT_PROTO*) ;;
15181                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15182                 esac
15183                 echo "Prototype: $try" ;;
15184         esac
15185         ;;
15186         *)      case "$usethreads" in
15187                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15188                 esac
15189                 d_sethostent_r=undef
15190                 sethostent_r_proto=0
15191                 ;;
15192         esac
15193         ;;
15194 *)      sethostent_r_proto=0
15195         ;;
15196 esac
15197
15198 : see if setitimer exists
15199 set setitimer d_setitimer
15200 eval $inlibc
15201
15202 : see if setlinebuf exists
15203 set setlinebuf d_setlinebuf
15204 eval $inlibc
15205
15206 : see if setlocale exists
15207 set setlocale d_setlocale
15208 eval $inlibc
15209
15210 : see if locale.h is available
15211 set locale.h i_locale
15212 eval $inhdr
15213
15214 : see if setlocale_r exists
15215 set setlocale_r d_setlocale_r
15216 eval $inlibc
15217 case "$d_setlocale_r" in
15218 "$define")
15219         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15220         case "$d_setlocale_r_proto:$usethreads" in
15221         ":define")      d_setlocale_r_proto=define
15222                 set d_setlocale_r_proto setlocale_r $hdrs
15223                 eval $hasproto ;;
15224         *)      ;;
15225         esac
15226         case "$d_setlocale_r_proto" in
15227         define)
15228         case "$setlocale_r_proto" in
15229         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15230         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15231         esac
15232         case "$setlocale_r_proto" in
15233         ''|0)   d_setlocale_r=undef
15234                 setlocale_r_proto=0
15235                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15236         * )     case "$setlocale_r_proto" in
15237                 REENTRANT_PROTO*) ;;
15238                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15239                 esac
15240                 echo "Prototype: $try" ;;
15241         esac
15242         ;;
15243         *)      case "$usethreads" in
15244                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15245                 esac
15246                 d_setlocale_r=undef
15247                 setlocale_r_proto=0
15248                 ;;
15249         esac
15250         ;;
15251 *)      setlocale_r_proto=0
15252         ;;
15253 esac
15254
15255 : see if setnetent exists
15256 set setnetent d_setnent
15257 eval $inlibc
15258
15259 : see if setnetent_r exists
15260 set setnetent_r d_setnetent_r
15261 eval $inlibc
15262 case "$d_setnetent_r" in
15263 "$define")
15264         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15265         case "$d_setnetent_r_proto:$usethreads" in
15266         ":define")      d_setnetent_r_proto=define
15267                 set d_setnetent_r_proto setnetent_r $hdrs
15268                 eval $hasproto ;;
15269         *)      ;;
15270         esac
15271         case "$d_setnetent_r_proto" in
15272         define)
15273         case "$setnetent_r_proto" in
15274         ''|0) try='int setnetent_r(int, struct netent_data*);'
15275         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15276         esac
15277         case "$setnetent_r_proto" in
15278         ''|0) try='void setnetent_r(int, struct netent_data*);'
15279         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15280         esac
15281         case "$setnetent_r_proto" in
15282         ''|0)   d_setnetent_r=undef
15283                 setnetent_r_proto=0
15284                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15285         * )     case "$setnetent_r_proto" in
15286                 REENTRANT_PROTO*) ;;
15287                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15288                 esac
15289                 echo "Prototype: $try" ;;
15290         esac
15291         ;;
15292         *)      case "$usethreads" in
15293                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15294                 esac
15295                 d_setnetent_r=undef
15296                 setnetent_r_proto=0
15297                 ;;
15298         esac
15299         ;;
15300 *)      setnetent_r_proto=0
15301         ;;
15302 esac
15303
15304 : see if setprotoent exists
15305 set setprotoent d_setpent
15306 eval $inlibc
15307
15308 : see if setpgid exists
15309 set setpgid d_setpgid
15310 eval $inlibc
15311
15312 : see if setpgrp2 exists
15313 set setpgrp2 d_setpgrp2
15314 eval $inlibc
15315
15316 : see if setpriority exists
15317 set setpriority d_setprior
15318 eval $inlibc
15319
15320 : see if setproctitle exists
15321 set setproctitle d_setproctitle
15322 eval $inlibc
15323
15324 : see if setprotoent_r exists
15325 set setprotoent_r d_setprotoent_r
15326 eval $inlibc
15327 case "$d_setprotoent_r" in
15328 "$define")
15329         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15330         case "$d_setprotoent_r_proto:$usethreads" in
15331         ":define")      d_setprotoent_r_proto=define
15332                 set d_setprotoent_r_proto setprotoent_r $hdrs
15333                 eval $hasproto ;;
15334         *)      ;;
15335         esac
15336         case "$d_setprotoent_r_proto" in
15337         define)
15338         case "$setprotoent_r_proto" in
15339         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15340         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15341         esac
15342         case "$setprotoent_r_proto" in
15343         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15344         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15345         esac
15346         case "$setprotoent_r_proto" in
15347         ''|0)   d_setprotoent_r=undef
15348                 setprotoent_r_proto=0
15349                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15350         * )     case "$setprotoent_r_proto" in
15351                 REENTRANT_PROTO*) ;;
15352                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15353                 esac
15354                 echo "Prototype: $try" ;;
15355         esac
15356         ;;
15357         *)      case "$usethreads" in
15358                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15359                 esac
15360                 d_setprotoent_r=undef
15361                 setprotoent_r_proto=0
15362                 ;;
15363         esac
15364         ;;
15365 *)      setprotoent_r_proto=0
15366         ;;
15367 esac
15368
15369 : see if setpwent exists
15370 set setpwent d_setpwent
15371 eval $inlibc
15372
15373 : see if setpwent_r exists
15374 set setpwent_r d_setpwent_r
15375 eval $inlibc
15376 case "$d_setpwent_r" in
15377 "$define")
15378         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15379         case "$d_setpwent_r_proto:$usethreads" in
15380         ":define")      d_setpwent_r_proto=define
15381                 set d_setpwent_r_proto setpwent_r $hdrs
15382                 eval $hasproto ;;
15383         *)      ;;
15384         esac
15385         case "$d_setpwent_r_proto" in
15386         define)
15387         case "$setpwent_r_proto" in
15388         ''|0) try='int setpwent_r(FILE**);'
15389         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15390         esac
15391         case "$setpwent_r_proto" in
15392         ''|0) try='void setpwent_r(FILE**);'
15393         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15394         esac
15395         case "$setpwent_r_proto" in
15396         ''|0)   d_setpwent_r=undef
15397                 setpwent_r_proto=0
15398                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15399         * )     case "$setpwent_r_proto" in
15400                 REENTRANT_PROTO*) ;;
15401                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15402                 esac
15403                 echo "Prototype: $try" ;;
15404         esac
15405         ;;
15406         *)      case "$usethreads" in
15407                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15408                 esac
15409                 d_setpwent_r=undef
15410                 setpwent_r_proto=0
15411                 ;;
15412         esac
15413         ;;
15414 *)      setpwent_r_proto=0
15415         ;;
15416 esac
15417
15418 : see if setregid exists
15419 set setregid d_setregid
15420 eval $inlibc
15421 set setresgid d_setresgid
15422 eval $inlibc
15423
15424 : see if setreuid exists
15425 set setreuid d_setreuid
15426 eval $inlibc
15427 set setresuid d_setresuid
15428 eval $inlibc
15429
15430 : see if setrgid exists
15431 set setrgid d_setrgid
15432 eval $inlibc
15433
15434 : see if setruid exists
15435 set setruid d_setruid
15436 eval $inlibc
15437
15438 : see if setservent exists
15439 set setservent d_setsent
15440 eval $inlibc
15441
15442 : see if setservent_r exists
15443 set setservent_r d_setservent_r
15444 eval $inlibc
15445 case "$d_setservent_r" in
15446 "$define")
15447         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15448         case "$d_setservent_r_proto:$usethreads" in
15449         ":define")      d_setservent_r_proto=define
15450                 set d_setservent_r_proto setservent_r $hdrs
15451                 eval $hasproto ;;
15452         *)      ;;
15453         esac
15454         case "$d_setservent_r_proto" in
15455         define)
15456         case "$setservent_r_proto" in
15457         ''|0) try='int setservent_r(int, struct servent_data*);'
15458         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15459         esac
15460         case "$setservent_r_proto" in
15461         ''|0) try='void setservent_r(int, struct servent_data*);'
15462         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15463         esac
15464         case "$setservent_r_proto" in
15465         ''|0)   d_setservent_r=undef
15466                 setservent_r_proto=0
15467                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15468         * )     case "$setservent_r_proto" in
15469                 REENTRANT_PROTO*) ;;
15470                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15471                 esac
15472                 echo "Prototype: $try" ;;
15473         esac
15474         ;;
15475         *)      case "$usethreads" in
15476                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15477                 esac
15478                 d_setservent_r=undef
15479                 setservent_r_proto=0
15480                 ;;
15481         esac
15482         ;;
15483 *)      setservent_r_proto=0
15484         ;;
15485 esac
15486
15487 : see if setsid exists
15488 set setsid d_setsid
15489 eval $inlibc
15490
15491 : see if setvbuf exists
15492 set setvbuf d_setvbuf
15493 eval $inlibc
15494
15495 : see if sfio.h is available
15496 set sfio.h i_sfio
15497 eval $inhdr
15498
15499
15500 : see if sfio library is available
15501 case "$i_sfio" in
15502 $define)
15503         val=''
15504         set sfreserve val
15505         eval $inlibc
15506         ;;
15507 *)
15508         val="$undef"
15509         ;;
15510 esac
15511 : Ok, but do we want to use it.
15512 case "$val" in
15513 $define)
15514         case "$usesfio" in
15515         true|$define|[yY]*) dflt='y';;
15516         *) dflt='n';;
15517         esac
15518         echo "$package can use the sfio library, but it is experimental."
15519         case "$useperlio" in
15520         "$undef")
15521             echo "For sfio also the PerlIO abstraction layer is needed."
15522             echo "Earlier you said you wouldn't want that."
15523             ;;
15524         esac
15525         rp="You seem to have sfio available, do you want to try using it?"
15526         . ./myread
15527         case "$ans" in
15528         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15529                 useperlio="$define"
15530                 val="$define"
15531                 ;;
15532         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15533                 val="$undef"
15534                 ;;
15535         esac
15536         ;;
15537 *)      case "$usesfio" in
15538         true|$define|[yY]*)
15539                 echo "Sorry, cannot find sfio on this machine." >&4
15540                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15541                 val="$undef"
15542                 ;;
15543         esac
15544         ;;
15545 esac
15546 set d_sfio
15547 eval $setvar
15548 case "$d_sfio" in
15549 $define) usesfio='true';;
15550 *) usesfio='false';;
15551 esac
15552 case "$d_sfio" in
15553 $define) ;;
15554 *)      : Remove sfio from list of libraries to use
15555         case "$libs" in
15556         *-lsfio*)
15557                 echo "Removing unneeded -lsfio from library list" >&4
15558                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15559                 shift
15560                 libs="$*"
15561                 echo "libs = $libs" >&4
15562                 ;;
15563         esac
15564 ;;
15565 esac
15566
15567
15568 : see if shmctl exists
15569 set shmctl d_shmctl
15570 eval $inlibc
15571
15572 : see if shmget exists
15573 set shmget d_shmget
15574 eval $inlibc
15575
15576 : see if shmat exists
15577 set shmat d_shmat
15578 eval $inlibc
15579 : see what shmat returns
15580 case "$d_shmat" in
15581 "$define")
15582         $cat >shmat.c <<'END'
15583 #include <sys/shm.h>
15584 void *shmat();
15585 END
15586         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15587                 shmattype='void *'
15588         else
15589                 shmattype='char *'
15590         fi
15591         echo "and it returns ($shmattype)." >&4
15592         : see if a prototype for shmat is available
15593         xxx=`./findhdr sys/shm.h`
15594         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15595         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15596                 val="$define"
15597         else
15598                 val="$undef"
15599         fi
15600         $rm -f shmat.[co]
15601         ;;
15602 *)
15603         val="$undef"
15604         ;;
15605 esac
15606 set d_shmatprototype
15607 eval $setvar
15608
15609 : see if shmdt exists
15610 set shmdt d_shmdt
15611 eval $inlibc
15612
15613 : see how much of the 'shm*(2)' library is present.
15614 h_shm=true
15615 echo " "
15616 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15617 *"$undef"*) h_shm=false;;
15618 esac
15619 case "$osname" in
15620 freebsd)
15621     case "`ipcs 2>&1`" in
15622     "SVID shared memory"*"not configured"*)
15623         echo "Your $osname does not have the shm*(2) configured." >&4
15624         h_shm=false
15625         val="$undef"
15626         set shmctl d_shmctl
15627         evat $setvar
15628         set shmget d_shmget
15629         evat $setvar
15630         set shmat d_shmat
15631         evat $setvar
15632         set shmdt d_shmdt
15633         evat $setvar
15634         ;;
15635     esac
15636     ;;
15637 esac
15638 : we could also check for sys/ipc.h ...
15639 if $h_shm && $test `./findhdr sys/shm.h`; then
15640         echo "You have the full shm*(2) library." >&4
15641         val="$define"
15642 else
15643         echo "You don't have the full shm*(2) library." >&4
15644         val="$undef"
15645 fi
15646 set d_shm
15647 eval $setvar
15648
15649 echo " "
15650 : see if we have sigaction
15651 if set sigaction val -f d_sigaction; eval $csym; $val; then
15652         echo 'sigaction() found.' >&4
15653         $cat > try.c <<EOP
15654 #include <stdio.h>
15655 #include <sys/types.h>
15656 #include <signal.h>
15657 #$i_stdlib I_STDLIB
15658 #ifdef I_STDLIB
15659 #include <stdlib.h>
15660 #endif
15661 int main()
15662 {
15663     struct sigaction act, oact;
15664     act.sa_flags = 0;
15665     oact.sa_handler = 0;
15666     /* so that act and oact are used */
15667     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15668 }
15669 EOP
15670         set try
15671         if eval $compile_ok; then
15672                 val="$define"
15673         else
15674                 echo "But you don't seem to have a useable struct sigaction." >&4
15675                 val="$undef"
15676         fi
15677 else
15678         echo 'sigaction NOT found.' >&4
15679         val="$undef"
15680 fi
15681 set d_sigaction; eval $setvar
15682 $rm -f try try$_o try.c
15683
15684 : see if sigprocmask exists
15685 set sigprocmask d_sigprocmask
15686 eval $inlibc
15687
15688 : see if sigsetjmp exists
15689 echo " "
15690 case "$d_sigsetjmp" in
15691 '')
15692         $cat >try.c <<EOP
15693 #include <setjmp.h>
15694 #$i_stdlib I_STDLIB
15695 #ifdef I_STDLIB
15696 #include <stdlib.h>
15697 #endif
15698 sigjmp_buf env;
15699 int set = 1;
15700 int main()
15701 {
15702         if (sigsetjmp(env,1))
15703                 exit(set);
15704         set = 0;
15705         siglongjmp(env, 1);
15706         exit(1);
15707 }
15708 EOP
15709         set try
15710         if eval $compile; then
15711                 if $run ./try >/dev/null 2>&1; then
15712                         echo "POSIX sigsetjmp found." >&4
15713                         val="$define"
15714                 else
15715                         $cat >&4 <<EOM
15716 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15717 I'll ignore them.
15718 EOM
15719                         val="$undef"
15720                 fi
15721         else
15722                 echo "sigsetjmp not found." >&4
15723                 val="$undef"
15724         fi
15725         ;;
15726 *) val="$d_sigsetjmp"
15727         case "$d_sigsetjmp" in
15728         $define) echo "POSIX sigsetjmp found." >&4;;
15729         $undef) echo "sigsetjmp not found." >&4;;
15730         esac
15731         ;;
15732 esac
15733 set d_sigsetjmp
15734 eval $setvar
15735 $rm -f try.c try
15736
15737 : see if sockatmark exists
15738 set sockatmark d_sockatmark
15739 eval $inlibc
15740
15741 : see if prototype for sockatmark is available
15742 echo " "
15743 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15744 eval $hasproto
15745
15746 : see if socks5_init exists
15747 set socks5_init d_socks5_init
15748 eval $inlibc
15749
15750 : see if srand48_r exists
15751 set srand48_r d_srand48_r
15752 eval $inlibc
15753 case "$d_srand48_r" in
15754 "$define")
15755         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15756         case "$d_srand48_r_proto:$usethreads" in
15757         ":define")      d_srand48_r_proto=define
15758                 set d_srand48_r_proto srand48_r $hdrs
15759                 eval $hasproto ;;
15760         *)      ;;
15761         esac
15762         case "$d_srand48_r_proto" in
15763         define)
15764         case "$srand48_r_proto" in
15765         ''|0) try='int srand48_r(long, struct drand48_data*);'
15766         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15767         esac
15768         case "$srand48_r_proto" in
15769         ''|0)   d_srand48_r=undef
15770                 srand48_r_proto=0
15771                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15772         * )     case "$srand48_r_proto" in
15773                 REENTRANT_PROTO*) ;;
15774                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15775                 esac
15776                 echo "Prototype: $try" ;;
15777         esac
15778         ;;
15779         *)      case "$usethreads" in
15780                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15781                 esac
15782                 d_srand48_r=undef
15783                 srand48_r_proto=0
15784                 ;;
15785         esac
15786         ;;
15787 *)      srand48_r_proto=0
15788         ;;
15789 esac
15790
15791 : see if srandom_r exists
15792 set srandom_r d_srandom_r
15793 eval $inlibc
15794 case "$d_srandom_r" in
15795 "$define")
15796         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15797         case "$d_srandom_r_proto:$usethreads" in
15798         ":define")      d_srandom_r_proto=define
15799                 set d_srandom_r_proto srandom_r $hdrs
15800                 eval $hasproto ;;
15801         *)      ;;
15802         esac
15803         case "$d_srandom_r_proto" in
15804         define)
15805         case "$srandom_r_proto" in
15806         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15807         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15808         esac
15809         case "$srandom_r_proto" in
15810         ''|0)   d_srandom_r=undef
15811                 srandom_r_proto=0
15812                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15813         * )     case "$srandom_r_proto" in
15814                 REENTRANT_PROTO*) ;;
15815                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15816                 esac
15817                 echo "Prototype: $try" ;;
15818         esac
15819         ;;
15820         *)      case "$usethreads" in
15821                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15822                 esac
15823                 d_srandom_r=undef
15824                 srandom_r_proto=0
15825                 ;;
15826         esac
15827         ;;
15828 *)      srandom_r_proto=0
15829         ;;
15830 esac
15831
15832 : see if prototype for setresgid is available
15833 echo " "
15834 set d_sresgproto setresgid $i_unistd unistd.h
15835 eval $hasproto
15836
15837 : see if prototype for setresuid is available
15838 echo " "
15839 set d_sresuproto setresuid $i_unistd unistd.h
15840 eval $hasproto
15841
15842 : see if sys/stat.h is available
15843 set sys/stat.h i_sysstat
15844 eval $inhdr
15845
15846
15847 : see if stat knows about block sizes
15848 echo " "
15849 echo "Checking to see if your struct stat has st_blocks field..." >&4
15850 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15851 eval $hasfield
15852
15853
15854 : see if this is a sys/vfs.h system
15855 set sys/vfs.h i_sysvfs
15856 eval $inhdr
15857
15858
15859 : see if this is a sys/statfs.h system
15860 set sys/statfs.h i_sysstatfs
15861 eval $inhdr
15862
15863
15864 echo " "
15865 echo "Checking to see if your system supports struct statfs..." >&4
15866 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
15867 eval $hasstruct
15868 case "$d_statfs_s" in
15869 "$define")      echo "Yes, it does."   ;;
15870 *)              echo "No, it doesn't." ;;
15871 esac
15872
15873
15874
15875 : see if struct statfs knows about f_flags
15876 case "$d_statfs_s" in
15877 define) 
15878         echo " "
15879         echo "Checking to see if your struct statfs has f_flags field..." >&4
15880         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
15881         eval $hasfield
15882         ;;
15883 *)      val="$undef"
15884         set d_statfs_f_flags
15885         eval $setvar
15886         ;;
15887 esac
15888 case "$d_statfs_f_flags" in
15889 "$define")      echo "Yes, it does."   ;;
15890 *)              echo "No, it doesn't." ;;
15891 esac
15892
15893 : see if _ptr and _cnt from stdio act std
15894 echo " "
15895
15896 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15897         echo "(Looks like you have stdio.h from BSD.)"
15898         case "$stdio_ptr" in
15899         '') stdio_ptr='((fp)->_p)'
15900                 ptr_lval=$define
15901                 ;;
15902         *)      ptr_lval=$d_stdio_ptr_lval;;
15903         esac
15904         case "$stdio_cnt" in
15905         '') stdio_cnt='((fp)->_r)'
15906                 cnt_lval=$define
15907                 ;;
15908         *)      cnt_lval=$d_stdio_cnt_lval;;
15909         esac
15910         case "$stdio_base" in
15911         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15912         esac
15913         case "$stdio_bufsiz" in
15914         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15915         esac
15916 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15917         echo "(Looks like you have stdio.h from Linux.)"
15918         case "$stdio_ptr" in
15919         '') stdio_ptr='((fp)->_IO_read_ptr)'
15920                 ptr_lval=$define
15921                 ;;
15922         *)      ptr_lval=$d_stdio_ptr_lval;;
15923         esac
15924         case "$stdio_cnt" in
15925         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15926                 cnt_lval=$undef
15927                 ;;
15928         *)      cnt_lval=$d_stdio_cnt_lval;;
15929         esac
15930         case "$stdio_base" in
15931         '') stdio_base='((fp)->_IO_read_base)';;
15932         esac
15933         case "$stdio_bufsiz" in
15934         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15935         esac
15936 else
15937         case "$stdio_ptr" in
15938         '') stdio_ptr='((fp)->_ptr)'
15939                 ptr_lval=$define
15940                 ;;
15941         *)      ptr_lval=$d_stdio_ptr_lval;;
15942         esac
15943         case "$stdio_cnt" in
15944         '') stdio_cnt='((fp)->_cnt)'
15945                 cnt_lval=$define
15946                 ;;
15947         *)      cnt_lval=$d_stdio_cnt_lval;;
15948         esac
15949         case "$stdio_base" in
15950         '') stdio_base='((fp)->_base)';;
15951         esac
15952         case "$stdio_bufsiz" in
15953         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15954         esac
15955 fi
15956
15957 : test whether _ptr and _cnt really work
15958 echo "Checking how std your stdio is..." >&4
15959 $cat >try.c <<EOP
15960 #include <stdio.h>
15961 #$i_stdlib I_STDLIB
15962 #ifdef I_STDLIB
15963 #include <stdlib.h>
15964 #endif
15965 #define FILE_ptr(fp)    $stdio_ptr
15966 #define FILE_cnt(fp)    $stdio_cnt
15967 int main() {
15968         FILE *fp = fopen("try.c", "r");
15969         char c = getc(fp);
15970         if (
15971                 18 <= FILE_cnt(fp) &&
15972                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15973         )
15974                 exit(0);
15975         exit(1);
15976 }
15977 EOP
15978 val="$undef"
15979 set try
15980 if eval $compile && $to try.c; then
15981         if $run ./try; then
15982                 echo "Your stdio acts pretty std."
15983                 val="$define"
15984         else
15985                 echo "Your stdio isn't very std."
15986         fi
15987 else
15988         echo "Your stdio doesn't appear very std."
15989 fi
15990 $rm -f try.c try
15991
15992 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15993 # direct buffer manipulation no longer works.  The Configure tests
15994 # should be changed to correctly detect this, but until then,
15995 # the following check should at least let perl compile and run.
15996 # (This quick fix should be updated before 5.8.1.)
15997 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15998 # A. Dougherty, June 3, 2002.
15999 case "$d_gnulibc" in
16000 $define)
16001         case "$gnulibc_version" in
16002         2.[01]*)  ;;
16003         2.2) ;;
16004         2.2.[0-9]) ;;
16005         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
16006                 val="$undef"
16007                 ;;
16008         esac
16009         ;;
16010 esac
16011 set d_stdstdio
16012 eval $setvar
16013
16014 : Can _ptr be used as an lvalue?
16015 case "$d_stdstdio$ptr_lval" in
16016 $define$define) val=$define ;;
16017 *) val=$undef ;;
16018 esac
16019 set d_stdio_ptr_lval
16020 eval $setvar
16021
16022 : Can _cnt be used as an lvalue?
16023 case "$d_stdstdio$cnt_lval" in
16024 $define$define) val=$define ;;
16025 *) val=$undef ;;
16026 esac
16027 set d_stdio_cnt_lval
16028 eval $setvar
16029
16030
16031 : test whether setting _ptr sets _cnt as a side effect
16032 d_stdio_ptr_lval_sets_cnt="$undef"
16033 d_stdio_ptr_lval_nochange_cnt="$undef"
16034 case "$d_stdio_ptr_lval$d_stdstdio" in
16035 $define$define)
16036         echo "Checking to see what happens if we set the stdio ptr..." >&4
16037 $cat >try.c <<EOP
16038 #include <stdio.h>
16039 /* Can we scream? */
16040 /* Eat dust sed :-) */
16041 /* In the buffer space, no one can hear you scream. */
16042 #$i_stdlib I_STDLIB
16043 #ifdef I_STDLIB
16044 #include <stdlib.h>
16045 #endif
16046 #define FILE_ptr(fp)    $stdio_ptr
16047 #define FILE_cnt(fp)    $stdio_cnt
16048 #include <sys/types.h>
16049 int main() {
16050         FILE *fp = fopen("try.c", "r");
16051         int c;
16052         char *ptr;
16053         size_t cnt;
16054         if (!fp) {
16055             puts("Fail even to read");
16056             exit(1);
16057         }
16058         c = getc(fp); /* Read away the first # */
16059         if (c == EOF) {
16060             puts("Fail even to read");
16061             exit(1);
16062         }
16063         if (!(
16064                 18 <= FILE_cnt(fp) &&
16065                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
16066         )) {
16067                 puts("Fail even to read");
16068                 exit (1);
16069         }
16070         ptr = (char*) FILE_ptr(fp);
16071         cnt = (size_t)FILE_cnt(fp);
16072
16073         FILE_ptr(fp) += 42;
16074
16075         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
16076                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
16077                 exit (1);
16078         }
16079         if (FILE_cnt(fp) <= 20) {
16080                 printf ("Fail (<20 chars to test)");
16081                 exit (1);
16082         }
16083         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
16084                 puts("Fail compare");
16085                 exit (1);
16086         }
16087         if (cnt == FILE_cnt(fp)) {
16088                 puts("Pass_unchanged");
16089                 exit (0);
16090         }       
16091         if (FILE_cnt(fp) == (cnt - 42)) {
16092                 puts("Pass_changed");
16093                 exit (0);
16094         }
16095         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
16096         return 1;
16097
16098 }
16099 EOP
16100         set try
16101         if eval $compile && $to try.c; then
16102                 case `$run ./try` in
16103                 Pass_changed)
16104                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
16105                         d_stdio_ptr_lval_sets_cnt="$define" ;;
16106                 Pass_unchanged)
16107                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
16108                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
16109                 Fail*)
16110                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
16111                 *)
16112                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
16113         esac
16114         else
16115                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
16116         fi
16117         $rm -f try.c try
16118         ;;
16119 esac
16120
16121 : see if _base is also standard
16122 val="$undef"
16123 case "$d_stdstdio" in
16124 $define)
16125         $cat >try.c <<EOP
16126 #include <stdio.h>
16127 #$i_stdlib I_STDLIB
16128 #ifdef I_STDLIB
16129 #include <stdlib.h>
16130 #endif
16131 #define FILE_base(fp)   $stdio_base
16132 #define FILE_bufsiz(fp) $stdio_bufsiz
16133 int main() {
16134         FILE *fp = fopen("try.c", "r");
16135         char c = getc(fp);
16136         if (
16137                 19 <= FILE_bufsiz(fp) &&
16138                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
16139         )
16140                 exit(0);
16141         exit(1);
16142 }
16143 EOP
16144         set try
16145         if eval $compile && $to try.c; then
16146                 if $run ./try; then
16147                         echo "And its _base field acts std."
16148                         val="$define"
16149                 else
16150                         echo "But its _base field isn't std."
16151                 fi
16152         else
16153                 echo "However, it seems to be lacking the _base field."
16154         fi
16155         $rm -f try.c try
16156         ;;
16157 esac
16158 set d_stdiobase
16159 eval $setvar
16160
16161 $cat >&4 <<EOM
16162 Checking how to access stdio streams by file descriptor number...
16163 EOM
16164 case "$stdio_stream_array" in
16165 '')     $cat >try.c <<EOCP
16166 #include <stdio.h>
16167 int main() {
16168   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16169     printf("yes\n");
16170 }
16171 EOCP
16172         for s in _iob __iob __sF
16173         do
16174                 set try -DSTDIO_STREAM_ARRAY=$s
16175                 if eval $compile; then
16176                         case "`$run ./try`" in
16177                         yes)    stdio_stream_array=$s; break ;;
16178                         esac
16179                 fi
16180         done
16181         $rm -f try.* try$exe_ext
16182 esac
16183 case "$stdio_stream_array" in
16184 '')     $cat >&4 <<EOM
16185 I can't figure out how to access stdio streams by file descriptor number.
16186 EOM
16187         d_stdio_stream_array="$undef"
16188         ;;
16189 *)      $cat >&4 <<EOM
16190 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16191 EOM
16192         d_stdio_stream_array="$define"
16193         ;;
16194 esac
16195
16196 : see if strcoll exists
16197 set strcoll d_strcoll
16198 eval $inlibc
16199
16200 : check for structure copying
16201 echo " "
16202 echo "Checking to see if your C compiler can copy structs..." >&4
16203 $cat >try.c <<'EOCP'
16204 int main()
16205 {
16206         struct blurfl {
16207                 int dyick;
16208         } foo, bar;
16209
16210         foo = bar;
16211 }
16212 EOCP
16213 if $cc -c try.c >/dev/null 2>&1 ; then
16214         val="$define"
16215         echo "Yup, it can."
16216 else
16217         val="$undef"
16218         echo "Nope, it can't."
16219 fi
16220 set d_strctcpy
16221 eval $setvar
16222 $rm -f try.*
16223
16224 : see if strerror and/or sys_errlist[] exist
16225 echo " "
16226 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16227     if set strerror val -f d_strerror; eval $csym; $val; then
16228                 echo 'strerror() found.' >&4
16229                 d_strerror="$define"
16230                 d_strerrm='strerror(e)'
16231                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16232                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16233                         d_syserrlst="$define"
16234                 else
16235                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16236                         d_syserrlst="$undef"
16237                 fi
16238     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16239                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16240                 echo 'strerror() found in string header.' >&4
16241                 d_strerror="$define"
16242                 d_strerrm='strerror(e)'
16243                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16244                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16245                                 d_syserrlst="$define"
16246                 else
16247                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16248                         d_syserrlst="$undef"
16249                 fi
16250     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16251                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16252                 d_strerror="$undef"
16253                 d_syserrlst="$define"
16254                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16255     else
16256                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16257                 d_strerror="$undef"
16258                 d_syserrlst="$undef"
16259                 d_strerrm='"unknown"'
16260     fi
16261 fi
16262
16263 : see if strerror_r exists
16264 set strerror_r d_strerror_r
16265 eval $inlibc
16266 case "$d_strerror_r" in
16267 "$define")
16268         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16269         case "$d_strerror_r_proto:$usethreads" in
16270         ":define")      d_strerror_r_proto=define
16271                 set d_strerror_r_proto strerror_r $hdrs
16272                 eval $hasproto ;;
16273         *)      ;;
16274         esac
16275         case "$d_strerror_r_proto" in
16276         define)
16277         case "$strerror_r_proto" in
16278         ''|0) try='int strerror_r(int, char*, size_t);'
16279         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16280         esac
16281         case "$strerror_r_proto" in
16282         ''|0) try='int strerror_r(int, char*, int);'
16283         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16284         esac
16285         case "$strerror_r_proto" in
16286         ''|0) try='char* strerror_r(int, char*, size_t);'
16287         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16288         esac
16289         case "$strerror_r_proto" in
16290         ''|0)   d_strerror_r=undef
16291                 strerror_r_proto=0
16292                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16293         * )     case "$strerror_r_proto" in
16294                 REENTRANT_PROTO*) ;;
16295                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16296                 esac
16297                 echo "Prototype: $try" ;;
16298         esac
16299         ;;
16300         *)      case "$usethreads" in
16301                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16302                 esac
16303                 d_strerror_r=undef
16304                 strerror_r_proto=0
16305                 ;;
16306         esac
16307         ;;
16308 *)      strerror_r_proto=0
16309         ;;
16310 esac
16311
16312 : see if strftime exists
16313 set strftime d_strftime
16314 eval $inlibc
16315
16316 : see if strtod exists
16317 set strtod d_strtod
16318 eval $inlibc
16319
16320 : see if strtol exists
16321 set strtol d_strtol
16322 eval $inlibc
16323
16324 : see if strtold exists
16325 set strtold d_strtold
16326 eval $inlibc
16327
16328 : see if strtoll exists
16329 set strtoll d_strtoll
16330 eval $inlibc
16331
16332 case "$d_longlong-$d_strtoll" in
16333 "$define-$define")
16334         $cat <<EOM
16335 Checking whether your strtoll() works okay...
16336 EOM
16337         $cat >try.c <<'EOCP'
16338 #include <errno.h>
16339 #ifdef __hpux
16340 #define strtoll __strtoll
16341 #endif
16342 #ifdef __EMX__
16343 #define strtoll _strtoll
16344 #endif
16345 #include <stdio.h>
16346 extern long long int strtoll(char *s, char **, int); 
16347 static int bad = 0;
16348 int check(char *s, long long ell, int een) {
16349         long long gll;
16350         errno = 0;
16351         gll = strtoll(s, 0, 10);
16352         if (!((gll == ell) && (errno == een)))
16353                 bad++;
16354 }
16355 int main() {
16356         check(" 1",                                      1LL, 0);
16357         check(" 0",                                      0LL, 0);
16358         check("-1",                                     -1LL, 0);
16359         check("-9223372036854775808", -9223372036854775808LL, 0);
16360         check("-9223372036854775808", -9223372036854775808LL, 0);
16361         check(" 9223372036854775807",  9223372036854775807LL, 0);
16362         check("-9223372036854775808", -9223372036854775808LL, 0);
16363         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16364         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16365         if (!bad)
16366                 printf("ok\n");
16367 }
16368 EOCP
16369         set try
16370         if eval $compile; then
16371                 yyy=`$run ./try`
16372                 case "$yyy" in
16373                 ok) echo "Your strtoll() seems to be working okay." ;;
16374                 *) cat <<EOM >&4
16375 Your strtoll() doesn't seem to be working okay.
16376 EOM
16377                    d_strtoll="$undef"
16378                    ;;
16379                 esac
16380         else
16381                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16382                 d_strtoll="$undef"
16383         fi
16384         ;;
16385 esac
16386
16387 : see if strtoq exists
16388 set strtoq d_strtoq
16389 eval $inlibc
16390
16391 : see if strtoul exists
16392 set strtoul d_strtoul
16393 eval $inlibc
16394
16395 case "$d_strtoul" in
16396 "$define")
16397         $cat <<EOM
16398 Checking whether your strtoul() works okay...
16399 EOM
16400         $cat >try.c <<'EOCP'
16401 #include <errno.h>
16402 #include <stdio.h>
16403 extern unsigned long int strtoul(char *s, char **, int); 
16404 static int bad = 0;
16405 void check(char *s, unsigned long eul, int een) {
16406         unsigned long gul;
16407         errno = 0;
16408         gul = strtoul(s, 0, 10);
16409         if (!((gul == eul) && (errno == een)))
16410                 bad++;
16411 }
16412 int main() {
16413         check(" 1", 1L, 0);
16414         check(" 0", 0L, 0);
16415 EOCP
16416         case "$longsize" in
16417         8)
16418             $cat >>try.c <<'EOCP'
16419         check("18446744073709551615", 18446744073709551615UL, 0);
16420         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16421 #if 0 /* strtoul() for /^-/ strings is undefined. */
16422         check("-1", 18446744073709551615UL, 0);
16423         check("-18446744073709551614", 2, 0);
16424         check("-18446744073709551615", 1, 0);
16425         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16426         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16427 #endif
16428 EOCP
16429                 ;;
16430         4)
16431                     $cat >>try.c <<'EOCP'
16432         check("4294967295", 4294967295UL, 0);
16433         check("4294967296", 4294967295UL, ERANGE);
16434 #if 0 /* strtoul() for /^-/ strings is undefined. */
16435         check("-1", 4294967295UL, 0);
16436         check("-4294967294", 2, 0);
16437         check("-4294967295", 1, 0);
16438         check("-4294967296", 4294967295UL, ERANGE);
16439         check("-4294967297", 4294967295UL, ERANGE);
16440 #endif
16441 EOCP
16442                 ;;
16443         *)
16444 : Should we write these tests to be more portable by sprintf-ing
16445 : ~0 and then manipulating that char string as input for strtol?
16446                 ;;
16447         esac
16448         $cat >>try.c <<'EOCP'
16449         if (!bad)
16450                 printf("ok\n");
16451         return 0;
16452 }
16453 EOCP
16454         set try
16455         if eval $compile; then
16456                 case "`$run ./try`" in
16457                 ok) echo "Your strtoul() seems to be working okay." ;;
16458                 *) cat <<EOM >&4
16459 Your strtoul() doesn't seem to be working okay.
16460 EOM
16461                    d_strtoul="$undef"
16462                    ;;
16463                 esac
16464         fi
16465         ;;
16466 esac
16467
16468 : see if strtoull exists
16469 set strtoull d_strtoull
16470 eval $inlibc
16471
16472 case "$d_longlong-$d_strtoull" in
16473 "$define-$define")
16474         $cat <<EOM
16475 Checking whether your strtoull() works okay...
16476 EOM
16477         $cat >try.c <<'EOCP'
16478 #include <errno.h>
16479 #ifdef __hpux
16480 #define strtoull __strtoull
16481 #endif
16482 #include <stdio.h>
16483 extern unsigned long long int strtoull(char *s, char **, int); 
16484 static int bad = 0;
16485 int check(char *s, long long eull, int een) {
16486         long long gull;
16487         errno = 0;
16488         gull = strtoull(s, 0, 10);
16489         if (!((gull == eull) && (errno == een)))
16490                 bad++;
16491 }
16492 int main() {
16493         check(" 1",                                        1LL, 0);
16494         check(" 0",                                        0LL, 0);
16495         check("18446744073709551615",  18446744073709551615ULL, 0);
16496         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16497 #if 0 /* strtoull() for /^-/ strings is undefined. */
16498         check("-1",                    18446744073709551615ULL, 0);
16499         check("-18446744073709551614",                     2LL, 0);
16500         check("-18446744073709551615",                     1LL, 0);
16501         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16502         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16503 #endif
16504         if (!bad)
16505                 printf("ok\n");
16506 }
16507 EOCP
16508         set try
16509         if eval $compile; then
16510                 case "`$run ./try`" in
16511                 ok) echo "Your strtoull() seems to be working okay." ;;
16512                 *) cat <<EOM >&4
16513 Your strtoull() doesn't seem to be working okay.
16514 EOM
16515                    d_strtoull="$undef"
16516                    ;;
16517                 esac
16518         fi
16519         ;;
16520 esac
16521
16522 : see if strtouq exists
16523 set strtouq d_strtouq
16524 eval $inlibc
16525
16526 case "$d_strtouq" in
16527 "$define")
16528         $cat <<EOM
16529 Checking whether your strtouq() works okay...
16530 EOM
16531         $cat >try.c <<'EOCP'
16532 #include <errno.h>
16533 #include <stdio.h>
16534 extern unsigned long long int strtouq(char *s, char **, int); 
16535 static int bad = 0;
16536 void check(char *s, unsigned long long eull, int een) {
16537         unsigned long long gull;
16538         errno = 0;
16539         gull = strtouq(s, 0, 10);
16540         if (!((gull == eull) && (errno == een)))
16541                 bad++;
16542 }
16543 int main() {
16544         check(" 1",                                        1LL, 0);
16545         check(" 0",                                        0LL, 0);
16546         check("18446744073709551615",  18446744073709551615ULL, 0);
16547         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16548 #if 0 /* strtouq() for /^-/ strings is undefined. */
16549         check("-1",                    18446744073709551615ULL, 0);
16550         check("-18446744073709551614",                     2LL, 0);
16551         check("-18446744073709551615",                     1LL, 0);
16552         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16553         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16554 #endif
16555         if (!bad)
16556                 printf("ok\n");
16557         return 0;
16558 }
16559 EOCP
16560         set try
16561         if eval $compile; then
16562                 case "`$run ./try`" in
16563                 ok) echo "Your strtouq() seems to be working okay." ;;
16564                 *) cat <<EOM >&4
16565 Your strtouq() doesn't seem to be working okay.
16566 EOM
16567                    d_strtouq="$undef"
16568                    ;;
16569                 esac
16570         fi
16571         ;;
16572 esac
16573
16574 : see if strxfrm exists
16575 set strxfrm d_strxfrm
16576 eval $inlibc
16577
16578 : see if symlink exists
16579 set symlink d_symlink
16580 eval $inlibc
16581
16582 : see if syscall exists
16583 set syscall d_syscall
16584 eval $inlibc
16585
16586 : see if prototype for syscall is available
16587 echo " "
16588 set d_syscallproto syscall $i_unistd unistd.h
16589 eval $hasproto
16590
16591 : see if sysconf exists
16592 set sysconf d_sysconf
16593 eval $inlibc
16594
16595 : see if system exists
16596 set system d_system
16597 eval $inlibc
16598
16599 : see if tcgetpgrp exists
16600 set tcgetpgrp d_tcgetpgrp
16601 eval $inlibc
16602
16603 : see if tcsetpgrp exists
16604 set tcsetpgrp d_tcsetpgrp
16605 eval $inlibc
16606
16607 : see if prototype for telldir is available
16608 echo " "
16609 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16610 eval $hasproto
16611
16612 : see if time exists
16613 echo " "
16614 if test "X$d_time" = X -o X"$timetype" = X; then
16615     if set time val -f d_time; eval $csym; $val; then
16616                 echo 'time() found.' >&4
16617                 val="$define"
16618                 rp="What is the type returned by time() on this system?"
16619                 set time_t timetype long stdio.h sys/types.h
16620                 eval $typedef_ask
16621     else
16622                 echo 'time() not found, hope that will do.' >&4
16623                 val="$undef"
16624                 timetype='int';
16625     fi
16626     set d_time
16627     eval $setvar
16628 fi
16629
16630 : see if this is a sys/times.h system
16631 set sys/times.h i_systimes
16632 eval $inhdr
16633
16634 : see if times exists
16635 echo " "
16636 if set times val -f d_times; eval $csym; $val; then
16637         echo 'times() found.' >&4
16638         d_times="$define"
16639         inc=''
16640         case "$i_systimes" in
16641         "$define") inc='sys/times.h';;
16642         esac
16643         rp="What is the type returned by times() on this system?"
16644         set clock_t clocktype long stdio.h sys/types.h $inc
16645         eval $typedef_ask
16646 else
16647         echo 'times() NOT found, hope that will do.' >&4
16648         d_times="$undef"
16649         clocktype='int'
16650 fi
16651
16652 : see if tmpnam_r exists
16653 set tmpnam_r d_tmpnam_r
16654 eval $inlibc
16655 case "$d_tmpnam_r" in
16656 "$define")
16657         hdrs="$i_systypes sys/types.h define stdio.h "
16658         case "$d_tmpnam_r_proto:$usethreads" in
16659         ":define")      d_tmpnam_r_proto=define
16660                 set d_tmpnam_r_proto tmpnam_r $hdrs
16661                 eval $hasproto ;;
16662         *)      ;;
16663         esac
16664         case "$d_tmpnam_r_proto" in
16665         define)
16666         case "$tmpnam_r_proto" in
16667         ''|0) try='char* tmpnam_r(char*);'
16668         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16669         esac
16670         case "$tmpnam_r_proto" in
16671         ''|0)   d_tmpnam_r=undef
16672                 tmpnam_r_proto=0
16673                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16674         * )     case "$tmpnam_r_proto" in
16675                 REENTRANT_PROTO*) ;;
16676                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16677                 esac
16678                 echo "Prototype: $try" ;;
16679         esac
16680         ;;
16681         *)      case "$usethreads" in
16682                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16683                 esac
16684                 d_tmpnam_r=undef
16685                 tmpnam_r_proto=0
16686                 ;;
16687         esac
16688         ;;
16689 *)      tmpnam_r_proto=0
16690         ;;
16691 esac
16692
16693 : see if truncate exists
16694 set truncate d_truncate
16695 eval $inlibc
16696
16697 : see if ttyname_r exists
16698 set ttyname_r d_ttyname_r
16699 eval $inlibc
16700 case "$d_ttyname_r" in
16701 "$define")
16702         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16703         case "$d_ttyname_r_proto:$usethreads" in
16704         ":define")      d_ttyname_r_proto=define
16705                 set d_ttyname_r_proto ttyname_r $hdrs
16706                 eval $hasproto ;;
16707         *)      ;;
16708         esac
16709         case "$d_ttyname_r_proto" in
16710         define)
16711         case "$ttyname_r_proto" in
16712         ''|0) try='int ttyname_r(int, char*, size_t);'
16713         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16714         esac
16715         case "$ttyname_r_proto" in
16716         ''|0) try='int ttyname_r(int, char*, int);'
16717         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16718         esac
16719         case "$ttyname_r_proto" in
16720         ''|0) try='char* ttyname_r(int, char*, int);'
16721         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16722         esac
16723         case "$ttyname_r_proto" in
16724         ''|0)   d_ttyname_r=undef
16725                 ttyname_r_proto=0
16726                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16727         * )     case "$ttyname_r_proto" in
16728                 REENTRANT_PROTO*) ;;
16729                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16730                 esac
16731                 echo "Prototype: $try" ;;
16732         esac
16733         ;;
16734         *)      case "$usethreads" in
16735                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16736                 esac
16737                 d_ttyname_r=undef
16738                 ttyname_r_proto=0
16739                 ;;
16740         esac
16741         ;;
16742 *)      ttyname_r_proto=0
16743         ;;
16744 esac
16745
16746 : see if tzname[] exists
16747 echo " "
16748 if set tzname val -a d_tzname; eval $csym; $val; then
16749         val="$define"
16750         echo 'tzname[] found.' >&4
16751 else
16752         val="$undef"
16753         echo 'tzname[] NOT found.' >&4
16754 fi
16755 set d_tzname
16756 eval $setvar
16757
16758 case "$osname" in
16759 next|rhapsody|darwin) multiarch="$define" ;;
16760 esac
16761 case "$multiarch" in
16762 ''|[nN]*) multiarch="$undef" ;;
16763 esac
16764
16765 : check for ordering of bytes in a UV
16766 echo " "
16767 case "$usecrosscompile$multiarch" in
16768 *$define*)
16769         $cat <<EOM
16770 You seem to be either cross-compiling or doing a multiarchitecture build,
16771 skipping the byteorder check.
16772
16773 EOM
16774         byteorder='ffff'
16775         ;;
16776 *)
16777         case "$byteorder" in
16778         '')
16779                 $cat <<'EOM'
16780 In the following, larger digits indicate more significance.  A big-endian
16781 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16782 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16783 machines may have weird orders like 3412.  A Cray will report 87654321,
16784 an Alpha will report 12345678. If the test program works the default is
16785 probably right.
16786 I'm now running the test program...
16787 EOM
16788                 $cat >try.c <<EOCP
16789 #include <stdio.h>
16790 #$i_stdlib I_STDLIB
16791 #ifdef I_STDLIB
16792 #include <stdlib.h>
16793 #endif
16794 #include <sys/types.h>
16795 typedef $uvtype UV;
16796 int main()
16797 {
16798         int i;
16799         union {
16800                 UV l;
16801                 char c[$uvsize];
16802         } u;
16803
16804         if ($uvsize > 4)
16805                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16806         else
16807                 u.l = (UV)0x04030201;
16808         for (i = 0; i < $uvsize; i++)
16809                 printf("%c", u.c[i]+'0');
16810         printf("\n");
16811         exit(0);
16812 }
16813 EOCP
16814                 xxx_prompt=y
16815                 set try
16816                 if eval $compile && ./try > /dev/null; then
16817                         dflt=`$run ./try`
16818                         case "$dflt" in
16819                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16820                                 echo "(The test program ran ok.)"
16821                                 echo "byteorder=$dflt"
16822                                 xxx_prompt=n
16823                         ;;
16824                         ????|????????) echo "(The test program ran ok.)" ;;
16825                         *) echo "(The test program didn't run right for some reason.)" ;;
16826                         esac
16827                 else
16828                         dflt='4321'
16829                         cat <<'EOM'
16830 (I can't seem to compile the test program.  Guessing big-endian...)
16831 EOM
16832                 fi
16833                 case "$xxx_prompt" in
16834                 y)
16835                         rp="What is the order of bytes in $uvtype?"
16836                         . ./myread
16837                         byteorder="$ans"
16838                         ;;
16839                 *)      byteorder=$dflt
16840                         ;;
16841                 esac
16842                 ;;
16843         esac
16844         $rm -f try.c try
16845         ;;
16846 esac
16847
16848
16849 $cat <<EOM
16850
16851 Checking to see whether you can access character data unalignedly...
16852 EOM
16853 case "$d_u32align" in
16854 '')   $cat >try.c <<EOCP
16855 #include <stdio.h>
16856 #$i_stdlib I_STDLIB
16857 #ifdef I_STDLIB
16858 #include <stdlib.h>
16859 #endif
16860 #define U32 $u32type
16861 #define BYTEORDER 0x$byteorder
16862 #define U8 $u8type
16863 #include <signal.h>
16864 #ifdef SIGBUS
16865 $signal_t bletch(s) int s; { exit(4); }
16866 #endif
16867 int main() {
16868 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16869     U8 buf[8];
16870     U32 *up;
16871     int i;
16872
16873     if (sizeof(U32) != 4) {
16874         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16875         exit(1);
16876     }
16877
16878     fflush(stdout);
16879
16880 #ifdef SIGBUS
16881     signal(SIGBUS, bletch);
16882 #endif
16883
16884     buf[0] = 0;
16885     buf[1] = 0;
16886     buf[2] = 0;
16887     buf[3] = 1;
16888     buf[5] = 0;
16889     buf[6] = 0;
16890     buf[7] = 0;
16891     buf[8] = 1;
16892
16893     for (i = 0; i < 4; i++) {
16894         up = (U32*)(buf + i);
16895         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16896                (*up == 1 << (8*(3-i)))  /* little-endian */
16897               )
16898            )
16899         {
16900             printf("read failed (%x)\n", *up);
16901             exit(2);
16902         }
16903     }
16904
16905     /* write test */
16906     for (i = 0; i < 4; i++) {
16907         up = (U32*)(buf + i);
16908         *up = 0xBeef;
16909         if (*up != 0xBeef) {
16910             printf("write failed (%x)\n", *up);
16911             exit(3);
16912         }
16913     }
16914
16915     exit(0);
16916 #else
16917     printf("1\n");
16918     exit(1);
16919 #endif
16920     return 0;
16921 }
16922 EOCP
16923 set try
16924 if eval $compile_ok; then
16925         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16926         $run ./try 2>&1 >/dev/null
16927         case "$?" in
16928         0)      cat >&4 <<EOM
16929 You can access character data pretty unalignedly.
16930 EOM
16931                 d_u32align="$undef"
16932                 ;;
16933         *)      cat >&4 <<EOM
16934 It seems that you must access character data in an aligned manner.
16935 EOM
16936                 d_u32align="$define"
16937                 ;;
16938         esac
16939 else
16940         rp='Can you access character data at unaligned addresses?'
16941         dflt='n'
16942         . ./myread
16943         case "$ans" in
16944         [yY]*)  d_u32align="$undef"  ;;
16945         *)      d_u32align="$define" ;;
16946         esac
16947 fi
16948 $rm -f core core.try.* try.core
16949 ;;
16950 esac
16951
16952 : see if ualarm exists
16953 set ualarm d_ualarm
16954 eval $inlibc
16955
16956 : see if umask exists
16957 set umask d_umask
16958 eval $inlibc
16959
16960 : see if unordered exists
16961 set unordered d_unordered
16962 eval $inlibc
16963
16964 : see if usleep exists
16965 set usleep d_usleep
16966 eval $inlibc
16967
16968 : see if prototype for usleep is available
16969 echo " "
16970 set d_usleepproto usleep $i_unistd unistd.h
16971 eval $hasproto
16972
16973 : see if ustat exists
16974 set ustat d_ustat
16975 eval $inlibc
16976
16977 : backward compatibility for d_hvfork
16978 if test X$d_hvfork != X; then
16979         d_vfork="$d_hvfork"
16980         d_hvfork=''
16981 fi
16982 : see if there is a vfork
16983 val=''
16984 set vfork val
16985 eval $inlibc
16986
16987 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16988 : perl on Solaris 2.x, and probably elsewhere.
16989 case "$val" in
16990 $define)
16991         echo " "
16992         case "$usevfork" in
16993         false) dflt='n';;
16994         *) dflt='y';;
16995         esac
16996         cat <<'EOM'
16997  
16998 Perl can only use a vfork() that doesn't suffer from strict
16999 restrictions on calling functions or modifying global data in
17000 the child.  For example, glibc-2.1 contains such a vfork()
17001 that is unsuitable.  If your system provides a proper fork()
17002 call, chances are that you do NOT want perl to use vfork().
17003
17004 EOM
17005         rp="Do you still want to use vfork()?"
17006         . ./myread
17007         case "$ans" in
17008         y|Y) ;;
17009         *)
17010                 echo "Ok, we won't use vfork()."
17011                 val="$undef"
17012                 ;;
17013         esac
17014         ;;
17015 esac
17016 set d_vfork
17017 eval $setvar
17018 case "$d_vfork" in
17019 $define) usevfork='true';;
17020 *) usevfork='false';;
17021 esac
17022
17023 : see if closedir exists
17024 set closedir d_closedir
17025 eval $inlibc
17026
17027 case "$d_closedir" in
17028 "$define")
17029         echo " "
17030         echo "Checking whether closedir() returns a status..." >&4
17031         cat > try.c <<EOM
17032 #$i_dirent I_DIRENT             /**/
17033 #$i_sysdir I_SYS_DIR            /**/
17034 #$i_sysndir I_SYS_NDIR          /**/
17035 #$i_systypes I_SYS_TYPES        /**/
17036
17037 #if defined(I_SYS_TYPES)
17038 #include <sys/types.h>
17039 #endif
17040 #if defined(I_DIRENT)
17041 #include <dirent.h>
17042 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17043 #include <sys/dir.h>
17044 #endif
17045 #else
17046 #ifdef I_SYS_NDIR
17047 #include <sys/ndir.h>
17048 #else
17049 #ifdef I_SYS_DIR
17050 #ifdef hp9000s500
17051 #include <ndir.h>       /* may be wrong in the future */
17052 #else
17053 #include <sys/dir.h>
17054 #endif
17055 #endif
17056 #endif
17057 #endif 
17058 int main() { return closedir(opendir(".")); }
17059 EOM
17060         set try
17061         if eval $compile_ok; then
17062                 if $run ./try > /dev/null 2>&1 ; then
17063                         echo "Yes, it does."
17064                         val="$undef"
17065                 else
17066                         echo "No, it doesn't."
17067                         val="$define"
17068                 fi
17069         else
17070                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17071                 val="$define"
17072         fi
17073         ;;
17074 *)
17075         val="$undef";
17076         ;;
17077 esac
17078 set d_void_closedir
17079 eval $setvar
17080 $rm -f try try.*
17081 : see if there is a wait4
17082 set wait4 d_wait4
17083 eval $inlibc
17084
17085 : see if waitpid exists
17086 set waitpid d_waitpid
17087 eval $inlibc
17088
17089 : see if wcstombs exists
17090 set wcstombs d_wcstombs
17091 eval $inlibc
17092
17093 : see if wctomb exists
17094 set wctomb d_wctomb
17095 eval $inlibc
17096
17097 : see if writev exists
17098 set writev d_writev
17099 eval $inlibc
17100
17101 : preserve RCS keywords in files with variable substitution, grrr
17102 Date='$Date'
17103 Id='$Id'
17104 Log='$Log'
17105 RCSfile='$RCSfile'
17106 Revision='$Revision'
17107
17108 : check for alignment requirements
17109 echo " "
17110 case "$usecrosscompile$multiarch" in
17111 *$define*)
17112         $cat <<EOM
17113 You seem to be either cross-compiling or doing a multiarchitecture build,
17114 skipping the memory alignment check.
17115
17116 EOM
17117         case "$alignbytes" in
17118         '') alignbytes=8 ;;
17119         esac
17120         ;;
17121 *)
17122         case "$alignbytes" in
17123         '') echo "Checking alignment constraints..." >&4
17124                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17125                         $cat >try.c <<'EOCP'
17126 typedef long double NV;
17127 EOCP
17128                 else
17129                         $cat >try.c <<'EOCP'
17130 typedef double NV;
17131 EOCP
17132                 fi
17133                 $cat >>try.c <<'EOCP'
17134 #include <stdio.h>
17135 struct foobar {
17136         char foo;
17137         NV bar;
17138 } try_algn;
17139 int main()
17140 {
17141     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17142     return(0);
17143 }
17144 EOCP
17145                 set try
17146                 if eval $compile_ok; then
17147                         dflt=`$run ./try`
17148                 else
17149                         dflt='8'
17150                         echo "(I can't seem to compile the test program...)"
17151                 fi
17152                 ;;
17153         *) dflt="$alignbytes"
17154                 ;;
17155         esac
17156         rp="Doubles must be aligned on a how-many-byte boundary?"
17157         . ./myread
17158         alignbytes="$ans"
17159         $rm -f try.c try
17160         ;;
17161 esac
17162
17163
17164 : set the base revision
17165 baserev=5.0
17166
17167 : how do we catenate cpp tokens here?
17168 echo " "
17169 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
17170 $cat >cpp_stuff.c <<'EOCP'
17171 #define RCAT(a,b)a/**/b
17172 #define ACAT(a,b)a ## b
17173 RCAT(Rei,ser)
17174 ACAT(Cir,cus)
17175 EOCP
17176 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17177 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17178         echo "Oh!  Smells like ANSI's been here." >&4
17179         echo "We can catify or stringify, separately or together!"
17180         cpp_stuff=42
17181 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17182         echo "Ah, yes!  The good old days!" >&4
17183         echo "However, in the good old days we don't know how to stringify and"
17184         echo "catify at the same time."
17185         cpp_stuff=1
17186 else
17187         $cat >&4 <<EOM
17188 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
17189 to have to edit the values of CAT[2-5] in config.h...
17190 EOM
17191         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17192 fi
17193 $rm -f cpp_stuff.*
17194
17195 : see if this is a db.h system
17196 set db.h i_db
17197 eval $inhdr
17198
17199 case "$i_db" in
17200 $define)
17201         : Check db version.
17202         echo " "
17203         echo "Checking Berkeley DB version ..." >&4
17204         $cat >try.c <<EOCP
17205 #$d_const HASCONST
17206 #ifndef HASCONST
17207 #define const
17208 #endif
17209 #include <sys/types.h>
17210 #include <stdio.h>
17211 #$i_stdlib I_STDLIB
17212 #ifdef I_STDLIB
17213 #include <stdlib.h>
17214 #endif
17215 #include <db.h>
17216 int main(int argc, char *argv[])
17217 {
17218 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17219     int Major, Minor, Patch ;
17220     unsigned long Version ;
17221     (void)db_version(&Major, &Minor, &Patch) ;
17222     if (argc == 2) {
17223         printf("%d %d %d %d %d %d\n",
17224                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17225                Major, Minor, Patch);
17226         exit(0);
17227     }
17228     printf("You have Berkeley DB Version 2 or greater.\n");
17229
17230     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17231                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17232     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17233                 Major, Minor, Patch) ;
17234
17235     /* check that db.h & libdb are compatible */
17236     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17237         printf("db.h and libdb are incompatible.\n") ;
17238         exit(3);        
17239     }
17240
17241     printf("db.h and libdb are compatible.\n") ;
17242
17243     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17244                 + DB_VERSION_PATCH ;
17245
17246     /* needs to be >= 2.3.4 */
17247     if (Version < 2003004) {
17248     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17249         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17250         exit(2);        
17251     }
17252
17253     exit(0);
17254 #else
17255 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17256     if (argc == 2) {
17257         printf("1 0 0\n");
17258         exit(0);
17259     }
17260     printf("You have Berkeley DB Version 1.\n");
17261     exit(0);    /* DB version < 2: the coast is clear. */
17262 #else
17263     exit(1);    /* <db.h> not Berkeley DB? */
17264 #endif
17265 #endif
17266 }
17267 EOCP
17268         set try
17269         if eval $compile_ok && $run ./try; then
17270                 echo 'Looks OK.' >&4
17271                 set `$run ./try 1`
17272                 db_version_major=$1
17273                 db_version_minor=$2
17274                 db_version_patch=$3
17275         else
17276                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17277                 i_db=$undef
17278                 case " $libs " in
17279                 *"-ldb "*)
17280                         : Remove db from list of libraries to use
17281                         echo "Removing unusable -ldb from library list" >&4
17282                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17283                         shift
17284                         libs="$*"
17285                         echo "libs = $libs" >&4
17286                         ;;
17287                 esac
17288         fi
17289         $rm -f try.*
17290         ;;
17291 esac
17292
17293 case "$i_db" in
17294 define)
17295         : Check the return type needed for hash 
17296         echo " "
17297         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17298         $cat >try.c <<EOCP
17299 #$d_const HASCONST
17300 #ifndef HASCONST
17301 #define const
17302 #endif
17303 #include <sys/types.h>
17304 #include <db.h>
17305
17306 #ifndef DB_VERSION_MAJOR
17307 u_int32_t hash_cb (ptr, size)
17308 const void *ptr;
17309 size_t size;
17310 {
17311 }
17312 HASHINFO info;
17313 int main()
17314 {
17315         info.hash = hash_cb;
17316 }
17317 #endif
17318 EOCP
17319         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17320                 if $contains warning try.out >>/dev/null 2>&1 ; then
17321                         db_hashtype='int'
17322                 else
17323                         db_hashtype='u_int32_t'
17324                 fi
17325         else
17326                 : XXX Maybe we should just give up here.
17327                 db_hashtype=u_int32_t
17328                 $cat try.out >&4
17329                 echo "Help:  I can't seem to compile the db test program." >&4
17330                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17331         fi
17332         $rm -f try.*
17333         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17334         ;;
17335 *)      db_hashtype=u_int32_t
17336         ;;
17337 esac
17338 case "$i_db" in
17339 define)
17340         : Check the return type needed for prefix 
17341         echo " "
17342         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17343         cat >try.c <<EOCP
17344 #$d_const HASCONST
17345 #ifndef HASCONST
17346 #define const
17347 #endif
17348 #include <sys/types.h>
17349 #include <db.h>
17350
17351 #ifndef DB_VERSION_MAJOR
17352 size_t prefix_cb (key1, key2)
17353 const DBT *key1;
17354 const DBT *key2;
17355 {
17356 }
17357 BTREEINFO info;
17358 int main()
17359 {
17360         info.prefix = prefix_cb;
17361 }
17362 #endif
17363 EOCP
17364         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17365                 if $contains warning try.out >>/dev/null 2>&1 ; then
17366                         db_prefixtype='int'
17367                 else
17368                         db_prefixtype='size_t'
17369                 fi
17370         else
17371                 db_prefixtype='size_t'
17372                 : XXX Maybe we should just give up here.
17373                 $cat try.out >&4
17374                 echo "Help:  I can't seem to compile the db test program." >&4
17375                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17376         fi
17377         $rm -f try.*
17378         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17379         ;;
17380 *)      db_prefixtype='size_t'
17381         ;;
17382 esac
17383
17384
17385 : How can we generate normalized random numbers ?
17386 echo " "
17387 echo "Looking for a random number function..." >&4
17388 case "$randfunc" in
17389 '')
17390         if set drand48 val -f; eval $csym; $val; then
17391                 dflt="drand48"
17392                 echo "Good, found drand48()." >&4
17393         elif set random val -f; eval $csym; $val; then
17394                 dflt="random"
17395                 echo "OK, found random()." >&4
17396         else
17397                 dflt="rand"
17398                 echo "Yick, looks like I have to use rand()." >&4
17399         fi
17400         echo " "
17401         ;;
17402 *)
17403         dflt="$randfunc"
17404         ;;
17405 esac
17406 cont=true
17407
17408 case "$ccflags" in
17409 *-Dmy_rand=*|*-Dmy_srand=*)
17410         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17411         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17412         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17413         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17414         ;;
17415 esac
17416
17417 while $test "$cont"; do
17418         rp="Use which function to generate random numbers?"
17419         . ./myread
17420         if $test "$ans" = "$dflt"; then
17421                 : null
17422         else
17423                 randbits=''
17424         fi
17425         randfunc="$ans"
17426         if set $ans val -f; eval $csym; $val; then
17427                 cont=''
17428         else
17429                 dflt=y
17430                 rp="I cannot find function $ans. Use that name anyway?"
17431                 . ./myread
17432                 dflt=rand
17433                 case "$ans" in
17434                         [yY]*) cont='';;
17435                 esac
17436         fi
17437         case "$cont" in
17438         '')
17439                 case "$randfunc" in
17440                 drand48)
17441                         drand01="drand48()"
17442                         seedfunc="srand48"
17443                         randbits=48
17444                         randseedtype=long
17445                         ;;
17446                 rand|random)
17447                         case "$randbits" in
17448                         '')
17449 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17450                                 $cat >try.c <<EOCP
17451 #$i_unistd I_UNISTD
17452 #$i_stdlib I_STDLIB
17453 #include <stdio.h>
17454 #ifdef I_UNISTD
17455 #  include <unistd.h>
17456 #endif
17457 #ifdef I_STDLIB
17458 #  include <stdlib.h>
17459 #endif
17460 int main()
17461 {
17462         register int i;
17463         register unsigned long tmp;
17464         register unsigned long max = 0L;
17465
17466         for (i = 1000; i; i--) {
17467                 tmp = (unsigned long) $randfunc();
17468                 if (tmp > max) max = tmp;
17469         }
17470         for (i = 0; max; i++)
17471                 max /= 2;
17472         printf("%d\n",i);
17473 }
17474 EOCP
17475                                 set try
17476                                 if eval $compile_ok; then
17477                                         dflt=`try`
17478                                 else
17479                                         dflt='?'
17480                                         echo "(I can't seem to compile the test program...)"
17481                                 fi
17482                                 ;;
17483                         *)
17484                                 dflt="$randbits"
17485                                 ;;
17486                         esac
17487                         rp="How many bits does your $randfunc() function produce?"
17488                         . ./myread
17489                         randbits="$ans"
17490                         $rm -f try.c try
17491                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17492                         seedfunc="s$randfunc"
17493                         randseedtype=unsigned
17494                         ;;
17495                 *)
17496                         dflt="31"
17497                         rp="How many bits does your $randfunc() function produce?"
17498                         . ./myread
17499                         randbits="$ans"
17500                         seedfunc="s$randfunc"
17501                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17502                         if set $seedfunc val -f; eval $csym; $val; then
17503                                 echo "(Using $seedfunc() to seed random generator)"
17504                         else
17505                                 echo "(Warning: no $seedfunc() to seed random generator)"
17506                                 seedfunc=rand
17507                         fi
17508                         randseedtype=unsigned
17509                         ;;
17510                 esac
17511                 ;;
17512         esac
17513 done
17514
17515 echo " "
17516 echo "Determining whether or not we are on an EBCDIC system..." >&4
17517 $cat >try.c <<'EOM'
17518 int main()
17519 {
17520   if ('M'==0xd4) return 0;
17521   return 1;
17522 }
17523 EOM
17524
17525 val=$undef
17526 set try
17527 if eval $compile_ok; then
17528         if $run ./try; then
17529                 echo "You seem to speak EBCDIC." >&4
17530                 val="$define"
17531         else
17532                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17533         fi
17534 else
17535         echo "I'm unable to compile the test program." >&4
17536         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17537 fi
17538 $rm -f try try.*
17539 set ebcdic
17540 eval $setvar
17541
17542 echo " "
17543 $cat >&4 <<EOM
17544 Checking how to flush all pending stdio output...
17545 EOM
17546 # I only know how to find the first 32 possibly open files on SunOS.
17547 # See also hints/sunos_4_1.sh and util.c  --AD
17548 case "$osname" in
17549 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17550 esac
17551 $cat >>try.c <<EOCP
17552 #include <stdio.h>
17553 #$i_stdlib I_STDLIB
17554 #ifdef I_STDLIB
17555 #include <stdlib.h>
17556 #endif
17557 #$i_unistd I_UNISTD
17558 #ifdef I_UNISTD
17559 # include <unistd.h>
17560 #endif
17561 #$d_sysconf HAS_SYSCONF
17562 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17563 #ifdef HAS_STDIO_STREAM_ARRAY
17564 # define STDIO_STREAM_ARRAY $stdio_stream_array
17565 #endif
17566 int main() {
17567   FILE* p;
17568   unlink("try.out");
17569   p = fopen("try.out", "w");
17570 #ifdef TRY_FPUTC
17571   fputc('x', p);
17572 #else
17573 # ifdef TRY_FPRINTF
17574   fprintf(p, "x");
17575 # endif
17576 #endif
17577 #ifdef TRY_FFLUSH_NULL
17578   fflush(NULL);
17579 #endif
17580 #ifdef TRY_FFLUSH_ALL
17581   {
17582     long open_max = -1;
17583 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17584     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17585 # else
17586 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17587     open_max = sysconf(_SC_OPEN_MAX);
17588 #  else
17589 #   ifdef FOPEN_MAX
17590     open_max = FOPEN_MAX;
17591 #   else
17592 #    ifdef OPEN_MAX
17593     open_max = OPEN_MAX;
17594 #    else
17595 #     ifdef _NFILE
17596     open_max = _NFILE;
17597 #     endif
17598 #    endif
17599 #   endif
17600 #  endif
17601 # endif 
17602 # ifdef HAS_STDIO_STREAM_ARRAY
17603     if (open_max > 0) {
17604       long i;
17605       for (i = 0; i < open_max; i++)
17606             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17607                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17608                 STDIO_STREAM_ARRAY[i]._flag)
17609                 fflush(&STDIO_STREAM_ARRAY[i]);
17610     }   
17611   }
17612 # endif
17613 #endif
17614   _exit(42);
17615 }
17616 EOCP
17617 : first we have to find out how _not_ to flush
17618 $to try.c
17619 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17620     output=''
17621     set try -DTRY_FPUTC
17622     if eval $compile; then
17623             $run ./try 2>/dev/null
17624             code="$?"
17625             $from try.out
17626             if $test ! -s try.out -a "X$code" = X42; then
17627                 output=-DTRY_FPUTC
17628             fi
17629     fi
17630     case "$output" in
17631     '')
17632             set try -DTRY_FPRINTF
17633             if eval $compile; then
17634                     $run ./try 2>/dev/null
17635                     code="$?"
17636                     $from try.out
17637                     if $test ! -s try.out -a "X$code" = X42; then
17638                         output=-DTRY_FPRINTF
17639                     fi
17640             fi
17641         ;;
17642     esac
17643 fi
17644 : check for fflush NULL behaviour
17645 case "$fflushNULL" in
17646 '')     set try -DTRY_FFLUSH_NULL $output
17647         if eval $compile; then
17648                 $run ./try 2>/dev/null
17649                 code="$?"
17650                 $from try.out
17651                 if $test -s try.out -a "X$code" = X42; then
17652                         fflushNULL="`$cat try.out`"
17653                 else
17654                         if $test "X$code" != X42; then
17655                                 $cat >&4 <<EOM
17656 (If this test failed, don't worry, we'll try another method shortly.)
17657 EOM
17658                         fi
17659                 fi
17660         fi
17661         $rm -f core try.core core.try.*
17662         case "$fflushNULL" in
17663         x)      $cat >&4 <<EOM
17664 Your fflush(NULL) works okay for output streams.
17665 Let's see if it clobbers input pipes...
17666 EOM
17667 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17668 # bug that improperly flushes the input end of pipes.  So we avoid the
17669 # autoflush on fork/system/exec support for now. :-(
17670 $cat >tryp.c <<EOCP
17671 #include <stdio.h>
17672 int
17673 main(int argc, char **argv)
17674 {
17675     char buf[1024];
17676     int i;
17677     char *bp = buf;
17678     while (1) {
17679         while ((i = getc(stdin)) != -1
17680                && (*bp++ = i) != '\n'
17681                && bp < &buf[1024])
17682         /* DO NOTHING */ ;
17683         *bp = '\0';
17684         fprintf(stdout, "%s", buf);
17685         fflush(NULL);
17686         if (i == -1)
17687             return 0;
17688         bp = buf;
17689     }
17690 }
17691 EOCP
17692                 fflushNULL="$define"
17693                 set tryp
17694                 if eval $compile; then
17695                     $rm -f tryp.out
17696                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17697                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17698                        $cat >&4 <<EOM
17699 fflush(NULL) seems to behave okay with input streams.
17700 EOM
17701                         fflushNULL="$define"
17702                     else
17703                         $cat >&4 <<EOM
17704 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17705 EOM
17706                         fflushNULL="$undef"
17707                     fi
17708                 fi
17709                 $rm -f core tryp.c tryp.core core.tryp.*
17710                 ;;
17711         '')     $cat >&4 <<EOM
17712 Your fflush(NULL) isn't working (contrary to ANSI C).
17713 EOM
17714                 fflushNULL="$undef"
17715                 ;;
17716         *)      $cat >&4 <<EOM
17717 Cannot figure out whether your fflush(NULL) works or not.
17718 I'm assuming it doesn't (contrary to ANSI C).
17719 EOM
17720                 fflushNULL="$undef"
17721                 ;;
17722         esac
17723         ;;
17724 $define|true|[yY]*)
17725         fflushNULL="$define"
17726         ;;
17727 *)
17728         fflushNULL="$undef"
17729         ;;
17730 esac
17731 : check explicit looping only if NULL did not work, and if the pipe
17732 : bug does not show up on an explicit flush too
17733 case "$fflushNULL" in
17734 "$undef")
17735         $cat >tryp.c <<EOCP
17736 #include <stdio.h>
17737 int
17738 main(int argc, char **argv)
17739 {
17740     char buf[1024];
17741     int i;
17742     char *bp = buf;
17743     while (1) {
17744         while ((i = getc(stdin)) != -1
17745                && (*bp++ = i) != '\n'
17746                && bp < &buf[1024])
17747         /* DO NOTHING */ ;
17748         *bp = '\0';
17749         fprintf(stdout, "%s", buf);
17750         fflush(stdin);
17751         if (i == -1)
17752             return 0;
17753         bp = buf;
17754     }
17755 }
17756 EOCP
17757         set tryp
17758         if eval $compile; then
17759             $rm -f tryp.out
17760             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17761             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17762                $cat >&4 <<EOM
17763 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17764 EOM
17765                 : now check for fflushall behaviour
17766                 case "$fflushall" in
17767                 '')     set try -DTRY_FFLUSH_ALL $output
17768                         if eval $compile; then
17769                                 $cat >&4 <<EOM
17770 (Now testing the other method--but note that this also may fail.)
17771 EOM
17772                                 $run ./try 2>/dev/null
17773                                 code=$?
17774                                 $from try.out
17775                                 if $test -s try.out -a "X$code" = X42; then
17776                                         fflushall="`$cat try.out`"
17777                                 fi
17778                         fi
17779                         $rm -f core try.core core.try.*
17780                         case "$fflushall" in
17781                         x)      $cat >&4 <<EOM
17782 Whew. Flushing explicitly all the stdio streams works.
17783 EOM
17784                                 fflushall="$define"
17785                                 ;;
17786                         '')     $cat >&4 <<EOM
17787 Sigh. Flushing explicitly all the stdio streams doesn't work.
17788 EOM
17789                                 fflushall="$undef"
17790                                 ;;
17791                         *)      $cat >&4 <<EOM
17792 Cannot figure out whether flushing stdio streams explicitly works or not.
17793 I'm assuming it doesn't.
17794 EOM
17795                                 fflushall="$undef"
17796                                 ;;
17797                         esac
17798                         ;;
17799                 "$define"|true|[yY]*)
17800                         fflushall="$define"
17801                         ;;
17802                 *)
17803                         fflushall="$undef"
17804                         ;;
17805                 esac
17806             else
17807                 $cat >&4 <<EOM
17808 All is futile.  Even fflush(stdin) clobbers input pipes!
17809 EOM
17810                 fflushall="$undef"
17811             fi
17812         else
17813             fflushall="$undef"
17814         fi
17815         $rm -f core tryp.c tryp.core core.tryp.*
17816         ;;
17817 *)      fflushall="$undef"
17818         ;;
17819 esac
17820
17821 case "$fflushNULL$fflushall" in
17822 undefundef)
17823         $cat <<EOM
17824 OK, I give up.  I cannot figure out how to flush pending stdio output.
17825 We won't be flushing handles at all before fork/exec/popen.
17826 EOM
17827         ;;
17828 esac
17829 $rm -f try.* try$exe_ext
17830
17831 : Store the full pathname to the ar program for use in the C program
17832 : Respect a hint or command line value for full_ar.
17833 case "$full_ar" in
17834 '') full_ar=$ar ;;
17835 esac
17836
17837 : Store the full pathname to the sed program for use in the C program
17838 full_sed=$sed
17839
17840 : see what type gids are declared as in the kernel
17841 echo " "
17842 echo "Looking for the type for group ids returned by getgid()."
17843 set gid_t gidtype xxx stdio.h sys/types.h
17844 eval $typedef
17845 case "$gidtype" in
17846 xxx)
17847         xxx=`./findhdr sys/user.h`
17848         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17849         case $1 in
17850         unsigned) dflt="$1 $2" ;;
17851         *) dflt="$1" ;;
17852         esac
17853         ;;
17854 *) dflt="$gidtype";;
17855 esac
17856 case "$gidtype" in
17857 gid_t) echo "gid_t found." ;;
17858 *)      rp="What is the type for group ids returned by getgid()?"
17859         . ./myread
17860         gidtype="$ans"
17861         ;;
17862 esac
17863
17864 echo " "
17865 case "$gidtype" in
17866 *_t) zzz="$gidtype"     ;;
17867 *)   zzz="gid"          ;;
17868 esac
17869 echo "Checking the size of $zzz..." >&4 
17870 cat > try.c <<EOCP
17871 #include <sys/types.h>
17872 #include <stdio.h>
17873 #$i_stdlib I_STDLIB
17874 #ifdef I_STDLIB
17875 #include <stdlib.h>
17876 #endif
17877 int main() {
17878     printf("%d\n", (int)sizeof($gidtype));
17879     exit(0);
17880 }
17881 EOCP
17882 set try
17883 if eval $compile_ok; then
17884         yyy=`$run ./try`
17885         case "$yyy" in
17886         '')     gidsize=4
17887                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17888                 ;;
17889         *)      gidsize=$yyy
17890                 echo "Your $zzz is $gidsize bytes long."
17891                 ;;
17892         esac
17893 else
17894         gidsize=4
17895         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17896 fi
17897
17898
17899 echo " "
17900 case "$gidtype" in
17901 *_t) zzz="$gidtype"     ;;
17902 *)   zzz="gid"          ;;
17903 esac
17904 echo "Checking the sign of $zzz..." >&4 
17905 cat > try.c <<EOCP
17906 #include <sys/types.h>
17907 #include <stdio.h>
17908 int main() {
17909         $gidtype foo = -1;
17910         if (foo < 0)
17911                 printf("-1\n");
17912         else
17913                 printf("1\n");
17914 }
17915 EOCP
17916 set try
17917 if eval $compile; then
17918         yyy=`$run ./try`
17919         case "$yyy" in
17920         '')     gidsign=1
17921                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17922                 ;;
17923         *)      gidsign=$yyy
17924                 case "$gidsign" in
17925                  1) echo "Your $zzz is unsigned." ;;
17926                 -1) echo "Your $zzz is signed."   ;;
17927                 esac
17928                 ;;
17929         esac
17930 else
17931         gidsign=1
17932         echo "(I can't compile the test program--guessing unsigned.)" >&4
17933 fi
17934
17935
17936 echo " "
17937
17938 if $test X"$quadtype" != X; then
17939
17940 echo "Checking how to print 64-bit integers..." >&4
17941
17942 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17943         $cat >try.c <<'EOCP'
17944 #include <sys/types.h>
17945 #include <stdio.h>
17946 int main() {
17947   int q = 12345678901;
17948   printf("%ld\n", q);
17949 }
17950 EOCP
17951         set try
17952         if eval $compile; then
17953                 yyy=`$run ./try`
17954                 case "$yyy" in
17955                 12345678901)
17956                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17957                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17958                         echo "We will use %d."
17959                         ;;
17960                 esac
17961         fi
17962 fi
17963
17964 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17965         $cat >try.c <<'EOCP'
17966 #include <sys/types.h>
17967 #include <stdio.h>
17968 int main() {
17969   long q = 12345678901;
17970   printf("%ld\n", q);
17971 }
17972 EOCP
17973         set try
17974         if eval $compile; then
17975                 yyy=`$run ./try`
17976                 case "$yyy" in
17977                 12345678901)
17978                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17979                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17980                         echo "We will use %ld."
17981                         ;;
17982                 esac
17983         fi
17984 fi
17985
17986 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17987         $cat >try.c <<'EOCP'
17988 #include <sys/types.h>
17989 #include <inttypes.h>
17990 #include <stdio.h>
17991 int main() {
17992   int64_t q = 12345678901;
17993   printf("%" PRId64 "\n", q);
17994 }
17995 EOCP
17996         set try
17997         if eval $compile; then
17998                 yyy=`$run ./try`
17999                 case "$yyy" in
18000                 12345678901)
18001                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18002                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18003                         echo "We will use the C9X style."
18004                         ;;
18005                 esac
18006         fi
18007 fi
18008
18009 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18010         $cat >try.c <<EOCP
18011 #include <sys/types.h>
18012 #include <stdio.h>
18013 int main() {
18014   $quadtype q = 12345678901;
18015   printf("%Ld\n", q);
18016 }
18017 EOCP
18018         set try
18019         if eval $compile; then
18020                 yyy=`$run ./try`
18021                 case "$yyy" in
18022                 12345678901)
18023                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18024                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18025                         echo "We will use %Ld."
18026                         ;;
18027                 esac
18028         fi
18029 fi
18030
18031 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18032         $cat >try.c <<'EOCP'
18033 #include <sys/types.h>
18034 #include <stdio.h>
18035 int main() {
18036   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18037   printf("%lld\n", q);
18038 }
18039 EOCP
18040         set try
18041         if eval $compile; then
18042                 yyy=`$run ./try`
18043                 case "$yyy" in
18044                 12345678901)
18045                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18046                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18047                         echo "We will use the %lld style."
18048                         ;;
18049                 esac
18050         fi
18051 fi
18052
18053 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18054         $cat >try.c <<EOCP
18055 #include <sys/types.h>
18056 #include <stdio.h>
18057 int main() {
18058   $quadtype q = 12345678901;
18059   printf("%qd\n", q);
18060 }
18061 EOCP
18062         set try
18063         if eval $compile; then
18064                 yyy=`$run ./try`
18065                 case "$yyy" in
18066                 12345678901)
18067                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18068                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18069                         echo "We will use %qd."
18070                         ;;
18071                 esac
18072         fi
18073 fi
18074
18075 if $test X"$sPRId64" = X; then
18076         echo "Cannot figure out how to print 64-bit integers." >&4
18077 fi
18078
18079 $rm -f try try.*
18080
18081 fi
18082
18083 case "$sPRId64" in
18084 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18085         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18086         ;;
18087 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18088         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18089         ;;
18090 esac
18091
18092
18093 echo " "
18094 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18095
18096 if $test X"$ivsize" = X8; then
18097         ivdformat="$sPRId64"
18098         uvuformat="$sPRIu64"
18099         uvoformat="$sPRIo64"
18100         uvxformat="$sPRIx64"
18101         uvXUformat="$sPRIXU64"
18102 else
18103         if $test X"$ivsize" = X"$longsize"; then
18104                 ivdformat='"ld"'
18105                 uvuformat='"lu"'
18106                 uvoformat='"lo"'
18107                 uvxformat='"lx"'
18108                 uvXUformat='"lX"'
18109         else
18110                 if $test X"$ivsize" = X"$intsize"; then
18111                         ivdformat='"d"'
18112                         uvuformat='"u"'
18113                         uvoformat='"o"'
18114                         uvxformat='"x"'
18115                         uvXUformat='"X"'
18116                 else
18117                         : far out
18118                         if $test X"$ivsize" = X"$shortsize"; then
18119                                 ivdformat='"hd"'
18120                                 uvuformat='"hu"'
18121                                 uvoformat='"ho"'
18122                                 uvxformat='"hx"'
18123                                 uvXUformat='"hX"'
18124                         fi
18125                 fi
18126         fi
18127 fi
18128
18129 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18130         nveformat="$sPRIeldbl"
18131         nvfformat="$sPRIfldbl"
18132         nvgformat="$sPRIgldbl"
18133         nvEUformat="$sPRIEUldbl"
18134         nvFUformat="$sPRIFUldbl"
18135         nvGUformat="$sPRIGUldbl"
18136 else
18137         nveformat='"e"'
18138         nvfformat='"f"'
18139         nvgformat='"g"'
18140         nvEUformat='"E"'
18141         nvFUformat='"F"'
18142         nvGUformat='"G"'
18143 fi
18144
18145 case "$ivdformat" in
18146 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18147     exit 1
18148     ;;
18149 esac
18150
18151
18152 echo " "
18153 $echo "Checking the format string to be used for gids..." >&4
18154
18155 case "$gidsign" in
18156 -1)     if $test X"$gidsize" = X"$ivsize"; then
18157                 gidformat="$ivdformat"
18158         else
18159                 if $test X"$gidsize" = X"$longsize"; then
18160                         gidformat='"ld"'
18161                 else
18162                         if $test X"$gidsize" = X"$intsize"; then
18163                                 gidformat='"d"'
18164                         else
18165                                 if $test X"$gidsize" = X"$shortsize"; then
18166                                         gidformat='"hd"'
18167                                 fi
18168                         fi
18169                 fi
18170         fi
18171         ;;
18172 *)      if $test X"$gidsize" = X"$uvsize"; then
18173                 gidformat="$uvuformat"
18174         else
18175                 if $test X"$gidsize" = X"$longsize"; then
18176                         gidformat='"lu"'
18177                 else
18178                         if $test X"$gidsize" = X"$intsize"; then
18179                                 gidformat='"u"'
18180                         else
18181                                 if $test X"$gidsize" = X"$shortsize"; then
18182                                         gidformat='"hu"'
18183                                 fi
18184                         fi
18185                 fi
18186         fi
18187         ;;
18188 esac
18189
18190 : see if getgroups exists
18191 set getgroups d_getgrps
18192 eval $inlibc
18193
18194 : see if setgroups exists
18195 set setgroups d_setgrps
18196 eval $inlibc
18197
18198
18199 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18200 echo " "
18201 case "$d_getgrps$d_setgrps" in
18202 *define*)
18203         case "$groupstype" in
18204         '') dflt="$gidtype" ;;
18205         *)  dflt="$groupstype" ;;
18206         esac
18207         $cat <<EOM
18208 What type of pointer is the second argument to getgroups() and setgroups()?
18209 Usually this is the same as group ids, $gidtype, but not always.
18210
18211 EOM
18212         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18213         . ./myread
18214         groupstype="$ans"
18215         ;;
18216 *)  groupstype="$gidtype";;
18217 esac
18218
18219 echo " "
18220 echo "Checking if your $make program sets \$(MAKE)..." >&4
18221 case "$make_set_make" in
18222 '')
18223         $sed 's/^X //' > testmake.mak << 'EOF'
18224 Xall:
18225 X       @echo 'maketemp="$(MAKE)"'
18226 EOF
18227         case "`$make -f testmake.mak 2>/dev/null`" in
18228         *maketemp=*) make_set_make='#' ;;
18229         *)      make_set_make="MAKE=$make" ;;
18230         esac
18231         $rm -f testmake.mak
18232         ;;
18233 esac
18234 case "$make_set_make" in
18235 '#') echo "Yup, it does.";;
18236 *) echo "Nope, it doesn't.";;
18237 esac
18238
18239 : see what type is used for mode_t
18240 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18241 set mode_t modetype int stdio.h sys/types.h
18242 eval $typedef_ask
18243
18244 : see if stdarg is available
18245 echo " "
18246 if $test `./findhdr stdarg.h`; then
18247         echo "<stdarg.h> found." >&4
18248         valstd="$define"
18249 else
18250         echo "<stdarg.h> NOT found." >&4
18251         valstd="$undef"
18252 fi
18253
18254 : see if varags is available
18255 echo " "
18256 if $test `./findhdr varargs.h`; then
18257         echo "<varargs.h> found." >&4
18258 else
18259         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18260 fi
18261
18262 : set up the varargs testing programs
18263 $cat > varargs.c <<EOP
18264 #ifdef I_STDARG
18265 #include <stdarg.h>
18266 #endif
18267 #ifdef I_VARARGS
18268 #include <varargs.h>
18269 #endif
18270
18271 #ifdef I_STDARG
18272 int f(char *p, ...)
18273 #else
18274 int f(va_alist)
18275 va_dcl
18276 #endif
18277 {
18278         va_list ap;
18279 #ifndef I_STDARG
18280         char *p;
18281 #endif
18282 #ifdef I_STDARG
18283         va_start(ap,p);
18284 #else
18285         va_start(ap);
18286         p = va_arg(ap, char *);
18287 #endif
18288         va_end(ap);
18289 }
18290 EOP
18291 $cat > varargs <<EOP
18292 $startsh
18293 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18294         echo "true"
18295 else
18296         echo "false"
18297 fi
18298 $rm -f varargs$_o
18299 EOP
18300 chmod +x varargs
18301
18302 : now check which varargs header should be included
18303 echo " "
18304 i_varhdr=''
18305 case "$valstd" in
18306 "$define")
18307         if `./varargs I_STDARG`; then
18308                 val='stdarg.h'
18309         elif `./varargs I_VARARGS`; then
18310                 val='varargs.h'
18311         fi
18312         ;;
18313 *)
18314         if `./varargs I_VARARGS`; then
18315                 val='varargs.h'
18316         fi
18317         ;;
18318 esac
18319 case "$val" in
18320 '')
18321 echo "I could not find the definition for va_dcl... You have problems..." >&4
18322         val="$undef"; set i_stdarg; eval $setvar
18323         val="$undef"; set i_varargs; eval $setvar
18324         ;;
18325 *) 
18326         set i_varhdr
18327         eval $setvar
18328         case "$i_varhdr" in
18329         stdarg.h)
18330                 val="$define"; set i_stdarg; eval $setvar
18331                 val="$undef"; set i_varargs; eval $setvar
18332                 ;;
18333         varargs.h)
18334                 val="$undef"; set i_stdarg; eval $setvar
18335                 val="$define"; set i_varargs; eval $setvar
18336                 ;;
18337         esac
18338         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18339 esac
18340 $rm -f varargs*
18341
18342 : see if we need va_copy
18343 echo " "
18344 case "$i_stdarg" in
18345 "$define")
18346         $cat >try.c <<EOCP
18347 #include <stdarg.h>
18348 #include <stdio.h>
18349 #$i_stdlib I_STDLIB
18350 #ifdef I_STDLIB
18351 #include <stdlib.h>
18352 #endif
18353 #include <signal.h>
18354
18355 int
18356 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18357 {
18358   return vfprintf(f, fmt, *valp);
18359 }
18360  
18361 int    
18362 myvfprintf(FILE *f, const  char *fmt, va_list val)
18363 {
18364   return ivfprintf(f, fmt, &val);
18365 }
18366       
18367 int
18368 myprintf(char *fmt, ...) 
18369 {
18370   va_list val;
18371   va_start(val, fmt);
18372   return myvfprintf(stdout, fmt, val); 
18373 }         
18374
18375 int
18376 main(int ac, char **av)
18377 {
18378   signal(SIGSEGV, exit);
18379
18380   myprintf("%s%cs all right, then\n", "that", '\'');                            
18381   exit(0);      
18382 }
18383 EOCP
18384         set try
18385         if eval $compile && $run ./try 2>&1 >/dev/null; then
18386                 case "`$run ./try`" in
18387                 "that's all right, then")
18388                         okay=yes
18389                         ;;
18390                 esac
18391         fi
18392         case "$okay" in
18393         yes)    echo "It seems that you don't need va_copy()." >&4
18394                 need_va_copy="$undef"
18395                 ;;
18396         *)      echo "It seems that va_copy() or similar will be needed." >&4
18397                 need_va_copy="$define"
18398                 ;;
18399         esac
18400         $rm -f try.* core core.* *.core *.core.*
18401         ;;
18402 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18403         ;;
18404 esac
18405
18406 : see what type is used for size_t
18407 rp="What is the type used for the length parameter for string functions?"
18408 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18409 eval $typedef_ask
18410
18411 : check for type of arguments to gethostbyaddr. 
18412 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18413         case "$d_gethbyaddr" in
18414         $define)
18415                 $cat <<EOM
18416
18417 Checking to see what type of arguments are accepted by gethostbyaddr().
18418 EOM
18419                 hdrs="$define sys/types.h
18420                         $d_socket sys/socket.h 
18421                         $i_niin netinet/in.h 
18422                         $i_netdb netdb.h
18423                         $i_unistd unistd.h"
18424                 : The first arg can 'char *' or 'void *'
18425                 : The second arg is some of integral type
18426                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18427                         for yyy in size_t long int; do
18428                                 case "$netdb_host_type" in
18429                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18430                                         if ./protochk "$try" $hdrs; then
18431                                                 echo "Your system accepts $xxx for the first arg."
18432                                                 echo "...and $yyy for the second arg."
18433                                                 netdb_host_type="$xxx"
18434                                                 netdb_hlen_type="$yyy"
18435                                         fi
18436                                         ;;
18437                                 esac
18438                         done
18439                 done
18440                 : In case none of those worked, prompt the user.
18441                 case "$netdb_host_type" in
18442                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18443                         dflt='char *'
18444                         . ./myread
18445                         netdb_host_type=$ans
18446                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18447                         dflt="$sizetype"
18448                         . ./myread
18449                         netdb_hlen_type=$ans
18450                         ;;
18451                 esac
18452                 ;;
18453         *)      : no gethostbyaddr, so pick harmless defaults
18454                 netdb_host_type='char *'
18455                 netdb_hlen_type="$sizetype"
18456                 ;;
18457         esac
18458         # Remove the "const" if needed. -- but then we'll have a 
18459         # prototype clash!
18460         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18461 fi
18462
18463 : check for type of argument to gethostbyname. 
18464 if test "X$netdb_name_type" = X ; then
18465         case "$d_gethbyname" in
18466         $define)
18467                 $cat <<EOM
18468
18469 Checking to see what type of argument is accepted by gethostbyname().
18470 EOM
18471                 hdrs="$define sys/types.h
18472                         $d_socket sys/socket.h 
18473                         $i_niin netinet/in.h 
18474                         $i_netdb netdb.h
18475                         $i_unistd unistd.h"
18476                 for xxx in "const char *" "char *"; do
18477                         case "$netdb_name_type" in
18478                         '')     try="extern struct hostent *gethostbyname($xxx);"
18479                                 if ./protochk "$try" $hdrs; then
18480                                         echo "Your system accepts $xxx."
18481                                         netdb_name_type="$xxx"
18482                                 fi
18483                                 ;;
18484                         esac
18485                 done
18486                 : In case none of those worked, prompt the user.
18487                 case "$netdb_name_type" in
18488                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18489                         dflt='char *'
18490                         . ./myread
18491                         netdb_name_type=$ans
18492                         ;;
18493                 esac
18494                 ;;
18495         *)      : no gethostbyname, so pick harmless default
18496                 netdb_name_type='char *'
18497                 ;;
18498         esac
18499 fi
18500
18501 : check for type of 1st argument to getnetbyaddr. 
18502 if test "X$netdb_net_type" = X ; then
18503         case "$d_getnbyaddr" in
18504         $define)
18505                 $cat <<EOM
18506
18507 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18508 EOM
18509                 hdrs="$define sys/types.h
18510                         $d_socket sys/socket.h 
18511                         $i_niin netinet/in.h 
18512                         $i_netdb netdb.h
18513                         $i_unistd unistd.h"
18514                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18515                         case "$netdb_net_type" in
18516                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18517                                 if ./protochk "$try" $hdrs; then
18518                                         echo "Your system accepts $xxx."
18519                                         netdb_net_type="$xxx"
18520                                 fi
18521                                 ;;
18522                         esac
18523                 done
18524                 : In case none of those worked, prompt the user.
18525                 case "$netdb_net_type" in
18526                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18527                         dflt='long'
18528                         . ./myread
18529                         netdb_net_type=$ans
18530                         ;;
18531                 esac
18532                 ;;
18533         *)      : no getnetbyaddr, so pick harmless default
18534                 netdb_net_type='long'
18535                 ;;
18536         esac
18537 fi
18538 : locate the preferred pager for this system
18539 fn=f/
18540 case "$pager" in
18541 '')
18542         dflt=''
18543         case "$pg" in
18544         /*) dflt=$pg;;
18545         [a-zA-Z]:/*) dflt=$pg;;
18546         esac
18547         case "$more" in
18548         /*) dflt=$more;;
18549         [a-zA-Z]:/*) dflt=$more;;
18550         esac
18551         case "$less" in
18552         /*) dflt=$less;;
18553         [a-zA-Z]:/*) dflt=$less;;
18554         esac
18555         case "$dflt" in
18556         '') dflt=/usr/ucb/more;;
18557         esac
18558         ;;
18559 *)      dflt="$pager"
18560         : Instruct ./getfile to trust the hinted or previous pager value,
18561         : even if it does not begin with a slash.  For example, on os2,
18562         : pager might be cmd /c more.  See comments in UU/getfile.
18563         fn="f/($pager)"
18564         ;;
18565 esac
18566 echo " "
18567 rp='What pager is used on your system?'
18568 . ./getfile
18569 pager="$ans"
18570
18571 : see what type pids are declared as in the kernel
18572 rp="What is the type of process ids on this system?"
18573 set pid_t pidtype int stdio.h sys/types.h
18574 eval $typedef_ask
18575
18576 : Find earliest binary compatible site_perl subdirectory perl can use.
18577 xs_apiversion=$version # The current site_perl version.
18578 : Find earliest pure perl site_perl subdirectory perl can use.
18579 : The versioned directories started at 5.005.
18580 pm_apiversion='5.005'
18581
18582 : see if ar generates random libraries by itself
18583 echo " "
18584 echo "Checking how to generate random libraries on your machine..." >&4
18585 echo 'int bar1() { return bar2(); }' > bar1.c
18586 echo 'int bar2() { return 2; }' > bar2.c
18587 $cat > foo.c <<EOP
18588 #$i_stdlib I_STDLIB
18589 #ifdef I_STDLIB
18590 #include <stdlib.h>
18591 #endif
18592 int main() { printf("%d\n", bar1()); exit(0); }
18593 EOP
18594 $cc $ccflags -c bar1.c >/dev/null 2>&1
18595 $cc $ccflags -c bar2.c >/dev/null 2>&1
18596 $cc $ccflags -c foo.c >/dev/null 2>&1
18597 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18598 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18599         $run ./foobar >/dev/null 2>&1; then
18600         echo "$ar appears to generate random libraries itself."
18601         orderlib=false
18602         ranlib=":"
18603 elif $ar ts bar$_a >/dev/null 2>&1 &&
18604         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18605         $run ./foobar >/dev/null 2>&1; then
18606                 echo "a table of contents needs to be added with '$ar ts'."
18607                 orderlib=false
18608                 ranlib="$ar ts"
18609 else
18610         case "$ranlib" in
18611         :) ranlib='';;
18612         '')
18613                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18614                 $test -f $ranlib || ranlib=''
18615                 ;;
18616         esac
18617         if $test -n "$ranlib"; then
18618                 echo "your system has '$ranlib'; we'll use that."
18619                 orderlib=false
18620         else
18621                 echo "your system doesn't seem to support random libraries"
18622                 echo "so we'll use lorder and tsort to order the libraries."
18623                 orderlib=true
18624                 ranlib=":"
18625         fi
18626 fi
18627 $rm -f foo* bar* 
18628
18629 : check for type of arguments to select. 
18630 case "$selecttype" in
18631 '') case "$d_select" in
18632         $define)
18633                 echo " "
18634                 $cat <<EOM
18635 Checking to see what type of arguments are accepted by select().
18636 EOM
18637                 hdrs="$define sys/types.h
18638                         $i_systime sys/time.h 
18639                         $i_sysselct sys/select.h
18640                         $d_socket sys/socket.h"
18641                 : The first arg can be int, unsigned, or size_t
18642                 : The last arg may or may not be 'const'
18643                 val=''
18644                 : void pointer has been seen but using that
18645                 : breaks the selectminbits test
18646                 for xxx in 'fd_set *' 'int *'; do
18647                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18648                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18649                                         case "$val" in
18650                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18651                                                 if ./protochk "$try" $hdrs; then
18652                                                         echo "Your system accepts $xxx."
18653                                                         val="$xxx"
18654                                                 fi
18655                                                 ;;
18656                                         esac
18657                                 done
18658                         done
18659                 done
18660                 case "$val" in
18661                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18662                         case "$d_fd_set" in
18663                                 $define) dflt="fd_set *" ;;
18664                                 *)              dflt="int *" ;;
18665                         esac
18666                         . ./myread
18667                         val=$ans
18668                         ;;
18669                 esac
18670                 selecttype="$val"
18671                 ;;
18672         *)      : no select, so pick a harmless default
18673                 selecttype='int *'
18674                 ;;
18675         esac
18676         ;;
18677 esac
18678
18679 : check for the select 'width'
18680 case "$selectminbits" in
18681 '') safebits=`expr $ptrsize \* 8`
18682     case "$d_select" in
18683         $define)
18684                 $cat <<EOM
18685
18686 Checking to see on how many bits at a time your select() operates...
18687 EOM
18688                 $cat >try.c <<EOCP
18689 #include <sys/types.h>
18690 #$i_time I_TIME
18691 #$i_systime I_SYS_TIME
18692 #$i_systimek I_SYS_TIME_KERNEL
18693 #ifdef I_TIME
18694 #   include <time.h>
18695 #endif
18696 #ifdef I_SYS_TIME
18697 #   ifdef I_SYS_TIME_KERNEL
18698 #       define KERNEL
18699 #   endif
18700 #   include <sys/time.h>
18701 #   ifdef I_SYS_TIME_KERNEL
18702 #       undef KERNEL
18703 #   endif
18704 #endif
18705 #$i_sysselct I_SYS_SELECT
18706 #ifdef I_SYS_SELECT
18707 #include <sys/select.h>
18708 #endif
18709 #$d_socket HAS_SOCKET
18710 #ifdef HAS_SOCKET
18711 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18712 #endif
18713 #include <stdio.h>
18714 #$i_stdlib I_STDLIB
18715 #ifdef I_STDLIB
18716 #include <stdlib.h>
18717 #endif
18718 $selecttype b;
18719 #define S sizeof(*(b))
18720 #define MINBITS 64
18721 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18722 #define NBITS  (NBYTES * 8)
18723 int main() {
18724     char *s = malloc(NBYTES);
18725     struct timeval t;
18726     int i;
18727     FILE* fp;
18728     int fd;
18729
18730     if (!s)
18731         exit(1);
18732     fclose(stdin);
18733     fp = fopen("try.c", "r");
18734     if (fp == 0)
18735       exit(2);
18736     fd = fileno(fp);
18737     if (fd < 0)
18738       exit(3);
18739     b = ($selecttype)s;
18740     for (i = 0; i < NBITS; i++)
18741         FD_SET(i, b);
18742     t.tv_sec  = 0;
18743     t.tv_usec = 0;
18744     select(fd + 1, b, 0, 0, &t);
18745     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18746     free(s);
18747     printf("%d\n", i + 1);
18748     return 0;
18749 }
18750 EOCP
18751                 set try
18752                 if eval $compile_ok; then
18753                         selectminbits=`$run ./try`
18754                         case "$selectminbits" in
18755                         '')     cat >&4 <<EOM
18756 Cannot figure out on how many bits at a time your select() operates.
18757 I'll play safe and guess it is $safebits bits.
18758 EOM
18759                                 selectminbits=$safebits
18760                                 bits="$safebits bits"
18761                                 ;;
18762                         1)      bits="1 bit" ;;
18763                         *)      bits="$selectminbits bits" ;;
18764                         esac
18765                         echo "Your select() operates on $bits at a time." >&4
18766                 else
18767                         rp='What is the minimum number of bits your select() operates on?'
18768                         case "$byteorder" in
18769                         12345678)       dflt=64 ;;
18770                         1234)           dflt=32 ;;
18771                         *)              dflt=1  ;;
18772                         esac
18773                         . ./myread
18774                         val=$ans
18775                         selectminbits="$val"
18776                 fi
18777                 $rm -f try.* try
18778                 ;;
18779         *)      : no select, so pick a harmless default
18780                 selectminbits=$safebits
18781                 ;;
18782         esac
18783         ;;
18784 esac
18785
18786 : Trace out the files included by signal.h, then look for SIGxxx names.
18787 : Remove SIGARRAYSIZE used by HPUX.
18788 : Remove SIGSTKSIZE used by Linux.
18789 : Remove SIGSTKSZ used by Posix.
18790 : Remove SIGTYP void lines used by OS2.
18791 : Some cpps, like os390, dont give the file name anywhere
18792 if [ "X$fieldn" = X ]; then
18793         : Just make some guesses.  We check them later.
18794         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18795 else
18796         xxx=`echo '#include <signal.h>' |
18797         $cppstdin $cppminus $cppflags 2>/dev/null |
18798         $grep '^[       ]*#.*include' | 
18799         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18800 fi
18801 : Check this list of files to be sure we have parsed the cpp output ok.
18802 : This will also avoid potentially non-existent files, such 
18803 : as ../foo/bar.h
18804 xxxfiles=''
18805 for xx in $xxx /dev/null ; do
18806         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18807 done
18808 : If we have found no files, at least try signal.h
18809 case "$xxxfiles" in
18810 '')     xxxfiles=`./findhdr signal.h` ;;
18811 esac
18812 xxx=`awk '
18813 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18814         print substr($2, 4, 20)
18815 }
18816 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18817         print substr($3, 4, 20)
18818 }' $xxxfiles`
18819 : Append some common names just in case the awk scan failed.
18820 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18821 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18822 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18823 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18824 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18825
18826 : generate a few handy files for later
18827 $cat > signal.c <<EOCP
18828 #include <sys/types.h>
18829 #include <signal.h>
18830 #$i_stdlib I_STDLIB
18831 #ifdef I_STDLIB
18832 #include <stdlib.h>
18833 #endif
18834 #include <stdio.h>
18835 int main() {
18836
18837 /* Strange style to avoid deeply-nested #if/#else/#endif */
18838 #ifndef NSIG
18839 #  ifdef _NSIG
18840 #    define NSIG (_NSIG)
18841 #  endif
18842 #endif
18843
18844 #ifndef NSIG
18845 #  ifdef SIGMAX
18846 #    define NSIG (SIGMAX+1)
18847 #  endif
18848 #endif
18849
18850 #ifndef NSIG
18851 #  ifdef SIG_MAX
18852 #    define NSIG (SIG_MAX+1)
18853 #  endif
18854 #endif
18855
18856 #ifndef NSIG
18857 #  ifdef MAXSIG
18858 #    define NSIG (MAXSIG+1)
18859 #  endif
18860 #endif
18861
18862 #ifndef NSIG
18863 #  ifdef MAX_SIG
18864 #    define NSIG (MAX_SIG+1)
18865 #  endif
18866 #endif
18867
18868 #ifndef NSIG
18869 #  ifdef SIGARRAYSIZE
18870 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18871 #  endif
18872 #endif
18873
18874 #ifndef NSIG
18875 #  ifdef _sys_nsig
18876 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18877 #  endif
18878 #endif
18879
18880 /* Default to some arbitrary number that's big enough to get most
18881    of the common signals.
18882 */
18883 #ifndef NSIG
18884 #    define NSIG 50
18885 #endif
18886
18887 printf("NSIG %d\n", NSIG);
18888
18889 #ifndef JUST_NSIG
18890
18891 EOCP
18892
18893 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18894 {
18895         printf "#ifdef SIG"; printf $1; printf "\n"
18896         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18897         printf $1; printf ");\n"
18898         printf "#endif\n"
18899 }
18900 END {
18901         printf "#endif /* JUST_NSIG */\n";
18902         printf "exit(0);\n}\n";
18903 }
18904 ' >>signal.c
18905 $cat >signal.awk <<'EOP'
18906 BEGIN { ndups = 0 }
18907 $1 ~ /^NSIG$/ { nsig = $2 }
18908 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
18909     if ($2 > maxsig) { maxsig = $2 }
18910     if (sig_name[$2]) {
18911         dup_name[ndups] = $1
18912         dup_num[ndups] = $2
18913         ndups++ 
18914     }
18915     else {
18916         sig_name[$2] = $1
18917         sig_num[$2] = $2
18918     }
18919 }
18920 END { 
18921     if (nsig == 0) {
18922         nsig = maxsig + 1
18923     }
18924     printf("NSIG %d\n", nsig);
18925     for (n = 1; n < nsig; n++) {
18926         if (sig_name[n]) {
18927             printf("%s %d\n", sig_name[n], sig_num[n])
18928         }
18929         else {
18930             printf("NUM%d %d\n", n, n) 
18931         }
18932     }
18933     for (n = 0; n < ndups; n++) {
18934         printf("%s %d\n", dup_name[n], dup_num[n])
18935     }
18936 }
18937 EOP
18938 $cat >signal_cmd <<EOS
18939 $startsh
18940 if $test -s signal.lst; then
18941     echo "Using your existing signal.lst file"
18942         exit 0
18943 fi
18944 xxx="$xxx"
18945 EOS
18946 $cat >>signal_cmd <<'EOS'
18947
18948 set signal
18949 if eval $compile_ok; then
18950         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18951 else
18952         echo "(I can't seem be able to compile the whole test program)" >&4
18953         echo "(I'll try it in little pieces.)" >&4
18954         set signal -DJUST_NSIG
18955         if eval $compile_ok; then
18956                 $run ./signal$_exe > signal.nsg
18957                 $cat signal.nsg
18958         else
18959                 echo "I can't seem to figure out how many signals you have." >&4
18960                 echo "Guessing 50." >&4
18961                 echo 'NSIG 50' > signal.nsg
18962         fi
18963         : Now look at all the signal names, one at a time.
18964         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18965                 $cat > signal.c <<EOCP
18966 #include <sys/types.h>
18967 #include <signal.h>
18968 #include <stdio.h>
18969 int main() {
18970 printf("$xx %d\n", SIG${xx});
18971 return 0;
18972 }
18973 EOCP
18974                 set signal
18975                 if eval $compile; then
18976                         echo "SIG${xx} found."
18977                         $run ./signal$_exe  >> signal.ls1
18978                 else
18979                         echo "SIG${xx} NOT found."
18980                 fi
18981         done
18982         if $test -s signal.ls1; then
18983                 $cat signal.nsg signal.ls1 |
18984                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18985         fi
18986
18987 fi
18988 if $test -s signal.lst; then
18989         :
18990 else
18991         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18992         echo 'kill -l' >signal
18993         set X `csh -f <signal`
18994         $rm -f signal
18995         shift
18996         case $# in
18997         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18998         esac
18999         echo $@ | $tr ' ' $trnl | \
19000             $awk '{ printf "%s %d\n", $1, ++s; }
19001                   END { printf "NSIG %d\n", ++s }' >signal.lst
19002 fi
19003 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19004 EOS
19005 chmod a+x signal_cmd
19006 $eunicefix signal_cmd
19007
19008 : generate list of signal names
19009 echo " "
19010 case "$sig_name_init" in
19011 '') doinit=yes ;;
19012 *)  case "$sig_num_init" in
19013     ''|*,*) doinit=yes ;;
19014     esac ;;
19015 esac
19016 case "$doinit" in
19017 yes)
19018         echo "Generating a list of signal names and numbers..." >&4
19019         . ./signal_cmd
19020         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19021         sig_name=`$awk 'BEGIN { printf "ZERO " }
19022                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19023         sig_num=`$awk  'BEGIN { printf "0 " }
19024                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19025         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19026                              !/^NSIG/   { printf "\"%s\", ", $1 }
19027                              END        { printf "0\n" }' signal.lst`
19028         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19029                              !/^NSIG/   { printf "%d, ", $2}
19030                              END        { printf "0\n"}' signal.lst`
19031         ;;
19032 esac
19033 echo "The following $sig_count signals are available:"
19034 echo " "
19035 echo $sig_name | $awk \
19036 'BEGIN { linelen = 0 }
19037 {
19038         for (i = 1; i <= NF; i++) {
19039                 name = "SIG" $i " "
19040                 linelen = linelen + length(name)
19041                 if (linelen > 70) {
19042                         printf "\n"
19043                         linelen = length(name)
19044                 }
19045                 printf "%s", name
19046         }
19047         printf "\n"
19048 }'
19049 sig_size=`echo $sig_name | awk '{print NF}'`
19050 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19051
19052 echo " "
19053 case "$sizetype" in
19054 *_t) zzz="$sizetype"    ;;
19055 *)   zzz="filesize"     ;;
19056 esac
19057 echo "Checking the size of $zzz..." >&4 
19058 cat > try.c <<EOCP
19059 #include <sys/types.h>
19060 #include <stdio.h>
19061 #$i_stdlib I_STDLIB
19062 #ifdef I_STDLIB
19063 #include <stdlib.h>
19064 #endif
19065 int main() {
19066     printf("%d\n", (int)sizeof($sizetype));
19067     exit(0);
19068 }
19069 EOCP
19070 set try
19071 if eval $compile_ok; then
19072         yyy=`$run ./try`
19073         case "$yyy" in
19074         '')     sizesize=4
19075                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19076                 ;;
19077         *)      sizesize=$yyy
19078                 echo "Your $zzz size is $sizesize bytes."
19079                 ;;
19080         esac
19081 else
19082         sizesize=4
19083         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19084 fi
19085
19086
19087 : check for socklen_t
19088 echo " "
19089 echo "Checking to see if you have socklen_t..." >&4
19090 $cat >try.c <<EOCP
19091 #include <sys/types.h>
19092 #$d_socket HAS_SOCKET
19093 #ifdef HAS_SOCKET
19094 #include <sys/socket.h>
19095 #endif
19096 int main() { socklen_t x = 16; }
19097 EOCP
19098 set try
19099 if eval $compile; then
19100         val="$define"
19101         echo "You have socklen_t."
19102 else
19103         val="$undef"
19104         echo "You do not have socklen_t."
19105         case "$sizetype" in
19106         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19107         esac
19108 fi
19109 $rm -f try try.*
19110 set d_socklen_t
19111 eval $setvar
19112
19113 : see if this is a socks.h system
19114 set socks.h i_socks
19115 eval $inhdr
19116
19117 : check for type of the size argument to socket calls
19118 case "$d_socket" in
19119 "$define")
19120         $cat <<EOM
19121
19122 Checking to see what type is the last argument of accept().
19123 EOM
19124         yyy=''
19125         case "$d_socklen_t" in
19126         "$define") yyy="$yyy socklen_t"
19127         esac
19128         yyy="$yyy $sizetype int long unsigned"
19129         for xxx in $yyy; do
19130                 case "$socksizetype" in
19131                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19132                         case "$usesocks" in
19133                         "$define")
19134                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19135                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19136                                         socksizetype="$xxx"
19137                                 fi
19138                                 ;;
19139                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19140                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19141                                         socksizetype="$xxx"
19142                                 fi
19143                                 ;;
19144                         esac
19145                         ;;
19146                 esac
19147         done
19148 : In case none of those worked, prompt the user.
19149         case "$socksizetype" in
19150         '')     rp='What is the type for socket address structure sizes?'
19151                 dflt='int'
19152                 . ./myread
19153                 socksizetype=$ans
19154                 ;;
19155         esac
19156         ;;
19157 *)      : no sockets, so pick relatively harmless default
19158         socksizetype='int'
19159         ;;
19160 esac
19161
19162 : see what type is used for signed size_t
19163 set ssize_t ssizetype int stdio.h sys/types.h
19164 eval $typedef
19165 dflt="$ssizetype"
19166 $cat > try.c <<EOM
19167 #include <stdio.h>
19168 #$i_stdlib I_STDLIB
19169 #ifdef I_STDLIB
19170 #include <stdlib.h>
19171 #endif
19172 #include <sys/types.h>
19173 #define Size_t $sizetype
19174 #define SSize_t $dflt
19175 int main()
19176 {
19177         if (sizeof(Size_t) == sizeof(SSize_t))
19178                 printf("$dflt\n");
19179         else if (sizeof(Size_t) == sizeof(int))
19180                 printf("int\n");
19181         else 
19182                 printf("long\n");
19183         exit(0);
19184 }
19185 EOM
19186 echo " "
19187 set try
19188 if eval $compile_ok && $run ./try > /dev/null; then
19189         ssizetype=`$run ./try`
19190         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19191 else
19192         $cat >&4 <<EOM
19193 Help! I can't compile and run the ssize_t test program: please enlighten me!
19194 (This is probably a misconfiguration in your system or libraries, and
19195 you really ought to fix it.  Still, I'll try anyway.)
19196
19197 I need a type that is the same size as $sizetype, but is guaranteed to
19198 be signed.  Common values are ssize_t, int and long.
19199
19200 EOM
19201         rp="What signed type is the same size as $sizetype?"
19202         . ./myread
19203         ssizetype="$ans"
19204 fi
19205 $rm -f try try.*
19206
19207 : see what type of char stdio uses.
19208 echo " "
19209 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19210 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19211         echo "Your stdio uses unsigned chars." >&4
19212         stdchar="unsigned char"
19213 else
19214         echo "Your stdio uses signed chars." >&4
19215         stdchar="char"
19216 fi
19217 $rm -f stdioh
19218
19219
19220
19221 : see what type uids are declared as in the kernel
19222 echo " "
19223 echo "Looking for the type for user ids returned by getuid()."
19224 set uid_t uidtype xxx stdio.h sys/types.h
19225 eval $typedef
19226 case "$uidtype" in
19227 xxx)
19228         xxx=`./findhdr sys/user.h`
19229         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19230         case $1 in
19231         unsigned) dflt="$1 $2" ;;
19232         *) dflt="$1" ;;
19233         esac
19234         ;;
19235 *) dflt="$uidtype";;
19236 esac
19237 case "$uidtype" in
19238 uid_t)  echo "uid_t found." ;;
19239 *)      rp="What is the type for user ids returned by getuid()?"
19240         . ./myread
19241         uidtype="$ans"
19242         ;;
19243 esac
19244
19245 echo " "
19246 case "$uidtype" in
19247 *_t) zzz="$uidtype"     ;;
19248 *)   zzz="uid"          ;;
19249 esac
19250 echo "Checking the size of $zzz..." >&4 
19251 cat > try.c <<EOCP
19252 #include <sys/types.h>
19253 #include <stdio.h>
19254 #$i_stdlib I_STDLIB
19255 #ifdef I_STDLIB
19256 #include <stdlib.h>
19257 #endif
19258 int main() {
19259     printf("%d\n", (int)sizeof($uidtype));
19260     exit(0);
19261 }
19262 EOCP
19263 set try
19264 if eval $compile_ok; then
19265         yyy=`$run ./try`
19266         case "$yyy" in
19267         '')     uidsize=4
19268                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19269                 ;;
19270         *)      uidsize=$yyy
19271                 echo "Your $zzz is $uidsize bytes long."
19272                 ;;
19273         esac
19274 else
19275         uidsize=4
19276         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19277 fi
19278
19279 echo " "
19280 case "$uidtype" in
19281 *_t) zzz="$uidtype"     ;;
19282 *)   zzz="uid"          ;;
19283 esac
19284 echo "Checking the sign of $zzz..." >&4
19285 cat > try.c <<EOCP
19286 #include <sys/types.h>
19287 #include <stdio.h>
19288 int main() {
19289         $uidtype foo = -1;
19290         if (foo < 0)
19291                 printf("-1\n");
19292         else
19293                 printf("1\n");
19294 }
19295 EOCP
19296 set try
19297 if eval $compile; then
19298         yyy=`$run ./try`
19299         case "$yyy" in
19300         '')     uidsign=1
19301                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19302                 ;;
19303         *)      uidsign=$yyy
19304                 case "$uidsign" in
19305                  1) echo "Your $zzz is unsigned." ;;
19306                 -1) echo "Your $zzz is signed."   ;;
19307                 esac
19308                 ;;
19309         esac
19310 else
19311         uidsign=1
19312         echo "(I can't compile the test program--guessing unsigned.)" >&4
19313 fi
19314
19315
19316
19317 echo " "
19318 $echo "Checking the format string to be used for uids..." >&4
19319
19320 case "$uidsign" in
19321 -1)     if $test X"$uidsize" = X"$ivsize"; then
19322                 uidformat="$ivdformat"
19323         else
19324                 if $test X"$uidsize" = X"$longsize"; then
19325                         uidformat='"ld"'
19326                 else
19327                         if $test X"$uidsize" = X"$intsize"; then
19328                                 uidformat='"d"'
19329                         else
19330                                 if $test X"$uidsize" = X"$shortsize"; then
19331                                         uidformat='"hd"'
19332                                 fi
19333                         fi
19334                 fi
19335         fi
19336         ;;
19337 *)      if $test X"$uidsize" = X"$uvsize"; then
19338                 uidformat="$uvuformat"
19339         else
19340                 if $test X"$uidsize" = X"$longsize"; then
19341                         uidformat='"lu"'
19342                 else
19343                         if $test X"$uidsize" = X"$intsize"; then
19344                                 uidformat='"u"'
19345                         else
19346                                 if $test X"$uidsize" = X"$shortsize"; then
19347                                         uidformat='"hu"'
19348                                 fi
19349                         fi
19350                 fi
19351         fi
19352         ;;
19353 esac
19354
19355 : determine compiler compiler
19356 case "$yacc" in
19357 '')
19358         dflt=yacc;;
19359 *)
19360         dflt="$yacc";;
19361 esac
19362 echo " "
19363 comp='yacc'
19364 if $test -f "$byacc$_exe"; then
19365         dflt="$byacc"
19366         comp="byacc or $comp"
19367 fi
19368 if $test -f "$bison$_exe"; then
19369         comp="$comp or bison -y"
19370 fi
19371 rp="Which compiler compiler ($comp) shall I use?"
19372 . ./myread
19373 yacc="$ans"
19374 case "$yacc" in
19375 *bis*)
19376         case "$yacc" in
19377         *-y*) ;;
19378         *)
19379                 yacc="$yacc -y"
19380                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19381                 ;;
19382         esac
19383         ;;
19384 esac
19385
19386 : see if this is a fp.h system
19387 set fp.h i_fp
19388 eval $inhdr
19389
19390 : see if this is a fp_class.h system
19391 set fp_class.h i_fp_class
19392 eval $inhdr
19393
19394 : see if this is a ieeefp.h system
19395 case "$i_ieeefp" in
19396 '' ) set ieeefp.h i_ieeefp
19397      eval $inhdr
19398      ;;
19399 esac
19400
19401 : see if this is a libutil.h system
19402 set libutil.h i_libutil
19403 eval $inhdr
19404
19405 : see if mach cthreads are available
19406 if test "X$usethreads" = "X$define"; then
19407         set mach/cthreads.h i_machcthr
19408         eval $inhdr
19409 else
19410         i_machcthr="$undef"
19411 fi
19412
19413
19414
19415 : see if this is a math.h system
19416 set math.h i_math
19417 eval $inhdr
19418
19419 : see if this is a mntent.h system
19420 set mntent.h i_mntent
19421 eval $inhdr
19422
19423 : see if ndbm.h is available
19424 set ndbm.h t_ndbm
19425 eval $inhdr
19426
19427 case "$t_ndbm" in
19428 $undef)
19429     # Some Linux distributions such as RedHat 7.1 put the
19430     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19431     if $test -f /usr/include/gdbm/ndbm.h; then
19432         echo '<gdbm/ndbm.h> found.'
19433         ccflags="$ccflags -I/usr/include/gdbm"
19434         cppflags="$cppflags -I/usr/include/gdbm"
19435         t_ndbm=$define
19436     fi
19437     ;;
19438 esac
19439
19440 case "$t_ndbm" in
19441 $define)
19442         : see if dbm_open exists
19443         set dbm_open d_dbm_open
19444         eval $inlibc
19445         case "$d_dbm_open" in
19446         $undef)
19447                 t_ndbm="$undef"
19448                 echo "We won't be including <ndbm.h>"
19449                 ;;
19450         esac
19451         ;;
19452 esac
19453 val="$t_ndbm"
19454 set i_ndbm
19455 eval $setvar
19456
19457 : see if net/errno.h is available
19458 val=''
19459 set net/errno.h val
19460 eval $inhdr
19461
19462 : Unfortunately, it causes problems on some systems.  Arrgh.
19463 case "$val" in
19464 $define)
19465         cat > try.c <<'EOM'
19466 #include <stdio.h>
19467 #include <errno.h>
19468 #include <net/errno.h>
19469 int func()
19470 {
19471         return ENOTSOCK;
19472 }
19473 EOM
19474         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19475                 echo "We'll be including <net/errno.h>." >&4
19476         else
19477                 echo "We won't be including <net/errno.h>." >&4
19478                 val="$undef"
19479         fi
19480         $rm -f try.* try
19481         ;;
19482 esac
19483 set i_neterrno
19484 eval $setvar
19485
19486 : see if netinet/tcp.h is available
19487 set netinet/tcp.h i_netinettcp
19488 eval $inhdr
19489
19490 : see if this is a poll.h system
19491 set poll.h i_poll
19492 eval $inhdr
19493
19494 : see if this is a prot.h system
19495 set prot.h i_prot
19496 eval $inhdr
19497
19498 echo " "
19499 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19500 $cat <<'EOSH' > Cppsym.know
19501 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19502 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19503 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19504 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19505 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19506 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19507 bull c cadmus clipper CMU COFF COMPILER_VERSION
19508 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19509 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19510 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19511 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19512 GLIBC GLIBC_MINOR
19513 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19514 H3050R H3050RX hbullx20 hcx host_mips
19515 hp200 hp300 hp700 HP700 hp800 hp9000
19516 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19517 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19518 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19519 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19520 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19521 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19522 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19523 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19524 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19525 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19526 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19527 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19528 MATH_HAS_NO_SIDE_EFFECTS
19529 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19530 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19531 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19532 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19533 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19534 NetBSD news1500 news1700 news1800 news1900 news3700
19535 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19536 ns32016 ns32332 ns32k nsc32000
19537 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19538 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19539 pc532 pdp11 PGC PIC plexus PORTAR posix
19540 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19541 POSIX_C_SOURCE POSIX_SOURCE POWER
19542 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19543 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19544 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19545 sony sony_news sonyrisc sparc sparclite spectrum
19546 stardent stdc STDC_EXT stratos sun sun3 sun386
19547 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19548 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19549 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19550 sysV68 sysV88 Tek4132 Tek4300 titan
19551 TM3200 TM5400 TM5600
19552 tower tower32 tower32_200 tower32_600 tower32_700
19553 tower32_800 tower32_850 tss
19554 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19555 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19556 unix UNIX95 UNIX99 unixpc unos
19557 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19558 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19559 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19560 USGr4 USGr4_2
19561 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19562 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19563 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19564 z8000
19565 EOSH
19566 # Maybe put other stuff here too.
19567 cat <<EOSH >>Cppsym.know
19568 $osname
19569 EOSH
19570 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19571 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19572 $cat Cppsym.know > Cppsym.c
19573 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19574 $rm -f Cppsym.a Cppsym.b Cppsym.c
19575 cat <<EOSH > Cppsym
19576 $startsh
19577 if $test \$# -gt 0; then
19578     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19579     if $test -s Cppsym.got; then
19580         $rm -f Cppsym.got
19581         exit 0
19582     fi
19583     $rm -f Cppsym.got
19584     exit 1
19585 else
19586     $tr " " "$trnl" | ./Cppsym.try
19587     exit 0
19588 fi
19589 EOSH
19590 chmod +x Cppsym
19591 $eunicefix Cppsym
19592 cat <<EOSH > Cppsym.try
19593 $startsh
19594 cat <<'EOCP' > try.c
19595 #include <stdio.h>
19596 int main() {
19597 EOCP
19598 $awk \\
19599 EOSH
19600 cat <<'EOSH' >> Cppsym.try
19601 'length($1) > 0 {
19602     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
19603     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
19604     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
19605     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
19606 }'       >> try.c
19607 echo 'return 0;}' >> try.c
19608 EOSH
19609 cat <<EOSH >> Cppsym.try
19610 ccflags="$ccflags"
19611 case "$osname-$gccversion" in
19612 irix-) ccflags="\$ccflags -woff 1178" ;;
19613 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19614 esac
19615 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19616 EOSH
19617 chmod +x Cppsym.try
19618 $eunicefix Cppsym.try
19619 ./Cppsym < Cppsym.know > Cppsym.true
19620 : now check the C compiler for additional symbols
19621 postprocess_cc_v=''
19622 case "$osname" in
19623 aix) postprocess_cc_v="|$tr , ' '" ;;
19624 esac
19625 $cat >ccsym <<EOS
19626 $startsh
19627 $cat >tmp.c <<EOF
19628 extern int foo;
19629 EOF
19630 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19631 do
19632         case "\$i" in
19633         -D*) echo "\$i" | $sed 's/^-D//';;
19634         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19635         esac
19636 done
19637 $rm -f try.c
19638 EOS
19639 postprocess_cc_v=''
19640 chmod +x ccsym
19641 $eunicefix ccsym
19642 ./ccsym > ccsym1.raw
19643 if $test -s ccsym1.raw; then
19644        $sort ccsym1.raw | $uniq >ccsym.raw
19645 else
19646        mv ccsym1.raw ccsym.raw
19647 fi
19648
19649 $awk '/\=/ { print $0; next }
19650         { print $0"=1" }' ccsym.raw >ccsym.list
19651 $awk '/\=/ { print $0; next }
19652         { print $0"=1" }' Cppsym.true >ccsym.true
19653 $comm -13 ccsym.true ccsym.list >ccsym.own
19654 $comm -12 ccsym.true ccsym.list >ccsym.com
19655 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19656 also=''
19657 if $test -z ccsym.raw; then
19658         echo "Your C compiler doesn't seem to define any symbols!" >&4
19659         echo " "
19660         echo "However, your C preprocessor defines the following symbols:"
19661         $cat Cppsym.true
19662         ccsymbols=''
19663         cppsymbols=`$cat Cppsym.true`
19664         cppsymbols=`echo $cppsymbols`
19665         cppccsymbols="$cppsymbols"
19666 else
19667         if $test -s ccsym.com; then
19668                 echo "Your C compiler and pre-processor define these symbols:"
19669                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19670                 also='also '
19671                 symbols='ones'
19672                 cppccsymbols=`$cat ccsym.com`
19673                 cppccsymbols=`echo $cppccsymbols`
19674                 $test "$silent" || sleep 1
19675         fi
19676         if $test -s ccsym.cpp; then
19677                 $test "$also" && echo " "
19678                 echo "Your C pre-processor ${also}defines the following symbols:"
19679                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19680                 also='further '
19681                 cppsymbols=`$cat ccsym.cpp`
19682                 cppsymbols=`echo $cppsymbols`
19683                 $test "$silent" || sleep 1
19684         fi
19685         if $test -s ccsym.own; then
19686                 $test "$also" && echo " "
19687                 echo "Your C compiler ${also}defines the following cpp symbols:"
19688                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19689                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19690                 ccsymbols=`$cat ccsym.own`
19691                 ccsymbols=`echo $ccsymbols`
19692                 $test "$silent" || sleep 1
19693         fi
19694 fi
19695
19696 : see if this is a termio system
19697 val="$undef"
19698 val2="$undef"
19699 val3="$undef"
19700 if $test `./findhdr termios.h`; then
19701         set tcsetattr i_termios
19702         eval $inlibc
19703         val3="$i_termios"
19704 fi
19705 echo " "
19706 case "$val3" in
19707 "$define") echo "You have POSIX termios.h... good!" >&4;;
19708 *) if ./Cppsym pyr; then
19709                 case "`/bin/universe`" in
19710                 ucb) if $test `./findhdr sgtty.h`; then
19711                                 val2="$define"
19712                                 echo "<sgtty.h> found." >&4
19713                         else
19714                                 echo "System is pyramid with BSD universe."
19715                                 echo "<sgtty.h> not found--you could have problems." >&4
19716                         fi;;
19717                 *) if $test `./findhdr termio.h`; then
19718                                 val="$define"
19719                                 echo "<termio.h> found." >&4
19720                         else
19721                                 echo "System is pyramid with USG universe."
19722                                 echo "<termio.h> not found--you could have problems." >&4
19723                         fi;;
19724                 esac
19725         elif ./usg; then
19726                 if $test `./findhdr termio.h`; then
19727                         echo "<termio.h> found." >&4
19728                         val="$define"
19729                 elif $test `./findhdr sgtty.h`; then
19730                         echo "<sgtty.h> found." >&4
19731                         val2="$define"
19732                 else
19733 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19734                 fi
19735         else
19736                 if $test `./findhdr sgtty.h`; then
19737                         echo "<sgtty.h> found." >&4
19738                         val2="$define"
19739                 elif $test `./findhdr termio.h`; then
19740                         echo "<termio.h> found." >&4
19741                         val="$define"
19742                 else
19743 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19744                 fi
19745         fi;;
19746 esac
19747 set i_termio; eval $setvar
19748 val=$val2; set i_sgtty; eval $setvar
19749 val=$val3; set i_termios; eval $setvar
19750
19751 : see if stddef is available
19752 set stddef.h i_stddef
19753 eval $inhdr
19754
19755 : see if this is a sunmath.h system
19756 set sunmath.h i_sunmath
19757 eval $inhdr
19758
19759 : see if sys/access.h is available
19760 set sys/access.h i_sysaccess
19761 eval $inhdr
19762
19763 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19764 set sys/filio.h i_sysfilio
19765 eval $inhdr
19766 echo " "
19767 if $test `./findhdr sys/ioctl.h`; then
19768         val="$define"
19769         echo '<sys/ioctl.h> found.' >&4
19770 else
19771         val="$undef"
19772         if $test $i_sysfilio = "$define"; then
19773             echo '<sys/ioctl.h> NOT found.' >&4
19774         else
19775                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19776                 $test $i_termio = "$define" && xxx="termio.h"
19777                 $test $i_termios = "$define" && xxx="termios.h"
19778 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19779         fi
19780 fi
19781 set i_sysioctl
19782 eval $setvar
19783
19784 : see if socket ioctl defs are in sys/sockio.h
19785 echo " "
19786 xxx=`./findhdr sys/sockio.h`
19787 if $test "$xxx"; then
19788         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19789                 val="$define"
19790                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19791         else
19792                 val="$undef"
19793                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19794         fi
19795 else
19796         val="$undef"
19797         $cat <<EOM
19798 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19799 EOM
19800 fi
19801 set i_syssockio
19802 eval $setvar
19803
19804
19805 : see if this is a syslog.h system
19806 set syslog.h i_syslog
19807 eval $inhdr
19808
19809
19810 : see if this is a sys/mode.h system
19811 set sys/mode.h i_sysmode
19812 eval $inhdr
19813
19814 : see if sys/resource.h has to be included
19815 set sys/resource.h i_sysresrc
19816 eval $inhdr
19817
19818 : see if sys/security.h is available
19819 set sys/security.h i_syssecrt
19820 eval $inhdr
19821
19822 : see if this is a sys/statvfs.h system
19823 set sys/statvfs.h i_sysstatvfs
19824 eval $inhdr
19825
19826 : see if this is a sys/un.h system
19827 set sys/un.h i_sysun
19828 eval $inhdr
19829
19830
19831 : see if this is a sys/utsname.h system
19832 set sys/utsname.h i_sysutsname
19833 eval $inhdr
19834
19835 : see if this is a syswait system
19836 set sys/wait.h i_syswait
19837 eval $inhdr
19838
19839 : see if this is a ustat.h system
19840 set ustat.h i_ustat
19841 eval $inhdr
19842
19843 : see if this is an utime system
19844 set utime.h i_utime
19845 eval $inhdr
19846
19847 : see if this is a values.h system
19848 set values.h i_values
19849 eval $inhdr
19850
19851 : see if this is a vfork system
19852 case "$d_vfork" in
19853 "$define")
19854         set vfork.h i_vfork
19855         eval $inhdr
19856         ;;
19857 *)
19858         i_vfork="$undef"
19859         ;;
19860 esac
19861
19862 : see if gdbm.h is available
19863 set gdbm.h t_gdbm
19864 eval $inhdr
19865 case "$t_gdbm" in
19866 $define)
19867         : see if gdbm_open exists
19868         set gdbm_open d_gdbm_open
19869         eval $inlibc
19870         case "$d_gdbm_open" in
19871         $undef)
19872                 t_gdbm="$undef"
19873                 echo "We won't be including <gdbm.h>"
19874                 ;;
19875         esac
19876         ;;
19877 esac
19878 val="$t_gdbm"
19879 set i_gdbm
19880 eval $setvar
19881
19882 echo " "
19883 echo "Looking for extensions..." >&4
19884 : If we are using the old config.sh, known_extensions may contain
19885 : old or inaccurate or duplicate values.
19886 known_extensions=''
19887 nonxs_extensions=''
19888 : We do not use find because it might not be available.
19889 : We do not just use MANIFEST because the user may have dropped
19890 : some additional extensions into the source tree and expect them
19891 : to be built.
19892
19893 : Function to recursively find available extensions, ignoring DynaLoader
19894 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19895 find_extensions='
19896     for xxx in *; do
19897        case "$xxx" in
19898            DynaLoader|dynaload) ;;
19899            *)
19900            if $test -f $xxx/$xxx.xs; then
19901                known_extensions="$known_extensions $1$xxx";
19902            elif $test -f $xxx/Makefile.PL; then
19903                nonxs_extensions="$nonxs_extensions $1$xxx";
19904            else
19905                if $test -d $xxx -a $# -lt 10; then
19906                    set $1$xxx/ $*;
19907                    cd "$xxx";
19908                    eval $find_extensions;
19909                    cd ..;
19910                    shift;
19911                fi;
19912            fi
19913            ;;
19914        esac;
19915     done'
19916 tdir=`pwd`
19917 cd "$rsrc/ext"
19918 set X
19919 shift
19920 eval $find_extensions
19921 # Special case:  Add in threads/shared since it is not picked up by the
19922 # recursive find above (and adding in general recursive finding breaks
19923 # SDBM_File/sdbm).  A.D.  10/25/2001.
19924 known_extensions="$known_extensions threads/shared"
19925 set X $nonxs_extensions
19926 shift
19927 nonxs_extensions="$*"
19928 set X $known_extensions
19929 shift
19930 known_extensions="$*"
19931 cd "$tdir"
19932
19933 : Now see which are supported on this system.
19934 avail_ext=''
19935 for xxx in $known_extensions ; do
19936         case "$xxx" in
19937         DB_File|db_file)
19938                 case "$i_db" in
19939                 $define) avail_ext="$avail_ext $xxx" ;;
19940                 esac
19941                 ;;
19942         GDBM_File|gdbm_fil)
19943                 case "$i_gdbm" in 
19944                 $define) avail_ext="$avail_ext $xxx" ;;
19945                 esac
19946                 ;;
19947         I18N/Langinfo|i18n_lan)
19948                 case "$i_langinfo$d_nl_langinfo" in 
19949                 $define$define) avail_ext="$avail_ext $xxx" ;;
19950                 esac
19951                 ;;
19952         NDBM_File|ndbm_fil)
19953                 case "$i_ndbm" in
19954                 $define)
19955                     case "$osname-$use64bitint" in
19956                     hpux-define)
19957                         case "$libs" in
19958                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19959                         esac
19960                         ;;
19961                     *) avail_ext="$avail_ext $xxx" ;;
19962                     esac
19963                     ;;
19964                 esac
19965                 ;;
19966         ODBM_File|odbm_fil) 
19967                 case "${i_dbm}${i_rpcsvcdbm}" in
19968                 *"${define}"*)
19969                     case "$osname-$use64bitint" in
19970                     hpux-define)
19971                         case "$libs" in
19972                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19973                         esac
19974                         ;;
19975                     *) avail_ext="$avail_ext $xxx" ;;
19976                     esac
19977                     ;;
19978                 esac
19979                 ;;
19980         POSIX|posix)
19981                 case "$useposix" in
19982                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19983                 esac
19984                 ;;
19985         Opcode|opcode)
19986                 case "$useopcode" in
19987                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19988                 esac
19989                 ;;
19990         Socket|socket)
19991                 case "$d_socket" in 
19992                 true|$define|y)
19993                     case "$osname" in
19994                     beos) ;; # not unless BONE
19995                     *) avail_ext="$avail_ext $xxx" ;;
19996                     esac
19997                     ;;
19998                 esac
19999                 ;;
20000         Sys/Syslog|sys/syslog)
20001                 : XXX syslog requires socket
20002                 case "$d_socket" in 
20003                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20004                 esac
20005                 ;;
20006         Thread|thread)
20007                 case "$usethreads" in
20008                 true|$define|y)
20009                         case "$useithreads" in
20010                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20011                         esac
20012                 esac
20013                 ;;
20014         XS/APItest|xs/apitest)
20015                 # This is just for testing.  Skip it unless we have dynamic loading.
20016
20017                 case "$usedl" in
20018                 $define) avail_ext="$avail_ext $xxx" ;;
20019                 esac
20020                 ;;
20021         XS/Typemap|xs/typemap)
20022                 # This is just for testing.  Skip it unless we have dynamic loading.
20023                 case "$usedl" in
20024                 $define) avail_ext="$avail_ext $xxx" ;;
20025                 esac
20026                 ;;
20027         threads|threads/shared)
20028                 # threads and threads::shared are special cases.
20029                 # To stop people from asking "Perl 5.8.0 was supposed
20030                 # to have this new fancy threads implementation but my
20031                 # perl doesn't have it" and from people trying to
20032                 # (re)install the threads module using CPAN.pm and
20033                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20034                 # the threads.pm and threads/shared.pm will always be
20035                 # there, croaking informatively ("you need to rebuild
20036                 # all of Perl with threads, sorry") when threads haven't
20037                 # been compiled in.
20038                 # --jhi
20039                 avail_ext="$avail_ext $xxx"
20040                 ;;
20041         IPC/SysV|ipc/sysv)
20042                 : XXX Do we need a useipcsysv variable here
20043                 case "${d_msg}${d_sem}${d_shm}" in 
20044                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20045                 esac
20046                 ;;
20047         *)      avail_ext="$avail_ext $xxx"
20048                 ;;
20049         esac
20050 done
20051
20052 set X $avail_ext
20053 shift
20054 avail_ext="$*"
20055
20056 : Now see which nonxs extensions are supported on this system.
20057 : For now assume all are.
20058 nonxs_ext=''
20059 for xxx in $nonxs_extensions ; do
20060         case "$xxx" in
20061         *)      nonxs_ext="$nonxs_ext $xxx"
20062                 ;;
20063         esac
20064 done
20065
20066 set X $nonxs_ext
20067 shift
20068 nonxs_ext="$*"
20069
20070 case $usedl in
20071 $define)
20072         $cat <<EOM
20073 A number of extensions are supplied with $package.  You may choose to
20074 compile these extensions for dynamic loading (the default), compile
20075 them into the $package executable (static loading), or not include
20076 them at all.  Answer "none" to include no extensions.
20077 Note that DynaLoader is always built and need not be mentioned here.
20078
20079 EOM
20080         case "$dynamic_ext" in
20081         '')
20082                 : Exclude those listed in static_ext
20083                 dflt=''
20084                 for xxx in $avail_ext; do
20085                         case " $static_ext " in
20086                         *" $xxx "*) ;;
20087                         *) dflt="$dflt $xxx" ;;
20088                         esac
20089                 done
20090                 set X $dflt
20091                 shift
20092                 dflt="$*"
20093                 ;;
20094         *)      dflt="$dynamic_ext"
20095                 # Perhaps we are reusing an old out-of-date config.sh.
20096                 case "$hint" in
20097                 previous)
20098                         if test X"$dynamic_ext" != X"$avail_ext"; then
20099                                 $cat <<EOM
20100 NOTICE:  Your previous config.sh list may be incorrect. 
20101 The extensions now available to you are 
20102         ${avail_ext}
20103 but the default list from your previous config.sh is
20104         ${dynamic_ext} 
20105
20106 EOM
20107                         fi
20108                         ;;
20109                 esac
20110                 ;;
20111         esac
20112         case "$dflt" in
20113         '')     dflt=none;;
20114         esac
20115         rp="What extensions do you wish to load dynamically?"
20116         . ./myread
20117         case "$ans" in
20118         none) dynamic_ext=' ' ;;
20119         *) dynamic_ext="$ans" ;;
20120         esac
20121
20122         case "$static_ext" in
20123         '')
20124                 : Exclude those already listed in dynamic linking
20125                 dflt=''
20126                 for xxx in $avail_ext; do
20127                         case " $dynamic_ext " in
20128                         *" $xxx "*) ;;
20129                         *) dflt="$dflt $xxx" ;;
20130                         esac
20131                 done
20132                 set X $dflt
20133                 shift
20134                 dflt="$*"
20135                 ;;
20136         *)  dflt="$static_ext" 
20137                 ;;
20138         esac
20139
20140         case "$dflt" in
20141         '')     dflt=none;;
20142         esac
20143         rp="What extensions do you wish to load statically?"
20144         . ./myread
20145         case "$ans" in
20146         none) static_ext=' ' ;;
20147         *) static_ext="$ans" ;;
20148         esac
20149         ;;
20150 *)
20151         $cat <<EOM
20152 A number of extensions are supplied with $package.  Answer "none" 
20153 to include no extensions. 
20154 Note that DynaLoader is always built and need not be mentioned here.
20155
20156 EOM
20157         case "$static_ext" in
20158         '') dflt="$avail_ext" ;;
20159         *)      dflt="$static_ext"
20160                 # Perhaps we are reusing an old out-of-date config.sh.
20161                 case "$hint" in
20162                 previous)
20163                         if test X"$static_ext" != X"$avail_ext"; then
20164                                 $cat <<EOM
20165 NOTICE:  Your previous config.sh list may be incorrect. 
20166 The extensions now available to you are 
20167         ${avail_ext}
20168 but the default list from your previous config.sh is
20169         ${static_ext} 
20170
20171 EOM
20172                         fi
20173                         ;;
20174                 esac
20175                 ;;
20176         esac
20177         : Exclude those that are not xs extensions
20178         case "$dflt" in
20179         '')     dflt=none;;
20180         esac
20181         rp="What extensions do you wish to include?"
20182         . ./myread
20183         case "$ans" in
20184         none) static_ext=' ' ;;
20185         *) static_ext="$ans" ;;
20186         esac
20187         ;;
20188 esac
20189 #        
20190 # Encode is a special case.  If we are building Encode as a static
20191 # extension, we need to explicitly list its subextensions as well.
20192 # For other nested extensions, this is handled automatically by
20193 # the appropriate Makefile.PL.
20194 case " $static_ext " in
20195         *" Encode "*) # Add the subextensions of Encode
20196         cd "$rsrc/ext"
20197         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20198                 static_ext="$static_ext Encode/$xxx"
20199         done
20200         cd "$tdir"
20201         ;;
20202 esac
20203
20204 set X $dynamic_ext $static_ext $nonxs_ext
20205 shift
20206 extensions="$*"
20207
20208 case "$onlyextensions" in
20209 '') ;;
20210 *)  keepextensions=''
20211     echo "You have requested that only certains extensions be included..." >&4
20212     for i in $onlyextensions; do
20213         case " $extensions " in
20214         *" $i "*)
20215             echo "Keeping extension $i."
20216             keepextensions="$keepextensions $i"
20217             ;;
20218         *) echo "Ignoring extension $i." ;;
20219         esac
20220     done
20221     extensions="$keepextensions"
20222     ;;
20223 esac
20224
20225 case "$noextensions" in
20226 '') ;;
20227 *)  keepextensions=''
20228     echo "You have requested that certain extensions be ignored..." >&4
20229     for i in $extensions; do
20230         case " $i " in
20231         " $noextensions ") echo "Ignoring extension $i." ;;
20232         *) echo "Keeping extension $i.";
20233            keepextensions="$keepextensions $i"
20234            ;;
20235         esac
20236     done
20237     extensions="$keepextensions"
20238     ;;
20239 esac
20240
20241 case "$extensions" in
20242 *"_File "*" Fcntl "*" IO "*) ;;
20243 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20244    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20245    ;;
20246 esac
20247
20248 : Remove libraries needed only for extensions
20249 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20250 : The exception is SunOS 4.x, which needs them.
20251 case "${osname}X${osvers}" in
20252 sunos*X4*)
20253     perllibs="$libs"
20254     ;;
20255 *) case "$usedl" in
20256     $define|true|[yY]*)
20257             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20258             shift
20259             perllibs="$*"
20260             ;;
20261     *)  perllibs="$libs"
20262             ;;
20263     esac
20264     ;;
20265 esac
20266
20267 : Remove build directory name from cppstdin so it can be used from
20268 : either the present location or the final installed location.
20269 echo " "
20270 : Get out of the UU directory to get correct path name.
20271 cd ..
20272 case "$cppstdin" in
20273 `pwd`/cppstdin)
20274         echo "Stripping down cppstdin path name"
20275         cppstdin=cppstdin
20276         ;;
20277 esac
20278 cd UU
20279
20280 : end of configuration questions
20281 echo " "
20282 echo "End of configuration questions."
20283 echo " "
20284
20285 : back to where it started
20286 if test -d ../UU; then
20287         cd ..
20288 fi
20289
20290 : configuration may be patched via a 'config.arch' file
20291 if $test -f config.arch; then
20292         echo "I see a config.arch file, loading it."
20293         . ./config.arch
20294 fi
20295
20296 : configuration may be patched via a 'config.over' file
20297 if $test -f config.over; then
20298         echo " "
20299         dflt=y
20300         rp='I see a config.over file.  Do you wish to load it?'
20301         . UU/myread
20302         case "$ans" in
20303         n*) echo "OK, I'll ignore it.";;
20304         *)      . ./config.over
20305                 echo "Configuration override changes have been loaded."
20306                 ;;
20307         esac
20308 fi
20309
20310 : in case they want portability, strip down executable paths
20311 case "$d_portable" in
20312 "$define")
20313         echo " "
20314         echo "Stripping down executable paths..." >&4
20315         for file in $loclist $trylist; do
20316                 eval temp=\$$file
20317                 eval $file=`basename $temp`
20318         done
20319         ;;
20320 esac
20321
20322 : create config.sh file
20323 echo " "
20324 echo "Creating config.sh..." >&4
20325 $spitshell <<EOT >config.sh
20326 $startsh
20327 #
20328 # This file was produced by running the Configure script. It holds all the
20329 # definitions figured out by Configure. Should you modify one of these values,
20330 # do not forget to propagate your changes by running "Configure -der". You may
20331 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20332 #
20333
20334 # Package name      : $package
20335 # Source directory  : $src
20336 # Configuration time: $cf_time
20337 # Configured by     : $cf_by
20338 # Target system     : $myuname
20339
20340 Author='$Author'
20341 Date='$Date'
20342 Header='$Header'
20343 Id='$Id'
20344 Locker='$Locker'
20345 Log='$Log'
20346 Mcc='$Mcc'
20347 RCSfile='$RCSfile'
20348 Revision='$Revision'
20349 Source='$Source'
20350 State='$State'
20351 _a='$_a'
20352 _exe='$_exe'
20353 _o='$_o'
20354 afs='$afs'
20355 afsroot='$afsroot'
20356 alignbytes='$alignbytes'
20357 ansi2knr='$ansi2knr'
20358 aphostname='$aphostname'
20359 api_revision='$api_revision'
20360 api_subversion='$api_subversion'
20361 api_version='$api_version'
20362 api_versionstring='$api_versionstring'
20363 ar='$ar'
20364 archlib='$archlib'
20365 archlibexp='$archlibexp'
20366 archname64='$archname64'
20367 archname='$archname'
20368 archobjs='$archobjs'
20369 asctime_r_proto='$asctime_r_proto'
20370 awk='$awk'
20371 baserev='$baserev'
20372 bash='$bash'
20373 bin='$bin'
20374 binexp='$binexp'
20375 bison='$bison'
20376 byacc='$byacc'
20377 byteorder='$byteorder'
20378 c='$c'
20379 castflags='$castflags'
20380 cat='$cat'
20381 cc='$cc'
20382 cccdlflags='$cccdlflags'
20383 ccdlflags='$ccdlflags'
20384 ccflags='$ccflags'
20385 ccflags_uselargefiles='$ccflags_uselargefiles'
20386 ccname='$ccname'
20387 ccsymbols='$ccsymbols'
20388 ccversion='$ccversion'
20389 cf_by='$cf_by'
20390 cf_email='$cf_email'
20391 cf_time='$cf_time'
20392 charsize='$charsize'
20393 chgrp='$chgrp'
20394 chmod='$chmod'
20395 chown='$chown'
20396 clocktype='$clocktype'
20397 comm='$comm'
20398 compress='$compress'
20399 contains='$contains'
20400 cp='$cp'
20401 cpio='$cpio'
20402 cpp='$cpp'
20403 cpp_stuff='$cpp_stuff'
20404 cppccsymbols='$cppccsymbols'
20405 cppflags='$cppflags'
20406 cpplast='$cpplast'
20407 cppminus='$cppminus'
20408 cpprun='$cpprun'
20409 cppstdin='$cppstdin'
20410 cppsymbols='$cppsymbols'
20411 crypt_r_proto='$crypt_r_proto'
20412 cryptlib='$cryptlib'
20413 csh='$csh'
20414 ctermid_r_proto='$ctermid_r_proto'
20415 ctime_r_proto='$ctime_r_proto'
20416 d_Gconvert='$d_Gconvert'
20417 d_PRIEUldbl='$d_PRIEUldbl'
20418 d_PRIFUldbl='$d_PRIFUldbl'
20419 d_PRIGUldbl='$d_PRIGUldbl'
20420 d_PRIXU64='$d_PRIXU64'
20421 d_PRId64='$d_PRId64'
20422 d_PRIeldbl='$d_PRIeldbl'
20423 d_PRIfldbl='$d_PRIfldbl'
20424 d_PRIgldbl='$d_PRIgldbl'
20425 d_PRIi64='$d_PRIi64'
20426 d_PRIo64='$d_PRIo64'
20427 d_PRIu64='$d_PRIu64'
20428 d_PRIx64='$d_PRIx64'
20429 d_SCNfldbl='$d_SCNfldbl'
20430 d__fwalk='$d__fwalk'
20431 d_access='$d_access'
20432 d_accessx='$d_accessx'
20433 d_aintl='$d_aintl'
20434 d_alarm='$d_alarm'
20435 d_archlib='$d_archlib'
20436 d_asctime_r='$d_asctime_r'
20437 d_atolf='$d_atolf'
20438 d_atoll='$d_atoll'
20439 d_attribut='$d_attribut'
20440 d_bcmp='$d_bcmp'
20441 d_bcopy='$d_bcopy'
20442 d_bsd='$d_bsd'
20443 d_bsdgetpgrp='$d_bsdgetpgrp'
20444 d_bsdsetpgrp='$d_bsdsetpgrp'
20445 d_bzero='$d_bzero'
20446 d_casti32='$d_casti32'
20447 d_castneg='$d_castneg'
20448 d_charvspr='$d_charvspr'
20449 d_chown='$d_chown'
20450 d_chroot='$d_chroot'
20451 d_chsize='$d_chsize'
20452 d_class='$d_class'
20453 d_closedir='$d_closedir'
20454 d_cmsghdr_s='$d_cmsghdr_s'
20455 d_const='$d_const'
20456 d_copysignl='$d_copysignl'
20457 d_crypt='$d_crypt'
20458 d_crypt_r='$d_crypt_r'
20459 d_csh='$d_csh'
20460 d_ctermid_r='$d_ctermid_r'
20461 d_ctime_r='$d_ctime_r'
20462 d_cuserid='$d_cuserid'
20463 d_dbl_dig='$d_dbl_dig'
20464 d_dbminitproto='$d_dbminitproto'
20465 d_difftime='$d_difftime'
20466 d_dirfd='$d_dirfd'
20467 d_dirnamlen='$d_dirnamlen'
20468 d_dlerror='$d_dlerror'
20469 d_dlopen='$d_dlopen'
20470 d_dlsymun='$d_dlsymun'
20471 d_dosuid='$d_dosuid'
20472 d_drand48_r='$d_drand48_r'
20473 d_drand48proto='$d_drand48proto'
20474 d_dup2='$d_dup2'
20475 d_eaccess='$d_eaccess'
20476 d_endgrent='$d_endgrent'
20477 d_endgrent_r='$d_endgrent_r'
20478 d_endhent='$d_endhent'
20479 d_endhostent_r='$d_endhostent_r'
20480 d_endnent='$d_endnent'
20481 d_endnetent_r='$d_endnetent_r'
20482 d_endpent='$d_endpent'
20483 d_endprotoent_r='$d_endprotoent_r'
20484 d_endpwent='$d_endpwent'
20485 d_endpwent_r='$d_endpwent_r'
20486 d_endsent='$d_endsent'
20487 d_endservent_r='$d_endservent_r'
20488 d_eofnblk='$d_eofnblk'
20489 d_eunice='$d_eunice'
20490 d_fchdir='$d_fchdir'
20491 d_fchmod='$d_fchmod'
20492 d_fchown='$d_fchown'
20493 d_fcntl='$d_fcntl'
20494 d_fcntl_can_lock='$d_fcntl_can_lock'
20495 d_fd_macros='$d_fd_macros'
20496 d_fd_set='$d_fd_set'
20497 d_fds_bits='$d_fds_bits'
20498 d_fgetpos='$d_fgetpos'
20499 d_finite='$d_finite'
20500 d_finitel='$d_finitel'
20501 d_flexfnam='$d_flexfnam'
20502 d_flock='$d_flock'
20503 d_flockproto='$d_flockproto'
20504 d_fork='$d_fork'
20505 d_fp_class='$d_fp_class'
20506 d_fpathconf='$d_fpathconf'
20507 d_fpclass='$d_fpclass'
20508 d_fpclassify='$d_fpclassify'
20509 d_fpclassl='$d_fpclassl'
20510 d_fpos64_t='$d_fpos64_t'
20511 d_frexpl='$d_frexpl'
20512 d_fs_data_s='$d_fs_data_s'
20513 d_fseeko='$d_fseeko'
20514 d_fsetpos='$d_fsetpos'
20515 d_fstatfs='$d_fstatfs'
20516 d_fstatvfs='$d_fstatvfs'
20517 d_fsync='$d_fsync'
20518 d_ftello='$d_ftello'
20519 d_ftime='$d_ftime'
20520 d_getcwd='$d_getcwd'
20521 d_getespwnam='$d_getespwnam'
20522 d_getfsstat='$d_getfsstat'
20523 d_getgrent='$d_getgrent'
20524 d_getgrent_r='$d_getgrent_r'
20525 d_getgrgid_r='$d_getgrgid_r'
20526 d_getgrnam_r='$d_getgrnam_r'
20527 d_getgrps='$d_getgrps'
20528 d_gethbyaddr='$d_gethbyaddr'
20529 d_gethbyname='$d_gethbyname'
20530 d_gethent='$d_gethent'
20531 d_gethname='$d_gethname'
20532 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20533 d_gethostbyname_r='$d_gethostbyname_r'
20534 d_gethostent_r='$d_gethostent_r'
20535 d_gethostprotos='$d_gethostprotos'
20536 d_getitimer='$d_getitimer'
20537 d_getlogin='$d_getlogin'
20538 d_getlogin_r='$d_getlogin_r'
20539 d_getmnt='$d_getmnt'
20540 d_getmntent='$d_getmntent'
20541 d_getnbyaddr='$d_getnbyaddr'
20542 d_getnbyname='$d_getnbyname'
20543 d_getnent='$d_getnent'
20544 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20545 d_getnetbyname_r='$d_getnetbyname_r'
20546 d_getnetent_r='$d_getnetent_r'
20547 d_getnetprotos='$d_getnetprotos'
20548 d_getpagsz='$d_getpagsz'
20549 d_getpbyname='$d_getpbyname'
20550 d_getpbynumber='$d_getpbynumber'
20551 d_getpent='$d_getpent'
20552 d_getpgid='$d_getpgid'
20553 d_getpgrp2='$d_getpgrp2'
20554 d_getpgrp='$d_getpgrp'
20555 d_getppid='$d_getppid'
20556 d_getprior='$d_getprior'
20557 d_getprotobyname_r='$d_getprotobyname_r'
20558 d_getprotobynumber_r='$d_getprotobynumber_r'
20559 d_getprotoent_r='$d_getprotoent_r'
20560 d_getprotoprotos='$d_getprotoprotos'
20561 d_getprpwnam='$d_getprpwnam'
20562 d_getpwent='$d_getpwent'
20563 d_getpwent_r='$d_getpwent_r'
20564 d_getpwnam_r='$d_getpwnam_r'
20565 d_getpwuid_r='$d_getpwuid_r'
20566 d_getsbyname='$d_getsbyname'
20567 d_getsbyport='$d_getsbyport'
20568 d_getsent='$d_getsent'
20569 d_getservbyname_r='$d_getservbyname_r'
20570 d_getservbyport_r='$d_getservbyport_r'
20571 d_getservent_r='$d_getservent_r'
20572 d_getservprotos='$d_getservprotos'
20573 d_getspnam='$d_getspnam'
20574 d_getspnam_r='$d_getspnam_r'
20575 d_gettimeod='$d_gettimeod'
20576 d_gmtime_r='$d_gmtime_r'
20577 d_gnulibc='$d_gnulibc'
20578 d_grpasswd='$d_grpasswd'
20579 d_hasmntopt='$d_hasmntopt'
20580 d_htonl='$d_htonl'
20581 d_ilogbl='$d_ilogbl'
20582 d_index='$d_index'
20583 d_inetaton='$d_inetaton'
20584 d_int64_t='$d_int64_t'
20585 d_isascii='$d_isascii'
20586 d_isfinite='$d_isfinite'
20587 d_isinf='$d_isinf'
20588 d_isnan='$d_isnan'
20589 d_isnanl='$d_isnanl'
20590 d_killpg='$d_killpg'
20591 d_lchown='$d_lchown'
20592 d_ldbl_dig='$d_ldbl_dig'
20593 d_link='$d_link'
20594 d_localtime_r='$d_localtime_r'
20595 d_locconv='$d_locconv'
20596 d_lockf='$d_lockf'
20597 d_longdbl='$d_longdbl'
20598 d_longlong='$d_longlong'
20599 d_lseekproto='$d_lseekproto'
20600 d_lstat='$d_lstat'
20601 d_madvise='$d_madvise'
20602 d_mblen='$d_mblen'
20603 d_mbstowcs='$d_mbstowcs'
20604 d_mbtowc='$d_mbtowc'
20605 d_memchr='$d_memchr'
20606 d_memcmp='$d_memcmp'
20607 d_memcpy='$d_memcpy'
20608 d_memmove='$d_memmove'
20609 d_memset='$d_memset'
20610 d_mkdir='$d_mkdir'
20611 d_mkdtemp='$d_mkdtemp'
20612 d_mkfifo='$d_mkfifo'
20613 d_mkstemp='$d_mkstemp'
20614 d_mkstemps='$d_mkstemps'
20615 d_mktime='$d_mktime'
20616 d_mmap='$d_mmap'
20617 d_modfl='$d_modfl'
20618 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20619 d_modflproto='$d_modflproto'
20620 d_mprotect='$d_mprotect'
20621 d_msg='$d_msg'
20622 d_msg_ctrunc='$d_msg_ctrunc'
20623 d_msg_dontroute='$d_msg_dontroute'
20624 d_msg_oob='$d_msg_oob'
20625 d_msg_peek='$d_msg_peek'
20626 d_msg_proxy='$d_msg_proxy'
20627 d_msgctl='$d_msgctl'
20628 d_msgget='$d_msgget'
20629 d_msghdr_s='$d_msghdr_s'
20630 d_msgrcv='$d_msgrcv'
20631 d_msgsnd='$d_msgsnd'
20632 d_msync='$d_msync'
20633 d_munmap='$d_munmap'
20634 d_mymalloc='$d_mymalloc'
20635 d_nanosleep='$d_nanosleep'
20636 d_nice='$d_nice'
20637 d_nl_langinfo='$d_nl_langinfo'
20638 d_nv_preserves_uv='$d_nv_preserves_uv'
20639 d_off64_t='$d_off64_t'
20640 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20641 d_oldpthreads='$d_oldpthreads'
20642 d_oldsock='$d_oldsock'
20643 d_open3='$d_open3'
20644 d_pathconf='$d_pathconf'
20645 d_pause='$d_pause'
20646 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20647 d_phostname='$d_phostname'
20648 d_pipe='$d_pipe'
20649 d_poll='$d_poll'
20650 d_portable='$d_portable'
20651 d_procselfexe='$d_procselfexe'
20652 d_pthread_atfork='$d_pthread_atfork'
20653 d_pthread_yield='$d_pthread_yield'
20654 d_pwage='$d_pwage'
20655 d_pwchange='$d_pwchange'
20656 d_pwclass='$d_pwclass'
20657 d_pwcomment='$d_pwcomment'
20658 d_pwexpire='$d_pwexpire'
20659 d_pwgecos='$d_pwgecos'
20660 d_pwpasswd='$d_pwpasswd'
20661 d_pwquota='$d_pwquota'
20662 d_qgcvt='$d_qgcvt'
20663 d_quad='$d_quad'
20664 d_random_r='$d_random_r'
20665 d_readdir64_r='$d_readdir64_r'
20666 d_readdir='$d_readdir'
20667 d_readdir_r='$d_readdir_r'
20668 d_readlink='$d_readlink'
20669 d_readv='$d_readv'
20670 d_recvmsg='$d_recvmsg'
20671 d_rename='$d_rename'
20672 d_rewinddir='$d_rewinddir'
20673 d_rmdir='$d_rmdir'
20674 d_safebcpy='$d_safebcpy'
20675 d_safemcpy='$d_safemcpy'
20676 d_sanemcmp='$d_sanemcmp'
20677 d_sbrkproto='$d_sbrkproto'
20678 d_scalbnl='$d_scalbnl'
20679 d_sched_yield='$d_sched_yield'
20680 d_scm_rights='$d_scm_rights'
20681 d_seekdir='$d_seekdir'
20682 d_select='$d_select'
20683 d_sem='$d_sem'
20684 d_semctl='$d_semctl'
20685 d_semctl_semid_ds='$d_semctl_semid_ds'
20686 d_semctl_semun='$d_semctl_semun'
20687 d_semget='$d_semget'
20688 d_semop='$d_semop'
20689 d_sendmsg='$d_sendmsg'
20690 d_setegid='$d_setegid'
20691 d_seteuid='$d_seteuid'
20692 d_setgrent='$d_setgrent'
20693 d_setgrent_r='$d_setgrent_r'
20694 d_setgrps='$d_setgrps'
20695 d_sethent='$d_sethent'
20696 d_sethostent_r='$d_sethostent_r'
20697 d_setitimer='$d_setitimer'
20698 d_setlinebuf='$d_setlinebuf'
20699 d_setlocale='$d_setlocale'
20700 d_setlocale_r='$d_setlocale_r'
20701 d_setnent='$d_setnent'
20702 d_setnetent_r='$d_setnetent_r'
20703 d_setpent='$d_setpent'
20704 d_setpgid='$d_setpgid'
20705 d_setpgrp2='$d_setpgrp2'
20706 d_setpgrp='$d_setpgrp'
20707 d_setprior='$d_setprior'
20708 d_setproctitle='$d_setproctitle'
20709 d_setprotoent_r='$d_setprotoent_r'
20710 d_setpwent='$d_setpwent'
20711 d_setpwent_r='$d_setpwent_r'
20712 d_setregid='$d_setregid'
20713 d_setresgid='$d_setresgid'
20714 d_setresuid='$d_setresuid'
20715 d_setreuid='$d_setreuid'
20716 d_setrgid='$d_setrgid'
20717 d_setruid='$d_setruid'
20718 d_setsent='$d_setsent'
20719 d_setservent_r='$d_setservent_r'
20720 d_setsid='$d_setsid'
20721 d_setvbuf='$d_setvbuf'
20722 d_sfio='$d_sfio'
20723 d_shm='$d_shm'
20724 d_shmat='$d_shmat'
20725 d_shmatprototype='$d_shmatprototype'
20726 d_shmctl='$d_shmctl'
20727 d_shmdt='$d_shmdt'
20728 d_shmget='$d_shmget'
20729 d_sigaction='$d_sigaction'
20730 d_sigprocmask='$d_sigprocmask'
20731 d_sigsetjmp='$d_sigsetjmp'
20732 d_sockatmark='$d_sockatmark'
20733 d_sockatmarkproto='$d_sockatmarkproto'
20734 d_socket='$d_socket'
20735 d_socklen_t='$d_socklen_t'
20736 d_sockpair='$d_sockpair'
20737 d_socks5_init='$d_socks5_init'
20738 d_sqrtl='$d_sqrtl'
20739 d_srand48_r='$d_srand48_r'
20740 d_srandom_r='$d_srandom_r'
20741 d_sresgproto='$d_sresgproto'
20742 d_sresuproto='$d_sresuproto'
20743 d_statblks='$d_statblks'
20744 d_statfs_f_flags='$d_statfs_f_flags'
20745 d_statfs_s='$d_statfs_s'
20746 d_statvfs='$d_statvfs'
20747 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20748 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20749 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20750 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20751 d_stdio_stream_array='$d_stdio_stream_array'
20752 d_stdiobase='$d_stdiobase'
20753 d_stdstdio='$d_stdstdio'
20754 d_strchr='$d_strchr'
20755 d_strcoll='$d_strcoll'
20756 d_strctcpy='$d_strctcpy'
20757 d_strerrm='$d_strerrm'
20758 d_strerror='$d_strerror'
20759 d_strerror_r='$d_strerror_r'
20760 d_strftime='$d_strftime'
20761 d_strtod='$d_strtod'
20762 d_strtol='$d_strtol'
20763 d_strtold='$d_strtold'
20764 d_strtoll='$d_strtoll'
20765 d_strtoq='$d_strtoq'
20766 d_strtoul='$d_strtoul'
20767 d_strtoull='$d_strtoull'
20768 d_strtouq='$d_strtouq'
20769 d_strxfrm='$d_strxfrm'
20770 d_suidsafe='$d_suidsafe'
20771 d_symlink='$d_symlink'
20772 d_syscall='$d_syscall'
20773 d_syscallproto='$d_syscallproto'
20774 d_sysconf='$d_sysconf'
20775 d_sysernlst='$d_sysernlst'
20776 d_syserrlst='$d_syserrlst'
20777 d_system='$d_system'
20778 d_tcgetpgrp='$d_tcgetpgrp'
20779 d_tcsetpgrp='$d_tcsetpgrp'
20780 d_telldir='$d_telldir'
20781 d_telldirproto='$d_telldirproto'
20782 d_time='$d_time'
20783 d_times='$d_times'
20784 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20785 d_tm_tm_zone='$d_tm_tm_zone'
20786 d_tmpnam_r='$d_tmpnam_r'
20787 d_truncate='$d_truncate'
20788 d_ttyname_r='$d_ttyname_r'
20789 d_tzname='$d_tzname'
20790 d_u32align='$d_u32align'
20791 d_ualarm='$d_ualarm'
20792 d_umask='$d_umask'
20793 d_uname='$d_uname'
20794 d_union_semun='$d_union_semun'
20795 d_unordered='$d_unordered'
20796 d_usleep='$d_usleep'
20797 d_usleepproto='$d_usleepproto'
20798 d_ustat='$d_ustat'
20799 d_vendorarch='$d_vendorarch'
20800 d_vendorbin='$d_vendorbin'
20801 d_vendorlib='$d_vendorlib'
20802 d_vendorscript='$d_vendorscript'
20803 d_vfork='$d_vfork'
20804 d_void_closedir='$d_void_closedir'
20805 d_voidsig='$d_voidsig'
20806 d_voidtty='$d_voidtty'
20807 d_volatile='$d_volatile'
20808 d_vprintf='$d_vprintf'
20809 d_wait4='$d_wait4'
20810 d_waitpid='$d_waitpid'
20811 d_wcstombs='$d_wcstombs'
20812 d_wctomb='$d_wctomb'
20813 d_writev='$d_writev'
20814 d_xenix='$d_xenix'
20815 date='$date'
20816 db_hashtype='$db_hashtype'
20817 db_prefixtype='$db_prefixtype'
20818 db_version_major='$db_version_major'
20819 db_version_minor='$db_version_minor'
20820 db_version_patch='$db_version_patch'
20821 defvoidused='$defvoidused'
20822 direntrytype='$direntrytype'
20823 dlext='$dlext'
20824 dlsrc='$dlsrc'
20825 doublesize='$doublesize'
20826 drand01='$drand01'
20827 drand48_r_proto='$drand48_r_proto'
20828 dynamic_ext='$dynamic_ext'
20829 eagain='$eagain'
20830 ebcdic='$ebcdic'
20831 echo='$echo'
20832 egrep='$egrep'
20833 emacs='$emacs'
20834 endgrent_r_proto='$endgrent_r_proto'
20835 endhostent_r_proto='$endhostent_r_proto'
20836 endnetent_r_proto='$endnetent_r_proto'
20837 endprotoent_r_proto='$endprotoent_r_proto'
20838 endpwent_r_proto='$endpwent_r_proto'
20839 endservent_r_proto='$endservent_r_proto'
20840 eunicefix='$eunicefix'
20841 exe_ext='$exe_ext'
20842 expr='$expr'
20843 extensions='$extensions'
20844 extras='$extras'
20845 fflushNULL='$fflushNULL'
20846 fflushall='$fflushall'
20847 find='$find'
20848 firstmakefile='$firstmakefile'
20849 flex='$flex'
20850 fpossize='$fpossize'
20851 fpostype='$fpostype'
20852 freetype='$freetype'
20853 from='$from'
20854 full_ar='$full_ar'
20855 full_csh='$full_csh'
20856 full_sed='$full_sed'
20857 gccansipedantic='$gccansipedantic'
20858 gccosandvers='$gccosandvers'
20859 gccversion='$gccversion'
20860 getgrent_r_proto='$getgrent_r_proto'
20861 getgrgid_r_proto='$getgrgid_r_proto'
20862 getgrnam_r_proto='$getgrnam_r_proto'
20863 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20864 gethostbyname_r_proto='$gethostbyname_r_proto'
20865 gethostent_r_proto='$gethostent_r_proto'
20866 getlogin_r_proto='$getlogin_r_proto'
20867 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20868 getnetbyname_r_proto='$getnetbyname_r_proto'
20869 getnetent_r_proto='$getnetent_r_proto'
20870 getprotobyname_r_proto='$getprotobyname_r_proto'
20871 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20872 getprotoent_r_proto='$getprotoent_r_proto'
20873 getpwent_r_proto='$getpwent_r_proto'
20874 getpwnam_r_proto='$getpwnam_r_proto'
20875 getpwuid_r_proto='$getpwuid_r_proto'
20876 getservbyname_r_proto='$getservbyname_r_proto'
20877 getservbyport_r_proto='$getservbyport_r_proto'
20878 getservent_r_proto='$getservent_r_proto'
20879 getspnam_r_proto='$getspnam_r_proto'
20880 gidformat='$gidformat'
20881 gidsign='$gidsign'
20882 gidsize='$gidsize'
20883 gidtype='$gidtype'
20884 glibpth='$glibpth'
20885 gmake='$gmake'
20886 gmtime_r_proto='$gmtime_r_proto'
20887 gnulibc_version='$gnulibc_version'
20888 grep='$grep'
20889 groupcat='$groupcat'
20890 groupstype='$groupstype'
20891 gzip='$gzip'
20892 h_fcntl='$h_fcntl'
20893 h_sysfile='$h_sysfile'
20894 hint='$hint'
20895 hostcat='$hostcat'
20896 html1dir='$html1dir'
20897 html1direxp='$html1direxp'
20898 html3dir='$html3dir'
20899 html3direxp='$html3direxp'
20900 i16size='$i16size'
20901 i16type='$i16type'
20902 i32size='$i32size'
20903 i32type='$i32type'
20904 i64size='$i64size'
20905 i64type='$i64type'
20906 i8size='$i8size'
20907 i8type='$i8type'
20908 i_arpainet='$i_arpainet'
20909 i_bsdioctl='$i_bsdioctl'
20910 i_crypt='$i_crypt'
20911 i_db='$i_db'
20912 i_dbm='$i_dbm'
20913 i_dirent='$i_dirent'
20914 i_dld='$i_dld'
20915 i_dlfcn='$i_dlfcn'
20916 i_fcntl='$i_fcntl'
20917 i_float='$i_float'
20918 i_fp='$i_fp'
20919 i_fp_class='$i_fp_class'
20920 i_gdbm='$i_gdbm'
20921 i_grp='$i_grp'
20922 i_ieeefp='$i_ieeefp'
20923 i_inttypes='$i_inttypes'
20924 i_langinfo='$i_langinfo'
20925 i_libutil='$i_libutil'
20926 i_limits='$i_limits'
20927 i_locale='$i_locale'
20928 i_machcthr='$i_machcthr'
20929 i_malloc='$i_malloc'
20930 i_math='$i_math'
20931 i_memory='$i_memory'
20932 i_mntent='$i_mntent'
20933 i_ndbm='$i_ndbm'
20934 i_netdb='$i_netdb'
20935 i_neterrno='$i_neterrno'
20936 i_netinettcp='$i_netinettcp'
20937 i_niin='$i_niin'
20938 i_poll='$i_poll'
20939 i_prot='$i_prot'
20940 i_pthread='$i_pthread'
20941 i_pwd='$i_pwd'
20942 i_rpcsvcdbm='$i_rpcsvcdbm'
20943 i_sfio='$i_sfio'
20944 i_sgtty='$i_sgtty'
20945 i_shadow='$i_shadow'
20946 i_socks='$i_socks'
20947 i_stdarg='$i_stdarg'
20948 i_stddef='$i_stddef'
20949 i_stdlib='$i_stdlib'
20950 i_string='$i_string'
20951 i_sunmath='$i_sunmath'
20952 i_sysaccess='$i_sysaccess'
20953 i_sysdir='$i_sysdir'
20954 i_sysfile='$i_sysfile'
20955 i_sysfilio='$i_sysfilio'
20956 i_sysin='$i_sysin'
20957 i_sysioctl='$i_sysioctl'
20958 i_syslog='$i_syslog'
20959 i_sysmman='$i_sysmman'
20960 i_sysmode='$i_sysmode'
20961 i_sysmount='$i_sysmount'
20962 i_sysndir='$i_sysndir'
20963 i_sysparam='$i_sysparam'
20964 i_sysresrc='$i_sysresrc'
20965 i_syssecrt='$i_syssecrt'
20966 i_sysselct='$i_sysselct'
20967 i_syssockio='$i_syssockio'
20968 i_sysstat='$i_sysstat'
20969 i_sysstatfs='$i_sysstatfs'
20970 i_sysstatvfs='$i_sysstatvfs'
20971 i_systime='$i_systime'
20972 i_systimek='$i_systimek'
20973 i_systimes='$i_systimes'
20974 i_systypes='$i_systypes'
20975 i_sysuio='$i_sysuio'
20976 i_sysun='$i_sysun'
20977 i_sysutsname='$i_sysutsname'
20978 i_sysvfs='$i_sysvfs'
20979 i_syswait='$i_syswait'
20980 i_termio='$i_termio'
20981 i_termios='$i_termios'
20982 i_time='$i_time'
20983 i_unistd='$i_unistd'
20984 i_ustat='$i_ustat'
20985 i_utime='$i_utime'
20986 i_values='$i_values'
20987 i_varargs='$i_varargs'
20988 i_varhdr='$i_varhdr'
20989 i_vfork='$i_vfork'
20990 ignore_versioned_solibs='$ignore_versioned_solibs'
20991 inc_version_list='$inc_version_list'
20992 inc_version_list_init='$inc_version_list_init'
20993 incpath='$incpath'
20994 inews='$inews'
20995 installarchlib='$installarchlib'
20996 installbin='$installbin'
20997 installhtml1dir='$installhtml1dir'
20998 installhtml3dir='$installhtml3dir'
20999 installman1dir='$installman1dir'
21000 installman3dir='$installman3dir'
21001 installprefix='$installprefix'
21002 installprefixexp='$installprefixexp'
21003 installprivlib='$installprivlib'
21004 installscript='$installscript'
21005 installsitearch='$installsitearch'
21006 installsitebin='$installsitebin'
21007 installsitehtml1='$installsitehtml1'
21008 installsitehtml3='$installsitehtml3'
21009 installsitelib='$installsitelib'
21010 installsiteman1='$installsiteman1'
21011 installsiteman3='$installsiteman3'
21012 installsitescript='$installsitescript'
21013 installstyle='$installstyle'
21014 installusrbinperl='$installusrbinperl'
21015 installvendorarch='$installvendorarch'
21016 installvendorbin='$installvendorbin'
21017 installvendorhtml1='$installvendorhtml1'
21018 installvendorhtml3='$installvendorhtml3'
21019 installvendorlib='$installvendorlib'
21020 installvendorman1='$installvendorman1'
21021 installvendorman3='$installvendorman3'
21022 installvendorscript='$installvendorscript'
21023 intsize='$intsize'
21024 issymlink='$issymlink'
21025 ivdformat='$ivdformat'
21026 ivsize='$ivsize'
21027 ivtype='$ivtype'
21028 known_extensions='$known_extensions'
21029 ksh='$ksh'
21030 ld='$ld'
21031 lddlflags='$lddlflags'
21032 ldflags='$ldflags'
21033 ldflags_uselargefiles='$ldflags_uselargefiles'
21034 ldlibpthname='$ldlibpthname'
21035 less='$less'
21036 lib_ext='$lib_ext'
21037 libc='$libc'
21038 libperl='$libperl'
21039 libpth='$libpth'
21040 libs='$libs'
21041 libsdirs='$libsdirs'
21042 libsfiles='$libsfiles'
21043 libsfound='$libsfound'
21044 libspath='$libspath'
21045 libswanted='$libswanted'
21046 libswanted_uselargefiles='$libswanted_uselargefiles'
21047 line='$line'
21048 lint='$lint'
21049 lkflags='$lkflags'
21050 ln='$ln'
21051 lns='$lns'
21052 localtime_r_proto='$localtime_r_proto'
21053 locincpth='$locincpth'
21054 loclibpth='$loclibpth'
21055 longdblsize='$longdblsize'
21056 longlongsize='$longlongsize'
21057 longsize='$longsize'
21058 lp='$lp'
21059 lpr='$lpr'
21060 ls='$ls'
21061 lseeksize='$lseeksize'
21062 lseektype='$lseektype'
21063 mail='$mail'
21064 mailx='$mailx'
21065 make='$make'
21066 make_set_make='$make_set_make'
21067 mallocobj='$mallocobj'
21068 mallocsrc='$mallocsrc'
21069 malloctype='$malloctype'
21070 man1dir='$man1dir'
21071 man1direxp='$man1direxp'
21072 man1ext='$man1ext'
21073 man3dir='$man3dir'
21074 man3direxp='$man3direxp'
21075 man3ext='$man3ext'
21076 mips_type='$mips_type'
21077 mkdir='$mkdir'
21078 mmaptype='$mmaptype'
21079 modetype='$modetype'
21080 more='$more'
21081 multiarch='$multiarch'
21082 mv='$mv'
21083 myarchname='$myarchname'
21084 mydomain='$mydomain'
21085 myhostname='$myhostname'
21086 myuname='$myuname'
21087 n='$n'
21088 need_va_copy='$need_va_copy'
21089 netdb_hlen_type='$netdb_hlen_type'
21090 netdb_host_type='$netdb_host_type'
21091 netdb_name_type='$netdb_name_type'
21092 netdb_net_type='$netdb_net_type'
21093 nm='$nm'
21094 nm_opt='$nm_opt'
21095 nm_so_opt='$nm_so_opt'
21096 nonxs_ext='$nonxs_ext'
21097 nroff='$nroff'
21098 nvEUformat='$nvEUformat'
21099 nvFUformat='$nvFUformat'
21100 nvGUformat='$nvGUformat'
21101 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21102 nveformat='$nveformat'
21103 nvfformat='$nvfformat'
21104 nvgformat='$nvgformat'
21105 nvsize='$nvsize'
21106 nvtype='$nvtype'
21107 o_nonblock='$o_nonblock'
21108 obj_ext='$obj_ext'
21109 old_pthread_create_joinable='$old_pthread_create_joinable'
21110 optimize='$optimize'
21111 orderlib='$orderlib'
21112 osname='$osname'
21113 osvers='$osvers'
21114 otherlibdirs='$otherlibdirs'
21115 package='$package'
21116 pager='$pager'
21117 passcat='$passcat'
21118 patchlevel='$patchlevel'
21119 path_sep='$path_sep'
21120 perl5='$perl5'
21121 perl='$perl'
21122 perl_patchlevel='$perl_patchlevel'
21123 perladmin='$perladmin'
21124 perllibs='$perllibs'
21125 perlpath='$perlpath'
21126 pg='$pg'
21127 phostname='$phostname'
21128 pidtype='$pidtype'
21129 plibpth='$plibpth'
21130 pm_apiversion='$pm_apiversion'
21131 pmake='$pmake'
21132 pr='$pr'
21133 prefix='$prefix'
21134 prefixexp='$prefixexp'
21135 privlib='$privlib'
21136 privlibexp='$privlibexp'
21137 procselfexe='$procselfexe'
21138 prototype='$prototype'
21139 ptrsize='$ptrsize'
21140 quadkind='$quadkind'
21141 quadtype='$quadtype'
21142 randbits='$randbits'
21143 randfunc='$randfunc'
21144 random_r_proto='$random_r_proto'
21145 randseedtype='$randseedtype'
21146 ranlib='$ranlib'
21147 rd_nodata='$rd_nodata'
21148 readdir64_r_proto='$readdir64_r_proto'
21149 readdir_r_proto='$readdir_r_proto'
21150 revision='$revision'
21151 rm='$rm'
21152 rmail='$rmail'
21153 run='$run'
21154 runnm='$runnm'
21155 sPRIEUldbl='$sPRIEUldbl'
21156 sPRIFUldbl='$sPRIFUldbl'
21157 sPRIGUldbl='$sPRIGUldbl'
21158 sPRIXU64='$sPRIXU64'
21159 sPRId64='$sPRId64'
21160 sPRIeldbl='$sPRIeldbl'
21161 sPRIfldbl='$sPRIfldbl'
21162 sPRIgldbl='$sPRIgldbl'
21163 sPRIi64='$sPRIi64'
21164 sPRIo64='$sPRIo64'
21165 sPRIu64='$sPRIu64'
21166 sPRIx64='$sPRIx64'
21167 sSCNfldbl='$sSCNfldbl'
21168 sched_yield='$sched_yield'
21169 scriptdir='$scriptdir'
21170 scriptdirexp='$scriptdirexp'
21171 sed='$sed'
21172 seedfunc='$seedfunc'
21173 selectminbits='$selectminbits'
21174 selecttype='$selecttype'
21175 sendmail='$sendmail'
21176 setgrent_r_proto='$setgrent_r_proto'
21177 sethostent_r_proto='$sethostent_r_proto'
21178 setlocale_r_proto='$setlocale_r_proto'
21179 setnetent_r_proto='$setnetent_r_proto'
21180 setprotoent_r_proto='$setprotoent_r_proto'
21181 setpwent_r_proto='$setpwent_r_proto'
21182 setservent_r_proto='$setservent_r_proto'
21183 sh='$sh'
21184 shar='$shar'
21185 sharpbang='$sharpbang'
21186 shmattype='$shmattype'
21187 shortsize='$shortsize'
21188 shrpenv='$shrpenv'
21189 shsharp='$shsharp'
21190 sig_count='$sig_count'
21191 sig_name='$sig_name'
21192 sig_name_init='$sig_name_init'
21193 sig_num='$sig_num'
21194 sig_num_init='$sig_num_init'
21195 sig_size='$sig_size'
21196 signal_t='$signal_t'
21197 sitearch='$sitearch'
21198 sitearchexp='$sitearchexp'
21199 sitebin='$sitebin'
21200 sitebinexp='$sitebinexp'
21201 sitehtml1='$sitehtml1'
21202 sitehtml1exp='$sitehtml1exp'
21203 sitehtml3='$sitehtml3'
21204 sitehtml3exp='$sitehtml3exp'
21205 sitelib='$sitelib'
21206 sitelib_stem='$sitelib_stem'
21207 sitelibexp='$sitelibexp'
21208 siteman1='$siteman1'
21209 siteman1exp='$siteman1exp'
21210 siteman3='$siteman3'
21211 siteman3exp='$siteman3exp'
21212 siteprefix='$siteprefix'
21213 siteprefixexp='$siteprefixexp'
21214 sitescript='$sitescript'
21215 sitescriptexp='$sitescriptexp'
21216 sizesize='$sizesize'
21217 sizetype='$sizetype'
21218 sleep='$sleep'
21219 smail='$smail'
21220 so='$so'
21221 sockethdr='$sockethdr'
21222 socketlib='$socketlib'
21223 socksizetype='$socksizetype'
21224 sort='$sort'
21225 spackage='$spackage'
21226 spitshell='$spitshell'
21227 srand48_r_proto='$srand48_r_proto'
21228 srandom_r_proto='$srandom_r_proto'
21229 src='$src'
21230 ssizetype='$ssizetype'
21231 startperl='$startperl'
21232 startsh='$startsh'
21233 static_ext='$static_ext'
21234 stdchar='$stdchar'
21235 stdio_base='$stdio_base'
21236 stdio_bufsiz='$stdio_bufsiz'
21237 stdio_cnt='$stdio_cnt'
21238 stdio_filbuf='$stdio_filbuf'
21239 stdio_ptr='$stdio_ptr'
21240 stdio_stream_array='$stdio_stream_array'
21241 strerror_r_proto='$strerror_r_proto'
21242 strings='$strings'
21243 submit='$submit'
21244 subversion='$subversion'
21245 sysman='$sysman'
21246 tail='$tail'
21247 tar='$tar'
21248 targetarch='$targetarch'
21249 tbl='$tbl'
21250 tee='$tee'
21251 test='$test'
21252 timeincl='$timeincl'
21253 timetype='$timetype'
21254 tmpnam_r_proto='$tmpnam_r_proto'
21255 to='$to'
21256 touch='$touch'
21257 tr='$tr'
21258 trnl='$trnl'
21259 troff='$troff'
21260 ttyname_r_proto='$ttyname_r_proto'
21261 u16size='$u16size'
21262 u16type='$u16type'
21263 u32size='$u32size'
21264 u32type='$u32type'
21265 u64size='$u64size'
21266 u64type='$u64type'
21267 u8size='$u8size'
21268 u8type='$u8type'
21269 uidformat='$uidformat'
21270 uidsign='$uidsign'
21271 uidsize='$uidsize'
21272 uidtype='$uidtype'
21273 uname='$uname'
21274 uniq='$uniq'
21275 uquadtype='$uquadtype'
21276 use5005threads='$use5005threads'
21277 use64bitall='$use64bitall'
21278 use64bitint='$use64bitint'
21279 usecrosscompile='$usecrosscompile'
21280 usedl='$usedl'
21281 useithreads='$useithreads'
21282 uselargefiles='$uselargefiles'
21283 uselongdouble='$uselongdouble'
21284 usemorebits='$usemorebits'
21285 usemultiplicity='$usemultiplicity'
21286 usemymalloc='$usemymalloc'
21287 usenm='$usenm'
21288 useopcode='$useopcode'
21289 useperlio='$useperlio'
21290 useposix='$useposix'
21291 usereentrant='$usereentrant'
21292 usesfio='$usesfio'
21293 useshrplib='$useshrplib'
21294 usesocks='$usesocks'
21295 usethreads='$usethreads'
21296 usevendorprefix='$usevendorprefix'
21297 usevfork='$usevfork'
21298 usrinc='$usrinc'
21299 uuname='$uuname'
21300 uvXUformat='$uvXUformat'
21301 uvoformat='$uvoformat'
21302 uvsize='$uvsize'
21303 uvtype='$uvtype'
21304 uvuformat='$uvuformat'
21305 uvxformat='$uvxformat'
21306 vendorarch='$vendorarch'
21307 vendorarchexp='$vendorarchexp'
21308 vendorbin='$vendorbin'
21309 vendorbinexp='$vendorbinexp'
21310 vendorhtml1='$vendorhtml1'
21311 vendorhtml1exp='$vendorhtml1exp'
21312 vendorhtml3='$vendorhtml3'
21313 vendorhtml3exp='$vendorhtml3exp'
21314 vendorlib='$vendorlib'
21315 vendorlib_stem='$vendorlib_stem'
21316 vendorlibexp='$vendorlibexp'
21317 vendorman1='$vendorman1'
21318 vendorman1exp='$vendorman1exp'
21319 vendorman3='$vendorman3'
21320 vendorman3exp='$vendorman3exp'
21321 vendorprefix='$vendorprefix'
21322 vendorprefixexp='$vendorprefixexp'
21323 vendorscript='$vendorscript'
21324 vendorscriptexp='$vendorscriptexp'
21325 version='$version'
21326 version_patchlevel_string='$version_patchlevel_string'
21327 versiononly='$versiononly'
21328 vi='$vi'
21329 voidflags='$voidflags'
21330 xlibpth='$xlibpth'
21331 xs_apiversion='$xs_apiversion'
21332 yacc='$yacc'
21333 yaccflags='$yaccflags'
21334 zcat='$zcat'
21335 zip='$zip'
21336 EOT
21337
21338 : Add in command line options if available
21339 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21340
21341 : add special variables
21342 $test -f $src/patchlevel.h && \
21343 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21344 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21345 echo "PERL_CONFIG_SH=true" >>config.sh
21346
21347 : propagate old symbols
21348 if $test -f UU/config.sh; then
21349         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21350         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21351         $sort | $uniq -u >UU/oldsyms
21352         set X `cat UU/oldsyms`
21353         shift
21354         case $# in
21355         0) ;;
21356         *)
21357                 cat <<EOM
21358 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21359 EOM
21360                 echo "# Variables propagated from previous config.sh file." >>config.sh
21361                 for sym in `cat UU/oldsyms`; do
21362                         echo "    Propagating $hint variable "'$'"$sym..."
21363                         eval 'tmp="$'"${sym}"'"'
21364                         echo "$tmp" | \
21365                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21366                 done
21367                 ;;
21368         esac
21369 fi
21370
21371 : Finish up by extracting the .SH files
21372 case "$alldone" in
21373 exit)
21374         $rm -rf UU
21375         echo "Extraction done."
21376         exit 0
21377         ;;
21378 cont)
21379         ;;
21380 '')
21381         dflt=''
21382         nostick=true
21383         $cat <<EOM
21384
21385 If you'd like to make any changes to the config.sh file before I begin
21386 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21387
21388 EOM
21389         rp="Press return or use a shell escape to edit config.sh:"
21390         . UU/myread
21391         nostick=''
21392         case "$ans" in
21393         '') ;;
21394         *) : in case they cannot read
21395                 sh 1>&4 -c "$ans";;
21396         esac
21397         ;;
21398 esac
21399
21400 : if this fails, just run all the .SH files by hand
21401 . ./config.sh
21402
21403 echo " "
21404 exec 1>&4
21405 pwd=`pwd`
21406 . ./UU/extract
21407 cd "$pwd"
21408
21409 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21410         dflt=y
21411         case "$silent" in
21412         true) ;;
21413         *)
21414                 $cat <<EOM
21415
21416 Now you need to generate make dependencies by running "$make depend".
21417 You might prefer to run it in background: "$make depend > makedepend.out &"
21418 It can take a while, so you might not want to run it right now.
21419
21420 EOM
21421                 ;;
21422         esac
21423         rp="Run $make depend now?"
21424         . UU/myread
21425         case "$ans" in
21426         y*)
21427                 $make depend && echo "Now you must run '$make'."
21428                 ;;
21429         *)
21430                 echo "You must run '$make depend' then '$make'."
21431                 ;;
21432         esac
21433 elif test -f [Mm]akefile; then
21434         echo " "
21435         echo "Now you must run a $make."
21436 else
21437         echo "Configure done."
21438 fi
21439
21440 if $test -f Policy.sh; then
21441     $cat <<EOM
21442
21443 If you compile $package on a different machine or from a different object
21444 directory, copy the Policy.sh file from this object directory to the
21445 new one before you run Configure -- this will help you with most of
21446 the policy defaults.
21447
21448 EOM
21449 fi
21450 if $test -f config.msg; then
21451     echo "Hmm.  I also noted the following information while running:"
21452     echo " "
21453     $cat config.msg >&4
21454     $rm -f config.msg
21455 fi
21456 $rm -f kit*isdone ark*isdone
21457 $rm -rf UU
21458
21459 : End of Configure
21460