Backport of changes #25831 and #25832. Re-order needed
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Tue Oct 25 01:58:55 CEST 2005 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 installbin=''
323 byteorder=''
324 cc=''
325 ccflags=''
326 cppflags=''
327 ldflags=''
328 lkflags=''
329 locincpth=''
330 optimize=''
331 cf_email=''
332 cf_by=''
333 cf_time=''
334 charsize=''
335 contains=''
336 cpp_stuff=''
337 cpplast=''
338 cppminus=''
339 cpprun=''
340 cppstdin=''
341 d__fwalk=''
342 d_access=''
343 d_accessx=''
344 d_aintl=''
345 d_alarm=''
346 asctime_r_proto=''
347 d_asctime_r=''
348 d_attribute_format=''
349 d_attribute_malloc=''
350 d_attribute_nonnull=''
351 d_attribute_noreturn=''
352 d_attribute_pure=''
353 d_attribute_unused=''
354 d_attribute_warn_unused_result=''
355 d_bcmp=''
356 d_bcopy=''
357 d_bzero=''
358 d_casti32=''
359 castflags=''
360 d_castneg=''
361 d_chown=''
362 d_chroot=''
363 d_chsize=''
364 d_class=''
365 d_clearenv=''
366 d_closedir=''
367 d_void_closedir=''
368 d_cmsghdr_s=''
369 d_const=''
370 d_copysignl=''
371 cryptlib=''
372 d_crypt=''
373 crypt_r_proto=''
374 d_crypt_r=''
375 d_csh=''
376 full_csh=''
377 ctermid_r_proto=''
378 d_ctermid_r=''
379 ctime_r_proto=''
380 d_ctime_r=''
381 d_cuserid=''
382 d_dbl_dig=''
383 d_dbminitproto=''
384 d_difftime=''
385 d_dirfd=''
386 d_dlerror=''
387 d_dlopen=''
388 d_dlsymun=''
389 d_dosuid=''
390 d_suidsafe=''
391 d_drand48_r=''
392 drand48_r_proto=''
393 d_drand48proto=''
394 d_dup2=''
395 d_eaccess=''
396 d_endgrent=''
397 d_endgrent_r=''
398 endgrent_r_proto=''
399 d_endhent=''
400 d_endhostent_r=''
401 endhostent_r_proto=''
402 d_endnent=''
403 d_endnetent_r=''
404 endnetent_r_proto=''
405 d_endpent=''
406 d_endprotoent_r=''
407 endprotoent_r_proto=''
408 d_endpwent=''
409 d_endpwent_r=''
410 endpwent_r_proto=''
411 d_endsent=''
412 d_endservent_r=''
413 endservent_r_proto=''
414 d_faststdio=''
415 d_fchdir=''
416 d_fchmod=''
417 d_fchown=''
418 d_fcntl=''
419 d_fcntl_can_lock=''
420 d_fd_macros=''
421 d_fd_set=''
422 d_fds_bits=''
423 d_fgetpos=''
424 d_finite=''
425 d_finitel=''
426 d_flexfnam=''
427 d_flock=''
428 d_flockproto=''
429 d_fork=''
430 d_fp_class=''
431 d_fpclass=''
432 d_fpclassify=''
433 d_fpclassl=''
434 d_fpos64_t=''
435 d_frexpl=''
436 d_fs_data_s=''
437 d_fseeko=''
438 d_fsetpos=''
439 d_fstatfs=''
440 d_fsync=''
441 d_ftello=''
442 d_ftime=''
443 d_gettimeod=''
444 d_Gconvert=''
445 d_getcwd=''
446 d_getespwnam=''
447 d_getfsstat=''
448 d_getgrent=''
449 d_getgrent_r=''
450 getgrent_r_proto=''
451 d_getgrgid_r=''
452 getgrgid_r_proto=''
453 d_getgrnam_r=''
454 getgrnam_r_proto=''
455 d_getgrps=''
456 d_gethbyaddr=''
457 d_gethbyname=''
458 d_gethent=''
459 aphostname=''
460 d_gethname=''
461 d_phostname=''
462 d_uname=''
463 d_gethostbyaddr_r=''
464 gethostbyaddr_r_proto=''
465 d_gethostbyname_r=''
466 gethostbyname_r_proto=''
467 d_gethostent_r=''
468 gethostent_r_proto=''
469 d_gethostprotos=''
470 d_getitimer=''
471 d_getlogin=''
472 d_getlogin_r=''
473 getlogin_r_proto=''
474 d_getmnt=''
475 d_getmntent=''
476 d_getnbyaddr=''
477 d_getnbyname=''
478 d_getnent=''
479 d_getnetbyaddr_r=''
480 getnetbyaddr_r_proto=''
481 d_getnetbyname_r=''
482 getnetbyname_r_proto=''
483 d_getnetent_r=''
484 getnetent_r_proto=''
485 d_getnetprotos=''
486 d_getpagsz=''
487 d_getpent=''
488 d_getpgid=''
489 d_getpgrp2=''
490 d_bsdgetpgrp=''
491 d_getpgrp=''
492 d_getppid=''
493 d_getprior=''
494 d_getpbyname=''
495 d_getpbynumber=''
496 d_getprotobyname_r=''
497 getprotobyname_r_proto=''
498 d_getprotobynumber_r=''
499 getprotobynumber_r_proto=''
500 d_getprotoent_r=''
501 getprotoent_r_proto=''
502 d_getprotoprotos=''
503 d_getprpwnam=''
504 d_getpwent=''
505 d_getpwent_r=''
506 getpwent_r_proto=''
507 d_getpwnam_r=''
508 getpwnam_r_proto=''
509 d_getpwuid_r=''
510 getpwuid_r_proto=''
511 d_getsent=''
512 d_getservbyname_r=''
513 getservbyname_r_proto=''
514 d_getservbyport_r=''
515 getservbyport_r_proto=''
516 d_getservent_r=''
517 getservent_r_proto=''
518 d_getservprotos=''
519 d_getspnam=''
520 d_getspnam_r=''
521 getspnam_r_proto=''
522 d_getsbyname=''
523 d_getsbyport=''
524 d_gmtime_r=''
525 gmtime_r_proto=''
526 d_gnulibc=''
527 gnulibc_version=''
528 d_hasmntopt=''
529 d_htonl=''
530 d_ilogbl=''
531 d_inetaton=''
532 d_int64_t=''
533 d_isascii=''
534 d_isfinite=''
535 d_isinf=''
536 d_isnan=''
537 d_isnanl=''
538 d_killpg=''
539 d_lchown=''
540 d_ldbl_dig=''
541 d_libm_lib_version=''
542 d_link=''
543 d_localtime_r=''
544 localtime_r_proto=''
545 d_locconv=''
546 d_lockf=''
547 d_longdbl=''
548 longdblsize=''
549 d_longlong=''
550 longlongsize=''
551 d_lseekproto=''
552 d_lstat=''
553 d_madvise=''
554 d_malloc_good_size=''
555 d_malloc_size=''
556 d_mblen=''
557 d_mbstowcs=''
558 d_mbtowc=''
559 d_memchr=''
560 d_memcmp=''
561 d_memcpy=''
562 d_memmove=''
563 d_memset=''
564 d_mkdir=''
565 d_mkdtemp=''
566 d_mkfifo=''
567 d_mkstemp=''
568 d_mkstemps=''
569 d_mktime=''
570 d_mmap=''
571 mmaptype=''
572 d_modfl=''
573 d_modfl_pow32_bug=''
574 d_modflproto=''
575 d_mprotect=''
576 d_msg=''
577 d_msgctl=''
578 d_msgget=''
579 d_msghdr_s=''
580 d_msgrcv=''
581 d_msgsnd=''
582 d_msync=''
583 d_munmap=''
584 d_nice=''
585 d_nl_langinfo=''
586 d_off64_t=''
587 d_open3=''
588 d_fpathconf=''
589 d_pathconf=''
590 d_pause=''
591 d_pipe=''
592 d_poll=''
593 d_portable=''
594 d_procselfexe=''
595 procselfexe=''
596 d_old_pthread_create_joinable=''
597 old_pthread_create_joinable=''
598 d_pthread_atfork=''
599 d_pthread_attr_setscope=''
600 d_pthread_yield=''
601 d_sched_yield=''
602 sched_yield=''
603 d_qgcvt=''
604 d_random_r=''
605 random_r_proto=''
606 d_readdir64_r=''
607 readdir64_r_proto=''
608 d_readdir=''
609 d_rewinddir=''
610 d_seekdir=''
611 d_telldir=''
612 d_readdir_r=''
613 readdir_r_proto=''
614 d_readlink=''
615 d_readv=''
616 d_recvmsg=''
617 d_rename=''
618 d_rmdir=''
619 d_safebcpy=''
620 d_safemcpy=''
621 d_sanemcmp=''
622 d_sbrkproto=''
623 d_scalbnl=''
624 d_select=''
625 d_sem=''
626 d_semctl=''
627 d_semget=''
628 d_semop=''
629 d_sendmsg=''
630 d_setegid=''
631 d_seteuid=''
632 d_setgrent=''
633 d_setgrent_r=''
634 setgrent_r_proto=''
635 d_setgrps=''
636 d_sethent=''
637 d_sethostent_r=''
638 sethostent_r_proto=''
639 d_setitimer=''
640 d_setlinebuf=''
641 d_setlocale=''
642 d_setlocale_r=''
643 setlocale_r_proto=''
644 d_setnent=''
645 d_setnetent_r=''
646 setnetent_r_proto=''
647 d_setpent=''
648 d_setpgid=''
649 d_setpgrp2=''
650 d_bsdsetpgrp=''
651 d_setpgrp=''
652 d_setprior=''
653 d_setproctitle=''
654 d_setprotoent_r=''
655 setprotoent_r_proto=''
656 d_setpwent=''
657 d_setpwent_r=''
658 setpwent_r_proto=''
659 d_setregid=''
660 d_setresgid=''
661 d_setresuid=''
662 d_setreuid=''
663 d_setrgid=''
664 d_setruid=''
665 d_setsent=''
666 d_setservent_r=''
667 setservent_r_proto=''
668 d_setsid=''
669 d_setvbuf=''
670 d_sfio=''
671 usesfio=''
672 d_shm=''
673 d_shmat=''
674 d_shmatprototype=''
675 shmattype=''
676 d_shmctl=''
677 d_shmdt=''
678 d_shmget=''
679 d_sigaction=''
680 d_sigprocmask=''
681 d_sigsetjmp=''
682 usesitecustomize=''
683 d_sockatmark=''
684 d_sockatmarkproto=''
685 d_msg_ctrunc=''
686 d_msg_dontroute=''
687 d_msg_oob=''
688 d_msg_peek=''
689 d_msg_proxy=''
690 d_oldsock=''
691 d_scm_rights=''
692 d_socket=''
693 d_sockpair=''
694 sockethdr=''
695 socketlib=''
696 d_socklen_t=''
697 d_socks5_init=''
698 d_sprintf_returns_strlen=''
699 d_sqrtl=''
700 d_srand48_r=''
701 srand48_r_proto=''
702 d_srandom_r=''
703 srandom_r_proto=''
704 d_sresgproto=''
705 d_sresuproto=''
706 d_statblks=''
707 d_statfs_f_flags=''
708 d_statfs_s=''
709 d_fstatvfs=''
710 d_statvfs=''
711 d_stdio_cnt_lval=''
712 d_stdio_ptr_lval=''
713 d_stdio_ptr_lval_nochange_cnt=''
714 d_stdio_ptr_lval_sets_cnt=''
715 d_stdiobase=''
716 d_stdstdio=''
717 stdio_base=''
718 stdio_bufsiz=''
719 stdio_cnt=''
720 stdio_filbuf=''
721 stdio_ptr=''
722 d_index=''
723 d_strchr=''
724 d_strcoll=''
725 d_strctcpy=''
726 d_strerrm=''
727 d_strerror=''
728 d_sysernlst=''
729 d_syserrlst=''
730 d_strerror_r=''
731 strerror_r_proto=''
732 d_strftime=''
733 d_strlcat=''
734 d_strlcpy=''
735 d_strtod=''
736 d_strtol=''
737 d_strtold=''
738 d_strtoll=''
739 d_strtoq=''
740 d_strtoul=''
741 d_strtoull=''
742 d_strtouq=''
743 d_strxfrm=''
744 d_symlink=''
745 d_syscall=''
746 d_syscallproto=''
747 d_sysconf=''
748 d_system=''
749 d_tcgetpgrp=''
750 d_tcsetpgrp=''
751 d_telldirproto=''
752 d_time=''
753 timetype=''
754 clocktype=''
755 d_times=''
756 d_tmpnam_r=''
757 tmpnam_r_proto=''
758 d_truncate=''
759 d_ttyname_r=''
760 ttyname_r_proto=''
761 d_tzname=''
762 d_u32align=''
763 d_ualarm=''
764 d_umask=''
765 d_semctl_semid_ds=''
766 d_semctl_semun=''
767 d_union_semun=''
768 d_unordered=''
769 d_unsetenv=''
770 d_usleep=''
771 d_usleepproto=''
772 d_ustat=''
773 d_vfork=''
774 usevfork=''
775 d_voidsig=''
776 signal_t=''
777 d_volatile=''
778 d_charvspr=''
779 d_vprintf=''
780 d_wait4=''
781 d_waitpid=''
782 d_wcstombs=''
783 d_wctomb=''
784 d_writev=''
785 dlext=''
786 cccdlflags=''
787 ccdlflags=''
788 dlsrc=''
789 ld=''
790 lddlflags=''
791 usedl=''
792 doublesize=''
793 ebcdic=''
794 fflushNULL=''
795 fflushall=''
796 fpossize=''
797 fpostype=''
798 gccansipedantic=''
799 gccosandvers=''
800 gccversion=''
801 gidformat=''
802 gidsign=''
803 gidsize=''
804 gidtype=''
805 groupstype=''
806 h_fcntl=''
807 h_sysfile=''
808 html1dir=''
809 html1direxp=''
810 installhtml1dir=''
811 html3dir=''
812 html3direxp=''
813 installhtml3dir=''
814 i_arpainet=''
815 i_crypt=''
816 db_hashtype=''
817 db_prefixtype=''
818 db_version_major=''
819 db_version_minor=''
820 db_version_patch=''
821 i_db=''
822 i_dbm=''
823 i_rpcsvcdbm=''
824 d_dirnamlen=''
825 direntrytype=''
826 i_dirent=''
827 i_dld=''
828 i_dlfcn=''
829 i_fcntl=''
830 i_float=''
831 i_fp=''
832 i_fp_class=''
833 i_gdbm=''
834 d_grpasswd=''
835 i_grp=''
836 i_ieeefp=''
837 i_inttypes=''
838 i_langinfo=''
839 i_libutil=''
840 i_limits=''
841 i_locale=''
842 i_machcthr=''
843 i_malloc=''
844 i_math=''
845 i_memory=''
846 i_mntent=''
847 i_ndbm=''
848 i_netdb=''
849 i_neterrno=''
850 i_netinettcp=''
851 i_niin=''
852 i_sysin=''
853 i_poll=''
854 i_prot=''
855 i_pthread=''
856 d_pwage=''
857 d_pwchange=''
858 d_pwclass=''
859 d_pwcomment=''
860 d_pwexpire=''
861 d_pwgecos=''
862 d_pwpasswd=''
863 d_pwquota=''
864 i_pwd=''
865 i_sfio=''
866 i_shadow=''
867 i_socks=''
868 i_stddef=''
869 i_stdlib=''
870 i_string=''
871 strings=''
872 i_sunmath=''
873 i_sysaccess=''
874 i_sysdir=''
875 i_sysfile=''
876 d_voidtty=''
877 i_bsdioctl=''
878 i_sysfilio=''
879 i_sysioctl=''
880 i_syssockio=''
881 i_syslog=''
882 i_sysmman=''
883 i_sysmode=''
884 i_sysmount=''
885 i_sysndir=''
886 i_sysparam=''
887 i_sysresrc=''
888 i_syssecrt=''
889 i_sysselct=''
890 i_sysstat=''
891 i_sysstatfs=''
892 i_sysstatvfs=''
893 i_systimes=''
894 i_systypes=''
895 i_sysuio=''
896 i_sysun=''
897 i_sysutsname=''
898 i_sysvfs=''
899 i_syswait=''
900 i_sgtty=''
901 i_termio=''
902 i_termios=''
903 d_tm_tm_gmtoff=''
904 d_tm_tm_zone=''
905 i_systime=''
906 i_systimek=''
907 i_time=''
908 timeincl=''
909 i_unistd=''
910 i_ustat=''
911 i_utime=''
912 i_values=''
913 i_stdarg=''
914 i_varargs=''
915 i_varhdr=''
916 i_vfork=''
917 inc_version_list=''
918 inc_version_list_init=''
919 installprefix=''
920 installprefixexp=''
921 installstyle=''
922 installusrbinperl=''
923 intsize=''
924 longsize=''
925 shortsize=''
926 issymlink=''
927 libc=''
928 ldlibpthname=''
929 libperl=''
930 shrpenv=''
931 useshrplib=''
932 glibpth=''
933 libpth=''
934 loclibpth=''
935 plibpth=''
936 xlibpth=''
937 ignore_versioned_solibs=''
938 libs=''
939 libsdirs=''
940 libsfiles=''
941 libsfound=''
942 libspath=''
943 lns=''
944 d_PRIEUldbl=''
945 d_PRIFUldbl=''
946 d_PRIGUldbl=''
947 d_PRIeldbl=''
948 d_PRIfldbl=''
949 d_PRIgldbl=''
950 d_SCNfldbl=''
951 sPRIEUldbl=''
952 sPRIFUldbl=''
953 sPRIGUldbl=''
954 sPRIeldbl=''
955 sPRIfldbl=''
956 sPRIgldbl=''
957 sSCNfldbl=''
958 lseeksize=''
959 lseektype=''
960 make_set_make=''
961 d_mymalloc=''
962 freetype=''
963 mallocobj=''
964 mallocsrc=''
965 malloctype=''
966 usemallocwrap=''
967 usemymalloc=''
968 installman1dir=''
969 man1dir=''
970 man1direxp=''
971 man1ext=''
972 installman3dir=''
973 man3dir=''
974 man3direxp=''
975 man3ext=''
976 modetype=''
977 multiarch=''
978 mydomain=''
979 myhostname=''
980 phostname=''
981 c=''
982 n=''
983 d_eofnblk=''
984 eagain=''
985 o_nonblock=''
986 rd_nodata=''
987 need_va_copy=''
988 netdb_hlen_type=''
989 netdb_host_type=''
990 netdb_name_type=''
991 netdb_net_type=''
992 groupcat=''
993 hostcat=''
994 passcat=''
995 orderlib=''
996 ranlib=''
997 d_perl_otherlibdirs=''
998 otherlibdirs=''
999 package=''
1000 spackage=''
1001 pager=''
1002 api_revision=''
1003 api_subversion=''
1004 api_version=''
1005 api_versionstring=''
1006 patchlevel=''
1007 perl_patchlevel=''
1008 revision=''
1009 subversion=''
1010 version=''
1011 version_patchlevel_string=''
1012 perl5=''
1013 perladmin=''
1014 perlpath=''
1015 d_nv_preserves_uv=''
1016 d_nv_zero_is_allbits_zero=''
1017 i16size=''
1018 i16type=''
1019 i32size=''
1020 i32type=''
1021 i64size=''
1022 i64type=''
1023 i8size=''
1024 i8type=''
1025 ivsize=''
1026 ivtype=''
1027 nv_preserves_uv_bits=''
1028 nvsize=''
1029 nvtype=''
1030 u16size=''
1031 u16type=''
1032 u32size=''
1033 u32type=''
1034 u64size=''
1035 u64type=''
1036 u8size=''
1037 u8type=''
1038 uvsize=''
1039 uvtype=''
1040 ivdformat=''
1041 nvEUformat=''
1042 nvFUformat=''
1043 nvGUformat=''
1044 nveformat=''
1045 nvfformat=''
1046 nvgformat=''
1047 uvXUformat=''
1048 uvoformat=''
1049 uvuformat=''
1050 uvxformat=''
1051 pidtype=''
1052 prefix=''
1053 prefixexp=''
1054 installprivlib=''
1055 privlib=''
1056 privlibexp=''
1057 prototype=''
1058 ptrsize=''
1059 d_PRIXU64=''
1060 d_PRId64=''
1061 d_PRIi64=''
1062 d_PRIo64=''
1063 d_PRIu64=''
1064 d_PRIx64=''
1065 sPRIXU64=''
1066 sPRId64=''
1067 sPRIi64=''
1068 sPRIo64=''
1069 sPRIu64=''
1070 sPRIx64=''
1071 d_quad=''
1072 quadkind=''
1073 quadtype=''
1074 uquadtype=''
1075 drand01=''
1076 randbits=''
1077 randfunc=''
1078 randseedtype=''
1079 seedfunc=''
1080 installscript=''
1081 scriptdir=''
1082 scriptdirexp=''
1083 selectminbits=''
1084 selecttype=''
1085 sh=''
1086 sig_count=''
1087 sig_name=''
1088 sig_name_init=''
1089 sig_num=''
1090 sig_num_init=''
1091 sig_size=''
1092 installsitearch=''
1093 sitearch=''
1094 sitearchexp=''
1095 installsitebin=''
1096 sitebin=''
1097 sitebinexp=''
1098 installsitehtml1dir=''
1099 sitehtml1dir=''
1100 sitehtml1direxp=''
1101 installsitehtml3dir=''
1102 sitehtml3dir=''
1103 sitehtml3direxp=''
1104 installsitelib=''
1105 sitelib=''
1106 sitelib_stem=''
1107 sitelibexp=''
1108 installsiteman1dir=''
1109 siteman1dir=''
1110 siteman1direxp=''
1111 installsiteman3dir=''
1112 siteman3dir=''
1113 siteman3direxp=''
1114 siteprefix=''
1115 siteprefixexp=''
1116 installsitescript=''
1117 sitescript=''
1118 sitescriptexp=''
1119 sizesize=''
1120 sizetype=''
1121 so=''
1122 socksizetype=''
1123 sharpbang=''
1124 shsharp=''
1125 spitshell=''
1126 src=''
1127 ssizetype=''
1128 startperl=''
1129 startsh=''
1130 stdchar=''
1131 d_stdio_stream_array=''
1132 stdio_stream_array=''
1133 sysman=''
1134 trnl=''
1135 uidformat=''
1136 uidsign=''
1137 uidsize=''
1138 uidtype=''
1139 archname64=''
1140 use64bitall=''
1141 use64bitint=''
1142 usefaststdio=''
1143 ccflags_uselargefiles=''
1144 ldflags_uselargefiles=''
1145 libswanted_uselargefiles=''
1146 uselargefiles=''
1147 uselongdouble=''
1148 usemorebits=''
1149 usemultiplicity=''
1150 nm_opt=''
1151 nm_so_opt=''
1152 runnm=''
1153 usenm=''
1154 useperlio=''
1155 userelocatableinc=''
1156 usesocks=''
1157 d_oldpthreads=''
1158 use5005threads=''
1159 useithreads=''
1160 usereentrant=''
1161 usethreads=''
1162 incpath=''
1163 mips_type=''
1164 usrinc=''
1165 d_vendorarch=''
1166 installvendorarch=''
1167 vendorarch=''
1168 vendorarchexp=''
1169 d_vendorbin=''
1170 installvendorbin=''
1171 vendorbin=''
1172 vendorbinexp=''
1173 installvendorhtml1dir=''
1174 vendorhtml1dir=''
1175 vendorhtml1direxp=''
1176 installvendorhtml3dir=''
1177 vendorhtml3dir=''
1178 vendorhtml3direxp=''
1179 d_vendorlib=''
1180 installvendorlib=''
1181 vendorlib=''
1182 vendorlib_stem=''
1183 vendorlibexp=''
1184 installvendorman1dir=''
1185 vendorman1dir=''
1186 vendorman1direxp=''
1187 installvendorman3dir=''
1188 vendorman3dir=''
1189 vendorman3direxp=''
1190 usevendorprefix=''
1191 vendorprefix=''
1192 vendorprefixexp=''
1193 d_vendorscript=''
1194 installvendorscript=''
1195 vendorscript=''
1196 vendorscriptexp=''
1197 versiononly=''
1198 defvoidused=''
1199 voidflags=''
1200 yacc=''
1201 yaccflags=''
1202 CONFIG=''
1203
1204 define='define'
1205 undef='undef'
1206 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1207 rmlist=''
1208
1209 : We must find out about Eunice early
1210 eunicefix=':'
1211 if test -f /etc/unixtovms; then
1212         eunicefix=/etc/unixtovms
1213 fi
1214 if test -f /etc/unixtovms.exe; then
1215         eunicefix=/etc/unixtovms.exe
1216 fi
1217
1218 : Set executable suffix now -- needed before hints available
1219 if test -f "/libs/version.library"; then
1220 : Amiga OS
1221     _exe=""
1222 elif test -f "/system/gnu_library/bin/ar.pm"; then
1223 : Stratus VOS
1224     _exe=".pm"
1225 elif test -n "$DJGPP"; then
1226 : DOS DJGPP
1227     _exe=".exe"
1228 elif test -d c:/. -o -n "$is_os2" ; then
1229 : OS/2 or cygwin
1230     _exe=".exe"
1231 fi
1232
1233 i_whoami=''
1234 ccname=''
1235 ccversion=''
1236 perllibs=''
1237 : set useposix=false in your hint file to disable the POSIX extension.
1238 useposix=true
1239 : set useopcode=false in your hint file to disable the Opcode extension.
1240 useopcode=true
1241 : Trailing extension.  Override this in a hint file, if needed.
1242 : Extra object files, if any, needed on this platform.
1243 archobjs=''
1244 archname=''
1245 : Possible local include directories to search.
1246 : Set locincpth to "" in a hint file to defeat local include searches.
1247 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1248 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1249 :
1250 : no include file wanted by default
1251 inclwanted=''
1252
1253 groupstype=''
1254 libnames=''
1255 : change the next line if compiling for Xenix/286 on Xenix/386
1256 xlibpth='/usr/lib/386 /lib/386'
1257 : Possible local library directories to search.
1258 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1259 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1260
1261 : general looking path for locating libraries
1262 glibpth="/lib /usr/lib $xlibpth"
1263 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1264 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1265 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1266
1267 : Private path used by Configure to find libraries.  Its value
1268 : is prepended to libpth. This variable takes care of special
1269 : machines, like the mips.  Usually, it should be empty.
1270 plibpth=''
1271
1272 : default library list
1273 libswanted=''
1274 : some systems want to use only the non-versioned libso:s
1275 ignore_versioned_solibs=''
1276 siteman1dir=''
1277 siteman3dir=''
1278 sitescript=''
1279 archname64=''
1280 ccflags_uselargefiles=''
1281 ldflags_uselargefiles=''
1282 libswanted_uselargefiles=''
1283 : set usemultiplicity on the Configure command line to enable multiplicity.
1284 : set usesocks on the Configure command line to enable socks.
1285 : set usethreads on the Configure command line to enable threads.
1286 usereentrant='undef'
1287 : full support for void wanted by default
1288 defvoidused=15
1289
1290 : List of libraries we want.
1291 : If anyone needs extra -lxxx, put those in a hint file.
1292 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1293 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1294 : We probably want to search /usr/shlib before most other libraries.
1295 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1296 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1297 glibpth="/usr/shlib $glibpth"
1298 : Do not use vfork unless overridden by a hint file.
1299 usevfork=false
1300
1301 : Find the basic shell for Bourne shell scripts
1302 case "$sh" in
1303 '')
1304         case "$SYSTYPE" in
1305         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1306         *) xxx='/bin/sh';;
1307         esac
1308         if test -f "$xxx"; then
1309                 sh="$xxx"
1310         else
1311                 : Build up a list and do a single loop so we can 'break' out.
1312                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1313                 for xxx in sh bash ksh pdksh ash; do
1314                         for p in $pth; do
1315                                 try="$try ${p}/${xxx}"
1316                         done
1317                 done
1318                 for xxx in $try; do
1319                         if test -f "$xxx"; then
1320                                 sh="$xxx";
1321                                 break
1322                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1323                                 sh="$xxx";
1324                                 break
1325                         elif test -f "$xxx.exe"; then
1326                                 sh="$xxx";
1327                                 break
1328                         fi
1329                 done
1330         fi
1331         ;;
1332 esac
1333
1334 case "$sh" in
1335 '')     cat >&2 <<EOM
1336 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1337
1338 Usually it's in /bin/sh.  How did you even get this far?
1339 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1340 we'll try to straighten this all out.
1341 EOM
1342         exit 1
1343         ;;
1344 esac
1345
1346 : see if sh knows # comments
1347 if `$sh -c '#' >/dev/null 2>&1`; then
1348         shsharp=true
1349         spitshell=cat
1350         xcat=/bin/cat
1351         test -f $xcat$_exe || xcat=/usr/bin/cat
1352         if test ! -f $xcat$_exe; then
1353                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1354                         if test -f $p/cat$_exe; then
1355                                 xcat=$p/cat
1356                                 break
1357                         fi
1358                 done
1359                 if test ! -f $xcat$_exe; then
1360                         echo "Can't find cat anywhere!"
1361                         exit 1
1362                 fi
1363         fi
1364         echo "#!$xcat" >sharp
1365         $eunicefix sharp
1366         chmod +x sharp
1367         ./sharp > today
1368         if test -s today; then
1369                 sharpbang='#!'
1370         else
1371                 echo "#! $xcat" > sharp
1372                 $eunicefix sharp
1373                 chmod +x sharp
1374                 ./sharp > today
1375                 if test -s today; then
1376                         sharpbang='#! '
1377                 else
1378                         sharpbang=': use '
1379                 fi
1380         fi
1381 else
1382         echo " "
1383         echo "Your $sh doesn't grok # comments--I will strip them later on."
1384         shsharp=false
1385         cd ..
1386         echo "exec grep -v '^[  ]*#'" >spitshell
1387         chmod +x spitshell
1388         $eunicefix spitshell
1389         spitshell=`pwd`/spitshell
1390         cd UU
1391         echo "I presume that if # doesn't work, #! won't work either!"
1392         sharpbang=': use '
1393 fi
1394 rm -f sharp today
1395
1396 : figure out how to guarantee sh startup
1397 case "$startsh" in
1398 '') startsh=${sharpbang}${sh} ;;
1399 *)
1400 esac
1401 cat >sharp <<EOSS
1402 $startsh
1403 set abc
1404 test "$?abc" != 1
1405 EOSS
1406
1407 chmod +x sharp
1408 $eunicefix sharp
1409 if ./sharp; then
1410         : echo "Yup, it does."
1411 else
1412         echo "Hmm... '$startsh' does not guarantee sh startup..."
1413         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1414 fi
1415 rm -f sharp
1416
1417
1418 : Save command line options in file UU/cmdline.opt for later use in
1419 : generating config.sh.
1420 cat > cmdline.opt <<EOSH
1421 # Configure command line arguments.
1422 config_arg0='$0'
1423 config_args='$*'
1424 config_argc=$#
1425 EOSH
1426 argn=1
1427 args_exp=''
1428 args_sep=''
1429 for arg in "$@"; do
1430         cat >>cmdline.opt <<EOSH
1431 config_arg$argn='$arg'
1432 EOSH
1433         # Extreme backslashitis: replace each ' by '"'"'
1434         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1435 $arg
1436 EOC
1437         arg_exp=`cat cmdl.opt`
1438         args_exp="$args_exp$args_sep'$arg_exp'"
1439         argn=`expr $argn + 1`
1440         args_sep=' '
1441 done
1442 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1443 # used by ./hints/os2.sh
1444 rm -f cmdl.opt
1445
1446 : produce awk script to parse command line options
1447 cat >options.awk <<'EOF'
1448 BEGIN {
1449         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1450
1451         len = length(optstr);
1452         for (i = 1; i <= len; i++) {
1453                 c = substr(optstr, i, 1);
1454                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1455                 if (a == ":") {
1456                         arg[c] = 1;
1457                         i++;
1458                 }
1459                 opt[c] = 1;
1460         }
1461 }
1462 {
1463         expect = 0;
1464         str = $0;
1465         if (substr(str, 1, 1) != "-") {
1466                 printf("'%s'\n", str);
1467                 next;
1468         }
1469         len = length($0);
1470         for (i = 2; i <= len; i++) {
1471                 c = substr(str, i, 1);
1472                 if (!opt[c]) {
1473                         printf("-%s\n", substr(str, i));
1474                         next;
1475                 }
1476                 printf("-%s\n", c);
1477                 if (arg[c]) {
1478                         if (i < len)
1479                                 printf("'%s'\n", substr(str, i + 1));
1480                         else
1481                                 expect = 1;
1482                         next;
1483                 }
1484         }
1485 }
1486 END {
1487         if (expect)
1488                 print "?";
1489 }
1490 EOF
1491
1492 : process the command line options
1493 set X `for arg in "$@"; do echo "X$arg"; done |
1494         sed -e s/X// | awk -f options.awk`
1495 eval "set $*"
1496 shift
1497 rm -f options.awk
1498
1499 : set up default values
1500 fastread=''
1501 reuseval=false
1502 config_sh=''
1503 alldone=''
1504 error=''
1505 silent=''
1506 extractsh=''
1507 override=''
1508 knowitall=''
1509 rm -f optdef.sh posthint.sh
1510 cat >optdef.sh <<EOS
1511 $startsh
1512 EOS
1513
1514
1515 : option parsing
1516 while test $# -gt 0; do
1517         case "$1" in
1518         -d) shift; fastread=yes;;
1519         -e) shift; alldone=cont;;
1520         -f)
1521                 shift
1522                 cd ..
1523                 if test -r "$1"; then
1524                         config_sh="$1"
1525                 else
1526                         echo "$me: cannot read config file $1." >&2
1527                         error=true
1528                 fi
1529                 cd UU
1530                 shift;;
1531         -h) shift; error=true;;
1532         -r) shift; reuseval=true;;
1533         -s) shift; silent=true; realsilent=true;;
1534         -E) shift; alldone=exit;;
1535         -K) shift; knowitall=true;;
1536         -O) shift; override=true;;
1537         -S) shift; silent=true; extractsh=true;;
1538         -D)
1539                 shift
1540                 case "$1" in
1541                 *=)
1542                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1543                         echo "$me: ignoring -D $1" >&2
1544                         ;;
1545                 *=*) echo "$1" | \
1546                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1547                 *) echo "$1='define'" >> optdef.sh;;
1548                 esac
1549                 shift
1550                 ;;
1551         -U)
1552                 shift
1553                 case "$1" in
1554                 *=) echo "$1" >> optdef.sh;;
1555                 *=*)
1556                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1557                         echo "$me: ignoring -U $1" >&2
1558                         ;;
1559                 *) echo "$1='undef'" >> optdef.sh;;
1560                 esac
1561                 shift
1562                 ;;
1563         -A)
1564             shift
1565             xxx=''
1566             yyy="$1"
1567             zzz=''
1568             uuu=undef
1569             case "$yyy" in
1570             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1571                  case "$zzz" in
1572                  *:*) zzz='' ;;
1573                  *)   xxx=append
1574                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1575                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1576                  esac
1577                  ;;
1578             esac
1579             case "$xxx" in
1580             '')  case "$yyy" in
1581                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1582                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1583                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1584                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1585                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1586                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1587                  esac
1588                  ;;       
1589             esac
1590             case "$xxx" in
1591             append)
1592                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1593             clear)
1594                 echo "$yyy=''"                  >> posthint.sh ;;
1595             define)
1596                 case "$zzz" in
1597                 '') zzz=define ;;
1598                 esac
1599                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1600             eval)
1601                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1602             prepend)
1603                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1604             undef)
1605                 case "$zzz" in
1606                 '') zzz="$uuu" ;;
1607                 esac
1608                 echo "$yyy=$zzz"                >> posthint.sh ;;
1609             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1610             esac
1611             shift
1612             ;;
1613         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1614             exit 0;;
1615         --) break;;
1616         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1617         *) break;;
1618         esac
1619 done
1620
1621 case "$error" in
1622 true)
1623         cat >&2 <<EOM
1624 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1625                  [-U symbol] [-U symbol=] [-A command:symbol...]
1626   -d : use defaults for all answers.
1627   -e : go on without questioning past the production of config.sh.
1628   -f : specify an alternate default configuration file.
1629   -h : print this help message and exit (with an error status).
1630   -r : reuse C symbols value if possible (skips costly nm extraction).
1631   -s : silent mode, only echoes questions and essential information.
1632   -D : define symbol to have some value:
1633          -D symbol         symbol gets the value 'define'
1634          -D symbol=value   symbol gets the value 'value'
1635   -E : stop at the end of questions, after having produced config.sh.
1636   -K : do not use unless you know what you are doing.
1637   -O : let -D and -U override definitions from loaded configuration file.
1638   -S : perform variable substitutions on all .SH files (can mix with -f)
1639   -U : undefine symbol:
1640          -U symbol    symbol gets the value 'undef'
1641          -U symbol=   symbol gets completely empty
1642   -A : manipulate symbol after the platform specific hints have been applied:
1643          -A symbol=value                append " "value to symbol
1644          -A append:symbol=value         append value to symbol
1645          -A define:symbol=value         define symbol to have value
1646          -A clear:symbol                define symbol to be ''
1647          -A define:symbol               define symbol to be 'define'
1648          -A eval:symbol=value           define symbol to be eval of value
1649          -A prepend:symbol=value        prepend value to symbol
1650          -A undef:symbol                define symbol to be 'undef'
1651          -A undef:symbol=               define symbol to be ''
1652   -V : print version number and exit (with a zero status).
1653 EOM
1654         exit 1
1655         ;;
1656 esac
1657
1658 : Sanity checks
1659 case "$fastread$alldone" in
1660 yescont|yesexit) ;;
1661 *)
1662         case "$extractsh" in
1663         true) ;;
1664         *)
1665                 if test ! -t 0; then
1666                         echo "Say 'sh Configure', not 'sh <Configure'"
1667                         exit 1
1668                 fi
1669                 ;;
1670         esac
1671         ;;
1672 esac
1673
1674 exec 4>&1
1675 case "$silent" in
1676 true) exec 1>/dev/null;;
1677 esac
1678
1679 : run the defines and the undefines, if any, but leave the file out there...
1680 touch optdef.sh
1681 . ./optdef.sh
1682 : create the posthint manipulation script and leave the file out there...
1683 touch posthint.sh
1684
1685 : set package name
1686 package=perl5
1687 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1688 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1689 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1690 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1691 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1692 esac
1693
1694 : Some greps do not return status, grrr.
1695 echo "grimblepritz" >grimble
1696 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1697         contains=contains
1698 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1699         contains=grep
1700 else
1701         contains=contains
1702 fi
1703 rm -f grimble
1704 : the following should work in any shell
1705 case "$contains" in
1706 contains*)
1707         echo " "
1708         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1709         cat >contains <<'EOSS'
1710 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1711 EOSS
1712 chmod +x contains
1713 esac
1714
1715 : Find the path to the source tree
1716 case "$src" in
1717 '') case "$0" in
1718     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1719          case "$src" in
1720          /*)    ;;
1721          .)     ;;
1722          *)     src=`cd ../$src && pwd` ;;
1723          esac
1724          ;;
1725     *)   src='.';;
1726     esac;;
1727 esac
1728 case "$src" in
1729 '')     src=/
1730         rsrc=/
1731         ;;
1732 /*) rsrc="$src";;
1733 *) rsrc="../$src";;
1734 esac
1735 if test -f $rsrc/Configure && \
1736         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1737 then
1738    : found it, so we are ok.
1739 else
1740         rsrc=''
1741         for src in . .. ../.. ../../.. ../../../..; do
1742                 if test -f ../$src/Configure && \
1743                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1744                 then
1745                         rsrc=../$src
1746                         break
1747                 fi
1748         done
1749 fi
1750 case "$rsrc" in
1751 '')
1752         cat <<EOM >&4
1753
1754 Sorry, I can't seem to locate the source dir for $package.  Please start
1755 Configure with an explicit path -- i.e. /some/path/Configure.
1756
1757 EOM
1758         exit 1
1759         ;;
1760 ../.)   rsrc='..';;
1761 *)
1762         echo " "
1763         echo "Sources for $package found in \"$src\"." >&4
1764         ;;
1765 esac
1766
1767 : script used to extract .SH files with variable substitutions
1768 cat >extract <<'EOS'
1769 PERL_CONFIG_SH=true
1770 echo "Doing variable substitutions on .SH files..."
1771 if test -f MANIFEST; then
1772         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1773 else
1774         echo "(Looking for .SH files under the source directory.)"
1775         set x `(cd "$src"; find . -name "*.SH" -print)`
1776 fi
1777 shift
1778 case $# in
1779 0) set x `(cd "$src"; echo *.SH)`; shift;;
1780 esac
1781 if test ! -f "$src/$1"; then
1782         shift
1783 fi
1784 mkdir_p='
1785 name=$1;
1786 create="";
1787 while test $name; do
1788         if test ! -d "$name"; then
1789                 create="$name $create";
1790                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1791                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1792         else
1793                 name="";
1794         fi;
1795 done;
1796 for file in $create; do
1797         mkdir $file;
1798 done
1799 '
1800 for file in $*; do
1801         case "$src" in
1802         ".")
1803                 case "$file" in
1804                 */*)
1805                         dir=`expr X$file : 'X\(.*\)/'`
1806                         file=`expr X$file : 'X.*/\(.*\)'`
1807                         (cd "$dir" && . ./$file)
1808                         ;;
1809                 *)
1810                         . ./$file
1811                         ;;
1812                 esac
1813                 ;;
1814         *)
1815                 case "$file" in
1816                 */*)
1817                         dir=`expr X$file : 'X\(.*\)/'`
1818                         file=`expr X$file : 'X.*/\(.*\)'`
1819                         (set x $dir; shift; eval $mkdir_p)
1820                         sh <"$src/$dir/$file"
1821                         ;;
1822                 *)
1823                         sh <"$src/$file"
1824                         ;;
1825                 esac
1826                 ;;
1827         esac
1828 done
1829 if test -f "$src/config_h.SH"; then
1830         if test ! -f config.h; then
1831         : oops, they left it out of MANIFEST, probably, so do it anyway.
1832         . "$src/config_h.SH"
1833         fi
1834 fi
1835 EOS
1836
1837 : extract files and exit if asked to do so
1838 case "$extractsh" in
1839 true)
1840         case "$realsilent" in
1841         true) ;;
1842         *) exec 1>&4;;
1843         esac
1844         case "$config_sh" in
1845         '') config_sh='config.sh';;
1846         esac
1847         echo " "
1848         echo "Fetching answers from $config_sh..."
1849         cd ..
1850         . $config_sh
1851         test "$override" && . ./optdef.sh
1852         echo " "
1853         . UU/extract
1854         rm -rf UU
1855         echo "Extraction done."
1856         exit 0
1857         ;;
1858 esac
1859
1860 : Eunice requires " " instead of "", can you believe it
1861 echo " "
1862 : Here we go...
1863 echo "Beginning of configuration questions for $package."
1864
1865 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1866
1867 : first determine how to suppress newline on echo command
1868 echo " "
1869 echo "Checking echo to see how to suppress newlines..."
1870 (echo "hi there\c" ; echo " ") >.echotmp
1871 if $contains c .echotmp >/dev/null 2>&1 ; then
1872         echo "...using -n."
1873         n='-n'
1874         c=''
1875 else
1876         cat <<'EOM'
1877 ...using \c
1878 EOM
1879         n=''
1880         c='\c'
1881 fi
1882 echo $n "The star should be here-->$c"
1883 echo '*'
1884 rm -f .echotmp
1885
1886 : Now test for existence of everything in MANIFEST
1887 echo " "
1888 if test -f "$rsrc/MANIFEST"; then
1889         echo "First let's make sure your kit is complete.  Checking..." >&4
1890         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1891         rm -f missing
1892         tmppwd=`pwd`
1893         for filelist in x??; do
1894                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1895         done
1896         if test -s missing; then
1897                 cat missing >&4
1898                 cat >&4 <<'EOM'
1899
1900 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1901
1902 You have the option of continuing the configuration process, despite the
1903 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1904 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1905 and contact the author (perlbug@perl.org).
1906
1907 EOM
1908                 echo $n "Continue? [n] $c" >&4
1909                 read ans
1910                 case "$ans" in
1911                 y*)
1912                         echo "Continuing..." >&4
1913                         rm -f missing
1914                         ;;
1915                 *)
1916                         echo "ABORTING..." >&4
1917                         kill $$
1918                         ;;
1919                 esac
1920         else
1921                 echo "Looks good..."
1922         fi
1923 else
1924         echo "There is no MANIFEST file.  I hope your kit is complete !"
1925 fi
1926 rm -f missing x??
1927
1928 echo " "
1929 : Find the appropriate value for a newline for tr
1930 if test -n "$DJGPP"; then
1931        trnl='\012'
1932 fi
1933 if test X"$trnl" = X; then
1934         case "`echo foo|tr '\n' x 2>/dev/null`" in
1935         foox) trnl='\n' ;;
1936         esac
1937 fi
1938 if test X"$trnl" = X; then
1939         case "`echo foo|tr '\012' x 2>/dev/null`" in
1940         foox) trnl='\012' ;;
1941         esac
1942 fi
1943 if test X"$trnl" = X; then
1944        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1945        fooxy) trnl='\n\r' ;;
1946        esac
1947 fi
1948 if test X"$trnl" = X; then
1949         cat <<EOM >&2
1950
1951 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1952
1953 EOM
1954         exit 1
1955 fi
1956
1957 : compute the number of columns on the terminal for proper question formatting
1958 case "$COLUMNS" in
1959 '') COLUMNS='80';;
1960 esac
1961
1962 : set up the echo used in my read
1963 myecho="case \"\$xxxm\" in
1964 '') echo $n \"\$rp $c\" >&4;;
1965 *) case \"\$rp\" in
1966         '') echo $n \"[\$xxxm] $c\";;
1967         *)
1968                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1969                         echo \"\$rp\" >&4
1970                         echo $n \"[\$xxxm] $c\" >&4
1971                 else
1972                         echo $n \"\$rp [\$xxxm] $c\" >&4
1973                 fi
1974                 ;;
1975         esac;;
1976 esac"
1977
1978 : now set up to do reads with possible shell escape and default assignment
1979 cat <<EOSC >myread
1980 $startsh
1981 xxxm=\$dflt
1982 $myecho
1983 ans='!'
1984 case "\$fastread" in
1985 yes) case "\$dflt" in
1986         '') ;;
1987         *) ans='';
1988                 case "\$silent-\$rp" in
1989                 true-) ;;
1990                 *) echo " " >&4;;
1991                 esac;;
1992         esac;;
1993 *) case "\$silent" in
1994         true) case "\$rp" in
1995                 '') ans='';;
1996                 esac;;
1997         esac;;
1998 esac
1999 while expr "X\$ans" : "X!" >/dev/null; do
2000         read answ
2001         set x \$xxxm
2002         shift
2003         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2004         case  "\$answ" in
2005         "!")
2006                 sh 1>&4
2007                 echo " "
2008                 $myecho
2009                 ;;
2010         !*)
2011                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2012                 shift
2013                 sh 1>&4 -c "\$*"
2014                 echo " "
2015                 $myecho
2016                 ;;
2017         "\$ans")
2018                 case "\$ans" in
2019                 \\&*)
2020                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2021                         shift
2022                         case "\$1" in
2023                         -d)
2024                                 fastread=yes
2025                                 echo "(OK, I'll run with -d after this question.)" >&4
2026                                 ;;
2027                         -*)
2028                                 echo "*** Sorry, \$1 not supported yet." >&4
2029                                 ;;
2030                         esac
2031                         $myecho
2032                         ans=!
2033                         ;;
2034                 esac;;
2035         *)
2036                 case "\$aok" in
2037                 y)
2038                         echo "*** Substitution done -- please confirm."
2039                         xxxm="\$ans"
2040                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2041                         xxxm="\$ans"
2042                         ans=!
2043                         ;;
2044                 *)
2045                         echo "*** Error -- try again."
2046                         ans=!
2047                         ;;
2048                 esac
2049                 $myecho
2050                 ;;
2051         esac
2052         case "\$ans\$xxxm\$nostick" in
2053         '')
2054                 ans=!
2055                 $myecho
2056                 ;;
2057         esac
2058 done
2059 case "\$ans" in
2060 '') ans="\$xxxm";;
2061 esac
2062 EOSC
2063
2064 : create .config dir to save info across Configure sessions
2065 test -d ../.config || mkdir ../.config
2066 cat >../.config/README <<EOF
2067 This directory created by Configure to save information that should
2068 persist across sessions for $package.
2069
2070 You may safely delete it if you wish.
2071 EOF
2072
2073 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2074 case "$usedevel" in
2075 $define|true|[yY]*) ;;
2076 *) case "$xversion" in
2077    *[13579])
2078         cat >&4 <<EOH
2079 *** WHOA THERE!!! ***
2080
2081     This is an UNSTABLE DEVELOPMENT release.
2082     The version of this $package distribution is $xversion, that is, odd,
2083     (as opposed to even) and that signifies a development release.
2084     If you want a maintenance release, you want an even-numbered version.
2085
2086     Do ***NOT*** install this into production use.
2087     Data corruption and crashes are possible.
2088
2089     It is most seriously suggested that you do not continue any further
2090     unless you want to help in developing and debugging Perl.
2091
2092     If you *still* want to build perl, you can answer 'y' now,
2093     or pass -Dusedevel to Configure.
2094
2095 EOH
2096         rp='Do you really want to continue?'
2097         dflt='n'
2098         . ./myread
2099         case "$ans" in
2100         [yY]) echo >&4 "Okay, continuing."
2101               usedevel="$define" ;;
2102         *) echo >&4 "Okay, bye."
2103            exit 1
2104            ;;
2105         esac
2106         ;;
2107     esac
2108     ;;
2109 esac
2110 case "$usedevel" in
2111 $define|true|[yY]*)
2112         case "$versiononly" in
2113         '') versiononly="$define" ;;
2114         esac
2115         case "$installusrbinperl" in
2116         '') installusrbinperl="$undef" ;;
2117         esac
2118         ;;
2119 esac
2120
2121 : general instructions
2122 needman=true
2123 firsttime=true
2124 user=`(logname) 2>/dev/null`
2125 case "$user" in
2126 '') user=`whoami 2>&1`;;
2127 esac
2128 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2129         firsttime=false
2130         echo " "
2131         rp='Would you like to see the instructions?'
2132         dflt=n
2133         . ./myread
2134         case "$ans" in
2135         [yY]*) ;;
2136         *) needman=false;;
2137         esac
2138 fi
2139 if $needman; then
2140         cat <<EOH
2141
2142 This installation shell script will examine your system and ask you questions
2143 to determine how the perl5 package should be installed. If you get
2144 stuck on a question, you may use a ! shell escape to start a subshell or
2145 execute a command.  Many of the questions will have default answers in square
2146 brackets; typing carriage return will give you the default.
2147
2148 On some of the questions which ask for file or directory names you are allowed
2149 to use the ~name construct to specify the login directory belonging to "name",
2150 even if you don't have a shell which knows about that.  Questions where this is
2151 allowed will be marked "(~name ok)".
2152
2153 EOH
2154         rp=''
2155         dflt='Type carriage return to continue'
2156         . ./myread
2157         cat <<'EOH'
2158
2159 The prompter used in this script allows you to use shell variables and
2160 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2161 in the default answer, as if the default line was a set of arguments given to a
2162 script shell.  This means you may also use $* to repeat the whole default line,
2163 so you do not have to re-type everything to add something to the default.
2164
2165 Everytime there is a substitution, you will have to confirm.  If there is an
2166 error (e.g. an unmatched backtick), the default answer will remain unchanged
2167 and you will be prompted again.
2168
2169 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2170 the questions and use the computed defaults (or the previous answers if there
2171 was already a config.sh file). Type 'Configure -h' for a list of options.
2172 You may also start interactively and then answer '& -d' at any prompt to turn
2173 on the non-interactive behaviour for the remainder of the execution.
2174
2175 EOH
2176         . ./myread
2177         cat <<EOH
2178
2179 Much effort has been expended to ensure that this shell script will run on any
2180 Unix system.  If despite that it blows up on yours, your best bet is to edit
2181 Configure and run it again.  If you can't run Configure for some reason,
2182 you'll have to generate a config.sh file by hand.  Whatever problems you
2183 have, let me (perlbug@perl.org) know how I blew it.
2184
2185 This installation script affects things in two ways:
2186
2187 1) it may do direct variable substitutions on some of the files included
2188    in this kit.
2189 2) it builds a config.h file for inclusion in C programs.  You may edit
2190    any of these files as the need arises after running this script.
2191
2192 If you make a mistake on a question, there is no easy way to back up to it
2193 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2194 files.  Configure will offer to let you do this before it runs the SH files.
2195
2196 EOH
2197         dflt='Type carriage return to continue'
2198         . ./myread
2199         case "$firsttime" in
2200         true) echo $user >>../.config/instruct;;
2201         esac
2202 fi
2203
2204 : find out where common programs are
2205 echo " "
2206 echo "Locating common programs..." >&4
2207 cat <<EOSC >loc
2208 $startsh
2209 case \$# in
2210 0) exit 1;;
2211 esac
2212 thing=\$1
2213 shift
2214 dflt=\$1
2215 shift
2216 for dir in \$*; do
2217         case "\$thing" in
2218         .)
2219         if test -d \$dir/\$thing; then
2220                 echo \$dir
2221                 exit 0
2222         fi
2223         ;;
2224         *)
2225         for thisthing in \$dir/\$thing; do
2226                 : just loop through to pick last item
2227         done
2228         if test -f \$thisthing; then
2229                 echo \$thisthing
2230                 exit 0
2231         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2232                 echo \$thisthing
2233                 exit 0
2234         elif test -f \$dir/\$thing.exe; then
2235                 if test -n "$DJGPP"; then
2236                         echo \$dir/\$thing.exe
2237                 elif test "$eunicefix" != ":"; then
2238                         : on Eunice apparently
2239                         echo \$dir/\$thing
2240                         exit 0
2241                 fi
2242                 exit 0
2243         fi
2244         ;;
2245         esac
2246 done
2247 echo \$dflt
2248 exit 1
2249 EOSC
2250 chmod +x loc
2251 $eunicefix loc
2252 loclist="
2253 awk
2254 cat
2255 chmod
2256 comm
2257 cp
2258 echo
2259 expr
2260 grep
2261 ls
2262 mkdir
2263 rm
2264 sed
2265 sort
2266 touch
2267 tr
2268 uniq
2269 "
2270 trylist="
2271 Mcc
2272 ar
2273 bison
2274 byacc
2275 cpp
2276 csh
2277 date
2278 egrep
2279 gmake
2280 gzip
2281 less
2282 ln
2283 make
2284 more
2285 nm
2286 nroff
2287 pg
2288 test
2289 uname
2290 zip
2291 "
2292 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2293 pth="$pth /lib /usr/lib"
2294 for file in $loclist; do
2295         eval xxx=\$$file
2296         case "$xxx" in
2297         /*|?:[\\/]*)
2298                 if test -f "$xxx"; then
2299                         : ok
2300                 else
2301                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2302                         xxx=`./loc $file $file $pth`
2303                 fi
2304                 ;;
2305         '') xxx=`./loc $file $file $pth`;;
2306         *) xxx=`./loc $xxx $xxx $pth`;;
2307         esac
2308         eval $file=$xxx$_exe
2309         eval _$file=$xxx
2310         case "$xxx" in
2311         /*)
2312                 echo $file is in $xxx.
2313                 ;;
2314         ?:[\\/]*)
2315                 echo $file is in $xxx.
2316                 ;;
2317         *)
2318                 echo "I don't know where '$file' is, and my life depends on it." >&4
2319                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2320                 exit 1
2321                 ;;
2322         esac
2323 done
2324 echo " "
2325 echo "Don't worry if any of the following aren't found..."
2326 say=offhand
2327 for file in $trylist; do
2328         eval xxx=\$$file
2329         case "$xxx" in
2330         /*|?:[\\/]*)
2331                 if test -f "$xxx"; then
2332                         : ok
2333                 else
2334                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2335                         xxx=`./loc $file $file $pth`
2336                 fi
2337                 ;;
2338         '') xxx=`./loc $file $file $pth`;;
2339         *) xxx=`./loc $xxx $xxx $pth`;;
2340         esac
2341         eval $file=$xxx$_exe
2342         eval _$file=$xxx
2343         case "$xxx" in
2344         /*)
2345                 echo $file is in $xxx.
2346                 ;;
2347         ?:[\\/]*)
2348                 echo $file is in $xxx.
2349                 ;;
2350         *)
2351                 echo "I don't see $file out there, $say."
2352                 say=either
2353                 ;;
2354         esac
2355 done
2356 case "$egrep" in
2357 egrep)
2358         echo "Substituting grep for egrep."
2359         egrep=$grep
2360         _egrep=$grep
2361         ;;
2362 esac
2363 case "$ln" in
2364 ln)
2365         echo "Substituting cp for ln."
2366         ln=$cp
2367         _ln=$cp
2368         ;;
2369 esac
2370 case "$make" in
2371 make)   
2372         case "$gmake" in
2373         gmake)
2374         echo "I can't find make or gmake, and my life depends on it." >&4
2375         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2376         exit 1
2377         ;;
2378         esac
2379         ;;
2380 esac    
2381 case "$gmake" in
2382 gmake)  ;;
2383 *)      # We can't have osname yet.
2384         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2385                 # Assume that gmake, if found, is definitely GNU make
2386                 # and prefer it over the system make.
2387                 echo "Substituting gmake for make."
2388                 make=$gmake
2389                 _make=$gmake
2390         fi
2391         ;;
2392 esac
2393 case "$test" in
2394 test)
2395         echo "Hopefully test is built into your sh."
2396         ;;
2397 *)
2398         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2399                 echo "Using the test built into your sh."
2400                 test=test
2401                 _test=test
2402         fi
2403         ;;
2404 esac
2405 case "$echo" in
2406 echo)
2407         echo "Hopefully echo is built into your sh."
2408         ;;
2409 '') ;;
2410 *)
2411         echo " "
2412 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2413         $echo $n "hi there$c" >foo1
2414         echo $n "hi there$c" >foo2
2415         if cmp foo1 foo2 >/dev/null 2>&1; then
2416                 echo "They are compatible.  In fact, they may be identical."
2417         else
2418                 case "$n" in
2419                 '-n') n='' c='\c';;
2420                 *) n='-n' c='';;
2421                 esac
2422                 cat <<FOO
2423 They are not compatible!  You are probably running ksh on a non-USG system.
2424 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2425 have echo built in and we may have to run some Bourne shell scripts.  That
2426 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2427
2428 FOO
2429                 $echo $n "The star should be here-->$c"
2430                 $echo "*"
2431         fi
2432         $rm -f foo1 foo2
2433         ;;
2434 esac
2435
2436 cat <<EOS >trygcc
2437 $startsh
2438 EOS
2439 cat <<'EOSC' >>trygcc
2440 case "$cc" in
2441 '') ;;
2442 *)  $rm -f try try.*
2443     $cat >try.c <<EOM
2444 int main(int argc, char *argv[]) {
2445   return 0;
2446 }
2447 EOM
2448     if $cc -o try $ccflags $ldflags try.c; then
2449        :
2450     else
2451         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2452         despair=yes
2453         trygcc=yes
2454         case "$cc" in
2455         *gcc*) trygcc=no ;;
2456         esac
2457         case "`$cc -v -c try.c 2>&1`" in
2458         *gcc*) trygcc=no ;;
2459         esac
2460         if $test X"$trygcc" = Xyes; then
2461             if gcc -o try -c try.c; then
2462                 echo " "
2463                 echo "You seem to have a working gcc, though." >&4
2464                 rp="Would you like to use it?"
2465                 dflt=y
2466                 if $test -f myread; then
2467                     . ./myread
2468                 else
2469                     if $test -f UU/myread; then
2470                         . ./UU/myread
2471                     else
2472                         echo "Cannot find myread, sorry.  Aborting." >&2
2473                         exit 1
2474                     fi
2475                 fi  
2476                 case "$ans" in
2477                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2478                        if $test -f usethreads.cbu; then
2479                            $cat >&4 <<EOM 
2480
2481 *** However, any setting of the C compiler flags (e.g. for thread support)
2482 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2483 *** (together with e.g. -Dusethreads).
2484
2485 EOM
2486                        fi;;
2487                 esac
2488             fi
2489         fi
2490     fi
2491     $rm -f try try.*
2492     ;;
2493 esac
2494 EOSC
2495
2496 cat <<EOS >checkcc
2497 $startsh
2498 EOS
2499 cat <<'EOSC' >>checkcc
2500 case "$cc" in        
2501 '') ;;
2502 *)  $rm -f try try.*              
2503     $cat >try.c <<EOM
2504 int main(int argc, char *argv[]) {
2505   return 0;
2506 }
2507 EOM
2508     if $cc -o try $ccflags $ldflags try.c; then
2509        :
2510     else
2511         if $test X"$despair" = Xyes; then
2512            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2513         fi
2514         $cat >&4 <<EOM         
2515 You need to find a working C compiler.
2516 Either (purchase and) install the C compiler supplied by your OS vendor,
2517 or for a free C compiler try http://gcc.gnu.org/
2518 I cannot continue any further, aborting.
2519 EOM
2520         exit 1
2521     fi
2522     $rm -f try try.*
2523     ;;
2524 esac
2525 EOSC
2526
2527 : determine whether symbolic links are supported
2528 echo " "
2529 $touch blurfl
2530 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2531         echo "Symbolic links are supported." >&4
2532         lns="$ln -s"
2533 else
2534         echo "Symbolic links are NOT supported." >&4
2535         lns="$ln"
2536 fi
2537 $rm -f blurfl sym
2538
2539 : determine whether symbolic links are supported
2540 echo " "
2541 case "$lns" in
2542 *"ln"*" -s")
2543         echo "Checking how to test for symbolic links..." >&4
2544         $lns blurfl sym
2545         if $test "X$issymlink" = X; then
2546                 case "$newsh" in
2547                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2548                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2549                 esac
2550                 if test $? = 0; then
2551                         issymlink="test -h"
2552                 else
2553                         echo "Your builtin 'test -h' may be broken." >&4
2554                         case "$test" in
2555                         /*)     ;;
2556                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2557                                 for p in $pth
2558                                 do
2559                                         if test -f "$p/$test"; then
2560                                                 test="$p/$test"
2561                                                 break
2562                                         fi
2563                                 done
2564                                 ;;
2565                         esac
2566                         case "$test" in
2567                         /*)
2568                                 echo "Trying external '$test -h'." >&4
2569                                 issymlink="$test -h"
2570                                 if $test ! -h sym >/dev/null 2>&1; then
2571                                         echo "External '$test -h' is broken, too." >&4
2572                                         issymlink=''
2573                                 fi
2574                                 ;;
2575                         *)      issymlink='' ;;
2576                         esac
2577                 fi              
2578         fi
2579         if $test "X$issymlink" = X; then
2580                 if $test -L sym 2>/dev/null; then
2581                         issymlink="$test -L"
2582                         echo "The builtin '$test -L' worked." >&4
2583                 fi
2584         fi
2585         if $test "X$issymlink" != X; then
2586                 echo "You can test for symbolic links with '$issymlink'." >&4
2587         else
2588                 echo "I do not know how you can test for symbolic links." >&4
2589         fi
2590         $rm -f blurfl sym
2591         ;;
2592 *)      echo "No symbolic links, so not testing for their testing..." >&4
2593         ;;
2594 esac
2595 echo " "
2596
2597
2598 case "$mksymlinks" in
2599 $define|true|[yY]*)
2600         case "$src" in
2601         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2602                 exit 1
2603                 ;;
2604         *)      case "$lns:$issymlink" in
2605                 *"ln"*" -s:"*"test -"?)
2606                         echo "Creating the symbolic links..." >&4
2607                         echo "(First creating the subdirectories...)" >&4
2608                         cd ..
2609                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2610                                 read directory
2611                                 test -z "$directory" && break
2612                                 mkdir -p $directory
2613                         done
2614                         # Sanity check 1.
2615                         if test ! -d t/base; then
2616                                 echo "Failed to create the subdirectories.  Aborting." >&4
2617                                 exit 1
2618                         fi
2619                         echo "(Then creating the symlinks...)" >&4
2620                         awk '{print $1}' $src/MANIFEST | while true; do
2621                                 read filename
2622                                 test -z "$filename" && break
2623                                 if test -f $filename; then
2624                                         if $issymlink $filename; then
2625                                                 rm -f $filename
2626                                         fi
2627                                 fi
2628                                 if test -f $filename; then
2629                                         echo "$filename already exists, not symlinking."
2630                                 else
2631                                         ln -s $src/$filename $filename
2632                                 fi
2633                         done
2634                         # Sanity check 2.
2635                         if test ! -f t/base/lex.t; then
2636                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2637                                 exit 1
2638                         fi
2639                         cd UU
2640                         ;;
2641                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2642                         ;;
2643                 esac
2644                 ;;
2645         esac
2646         ;;
2647 esac
2648
2649
2650 case "$usecrosscompile" in
2651 $define|true|[yY]*)
2652         $echo "Cross-compiling..."
2653         croak=''
2654         case "$cc" in
2655         *-*-gcc) # A cross-compiling gcc, probably.
2656             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2657             ar=$targetarch-ar
2658             # leave out ld, choosing it is more complex
2659             nm=$targetarch-nm
2660             ranlib=$targetarch-ranlib
2661             $echo 'extern int foo;' > try.c
2662             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2663             shift
2664             if $test $# -gt 0; then
2665                 incpth="$incpth $*"
2666                 incpth="`$echo $incpth|$sed 's/^ //'`"
2667                 echo "Guessing incpth '$incpth'." >&4
2668                 for i in $*; do
2669                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2670                     if $test -d $j; then
2671                         libpth="$libpth $j"
2672                     fi
2673                 done   
2674                 libpth="`$echo $libpth|$sed 's/^ //'`"
2675                 echo "Guessing libpth '$libpth'." >&4
2676             fi
2677             $rm -f try.c
2678             ;;
2679         esac
2680         case "$targetarch" in
2681         '') echo "Targetarch not defined." >&4; croak=y ;;
2682         *)  echo "Using targetarch $targetarch." >&4 ;;
2683         esac
2684         case "$incpth" in
2685         '') echo "Incpth not defined." >&4; croak=y ;;
2686         *)  echo "Using incpth '$incpth'." >&4 ;;
2687         esac
2688         case "$libpth" in
2689         '') echo "Libpth not defined." >&4; croak=y ;;
2690         *)  echo "Using libpth '$libpth'." >&4 ;;
2691         esac
2692         case "$usrinc" in
2693         '') for i in $incpth; do
2694                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2695                     usrinc=$i
2696                     echo "Guessing usrinc $usrinc." >&4
2697                     break
2698                 fi
2699             done
2700             case "$usrinc" in
2701             '') echo "Usrinc not defined." >&4; croak=y ;;
2702             esac
2703             ;;
2704         *)  echo "Using usrinc $usrinc." >&4 ;;
2705         esac
2706         case "$targethost" in
2707         '') echo "Targethost not defined." >&4; croak=y ;;
2708         *)  echo "Using targethost $targethost." >&4
2709         esac
2710         locincpth=' '
2711         loclibpth=' '
2712         case "$croak" in
2713         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2714         esac
2715         case "$src" in
2716         /*) run=$src/Cross/run
2717             targetmkdir=$src/Cross/mkdir
2718             to=$src/Cross/to
2719             from=$src/Cross/from
2720             ;;
2721         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2722             run=$pwd/Cross/run
2723             targetmkdir=$pwd/Cross/mkdir
2724             to=$pwd/Cross/to
2725             from=$pwd/Cross/from
2726             ;;
2727         esac
2728         case "$targetrun" in
2729         '') targetrun=ssh ;;
2730         esac
2731         case "$targetto" in
2732         '') targetto=scp ;;
2733         esac
2734         case "$targetfrom" in
2735         '') targetfrom=scp ;;
2736         esac
2737         run=$run-$targetrun
2738         to=$to-$targetto
2739         from=$from-$targetfrom
2740         case "$targetdir" in
2741         '')  targetdir=/tmp
2742              echo "Guessing targetdir $targetdir." >&4
2743              ;;
2744         esac
2745         case "$targetuser" in
2746         '')  targetuser=root
2747              echo "Guessing targetuser $targetuser." >&4
2748              ;;
2749         esac
2750         case "$targetfrom" in
2751         scp)    q=-q ;;
2752         *)      q='' ;;
2753         esac
2754         case "$targetrun" in
2755         ssh|rsh)
2756             cat >$run <<EOF
2757 #!/bin/sh
2758 case "\$1" in
2759 -cwd)
2760   shift
2761   cwd=\$1
2762   shift
2763   ;;
2764 esac
2765 case "\$cwd" in
2766 '') cwd=$targetdir ;;
2767 esac
2768 exe=\$1
2769 shift
2770 if $test ! -f \$exe.xok; then
2771   $to \$exe
2772   $touch \$exe.xok
2773 fi
2774 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2775 EOF
2776             ;;
2777         *)  echo "Unknown targetrun '$targetrun'" >&4
2778             exit 1
2779             ;;
2780         esac
2781         case "$targetmkdir" in
2782         */Cross/mkdir)
2783             cat >$targetmkdir <<EOF
2784 #!/bin/sh
2785 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2786 EOF
2787             $chmod a+rx $targetmkdir
2788             ;;
2789         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2790             exit 1
2791             ;;
2792         esac
2793         case "$targetto" in
2794         scp|rcp)
2795             cat >$to <<EOF
2796 #!/bin/sh
2797 for f in \$@
2798 do
2799   case "\$f" in
2800   /*)
2801     $targetmkdir \`dirname \$f\`
2802     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2803     ;;
2804   *)
2805     $targetmkdir $targetdir/\`dirname \$f\`
2806     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2807     ;;
2808   esac
2809 done
2810 exit 0
2811 EOF
2812             ;;
2813         cp) cat >$to <<EOF
2814 #!/bin/sh
2815 for f in \$@
2816 do
2817   case "\$f" in
2818   /*)
2819     $mkdir -p $targetdir/\`dirname \$f\`
2820     $cp \$f $targetdir/\$f || exit 1
2821     ;;
2822   *)
2823     $targetmkdir $targetdir/\`dirname \$f\`
2824     $cp \$f $targetdir/\$f || exit 1
2825     ;;
2826   esac
2827 done
2828 exit 0
2829 EOF
2830             ;;
2831         *)  echo "Unknown targetto '$targetto'" >&4
2832             exit 1
2833             ;;
2834         esac
2835         case "$targetfrom" in
2836         scp|rcp)
2837           cat >$from <<EOF
2838 #!/bin/sh
2839 for f in \$@
2840 do
2841   $rm -f \$f
2842   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2843 done
2844 exit 0
2845 EOF
2846             ;;
2847         cp) cat >$from <<EOF
2848 #!/bin/sh
2849 for f in \$@
2850 do
2851   $rm -f \$f
2852   cp $targetdir/\$f . || exit 1
2853 done
2854 exit 0
2855 EOF
2856             ;;
2857         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2858             exit 1
2859             ;;
2860         esac
2861         if $test ! -f $run; then
2862             echo "Target 'run' script '$run' not found." >&4
2863         else
2864             $chmod a+rx $run
2865         fi
2866         if $test ! -f $to; then
2867             echo "Target 'to' script '$to' not found." >&4
2868         else
2869             $chmod a+rx $to
2870         fi
2871         if $test ! -f $from; then
2872             echo "Target 'from' script '$from' not found." >&4
2873         else
2874             $chmod a+rx $from
2875         fi
2876         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2877             exit 1
2878         fi
2879         cat >&4 <<EOF
2880 Using '$run' for remote execution,
2881 and '$from' and '$to'
2882 for remote file transfer.
2883 EOF
2884         ;;
2885 *)      run=''
2886         to=:
2887         from=:
2888         usecrosscompile='undef'
2889         targetarch=''
2890         ;;
2891 esac
2892
2893 : see whether [:lower:] and [:upper:] are supported character classes
2894 echo " "
2895 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2896 ABYZ)
2897         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2898         up='[:upper:]'
2899         low='[:lower:]'
2900         ;;
2901 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2902         # (0xd9 and 0xe2), therefore that is a nice testing point.
2903         if test "X$up" = X -o "X$low" = X; then
2904             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2905             rs) up='[A-Z]'
2906                 low='[a-z]'
2907                 ;;
2908             esac
2909         fi
2910         if test "X$up" = X -o "X$low" = X; then
2911             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2912             rs) up='A-Z'
2913                 low='a-z'
2914                 ;;
2915             esac
2916         fi
2917         if test "X$up" = X -o "X$low" = X; then
2918             case "`echo RS | od -x 2>/dev/null`" in
2919             *D9E2*|*d9e2*)
2920                 echo "Hey, this might be EBCDIC." >&4
2921                 if test "X$up" = X -o "X$low" = X; then
2922                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2923                     rs) up='[A-IJ-RS-Z]'
2924                         low='[a-ij-rs-z]'
2925                         ;;
2926                     esac
2927                 fi
2928                 if test "X$up" = X -o "X$low" = X; then
2929                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2930                     rs) up='A-IJ-RS-Z'
2931                         low='a-ij-rs-z'
2932                         ;;
2933                     esac
2934                 fi
2935                 ;;
2936             esac
2937         fi
2938 esac
2939 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2940 rs)
2941     echo "Using $up and $low to convert case." >&4
2942     ;;
2943 *)
2944     echo "I don't know how to translate letters from upper to lower case." >&4
2945     echo "Your tr is not acting any way I know of." >&4
2946     exit 1
2947     ;;
2948 esac
2949 : set up the translation script tr, must be called with ./tr of course
2950 cat >tr <<EOSC
2951 $startsh
2952 case "\$1\$2" in
2953 '[A-Z][a-z]') exec $tr '$up' '$low';;
2954 '[a-z][A-Z]') exec $tr '$low' '$up';;
2955 esac
2956 exec $tr "\$@"
2957 EOSC
2958 chmod +x tr
2959 $eunicefix tr
2960
2961 : Try to determine whether config.sh was made on this system
2962 case "$config_sh" in
2963 '')
2964 myuname=`$uname -a 2>/dev/null`
2965 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2966 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2967 # because the A-Z/a-z are not consecutive.
2968 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2969         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2970 newmyuname="$myuname"
2971 dflt=n
2972 case "$knowitall" in
2973 '')
2974         if test -f ../config.sh; then
2975                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2976                         eval "`grep myuname= ../config.sh`"
2977                 fi
2978                 if test "X$myuname" = "X$newmyuname"; then
2979                         dflt=y
2980                 fi
2981         fi
2982         ;;
2983 *) dflt=y;;
2984 esac
2985
2986 : Get old answers from old config file if Configure was run on the
2987 : same system, otherwise use the hints.
2988 hint=default
2989 cd ..
2990 if test -f config.sh; then
2991         echo " "
2992         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2993         . UU/myread
2994         case "$ans" in
2995         n*|N*) echo "OK, I'll ignore it."
2996                 mv config.sh config.sh.old
2997                 myuname="$newmyuname"
2998                 ;;
2999         *)  echo "Fetching default answers from your old config.sh file..." >&4
3000                 tmp_n="$n"
3001                 tmp_c="$c"
3002                 tmp_sh="$sh"
3003                 . ./config.sh
3004                 cp config.sh UU
3005                 n="$tmp_n"
3006                 c="$tmp_c"
3007                 : Older versions did not always set $sh.  Catch re-use of such
3008                 : an old config.sh.
3009                 case "$sh" in
3010                 '') sh="$tmp_sh" ;;
3011                 esac
3012                 hint=previous
3013                 ;;
3014         esac
3015 fi
3016 . ./UU/checkcc
3017 if test ! -f config.sh; then
3018         $cat <<EOM
3019
3020 First time through, eh?  I have some defaults handy for some systems
3021 that need some extra help getting the Configure answers right:
3022
3023 EOM
3024         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3025         dflt=''
3026         : Half the following guesses are probably wrong... If you have better
3027         : tests or hints, please send them to perlbug@perl.org
3028         : The metaconfig authors would also appreciate a copy...
3029         $test -f /irix && osname=irix
3030         $test -f /xenix && osname=sco_xenix
3031         $test -f /dynix && osname=dynix
3032         $test -f /dnix && osname=dnix
3033         $test -f /lynx.os && osname=lynxos
3034         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3035         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3036         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3037         $test -f /bin/mips && /bin/mips && osname=mips
3038         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3039                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3040         $test -d /usr/apollo/bin && osname=apollo
3041         $test -f /etc/saf/_sactab && osname=svr4
3042         $test -d /usr/include/minix && osname=minix
3043         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3044         if $test -d /MachTen -o -d /MachTen_Folder; then
3045                 osname=machten
3046                 if $test -x /sbin/version; then
3047                         osvers=`/sbin/version | $awk '{print $2}' |
3048                         $sed -e 's/[A-Za-z]$//'`
3049                 elif $test -x /usr/etc/version; then
3050                         osvers=`/usr/etc/version | $awk '{print $2}' |
3051                         $sed -e 's/[A-Za-z]$//'`
3052                 else
3053                         osvers="$2.$3"
3054                 fi
3055         fi
3056
3057         $test -f /sys/posix.dll &&
3058                 $test -f /usr/bin/what &&
3059                 set X `/usr/bin/what /sys/posix.dll` &&
3060                 $test "$3" = UWIN &&
3061                 osname=uwin &&
3062                 osvers="$5"
3063
3064         if $test -f $uname; then
3065                 set X $myuname
3066                 shift
3067
3068                 case "$5" in
3069                 fps*) osname=fps ;;
3070                 mips*)
3071                         case "$4" in
3072                         umips) osname=umips ;;
3073                         *) osname=mips ;;
3074                         esac;;
3075                 [23]100) osname=mips ;;
3076                 next*) osname=next ;;
3077                 i386*)
3078                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3079                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3080                                 osname='sco'
3081                                 osvers=$tmp
3082                         elif $test -f /etc/kconfig; then
3083                                 osname=isc
3084                                 if test "$lns" = "$ln -s"; then
3085                                         osvers=4
3086                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3087                                         osvers=3
3088                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3089                                         osvers=2
3090                                 fi
3091                         fi
3092                         tmp=''
3093                         ;;
3094                 pc*)
3095                         if test -n "$DJGPP"; then
3096                                 osname=dos
3097                                 osvers=djgpp
3098                         fi
3099                         ;;
3100                 esac
3101
3102                 case "$1" in
3103                 aix) osname=aix
3104                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3105                         case "$tmp" in
3106                         # oslevel can fail with:
3107                         # oslevel: Unable to acquire lock.
3108                         *not\ found) osvers="$4"."$3" ;;
3109                         '<3240'|'<>3240') osvers=3.2.0 ;;
3110                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3111                         '=3250'|'>3250') osvers=3.2.5 ;;
3112                         *) osvers=$tmp;;
3113                         esac
3114                         ;;
3115                 bsd386) osname=bsd386
3116                         osvers=`$uname -r`
3117                         ;;
3118                 cygwin*) osname=cygwin
3119                         osvers="$3"
3120                         ;;
3121                 *dc.osx) osname=dcosx
3122                         osvers="$3"
3123                         ;;
3124                 dnix) osname=dnix
3125                         osvers="$3"
3126                         ;;
3127                 domainos) osname=apollo
3128                         osvers="$3"
3129                         ;;
3130                 dgux)   osname=dgux 
3131                         osvers="$3"
3132                         ;;
3133                 dynixptx*) osname=dynixptx
3134                         osvers=`echo "$4"|sed 's/^v//'`
3135                         ;;
3136                 freebsd) osname=freebsd 
3137                         osvers="$3" ;;
3138                 genix)  osname=genix ;;
3139                 gnu)    osname=gnu
3140                         osvers="$3" ;;
3141                 hp*)    osname=hpux 
3142                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3143                         ;;
3144                 irix*)  osname=irix
3145                         case "$3" in
3146                         4*) osvers=4 ;;
3147                         5*) osvers=5 ;;
3148                         *)      osvers="$3" ;;
3149                         esac
3150                         ;;
3151                 linux)  osname=linux
3152                         case "$3" in
3153                         *)      osvers="$3" ;;
3154                         esac
3155                         ;;
3156                 MiNT)   osname=mint
3157                         ;;
3158                 netbsd*) osname=netbsd
3159                         osvers="$3"
3160                         ;;
3161                 news-os) osvers="$3"
3162                         case "$3" in
3163                         4*) osname=newsos4 ;;
3164                         *) osname=newsos ;;
3165                         esac
3166                         ;;
3167                 next*) osname=next ;;
3168                 nonstop-ux) osname=nonstopux ;;
3169                 openbsd) osname=openbsd
3170                         osvers="$3"
3171                         ;;
3172                 os2)    osname=os2
3173                         osvers="$4"
3174                         ;;
3175                 POSIX-BC | posix-bc ) osname=posix-bc
3176                         osvers="$3"
3177                         ;;
3178                 powerux | power_ux | powermax_os | powermaxos | \
3179                 powerunix | power_unix) osname=powerux
3180                         osvers="$3"
3181                         ;;
3182                 qnx) osname=qnx
3183                         osvers="$4"
3184                         ;;
3185                 solaris) osname=solaris
3186                         case "$3" in
3187                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3188                         *)      osvers="$3" ;;
3189                         esac
3190                         ;;
3191                 sunos) osname=sunos
3192                         case "$3" in
3193                         5*) osname=solaris
3194                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3195                         *)      osvers="$3" ;;
3196                         esac
3197                         ;;
3198                 titanos) osname=titanos
3199                         case "$3" in
3200                         1*) osvers=1 ;;
3201                         2*) osvers=2 ;;
3202                         3*) osvers=3 ;;
3203                         4*) osvers=4 ;;
3204                         *)      osvers="$3" ;;
3205                         esac
3206                         ;;
3207                 ultrix) osname=ultrix
3208                         osvers="$3"
3209                         ;;
3210                 osf1|mls+)      case "$5" in
3211                                 alpha)
3212                                         osname=dec_osf
3213                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3214                                         case "$osvers" in
3215                                         [1-9].[0-9]*) ;;
3216                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3217                                         esac
3218                                         ;;
3219                         hp*)    osname=hp_osf1  ;;
3220                         mips)   osname=mips_osf1 ;;
3221                         esac
3222                         ;;
3223                 # UnixWare 7.1.2 is known as Open UNIX 8
3224                 openunix|unixware) osname=svr5
3225                         osvers="$4"
3226                         ;;
3227                 uts)    osname=uts
3228                         osvers="$3"
3229                         ;;
3230                 vos) osvers="$3"
3231                         ;;
3232                 $2) case "$osname" in
3233                         *isc*) ;;
3234                         *freebsd*) ;;
3235                         svr*)
3236                                 : svr4.x or possibly later
3237                                 case "svr$3" in 
3238                                 ${osname}*)
3239                                         osname=svr$3
3240                                         osvers=$4
3241                                         ;;
3242                                 esac
3243                                 case "$osname" in
3244                                 svr4.0)
3245                                         : Check for ESIX
3246                                         if test -f /stand/boot ; then
3247                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3248                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3249                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3250                                                         if test -n "$isesix"; then
3251                                                                 osname=esix4
3252                                                         fi
3253                                                 fi
3254                                         fi
3255                                         ;;
3256                                 esac
3257                                 ;;
3258                         *)      if test -f /etc/systemid; then
3259                                         osname=sco
3260                                         set `echo $3 | $sed 's/\./ /g'` $4
3261                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3262                                                 osvers=$1.$2.$3
3263                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3264                                                 osvers=$1.$2
3265                                         elif $test -f $src/hints/sco_$1.sh; then
3266                                                 osvers=$1
3267                                         fi
3268                                 else
3269                                         case "$osname" in
3270                                         '') : Still unknown.  Probably a generic Sys V.
3271                                                 osname="sysv"
3272                                                 osvers="$3"
3273                                                 ;;
3274                                         esac
3275                                 fi
3276                                 ;;
3277                         esac
3278                         ;;
3279                 *)      case "$osname" in
3280                         '') : Still unknown.  Probably a generic BSD.
3281                                 osname="$1"
3282                                 osvers="$3"
3283                                 ;;
3284                         esac
3285                         ;;
3286                 esac
3287         else
3288                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3289                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3290                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3291                                 osname=news_os
3292                         fi
3293                         $rm -f UU/kernel.what
3294                 elif test -d c:/. -o -n "$is_os2" ; then
3295                         set X $myuname
3296                         osname=os2
3297                         osvers="$5"
3298                 fi
3299         fi
3300         
3301         case "$targetarch" in
3302         '') ;;
3303         *)  hostarch=$osname
3304             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3305             osvers=''
3306             ;;
3307         esac
3308
3309         : Now look for a hint file osname_osvers, unless one has been
3310         : specified already.
3311         case "$hintfile" in
3312         ''|' ')
3313                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3314                 : Also try without trailing minor version numbers.
3315                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3316                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3317                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3318                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3319                 case "$file" in
3320                 '') dflt=none ;;
3321                 *)  case "$osvers" in
3322                         '') dflt=$file
3323                                 ;;
3324                         *)  if $test -f $src/hints/$file.sh ; then
3325                                         dflt=$file
3326                                 elif $test -f $src/hints/$xfile.sh ; then
3327                                         dflt=$xfile
3328                                 elif $test -f $src/hints/$xxfile.sh ; then
3329                                         dflt=$xxfile
3330                                 elif $test -f $src/hints/$xxxfile.sh ; then
3331                                         dflt=$xxxfile
3332                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3333                                         dflt=$xxxxfile
3334                                 elif $test -f "$src/hints/${osname}.sh" ; then
3335                                         dflt="${osname}"
3336                                 else
3337                                         dflt=none
3338                                 fi
3339                                 ;;
3340                         esac
3341                         ;;
3342                 esac
3343                 if $test -f Policy.sh ; then
3344                         case "$dflt" in
3345                         *Policy*) ;;
3346                         none) dflt="Policy" ;;
3347                         *) dflt="Policy $dflt" ;;
3348                         esac
3349                 fi
3350                 ;;
3351         *)
3352                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3353                 ;;
3354         esac
3355
3356         if $test -f Policy.sh ; then
3357                 $cat <<EOM
3358
3359 There's also a Policy hint file available, which should make the
3360 site-specific (policy) questions easier to answer.
3361 EOM
3362
3363         fi
3364
3365         $cat <<EOM
3366
3367 You may give one or more space-separated answers, or "none" if appropriate.
3368 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3369 is a good thing.  DO NOT give a wrong version or a wrong OS.
3370
3371 EOM
3372
3373         rp="Which of these apply, if any?"
3374         . UU/myread
3375         tans=$ans
3376         for file in $tans; do
3377                 if $test X$file = XPolicy -a -f Policy.sh; then
3378                         . Policy.sh
3379                         $cat Policy.sh >> UU/config.sh
3380                 elif $test -f $src/hints/$file.sh; then
3381                         . $src/hints/$file.sh
3382                         $cat $src/hints/$file.sh >> UU/config.sh
3383                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3384                         : nothing
3385                 else
3386                         : Give one chance to correct a possible typo.
3387                         echo "$file.sh does not exist"
3388                         dflt=$file
3389                         rp="hint to use instead?"
3390                         . UU/myread
3391                         for file in $ans; do
3392                                 if $test -f "$src/hints/$file.sh"; then
3393                                         . $src/hints/$file.sh
3394                                         $cat $src/hints/$file.sh >> UU/config.sh
3395                                 elif $test X$ans = X -o X$ans = Xnone ; then
3396                                         : nothing
3397                                 else
3398                                         echo "$file.sh does not exist -- ignored."
3399                                 fi
3400                         done
3401                 fi
3402         done
3403
3404         hint=recommended
3405         : Remember our hint file for later.
3406         if $test -f "$src/hints/$file.sh" ; then
3407                 hintfile="$file"
3408         else
3409                 hintfile=''
3410         fi
3411 fi
3412 cd UU
3413 ;;
3414 *)
3415         echo " "
3416         echo "Fetching default answers from $config_sh..." >&4
3417         tmp_n="$n"
3418         tmp_c="$c"
3419         cd ..
3420         cp $config_sh config.sh 2>/dev/null
3421         chmod +w config.sh
3422         . ./config.sh
3423         cd UU
3424         cp ../config.sh .
3425         n="$tmp_n"
3426         c="$tmp_c"
3427         hint=previous
3428         ;;
3429 esac
3430 test "$override" && . ./optdef.sh
3431
3432 : Restore computed paths
3433 for file in $loclist $trylist; do
3434         eval $file="\$_$file"
3435 done
3436
3437 cat << EOM
3438
3439 Configure uses the operating system name and version to set some defaults.
3440 The default value is probably right if the name rings a bell. Otherwise,
3441 since spelling matters for me, either accept the default or answer "none"
3442 to leave it blank.
3443
3444 EOM
3445 case "$osname" in
3446         ''|' ')
3447                 case "$hintfile" in
3448                 ''|' '|none) dflt=none ;;
3449                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3450                 esac
3451                 ;;
3452         *) dflt="$osname" ;;
3453 esac
3454 rp="Operating system name?"
3455 . ./myread
3456 case "$ans" in
3457 none)  osname='' ;;
3458 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3459 esac
3460 echo " "
3461 case "$osvers" in
3462         ''|' ')
3463                 case "$hintfile" in
3464                 ''|' '|none) dflt=none ;;
3465                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3466                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3467                         case "$dflt" in
3468                         ''|' ') dflt=none ;;
3469                         esac
3470                         ;;
3471                 esac
3472                 ;;
3473         *) dflt="$osvers" ;;
3474 esac
3475 rp="Operating system version?"
3476 . ./myread
3477 case "$ans" in
3478 none)  osvers='' ;;
3479 *) osvers="$ans" ;;
3480 esac
3481
3482
3483 . ./posthint.sh
3484
3485 : who configured the system
3486 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3487 case "$cf_by" in
3488 "")
3489         cf_by=`(logname) 2>/dev/null`
3490         case "$cf_by" in
3491         "")
3492                 cf_by=`(whoami) 2>/dev/null`
3493                 case "$cf_by" in
3494                 "") cf_by=unknown ;;
3495                 esac ;;
3496         esac ;;
3497 esac
3498
3499 : set up the script used to warn in case of inconsistency
3500 cat <<EOS >whoa
3501 $startsh
3502 EOS
3503 cat <<'EOSC' >>whoa
3504 dflt=y
3505 echo " "
3506 echo "*** WHOA THERE!!! ***" >&4
3507 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3508 rp="    Keep the $hint value?"
3509 . ./myread
3510 case "$ans" in
3511 y) td=$was; tu=$was;;
3512 esac
3513 EOSC
3514
3515 : function used to set $1 to $val
3516 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3517 case "$val$was" in
3518 $define$undef) . ./whoa; eval "$var=\$td";;
3519 $undef$define) . ./whoa; eval "$var=\$tu";;
3520 *) eval "$var=$val";;
3521 esac'
3522
3523 case "$usesocks" in
3524 $define|true|[yY]*)     dflt='y';;
3525 *) dflt='n';;
3526 esac
3527 cat <<EOM
3528
3529 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3530 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3531 to use the PerlIO abstraction layer, this will be implicitly selected.
3532
3533 If this doesn't make any sense to you, just accept the default '$dflt'.
3534 EOM
3535 rp='Build Perl for SOCKS?'
3536 . ./myread
3537 case "$ans" in
3538 y|Y)    val="$define" ;;     
3539 *)      val="$undef" ;;
3540 esac
3541 set usesocks
3542 eval $setvar
3543
3544 case "$usesocks" in
3545 $define|true|[yY]*) useperlio="$define";;
3546 esac
3547
3548 case "$useperlio" in
3549 $define|true|[yY]*|'')  dflt='y';;
3550 *) dflt='n';;
3551 esac
3552 cat <<EOM
3553
3554 Previous version of $package used the standard IO mechanisms as
3555 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3556 alternate IO mechanisms via the PerlIO abstraction layer, but the
3557 stdio mechanism is still available if needed.  The abstraction layer
3558 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3559 Using PerlIO with sfio may cause problems with some extension modules.
3560
3561 If this doesn't make any sense to you, just accept the default '$dflt'.
3562 EOM
3563 rp='Use the PerlIO abstraction layer?'
3564 . ./myread
3565 case "$ans" in
3566 y|Y) 
3567         val="$define"
3568         ;;
3569 *)      
3570         echo "Ok, doing things the stdio way."
3571         val="$undef"
3572         ;;
3573 esac
3574 set useperlio
3575 eval $setvar 
3576
3577 case "$usesocks" in
3578 $define|true|[yY]*)
3579         case "$useperlio" in
3580         $define|true|[yY]*) ;;
3581         *)      cat >&4 <<EOM
3582
3583 You are using the SOCKS proxy protocol library which means that you
3584 should also use the PerlIO layer.  You may be headed for trouble.
3585
3586 EOM
3587                 ;;
3588         esac
3589         ;;
3590 esac
3591
3592         
3593 case "$usethreads" in
3594 $define|true|[yY]*)     dflt='y';;
3595 *)     # Catch case where user specified ithreads or 5005threads but
3596        # forgot -Dusethreads (A.D. 4/2002)
3597        case "$useithreads$use5005threads" in
3598        *$define*)      
3599                 case "$useperlio" in
3600                 "$define")      dflt='y' ;;
3601                 *)              dflt='n' ;;
3602                 esac
3603                 ;;
3604        *)       dflt='n';;
3605        esac
3606        ;;
3607 esac
3608 cat <<EOM
3609
3610 Perl can be built to take advantage of threads on some systems.
3611 To do so, Configure can be run with -Dusethreads.
3612
3613 Note that Perl built with threading support runs slightly slower
3614 and uses more memory than plain Perl. The current implementation
3615 is believed to be stable, but it is fairly new, and so should be
3616 treated with caution.
3617
3618 If this doesn't make any sense to you, just accept the default '$dflt'.
3619 EOM
3620 rp='Build a threading Perl?'
3621 . ./myread
3622 case "$ans" in
3623 y|Y)    val="$define" ;;
3624 *)      val="$undef" ;;
3625 esac
3626 set usethreads
3627 eval $setvar
3628
3629 case "$usethreads" in
3630 $define)
3631         $cat <<EOM
3632
3633 Since release 5.6, Perl has had two different threading implementations,
3634 the newer interpreter-based version (ithreads) with one interpreter per
3635 thread, and the older 5.005 version (5005threads).
3636 The 5005threads version is effectively unmaintained and will probably be
3637 removed in Perl 5.10, so there should be no need to build a Perl using it
3638 unless needed for backwards compatibility with some existing 5.005threads
3639 code.
3640
3641 EOM
3642         : Default to ithreads unless overridden on command line or with
3643         : old config.sh
3644         dflt='y'
3645         case "$use5005threads" in
3646                 $define|true|[yY]*) dflt='n';;
3647         esac
3648         case "$useithreads" in
3649                 $undef|false|[nN]*) dflt='n';;
3650         esac
3651         rp='Use the newer interpreter-based ithreads?'
3652         . ./myread
3653         case "$ans" in
3654         y|Y)    val="$define" ;;
3655         *)      val="$undef" ;;
3656         esac
3657         set useithreads
3658         eval $setvar
3659         : Now set use5005threads to the opposite value.
3660         case "$useithreads" in
3661         $define) val="$undef" ;;
3662         *) val="$define" ;;
3663         esac
3664         set use5005threads
3665         eval $setvar
3666         ;;
3667 *)
3668         useithreads="$undef"
3669         use5005threads="$undef"
3670         ;;
3671 esac
3672
3673 case "$useithreads$use5005threads" in
3674 "$define$define")
3675         $cat >&4 <<EOM
3676
3677 You cannot have both the ithreads and the 5.005 threads enabled
3678 at the same time.  Disabling the 5.005 threads since they are
3679 much less stable than the ithreads.
3680
3681 EOM
3682         use5005threads="$undef"
3683         ;;
3684 esac
3685
3686 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3687         cat >&4 <<EOF
3688 ***
3689 *** To build with ithreads you must also use the PerlIO layer.
3690 *** Cannot continue, aborting.
3691 ***
3692 EOF
3693         exit 1
3694 fi
3695
3696 case "$d_oldpthreads" in
3697 '')     : Configure tests would be welcome here.  For now, assume undef.
3698         val="$undef" ;;
3699 *)      val="$d_oldpthreads" ;;
3700 esac
3701 set d_oldpthreads
3702 eval $setvar
3703
3704
3705 : Look for a hint-file generated 'call-back-unit'.  If the
3706 : user has specified that a threading perl is to be built,
3707 : we may need to set or change some other defaults.
3708 if $test -f usethreads.cbu; then
3709     echo "Your platform has some specific hints regarding threaded builds, using them..."
3710     . ./usethreads.cbu
3711 else
3712     case "$usethreads" in
3713         "$define"|true|[yY]*)
3714                 $cat <<EOM
3715 (Your platform does not have any specific hints for threaded builds.
3716  Assuming POSIX threads, then.)
3717 EOM
3718         ;;
3719     esac
3720 fi
3721
3722 cat <<EOM
3723
3724 Perl can be built so that multiple Perl interpreters can coexist
3725 within the same Perl executable.
3726 EOM
3727
3728 case "$useithreads" in
3729 $define)
3730         cat <<EOM
3731 This multiple interpreter support is required for interpreter-based threads.
3732 EOM
3733         val="$define"
3734         ;;
3735 *)      case "$usemultiplicity" in
3736         $define|true|[yY]*)     dflt='y';;
3737         *) dflt='n';;
3738         esac
3739         echo " "
3740         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3741         rp='Build Perl for multiplicity?'
3742         . ./myread
3743         case "$ans" in
3744         y|Y)    val="$define" ;;
3745         *)      val="$undef" ;;
3746         esac
3747         ;;
3748 esac
3749 set usemultiplicity
3750 eval $setvar
3751
3752
3753 case "$usemorebits" in
3754 "$define"|true|[yY]*)
3755         use64bitint="$define"
3756         uselongdouble="$define"
3757         usemorebits="$define"
3758         ;;
3759 *)      usemorebits="$undef"
3760         ;;
3761 esac
3762
3763 : make some quick guesses about what we are up against
3764 echo " "
3765 $echo $n "Hmm...  $c"
3766 echo exit 1 >bsd
3767 echo exit 1 >usg
3768 echo exit 1 >v7
3769 echo exit 1 >osf1
3770 echo exit 1 >eunice
3771 echo exit 1 >xenix
3772 echo exit 1 >venix
3773 echo exit 1 >os2
3774 d_bsd="$undef"
3775 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3776 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3777 then
3778         echo "Looks kind of like an OSF/1 system, but we'll see..."
3779         echo exit 0 >osf1
3780 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3781         xxx=`./loc addbib blurfl $pth`
3782         if $test -f $xxx; then
3783         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3784                 echo exit 0 >bsd
3785                 echo exit 0 >usg
3786         else
3787                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3788                         echo "Looks kind of like an extended USG system, but we'll see..."
3789                 else
3790                         echo "Looks kind of like a USG system, but we'll see..."
3791                 fi
3792                 echo exit 0 >usg
3793         fi
3794 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3795         echo "Looks kind of like a BSD system, but we'll see..."
3796         d_bsd="$define"
3797         echo exit 0 >bsd
3798 else
3799         echo "Looks kind of like a Version 7 system, but we'll see..."
3800         echo exit 0 >v7
3801 fi
3802 case "$eunicefix" in
3803 *unixtovms*)
3804         $cat <<'EOI'
3805 There is, however, a strange, musty smell in the air that reminds me of
3806 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3807 EOI
3808         echo exit 0 >eunice
3809         d_eunice="$define"
3810 : it so happens the Eunice I know will not run shell scripts in Unix format
3811         ;;
3812 *)
3813         echo " "
3814         echo "Congratulations.  You aren't running Eunice."
3815         d_eunice="$undef"
3816         ;;
3817 esac
3818 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3819 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3820 : semicolon as a patch separator
3821 case "$p_" in
3822 :) ;;
3823 *)
3824         $cat <<'EOI'
3825 I have the feeling something is not exactly right, however...don't tell me...
3826 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3827 (Or you may be running DOS with DJGPP.)
3828 EOI
3829         echo exit 0 >os2
3830         ;;
3831 esac
3832 if test -f /xenix; then
3833         echo "Actually, this looks more like a XENIX system..."
3834         echo exit 0 >xenix
3835         d_xenix="$define"
3836 else
3837         echo " "
3838         echo "It's not Xenix..."
3839         d_xenix="$undef"
3840 fi
3841 chmod +x xenix
3842 $eunicefix xenix
3843 if test -f /venix; then
3844         echo "Actually, this looks more like a VENIX system..."
3845         echo exit 0 >venix
3846 else
3847         echo " "
3848         if ./xenix; then
3849                 : null
3850         else
3851                 echo "Nor is it Venix..."
3852         fi
3853 fi
3854 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3855 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3856 $rm -f foo
3857
3858 case "$cc" in
3859 '') dflt=cc;;
3860 *) dflt="$cc";;
3861 esac
3862 rp="Use which C compiler?"
3863 . ./myread
3864 cc="$ans"
3865
3866 : See if they have not cc but they do have gcc
3867 . ./trygcc
3868 : Look for a hint-file generated 'call-back-unit'.  Now that the
3869 : user has specified the compiler, we may need to set or change some
3870 : other defaults.
3871 if $test -f cc.cbu; then
3872     . ./cc.cbu
3873 fi
3874 . ./checkcc
3875
3876 echo " "
3877 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3878 $cat >try.c <<EOM
3879 #include <stdio.h>
3880 int main() {
3881 #ifdef __GNUC__
3882 #ifdef __VERSION__
3883         printf("%s\n", __VERSION__);
3884 #else
3885         printf("%s\n", "1");
3886 #endif
3887 #endif
3888         return(0);
3889 }
3890 EOM
3891 if $cc -o try $ccflags $ldflags try.c; then
3892         gccversion=`$run ./try`
3893         case "$gccversion" in
3894         '') echo "You are not using GNU cc." ;;
3895         *)  echo "You are using GNU cc $gccversion."
3896             ccname=gcc
3897             ;;
3898         esac
3899 else
3900         echo " "
3901         echo "*** WHOA THERE!!! ***" >&4
3902         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3903         case "$knowitall" in
3904         '')
3905         echo "    You'd better start hunting for one and let me know about it." >&4
3906                 exit 1
3907                 ;;
3908         esac
3909 fi
3910 $rm -f try try.*
3911 case "$gccversion" in
3912 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3913 esac
3914 case "$gccversion" in
3915 '') gccosandvers='' ;;
3916 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3917    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3918    gccshortvers=''
3919    case "$gccosandvers" in
3920    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3921    $osname$osvers) ;; # looking good
3922    $osname*) cat <<EOM >&4
3923
3924 *** WHOA THERE!!! ***
3925
3926     Your gcc has not been compiled for the exact release of
3927     your operating system ($gccosandvers versus $osname$osvers).
3928
3929     In general it is a good idea to keep gcc synchronized with
3930     the operating system because otherwise serious problems
3931     may ensue when trying to compile software, like Perl.
3932
3933     I'm trying to be optimistic here, though, and will continue.
3934     If later during the configuration and build icky compilation
3935     problems appear (headerfile conflicts being the most common
3936     manifestation), I suggest reinstalling the gcc to match
3937     your operating system release.
3938
3939 EOM
3940       ;;
3941    *) gccosandvers='' ;; # failed to parse, better be silent
3942    esac
3943    ;;
3944 esac
3945 case "$ccname" in
3946 '') ccname="$cc" ;;
3947 esac
3948
3949 # gcc 3.* complain about adding -Idirectories that they already know about,
3950 # so we will take those off from locincpth.
3951 case "$gccversion" in
3952 3*)
3953     echo "main(){}">try.c
3954     for incdir in $locincpth; do
3955        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3956              grep '^c[cp]p*[01]: warning: changing search order '`
3957        if test "X$warn" != X; then
3958            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3959        fi
3960     done
3961     $rm -f try try.*
3962 esac
3963
3964 : decide how portable to be.  Allow command line overrides.
3965 case "$d_portable" in
3966 "$undef") ;;
3967 *)      d_portable="$define" ;;
3968 esac
3969
3970 : set up shell script to do ~ expansion
3971 cat >filexp <<EOSS
3972 $startsh
3973 : expand filename
3974 case "\$1" in
3975  ~/*|~)
3976         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3977         ;;
3978  ~*)
3979         if $test -f /bin/csh; then
3980                 /bin/csh -f -c "glob \$1"
3981                 failed=\$?
3982                 echo ""
3983                 exit \$failed
3984         else
3985                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3986                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3987                 if $test ! -d "\$dir"; then
3988                         me=\`basename \$0\`
3989                         echo "\$me: can't locate home directory for: \$name" >&2
3990                         exit 1
3991                 fi
3992                 case "\$1" in
3993                 */*)
3994                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3995                         ;;
3996                 *)
3997                         echo \$dir
3998                         ;;
3999                 esac
4000         fi
4001         ;;
4002 *)
4003         echo \$1
4004         ;;
4005 esac
4006 EOSS
4007 chmod +x filexp
4008 $eunicefix filexp
4009
4010 : now set up to get a file name
4011 cat <<EOS >getfile
4012 $startsh
4013 EOS
4014 cat <<'EOSC' >>getfile
4015 tilde=''
4016 fullpath=''
4017 already=''
4018 skip=''
4019 none_ok=''
4020 exp_file=''
4021 nopath_ok=''
4022 orig_rp="$rp"
4023 orig_dflt="$dflt"
4024 case "$gfpth" in
4025 '') gfpth='.' ;;
4026 esac
4027
4028 case "$fn" in
4029 *\(*)
4030         : getfile will accept an answer from the comma-separated list
4031         : enclosed in parentheses even if it does not meet other criteria.
4032         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4033         fn=`echo $fn | sed 's/(.*)//'`
4034         ;;
4035 esac
4036
4037 case "$fn" in
4038 *:*)
4039         loc_file=`expr $fn : '.*:\(.*\)'`
4040         fn=`expr $fn : '\(.*\):.*'`
4041         ;;
4042 esac
4043
4044 case "$fn" in
4045 *~*) tilde=true;;
4046 esac
4047 case "$fn" in
4048 */*) fullpath=true;;
4049 esac
4050 case "$fn" in
4051 *+*) skip=true;;
4052 esac
4053 case "$fn" in
4054 *n*) none_ok=true;;
4055 esac
4056 case "$fn" in
4057 *e*) exp_file=true;;
4058 esac
4059 case "$fn" in
4060 *p*) nopath_ok=true;;
4061 esac
4062
4063 case "$fn" in
4064 *f*) type='File';;
4065 *d*) type='Directory';;
4066 *l*) type='Locate';;
4067 esac
4068
4069 what="$type"
4070 case "$what" in
4071 Locate) what='File';;
4072 esac
4073
4074 case "$exp_file" in
4075 '')
4076         case "$d_portable" in
4077         "$define") ;;
4078         *) exp_file=true;;
4079         esac
4080         ;;
4081 esac
4082
4083 cd ..
4084 while test "$type"; do
4085         redo=''
4086         rp="$orig_rp"
4087         dflt="$orig_dflt"
4088         case "$tilde" in
4089         true) rp="$rp (~name ok)";;
4090         esac
4091         . UU/myread
4092         if test -f UU/getfile.ok && \
4093                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4094         then
4095                 value="$ans"
4096                 ansexp="$ans"
4097                 break
4098         fi
4099         case "$ans" in
4100         none)
4101                 value=''
4102                 ansexp=''
4103                 case "$none_ok" in
4104                 true) type='';;
4105                 esac
4106                 ;;
4107         *)
4108                 case "$tilde" in
4109                 '') value="$ans"
4110                         ansexp="$ans";;
4111                 *)
4112                         value=`UU/filexp $ans`
4113                         case $? in
4114                         0)
4115                                 if test "$ans" != "$value"; then
4116                                         echo "(That expands to $value on this system.)"
4117                                 fi
4118                                 ;;
4119                         *) value="$ans";;
4120                         esac
4121                         ansexp="$value"
4122                         case "$exp_file" in
4123                         '') value="$ans";;
4124                         esac
4125                         ;;
4126                 esac
4127                 case "$fullpath" in
4128                 true)
4129                         case "$ansexp" in
4130                         /*) value="$ansexp" ;;
4131                         [a-zA-Z]:/*) value="$ansexp" ;;
4132                         *)
4133                                 redo=true
4134                                 case "$already" in
4135                                 true)
4136                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4137                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4138                                         ;;
4139                                 *)
4140                                 echo "Please give a full path name, starting with slash." >&4
4141                                         case "$tilde" in
4142                                         true)
4143                                 echo "Note that using ~name is ok provided it expands well." >&4
4144                                                 already=true
4145                                                 ;;
4146                                         esac
4147                                 esac
4148                                 ;;
4149                         esac
4150                         ;;
4151                 esac
4152                 case "$redo" in
4153                 '')
4154                         case "$type" in
4155                         File)
4156                                 for fp in $gfpth; do
4157                                         if test "X$fp" = X.; then
4158                                             pf="$ansexp"
4159                                         else    
4160                                             pf="$fp/$ansexp"
4161                                         fi
4162                                         if test -f "$pf"; then
4163                                                 type=''
4164                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4165                                         then
4166                                                 echo "($value is not a plain file, but that's ok.)"
4167                                                 type=''
4168                                         fi
4169                                         if test X"$type" = X; then
4170                                             value="$pf"
4171                                             break
4172                                         fi
4173                                 done
4174                                 ;;
4175                         Directory)
4176                                 for fp in $gfpth; do
4177                                         if test "X$fp" = X.; then
4178                                             dir="$ans"
4179                                             direxp="$ansexp"
4180                                         else    
4181                                             dir="$fp/$ansexp"
4182                                             direxp="$fp/$ansexp"
4183                                         fi
4184                                         if test -d "$direxp"; then
4185                                                 type=''
4186                                                 value="$dir"
4187                                                 break
4188                                         fi
4189                                 done
4190                                 ;;
4191                         Locate)
4192                                 if test -d "$ansexp"; then
4193                                         echo "(Looking for $loc_file in directory $value.)"
4194                                         value="$value/$loc_file"
4195                                         ansexp="$ansexp/$loc_file"
4196                                 fi
4197                                 if test -f "$ansexp"; then
4198                                         type=''
4199                                 fi
4200                                 case "$nopath_ok" in
4201                                 true)   case "$value" in
4202                                         */*) ;;
4203                                         *)      echo "Assuming $value will be in people's path."
4204                                                 type=''
4205                                                 ;;
4206                                         esac
4207                                         ;;
4208                                 esac
4209                                 ;;
4210                         esac
4211
4212                         case "$skip" in
4213                         true) type='';
4214                         esac
4215
4216                         case "$type" in
4217                         '') ;;
4218                         *)
4219                                 if test "$fastread" = yes; then
4220                                         dflt=y
4221                                 else
4222                                         dflt=n
4223                                 fi
4224                                 rp="$what $value doesn't exist.  Use that name anyway?"
4225                                 . UU/myread
4226                                 dflt=''
4227                                 case "$ans" in
4228                                 y*) type='';;
4229                                 *) echo " ";;
4230                                 esac
4231                                 ;;
4232                         esac
4233                         ;;
4234                 esac
4235                 ;;
4236         esac
4237 done
4238 cd UU
4239 ans="$value"
4240 rp="$orig_rp"
4241 dflt="$orig_dflt"
4242 rm -f getfile.ok
4243 test "X$gfpthkeep" != Xy && gfpth=""
4244 EOSC
4245
4246 : What should the include directory be ?
4247 echo " "
4248 $echo $n "Hmm...  $c"
4249 dflt='/usr/include'
4250 incpath=''
4251 mips_type=''
4252 if $test -f /bin/mips && /bin/mips; then
4253         echo "Looks like a MIPS system..."
4254         $cat >usr.c <<'EOCP'
4255 #ifdef SYSTYPE_BSD43
4256 /bsd43
4257 #endif
4258 EOCP
4259         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4260                 dflt='/bsd43/usr/include'
4261                 incpath='/bsd43'
4262                 mips_type='BSD 4.3'
4263         else
4264                 mips_type='System V'
4265         fi
4266         $rm -f usr.c usr.out
4267         echo "and you're compiling with the $mips_type compiler and libraries."
4268         xxx_prompt=y
4269         echo "exit 0" >mips
4270 else
4271         echo "Doesn't look like a MIPS system."
4272         xxx_prompt=n
4273         echo "exit 1" >mips
4274 fi
4275 chmod +x mips
4276 $eunicefix mips
4277 case "$usrinc" in
4278 '') ;;
4279 *) dflt="$usrinc";;
4280 esac
4281 case "$xxx_prompt" in
4282 y)      fn=d/
4283         echo " "
4284         rp='Where are the include files you want to use?'
4285         . ./getfile
4286         usrinc="$ans"
4287         ;;
4288 *)      usrinc="$dflt"
4289         ;;
4290 esac
4291
4292 : see how we invoke the C preprocessor
4293 echo " "
4294 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4295 cat <<'EOT' >testcpp.c
4296 #define ABC abc
4297 #define XYZ xyz
4298 ABC.XYZ
4299 EOT
4300 cd ..
4301 if test ! -f cppstdin; then
4302         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4303                 # AIX cc -E doesn't show the absolute headerfile
4304                 # locations but we'll cheat by using the -M flag.
4305                 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
4306         else
4307                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4308         fi
4309 else
4310         echo "Keeping your $hint cppstdin wrapper."
4311 fi
4312 chmod 755 cppstdin
4313 wrapper=`pwd`/cppstdin
4314 ok='false'
4315 cd UU
4316
4317 if $test "X$cppstdin" != "X" && \
4318         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4319         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4320 then
4321         echo "You used to use $cppstdin $cppminus so we'll use that again."
4322         case "$cpprun" in
4323         '') echo "But let's see if we can live without a wrapper..." ;;
4324         *)
4325                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4326                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4327                 then
4328                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4329                         ok='true'
4330                 else
4331                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4332                 fi
4333                 ;;
4334         esac
4335 else
4336         case "$cppstdin" in
4337         '') ;;
4338         *)
4339                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4340                 ;;
4341         esac
4342 fi
4343
4344 if $ok; then
4345         : nothing
4346 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4347         $cc -E <testcpp.c >testcpp.out 2>&1; \
4348         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4349         echo "Yup, it does."
4350         x_cpp="$cc -E"
4351         x_minus='';
4352 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4353         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4354         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4355         echo "Yup, it does."
4356         x_cpp="$cc -E"
4357         x_minus='-';
4358 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4359         $cc -P <testcpp.c >testcpp.out 2>&1; \
4360         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4361         echo "Yipee, that works!"
4362         x_cpp="$cc -P"
4363         x_minus='';
4364 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4365         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4366         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4367         echo "At long last!"
4368         x_cpp="$cc -P"
4369         x_minus='-';
4370 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4371         $cpp <testcpp.c >testcpp.out 2>&1; \
4372         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4373         echo "It works!"
4374         x_cpp="$cpp"
4375         x_minus='';
4376 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4377         $cpp - <testcpp.c >testcpp.out 2>&1; \
4378         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4379         echo "Hooray, it works!  I was beginning to wonder."
4380         x_cpp="$cpp"
4381         x_minus='-';
4382 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4383         $wrapper <testcpp.c >testcpp.out 2>&1; \
4384         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4385         x_cpp="$wrapper"
4386         x_minus=''
4387         echo "Eureka!"
4388 else
4389         dflt=''
4390         rp="No dice.  I can't find a C preprocessor.  Name one:"
4391         . ./myread
4392         x_cpp="$ans"
4393         x_minus=''
4394         $x_cpp <testcpp.c >testcpp.out 2>&1
4395         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4396                 echo "OK, that will do." >&4
4397         else
4398 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4399                 exit 1
4400         fi
4401 fi
4402
4403 case "$ok" in
4404 false)
4405         cppstdin="$x_cpp"
4406         cppminus="$x_minus"
4407         cpprun="$x_cpp"
4408         cpplast="$x_minus"
4409         set X $x_cpp
4410         shift
4411         case "$1" in
4412         "$cpp")
4413                 echo "Perhaps can we force $cc -E using a wrapper..."
4414                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4415                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4416                 then
4417                         echo "Yup, we can."
4418                         cppstdin="$wrapper"
4419                         cppminus='';
4420                 else
4421                         echo "Nope, we'll have to live without it..."
4422                 fi
4423                 ;;
4424         esac
4425         case "$cpprun" in
4426         "$wrapper")
4427                 cpprun=''
4428                 cpplast=''
4429                 ;;
4430         esac
4431         ;;
4432 esac
4433
4434 case "$cppstdin" in
4435 "$wrapper"|'cppstdin') ;;
4436 *) $rm -f $wrapper;;
4437 esac
4438 $rm -f testcpp.c testcpp.out
4439
4440 : Set private lib path
4441 case "$plibpth" in
4442 '') if ./mips; then
4443                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4444         fi;;
4445 esac
4446 case "$libpth" in
4447 ' ') dlist='';;
4448 '') dlist="$loclibpth $plibpth $glibpth";;
4449 *) dlist="$libpth";;
4450 esac
4451
4452 : Now check and see which directories actually exist, avoiding duplicates
4453 libpth=''
4454 for xxx in $dlist
4455 do
4456     if $test -d $xxx; then
4457                 case " $libpth " in
4458                 *" $xxx "*) ;;
4459                 *) libpth="$libpth $xxx";;
4460                 esac
4461     fi
4462 done
4463 $cat <<'EOM'
4464
4465 Some systems have incompatible or broken versions of libraries.  Among
4466 the directories listed in the question below, please remove any you
4467 know not to be holding relevant libraries, and add any that are needed.
4468 Say "none" for none.
4469
4470 EOM
4471 case "$libpth" in
4472 '') dflt='none';;
4473 *)
4474         set X $libpth
4475         shift
4476         dflt=${1+"$@"}
4477         ;;
4478 esac
4479 rp="Directories to use for library searches?"
4480 . ./myread
4481 case "$ans" in
4482 none) libpth=' ';;
4483 *) libpth="$ans";;
4484 esac
4485
4486 : compute shared library extension
4487 case "$so" in
4488 '')
4489         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4490                 dflt='sl'
4491         else
4492                 dflt='so'
4493         fi
4494         ;;
4495 *) dflt="$so";;
4496 esac
4497 $cat <<EOM
4498
4499 On some systems, shared libraries may be available.  Answer 'none' if
4500 you want to suppress searching of shared libraries for the remainder
4501 of this configuration.
4502
4503 EOM
4504 rp='What is the file extension used for shared libraries?'
4505 . ./myread
4506 so="$ans"
4507
4508 : Define several unixisms.
4509 : Hints files or command line option can be used to override them.
4510 : The convoluted testing is in case hints files set either the old
4511 : or the new name.
4512 case "$_exe" in
4513 '')     case "$exe_ext" in
4514         '')     ;;
4515         *)      _exe="$exe_ext" ;;
4516         esac
4517         ;;
4518 esac
4519 case "$_a" in
4520 '')     case "$lib_ext" in
4521     '') _a='.a';;
4522         *)      _a="$lib_ext" ;;
4523         esac
4524         ;;
4525 esac
4526 case "$_o" in
4527 '') case "$obj_ext" in
4528         '')     _o='.o';;
4529         *)      _o="$obj_ext";;
4530         esac
4531         ;;
4532 esac
4533 case "$p_" in
4534 '') case "$path_sep" in
4535         '')     p_=':';;
4536         *)      p_="$path_sep";;
4537         esac
4538         ;;
4539 esac
4540 exe_ext=$_exe
4541 lib_ext=$_a
4542 obj_ext=$_o
4543 path_sep=$p_
4544
4545 : Which makefile gets called first.  This is used by make depend.
4546 case "$firstmakefile" in
4547 '') firstmakefile='makefile';;
4548 esac
4549
4550 case "$ccflags" in
4551 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4552 esac
4553
4554 case "$uselongdouble" in
4555 $define|true|[yY]*)     dflt='y';;
4556 *) dflt='n';;
4557 esac
4558 cat <<EOM
4559
4560 Perl can be built to take advantage of long doubles which
4561 (if available) may give more accuracy and range for floating point numbers.
4562
4563 If this doesn't make any sense to you, just accept the default '$dflt'.
4564 EOM
4565 rp='Try to use long doubles if available?'
4566 . ./myread
4567 case "$ans" in
4568 y|Y)    val="$define"   ;;
4569 *)      val="$undef"    ;;
4570 esac
4571 set uselongdouble
4572 eval $setvar
4573
4574 case "$uselongdouble" in
4575 true|[yY]*) uselongdouble="$define" ;;
4576 esac
4577
4578 : Look for a hint-file generated 'call-back-unit'.  If the
4579 : user has specified that long doubles should be used,
4580 : we may need to set or change some other defaults.
4581 if $test -f uselongdouble.cbu; then
4582     echo "Your platform has some specific hints regarding long doubles, using them..."
4583     . ./uselongdouble.cbu
4584 else
4585     case "$uselongdouble" in
4586         $define)
4587                 $cat <<EOM
4588 (Your platform does not have any specific hints for long doubles.)
4589 EOM
4590         ;;
4591     esac
4592 fi
4593
4594 : Looking for optional libraries
4595 echo " "
4596 echo "Checking for optional libraries..." >&4
4597 case "$libs" in
4598 ' '|'') dflt='';;
4599 *) dflt="$libs";;
4600 esac
4601 case "$libswanted" in
4602 '') libswanted='c_s';;
4603 esac
4604 case "$usesocks" in
4605 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4606 esac
4607 libsfound=''
4608 libsfiles=''
4609 libsdirs=''
4610 libspath=''
4611 for thisdir in $libpth $xlibpth; do
4612   test -d $thisdir && libspath="$libspath $thisdir"
4613 done
4614 for thislib in $libswanted; do
4615         for thisdir in $libspath; do
4616             xxx=''
4617             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4618                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4619                 $test -f "$xxx" && eval $libscheck
4620                 $test -f "$xxx" && libstyle=shared
4621             fi
4622             if test ! -f "$xxx"; then
4623                 xxx=$thisdir/lib$thislib.$so
4624                 $test -f "$xxx" && eval $libscheck
4625                 $test -f "$xxx" && libstyle=shared
4626             fi  
4627             if test ! -f "$xxx"; then
4628                 xxx=$thisdir/lib$thislib$_a
4629                 $test -f "$xxx" && eval $libscheck
4630                 $test -f "$xxx" && libstyle=static
4631             fi
4632             if test ! -f "$xxx"; then
4633                 xxx=$thisdir/$thislib$_a
4634                 $test -f "$xxx" && eval $libscheck
4635                 $test -f "$xxx" && libstyle=static
4636             fi
4637             if test ! -f "$xxx"; then
4638                 xxx=$thisdir/lib${thislib}_s$_a
4639                 $test -f "$xxx" && eval $libscheck
4640                 $test -f "$xxx" && libstyle=static
4641                 $test -f "$xxx" && thislib=${thislib}_s
4642             fi
4643             if test ! -f "$xxx"; then
4644                 xxx=$thisdir/Slib$thislib$_a
4645                 $test -f "$xxx" && eval $libscheck
4646                 $test -f "$xxx" && libstyle=static
4647             fi
4648             if $test -f "$xxx"; then
4649                 case "$libstyle" in
4650                 shared) echo "Found -l$thislib (shared)." ;;
4651                 static) echo "Found -l$thislib." ;;
4652                 *)      echo "Found -l$thislib ($libstyle)." ;;
4653                 esac
4654                 case " $dflt " in
4655                 *"-l$thislib "*);;
4656                 *) dflt="$dflt -l$thislib"
4657                    libsfound="$libsfound $xxx"
4658                    yyy=`basename $xxx`
4659                    libsfiles="$libsfiles $yyy"
4660                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4661                    case " $libsdirs " in
4662                    *" $yyy "*) ;;
4663                    *) libsdirs="$libsdirs $yyy" ;;
4664                    esac
4665                    ;;
4666                 esac
4667                 break
4668             fi  
4669         done
4670         if $test ! -f "$xxx"; then
4671             echo "No -l$thislib."
4672         fi
4673 done
4674 set X $dflt
4675 shift
4676 dflt="$*"
4677 case "$libs" in
4678 '') dflt="$dflt";;
4679 *) dflt="$libs";;
4680 esac
4681 case "$dflt" in
4682 ' '|'') dflt='none';;
4683 esac
4684
4685 $cat <<EOM
4686
4687 In order to compile $package on your machine, a number of libraries
4688 are usually needed.  Include any other special libraries here as well.
4689 Say "none" for none.  The default list is almost always right.
4690 EOM
4691
4692 echo " "
4693 rp="What libraries to use?"
4694 . ./myread
4695 case "$ans" in
4696 none) libs=' ';;
4697 *) libs="$ans";;
4698 esac
4699
4700 : determine optimization, if desired, or use for debug flag also
4701 case "$optimize" in
4702 ' '|$undef) dflt='none';;
4703 '') dflt='-O';;
4704 *) dflt="$optimize";;
4705 esac
4706 $cat <<EOH
4707
4708 By default, $package compiles with the -O flag to use the optimizer.
4709 Alternately, you might want to use the symbolic debugger, which uses
4710 the -g flag (on traditional Unix systems).  Either flag can be
4711 specified here.  To use neither flag, specify the word "none".
4712
4713 EOH
4714 rp="What optimizer/debugger flag should be used?"
4715 . ./myread
4716 optimize="$ans"
4717 case "$optimize" in
4718 'none') optimize=" ";;
4719 esac
4720
4721 dflt=''
4722 : We will not override a previous value, but we might want to
4723 : augment a hint file
4724 case "$hint" in
4725 default|recommended)
4726         case "$gccversion" in
4727         1*) dflt='-fpcc-struct-return' ;;
4728         esac
4729         case "$optimize" in
4730         *-g*) dflt="$dflt -DDEBUGGING";;
4731         esac
4732         case "$gccversion" in
4733         2*) if test -d /etc/conf/kconfig.d &&
4734                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4735                 then
4736                         # Interactive Systems (ISC) POSIX mode.
4737                         dflt="$dflt -posix"
4738                 fi
4739                 ;;
4740         esac
4741         case "$gccversion" in
4742         1*) ;;
4743         2.[0-8]*) ;;
4744         ?*)     echo " "
4745                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4746                 echo 'int main(void) { return 0; }' > gcctest.c
4747                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4748                         echo "Yes, it does." 2>&1
4749                         case "$ccflags" in
4750                         *strict-aliasing*)
4751                                 echo "Leaving current flags $ccflags alone." 2>&1
4752                                 ;;
4753                         *) dflt="$dflt -fno-strict-aliasing" ;;
4754                         esac
4755                 else
4756                         echo "Nope, it doesn't, but that's ok." 2>&1
4757                 fi
4758                 ;;
4759         esac
4760         # For gcc, adding -pipe speeds up compilations for some, but apparently
4761         # some assemblers can't read from stdin.  (It also slows down compilations
4762         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4763         case "$gccversion" in
4764         ?*)     echo " "
4765                 echo "Checking if your compiler accepts -pipe" 2>&1
4766                 echo 'int main(void) { return 0; }' > gcctest.c
4767                 if $cc -pipe -o gcctest gcctest.c; then
4768                         echo "Yes, it does." 2>&1
4769                         case "$ccflags" in
4770                         *-pipe*)
4771                                 echo "Leaving current flags $ccflags alone." 2>&1
4772                                 ;;
4773                         *) dflt="$dflt -pipe" ;;
4774                         esac
4775                 else
4776                         echo "Nope, it doesn't, but that's ok." 2>&1
4777                 fi
4778
4779                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4780                 echo 'int main(void) { return 0; }' > gcctest.c
4781                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4782                         echo "Yes, it does." 2>&1
4783                         case "$ccflags" in
4784                         *-Wdeclaration-after-statement*)
4785                                 echo "Leaving current flags $ccflags alone." 2>&1
4786                                 ;;
4787                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4788                         esac
4789                 else
4790                         echo "Nope, it doesn't, but that's ok." 2>&1
4791                 fi
4792                 ;;
4793         esac
4794         ;;
4795 esac
4796
4797 case "$mips_type" in
4798 *BSD*|'') inclwanted="$locincpth $usrinc";;
4799 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4800 esac
4801 for thisincl in $inclwanted; do
4802         if $test -d $thisincl; then
4803                 if $test x$thisincl != x$usrinc; then
4804                         case "$dflt" in
4805                         *" -I$thisincl "*);;
4806                         *) dflt="$dflt -I$thisincl ";;
4807                         esac
4808                 fi
4809         fi
4810 done
4811
4812 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4813         xxx=true;
4814 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4815         xxx=true;
4816 else
4817         xxx=false;
4818 fi;
4819 if $xxx; then
4820         case "$dflt" in
4821         *$2*);;
4822         *) dflt="$dflt -D$2";;
4823         esac;
4824 fi'
4825
4826 set signal.h LANGUAGE_C; eval $inctest
4827
4828 case "$usesocks" in
4829 $define)
4830         ccflags="$ccflags -DSOCKS"
4831         ;;
4832 esac
4833
4834 case "$hint" in
4835 default|recommended) dflt="$ccflags $dflt" ;;
4836 *) dflt="$ccflags";;
4837 esac
4838
4839 case "$dflt" in
4840 ''|' ') dflt=none;;
4841 esac
4842
4843 $cat <<EOH
4844
4845 Your C compiler may want other flags.  For this question you should include
4846 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4847 but you should NOT include libraries or ld flags like -lwhatever.  If you
4848 want $package to honor its debug switch, you should include -DDEBUGGING here.
4849 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4850
4851 To use no flags, specify the word "none".
4852
4853 EOH
4854 set X $dflt
4855 shift
4856 dflt=${1+"$@"}
4857 rp="Any additional cc flags?"
4858 . ./myread
4859 case "$ans" in
4860 none) ccflags='';;
4861 *) ccflags="$ans";;
4862 esac
4863
4864 : the following weeds options from ccflags that are of no interest to cpp
4865 case "$cppflags" in
4866 '') cppflags="$ccflags" ;;
4867 *)  cppflags="$cppflags $ccflags" ;;
4868 esac
4869 case "$gccversion" in
4870 1*) cppflags="$cppflags -D__GNUC__"
4871 esac
4872 case "$mips_type" in
4873 '');;
4874 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4875 esac
4876 case "$cppflags" in
4877 '');;
4878 *)
4879         echo " "
4880         echo "Let me guess what the preprocessor flags are..." >&4
4881         set X $cppflags
4882         shift
4883         cppflags=''
4884         $cat >cpp.c <<'EOM'
4885 #define BLURFL foo
4886
4887 BLURFL xx LFRULB
4888 EOM
4889         previous=''
4890         for flag in $*
4891         do
4892                 case "$flag" in
4893                 -*) ftry="$flag";;
4894                 *) ftry="$previous $flag";;
4895                 esac
4896                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4897                         >cpp1.out 2>/dev/null && \
4898                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4899                         >cpp2.out 2>/dev/null && \
4900                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4901                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4902                 then
4903                         cppflags="$cppflags $ftry"
4904                         previous=''
4905                 else
4906                         previous="$flag"
4907                 fi
4908         done
4909         set X $cppflags
4910         shift
4911         cppflags=${1+"$@"}
4912         case "$cppflags" in
4913         *-*)  echo "They appear to be: $cppflags";;
4914         esac
4915         $rm -f cpp.c cpp?.out
4916         ;;
4917 esac
4918
4919 : flags used in final linking phase
4920 case "$ldflags" in
4921 '') if ./venix; then
4922                 dflt='-i -z'
4923         else
4924                 dflt=''
4925         fi
4926         case "$ccflags" in
4927         *-posix*) dflt="$dflt -posix" ;;
4928         esac
4929         ;;
4930 *) dflt="$ldflags";;
4931 esac
4932
4933 : Try to guess additional flags to pick up local libraries.
4934 for thislibdir in $libpth; do
4935         case " $loclibpth " in
4936         *" $thislibdir "*)
4937                 case "$dflt " in
4938                 *"-L$thislibdir "*) ;;
4939                 *)  dflt="$dflt -L$thislibdir" ;;
4940                 esac
4941                 ;;
4942         esac
4943 done
4944
4945 case "$dflt" in
4946 '') dflt='none' ;;
4947 esac
4948
4949 $cat <<EOH
4950
4951 Your C linker may need flags.  For this question you should
4952 include -L/whatever and any other flags used by the C linker, but you
4953 should NOT include libraries like -lwhatever.
4954
4955 Make sure you include the appropriate -L/path flags if your C linker
4956 does not normally search all of the directories you specified above,
4957 namely
4958         $libpth
4959 To use no flags, specify the word "none".
4960
4961 EOH
4962
4963 rp="Any additional ld flags (NOT including libraries)?"
4964 . ./myread
4965 case "$ans" in
4966 none) ldflags='';;
4967 *) ldflags="$ans";;
4968 esac
4969 rmlist="$rmlist pdp11"
4970
4971 : coherency check
4972 echo " "
4973 echo "Checking your choice of C compiler and flags for coherency..." >&4
4974 $cat > try.c <<'EOF'
4975 #include <stdio.h>
4976 int main() { printf("Ok\n"); return(0); }
4977 EOF
4978 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4979 shift
4980 $cat >try.msg <<'EOM'
4981 I've tried to compile and run the following simple program:
4982
4983 EOM
4984 $cat try.c >> try.msg
4985
4986 $cat >> try.msg <<EOM
4987
4988 I used the command:
4989
4990         $*
4991         $run ./try
4992
4993 and I got the following output:
4994
4995 EOM
4996 dflt=y
4997 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4998         if $sh -c "$run ./try" >>try.msg 2>&1; then
4999                 xxx=`$run ./try`
5000                 case "$xxx" in
5001                 "Ok") dflt=n ;;
5002                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5003                         case " $libs " in
5004                         *" -lsfio "*)
5005                                 cat >> try.msg <<'EOQS'
5006 If $libs contains -lsfio, and sfio is mis-configured, then it
5007 sometimes (apparently) runs and exits with a 0 status, but with no
5008 output!  It may have to do with sfio's use of _exit vs. exit.
5009
5010 EOQS
5011                                 rp="You have a big problem.  Shall I abort Configure"
5012                                 dflt=y
5013                                 ;;
5014                         esac
5015                         ;;
5016                 esac
5017         else
5018                 echo "The program compiled OK, but exited with status $?." >>try.msg
5019                 rp="You have a problem.  Shall I abort Configure"
5020                 dflt=y
5021         fi
5022 else
5023         echo "I can't compile the test program." >>try.msg
5024         rp="You have a BIG problem.  Shall I abort Configure"
5025         dflt=y
5026 fi
5027 case "$dflt" in
5028 y)
5029         $cat try.msg >&4
5030         case "$knowitall" in
5031         '')
5032                 echo "(The supplied flags or libraries might be incorrect.)"
5033                 ;;
5034         *) dflt=n;;
5035         esac
5036         echo " "
5037         . ./myread
5038         case "$ans" in
5039         n*|N*) ;;
5040         *)      echo "Ok.  Stopping Configure." >&4
5041                 exit 1
5042                 ;;
5043         esac
5044         ;;
5045 n) echo "OK, that should do.";;
5046 esac
5047 $rm -f try try.* core
5048
5049 : define a shorthand compile call
5050 compile='
5051 mc_file=$1;
5052 shift;
5053 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5054 : define a shorthand compile call for compilations that should be ok.
5055 compile_ok='
5056 mc_file=$1;
5057 shift;
5058 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5059
5060 : determine filename position in cpp output
5061 echo " "
5062 echo "Computing filename position in cpp output for #include directives..." >&4
5063 case "$osname" in
5064 vos) testaccess=-e ;;
5065 *)   testaccess=-r ;;
5066 esac
5067 echo '#include <stdio.h>' > foo.c
5068 $cat >fieldn <<EOF
5069 $startsh
5070 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5071 $grep '^[       ]*#.*stdio\.h' | \
5072 while read cline; do
5073         pos=1
5074         set \$cline
5075         while $test \$# -gt 0; do
5076                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5077                         echo "\$pos"
5078                         exit 0
5079                 fi
5080                 shift
5081                 pos=\`expr \$pos + 1\`
5082         done
5083 done
5084 EOF
5085 chmod +x fieldn
5086 fieldn=`./fieldn`
5087 $rm -f foo.c fieldn
5088 case $fieldn in
5089 '') pos='???';;
5090 1) pos=first;;
5091 2) pos=second;;
5092 3) pos=third;;
5093 *) pos="${fieldn}th";;
5094 esac
5095 echo "Your cpp writes the filename in the $pos field of the line."
5096
5097 case "$osname" in
5098 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5099 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5100 *)   cppfilter='' ;;
5101 esac
5102 : locate header file
5103 $cat >findhdr <<EOF
5104 $startsh
5105 wanted=\$1
5106 name=''
5107 for usrincdir in $usrinc
5108 do
5109         if test -f \$usrincdir/\$wanted; then
5110                 echo "\$usrincdir/\$wanted"
5111                 exit 0
5112         fi
5113 done
5114 awkprg='{ print \$$fieldn }'
5115 echo "#include <\$wanted>" > foo\$\$.c
5116 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5117 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5118 while read cline; do
5119         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5120         case "\$name" in
5121         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5122         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5123         *) exit 2;;
5124         esac;
5125 done;
5126 #
5127 # status = 0: grep returned 0 lines, case statement not executed
5128 # status = 1: headerfile found
5129 # status = 2: while loop executed, no headerfile found
5130 #
5131 status=\$?
5132 $rm -f foo\$\$.c;
5133 if test \$status -eq 1; then
5134         exit 0;
5135 fi
5136 exit 1
5137 EOF
5138 chmod +x findhdr
5139
5140 : define an alternate in-header-list? function
5141 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5142 cont=true; xxf="echo \"<\$1> found.\" >&4";
5143 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5144 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5145 esac;
5146 case $# in 4) instead=instead;; *) instead="at last";; esac;
5147 while $test "$cont"; do
5148         xxx=`./findhdr $1`
5149         var=$2; eval "was=\$$2";
5150         if $test "$xxx" && $test -r "$xxx";
5151         then eval $xxf;
5152         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5153                 cont="";
5154         else eval $xxnf;
5155         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5156         set $yyy; shift; shift; yyy=$@;
5157         case $# in 0) cont="";;
5158         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5159                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5160         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5161                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5162         esac;
5163 done;
5164 while $test "$yyy";
5165 do set $yyy; var=$2; eval "was=\$$2";
5166         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5167         set $yyy; shift; shift; yyy=$@;
5168 done'
5169
5170 : see if stdlib is available
5171 set stdlib.h i_stdlib
5172 eval $inhdr
5173
5174 : check for lengths of integral types
5175 echo " "
5176 case "$intsize" in
5177 '')
5178         echo "Checking to see how big your integers are..." >&4
5179         $cat >try.c <<EOCP
5180 #include <stdio.h>
5181 #$i_stdlib I_STDLIB
5182 #ifdef I_STDLIB
5183 #include <stdlib.h>
5184 #endif
5185 int main()
5186 {
5187         printf("intsize=%d;\n", (int)sizeof(int));
5188         printf("longsize=%d;\n", (int)sizeof(long));
5189         printf("shortsize=%d;\n", (int)sizeof(short));
5190         exit(0);
5191 }
5192 EOCP
5193         set try
5194         if eval $compile_ok && $run ./try > /dev/null; then
5195                 eval `$run ./try`
5196                 echo "Your integers are $intsize bytes long."
5197                 echo "Your long integers are $longsize bytes long."
5198                 echo "Your short integers are $shortsize bytes long."
5199         else
5200                 $cat >&4 <<EOM
5201 !
5202 Help! I can't compile and run the intsize test program: please enlighten me!
5203 (This is probably a misconfiguration in your system or libraries, and
5204 you really ought to fix it.  Still, I'll try anyway.)
5205 !
5206 EOM
5207                 dflt=4
5208                 rp="What is the size of an integer (in bytes)?"
5209                 . ./myread
5210                 intsize="$ans"
5211                 dflt=$intsize
5212                 rp="What is the size of a long integer (in bytes)?"
5213                 . ./myread
5214                 longsize="$ans"
5215                 dflt=2
5216                 rp="What is the size of a short integer (in bytes)?"
5217                 . ./myread
5218                 shortsize="$ans"
5219         fi
5220         ;;
5221 esac
5222 $rm -f try try.*
5223
5224 : check for long long
5225 echo " "
5226 echo "Checking to see if you have long long..." >&4
5227 echo 'int main() { long long x = 7; return 0; }' > try.c
5228 set try
5229 if eval $compile; then
5230         val="$define"
5231         echo "You have long long."
5232 else
5233         val="$undef"
5234         echo "You do not have long long."
5235 fi
5236 $rm try.*
5237 set d_longlong
5238 eval $setvar
5239
5240 : check for length of long long
5241 case "${d_longlong}${longlongsize}" in
5242 $define)
5243         echo " "
5244         echo "Checking to see how big your long longs are..." >&4
5245         $cat >try.c <<'EOCP'
5246 #include <stdio.h>
5247 int main()
5248 {
5249     printf("%d\n", (int)sizeof(long long));
5250     return(0);
5251 }
5252 EOCP
5253         set try
5254         if eval $compile_ok; then
5255                 longlongsize=`$run ./try`
5256                 echo "Your long longs are $longlongsize bytes long."
5257         else
5258                 dflt='8'
5259                 echo " "
5260                 echo "(I can't seem to compile the test program.  Guessing...)"
5261                 rp="What is the size of a long long (in bytes)?"
5262                 . ./myread
5263                 longlongsize="$ans"
5264         fi
5265         if $test "X$longsize" = "X$longlongsize"; then
5266                 echo "(That isn't any different from an ordinary long.)"
5267         fi      
5268         ;;
5269 esac
5270 $rm -f try.* try
5271
5272 : see if inttypes.h is available
5273 : we want a real compile instead of Inhdr because some systems
5274 : have an inttypes.h which includes non-existent headers
5275 echo " "
5276 $cat >try.c <<EOCP
5277 #include <inttypes.h>
5278 int main() {
5279         static int32_t foo32 = 0x12345678;
5280 }
5281 EOCP
5282 set try
5283 if eval $compile; then
5284         echo "<inttypes.h> found." >&4
5285         val="$define"
5286 else
5287         echo "<inttypes.h> NOT found." >&4
5288         val="$undef"
5289 fi
5290 $rm -f try.c try
5291 set i_inttypes
5292 eval $setvar
5293
5294 : check for int64_t
5295 echo " "
5296 echo "Checking to see if you have int64_t..." >&4
5297 $cat >try.c <<EOCP
5298 #include <sys/types.h>
5299 #$i_inttypes I_INTTYPES
5300 #ifdef I_INTTYPES
5301 #include <inttypes.h>
5302 #endif
5303 int main() { int64_t x = 7; }
5304 EOCP
5305 set try
5306 if eval $compile; then
5307         val="$define"
5308         echo "You have int64_t."
5309 else
5310         val="$undef"
5311         echo "You do not have int64_t."
5312 fi
5313 $rm -f try try.*
5314 set d_int64_t
5315 eval $setvar
5316
5317
5318 echo " "
5319 echo "Checking which 64-bit integer type we could use..." >&4
5320
5321 case "$intsize" in
5322 8) val=int
5323    set quadtype
5324    eval $setvar
5325    val='"unsigned int"'
5326    set uquadtype
5327    eval $setvar
5328    quadkind=1
5329    ;;
5330 *) case "$longsize" in
5331    8) val=long
5332       set quadtype
5333       eval $setvar
5334       val='"unsigned long"'
5335       set uquadtype
5336       eval $setvar
5337       quadkind=2
5338       ;;
5339    *) case "$d_longlong:$longlongsize" in
5340       define:8)
5341         val='"long long"'
5342         set quadtype
5343         eval $setvar
5344         val='"unsigned long long"'
5345         set uquadtype
5346         eval $setvar
5347         quadkind=3
5348         ;;
5349       *) case "$d_int64_t" in
5350          define)
5351            val=int64_t
5352            set quadtype
5353            eval $setvar
5354            val=uint64_t
5355            set uquadtype
5356            eval $setvar
5357            quadkind=4
5358            ;;
5359          esac
5360          ;;
5361       esac
5362       ;;
5363    esac
5364    ;;
5365 esac
5366
5367 case "$quadtype" in
5368 '')     echo "Alas, no 64-bit integer types in sight." >&4
5369         d_quad="$undef"
5370         ;;
5371 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5372         d_quad="$define"
5373         ;;
5374 esac
5375
5376
5377 case "$uselonglong" in
5378 "$define"|true|[yY]*)
5379         cat <<EOM >&4
5380
5381 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5382 EOM
5383         use64bitint="$define"
5384         ;;
5385 esac                          
5386 case "$use64bits" in
5387 "$define"|true|[yY]*)
5388         cat <<EOM >&4
5389
5390 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5391 EOM
5392         use64bitint="$define"
5393         ;;
5394 esac                          
5395 case "$use64bitints" in
5396 "$define"|true|[yY]*)
5397         cat <<EOM >&4
5398
5399 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5400 EOM
5401         use64bitint="$define"
5402         ;;
5403 esac                          
5404 case "$use64bitsint" in
5405 "$define"|true|[yY]*)
5406         cat <<EOM >&4
5407
5408 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5409 EOM
5410         use64bitint="$define"
5411         ;;
5412 esac                          
5413 case "$uselonglongs" in
5414 "$define"|true|[yY]*)
5415         cat <<EOM >&4
5416
5417 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5418 EOM
5419         use64bitint="$define"
5420         ;;
5421 esac                          
5422 case "$use64bitsall" in
5423 "$define"|true|[yY]*)
5424         cat <<EOM >&4
5425
5426 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5427 EOM
5428         use64bitall="$define"
5429         ;;
5430 esac                          
5431
5432 case "$ccflags" in
5433 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5434 esac
5435 case "$use64bitall" in
5436 "$define"|true|[yY]*) use64bitint="$define" ;;
5437 esac
5438
5439 case "$longsize" in
5440 8) cat <<EOM
5441
5442 You have natively 64-bit long integers.
5443 EOM
5444    val="$define"
5445    ;;
5446 *) case "$use64bitint" in
5447    "$define"|true|[yY]*) dflt='y';;
5448    *) dflt='n';;
5449    esac
5450    case "$d_quad" in
5451    "$define") ;;
5452    *) dflt='n' ;;
5453    esac
5454    cat <<EOM
5455
5456 Perl can be built to take advantage of 64-bit integer types
5457 on some systems.  To do so, Configure can be run with -Duse64bitint.
5458 Choosing this option will most probably introduce binary incompatibilities.
5459
5460 If this doesn't make any sense to you, just accept the default '$dflt'.
5461 (The default has been chosen based on your configuration.)
5462 EOM
5463    rp='Try to use 64-bit integers, if available?'
5464    . ./myread
5465    case "$ans" in
5466    [yY]*) val="$define" ;;
5467    *)     val="$undef"  ;;
5468    esac
5469    ;;
5470 esac
5471 set use64bitint
5472 eval $setvar
5473
5474 case "$use64bitall" in
5475 "$define"|true|[yY]*) dflt='y' ;;
5476 *) case "$longsize" in
5477    8) dflt='y' ;;
5478    *) dflt='n' ;;
5479    esac
5480    ;;
5481 esac    
5482 cat <<EOM
5483
5484 You may also choose to try maximal 64-bitness.  It means using as much
5485 64-bitness as possible on the platform.  This in turn means even more
5486 binary incompatibilities.  On the other hand, your platform may not
5487 have any more 64-bitness available than what you already have chosen.
5488
5489 If this doesn't make any sense to you, just accept the default '$dflt'.
5490 (The default has been chosen based on your configuration.)
5491 EOM
5492 rp='Try to use maximal 64-bit support, if available?'
5493 . ./myread
5494 case "$ans" in
5495 [yY]*) val="$define" ;;
5496 *)     val="$undef"  ;;
5497 esac
5498 set use64bitall
5499 eval $setvar
5500 case "$use64bitall" in
5501 "$define")
5502         case "$use64bitint" in
5503         "$undef")
5504                 cat <<EOM
5505
5506 Since you have chosen a maximally 64-bit build, I'm also turning on
5507 the use of 64-bit integers.
5508 EOM
5509                 use64bitint="$define" ;;
5510         esac
5511         ;;
5512 esac
5513
5514 : Look for a hint-file generated 'call-back-unit'.  If the
5515 : user has specified that a 64-bit perl is to be built,
5516 : we may need to set or change some other defaults.
5517 if $test -f use64bitint.cbu; then
5518         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5519         . ./use64bitint.cbu
5520 fi
5521 case "$use64bitint" in
5522 "$define"|true|[yY]*)
5523         case "$longsize" in
5524         4) case "$archname64" in
5525            '') archname64=64int ;;
5526            esac
5527            ;;
5528         esac
5529         ;;
5530 esac
5531
5532 : Look for a hint-file generated 'call-back-unit'.  If the
5533 : user has specified that a maximally 64-bit perl is to be built,
5534 : we may need to set or change some other defaults.
5535 if $test -f use64bitall.cbu; then
5536         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5537         . ./use64bitall.cbu
5538 fi
5539 case "$use64bitall" in
5540 "$define"|true|[yY]*)
5541         case "$longsize" in
5542         4) case "$archname64" in
5543            ''|64int) archname64=64all ;;
5544            esac
5545            ;;
5546         esac
5547         ;;
5548 esac
5549
5550 case "$d_quad:$use64bitint" in
5551 $undef:$define)
5552         cat >&4 <<EOF
5553
5554 *** You have chosen to use 64-bit integers,
5555 *** but none can be found.
5556 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5557 *** Cannot continue, aborting.
5558
5559 EOF
5560         exit 1
5561         ;;
5562 esac
5563
5564 : check for length of double
5565 echo " "
5566 case "$doublesize" in
5567 '')
5568         echo "Checking to see how big your double precision numbers are..." >&4
5569         $cat >try.c <<EOCP
5570 #include <stdio.h>
5571 #$i_stdlib I_STDLIB
5572 #ifdef I_STDLIB
5573 #include <stdlib.h>
5574 #endif
5575 int main()
5576 {
5577     printf("%d\n", (int)sizeof(double));
5578     exit(0);
5579 }
5580 EOCP
5581         set try
5582         if eval $compile_ok; then
5583                 doublesize=`$run ./try`
5584                 echo "Your double is $doublesize bytes long."
5585         else
5586                 dflt='8'
5587                 echo "(I can't seem to compile the test program.  Guessing...)"
5588                 rp="What is the size of a double precision number (in bytes)?"
5589                 . ./myread
5590                 doublesize="$ans"
5591         fi
5592         ;;
5593 esac
5594 $rm -f try.c try
5595
5596 : check for long doubles
5597 echo " "
5598 echo "Checking to see if you have long double..." >&4
5599 echo 'int main() { long double x = 7.0; }' > try.c
5600 set try
5601 if eval $compile; then
5602         val="$define"
5603         echo "You have long double."
5604 else
5605         val="$undef"
5606         echo "You do not have long double."
5607 fi
5608 $rm try.*
5609 set d_longdbl
5610 eval $setvar
5611
5612 : check for length of long double
5613 case "${d_longdbl}${longdblsize}" in
5614 $define)
5615         echo " "
5616         echo "Checking to see how big your long doubles are..." >&4
5617         $cat >try.c <<'EOCP'
5618 #include <stdio.h>
5619 int main()
5620 {
5621         printf("%d\n", sizeof(long double));
5622 }
5623 EOCP
5624         set try
5625         set try
5626         if eval $compile; then
5627                 longdblsize=`$run ./try`
5628                 echo "Your long doubles are $longdblsize bytes long."
5629         else
5630                 dflt='8'
5631                 echo " "
5632                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5633                 rp="What is the size of a long double (in bytes)?"
5634                 . ./myread
5635                 longdblsize="$ans"
5636         fi
5637         if $test "X$doublesize" = "X$longdblsize"; then
5638                 echo "That isn't any different from an ordinary double."
5639                 echo "I'll keep your setting anyway, but you may see some"
5640                 echo "harmless compilation warnings."
5641         fi      
5642         ;;
5643 esac
5644 $rm -f try.* try
5645
5646 : determine the architecture name
5647 echo " "
5648 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5649         tarch=`arch`"-$osname"
5650 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5651         if uname -m > tmparch 2>&1 ; then
5652                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5653                         -e 's/$/'"-$osname/" tmparch`
5654         else
5655                 tarch="$osname"
5656         fi
5657         $rm -f tmparch
5658 else
5659         tarch="$osname"
5660 fi
5661 case "$myarchname" in
5662 ''|"$tarch") ;;
5663 *)
5664         echo "(Your architecture name used to be $myarchname.)"
5665         archname=''
5666         ;;
5667 esac
5668 case "$targetarch" in
5669 '') ;;
5670 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5671 esac
5672 myarchname="$tarch"
5673 case "$archname" in
5674 '') dflt="$tarch";;
5675 *) dflt="$archname";;
5676 esac
5677 rp='What is your architecture name'
5678 . ./myread
5679 archname="$ans"
5680 case "$usethreads" in
5681 $define)
5682         echo "Threads selected." >&4
5683         case "$archname" in
5684         *-thread*) echo "...and architecture name already has -thread." >&4
5685                 ;;
5686         *)      archname="$archname-thread"
5687                 echo "...setting architecture name to $archname." >&4
5688                 ;;
5689         esac
5690         ;;
5691 esac
5692 case "$usemultiplicity" in
5693 $define)
5694         echo "Multiplicity selected." >&4
5695         case "$archname" in
5696         *-multi*) echo "...and architecture name already has -multi." >&4
5697                 ;;
5698         *)      archname="$archname-multi"
5699                 echo "...setting architecture name to $archname." >&4
5700                 ;;
5701         esac
5702         ;;
5703 esac
5704 case "$use64bitint$use64bitall" in
5705 *"$define"*)
5706         case "$archname64" in
5707         '')
5708                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5709                 ;;
5710         *)
5711                 case "$use64bitint" in
5712                 "$define") echo "64 bit integers selected." >&4 ;;
5713                 esac
5714                 case "$use64bitall" in
5715                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5716                 esac
5717                 case "$archname" in
5718                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5719                         ;;
5720                 *)      archname="$archname-$archname64"
5721                         echo "...setting architecture name to $archname." >&4
5722                         ;;
5723                 esac
5724                 ;;
5725         esac
5726 esac
5727 case "$uselongdouble" in
5728 $define)
5729         echo "Long doubles selected." >&4
5730         case "$longdblsize" in
5731         $doublesize)
5732                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5733                 ;;
5734         *)
5735                 case "$archname" in
5736                 *-ld*) echo "...and architecture name already has -ld." >&4
5737                         ;;
5738                 *)      archname="$archname-ld"
5739                         echo "...setting architecture name to $archname." >&4
5740                         ;;
5741                 esac
5742                 ;;
5743         esac
5744         ;;
5745 esac
5746 case "$useperlio" in
5747 $define)
5748         echo "Perlio selected." >&4
5749         ;;
5750 *)
5751         echo "Perlio not selected, using stdio." >&4
5752         case "$archname" in
5753         *-stdio*) echo "...and architecture name already has -stdio." >&4
5754                 ;;
5755         *)      archname="$archname-stdio"
5756                 echo "...setting architecture name to $archname." >&4
5757                 ;;
5758         esac
5759         ;;
5760 esac
5761 if $test -f archname.cbu; then
5762         echo "Your platform has some specific hints for architecture name, using them..."
5763         . ./archname.cbu
5764 fi
5765
5766 : determine root of directory hierarchy where package will be installed.
5767 case "$prefix" in
5768 '')
5769         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5770         ;;
5771 *?/)
5772         dflt=`echo "$prefix" | sed 's/.$//'`
5773         ;;
5774 *)
5775         dflt="$prefix"
5776         ;;
5777 esac
5778 $cat <<EOM
5779
5780 By default, $package will be installed in $dflt/bin, manual pages
5781 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5782 installation directories. Typically this is something like /usr/local.
5783 If you wish to have binaries under /usr/bin but other parts of the
5784 installation under /usr/local, that's ok: you will be prompted
5785 separately for each of the installation directories, the prefix being
5786 only used to set the defaults.
5787
5788 EOM
5789 fn=d~
5790 rp='Installation prefix to use?'
5791 . ./getfile
5792 oldprefix=''
5793 case "$prefix" in
5794 '') ;;
5795 *)
5796         case "$ans" in
5797         "$prefix") ;;
5798         *) oldprefix="$prefix";;
5799         esac
5800         ;;
5801 esac
5802 prefix="$ans"
5803 prefixexp="$ansexp"
5804
5805 case "$afsroot" in
5806 '')     afsroot=/afs ;;
5807 *)      afsroot=$afsroot ;;
5808 esac
5809
5810 : is AFS running?
5811 echo " "
5812 case "$afs" in
5813 $define|true)   afs=true ;;
5814 $undef|false)   afs=false ;;
5815 *)      if test -d $afsroot; then
5816                 afs=true
5817         else
5818                 afs=false
5819         fi
5820         ;;
5821 esac
5822 if $afs; then
5823         echo "AFS may be running... I'll be extra cautious then..." >&4
5824 else
5825         echo "AFS does not seem to be running..." >&4
5826 fi
5827
5828 : determine installation prefix for where package is to be installed.
5829 if $afs; then 
5830 $cat <<EOM
5831
5832 Since you are running AFS, I need to distinguish the directory in which
5833 files will reside from the directory in which they are installed (and from
5834 which they are presumably copied to the former directory by occult means).
5835
5836 EOM
5837         case "$installprefix" in
5838         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5839         *) dflt="$installprefix";;
5840         esac
5841 else
5842 $cat <<EOM
5843
5844 In some special cases, particularly when building $package for distribution,
5845 it is convenient to distinguish the directory in which files should be
5846 installed from the directory ($prefix) in which they will
5847 eventually reside.  For most users, these two directories are the same.
5848
5849 EOM
5850         case "$installprefix" in
5851         '') dflt=$prefix ;;
5852         *) dflt=$installprefix;;
5853         esac
5854 fi
5855 fn=d~
5856 rp='What installation prefix should I use for installing files?'
5857 . ./getfile
5858 installprefix="$ans"
5859 installprefixexp="$ansexp"
5860
5861 : set the prefixit variable, to compute a suitable default value
5862 prefixit='case "$3" in
5863 ""|none)
5864         case "$oldprefix" in
5865         "") eval "$1=\"\$$2\"";;
5866         *)
5867                 case "$3" in
5868                 "") eval "$1=";;
5869                 none)
5870                         eval "tp=\"\$$2\"";
5871                         case "$tp" in
5872                         ""|" ") eval "$1=\"\$$2\"";;
5873                         *) eval "$1=";;
5874                         esac;;
5875                 esac;;
5876         esac;;
5877 *)
5878         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5879         case "$tp" in
5880         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5881         /*-$oldprefix/*|\~*-$oldprefix/*)
5882                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5883         *) eval "$1=\"\$$2\"";;
5884         esac;;
5885 esac'
5886
5887 : get the patchlevel
5888 echo " "
5889 echo "Getting the current patchlevel..." >&4
5890 if $test -r $rsrc/patchlevel.h;then
5891         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5892         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5893         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5894         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5895         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5896         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5897        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5898 else
5899         revision=0
5900         patchlevel=0
5901         subversion=0
5902         api_revision=0
5903         api_version=0
5904         api_subversion=0
5905         perl_patchlevel=0
5906         $echo "(You do not have patchlevel.h.  Eek.)"
5907 fi
5908 if $test -r $rsrc/.patch ; then  
5909         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5910                 perl_patchlevel=`cat $rsrc/.patch`
5911         fi
5912 fi
5913 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5914 version_patchlevel_string="version $patchlevel subversion $subversion"
5915 case "$perl_patchlevel" in
5916 0|'') ;;
5917 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5918 esac
5919
5920 $echo "(You have $package $version_patchlevel_string.)"
5921
5922 case "$osname" in
5923 dos|vms)
5924         : XXX Should be a Configure test for double-dots in filenames.
5925         version=`echo $revision $patchlevel $subversion | \
5926                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5927         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5928                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5929         ;;
5930 *)
5931         version=`echo $revision $patchlevel $subversion | \
5932                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5933         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5934                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5935         ;;
5936 esac
5937 : Special case the 5.005_xx maintenance series, which used 5.005
5938 : without any subversion label as a subdirectory in $sitelib
5939 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5940         api_versionstring='5.005'
5941 fi
5942
5943 : determine installation style
5944 : For now, try to deduce it from prefix unless it is already set.
5945 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5946 case "$installstyle" in
5947 '')     case "$prefix" in
5948                 *perl*) dflt='lib';;
5949                 *) dflt='lib/perl5' ;;
5950         esac
5951         ;;
5952 *)      dflt="$installstyle" ;;
5953 esac
5954 : Probably not worth prompting for this since we prompt for all
5955 : the directories individually, and the prompt would be too long and
5956 : confusing anyway.
5957 installstyle=$dflt
5958
5959 : determine where private library files go
5960 : Usual default is /usr/local/lib/perl5/$version.
5961 : Also allow things like /opt/perl/lib/$version, since 
5962 : /opt/perl/lib/perl5... would be redundant.
5963 : The default "style" setting is made in installstyle.U
5964 case "$installstyle" in
5965 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5966 *)       set dflt privlib lib/$version ;;
5967 esac
5968 eval $prefixit
5969 $cat <<EOM
5970
5971 There are some auxiliary files for $package that need to be put into a
5972 private library directory that is accessible by everyone.
5973
5974 EOM
5975 fn=d~+
5976 rp='Pathname where the private library files will reside?'
5977 . ./getfile
5978 privlib="$ans"
5979 privlibexp="$ansexp"
5980 : Change installation prefix, if necessary.
5981 if $test X"$prefix" != X"$installprefix"; then
5982         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5983 else
5984         installprivlib="$privlibexp"
5985 fi
5986
5987 : set the prefixup variable, to restore leading tilda escape
5988 prefixup='case "$prefixexp" in
5989 "$prefix") ;;
5990 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5991 esac'
5992
5993 : determine where public architecture dependent libraries go
5994 set archlib archlib
5995 eval $prefixit
5996 : privlib default is /usr/local/lib/$package/$version
5997 : archlib default is /usr/local/lib/$package/$version/$archname
5998 : privlib may have an optional trailing /share.
5999 tdflt=`echo $privlib | $sed 's,/share$,,'`
6000 tdflt=$tdflt/$archname
6001 case "$archlib" in
6002 '')     dflt=$tdflt
6003         ;;
6004 *)      dflt="$archlib"
6005     ;;
6006 esac
6007 $cat <<EOM
6008
6009 $spackage contains architecture-dependent library files.  If you are
6010 sharing libraries in a heterogeneous environment, you might store
6011 these files in a separate location.  Otherwise, you can just include
6012 them with the rest of the public library files.
6013
6014 EOM
6015 fn=d+~
6016 rp='Where do you want to put the public architecture-dependent libraries?'
6017 . ./getfile
6018 archlib="$ans"
6019 archlibexp="$ansexp"
6020 if $test X"$archlib" = X"$privlib"; then
6021         d_archlib="$undef"
6022 else
6023         d_archlib="$define"
6024 fi
6025 : Change installation prefix, if necessary.
6026 if $test X"$prefix" != X"$installprefix"; then
6027         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6028 else
6029         installarchlib="$archlibexp"
6030 fi
6031
6032 : see if setuid scripts can be secure
6033 $cat <<EOM
6034
6035 Some kernels have a bug that prevents setuid #! scripts from being
6036 secure.  Some sites have disabled setuid #! scripts because of this.
6037
6038 First let's decide if your kernel supports secure setuid #! scripts.
6039 (If setuid #! scripts would be secure but have been disabled anyway,
6040 don't say that they are secure if asked.)
6041
6042 EOM
6043
6044 val="$undef"
6045 if $test -d /dev/fd; then
6046         echo "#!$ls" >reflect
6047         chmod +x,u+s reflect
6048         ./reflect >flect 2>&1
6049         if $contains "/dev/fd" flect >/dev/null; then
6050                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6051                 val="$define"
6052         else
6053                 $cat <<EOM
6054 If you are not sure if they are secure, I can check but I'll need a
6055 username and password different from the one you are using right now.
6056 If you don't have such a username or don't want me to test, simply
6057 enter 'none'.
6058
6059 EOM
6060                 rp='Other username to test security of setuid scripts with?'
6061                 dflt='none'
6062                 . ./myread
6063                 case "$ans" in
6064                 n|none)
6065                         case "$d_suidsafe" in
6066                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6067                                 dflt=n;;
6068                         "$undef")
6069                                 echo "Well, the $hint value is *not* secure." >&4
6070                                 dflt=n;;
6071                         *)      echo "Well, the $hint value *is* secure." >&4
6072                                 dflt=y;;
6073                         esac
6074                         ;;
6075                 *)
6076                         $rm -f reflect flect
6077                         echo "#!$ls" >reflect
6078                         chmod +x,u+s reflect
6079                         echo >flect
6080                         chmod a+w flect
6081                         echo '"su" will (probably) prompt you for '"$ans's password."
6082                         su $ans -c './reflect >flect'
6083                         if $contains "/dev/fd" flect >/dev/null; then
6084                                 echo "Okay, it looks like setuid scripts are secure." >&4
6085                                 dflt=y
6086                         else
6087                                 echo "I don't think setuid scripts are secure." >&4
6088                                 dflt=n
6089                         fi
6090                         ;;
6091                 esac
6092                 rp='Does your kernel have *secure* setuid scripts?'
6093                 . ./myread
6094                 case "$ans" in
6095                 [yY]*)  val="$define";;
6096                 *)      val="$undef";;
6097                 esac
6098         fi
6099 else
6100         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6101         echo "(That's for file descriptors, not floppy disks.)"
6102         val="$undef"
6103 fi
6104 set d_suidsafe
6105 eval $setvar
6106
6107 $rm -f reflect flect
6108
6109 : now see if they want to do setuid emulation
6110 echo " "
6111 val="$undef"
6112 case "$d_suidsafe" in
6113 "$define")
6114         val="$undef"
6115         echo "No need to emulate SUID scripts since they are secure here." >&4
6116         ;;
6117 *)
6118         $cat <<EOM
6119 Some systems have disabled setuid scripts, especially systems where
6120 setuid scripts cannot be secure.  On systems where setuid scripts have
6121 been disabled, the setuid/setgid bits on scripts are currently
6122 useless.  It is possible for $package to detect those bits and emulate
6123 setuid/setgid in a secure fashion.  This emulation will only work if
6124 setuid scripts have been disabled in your kernel.
6125
6126 EOM
6127         case "$d_dosuid" in
6128         "$define") dflt=y ;;
6129         *) dflt=n ;;
6130         esac
6131         rp="Do you want to do setuid/setgid emulation?"
6132         . ./myread
6133         case "$ans" in
6134         [yY]*)  val="$define";;
6135         *)      val="$undef";;
6136         esac
6137         ;;
6138 esac
6139 set d_dosuid
6140 eval $setvar
6141
6142 : see if this is a malloc.h system
6143 : we want a real compile instead of Inhdr because some systems have a
6144 : malloc.h that just gives a compile error saying to use stdlib.h instead
6145 echo " "
6146 $cat >try.c <<EOCP
6147 #include <stdlib.h>
6148 #include <malloc.h>
6149 int main () { return 0; }
6150 EOCP
6151 set try
6152 if eval $compile; then
6153     echo "<malloc.h> found." >&4
6154     val="$define"
6155 else
6156     echo "<malloc.h> NOT found." >&4
6157     val="$undef"
6158 fi
6159 $rm -f try.c try
6160 set i_malloc
6161 eval $setvar
6162
6163 : check for void type
6164 echo " "
6165 echo "Checking to see how well your C compiler groks the void type..." >&4
6166 case "$voidflags" in
6167 '')
6168         $cat >try.c <<EOCP
6169 #$i_stdlib I_STDLIB
6170 #ifdef I_STDLIB
6171 #include <stdlib.h>
6172 #endif
6173 #if TRY & 1
6174 void sub() {
6175 #else
6176 sub() {
6177 #endif
6178         extern void moo();      /* function returning void */
6179         void (*goo)();          /* ptr to func returning void */
6180 #if TRY & 8
6181         void *hue;              /* generic ptr */
6182 #endif
6183 #if TRY & 2
6184         void (*foo[10])();
6185 #endif
6186
6187 #if TRY & 4
6188         if(goo == moo) {
6189                 exit(0);
6190         }
6191 #endif
6192         exit(0);
6193 }
6194 int main() { sub(); }
6195 EOCP
6196         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6197                 voidflags=$defvoidused
6198         echo "Good.  It appears to support void to the level $package wants.">&4
6199                 if $contains warning .out >/dev/null 2>&1; then
6200                         echo "However, you might get some warnings that look like this:"
6201                         $cat .out
6202                 fi
6203         else
6204 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6205                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6206                         echo "It supports 1..."
6207                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6208                                 echo "It also supports 2..."
6209                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6210                                         voidflags=7
6211                                         echo "And it supports 4 but not 8 definitely."
6212                                 else
6213                                         echo "It doesn't support 4..."
6214                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6215                                                 voidflags=11
6216                                                 echo "But it supports 8."
6217                                         else
6218                                                 voidflags=3
6219                                                 echo "Neither does it support 8."
6220                                         fi
6221                                 fi
6222                         else
6223                                 echo "It does not support 2..."
6224                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6225                                         voidflags=13
6226                                         echo "But it supports 4 and 8."
6227                                 else
6228                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6229                                                 voidflags=5
6230                                                 echo "And it supports 4 but has not heard about 8."
6231                                         else
6232                                                 echo "However it supports 8 but not 4."
6233                                         fi
6234                                 fi
6235                         fi
6236                 else
6237                         echo "There is no support at all for void."
6238                         voidflags=0
6239                 fi
6240         fi
6241 esac
6242 case "$voidflags" in
6243 "$defvoidused") ;;
6244 *)      $cat >&4 <<'EOM'
6245   Support flag bits are:
6246     1: basic void declarations.
6247     2: arrays of pointers to functions returning void.
6248     4: operations between pointers to and addresses of void functions.
6249     8: generic void pointers.
6250 EOM
6251         dflt="$voidflags";
6252         rp="Your void support flags add up to what?"
6253         . ./myread
6254         voidflags="$ans"
6255         ;;
6256 esac
6257 $rm -f try.* .out
6258
6259 : check for length of pointer
6260 echo " "
6261 case "$ptrsize" in
6262 '')
6263         echo "Checking to see how big your pointers are..." >&4
6264         if test "$voidflags" -gt 7; then
6265                 echo '#define VOID_PTR char *' > try.c
6266         else
6267                 echo '#define VOID_PTR void *' > try.c
6268         fi
6269         $cat >>try.c <<EOCP
6270 #include <stdio.h>
6271 #$i_stdlib I_STDLIB
6272 #ifdef I_STDLIB
6273 #include <stdlib.h>
6274 #endif
6275 int main()
6276 {
6277     printf("%d\n", (int)sizeof(VOID_PTR));
6278     exit(0);
6279 }
6280 EOCP
6281         set try
6282         if eval $compile_ok; then
6283                 ptrsize=`$run ./try`
6284                 echo "Your pointers are $ptrsize bytes long."
6285         else
6286                 dflt='4'
6287                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6288                 rp="What is the size of a pointer (in bytes)?"
6289                 . ./myread
6290                 ptrsize="$ans"
6291         fi
6292         ;;
6293 esac
6294 $rm -f try.c try
6295 case "$use64bitall" in
6296 "$define"|true|[yY]*)
6297         case "$ptrsize" in
6298         4)      cat <<EOM >&4
6299
6300 *** You have chosen a maximally 64-bit build,
6301 *** but your pointers are only 4 bytes wide.
6302 *** Please rerun Configure without -Duse64bitall.
6303 EOM
6304                 case "$d_quad" in
6305                 define)
6306                         cat <<EOM >&4
6307 *** Since you have quads, you could possibly try with -Duse64bitint.
6308 EOM
6309                         ;;
6310                 esac
6311                 cat <<EOM >&4
6312 *** Cannot continue, aborting.
6313
6314 EOM
6315
6316                 exit 1
6317                 ;;
6318         esac
6319         ;;
6320 esac
6321
6322
6323 : determine whether to use malloc wrapping
6324 echo " "
6325 case "$usemallocwrap" in
6326 [yY]*|true|$define)     dflt='y' ;;
6327 [nN]*|false|$undef)     dflt='n' ;;
6328 *)      case "$usedevel" in
6329         [yY]*|true|$define)     dflt='y' ;;
6330         *) dflt='n' ;;
6331         esac
6332         ;;
6333 esac
6334 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6335 . ./myread
6336 usemallocwrap="$ans"
6337 case "$ans" in
6338 y*|true)
6339         usemallocwrap="$define" ;;
6340 *)
6341         usemallocwrap="$undef" ;;
6342 esac
6343
6344 : determine which malloc to compile in
6345 echo " "
6346 case "$usemymalloc" in
6347 [yY]*|true|$define)     dflt='y' ;;
6348 [nN]*|false|$undef)     dflt='n' ;;
6349 *)      case "$ptrsize" in
6350         4) dflt='y' ;;
6351         *) dflt='n' ;;
6352         esac
6353         ;;
6354 esac
6355 rp="Do you wish to attempt to use the malloc that comes with $package?"
6356 . ./myread
6357 usemymalloc="$ans"
6358 case "$ans" in
6359 y*|true)
6360         usemymalloc='y'
6361         mallocsrc='malloc.c'
6362         mallocobj="malloc$_o"
6363         d_mymalloc="$define"
6364         case "$libs" in
6365         *-lmalloc*)
6366                 : Remove malloc from list of libraries to use
6367                 echo "Removing unneeded -lmalloc from library list" >&4
6368                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6369                 shift
6370                 libs="$*"
6371                 echo "libs = $libs" >&4
6372                 ;;
6373         esac
6374         ;;
6375 *)
6376         usemymalloc='n'
6377         mallocsrc=''
6378         mallocobj=''
6379         d_mymalloc="$undef"
6380         ;;
6381 esac
6382
6383 : compute the return types of malloc and free
6384 echo " "
6385 $cat >malloc.c <<END
6386 #$i_malloc I_MALLOC
6387 #$i_stdlib I_STDLIB
6388 #include <stdio.h>
6389 #include <sys/types.h>
6390 #ifdef I_MALLOC
6391 #include <malloc.h>
6392 #endif
6393 #ifdef I_STDLIB
6394 #include <stdlib.h>
6395 #endif
6396 #ifdef TRY_MALLOC
6397 void *malloc();
6398 #endif
6399 #ifdef TRY_FREE
6400 void free();
6401 #endif
6402 END
6403 case "$malloctype" in
6404 '')
6405         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6406                 malloctype='void *'
6407         else
6408                 malloctype='char *'
6409         fi
6410         ;;
6411 esac
6412 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6413
6414 case "$freetype" in
6415 '')
6416         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6417                 freetype='void'
6418         else
6419                 freetype='int'
6420         fi
6421         ;;
6422 esac
6423 echo "Your system uses $freetype free(), it would seem." >&4
6424 $rm -f malloc.[co]
6425 $cat <<EOM
6426
6427 After $package is installed, you may wish to install various
6428 add-on modules and utilities.  Typically, these add-ons will
6429 be installed under $prefix with the rest
6430 of this package.  However, you may wish to install such add-ons
6431 elsewhere under a different prefix.
6432
6433 If you do not wish to put everything under a single prefix, that's
6434 ok.  You will be prompted for the individual locations; this siteprefix
6435 is only used to suggest the defaults.
6436
6437 The default should be fine for most people.
6438
6439 EOM
6440 fn=d~+
6441 rp='Installation prefix to use for add-on modules and utilities?'
6442 : XXX Here might be another good place for an installstyle setting.
6443 case "$siteprefix" in
6444 '') dflt=$prefix ;;
6445 *)  dflt=$siteprefix ;;
6446 esac
6447 . ./getfile
6448 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6449 oldsiteprefix=''
6450 case "$siteprefix" in
6451 '') ;;
6452 *)      case "$ans" in
6453         "$prefix") ;;
6454         *) oldsiteprefix="$prefix";;
6455         esac
6456         ;;
6457 esac
6458 siteprefix="$ans"
6459 siteprefixexp="$ansexp"
6460
6461 : determine where site specific libraries go.
6462 : Usual default is /usr/local/lib/perl5/site_perl/$version
6463 : The default "style" setting is made in installstyle.U
6464 : XXX No longer works with Prefixit stuff.
6465 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6466 case "$sitelib" in
6467 '') case "$installstyle" in
6468         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6469         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6470         esac
6471         ;;
6472 *)      dflt="$sitelib"
6473         ;;
6474 esac
6475 $cat <<EOM
6476
6477 The installation process will create a directory for
6478 site-specific extensions and modules.  Most users find it convenient
6479 to place all site-specific files in this directory rather than in the
6480 main distribution directory.
6481
6482 EOM
6483 fn=d~+
6484 rp='Pathname for the site-specific library files?'
6485 . ./getfile
6486 sitelib="$ans"
6487 sitelibexp="$ansexp"
6488 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6489 : Change installation prefix, if necessary.
6490 if $test X"$prefix" != X"$installprefix"; then
6491         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6492 else
6493         installsitelib="$sitelibexp"
6494 fi
6495
6496 : determine where site specific architecture-dependent libraries go.
6497 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6498 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6499 : sitelib may have an optional trailing /share.
6500 case "$sitearch" in
6501 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6502         dflt="$dflt/$archname"
6503         ;;
6504 *)      dflt="$sitearch"
6505         ;;
6506 esac
6507 set sitearch sitearch none
6508 eval $prefixit
6509 $cat <<EOM
6510
6511 The installation process will also create a directory for
6512 architecture-dependent site-specific extensions and modules.
6513
6514 EOM
6515 fn=d~+
6516 rp='Pathname for the site-specific architecture-dependent library files?'
6517 . ./getfile
6518 sitearch="$ans"
6519 sitearchexp="$ansexp"
6520 : Change installation prefix, if necessary.
6521 if $test X"$prefix" != X"$installprefix"; then
6522         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6523 else
6524         installsitearch="$sitearchexp"
6525 fi
6526
6527 $cat <<EOM
6528
6529 The installation process will also create a directory for
6530 vendor-supplied add-ons.  Vendors who supply perl with their system
6531 may find it convenient to place all vendor-supplied files in this
6532 directory rather than in the main distribution directory.  This will
6533 ease upgrades between binary-compatible maintenance versions of perl.
6534
6535 Of course you may also use these directories in whatever way you see
6536 fit.  For example, you might use them to access modules shared over a
6537 company-wide network.
6538
6539 The default answer should be fine for most people.
6540 This causes further questions about vendor add-ons to be skipped
6541 and no vendor-specific directories will be configured for perl.
6542
6543 EOM
6544 rp='Do you want to configure vendor-specific add-on directories?'
6545 case "$usevendorprefix" in
6546 define|true|[yY]*) dflt=y ;;
6547 *)      : User may have set vendorprefix directly on Configure command line.
6548         case "$vendorprefix" in
6549         ''|' ') dflt=n ;;
6550         *)      dflt=y ;;
6551         esac
6552         ;;
6553 esac
6554 . ./myread
6555 case "$ans" in
6556 [yY]*)  fn=d~+
6557         rp='Installation prefix to use for vendor-supplied add-ons?'
6558         case "$vendorprefix" in
6559         '') dflt='' ;;
6560         *)  dflt=$vendorprefix ;;
6561         esac
6562         . ./getfile
6563         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6564         oldvendorprefix=''
6565         case "$vendorprefix" in
6566         '') ;;
6567         *)      case "$ans" in
6568                 "$prefix") ;;
6569                 *) oldvendorprefix="$prefix";;
6570                 esac
6571                 ;;
6572         esac
6573         usevendorprefix="$define"
6574         vendorprefix="$ans"
6575         vendorprefixexp="$ansexp"
6576         ;;
6577 *)      usevendorprefix="$undef"
6578         vendorprefix=''
6579         vendorprefixexp=''
6580         ;;
6581 esac
6582
6583 case "$vendorprefix" in
6584 '')     d_vendorlib="$undef"
6585         vendorlib=''
6586         vendorlibexp=''
6587         ;;
6588 *)      d_vendorlib="$define"
6589         : determine where vendor-supplied modules go.
6590         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6591         case "$vendorlib" in
6592         '')
6593                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6594                 case "$installstyle" in
6595                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6596                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6597                 esac
6598                 ;;
6599         *)      dflt="$vendorlib"
6600                 ;;
6601         esac
6602         fn=d~+
6603         rp='Pathname for the vendor-supplied library files?'
6604         . ./getfile
6605         vendorlib="$ans"
6606         vendorlibexp="$ansexp"
6607         ;;
6608 esac
6609 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6610 : Change installation prefix, if necessary.
6611 if $test X"$prefix" != X"$installprefix"; then
6612         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6613 else
6614         installvendorlib="$vendorlibexp"
6615 fi
6616
6617 case "$vendorprefix" in
6618 '')     d_vendorarch="$undef"
6619         vendorarch=''
6620         vendorarchexp=''
6621         ;;
6622 *)      d_vendorarch="$define"
6623         : determine where vendor-supplied architecture-dependent libraries go.
6624         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6625         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6626         : vendorlib may have an optional trailing /share.
6627         case "$vendorarch" in
6628         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6629                 dflt="$dflt/$archname"
6630                 ;;
6631         *)      dflt="$vendorarch" ;;
6632         esac
6633         fn=d~+
6634         rp='Pathname for vendor-supplied architecture-dependent files?'
6635         . ./getfile
6636         vendorarch="$ans"
6637         vendorarchexp="$ansexp"
6638         ;;
6639 esac
6640 : Change installation prefix, if necessary.
6641 if $test X"$prefix" != X"$installprefix"; then
6642         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6643 else
6644         installvendorarch="$vendorarchexp"
6645 fi
6646
6647 : Final catch-all directories to search
6648 $cat <<EOM
6649
6650 Lastly, you can have perl look in other directories for extensions and
6651 modules in addition to those already specified.
6652 These directories will be searched after 
6653         $sitearch 
6654         $sitelib 
6655 EOM
6656 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6657 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6658 echo ' '
6659 case "$otherlibdirs" in
6660 ''|' ') dflt='none' ;;
6661 *)      dflt="$otherlibdirs" ;;
6662 esac
6663 $cat <<EOM
6664 Enter a colon-separated set of extra paths to include in perl's @INC
6665 search path, or enter 'none' for no extra paths.
6666
6667 EOM
6668
6669 rp='Colon-separated list of additional directories for perl to search?'
6670 . ./myread
6671 case "$ans" in
6672 ' '|''|none)    otherlibdirs=' ' ;;     
6673 *)      otherlibdirs="$ans" ;;
6674 esac
6675 case "$otherlibdirs" in
6676 ' ') val=$undef ;;
6677 *)      val=$define ;;
6678 esac
6679 set d_perl_otherlibdirs
6680 eval $setvar
6681
6682 : Cruising for prototypes
6683 echo " "
6684 echo "Checking out function prototypes..." >&4
6685 $cat >prototype.c <<EOCP
6686 #$i_stdlib I_STDLIB
6687 #ifdef I_STDLIB
6688 #include <stdlib.h>
6689 #endif
6690 int main(int argc, char *argv[]) {
6691         exit(0);}
6692 EOCP
6693 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6694         echo "Your C compiler appears to support function prototypes."
6695         val="$define"
6696 else
6697         echo "Your C compiler doesn't seem to understand function prototypes."
6698         val="$undef"
6699 fi
6700 set prototype
6701 eval $setvar
6702 $rm -f prototype*
6703
6704 case "$prototype" in
6705 "$define") ;;
6706 *)      ansi2knr='ansi2knr'
6707         echo " "
6708         cat <<EOM >&4
6709
6710 $me:  FATAL ERROR:
6711 This version of $package can only be compiled by a compiler that 
6712 understands function prototypes.  Unfortunately, your C compiler 
6713         $cc $ccflags
6714 doesn't seem to understand them.  Sorry about that.
6715
6716 If GNU cc is available for your system, perhaps you could try that instead.  
6717
6718 Eventually, we hope to support building Perl with pre-ANSI compilers.
6719 If you would like to help in that effort, please contact <perlbug@perl.org>.
6720
6721 Aborting Configure now.
6722 EOM
6723         exit 2
6724         ;;
6725 esac
6726
6727 : determine where public executables go
6728 echo " "
6729 set dflt bin bin
6730 eval $prefixit
6731 fn=d~
6732 rp='Pathname where the public executables will reside?'
6733 . ./getfile
6734 if $test "X$ansexp" != "X$binexp"; then
6735         installbin=''
6736 fi
6737 bin="$ans"
6738 binexp="$ansexp"
6739 : Change installation prefix, if necessary.
6740 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6741 if $test X"$prefix" != X"$installprefix"; then
6742         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6743 else
6744         installbin="$binexp"
6745 fi
6746
6747 echo " "
6748 case "$extras" in
6749 '') dflt='n';;
6750 *) dflt='y';;
6751 esac
6752 cat <<EOM
6753 Perl can be built with extra modules or bundles of modules which
6754 will be fetched from the CPAN and installed alongside Perl.
6755
6756 Notice that you will need access to the CPAN; either via the Internet,
6757 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6758 be asked later to configure the CPAN.pm module which will in turn do
6759 the installation of the rest of the extra modules or bundles.)
6760
6761 Notice also that if the modules require any external software such as
6762 libraries and headers (the libz library and the zlib.h header for the
6763 Compress::Zlib module, for example) you MUST have any such software
6764 already installed, this configuration process will NOT install such
6765 things for you.
6766
6767 If this doesn't make any sense to you, just accept the default '$dflt'.
6768 EOM
6769 rp='Install any extra modules (y or n)?'
6770 . ./myread
6771 case "$ans" in
6772 y|Y)
6773         cat <<EOM
6774
6775 Please list any extra modules or bundles to be installed from CPAN,
6776 with spaces between the names.  The names can be in any format the
6777 'install' command of CPAN.pm will understand.  (Answer 'none',
6778 without the quotes, to install no extra modules or bundles.)
6779 EOM
6780         rp='Extras?'
6781         dflt="$extras"
6782         . ./myread
6783         extras="$ans"
6784 esac
6785 case "$extras" in
6786 ''|'none')
6787         val=''
6788         $rm -f ../extras.lst
6789         ;;
6790 *)      echo "(Saving the list of extras for later...)"
6791         echo "$extras" > ../extras.lst
6792         val="'$extras'"
6793         ;;
6794 esac
6795 set extras
6796 eval $setvar
6797 echo " "
6798
6799 : determine where html pages for programs go
6800 set html1dir html1dir none
6801 eval $prefixit
6802 $cat <<EOM
6803
6804 If you wish to install html files for programs in $spackage, indicate 
6805 the appropriate directory here.  To skip installing html files,
6806 answer "none".
6807 EOM
6808 case "$html1dir" in
6809 ''|none|$undef|' ') dflt=none ;;
6810 *) dflt=$html1dir ;;
6811 esac
6812 fn=dn+~
6813 rp="Directory for the main $spackage html pages?"
6814 . ./getfile
6815 html1dir="$ans"
6816 html1direxp="$ansexp"
6817 : Use ' ' for none so value is preserved next time through Configure
6818 $test X"$html1dir" = "X" && html1dir=' '
6819 : Change installation prefix, if necessary.
6820 if $test X"$prefix" != X"$installprefix"; then
6821         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6822 else
6823         installhtml1dir="$html1direxp"
6824 fi
6825
6826 : determine where html pages for libraries and modules go
6827 set html3dir html3dir none
6828 eval $prefixit
6829 $cat <<EOM
6830
6831 If you wish to install html files for modules associated with $spackage,
6832 indicate the appropriate directory here.  To skip installing html files,
6833 answer "none".
6834 EOM
6835 : There is no obvious default.  If they have specified html1dir, then
6836 : try to key off that, possibly changing .../html1 into .../html3.
6837 case "$html3dir" in
6838 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6839 *) dflt=$html3dir ;;
6840 esac
6841 fn=dn+~
6842 rp="Directory for the $spackage module html pages?"
6843 . ./getfile
6844 html3dir="$ans"
6845 html3direxp="$ansexp"
6846 : Use ' ' for none so value is preserved next time through Configure
6847 $test X"$html3dir" = "X" && html3dir=' '
6848 : Change installation prefix, if necessary.
6849 if $test X"$prefix" != X"$installprefix"; then
6850         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6851 else
6852         installhtml3dir="$html3direxp"
6853 fi
6854
6855 : Find perl5.005 or later.
6856 echo "Looking for a previously installed perl5.005 or later... "
6857 case "$perl5" in
6858 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6859                 : Check if this perl is recent and can load a simple module
6860                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6861                         perl5=$tdir/perl
6862                         break;
6863                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6864                         perl5=$tdir/perl5
6865                         break;
6866                 fi
6867         done
6868         ;;
6869 *)      perl5="$perl5"
6870         ;;
6871 esac
6872 case "$perl5" in
6873 '')     echo "None found.  That's ok.";;
6874 *)      echo "Using $perl5." ;;
6875 esac
6876
6877 : Determine list of previous versions to include in @INC
6878 $cat > getverlist <<EOPL
6879 #!$perl5 -w
6880 use File::Basename;
6881 \$api_versionstring = "$api_versionstring";
6882 \$version = "$version";
6883 \$stem = "$sitelib_stem";
6884 \$archname = "$archname";
6885 EOPL
6886         $cat >> getverlist <<'EOPL'
6887 # Can't have leading @ because metaconfig interprets it as a command!
6888 ;@inc_version_list=();
6889 # XXX Redo to do opendir/readdir? 
6890 if (-d $stem) {
6891     chdir($stem);
6892     ;@candidates = glob("5.*");
6893 }
6894 else {
6895     ;@candidates = ();
6896 }
6897
6898 # XXX ToDo:  These comparisons must be reworked when two-digit
6899 # subversions come along, so that 5.7.10 compares as greater than
6900 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6901 # widespread that we can use the built-in version vectors rather
6902 # than reinventing them here.  For 5.6.0, however, we must
6903 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6904 foreach $d (@candidates) {
6905     if ($d lt $version) {
6906         if ($d ge $api_versionstring) {
6907             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6908         }
6909         elsif ($d ge "5.005") {
6910             unshift(@inc_version_list, grep { -d } $d);
6911         }
6912     }
6913     else {
6914         # Skip newer version.  I.e. don't look in
6915         # 5.7.0 if we're installing 5.6.1.
6916     }
6917 }
6918
6919 if (@inc_version_list) {
6920     print join(' ', @inc_version_list);
6921 }
6922 else {
6923     # Blank space to preserve value for next Configure run.
6924     print " ";
6925 }
6926 EOPL
6927 chmod +x getverlist
6928 case "$inc_version_list" in
6929 '')     if test -x "$perl5$exe_ext"; then
6930                 dflt=`$perl5 getverlist`
6931         else
6932                 dflt='none'
6933         fi
6934         ;;
6935 $undef) dflt='none' ;;
6936 *)  eval dflt=\"$inc_version_list\" ;;
6937 esac
6938 case "$dflt" in
6939 ''|' ') dflt=none ;;
6940 esac
6941 case "$dflt" in
6942 5.005) dflt=none ;;
6943 esac
6944 $cat <<EOM
6945
6946 In order to ease the process of upgrading, this version of perl 
6947 can be configured to use modules built and installed with earlier 
6948 versions of perl that were installed under $prefix.  Specify here
6949 the list of earlier versions that this version of perl should check.
6950 If Configure detected no earlier versions of perl installed under
6951 $prefix, then the list will be empty.  Answer 'none' to tell perl
6952 to not search earlier versions.
6953
6954 The default should almost always be sensible, so if you're not sure,
6955 just accept the default.
6956 EOM
6957
6958 rp='List of earlier versions to include in @INC?'
6959 . ./myread
6960 case "$ans" in
6961 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6962 *) inc_version_list="$ans" ;;
6963 esac
6964 case "$inc_version_list" in
6965 ''|' ') 
6966         inc_version_list_init='0';;
6967 *)      inc_version_list_init=`echo $inc_version_list |
6968                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6969         ;;
6970 esac
6971 $rm -f getverlist
6972
6973 : determine whether to install perl also as /usr/bin/perl
6974
6975 echo " "
6976 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6977         $cat <<EOM
6978 Many scripts expect perl to be installed as /usr/bin/perl.
6979
6980 If you want to, I can install the perl you are about to compile
6981 as /usr/bin/perl (in addition to $bin/perl).
6982 EOM
6983         if test -f /usr/bin/perl; then
6984             $cat <<EOM
6985
6986 However, please note that because you already have a /usr/bin/perl,
6987 overwriting that with a new Perl would very probably cause problems.
6988 Therefore I'm assuming you don't want to do that (unless you insist).
6989
6990 EOM
6991             case "$installusrbinperl" in
6992             "$define"|[yY]*)    dflt='y';;
6993             *)                  dflt='n';;
6994             esac
6995         else
6996             $cat <<EOM
6997
6998 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6999
7000 EOM
7001             case "$installusrbinperl" in
7002             "$undef"|[nN]*)     dflt='n';;
7003             *)                  dflt='y';;
7004             esac
7005         fi
7006         rp="Do you want to install perl as /usr/bin/perl?"
7007         . ./myread
7008         case "$ans" in
7009         [yY]*)  val="$define";;
7010         *)      val="$undef" ;;
7011         esac
7012 else
7013         val="$undef"
7014 fi
7015 set installusrbinperl
7016 eval $setvar
7017
7018 echo " "
7019 echo "Checking for GNU C Library..." >&4
7020 cat >try.c <<'EOCP'
7021 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7022    alone are insufficient to distinguish different versions, such as
7023    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7024    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7025 */
7026 #include <stdio.h>
7027 int main(void)
7028 {
7029 #ifdef __GLIBC__
7030 #   ifdef __GLIBC_MINOR__
7031 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7032 #           include <gnu/libc-version.h>
7033             printf("%s\n",  gnu_get_libc_version());
7034 #       else
7035             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7036 #       endif
7037 #   else
7038         printf("%d\n",  __GLIBC__);
7039 #   endif
7040     return 0;
7041 #else
7042     return 1;
7043 #endif
7044 }
7045 EOCP
7046 set try
7047 if eval $compile_ok && $run ./try > glibc.ver; then
7048         val="$define"
7049         gnulibc_version=`$cat glibc.ver`
7050         echo "You are using the GNU C Library version $gnulibc_version"
7051 else
7052         val="$undef"
7053         gnulibc_version=''
7054         echo "You are not using the GNU C Library"
7055 fi
7056 $rm -f try try.* glibc.ver
7057 set d_gnulibc
7058 eval $setvar
7059
7060 : see if nm is to be used to determine whether a symbol is defined or not
7061 case "$usenm" in
7062 '')
7063         dflt=''
7064         case "$d_gnulibc" in
7065         "$define")
7066                 echo " "
7067                 echo "nm probably won't work on the GNU C Library." >&4
7068                 dflt=n
7069                 ;;
7070         esac
7071         case "$dflt" in
7072         '') 
7073                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7074                         echo " "
7075                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7076                         echo "'nm' won't be sufficient on this sytem." >&4
7077                         dflt=n
7078                 fi
7079                 ;;
7080         esac
7081         case "$dflt" in
7082         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7083                 if $test $dflt -gt 20; then
7084                         dflt=y
7085                 else
7086                         dflt=n
7087                 fi
7088                 ;;
7089         esac
7090         ;;
7091 *)
7092         case "$usenm" in
7093         true|$define) dflt=y;;
7094         *) dflt=n;;
7095         esac
7096         ;;
7097 esac
7098 $cat <<EOM
7099
7100 I can use $nm to extract the symbols from your C libraries. This
7101 is a time consuming task which may generate huge output on the disk (up
7102 to 3 megabytes) but that should make the symbols extraction faster. The
7103 alternative is to skip the 'nm' extraction part and to compile a small
7104 test program instead to determine whether each symbol is present. If
7105 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7106 this may be the best solution.
7107
7108 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7109
7110 EOM
7111 rp="Shall I use $nm to extract C symbols from the libraries?"
7112 . ./myread
7113 case "$ans" in
7114 [Nn]*) usenm=false;;
7115 *) usenm=true;;
7116 esac
7117
7118 runnm=$usenm
7119 case "$reuseval" in
7120 true) runnm=false;;
7121 esac
7122
7123 : nm options which may be necessary
7124 case "$nm_opt" in
7125 '') if $test -f /mach_boot; then
7126                 nm_opt=''       # Mach
7127         elif $test -d /usr/ccs/lib; then
7128                 nm_opt='-p'     # Solaris (and SunOS?)
7129         elif $test -f /dgux; then
7130                 nm_opt='-p'     # DG-UX
7131         elif $test -f /lib64/rld; then
7132                 nm_opt='-p'     # 64-bit Irix
7133         else
7134                 nm_opt=''
7135         fi;;
7136 esac
7137
7138 : nm options which may be necessary for shared libraries but illegal
7139 : for archive libraries.  Thank you, Linux.
7140 case "$nm_so_opt" in
7141 '')     case "$myuname" in
7142         *linux*|gnu*)
7143                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7144                         nm_so_opt='--dynamic'
7145                 fi
7146                 ;;
7147         esac
7148         ;;
7149 esac
7150
7151 case "$runnm" in
7152 true)
7153 : get list of predefined functions in a handy place
7154 echo " "
7155 case "$libc" in
7156 '') libc=unknown
7157         case "$libs" in
7158         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7159         esac
7160         ;;
7161 esac
7162 case "$libs" in
7163 '') ;;
7164 *)  for thislib in $libs; do
7165         case "$thislib" in
7166         -lc|-lc_s)
7167                 : Handle C library specially below.
7168                 ;;
7169         -l*)
7170                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7171                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7172                         :
7173                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7174                         :
7175                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7176                         :
7177                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7178                         :
7179                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7180                         :
7181                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7182                         :
7183                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7184                         :
7185                 else
7186                         try=''
7187                 fi
7188                 libnames="$libnames $try"
7189                 ;;
7190         *) libnames="$libnames $thislib" ;;
7191         esac
7192         done
7193         ;;
7194 esac
7195 xxx=normal
7196 case "$libc" in
7197 unknown)
7198         set /lib/libc.$so
7199         for xxx in $libpth; do
7200                 $test -r $1 || set $xxx/libc.$so
7201                 : The messy sed command sorts on library version numbers.
7202                 $test -r $1 || \
7203                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7204                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7205                                 h
7206                                 s/[0-9][0-9]*/0000&/g
7207                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7208                                 G
7209                                 s/\n/ /' | \
7210                          $sort | $sed -e 's/^.* //'`
7211                 eval set \$$#
7212         done
7213         $test -r $1 || set /usr/ccs/lib/libc.$so
7214         $test -r $1 || set /lib/libsys_s$_a
7215         ;;
7216 *)
7217         set blurfl
7218         ;;
7219 esac
7220 if $test -r "$1"; then
7221         echo "Your (shared) C library seems to be in $1."
7222         libc="$1"
7223 elif $test -r /lib/libc && $test -r /lib/clib; then
7224         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7225         xxx=apollo
7226         libc='/lib/clib /lib/libc'
7227         if $test -r /lib/syslib; then
7228                 echo "(Your math library is in /lib/syslib.)"
7229                 libc="$libc /lib/syslib"
7230         fi
7231 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7232         echo "Your C library seems to be in $libc, as you said before."
7233 elif $test -r $incpath/usr/lib/libc$_a; then
7234         libc=$incpath/usr/lib/libc$_a;
7235         echo "Your C library seems to be in $libc.  That's fine."
7236 elif $test -r /lib/libc$_a; then
7237         libc=/lib/libc$_a;
7238         echo "Your C library seems to be in $libc.  You're normal."
7239 else
7240         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7241                 :
7242         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7243                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7244         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7245                 :
7246         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7247                 :
7248         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7249                 :
7250         else
7251                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7252         fi
7253         if $test -r "$tans"; then
7254                 echo "Your C library seems to be in $tans, of all places."
7255                 libc=$tans
7256         else
7257                 libc='blurfl'
7258         fi
7259 fi
7260 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7261         dflt="$libc"
7262         cat <<EOM
7263
7264 If the guess above is wrong (which it might be if you're using a strange
7265 compiler, or your machine supports multiple models), you can override it here.
7266
7267 EOM
7268 else
7269         dflt=''
7270         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7271         cat >&4 <<EOM
7272 I can't seem to find your C library.  I've looked in the following places:
7273
7274 EOM
7275         $sed 's/^/      /' libpath
7276         cat <<EOM
7277
7278 None of these seems to contain your C library. I need to get its name...
7279
7280 EOM
7281 fi
7282 fn=f
7283 rp='Where is your C library?'
7284 . ./getfile
7285 libc="$ans"
7286
7287 echo " "
7288 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7289 set X `cat libnames`
7290 shift
7291 xxx=files
7292 case $# in 1) xxx=file; esac
7293 echo "Extracting names from the following $xxx for later perusal:" >&4
7294 echo " "
7295 $sed 's/^/      /' libnames >&4
7296 echo " "
7297 $echo $n "This may take a while...$c" >&4
7298
7299 for file in $*; do
7300         case $file in
7301         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7302         *) $nm $nm_opt $file 2>/dev/null;;
7303         esac
7304 done >libc.tmp
7305
7306 $echo $n ".$c"
7307 $grep fprintf libc.tmp > libc.ptf
7308 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7309 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7310 xxx='[ADTSIW]'
7311 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7312         eval $xscan;\
7313         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7314                 eval $xrun
7315 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7316         eval $xscan;\
7317         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7318                 eval $xrun
7319 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7320         eval $xscan;\
7321         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7322                 eval $xrun
7323 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7324         eval $xscan;\
7325         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7326                 eval $xrun
7327 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7328         eval $xscan;\
7329         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7330                 eval $xrun
7331 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7332         eval $xscan;\
7333         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7334                 eval $xrun
7335 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7336                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7337         eval $xscan;\
7338         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7339                 eval $xrun
7340 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7341         eval $xscan;\
7342         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7343                 eval $xrun
7344 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7345         eval $xscan;\
7346         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7347                 eval $xrun
7348 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7349         eval $xscan;\
7350         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7351                 eval $xrun
7352 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7353         eval $xscan;\
7354         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7355                 eval $xrun
7356 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7357         eval $xscan;\
7358         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7359                 eval $xrun
7360 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7361         eval $xscan;\
7362         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7363                 eval $xrun
7364 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7365         eval $xscan;\
7366         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7367                 eval $xrun
7368 else
7369         $nm -p $* 2>/dev/null >libc.tmp
7370         $grep fprintf libc.tmp > libc.ptf
7371         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7372                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7373         then
7374                 nm_opt='-p'
7375                 eval $xrun
7376         else
7377                 echo " "
7378                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7379                 com=''
7380                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7381                         for thisname in $libnames $libc; do
7382                                 $ar t $thisname >>libc.tmp
7383                         done
7384                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7385                         echo "Ok." >&4
7386                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7387                         # Repeat libc to extract forwarders to DLL entries too
7388                         for thisname in $libnames $libc; do
7389                                 $ar tv $thisname >>libc.tmp
7390                                 # Revision 50 of EMX has bug in $ar.
7391                                 # it will not extract forwarders to DLL entries
7392                                 # Use emximp which will extract exactly them.
7393                                 emximp -o tmp.imp $thisname \
7394                                     2>/dev/null && \
7395                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7396                                     < tmp.imp >>libc.tmp
7397                                 $rm tmp.imp
7398                         done
7399                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7400                         echo "Ok." >&4
7401                 else
7402                         echo "$ar didn't seem to work right." >&4
7403                         echo "Maybe this is a Cray...trying bld instead..." >&4
7404                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7405                         then
7406                                 for thisname in $libnames; do
7407                                         bld t $libnames | \
7408                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7409                                         $ar t $thisname >>libc.tmp
7410                                 done
7411                                 echo "Ok." >&4
7412                         else
7413                                 echo "That didn't work either.  Giving up." >&4
7414                                 exit 1
7415                         fi
7416                 fi
7417         fi
7418 fi
7419 nm_extract="$com"
7420 case "$PASE" in
7421 define)
7422     echo " "
7423     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7424     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7425     ;;
7426 *)  if $test -f /lib/syscalls.exp; then
7427         echo " "
7428         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7429         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7430     fi
7431     ;;
7432 esac
7433 ;;
7434 esac
7435 $rm -f libnames libpath
7436
7437 : see if dld is available
7438 set dld.h i_dld
7439 eval $inhdr
7440
7441 : is a C symbol defined?
7442 csym='tlook=$1;
7443 case "$3" in
7444 -v) tf=libc.tmp; tdc="";;
7445 -a) tf=libc.tmp; tdc="[]";;
7446 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7447 esac;
7448 tx=yes;
7449 case "$reuseval-$4" in
7450 true-) ;;
7451 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7452 esac;
7453 case "$tx" in
7454 yes)
7455         tval=false;
7456         if $test "$runnm" = true; then
7457                 if $contains $tlook $tf >/dev/null 2>&1; then
7458                         tval=true;
7459                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7460                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7461                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7462                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7463                         $rm -f try$_exe try.c core core.* try.core;
7464                 fi;
7465         else
7466                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7467                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7468                 $rm -f try$_exe try.c;
7469         fi;
7470         ;;
7471 *)
7472         case "$tval" in
7473         $define) tval=true;;
7474         *) tval=false;;
7475         esac;
7476         ;;
7477 esac;
7478 eval "$2=$tval"'
7479
7480 : define an is-in-libc? function
7481 inlibc='echo " "; td=$define; tu=$undef;
7482 sym=$1; var=$2; eval "was=\$$2";
7483 tx=yes;
7484 case "$reuseval$was" in
7485 true) ;;
7486 true*) tx=no;;
7487 esac;
7488 case "$tx" in
7489 yes)
7490         set $sym tres -f;
7491         eval $csym;
7492         case "$tres" in
7493         true)
7494                 echo "$sym() found." >&4;
7495                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7496         *)
7497                 echo "$sym() NOT found." >&4;
7498                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7499         esac;;
7500 *)
7501         case "$was" in
7502         $define) echo "$sym() found." >&4;;
7503         *) echo "$sym() NOT found." >&4;;
7504         esac;;
7505 esac'
7506
7507 : see if dlopen exists
7508 xxx_runnm="$runnm"
7509 runnm=false
7510 set dlopen d_dlopen
7511 eval $inlibc
7512 runnm="$xxx_runnm"
7513
7514 : determine which dynamic loading, if any, to compile in
7515 echo " "
7516 dldir="ext/DynaLoader"
7517 case "$usedl" in
7518 $define|y|true)
7519         dflt='y'
7520         usedl="$define"
7521         ;;
7522 $undef|n|false)
7523         dflt='n'
7524         usedl="$undef"
7525         ;;
7526 *) 
7527         dflt='n'
7528         case "$d_dlopen" in
7529             $define) dflt='y' ;;
7530         esac
7531         case "$i_dld" in
7532             $define) dflt='y' ;;
7533         esac
7534         : Does a dl_xxx.xs file exist for this operating system
7535         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7536         ;;
7537 esac
7538 rp="Do you wish to use dynamic loading?"
7539 . ./myread
7540 usedl="$ans"
7541 case "$ans" in
7542 y*) usedl="$define"
7543         case "$dlsrc" in
7544         '')
7545                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7546                         dflt="$dldir/dl_${osname}.xs"
7547                 elif $test "$d_dlopen" = "$define" ; then
7548                         dflt="$dldir/dl_dlopen.xs"
7549                 elif $test "$i_dld" = "$define" ; then
7550                         dflt="$dldir/dl_dld.xs"
7551                 else
7552                         dflt=''
7553                 fi
7554                 ;;
7555         *)      dflt="$dldir/$dlsrc"
7556                 ;;
7557         esac
7558     echo "The following dynamic loading files are available:"
7559         : Can not go over to $dldir because getfile has path hard-coded in.
7560         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7561         rp="Source file to use for dynamic loading"
7562         fn="fne"
7563         gfpth="$src"
7564         . ./getfile
7565         usedl="$define"
7566         : emulate basename
7567         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7568
7569         $cat << EOM
7570
7571 Some systems may require passing special flags to $cc -c to
7572 compile modules that will be used to create a shared library.
7573 To use no flags, say "none".
7574
7575 EOM
7576     case "$cccdlflags" in
7577     '') case "$gccversion" in
7578                 '') case "$osname" in
7579                         hpux)   dflt='+z' ;;
7580                         next)   dflt='none' ;;
7581                         irix*)  dflt='-KPIC' ;;
7582                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7583                         sunos)  dflt='-pic' ;;
7584                         *)      dflt='none' ;;
7585                     esac
7586                         ;;
7587                 *)  case "$osname" in
7588                         darwin) dflt='none' ;;
7589                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7590                         *)      dflt='-fpic' ;;
7591                     esac ;;
7592             esac ;;
7593         ' ') dflt='none' ;;
7594     *)  dflt="$cccdlflags" ;;
7595     esac
7596     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7597     . ./myread
7598     case "$ans" in
7599     none) cccdlflags=' ' ;;
7600     *) cccdlflags="$ans" ;;
7601     esac
7602
7603     cat << EOM
7604
7605 Some systems use ld to create libraries that can be dynamically loaded,
7606 while other systems (such as those using ELF) use $cc.
7607
7608 EOM
7609         case "$ld" in
7610         '')     $cat >try.c <<EOM
7611 /* Test for whether ELF binaries are produced */
7612 #include <fcntl.h>
7613 #$i_stdlib I_STDLIB
7614 #ifdef I_STDLIB
7615 #include <stdlib.h>
7616 #endif
7617 int main() {
7618         char b[4];
7619         int i = open("a.out",O_RDONLY);
7620         if(i == -1) 
7621                 exit(1); /* fail */
7622         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7623                 exit(0); /* succeed (yes, it's ELF) */
7624         else
7625                 exit(1); /* fail */
7626 }
7627 EOM
7628                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7629                         cat <<EOM
7630 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7631 EOM
7632                         dflt="$cc"
7633                 else
7634                         echo "I'll use ld to build dynamic libraries."
7635                         dflt='ld'
7636                 fi
7637                 rm -f try.c a.out
7638                 ;;
7639         *)      dflt="$ld"
7640                 ;;
7641         esac
7642
7643     rp="What command should be used to create dynamic libraries?"
7644     . ./myread
7645         ld="$ans"
7646
7647     cat << EOM
7648
7649 Some systems may require passing special flags to $ld to create a
7650 library that can be dynamically loaded.  If your ld flags include
7651 -L/other/path options to locate libraries outside your loader's normal
7652 search path, you may need to specify those -L options here as well.  To
7653 use no flags, say "none".
7654
7655 EOM
7656     case "$lddlflags" in
7657     '') case "$osname" in
7658                         beos) dflt='-nostart' ;;
7659                         hpux) dflt='-b';
7660                               case "$gccversion" in
7661                               '') dflt="$dflt +vnocompatwarnings" ;;
7662                               esac
7663                               ;;        
7664                         linux|irix*|gnu*)       dflt='-shared' ;;
7665                         next)  dflt='none' ;;
7666                         solaris) dflt='-G' ;;
7667                         sunos) dflt='-assert nodefinitions' ;;
7668                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7669                 *)     dflt='none' ;;
7670                         esac
7671                         ;;
7672     *) dflt="$lddlflags" ;;
7673     esac
7674
7675         : Try to guess additional flags to pick up local libraries.
7676         : Be careful not to append to a plain 'none'
7677         case "$dflt" in
7678         none) dflt='' ;;
7679         esac
7680         for thisflag in $ldflags; do
7681                 case "$thisflag" in
7682                 -L*|-R*|-Wl,-R*)
7683                         case " $dflt " in
7684                         *" $thisflag "*) ;;
7685                         *) dflt="$dflt $thisflag" ;;
7686                         esac
7687                         ;;
7688                 esac
7689         done
7690
7691         case "$dflt" in
7692         ''|' ') dflt='none' ;;
7693         esac
7694
7695     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7696     . ./myread
7697     case "$ans" in
7698     none) lddlflags=' ' ;;
7699     *) lddlflags="$ans" ;;
7700     esac
7701
7702         cat <<EOM
7703
7704 Some systems may require passing special flags to $cc to indicate that
7705 the resulting executable will use dynamic linking.  To use no flags,
7706 say "none".
7707
7708 EOM
7709     case "$ccdlflags" in
7710     '') case "$osname" in
7711             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7712             next|sunos) dflt='none' ;;
7713             *)          dflt='none' ;;
7714             esac ;;
7715     ' ')  dflt='none' ;;
7716     *)  dflt="$ccdlflags" ;;
7717     esac
7718     rp="Any special flags to pass to $cc to use dynamic linking?"
7719     . ./myread
7720     case "$ans" in
7721     none) ccdlflags=' ' ;;
7722     *) ccdlflags="$ans" ;;
7723     esac
7724     ;;
7725 *)  usedl="$undef"
7726         ld='ld'
7727     dlsrc='dl_none.xs'
7728     lddlflags=''
7729     ccdlflags=''
7730     ;;
7731 esac
7732
7733 also=''
7734 case "$usedl" in
7735 $undef)
7736         # No dynamic loading being used, so don't bother even to prompt.
7737         useshrplib='false'
7738         ;;
7739 *)      case "$useshrplib" in
7740         '')     case "$osname" in
7741                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7742                         dflt=y
7743                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7744                         ;;
7745                 next*)
7746                         case "$osvers" in
7747                         4*)     dflt=y
7748                                 also='Building a shared libperl is needed for MAB support.'
7749                                 ;;
7750                         *)      dflt=n
7751                                 ;;
7752                         esac
7753                         ;;
7754                 *)      dflt=n
7755                         ;;
7756                 esac
7757                 ;;
7758         $define|true|[Yy]*)
7759                 dflt=y
7760                 ;;
7761         *)      dflt=n
7762                 ;;
7763         esac
7764         $cat << EOM
7765
7766 The perl executable is normally obtained by linking perlmain.c with
7767 libperl${_a}, any static extensions (usually just DynaLoader), and
7768 any other libraries needed on this system (such as -lm, etc.).  Since
7769 your system supports dynamic loading, it is probably possible to build
7770 a shared libperl.$so.  If you will have more than one executable linked
7771 to libperl.$so, this will significantly reduce the size of each
7772 executable, but it may have a noticeable effect on performance.  The
7773 default is probably sensible for your system.
7774 $also
7775
7776 EOM
7777         rp="Build a shared libperl.$so (y/n)"
7778         . ./myread
7779         case "$ans" in
7780         true|$define|[Yy]*)
7781                 useshrplib='true'  ;;
7782         *)      useshrplib='false' ;;
7783         esac
7784         ;;
7785 esac
7786
7787 case "$useshrplib" in
7788 true)
7789         case "$libperl" in
7790         '')
7791                 # Figure out a good name for libperl.so.  Since it gets stored in
7792                 # a version-specific architecture-dependent library, the version
7793                 # number isn't really that important, except for making cc/ld happy.
7794                 #
7795                 # A name such as libperl.so.3.1
7796                 majmin="libperl.$so.$patchlevel.$subversion"
7797                 # A name such as libperl.so.301
7798                 majonly=`echo $patchlevel $subversion |
7799                         $awk '{printf "%d%02d", $1, $2}'`
7800                 majonly=libperl.$so.$majonly
7801                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7802                 # rely on figuring it out from the naming of libc.
7803                 case "${osname}${osvers}" in
7804                 next4*)
7805                         dflt=libperl.5.$so
7806                         # XXX How handle the --version stuff for MAB?
7807                         ;;
7808                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7809                         dflt=libperl.$so
7810                         ;;
7811                 cygwin*) # ld links against an importlib
7812                         dflt=libperl$lib_ext
7813                         ;;
7814                 *)      # Try to guess based on whether libc has major.minor.
7815                         case "$libc" in
7816                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7817                         *libc.$so.[0-9]*) dflt=$majonly ;;
7818                         *)      dflt=libperl.$so ;;
7819                         esac
7820                         ;;
7821                 esac
7822                 ;;
7823         *)      dflt=$libperl
7824                 ;;
7825         esac
7826         cat << EOM
7827
7828 I need to select a good name for the shared libperl.  If your system uses
7829 library names with major and minor numbers, then you might want something
7830 like $majmin.  Alternatively, if your system uses a single version
7831 number for shared libraries, then you might want to use $majonly.
7832 Or, your system might be quite happy with a simple libperl.$so.
7833
7834 Since the shared libperl will get installed into a version-specific
7835 architecture-dependent directory, the version number of the shared perl
7836 library probably isn't important, so the default should be o.k.
7837
7838 EOM
7839         rp='What name do you want to give to the shared libperl?'
7840         . ./myread
7841         libperl=$ans
7842         echo "Ok, I'll use $libperl"
7843         ;;
7844 *)
7845         libperl="libperl${_a}"
7846         ;;
7847 esac
7848
7849 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7850 case "$shrpdir" in
7851 '') ;;
7852 *)      $cat >&4 <<EOM
7853 WARNING:  Use of the shrpdir variable for the installation location of
7854 the shared $libperl is not supported.  It was never documented and
7855 will not work in this version.  Let me (perlbug@perl.org)
7856 know of any problems this may cause.
7857
7858 EOM
7859         case "$shrpdir" in
7860         "$archlibexp/CORE")
7861                 $cat >&4 <<EOM
7862 But your current setting of $shrpdir is
7863 the default anyway, so it's harmless.
7864 EOM
7865                 ;;
7866         *)
7867                 $cat >&4 <<EOM
7868 Further, your current attempted setting of $shrpdir
7869 conflicts with the value of $archlibexp/CORE
7870 that installperl will use.
7871 EOM
7872                 ;;
7873         esac
7874         ;;
7875 esac
7876
7877 # How will the perl executable find the installed shared $libperl?
7878 # Add $xxx to ccdlflags.
7879 # If we can't figure out a command-line option, use $shrpenv to
7880 # set env LD_RUN_PATH.  The main perl makefile uses this.
7881 shrpdir=$archlibexp/CORE
7882 xxx=''
7883 tmp_shrpenv=''
7884 if "$useshrplib"; then
7885     case "$osname" in 
7886         aix)
7887                 # We'll set it in Makefile.SH...
7888                 ;;
7889         solaris)
7890                 xxx="-R $shrpdir"
7891                 ;;
7892         freebsd|netbsd|openbsd|interix)
7893                 xxx="-Wl,-R$shrpdir"
7894                 ;;
7895         bsdos|linux|irix*|dec_osf|gnu*)
7896                 xxx="-Wl,-rpath,$shrpdir"
7897                 ;;
7898         next)
7899                 # next doesn't like the default...
7900                 ;;
7901         beos)
7902                 # beos doesn't like the default, either.
7903                 ;;
7904         hpux*)
7905                 # hpux doesn't like the default, either.
7906                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7907                 ;;
7908         *)
7909                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7910                 ;;
7911         esac
7912         case "$xxx" in
7913         '') ;;
7914         *)      
7915                 # Only add $xxx if it isn't already in ccdlflags.
7916                 case " $ccdlflags " in
7917                 *" $xxx "*)     ;;
7918                 *)      ccdlflags="$ccdlflags $xxx"
7919                         cat <<EOM >&4
7920
7921 Adding $xxx to the flags
7922 passed to $ld so that the perl executable will find the 
7923 installed shared $libperl.
7924
7925 EOM
7926                         ;;
7927                 esac
7928                 ;;
7929         esac
7930 fi
7931 # Fix ccdlflags in AIX for building external extensions.
7932 # (For building Perl itself bare -bE:perl.exp is needed,
7933 #  Makefile.SH takes care of this.)
7934 case "$osname" in
7935 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7936 esac
7937 # Respect a hint or command-line value.
7938 case "$shrpenv" in
7939 '') shrpenv="$tmp_shrpenv" ;;
7940 esac
7941 case "$ldlibpthname" in
7942 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7943 none)   ldlibpthname='' ;;
7944 esac
7945
7946 : determine where manual pages are on this system
7947 echo " "
7948 case "$sysman" in
7949 '') 
7950         syspath='/usr/share/man/man1 /usr/man/man1'
7951         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7952         syspath="$syspath /usr/man/u_man/man1"
7953         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7954         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7955         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7956         sysman=`./loc . /usr/man/man1 $syspath`
7957         ;;
7958 esac
7959 if $test -d "$sysman"; then
7960         echo "System manual is in $sysman." >&4
7961 else
7962         echo "Could not find manual pages in source form." >&4
7963 fi
7964
7965 : determine where manual pages go
7966 set man1dir man1dir none
7967 eval $prefixit
7968 $cat <<EOM
7969
7970 $spackage has manual pages available in source form.
7971 EOM
7972 case "$nroff" in
7973 nroff)
7974         echo "However, you don't have nroff, so they're probably useless to you."
7975         case "$man1dir" in
7976         '') man1dir="none";;
7977         esac;;
7978 esac
7979 echo "If you don't want the manual sources installed, answer 'none'."
7980 case "$man1dir" in
7981 ' ') dflt=none
7982         ;;
7983 '')
7984         lookpath="$prefixexp/share/man/man1"
7985         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7986         lookpath="$lookpath $prefixexp/man/p_man/man1"
7987         lookpath="$lookpath $prefixexp/man/u_man/man1"
7988         lookpath="$lookpath $prefixexp/man/man.1"
7989         case "$sysman" in
7990         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7991         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7992         esac
7993         set dflt
7994         eval $prefixup
7995         ;;
7996 *)  dflt="$man1dir"
7997         ;;
7998 esac
7999 echo " "
8000 fn=dn+~
8001 rp="Where do the main $spackage manual pages (source) go?"
8002 . ./getfile
8003 if $test "X$man1direxp" != "X$ansexp"; then
8004         installman1dir=''
8005 fi
8006 man1dir="$ans"
8007 man1direxp="$ansexp"
8008 case "$man1dir" in
8009 '')     man1dir=' '
8010         installman1dir='';;
8011 esac
8012
8013 : Change installation prefix, if necessary.
8014 if $test X"$prefix" != X"$installprefix"; then
8015         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8016 else
8017         installman1dir="$man1direxp"
8018 fi
8019
8020 : What suffix to use on installed man pages
8021
8022 case "$man1dir" in
8023 ' ')
8024         man1ext='0'
8025         ;;
8026 *)
8027         rp="What suffix should be used for the main $spackage man pages?"
8028         case "$man1ext" in
8029         '')     case "$man1dir" in
8030                 *1)  dflt=1 ;;
8031                 *1p) dflt=1p ;;
8032                 *1pm) dflt=1pm ;;
8033                 *l) dflt=l;;
8034                 *n) dflt=n;;
8035                 *o) dflt=o;;
8036                 *p) dflt=p;;
8037                 *C) dflt=C;;
8038                 *L) dflt=L;;
8039                 *L1) dflt=L1;;
8040                 *) dflt=1;;
8041                 esac
8042                 ;;
8043         *)      dflt="$man1ext";;
8044         esac
8045         . ./myread
8046         man1ext="$ans"
8047         ;;
8048 esac
8049
8050 : see if we can have long filenames
8051 echo " "
8052 first=123456789abcdef
8053 $rm -f $first
8054 if (echo hi >$first) 2>/dev/null; then
8055         if $test -f 123456789abcde; then
8056                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8057                 val="$undef"
8058         else
8059                 echo 'You can have filenames longer than 14 characters.'>&4
8060                 val="$define"
8061         fi
8062 else
8063         $cat <<'EOM'
8064 You can't have filenames longer than 14 chars.
8065 You can't even think about them!
8066 EOM
8067         val="$undef"
8068 fi 
8069 set d_flexfnam
8070 eval $setvar
8071 $rm -rf 123456789abcde*
8072
8073 : determine where library module manual pages go
8074 set man3dir man3dir none
8075 eval $prefixit
8076 $cat <<EOM
8077
8078 $spackage has manual pages for many of the library modules.
8079 EOM
8080
8081 case "$nroff" in
8082 nroff)
8083         $cat <<'EOM'
8084 However, you don't have nroff, so they're probably useless to you.
8085 EOM
8086         case "$man3dir" in
8087         '') man3dir="none";;
8088         esac;;
8089 esac
8090
8091 case "$d_flexfnam" in
8092 undef)
8093         $cat <<'EOM'
8094 However, your system can't handle the long file names like File::Basename.3. 
8095 EOM
8096         case "$man3dir" in
8097         '') man3dir="none";;
8098         esac;;
8099 esac
8100
8101 echo "If you don't want the manual sources installed, answer 'none'."
8102 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8103 case "$man3dir" in
8104 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8105         if $test -d "$privlib/man/man3"; then
8106                 cat <<EOM >&4
8107
8108 WARNING:  Previous versions of perl installed man3 pages into
8109 $privlib/man/man3.  This version will suggest a 
8110 new default of $dflt.  
8111 EOM
8112                 tdflt=$dflt
8113                 dflt='n'
8114                 rp='Do you wish to preserve the old behavior?(y/n)'
8115                 . ./myread
8116                 case "$ans" in
8117                 y*) dflt="$privlib/man/man3" ;;
8118                 *)  dflt=$tdflt ;;
8119                 esac
8120     fi
8121         ;;
8122 *)      dflt="$man3dir" ;;
8123 esac
8124 case "$dflt" in
8125 ' ') dflt=none ;;
8126 esac
8127 echo " "
8128 fn=dn+~
8129 rp="Where do the $package library man pages (source) go?"
8130 . ./getfile
8131 man3dir="$ans"
8132 man3direxp="$ansexp"
8133 case "$man3dir" in
8134 '')     man3dir=' '
8135         installman3dir='';;
8136 esac
8137
8138 : Change installation prefix, if necessary.
8139 if $test X"$prefix" != X"$installprefix"; then
8140         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8141 else
8142         installman3dir="$man3direxp"
8143 fi
8144
8145 : What suffix to use on installed man pages
8146 case "$man3dir" in
8147 ' ')
8148         man3ext='0'
8149         ;;
8150 *)
8151         rp="What suffix should be used for the $package library man pages?"
8152         case "$man3ext" in
8153         '')     case "$man3dir" in
8154                 *3)  dflt=3 ;;
8155                 *3p) dflt=3p ;;
8156                 *3pm) dflt=3pm ;;
8157                 *l) dflt=l;;
8158                 *n) dflt=n;;
8159                 *o) dflt=o;;
8160                 *p) dflt=p;;
8161                 *C) dflt=C;;
8162                 *L) dflt=L;;
8163                 *L3) dflt=L3;;
8164                 *) dflt=3;;
8165                 esac
8166                 ;;
8167         *)      dflt="$man3ext";;
8168         esac
8169         . ./myread
8170         man3ext="$ans"
8171         ;;
8172 esac
8173
8174 : see if we have to deal with yellow pages, now NIS.
8175 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8176         if $test -f /usr/etc/nibindd; then
8177                 echo " "
8178                 echo "I'm fairly confident you're on a NeXT."
8179                 echo " "
8180                 rp='Do you get the hosts file via NetInfo?'
8181                 dflt=y
8182                 case "$hostcat" in
8183                 nidump*) ;;
8184                 '') ;;
8185                 *) dflt=n;;
8186                 esac
8187                 . ./myread
8188                 case "$ans" in
8189                 y*) hostcat='nidump hosts .';;
8190                 *)      case "$hostcat" in
8191                         nidump*) hostcat='';;
8192                         esac
8193                         ;;
8194                 esac
8195         fi
8196         case "$hostcat" in
8197         nidump*) ;;
8198         *)
8199                 case "$hostcat" in
8200                 *ypcat*) dflt=y;;
8201                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8202                                 dflt=y
8203                         else
8204                                 dflt=n
8205                         fi;;
8206                 *) dflt=n;;
8207                 esac
8208                 echo " "
8209                 rp='Are you getting the hosts file via yellow pages?'
8210                 . ./myread
8211                 case "$ans" in
8212                 y*) hostcat='ypcat hosts';;
8213                 *) hostcat='cat /etc/hosts';;
8214                 esac
8215                 ;;
8216         esac
8217 fi
8218 case "$hostcat" in
8219 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8220 esac
8221 case "$groupcat" in
8222 '') test -f /etc/group && groupcat='cat /etc/group';;
8223 esac
8224 case "$passcat" in
8225 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8226 esac
8227
8228 : now get the host name
8229 echo " "
8230 echo "Figuring out host name..." >&4
8231 case "$myhostname" in
8232 '') cont=true
8233         echo 'Maybe "hostname" will work...'
8234         if tans=`sh -c hostname 2>&1` ; then
8235                 myhostname=$tans
8236                 phostname=hostname
8237                 cont=''
8238         fi
8239         ;;
8240 *) cont='';;
8241 esac
8242 if $test "$cont"; then
8243         if ./xenix; then
8244                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8245                 if tans=`cat /etc/systemid 2>&1` ; then
8246                         myhostname=$tans
8247                         phostname='cat /etc/systemid'
8248                         echo "Whadyaknow.  Xenix always was a bit strange..."
8249                         cont=''
8250                 fi
8251         elif $test -r /etc/systemid; then
8252                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8253         fi
8254 fi
8255 if $test "$cont"; then
8256         echo 'No, maybe "uuname -l" will work...'
8257         if tans=`sh -c 'uuname -l' 2>&1` ; then
8258                 myhostname=$tans
8259                 phostname='uuname -l'
8260         else
8261                 echo 'Strange.  Maybe "uname -n" will work...'
8262                 if tans=`sh -c 'uname -n' 2>&1` ; then
8263                         myhostname=$tans
8264                         phostname='uname -n'
8265                 else
8266                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8267                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8268                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8269                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8270                         else
8271                                 case "$myhostname" in
8272                                 '') echo "Does this machine have an identity crisis or something?"
8273                                         phostname='';;
8274                                 *)
8275                                         echo "Well, you said $myhostname before..."
8276                                         phostname='echo $myhostname';;
8277                                 esac
8278                         fi
8279                 fi
8280         fi
8281 fi
8282 case "$myhostname" in
8283 '') myhostname=noname ;;
8284 esac
8285 : you do not want to know about this
8286 set $myhostname
8287 myhostname=$1
8288
8289 : verify guess
8290 if $test "$myhostname" ; then
8291         dflt=y
8292         rp='Your host name appears to be "'$myhostname'".'" Right?"
8293         . ./myread
8294         case "$ans" in
8295         y*) ;;
8296         *) myhostname='';;
8297         esac
8298 fi
8299
8300 : bad guess or no guess
8301 while $test "X$myhostname" = X ; do
8302         dflt=''
8303         rp="Please type the (one word) name of your host:"
8304         . ./myread
8305         myhostname="$ans"
8306 done
8307
8308 : translate upper to lower if necessary
8309 case "$myhostname" in
8310 *[A-Z]*)
8311         echo "(Normalizing case in your host name)"
8312         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8313         ;;
8314 esac
8315
8316 case "$myhostname" in
8317 *.*)
8318         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8319         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8320         echo "(Trimming domain name from host name--host name is now $myhostname)"
8321         ;;
8322 *) case "$mydomain" in
8323         '')
8324                 {
8325                         test "X$hostcat" = "Xypcat hosts" &&
8326                         ypmatch "$myhostname" hosts 2>/dev/null |\
8327                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8328                         $test -s hosts
8329                 } || {
8330                         test "X$hostcat" != "X" &&
8331                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8332                                         /[       ]$myhostname[  . ]/p" > hosts
8333                 }
8334                 tmp_re="[       . ]"
8335                 if $test -f hosts; then
8336                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8337                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8338                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8339                                 hosts | $sort | $uniq | \
8340                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8341                         case `$echo X$dflt` in
8342                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8343                                 dflt=.
8344                                 ;;
8345                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8346                                 ;;
8347                         esac
8348                 else
8349                         echo "(I cannot locate a hosts database anywhere)"
8350                         dflt=.
8351                 fi
8352                 case "$dflt" in
8353                 .)
8354                         tans=`./loc resolv.conf X /etc /usr/etc`
8355                         if $test -f "$tans"; then
8356                                 echo "(Attempting domain name extraction from $tans)"
8357                                 dflt=.`$sed -n -e 's/   / /g' \
8358                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8359                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8360                                 case "$dflt" in
8361                                 .) dflt=.`$sed -n -e 's/        / /g' \
8362                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8363                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8364                                         ;;
8365                                 esac
8366                         fi
8367                         ;;
8368                 esac
8369                 case "$dflt" in
8370                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8371                         dflt=.`sh -c domainname 2>/dev/null`
8372                         case "$dflt" in
8373                         '') dflt='.';;
8374                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8375                         esac
8376                         ;;
8377                 esac
8378                 case "$dflt$osname" in
8379                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8380                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8381                         ;;
8382                 esac
8383                 case "$dflt" in
8384                 .) echo "(Lost all hope -- silly guess then)"
8385                         dflt='.nonet'
8386                         ;;
8387                 esac
8388                 $rm -f hosts
8389                 ;;
8390         *) dflt="$mydomain";;
8391         esac;;
8392 esac
8393 echo " "
8394 rp="What is your domain name?"
8395 . ./myread
8396 tans="$ans"
8397 case "$ans" in
8398 '') ;;
8399 .*) ;;
8400 *) tans=".$tans";;
8401 esac
8402 mydomain="$tans"
8403
8404 : translate upper to lower if necessary
8405 case "$mydomain" in
8406 *[A-Z]*)
8407         echo "(Normalizing case in your domain name)"
8408         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8409         ;;
8410 esac
8411
8412 : a little sanity check here
8413 case "$phostname" in
8414 '') ;;
8415 *)
8416         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8417         $myhostname$mydomain|$myhostname) ;;
8418         *)
8419                 case "$phostname" in
8420                 sed*)
8421                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8422                         ;;
8423                 *)
8424                         echo "(That doesn't agree with your $phostname command, by the way.)"
8425                         ;;
8426                 esac
8427         ;;
8428         esac
8429         ;;
8430 esac
8431
8432 $cat <<EOM
8433
8434 I need to get your e-mail address in Internet format if possible, i.e.
8435 something like user@host.domain. Please answer accurately since I have
8436 no easy means to double check it. The default value provided below
8437 is most probably close to reality but may not be valid from outside
8438 your organization...
8439
8440 EOM
8441 cont=x
8442 while test "$cont"; do
8443         case "$cf_email" in
8444         '') dflt="$cf_by@$myhostname$mydomain";;
8445         *) dflt="$cf_email";;
8446         esac
8447         rp='What is your e-mail address?'
8448         . ./myread
8449         cf_email="$ans"
8450         case "$cf_email" in
8451         *@*.*) cont='' ;;
8452         *)
8453                 rp='Address does not look like an Internet one.  Use it anyway?'
8454                 case "$fastread" in
8455                 yes) dflt=y ;;
8456                 *) dflt=n ;;
8457                 esac
8458                 . ./myread
8459                 case "$ans" in
8460                 y*) cont='' ;;
8461                 *) echo " " ;;
8462                 esac
8463                 ;;
8464         esac
8465 done
8466
8467 $cat <<EOM
8468
8469 If you or somebody else will be maintaining perl at your site, please
8470 fill in the correct e-mail address here so that they may be contacted
8471 if necessary. Currently, the "perlbug" program included with perl
8472 will send mail to this address in addition to perlbug@perl.org. You may
8473 enter "none" for no administrator.
8474
8475 EOM
8476 case "$perladmin" in
8477 '') dflt="$cf_email";;
8478 *) dflt="$perladmin";;
8479 esac
8480 rp='Perl administrator e-mail address'
8481 . ./myread
8482 perladmin="$ans"
8483
8484 : determine whether to only install version-specific parts.
8485 echo " "
8486 $cat <<EOM
8487 Do you want to install only the version-specific parts of the perl
8488 distribution?  Usually you do *not* want to do this.
8489 EOM
8490 case "$versiononly" in
8491 "$define"|[Yy]*|true) dflt='y' ;;
8492 *) dflt='n';
8493 esac
8494 rp="Do you want to install only the version-specific parts of perl?"
8495 . ./myread
8496 case "$ans" in
8497 [yY]*)  val="$define";;
8498 *)      val="$undef" ;;
8499 esac
8500 set versiononly
8501 eval $setvar
8502
8503 case "$versiononly" in
8504 "$define") inc_version_list=''
8505            inc_version_list_init=0
8506            ;;
8507 esac
8508
8509 : figure out how to guarantee perl startup
8510 case "$startperl" in
8511 '')
8512         case "$sharpbang" in
8513         *!)
8514                 $cat <<EOH
8515
8516 I can use the #! construct to start perl on your system. This will
8517 make startup of perl scripts faster, but may cause problems if you
8518 want to share those scripts and perl is not in a standard place
8519 ($binexp/perl) on all your platforms. The alternative is to force
8520 a shell by starting the script with a single ':' character.
8521
8522 EOH
8523                 case "$versiononly" in
8524                 "$define")      dflt="$binexp/perl$version";;  
8525                 *)              dflt="$binexp/perl";;
8526                 esac
8527                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8528                 . ./myread
8529                 case "$ans" in
8530                 none)   startperl=": # use perl";;
8531                 *)      startperl="#!$ans"
8532                         if $test 30 -lt `echo "$ans" | wc -c`; then
8533                                 $cat >&4 <<EOM
8534
8535 WARNING:  Some systems limit the #! command to 32 characters.
8536 If you experience difficulty running Perl scripts with #!, try
8537 installing Perl in a directory with a shorter pathname.
8538
8539 EOM
8540                         fi ;;
8541                 esac
8542                 ;;
8543         *) startperl=": # use perl"
8544                 ;;
8545         esac
8546         ;;
8547 esac
8548 echo "I'll use $startperl to start perl scripts."
8549
8550 : figure best path for perl in scripts
8551 case "$perlpath" in
8552 '')
8553         case "$versiononly" in
8554         "$define")      perlpath="$binexp/perl$version";;
8555         *)              perlpath="$binexp/perl";;
8556         esac
8557         case "$startperl" in
8558         *!*) ;;
8559         *)
8560                 $cat <<EOH
8561
8562 I will use the "eval 'exec'" idiom to start Perl on your system.
8563 I can use the full path of your Perl binary for this purpose, but
8564 doing so may cause problems if you want to share those scripts and
8565 Perl is not always in a standard place ($binexp/perl).
8566
8567 EOH
8568                 dflt="$binexp/perl"
8569                 rp="What path shall I use in \"eval 'exec'\"?"
8570                 . ./myread
8571                 perlpath="$ans"
8572                 ;;
8573         esac
8574         ;;
8575 esac
8576 case "$startperl" in
8577 *!*)    ;;
8578 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8579 esac
8580
8581 : determine where public executable scripts go
8582 set scriptdir scriptdir
8583 eval $prefixit
8584 case "$scriptdir" in
8585 '')
8586         dflt="$bin"
8587         : guess some guesses
8588         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8589         $test -d /usr/share/bin     && dflt=/usr/share/bin
8590         $test -d /usr/local/script  && dflt=/usr/local/script
8591         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8592         $test -d $prefixexp/script  && dflt=$prefixexp/script
8593         set dflt
8594         eval $prefixup
8595         ;;
8596 *)  dflt="$scriptdir"
8597         ;;
8598 esac
8599 $cat <<EOM
8600  
8601 Some installations have a separate directory just for executable scripts so
8602 that they can mount it across multiple architectures but keep the scripts in
8603 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8604 Or you might just lump your scripts in with all your other executables.
8605  
8606 EOM
8607 fn=d~
8608 rp='Where do you keep publicly executable scripts?'
8609 . ./getfile
8610 if $test "X$ansexp" != "X$scriptdirexp"; then
8611         installscript=''
8612 fi
8613 scriptdir="$ans"
8614 scriptdirexp="$ansexp"
8615 : Change installation prefix, if necessary.
8616 if $test X"$prefix" != X"$installprefix"; then
8617         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8618 else
8619         installscript="$scriptdirexp"
8620 fi
8621
8622 : determine where add-on public executables go
8623 case "$sitebin" in
8624 '')     dflt=$siteprefix/bin ;;
8625 *)      dflt=$sitebin ;;
8626 esac
8627 fn=d~
8628 rp='Pathname where the add-on public executables should be installed?'
8629 . ./getfile
8630 sitebin="$ans"
8631 sitebinexp="$ansexp"
8632 : Change installation prefix, if necessary.
8633 if $test X"$prefix" != X"$installprefix"; then
8634         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8635 else
8636         installsitebin="$sitebinexp"
8637 fi
8638
8639 : determine where add-on html pages go
8640 : There is no standard location, so try to copy the previously-selected
8641 : directory structure for the core html pages.
8642 case "$sitehtml1dir" in
8643 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8644 *)     dflt=$sitehtml1dir ;;
8645 esac
8646 case "$dflt" in
8647 ''|' ') dflt=none ;;
8648 esac
8649 fn=dn+~
8650 rp='Pathname where the site-specific html pages should be installed?'
8651 . ./getfile
8652 sitehtml1dir="$ans"
8653 sitehtml1direxp="$ansexp"
8654 : Change installation prefix, if necessary.
8655 if $test X"$prefix" != X"$installprefix"; then
8656         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8657 else
8658         installsitehtml1dir="$sitehtml1direxp"
8659 fi
8660
8661 : determine where add-on library html pages go
8662 : There is no standard location, so try to copy the previously-selected
8663 : directory structure for the core html pages.
8664 case "$sitehtml3dir" in
8665 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8666 *)     dflt=$sitehtml3dir ;;
8667 esac
8668 case "$dflt" in
8669 ''|' ') dflt=none ;;
8670 esac
8671 fn=dn+~
8672 rp='Pathname where the site-specific library html pages should be installed?'
8673 . ./getfile
8674 sitehtml3dir="$ans"
8675 sitehtml3direxp="$ansexp"
8676 : Change installation prefix, if necessary.
8677 if $test X"$prefix" != X"$installprefix"; then
8678         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8679 else
8680         installsitehtml3dir="$sitehtml3direxp"
8681 fi
8682
8683 : determine where add-on manual pages go
8684 case "$siteman1dir" in
8685 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8686 *)      dflt=$siteman1dir ;;
8687 esac
8688 case "$dflt" in
8689 ''|' ') dflt=none ;;
8690 esac
8691 fn=dn+~
8692 rp='Pathname where the site-specific manual pages should be installed?'
8693 . ./getfile
8694 siteman1dir="$ans"
8695 siteman1direxp="$ansexp"
8696 : Change installation prefix, if necessary.
8697 if $test X"$prefix" != X"$installprefix"; then
8698         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8699 else
8700         installsiteman1dir="$siteman1direxp"
8701 fi
8702
8703 : determine where add-on library man pages go
8704 case "$siteman3dir" in
8705 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8706 *)      dflt=$siteman3dir ;;
8707 esac
8708 case "$dflt" in
8709 ''|' ') dflt=none ;;
8710 esac
8711 fn=dn+~
8712 rp='Pathname where the site-specific library manual pages should be installed?'
8713 . ./getfile
8714 siteman3dir="$ans"
8715 siteman3direxp="$ansexp"
8716 : Change installation prefix, if necessary.
8717 if $test X"$prefix" != X"$installprefix"; then
8718         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8719 else
8720         installsiteman3dir="$siteman3direxp"
8721 fi
8722
8723 : determine where add-on public executable scripts go
8724 case "$sitescript" in
8725 '')     dflt=$siteprefix/script
8726         $test -d $dflt || dflt=$sitebin ;;
8727 *)  dflt="$sitescript" ;;
8728 esac
8729 fn=d~+
8730 rp='Pathname where add-on public executable scripts should be installed?'
8731 . ./getfile
8732 sitescript="$ans"
8733 sitescriptexp="$ansexp"
8734 : Change installation prefix, if necessary.
8735 if $test X"$prefix" != X"$installprefix"; then
8736         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8737 else
8738         installsitescript="$sitescriptexp"
8739 fi
8740
8741 case "$usefaststdio" in
8742 $define|true|[yY]*|'')
8743         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8744         case "$xversion" in
8745         [68])   dflt='y' ;;
8746         *)      dflt='n' ;;
8747         esac
8748         ;;
8749 *) dflt='n';;
8750 esac
8751 cat <<EOM
8752
8753 Perl can be built to use 'fast stdio', which means using the stdio
8754 library but also directly manipulating the stdio buffers to enable
8755 faster I/O.  Using stdio is better for backward compatibility (especially
8756 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8757 interface has been preferred instead of stdio.
8758
8759 If this doesn't make any sense to you, just accept the default '$dflt'.
8760 EOM
8761 rp='Use the "fast stdio" if available?'
8762 . ./myread
8763 case "$ans" in
8764 y|Y)    val="$define" ;;     
8765 *)      val="$undef" ;;
8766 esac
8767 set usefaststdio
8768 eval $setvar
8769
8770
8771 : define an is-a-typedef? function
8772 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8773 case "$inclist" in
8774 "") inclist="sys/types.h";;
8775 esac;
8776 eval "varval=\$$var";
8777 case "$varval" in
8778 "")
8779         $rm -f temp.c;
8780         for inc in $inclist; do
8781                 echo "#include <$inc>" >>temp.c;
8782         done;
8783         echo "#ifdef $type" >> temp.c;
8784         echo "printf(\"We have $type\");" >> temp.c;
8785         echo "#endif" >> temp.c;
8786         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8787         if $contains $type temp.E >/dev/null 2>&1; then
8788                 eval "$var=\$type";
8789         else
8790                 eval "$var=\$def";
8791         fi;
8792         $rm -f temp.?;;
8793 *) eval "$var=\$varval";;
8794 esac'
8795
8796 : define an is-a-typedef? function that prompts if the type is not available.
8797 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8798 case "$inclist" in
8799 "") inclist="sys/types.h";;
8800 esac;
8801 eval "varval=\$$var";
8802 case "$varval" in
8803 "")
8804         $rm -f temp.c;
8805         for inc in $inclist; do
8806                 echo "#include <$inc>" >>temp.c;
8807         done;
8808         echo "#ifdef $type" >> temp.c;
8809         echo "printf(\"We have $type\");" >> temp.c;
8810         echo "#endif" >> temp.c;
8811         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8812         echo " " ;
8813         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8814         if $contains $type temp.E >/dev/null 2>&1; then
8815                 echo "$type found." >&4;
8816                 eval "$var=\$type";
8817         else
8818                 echo "$type NOT found." >&4;
8819                 dflt="$def";
8820                 . ./myread ;
8821                 eval "$var=\$ans";
8822         fi;
8823         $rm -f temp.?;;
8824 *) eval "$var=\$varval";;
8825 esac'
8826
8827 : see what type lseek is declared as in the kernel
8828 rp="What is the type used for lseek's offset on this system?"
8829 set off_t lseektype long stdio.h sys/types.h
8830 eval $typedef_ask
8831
8832 echo " "
8833 echo "Checking to see how big your file offsets are..." >&4
8834 $cat >try.c <<EOCP
8835 #include <sys/types.h>
8836 #include <stdio.h>
8837 int main()
8838 {
8839     printf("%d\n", (int)sizeof($lseektype));
8840     return(0); 
8841 }
8842 EOCP
8843 set try
8844 if eval $compile_ok; then
8845         lseeksize=`$run ./try`
8846         echo "Your file offsets are $lseeksize bytes long."
8847 else
8848         dflt=$longsize
8849         echo " "
8850         echo "(I can't seem to compile the test program.  Guessing...)"
8851         rp="What is the size of your file offsets (in bytes)?"
8852         . ./myread
8853         lseeksize="$ans"
8854 fi
8855 $rm -f try.c try
8856
8857 : see what type file positions are declared as in the library
8858 rp="What is the type for file position used by fsetpos()?"
8859 set fpos_t fpostype long stdio.h sys/types.h
8860 eval $typedef_ask
8861
8862 echo " "
8863 case "$fpostype" in
8864 *_t) zzz="$fpostype"    ;;
8865 *)   zzz="fpos_t"       ;;
8866 esac
8867 echo "Checking the size of $zzz..." >&4 
8868 cat > try.c <<EOCP
8869 #include <sys/types.h>
8870 #include <stdio.h>
8871 #$i_stdlib I_STDLIB
8872 #ifdef I_STDLIB
8873 #include <stdlib.h>
8874 #endif
8875 int main() {
8876     printf("%d\n", (int)sizeof($fpostype));
8877     exit(0);
8878 }
8879 EOCP
8880 set try
8881 if eval $compile_ok; then
8882         yyy=`$run ./try`
8883         case "$yyy" in
8884         '')     fpossize=4
8885                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8886                 ;;
8887         *)      fpossize=$yyy
8888                 echo "Your $zzz is $fpossize bytes long."
8889                 ;;
8890         esac
8891 else
8892         dflt="$longsize"
8893         echo " " >&4
8894         echo "(I can't compile the test program.  Guessing...)" >&4
8895         rp="What is the size of your file positions (in bytes)?"
8896         . ./myread
8897         fpossize="$ans"
8898 fi
8899
8900 # Backward compatibility (uselfs is deprecated).
8901 case "$uselfs" in
8902 "$define"|true|[yY]*)
8903         cat <<EOM >&4
8904
8905 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8906 EOM
8907         uselargefiles="$define"
8908         ;;
8909 esac                          
8910
8911 case "$lseeksize:$fpossize" in
8912 8:8) cat <<EOM
8913
8914 You can have files larger than 2 gigabytes.
8915 EOM
8916    val="$define" ;;
8917 *)    case "$uselargefiles" in
8918    "$undef"|false|[nN]*) dflt='n' ;;
8919    *)   dflt='y' ;;
8920    esac
8921    cat <<EOM
8922
8923 Perl can be built to understand large files (files larger than 2 gigabytes)
8924 on some systems.  To do so, Configure can be run with -Duselargefiles.
8925
8926 If this doesn't make any sense to you, just accept the default '$dflt'.
8927 EOM
8928    rp='Try to understand large files, if available?'
8929    . ./myread
8930    case "$ans" in
8931    y|Y)         val="$define" ;;
8932    *)           val="$undef"  ;;
8933    esac
8934    ;;
8935 esac
8936 set uselargefiles
8937 eval $setvar
8938 : Look for a hint-file generated 'call-back-unit'.  If the
8939 : user has specified that a large files perl is to be built,
8940 : we may need to set or change some other defaults.
8941 if $test -f uselargefiles.cbu; then
8942         echo "Your platform has some specific hints regarding large file builds, using them..."
8943         . ./uselargefiles.cbu
8944 fi
8945 case "$uselargefiles" in
8946 "$define")
8947         if $test -f uselargefiles.cbu; then
8948                 echo " "
8949                 echo "Rechecking to see how big your file offsets are..." >&4
8950                 $cat >try.c <<EOCP
8951 #include <sys/types.h>
8952 #include <stdio.h>
8953 int main()
8954 {
8955     printf("%d\n", (int)sizeof($lseektype));
8956     return(0); 
8957 }
8958 EOCP
8959                 set try
8960                 if eval $compile_ok; then
8961                         lseeksize=`$run ./try`
8962                         $echo "Your file offsets are now $lseeksize bytes long."
8963                 else
8964                         dflt="$lseeksize"
8965                         echo " "
8966                         echo "(I can't seem to compile the test program.  Guessing...)"
8967                         rp="What is the size of your file offsets (in bytes)?"
8968                         . ./myread
8969                         lseeksize="$ans"
8970                 fi
8971                 case "$fpostype" in
8972                 *_t) zzz="$fpostype"    ;;
8973                 *)   zzz="fpos_t"       ;;
8974                 esac
8975                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8976                 $cat > try.c <<EOCP
8977 #include <sys/types.h>
8978 #include <stdio.h>
8979 #$i_stdlib I_STDLIB
8980 #ifdef I_STDLIB
8981 #include <stdlib.h>
8982 #endif
8983 int main() {
8984     printf("%d\n", (int)sizeof($fpostype));
8985     return(0);
8986 }
8987 EOCP
8988                 set try
8989                 if eval $compile_ok; then
8990                         yyy=`$run ./try`
8991                         dflt="$lseeksize"
8992                         case "$yyy" in
8993                         '')     echo " "
8994                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8995                                 ;;
8996                         *)      fpossize=$yyy
8997                                 echo " $fpossize bytes." >&4
8998                                 ;;
8999                         esac
9000                 else
9001                         dflt="$fpossize"
9002                         echo " "
9003                         echo "(I can't compile the test program.  Guessing...)" >&4
9004                         rp="What is the size of your file positions (in bytes)?"
9005                         . ./myread
9006                         fpossize="$ans"
9007                 fi
9008                 $rm -f try.c try
9009         fi
9010         ;;
9011 esac
9012
9013 # probably will refer to
9014 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9015 need_relocation=0
9016 userelocatableinc=undef
9017
9018 case "$vendorprefix" in
9019 '')     d_vendorbin="$undef"
9020         vendorbin=''
9021         vendorbinexp=''
9022         ;;
9023 *)      d_vendorbin="$define"
9024         : determine where vendor-supplied executables go.
9025         case "$vendorbin" in
9026         '') dflt=$vendorprefix/bin ;;
9027         *)      dflt="$vendorbin" ;;
9028         esac
9029         fn=d~+
9030         rp='Pathname for the vendor-supplied executables directory?'
9031         . ./getfile
9032         vendorbin="$ans"
9033         vendorbinexp="$ansexp"
9034         ;;
9035 esac
9036 : Change installation prefix, if necessary.
9037 if $test X"$prefix" != X"$installprefix"; then
9038         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9039 else
9040         installvendorbin="$vendorbinexp"
9041 fi
9042
9043 case "$vendorprefix" in
9044 '')     vendorhtml1dir=''
9045         vendorhtml1direxp=''
9046         ;;
9047 *)      : determine where vendor-supplied html pages go.
9048         : There is no standard location, so try to copy the previously-selected
9049         : directory structure for the core html pages.
9050         : XXX Better default suggestions would be welcome.
9051         case "$vendorhtml1dir" in
9052         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9053         *)      dflt=$vendorhtml1dir ;;
9054         esac
9055         case "$dflt" in
9056         ''|' ') dflt=none ;;
9057         esac
9058         fn=dn+~
9059         rp='Pathname for the vendor-supplied html pages?'
9060         . ./getfile
9061         vendorhtml1dir="$ans"
9062         vendorhtml1direxp="$ansexp"
9063         ;;
9064 esac
9065 : Use ' ' for none so value is preserved next time through Configure
9066 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9067 : Change installation prefix, if necessary.
9068 if $test X"$prefix" != X"$installprefix"; then
9069         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9070 else
9071         installvendorhtml1dir="$vendorhtml1direxp"
9072 fi
9073
9074 case "$vendorprefix" in
9075 '')     vendorhtml3dir=''
9076         vendorhtml3direxp=''
9077         ;;
9078 *)      : determine where vendor-supplied module html pages go.
9079         : There is no standard location, so try to copy the previously-selected
9080         : directory structure for the core html pages.
9081         : XXX Better default suggestions would be welcome.
9082         case "$vendorhtml3dir" in
9083         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9084         *)      dflt=$vendorhtml3dir ;;
9085         esac
9086         case "$dflt" in
9087         ''|' ') dflt=none ;;
9088         esac
9089         fn=dn+~
9090         rp='Pathname for the vendor-supplied html pages?'
9091         . ./getfile
9092         vendorhtml3dir="$ans"
9093         vendorhtml3direxp="$ansexp"
9094         ;;
9095 esac
9096 : Use ' ' for none so value is preserved next time through Configure
9097 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9098 : Change installation prefix, if necessary.
9099 if $test X"$prefix" != X"$installprefix"; then
9100         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9101 else
9102         installvendorhtml3dir="$vendorhtml3direxp"
9103 fi
9104
9105 case "$vendorprefix" in
9106 '')     vendorman1dir=''
9107         vendorman1direxp=''
9108         ;;
9109 *)      : determine where vendor-supplied manual pages go.
9110         case "$vendorman1dir" in
9111         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9112         *)      dflt=$vendorman1dir ;;
9113         esac
9114         case "$dflt" in
9115         ''|' ') dflt=none ;;
9116         esac
9117         fn=nd~+
9118         rp='Pathname for the vendor-supplied manual section 1 pages?'
9119         . ./getfile
9120         vendorman1dir="$ans"
9121         vendorman1direxp="$ansexp"
9122         ;;
9123 esac
9124 : Use ' ' for none so value is preserved next time through Configure
9125 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9126 : Change installation prefix, if necessary.
9127 if $test X"$prefix" != X"$installprefix"; then
9128         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9129 else
9130         installvendorman1dir="$vendorman1direxp"
9131 fi
9132
9133 case "$vendorprefix" in
9134 '')     vendorman3dir=''
9135         vendorman3direxp=''
9136         ;;
9137 *)      : determine where vendor-supplied module manual pages go.
9138         case "$vendorman3dir" in
9139         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9140         *)      dflt=$vendorman3dir ;;
9141         esac
9142         case "$dflt" in
9143         ''|' ') dflt=none ;;
9144         esac
9145         fn=nd~+
9146         rp='Pathname for the vendor-supplied manual section 3 pages?'
9147         . ./getfile
9148         vendorman3dir="$ans"
9149         vendorman3direxp="$ansexp"
9150         ;;
9151 esac
9152 : Use ' ' for none so value is preserved next time through Configure
9153 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9154 : Change installation prefix, if necessary.
9155 if $test X"$prefix" != X"$installprefix"; then
9156         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9157 else
9158         installvendorman3dir="$vendorman3direxp"
9159 fi
9160
9161 case "$vendorprefix" in
9162 '')     d_vendorscript="$undef"
9163         vendorscript=''
9164         vendorscriptexp=''
9165         ;;
9166 *)      d_vendorscript="$define"
9167         : determine where vendor-supplied scripts go.
9168         case "$vendorscript" in
9169         '')     dflt=$vendorprefix/script
9170                 $test -d $dflt || dflt=$vendorbin ;;
9171         *)  dflt="$vendorscript" ;;
9172         esac
9173         $cat <<EOM
9174
9175 The installation process will create a directory for 
9176 vendor-supplied scripts.
9177
9178 EOM
9179         fn=d~+
9180         rp='Pathname for the vendor-supplied scripts directory?'
9181         . ./getfile
9182         vendorscript="$ans"
9183         vendorscriptexp="$ansexp"
9184         ;;
9185 esac
9186 : Change installation prefix, if necessary.
9187 if $test X"$prefix" != X"$installprefix"; then
9188         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9189 else
9190         installvendorscript="$vendorscriptexp"
9191 fi
9192
9193 : see if qgcvt exists
9194 set qgcvt d_qgcvt
9195 eval $inlibc
9196
9197 echo " "
9198
9199 if $test X"$d_longdbl" = X"$define"; then
9200
9201 echo "Checking how to print long doubles..." >&4
9202
9203 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9204         $cat >try.c <<'EOCP'
9205 #include <sys/types.h>
9206 #include <stdio.h>
9207 int main() {
9208   double d = 123.456;
9209   printf("%.3f\n", d);
9210 }
9211 EOCP
9212         set try
9213         if eval $compile; then
9214                 yyy=`$run ./try`
9215                 case "$yyy" in
9216                 123.456)
9217                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9218                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9219                         echo "We will use %f."
9220                         ;;
9221                 esac
9222         fi
9223 fi
9224
9225 if $test X"$sPRIfldbl" = X; then
9226         $cat >try.c <<'EOCP'
9227 #include <sys/types.h>
9228 #include <stdio.h>
9229 int main() {
9230   long double d = 123.456;
9231   printf("%.3Lf\n", d);
9232 }
9233 EOCP
9234         set try
9235         if eval $compile; then
9236                 yyy=`$run ./try`
9237                 case "$yyy" in
9238                 123.456)
9239                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9240                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9241                         echo "We will use %Lf."
9242                         ;;
9243                 esac
9244         fi
9245 fi
9246
9247 if $test X"$sPRIfldbl" = X; then
9248         $cat >try.c <<'EOCP'
9249 #include <sys/types.h>
9250 #include <stdio.h>
9251 int main() {
9252   long double d = 123.456;
9253   printf("%.3llf\n", d);
9254 }
9255 EOCP
9256         set try
9257         if eval $compile; then
9258                 yyy=`$run ./try`
9259                 case "$yyy" in
9260                 123.456)
9261                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9262                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9263                         echo "We will use %llf."
9264                         ;;
9265                 esac
9266         fi
9267 fi
9268
9269 if $test X"$sPRIfldbl" = X; then
9270         $cat >try.c <<'EOCP'
9271 #include <sys/types.h>
9272 #include <stdio.h>
9273 int main() {
9274   long double d = 123.456;
9275   printf("%.3lf\n", d);
9276 }
9277 EOCP
9278         set try
9279         if eval $compile; then
9280                 yyy=`$run ./try`
9281                 case "$yyy" in
9282                 123.456)
9283                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9284                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9285                         echo "We will use %lf."
9286                         ;;
9287                 esac
9288         fi
9289 fi
9290
9291 if $test X"$sPRIfldbl" = X; then
9292         echo "Cannot figure out how to print long doubles." >&4
9293 else
9294         sSCNfldbl=$sPRIfldbl    # expect consistency
9295 fi
9296
9297 $rm -f try try.*
9298
9299 fi # d_longdbl
9300
9301 case "$sPRIfldbl" in
9302 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9303         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9304         d_SCNfldbl="$undef";
9305         ;;
9306 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9307         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9308         d_SCNfldbl="$define";
9309         ;;
9310 esac
9311
9312 : Check how to convert floats to strings.
9313
9314 if test "X$d_Gconvert" = X; then
9315
9316 echo " "
9317 echo "Checking for an efficient way to convert floats to strings."
9318 echo " " > try.c
9319 case "$uselongdouble" in
9320 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9321 esac
9322 case "$d_longdbl" in
9323 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9324 esac
9325 case "$d_PRIgldbl" in
9326 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9327 esac
9328 $cat >>try.c <<EOP
9329 #ifdef TRY_gconvert
9330 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9331 char *myname = "gconvert";
9332 #endif
9333 #ifdef TRY_gcvt
9334 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9335 char *myname = "gcvt";
9336 #endif
9337 #ifdef TRY_qgcvt
9338 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9339 char *myname = "qgcvt";
9340 #define DOUBLETYPE long double
9341 #endif
9342 #ifdef TRY_sprintf
9343 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9344 #ifdef HAS_PRIgldbl
9345 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9346 #else
9347 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9348 #endif
9349 #else
9350 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9351 #endif
9352 char *myname = "sprintf";
9353 #endif
9354
9355 #ifndef DOUBLETYPE
9356 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9357 #define DOUBLETYPE long double
9358 #else
9359 #define DOUBLETYPE double
9360 #endif
9361 #endif
9362
9363 #include <stdio.h>
9364
9365 #define I_STDLIB $i_stdlib
9366 #ifdef I_STDLIB
9367 #include <stdlib.h>
9368 #endif
9369
9370 int
9371 checkit(expect, got)
9372 char *expect;
9373 char *got;
9374 {
9375     if (strcmp(expect, got)) {
9376                 printf("%s oddity:  Expected %s, got %s\n",
9377                         myname, expect, got);
9378                 exit(1);
9379         }
9380 }
9381
9382 int main()
9383
9384         char buf[64]; 
9385         buf[63] = '\0';
9386
9387         /* This must be 1st test on (which?) platform */
9388         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9389         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9390         checkit("0.1", buf);
9391
9392         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9393         checkit("0.01", buf);
9394
9395         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9396         checkit("0.001", buf);
9397
9398         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9399         checkit("0.0001", buf);
9400
9401         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9402         if (strlen(buf) > 5)
9403             checkit("9e-005", buf); /* for Microsoft ?? */
9404         else
9405             checkit("9e-05", buf);
9406
9407         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9408         checkit("1", buf);
9409
9410         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9411         checkit("1.1", buf);
9412
9413         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9414         checkit("1.01", buf);
9415
9416         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9417         checkit("1.001", buf);
9418
9419         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9420         checkit("1.0001", buf);
9421
9422         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9423         checkit("1.00001", buf);
9424
9425         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9426         checkit("1.000001", buf);
9427
9428         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9429         checkit("0", buf);
9430
9431         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9432         checkit("-1", buf);
9433
9434         /* Some Linux gcvt's give 1.e+5 here. */
9435         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9436         checkit("100000", buf);
9437         
9438         /* Some Linux gcvt's give -1.e+5 here. */
9439         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9440         checkit("-100000", buf);
9441
9442         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9443         checkit("123.456", buf);
9444
9445         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9446         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9447         /* 34 should be enough to scare even long double
9448          * places into using the e notation. */
9449         if (strlen(buf) > 5)
9450             checkit("1e+034", buf); /* for Microsoft */
9451         else
9452             checkit("1e+34", buf);
9453
9454         /* For Perl, if you add additional tests here, also add them to
9455          * t/base/num.t for benefit of platforms not using Configure or
9456          * overriding d_Gconvert */
9457
9458         exit(0);
9459 }
9460 EOP
9461 : first add preferred functions to our list
9462 xxx_list=""
9463 for xxx_convert in $gconvert_preference; do
9464     case $xxx_convert in
9465     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9466     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9467     esac 
9468 done
9469 : then add any others
9470 for xxx_convert in gconvert gcvt sprintf; do
9471     case "$xxx_list" in
9472     *$xxx_convert*) ;;
9473     *) xxx_list="$xxx_list $xxx_convert" ;;
9474     esac 
9475 done
9476
9477 case "$d_longdbl$uselongdouble" in
9478 "$define$define")
9479     : again, add prefered functions to our list first
9480     xxx_ld_list=""
9481     for xxx_convert in $gconvert_ld_preference; do
9482         case $xxx_convert in
9483         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9484         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9485         esac
9486     done
9487     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9488     for xxx_convert in qgcvt sprintf $xxx_list; do
9489         case "$xxx_ld_list" in
9490         $xxx_convert*|*" $xxx_convert"*) ;;
9491         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9492         esac
9493     done
9494     : if sprintf cannot do long doubles, move it to the end
9495     if test "$d_PRIgldbl" != "$define"; then
9496         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9497     fi
9498     : if no qgcvt, remove it
9499     if test "$d_qgcvt" != "$define"; then
9500         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9501     fi
9502     : use the ld_list
9503     xxx_list="$xxx_ld_list"
9504     ;;
9505 esac
9506
9507 for xxx_convert in $xxx_list; do
9508         echo "Trying $xxx_convert..."
9509         $rm -f try try$_o
9510         set try -DTRY_$xxx_convert
9511         if eval $compile; then
9512                 echo "$xxx_convert() found." >&4
9513                 if $run ./try; then
9514                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9515                         break;
9516                 else
9517                         echo "...But $xxx_convert didn't work as I expected."
9518                         xxx_convert=''
9519                 fi
9520         else
9521                 echo "$xxx_convert NOT found." >&4
9522         fi
9523 done
9524
9525 if test X$xxx_convert = X; then
9526     echo "*** WHOA THERE!!! ***" >&4
9527     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9528     xxx_convert=sprintf
9529 fi
9530
9531 case "$xxx_convert" in
9532 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9533 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9534 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9535 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9536    "$define$define$define")
9537       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9538    "$define$define$undef")
9539       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9540    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9541    esac
9542    ;;  
9543 esac
9544
9545 fi
9546
9547 : see if _fwalk exists
9548 set fwalk d__fwalk
9549 eval $inlibc
9550
9551 : Initialize h_fcntl
9552 h_fcntl=false
9553
9554 : Initialize h_sysfile
9555 h_sysfile=false
9556
9557 : access call always available on UNIX
9558 set access d_access
9559 eval $inlibc
9560
9561 : locate the flags for 'access()'
9562 case "$d_access" in
9563 "$define")
9564         echo " "
9565         $cat >access.c <<EOCP
9566 #include <sys/types.h>
9567 #ifdef I_FCNTL
9568 #include <fcntl.h>
9569 #endif
9570 #ifdef I_SYS_FILE
9571 #include <sys/file.h>
9572 #endif
9573 #ifdef I_UNISTD
9574 #include <unistd.h>
9575 #endif
9576 #$i_stdlib I_STDLIB
9577 #ifdef I_STDLIB
9578 #include <stdlib.h>
9579 #endif
9580 int main() {
9581         exit(R_OK);
9582 }
9583 EOCP
9584         : check sys/file.h first, no particular reason here
9585         if $test `./findhdr sys/file.h` && \
9586                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9587                 h_sysfile=true;
9588                 echo "<sys/file.h> defines the *_OK access constants." >&4
9589         elif $test `./findhdr fcntl.h` && \
9590                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9591                 h_fcntl=true;
9592                 echo "<fcntl.h> defines the *_OK access constants." >&4
9593         elif $test `./findhdr unistd.h` && \
9594                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9595                 echo "<unistd.h> defines the *_OK access constants." >&4
9596         else
9597                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9598         fi
9599         ;;
9600 esac
9601 $rm -f access*
9602
9603 : see if accessx exists
9604 set accessx d_accessx
9605 eval $inlibc
9606
9607 : see if aintl exists
9608 set aintl d_aintl
9609 eval $inlibc
9610
9611 : see if alarm exists
9612 set alarm d_alarm
9613 eval $inlibc
9614
9615 : see if POSIX threads are available
9616 set pthread.h i_pthread
9617 eval $inhdr
9618
9619 : define a fucntion to check prototypes
9620 $cat > protochk <<EOSH
9621 $startsh
9622 cc="$cc"
9623 optimize="$optimize"
9624 ccflags="$ccflags"
9625 prototype="$prototype"
9626 define="$define"
9627 rm=$rm
9628 usethreads=$usethreads
9629 i_pthread=$i_pthread
9630 pthread_h_first=$pthread_h_first
9631 EOSH
9632
9633 $cat >> protochk <<'EOSH'
9634
9635 $rm -f try.c
9636 foo="$1"
9637 shift
9638 while test $# -ge 2; do
9639         case "$1" in
9640                 $define) echo "#include <$2>" >> try.c ;;
9641                 literal) echo "$2" >> try.c ;;
9642         esac
9643     # Extra magic for the benefit of systems that need pthread.h
9644     # to be included early to correctly detect threadsafe functions.
9645     # Such functions must guarantee themselves, though, that the usethreads
9646     # and i_pthread have been defined, before calling protochk.
9647     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9648         echo "#include <pthread.h>" >> try.c
9649         pthread_h_done=yes
9650     fi
9651     shift 2
9652 done
9653 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9654 cat >> try.c <<'EOCP'
9655 #ifdef CAN_PROTOTYPE
9656 #define _(args) args
9657 #else
9658 #define _(args) ()
9659 #endif
9660 EOCP
9661 echo "$foo" >> try.c
9662 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9663 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9664 status=$?
9665 $rm -f try.[co]
9666 exit $status
9667 EOSH
9668 chmod +x protochk
9669 $eunicefix protochk
9670
9671 hasproto='varname=$1; func=$2; shift; shift;
9672 while $test $# -ge 2; do
9673         case "$1" in
9674         $define) echo "#include <$2>";;
9675         esac ;
9676     shift 2;
9677 done > try.c;
9678 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9679 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9680         echo "$func() prototype found.";
9681         val="$define";
9682 else
9683         echo "$func() prototype NOT found.";
9684         val="$undef";
9685 fi;
9686 set $varname;
9687 eval $setvar;
9688 $rm -f try.c tryout.c'
9689
9690 : see if sys/types.h has to be included
9691 set sys/types.h i_systypes
9692 eval $inhdr
9693
9694 : see if sys/select.h has to be included
9695 set sys/select.h i_sysselct
9696 eval $inhdr
9697
9698 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9699 while $test $# -ge 2; do
9700         case "$1" in
9701         $define) echo "#include <$2>";;
9702         esac ;
9703     shift 2;
9704 done > try.c;
9705 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9706 set try;
9707 if eval $compile; then
9708         val="$define";
9709 else
9710         val="$undef";
9711 fi;
9712 set $varname;
9713 eval $setvar;
9714 $rm -f try.c try.o'
9715
9716 : see if we should include time.h, sys/time.h, or both
9717 echo " "
9718 if test "X$timeincl" = X; then
9719         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9720         $echo $n "I'm now running the test program...$c"
9721         $cat >try.c <<EOCP
9722 #include <sys/types.h>
9723 #ifdef I_TIME
9724 #include <time.h>
9725 #endif
9726 #ifdef I_SYSTIME
9727 #ifdef SYSTIMEKERNEL
9728 #define KERNEL
9729 #endif
9730 #include <sys/time.h>
9731 #endif
9732 #ifdef I_SYSSELECT
9733 #include <sys/select.h>
9734 #endif
9735 #$i_stdlib I_STDLIB
9736 #ifdef I_STDLIB
9737 #include <stdlib.h>
9738 #endif
9739 int main()
9740 {
9741         struct tm foo;
9742 #ifdef S_TIMEVAL
9743         struct timeval bar;
9744 #endif
9745 #ifdef S_TIMEZONE
9746         struct timezone tzp;
9747 #endif
9748         if (foo.tm_sec == foo.tm_sec)
9749                 exit(0);
9750 #ifdef S_TIMEVAL
9751         if (bar.tv_sec == bar.tv_sec)
9752                 exit(0);
9753 #endif
9754         exit(1);
9755 }
9756 EOCP
9757         flags=''
9758         for s_timezone in '-DS_TIMEZONE' ''; do
9759         sysselect=''
9760         for s_timeval in '-DS_TIMEVAL' ''; do
9761         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9762         for i_time in '' '-DI_TIME'; do
9763         for i_systime in '-DI_SYSTIME' ''; do
9764                 case "$flags" in
9765                 '') $echo $n ".$c"
9766                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9767                         if eval $compile; then
9768                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9769                                 shift
9770                                 flags="$*"
9771                                 echo " "
9772                                 $echo $n "Succeeded with $flags$c"
9773                         fi
9774                         ;;
9775                 esac
9776         done
9777         done
9778         done
9779         done
9780         done
9781         timeincl=''
9782         echo " "
9783         case "$flags" in
9784         *SYSTIMEKERNEL*) i_systimek="$define"
9785                 timeincl=`./findhdr sys/time.h`
9786                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9787         *) i_systimek="$undef";;
9788         esac
9789         case "$flags" in
9790         *I_TIME*) i_time="$define"
9791                 timeincl=`./findhdr time.h`" $timeincl"
9792                 echo "We'll include <time.h>." >&4;;
9793         *) i_time="$undef";;
9794         esac
9795         case "$flags" in
9796         *I_SYSTIME*) i_systime="$define"
9797                 timeincl=`./findhdr sys/time.h`" $timeincl"
9798                 echo "We'll include <sys/time.h>." >&4;;
9799         *) i_systime="$undef";;
9800         esac
9801         $rm -f try.c try
9802 fi
9803 : see if struct tm knows about tm_zone
9804 case "$i_systime$i_time" in
9805 *$define*) 
9806         echo " "
9807         echo "Checking to see if your struct tm has tm_zone field..." >&4
9808         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9809         eval $hasfield
9810         ;;
9811 *)      val="$undef"
9812         set d_tm_tm_zone
9813         eval $setvar
9814         ;;
9815 esac
9816 case "$d_tm_tm_zone" in
9817 "$define")      echo "Yes, it does."   ;;
9818 *)              echo "No, it doesn't." ;;
9819 esac
9820 : see if struct tm knows about tm_gmtoff
9821 case "$i_systime$i_time" in
9822 *$define*) 
9823         echo " "
9824         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9825         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9826         eval $hasfield
9827         ;;
9828 *)      val="$undef"
9829         set d_tm_tm_gmtoff
9830         eval $setvar
9831         ;;
9832 esac
9833 case "$d_tm_tm_gmtoff" in
9834 "$define")      echo "Yes, it does."   ;;
9835 *)              echo "No, it doesn't." ;;
9836 esac
9837
9838 : see if asctime_r exists
9839 set asctime_r d_asctime_r
9840 eval $inlibc
9841 case "$d_asctime_r" in
9842 "$define")
9843         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9844         case "$d_asctime_r_proto:$usethreads" in
9845         ":define")      d_asctime_r_proto=define
9846                 set d_asctime_r_proto asctime_r $hdrs
9847                 eval $hasproto ;;
9848         *)      ;;
9849         esac
9850         case "$d_asctime_r_proto" in
9851         define)
9852         case "$asctime_r_proto" in
9853         ''|0) try='char* asctime_r(const struct tm*, char*);'
9854         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9855         esac
9856         case "$asctime_r_proto" in
9857         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9858         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9859         esac
9860         case "$asctime_r_proto" in
9861         ''|0) try='int asctime_r(const struct tm*, char*);'
9862         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9863         esac
9864         case "$asctime_r_proto" in
9865         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9866         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9867         esac
9868         case "$asctime_r_proto" in
9869         ''|0)   d_asctime_r=undef
9870                 asctime_r_proto=0
9871                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9872         * )     case "$asctime_r_proto" in
9873                 REENTRANT_PROTO*) ;;
9874                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9875                 esac
9876                 echo "Prototype: $try" ;;
9877         esac
9878         ;;
9879         *)      case "$usethreads" in
9880                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9881                 esac
9882                 d_asctime_r=undef
9883                 asctime_r_proto=0
9884                 ;;
9885         esac
9886         ;;
9887 *)      asctime_r_proto=0
9888         ;;
9889 esac
9890
9891 : see if atolf exists
9892 set atolf d_atolf
9893 eval $inlibc
9894
9895 : see if atoll exists
9896 set atoll d_atoll
9897 eval $inlibc
9898
9899 : Look for GCC-style attribute format
9900 case "$d_attribute_format" in
9901 '')
9902 echo " "
9903 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9904 $cat >attrib.c <<'EOCP'
9905 #include <stdio.h>
9906 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9907 EOCP
9908 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9909         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9910                 echo "Your C compiler doesn't support __attribute__((format))."
9911                 val="$undef"
9912         else
9913                 echo "Your C compiler supports __attribute__((format))."
9914                 val="$define"
9915         fi
9916 else
9917         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9918         val="$undef"
9919 fi
9920 ;;
9921 *) val="$d_attribute_format" ;;
9922 esac
9923 set d_attribute_format
9924 eval $setvar
9925 $rm -f attrib*
9926
9927 : Look for GCC-style attribute malloc
9928 case "$d_attribute_malloc" in
9929 '')
9930 echo " "
9931 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9932 $cat >attrib.c <<'EOCP'
9933 #include <stdio.h>
9934 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9935 EOCP
9936 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9937         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9938                 echo "Your C compiler doesn't support __attribute__((malloc))."
9939                 val="$undef"
9940         else
9941                 echo "Your C compiler supports __attribute__((malloc))."
9942                 val="$define"
9943         fi
9944 else
9945         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9946         val="$undef"
9947 fi
9948 ;;
9949 *) val="$d_attribute_malloc" ;;
9950 esac
9951 set d_attribute_malloc
9952 eval $setvar
9953 $rm -f attrib*
9954
9955 : Look for GCC-style attribute nonnull
9956 case "$d_attribute_nonnull" in
9957 '')
9958 echo " "
9959 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9960 $cat >attrib.c <<'EOCP'
9961 #include <stdio.h>
9962 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9963 EOCP
9964 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9965         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9966                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9967                 val="$undef"
9968         else
9969                 echo "Your C compiler supports __attribute__((nonnull))."
9970                 val="$define"
9971         fi
9972 else
9973         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9974         val="$undef"
9975 fi
9976 ;;
9977 *) val="$d_attribute_nonnull" ;;
9978 esac
9979 set d_attribute_nonnull
9980 eval $setvar
9981 $rm -f attrib*
9982
9983 : Look for GCC-style attribute noreturn
9984 case "$d_attribute_noreturn" in
9985 '')
9986 echo " "
9987 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9988 $cat >attrib.c <<'EOCP'
9989 #include <stdio.h>
9990 void fall_over_dead( void ) __attribute__((noreturn));
9991 EOCP
9992 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9993         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9994                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9995                 val="$undef"
9996         else
9997                 echo "Your C compiler supports __attribute__((noreturn))."
9998                 val="$define"
9999         fi
10000 else
10001         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10002         val="$undef"
10003 fi
10004 ;;
10005 *) val="$d_attribute_noreturn" ;;
10006 esac
10007 set d_attribute_noreturn
10008 eval $setvar
10009 $rm -f attrib*
10010
10011 : Look for GCC-style attribute pure
10012 case "$d_attribute_pure" in
10013 '')
10014 echo " "
10015 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10016 $cat >attrib.c <<'EOCP'
10017 #include <stdio.h>
10018 int square( int n ) __attribute__((pure));
10019 EOCP
10020 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10021         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10022                 echo "Your C compiler doesn't support __attribute__((pure))."
10023                 val="$undef"
10024         else
10025                 echo "Your C compiler supports __attribute__((pure))."
10026                 val="$define"
10027         fi
10028 else
10029         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10030         val="$undef"
10031 fi
10032 ;;
10033 *) val="$d_attribute_pure" ;;
10034 esac
10035 set d_attribute_pure
10036 eval $setvar
10037 $rm -f attrib*
10038
10039 : Look for GCC-style attribute unused
10040 case "$d_attribute_unused" in
10041 '')
10042 echo " "
10043 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10044 $cat >attrib.c <<'EOCP'
10045 #include <stdio.h>
10046 int do_something( int dummy __attribute__((unused)), int n );
10047 EOCP
10048 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10049         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10050                 echo "Your C compiler doesn't support __attribute__((unused))."
10051                 val="$undef"
10052         else
10053                 echo "Your C compiler supports __attribute__((unused))."
10054                 val="$define"
10055         fi
10056 else
10057         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10058         val="$undef"
10059 fi
10060 ;;
10061 *) val="$d_attribute_unused" ;;
10062 esac
10063 set d_attribute_unused
10064 eval $setvar
10065 $rm -f attrib*
10066
10067 : Look for GCC-style attribute warn_unused_result
10068 case "$d_attribute_warn_unused_result" in
10069 '')
10070 echo " "
10071 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10072 $cat >attrib.c <<'EOCP'
10073 #include <stdio.h>
10074 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10075 EOCP
10076 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10077         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10078                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10079                 val="$undef"
10080         else
10081                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10082                 val="$define"
10083         fi
10084 else
10085         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10086         val="$undef"
10087 fi
10088 ;;
10089 *) val="$d_attribute_warn_unused_result" ;;
10090 esac
10091 set d_attribute_warn_unused_result
10092 eval $setvar
10093 $rm -f attrib*
10094
10095 : see if bcmp exists
10096 set bcmp d_bcmp
10097 eval $inlibc
10098
10099 : see if bcopy exists
10100 set bcopy d_bcopy
10101 eval $inlibc
10102
10103 : see if this is a unistd.h system
10104 set unistd.h i_unistd
10105 eval $inhdr
10106
10107 : see if getpgrp exists
10108 set getpgrp d_getpgrp
10109 eval $inlibc
10110
10111 case "$d_getpgrp" in
10112 "$define")
10113         echo " "
10114         echo "Checking to see which flavor of getpgrp is in use..."
10115         $cat >try.c <<EOP
10116 #$i_unistd I_UNISTD
10117 #include <sys/types.h>
10118 #ifdef I_UNISTD
10119 #  include <unistd.h>
10120 #endif
10121 #$i_stdlib I_STDLIB
10122 #ifdef I_STDLIB
10123 #include <stdlib.h>
10124 #endif
10125 int main()
10126 {
10127         if (getuid() == 0) {
10128                 printf("(I see you are running Configure as super-user...)\n");
10129                 setuid(1);
10130         }
10131 #ifdef TRY_BSD_PGRP
10132         if (getpgrp(1) == 0)
10133                 exit(0);
10134 #else
10135         if (getpgrp() > 0)
10136                 exit(0);
10137 #endif
10138         exit(1);
10139 }
10140 EOP
10141         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10142                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10143                 val="$define"
10144         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10145                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10146                 val="$undef"
10147         else
10148                 echo "I can't seem to compile and run the test program."
10149                 if ./usg; then
10150                         xxx="a USG one, i.e. you use getpgrp()."
10151                 else
10152                         # SVR4 systems can appear rather BSD-ish.
10153                         case "$i_unistd" in
10154                         $undef)
10155                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10156                                 val="$define"
10157                                 ;;
10158                         $define)
10159                                 xxx="probably a USG one, i.e. you use getpgrp()."
10160                                 val="$undef"
10161                                 ;;
10162                         esac
10163                 fi
10164                 echo "Assuming your getpgrp is $xxx" >&4
10165         fi
10166         ;;
10167 *) val="$undef";;
10168 esac
10169 set d_bsdgetpgrp
10170 eval $setvar
10171 $rm -f try try.*
10172
10173 : see if setpgrp exists
10174 set setpgrp d_setpgrp
10175 eval $inlibc
10176
10177 case "$d_setpgrp" in
10178 "$define")
10179         echo " "
10180         echo "Checking to see which flavor of setpgrp is in use..."
10181         $cat >try.c <<EOP
10182 #$i_unistd I_UNISTD
10183 #include <sys/types.h>
10184 #ifdef I_UNISTD
10185 #  include <unistd.h>
10186 #endif
10187 #$i_stdlib I_STDLIB
10188 #ifdef I_STDLIB
10189 #include <stdlib.h>
10190 #endif
10191 int main()
10192 {
10193         if (getuid() == 0) {
10194                 printf("(I see you are running Configure as super-user...)\n");
10195                 setuid(1);
10196         }
10197 #ifdef TRY_BSD_PGRP
10198         if (-1 == setpgrp(1, 1))
10199                 exit(0);
10200 #else
10201         if (setpgrp() != -1)
10202                 exit(0);
10203 #endif
10204         exit(1);
10205 }
10206 EOP
10207         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10208                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10209                 val="$define"
10210         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10211                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10212                 val="$undef"
10213         else
10214                 echo "(I can't seem to compile and run the test program.)"
10215                 if ./usg; then
10216                         xxx="a USG one, i.e. you use setpgrp()."
10217                 else
10218                         # SVR4 systems can appear rather BSD-ish.
10219                         case "$i_unistd" in
10220                         $undef)
10221                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10222                                 val="$define"
10223                                 ;;
10224                         $define)
10225                                 xxx="probably a USG one, i.e. you use setpgrp()."
10226                                 val="$undef"
10227                                 ;;
10228                         esac
10229                 fi
10230                 echo "Assuming your setpgrp is $xxx" >&4
10231         fi
10232         ;;
10233 *) val="$undef";;
10234 esac
10235 set d_bsdsetpgrp
10236 eval $setvar
10237 $rm -f try try.*
10238 : see if bzero exists
10239 set bzero d_bzero
10240 eval $inlibc
10241
10242 : see if signal is declared as pointer to function returning int or void
10243 echo " "
10244 xxx=`./findhdr signal.h`
10245 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10246 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10247         echo "You have int (*signal())() instead of void." >&4
10248         val="$undef"
10249 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10250         echo "You have void (*signal())()." >&4
10251         val="$define"
10252 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10253         echo "You have int (*signal())() instead of void." >&4
10254         val="$undef"
10255 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10256         echo "You have void (*signal())()." >&4
10257         val="$define"
10258 else
10259         case "$d_voidsig" in
10260         '')
10261         echo "I can't determine whether signal handler returns void or int..." >&4
10262                 dflt=void
10263                 rp="What type does your signal handler return?"
10264                 . ./myread
10265                 case "$ans" in
10266                 v*) val="$define";;
10267                 *) val="$undef";;
10268                 esac;;
10269         "$define")
10270                 echo "As you already told me, signal handler returns void." >&4
10271                 val="$define"
10272                 ;;
10273         *)      echo "As you already told me, signal handler returns int." >&4
10274                 val="$undef"
10275                 ;;
10276         esac
10277 fi
10278 set d_voidsig
10279 eval $setvar
10280 case "$d_voidsig" in
10281 "$define") signal_t="void";;
10282 *) signal_t="int";;
10283 esac
10284 $rm -f $$.tmp
10285
10286 : check for ability to cast large floats to 32-bit ints.
10287 echo " "
10288 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10289 if $test "$intsize" -ge 4; then
10290         xxx=int
10291 else
10292         xxx=long
10293 fi
10294 $cat >try.c <<EOCP
10295 #include <stdio.h>
10296 #$i_stdlib I_STDLIB
10297 #ifdef I_STDLIB
10298 #include <stdlib.h>
10299 #endif
10300 #include <sys/types.h>
10301 #include <signal.h>
10302 $signal_t blech(s) int s; { exit(3); }
10303 int main()
10304 {
10305         $xxx i32;
10306         double f, g;
10307         int result = 0;
10308         char str[16];
10309         signal(SIGFPE, blech);
10310
10311         /* Don't let compiler optimize the test away.  Store the number 
10312            in a writable string for gcc to pass to sscanf under HP/UX.
10313         */
10314         sprintf(str, "2147483647");
10315         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10316         g = 10 * f;
10317         i32  = ($xxx) g;
10318
10319         /* x86 processors will probably give 0x8000 0000, which is a
10320            sign change.  We don't want that.  We want to mimic SPARC
10321            behavior here, which is to preserve the sign and give
10322            back 0x7fff ffff.
10323         */
10324         if (i32 != ($xxx) f)
10325                 result |= 1;
10326         exit(result);
10327 }
10328 EOCP
10329 set try
10330 if eval $compile_ok; then
10331         $run ./try
10332         yyy=$?
10333 else
10334         echo "(I can't seem to compile the test program--assuming it can't)"
10335         yyy=1
10336 fi
10337 case "$yyy" in
10338 0)      val="$define"
10339         echo "Yup, it can."
10340         ;;
10341 *)      val="$undef"
10342         echo "Nope, it can't."
10343         ;;
10344 esac
10345 set d_casti32
10346 eval $setvar
10347 $rm -f try try.*
10348
10349 : check for ability to cast negative floats to unsigned
10350 echo " "
10351 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10352 $cat >try.c <<EOCP
10353 #include <stdio.h>
10354 #$i_stdlib I_STDLIB
10355 #ifdef I_STDLIB
10356 #include <stdlib.h>
10357 #endif
10358 #include <sys/types.h>
10359 #include <signal.h>
10360 $signal_t blech(s) int s; { exit(7); }
10361 $signal_t blech_in_list(s) int s; { exit(4); }
10362 unsigned long dummy_long(p) unsigned long p; { return p; }
10363 unsigned int dummy_int(p) unsigned int p; { return p; }
10364 unsigned short dummy_short(p) unsigned short p; { return p; }
10365 int main()
10366 {
10367         double f;
10368         unsigned long along;
10369         unsigned int aint;
10370         unsigned short ashort;
10371         int result = 0;
10372         char str[16];
10373         
10374         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10375            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10376            optimized the whole file away
10377         */
10378         /* Store the number in a writable string for gcc to pass to 
10379            sscanf under HP/UX.
10380         */
10381         sprintf(str, "-123");
10382         sscanf(str, "%lf", &f);  /* f = -123.; */
10383
10384         signal(SIGFPE, blech);
10385         along = (unsigned long)f;
10386         aint = (unsigned int)f;
10387         ashort = (unsigned short)f;
10388         if (along != (unsigned long)-123)
10389                 result |= 1;
10390         if (aint != (unsigned int)-123)
10391                 result |= 1;
10392         if (ashort != (unsigned short)-123)
10393                 result |= 1;
10394         sprintf(str, "1073741824.");
10395         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10396         f = f + f;
10397         along = 0;
10398         along = (unsigned long)f;
10399         if (along != 0x80000000)
10400                 result |= 2;
10401         f -= 1.;
10402         along = 0;
10403         along = (unsigned long)f;
10404         if (along != 0x7fffffff)
10405                 result |= 1;
10406         f += 2.;
10407         along = 0;
10408         along = (unsigned long)f;
10409         if (along != 0x80000001)
10410                 result |= 2;
10411         if (result)
10412                 exit(result);
10413         signal(SIGFPE, blech_in_list);
10414         sprintf(str, "123.");
10415         sscanf(str, "%lf", &f);  /* f = 123.; */
10416         along = dummy_long((unsigned long)f);
10417         aint = dummy_int((unsigned int)f);
10418         ashort = dummy_short((unsigned short)f);
10419         if (along != (unsigned long)123)
10420                 result |= 4;
10421         if (aint != (unsigned int)123)
10422                 result |= 4;
10423         if (ashort != (unsigned short)123)
10424                 result |= 4;
10425         exit(result);
10426
10427 }
10428 EOCP
10429 set try
10430 if eval $compile_ok; then
10431         $run ./try
10432         castflags=$?
10433 else
10434         echo "(I can't seem to compile the test program--assuming it can't)"
10435         castflags=7
10436 fi
10437 case "$castflags" in
10438 0)      val="$define"
10439         echo "Yup, it can."
10440         ;;
10441 *)      val="$undef"
10442         echo "Nope, it can't."
10443         ;;
10444 esac
10445 set d_castneg
10446 eval $setvar
10447 $rm -f try.*
10448
10449 : see if vprintf exists
10450 echo " "
10451 if set vprintf val -f d_vprintf; eval $csym; $val; then
10452         echo 'vprintf() found.' >&4
10453         val="$define"
10454         $cat >try.c <<EOF
10455 #include <varargs.h>
10456 #$i_stdlib I_STDLIB
10457 #ifdef I_STDLIB
10458 #include <stdlib.h>
10459 #endif
10460
10461 int main() { xxx("foo"); }
10462
10463 xxx(va_alist)
10464 va_dcl
10465 {
10466         va_list args;
10467         char buf[10];
10468
10469         va_start(args);
10470         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10471 }
10472 EOF
10473         set try
10474         if eval $compile && $run ./try; then
10475                 echo "Your vsprintf() returns (int)." >&4
10476                 val2="$undef"
10477         else
10478                 echo "Your vsprintf() returns (char*)." >&4
10479                 val2="$define"
10480         fi
10481 else
10482         echo 'vprintf() NOT found.' >&4
10483                 val="$undef"
10484                 val2="$undef"
10485 fi
10486 $rm -f try try.*
10487 set d_vprintf
10488 eval $setvar
10489 val=$val2
10490 set d_charvspr
10491 eval $setvar
10492
10493 : see if chown exists
10494 set chown d_chown
10495 eval $inlibc
10496
10497 : see if chroot exists
10498 set chroot d_chroot
10499 eval $inlibc
10500
10501 : see if chsize exists
10502 set chsize d_chsize
10503 eval $inlibc
10504
10505 : see if class exists
10506 set class d_class
10507 eval $inlibc
10508
10509 : see if clearenv exists
10510 set clearenv d_clearenv
10511 eval $inlibc
10512
10513 hasstruct='varname=$1; struct=$2; shift; shift;
10514 while $test $# -ge 2; do
10515         case "$1" in
10516         $define) echo "#include <$2>";;
10517         esac ;
10518     shift 2;
10519 done > try.c;
10520 echo "int main () { struct $struct foo; }" >> try.c;
10521 set try;
10522 if eval $compile; then
10523         val="$define";
10524 else
10525         val="$undef";
10526 fi;
10527 set $varname;
10528 eval $setvar;
10529 $rm -f try.c try.o'
10530
10531 socketlib=''
10532 sockethdr=''
10533 : see whether socket exists
10534 echo " "
10535 $echo $n "Hmm... $c" >&4
10536 if set socket val -f d_socket; eval $csym; $val; then
10537         echo "Looks like you have Berkeley networking support." >&4
10538         d_socket="$define"
10539         if set setsockopt val -f; eval $csym; $val; then
10540                 d_oldsock="$undef"
10541         else
10542                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10543                 d_oldsock="$define"
10544         fi
10545 else
10546         if $contains socklib libc.list >/dev/null 2>&1; then
10547                 echo "Looks like you have Berkeley networking support." >&4
10548                 d_socket="$define"
10549                 : we will have to assume that it supports the 4.2 BSD interface
10550                 d_oldsock="$undef"
10551         else
10552                 echo "You don't have Berkeley networking in libc$_a..." >&4
10553                 if test "X$d_socket" = "X$define"; then
10554                    echo "...but you seem to believe that you have sockets." >&4
10555                 else
10556                         for net in net socket
10557                         do
10558                                 if test -f /usr/lib/lib$net$_a; then
10559                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10560                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10561                                         if $contains socket libc.list >/dev/null 2>&1; then
10562                                                 d_socket="$define"
10563                                                 socketlib="-l$net"
10564                                                 case "$net" in
10565                                                 net)
10566                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10567                                                         sockethdr="-I/usr/netinclude"
10568                                                         ;;
10569                                                 esac
10570                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10571                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10572                                                         d_oldsock="$undef"
10573                                                 else
10574                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10575                                                         d_oldsock="$define"
10576                                                 fi
10577                                                 break
10578                                         fi
10579                                 fi
10580                         done
10581                         if test "X$d_socket" != "X$define"; then
10582                            echo "or anywhere else I see." >&4
10583                            d_socket="$undef"
10584                            d_oldsock="$undef"
10585                         fi
10586                 fi
10587         fi
10588 fi
10589
10590 : see if socketpair exists
10591 set socketpair d_sockpair
10592 eval $inlibc
10593
10594
10595 echo " "
10596 echo "Checking the availability of certain socket constants..." >&4
10597 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10598         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10599         $cat >try.c <<EOF
10600 #include <sys/types.h>
10601 #include <sys/socket.h>
10602 int main() {
10603     int i = $ENUM;
10604 }
10605 EOF
10606         val="$undef"
10607         set try; if eval $compile; then
10608                 val="$define"
10609         fi
10610         set d_${enum}; eval $setvar
10611         $rm -f try.c try
10612 done
10613
10614 : see if this is a sys/uio.h system
10615 set sys/uio.h i_sysuio
10616 eval $inhdr
10617
10618
10619 echo " "
10620 echo "Checking to see if your system supports struct cmsghdr..." >&4
10621 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10622 eval $hasstruct
10623 case "$d_cmsghdr_s" in
10624 "$define")      echo "Yes, it does."   ;;
10625 *)              echo "No, it doesn't." ;;
10626 esac
10627
10628
10629 : check for const keyword
10630 echo " "
10631 echo 'Checking to see if your C compiler knows about "const"...' >&4
10632 $cat >const.c <<'EOCP'
10633 typedef struct spug { int drokk; } spug;
10634 int main()
10635 {
10636         const char *foo;
10637         const spug y;
10638 }
10639 EOCP
10640 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10641         val="$define"
10642         echo "Yup, it does."
10643 else
10644         val="$undef"
10645         echo "Nope, it doesn't."
10646 fi
10647 set d_const
10648 eval $setvar
10649
10650 : see if copysignl exists
10651 set copysignl d_copysignl
10652 eval $inlibc
10653
10654 : see if crypt exists
10655 echo " "
10656 set crypt d_crypt
10657 eval $inlibc
10658 case "$d_crypt" in
10659 $define) cryptlib='' ;;
10660 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10661                 echo 'crypt() found.' >&4
10662                 val="$define"
10663                 cryptlib=''
10664         else
10665                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10666                 if $test -z "$cryptlib"; then
10667                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10668                 else
10669                         cryptlib=-lcrypt
10670                 fi
10671                 if $test -z "$cryptlib"; then
10672                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10673                 else
10674                         cryptlib=-lcrypt
10675                 fi
10676                 if $test -z "$cryptlib"; then
10677                         cryptlib=`./loc libcrypt$_a "" $libpth`
10678                 else
10679                         cryptlib=-lcrypt
10680                 fi
10681                 if $test -z "$cryptlib"; then
10682                         echo 'crypt() NOT found.' >&4
10683                         val="$undef"
10684                 else
10685                         val="$define"
10686                 fi
10687         fi
10688         set d_crypt
10689         eval $setvar
10690         ;;
10691 esac
10692
10693 : see if this is a crypt.h system
10694 set crypt.h i_crypt
10695 eval $inhdr
10696
10697 : see if crypt_r exists
10698 set crypt_r d_crypt_r
10699 eval $inlibc
10700 case "$d_crypt_r" in
10701 "$define")
10702         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10703         case "$d_crypt_r_proto:$usethreads" in
10704         ":define")      d_crypt_r_proto=define
10705                 set d_crypt_r_proto crypt_r $hdrs
10706                 eval $hasproto ;;
10707         *)      ;;
10708         esac
10709         case "$d_crypt_r_proto" in
10710         define)
10711         case "$crypt_r_proto" in
10712         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10713         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10714         esac
10715         case "$crypt_r_proto" in
10716         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10717         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10718         esac
10719         case "$crypt_r_proto" in
10720         ''|0)   d_crypt_r=undef
10721                 crypt_r_proto=0
10722                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10723         * )     case "$crypt_r_proto" in
10724                 REENTRANT_PROTO*) ;;
10725                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10726                 esac
10727                 echo "Prototype: $try" ;;
10728         esac
10729         ;;
10730         *)      case "$usethreads" in
10731                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10732                 esac
10733                 d_crypt_r=undef
10734                 crypt_r_proto=0
10735                 ;;
10736         esac
10737         ;;
10738 *)      crypt_r_proto=0
10739         ;;
10740 esac
10741
10742 : get csh whereabouts
10743 case "$csh" in
10744 'csh') val="$undef" ;;
10745 *) val="$define" ;;
10746 esac
10747 set d_csh
10748 eval $setvar
10749 : Respect a hint or command line value for full_csh.
10750 case "$full_csh" in
10751 '') full_csh=$csh ;;
10752 esac
10753
10754 : see if ctermid_r exists
10755 set ctermid_r d_ctermid_r
10756 eval $inlibc
10757 case "$d_ctermid_r" in
10758 "$define")
10759         hdrs="$i_systypes sys/types.h define stdio.h "
10760         case "$d_ctermid_r_proto:$usethreads" in
10761         ":define")      d_ctermid_r_proto=define
10762                 set d_ctermid_r_proto ctermid_r $hdrs
10763                 eval $hasproto ;;
10764         *)      ;;
10765         esac
10766         case "$d_ctermid_r_proto" in
10767         define)
10768         case "$ctermid_r_proto" in
10769         ''|0) try='char* ctermid_r(char*);'
10770         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10771         esac
10772         case "$ctermid_r_proto" in
10773         ''|0)   d_ctermid_r=undef
10774                 ctermid_r_proto=0
10775                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10776         * )     case "$ctermid_r_proto" in
10777                 REENTRANT_PROTO*) ;;
10778                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10779                 esac
10780                 echo "Prototype: $try" ;;
10781         esac
10782         ;;
10783         *)      case "$usethreads" in
10784                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10785                 esac
10786                 d_ctermid_r=undef
10787                 ctermid_r_proto=0
10788                 ;;
10789         esac
10790         ;;
10791 *)      ctermid_r_proto=0
10792         ;;
10793 esac
10794
10795 : see if ctime_r exists
10796 set ctime_r d_ctime_r
10797 eval $inlibc
10798 case "$d_ctime_r" in
10799 "$define")
10800         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10801         case "$d_ctime_r_proto:$usethreads" in
10802         ":define")      d_ctime_r_proto=define
10803                 set d_ctime_r_proto ctime_r $hdrs
10804                 eval $hasproto ;;
10805         *)      ;;
10806         esac
10807         case "$d_ctime_r_proto" in
10808         define)
10809         case "$ctime_r_proto" in
10810         ''|0) try='char* ctime_r(const time_t*, char*);'
10811         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10812         esac
10813         case "$ctime_r_proto" in
10814         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10815         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10816         esac
10817         case "$ctime_r_proto" in
10818         ''|0) try='int ctime_r(const time_t*, char*);'
10819         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10820         esac
10821         case "$ctime_r_proto" in
10822         ''|0) try='int ctime_r(const time_t*, char*, int);'
10823         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10824         esac
10825         case "$ctime_r_proto" in
10826         ''|0)   d_ctime_r=undef
10827                 ctime_r_proto=0
10828                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10829         * )     case "$ctime_r_proto" in
10830                 REENTRANT_PROTO*) ;;
10831                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10832                 esac
10833                 echo "Prototype: $try" ;;
10834         esac
10835         ;;
10836         *)      case "$usethreads" in
10837                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10838                 esac
10839                 d_ctime_r=undef
10840                 ctime_r_proto=0
10841                 ;;
10842         esac
10843         ;;
10844 *)      ctime_r_proto=0
10845         ;;
10846 esac
10847
10848 : see if cuserid exists
10849 set cuserid d_cuserid
10850 eval $inlibc
10851
10852 : see if this is a limits.h system
10853 set limits.h i_limits
10854 eval $inhdr
10855
10856 : see if this is a float.h system
10857 set float.h i_float
10858 eval $inhdr
10859
10860 : See if number of significant digits in a double precision number is known
10861 echo " "
10862 $cat >dbl_dig.c <<EOM
10863 #$i_limits I_LIMITS
10864 #$i_float I_FLOAT
10865 #ifdef I_LIMITS
10866 #include <limits.h>
10867 #endif
10868 #ifdef I_FLOAT
10869 #include <float.h>
10870 #endif
10871 #ifdef DBL_DIG
10872 printf("Contains DBL_DIG");
10873 #endif
10874 EOM
10875 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10876 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10877         echo "DBL_DIG found." >&4
10878         val="$define"
10879 else
10880         echo "DBL_DIG NOT found." >&4
10881         val="$undef"
10882 fi
10883 $rm -f dbl_dig.?
10884 set d_dbl_dig
10885 eval $setvar
10886
10887 : see if dbm.h is available
10888 : see if dbmclose exists
10889 set dbmclose d_dbmclose
10890 eval $inlibc
10891
10892 case "$d_dbmclose" in
10893 $define)
10894         set dbm.h i_dbm
10895         eval $inhdr
10896         case "$i_dbm" in
10897         $define)
10898                 val="$undef"
10899                 set i_rpcsvcdbm
10900                 eval $setvar
10901                 ;;
10902         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10903                 eval $inhdr
10904                 ;;
10905         esac
10906         ;;
10907 *)      echo "We won't be including <dbm.h>"
10908         val="$undef"
10909         set i_dbm
10910         eval $setvar
10911         val="$undef"
10912         set i_rpcsvcdbm
10913         eval $setvar
10914         ;;
10915 esac
10916
10917 : see if prototype for dbminit is available
10918 echo " "
10919 set d_dbminitproto dbminit $i_dbm dbm.h
10920 eval $hasproto
10921
10922 : see if difftime exists
10923 set difftime d_difftime
10924 eval $inlibc
10925
10926 : see if this is a dirent system
10927 echo " "
10928 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10929         val="$define"
10930         echo "<dirent.h> found." >&4
10931 else
10932         val="$undef"
10933         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10934                 echo "<sys/dir.h> found." >&4
10935                 echo " "
10936         else
10937                 xinc=`./findhdr sys/ndir.h`
10938         fi
10939         echo "<dirent.h> NOT found." >&4
10940 fi
10941 set i_dirent
10942 eval $setvar
10943
10944 : Look for type of directory structure.
10945 echo " "
10946 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10947
10948 case "$direntrytype" in
10949 ''|' ')
10950         case "$i_dirent" in
10951         $define) guess1='struct dirent' ;;
10952         *) guess1='struct direct'  ;;
10953         esac
10954         ;;
10955 *)      guess1="$direntrytype"
10956         ;;
10957 esac
10958
10959 case "$guess1" in
10960 'struct dirent') guess2='struct direct' ;;
10961 *) guess2='struct dirent' ;;
10962 esac
10963                 
10964 if $contains "$guess1" try.c >/dev/null 2>&1; then
10965         direntrytype="$guess1"
10966         echo "Your directory entries are $direntrytype." >&4
10967 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10968         direntrytype="$guess2"
10969         echo "Your directory entries seem to be $direntrytype." >&4
10970 else
10971         echo "I don't recognize your system's directory entries." >&4
10972         rp="What type is used for directory entries on this system?"
10973         dflt="$guess1"
10974         . ./myread
10975         direntrytype="$ans"
10976 fi
10977 $rm -f try.c
10978
10979
10980 : see if the directory entry stores field length
10981 echo " "
10982 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10983 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10984         echo "Good, your directory entry keeps length information in d_namlen." >&4
10985         val="$define"
10986 else
10987         echo "Your directory entry does not know about the d_namlen field." >&4
10988         val="$undef"
10989 fi
10990 set d_dirnamlen
10991 eval $setvar
10992 $rm -f try.c
10993
10994 : see if this is an sysdir system
10995 set sys/dir.h i_sysdir
10996 eval $inhdr
10997
10998 : see if this is an sysndir system
10999 set sys/ndir.h i_sysndir
11000 eval $inhdr
11001
11002 : Look for dirfd
11003 echo " "
11004 $cat >dirfd.c <<EOM
11005 #include <stdio.h>
11006 #$i_stdlib I_STDLIB
11007 #ifdef I_STDLIB
11008 #include <stdlib.h>
11009 #endif
11010 #$i_dirent I_DIRENT             /**/
11011 #$i_sysdir I_SYS_DIR            /**/
11012 #$i_sysndir I_SYS_NDIR          /**/
11013 #$i_systypes I_SYS_TYPES        /**/
11014 #if defined(I_SYS_TYPES)
11015 #include <sys/types.h>
11016 #endif
11017 #if defined(I_DIRENT)
11018 #include <dirent.h>
11019 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11020 #include <sys/dir.h>
11021 #endif
11022 #else
11023 #ifdef I_SYS_NDIR
11024 #include <sys/ndir.h>
11025 #else
11026 #ifdef I_SYS_DIR
11027 #ifdef hp9000s500
11028 #include <ndir.h>       /* may be wrong in the future */
11029 #else
11030 #include <sys/dir.h>
11031 #endif
11032 #endif
11033 #endif
11034 #endif 
11035 int main() {
11036         DIR *dirp = opendir(".");
11037         if (dirfd(dirp) >= 0)
11038                 exit(0);
11039         else
11040                 exit(1);
11041 }
11042 EOM
11043 val=$undef
11044 set dirfd
11045 if eval $compile; then
11046         val="$define"
11047 fi
11048 case "$val" in
11049 $define)        echo "dirfd() found." >&4       ;;
11050 *)              echo "dirfd() NOT found." >&4   ;;
11051 esac
11052 set d_dirfd
11053 eval $setvar
11054 $rm -f dirfd*
11055
11056 : see if dlerror exists
11057 xxx_runnm="$runnm"
11058 runnm=false
11059 set dlerror d_dlerror
11060 eval $inlibc
11061 runnm="$xxx_runnm"
11062
11063 : see if dlfcn is available
11064 set dlfcn.h i_dlfcn
11065 eval $inhdr
11066
11067 case "$usedl" in
11068 $define|y|true)
11069         $cat << EOM
11070
11071 On a few systems, the dynamically loaded modules that perl generates and uses
11072 will need a different extension than shared libs. The default will probably
11073 be appropriate.
11074
11075 EOM
11076         case "$dlext" in
11077         '')     dflt="$so" ;;
11078         *)      dflt="$dlext" ;;
11079         esac
11080         rp='What is the extension of dynamically loaded modules'
11081         . ./myread
11082         dlext="$ans"
11083         ;;
11084 *)
11085         dlext="none"
11086         ;;
11087 esac
11088
11089 : Check if dlsym need a leading underscore
11090 echo " "
11091 val="$undef"
11092
11093 case "$dlsrc" in
11094 dl_dlopen.xs)
11095         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11096         $cat >dyna.c <<'EOM'
11097 fred () { }
11098 EOM
11099
11100 $cat >fred.c<<EOM
11101
11102 #include <stdio.h>
11103 #$i_stdlib I_STDLIB
11104 #ifdef I_STDLIB
11105 #include <stdlib.h>
11106 #endif
11107 #$i_dlfcn I_DLFCN
11108 #ifdef I_DLFCN
11109 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11110 #else
11111 #include <sys/types.h>
11112 #include <nlist.h>
11113 #include <link.h>
11114 #endif
11115
11116 extern int fred() ;
11117
11118 int main()
11119 {
11120     void * handle ;
11121     void * symbol ;
11122 #ifndef RTLD_LAZY
11123     int mode = 1 ;
11124 #else
11125     int mode = RTLD_LAZY ;
11126 #endif
11127     handle = dlopen("./dyna.$dlext", mode) ;
11128     if (handle == NULL) {
11129         printf ("1\n") ;
11130         fflush (stdout) ;
11131         exit(0);
11132     }
11133     symbol = dlsym(handle, "fred") ;
11134     if (symbol == NULL) {
11135         /* try putting a leading underscore */
11136         symbol = dlsym(handle, "_fred") ;
11137         if (symbol == NULL) {
11138             printf ("2\n") ;
11139             fflush (stdout) ;
11140             exit(0);
11141         }
11142         printf ("3\n") ;
11143     }
11144     else
11145         printf ("4\n") ;
11146     fflush (stdout) ;
11147     exit(0);
11148 }
11149 EOM
11150         : Call the object file tmp-dyna.o in case dlext=o.
11151         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11152                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11153                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11154                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11155                 xxx=`$run ./fred`
11156                 case $xxx in
11157                 1)      echo "Test program failed using dlopen." >&4
11158                         echo "Perhaps you should not use dynamic loading." >&4;;
11159                 2)      echo "Test program failed using dlsym." >&4
11160                         echo "Perhaps you should not use dynamic loading." >&4;;
11161                 3)      echo "dlsym needs a leading underscore" >&4
11162                         val="$define" ;;
11163                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11164                 esac
11165         else
11166                 echo "I can't compile and run the test program." >&4
11167                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11168         fi
11169         ;;
11170 esac
11171                 
11172 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11173
11174 set d_dlsymun
11175 eval $setvar
11176
11177 : see if drand48_r exists
11178 set drand48_r d_drand48_r
11179 eval $inlibc
11180 case "$d_drand48_r" in
11181 "$define")
11182         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11183         case "$d_drand48_r_proto:$usethreads" in
11184         ":define")      d_drand48_r_proto=define
11185                 set d_drand48_r_proto drand48_r $hdrs
11186                 eval $hasproto ;;
11187         *)      ;;
11188         esac
11189         case "$d_drand48_r_proto" in
11190         define)
11191         case "$drand48_r_proto" in
11192         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11193         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11194         esac
11195         case "$drand48_r_proto" in
11196         ''|0)   d_drand48_r=undef
11197                 drand48_r_proto=0
11198                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11199         * )     case "$drand48_r_proto" in
11200                 REENTRANT_PROTO*) ;;
11201                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11202                 esac
11203                 echo "Prototype: $try" ;;
11204         esac
11205         ;;
11206         *)      case "$usethreads" in
11207                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11208                 esac
11209                 d_drand48_r=undef
11210                 drand48_r_proto=0
11211                 ;;
11212         esac
11213         ;;
11214 *)      drand48_r_proto=0
11215         ;;
11216 esac
11217
11218 : see if prototype for drand48 is available
11219 echo " "
11220 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11221 eval $hasproto
11222
11223 : see if dup2 exists
11224 set dup2 d_dup2
11225 eval $inlibc
11226
11227 : see if eaccess exists
11228 set eaccess d_eaccess
11229 eval $inlibc
11230
11231 : see if endgrent exists
11232 set endgrent d_endgrent
11233 eval $inlibc
11234
11235 : see if this is an grp system
11236 set grp.h i_grp
11237 eval $inhdr
11238
11239 case "$i_grp" in
11240 $define)
11241         xxx=`./findhdr grp.h`
11242         $cppstdin $cppflags $cppminus < $xxx >$$.h
11243
11244         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11245                 val="$define"
11246         else
11247                 val="$undef"
11248         fi
11249         set d_grpasswd
11250         eval $setvar
11251
11252         $rm -f $$.h
11253         ;;
11254 *)
11255         val="$undef";
11256         set d_grpasswd; eval $setvar
11257         ;;
11258 esac
11259
11260 : see if endgrent_r exists
11261 set endgrent_r d_endgrent_r
11262 eval $inlibc
11263 case "$d_endgrent_r" in
11264 "$define")
11265         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11266         case "$d_endgrent_r_proto:$usethreads" in
11267         ":define")      d_endgrent_r_proto=define
11268                 set d_endgrent_r_proto endgrent_r $hdrs
11269                 eval $hasproto ;;
11270         *)      ;;
11271         esac
11272         case "$d_endgrent_r_proto" in
11273         define)
11274         case "$endgrent_r_proto" in
11275         ''|0) try='int endgrent_r(FILE**);'
11276         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11277         esac
11278         case "$endgrent_r_proto" in
11279         ''|0) try='void endgrent_r(FILE**);'
11280         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11281         esac
11282         case "$endgrent_r_proto" in
11283         ''|0)   d_endgrent_r=undef
11284                 endgrent_r_proto=0
11285                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11286         * )     case "$endgrent_r_proto" in
11287                 REENTRANT_PROTO*) ;;
11288                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11289                 esac
11290                 echo "Prototype: $try" ;;
11291         esac
11292         ;;
11293         *)      case "$usethreads" in
11294                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11295                 esac
11296                 d_endgrent_r=undef
11297                 endgrent_r_proto=0
11298                 ;;
11299         esac
11300         ;;
11301 *)      endgrent_r_proto=0
11302         ;;
11303 esac
11304
11305 : see if endhostent exists
11306 set endhostent d_endhent
11307 eval $inlibc
11308
11309 : see if this is a netdb.h system
11310 set netdb.h i_netdb
11311 eval $inhdr
11312
11313 : see if endhostent_r exists
11314 set endhostent_r d_endhostent_r
11315 eval $inlibc
11316 case "$d_endhostent_r" in
11317 "$define")
11318         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11319         case "$d_endhostent_r_proto:$usethreads" in
11320         ":define")      d_endhostent_r_proto=define
11321                 set d_endhostent_r_proto endhostent_r $hdrs
11322                 eval $hasproto ;;
11323         *)      ;;
11324         esac
11325         case "$d_endhostent_r_proto" in
11326         define)
11327         case "$endhostent_r_proto" in
11328         ''|0) try='int endhostent_r(struct hostent_data*);'
11329         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11330         esac
11331         case "$endhostent_r_proto" in
11332         ''|0) try='void endhostent_r(struct hostent_data*);'
11333         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11334         esac
11335         case "$endhostent_r_proto" in
11336         ''|0)   d_endhostent_r=undef
11337                 endhostent_r_proto=0
11338                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11339         * )     case "$endhostent_r_proto" in
11340                 REENTRANT_PROTO*) ;;
11341                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11342                 esac
11343                 echo "Prototype: $try" ;;
11344         esac
11345         ;;
11346         *)      case "$usethreads" in
11347                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11348                 esac
11349                 d_endhostent_r=undef
11350                 endhostent_r_proto=0
11351                 ;;
11352         esac
11353         ;;
11354 *)      endhostent_r_proto=0
11355         ;;
11356 esac
11357
11358 : see if endnetent exists
11359 set endnetent d_endnent
11360 eval $inlibc
11361
11362 : see if endnetent_r exists
11363 set endnetent_r d_endnetent_r
11364 eval $inlibc
11365 case "$d_endnetent_r" in
11366 "$define")
11367         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11368         case "$d_endnetent_r_proto:$usethreads" in
11369         ":define")      d_endnetent_r_proto=define
11370                 set d_endnetent_r_proto endnetent_r $hdrs
11371                 eval $hasproto ;;
11372         *)      ;;
11373         esac
11374         case "$d_endnetent_r_proto" in
11375         define)
11376         case "$endnetent_r_proto" in
11377         ''|0) try='int endnetent_r(struct netent_data*);'
11378         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11379         esac
11380         case "$endnetent_r_proto" in
11381         ''|0) try='void endnetent_r(struct netent_data*);'
11382         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11383         esac
11384         case "$endnetent_r_proto" in
11385         ''|0)   d_endnetent_r=undef
11386                 endnetent_r_proto=0
11387                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11388         * )     case "$endnetent_r_proto" in
11389                 REENTRANT_PROTO*) ;;
11390                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11391                 esac
11392                 echo "Prototype: $try" ;;
11393         esac
11394         ;;
11395         *)      case "$usethreads" in
11396                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11397                 esac
11398                 d_endnetent_r=undef
11399                 endnetent_r_proto=0
11400                 ;;
11401         esac
11402         ;;
11403 *)      endnetent_r_proto=0
11404         ;;
11405 esac
11406
11407 : see if endprotoent exists
11408 set endprotoent d_endpent
11409 eval $inlibc
11410
11411 : see if endprotoent_r exists
11412 set endprotoent_r d_endprotoent_r
11413 eval $inlibc
11414 case "$d_endprotoent_r" in
11415 "$define")
11416         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11417         case "$d_endprotoent_r_proto:$usethreads" in
11418         ":define")      d_endprotoent_r_proto=define
11419                 set d_endprotoent_r_proto endprotoent_r $hdrs
11420                 eval $hasproto ;;
11421         *)      ;;
11422         esac
11423         case "$d_endprotoent_r_proto" in
11424         define)
11425         case "$endprotoent_r_proto" in
11426         ''|0) try='int endprotoent_r(struct protoent_data*);'
11427         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11428         esac
11429         case "$endprotoent_r_proto" in
11430         ''|0) try='void endprotoent_r(struct protoent_data*);'
11431         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11432         esac
11433         case "$endprotoent_r_proto" in
11434         ''|0)   d_endprotoent_r=undef
11435                 endprotoent_r_proto=0
11436                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11437         * )     case "$endprotoent_r_proto" in
11438                 REENTRANT_PROTO*) ;;
11439                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11440                 esac
11441                 echo "Prototype: $try" ;;
11442         esac
11443         ;;
11444         *)      case "$usethreads" in
11445                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11446                 esac
11447                 d_endprotoent_r=undef
11448                 endprotoent_r_proto=0
11449                 ;;
11450         esac
11451         ;;
11452 *)      endprotoent_r_proto=0
11453         ;;
11454 esac
11455
11456 : see if endpwent exists
11457 set endpwent d_endpwent
11458 eval $inlibc
11459
11460 : see if this is a pwd.h system
11461 set pwd.h i_pwd
11462 eval $inhdr
11463
11464 case "$i_pwd" in
11465 $define)
11466         xxx=`./findhdr pwd.h`
11467         $cppstdin $cppflags $cppminus < $xxx >$$.h
11468
11469         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11470                 val="$define"
11471         else
11472                 val="$undef"
11473         fi
11474         set d_pwquota
11475         eval $setvar
11476
11477         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11478                 val="$define"
11479         else
11480                 val="$undef"
11481         fi
11482         set d_pwage
11483         eval $setvar
11484
11485         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11486                 val="$define"
11487         else
11488                 val="$undef"
11489         fi
11490         set d_pwchange
11491         eval $setvar
11492
11493         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11494                 val="$define"
11495         else
11496                 val="$undef"
11497         fi
11498         set d_pwclass
11499         eval $setvar
11500
11501         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11502                 val="$define"
11503         else
11504                 val="$undef"
11505         fi
11506         set d_pwexpire
11507         eval $setvar
11508
11509         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11510                 val="$define"
11511         else
11512                 val="$undef"
11513         fi
11514         set d_pwcomment
11515         eval $setvar
11516
11517         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11518                 val="$define"
11519         else
11520                 val="$undef"
11521         fi
11522         set d_pwgecos
11523         eval $setvar
11524
11525         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11526                 val="$define"
11527         else
11528                 val="$undef"
11529         fi
11530         set d_pwpasswd
11531         eval $setvar
11532
11533         $rm -f $$.h
11534         ;;
11535 *)
11536         val="$undef"; 
11537         set d_pwquota; eval $setvar
11538         set d_pwage; eval $setvar
11539         set d_pwchange; eval $setvar
11540         set d_pwclass; eval $setvar
11541         set d_pwexpire; eval $setvar
11542         set d_pwcomment; eval $setvar
11543         set d_pwgecos; eval $setvar
11544         set d_pwpasswd; eval $setvar
11545         ;;
11546 esac
11547
11548 : see if endpwent_r exists
11549 set endpwent_r d_endpwent_r
11550 eval $inlibc
11551 case "$d_endpwent_r" in
11552 "$define")
11553         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11554         case "$d_endpwent_r_proto:$usethreads" in
11555         ":define")      d_endpwent_r_proto=define
11556                 set d_endpwent_r_proto endpwent_r $hdrs
11557                 eval $hasproto ;;
11558         *)      ;;
11559         esac
11560         case "$d_endpwent_r_proto" in
11561         define)
11562         case "$endpwent_r_proto" in
11563         ''|0) try='int endpwent_r(FILE**);'
11564         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11565         esac
11566         case "$endpwent_r_proto" in
11567         ''|0) try='void endpwent_r(FILE**);'
11568         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11569         esac
11570         case "$endpwent_r_proto" in
11571         ''|0)   d_endpwent_r=undef
11572                 endpwent_r_proto=0
11573                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11574         * )     case "$endpwent_r_proto" in
11575                 REENTRANT_PROTO*) ;;
11576                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11577                 esac
11578                 echo "Prototype: $try" ;;
11579         esac
11580         ;;
11581         *)      case "$usethreads" in
11582                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11583                 esac
11584                 d_endpwent_r=undef
11585                 endpwent_r_proto=0
11586                 ;;
11587         esac
11588         ;;
11589 *)      endpwent_r_proto=0
11590         ;;
11591 esac
11592
11593 : see if endservent exists
11594 set endservent d_endsent
11595 eval $inlibc
11596
11597 : see if endservent_r exists
11598 set endservent_r d_endservent_r
11599 eval $inlibc
11600 case "$d_endservent_r" in
11601 "$define")
11602         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11603         case "$d_endservent_r_proto:$usethreads" in
11604         ":define")      d_endservent_r_proto=define
11605                 set d_endservent_r_proto endservent_r $hdrs
11606                 eval $hasproto ;;
11607         *)      ;;
11608         esac
11609         case "$d_endservent_r_proto" in
11610         define)
11611         case "$endservent_r_proto" in
11612         ''|0) try='int endservent_r(struct servent_data*);'
11613         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11614         esac
11615         case "$endservent_r_proto" in
11616         ''|0) try='void endservent_r(struct servent_data*);'
11617         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11618         esac
11619         case "$endservent_r_proto" in
11620         ''|0)   d_endservent_r=undef
11621                 endservent_r_proto=0
11622                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11623         * )     case "$endservent_r_proto" in
11624                 REENTRANT_PROTO*) ;;
11625                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11626                 esac
11627                 echo "Prototype: $try" ;;
11628         esac
11629         ;;
11630         *)      case "$usethreads" in
11631                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11632                 esac
11633                 d_endservent_r=undef
11634                 endservent_r_proto=0
11635                 ;;
11636         esac
11637         ;;
11638 *)      endservent_r_proto=0
11639         ;;
11640 esac
11641
11642 : Locate the flags for 'open()'
11643 echo " "
11644 $cat >try.c <<EOCP
11645 #include <sys/types.h>
11646 #ifdef I_FCNTL
11647 #include <fcntl.h>
11648 #endif
11649 #ifdef I_SYS_FILE
11650 #include <sys/file.h>
11651 #endif
11652 #$i_stdlib I_STDLIB
11653 #ifdef I_STDLIB
11654 #include <stdlib.h>
11655 #endif
11656 int main() {
11657         if(O_RDONLY);
11658 #ifdef O_TRUNC
11659         exit(0);
11660 #else
11661         exit(1);
11662 #endif
11663 }
11664 EOCP
11665 : check sys/file.h first to get FREAD on Sun
11666 if $test `./findhdr sys/file.h` && \
11667                 set try -DI_SYS_FILE && eval $compile; then
11668         h_sysfile=true;
11669         echo "<sys/file.h> defines the O_* constants..." >&4
11670         if $run ./try; then
11671                 echo "and you have the 3 argument form of open()." >&4
11672                 val="$define"
11673         else
11674                 echo "but not the 3 argument form of open().  Oh, well." >&4
11675                 val="$undef"
11676         fi
11677 elif $test `./findhdr fcntl.h` && \
11678                 set try -DI_FCNTL && eval $compile; then
11679         h_fcntl=true;
11680         echo "<fcntl.h> defines the O_* constants..." >&4
11681         if $run ./try; then
11682                 echo "and you have the 3 argument form of open()." >&4
11683                 val="$define"
11684         else
11685                 echo "but not the 3 argument form of open().  Oh, well." >&4
11686                 val="$undef"
11687         fi
11688 else
11689         val="$undef"
11690         echo "I can't find the O_* constant definitions!  You got problems." >&4
11691 fi
11692 set d_open3
11693 eval $setvar
11694 $rm -f try try.*
11695
11696 : see which of string.h or strings.h is needed
11697 echo " "
11698 strings=`./findhdr string.h`
11699 if $test "$strings" && $test -r "$strings"; then
11700         echo "Using <string.h> instead of <strings.h>." >&4
11701         val="$define"
11702 else
11703         val="$undef"
11704         strings=`./findhdr strings.h`
11705         if $test "$strings" && $test -r "$strings"; then
11706                 echo "Using <strings.h> instead of <string.h>." >&4
11707         else
11708                 echo "No string header found -- You'll surely have problems." >&4
11709         fi
11710 fi
11711 set i_string
11712 eval $setvar
11713 case "$i_string" in
11714 "$undef") strings=`./findhdr strings.h`;;
11715 *)        strings=`./findhdr string.h`;;
11716 esac
11717
11718 : see if this is a sys/file.h system
11719 val=''
11720 set sys/file.h val
11721 eval $inhdr
11722
11723 : do we need to include sys/file.h ?
11724 case "$val" in
11725 "$define")
11726         echo " "
11727         if $h_sysfile; then
11728                 val="$define"
11729                 echo "We'll be including <sys/file.h>." >&4
11730         else
11731                 val="$undef"
11732                 echo "We won't be including <sys/file.h>." >&4
11733         fi
11734         ;;
11735 *)
11736         h_sysfile=false
11737         ;;
11738 esac
11739 set i_sysfile
11740 eval $setvar
11741
11742 : see if fcntl.h is there
11743 val=''
11744 set fcntl.h val
11745 eval $inhdr
11746
11747 : see if we can include fcntl.h
11748 case "$val" in
11749 "$define")
11750         echo " "
11751         if $h_fcntl; then
11752                 val="$define"
11753                 echo "We'll be including <fcntl.h>." >&4
11754         else
11755                 val="$undef"
11756                 if $h_sysfile; then
11757         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11758                 else
11759                         echo "We won't be including <fcntl.h>." >&4
11760                 fi
11761         fi
11762         ;;
11763 *)
11764         h_fcntl=false
11765         val="$undef"
11766         ;;
11767 esac
11768 set i_fcntl
11769 eval $setvar
11770
11771 : check for non-blocking I/O stuff
11772 case "$h_sysfile" in
11773 true) echo "#include <sys/file.h>" > head.c;;
11774 *)
11775        case "$h_fcntl" in
11776        true) echo "#include <fcntl.h>" > head.c;;
11777        *) echo "#include <sys/fcntl.h>" > head.c;;
11778        esac
11779        ;;
11780 esac
11781 echo " "
11782 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11783 case "$o_nonblock" in
11784 '')
11785         $cat head.c > try.c
11786         $cat >>try.c <<EOCP
11787 #include <stdio.h>
11788 #$i_stdlib I_STDLIB
11789 #ifdef I_STDLIB
11790 #include <stdlib.h>
11791 #endif
11792 #$i_fcntl I_FCNTL
11793 #ifdef I_FCNTL
11794 #include <fcntl.h>
11795 #endif
11796 int main() {
11797 #ifdef O_NONBLOCK
11798         printf("O_NONBLOCK\n");
11799         exit(0);
11800 #endif
11801 #ifdef O_NDELAY
11802         printf("O_NDELAY\n");
11803         exit(0);
11804 #endif
11805 #ifdef FNDELAY
11806         printf("FNDELAY\n");
11807         exit(0);
11808 #endif
11809         exit(0);
11810 }
11811 EOCP
11812         set try
11813         if eval $compile_ok; then
11814                 o_nonblock=`$run ./try`
11815                 case "$o_nonblock" in
11816                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11817                 *) echo "Seems like we can use $o_nonblock.";;
11818                 esac
11819         else
11820                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11821         fi
11822         ;;
11823 *) echo "Using $hint value $o_nonblock.";;
11824 esac
11825 $rm -f try try.* .out core
11826
11827 echo " "
11828 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11829 case "$eagain" in
11830 '')
11831         $cat head.c > try.c
11832         $cat >>try.c <<EOCP
11833 #include <errno.h>
11834 #include <sys/types.h>
11835 #include <signal.h>
11836 #include <stdio.h> 
11837 #$i_stdlib I_STDLIB
11838 #ifdef I_STDLIB
11839 #include <stdlib.h>
11840 #endif
11841 #$i_fcntl I_FCNTL
11842 #ifdef I_FCNTL
11843 #include <fcntl.h>
11844 #endif
11845 #define MY_O_NONBLOCK $o_nonblock
11846 #ifndef errno  /* XXX need better Configure test */
11847 extern int errno;
11848 #endif
11849 #$i_unistd I_UNISTD
11850 #ifdef I_UNISTD
11851 #include <unistd.h>
11852 #endif
11853 #$i_string I_STRING
11854 #ifdef I_STRING
11855 #include <string.h>
11856 #else
11857 #include <strings.h>
11858 #endif
11859 $signal_t blech(x) int x; { exit(3); }
11860 EOCP
11861         $cat >> try.c <<'EOCP'
11862 int main()
11863 {
11864         int pd[2];
11865         int pu[2];
11866         char buf[1];
11867         char string[100];
11868
11869         pipe(pd);       /* Down: child -> parent */
11870         pipe(pu);       /* Up: parent -> child */
11871         if (0 != fork()) {
11872                 int ret;
11873                 close(pd[1]);   /* Parent reads from pd[0] */
11874                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11875 #ifdef F_SETFL
11876                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11877                         exit(1);
11878 #else
11879                 exit(4);
11880 #endif
11881                 signal(SIGALRM, blech);
11882                 alarm(5);
11883                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11884                         exit(2);
11885                 sprintf(string, "%d\n", ret);
11886                 write(2, string, strlen(string));
11887                 alarm(0);
11888 #ifdef EAGAIN
11889                 if (errno == EAGAIN) {
11890                         printf("EAGAIN\n");
11891                         goto ok;
11892                 }
11893 #endif
11894 #ifdef EWOULDBLOCK
11895                 if (errno == EWOULDBLOCK)
11896                         printf("EWOULDBLOCK\n");
11897 #endif
11898         ok:
11899                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11900                 sleep(2);                               /* Give it time to close our pipe */
11901                 alarm(5);
11902                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11903                 alarm(0);
11904                 sprintf(string, "%d\n", ret);
11905                 write(4, string, strlen(string));
11906                 exit(0);
11907         }
11908
11909         close(pd[0]);                   /* We write to pd[1] */
11910         close(pu[1]);                   /* We read from pu[0] */
11911         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11912         close(pd[1]);                   /* Pipe pd is now fully closed! */
11913         exit(0);                                /* Bye bye, thank you for playing! */
11914 }
11915 EOCP
11916         set try
11917         if eval $compile_ok; then
11918                 echo "$startsh" >mtry
11919                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11920                 chmod +x mtry
11921                 ./mtry >/dev/null 2>&1
11922                 case $? in
11923                 0) eagain=`$cat try.out`;;
11924                 1) echo "Could not perform non-blocking setting!";;
11925                 2) echo "I did a successful read() for something that was not there!";;
11926                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11927                 4) echo "Could not find F_SETFL!";;
11928                 *) echo "Something terribly wrong happened during testing.";;
11929                 esac
11930                 rd_nodata=`$cat try.ret`
11931                 echo "A read() system call with no data present returns $rd_nodata."
11932                 case "$rd_nodata" in
11933                 0|-1) ;;
11934                 *)
11935                         echo "(That's peculiar, fixing that to be -1.)"
11936                         rd_nodata=-1
11937                         ;;
11938                 esac
11939                 case "$eagain" in
11940                 '')
11941                         echo "Forcing errno EAGAIN on read() with no data available."
11942                         eagain=EAGAIN
11943                         ;;
11944                 *)
11945                         echo "Your read() sets errno to $eagain when no data is available."
11946                         ;;
11947                 esac
11948                 status=`$cat try.err`
11949                 case "$status" in
11950                 0) echo "And it correctly returns 0 to signal EOF.";;
11951                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11952                 *) echo "However, your read() returns '$status' on EOF??";;
11953                 esac
11954                 val="$define"
11955                 if test "$status" = "$rd_nodata"; then
11956                         echo "WARNING: you can't distinguish between EOF and no data!"
11957                         val="$undef"
11958                 fi
11959         else
11960                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11961                 eagain=EAGAIN
11962         fi
11963         set d_eofnblk
11964         eval $setvar
11965         ;;
11966 *)
11967         echo "Using $hint value $eagain."
11968         echo "Your read() returns $rd_nodata when no data is present."
11969         case "$d_eofnblk" in
11970         "$define") echo "And you can see EOF because read() returns 0.";;
11971         "$undef") echo "But you can't see EOF status from read() returned value.";;
11972         *)
11973                 echo "(Assuming you can't see EOF status from read anyway.)"
11974                 d_eofnblk=$undef
11975                 ;;
11976         esac
11977         ;;
11978 esac
11979 $rm -f try try.* .out core head.c mtry
11980
11981 : see if _ptr and _cnt from stdio act std
11982 echo " "
11983
11984 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11985         echo "(Looks like you have stdio.h from BSD.)"
11986         case "$stdio_ptr" in
11987         '') stdio_ptr='((fp)->_p)'
11988                 ptr_lval=$define
11989                 ;;
11990         *)      ptr_lval=$d_stdio_ptr_lval;;
11991         esac
11992         case "$stdio_cnt" in
11993         '') stdio_cnt='((fp)->_r)'
11994                 cnt_lval=$define
11995                 ;;
11996         *)      cnt_lval=$d_stdio_cnt_lval;;
11997         esac
11998         case "$stdio_base" in
11999         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12000         esac
12001         case "$stdio_bufsiz" in
12002         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12003         esac
12004 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12005         echo "(Looks like you have stdio.h from Linux.)"
12006         case "$stdio_ptr" in
12007         '') stdio_ptr='((fp)->_IO_read_ptr)'
12008                 ptr_lval=$define
12009                 ;;
12010         *)      ptr_lval=$d_stdio_ptr_lval;;
12011         esac
12012         case "$stdio_cnt" in
12013         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12014                 cnt_lval=$undef
12015                 ;;
12016         *)      cnt_lval=$d_stdio_cnt_lval;;
12017         esac
12018         case "$stdio_base" in
12019         '') stdio_base='((fp)->_IO_read_base)';;
12020         esac
12021         case "$stdio_bufsiz" in
12022         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12023         esac
12024 else
12025         case "$stdio_ptr" in
12026         '') stdio_ptr='((fp)->_ptr)'
12027                 ptr_lval=$define
12028                 ;;
12029         *)      ptr_lval=$d_stdio_ptr_lval;;
12030         esac
12031         case "$stdio_cnt" in
12032         '') stdio_cnt='((fp)->_cnt)'
12033                 cnt_lval=$define
12034                 ;;
12035         *)      cnt_lval=$d_stdio_cnt_lval;;
12036         esac
12037         case "$stdio_base" in
12038         '') stdio_base='((fp)->_base)';;
12039         esac
12040         case "$stdio_bufsiz" in
12041         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12042         esac
12043 fi
12044
12045 : test whether _ptr and _cnt really work
12046 echo "Checking how std your stdio is..." >&4
12047 $cat >try.c <<EOP
12048 #include <stdio.h>
12049 #$i_stdlib I_STDLIB
12050 #ifdef I_STDLIB
12051 #include <stdlib.h>
12052 #endif
12053 #define FILE_ptr(fp)    $stdio_ptr
12054 #define FILE_cnt(fp)    $stdio_cnt
12055 int main() {
12056         FILE *fp = fopen("try.c", "r");
12057         char c = getc(fp);
12058         if (
12059                 18 <= FILE_cnt(fp) &&
12060                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12061         )
12062                 exit(0);
12063         exit(1);
12064 }
12065 EOP
12066 val="$undef"
12067 set try
12068 if eval $compile && $to try.c; then
12069         if $run ./try; then
12070                 echo "Your stdio acts pretty std."
12071                 val="$define"
12072         else
12073                 echo "Your stdio isn't very std."
12074         fi
12075 else
12076         echo "Your stdio doesn't appear very std."
12077 fi
12078 $rm -f try.c try
12079
12080 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12081 # direct buffer manipulation no longer works.  The Configure tests
12082 # should be changed to correctly detect this, but until then,
12083 # the following check should at least let perl compile and run.
12084 # (This quick fix should be updated before 5.8.1.)
12085 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12086 # A. Dougherty, June 3, 2002.
12087 case "$d_gnulibc" in
12088 $define)
12089         case "$gnulibc_version" in
12090         2.[01]*)  ;;
12091         2.2) ;;
12092         2.2.[0-9]) ;;
12093         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12094                 val="$undef"
12095                 ;;
12096         esac
12097         ;;
12098 esac
12099 set d_stdstdio
12100 eval $setvar
12101
12102 : Can _ptr be used as an lvalue?
12103 case "$d_stdstdio$ptr_lval" in
12104 $define$define) val=$define ;;
12105 *) val=$undef ;;
12106 esac
12107 set d_stdio_ptr_lval
12108 eval $setvar
12109
12110 : Can _cnt be used as an lvalue?
12111 case "$d_stdstdio$cnt_lval" in
12112 $define$define) val=$define ;;
12113 *) val=$undef ;;
12114 esac
12115 set d_stdio_cnt_lval
12116 eval $setvar
12117
12118
12119 : test whether setting _ptr sets _cnt as a side effect
12120 d_stdio_ptr_lval_sets_cnt="$undef"
12121 d_stdio_ptr_lval_nochange_cnt="$undef"
12122 case "$d_stdio_ptr_lval$d_stdstdio" in
12123 $define$define)
12124         echo "Checking to see what happens if we set the stdio ptr..." >&4
12125 $cat >try.c <<EOP
12126 #include <stdio.h>
12127 /* Can we scream? */
12128 /* Eat dust sed :-) */
12129 /* In the buffer space, no one can hear you scream. */
12130 #$i_stdlib I_STDLIB
12131 #ifdef I_STDLIB
12132 #include <stdlib.h>
12133 #endif
12134 #define FILE_ptr(fp)    $stdio_ptr
12135 #define FILE_cnt(fp)    $stdio_cnt
12136 #include <sys/types.h>
12137 int main() {
12138         FILE *fp = fopen("try.c", "r");
12139         int c;
12140         char *ptr;
12141         size_t cnt;
12142         if (!fp) {
12143             puts("Fail even to read");
12144             exit(1);
12145         }
12146         c = getc(fp); /* Read away the first # */
12147         if (c == EOF) {
12148             puts("Fail even to read");
12149             exit(1);
12150         }
12151         if (!(
12152                 18 <= FILE_cnt(fp) &&
12153                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12154         )) {
12155                 puts("Fail even to read");
12156                 exit (1);
12157         }
12158         ptr = (char*) FILE_ptr(fp);
12159         cnt = (size_t)FILE_cnt(fp);
12160
12161         FILE_ptr(fp) += 42;
12162
12163         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12164                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12165                 exit (1);
12166         }
12167         if (FILE_cnt(fp) <= 20) {
12168                 printf ("Fail (<20 chars to test)");
12169                 exit (1);
12170         }
12171         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12172                 puts("Fail compare");
12173                 exit (1);
12174         }
12175         if (cnt == FILE_cnt(fp)) {
12176                 puts("Pass_unchanged");
12177                 exit (0);
12178         }       
12179         if (FILE_cnt(fp) == (cnt - 42)) {
12180                 puts("Pass_changed");
12181                 exit (0);
12182         }
12183         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12184         return 1;
12185
12186 }
12187 EOP
12188         set try
12189         if eval $compile && $to try.c; then
12190                 case `$run ./try` in
12191                 Pass_changed)
12192                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12193                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12194                 Pass_unchanged)
12195                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12196                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12197                 Fail*)
12198                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12199                 *)
12200                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12201         esac
12202         else
12203                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12204         fi
12205         $rm -f try.c try
12206         ;;
12207 esac
12208
12209 : see if _base is also standard
12210 val="$undef"
12211 case "$d_stdstdio" in
12212 $define)
12213         $cat >try.c <<EOP
12214 #include <stdio.h>
12215 #$i_stdlib I_STDLIB
12216 #ifdef I_STDLIB
12217 #include <stdlib.h>
12218 #endif
12219 #define FILE_base(fp)   $stdio_base
12220 #define FILE_bufsiz(fp) $stdio_bufsiz
12221 int main() {
12222         FILE *fp = fopen("try.c", "r");
12223         char c = getc(fp);
12224         if (
12225                 19 <= FILE_bufsiz(fp) &&
12226                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12227         )
12228                 exit(0);
12229         exit(1);
12230 }
12231 EOP
12232         set try
12233         if eval $compile && $to try.c; then
12234                 if $run ./try; then
12235                         echo "And its _base field acts std."
12236                         val="$define"
12237                 else
12238                         echo "But its _base field isn't std."
12239                 fi
12240         else
12241                 echo "However, it seems to be lacking the _base field."
12242         fi
12243         $rm -f try.c try
12244         ;;
12245 esac
12246 set d_stdiobase
12247 eval $setvar
12248
12249 : see if fast_stdio exists
12250 val="$undef"
12251 case "$d_stdstdio:$d_stdio_ptr_lval" in
12252 "$define:$define")
12253         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12254         *$define*)
12255                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12256                 val="$define"
12257                 ;;
12258         esac
12259         ;;
12260 esac
12261 set d_faststdio
12262 eval $setvar
12263
12264
12265
12266 : see if fchdir exists
12267 set fchdir d_fchdir
12268 eval $inlibc
12269
12270 : see if fchmod exists
12271 set fchmod d_fchmod
12272 eval $inlibc
12273
12274 : see if fchown exists
12275 set fchown d_fchown
12276 eval $inlibc
12277
12278 : see if this is an fcntl system
12279 set fcntl d_fcntl
12280 eval $inlibc
12281
12282 echo " "
12283 : See if fcntl-based locking works.
12284 $cat >try.c <<EOCP
12285 #$i_stdlib I_STDLIB
12286 #ifdef I_STDLIB
12287 #include <stdlib.h>
12288 #endif
12289 #include <unistd.h>
12290 #include <fcntl.h>
12291 #include <signal.h>
12292 $signal_t blech(x) int x; { exit(3); }
12293 int main() {
12294 #if defined(F_SETLK) && defined(F_SETLKW)
12295      struct flock flock;
12296      int retval, fd;
12297      fd = open("try.c", O_RDONLY);
12298      flock.l_type = F_RDLCK;
12299      flock.l_whence = SEEK_SET;
12300      flock.l_start = flock.l_len = 0;
12301      signal(SIGALRM, blech);
12302      alarm(10);
12303      retval = fcntl(fd, F_SETLK, &flock);
12304      close(fd);
12305      (retval < 0 ? exit(2) : exit(0));
12306 #else
12307      exit(2);
12308 #endif
12309 }
12310 EOCP
12311 echo "Checking if fcntl-based file locking works... "
12312 case "$d_fcntl" in
12313 "$define")
12314         set try
12315         if eval $compile_ok; then
12316                 if $run ./try; then
12317                         echo "Yes, it seems to work."
12318                         val="$define"
12319                 else
12320                         echo "Nope, it didn't work."
12321                         val="$undef"
12322                         case "$?" in
12323                         3) $cat >&4 <<EOM
12324 ***
12325 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12326 *** This is (almost) impossible.
12327 *** If your NFS lock daemons are not feeling well, something like
12328 *** this may happen, please investigate.  Cannot continue, aborting.
12329 ***
12330 EOM
12331                                 exit 1
12332                                 ;;
12333                         esac
12334                 fi
12335         else
12336                 echo "I'm unable to compile the test program, so I'll assume not."
12337                 val="$undef"
12338         fi
12339         ;;
12340 *) val="$undef";
12341         echo "Nope, since you don't even have fcntl()."
12342         ;;
12343 esac
12344 set d_fcntl_can_lock
12345 eval $setvar
12346 $rm -f try*
12347
12348
12349 : check for fd_set items
12350 $cat <<EOM
12351
12352 Checking to see how well your C compiler handles fd_set and friends ...
12353 EOM
12354 $cat >try.c <<EOCP
12355 #$i_stdlib I_STDLIB
12356 #ifdef I_STDLIB
12357 #include <stdlib.h>
12358 #endif
12359 #$i_systime I_SYS_TIME
12360 #$i_sysselct I_SYS_SELECT
12361 #$d_socket HAS_SOCKET
12362 #include <sys/types.h>
12363 #ifdef HAS_SOCKET
12364 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12365 #endif
12366 #ifdef I_SYS_TIME
12367 #include <sys/time.h>
12368 #endif
12369 #ifdef I_SYS_SELECT
12370 #include <sys/select.h>
12371 #endif
12372 int main() {
12373         fd_set fds;
12374
12375 #ifdef TRYBITS
12376         if(fds.fds_bits);
12377 #endif
12378
12379 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12380         exit(0);
12381 #else
12382         exit(1);
12383 #endif
12384 }
12385 EOCP
12386 set try -DTRYBITS
12387 if eval $compile; then
12388         d_fds_bits="$define"
12389         d_fd_set="$define"
12390         echo "Well, your system knows about the normal fd_set typedef..." >&4
12391         if $run ./try; then
12392                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12393                 d_fd_macros="$define"
12394         else
12395                 $cat >&4 <<'EOM'
12396 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12397 EOM
12398                 d_fd_macros="$undef"
12399         fi
12400 else
12401         $cat <<'EOM'
12402 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12403 EOM
12404         set try
12405         if eval $compile; then
12406                 d_fds_bits="$undef"
12407                 d_fd_set="$define"
12408                 echo "Well, your system has some sort of fd_set available..." >&4
12409                 if $run ./try; then
12410                         echo "and you have the normal fd_set macros." >&4
12411                         d_fd_macros="$define"
12412                 else
12413                         $cat <<'EOM'
12414 but not the normal fd_set macros!  Gross!  More work for me...
12415 EOM
12416                         d_fd_macros="$undef"
12417                 fi
12418         else
12419         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12420                 d_fd_set="$undef"
12421                 d_fds_bits="$undef"
12422                 d_fd_macros="$undef"
12423         fi
12424 fi
12425 $rm -f try try.*
12426
12427 : see if fgetpos exists
12428 set fgetpos d_fgetpos
12429 eval $inlibc
12430
12431 : see if finite exists
12432 set finite d_finite
12433 eval $inlibc
12434
12435 : see if finitel exists
12436 set finitel d_finitel
12437 eval $inlibc
12438
12439 : see if flock exists
12440 set flock d_flock
12441 eval $inlibc
12442
12443 : see if prototype for flock is available
12444 echo " "
12445 set d_flockproto flock $i_sysfile sys/file.h
12446 eval $hasproto
12447
12448 : see if fork exists
12449 set fork d_fork
12450 eval $inlibc
12451
12452 : see if fp_class exists
12453 set fp_class d_fp_class
12454 eval $inlibc
12455
12456 : see if pathconf exists
12457 set pathconf d_pathconf
12458 eval $inlibc
12459
12460 : see if fpathconf exists
12461 set fpathconf d_fpathconf
12462 eval $inlibc
12463
12464 : see if fpclass exists
12465 set fpclass d_fpclass
12466 eval $inlibc
12467
12468 : see if fpclassify exists
12469 set fpclassify d_fpclassify
12470 eval $inlibc
12471
12472 : see if fpclassl exists
12473 set fpclassl d_fpclassl
12474 eval $inlibc
12475
12476
12477 : check for fpos64_t
12478 echo " "
12479 echo "Checking to see if you have fpos64_t..." >&4
12480 $cat >try.c <<EOCP
12481 #include <stdio.h>
12482 int main() { fpos64_t x = 7; }
12483 EOCP
12484 set try
12485 if eval $compile; then
12486         val="$define"
12487         echo "You have fpos64_t."
12488 else
12489         val="$undef"
12490         echo "You do not have fpos64_t."
12491         case "$fpossize" in
12492         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12493         esac
12494 fi
12495 $rm -f try.* try
12496 set d_fpos64_t
12497 eval $setvar
12498
12499 : see if frexpl exists
12500 set frexpl d_frexpl
12501 eval $inlibc
12502
12503 : see if this is a sys/param system
12504 set sys/param.h i_sysparam
12505 eval $inhdr
12506
12507 : see if this is a sys/mount.h system
12508 set sys/mount.h i_sysmount
12509 eval $inhdr
12510
12511
12512 echo " "
12513 echo "Checking to see if your system supports struct fs_data..." >&4
12514 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12515 eval $hasstruct
12516 case "$d_fs_data_s" in
12517 "$define")      echo "Yes, it does."   ;;
12518 *)              echo "No, it doesn't." ;;
12519 esac
12520
12521 : see if fseeko exists
12522 set fseeko d_fseeko
12523 eval $inlibc
12524 case "$longsize" in
12525 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12526 esac
12527
12528 : see if fsetpos exists
12529 set fsetpos d_fsetpos
12530 eval $inlibc
12531
12532
12533 : see if fstatfs exists
12534 set fstatfs d_fstatfs
12535 eval $inlibc
12536
12537
12538 : see if statvfs exists
12539 set statvfs d_statvfs
12540 eval $inlibc
12541
12542 : see if fstatvfs exists
12543 set fstatvfs d_fstatvfs
12544 eval $inlibc
12545
12546
12547 : see if fsync exists
12548 set fsync d_fsync
12549 eval $inlibc
12550
12551 : see if ftello exists
12552 set ftello d_ftello
12553 eval $inlibc
12554 case "$longsize" in
12555 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12556 esac
12557
12558 : see if getcwd exists
12559 set getcwd d_getcwd
12560 eval $inlibc
12561
12562 : see if getespwnam exists
12563 set getespwnam d_getespwnam
12564 eval $inlibc
12565
12566
12567 : see if getfsstat exists
12568 set getfsstat d_getfsstat
12569 eval $inlibc
12570
12571 : see if getgrent exists
12572 set getgrent d_getgrent
12573 eval $inlibc
12574
12575 : see if getgrent_r exists
12576 set getgrent_r d_getgrent_r
12577 eval $inlibc
12578 case "$d_getgrent_r" in
12579 "$define")
12580         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12581         case "$d_getgrent_r_proto:$usethreads" in
12582         ":define")      d_getgrent_r_proto=define
12583                 set d_getgrent_r_proto getgrent_r $hdrs
12584                 eval $hasproto ;;
12585         *)      ;;
12586         esac
12587         case "$d_getgrent_r_proto" in
12588         define)
12589         case "$getgrent_r_proto" in
12590         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12591         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12592         esac
12593         case "$getgrent_r_proto" in
12594         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12595         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12596         esac
12597         case "$getgrent_r_proto" in
12598         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12599         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12600         esac
12601         case "$getgrent_r_proto" in
12602         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12603         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12604         esac
12605         case "$getgrent_r_proto" in
12606         ''|0) try='int getgrent_r(struct group*, char*, int);'
12607         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12608         esac
12609         case "$getgrent_r_proto" in
12610         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12611         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12612         esac
12613         case "$getgrent_r_proto" in
12614         ''|0)   d_getgrent_r=undef
12615                 getgrent_r_proto=0
12616                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12617         * )     case "$getgrent_r_proto" in
12618                 REENTRANT_PROTO*) ;;
12619                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12620                 esac
12621                 echo "Prototype: $try" ;;
12622         esac
12623         ;;
12624         *)      case "$usethreads" in
12625                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12626                 esac
12627                 d_getgrent_r=undef
12628                 getgrent_r_proto=0
12629                 ;;
12630         esac
12631         ;;
12632 *)      getgrent_r_proto=0
12633         ;;
12634 esac
12635
12636 : see if getgrgid_r exists
12637 set getgrgid_r d_getgrgid_r
12638 eval $inlibc
12639 case "$d_getgrgid_r" in
12640 "$define")
12641         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12642         case "$d_getgrgid_r_proto:$usethreads" in
12643         ":define")      d_getgrgid_r_proto=define
12644                 set d_getgrgid_r_proto getgrgid_r $hdrs
12645                 eval $hasproto ;;
12646         *)      ;;
12647         esac
12648         case "$d_getgrgid_r_proto" in
12649         define)
12650         case "$getgrgid_r_proto" in
12651         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12652         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12653         esac
12654         case "$getgrgid_r_proto" in
12655         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12656         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12657         esac
12658         case "$getgrgid_r_proto" in
12659         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12660         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12661         esac
12662         case "$getgrgid_r_proto" in
12663         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12664         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12665         esac
12666         case "$getgrgid_r_proto" in
12667         ''|0)   d_getgrgid_r=undef
12668                 getgrgid_r_proto=0
12669                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12670         * )     case "$getgrgid_r_proto" in
12671                 REENTRANT_PROTO*) ;;
12672                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12673                 esac
12674                 echo "Prototype: $try" ;;
12675         esac
12676         ;;
12677         *)      case "$usethreads" in
12678                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12679                 esac
12680                 d_getgrgid_r=undef
12681                 getgrgid_r_proto=0
12682                 ;;
12683         esac
12684         ;;
12685 *)      getgrgid_r_proto=0
12686         ;;
12687 esac
12688
12689 : see if getgrnam_r exists
12690 set getgrnam_r d_getgrnam_r
12691 eval $inlibc
12692 case "$d_getgrnam_r" in
12693 "$define")
12694         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12695         case "$d_getgrnam_r_proto:$usethreads" in
12696         ":define")      d_getgrnam_r_proto=define
12697                 set d_getgrnam_r_proto getgrnam_r $hdrs
12698                 eval $hasproto ;;
12699         *)      ;;
12700         esac
12701         case "$d_getgrnam_r_proto" in
12702         define)
12703         case "$getgrnam_r_proto" in
12704         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12705         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12706         esac
12707         case "$getgrnam_r_proto" in
12708         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12709         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12710         esac
12711         case "$getgrnam_r_proto" in
12712         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12713         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12714         esac
12715         case "$getgrnam_r_proto" in
12716         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12717         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12718         esac
12719         case "$getgrnam_r_proto" in
12720         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12721         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12722         esac
12723         case "$getgrnam_r_proto" in
12724         ''|0)   d_getgrnam_r=undef
12725                 getgrnam_r_proto=0
12726                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12727         * )     case "$getgrnam_r_proto" in
12728                 REENTRANT_PROTO*) ;;
12729                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12730                 esac
12731                 echo "Prototype: $try" ;;
12732         esac
12733         ;;
12734         *)      case "$usethreads" in
12735                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12736                 esac
12737                 d_getgrnam_r=undef
12738                 getgrnam_r_proto=0
12739                 ;;
12740         esac
12741         ;;
12742 *)      getgrnam_r_proto=0
12743         ;;
12744 esac
12745
12746 : see if gethostbyaddr exists
12747 set gethostbyaddr d_gethbyaddr
12748 eval $inlibc
12749
12750 : see if gethostbyname exists
12751 set gethostbyname d_gethbyname
12752 eval $inlibc
12753
12754 : see if gethostent exists
12755 set gethostent d_gethent
12756 eval $inlibc
12757
12758 : see how we will look up host name
12759 echo " "
12760 call=''
12761 if set gethostname val -f d_gethname; eval $csym; $val; then
12762         echo 'gethostname() found.' >&4
12763         d_gethname="$define"
12764         call=gethostname
12765 fi
12766 if set uname val -f d_uname; eval $csym; $val; then
12767         if ./xenix; then
12768                 $cat <<'EOM'
12769 uname() was found, but you're running xenix, and older versions of xenix
12770 have a broken uname(). If you don't really know whether your xenix is old
12771 enough to have a broken system call, use the default answer.
12772
12773 EOM
12774                 dflt=y
12775                 case "$d_uname" in
12776                 "$define") dflt=n;;
12777                 esac
12778                 rp='Is your uname() broken?'
12779                 . ./myread
12780                 case "$ans" in
12781                 n*) d_uname="$define"; call=uname;;
12782                 esac
12783         else
12784                 echo 'uname() found.' >&4
12785                 d_uname="$define"
12786                 case "$call" in
12787                 '') call=uname ;;
12788                 esac
12789         fi
12790 fi
12791 case "$d_gethname" in
12792 '') d_gethname="$undef";;
12793 esac
12794 case "$d_uname" in
12795 '') d_uname="$undef";;
12796 esac
12797 case "$d_uname$d_gethname" in
12798 *define*)
12799         dflt=n
12800         cat <<EOM
12801  
12802 Every now and then someone has a $call() that lies about the hostname
12803 but can't be fixed for political or economic reasons.  If you wish, I can
12804 pretend $call() isn't there and maybe compute hostname at run-time
12805 thanks to the '$phostname' command.
12806
12807 EOM
12808         rp="Shall I ignore $call() from now on?"
12809         . ./myread
12810         case "$ans" in
12811         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12812         esac;;
12813 esac
12814 case "$phostname" in
12815 '') aphostname='';;
12816 *) case "$aphostname" in
12817         /*) ;;
12818         *) set X $phostname
12819                 shift
12820                 file=$1
12821                 shift
12822                 file=`./loc $file $file $pth`
12823                 aphostname=`echo $file $*`
12824                 ;;
12825         esac
12826         ;;
12827 esac
12828 case "$d_uname$d_gethname" in
12829 *define*) ;;
12830 *)
12831         case "$phostname" in
12832         '')
12833                 echo "There will be no way for $package to get your hostname." >&4;;
12834         *)
12835         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12836                 ;;
12837         esac;;
12838 esac
12839 case "$d_phostname" in
12840 '') d_phostname="$undef";;
12841 esac
12842
12843 : see if gethostbyaddr_r exists
12844 set gethostbyaddr_r d_gethostbyaddr_r
12845 eval $inlibc
12846 case "$d_gethostbyaddr_r" in
12847 "$define")
12848         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12849         case "$d_gethostbyaddr_r_proto:$usethreads" in
12850         ":define")      d_gethostbyaddr_r_proto=define
12851                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12852                 eval $hasproto ;;
12853         *)      ;;
12854         esac
12855         case "$d_gethostbyaddr_r_proto" in
12856         define)
12857         case "$gethostbyaddr_r_proto" in
12858         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12859         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12860         esac
12861         case "$gethostbyaddr_r_proto" in
12862         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12863         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12864         esac
12865         case "$gethostbyaddr_r_proto" in
12866         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12867         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12868         esac
12869         case "$gethostbyaddr_r_proto" in
12870         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12871         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12872         esac
12873         case "$gethostbyaddr_r_proto" in
12874         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12875         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12876         esac
12877         case "$gethostbyaddr_r_proto" in
12878         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12879         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12880         esac
12881         case "$gethostbyaddr_r_proto" in
12882         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12883         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12884         esac
12885         case "$gethostbyaddr_r_proto" in
12886         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12887         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12888         esac
12889         case "$gethostbyaddr_r_proto" in
12890         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12891         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12892         esac
12893         case "$gethostbyaddr_r_proto" in
12894         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12895         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12896         esac
12897         case "$gethostbyaddr_r_proto" in
12898         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12899         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12900         esac
12901         case "$gethostbyaddr_r_proto" in
12902         ''|0)   d_gethostbyaddr_r=undef
12903                 gethostbyaddr_r_proto=0
12904                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12905         * )     case "$gethostbyaddr_r_proto" in
12906                 REENTRANT_PROTO*) ;;
12907                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12908                 esac
12909                 echo "Prototype: $try" ;;
12910         esac
12911         ;;
12912         *)      case "$usethreads" in
12913                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12914                 esac
12915                 d_gethostbyaddr_r=undef
12916                 gethostbyaddr_r_proto=0
12917                 ;;
12918         esac
12919         ;;
12920 *)      gethostbyaddr_r_proto=0
12921         ;;
12922 esac
12923
12924 : see if gethostbyname_r exists
12925 set gethostbyname_r d_gethostbyname_r
12926 eval $inlibc
12927 case "$d_gethostbyname_r" in
12928 "$define")
12929         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12930         case "$d_gethostbyname_r_proto:$usethreads" in
12931         ":define")      d_gethostbyname_r_proto=define
12932                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12933                 eval $hasproto ;;
12934         *)      ;;
12935         esac
12936         case "$d_gethostbyname_r_proto" in
12937         define)
12938         case "$gethostbyname_r_proto" in
12939         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12940         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12941         esac
12942         case "$gethostbyname_r_proto" in
12943         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12944         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12945         esac
12946         case "$gethostbyname_r_proto" in
12947         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12948         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12949         esac
12950         case "$gethostbyname_r_proto" in
12951         ''|0)   d_gethostbyname_r=undef
12952                 gethostbyname_r_proto=0
12953                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12954         * )     case "$gethostbyname_r_proto" in
12955                 REENTRANT_PROTO*) ;;
12956                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12957                 esac
12958                 echo "Prototype: $try" ;;
12959         esac
12960         ;;
12961         *)      case "$usethreads" in
12962                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12963                 esac
12964                 d_gethostbyname_r=undef
12965                 gethostbyname_r_proto=0
12966                 ;;
12967         esac
12968         ;;
12969 *)      gethostbyname_r_proto=0
12970         ;;
12971 esac
12972
12973 : see if gethostent_r exists
12974 set gethostent_r d_gethostent_r
12975 eval $inlibc
12976 case "$d_gethostent_r" in
12977 "$define")
12978         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12979         case "$d_gethostent_r_proto:$usethreads" in
12980         ":define")      d_gethostent_r_proto=define
12981                 set d_gethostent_r_proto gethostent_r $hdrs
12982                 eval $hasproto ;;
12983         *)      ;;
12984         esac
12985         case "$d_gethostent_r_proto" in
12986         define)
12987         case "$gethostent_r_proto" in
12988         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12989         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12990         esac
12991         case "$gethostent_r_proto" in
12992         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12993         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12994         esac
12995         case "$gethostent_r_proto" in
12996         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12997         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12998         esac
12999         case "$gethostent_r_proto" in
13000         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13001         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13002         esac
13003         case "$gethostent_r_proto" in
13004         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13005         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13006         esac
13007         case "$gethostent_r_proto" in
13008         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13009         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13010         esac
13011         case "$gethostent_r_proto" in
13012         ''|0)   d_gethostent_r=undef
13013                 gethostent_r_proto=0
13014                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13015         * )     case "$gethostent_r_proto" in
13016                 REENTRANT_PROTO*) ;;
13017                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13018                 esac
13019                 echo "Prototype: $try" ;;
13020         esac
13021         ;;
13022         *)      case "$usethreads" in
13023                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13024                 esac
13025                 d_gethostent_r=undef
13026                 gethostent_r_proto=0
13027                 ;;
13028         esac
13029         ;;
13030 *)      gethostent_r_proto=0
13031         ;;
13032 esac
13033
13034 : see if prototypes for various gethostxxx netdb.h functions are available
13035 echo " "
13036 set d_gethostprotos gethostent $i_netdb netdb.h
13037 eval $hasproto
13038
13039 : see if getitimer exists
13040 set getitimer d_getitimer
13041 eval $inlibc
13042
13043 : see if getlogin exists
13044 set getlogin d_getlogin
13045 eval $inlibc
13046
13047 : see if getlogin_r exists
13048 set getlogin_r d_getlogin_r
13049 eval $inlibc
13050 case "$d_getlogin_r" in
13051 "$define")
13052         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13053         case "$d_getlogin_r_proto:$usethreads" in
13054         ":define")      d_getlogin_r_proto=define
13055                 set d_getlogin_r_proto getlogin_r $hdrs
13056                 eval $hasproto ;;
13057         *)      ;;
13058         esac
13059         case "$d_getlogin_r_proto" in
13060         define)
13061         case "$getlogin_r_proto" in
13062         ''|0) try='int getlogin_r(char*, size_t);'
13063         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13064         esac
13065         case "$getlogin_r_proto" in
13066         ''|0) try='int getlogin_r(char*, int);'
13067         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13068         esac
13069         case "$getlogin_r_proto" in
13070         ''|0) try='char* getlogin_r(char*, size_t);'
13071         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13072         esac
13073         case "$getlogin_r_proto" in
13074         ''|0) try='char* getlogin_r(char*, int);'
13075         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13076         esac
13077         case "$getlogin_r_proto" in
13078         ''|0)   d_getlogin_r=undef
13079                 getlogin_r_proto=0
13080                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13081         * )     case "$getlogin_r_proto" in
13082                 REENTRANT_PROTO*) ;;
13083                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13084                 esac
13085                 echo "Prototype: $try" ;;
13086         esac
13087         ;;
13088         *)      case "$usethreads" in
13089                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13090                 esac
13091                 d_getlogin_r=undef
13092                 getlogin_r_proto=0
13093                 ;;
13094         esac
13095         ;;
13096 *)      getlogin_r_proto=0
13097         ;;
13098 esac
13099
13100 : see if getmnt exists
13101 set getmnt d_getmnt
13102 eval $inlibc
13103
13104 : see if getmntent exists
13105 set getmntent d_getmntent
13106 eval $inlibc
13107
13108 : see if getnetbyaddr exists
13109 set getnetbyaddr d_getnbyaddr
13110 eval $inlibc
13111
13112 : see if getnetbyname exists
13113 set getnetbyname d_getnbyname
13114 eval $inlibc
13115
13116 : see if getnetent exists
13117 set getnetent d_getnent
13118 eval $inlibc
13119
13120 : see if getnetbyaddr_r exists
13121 set getnetbyaddr_r d_getnetbyaddr_r
13122 eval $inlibc
13123 case "$d_getnetbyaddr_r" in
13124 "$define")
13125         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13126         case "$d_getnetbyaddr_r_proto:$usethreads" in
13127         ":define")      d_getnetbyaddr_r_proto=define
13128                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13129                 eval $hasproto ;;
13130         *)      ;;
13131         esac
13132         case "$d_getnetbyaddr_r_proto" in
13133         define)
13134         case "$getnetbyaddr_r_proto" in
13135         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13136         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13137         esac
13138         case "$getnetbyaddr_r_proto" in
13139         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13140         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13141         esac
13142         case "$getnetbyaddr_r_proto" in
13143         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13144         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13145         esac
13146         case "$getnetbyaddr_r_proto" in
13147         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13148         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13149         esac
13150         case "$getnetbyaddr_r_proto" in
13151         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13152         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13153         esac
13154         case "$getnetbyaddr_r_proto" in
13155         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13156         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13157         esac
13158         case "$getnetbyaddr_r_proto" in
13159         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13160         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13161         esac
13162         case "$getnetbyaddr_r_proto" in
13163         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13164         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13165         esac
13166         case "$getnetbyaddr_r_proto" in
13167         ''|0)   d_getnetbyaddr_r=undef
13168                 getnetbyaddr_r_proto=0
13169                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13170         * )     case "$getnetbyaddr_r_proto" in
13171                 REENTRANT_PROTO*) ;;
13172                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13173                 esac
13174                 echo "Prototype: $try" ;;
13175         esac
13176         ;;
13177         *)      case "$usethreads" in
13178                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13179                 esac
13180                 d_getnetbyaddr_r=undef
13181                 getnetbyaddr_r_proto=0
13182                 ;;
13183         esac
13184         ;;
13185 *)      getnetbyaddr_r_proto=0
13186         ;;
13187 esac
13188
13189 : see if getnetbyname_r exists
13190 set getnetbyname_r d_getnetbyname_r
13191 eval $inlibc
13192 case "$d_getnetbyname_r" in
13193 "$define")
13194         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13195         case "$d_getnetbyname_r_proto:$usethreads" in
13196         ":define")      d_getnetbyname_r_proto=define
13197                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13198                 eval $hasproto ;;
13199         *)      ;;
13200         esac
13201         case "$d_getnetbyname_r_proto" in
13202         define)
13203         case "$getnetbyname_r_proto" in
13204         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13205         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13206         esac
13207         case "$getnetbyname_r_proto" in
13208         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13209         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13210         esac
13211         case "$getnetbyname_r_proto" in
13212         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13213         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13214         esac
13215         case "$getnetbyname_r_proto" in
13216         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13217         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13218         esac
13219         case "$getnetbyname_r_proto" in
13220         ''|0)   d_getnetbyname_r=undef
13221                 getnetbyname_r_proto=0
13222                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13223         * )     case "$getnetbyname_r_proto" in
13224                 REENTRANT_PROTO*) ;;
13225                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13226                 esac
13227                 echo "Prototype: $try" ;;
13228         esac
13229         ;;
13230         *)      case "$usethreads" in
13231                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13232                 esac
13233                 d_getnetbyname_r=undef
13234                 getnetbyname_r_proto=0
13235                 ;;
13236         esac
13237         ;;
13238 *)      getnetbyname_r_proto=0
13239         ;;
13240 esac
13241
13242 : see if getnetent_r exists
13243 set getnetent_r d_getnetent_r
13244 eval $inlibc
13245 case "$d_getnetent_r" in
13246 "$define")
13247         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13248         case "$d_getnetent_r_proto:$usethreads" in
13249         ":define")      d_getnetent_r_proto=define
13250                 set d_getnetent_r_proto getnetent_r $hdrs
13251                 eval $hasproto ;;
13252         *)      ;;
13253         esac
13254         case "$d_getnetent_r_proto" in
13255         define)
13256         case "$getnetent_r_proto" in
13257         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13258         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13259         esac
13260         case "$getnetent_r_proto" in
13261         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13262         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13263         esac
13264         case "$getnetent_r_proto" in
13265         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13266         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13267         esac
13268         case "$getnetent_r_proto" in
13269         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13270         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13271         esac
13272         case "$getnetent_r_proto" in
13273         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13274         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13275         esac
13276         case "$getnetent_r_proto" in
13277         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13278         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13279         esac
13280         case "$getnetent_r_proto" in
13281         ''|0)   d_getnetent_r=undef
13282                 getnetent_r_proto=0
13283                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13284         * )     case "$getnetent_r_proto" in
13285                 REENTRANT_PROTO*) ;;
13286                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13287                 esac
13288                 echo "Prototype: $try" ;;
13289         esac
13290         ;;
13291         *)      case "$usethreads" in
13292                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13293                 esac
13294                 d_getnetent_r=undef
13295                 getnetent_r_proto=0
13296                 ;;
13297         esac
13298         ;;
13299 *)      getnetent_r_proto=0
13300         ;;
13301 esac
13302
13303 : see if prototypes for various getnetxxx netdb.h functions are available
13304 echo " "
13305 set d_getnetprotos getnetent $i_netdb netdb.h
13306 eval $hasproto
13307
13308 : see if getpagesize exists
13309 set getpagesize d_getpagsz
13310 eval $inlibc
13311
13312
13313 : see if getprotobyname exists
13314 set getprotobyname d_getpbyname
13315 eval $inlibc
13316
13317 : see if getprotobynumber exists
13318 set getprotobynumber d_getpbynumber
13319 eval $inlibc
13320
13321 : see if getprotoent exists
13322 set getprotoent d_getpent
13323 eval $inlibc
13324
13325 : see if getpgid exists
13326 set getpgid d_getpgid
13327 eval $inlibc
13328
13329 : see if getpgrp2 exists
13330 set getpgrp2 d_getpgrp2
13331 eval $inlibc
13332
13333 : see if getppid exists
13334 set getppid d_getppid
13335 eval $inlibc
13336
13337 : see if getpriority exists
13338 set getpriority d_getprior
13339 eval $inlibc
13340
13341 : see if getprotobyname_r exists
13342 set getprotobyname_r d_getprotobyname_r
13343 eval $inlibc
13344 case "$d_getprotobyname_r" in
13345 "$define")
13346         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13347         case "$d_getprotobyname_r_proto:$usethreads" in
13348         ":define")      d_getprotobyname_r_proto=define
13349                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13350                 eval $hasproto ;;
13351         *)      ;;
13352         esac
13353         case "$d_getprotobyname_r_proto" in
13354         define)
13355         case "$getprotobyname_r_proto" in
13356         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13357         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13358         esac
13359         case "$getprotobyname_r_proto" in
13360         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13361         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13362         esac
13363         case "$getprotobyname_r_proto" in
13364         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13365         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13366         esac
13367         case "$getprotobyname_r_proto" in
13368         ''|0)   d_getprotobyname_r=undef
13369                 getprotobyname_r_proto=0
13370                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13371         * )     case "$getprotobyname_r_proto" in
13372                 REENTRANT_PROTO*) ;;
13373                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13374                 esac
13375                 echo "Prototype: $try" ;;
13376         esac
13377         ;;
13378         *)      case "$usethreads" in
13379                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13380                 esac
13381                 d_getprotobyname_r=undef
13382                 getprotobyname_r_proto=0
13383                 ;;
13384         esac
13385         ;;
13386 *)      getprotobyname_r_proto=0
13387         ;;
13388 esac
13389
13390 : see if getprotobynumber_r exists
13391 set getprotobynumber_r d_getprotobynumber_r
13392 eval $inlibc
13393 case "$d_getprotobynumber_r" in
13394 "$define")
13395         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13396         case "$d_getprotobynumber_r_proto:$usethreads" in
13397         ":define")      d_getprotobynumber_r_proto=define
13398                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13399                 eval $hasproto ;;
13400         *)      ;;
13401         esac
13402         case "$d_getprotobynumber_r_proto" in
13403         define)
13404         case "$getprotobynumber_r_proto" in
13405         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13406         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13407         esac
13408         case "$getprotobynumber_r_proto" in
13409         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13410         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13411         esac
13412         case "$getprotobynumber_r_proto" in
13413         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13414         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13415         esac
13416         case "$getprotobynumber_r_proto" in
13417         ''|0)   d_getprotobynumber_r=undef
13418                 getprotobynumber_r_proto=0
13419                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13420         * )     case "$getprotobynumber_r_proto" in
13421                 REENTRANT_PROTO*) ;;
13422                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13423                 esac
13424                 echo "Prototype: $try" ;;
13425         esac
13426         ;;
13427         *)      case "$usethreads" in
13428                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13429                 esac
13430                 d_getprotobynumber_r=undef
13431                 getprotobynumber_r_proto=0
13432                 ;;
13433         esac
13434         ;;
13435 *)      getprotobynumber_r_proto=0
13436         ;;
13437 esac
13438
13439 : see if getprotoent_r exists
13440 set getprotoent_r d_getprotoent_r
13441 eval $inlibc
13442 case "$d_getprotoent_r" in
13443 "$define")
13444         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13445         case "$d_getprotoent_r_proto:$usethreads" in
13446         ":define")      d_getprotoent_r_proto=define
13447                 set d_getprotoent_r_proto getprotoent_r $hdrs
13448                 eval $hasproto ;;
13449         *)      ;;
13450         esac
13451         case "$d_getprotoent_r_proto" in
13452         define)
13453         case "$getprotoent_r_proto" in
13454         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13455         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13456         esac
13457         case "$getprotoent_r_proto" in
13458         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13459         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13460         esac
13461         case "$getprotoent_r_proto" in
13462         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13463         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13464         esac
13465         case "$getprotoent_r_proto" in
13466         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13467         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13468         esac
13469         case "$getprotoent_r_proto" in
13470         ''|0)   d_getprotoent_r=undef
13471                 getprotoent_r_proto=0
13472                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13473         * )     case "$getprotoent_r_proto" in
13474                 REENTRANT_PROTO*) ;;
13475                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13476                 esac
13477                 echo "Prototype: $try" ;;
13478         esac
13479         ;;
13480         *)      case "$usethreads" in
13481                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13482                 esac
13483                 d_getprotoent_r=undef
13484                 getprotoent_r_proto=0
13485                 ;;
13486         esac
13487         ;;
13488 *)      getprotoent_r_proto=0
13489         ;;
13490 esac
13491
13492 : see if prototypes for various getprotoxxx netdb.h functions are available
13493 echo " "
13494 set d_getprotoprotos getprotoent $i_netdb netdb.h
13495 eval $hasproto
13496
13497 : see if getprpwnam exists
13498 set getprpwnam d_getprpwnam
13499 eval $inlibc
13500
13501 : see if getpwent exists
13502 set getpwent d_getpwent
13503 eval $inlibc
13504
13505 : see if getpwent_r exists
13506 set getpwent_r d_getpwent_r
13507 eval $inlibc
13508 case "$d_getpwent_r" in
13509 "$define")
13510         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13511         case "$d_getpwent_r_proto:$usethreads" in
13512         ":define")      d_getpwent_r_proto=define
13513                 set d_getpwent_r_proto getpwent_r $hdrs
13514                 eval $hasproto ;;
13515         *)      ;;
13516         esac
13517         case "$d_getpwent_r_proto" in
13518         define)
13519         case "$getpwent_r_proto" in
13520         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13521         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13522         esac
13523         case "$getpwent_r_proto" in
13524         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13525         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13526         esac
13527         case "$getpwent_r_proto" in
13528         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13529         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13530         esac
13531         case "$getpwent_r_proto" in
13532         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13533         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13534         esac
13535         case "$getpwent_r_proto" in
13536         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13537         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13538         esac
13539         case "$getpwent_r_proto" in
13540         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13541         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13542         esac
13543         case "$getpwent_r_proto" in
13544         ''|0)   d_getpwent_r=undef
13545                 getpwent_r_proto=0
13546                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13547         * )     case "$getpwent_r_proto" in
13548                 REENTRANT_PROTO*) ;;
13549                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13550                 esac
13551                 echo "Prototype: $try" ;;
13552         esac
13553         ;;
13554         *)      case "$usethreads" in
13555                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13556                 esac
13557                 d_getpwent_r=undef
13558                 getpwent_r_proto=0
13559                 ;;
13560         esac
13561         ;;
13562 *)      getpwent_r_proto=0
13563         ;;
13564 esac
13565
13566 : see if getpwnam_r exists
13567 set getpwnam_r d_getpwnam_r
13568 eval $inlibc
13569 case "$d_getpwnam_r" in
13570 "$define")
13571         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13572         case "$d_getpwnam_r_proto:$usethreads" in
13573         ":define")      d_getpwnam_r_proto=define
13574                 set d_getpwnam_r_proto getpwnam_r $hdrs
13575                 eval $hasproto ;;
13576         *)      ;;
13577         esac
13578         case "$d_getpwnam_r_proto" in
13579         define)
13580         case "$getpwnam_r_proto" in
13581         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13582         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13583         esac
13584         case "$getpwnam_r_proto" in
13585         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13586         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13587         esac
13588         case "$getpwnam_r_proto" in
13589         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13590         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13591         esac
13592         case "$getpwnam_r_proto" in
13593         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13594         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13595         esac
13596         case "$getpwnam_r_proto" in
13597         ''|0)   d_getpwnam_r=undef
13598                 getpwnam_r_proto=0
13599                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13600         * )     case "$getpwnam_r_proto" in
13601                 REENTRANT_PROTO*) ;;
13602                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13603                 esac
13604                 echo "Prototype: $try" ;;
13605         esac
13606         ;;
13607         *)      case "$usethreads" in
13608                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13609                 esac
13610                 d_getpwnam_r=undef
13611                 getpwnam_r_proto=0
13612                 ;;
13613         esac
13614         ;;
13615 *)      getpwnam_r_proto=0
13616         ;;
13617 esac
13618
13619 : see if getpwuid_r exists
13620 set getpwuid_r d_getpwuid_r
13621 eval $inlibc
13622 case "$d_getpwuid_r" in
13623 "$define")
13624         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13625         case "$d_getpwuid_r_proto:$usethreads" in
13626         ":define")      d_getpwuid_r_proto=define
13627                 set d_getpwuid_r_proto getpwuid_r $hdrs
13628                 eval $hasproto ;;
13629         *)      ;;
13630         esac
13631         case "$d_getpwuid_r_proto" in
13632         define)
13633         case "$getpwuid_r_proto" in
13634         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13635         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13636         esac
13637         case "$getpwuid_r_proto" in
13638         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13639         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13640         esac
13641         case "$getpwuid_r_proto" in
13642         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13643         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13644         esac
13645         case "$getpwuid_r_proto" in
13646         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13647         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13648         esac
13649         case "$getpwuid_r_proto" in
13650         ''|0)   d_getpwuid_r=undef
13651                 getpwuid_r_proto=0
13652                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13653         * )     case "$getpwuid_r_proto" in
13654                 REENTRANT_PROTO*) ;;
13655                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13656                 esac
13657                 echo "Prototype: $try" ;;
13658         esac
13659         ;;
13660         *)      case "$usethreads" in
13661                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13662                 esac
13663                 d_getpwuid_r=undef
13664                 getpwuid_r_proto=0
13665                 ;;
13666         esac
13667         ;;
13668 *)      getpwuid_r_proto=0
13669         ;;
13670 esac
13671
13672
13673 : see if getservbyname exists
13674 set getservbyname d_getsbyname
13675 eval $inlibc
13676
13677 : see if getservbyport exists
13678 set getservbyport d_getsbyport
13679 eval $inlibc
13680
13681 : see if getservent exists
13682 set getservent d_getsent
13683 eval $inlibc
13684
13685 : see if getservbyname_r exists
13686 set getservbyname_r d_getservbyname_r
13687 eval $inlibc
13688 case "$d_getservbyname_r" in
13689 "$define")
13690         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13691         case "$d_getservbyname_r_proto:$usethreads" in
13692         ":define")      d_getservbyname_r_proto=define
13693                 set d_getservbyname_r_proto getservbyname_r $hdrs
13694                 eval $hasproto ;;
13695         *)      ;;
13696         esac
13697         case "$d_getservbyname_r_proto" in
13698         define)
13699         case "$getservbyname_r_proto" in
13700         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13701         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13702         esac
13703         case "$getservbyname_r_proto" in
13704         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13705         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13706         esac
13707         case "$getservbyname_r_proto" in
13708         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13709         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13710         esac
13711         case "$getservbyname_r_proto" in
13712         ''|0)   d_getservbyname_r=undef
13713                 getservbyname_r_proto=0
13714                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13715         * )     case "$getservbyname_r_proto" in
13716                 REENTRANT_PROTO*) ;;
13717                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13718                 esac
13719                 echo "Prototype: $try" ;;
13720         esac
13721         ;;
13722         *)      case "$usethreads" in
13723                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13724                 esac
13725                 d_getservbyname_r=undef
13726                 getservbyname_r_proto=0
13727                 ;;
13728         esac
13729         ;;
13730 *)      getservbyname_r_proto=0
13731         ;;
13732 esac
13733
13734 : see if getservbyport_r exists
13735 set getservbyport_r d_getservbyport_r
13736 eval $inlibc
13737 case "$d_getservbyport_r" in
13738 "$define")
13739         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13740         case "$d_getservbyport_r_proto:$usethreads" in
13741         ":define")      d_getservbyport_r_proto=define
13742                 set d_getservbyport_r_proto getservbyport_r $hdrs
13743                 eval $hasproto ;;
13744         *)      ;;
13745         esac
13746         case "$d_getservbyport_r_proto" in
13747         define)
13748         case "$getservbyport_r_proto" in
13749         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13750         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13751         esac
13752         case "$getservbyport_r_proto" in
13753         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13754         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13755         esac
13756         case "$getservbyport_r_proto" in
13757         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13758         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13759         esac
13760         case "$getservbyport_r_proto" in
13761         ''|0)   d_getservbyport_r=undef
13762                 getservbyport_r_proto=0
13763                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13764         * )     case "$getservbyport_r_proto" in
13765                 REENTRANT_PROTO*) ;;
13766                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13767                 esac
13768                 echo "Prototype: $try" ;;
13769         esac
13770         ;;
13771         *)      case "$usethreads" in
13772                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13773                 esac
13774                 d_getservbyport_r=undef
13775                 getservbyport_r_proto=0
13776                 ;;
13777         esac
13778         ;;
13779 *)      getservbyport_r_proto=0
13780         ;;
13781 esac
13782
13783 : see if getservent_r exists
13784 set getservent_r d_getservent_r
13785 eval $inlibc
13786 case "$d_getservent_r" in
13787 "$define")
13788         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13789         case "$d_getservent_r_proto:$usethreads" in
13790         ":define")      d_getservent_r_proto=define
13791                 set d_getservent_r_proto getservent_r $hdrs
13792                 eval $hasproto ;;
13793         *)      ;;
13794         esac
13795         case "$d_getservent_r_proto" in
13796         define)
13797         case "$getservent_r_proto" in
13798         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13799         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13800         esac
13801         case "$getservent_r_proto" in
13802         ''|0) try='int getservent_r(struct servent*, char*, int);'
13803         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13804         esac
13805         case "$getservent_r_proto" in
13806         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13807         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13808         esac
13809         case "$getservent_r_proto" in
13810         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13811         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13812         esac
13813         case "$getservent_r_proto" in
13814         ''|0)   d_getservent_r=undef
13815                 getservent_r_proto=0
13816                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13817         * )     case "$getservent_r_proto" in
13818                 REENTRANT_PROTO*) ;;
13819                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13820                 esac
13821                 echo "Prototype: $try" ;;
13822         esac
13823         ;;
13824         *)      case "$usethreads" in
13825                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13826                 esac
13827                 d_getservent_r=undef
13828                 getservent_r_proto=0
13829                 ;;
13830         esac
13831         ;;
13832 *)      getservent_r_proto=0
13833         ;;
13834 esac
13835
13836 : see if prototypes for various getservxxx netdb.h functions are available
13837 echo " "
13838 set d_getservprotos getservent $i_netdb netdb.h
13839 eval $hasproto
13840
13841 : see if getspnam exists
13842 set getspnam d_getspnam
13843 eval $inlibc
13844
13845 : see if this is a shadow.h system
13846 set shadow.h i_shadow
13847 eval $inhdr
13848
13849 : see if getspnam_r exists
13850 set getspnam_r d_getspnam_r
13851 eval $inlibc
13852 case "$d_getspnam_r" in
13853 "$define")
13854         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13855         case "$d_getspnam_r_proto:$usethreads" in
13856         ":define")      d_getspnam_r_proto=define
13857                 set d_getspnam_r_proto getspnam_r $hdrs
13858                 eval $hasproto ;;
13859         *)      ;;
13860         esac
13861         case "$d_getspnam_r_proto" in
13862         define)
13863         case "$getspnam_r_proto" in
13864         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13865         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13866         esac
13867         case "$getspnam_r_proto" in
13868         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13869         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13870         esac
13871         case "$getspnam_r_proto" in
13872         ''|0)   d_getspnam_r=undef
13873                 getspnam_r_proto=0
13874                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13875         * )     case "$getspnam_r_proto" in
13876                 REENTRANT_PROTO*) ;;
13877                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13878                 esac
13879                 echo "Prototype: $try" ;;
13880         esac
13881         ;;
13882         *)      case "$usethreads" in
13883                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13884                 esac
13885                 d_getspnam_r=undef
13886                 getspnam_r_proto=0
13887                 ;;
13888         esac
13889         ;;
13890 *)      getspnam_r_proto=0
13891         ;;
13892 esac
13893
13894 : see if gettimeofday or ftime exists
13895 set gettimeofday d_gettimeod
13896 eval $inlibc
13897 case "$d_gettimeod" in
13898 "$undef")
13899         set ftime d_ftime 
13900         eval $inlibc
13901         ;;
13902 *)
13903         val="$undef"; set d_ftime; eval $setvar
13904         ;;
13905 esac
13906 case "$d_gettimeod$d_ftime" in
13907 "$undef$undef")
13908         echo " "
13909         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13910         ;;
13911 esac
13912
13913 : see if gmtime_r exists
13914 set gmtime_r d_gmtime_r
13915 eval $inlibc
13916 case "$d_gmtime_r" in
13917 "$define")
13918         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13919         case "$d_gmtime_r_proto:$usethreads" in
13920         ":define")      d_gmtime_r_proto=define
13921                 set d_gmtime_r_proto gmtime_r $hdrs
13922                 eval $hasproto ;;
13923         *)      ;;
13924         esac
13925         case "$d_gmtime_r_proto" in
13926         define)
13927         case "$gmtime_r_proto" in
13928         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13929         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13930         esac
13931         case "$gmtime_r_proto" in
13932         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13933         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13934         esac
13935         case "$gmtime_r_proto" in
13936         ''|0)   d_gmtime_r=undef
13937                 gmtime_r_proto=0
13938                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13939         * )     case "$gmtime_r_proto" in
13940                 REENTRANT_PROTO*) ;;
13941                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13942                 esac
13943                 echo "Prototype: $try" ;;
13944         esac
13945         ;;
13946         *)      case "$usethreads" in
13947                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13948                 esac
13949                 d_gmtime_r=undef
13950                 gmtime_r_proto=0
13951                 ;;
13952         esac
13953         ;;
13954 *)      gmtime_r_proto=0
13955         ;;
13956 esac
13957
13958 : see if hasmntopt exists
13959 set hasmntopt d_hasmntopt
13960 eval $inlibc
13961
13962 : see if this is a netinet/in.h or sys/in.h system
13963 set netinet/in.h i_niin sys/in.h i_sysin
13964 eval $inhdr
13965
13966 : see if arpa/inet.h has to be included
13967 set arpa/inet.h i_arpainet
13968 eval $inhdr
13969
13970 : see if htonl --and friends-- exists
13971 val=''
13972 set htonl val
13973 eval $inlibc
13974
13975 : Maybe they are macros.
13976 case "$val" in
13977 $undef)
13978         $cat >htonl.c <<EOM
13979 #include <stdio.h>
13980 #include <sys/types.h>
13981 #$i_niin I_NETINET_IN
13982 #$i_sysin I_SYS_IN
13983 #$i_arpainet I_ARPA_INET
13984 #ifdef I_NETINET_IN
13985 #include <netinet/in.h>
13986 #endif
13987 #ifdef I_SYS_IN
13988 #include <sys/in.h>
13989 #endif
13990 #ifdef I_ARPA_INET
13991 #include <arpa/inet.h>
13992 #endif
13993 #ifdef htonl
13994 printf("Defined as a macro.");
13995 #endif
13996 EOM
13997         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13998         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13999                 val="$define"
14000                 echo "But it seems to be defined as a macro." >&4
14001         fi
14002         $rm -f htonl.?
14003         ;;
14004 esac
14005 set d_htonl
14006 eval $setvar
14007
14008 : see if ilogbl exists
14009 set ilogbl d_ilogbl
14010 eval $inlibc
14011
14012 : index or strchr
14013 echo " "
14014 if set index val -f; eval $csym; $val; then
14015         if set strchr val -f d_strchr; eval $csym; $val; then
14016                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14017                         val="$define"
14018                         vali="$undef"
14019                         echo "strchr() found." >&4
14020                 else
14021                         val="$undef"
14022                         vali="$define"
14023                         echo "index() found." >&4
14024                 fi
14025         else
14026                 val="$undef"
14027                 vali="$define"
14028                 echo "index() found." >&4
14029         fi
14030 else
14031         if set strchr val -f d_strchr; eval $csym; $val; then
14032                 val="$define"
14033                 vali="$undef"
14034                 echo "strchr() found." >&4
14035         else
14036                 echo "No index() or strchr() found!" >&4
14037                 val="$undef"
14038                 vali="$undef"
14039         fi
14040 fi
14041 set d_strchr; eval $setvar
14042 val="$vali"
14043 set d_index; eval $setvar
14044
14045 : check whether inet_aton exists
14046 set inet_aton d_inetaton
14047 eval $inlibc
14048
14049 : Look for isascii
14050 echo " "
14051 $cat >isascii.c <<EOCP
14052 #include <stdio.h>
14053 #include <ctype.h>
14054 #$i_stdlib I_STDLIB
14055 #ifdef I_STDLIB
14056 #include <stdlib.h>
14057 #endif
14058 int main() {
14059         int c = 'A';
14060         if (isascii(c))
14061                 exit(0);
14062         else
14063                 exit(1);
14064 }
14065 EOCP
14066 set isascii
14067 if eval $compile; then
14068         echo "isascii() found." >&4
14069         val="$define"
14070 else
14071         echo "isascii() NOT found." >&4
14072         val="$undef"
14073 fi
14074 set d_isascii
14075 eval $setvar
14076 $rm -f isascii*
14077
14078 : see if isfinite exists
14079 set isfinite d_isfinite
14080 eval $inlibc
14081
14082 : see if isinf exists
14083 set isinf d_isinf
14084 eval $inlibc
14085
14086 : see if isnan exists
14087 set isnan d_isnan
14088 eval $inlibc
14089
14090 : see if isnanl exists
14091 set isnanl d_isnanl
14092 eval $inlibc
14093
14094 : see if killpg exists
14095 set killpg d_killpg
14096 eval $inlibc
14097
14098 : see if lchown exists
14099 echo " "
14100 $cat > try.c <<'EOCP'
14101 /* System header to define __stub macros and hopefully few prototypes,
14102     which can conflict with char lchown(); below.  */
14103 #include <assert.h>
14104 /* Override any gcc2 internal prototype to avoid an error.  */
14105 /* We use char because int might match the return type of a gcc2
14106    builtin and then its argument prototype would still apply.  */
14107 char lchown();
14108 int main() {
14109     /*  The GNU C library defines this for functions which it implements
14110         to always fail with ENOSYS.  Some functions are actually named
14111         something starting with __ and the normal name is an alias.  */
14112 #if defined (__stub_lchown) || defined (__stub___lchown)
14113 choke me
14114 #else
14115 lchown();
14116 #endif
14117 ; return 0; }
14118 EOCP
14119 set try
14120 if eval $compile; then
14121     $echo "lchown() found." >&4
14122     val="$define"
14123 else
14124     $echo "lchown() NOT found." >&4
14125     val="$undef"
14126 fi
14127 set d_lchown
14128 eval $setvar
14129
14130 : See if number of significant digits in a double precision number is known
14131 echo " "
14132 $cat >ldbl_dig.c <<EOM
14133 #$i_limits I_LIMITS
14134 #$i_float I_FLOAT
14135 #ifdef I_LIMITS
14136 #include <limits.h>
14137 #endif
14138 #ifdef I_FLOAT
14139 #include <float.h>
14140 #endif
14141 #ifdef LDBL_DIG
14142 printf("Contains LDBL_DIG");
14143 #endif
14144 EOM
14145 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14146 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14147         echo "LDBL_DIG found." >&4
14148         val="$define"
14149 else
14150         echo "LDBL_DIG NOT found." >&4
14151         val="$undef"
14152 fi
14153 $rm -f ldbl_dig.?
14154 set d_ldbl_dig
14155 eval $setvar
14156
14157 : see if this is a math.h system
14158 set math.h i_math
14159 eval $inhdr
14160
14161 d_libm_lib_version="$undef"
14162 case $i_math in
14163     $define)
14164         : check to see if math.h defines _LIB_VERSION
14165         echo " "
14166         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14167         $cat >try.c <<EOCP
14168 #include <unistd.h>
14169 #include <math.h>
14170 int main (int argc, char *argv[])
14171 {
14172     printf ("%d\n", _LIB_VERSION);
14173     return (0);
14174     } /* main */
14175 EOCP
14176         set try
14177         if eval $compile; then
14178             foo=`$run ./try`
14179             echo "Yes, it does ($foo)" >&4
14180             d_libm_lib_version="$define"
14181         else
14182             echo "No, it does not (probably harmless)\n" >&4
14183             fi
14184         $rm -f try.* try core core.try.*
14185         ;;
14186
14187     esac
14188
14189 : see if link exists
14190 set link d_link
14191 eval $inlibc
14192
14193 : see if localtime_r exists
14194 set localtime_r d_localtime_r
14195 eval $inlibc
14196 case "$d_localtime_r" in
14197 "$define")
14198         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14199         case "$d_localtime_r_proto:$usethreads" in
14200         ":define")      d_localtime_r_proto=define
14201                 set d_localtime_r_proto localtime_r $hdrs
14202                 eval $hasproto ;;
14203         *)      ;;
14204         esac
14205         case "$d_localtime_r_proto" in
14206         define)
14207         case "$localtime_r_proto" in
14208         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14209         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14210         esac
14211         case "$localtime_r_proto" in
14212         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14213         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14214         esac
14215         case "$localtime_r_proto" in
14216         ''|0)   d_localtime_r=undef
14217                 localtime_r_proto=0
14218                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14219         * )     case "$localtime_r_proto" in
14220                 REENTRANT_PROTO*) ;;
14221                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14222                 esac
14223                 echo "Prototype: $try" ;;
14224         esac
14225         ;;
14226         *)      case "$usethreads" in
14227                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14228                 esac
14229                 d_localtime_r=undef
14230                 localtime_r_proto=0
14231                 ;;
14232         esac
14233         ;;
14234 *)      localtime_r_proto=0
14235         ;;
14236 esac
14237
14238 : see if localeconv exists
14239 set localeconv d_locconv
14240 eval $inlibc
14241
14242 : see if lockf exists
14243 set lockf d_lockf
14244 eval $inlibc
14245
14246 : see if prototype for lseek is available
14247 echo " "
14248 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14249 eval $hasproto
14250
14251 : see if lstat exists
14252 set lstat d_lstat
14253 eval $inlibc
14254
14255 : see if madvise exists
14256 set madvise d_madvise
14257 eval $inlibc
14258
14259 : see if malloc_size exists
14260 set malloc_size d_malloc_size
14261 eval $inlibc
14262
14263 : see if malloc_size_good exists
14264 set malloc_good_size d_malloc_good_size
14265 eval $inlibc
14266
14267 : see if mblen exists
14268 set mblen d_mblen
14269 eval $inlibc
14270
14271 : see if mbstowcs exists
14272 set mbstowcs d_mbstowcs
14273 eval $inlibc
14274
14275 : see if mbtowc exists
14276 set mbtowc d_mbtowc
14277 eval $inlibc
14278
14279 : see if memchr exists
14280 set memchr d_memchr
14281 eval $inlibc
14282
14283 : see if memcmp exists
14284 set memcmp d_memcmp
14285 eval $inlibc
14286
14287 : see if memcpy exists
14288 set memcpy d_memcpy
14289 eval $inlibc
14290
14291 : see if memmove exists
14292 set memmove d_memmove
14293 eval $inlibc
14294
14295 : see if memset exists
14296 set memset d_memset
14297 eval $inlibc
14298
14299 : see if mkdir exists
14300 set mkdir d_mkdir
14301 eval $inlibc
14302
14303 : see if mkdtemp exists
14304 set mkdtemp d_mkdtemp
14305 eval $inlibc
14306
14307 : see if mkfifo exists
14308 set mkfifo d_mkfifo
14309 eval $inlibc
14310
14311 : see if mkstemp exists
14312 set mkstemp d_mkstemp
14313 eval $inlibc
14314
14315 : see if mkstemps exists
14316 set mkstemps d_mkstemps
14317 eval $inlibc
14318
14319 : see if mktime exists
14320 set mktime d_mktime
14321 eval $inlibc
14322
14323 : see if this is a sys/mman.h system
14324 set sys/mman.h i_sysmman
14325 eval $inhdr
14326
14327 : see if mmap exists
14328 set mmap d_mmap
14329 eval $inlibc
14330 : see what shmat returns
14331 : default to something harmless
14332 mmaptype='void *'
14333 case "$i_sysmman$d_mmap" in
14334 "$define$define")
14335         $cat >mmap.c <<'END'
14336 #include <sys/mman.h>
14337 void *mmap();
14338 END
14339         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14340                 mmaptype='void *'
14341         else
14342                 mmaptype='caddr_t'
14343         fi
14344         echo "and it returns ($mmaptype)." >&4
14345         ;;
14346 esac
14347
14348
14349
14350 : see if sqrtl exists
14351 set sqrtl d_sqrtl
14352 eval $inlibc
14353
14354 : see if scalbnl exists
14355 set scalbnl d_scalbnl
14356 eval $inlibc
14357
14358 : see if modfl exists
14359 set modfl d_modfl
14360 eval $inlibc
14361
14362 : see if prototype for modfl is available
14363 echo " "
14364 set d_modflproto modfl $i_math math.h
14365 eval $hasproto
14366
14367 d_modfl_pow32_bug="$undef"
14368
14369 case "$d_longdbl$d_modfl" in
14370 $define$define)
14371         $cat <<EOM
14372 Checking to see whether your modfl() is okay for large values...
14373 EOM
14374 $cat >try.c <<EOCP
14375 #include <math.h> 
14376 #include <stdio.h>
14377 EOCP
14378 if $test "X$d_modflproto" != "X$define"; then
14379         $cat >>try.c <<EOCP
14380 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14381 long double modfl (long double, long double *);
14382 EOCP
14383 fi
14384 $cat >>try.c <<EOCP
14385 int main() {
14386     long double nv = 4294967303.15;
14387     long double v, w;
14388     v = modfl(nv, &w);         
14389 #ifdef __GLIBC__
14390     printf("glibc");
14391 #endif
14392     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14393     return 0;
14394 }
14395 EOCP
14396         case "$osname:$gccversion" in
14397         aix:)   saveccflags="$ccflags"
14398                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14399         esac
14400         set try
14401         if eval $compile; then
14402                 foo=`$run ./try`
14403                 case "$foo" in
14404                 *" 4294967303.150000 1.150000 4294967302.000000")
14405                         echo >&4 "Your modfl() is broken for large values."
14406                         d_modfl_pow32_bug="$define"
14407                         case "$foo" in
14408                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14409                         ;;
14410                         esac
14411                         ;;
14412                 *" 4294967303.150000 0.150000 4294967303.000000")
14413                         echo >&4 "Your modfl() seems okay for large values."
14414                         ;;
14415                 *)      echo >&4 "I don't understand your modfl() at all."
14416                         d_modfl="$undef"
14417                         ;;
14418                 esac
14419                 $rm -f try.* try core core.try.*
14420         else
14421                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14422                 d_modfl="$undef"
14423         fi
14424         case "$osname:$gccversion" in
14425         aix:)   ccflags="$saveccflags" ;; # restore
14426         esac
14427         ;;
14428 esac
14429
14430 if $test "$uselongdouble" = "$define"; then
14431     message=""
14432     if $test "$d_sqrtl" != "$define"; then
14433         message="$message sqrtl"
14434     fi
14435     if $test "$d_modfl" != "$define"; then
14436         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14437             echo "You have both aintl and copysignl, so I can emulate modfl."
14438         else
14439             message="$message modfl"
14440         fi
14441     fi
14442     if $test "$d_frexpl" != "$define"; then
14443         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14444             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14445         else
14446             message="$message frexpl"
14447         fi
14448     fi
14449
14450     if $test "$message" != ""; then
14451         $cat <<EOM >&4
14452
14453 *** You requested the use of long doubles but you do not seem to have
14454 *** the following mathematical functions needed for long double support:
14455 ***    $message
14456 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14457 *** Cannot continue, aborting.
14458
14459 EOM
14460
14461         exit 1
14462     fi
14463 fi
14464
14465 : see if mprotect exists
14466 set mprotect d_mprotect
14467 eval $inlibc
14468
14469 : see if msgctl exists
14470 set msgctl d_msgctl
14471 eval $inlibc
14472
14473 : see if msgget exists
14474 set msgget d_msgget
14475 eval $inlibc
14476
14477 : see if msgsnd exists
14478 set msgsnd d_msgsnd
14479 eval $inlibc
14480
14481 : see if msgrcv exists
14482 set msgrcv d_msgrcv
14483 eval $inlibc
14484
14485 : see how much of the 'msg*(2)' library is present.
14486 h_msg=true
14487 echo " "
14488 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14489 *"$undef"*) h_msg=false;;
14490 esac
14491 case "$osname" in
14492 freebsd)
14493     case "`ipcs 2>&1`" in
14494     "SVID messages"*"not configured"*)
14495         echo "Your $osname does not have the msg*(2) configured." >&4
14496         h_msg=false
14497         val="$undef"
14498         set msgctl d_msgctl
14499         eval $setvar
14500         set msgget d_msgget
14501         eval $setvar
14502         set msgsnd d_msgsnd
14503         eval $setvar
14504         set msgrcv d_msgrcv
14505         eval $setvar
14506         ;;
14507     esac
14508     ;;
14509 esac
14510 : we could also check for sys/ipc.h ...
14511 if $h_msg && $test `./findhdr sys/msg.h`; then
14512         echo "You have the full msg*(2) library." >&4
14513         val="$define"
14514 else
14515         echo "You don't have the full msg*(2) library." >&4
14516         val="$undef"
14517 fi
14518 set d_msg
14519 eval $setvar
14520
14521
14522 echo " "
14523 echo "Checking to see if your system supports struct msghdr..." >&4
14524 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14525 eval $hasstruct
14526 case "$d_msghdr_s" in
14527 "$define")      echo "Yes, it does."   ;;
14528 *)              echo "No, it doesn't." ;;
14529 esac
14530
14531
14532 : see if msync exists
14533 set msync d_msync
14534 eval $inlibc
14535
14536 : see if munmap exists
14537 set munmap d_munmap
14538 eval $inlibc
14539
14540 : see if nice exists
14541 set nice d_nice
14542 eval $inlibc
14543
14544 : see if this is a langinfo.h system
14545 set langinfo.h i_langinfo
14546 eval $inhdr
14547
14548 : see if nl_langinfo exists
14549 set nl_langinfo d_nl_langinfo
14550 eval $inlibc
14551
14552 : check for length of character
14553 echo " "
14554 case "$charsize" in
14555 '')
14556         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14557         $cat >try.c <<EOCP
14558 #include <stdio.h>
14559 #$i_stdlib I_STDLIB
14560 #ifdef I_STDLIB
14561 #include <stdlib.h>
14562 #endif
14563 int main()
14564 {
14565     printf("%d\n", (int)sizeof(char));
14566     exit(0);
14567 }
14568 EOCP
14569         set try
14570         if eval $compile_ok; then
14571                 dflt=`$run ./try`
14572         else
14573                 dflt='1'
14574                 echo "(I can't seem to compile the test program.  Guessing...)"
14575         fi
14576         ;;
14577 *)
14578         dflt="$charsize"
14579         ;;
14580 esac
14581 rp="What is the size of a character (in bytes)?"
14582 . ./myread
14583 charsize="$ans"
14584 $rm -f try.c try
14585
14586 : check for volatile keyword
14587 echo " "
14588 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14589 $cat >try.c <<'EOCP'
14590 int main()
14591 {
14592         typedef struct _goo_struct goo_struct;
14593         goo_struct * volatile goo = ((goo_struct *)0);
14594         struct _goo_struct {
14595                 long long_int;
14596                 int reg_int;
14597                 char char_var;
14598         };
14599         typedef unsigned short foo_t;
14600         char *volatile foo;
14601         volatile int bar;
14602         volatile foo_t blech;
14603         foo = foo;
14604 }
14605 EOCP
14606 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14607         val="$define"
14608         echo "Yup, it does."
14609 else
14610         val="$undef"
14611         echo "Nope, it doesn't."
14612 fi
14613 set d_volatile
14614 eval $setvar
14615 $rm -f try.*
14616
14617
14618 echo " "
14619 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14620
14621 case "$use64bitint:$d_quad:$quadtype" in
14622 define:define:?*)
14623         ivtype="$quadtype"
14624         uvtype="$uquadtype"
14625         ivsize=8
14626         uvsize=8
14627         ;;
14628 *)      ivtype="long"
14629         uvtype="unsigned long"
14630         ivsize=$longsize
14631         uvsize=$longsize
14632         ;;
14633 esac
14634
14635 case "$uselongdouble:$d_longdbl" in
14636 define:define)
14637         nvtype="long double"
14638         nvsize=$longdblsize
14639         ;;
14640 *)      nvtype=double
14641         nvsize=$doublesize
14642         ;;
14643 esac
14644
14645 $echo "(IV will be "$ivtype", $ivsize bytes)"
14646 $echo "(UV will be "$uvtype", $uvsize bytes)"
14647 $echo "(NV will be "$nvtype", $nvsize bytes)"
14648
14649 $cat >try.c <<EOCP
14650 #$i_inttypes I_INTTYPES
14651 #ifdef I_INTTYPES
14652 #include <inttypes.h>
14653 #endif
14654 #include <stdio.h>
14655 int main() {
14656 #ifdef INT8
14657    int8_t i =  INT8_MAX;
14658   uint8_t u = UINT8_MAX;
14659   printf("int8_t\n");
14660 #endif
14661 #ifdef INT16
14662    int16_t i =  INT16_MAX;
14663   uint16_t i = UINT16_MAX;
14664   printf("int16_t\n");
14665 #endif
14666 #ifdef INT32
14667    int32_t i =  INT32_MAX;
14668   uint32_t u = UINT32_MAX;
14669   printf("int32_t\n");
14670 #endif
14671 }
14672 EOCP
14673
14674 case "$i8type" in
14675 '')     case "$charsize" in
14676         1)      i8type=char
14677                 u8type="unsigned char"
14678                 i8size=$charsize
14679                 u8size=$charsize
14680                 ;;
14681         esac
14682         ;;
14683 esac
14684 case "$i8type" in
14685 '')     set try -DINT8
14686         if eval $compile; then
14687                 case "`$run ./try`" in
14688                 int8_t) i8type=int8_t
14689                         u8type=uint8_t
14690                         i8size=1
14691                         u8size=1
14692                         ;;
14693                 esac
14694         fi
14695         ;;
14696 esac
14697 case "$i8type" in
14698 '')     if $test $charsize -ge 1; then
14699                 i8type=char
14700                 u8type="unsigned char"
14701                 i8size=$charsize
14702                 u8size=$charsize
14703         fi
14704         ;;
14705 esac
14706
14707 case "$i16type" in
14708 '')     case "$shortsize" in
14709         2)      i16type=short
14710                 u16type="unsigned short"
14711                 i16size=$shortsize
14712                 u16size=$shortsize
14713                 ;;
14714         esac
14715         ;;
14716 esac
14717 case "$i16type" in
14718 '')     set try -DINT16
14719         if eval $compile; then
14720                 case "`$run ./try`" in
14721                 int16_t)
14722                         i16type=int16_t
14723                         u16type=uint16_t
14724                         i16size=2
14725                         u16size=2
14726                         ;;
14727                 esac
14728         fi
14729         ;;
14730 esac
14731 case "$i16type" in
14732 '')     if $test $shortsize -ge 2; then
14733                 i16type=short
14734                 u16type="unsigned short"
14735                 i16size=$shortsize
14736                 u16size=$shortsize
14737         fi
14738         ;;
14739 esac
14740
14741 case "$i32type" in
14742 '')     case "$longsize" in
14743         4)      i32type=long
14744                 u32type="unsigned long"
14745                 i32size=$longsize
14746                 u32size=$longsize
14747                 ;;
14748         *)      case "$intsize" in
14749                 4)      i32type=int
14750                         u32type="unsigned int"
14751                         i32size=$intsize
14752                         u32size=$intsize
14753                         ;;
14754                 esac
14755                 ;;
14756         esac
14757         ;;
14758 esac
14759 case "$i32type" in
14760 '')     set try -DINT32
14761         if eval $compile; then
14762                 case "`$run ./try`" in
14763                 int32_t)
14764                         i32type=int32_t
14765                         u32type=uint32_t
14766                         i32size=4
14767                         u32size=4
14768                         ;;
14769                 esac
14770         fi
14771         ;;
14772 esac
14773 case "$i32type" in
14774 '')     if $test $intsize -ge 4; then
14775                 i32type=int
14776                 u32type="unsigned int"
14777                 i32size=$intsize
14778                 u32size=$intsize
14779         fi
14780         ;;
14781 esac
14782
14783 case "$i64type" in
14784 '')     case "$d_quad:$quadtype" in
14785         define:?*)
14786                 i64type="$quadtype"
14787                 u64type="$uquadtype"
14788                 i64size=8
14789                 u64size=8
14790                 ;;
14791         esac
14792         ;;
14793 esac
14794
14795 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14796 : volatile so that the compiler has to store it out to memory.
14797 if test X"$d_volatile" = X"$define"; then
14798         volatile=volatile
14799 fi
14800 $cat <<EOP >try.c
14801 #include <stdio.h>
14802 #$i_stdlib I_STDLIB
14803 #ifdef I_STDLIB
14804 #include <stdlib.h>
14805 #endif
14806 #include <sys/types.h>
14807 #include <signal.h>
14808 #ifdef SIGFPE
14809 $volatile int bletched = 0;
14810 $signal_t blech(s) int s; { bletched = 1; }
14811 #endif
14812 int main() {
14813     $uvtype u = 0;
14814     $nvtype d;
14815     int     n = 8 * $uvsize;
14816     int     i;
14817 #ifdef SIGFPE
14818     signal(SIGFPE, blech);
14819 #endif
14820
14821     for (i = 0; i < n; i++) {
14822       u = u << 1 | ($uvtype)1;
14823       d = ($nvtype)u;
14824       if (($uvtype)d != u)
14825         break;
14826       if (d <= 0)
14827         break;
14828       d = ($nvtype)(u - 1);
14829       if (($uvtype)d != (u - 1))
14830         break;
14831 #ifdef SIGFPE
14832       if (bletched) {
14833         break;
14834 #endif
14835       } 
14836     }
14837     printf("%d\n", ((i == n) ? -n : i));
14838     exit(0);
14839 }
14840 EOP
14841 set try
14842
14843 d_nv_preserves_uv="$undef"
14844 if eval $compile; then
14845         nv_preserves_uv_bits="`$run ./try`"
14846 fi
14847 case "$nv_preserves_uv_bits" in
14848 \-[1-9]*)       
14849         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14850         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14851         d_nv_preserves_uv="$define"
14852         ;;
14853 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14854         d_nv_preserves_uv="$undef" ;;
14855 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14856         nv_preserves_uv_bits="$undef" ;;
14857 esac
14858
14859 $rm -f try.* try
14860
14861 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14862 : volatile so that the compiler has to store it out to memory.
14863 if test X"$d_volatile" = X"$define"; then
14864         volatile=volatile
14865 fi
14866 $cat <<EOP >try.c
14867 #include <stdio.h>
14868 #$i_stdlib I_STDLIB
14869 #ifdef I_STDLIB
14870 #include <stdlib.h>
14871 #endif
14872 #$i_string I_STRING
14873 #ifdef I_STRING
14874 #  include <string.h>
14875 #else
14876 #  include <strings.h>
14877 #endif
14878 #include <sys/types.h>
14879 #include <signal.h>
14880 #ifdef SIGFPE
14881 $volatile int bletched = 0;
14882 $signal_t blech(s) int s; { bletched = 1; }
14883 #endif
14884
14885 int checkit($nvtype d, char *where) {
14886     unsigned char *p = (char *)&d;
14887     unsigned char *end = p + sizeof(d);
14888     int fail = 0;
14889
14890     while (p < end)
14891         fail += *p++;
14892
14893     if (!fail)
14894         return 0;
14895
14896     p = (char *)&d;
14897     printf("No - %s: 0x", where);
14898     while (p < end)
14899         printf ("%02X", *p++);
14900     printf("\n");
14901     return 1;
14902 }
14903
14904 int main(int argc, char **argv) {
14905     $nvtype d = 0.0;
14906     int fail = 0;
14907     fail += checkit(d, "0.0");
14908
14909     /* The compiler shouldn't be assuming that bletched is 0  */
14910     d = bletched;
14911
14912     fail += checkit(d, "bleched");
14913
14914 #ifdef SIGFPE
14915     signal(SIGFPE, blech);
14916 #endif
14917
14918     /* Paranoia - the compiler should have no way of knowing that ANSI says
14919        that argv[argc] will always be NULL.  Actually, if it did assume this it
14920        would be buggy, as this is C and main() can be called from elsewhere in
14921        the program.  */
14922     d = argv[argc] ? 1 : 0;
14923
14924     if (d) {
14925         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14926     }
14927
14928     fail += checkit(d, "ternary");
14929
14930     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14931
14932     if (d != 0.0) {
14933         printf("No - memset doesn't give 0.0\n");
14934         /* This might just blow up:  */
14935         printf("(gives %g)\n", d);
14936         return 1;
14937     }
14938     
14939 #ifdef SIGFPE
14940     if (bletched) {
14941         printf("No - something bleched\n");
14942         return 1;
14943     }
14944 #endif
14945     if (fail) {
14946       printf("No - %d fail(s)\n", fail);
14947       return 1;
14948     }
14949     printf("Yes\n");
14950     return 0;
14951 }
14952 EOP
14953 set try
14954
14955 d_nv_zero_is_allbits_zero="$undef"
14956 if eval $compile; then
14957     xxx="`$run ./try`"
14958     case "$?" in
14959         0)
14960             case "$xxx" in
14961                 Yes)  cat >&4 <<EOM
14962 0.0 is represented as all bits zero in memory
14963 EOM
14964                     d_nv_zero_is_allbits_zero="$define"
14965                     ;;
14966                 *)  cat >&4 <<EOM
14967 0.0 is not represented as all bits zero in memory
14968 EOM
14969                     d_nv_zero_is_allbits_zero="$undef"
14970                     ;;
14971             esac
14972             ;;
14973         *)  cat >&4 <<EOM
14974 0.0 is not represented as all bits zero in memory
14975 EOM
14976             d_nv_zero_is_allbits_zero="$undef"
14977             ;;
14978     esac
14979 fi
14980
14981 $rm -f try.* try
14982
14983
14984 : check for off64_t
14985 echo " "
14986 echo "Checking to see if you have off64_t..." >&4
14987 $cat >try.c <<EOCP
14988 #include <sys/types.h>
14989 #include <unistd.h>
14990 int main() { off64_t x = 7; }
14991 EOCP
14992 set try
14993 if eval $compile; then
14994         val="$define"
14995         echo "You have off64_t."
14996 else
14997         val="$undef"
14998         echo "You do not have off64_t."
14999         case "$lseeksize" in
15000         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15001         esac
15002 fi
15003 $rm -f try.* try
15004 set d_off64_t
15005 eval $setvar
15006
15007 : how to create joinable pthreads
15008 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15009         echo " "
15010         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15011         $cat >try.c <<'EOCP'
15012 #include <pthread.h>
15013 int main() {
15014     int detachstate = JOINABLE;
15015 }
15016 EOCP
15017         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15018         if eval $compile; then
15019                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15020                 val="$undef" # Yes, undef.
15021                 set d_old_pthread_create_joinable
15022                 eval $setvar
15023                 val=""
15024                 set old_pthread_create_joinable
15025                 eval $setvar
15026         else
15027                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15028                 if eval $compile; then
15029                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15030                         val="$define"
15031                         set d_old_pthread_create_joinable
15032                         eval $setvar
15033                         val=PTHREAD_CREATE_UNDETACHED
15034                         set old_pthread_create_joinable
15035                         eval $setvar
15036                 else            
15037                         set try -DJOINABLE=__UNDETACHED
15038                         if eval $compile; then
15039                                 echo "You seem to use __UNDETACHED." >&4
15040                                 val="$define"
15041                                 set d_old_pthread_create_joinable
15042                                 eval $setvar
15043                                 val=__UNDETACHED
15044                                 set old_pthread_create_joinable
15045                                 eval $setvar
15046                         else
15047                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15048                                 val="$define"
15049                                 set d_old_pthread_create_joinable
15050                                 eval $setvar
15051                                 val=0
15052                                 set old_pthread_create_joinable
15053                                 eval $setvar
15054                         fi
15055                 fi
15056         fi
15057         $rm -f try try.*
15058 else
15059     d_old_pthread_create_joinable="$undef"
15060     old_pthread_create_joinable=""
15061 fi
15062
15063 : see if pause exists
15064 set pause d_pause
15065 eval $inlibc
15066
15067 : see if pipe exists
15068 set pipe d_pipe
15069 eval $inlibc
15070
15071 : see if poll exists
15072 set poll d_poll
15073 eval $inlibc
15074
15075 : see if readlink exists
15076 set readlink d_readlink
15077 eval $inlibc
15078
15079 echo " "
15080 procselfexe=''
15081 val="$undef"
15082 case "$d_readlink" in
15083 "$define")
15084         if $issymlink /proc/self/exe ; then
15085                 $ls -l /proc/self/exe > reflect
15086                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15087                         echo "You have Linux-like /proc/self/exe."
15088                         procselfexe='"/proc/self/exe"'
15089                         val="$define"
15090                 fi
15091         fi
15092         if $issymlink /proc/curproc/file ; then
15093                 $ls -l /proc/curproc/file > reflect
15094                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15095                         echo "You have BSD-like /proc/curproc/file."
15096                         procselfexe='"/proc/curproc/file"'
15097                         val="$define"
15098                 fi
15099         fi
15100         ;;
15101 esac
15102 $rm -f reflect
15103 set d_procselfexe
15104 eval $setvar
15105
15106 : see whether the pthread_atfork exists
15107 $cat >try.c <<EOP
15108 #include <pthread.h>
15109 #include <stdio.h>
15110 int main() {
15111 #ifdef  PTHREAD_ATFORK
15112         pthread_atfork(NULL,NULL,NULL);
15113 #endif
15114 }
15115 EOP
15116
15117 : see if pthread_atfork exists
15118 set try -DPTHREAD_ATFORK
15119 if eval $compile; then
15120     val="$define"
15121 else
15122     val="$undef"
15123 fi
15124 case "$usethreads" in
15125 $define)
15126         case "$val" in
15127         $define) echo 'pthread_atfork found.' >&4        ;;
15128         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15129         esac
15130 esac
15131 set d_pthread_atfork
15132 eval $setvar
15133
15134 : see if pthread_attr_setscope exists
15135 set pthread_attr_setscope d_pthread_attr_setscope
15136 eval $inlibc
15137
15138
15139 : see whether the various POSIXish _yields exist
15140 $cat >try.c <<EOP
15141 #include <pthread.h>
15142 #include <stdio.h>
15143 int main() {
15144 #ifdef SCHED_YIELD
15145         sched_yield();
15146 #else
15147 #ifdef PTHREAD_YIELD
15148         pthread_yield();
15149 #else
15150 #ifdef PTHREAD_YIELD_NULL
15151         pthread_yield(NULL);
15152 #endif
15153 #endif
15154 #endif
15155 }
15156 EOP
15157 : see if sched_yield exists
15158 set try -DSCHED_YIELD
15159 if eval $compile; then
15160     val="$define"
15161     sched_yield='sched_yield()'
15162 else
15163     val="$undef"
15164 fi
15165 case "$usethreads" in
15166 $define)
15167         case "$val" in
15168         $define) echo 'sched_yield() found.' >&4        ;;
15169         *)       echo 'sched_yield() NOT found.' >&4    ;;
15170         esac
15171 esac
15172 set d_sched_yield
15173 eval $setvar
15174
15175 : see if pthread_yield exists
15176 set try -DPTHREAD_YIELD
15177 if eval $compile; then
15178     val="$define"
15179     case "$sched_yield" in
15180     '') sched_yield='pthread_yield()' ;;
15181     esac
15182 else
15183     set try -DPTHREAD_YIELD_NULL
15184     if eval $compile; then
15185         val="$define"
15186         case "$sched_yield" in
15187         '') sched_yield='pthread_yield(NULL)' ;;
15188         esac
15189     else
15190         val="$undef"
15191     fi
15192 fi
15193 case "$usethreads" in
15194 $define)
15195         case "$val" in
15196         $define) echo 'pthread_yield() found.' >&4      ;;
15197         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15198         esac
15199         ;;
15200 esac
15201 set d_pthread_yield
15202 eval $setvar
15203
15204 case "$sched_yield" in
15205 '') sched_yield=undef ;;
15206 esac
15207
15208 $rm -f try try.*
15209
15210 : see if random_r exists
15211 set random_r d_random_r
15212 eval $inlibc
15213 case "$d_random_r" in
15214 "$define")
15215         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15216         case "$d_random_r_proto:$usethreads" in
15217         ":define")      d_random_r_proto=define
15218                 set d_random_r_proto random_r $hdrs
15219                 eval $hasproto ;;
15220         *)      ;;
15221         esac
15222         case "$d_random_r_proto" in
15223         define)
15224         case "$random_r_proto" in
15225         ''|0) try='int random_r(int*, struct random_data*);'
15226         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15227         esac
15228         case "$random_r_proto" in
15229         ''|0) try='int random_r(long*, struct random_data*);'
15230         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15231         esac
15232         case "$random_r_proto" in
15233         ''|0) try='int random_r(struct random_data*, int32_t*);'
15234         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15235         esac
15236         case "$random_r_proto" in
15237         ''|0)   d_random_r=undef
15238                 random_r_proto=0
15239                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15240         * )     case "$random_r_proto" in
15241                 REENTRANT_PROTO*) ;;
15242                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15243                 esac
15244                 echo "Prototype: $try" ;;
15245         esac
15246         ;;
15247         *)      case "$usethreads" in
15248                 define) echo "random_r has no prototype, not using it." >&4 ;;
15249                 esac
15250                 d_random_r=undef
15251                 random_r_proto=0
15252                 ;;
15253         esac
15254         ;;
15255 *)      random_r_proto=0
15256         ;;
15257 esac
15258
15259 : see if readdir and friends exist
15260 set readdir d_readdir
15261 eval $inlibc
15262 set seekdir d_seekdir
15263 eval $inlibc
15264 set telldir d_telldir
15265 eval $inlibc
15266 set rewinddir d_rewinddir
15267 eval $inlibc
15268
15269 : see if readdir64_r exists
15270 set readdir64_r d_readdir64_r
15271 eval $inlibc
15272 case "$d_readdir64_r" in
15273 "$define")
15274         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15275         case "$d_readdir64_r_proto:$usethreads" in
15276         ":define")      d_readdir64_r_proto=define
15277                 set d_readdir64_r_proto readdir64_r $hdrs
15278                 eval $hasproto ;;
15279         *)      ;;
15280         esac
15281         case "$d_readdir64_r_proto" in
15282         define)
15283         case "$readdir64_r_proto" in
15284         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15285         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15286         esac
15287         case "$readdir64_r_proto" in
15288         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15289         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15290         esac
15291         case "$readdir64_r_proto" in
15292         ''|0)   d_readdir64_r=undef
15293                 readdir64_r_proto=0
15294                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15295         * )     case "$readdir64_r_proto" in
15296                 REENTRANT_PROTO*) ;;
15297                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15298                 esac
15299                 echo "Prototype: $try" ;;
15300         esac
15301         ;;
15302         *)      case "$usethreads" in
15303                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15304                 esac
15305                 d_readdir64_r=undef
15306                 readdir64_r_proto=0
15307                 ;;
15308         esac
15309         ;;
15310 *)      readdir64_r_proto=0
15311         ;;
15312 esac
15313
15314 : see if readdir_r exists
15315 set readdir_r d_readdir_r
15316 eval $inlibc
15317 case "$d_readdir_r" in
15318 "$define")
15319         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15320         case "$d_readdir_r_proto:$usethreads" in
15321         ":define")      d_readdir_r_proto=define
15322                 set d_readdir_r_proto readdir_r $hdrs
15323                 eval $hasproto ;;
15324         *)      ;;
15325         esac
15326         case "$d_readdir_r_proto" in
15327         define)
15328         case "$readdir_r_proto" in
15329         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15330         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15331         esac
15332         case "$readdir_r_proto" in
15333         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15334         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15335         esac
15336         case "$readdir_r_proto" in
15337         ''|0)   d_readdir_r=undef
15338                 readdir_r_proto=0
15339                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15340         * )     case "$readdir_r_proto" in
15341                 REENTRANT_PROTO*) ;;
15342                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15343                 esac
15344                 echo "Prototype: $try" ;;
15345         esac
15346         ;;
15347         *)      case "$usethreads" in
15348                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15349                 esac
15350                 d_readdir_r=undef
15351                 readdir_r_proto=0
15352                 ;;
15353         esac
15354         ;;
15355 *)      readdir_r_proto=0
15356         ;;
15357 esac
15358
15359 : see if readv exists
15360 set readv d_readv
15361 eval $inlibc
15362
15363 : see if recvmsg exists
15364 set recvmsg d_recvmsg
15365 eval $inlibc
15366
15367 : see if rename exists
15368 set rename d_rename
15369 eval $inlibc
15370
15371 : see if rmdir exists
15372 set rmdir d_rmdir
15373 eval $inlibc
15374
15375 : see if memory.h is available.
15376 val=''
15377 set memory.h val
15378 eval $inhdr
15379
15380 : See if it conflicts with string.h
15381 case "$val" in
15382 $define)
15383         case "$strings" in
15384         '') ;;
15385         *)
15386                 $cppstdin $cppflags $cppminus < $strings > mem.h
15387                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15388                         echo " "
15389                         echo "We won't be including <memory.h>."
15390                         val="$undef"
15391                 fi
15392                 $rm -f mem.h
15393                 ;;
15394         esac
15395 esac
15396 set i_memory
15397 eval $setvar
15398
15399 : can bcopy handle overlapping blocks?
15400 echo " "
15401 val="$undef"
15402 case "$d_memmove" in
15403 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15404 *)      case "$d_bcopy" in
15405         "$define")
15406                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15407                 $cat >try.c <<EOCP
15408 #$i_memory I_MEMORY
15409 #$i_stdlib I_STDLIB
15410 #$i_string I_STRING
15411 #$i_unistd I_UNISTD
15412 EOCP
15413         $cat >>try.c <<'EOCP'
15414 #include <stdio.h>
15415 #ifdef I_MEMORY
15416 #  include <memory.h>
15417 #endif
15418 #ifdef I_STDLIB
15419 #  include <stdlib.h>
15420 #endif
15421 #ifdef I_STRING
15422 #  include <string.h>
15423 #else
15424 #  include <strings.h>
15425 #endif
15426 #ifdef I_UNISTD
15427 #  include <unistd.h>  /* Needed for NetBSD */
15428 #endif
15429 int main()
15430 {
15431 char buf[128], abc[128];
15432 char *b;
15433 int len;
15434 int off;
15435 int align;
15436
15437 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15438    try to store the string in read-only memory. */
15439 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15440
15441 for (align = 7; align >= 0; align--) {
15442         for (len = 36; len; len--) {
15443                 b = buf+align;
15444                 bcopy(abc, b, len);
15445                 for (off = 1; off <= len; off++) {
15446                         bcopy(b, b+off, len);
15447                         bcopy(b+off, b, len);
15448                         if (bcmp(b, abc, len))
15449                                 exit(1);
15450                 }
15451         }
15452 }
15453 exit(0);
15454 }
15455 EOCP
15456                 set try
15457                 if eval $compile_ok; then
15458                         if ./try 2>/dev/null; then
15459                                 echo "Yes, it can."
15460                                 val="$define"
15461                         else
15462                                 echo "It can't, sorry."
15463                         fi
15464                 else
15465                         echo "(I can't compile the test program, so we'll assume not...)"
15466                 fi
15467                 ;;
15468         esac
15469         $rm -f try.* try core
15470         ;;
15471 esac
15472 set d_safebcpy
15473 eval $setvar
15474
15475 : can memcpy handle overlapping blocks?
15476 echo " "
15477 val="$undef"
15478 case "$d_memmove" in
15479 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15480 *)      case "$d_memcpy" in
15481         "$define")
15482                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15483                 $cat >try.c <<EOCP
15484 #$i_memory I_MEMORY
15485 #$i_stdlib I_STDLIB
15486 #$i_string I_STRING
15487 #$i_unistd I_UNISTD
15488 EOCP
15489         $cat >>try.c <<'EOCP'
15490 #include <stdio.h>
15491 #ifdef I_MEMORY
15492 #  include <memory.h>
15493 #endif
15494 #ifdef I_STDLIB
15495 #  include <stdlib.h>
15496 #endif
15497 #ifdef I_STRING
15498 #  include <string.h>
15499 #else
15500 #  include <strings.h>
15501 #endif
15502 #ifdef I_UNISTD
15503 #  include <unistd.h>  /* Needed for NetBSD */
15504 #endif
15505 int main()
15506 {
15507 char buf[128], abc[128];
15508 char *b;
15509 int len;
15510 int off;
15511 int align;
15512
15513 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15514    try to store the string in read-only memory. */
15515 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15516
15517 for (align = 7; align >= 0; align--) {
15518         for (len = 36; len; len--) {
15519                 b = buf+align;
15520                 memcpy(b, abc, len);
15521                 for (off = 1; off <= len; off++) {
15522                         memcpy(b+off, b, len);
15523                         memcpy(b, b+off, len);
15524                         if (memcmp(b, abc, len))
15525                                 exit(1);
15526                 }
15527         }
15528 }
15529 exit(0);
15530 }
15531 EOCP
15532                 set try
15533                 if eval $compile_ok; then
15534                         if ./try 2>/dev/null; then
15535                                 echo "Yes, it can."
15536                                 val="$define"
15537                         else
15538                                 echo "It can't, sorry."
15539                         fi
15540                 else
15541                         echo "(I can't compile the test program, so we'll assume not...)"
15542                 fi
15543                 ;;
15544         esac
15545         $rm -f try.* try core
15546         ;;
15547 esac
15548 set d_safemcpy
15549 eval $setvar
15550
15551 : can memcmp be trusted to compare relative magnitude?
15552 val="$undef"
15553 case "$d_memcmp" in
15554 "$define")
15555         echo " "
15556         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15557         $cat >try.c <<EOCP
15558 #$i_memory I_MEMORY
15559 #$i_stdlib I_STDLIB
15560 #$i_string I_STRING
15561 #$i_unistd I_UNISTD
15562 EOCP
15563         $cat >>try.c <<'EOCP'
15564 #include <stdio.h>
15565 #ifdef I_MEMORY
15566 #  include <memory.h>
15567 #endif
15568 #ifdef I_STDLIB
15569 #  include <stdlib.h>
15570 #endif
15571 #ifdef I_STRING
15572 #  include <string.h>
15573 #else
15574 #  include <strings.h>
15575 #endif
15576 #ifdef I_UNISTD
15577 #  include <unistd.h>  /* Needed for NetBSD */
15578 #endif
15579 int main()
15580 {
15581 char a = -1;
15582 char b = 0;
15583 if ((a < b) && memcmp(&a, &b, 1) < 0)
15584         exit(1);
15585 exit(0);
15586 }
15587 EOCP
15588         set try
15589         if eval $compile_ok; then
15590                 if $run ./try 2>/dev/null; then
15591                         echo "Yes, it can."
15592                         val="$define"
15593                 else
15594                         echo "No, it can't (it uses signed chars)."
15595                 fi
15596         else
15597                 echo "(I can't compile the test program, so we'll assume not...)"
15598         fi
15599         ;;
15600 esac
15601 $rm -f try.* try core
15602 set d_sanemcmp
15603 eval $setvar
15604
15605 : see if prototype for sbrk is available
15606 echo " "
15607 set d_sbrkproto sbrk $i_unistd unistd.h
15608 eval $hasproto
15609
15610 : see if select exists
15611 set select d_select
15612 eval $inlibc
15613
15614 : see if semctl exists
15615 set semctl d_semctl
15616 eval $inlibc
15617
15618 : see if semget exists
15619 set semget d_semget
15620 eval $inlibc
15621
15622 : see if semop exists
15623 set semop d_semop
15624 eval $inlibc
15625
15626 : see how much of the 'sem*(2)' library is present.
15627 h_sem=true
15628 echo " "
15629 case "$d_semctl$d_semget$d_semop" in
15630 *"$undef"*) h_sem=false;;
15631 esac
15632 case "$osname" in
15633 freebsd)
15634     case "`ipcs 2>&1`" in
15635     "SVID messages"*"not configured"*)
15636         echo "Your $osname does not have the sem*(2) configured." >&4
15637         h_sem=false
15638         val="$undef"
15639         set semctl d_semctl
15640         eval $setvar
15641         set semget d_semget
15642         eval $setvar
15643         set semop d_semop
15644         eval $setvar
15645         ;;
15646     esac
15647     ;;
15648 esac
15649 : we could also check for sys/ipc.h ...
15650 if $h_sem && $test `./findhdr sys/sem.h`; then
15651         echo "You have the full sem*(2) library." >&4
15652         val="$define"
15653 else
15654         echo "You don't have the full sem*(2) library." >&4
15655         val="$undef"
15656 fi
15657 set d_sem
15658 eval $setvar
15659
15660 : see whether sys/sem.h defines union semun
15661 echo " "
15662 $cat > try.c <<'END'
15663 #include <sys/types.h>
15664 #include <sys/ipc.h>
15665 #include <sys/sem.h>
15666 int main () { union semun semun; semun.buf = 0; }
15667 END
15668 set try
15669 if eval $compile; then
15670     echo "You have union semun in <sys/sem.h>." >&4
15671     val="$define"
15672 else
15673     echo "You do not have union semun in <sys/sem.h>." >&4
15674     val="$undef"
15675 fi
15676 $rm -f try try.c
15677 set d_union_semun
15678 eval $setvar
15679
15680 : see how to do semctl IPC_STAT
15681 case "$d_sem" in
15682 $define)
15683     echo " "
15684     $cat > try.h <<END
15685 #ifndef S_IRUSR
15686 #   ifdef S_IREAD
15687 #       define S_IRUSR S_IREAD
15688 #       define S_IWUSR S_IWRITE
15689 #       define S_IXUSR S_IEXEC
15690 #   else
15691 #       define S_IRUSR 0400
15692 #       define S_IWUSR 0200
15693 #       define S_IXUSR 0100
15694 #   endif
15695 #   define S_IRGRP (S_IRUSR>>3)
15696 #   define S_IWGRP (S_IWUSR>>3)
15697 #   define S_IXGRP (S_IXUSR>>3)
15698 #   define S_IROTH (S_IRUSR>>6)
15699 #   define S_IWOTH (S_IWUSR>>6)
15700 #   define S_IXOTH (S_IXUSR>>6)
15701 #endif
15702 #ifndef S_IRWXU
15703 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15704 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15705 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15706 #endif
15707 END
15708     : see whether semctl IPC_STAT can use union semun
15709     val="$undef"
15710     case "$d_semctl_semun" in
15711     '')
15712       $cat > try.c <<END
15713 #include <sys/types.h>
15714 #include <sys/ipc.h>
15715 #include <sys/sem.h>
15716 #include <sys/stat.h>
15717 #include <stdio.h>
15718 #include <errno.h>
15719 #include "try.h"
15720 #ifndef errno
15721 extern int errno;
15722 #endif
15723 #$d_union_semun HAS_UNION_SEMUN
15724 int main() {
15725     union semun
15726 #ifndef HAS_UNION_SEMUN
15727     {
15728         int val;
15729         struct semid_ds *buf;
15730         unsigned short *array;
15731     }
15732 #endif
15733     arg;
15734     int sem, st;
15735
15736 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15737     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15738     if (sem > -1) {
15739         struct semid_ds argbuf;
15740         arg.buf = &argbuf;
15741 #       ifdef IPC_STAT
15742         st = semctl(sem, 0, IPC_STAT, arg);
15743         if (st == 0)
15744             printf("semun\n");
15745         else
15746 #       endif /* IPC_STAT */
15747             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15748 #       ifdef IPC_RMID
15749         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15750 #       endif /* IPC_RMID */
15751             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15752     } else
15753 #endif /* IPC_PRIVATE && ... */
15754         printf("semget failed: errno = %d\n", errno);
15755   return 0;
15756 }
15757 END
15758       set try
15759       if eval $compile; then
15760           xxx=`$run ./try`
15761           case "$xxx" in
15762           semun) val="$define" ;;
15763           esac
15764       fi
15765       $rm -f try try.c
15766       ;;
15767     esac
15768     set d_semctl_semun
15769     eval $setvar
15770     case "$d_semctl_semun" in
15771     $define)
15772         echo "You can use union semun for semctl IPC_STAT." >&4
15773         also='also'
15774         ;;
15775     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15776         also=''
15777         ;;
15778     esac
15779
15780     : see whether semctl IPC_STAT can use struct semid_ds pointer
15781     val="$undef"
15782     case "$d_semctl_semid_ds" in
15783     '')
15784       $cat > try.c <<'END'
15785 #include <sys/types.h>
15786 #include <sys/ipc.h>
15787 #include <sys/sem.h>
15788 #include <sys/stat.h>
15789 #include "try.h"
15790 #include <stdio.h>
15791 #include <errno.h>
15792 #ifndef errno
15793 extern int errno;
15794 #endif
15795 int main() {
15796     struct semid_ds arg;
15797     int sem, st;
15798
15799 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15800     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15801     if (sem > -1) {
15802 #       ifdef IPC_STAT
15803         st = semctl(sem, 0, IPC_STAT, &arg);
15804         if (st == 0)
15805             printf("semid_ds\n");
15806         else
15807 #       endif /* IPC_STAT */
15808             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15809 #       ifdef IPC_RMID
15810         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15811 #       endif /* IPC_RMID */
15812             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15813     } else
15814 #endif /* IPC_PRIVATE && ... */
15815         printf("semget failed: errno = %d\n", errno);
15816
15817     return 0;
15818 }
15819 END
15820       set try
15821       if eval $compile; then
15822           xxx=`$run ./try`
15823           case "$xxx" in
15824           semid_ds) val="$define" ;;
15825           esac
15826       fi
15827       $rm -f try try.c
15828       ;;
15829     esac
15830     set d_semctl_semid_ds
15831     eval $setvar
15832     case "$d_semctl_semid_ds" in
15833     $define)
15834         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15835         ;;
15836     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15837         ;;
15838     esac
15839     $rm -f try.h
15840     ;;
15841 *)  val="$undef"
15842
15843     # We do not have the full sem*(2) library, so assume we can not
15844     # use either.
15845
15846     set d_semctl_semun
15847     eval $setvar
15848
15849     set d_semctl_semid_ds
15850     eval $setvar
15851     ;;
15852 esac
15853
15854 : see if sendmsg exists
15855 set sendmsg d_sendmsg
15856 eval $inlibc
15857
15858 : see if setegid exists
15859 set setegid d_setegid
15860 eval $inlibc
15861
15862 : see if seteuid exists
15863 set seteuid d_seteuid
15864 eval $inlibc
15865
15866 : see if setgrent exists
15867 set setgrent d_setgrent
15868 eval $inlibc
15869
15870 : see if setgrent_r exists
15871 set setgrent_r d_setgrent_r
15872 eval $inlibc
15873 case "$d_setgrent_r" in
15874 "$define")
15875         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15876         case "$d_setgrent_r_proto:$usethreads" in
15877         ":define")      d_setgrent_r_proto=define
15878                 set d_setgrent_r_proto setgrent_r $hdrs
15879                 eval $hasproto ;;
15880         *)      ;;
15881         esac
15882         case "$d_setgrent_r_proto" in
15883         define)
15884         case "$setgrent_r_proto" in
15885         ''|0) try='int setgrent_r(FILE**);'
15886         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15887         esac
15888         case "$setgrent_r_proto" in
15889         ''|0) try='void setgrent_r(FILE**);'
15890         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15891         esac
15892         case "$setgrent_r_proto" in
15893         ''|0)   d_setgrent_r=undef
15894                 setgrent_r_proto=0
15895                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15896         * )     case "$setgrent_r_proto" in
15897                 REENTRANT_PROTO*) ;;
15898                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15899                 esac
15900                 echo "Prototype: $try" ;;
15901         esac
15902         ;;
15903         *)      case "$usethreads" in
15904                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15905                 esac
15906                 d_setgrent_r=undef
15907                 setgrent_r_proto=0
15908                 ;;
15909         esac
15910         ;;
15911 *)      setgrent_r_proto=0
15912         ;;
15913 esac
15914
15915 : see if sethostent exists
15916 set sethostent d_sethent
15917 eval $inlibc
15918
15919 : see if sethostent_r exists
15920 set sethostent_r d_sethostent_r
15921 eval $inlibc
15922 case "$d_sethostent_r" in
15923 "$define")
15924         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15925         case "$d_sethostent_r_proto:$usethreads" in
15926         ":define")      d_sethostent_r_proto=define
15927                 set d_sethostent_r_proto sethostent_r $hdrs
15928                 eval $hasproto ;;
15929         *)      ;;
15930         esac
15931         case "$d_sethostent_r_proto" in
15932         define)
15933         case "$sethostent_r_proto" in
15934         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15935         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15936         esac
15937         case "$sethostent_r_proto" in
15938         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15939         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15940         esac
15941         case "$sethostent_r_proto" in
15942         ''|0)   d_sethostent_r=undef
15943                 sethostent_r_proto=0
15944                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15945         * )     case "$sethostent_r_proto" in
15946                 REENTRANT_PROTO*) ;;
15947                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15948                 esac
15949                 echo "Prototype: $try" ;;
15950         esac
15951         ;;
15952         *)      case "$usethreads" in
15953                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15954                 esac
15955                 d_sethostent_r=undef
15956                 sethostent_r_proto=0
15957                 ;;
15958         esac
15959         ;;
15960 *)      sethostent_r_proto=0
15961         ;;
15962 esac
15963
15964 : see if setitimer exists
15965 set setitimer d_setitimer
15966 eval $inlibc
15967
15968 : see if setlinebuf exists
15969 set setlinebuf d_setlinebuf
15970 eval $inlibc
15971
15972 : see if setlocale exists
15973 set setlocale d_setlocale
15974 eval $inlibc
15975
15976 : see if locale.h is available
15977 set locale.h i_locale
15978 eval $inhdr
15979
15980 : see if setlocale_r exists
15981 set setlocale_r d_setlocale_r
15982 eval $inlibc
15983 case "$d_setlocale_r" in
15984 "$define")
15985         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15986         case "$d_setlocale_r_proto:$usethreads" in
15987         ":define")      d_setlocale_r_proto=define
15988                 set d_setlocale_r_proto setlocale_r $hdrs
15989                 eval $hasproto ;;
15990         *)      ;;
15991         esac
15992         case "$d_setlocale_r_proto" in
15993         define)
15994         case "$setlocale_r_proto" in
15995         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15996         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15997         esac
15998         case "$setlocale_r_proto" in
15999         ''|0)   d_setlocale_r=undef
16000                 setlocale_r_proto=0
16001                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16002         * )     case "$setlocale_r_proto" in
16003                 REENTRANT_PROTO*) ;;
16004                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16005                 esac
16006                 echo "Prototype: $try" ;;
16007         esac
16008         ;;
16009         *)      case "$usethreads" in
16010                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16011                 esac
16012                 d_setlocale_r=undef
16013                 setlocale_r_proto=0
16014                 ;;
16015         esac
16016         ;;
16017 *)      setlocale_r_proto=0
16018         ;;
16019 esac
16020
16021 : see if setnetent exists
16022 set setnetent d_setnent
16023 eval $inlibc
16024
16025 : see if setnetent_r exists
16026 set setnetent_r d_setnetent_r
16027 eval $inlibc
16028 case "$d_setnetent_r" in
16029 "$define")
16030         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16031         case "$d_setnetent_r_proto:$usethreads" in
16032         ":define")      d_setnetent_r_proto=define
16033                 set d_setnetent_r_proto setnetent_r $hdrs
16034                 eval $hasproto ;;
16035         *)      ;;
16036         esac
16037         case "$d_setnetent_r_proto" in
16038         define)
16039         case "$setnetent_r_proto" in
16040         ''|0) try='int setnetent_r(int, struct netent_data*);'
16041         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16042         esac
16043         case "$setnetent_r_proto" in
16044         ''|0) try='void setnetent_r(int, struct netent_data*);'
16045         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16046         esac
16047         case "$setnetent_r_proto" in
16048         ''|0)   d_setnetent_r=undef
16049                 setnetent_r_proto=0
16050                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16051         * )     case "$setnetent_r_proto" in
16052                 REENTRANT_PROTO*) ;;
16053                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16054                 esac
16055                 echo "Prototype: $try" ;;
16056         esac
16057         ;;
16058         *)      case "$usethreads" in
16059                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16060                 esac
16061                 d_setnetent_r=undef
16062                 setnetent_r_proto=0
16063                 ;;
16064         esac
16065         ;;
16066 *)      setnetent_r_proto=0
16067         ;;
16068 esac
16069
16070 : see if setprotoent exists
16071 set setprotoent d_setpent
16072 eval $inlibc
16073
16074 : see if setpgid exists
16075 set setpgid d_setpgid
16076 eval $inlibc
16077
16078 : see if setpgrp2 exists
16079 set setpgrp2 d_setpgrp2
16080 eval $inlibc
16081
16082 : see if setpriority exists
16083 set setpriority d_setprior
16084 eval $inlibc
16085
16086 : see if setproctitle exists
16087 set setproctitle d_setproctitle
16088 eval $inlibc
16089
16090 : see if setprotoent_r exists
16091 set setprotoent_r d_setprotoent_r
16092 eval $inlibc
16093 case "$d_setprotoent_r" in
16094 "$define")
16095         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16096         case "$d_setprotoent_r_proto:$usethreads" in
16097         ":define")      d_setprotoent_r_proto=define
16098                 set d_setprotoent_r_proto setprotoent_r $hdrs
16099                 eval $hasproto ;;
16100         *)      ;;
16101         esac
16102         case "$d_setprotoent_r_proto" in
16103         define)
16104         case "$setprotoent_r_proto" in
16105         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16106         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16107         esac
16108         case "$setprotoent_r_proto" in
16109         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16110         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16111         esac
16112         case "$setprotoent_r_proto" in
16113         ''|0)   d_setprotoent_r=undef
16114                 setprotoent_r_proto=0
16115                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16116         * )     case "$setprotoent_r_proto" in
16117                 REENTRANT_PROTO*) ;;
16118                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16119                 esac
16120                 echo "Prototype: $try" ;;
16121         esac
16122         ;;
16123         *)      case "$usethreads" in
16124                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16125                 esac
16126                 d_setprotoent_r=undef
16127                 setprotoent_r_proto=0
16128                 ;;
16129         esac
16130         ;;
16131 *)      setprotoent_r_proto=0
16132         ;;
16133 esac
16134
16135 : see if setpwent exists
16136 set setpwent d_setpwent
16137 eval $inlibc
16138
16139 : see if setpwent_r exists
16140 set setpwent_r d_setpwent_r
16141 eval $inlibc
16142 case "$d_setpwent_r" in
16143 "$define")
16144         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16145         case "$d_setpwent_r_proto:$usethreads" in
16146         ":define")      d_setpwent_r_proto=define
16147                 set d_setpwent_r_proto setpwent_r $hdrs
16148                 eval $hasproto ;;
16149         *)      ;;
16150         esac
16151         case "$d_setpwent_r_proto" in
16152         define)
16153         case "$setpwent_r_proto" in
16154         ''|0) try='int setpwent_r(FILE**);'
16155         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16156         esac
16157         case "$setpwent_r_proto" in
16158         ''|0) try='void setpwent_r(FILE**);'
16159         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16160         esac
16161         case "$setpwent_r_proto" in
16162         ''|0)   d_setpwent_r=undef
16163                 setpwent_r_proto=0
16164                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16165         * )     case "$setpwent_r_proto" in
16166                 REENTRANT_PROTO*) ;;
16167                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16168                 esac
16169                 echo "Prototype: $try" ;;
16170         esac
16171         ;;
16172         *)      case "$usethreads" in
16173                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16174                 esac
16175                 d_setpwent_r=undef
16176                 setpwent_r_proto=0
16177                 ;;
16178         esac
16179         ;;
16180 *)      setpwent_r_proto=0
16181         ;;
16182 esac
16183
16184 : see if setregid exists
16185 set setregid d_setregid
16186 eval $inlibc
16187 set setresgid d_setresgid
16188 eval $inlibc
16189
16190 : see if setreuid exists
16191 set setreuid d_setreuid
16192 eval $inlibc
16193 set setresuid d_setresuid
16194 eval $inlibc
16195
16196 : see if setrgid exists
16197 set setrgid d_setrgid
16198 eval $inlibc
16199
16200 : see if setruid exists
16201 set setruid d_setruid
16202 eval $inlibc
16203
16204 : see if setservent exists
16205 set setservent d_setsent
16206 eval $inlibc
16207
16208 : see if setservent_r exists
16209 set setservent_r d_setservent_r
16210 eval $inlibc
16211 case "$d_setservent_r" in
16212 "$define")
16213         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16214         case "$d_setservent_r_proto:$usethreads" in
16215         ":define")      d_setservent_r_proto=define
16216                 set d_setservent_r_proto setservent_r $hdrs
16217                 eval $hasproto ;;
16218         *)      ;;
16219         esac
16220         case "$d_setservent_r_proto" in
16221         define)
16222         case "$setservent_r_proto" in
16223         ''|0) try='int setservent_r(int, struct servent_data*);'
16224         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16225         esac
16226         case "$setservent_r_proto" in
16227         ''|0) try='void setservent_r(int, struct servent_data*);'
16228         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16229         esac
16230         case "$setservent_r_proto" in
16231         ''|0)   d_setservent_r=undef
16232                 setservent_r_proto=0
16233                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16234         * )     case "$setservent_r_proto" in
16235                 REENTRANT_PROTO*) ;;
16236                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16237                 esac
16238                 echo "Prototype: $try" ;;
16239         esac
16240         ;;
16241         *)      case "$usethreads" in
16242                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16243                 esac
16244                 d_setservent_r=undef
16245                 setservent_r_proto=0
16246                 ;;
16247         esac
16248         ;;
16249 *)      setservent_r_proto=0
16250         ;;
16251 esac
16252
16253 : see if setsid exists
16254 set setsid d_setsid
16255 eval $inlibc
16256
16257 : see if setvbuf exists
16258 set setvbuf d_setvbuf
16259 eval $inlibc
16260
16261 : see if sfio.h is available
16262 set sfio.h i_sfio
16263 eval $inhdr
16264
16265
16266 : see if sfio library is available
16267 case "$i_sfio" in
16268 $define)
16269         val=''
16270         set sfreserve val
16271         eval $inlibc
16272         ;;
16273 *)
16274         val="$undef"
16275         ;;
16276 esac
16277 : Ok, but do we want to use it.
16278 case "$val" in
16279 $define)
16280         case "$usesfio" in
16281         true|$define|[yY]*) dflt='y';;
16282         *) dflt='n';;
16283         esac
16284         echo "$package can use the sfio library, but it is experimental."
16285         case "$useperlio" in
16286         "$undef")
16287             echo "For sfio also the PerlIO abstraction layer is needed."
16288             echo "Earlier you said you wouldn't want that."
16289             ;;
16290         esac
16291         rp="You seem to have sfio available, do you want to try using it?"
16292         . ./myread
16293         case "$ans" in
16294         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16295                 useperlio="$define"
16296                 val="$define"
16297                 ;;
16298         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16299                 val="$undef"
16300                 ;;
16301         esac
16302         ;;
16303 *)      case "$usesfio" in
16304         true|$define|[yY]*)
16305                 echo "Sorry, cannot find sfio on this machine." >&4
16306                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16307                 val="$undef"
16308                 ;;
16309         esac
16310         ;;
16311 esac
16312 set d_sfio
16313 eval $setvar
16314 case "$d_sfio" in
16315 $define) usesfio='true';;
16316 *) usesfio='false';;
16317 esac
16318 case "$d_sfio" in
16319 $define) ;;
16320 *)      : Remove sfio from list of libraries to use
16321         case "$libs" in
16322         *-lsfio*)
16323                 echo "Removing unneeded -lsfio from library list" >&4
16324                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16325                 shift
16326                 libs="$*"
16327                 echo "libs = $libs" >&4
16328                 ;;
16329         esac
16330 ;;
16331 esac
16332
16333
16334 : see if shmctl exists
16335 set shmctl d_shmctl
16336 eval $inlibc
16337
16338 : see if shmget exists
16339 set shmget d_shmget
16340 eval $inlibc
16341
16342 : see if shmat exists
16343 set shmat d_shmat
16344 eval $inlibc
16345 : see what shmat returns
16346 case "$d_shmat" in
16347 "$define")
16348         $cat >shmat.c <<'END'
16349 #include <sys/shm.h>
16350 void *shmat();
16351 END
16352         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16353                 shmattype='void *'
16354         else
16355                 shmattype='char *'
16356         fi
16357         echo "and it returns ($shmattype)." >&4
16358         : see if a prototype for shmat is available
16359         xxx=`./findhdr sys/shm.h`
16360         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16361         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16362                 val="$define"
16363         else
16364                 val="$undef"
16365         fi
16366         $rm -f shmat.[co]
16367         ;;
16368 *)
16369         val="$undef"
16370         ;;
16371 esac
16372 set d_shmatprototype
16373 eval $setvar
16374
16375 : see if shmdt exists
16376 set shmdt d_shmdt
16377 eval $inlibc
16378
16379 : see how much of the 'shm*(2)' library is present.
16380 h_shm=true
16381 echo " "
16382 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16383 *"$undef"*) h_shm=false;;
16384 esac
16385 case "$osname" in
16386 freebsd)
16387     case "`ipcs 2>&1`" in
16388     "SVID shared memory"*"not configured"*)
16389         echo "Your $osname does not have the shm*(2) configured." >&4
16390         h_shm=false
16391         val="$undef"
16392         set shmctl d_shmctl
16393         evat $setvar
16394         set shmget d_shmget
16395         evat $setvar
16396         set shmat d_shmat
16397         evat $setvar
16398         set shmdt d_shmdt
16399         evat $setvar
16400         ;;
16401     esac
16402     ;;
16403 esac
16404 : we could also check for sys/ipc.h ...
16405 if $h_shm && $test `./findhdr sys/shm.h`; then
16406         echo "You have the full shm*(2) library." >&4
16407         val="$define"
16408 else
16409         echo "You don't have the full shm*(2) library." >&4
16410         val="$undef"
16411 fi
16412 set d_shm
16413 eval $setvar
16414
16415 echo " "
16416 : see if we have sigaction
16417 if set sigaction val -f d_sigaction; eval $csym; $val; then
16418         echo 'sigaction() found.' >&4
16419         $cat > try.c <<EOP
16420 #include <stdio.h>
16421 #include <sys/types.h>
16422 #include <signal.h>
16423 #$i_stdlib I_STDLIB
16424 #ifdef I_STDLIB
16425 #include <stdlib.h>
16426 #endif
16427 int main()
16428 {
16429     struct sigaction act, oact;
16430     act.sa_flags = 0;
16431     oact.sa_handler = 0;
16432     /* so that act and oact are used */
16433     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16434 }
16435 EOP
16436         set try
16437         if eval $compile_ok; then
16438                 val="$define"
16439         else
16440                 echo "But you don't seem to have a useable struct sigaction." >&4
16441                 val="$undef"
16442         fi
16443 else
16444         echo 'sigaction NOT found.' >&4
16445         val="$undef"
16446 fi
16447 set d_sigaction; eval $setvar
16448 $rm -f try try$_o try.c
16449
16450 : see if sigprocmask exists
16451 set sigprocmask d_sigprocmask
16452 eval $inlibc
16453
16454 : see if sigsetjmp exists
16455 echo " "
16456 case "$d_sigsetjmp" in
16457 '')
16458         $cat >try.c <<EOP
16459 #include <setjmp.h>
16460 #$i_stdlib I_STDLIB
16461 #ifdef I_STDLIB
16462 #include <stdlib.h>
16463 #endif
16464 sigjmp_buf env;
16465 int set = 1;
16466 int main()
16467 {
16468         if (sigsetjmp(env,1))
16469                 exit(set);
16470         set = 0;
16471         siglongjmp(env, 1);
16472         exit(1);
16473 }
16474 EOP
16475         set try
16476         if eval $compile; then
16477                 if $run ./try >/dev/null 2>&1; then
16478                         echo "POSIX sigsetjmp found." >&4
16479                         val="$define"
16480                 else
16481                         $cat >&4 <<EOM
16482 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16483 I'll ignore them.
16484 EOM
16485                         val="$undef"
16486                 fi
16487         else
16488                 echo "sigsetjmp not found." >&4
16489                 val="$undef"
16490         fi
16491         ;;
16492 *) val="$d_sigsetjmp"
16493         case "$d_sigsetjmp" in
16494         $define) echo "POSIX sigsetjmp found." >&4;;
16495         $undef) echo "sigsetjmp not found." >&4;;
16496         esac
16497         ;;
16498 esac
16499 set d_sigsetjmp
16500 eval $setvar
16501 $rm -f try.c try
16502
16503 : see if sockatmark exists
16504 set sockatmark d_sockatmark
16505 eval $inlibc
16506
16507 : see if prototype for sockatmark is available
16508 echo " "
16509 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16510 eval $hasproto
16511
16512 : see if socks5_init exists
16513 set socks5_init d_socks5_init
16514 eval $inlibc
16515
16516 : see if sprintf returns the length of the string in the buffer as per ANSI
16517 $echo "Checking whether sprintf returns the length of the string..." >&4
16518 $cat <<EOP >try.c
16519 #include <stdio.h>
16520 #$i_stdlib I_STDLIB
16521 #ifdef I_STDLIB
16522 #include <stdlib.h>
16523 #endif
16524 #$i_string I_STRING
16525 #ifdef I_STRING
16526 #  include <string.h>
16527 #else
16528 #  include <strings.h>
16529 #endif
16530 #$i_math I_MATH
16531 #ifdef I_MATH
16532 #include <math.h>
16533 #endif
16534
16535 char buffer[256];
16536
16537 int check (size_t expect, int test) {
16538   size_t got = strlen(buffer);
16539   if (expect == got)
16540     return 0;
16541
16542   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16543        test, buffer);
16544   exit (test);
16545 }
16546
16547 int main(int argc, char **argv) {
16548   int test = 0;
16549
16550   check(sprintf(buffer, ""), ++test);
16551   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16552   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16553
16554   return 0;
16555 }
16556 EOP
16557 set try
16558
16559 d_sprintf_returns_strlen="$undef"
16560 if eval $compile; then
16561     xxx="`$run ./try`"
16562     case "$?" in
16563         0) cat >&4 <<EOM
16564 sprintf returns the length of the string (as ANSI says it should)
16565 EOM
16566         d_sprintf_returns_strlen="$define"
16567         ;;
16568         *) cat >&4 <<EOM
16569 sprintf does not return the length of the string (how old is this system?)
16570 EOM
16571         d_sprintf_returns_strlen="$undef"
16572         ;;
16573     esac
16574 fi
16575
16576 $rm -f try.* try
16577
16578 : see if srand48_r exists
16579 set srand48_r d_srand48_r
16580 eval $inlibc
16581 case "$d_srand48_r" in
16582 "$define")
16583         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16584         case "$d_srand48_r_proto:$usethreads" in
16585         ":define")      d_srand48_r_proto=define
16586                 set d_srand48_r_proto srand48_r $hdrs
16587                 eval $hasproto ;;
16588         *)      ;;
16589         esac
16590         case "$d_srand48_r_proto" in
16591         define)
16592         case "$srand48_r_proto" in
16593         ''|0) try='int srand48_r(long, struct drand48_data*);'
16594         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16595         esac
16596         case "$srand48_r_proto" in
16597         ''|0)   d_srand48_r=undef
16598                 srand48_r_proto=0
16599                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16600         * )     case "$srand48_r_proto" in
16601                 REENTRANT_PROTO*) ;;
16602                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16603                 esac
16604                 echo "Prototype: $try" ;;
16605         esac
16606         ;;
16607         *)      case "$usethreads" in
16608                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16609                 esac
16610                 d_srand48_r=undef
16611                 srand48_r_proto=0
16612                 ;;
16613         esac
16614         ;;
16615 *)      srand48_r_proto=0
16616         ;;
16617 esac
16618
16619 : see if srandom_r exists
16620 set srandom_r d_srandom_r
16621 eval $inlibc
16622 case "$d_srandom_r" in
16623 "$define")
16624         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16625         case "$d_srandom_r_proto:$usethreads" in
16626         ":define")      d_srandom_r_proto=define
16627                 set d_srandom_r_proto srandom_r $hdrs
16628                 eval $hasproto ;;
16629         *)      ;;
16630         esac
16631         case "$d_srandom_r_proto" in
16632         define)
16633         case "$srandom_r_proto" in
16634         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16635         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16636         esac
16637         case "$srandom_r_proto" in
16638         ''|0)   d_srandom_r=undef
16639                 srandom_r_proto=0
16640                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16641         * )     case "$srandom_r_proto" in
16642                 REENTRANT_PROTO*) ;;
16643                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16644                 esac
16645                 echo "Prototype: $try" ;;
16646         esac
16647         ;;
16648         *)      case "$usethreads" in
16649                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16650                 esac
16651                 d_srandom_r=undef
16652                 srandom_r_proto=0
16653                 ;;
16654         esac
16655         ;;
16656 *)      srandom_r_proto=0
16657         ;;
16658 esac
16659
16660 : see if prototype for setresgid is available
16661 echo " "
16662 set d_sresgproto setresgid $i_unistd unistd.h
16663 eval $hasproto
16664
16665 : see if prototype for setresuid is available
16666 echo " "
16667 set d_sresuproto setresuid $i_unistd unistd.h
16668 eval $hasproto
16669
16670 : see if sys/stat.h is available
16671 set sys/stat.h i_sysstat
16672 eval $inhdr
16673
16674
16675 : see if stat knows about block sizes
16676 echo " "
16677 echo "Checking to see if your struct stat has st_blocks field..." >&4
16678 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16679 eval $hasfield
16680
16681
16682 : see if this is a sys/vfs.h system
16683 set sys/vfs.h i_sysvfs
16684 eval $inhdr
16685
16686
16687 : see if this is a sys/statfs.h system
16688 set sys/statfs.h i_sysstatfs
16689 eval $inhdr
16690
16691
16692 echo " "
16693 echo "Checking to see if your system supports struct statfs..." >&4
16694 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
16695 eval $hasstruct
16696 case "$d_statfs_s" in
16697 "$define")      echo "Yes, it does."   ;;
16698 *)              echo "No, it doesn't." ;;
16699 esac
16700
16701
16702
16703 : see if struct statfs knows about f_flags
16704 case "$d_statfs_s" in
16705 define) 
16706         echo " "
16707         echo "Checking to see if your struct statfs has f_flags field..." >&4
16708         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
16709         eval $hasfield
16710         ;;
16711 *)      val="$undef"
16712         set d_statfs_f_flags
16713         eval $setvar
16714         ;;
16715 esac
16716 case "$d_statfs_f_flags" in
16717 "$define")      echo "Yes, it does."   ;;
16718 *)              echo "No, it doesn't." ;;
16719 esac
16720
16721 $cat >&4 <<EOM
16722 Checking how to access stdio streams by file descriptor number...
16723 EOM
16724 case "$stdio_stream_array" in
16725 '')     $cat >try.c <<EOCP
16726 #include <stdio.h>
16727 int main() {
16728   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16729     printf("yes\n");
16730 }
16731 EOCP
16732         for s in _iob __iob __sF
16733         do
16734                 set try -DSTDIO_STREAM_ARRAY=$s
16735                 if eval $compile; then
16736                         case "`$run ./try`" in
16737                         yes)    stdio_stream_array=$s; break ;;
16738                         esac
16739                 fi
16740         done
16741         $rm -f try.* try$exe_ext
16742 esac
16743 case "$stdio_stream_array" in
16744 '')     $cat >&4 <<EOM
16745 I can't figure out how to access stdio streams by file descriptor number.
16746 EOM
16747         d_stdio_stream_array="$undef"
16748         ;;
16749 *)      $cat >&4 <<EOM
16750 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16751 EOM
16752         d_stdio_stream_array="$define"
16753         ;;
16754 esac
16755
16756 : see if strcoll exists
16757 set strcoll d_strcoll
16758 eval $inlibc
16759
16760 : check for structure copying
16761 echo " "
16762 echo "Checking to see if your C compiler can copy structs..." >&4
16763 $cat >try.c <<'EOCP'
16764 int main()
16765 {
16766         struct blurfl {
16767                 int dyick;
16768         } foo, bar;
16769
16770         foo = bar;
16771 }
16772 EOCP
16773 if $cc -c try.c >/dev/null 2>&1 ; then
16774         val="$define"
16775         echo "Yup, it can."
16776 else
16777         val="$undef"
16778         echo "Nope, it can't."
16779 fi
16780 set d_strctcpy
16781 eval $setvar
16782 $rm -f try.*
16783
16784 : see if strerror and/or sys_errlist[] exist
16785 echo " "
16786 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16787     if set strerror val -f d_strerror; eval $csym; $val; then
16788                 echo 'strerror() found.' >&4
16789                 d_strerror="$define"
16790                 d_strerrm='strerror(e)'
16791                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16792                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16793                         d_syserrlst="$define"
16794                 else
16795                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16796                         d_syserrlst="$undef"
16797                 fi
16798     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16799                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16800                 echo 'strerror() found in string header.' >&4
16801                 d_strerror="$define"
16802                 d_strerrm='strerror(e)'
16803                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16804                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16805                                 d_syserrlst="$define"
16806                 else
16807                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16808                         d_syserrlst="$undef"
16809                 fi
16810     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16811                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16812                 d_strerror="$undef"
16813                 d_syserrlst="$define"
16814                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16815     else
16816                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16817                 d_strerror="$undef"
16818                 d_syserrlst="$undef"
16819                 d_strerrm='"unknown"'
16820     fi
16821 fi
16822
16823 : see if strerror_r exists
16824 set strerror_r d_strerror_r
16825 eval $inlibc
16826 case "$d_strerror_r" in
16827 "$define")
16828         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16829         case "$d_strerror_r_proto:$usethreads" in
16830         ":define")      d_strerror_r_proto=define
16831                 set d_strerror_r_proto strerror_r $hdrs
16832                 eval $hasproto ;;
16833         *)      ;;
16834         esac
16835         case "$d_strerror_r_proto" in
16836         define)
16837         case "$strerror_r_proto" in
16838         ''|0) try='int strerror_r(int, char*, size_t);'
16839         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16840         esac
16841         case "$strerror_r_proto" in
16842         ''|0) try='int strerror_r(int, char*, int);'
16843         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16844         esac
16845         case "$strerror_r_proto" in
16846         ''|0) try='char* strerror_r(int, char*, size_t);'
16847         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16848         esac
16849         case "$strerror_r_proto" in
16850         ''|0)   d_strerror_r=undef
16851                 strerror_r_proto=0
16852                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16853         * )     case "$strerror_r_proto" in
16854                 REENTRANT_PROTO*) ;;
16855                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16856                 esac
16857                 echo "Prototype: $try" ;;
16858         esac
16859         ;;
16860         *)      case "$usethreads" in
16861                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16862                 esac
16863                 d_strerror_r=undef
16864                 strerror_r_proto=0
16865                 ;;
16866         esac
16867         ;;
16868 *)      strerror_r_proto=0
16869         ;;
16870 esac
16871
16872 : see if strftime exists
16873 set strftime d_strftime
16874 eval $inlibc
16875
16876 : see if strlcat exists
16877 set strlcat d_strlcat
16878 eval $inlibc
16879
16880 : see if strlcpy exists
16881 set strlcpy d_strlcpy
16882 eval $inlibc
16883
16884 : see if strtod exists
16885 set strtod d_strtod
16886 eval $inlibc
16887
16888 : see if strtol exists
16889 set strtol d_strtol
16890 eval $inlibc
16891
16892 : see if strtold exists
16893 set strtold d_strtold
16894 eval $inlibc
16895
16896 : see if strtoll exists
16897 set strtoll d_strtoll
16898 eval $inlibc
16899
16900 case "$d_longlong-$d_strtoll" in
16901 "$define-$define")
16902         $cat <<EOM
16903 Checking whether your strtoll() works okay...
16904 EOM
16905         $cat >try.c <<'EOCP'
16906 #include <errno.h>
16907 #ifdef __hpux
16908 #define strtoll __strtoll
16909 #endif
16910 #ifdef __EMX__
16911 #define strtoll _strtoll
16912 #endif
16913 #include <stdio.h>
16914 extern long long int strtoll(char *s, char **, int); 
16915 static int bad = 0;
16916 int check(char *s, long long ell, int een) {
16917         long long gll;
16918         errno = 0;
16919         gll = strtoll(s, 0, 10);
16920         if (!((gll == ell) && (errno == een)))
16921                 bad++;
16922 }
16923 int main() {
16924         check(" 1",                                      1LL, 0);
16925         check(" 0",                                      0LL, 0);
16926         check("-1",                                     -1LL, 0);
16927         check("-9223372036854775808", -9223372036854775808LL, 0);
16928         check("-9223372036854775808", -9223372036854775808LL, 0);
16929         check(" 9223372036854775807",  9223372036854775807LL, 0);
16930         check("-9223372036854775808", -9223372036854775808LL, 0);
16931         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16932         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16933         if (!bad)
16934                 printf("ok\n");
16935 }
16936 EOCP
16937         set try
16938         if eval $compile; then
16939                 yyy=`$run ./try`
16940                 case "$yyy" in
16941                 ok) echo "Your strtoll() seems to be working okay." ;;
16942                 *) cat <<EOM >&4
16943 Your strtoll() doesn't seem to be working okay.
16944 EOM
16945                    d_strtoll="$undef"
16946                    ;;
16947                 esac
16948         else
16949                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16950                 d_strtoll="$undef"
16951         fi
16952         ;;
16953 esac
16954
16955 : see if strtoq exists
16956 set strtoq d_strtoq
16957 eval $inlibc
16958
16959 : see if strtoul exists
16960 set strtoul d_strtoul
16961 eval $inlibc
16962
16963 case "$d_strtoul" in
16964 "$define")
16965         $cat <<EOM
16966 Checking whether your strtoul() works okay...
16967 EOM
16968         $cat >try.c <<'EOCP'
16969 #include <errno.h>
16970 #include <stdio.h>
16971 extern unsigned long int strtoul(char *s, char **, int); 
16972 static int bad = 0;
16973 void check(char *s, unsigned long eul, int een) {
16974         unsigned long gul;
16975         errno = 0;
16976         gul = strtoul(s, 0, 10);
16977         if (!((gul == eul) && (errno == een)))
16978                 bad++;
16979 }
16980 int main() {
16981         check(" 1", 1L, 0);
16982         check(" 0", 0L, 0);
16983 EOCP
16984         case "$longsize" in
16985         8)
16986             $cat >>try.c <<'EOCP'
16987         check("18446744073709551615", 18446744073709551615UL, 0);
16988         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16989 #if 0 /* strtoul() for /^-/ strings is undefined. */
16990         check("-1", 18446744073709551615UL, 0);
16991         check("-18446744073709551614", 2, 0);
16992         check("-18446744073709551615", 1, 0);
16993         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16994         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16995 #endif
16996 EOCP
16997                 ;;
16998         4)
16999                     $cat >>try.c <<'EOCP'
17000         check("4294967295", 4294967295UL, 0);
17001         check("4294967296", 4294967295UL, ERANGE);
17002 #if 0 /* strtoul() for /^-/ strings is undefined. */
17003         check("-1", 4294967295UL, 0);
17004         check("-4294967294", 2, 0);
17005         check("-4294967295", 1, 0);
17006         check("-4294967296", 4294967295UL, ERANGE);
17007         check("-4294967297", 4294967295UL, ERANGE);
17008 #endif
17009 EOCP
17010                 ;;
17011         *)
17012 : Should we write these tests to be more portable by sprintf-ing
17013 : ~0 and then manipulating that char string as input for strtol?
17014                 ;;
17015         esac
17016         $cat >>try.c <<'EOCP'
17017         if (!bad)
17018                 printf("ok\n");
17019         return 0;
17020 }
17021 EOCP
17022         set try
17023         if eval $compile; then
17024                 case "`$run ./try`" in
17025                 ok) echo "Your strtoul() seems to be working okay." ;;
17026                 *) cat <<EOM >&4
17027 Your strtoul() doesn't seem to be working okay.
17028 EOM
17029                    d_strtoul="$undef"
17030                    ;;
17031                 esac
17032         fi
17033         ;;
17034 esac
17035
17036 : see if strtoull exists
17037 set strtoull d_strtoull
17038 eval $inlibc
17039
17040 case "$d_longlong-$d_strtoull" in
17041 "$define-$define")
17042         $cat <<EOM
17043 Checking whether your strtoull() works okay...
17044 EOM
17045         $cat >try.c <<'EOCP'
17046 #include <errno.h>
17047 #ifdef __hpux
17048 #define strtoull __strtoull
17049 #endif
17050 #include <stdio.h>
17051 extern unsigned long long int strtoull(char *s, char **, int); 
17052 static int bad = 0;
17053 int check(char *s, long long eull, int een) {
17054         long long gull;
17055         errno = 0;
17056         gull = strtoull(s, 0, 10);
17057         if (!((gull == eull) && (errno == een)))
17058                 bad++;
17059 }
17060 int main() {
17061         check(" 1",                                        1LL, 0);
17062         check(" 0",                                        0LL, 0);
17063         check("18446744073709551615",  18446744073709551615ULL, 0);
17064         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17065 #if 0 /* strtoull() for /^-/ strings is undefined. */
17066         check("-1",                    18446744073709551615ULL, 0);
17067         check("-18446744073709551614",                     2LL, 0);
17068         check("-18446744073709551615",                     1LL, 0);
17069         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17070         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17071 #endif
17072         if (!bad)
17073                 printf("ok\n");
17074 }
17075 EOCP
17076         set try
17077         if eval $compile; then
17078                 case "`$run ./try`" in
17079                 ok) echo "Your strtoull() seems to be working okay." ;;
17080                 *) cat <<EOM >&4
17081 Your strtoull() doesn't seem to be working okay.
17082 EOM
17083                    d_strtoull="$undef"
17084                    ;;
17085                 esac
17086         fi
17087         ;;
17088 esac
17089
17090 : see if strtouq exists
17091 set strtouq d_strtouq
17092 eval $inlibc
17093
17094 case "$d_strtouq" in
17095 "$define")
17096         $cat <<EOM
17097 Checking whether your strtouq() works okay...
17098 EOM
17099         $cat >try.c <<'EOCP'
17100 #include <errno.h>
17101 #include <stdio.h>
17102 extern unsigned long long int strtouq(char *s, char **, int); 
17103 static int bad = 0;
17104 void check(char *s, unsigned long long eull, int een) {
17105         unsigned long long gull;
17106         errno = 0;
17107         gull = strtouq(s, 0, 10);
17108         if (!((gull == eull) && (errno == een)))
17109                 bad++;
17110 }
17111 int main() {
17112         check(" 1",                                        1LL, 0);
17113         check(" 0",                                        0LL, 0);
17114         check("18446744073709551615",  18446744073709551615ULL, 0);
17115         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17116 #if 0 /* strtouq() for /^-/ strings is undefined. */
17117         check("-1",                    18446744073709551615ULL, 0);
17118         check("-18446744073709551614",                     2LL, 0);
17119         check("-18446744073709551615",                     1LL, 0);
17120         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17121         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17122 #endif
17123         if (!bad)
17124                 printf("ok\n");
17125         return 0;
17126 }
17127 EOCP
17128         set try
17129         if eval $compile; then
17130                 case "`$run ./try`" in
17131                 ok) echo "Your strtouq() seems to be working okay." ;;
17132                 *) cat <<EOM >&4
17133 Your strtouq() doesn't seem to be working okay.
17134 EOM
17135                    d_strtouq="$undef"
17136                    ;;
17137                 esac
17138         fi
17139         ;;
17140 esac
17141
17142 : see if strxfrm exists
17143 set strxfrm d_strxfrm
17144 eval $inlibc
17145
17146 : see if symlink exists
17147 set symlink d_symlink
17148 eval $inlibc
17149
17150 : see if syscall exists
17151 set syscall d_syscall
17152 eval $inlibc
17153
17154 : see if prototype for syscall is available
17155 echo " "
17156 set d_syscallproto syscall $i_unistd unistd.h
17157 eval $hasproto
17158
17159 : see if sysconf exists
17160 set sysconf d_sysconf
17161 eval $inlibc
17162
17163 : see if system exists
17164 set system d_system
17165 eval $inlibc
17166
17167 : see if tcgetpgrp exists
17168 set tcgetpgrp d_tcgetpgrp
17169 eval $inlibc
17170
17171 : see if tcsetpgrp exists
17172 set tcsetpgrp d_tcsetpgrp
17173 eval $inlibc
17174
17175 : see if prototype for telldir is available
17176 echo " "
17177 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17178 eval $hasproto
17179
17180 : see if time exists
17181 echo " "
17182 if test "X$d_time" = X -o X"$timetype" = X; then
17183     if set time val -f d_time; eval $csym; $val; then
17184                 echo 'time() found.' >&4
17185                 val="$define"
17186                 rp="What is the type returned by time() on this system?"
17187                 set time_t timetype long stdio.h sys/types.h
17188                 eval $typedef_ask
17189     else
17190                 echo 'time() not found, hope that will do.' >&4
17191                 val="$undef"
17192                 timetype='int';
17193     fi
17194     set d_time
17195     eval $setvar
17196 fi
17197
17198 : see if this is a sys/times.h system
17199 set sys/times.h i_systimes
17200 eval $inhdr
17201
17202 : see if times exists
17203 echo " "
17204 if set times val -f d_times; eval $csym; $val; then
17205         echo 'times() found.' >&4
17206         d_times="$define"
17207         inc=''
17208         case "$i_systimes" in
17209         "$define") inc='sys/times.h';;
17210         esac
17211         rp="What is the type returned by times() on this system?"
17212         set clock_t clocktype long stdio.h sys/types.h $inc
17213         eval $typedef_ask
17214 else
17215         echo 'times() NOT found, hope that will do.' >&4
17216         d_times="$undef"
17217         clocktype='int'
17218 fi
17219
17220 : see if tmpnam_r exists
17221 set tmpnam_r d_tmpnam_r
17222 eval $inlibc
17223 case "$d_tmpnam_r" in
17224 "$define")
17225         hdrs="$i_systypes sys/types.h define stdio.h "
17226         case "$d_tmpnam_r_proto:$usethreads" in
17227         ":define")      d_tmpnam_r_proto=define
17228                 set d_tmpnam_r_proto tmpnam_r $hdrs
17229                 eval $hasproto ;;
17230         *)      ;;
17231         esac
17232         case "$d_tmpnam_r_proto" in
17233         define)
17234         case "$tmpnam_r_proto" in
17235         ''|0) try='char* tmpnam_r(char*);'
17236         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17237         esac
17238         case "$tmpnam_r_proto" in
17239         ''|0)   d_tmpnam_r=undef
17240                 tmpnam_r_proto=0
17241                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17242         * )     case "$tmpnam_r_proto" in
17243                 REENTRANT_PROTO*) ;;
17244                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17245                 esac
17246                 echo "Prototype: $try" ;;
17247         esac
17248         ;;
17249         *)      case "$usethreads" in
17250                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17251                 esac
17252                 d_tmpnam_r=undef
17253                 tmpnam_r_proto=0
17254                 ;;
17255         esac
17256         ;;
17257 *)      tmpnam_r_proto=0
17258         ;;
17259 esac
17260
17261 : see if truncate exists
17262 set truncate d_truncate
17263 eval $inlibc
17264
17265 : see if ttyname_r exists
17266 set ttyname_r d_ttyname_r
17267 eval $inlibc
17268 case "$d_ttyname_r" in
17269 "$define")
17270         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17271         case "$d_ttyname_r_proto:$usethreads" in
17272         ":define")      d_ttyname_r_proto=define
17273                 set d_ttyname_r_proto ttyname_r $hdrs
17274                 eval $hasproto ;;
17275         *)      ;;
17276         esac
17277         case "$d_ttyname_r_proto" in
17278         define)
17279         case "$ttyname_r_proto" in
17280         ''|0) try='int ttyname_r(int, char*, size_t);'
17281         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17282         esac
17283         case "$ttyname_r_proto" in
17284         ''|0) try='int ttyname_r(int, char*, int);'
17285         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17286         esac
17287         case "$ttyname_r_proto" in
17288         ''|0) try='char* ttyname_r(int, char*, int);'
17289         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17290         esac
17291         case "$ttyname_r_proto" in
17292         ''|0)   d_ttyname_r=undef
17293                 ttyname_r_proto=0
17294                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17295         * )     case "$ttyname_r_proto" in
17296                 REENTRANT_PROTO*) ;;
17297                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17298                 esac
17299                 echo "Prototype: $try" ;;
17300         esac
17301         ;;
17302         *)      case "$usethreads" in
17303                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17304                 esac
17305                 d_ttyname_r=undef
17306                 ttyname_r_proto=0
17307                 ;;
17308         esac
17309         ;;
17310 *)      ttyname_r_proto=0
17311         ;;
17312 esac
17313
17314 : see if tzname[] exists
17315 echo " "
17316 if set tzname val -a d_tzname; eval $csym; $val; then
17317         val="$define"
17318         echo 'tzname[] found.' >&4
17319 else
17320         val="$undef"
17321         echo 'tzname[] NOT found.' >&4
17322 fi
17323 set d_tzname
17324 eval $setvar
17325
17326 case "$osname" in
17327 next|rhapsody|darwin) multiarch="$define" ;;
17328 esac
17329 case "$multiarch" in
17330 ''|[nN]*) multiarch="$undef" ;;
17331 esac
17332
17333 : check for ordering of bytes in a UV
17334 echo " "
17335 case "$usecrosscompile$multiarch" in
17336 *$define*)
17337         $cat <<EOM
17338 You seem to be either cross-compiling or doing a multiarchitecture build,
17339 skipping the byteorder check.
17340
17341 EOM
17342         byteorder='ffff'
17343         ;;
17344 *)
17345         case "$byteorder" in
17346         '')
17347                 $cat <<'EOM'
17348 In the following, larger digits indicate more significance.  A big-endian
17349 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17350 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17351 machines may have weird orders like 3412.  A Cray will report 87654321,
17352 an Alpha will report 12345678. If the test program works the default is
17353 probably right.
17354 I'm now running the test program...
17355 EOM
17356                 $cat >try.c <<EOCP
17357 #include <stdio.h>
17358 #$i_stdlib I_STDLIB
17359 #ifdef I_STDLIB
17360 #include <stdlib.h>
17361 #endif
17362 #include <sys/types.h>
17363 typedef $uvtype UV;
17364 int main()
17365 {
17366         int i;
17367         union {
17368                 UV l;
17369                 char c[$uvsize];
17370         } u;
17371
17372         if ($uvsize > 4)
17373                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17374         else
17375                 u.l = (UV)0x04030201;
17376         for (i = 0; i < $uvsize; i++)
17377                 printf("%c", u.c[i]+'0');
17378         printf("\n");
17379         exit(0);
17380 }
17381 EOCP
17382                 xxx_prompt=y
17383                 set try
17384                 if eval $compile && ./try > /dev/null; then
17385                         dflt=`$run ./try`
17386                         case "$dflt" in
17387                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17388                                 echo "(The test program ran ok.)"
17389                                 echo "byteorder=$dflt"
17390                                 xxx_prompt=n
17391                         ;;
17392                         ????|????????) echo "(The test program ran ok.)" ;;
17393                         *) echo "(The test program didn't run right for some reason.)" ;;
17394                         esac
17395                 else
17396                         dflt='4321'
17397                         cat <<'EOM'
17398 (I can't seem to compile the test program.  Guessing big-endian...)
17399 EOM
17400                 fi
17401                 case "$xxx_prompt" in
17402                 y)
17403                         rp="What is the order of bytes in $uvtype?"
17404                         . ./myread
17405                         byteorder="$ans"
17406                         ;;
17407                 *)      byteorder=$dflt
17408                         ;;
17409                 esac
17410                 ;;
17411         esac
17412         $rm -f try.c try
17413         ;;
17414 esac
17415
17416
17417 $cat <<EOM
17418
17419 Checking to see whether you can access character data unalignedly...
17420 EOM
17421 case "$d_u32align" in
17422 '')   $cat >try.c <<EOCP
17423 #include <stdio.h>
17424 #$i_stdlib I_STDLIB
17425 #ifdef I_STDLIB
17426 #include <stdlib.h>
17427 #endif
17428 #define U32 $u32type
17429 #define BYTEORDER 0x$byteorder
17430 #define U8 $u8type
17431 #include <signal.h>
17432 #ifdef SIGBUS
17433 $signal_t bletch(s) int s; { exit(4); }
17434 #endif
17435 int main() {
17436 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17437     U8 buf[8];
17438     U32 *up;
17439     int i;
17440
17441     if (sizeof(U32) != 4) {
17442         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17443         exit(1);
17444     }
17445
17446     fflush(stdout);
17447
17448 #ifdef SIGBUS
17449     signal(SIGBUS, bletch);
17450 #endif
17451
17452     buf[0] = 0;
17453     buf[1] = 0;
17454     buf[2] = 0;
17455     buf[3] = 1;
17456     buf[4] = 0;
17457     buf[5] = 0;
17458     buf[6] = 0;
17459     buf[7] = 1;
17460
17461     for (i = 0; i < 4; i++) {
17462         up = (U32*)(buf + i);
17463         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17464                (*up == 1 << (8*(3-i)))  /* little-endian */
17465               )
17466            )
17467         {
17468             printf("read failed (%x)\n", *up);
17469             exit(2);
17470         }
17471     }
17472
17473     /* write test */
17474     for (i = 0; i < 4; i++) {
17475         up = (U32*)(buf + i);
17476         *up = 0xBeef;
17477         if (*up != 0xBeef) {
17478             printf("write failed (%x)\n", *up);
17479             exit(3);
17480         }
17481     }
17482
17483     exit(0);
17484 #else
17485     printf("1\n");
17486     exit(1);
17487 #endif
17488     return 0;
17489 }
17490 EOCP
17491 set try
17492 if eval $compile_ok; then
17493         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17494         $run ./try 2>&1 >/dev/null
17495         case "$?" in
17496         0)      cat >&4 <<EOM
17497 You can access character data pretty unalignedly.
17498 EOM
17499                 d_u32align="$undef"
17500                 ;;
17501         *)      cat >&4 <<EOM
17502 It seems that you must access character data in an aligned manner.
17503 EOM
17504                 d_u32align="$define"
17505                 ;;
17506         esac
17507 else
17508         rp='Can you access character data at unaligned addresses?'
17509         dflt='n'
17510         . ./myread
17511         case "$ans" in
17512         [yY]*)  d_u32align="$undef"  ;;
17513         *)      d_u32align="$define" ;;
17514         esac
17515 fi
17516 $rm -f core core.try.* try.core
17517 ;;
17518 esac
17519
17520 : see if ualarm exists
17521 set ualarm d_ualarm
17522 eval $inlibc
17523
17524 : see if umask exists
17525 set umask d_umask
17526 eval $inlibc
17527
17528 : see if unordered exists
17529 set unordered d_unordered
17530 eval $inlibc
17531
17532 : see if unsetenv exists
17533 set unsetenv d_unsetenv
17534 eval $inlibc
17535
17536 : see if usleep exists
17537 set usleep d_usleep
17538 eval $inlibc
17539
17540 : see if prototype for usleep is available
17541 echo " "
17542 set d_usleepproto usleep $i_unistd unistd.h
17543 eval $hasproto
17544
17545 : see if ustat exists
17546 set ustat d_ustat
17547 eval $inlibc
17548
17549 : backward compatibility for d_hvfork
17550 if test X$d_hvfork != X; then
17551         d_vfork="$d_hvfork"
17552         d_hvfork=''
17553 fi
17554 : see if there is a vfork
17555 val=''
17556 set vfork val
17557 eval $inlibc
17558
17559 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17560 : perl on Solaris 2.x, and probably elsewhere.
17561 case "$val" in
17562 $define)
17563         echo " "
17564         case "$usevfork" in
17565         false) dflt='n';;
17566         *) dflt='y';;
17567         esac
17568         cat <<'EOM'
17569  
17570 Perl can only use a vfork() that doesn't suffer from strict
17571 restrictions on calling functions or modifying global data in
17572 the child.  For example, glibc-2.1 contains such a vfork()
17573 that is unsuitable.  If your system provides a proper fork()
17574 call, chances are that you do NOT want perl to use vfork().
17575
17576 EOM
17577         rp="Do you still want to use vfork()?"
17578         . ./myread
17579         case "$ans" in
17580         y|Y) ;;
17581         *)
17582                 echo "Ok, we won't use vfork()."
17583                 val="$undef"
17584                 ;;
17585         esac
17586         ;;
17587 esac
17588 set d_vfork
17589 eval $setvar
17590 case "$d_vfork" in
17591 $define) usevfork='true';;
17592 *) usevfork='false';;
17593 esac
17594
17595 : see if closedir exists
17596 set closedir d_closedir
17597 eval $inlibc
17598
17599 case "$d_closedir" in
17600 "$define")
17601         echo " "
17602         echo "Checking whether closedir() returns a status..." >&4
17603         cat > try.c <<EOM
17604 #$i_dirent I_DIRENT             /**/
17605 #$i_sysdir I_SYS_DIR            /**/
17606 #$i_sysndir I_SYS_NDIR          /**/
17607 #$i_systypes I_SYS_TYPES        /**/
17608
17609 #if defined(I_SYS_TYPES)
17610 #include <sys/types.h>
17611 #endif
17612 #if defined(I_DIRENT)
17613 #include <dirent.h>
17614 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17615 #include <sys/dir.h>
17616 #endif
17617 #else
17618 #ifdef I_SYS_NDIR
17619 #include <sys/ndir.h>
17620 #else
17621 #ifdef I_SYS_DIR
17622 #ifdef hp9000s500
17623 #include <ndir.h>       /* may be wrong in the future */
17624 #else
17625 #include <sys/dir.h>
17626 #endif
17627 #endif
17628 #endif
17629 #endif 
17630 int main() { return closedir(opendir(".")); }
17631 EOM
17632         set try
17633         if eval $compile_ok; then
17634                 if $run ./try > /dev/null 2>&1 ; then
17635                         echo "Yes, it does."
17636                         val="$undef"
17637                 else
17638                         echo "No, it doesn't."
17639                         val="$define"
17640                 fi
17641         else
17642                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17643                 val="$define"
17644         fi
17645         ;;
17646 *)
17647         val="$undef";
17648         ;;
17649 esac
17650 set d_void_closedir
17651 eval $setvar
17652 $rm -f try try.*
17653 : see if there is a wait4
17654 set wait4 d_wait4
17655 eval $inlibc
17656
17657 : see if waitpid exists
17658 set waitpid d_waitpid
17659 eval $inlibc
17660
17661 : see if wcstombs exists
17662 set wcstombs d_wcstombs
17663 eval $inlibc
17664
17665 : see if wctomb exists
17666 set wctomb d_wctomb
17667 eval $inlibc
17668
17669 : see if writev exists
17670 set writev d_writev
17671 eval $inlibc
17672
17673 : preserve RCS keywords in files with variable substitution, grrr
17674 Date='$Date'
17675 Id='$Id'
17676 Log='$Log'
17677 RCSfile='$RCSfile'
17678 Revision='$Revision'
17679
17680 : check for alignment requirements
17681 echo " "
17682 case "$usecrosscompile$multiarch" in
17683 *$define*)
17684         $cat <<EOM
17685 You seem to be either cross-compiling or doing a multiarchitecture build,
17686 skipping the memory alignment check.
17687
17688 EOM
17689         case "$alignbytes" in
17690         '') alignbytes=8 ;;
17691         esac
17692         ;;
17693 *)
17694         case "$alignbytes" in
17695         '') echo "Checking alignment constraints..." >&4
17696                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17697                         $cat >try.c <<'EOCP'
17698 typedef long double NV;
17699 EOCP
17700                 else
17701                         $cat >try.c <<'EOCP'
17702 typedef double NV;
17703 EOCP
17704                 fi
17705                 $cat >>try.c <<'EOCP'
17706 #include <stdio.h>
17707 struct foobar {
17708         char foo;
17709         NV bar;
17710 } try_algn;
17711 int main()
17712 {
17713     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17714     return(0);
17715 }
17716 EOCP
17717                 set try
17718                 if eval $compile_ok; then
17719                         dflt=`$run ./try`
17720                 else
17721                         dflt='8'
17722                         echo "(I can't seem to compile the test program...)"
17723                 fi
17724                 ;;
17725         *) dflt="$alignbytes"
17726                 ;;
17727         esac
17728         rp="Doubles must be aligned on a how-many-byte boundary?"
17729         . ./myread
17730         alignbytes="$ans"
17731         $rm -f try.c try
17732         ;;
17733 esac
17734
17735
17736 : set the base revision
17737 baserev=5.0
17738
17739 : how do we concatenate cpp tokens here?
17740 echo " "
17741 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17742 $cat >cpp_stuff.c <<'EOCP'
17743 #define RCAT(a,b)a/**/b
17744 #define ACAT(a,b)a ## b
17745 RCAT(Rei,ser)
17746 ACAT(Cir,cus)
17747 EOCP
17748 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17749 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17750         echo "Oh!  Smells like ANSI's been here." >&4
17751         echo "We can catify or stringify, separately or together!"
17752         cpp_stuff=42
17753 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17754         echo "Ah, yes!  The good old days!" >&4
17755         echo "However, in the good old days we don't know how to stringify and"
17756         echo "catify at the same time."
17757         cpp_stuff=1
17758 else
17759         $cat >&4 <<EOM
17760 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17761 You're going to have to edit the values of CAT[2-5] in config.h...
17762 EOM
17763         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17764 fi
17765 $rm -f cpp_stuff.*
17766
17767 : see if this is a db.h system
17768 set db.h i_db
17769 eval $inhdr
17770
17771 case "$i_db" in
17772 $define)
17773         : Check db version.
17774         echo " "
17775         echo "Checking Berkeley DB version ..." >&4
17776         $cat >try.c <<EOCP
17777 #$d_const HASCONST
17778 #ifndef HASCONST
17779 #define const
17780 #endif
17781 #include <sys/types.h>
17782 #include <stdio.h>
17783 #$i_stdlib I_STDLIB
17784 #ifdef I_STDLIB
17785 #include <stdlib.h>
17786 #endif
17787 #include <db.h>
17788 int main(int argc, char *argv[])
17789 {
17790 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17791     int Major, Minor, Patch ;
17792     unsigned long Version ;
17793     (void)db_version(&Major, &Minor, &Patch) ;
17794     if (argc == 2) {
17795         printf("%d %d %d %d %d %d\n",
17796                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17797                Major, Minor, Patch);
17798         exit(0);
17799     }
17800     printf("You have Berkeley DB Version 2 or greater.\n");
17801
17802     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17803                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17804     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17805                 Major, Minor, Patch) ;
17806
17807     /* check that db.h & libdb are compatible */
17808     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17809         printf("db.h and libdb are incompatible.\n") ;
17810         exit(3);        
17811     }
17812
17813     printf("db.h and libdb are compatible.\n") ;
17814
17815     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17816                 + DB_VERSION_PATCH ;
17817
17818     /* needs to be >= 2.3.4 */
17819     if (Version < 2003004) {
17820     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17821         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17822         exit(2);        
17823     }
17824
17825     exit(0);
17826 #else
17827 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17828     if (argc == 2) {
17829         printf("1 0 0\n");
17830         exit(0);
17831     }
17832     printf("You have Berkeley DB Version 1.\n");
17833     exit(0);    /* DB version < 2: the coast is clear. */
17834 #else
17835     exit(1);    /* <db.h> not Berkeley DB? */
17836 #endif
17837 #endif
17838 }
17839 EOCP
17840         set try
17841         if eval $compile_ok && $run ./try; then
17842                 echo 'Looks OK.' >&4
17843                 set `$run ./try 1`
17844                 db_version_major=$1
17845                 db_version_minor=$2
17846                 db_version_patch=$3
17847         else
17848                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17849                 i_db=$undef
17850                 case " $libs " in
17851                 *"-ldb "*)
17852                         : Remove db from list of libraries to use
17853                         echo "Removing unusable -ldb from library list" >&4
17854                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17855                         shift
17856                         libs="$*"
17857                         echo "libs = $libs" >&4
17858                         ;;
17859                 esac
17860         fi
17861         $rm -f try.*
17862         ;;
17863 esac
17864
17865 case "$i_db" in
17866 define)
17867         : Check the return type needed for hash 
17868         echo " "
17869         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17870         $cat >try.c <<EOCP
17871 #$d_const HASCONST
17872 #ifndef HASCONST
17873 #define const
17874 #endif
17875 #include <sys/types.h>
17876 #include <db.h>
17877
17878 #ifndef DB_VERSION_MAJOR
17879 u_int32_t hash_cb (ptr, size)
17880 const void *ptr;
17881 size_t size;
17882 {
17883 }
17884 HASHINFO info;
17885 int main()
17886 {
17887         info.hash = hash_cb;
17888 }
17889 #endif
17890 EOCP
17891         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17892                 if $contains warning try.out >>/dev/null 2>&1 ; then
17893                         db_hashtype='int'
17894                 else
17895                         db_hashtype='u_int32_t'
17896                 fi
17897         else
17898                 : XXX Maybe we should just give up here.
17899                 db_hashtype=u_int32_t
17900                 $cat try.out >&4
17901                 echo "Help:  I can't seem to compile the db test program." >&4
17902                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17903         fi
17904         $rm -f try.*
17905         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17906         ;;
17907 *)      db_hashtype=u_int32_t
17908         ;;
17909 esac
17910 case "$i_db" in
17911 define)
17912         : Check the return type needed for prefix 
17913         echo " "
17914         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17915         cat >try.c <<EOCP
17916 #$d_const HASCONST
17917 #ifndef HASCONST
17918 #define const
17919 #endif
17920 #include <sys/types.h>
17921 #include <db.h>
17922
17923 #ifndef DB_VERSION_MAJOR
17924 size_t prefix_cb (key1, key2)
17925 const DBT *key1;
17926 const DBT *key2;
17927 {
17928 }
17929 BTREEINFO info;
17930 int main()
17931 {
17932         info.prefix = prefix_cb;
17933 }
17934 #endif
17935 EOCP
17936         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17937                 if $contains warning try.out >>/dev/null 2>&1 ; then
17938                         db_prefixtype='int'
17939                 else
17940                         db_prefixtype='size_t'
17941                 fi
17942         else
17943                 db_prefixtype='size_t'
17944                 : XXX Maybe we should just give up here.
17945                 $cat try.out >&4
17946                 echo "Help:  I can't seem to compile the db test program." >&4
17947                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17948         fi
17949         $rm -f try.*
17950         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17951         ;;
17952 *)      db_prefixtype='size_t'
17953         ;;
17954 esac
17955
17956
17957 : How can we generate normalized random numbers ?
17958 echo " "
17959 echo "Looking for a random number function..." >&4
17960 case "$randfunc" in
17961 '')
17962         if set drand48 val -f; eval $csym; $val; then
17963                 dflt="drand48"
17964                 echo "Good, found drand48()." >&4
17965         elif set random val -f; eval $csym; $val; then
17966                 dflt="random"
17967                 echo "OK, found random()." >&4
17968         else
17969                 dflt="rand"
17970                 echo "Yick, looks like I have to use rand()." >&4
17971         fi
17972         echo " "
17973         ;;
17974 *)
17975         dflt="$randfunc"
17976         ;;
17977 esac
17978 cont=true
17979
17980 case "$ccflags" in
17981 *-Dmy_rand=*|*-Dmy_srand=*)
17982         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17983         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17984         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17985         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17986         ;;
17987 esac
17988
17989 while $test "$cont"; do
17990         rp="Use which function to generate random numbers?"
17991         . ./myread
17992         if $test "$ans" = "$dflt"; then
17993                 : null
17994         else
17995                 randbits=''
17996         fi
17997         randfunc="$ans"
17998         if set $ans val -f; eval $csym; $val; then
17999                 cont=''
18000         else
18001                 dflt=y
18002                 rp="I cannot find function $ans. Use that name anyway?"
18003                 . ./myread
18004                 dflt=rand
18005                 case "$ans" in
18006                         [yY]*) cont='';;
18007                 esac
18008         fi
18009         case "$cont" in
18010         '')
18011                 case "$randfunc" in
18012                 drand48)
18013                         drand01="drand48()"
18014                         seedfunc="srand48"
18015                         randbits=48
18016                         randseedtype=long
18017                         ;;
18018                 rand|random)
18019                         case "$randbits" in
18020                         '')
18021 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18022                                 $cat >try.c <<EOCP
18023 #$i_unistd I_UNISTD
18024 #$i_stdlib I_STDLIB
18025 #include <stdio.h>
18026 #ifdef I_UNISTD
18027 #  include <unistd.h>
18028 #endif
18029 #ifdef I_STDLIB
18030 #  include <stdlib.h>
18031 #endif
18032 int main()
18033 {
18034         register int i;
18035         register unsigned long tmp;
18036         register unsigned long max = 0L;
18037
18038         for (i = 1000; i; i--) {
18039                 tmp = (unsigned long) $randfunc();
18040                 if (tmp > max) max = tmp;
18041         }
18042         for (i = 0; max; i++)
18043                 max /= 2;
18044         printf("%d\n",i);
18045 }
18046 EOCP
18047                                 set try
18048                                 if eval $compile_ok; then
18049                                         dflt=`try`
18050                                 else
18051                                         dflt='?'
18052                                         echo "(I can't seem to compile the test program...)"
18053                                 fi
18054                                 ;;
18055                         *)
18056                                 dflt="$randbits"
18057                                 ;;
18058                         esac
18059                         rp="How many bits does your $randfunc() function produce?"
18060                         . ./myread
18061                         randbits="$ans"
18062                         $rm -f try.c try
18063                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18064                         seedfunc="s$randfunc"
18065                         randseedtype=unsigned
18066                         ;;
18067                 *)
18068                         dflt="31"
18069                         rp="How many bits does your $randfunc() function produce?"
18070                         . ./myread
18071                         randbits="$ans"
18072                         seedfunc="s$randfunc"
18073                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18074                         if set $seedfunc val -f; eval $csym; $val; then
18075                                 echo "(Using $seedfunc() to seed random generator)"
18076                         else
18077                                 echo "(Warning: no $seedfunc() to seed random generator)"
18078                                 seedfunc=rand
18079                         fi
18080                         randseedtype=unsigned
18081                         ;;
18082                 esac
18083                 ;;
18084         esac
18085 done
18086
18087 echo " "
18088 echo "Determining whether or not we are on an EBCDIC system..." >&4
18089 $cat >try.c <<'EOM'
18090 int main()
18091 {
18092   if ('M'==0xd4) return 0;
18093   return 1;
18094 }
18095 EOM
18096
18097 val=$undef
18098 set try
18099 if eval $compile_ok; then
18100         if $run ./try; then
18101                 echo "You seem to speak EBCDIC." >&4
18102                 val="$define"
18103         else
18104                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18105         fi
18106 else
18107         echo "I'm unable to compile the test program." >&4
18108         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18109 fi
18110 $rm -f try try.*
18111 set ebcdic
18112 eval $setvar
18113
18114 echo " "
18115 $cat >&4 <<EOM
18116 Checking how to flush all pending stdio output...
18117 EOM
18118 # I only know how to find the first 32 possibly open files on SunOS.
18119 # See also hints/sunos_4_1.sh and util.c  --AD
18120 case "$osname" in
18121 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18122 esac
18123 $cat >>try.c <<EOCP
18124 #include <stdio.h>
18125 #$i_stdlib I_STDLIB
18126 #ifdef I_STDLIB
18127 #include <stdlib.h>
18128 #endif
18129 #$i_unistd I_UNISTD
18130 #ifdef I_UNISTD
18131 # include <unistd.h>
18132 #endif
18133 #$d_sysconf HAS_SYSCONF
18134 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18135 #ifdef HAS_STDIO_STREAM_ARRAY
18136 # define STDIO_STREAM_ARRAY $stdio_stream_array
18137 #endif
18138 int main() {
18139   FILE* p;
18140   unlink("try.out");
18141   p = fopen("try.out", "w");
18142 #ifdef TRY_FPUTC
18143   fputc('x', p);
18144 #else
18145 # ifdef TRY_FPRINTF
18146   fprintf(p, "x");
18147 # endif
18148 #endif
18149 #ifdef TRY_FFLUSH_NULL
18150   fflush(NULL);
18151 #endif
18152 #ifdef TRY_FFLUSH_ALL
18153   {
18154     long open_max = -1;
18155 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18156     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18157 # else
18158 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18159     open_max = sysconf(_SC_OPEN_MAX);
18160 #  else
18161 #   ifdef FOPEN_MAX
18162     open_max = FOPEN_MAX;
18163 #   else
18164 #    ifdef OPEN_MAX
18165     open_max = OPEN_MAX;
18166 #    else
18167 #     ifdef _NFILE
18168     open_max = _NFILE;
18169 #     endif
18170 #    endif
18171 #   endif
18172 #  endif
18173 # endif 
18174 # ifdef HAS_STDIO_STREAM_ARRAY
18175     if (open_max > 0) {
18176       long i;
18177       for (i = 0; i < open_max; i++)
18178             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18179                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18180                 STDIO_STREAM_ARRAY[i]._flag)
18181                 fflush(&STDIO_STREAM_ARRAY[i]);
18182     }   
18183   }
18184 # endif
18185 #endif
18186   _exit(42);
18187 }
18188 EOCP
18189 : first we have to find out how _not_ to flush
18190 $to try.c
18191 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18192     output=''
18193     set try -DTRY_FPUTC
18194     if eval $compile; then
18195             $run ./try 2>/dev/null
18196             code="$?"
18197             $from try.out
18198             if $test ! -s try.out -a "X$code" = X42; then
18199                 output=-DTRY_FPUTC
18200             fi
18201     fi
18202     case "$output" in
18203     '')
18204             set try -DTRY_FPRINTF
18205             if eval $compile; then
18206                     $run ./try 2>/dev/null
18207                     code="$?"
18208                     $from try.out
18209                     if $test ! -s try.out -a "X$code" = X42; then
18210                         output=-DTRY_FPRINTF
18211                     fi
18212             fi
18213         ;;
18214     esac
18215 fi
18216 : check for fflush NULL behaviour
18217 case "$fflushNULL" in
18218 '')     set try -DTRY_FFLUSH_NULL $output
18219         if eval $compile; then
18220                 $run ./try 2>/dev/null
18221                 code="$?"
18222                 $from try.out
18223                 if $test -s try.out -a "X$code" = X42; then
18224                         fflushNULL="`$cat try.out`"
18225                 else
18226                         if $test "X$code" != X42; then
18227                                 $cat >&4 <<EOM
18228 (If this test failed, don't worry, we'll try another method shortly.)
18229 EOM
18230                         fi
18231                 fi
18232         fi
18233         $rm -f core try.core core.try.*
18234         case "$fflushNULL" in
18235         x)      $cat >&4 <<EOM
18236 Your fflush(NULL) works okay for output streams.
18237 Let's see if it clobbers input pipes...
18238 EOM
18239 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18240 # bug that improperly flushes the input end of pipes.  So we avoid the
18241 # autoflush on fork/system/exec support for now. :-(
18242 $cat >tryp.c <<EOCP
18243 #include <stdio.h>
18244 int
18245 main(int argc, char **argv)
18246 {
18247     char buf[1024];
18248     int i;
18249     char *bp = buf;
18250     while (1) {
18251         while ((i = getc(stdin)) != -1
18252                && (*bp++ = i) != '\n'
18253                && bp < &buf[1024])
18254         /* DO NOTHING */ ;
18255         *bp = '\0';
18256         fprintf(stdout, "%s", buf);
18257         fflush(NULL);
18258         if (i == -1)
18259             return 0;
18260         bp = buf;
18261     }
18262 }
18263 EOCP
18264                 fflushNULL="$define"
18265                 set tryp
18266                 if eval $compile; then
18267                     $rm -f tryp.out
18268                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18269                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18270                        $cat >&4 <<EOM
18271 fflush(NULL) seems to behave okay with input streams.
18272 EOM
18273                         fflushNULL="$define"
18274                     else
18275                         $cat >&4 <<EOM
18276 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18277 EOM
18278                         fflushNULL="$undef"
18279                     fi
18280                 fi
18281                 $rm -f core tryp.c tryp.core core.tryp.*
18282                 ;;
18283         '')     $cat >&4 <<EOM
18284 Your fflush(NULL) isn't working (contrary to ANSI C).
18285 EOM
18286                 fflushNULL="$undef"
18287                 ;;
18288         *)      $cat >&4 <<EOM
18289 Cannot figure out whether your fflush(NULL) works or not.
18290 I'm assuming it doesn't (contrary to ANSI C).
18291 EOM
18292                 fflushNULL="$undef"
18293                 ;;
18294         esac
18295         ;;
18296 $define|true|[yY]*)
18297         fflushNULL="$define"
18298         ;;
18299 *)
18300         fflushNULL="$undef"
18301         ;;
18302 esac
18303 : check explicit looping only if NULL did not work, and if the pipe
18304 : bug does not show up on an explicit flush too
18305 case "$fflushNULL" in
18306 "$undef")
18307         $cat >tryp.c <<EOCP
18308 #include <stdio.h>
18309 int
18310 main(int argc, char **argv)
18311 {
18312     char buf[1024];
18313     int i;
18314     char *bp = buf;
18315     while (1) {
18316         while ((i = getc(stdin)) != -1
18317                && (*bp++ = i) != '\n'
18318                && bp < &buf[1024])
18319         /* DO NOTHING */ ;
18320         *bp = '\0';
18321         fprintf(stdout, "%s", buf);
18322         fflush(stdin);
18323         if (i == -1)
18324             return 0;
18325         bp = buf;
18326     }
18327 }
18328 EOCP
18329         set tryp
18330         if eval $compile; then
18331             $rm -f tryp.out
18332             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18333             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18334                $cat >&4 <<EOM
18335 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18336 EOM
18337                 : now check for fflushall behaviour
18338                 case "$fflushall" in
18339                 '')     set try -DTRY_FFLUSH_ALL $output
18340                         if eval $compile; then
18341                                 $cat >&4 <<EOM
18342 (Now testing the other method--but note that this also may fail.)
18343 EOM
18344                                 $run ./try 2>/dev/null
18345                                 code=$?
18346                                 $from try.out
18347                                 if $test -s try.out -a "X$code" = X42; then
18348                                         fflushall="`$cat try.out`"
18349                                 fi
18350                         fi
18351                         $rm -f core try.core core.try.*
18352                         case "$fflushall" in
18353                         x)      $cat >&4 <<EOM
18354 Whew. Flushing explicitly all the stdio streams works.
18355 EOM
18356                                 fflushall="$define"
18357                                 ;;
18358                         '')     $cat >&4 <<EOM
18359 Sigh. Flushing explicitly all the stdio streams doesn't work.
18360 EOM
18361                                 fflushall="$undef"
18362                                 ;;
18363                         *)      $cat >&4 <<EOM
18364 Cannot figure out whether flushing stdio streams explicitly works or not.
18365 I'm assuming it doesn't.
18366 EOM
18367                                 fflushall="$undef"
18368                                 ;;
18369                         esac
18370                         ;;
18371                 "$define"|true|[yY]*)
18372                         fflushall="$define"
18373                         ;;
18374                 *)
18375                         fflushall="$undef"
18376                         ;;
18377                 esac
18378             else
18379                 $cat >&4 <<EOM
18380 All is futile.  Even fflush(stdin) clobbers input pipes!
18381 EOM
18382                 fflushall="$undef"
18383             fi
18384         else
18385             fflushall="$undef"
18386         fi
18387         $rm -f core tryp.c tryp.core core.tryp.*
18388         ;;
18389 *)      fflushall="$undef"
18390         ;;
18391 esac
18392
18393 case "$fflushNULL$fflushall" in
18394 undefundef)
18395         $cat <<EOM
18396 OK, I give up.  I cannot figure out how to flush pending stdio output.
18397 We won't be flushing handles at all before fork/exec/popen.
18398 EOM
18399         ;;
18400 esac
18401 $rm -f try.* try$exe_ext
18402
18403 : Store the full pathname to the ar program for use in the C program
18404 : Respect a hint or command line value for full_ar.
18405 case "$full_ar" in
18406 '') full_ar=$ar ;;
18407 esac
18408
18409 : Store the full pathname to the sed program for use in the C program
18410 full_sed=$sed
18411
18412 : see what type gids are declared as in the kernel
18413 echo " "
18414 echo "Looking for the type for group ids returned by getgid()."
18415 set gid_t gidtype xxx stdio.h sys/types.h
18416 eval $typedef
18417 case "$gidtype" in
18418 xxx)
18419         xxx=`./findhdr sys/user.h`
18420         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18421         case $1 in
18422         unsigned) dflt="$1 $2" ;;
18423         *) dflt="$1" ;;
18424         esac
18425         ;;
18426 *) dflt="$gidtype";;
18427 esac
18428 case "$gidtype" in
18429 gid_t) echo "gid_t found." ;;
18430 *)      rp="What is the type for group ids returned by getgid()?"
18431         . ./myread
18432         gidtype="$ans"
18433         ;;
18434 esac
18435
18436 echo " "
18437 case "$gidtype" in
18438 *_t) zzz="$gidtype"     ;;
18439 *)   zzz="gid"          ;;
18440 esac
18441 echo "Checking the size of $zzz..." >&4 
18442 cat > try.c <<EOCP
18443 #include <sys/types.h>
18444 #include <stdio.h>
18445 #$i_stdlib I_STDLIB
18446 #ifdef I_STDLIB
18447 #include <stdlib.h>
18448 #endif
18449 int main() {
18450     printf("%d\n", (int)sizeof($gidtype));
18451     exit(0);
18452 }
18453 EOCP
18454 set try
18455 if eval $compile_ok; then
18456         yyy=`$run ./try`
18457         case "$yyy" in
18458         '')     gidsize=4
18459                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18460                 ;;
18461         *)      gidsize=$yyy
18462                 echo "Your $zzz is $gidsize bytes long."
18463                 ;;
18464         esac
18465 else
18466         gidsize=4
18467         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18468 fi
18469
18470
18471 echo " "
18472 case "$gidtype" in
18473 *_t) zzz="$gidtype"     ;;
18474 *)   zzz="gid"          ;;
18475 esac
18476 echo "Checking the sign of $zzz..." >&4 
18477 cat > try.c <<EOCP
18478 #include <sys/types.h>
18479 #include <stdio.h>
18480 int main() {
18481         $gidtype foo = -1;
18482         if (foo < 0)
18483                 printf("-1\n");
18484         else
18485                 printf("1\n");
18486 }
18487 EOCP
18488 set try
18489 if eval $compile; then
18490         yyy=`$run ./try`
18491         case "$yyy" in
18492         '')     gidsign=1
18493                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18494                 ;;
18495         *)      gidsign=$yyy
18496                 case "$gidsign" in
18497                  1) echo "Your $zzz is unsigned." ;;
18498                 -1) echo "Your $zzz is signed."   ;;
18499                 esac
18500                 ;;
18501         esac
18502 else
18503         gidsign=1
18504         echo "(I can't compile the test program--guessing unsigned.)" >&4
18505 fi
18506
18507
18508 echo " "
18509
18510 if $test X"$quadtype" != X; then
18511
18512 echo "Checking how to print 64-bit integers..." >&4
18513
18514 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18515         $cat >try.c <<'EOCP'
18516 #include <sys/types.h>
18517 #include <stdio.h>
18518 int main() {
18519   int q = 12345678901;
18520   printf("%ld\n", q);
18521 }
18522 EOCP
18523         set try
18524         if eval $compile; then
18525                 yyy=`$run ./try`
18526                 case "$yyy" in
18527                 12345678901)
18528                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18529                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18530                         echo "We will use %d."
18531                         ;;
18532                 esac
18533         fi
18534 fi
18535
18536 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18537         $cat >try.c <<'EOCP'
18538 #include <sys/types.h>
18539 #include <stdio.h>
18540 int main() {
18541   long q = 12345678901;
18542   printf("%ld\n", q);
18543 }
18544 EOCP
18545         set try
18546         if eval $compile; then
18547                 yyy=`$run ./try`
18548                 case "$yyy" in
18549                 12345678901)
18550                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18551                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18552                         echo "We will use %ld."
18553                         ;;
18554                 esac
18555         fi
18556 fi
18557
18558 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18559         $cat >try.c <<'EOCP'
18560 #include <sys/types.h>
18561 #include <inttypes.h>
18562 #include <stdio.h>
18563 int main() {
18564   int64_t q = 12345678901;
18565   printf("%" PRId64 "\n", q);
18566 }
18567 EOCP
18568         set try
18569         if eval $compile; then
18570                 yyy=`$run ./try`
18571                 case "$yyy" in
18572                 12345678901)
18573                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18574                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18575                         echo "We will use the C9X style."
18576                         ;;
18577                 esac
18578         fi
18579 fi
18580
18581 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18582         $cat >try.c <<EOCP
18583 #include <sys/types.h>
18584 #include <stdio.h>
18585 int main() {
18586   $quadtype q = 12345678901;
18587   printf("%Ld\n", q);
18588 }
18589 EOCP
18590         set try
18591         if eval $compile; then
18592                 yyy=`$run ./try`
18593                 case "$yyy" in
18594                 12345678901)
18595                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18596                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18597                         echo "We will use %Ld."
18598                         ;;
18599                 esac
18600         fi
18601 fi
18602
18603 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18604         $cat >try.c <<'EOCP'
18605 #include <sys/types.h>
18606 #include <stdio.h>
18607 int main() {
18608   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18609   printf("%lld\n", q);
18610 }
18611 EOCP
18612         set try
18613         if eval $compile; then
18614                 yyy=`$run ./try`
18615                 case "$yyy" in
18616                 12345678901)
18617                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18618                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18619                         echo "We will use the %lld style."
18620                         ;;
18621                 esac
18622         fi
18623 fi
18624
18625 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18626         $cat >try.c <<EOCP
18627 #include <sys/types.h>
18628 #include <stdio.h>
18629 int main() {
18630   $quadtype q = 12345678901;
18631   printf("%qd\n", q);
18632 }
18633 EOCP
18634         set try
18635         if eval $compile; then
18636                 yyy=`$run ./try`
18637                 case "$yyy" in
18638                 12345678901)
18639                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18640                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18641                         echo "We will use %qd."
18642                         ;;
18643                 esac
18644         fi
18645 fi
18646
18647 if $test X"$sPRId64" = X; then
18648         echo "Cannot figure out how to print 64-bit integers." >&4
18649 fi
18650
18651 $rm -f try try.*
18652
18653 fi
18654
18655 case "$sPRId64" in
18656 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18657         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18658         ;;
18659 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18660         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18661         ;;
18662 esac
18663
18664
18665 echo " "
18666 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18667
18668 if $test X"$ivsize" = X8; then
18669         ivdformat="$sPRId64"
18670         uvuformat="$sPRIu64"
18671         uvoformat="$sPRIo64"
18672         uvxformat="$sPRIx64"
18673         uvXUformat="$sPRIXU64"
18674 else
18675         if $test X"$ivsize" = X"$longsize"; then
18676                 ivdformat='"ld"'
18677                 uvuformat='"lu"'
18678                 uvoformat='"lo"'
18679                 uvxformat='"lx"'
18680                 uvXUformat='"lX"'
18681         else
18682                 if $test X"$ivsize" = X"$intsize"; then
18683                         ivdformat='"d"'
18684                         uvuformat='"u"'
18685                         uvoformat='"o"'
18686                         uvxformat='"x"'
18687                         uvXUformat='"X"'
18688                 else
18689                         : far out
18690                         if $test X"$ivsize" = X"$shortsize"; then
18691                                 ivdformat='"hd"'
18692                                 uvuformat='"hu"'
18693                                 uvoformat='"ho"'
18694                                 uvxformat='"hx"'
18695                                 uvXUformat='"hX"'
18696                         fi
18697                 fi
18698         fi
18699 fi
18700
18701 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18702         nveformat="$sPRIeldbl"
18703         nvfformat="$sPRIfldbl"
18704         nvgformat="$sPRIgldbl"
18705         nvEUformat="$sPRIEUldbl"
18706         nvFUformat="$sPRIFUldbl"
18707         nvGUformat="$sPRIGUldbl"
18708 else
18709         nveformat='"e"'
18710         nvfformat='"f"'
18711         nvgformat='"g"'
18712         nvEUformat='"E"'
18713         nvFUformat='"F"'
18714         nvGUformat='"G"'
18715 fi
18716
18717 case "$ivdformat" in
18718 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18719     exit 1
18720     ;;
18721 esac
18722
18723
18724 echo " "
18725 $echo "Checking the format string to be used for gids..." >&4
18726
18727 case "$gidsign" in
18728 -1)     if $test X"$gidsize" = X"$ivsize"; then
18729                 gidformat="$ivdformat"
18730         else
18731                 if $test X"$gidsize" = X"$longsize"; then
18732                         gidformat='"ld"'
18733                 else
18734                         if $test X"$gidsize" = X"$intsize"; then
18735                                 gidformat='"d"'
18736                         else
18737                                 if $test X"$gidsize" = X"$shortsize"; then
18738                                         gidformat='"hd"'
18739                                 fi
18740                         fi
18741                 fi
18742         fi
18743         ;;
18744 *)      if $test X"$gidsize" = X"$uvsize"; then
18745                 gidformat="$uvuformat"
18746         else
18747                 if $test X"$gidsize" = X"$longsize"; then
18748                         gidformat='"lu"'
18749                 else
18750                         if $test X"$gidsize" = X"$intsize"; then
18751                                 gidformat='"u"'
18752                         else
18753                                 if $test X"$gidsize" = X"$shortsize"; then
18754                                         gidformat='"hu"'
18755                                 fi
18756                         fi
18757                 fi
18758         fi
18759         ;;
18760 esac
18761
18762 : see if getgroups exists
18763 set getgroups d_getgrps
18764 eval $inlibc
18765
18766 : see if setgroups exists
18767 set setgroups d_setgrps
18768 eval $inlibc
18769
18770
18771 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18772 echo " "
18773 case "$d_getgrps$d_setgrps" in
18774 *define*)
18775         case "$groupstype" in
18776         '') dflt="$gidtype" ;;
18777         *)  dflt="$groupstype" ;;
18778         esac
18779         $cat <<EOM
18780 What type of pointer is the second argument to getgroups() and setgroups()?
18781 Usually this is the same as group ids, $gidtype, but not always.
18782
18783 EOM
18784         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18785         . ./myread
18786         groupstype="$ans"
18787         ;;
18788 *)  groupstype="$gidtype";;
18789 esac
18790
18791 echo " "
18792 echo "Checking if your $make program sets \$(MAKE)..." >&4
18793 case "$make_set_make" in
18794 '')
18795         $sed 's/^X //' > testmake.mak << 'EOF'
18796 Xall:
18797 X       @echo 'maketemp="$(MAKE)"'
18798 EOF
18799         case "`$make -f testmake.mak 2>/dev/null`" in
18800         *maketemp=*) make_set_make='#' ;;
18801         *)      make_set_make="MAKE=$make" ;;
18802         esac
18803         $rm -f testmake.mak
18804         ;;
18805 esac
18806 case "$make_set_make" in
18807 '#') echo "Yup, it does.";;
18808 *) echo "Nope, it doesn't.";;
18809 esac
18810
18811 : see what type is used for mode_t
18812 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18813 set mode_t modetype int stdio.h sys/types.h
18814 eval $typedef_ask
18815
18816 : see if stdarg is available
18817 echo " "
18818 if $test `./findhdr stdarg.h`; then
18819         echo "<stdarg.h> found." >&4
18820         valstd="$define"
18821 else
18822         echo "<stdarg.h> NOT found." >&4
18823         valstd="$undef"
18824 fi
18825
18826 : see if varags is available
18827 echo " "
18828 if $test `./findhdr varargs.h`; then
18829         echo "<varargs.h> found." >&4
18830 else
18831         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18832 fi
18833
18834 : set up the varargs testing programs
18835 $cat > varargs.c <<EOP
18836 #ifdef I_STDARG
18837 #include <stdarg.h>
18838 #endif
18839 #ifdef I_VARARGS
18840 #include <varargs.h>
18841 #endif
18842
18843 #ifdef I_STDARG
18844 int f(char *p, ...)
18845 #else
18846 int f(va_alist)
18847 va_dcl
18848 #endif
18849 {
18850         va_list ap;
18851 #ifndef I_STDARG
18852         char *p;
18853 #endif
18854 #ifdef I_STDARG
18855         va_start(ap,p);
18856 #else
18857         va_start(ap);
18858         p = va_arg(ap, char *);
18859 #endif
18860         va_end(ap);
18861 }
18862 EOP
18863 $cat > varargs <<EOP
18864 $startsh
18865 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18866         echo "true"
18867 else
18868         echo "false"
18869 fi
18870 $rm -f varargs$_o
18871 EOP
18872 chmod +x varargs
18873
18874 : now check which varargs header should be included
18875 echo " "
18876 i_varhdr=''
18877 case "$valstd" in
18878 "$define")
18879         if `./varargs I_STDARG`; then
18880                 val='stdarg.h'
18881         elif `./varargs I_VARARGS`; then
18882                 val='varargs.h'
18883         fi
18884         ;;
18885 *)
18886         if `./varargs I_VARARGS`; then
18887                 val='varargs.h'
18888         fi
18889         ;;
18890 esac
18891 case "$val" in
18892 '')
18893 echo "I could not find the definition for va_dcl... You have problems..." >&4
18894         val="$undef"; set i_stdarg; eval $setvar
18895         val="$undef"; set i_varargs; eval $setvar
18896         ;;
18897 *) 
18898         set i_varhdr
18899         eval $setvar
18900         case "$i_varhdr" in
18901         stdarg.h)
18902                 val="$define"; set i_stdarg; eval $setvar
18903                 val="$undef"; set i_varargs; eval $setvar
18904                 ;;
18905         varargs.h)
18906                 val="$undef"; set i_stdarg; eval $setvar
18907                 val="$define"; set i_varargs; eval $setvar
18908                 ;;
18909         esac
18910         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18911 esac
18912 $rm -f varargs*
18913
18914 : see if we need va_copy
18915 echo " "
18916 case "$i_stdarg" in
18917 "$define")
18918         $cat >try.c <<EOCP
18919 #include <stdarg.h>
18920 #include <stdio.h>
18921 #$i_stdlib I_STDLIB
18922 #ifdef I_STDLIB
18923 #include <stdlib.h>
18924 #endif
18925 #include <signal.h>
18926
18927 int
18928 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18929 {
18930   return vfprintf(f, fmt, *valp);
18931 }
18932  
18933 int    
18934 myvfprintf(FILE *f, const  char *fmt, va_list val)
18935 {
18936   return ivfprintf(f, fmt, &val);
18937 }
18938       
18939 int
18940 myprintf(char *fmt, ...) 
18941 {
18942   va_list val;
18943   va_start(val, fmt);
18944   return myvfprintf(stdout, fmt, val); 
18945 }         
18946
18947 int
18948 main(int ac, char **av)
18949 {
18950   signal(SIGSEGV, exit);
18951
18952   myprintf("%s%cs all right, then\n", "that", '\'');                            
18953   exit(0);      
18954 }
18955 EOCP
18956         set try
18957         if eval $compile && $run ./try 2>&1 >/dev/null; then
18958                 case "`$run ./try`" in
18959                 "that's all right, then")
18960                         okay=yes
18961                         ;;
18962                 esac
18963         fi
18964         case "$okay" in
18965         yes)    echo "It seems that you don't need va_copy()." >&4
18966                 need_va_copy="$undef"
18967                 ;;
18968         *)      echo "It seems that va_copy() or similar will be needed." >&4
18969                 need_va_copy="$define"
18970                 ;;
18971         esac
18972         $rm -f try.* core core.* *.core *.core.*
18973         ;;
18974 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18975         ;;
18976 esac
18977
18978 : see what type is used for size_t
18979 rp="What is the type used for the length parameter for string functions?"
18980 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18981 eval $typedef_ask
18982
18983 : check for type of arguments to gethostbyaddr. 
18984 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18985         case "$d_gethbyaddr" in
18986         $define)
18987                 $cat <<EOM
18988
18989 Checking to see what type of arguments are accepted by gethostbyaddr().
18990 EOM
18991                 hdrs="$define sys/types.h
18992                         $d_socket sys/socket.h 
18993                         $i_niin netinet/in.h 
18994                         $i_netdb netdb.h
18995                         $i_unistd unistd.h"
18996                 : The first arg can 'char *' or 'void *'
18997                 : The second arg is some of integral type
18998                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18999                         for yyy in size_t long int; do
19000                                 case "$netdb_host_type" in
19001                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19002                                         if ./protochk "$try" $hdrs; then
19003                                                 echo "Your system accepts $xxx for the first arg."
19004                                                 echo "...and $yyy for the second arg."
19005                                                 netdb_host_type="$xxx"
19006                                                 netdb_hlen_type="$yyy"
19007                                         fi
19008                                         ;;
19009                                 esac
19010                         done
19011                 done
19012                 : In case none of those worked, prompt the user.
19013                 case "$netdb_host_type" in
19014                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19015                         dflt='char *'
19016                         . ./myread
19017                         netdb_host_type=$ans
19018                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19019                         dflt="$sizetype"
19020                         . ./myread
19021                         netdb_hlen_type=$ans
19022                         ;;
19023                 esac
19024                 ;;
19025         *)      : no gethostbyaddr, so pick harmless defaults
19026                 netdb_host_type='char *'
19027                 netdb_hlen_type="$sizetype"
19028                 ;;
19029         esac
19030         # Remove the "const" if needed. -- but then we'll have a 
19031         # prototype clash!
19032         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19033 fi
19034
19035 : check for type of argument to gethostbyname. 
19036 if test "X$netdb_name_type" = X ; then
19037         case "$d_gethbyname" in
19038         $define)
19039                 $cat <<EOM
19040
19041 Checking to see what type of argument is accepted by gethostbyname().
19042 EOM
19043                 hdrs="$define sys/types.h
19044                         $d_socket sys/socket.h 
19045                         $i_niin netinet/in.h 
19046                         $i_netdb netdb.h
19047                         $i_unistd unistd.h"
19048                 for xxx in "const char *" "char *"; do
19049                         case "$netdb_name_type" in
19050                         '')     try="extern struct hostent *gethostbyname($xxx);"
19051                                 if ./protochk "$try" $hdrs; then
19052                                         echo "Your system accepts $xxx."
19053                                         netdb_name_type="$xxx"
19054                                 fi
19055                                 ;;
19056                         esac
19057                 done
19058                 : In case none of those worked, prompt the user.
19059                 case "$netdb_name_type" in
19060                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19061                         dflt='char *'
19062                         . ./myread
19063                         netdb_name_type=$ans
19064                         ;;
19065                 esac
19066                 ;;
19067         *)      : no gethostbyname, so pick harmless default
19068                 netdb_name_type='char *'
19069                 ;;
19070         esac
19071 fi
19072
19073 : check for type of 1st argument to getnetbyaddr. 
19074 if test "X$netdb_net_type" = X ; then
19075         case "$d_getnbyaddr" in
19076         $define)
19077                 $cat <<EOM
19078
19079 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19080 EOM
19081                 hdrs="$define sys/types.h
19082                         $d_socket sys/socket.h 
19083                         $i_niin netinet/in.h 
19084                         $i_netdb netdb.h
19085                         $i_unistd unistd.h"
19086                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19087                         case "$netdb_net_type" in
19088                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19089                                 if ./protochk "$try" $hdrs; then
19090                                         echo "Your system accepts $xxx."
19091                                         netdb_net_type="$xxx"
19092                                 fi
19093                                 ;;
19094                         esac
19095                 done
19096                 : In case none of those worked, prompt the user.
19097                 case "$netdb_net_type" in
19098                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19099                         dflt='long'
19100                         . ./myread
19101                         netdb_net_type=$ans
19102                         ;;
19103                 esac
19104                 ;;
19105         *)      : no getnetbyaddr, so pick harmless default
19106                 netdb_net_type='long'
19107                 ;;
19108         esac
19109 fi
19110 : locate the preferred pager for this system
19111 fn=f/
19112 case "$pager" in
19113 '')
19114         dflt=''
19115         case "$pg" in
19116         /*) dflt=$pg;;
19117         [a-zA-Z]:/*) dflt=$pg;;
19118         esac
19119         case "$more" in
19120         /*) dflt=$more;;
19121         [a-zA-Z]:/*) dflt=$more;;
19122         esac
19123         case "$less" in
19124         /*) dflt=$less;;
19125         [a-zA-Z]:/*) dflt=$less;;
19126         esac
19127         case "$dflt" in
19128         '') dflt=/usr/ucb/more;;
19129         esac
19130         ;;
19131 *)      dflt="$pager"
19132         : Instruct ./getfile to trust the hinted or previous pager value,
19133         : even if it does not begin with a slash.  For example, on os2,
19134         : pager might be cmd /c more.  See comments in UU/getfile.
19135         fn="f/($pager)"
19136         ;;
19137 esac
19138 echo " "
19139 rp='What pager is used on your system?'
19140 . ./getfile
19141 pager="$ans"
19142
19143 : see what type pids are declared as in the kernel
19144 rp="What is the type of process ids on this system?"
19145 set pid_t pidtype int stdio.h sys/types.h
19146 eval $typedef_ask
19147
19148 : see if ar generates random libraries by itself
19149 echo " "
19150 echo "Checking how to generate random libraries on your machine..." >&4
19151 echo 'int bar1() { return bar2(); }' > bar1.c
19152 echo 'int bar2() { return 2; }' > bar2.c
19153 $cat > foo.c <<EOP
19154 #$i_stdlib I_STDLIB
19155 #ifdef I_STDLIB
19156 #include <stdlib.h>
19157 #endif
19158 int main() { printf("%d\n", bar1()); exit(0); }
19159 EOP
19160 $cc $ccflags -c bar1.c >/dev/null 2>&1
19161 $cc $ccflags -c bar2.c >/dev/null 2>&1
19162 $cc $ccflags -c foo.c >/dev/null 2>&1
19163 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19164 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19165         $run ./foobar >/dev/null 2>&1; then
19166         echo "$ar appears to generate random libraries itself."
19167         orderlib=false
19168         if [ "X$ranlib" = "X" ]; then
19169             ranlib=":"
19170         fi
19171 elif $ar ts bar$_a >/dev/null 2>&1 &&
19172         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19173         $run ./foobar >/dev/null 2>&1; then
19174                 echo "a table of contents needs to be added with '$ar ts'."
19175                 orderlib=false
19176                 ranlib="$ar ts"
19177 else
19178         case "$ranlib" in
19179         :) ranlib='';;
19180         '')
19181                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19182                 $test -f $ranlib || ranlib=''
19183                 ;;
19184         esac
19185         if $test -n "$ranlib"; then
19186                 echo "your system has '$ranlib'; we'll use that."
19187                 orderlib=false
19188         else
19189                 echo "your system doesn't seem to support random libraries"
19190                 echo "so we'll use lorder and tsort to order the libraries."
19191                 orderlib=true
19192                 ranlib=":"
19193         fi
19194 fi
19195 $rm -f foo* bar* 
19196
19197 : check for type of arguments to select. 
19198 case "$selecttype" in
19199 '') case "$d_select" in
19200         $define)
19201                 echo " "
19202                 $cat <<EOM
19203 Checking to see what type of arguments are accepted by select().
19204 EOM
19205                 hdrs="$define sys/types.h
19206                         $i_systime sys/time.h 
19207                         $i_sysselct sys/select.h
19208                         $d_socket sys/socket.h"
19209                 : The first arg can be int, unsigned, or size_t
19210                 : The last arg may or may not be 'const'
19211                 val=''
19212                 : void pointer has been seen but using that
19213                 : breaks the selectminbits test
19214                 for xxx in 'fd_set *' 'int *'; do
19215                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19216                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19217                                         case "$val" in
19218                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19219                                                 if ./protochk "$try" $hdrs; then
19220                                                         echo "Your system accepts $xxx."
19221                                                         val="$xxx"
19222                                                 fi
19223                                                 ;;
19224                                         esac
19225                                 done
19226                         done
19227                 done
19228                 case "$val" in
19229                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19230                         case "$d_fd_set" in
19231                                 $define) dflt="fd_set *" ;;
19232                                 *)              dflt="int *" ;;
19233                         esac
19234                         . ./myread
19235                         val=$ans
19236                         ;;
19237                 esac
19238                 selecttype="$val"
19239                 ;;
19240         *)      : no select, so pick a harmless default
19241                 selecttype='int *'
19242                 ;;
19243         esac
19244         ;;
19245 esac
19246
19247 : check for the select 'width'
19248 case "$selectminbits" in
19249 '') safebits=`expr $ptrsize \* 8`
19250     case "$d_select" in
19251         $define)
19252                 $cat <<EOM
19253
19254 Checking to see on how many bits at a time your select() operates...
19255 EOM
19256                 $cat >try.c <<EOCP
19257 #include <sys/types.h>
19258 #$i_time I_TIME
19259 #$i_systime I_SYS_TIME
19260 #$i_systimek I_SYS_TIME_KERNEL
19261 #ifdef I_TIME
19262 #   include <time.h>
19263 #endif
19264 #ifdef I_SYS_TIME
19265 #   ifdef I_SYS_TIME_KERNEL
19266 #       define KERNEL
19267 #   endif
19268 #   include <sys/time.h>
19269 #   ifdef I_SYS_TIME_KERNEL
19270 #       undef KERNEL
19271 #   endif
19272 #endif
19273 #$i_sysselct I_SYS_SELECT
19274 #ifdef I_SYS_SELECT
19275 #include <sys/select.h>
19276 #endif
19277 #$d_socket HAS_SOCKET
19278 #ifdef HAS_SOCKET
19279 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19280 #endif
19281 #include <stdio.h>
19282 #$i_stdlib I_STDLIB
19283 #ifdef I_STDLIB
19284 #include <stdlib.h>
19285 #endif
19286 $selecttype b;
19287 #define S sizeof(*(b))
19288 #define MINBITS 64
19289 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19290 #define NBITS  (NBYTES * 8)
19291 int main() {
19292     char *s = malloc(NBYTES);
19293     struct timeval t;
19294     int i;
19295     FILE* fp;
19296     int fd;
19297
19298     if (!s)
19299         exit(1);
19300     fclose(stdin);
19301     fp = fopen("try.c", "r");
19302     if (fp == 0)
19303       exit(2);
19304     fd = fileno(fp);
19305     if (fd < 0)
19306       exit(3);
19307     b = ($selecttype)s;
19308     for (i = 0; i < NBITS; i++)
19309         FD_SET(i, b);
19310     t.tv_sec  = 0;
19311     t.tv_usec = 0;
19312     select(fd + 1, b, 0, 0, &t);
19313     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19314     free(s);
19315     printf("%d\n", i + 1);
19316     return 0;
19317 }
19318 EOCP
19319                 set try
19320                 if eval $compile_ok; then
19321                         selectminbits=`$run ./try`
19322                         case "$selectminbits" in
19323                         '')     cat >&4 <<EOM
19324 Cannot figure out on how many bits at a time your select() operates.
19325 I'll play safe and guess it is $safebits bits.
19326 EOM
19327                                 selectminbits=$safebits
19328                                 bits="$safebits bits"
19329                                 ;;
19330                         1)      bits="1 bit" ;;
19331                         *)      bits="$selectminbits bits" ;;
19332                         esac
19333                         echo "Your select() operates on $bits at a time." >&4
19334                 else
19335                         rp='What is the minimum number of bits your select() operates on?'
19336                         case "$byteorder" in
19337                         12345678)       dflt=64 ;;
19338                         1234)           dflt=32 ;;
19339                         *)              dflt=1  ;;
19340                         esac
19341                         . ./myread
19342                         val=$ans
19343                         selectminbits="$val"
19344                 fi
19345                 $rm -f try.* try
19346                 ;;
19347         *)      : no select, so pick a harmless default
19348                 selectminbits=$safebits
19349                 ;;
19350         esac
19351         ;;
19352 esac
19353
19354 : Trace out the files included by signal.h, then look for SIGxxx names.
19355 : Remove SIGARRAYSIZE used by HPUX.
19356 : Remove SIGSTKSIZE used by Linux.
19357 : Remove SIGSTKSZ used by Posix.
19358 : Remove SIGTYP void lines used by OS2.
19359 : Some cpps, like os390, dont give the file name anywhere
19360 if [ "X$fieldn" = X ]; then
19361         : Just make some guesses.  We check them later.
19362         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19363 else
19364         xxx=`echo '#include <signal.h>' |
19365         $cppstdin $cppminus $cppflags 2>/dev/null |
19366         $grep '^[       ]*#.*include' | 
19367         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19368 fi
19369 : Check this list of files to be sure we have parsed the cpp output ok.
19370 : This will also avoid potentially non-existent files, such 
19371 : as ../foo/bar.h
19372 xxxfiles=''
19373 for xx in $xxx /dev/null ; do
19374         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19375 done
19376 : If we have found no files, at least try signal.h
19377 case "$xxxfiles" in
19378 '')     xxxfiles=`./findhdr signal.h` ;;
19379 esac
19380 xxx=`awk '
19381 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19382         print substr($2, 4, 20)
19383 }
19384 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19385         print substr($3, 4, 20)
19386 }' $xxxfiles`
19387 : Append some common names just in case the awk scan failed.
19388 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19389 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19390 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19391 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19392 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19393
19394 : generate a few handy files for later
19395 $cat > signal.c <<EOCP
19396 #include <sys/types.h>
19397 #include <signal.h>
19398 #$i_stdlib I_STDLIB
19399 #ifdef I_STDLIB
19400 #include <stdlib.h>
19401 #endif
19402 #include <stdio.h>
19403 int main() {
19404
19405 /* Strange style to avoid deeply-nested #if/#else/#endif */
19406 #ifndef NSIG
19407 #  ifdef _NSIG
19408 #    define NSIG (_NSIG)
19409 #  endif
19410 #endif
19411
19412 #ifndef NSIG
19413 #  ifdef SIGMAX
19414 #    define NSIG (SIGMAX+1)
19415 #  endif
19416 #endif
19417
19418 #ifndef NSIG
19419 #  ifdef SIG_MAX
19420 #    define NSIG (SIG_MAX+1)
19421 #  endif
19422 #endif
19423
19424 #ifndef NSIG
19425 #  ifdef _SIG_MAX
19426 #    define NSIG (_SIG_MAX+1)
19427 #  endif
19428 #endif
19429
19430 #ifndef NSIG
19431 #  ifdef MAXSIG
19432 #    define NSIG (MAXSIG+1)
19433 #  endif
19434 #endif
19435
19436 #ifndef NSIG
19437 #  ifdef MAX_SIG
19438 #    define NSIG (MAX_SIG+1)
19439 #  endif
19440 #endif
19441
19442 #ifndef NSIG
19443 #  ifdef SIGARRAYSIZE
19444 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19445 #  endif
19446 #endif
19447
19448 #ifndef NSIG
19449 #  ifdef _sys_nsig
19450 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19451 #  endif
19452 #endif
19453
19454 /* Default to some arbitrary number that's big enough to get most
19455    of the common signals.
19456 */
19457 #ifndef NSIG
19458 #    define NSIG 50
19459 #endif
19460
19461 printf("NSIG %d\n", NSIG);
19462
19463 #ifndef JUST_NSIG
19464
19465 EOCP
19466
19467 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19468 {
19469         printf "#ifdef SIG"; printf $1; printf "\n"
19470         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19471         printf $1; printf ");\n"
19472         printf "#endif\n"
19473 }
19474 END {
19475         printf "#endif /* JUST_NSIG */\n";
19476         printf "exit(0);\n}\n";
19477 }
19478 ' >>signal.c
19479 $cat >signal.awk <<'EOP'
19480 BEGIN { ndups = 0 }
19481 $1 ~ /^NSIG$/ { nsig = $2 }
19482 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19483     if ($2 > maxsig) { maxsig = $2 }
19484     if (sig_name[$2]) {
19485         dup_name[ndups] = $1
19486         dup_num[ndups] = $2
19487         ndups++ 
19488     }
19489     else {
19490         sig_name[$2] = $1
19491         sig_num[$2] = $2
19492     }
19493 }
19494 END { 
19495     if (nsig == 0) {
19496         nsig = maxsig + 1
19497     }
19498     printf("NSIG %d\n", nsig);
19499     for (n = 1; n < nsig; n++) {
19500         if (sig_name[n]) {
19501             printf("%s %d\n", sig_name[n], sig_num[n])
19502         }
19503         else {
19504             printf("NUM%d %d\n", n, n) 
19505         }
19506     }
19507     for (n = 0; n < ndups; n++) {
19508         printf("%s %d\n", dup_name[n], dup_num[n])
19509     }
19510 }
19511 EOP
19512 $cat >signal_cmd <<EOS
19513 $startsh
19514 if $test -s signal.lst; then
19515     echo "Using your existing signal.lst file"
19516         exit 0
19517 fi
19518 xxx="$xxx"
19519 EOS
19520 $cat >>signal_cmd <<'EOS'
19521
19522 set signal
19523 if eval $compile_ok; then
19524         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19525 else
19526         echo "(I can't seem be able to compile the whole test program)" >&4
19527         echo "(I'll try it in little pieces.)" >&4
19528         set signal -DJUST_NSIG
19529         if eval $compile_ok; then
19530                 $run ./signal$_exe > signal.nsg
19531                 $cat signal.nsg
19532         else
19533                 echo "I can't seem to figure out how many signals you have." >&4
19534                 echo "Guessing 50." >&4
19535                 echo 'NSIG 50' > signal.nsg
19536         fi
19537         : Now look at all the signal names, one at a time.
19538         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19539                 $cat > signal.c <<EOCP
19540 #include <sys/types.h>
19541 #include <signal.h>
19542 #include <stdio.h>
19543 int main() {
19544 printf("$xx %d\n", SIG${xx});
19545 return 0;
19546 }
19547 EOCP
19548                 set signal
19549                 if eval $compile; then
19550                         echo "SIG${xx} found."
19551                         $run ./signal$_exe  >> signal.ls1
19552                 else
19553                         echo "SIG${xx} NOT found."
19554                 fi
19555         done
19556         if $test -s signal.ls1; then
19557                 $cat signal.nsg signal.ls1 |
19558                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19559         fi
19560
19561 fi
19562 if $test -s signal.lst; then
19563         :
19564 else
19565         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19566         echo 'kill -l' >signal
19567         set X `csh -f <signal`
19568         $rm -f signal
19569         shift
19570         case $# in
19571         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19572         esac
19573         echo $@ | $tr ' ' $trnl | \
19574             $awk '{ printf "%s %d\n", $1, ++s; }
19575                   END { printf "NSIG %d\n", ++s }' >signal.lst
19576 fi
19577 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19578 EOS
19579 chmod a+x signal_cmd
19580 $eunicefix signal_cmd
19581
19582 : generate list of signal names
19583 echo " "
19584 case "$sig_name_init" in
19585 '') doinit=yes ;;
19586 *)  case "$sig_num_init" in
19587     ''|*,*) doinit=yes ;;
19588     esac ;;
19589 esac
19590 case "$doinit" in
19591 yes)
19592         echo "Generating a list of signal names and numbers..." >&4
19593         . ./signal_cmd
19594         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19595         sig_name=`$awk 'BEGIN { printf "ZERO " }
19596                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19597         sig_num=`$awk  'BEGIN { printf "0 " }
19598                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19599         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19600                              !/^NSIG/   { printf "\"%s\", ", $1 }
19601                              END        { printf "0\n" }' signal.lst`
19602         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19603                              !/^NSIG/   { printf "%d, ", $2}
19604                              END        { printf "0\n"}' signal.lst`
19605         ;;
19606 esac
19607 echo "The following $sig_count signals are available:"
19608 echo " "
19609 echo $sig_name | $awk \
19610 'BEGIN { linelen = 0 }
19611 {
19612         for (i = 1; i <= NF; i++) {
19613                 name = "SIG" $i " "
19614                 linelen = linelen + length(name)
19615                 if (linelen > 70) {
19616                         printf "\n"
19617                         linelen = length(name)
19618                 }
19619                 printf "%s", name
19620         }
19621         printf "\n"
19622 }'
19623 sig_size=`echo $sig_name | awk '{print NF}'`
19624 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19625
19626 echo " "
19627 case "$sizetype" in
19628 *_t) zzz="$sizetype"    ;;
19629 *)   zzz="filesize"     ;;
19630 esac
19631 echo "Checking the size of $zzz..." >&4 
19632 cat > try.c <<EOCP
19633 #include <sys/types.h>
19634 #include <stdio.h>
19635 #$i_stdlib I_STDLIB
19636 #ifdef I_STDLIB
19637 #include <stdlib.h>
19638 #endif
19639 int main() {
19640     printf("%d\n", (int)sizeof($sizetype));
19641     exit(0);
19642 }
19643 EOCP
19644 set try
19645 if eval $compile_ok; then
19646         yyy=`$run ./try`
19647         case "$yyy" in
19648         '')     sizesize=4
19649                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19650                 ;;
19651         *)      sizesize=$yyy
19652                 echo "Your $zzz size is $sizesize bytes."
19653                 ;;
19654         esac
19655 else
19656         sizesize=4
19657         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19658 fi
19659
19660
19661 : check for socklen_t
19662 echo " "
19663 echo "Checking to see if you have socklen_t..." >&4
19664 $cat >try.c <<EOCP
19665 #include <sys/types.h>
19666 #$d_socket HAS_SOCKET
19667 #ifdef HAS_SOCKET
19668 #include <sys/socket.h>
19669 #endif
19670 int main() { socklen_t x = 16; }
19671 EOCP
19672 set try
19673 if eval $compile; then
19674         val="$define"
19675         echo "You have socklen_t."
19676 else
19677         val="$undef"
19678         echo "You do not have socklen_t."
19679         case "$sizetype" in
19680         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19681         esac
19682 fi
19683 $rm -f try try.*
19684 set d_socklen_t
19685 eval $setvar
19686
19687 : see if this is a socks.h system
19688 set socks.h i_socks
19689 eval $inhdr
19690
19691 : check for type of the size argument to socket calls
19692 case "$d_socket" in
19693 "$define")
19694         $cat <<EOM
19695
19696 Checking to see what type is the last argument of accept().
19697 EOM
19698         yyy=''
19699         case "$d_socklen_t" in
19700         "$define") yyy="$yyy socklen_t"
19701         esac
19702         yyy="$yyy $sizetype int long unsigned"
19703         for xxx in $yyy; do
19704                 case "$socksizetype" in
19705                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19706                         case "$usesocks" in
19707                         "$define")
19708                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19709                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19710                                         socksizetype="$xxx"
19711                                 fi
19712                                 ;;
19713                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19714                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19715                                         socksizetype="$xxx"
19716                                 fi
19717                                 ;;
19718                         esac
19719                         ;;
19720                 esac
19721         done
19722 : In case none of those worked, prompt the user.
19723         case "$socksizetype" in
19724         '')     rp='What is the type for socket address structure sizes?'
19725                 dflt='int'
19726                 . ./myread
19727                 socksizetype=$ans
19728                 ;;
19729         esac
19730         ;;
19731 *)      : no sockets, so pick relatively harmless default
19732         socksizetype='int'
19733         ;;
19734 esac
19735
19736 : see what type is used for signed size_t
19737 set ssize_t ssizetype int stdio.h sys/types.h
19738 eval $typedef
19739 dflt="$ssizetype"
19740 $cat > try.c <<EOM
19741 #include <stdio.h>
19742 #$i_stdlib I_STDLIB
19743 #ifdef I_STDLIB
19744 #include <stdlib.h>
19745 #endif
19746 #include <sys/types.h>
19747 #define Size_t $sizetype
19748 #define SSize_t $dflt
19749 int main()
19750 {
19751         if (sizeof(Size_t) == sizeof(SSize_t))
19752                 printf("$dflt\n");
19753         else if (sizeof(Size_t) == sizeof(int))
19754                 printf("int\n");
19755         else 
19756                 printf("long\n");
19757         exit(0);
19758 }
19759 EOM
19760 echo " "
19761 set try
19762 if eval $compile_ok && $run ./try > /dev/null; then
19763         ssizetype=`$run ./try`
19764         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19765 else
19766         $cat >&4 <<EOM
19767 Help! I can't compile and run the ssize_t test program: please enlighten me!
19768 (This is probably a misconfiguration in your system or libraries, and
19769 you really ought to fix it.  Still, I'll try anyway.)
19770
19771 I need a type that is the same size as $sizetype, but is guaranteed to
19772 be signed.  Common values are ssize_t, int and long.
19773
19774 EOM
19775         rp="What signed type is the same size as $sizetype?"
19776         . ./myread
19777         ssizetype="$ans"
19778 fi
19779 $rm -f try try.*
19780
19781 : see what type of char stdio uses.
19782 echo " "
19783 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19784 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19785         echo "Your stdio uses unsigned chars." >&4
19786         stdchar="unsigned char"
19787 else
19788         echo "Your stdio uses signed chars." >&4
19789         stdchar="char"
19790 fi
19791 $rm -f stdioh
19792
19793
19794
19795 : see what type uids are declared as in the kernel
19796 echo " "
19797 echo "Looking for the type for user ids returned by getuid()."
19798 set uid_t uidtype xxx stdio.h sys/types.h
19799 eval $typedef
19800 case "$uidtype" in
19801 xxx)
19802         xxx=`./findhdr sys/user.h`
19803         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19804         case $1 in
19805         unsigned) dflt="$1 $2" ;;
19806         *) dflt="$1" ;;
19807         esac
19808         ;;
19809 *) dflt="$uidtype";;
19810 esac
19811 case "$uidtype" in
19812 uid_t)  echo "uid_t found." ;;
19813 *)      rp="What is the type for user ids returned by getuid()?"
19814         . ./myread
19815         uidtype="$ans"
19816         ;;
19817 esac
19818
19819 echo " "
19820 case "$uidtype" in
19821 *_t) zzz="$uidtype"     ;;
19822 *)   zzz="uid"          ;;
19823 esac
19824 echo "Checking the size of $zzz..." >&4 
19825 cat > try.c <<EOCP
19826 #include <sys/types.h>
19827 #include <stdio.h>
19828 #$i_stdlib I_STDLIB
19829 #ifdef I_STDLIB
19830 #include <stdlib.h>
19831 #endif
19832 int main() {
19833     printf("%d\n", (int)sizeof($uidtype));
19834     exit(0);
19835 }
19836 EOCP
19837 set try
19838 if eval $compile_ok; then
19839         yyy=`$run ./try`
19840         case "$yyy" in
19841         '')     uidsize=4
19842                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19843                 ;;
19844         *)      uidsize=$yyy
19845                 echo "Your $zzz is $uidsize bytes long."
19846                 ;;
19847         esac
19848 else
19849         uidsize=4
19850         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19851 fi
19852
19853 echo " "
19854 case "$uidtype" in
19855 *_t) zzz="$uidtype"     ;;
19856 *)   zzz="uid"          ;;
19857 esac
19858 echo "Checking the sign of $zzz..." >&4
19859 cat > try.c <<EOCP
19860 #include <sys/types.h>
19861 #include <stdio.h>
19862 int main() {
19863         $uidtype foo = -1;
19864         if (foo < 0)
19865                 printf("-1\n");
19866         else
19867                 printf("1\n");
19868 }
19869 EOCP
19870 set try
19871 if eval $compile; then
19872         yyy=`$run ./try`
19873         case "$yyy" in
19874         '')     uidsign=1
19875                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19876                 ;;
19877         *)      uidsign=$yyy
19878                 case "$uidsign" in
19879                  1) echo "Your $zzz is unsigned." ;;
19880                 -1) echo "Your $zzz is signed."   ;;
19881                 esac
19882                 ;;
19883         esac
19884 else
19885         uidsign=1
19886         echo "(I can't compile the test program--guessing unsigned.)" >&4
19887 fi
19888
19889
19890
19891 echo " "
19892 $echo "Checking the format string to be used for uids..." >&4
19893
19894 case "$uidsign" in
19895 -1)     if $test X"$uidsize" = X"$ivsize"; then
19896                 uidformat="$ivdformat"
19897         else
19898                 if $test X"$uidsize" = X"$longsize"; then
19899                         uidformat='"ld"'
19900                 else
19901                         if $test X"$uidsize" = X"$intsize"; then
19902                                 uidformat='"d"'
19903                         else
19904                                 if $test X"$uidsize" = X"$shortsize"; then
19905                                         uidformat='"hd"'
19906                                 fi
19907                         fi
19908                 fi
19909         fi
19910         ;;
19911 *)      if $test X"$uidsize" = X"$uvsize"; then
19912                 uidformat="$uvuformat"
19913         else
19914                 if $test X"$uidsize" = X"$longsize"; then
19915                         uidformat='"lu"'
19916                 else
19917                         if $test X"$uidsize" = X"$intsize"; then
19918                                 uidformat='"u"'
19919                         else
19920                                 if $test X"$uidsize" = X"$shortsize"; then
19921                                         uidformat='"hu"'
19922                                 fi
19923                         fi
19924                 fi
19925         fi
19926         ;;
19927 esac
19928
19929
19930 case "$usesitecustomize" in
19931     $define|true|[Yy]*)
19932         usesitecustomize="$define"
19933         ;;
19934     *)
19935         usesitecustomize="$undef"
19936         ;;
19937     esac
19938
19939 : determine compiler compiler
19940 case "$yacc" in
19941 '')
19942         dflt=yacc;;
19943 *)
19944         dflt="$yacc";;
19945 esac
19946 echo " "
19947 comp='yacc'
19948 if $test -f "$byacc$_exe"; then
19949         dflt="$byacc"
19950         comp="byacc or $comp"
19951 fi
19952 if $test -f "$bison$_exe"; then
19953         comp="$comp or bison -y"
19954 fi
19955 rp="Which compiler compiler ($comp) shall I use?"
19956 . ./myread
19957 yacc="$ans"
19958 case "$yacc" in
19959 *bis*)
19960         case "$yacc" in
19961         *-y*) ;;
19962         *)
19963                 yacc="$yacc -y"
19964                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19965                 ;;
19966         esac
19967         ;;
19968 esac
19969
19970 : see if this is a fp.h system
19971 set fp.h i_fp
19972 eval $inhdr
19973
19974 : see if this is a fp_class.h system
19975 set fp_class.h i_fp_class
19976 eval $inhdr
19977
19978 : see if this is a ieeefp.h system
19979 case "$i_ieeefp" in
19980 '' ) set ieeefp.h i_ieeefp
19981      eval $inhdr
19982      ;;
19983 esac
19984
19985 : see if this is a libutil.h system
19986 set libutil.h i_libutil
19987 eval $inhdr
19988
19989 : see if mach cthreads are available
19990 if test "X$usethreads" = "X$define"; then
19991         set mach/cthreads.h i_machcthr
19992         eval $inhdr
19993 else
19994         i_machcthr="$undef"
19995 fi
19996
19997
19998
19999 : see if this is a mntent.h system
20000 set mntent.h i_mntent
20001 eval $inhdr
20002
20003 : see if ndbm.h is available
20004 set ndbm.h t_ndbm
20005 eval $inhdr
20006
20007 case "$t_ndbm" in
20008 $undef)
20009     # Some Linux distributions such as RedHat 7.1 put the
20010     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20011     if $test -f /usr/include/gdbm/ndbm.h; then
20012         echo '<gdbm/ndbm.h> found.'
20013         ccflags="$ccflags -I/usr/include/gdbm"
20014         cppflags="$cppflags -I/usr/include/gdbm"
20015         t_ndbm=$define
20016     fi
20017     ;;
20018 esac
20019
20020 case "$t_ndbm" in
20021 $define)
20022         : see if dbm_open exists
20023         set dbm_open d_dbm_open
20024         eval $inlibc
20025         case "$d_dbm_open" in
20026         $undef)
20027                 t_ndbm="$undef"
20028                 echo "We won't be including <ndbm.h>"
20029                 ;;
20030         esac
20031         ;;
20032 esac
20033 val="$t_ndbm"
20034 set i_ndbm
20035 eval $setvar
20036
20037 : see if net/errno.h is available
20038 val=''
20039 set net/errno.h val
20040 eval $inhdr
20041
20042 : Unfortunately, it causes problems on some systems.  Arrgh.
20043 case "$val" in
20044 $define)
20045         cat > try.c <<'EOM'
20046 #include <stdio.h>
20047 #include <errno.h>
20048 #include <net/errno.h>
20049 int func()
20050 {
20051         return ENOTSOCK;
20052 }
20053 EOM
20054         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20055                 echo "We'll be including <net/errno.h>." >&4
20056         else
20057                 echo "We won't be including <net/errno.h>." >&4
20058                 val="$undef"
20059         fi
20060         $rm -f try.* try
20061         ;;
20062 esac
20063 set i_neterrno
20064 eval $setvar
20065
20066 : see if netinet/tcp.h is available
20067 set netinet/tcp.h i_netinettcp
20068 eval $inhdr
20069
20070 : see if this is a poll.h system
20071 set poll.h i_poll
20072 eval $inhdr
20073
20074 : see if this is a prot.h system
20075 set prot.h i_prot
20076 eval $inhdr
20077
20078 echo " "
20079 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
20080 $cat <<'EOSH' > Cppsym.know
20081 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20082 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20083 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20084 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20085 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20086 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20087 bull c cadmus clipper CMU COFF COMPILER_VERSION
20088 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20089 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20090 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20091 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20092 GLIBC GLIBC_MINOR
20093 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20094 H3050R H3050RX hbullx20 hcx host_mips
20095 hp200 hp300 hp700 HP700 hp800 hp9000
20096 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20097 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20098 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20099 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20100 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20101 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20102 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20103 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20104 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20105 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20106 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20107 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20108 MATH_HAS_NO_SIDE_EFFECTS
20109 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20110 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20111 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20112 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20113 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20114 NetBSD news1500 news1700 news1800 news1900 news3700
20115 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20116 ns32016 ns32332 ns32k nsc32000
20117 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20118 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20119 pc532 pdp11 PGC PIC plexus PORTAR posix
20120 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20121 POSIX_C_SOURCE POSIX_SOURCE POWER
20122 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20123 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20124 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20125 sony sony_news sonyrisc sparc sparclite spectrum
20126 stardent stdc STDC_EXT stratos sun sun3 sun386
20127 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20128 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20129 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20130 sysV68 sysV88 Tek4132 Tek4300 titan
20131 TM3200 TM5400 TM5600
20132 tower tower32 tower32_200 tower32_600 tower32_700
20133 tower32_800 tower32_850 tss
20134 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20135 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20136 unix UNIX95 UNIX99 unixpc unos
20137 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20138 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20139 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20140 USGr4 USGr4_2
20141 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20142 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20143 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20144 z8000
20145 EOSH
20146 # Maybe put other stuff here too.
20147 cat <<EOSH >>Cppsym.know
20148 $osname
20149 EOSH
20150 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20151 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20152 $cat Cppsym.know > Cppsym.c
20153 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20154 $rm -f Cppsym.a Cppsym.b Cppsym.c
20155 cat <<EOSH > Cppsym
20156 $startsh
20157 if $test \$# -gt 0; then
20158     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20159     if $test -s Cppsym.got; then
20160         $rm -f Cppsym.got
20161         exit 0
20162     fi
20163     $rm -f Cppsym.got
20164     exit 1
20165 else
20166     $tr " " "$trnl" | ./Cppsym.try
20167     exit 0
20168 fi
20169 EOSH
20170 chmod +x Cppsym
20171 $eunicefix Cppsym
20172 cat <<EOSH > Cppsym.try
20173 $startsh
20174 cat <<'EOCP' > try.c
20175 #include <stdio.h>
20176 #if cpp_stuff == 1
20177 #define STRINGIFY(a)    "a"
20178 #endif
20179 #if cpp_stuff == 42
20180 #define StGiFy(a)  #a
20181 #define STRINGIFY(a)    StGiFy(a)
20182 #endif
20183 #if $cpp_stuff != 1 && $cpp_stuff != 42
20184 #   include "Bletch: How does this C preprocessor stringify macros?"
20185 #endif
20186 int main() {
20187 EOCP
20188 $awk \\
20189 EOSH
20190 cat <<'EOSH' >> Cppsym.try
20191 'length($1) > 0 {
20192     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20193     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20194     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20195     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20196 }'       >> try.c
20197 echo 'return 0;}' >> try.c
20198 EOSH
20199 cat <<EOSH >> Cppsym.try
20200 ccflags="$ccflags"
20201 case "$osname-$gccversion" in
20202 irix-) ccflags="\$ccflags -woff 1178" ;;
20203 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20204 esac
20205 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20206 EOSH
20207 chmod +x Cppsym.try
20208 $eunicefix Cppsym.try
20209 ./Cppsym < Cppsym.know > Cppsym.true
20210 : now check the C compiler for additional symbols
20211 postprocess_cc_v=''
20212 case "$osname" in
20213 aix) postprocess_cc_v="|$tr , ' '" ;;
20214 esac
20215 $cat >ccsym <<EOS
20216 $startsh
20217 $cat >tmp.c <<EOF
20218 extern int foo;
20219 EOF
20220 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20221 do
20222         case "\$i" in
20223         -D*) echo "\$i" | $sed 's/^-D//';;
20224         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20225         esac
20226 done
20227 $rm -f try.c
20228 EOS
20229 postprocess_cc_v=''
20230 chmod +x ccsym
20231 $eunicefix ccsym
20232 ./ccsym > ccsym1.raw
20233 if $test -s ccsym1.raw; then
20234        $sort ccsym1.raw | $uniq >ccsym.raw
20235 else
20236        mv ccsym1.raw ccsym.raw
20237 fi
20238
20239 $awk '/\=/ { print $0; next }
20240         { print $0"=1" }' ccsym.raw >ccsym.list
20241 $comm -13 Cppsym.true ccsym.list >ccsym.own
20242 $comm -12 Cppsym.true ccsym.list >ccsym.com
20243 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20244 also=''
20245 if $test -z ccsym.raw; then
20246         echo "Your C compiler doesn't seem to define any symbols!" >&4
20247         echo " "
20248         echo "However, your C preprocessor defines the following symbols:"
20249         $cat Cppsym.true
20250         ccsymbols=''
20251         cppsymbols=`$cat Cppsym.true`
20252         cppsymbols=`echo $cppsymbols`
20253         cppccsymbols="$cppsymbols"
20254 else
20255         if $test -s ccsym.com; then
20256                 echo "Your C compiler and pre-processor define these symbols:"
20257                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20258                 also='also '
20259                 symbols='ones'
20260                 cppccsymbols=`$cat ccsym.com`
20261                 cppccsymbols=`echo $cppccsymbols`
20262                 $test "$silent" || sleep 1
20263         fi
20264         if $test -s ccsym.cpp; then
20265                 $test "$also" && echo " "
20266                 echo "Your C pre-processor ${also}defines the following symbols:"
20267                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20268                 also='further '
20269                 cppsymbols=`$cat ccsym.cpp`
20270                 cppsymbols=`echo $cppsymbols`
20271                 $test "$silent" || sleep 1
20272         fi
20273         if $test -s ccsym.own; then
20274                 $test "$also" && echo " "
20275                 echo "Your C compiler ${also}defines the following cpp symbols:"
20276                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20277                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20278                 ccsymbols=`$cat ccsym.own`
20279                 ccsymbols=`echo $ccsymbols`
20280                 $test "$silent" || sleep 1
20281         fi
20282 fi
20283
20284 : see if this is a termio system
20285 val="$undef"
20286 val2="$undef"
20287 val3="$undef"
20288 if $test `./findhdr termios.h`; then
20289         set tcsetattr i_termios
20290         eval $inlibc
20291         val3="$i_termios"
20292 fi
20293 echo " "
20294 case "$val3" in
20295 "$define") echo "You have POSIX termios.h... good!" >&4;;
20296 *) if ./Cppsym pyr; then
20297                 case "`/bin/universe`" in
20298                 ucb) if $test `./findhdr sgtty.h`; then
20299                                 val2="$define"
20300                                 echo "<sgtty.h> found." >&4
20301                         else
20302                                 echo "System is pyramid with BSD universe."
20303                                 echo "<sgtty.h> not found--you could have problems." >&4
20304                         fi;;
20305                 *) if $test `./findhdr termio.h`; then
20306                                 val="$define"
20307                                 echo "<termio.h> found." >&4
20308                         else
20309                                 echo "System is pyramid with USG universe."
20310                                 echo "<termio.h> not found--you could have problems." >&4
20311                         fi;;
20312                 esac
20313         elif ./usg; then
20314                 if $test `./findhdr termio.h`; then
20315                         echo "<termio.h> found." >&4
20316                         val="$define"
20317                 elif $test `./findhdr sgtty.h`; then
20318                         echo "<sgtty.h> found." >&4
20319                         val2="$define"
20320                 else
20321 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20322                 fi
20323         else
20324                 if $test `./findhdr sgtty.h`; then
20325                         echo "<sgtty.h> found." >&4
20326                         val2="$define"
20327                 elif $test `./findhdr termio.h`; then
20328                         echo "<termio.h> found." >&4
20329                         val="$define"
20330                 else
20331 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20332                 fi
20333         fi;;
20334 esac
20335 set i_termio; eval $setvar
20336 val=$val2; set i_sgtty; eval $setvar
20337 val=$val3; set i_termios; eval $setvar
20338
20339 : see if stddef is available
20340 set stddef.h i_stddef
20341 eval $inhdr
20342
20343 : see if this is a sunmath.h system
20344 set sunmath.h i_sunmath
20345 eval $inhdr
20346
20347 : see if sys/access.h is available
20348 set sys/access.h i_sysaccess
20349 eval $inhdr
20350
20351 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20352 set sys/filio.h i_sysfilio
20353 eval $inhdr
20354 echo " "
20355 if $test `./findhdr sys/ioctl.h`; then
20356         val="$define"
20357         echo '<sys/ioctl.h> found.' >&4
20358 else
20359         val="$undef"
20360         if $test $i_sysfilio = "$define"; then
20361             echo '<sys/ioctl.h> NOT found.' >&4
20362         else
20363                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20364                 $test $i_termio = "$define" && xxx="termio.h"
20365                 $test $i_termios = "$define" && xxx="termios.h"
20366 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20367         fi
20368 fi
20369 set i_sysioctl
20370 eval $setvar
20371
20372 : see if socket ioctl defs are in sys/sockio.h
20373 echo " "
20374 xxx=`./findhdr sys/sockio.h`
20375 if $test "$xxx"; then
20376         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20377                 val="$define"
20378                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20379         else
20380                 val="$undef"
20381                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20382         fi
20383 else
20384         val="$undef"
20385         $cat <<EOM
20386 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20387 EOM
20388 fi
20389 set i_syssockio
20390 eval $setvar
20391
20392
20393 : see if this is a syslog.h system
20394 set syslog.h i_syslog
20395 eval $inhdr
20396
20397
20398 : see if this is a sys/mode.h system
20399 set sys/mode.h i_sysmode
20400 eval $inhdr
20401
20402 : see if sys/resource.h has to be included
20403 set sys/resource.h i_sysresrc
20404 eval $inhdr
20405
20406 : see if sys/security.h is available
20407 set sys/security.h i_syssecrt
20408 eval $inhdr
20409
20410 : see if this is a sys/statvfs.h system
20411 set sys/statvfs.h i_sysstatvfs
20412 eval $inhdr
20413
20414 : see if this is a sys/un.h system
20415 set sys/un.h i_sysun
20416 eval $inhdr
20417
20418
20419 : see if this is a sys/utsname.h system
20420 set sys/utsname.h i_sysutsname
20421 eval $inhdr
20422
20423 : see if this is a syswait system
20424 set sys/wait.h i_syswait
20425 eval $inhdr
20426
20427 : see if this is a ustat.h system
20428 set ustat.h i_ustat
20429 eval $inhdr
20430
20431 : see if this is an utime system
20432 set utime.h i_utime
20433 eval $inhdr
20434
20435 : see if this is a values.h system
20436 set values.h i_values
20437 eval $inhdr
20438
20439 : see if this is a vfork system
20440 case "$d_vfork" in
20441 "$define")
20442         set vfork.h i_vfork
20443         eval $inhdr
20444         ;;
20445 *)
20446         i_vfork="$undef"
20447         ;;
20448 esac
20449
20450 : see if gdbm.h is available
20451 set gdbm.h t_gdbm
20452 eval $inhdr
20453 case "$t_gdbm" in
20454 $define)
20455         : see if gdbm_open exists
20456         set gdbm_open d_gdbm_open
20457         eval $inlibc
20458         case "$d_gdbm_open" in
20459         $undef)
20460                 t_gdbm="$undef"
20461                 echo "We won't be including <gdbm.h>"
20462                 ;;
20463         esac
20464         ;;
20465 esac
20466 val="$t_gdbm"
20467 set i_gdbm
20468 eval $setvar
20469
20470 echo " "
20471 echo "Looking for extensions..." >&4
20472 : If we are using the old config.sh, known_extensions may contain
20473 : old or inaccurate or duplicate values.
20474 known_extensions=''
20475 nonxs_extensions=''
20476 : We do not use find because it might not be available.
20477 : We do not just use MANIFEST because the user may have dropped
20478 : some additional extensions into the source tree and expect them
20479 : to be built.
20480
20481 : Function to recursively find available extensions, ignoring DynaLoader
20482 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20483 find_extensions='
20484     for xxx in *; do
20485        case "$xxx" in
20486            DynaLoader|dynaload) ;;
20487            *)
20488            if $test -f $xxx/$xxx.xs; then
20489                known_extensions="$known_extensions $1$xxx";
20490            elif $test -f $xxx/Makefile.PL; then
20491                nonxs_extensions="$nonxs_extensions $1$xxx";
20492            else
20493                if $test -d $xxx -a $# -lt 10; then
20494                    set $1$xxx/ $*;
20495                    cd "$xxx";
20496                    eval $find_extensions;
20497                    cd ..;
20498                    shift;
20499                fi;
20500            fi
20501            ;;
20502        esac;
20503     done'
20504 tdir=`pwd`
20505 cd "$rsrc/ext"
20506 set X
20507 shift
20508 eval $find_extensions
20509 # Special case:  Add in threads/shared since it is not picked up by the
20510 # recursive find above (and adding in general recursive finding breaks
20511 # SDBM_File/sdbm).  A.D.  10/25/2001.
20512 known_extensions="$known_extensions threads/shared"
20513 set X $nonxs_extensions
20514 shift
20515 nonxs_extensions="$*"
20516 set X $known_extensions
20517 shift
20518 known_extensions="$*"
20519 cd "$tdir"
20520
20521 : Now see which are supported on this system.
20522 avail_ext=''
20523 for xxx in $known_extensions ; do
20524         case "$xxx" in
20525         DB_File|db_file)
20526                 case "$i_db" in
20527                 $define) avail_ext="$avail_ext $xxx" ;;
20528                 esac
20529                 ;;
20530         GDBM_File|gdbm_fil)
20531                 case "$i_gdbm" in 
20532                 $define) avail_ext="$avail_ext $xxx" ;;
20533                 esac
20534                 ;;
20535         I18N/Langinfo|i18n_lan)
20536                 case "$i_langinfo$d_nl_langinfo" in 
20537                 $define$define) avail_ext="$avail_ext $xxx" ;;
20538                 esac
20539                 ;;
20540         NDBM_File|ndbm_fil)
20541                 case "$i_ndbm" in
20542                 $define)
20543                     case "$osname-$use64bitint" in
20544                     hpux-define)
20545                         case "$libs" in
20546                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20547                         esac
20548                         ;;
20549                     *) avail_ext="$avail_ext $xxx" ;;
20550                     esac
20551                     ;;
20552                 esac
20553                 ;;
20554         ODBM_File|odbm_fil) 
20555                 case "${i_dbm}${i_rpcsvcdbm}" in
20556                 *"${define}"*)
20557                     case "$osname-$use64bitint" in
20558                     hpux-define)
20559                         case "$libs" in
20560                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20561                         esac
20562                         ;;
20563                     *) avail_ext="$avail_ext $xxx" ;;
20564                     esac
20565                     ;;
20566                 esac
20567                 ;;
20568         POSIX|posix)
20569                 case "$useposix" in
20570                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20571                 esac
20572                 ;;
20573         Opcode|opcode)
20574                 case "$useopcode" in
20575                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20576                 esac
20577                 ;;
20578         Socket|socket)
20579                 case "$d_socket" in 
20580                 true|$define|y)
20581                     case "$osname" in
20582                     beos) ;; # not unless BONE
20583                     *) avail_ext="$avail_ext $xxx" ;;
20584                     esac
20585                     ;;
20586                 esac
20587                 ;;
20588         Sys/Syslog|sys/syslog)
20589                 : XXX syslog requires socket
20590                 case "$d_socket" in 
20591                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20592                 esac
20593                 ;;
20594         Thread|thread)
20595                 case "$usethreads" in
20596                 true|$define|y)
20597                         case "$useithreads" in
20598                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20599                         esac
20600                 esac
20601                 ;;
20602         XS/APItest|xs/apitest)
20603                 # This is just for testing.  Skip it unless we have dynamic loading.
20604
20605                 case "$usedl" in
20606                 $define) avail_ext="$avail_ext $xxx" ;;
20607                 esac
20608                 ;;
20609         XS/Typemap|xs/typemap)
20610                 # This is just for testing.  Skip it unless we have dynamic loading.
20611                 case "$usedl" in
20612                 $define) avail_ext="$avail_ext $xxx" ;;
20613                 esac
20614                 ;;
20615         threads|threads/shared)
20616                 # threads and threads::shared are special cases.
20617                 # To stop people from asking "Perl 5.8.0 was supposed
20618                 # to have this new fancy threads implementation but my
20619                 # perl doesn't have it" and from people trying to
20620                 # (re)install the threads module using CPAN.pm and
20621                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20622                 # the threads.pm and threads/shared.pm will always be
20623                 # there, croaking informatively ("you need to rebuild
20624                 # all of Perl with threads, sorry") when threads haven't
20625                 # been compiled in.
20626                 # --jhi
20627                 avail_ext="$avail_ext $xxx"
20628                 ;;
20629         IPC/SysV|ipc/sysv)
20630                 : XXX Do we need a useipcsysv variable here
20631                 case "${d_msg}${d_sem}${d_shm}" in 
20632                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20633                 esac
20634                 ;;
20635         *)      avail_ext="$avail_ext $xxx"
20636                 ;;
20637         esac
20638 done
20639
20640 set X $avail_ext
20641 shift
20642 avail_ext="$*"
20643
20644 case "$onlyextensions" in
20645 '') ;;
20646 *)  keepextensions=''
20647     echo "You have requested that only certains extensions be included..." >&4
20648     for i in $onlyextensions; do
20649         case " $avail_ext " in
20650         *" $i "*)
20651             echo "Keeping extension $i."
20652             keepextensions="$keepextensions $i"
20653             ;;
20654         *) echo "Ignoring extension $i." ;;
20655         esac
20656     done
20657     avail_ext="$keepextensions"
20658     ;;
20659 esac
20660
20661 case "$noextensions" in
20662 '') ;;
20663 *)  keepextensions=''
20664     echo "You have requested that certain extensions be ignored..." >&4
20665     for i in $avail_ext; do
20666         case " $noextensions " in
20667         *" $i "*) echo "Ignoring extension $i." ;;
20668         *) echo "Keeping extension $i.";
20669            keepextensions="$keepextensions $i"
20670            ;;
20671         esac
20672     done
20673     avail_ext="$keepextensions"
20674     ;;
20675 esac
20676
20677 : Now see which nonxs extensions are supported on this system.
20678 : For now assume all are.
20679 nonxs_ext=''
20680 for xxx in $nonxs_extensions ; do
20681         case "$xxx" in
20682         *)      nonxs_ext="$nonxs_ext $xxx"
20683                 ;;
20684         esac
20685 done
20686
20687 set X $nonxs_ext
20688 shift
20689 nonxs_ext="$*"
20690
20691 case $usedl in
20692 $define)
20693         $cat <<EOM
20694 A number of extensions are supplied with $package.  You may choose to
20695 compile these extensions for dynamic loading (the default), compile
20696 them into the $package executable (static loading), or not include
20697 them at all.  Answer "none" to include no extensions.
20698 Note that DynaLoader is always built and need not be mentioned here.
20699
20700 EOM
20701         case "$dynamic_ext" in
20702         '')
20703                 : Exclude those listed in static_ext
20704                 dflt=''
20705                 for xxx in $avail_ext; do
20706                         case " $static_ext " in
20707                         *" $xxx "*) ;;
20708                         *) dflt="$dflt $xxx" ;;
20709                         esac
20710                 done
20711                 set X $dflt
20712                 shift
20713                 dflt="$*"
20714                 ;;
20715         *)      dflt="$dynamic_ext"
20716                 # Perhaps we are reusing an old out-of-date config.sh.
20717                 case "$hint" in
20718                 previous)
20719                         if test X"$dynamic_ext" != X"$avail_ext"; then
20720                                 $cat <<EOM
20721 NOTICE:  Your previous config.sh list may be incorrect. 
20722 The extensions now available to you are 
20723         ${avail_ext}
20724 but the default list from your previous config.sh is
20725         ${dynamic_ext} 
20726
20727 EOM
20728                         fi
20729                         ;;
20730                 esac
20731                 ;;
20732         esac
20733         case "$dflt" in
20734         '')     dflt=none;;
20735         esac
20736         rp="What extensions do you wish to load dynamically?"
20737         . ./myread
20738         case "$ans" in
20739         none) dynamic_ext=' ' ;;
20740         *) dynamic_ext="$ans" ;;
20741         esac
20742
20743         case "$static_ext" in
20744         '')
20745                 : Exclude those already listed in dynamic linking
20746                 dflt=''
20747                 for xxx in $avail_ext; do
20748                         case " $dynamic_ext " in
20749                         *" $xxx "*) ;;
20750                         *) dflt="$dflt $xxx" ;;
20751                         esac
20752                 done
20753                 set X $dflt
20754                 shift
20755                 dflt="$*"
20756                 ;;
20757         *)  dflt="$static_ext" 
20758                 ;;
20759         esac
20760
20761         case "$dflt" in
20762         '')     dflt=none;;
20763         esac
20764         rp="What extensions do you wish to load statically?"
20765         . ./myread
20766         case "$ans" in
20767         none) static_ext=' ' ;;
20768         *) static_ext="$ans" ;;
20769         esac
20770         ;;
20771 *)
20772         $cat <<EOM
20773 A number of extensions are supplied with $package.  Answer "none" 
20774 to include no extensions. 
20775 Note that DynaLoader is always built and need not be mentioned here.
20776
20777 EOM
20778         case "$static_ext" in
20779         '') dflt="$avail_ext" ;;
20780         *)      dflt="$static_ext"
20781                 # Perhaps we are reusing an old out-of-date config.sh.
20782                 case "$hint" in
20783                 previous)
20784                         if test X"$static_ext" != X"$avail_ext"; then
20785                                 $cat <<EOM
20786 NOTICE:  Your previous config.sh list may be incorrect. 
20787 The extensions now available to you are 
20788         ${avail_ext}
20789 but the default list from your previous config.sh is
20790         ${static_ext} 
20791
20792 EOM
20793                         fi
20794                         ;;
20795                 esac
20796                 ;;
20797         esac
20798         : Exclude those that are not xs extensions
20799         case "$dflt" in
20800         '')     dflt=none;;
20801         esac
20802         rp="What extensions do you wish to include?"
20803         . ./myread
20804         case "$ans" in
20805         none) static_ext=' ' ;;
20806         *) static_ext="$ans" ;;
20807         esac
20808         ;;
20809 esac
20810 #        
20811 # Encode is a special case.  If we are building Encode as a static
20812 # extension, we need to explicitly list its subextensions as well.
20813 # For other nested extensions, this is handled automatically by
20814 # the appropriate Makefile.PL.
20815 case " $static_ext " in
20816         *" Encode "*) # Add the subextensions of Encode
20817         cd "$rsrc/ext"
20818         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20819                 static_ext="$static_ext Encode/$xxx"
20820         done
20821         cd "$tdir"
20822         ;;
20823 esac
20824
20825 set X $dynamic_ext $static_ext $nonxs_ext
20826 shift
20827 extensions="$*"
20828
20829 # Sanity check:  We require an extension suitable for use with
20830 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20831 # should show up as failures in the test suite, but it's helpful to
20832 # catch them now.) The 'extensions' list is normally sorted
20833 # alphabetically, so we need to accept either
20834 #    DB_File ... Fcntl ... IO  ....
20835 # or something like
20836 #    Fcntl ... NDBM_File ... IO  ....
20837 case " $extensions"  in
20838 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20839 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20840 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20841 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20842    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20843    ;;
20844 esac
20845
20846 : Remove libraries needed only for extensions
20847 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20848 : The exception is SunOS 4.x, which needs them.
20849 case "${osname}X${osvers}" in
20850 sunos*X4*)
20851     perllibs="$libs"
20852     ;;
20853 *) case "$usedl" in
20854     $define|true|[yY]*)
20855             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20856             shift
20857             perllibs="$*"
20858             ;;
20859     *)  perllibs="$libs"
20860             ;;
20861     esac
20862     ;;
20863 esac
20864
20865 : Remove build directory name from cppstdin so it can be used from
20866 : either the present location or the final installed location.
20867 echo " "
20868 : Get out of the UU directory to get correct path name.
20869 cd ..
20870 case "$cppstdin" in
20871 `pwd`/cppstdin)
20872         echo "Stripping down cppstdin path name"
20873         cppstdin=cppstdin
20874         ;;
20875 esac
20876 cd UU
20877
20878 : end of configuration questions
20879 echo " "
20880 echo "End of configuration questions."
20881 echo " "
20882
20883 : back to where it started
20884 if test -d ../UU; then
20885         cd ..
20886 fi
20887
20888 : configuration may be patched via a 'config.arch' file
20889 if $test -f config.arch; then
20890         echo "I see a config.arch file, loading it."
20891         . ./config.arch
20892 fi
20893
20894 : configuration may be patched via a 'config.over' file
20895 if $test -f config.over; then
20896         echo " "
20897         dflt=y
20898         rp='I see a config.over file.  Do you wish to load it?'
20899         . UU/myread
20900         case "$ans" in
20901         n*) echo "OK, I'll ignore it.";;
20902         *)      . ./config.over
20903                 echo "Configuration override changes have been loaded."
20904                 ;;
20905         esac
20906 fi
20907
20908 : in case they want portability, strip down executable paths
20909 case "$d_portable" in
20910 "$define")
20911         echo " "
20912         echo "Stripping down executable paths..." >&4
20913         for file in $loclist $trylist; do
20914                 eval temp=\$$file
20915                 eval $file=`basename $temp`
20916         done
20917         ;;
20918 esac
20919
20920 : create config.sh file
20921 echo " "
20922 echo "Creating config.sh..." >&4
20923 $spitshell <<EOT >config.sh
20924 $startsh
20925 #
20926 # This file was produced by running the Configure script. It holds all the
20927 # definitions figured out by Configure. Should you modify one of these values,
20928 # do not forget to propagate your changes by running "Configure -der". You may
20929 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20930 #
20931
20932 # Package name      : $package
20933 # Source directory  : $src
20934 # Configuration time: $cf_time
20935 # Configured by     : $cf_by
20936 # Target system     : $myuname
20937
20938 Author='$Author'
20939 Date='$Date'
20940 Header='$Header'
20941 Id='$Id'
20942 Locker='$Locker'
20943 Log='$Log'
20944 Mcc='$Mcc'
20945 RCSfile='$RCSfile'
20946 Revision='$Revision'
20947 Source='$Source'
20948 State='$State'
20949 _a='$_a'
20950 _exe='$_exe'
20951 _o='$_o'
20952 afs='$afs'
20953 afsroot='$afsroot'
20954 alignbytes='$alignbytes'
20955 ansi2knr='$ansi2knr'
20956 aphostname='$aphostname'
20957 api_revision='$api_revision'
20958 api_subversion='$api_subversion'
20959 api_version='$api_version'
20960 api_versionstring='$api_versionstring'
20961 ar='$ar'
20962 archlib='$archlib'
20963 archlibexp='$archlibexp'
20964 archname64='$archname64'
20965 archname='$archname'
20966 archobjs='$archobjs'
20967 asctime_r_proto='$asctime_r_proto'
20968 awk='$awk'
20969 baserev='$baserev'
20970 bash='$bash'
20971 bin='$bin'
20972 binexp='$binexp'
20973 bison='$bison'
20974 byacc='$byacc'
20975 byteorder='$byteorder'
20976 c='$c'
20977 castflags='$castflags'
20978 cat='$cat'
20979 cc='$cc'
20980 cccdlflags='$cccdlflags'
20981 ccdlflags='$ccdlflags'
20982 ccflags='$ccflags'
20983 ccflags_uselargefiles='$ccflags_uselargefiles'
20984 ccname='$ccname'
20985 ccsymbols='$ccsymbols'
20986 ccversion='$ccversion'
20987 cf_by='$cf_by'
20988 cf_email='$cf_email'
20989 cf_time='$cf_time'
20990 charsize='$charsize'
20991 chgrp='$chgrp'
20992 chmod='$chmod'
20993 chown='$chown'
20994 clocktype='$clocktype'
20995 comm='$comm'
20996 compress='$compress'
20997 contains='$contains'
20998 cp='$cp'
20999 cpio='$cpio'
21000 cpp='$cpp'
21001 cpp_stuff='$cpp_stuff'
21002 cppccsymbols='$cppccsymbols'
21003 cppflags='$cppflags'
21004 cpplast='$cpplast'
21005 cppminus='$cppminus'
21006 cpprun='$cpprun'
21007 cppstdin='$cppstdin'
21008 cppsymbols='$cppsymbols'
21009 crypt_r_proto='$crypt_r_proto'
21010 cryptlib='$cryptlib'
21011 csh='$csh'
21012 ctermid_r_proto='$ctermid_r_proto'
21013 ctime_r_proto='$ctime_r_proto'
21014 d_Gconvert='$d_Gconvert'
21015 d_PRIEUldbl='$d_PRIEUldbl'
21016 d_PRIFUldbl='$d_PRIFUldbl'
21017 d_PRIGUldbl='$d_PRIGUldbl'
21018 d_PRIXU64='$d_PRIXU64'
21019 d_PRId64='$d_PRId64'
21020 d_PRIeldbl='$d_PRIeldbl'
21021 d_PRIfldbl='$d_PRIfldbl'
21022 d_PRIgldbl='$d_PRIgldbl'
21023 d_PRIi64='$d_PRIi64'
21024 d_PRIo64='$d_PRIo64'
21025 d_PRIu64='$d_PRIu64'
21026 d_PRIx64='$d_PRIx64'
21027 d_SCNfldbl='$d_SCNfldbl'
21028 d__fwalk='$d__fwalk'
21029 d_access='$d_access'
21030 d_accessx='$d_accessx'
21031 d_aintl='$d_aintl'
21032 d_alarm='$d_alarm'
21033 d_archlib='$d_archlib'
21034 d_asctime_r='$d_asctime_r'
21035 d_atolf='$d_atolf'
21036 d_atoll='$d_atoll'
21037 d_attribute_format='$d_attribute_format'
21038 d_attribute_malloc='$d_attribute_malloc'
21039 d_attribute_nonnull='$d_attribute_nonnull'
21040 d_attribute_noreturn='$d_attribute_noreturn'
21041 d_attribute_pure='$d_attribute_pure'
21042 d_attribute_unused='$d_attribute_unused'
21043 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21044 d_bcmp='$d_bcmp'
21045 d_bcopy='$d_bcopy'
21046 d_bsd='$d_bsd'
21047 d_bsdgetpgrp='$d_bsdgetpgrp'
21048 d_bsdsetpgrp='$d_bsdsetpgrp'
21049 d_bzero='$d_bzero'
21050 d_casti32='$d_casti32'
21051 d_castneg='$d_castneg'
21052 d_charvspr='$d_charvspr'
21053 d_chown='$d_chown'
21054 d_chroot='$d_chroot'
21055 d_chsize='$d_chsize'
21056 d_class='$d_class'
21057 d_clearenv='$d_clearenv'
21058 d_closedir='$d_closedir'
21059 d_cmsghdr_s='$d_cmsghdr_s'
21060 d_const='$d_const'
21061 d_copysignl='$d_copysignl'
21062 d_crypt='$d_crypt'
21063 d_crypt_r='$d_crypt_r'
21064 d_csh='$d_csh'
21065 d_ctermid_r='$d_ctermid_r'
21066 d_ctime_r='$d_ctime_r'
21067 d_cuserid='$d_cuserid'
21068 d_dbl_dig='$d_dbl_dig'
21069 d_dbminitproto='$d_dbminitproto'
21070 d_difftime='$d_difftime'
21071 d_dirfd='$d_dirfd'
21072 d_dirnamlen='$d_dirnamlen'
21073 d_dlerror='$d_dlerror'
21074 d_dlopen='$d_dlopen'
21075 d_dlsymun='$d_dlsymun'
21076 d_dosuid='$d_dosuid'
21077 d_drand48_r='$d_drand48_r'
21078 d_drand48proto='$d_drand48proto'
21079 d_dup2='$d_dup2'
21080 d_eaccess='$d_eaccess'
21081 d_endgrent='$d_endgrent'
21082 d_endgrent_r='$d_endgrent_r'
21083 d_endhent='$d_endhent'
21084 d_endhostent_r='$d_endhostent_r'
21085 d_endnent='$d_endnent'
21086 d_endnetent_r='$d_endnetent_r'
21087 d_endpent='$d_endpent'
21088 d_endprotoent_r='$d_endprotoent_r'
21089 d_endpwent='$d_endpwent'
21090 d_endpwent_r='$d_endpwent_r'
21091 d_endsent='$d_endsent'
21092 d_endservent_r='$d_endservent_r'
21093 d_eofnblk='$d_eofnblk'
21094 d_eunice='$d_eunice'
21095 d_faststdio='$d_faststdio'
21096 d_fchdir='$d_fchdir'
21097 d_fchmod='$d_fchmod'
21098 d_fchown='$d_fchown'
21099 d_fcntl='$d_fcntl'
21100 d_fcntl_can_lock='$d_fcntl_can_lock'
21101 d_fd_macros='$d_fd_macros'
21102 d_fd_set='$d_fd_set'
21103 d_fds_bits='$d_fds_bits'
21104 d_fgetpos='$d_fgetpos'
21105 d_finite='$d_finite'
21106 d_finitel='$d_finitel'
21107 d_flexfnam='$d_flexfnam'
21108 d_flock='$d_flock'
21109 d_flockproto='$d_flockproto'
21110 d_fork='$d_fork'
21111 d_fp_class='$d_fp_class'
21112 d_fpathconf='$d_fpathconf'
21113 d_fpclass='$d_fpclass'
21114 d_fpclassify='$d_fpclassify'
21115 d_fpclassl='$d_fpclassl'
21116 d_fpos64_t='$d_fpos64_t'
21117 d_frexpl='$d_frexpl'
21118 d_fs_data_s='$d_fs_data_s'
21119 d_fseeko='$d_fseeko'
21120 d_fsetpos='$d_fsetpos'
21121 d_fstatfs='$d_fstatfs'
21122 d_fstatvfs='$d_fstatvfs'
21123 d_fsync='$d_fsync'
21124 d_ftello='$d_ftello'
21125 d_ftime='$d_ftime'
21126 d_getcwd='$d_getcwd'
21127 d_getespwnam='$d_getespwnam'
21128 d_getfsstat='$d_getfsstat'
21129 d_getgrent='$d_getgrent'
21130 d_getgrent_r='$d_getgrent_r'
21131 d_getgrgid_r='$d_getgrgid_r'
21132 d_getgrnam_r='$d_getgrnam_r'
21133 d_getgrps='$d_getgrps'
21134 d_gethbyaddr='$d_gethbyaddr'
21135 d_gethbyname='$d_gethbyname'
21136 d_gethent='$d_gethent'
21137 d_gethname='$d_gethname'
21138 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21139 d_gethostbyname_r='$d_gethostbyname_r'
21140 d_gethostent_r='$d_gethostent_r'
21141 d_gethostprotos='$d_gethostprotos'
21142 d_getitimer='$d_getitimer'
21143 d_getlogin='$d_getlogin'
21144 d_getlogin_r='$d_getlogin_r'
21145 d_getmnt='$d_getmnt'
21146 d_getmntent='$d_getmntent'
21147 d_getnbyaddr='$d_getnbyaddr'
21148 d_getnbyname='$d_getnbyname'
21149 d_getnent='$d_getnent'
21150 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21151 d_getnetbyname_r='$d_getnetbyname_r'
21152 d_getnetent_r='$d_getnetent_r'
21153 d_getnetprotos='$d_getnetprotos'
21154 d_getpagsz='$d_getpagsz'
21155 d_getpbyname='$d_getpbyname'
21156 d_getpbynumber='$d_getpbynumber'
21157 d_getpent='$d_getpent'
21158 d_getpgid='$d_getpgid'
21159 d_getpgrp2='$d_getpgrp2'
21160 d_getpgrp='$d_getpgrp'
21161 d_getppid='$d_getppid'
21162 d_getprior='$d_getprior'
21163 d_getprotobyname_r='$d_getprotobyname_r'
21164 d_getprotobynumber_r='$d_getprotobynumber_r'
21165 d_getprotoent_r='$d_getprotoent_r'
21166 d_getprotoprotos='$d_getprotoprotos'
21167 d_getprpwnam='$d_getprpwnam'
21168 d_getpwent='$d_getpwent'
21169 d_getpwent_r='$d_getpwent_r'
21170 d_getpwnam_r='$d_getpwnam_r'
21171 d_getpwuid_r='$d_getpwuid_r'
21172 d_getsbyname='$d_getsbyname'
21173 d_getsbyport='$d_getsbyport'
21174 d_getsent='$d_getsent'
21175 d_getservbyname_r='$d_getservbyname_r'
21176 d_getservbyport_r='$d_getservbyport_r'
21177 d_getservent_r='$d_getservent_r'
21178 d_getservprotos='$d_getservprotos'
21179 d_getspnam='$d_getspnam'
21180 d_getspnam_r='$d_getspnam_r'
21181 d_gettimeod='$d_gettimeod'
21182 d_gmtime_r='$d_gmtime_r'
21183 d_gnulibc='$d_gnulibc'
21184 d_grpasswd='$d_grpasswd'
21185 d_hasmntopt='$d_hasmntopt'
21186 d_htonl='$d_htonl'
21187 d_ilogbl='$d_ilogbl'
21188 d_index='$d_index'
21189 d_inetaton='$d_inetaton'
21190 d_int64_t='$d_int64_t'
21191 d_isascii='$d_isascii'
21192 d_isfinite='$d_isfinite'
21193 d_isinf='$d_isinf'
21194 d_isnan='$d_isnan'
21195 d_isnanl='$d_isnanl'
21196 d_killpg='$d_killpg'
21197 d_lchown='$d_lchown'
21198 d_ldbl_dig='$d_ldbl_dig'
21199 d_libm_lib_version='$d_libm_lib_version'
21200 d_link='$d_link'
21201 d_localtime_r='$d_localtime_r'
21202 d_locconv='$d_locconv'
21203 d_lockf='$d_lockf'
21204 d_longdbl='$d_longdbl'
21205 d_longlong='$d_longlong'
21206 d_lseekproto='$d_lseekproto'
21207 d_lstat='$d_lstat'
21208 d_madvise='$d_madvise'
21209 d_malloc_good_size='$d_malloc_good_size'
21210 d_malloc_size='$d_malloc_size'
21211 d_mblen='$d_mblen'
21212 d_mbstowcs='$d_mbstowcs'
21213 d_mbtowc='$d_mbtowc'
21214 d_memchr='$d_memchr'
21215 d_memcmp='$d_memcmp'
21216 d_memcpy='$d_memcpy'
21217 d_memmove='$d_memmove'
21218 d_memset='$d_memset'
21219 d_mkdir='$d_mkdir'
21220 d_mkdtemp='$d_mkdtemp'
21221 d_mkfifo='$d_mkfifo'
21222 d_mkstemp='$d_mkstemp'
21223 d_mkstemps='$d_mkstemps'
21224 d_mktime='$d_mktime'
21225 d_mmap='$d_mmap'
21226 d_modfl='$d_modfl'
21227 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21228 d_modflproto='$d_modflproto'
21229 d_mprotect='$d_mprotect'
21230 d_msg='$d_msg'
21231 d_msg_ctrunc='$d_msg_ctrunc'
21232 d_msg_dontroute='$d_msg_dontroute'
21233 d_msg_oob='$d_msg_oob'
21234 d_msg_peek='$d_msg_peek'
21235 d_msg_proxy='$d_msg_proxy'
21236 d_msgctl='$d_msgctl'
21237 d_msgget='$d_msgget'
21238 d_msghdr_s='$d_msghdr_s'
21239 d_msgrcv='$d_msgrcv'
21240 d_msgsnd='$d_msgsnd'
21241 d_msync='$d_msync'
21242 d_munmap='$d_munmap'
21243 d_mymalloc='$d_mymalloc'
21244 d_nice='$d_nice'
21245 d_nl_langinfo='$d_nl_langinfo'
21246 d_nv_preserves_uv='$d_nv_preserves_uv'
21247 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21248 d_off64_t='$d_off64_t'
21249 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21250 d_oldpthreads='$d_oldpthreads'
21251 d_oldsock='$d_oldsock'
21252 d_open3='$d_open3'
21253 d_pathconf='$d_pathconf'
21254 d_pause='$d_pause'
21255 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21256 d_phostname='$d_phostname'
21257 d_pipe='$d_pipe'
21258 d_poll='$d_poll'
21259 d_portable='$d_portable'
21260 d_procselfexe='$d_procselfexe'
21261 d_pthread_atfork='$d_pthread_atfork'
21262 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21263 d_pthread_yield='$d_pthread_yield'
21264 d_pwage='$d_pwage'
21265 d_pwchange='$d_pwchange'
21266 d_pwclass='$d_pwclass'
21267 d_pwcomment='$d_pwcomment'
21268 d_pwexpire='$d_pwexpire'
21269 d_pwgecos='$d_pwgecos'
21270 d_pwpasswd='$d_pwpasswd'
21271 d_pwquota='$d_pwquota'
21272 d_qgcvt='$d_qgcvt'
21273 d_quad='$d_quad'
21274 d_random_r='$d_random_r'
21275 d_readdir64_r='$d_readdir64_r'
21276 d_readdir='$d_readdir'
21277 d_readdir_r='$d_readdir_r'
21278 d_readlink='$d_readlink'
21279 d_readv='$d_readv'
21280 d_recvmsg='$d_recvmsg'
21281 d_rename='$d_rename'
21282 d_rewinddir='$d_rewinddir'
21283 d_rmdir='$d_rmdir'
21284 d_safebcpy='$d_safebcpy'
21285 d_safemcpy='$d_safemcpy'
21286 d_sanemcmp='$d_sanemcmp'
21287 d_sbrkproto='$d_sbrkproto'
21288 d_scalbnl='$d_scalbnl'
21289 d_sched_yield='$d_sched_yield'
21290 d_scm_rights='$d_scm_rights'
21291 d_seekdir='$d_seekdir'
21292 d_select='$d_select'
21293 d_sem='$d_sem'
21294 d_semctl='$d_semctl'
21295 d_semctl_semid_ds='$d_semctl_semid_ds'
21296 d_semctl_semun='$d_semctl_semun'
21297 d_semget='$d_semget'
21298 d_semop='$d_semop'
21299 d_sendmsg='$d_sendmsg'
21300 d_setegid='$d_setegid'
21301 d_seteuid='$d_seteuid'
21302 d_setgrent='$d_setgrent'
21303 d_setgrent_r='$d_setgrent_r'
21304 d_setgrps='$d_setgrps'
21305 d_sethent='$d_sethent'
21306 d_sethostent_r='$d_sethostent_r'
21307 d_setitimer='$d_setitimer'
21308 d_setlinebuf='$d_setlinebuf'
21309 d_setlocale='$d_setlocale'
21310 d_setlocale_r='$d_setlocale_r'
21311 d_setnent='$d_setnent'
21312 d_setnetent_r='$d_setnetent_r'
21313 d_setpent='$d_setpent'
21314 d_setpgid='$d_setpgid'
21315 d_setpgrp2='$d_setpgrp2'
21316 d_setpgrp='$d_setpgrp'
21317 d_setprior='$d_setprior'
21318 d_setproctitle='$d_setproctitle'
21319 d_setprotoent_r='$d_setprotoent_r'
21320 d_setpwent='$d_setpwent'
21321 d_setpwent_r='$d_setpwent_r'
21322 d_setregid='$d_setregid'
21323 d_setresgid='$d_setresgid'
21324 d_setresuid='$d_setresuid'
21325 d_setreuid='$d_setreuid'
21326 d_setrgid='$d_setrgid'
21327 d_setruid='$d_setruid'
21328 d_setsent='$d_setsent'
21329 d_setservent_r='$d_setservent_r'
21330 d_setsid='$d_setsid'
21331 d_setvbuf='$d_setvbuf'
21332 d_sfio='$d_sfio'
21333 d_shm='$d_shm'
21334 d_shmat='$d_shmat'
21335 d_shmatprototype='$d_shmatprototype'
21336 d_shmctl='$d_shmctl'
21337 d_shmdt='$d_shmdt'
21338 d_shmget='$d_shmget'
21339 d_sigaction='$d_sigaction'
21340 d_sigprocmask='$d_sigprocmask'
21341 d_sigsetjmp='$d_sigsetjmp'
21342 d_sockatmark='$d_sockatmark'
21343 d_sockatmarkproto='$d_sockatmarkproto'
21344 d_socket='$d_socket'
21345 d_socklen_t='$d_socklen_t'
21346 d_sockpair='$d_sockpair'
21347 d_socks5_init='$d_socks5_init'
21348 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21349 d_sqrtl='$d_sqrtl'
21350 d_srand48_r='$d_srand48_r'
21351 d_srandom_r='$d_srandom_r'
21352 d_sresgproto='$d_sresgproto'
21353 d_sresuproto='$d_sresuproto'
21354 d_statblks='$d_statblks'
21355 d_statfs_f_flags='$d_statfs_f_flags'
21356 d_statfs_s='$d_statfs_s'
21357 d_statvfs='$d_statvfs'
21358 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21359 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21360 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21361 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21362 d_stdio_stream_array='$d_stdio_stream_array'
21363 d_stdiobase='$d_stdiobase'
21364 d_stdstdio='$d_stdstdio'
21365 d_strchr='$d_strchr'
21366 d_strcoll='$d_strcoll'
21367 d_strctcpy='$d_strctcpy'
21368 d_strerrm='$d_strerrm'
21369 d_strerror='$d_strerror'
21370 d_strerror_r='$d_strerror_r'
21371 d_strftime='$d_strftime'
21372 d_strlcat='$d_strlcat'
21373 d_strlcpy='$d_strlcpy'
21374 d_strtod='$d_strtod'
21375 d_strtol='$d_strtol'
21376 d_strtold='$d_strtold'
21377 d_strtoll='$d_strtoll'
21378 d_strtoq='$d_strtoq'
21379 d_strtoul='$d_strtoul'
21380 d_strtoull='$d_strtoull'
21381 d_strtouq='$d_strtouq'
21382 d_strxfrm='$d_strxfrm'
21383 d_suidsafe='$d_suidsafe'
21384 d_symlink='$d_symlink'
21385 d_syscall='$d_syscall'
21386 d_syscallproto='$d_syscallproto'
21387 d_sysconf='$d_sysconf'
21388 d_sysernlst='$d_sysernlst'
21389 d_syserrlst='$d_syserrlst'
21390 d_system='$d_system'
21391 d_tcgetpgrp='$d_tcgetpgrp'
21392 d_tcsetpgrp='$d_tcsetpgrp'
21393 d_telldir='$d_telldir'
21394 d_telldirproto='$d_telldirproto'
21395 d_time='$d_time'
21396 d_times='$d_times'
21397 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21398 d_tm_tm_zone='$d_tm_tm_zone'
21399 d_tmpnam_r='$d_tmpnam_r'
21400 d_truncate='$d_truncate'
21401 d_ttyname_r='$d_ttyname_r'
21402 d_tzname='$d_tzname'
21403 d_u32align='$d_u32align'
21404 d_ualarm='$d_ualarm'
21405 d_umask='$d_umask'
21406 d_uname='$d_uname'
21407 d_union_semun='$d_union_semun'
21408 d_unordered='$d_unordered'
21409 d_unsetenv='$d_unsetenv'
21410 d_usleep='$d_usleep'
21411 d_usleepproto='$d_usleepproto'
21412 d_ustat='$d_ustat'
21413 d_vendorarch='$d_vendorarch'
21414 d_vendorbin='$d_vendorbin'
21415 d_vendorlib='$d_vendorlib'
21416 d_vendorscript='$d_vendorscript'
21417 d_vfork='$d_vfork'
21418 d_void_closedir='$d_void_closedir'
21419 d_voidsig='$d_voidsig'
21420 d_voidtty='$d_voidtty'
21421 d_volatile='$d_volatile'
21422 d_vprintf='$d_vprintf'
21423 d_wait4='$d_wait4'
21424 d_waitpid='$d_waitpid'
21425 d_wcstombs='$d_wcstombs'
21426 d_wctomb='$d_wctomb'
21427 d_writev='$d_writev'
21428 d_xenix='$d_xenix'
21429 date='$date'
21430 db_hashtype='$db_hashtype'
21431 db_prefixtype='$db_prefixtype'
21432 db_version_major='$db_version_major'
21433 db_version_minor='$db_version_minor'
21434 db_version_patch='$db_version_patch'
21435 defvoidused='$defvoidused'
21436 direntrytype='$direntrytype'
21437 dlext='$dlext'
21438 dlsrc='$dlsrc'
21439 doublesize='$doublesize'
21440 drand01='$drand01'
21441 drand48_r_proto='$drand48_r_proto'
21442 dynamic_ext='$dynamic_ext'
21443 eagain='$eagain'
21444 ebcdic='$ebcdic'
21445 echo='$echo'
21446 egrep='$egrep'
21447 emacs='$emacs'
21448 endgrent_r_proto='$endgrent_r_proto'
21449 endhostent_r_proto='$endhostent_r_proto'
21450 endnetent_r_proto='$endnetent_r_proto'
21451 endprotoent_r_proto='$endprotoent_r_proto'
21452 endpwent_r_proto='$endpwent_r_proto'
21453 endservent_r_proto='$endservent_r_proto'
21454 eunicefix='$eunicefix'
21455 exe_ext='$exe_ext'
21456 expr='$expr'
21457 extensions='$extensions'
21458 extras='$extras'
21459 fflushNULL='$fflushNULL'
21460 fflushall='$fflushall'
21461 find='$find'
21462 firstmakefile='$firstmakefile'
21463 flex='$flex'
21464 fpossize='$fpossize'
21465 fpostype='$fpostype'
21466 freetype='$freetype'
21467 from='$from'
21468 full_ar='$full_ar'
21469 full_csh='$full_csh'
21470 full_sed='$full_sed'
21471 gccansipedantic='$gccansipedantic'
21472 gccosandvers='$gccosandvers'
21473 gccversion='$gccversion'
21474 getgrent_r_proto='$getgrent_r_proto'
21475 getgrgid_r_proto='$getgrgid_r_proto'
21476 getgrnam_r_proto='$getgrnam_r_proto'
21477 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21478 gethostbyname_r_proto='$gethostbyname_r_proto'
21479 gethostent_r_proto='$gethostent_r_proto'
21480 getlogin_r_proto='$getlogin_r_proto'
21481 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21482 getnetbyname_r_proto='$getnetbyname_r_proto'
21483 getnetent_r_proto='$getnetent_r_proto'
21484 getprotobyname_r_proto='$getprotobyname_r_proto'
21485 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21486 getprotoent_r_proto='$getprotoent_r_proto'
21487 getpwent_r_proto='$getpwent_r_proto'
21488 getpwnam_r_proto='$getpwnam_r_proto'
21489 getpwuid_r_proto='$getpwuid_r_proto'
21490 getservbyname_r_proto='$getservbyname_r_proto'
21491 getservbyport_r_proto='$getservbyport_r_proto'
21492 getservent_r_proto='$getservent_r_proto'
21493 getspnam_r_proto='$getspnam_r_proto'
21494 gidformat='$gidformat'
21495 gidsign='$gidsign'
21496 gidsize='$gidsize'
21497 gidtype='$gidtype'
21498 glibpth='$glibpth'
21499 gmake='$gmake'
21500 gmtime_r_proto='$gmtime_r_proto'
21501 gnulibc_version='$gnulibc_version'
21502 grep='$grep'
21503 groupcat='$groupcat'
21504 groupstype='$groupstype'
21505 gzip='$gzip'
21506 h_fcntl='$h_fcntl'
21507 h_sysfile='$h_sysfile'
21508 hint='$hint'
21509 hostcat='$hostcat'
21510 html1dir='$html1dir'
21511 html1direxp='$html1direxp'
21512 html3dir='$html3dir'
21513 html3direxp='$html3direxp'
21514 i16size='$i16size'
21515 i16type='$i16type'
21516 i32size='$i32size'
21517 i32type='$i32type'
21518 i64size='$i64size'
21519 i64type='$i64type'
21520 i8size='$i8size'
21521 i8type='$i8type'
21522 i_arpainet='$i_arpainet'
21523 i_bsdioctl='$i_bsdioctl'
21524 i_crypt='$i_crypt'
21525 i_db='$i_db'
21526 i_dbm='$i_dbm'
21527 i_dirent='$i_dirent'
21528 i_dld='$i_dld'
21529 i_dlfcn='$i_dlfcn'
21530 i_fcntl='$i_fcntl'
21531 i_float='$i_float'
21532 i_fp='$i_fp'
21533 i_fp_class='$i_fp_class'
21534 i_gdbm='$i_gdbm'
21535 i_grp='$i_grp'
21536 i_ieeefp='$i_ieeefp'
21537 i_inttypes='$i_inttypes'
21538 i_langinfo='$i_langinfo'
21539 i_libutil='$i_libutil'
21540 i_limits='$i_limits'
21541 i_locale='$i_locale'
21542 i_machcthr='$i_machcthr'
21543 i_malloc='$i_malloc'
21544 i_math='$i_math'
21545 i_memory='$i_memory'
21546 i_mntent='$i_mntent'
21547 i_ndbm='$i_ndbm'
21548 i_netdb='$i_netdb'
21549 i_neterrno='$i_neterrno'
21550 i_netinettcp='$i_netinettcp'
21551 i_niin='$i_niin'
21552 i_poll='$i_poll'
21553 i_prot='$i_prot'
21554 i_pthread='$i_pthread'
21555 i_pwd='$i_pwd'
21556 i_rpcsvcdbm='$i_rpcsvcdbm'
21557 i_sfio='$i_sfio'
21558 i_sgtty='$i_sgtty'
21559 i_shadow='$i_shadow'
21560 i_socks='$i_socks'
21561 i_stdarg='$i_stdarg'
21562 i_stddef='$i_stddef'
21563 i_stdlib='$i_stdlib'
21564 i_string='$i_string'
21565 i_sunmath='$i_sunmath'
21566 i_sysaccess='$i_sysaccess'
21567 i_sysdir='$i_sysdir'
21568 i_sysfile='$i_sysfile'
21569 i_sysfilio='$i_sysfilio'
21570 i_sysin='$i_sysin'
21571 i_sysioctl='$i_sysioctl'
21572 i_syslog='$i_syslog'
21573 i_sysmman='$i_sysmman'
21574 i_sysmode='$i_sysmode'
21575 i_sysmount='$i_sysmount'
21576 i_sysndir='$i_sysndir'
21577 i_sysparam='$i_sysparam'
21578 i_sysresrc='$i_sysresrc'
21579 i_syssecrt='$i_syssecrt'
21580 i_sysselct='$i_sysselct'
21581 i_syssockio='$i_syssockio'
21582 i_sysstat='$i_sysstat'
21583 i_sysstatfs='$i_sysstatfs'
21584 i_sysstatvfs='$i_sysstatvfs'
21585 i_systime='$i_systime'
21586 i_systimek='$i_systimek'
21587 i_systimes='$i_systimes'
21588 i_systypes='$i_systypes'
21589 i_sysuio='$i_sysuio'
21590 i_sysun='$i_sysun'
21591 i_sysutsname='$i_sysutsname'
21592 i_sysvfs='$i_sysvfs'
21593 i_syswait='$i_syswait'
21594 i_termio='$i_termio'
21595 i_termios='$i_termios'
21596 i_time='$i_time'
21597 i_unistd='$i_unistd'
21598 i_ustat='$i_ustat'
21599 i_utime='$i_utime'
21600 i_values='$i_values'
21601 i_varargs='$i_varargs'
21602 i_varhdr='$i_varhdr'
21603 i_vfork='$i_vfork'
21604 ignore_versioned_solibs='$ignore_versioned_solibs'
21605 inc_version_list='$inc_version_list'
21606 inc_version_list_init='$inc_version_list_init'
21607 incpath='$incpath'
21608 inews='$inews'
21609 installarchlib='$installarchlib'
21610 installbin='$installbin'
21611 installhtml1dir='$installhtml1dir'
21612 installhtml3dir='$installhtml3dir'
21613 installman1dir='$installman1dir'
21614 installman3dir='$installman3dir'
21615 installprefix='$installprefix'
21616 installprefixexp='$installprefixexp'
21617 installprivlib='$installprivlib'
21618 installscript='$installscript'
21619 installsitearch='$installsitearch'
21620 installsitebin='$installsitebin'
21621 installsitehtml1dir='$installsitehtml1dir'
21622 installsitehtml3dir='$installsitehtml3dir'
21623 installsitelib='$installsitelib'
21624 installsiteman1dir='$installsiteman1dir'
21625 installsiteman3dir='$installsiteman3dir'
21626 installsitescript='$installsitescript'
21627 installstyle='$installstyle'
21628 installusrbinperl='$installusrbinperl'
21629 installvendorarch='$installvendorarch'
21630 installvendorbin='$installvendorbin'
21631 installvendorhtml1dir='$installvendorhtml1dir'
21632 installvendorhtml3dir='$installvendorhtml3dir'
21633 installvendorlib='$installvendorlib'
21634 installvendorman1dir='$installvendorman1dir'
21635 installvendorman3dir='$installvendorman3dir'
21636 installvendorscript='$installvendorscript'
21637 intsize='$intsize'
21638 issymlink='$issymlink'
21639 ivdformat='$ivdformat'
21640 ivsize='$ivsize'
21641 ivtype='$ivtype'
21642 known_extensions='$known_extensions'
21643 ksh='$ksh'
21644 ld='$ld'
21645 lddlflags='$lddlflags'
21646 ldflags='$ldflags'
21647 ldflags_uselargefiles='$ldflags_uselargefiles'
21648 ldlibpthname='$ldlibpthname'
21649 less='$less'
21650 lib_ext='$lib_ext'
21651 libc='$libc'
21652 libperl='$libperl'
21653 libpth='$libpth'
21654 libs='$libs'
21655 libsdirs='$libsdirs'
21656 libsfiles='$libsfiles'
21657 libsfound='$libsfound'
21658 libspath='$libspath'
21659 libswanted='$libswanted'
21660 libswanted_uselargefiles='$libswanted_uselargefiles'
21661 line='$line'
21662 lint='$lint'
21663 lkflags='$lkflags'
21664 ln='$ln'
21665 lns='$lns'
21666 localtime_r_proto='$localtime_r_proto'
21667 locincpth='$locincpth'
21668 loclibpth='$loclibpth'
21669 longdblsize='$longdblsize'
21670 longlongsize='$longlongsize'
21671 longsize='$longsize'
21672 lp='$lp'
21673 lpr='$lpr'
21674 ls='$ls'
21675 lseeksize='$lseeksize'
21676 lseektype='$lseektype'
21677 mail='$mail'
21678 mailx='$mailx'
21679 make='$make'
21680 make_set_make='$make_set_make'
21681 mallocobj='$mallocobj'
21682 mallocsrc='$mallocsrc'
21683 malloctype='$malloctype'
21684 man1dir='$man1dir'
21685 man1direxp='$man1direxp'
21686 man1ext='$man1ext'
21687 man3dir='$man3dir'
21688 man3direxp='$man3direxp'
21689 man3ext='$man3ext'
21690 mips_type='$mips_type'
21691 mistrustnm='$mistrustnm'
21692 mkdir='$mkdir'
21693 mmaptype='$mmaptype'
21694 modetype='$modetype'
21695 more='$more'
21696 multiarch='$multiarch'
21697 mv='$mv'
21698 myarchname='$myarchname'
21699 mydomain='$mydomain'
21700 myhostname='$myhostname'
21701 myuname='$myuname'
21702 n='$n'
21703 need_va_copy='$need_va_copy'
21704 netdb_hlen_type='$netdb_hlen_type'
21705 netdb_host_type='$netdb_host_type'
21706 netdb_name_type='$netdb_name_type'
21707 netdb_net_type='$netdb_net_type'
21708 nm='$nm'
21709 nm_opt='$nm_opt'
21710 nm_so_opt='$nm_so_opt'
21711 nonxs_ext='$nonxs_ext'
21712 nroff='$nroff'
21713 nvEUformat='$nvEUformat'
21714 nvFUformat='$nvFUformat'
21715 nvGUformat='$nvGUformat'
21716 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21717 nveformat='$nveformat'
21718 nvfformat='$nvfformat'
21719 nvgformat='$nvgformat'
21720 nvsize='$nvsize'
21721 nvtype='$nvtype'
21722 o_nonblock='$o_nonblock'
21723 obj_ext='$obj_ext'
21724 old_pthread_create_joinable='$old_pthread_create_joinable'
21725 optimize='$optimize'
21726 orderlib='$orderlib'
21727 osname='$osname'
21728 osvers='$osvers'
21729 otherlibdirs='$otherlibdirs'
21730 package='$package'
21731 pager='$pager'
21732 passcat='$passcat'
21733 patchlevel='$patchlevel'
21734 path_sep='$path_sep'
21735 perl5='$perl5'
21736 perl='$perl'
21737 perl_patchlevel='$perl_patchlevel'
21738 perladmin='$perladmin'
21739 perllibs='$perllibs'
21740 perlpath='$perlpath'
21741 pg='$pg'
21742 phostname='$phostname'
21743 pidtype='$pidtype'
21744 plibpth='$plibpth'
21745 pmake='$pmake'
21746 pr='$pr'
21747 prefix='$prefix'
21748 prefixexp='$prefixexp'
21749 privlib='$privlib'
21750 privlibexp='$privlibexp'
21751 procselfexe='$procselfexe'
21752 prototype='$prototype'
21753 ptrsize='$ptrsize'
21754 quadkind='$quadkind'
21755 quadtype='$quadtype'
21756 randbits='$randbits'
21757 randfunc='$randfunc'
21758 random_r_proto='$random_r_proto'
21759 randseedtype='$randseedtype'
21760 ranlib='$ranlib'
21761 rd_nodata='$rd_nodata'
21762 readdir64_r_proto='$readdir64_r_proto'
21763 readdir_r_proto='$readdir_r_proto'
21764 revision='$revision'
21765 rm='$rm'
21766 rmail='$rmail'
21767 run='$run'
21768 runnm='$runnm'
21769 sPRIEUldbl='$sPRIEUldbl'
21770 sPRIFUldbl='$sPRIFUldbl'
21771 sPRIGUldbl='$sPRIGUldbl'
21772 sPRIXU64='$sPRIXU64'
21773 sPRId64='$sPRId64'
21774 sPRIeldbl='$sPRIeldbl'
21775 sPRIfldbl='$sPRIfldbl'
21776 sPRIgldbl='$sPRIgldbl'
21777 sPRIi64='$sPRIi64'
21778 sPRIo64='$sPRIo64'
21779 sPRIu64='$sPRIu64'
21780 sPRIx64='$sPRIx64'
21781 sSCNfldbl='$sSCNfldbl'
21782 sched_yield='$sched_yield'
21783 scriptdir='$scriptdir'
21784 scriptdirexp='$scriptdirexp'
21785 sed='$sed'
21786 seedfunc='$seedfunc'
21787 selectminbits='$selectminbits'
21788 selecttype='$selecttype'
21789 sendmail='$sendmail'
21790 setgrent_r_proto='$setgrent_r_proto'
21791 sethostent_r_proto='$sethostent_r_proto'
21792 setlocale_r_proto='$setlocale_r_proto'
21793 setnetent_r_proto='$setnetent_r_proto'
21794 setprotoent_r_proto='$setprotoent_r_proto'
21795 setpwent_r_proto='$setpwent_r_proto'
21796 setservent_r_proto='$setservent_r_proto'
21797 sh='$sh'
21798 shar='$shar'
21799 sharpbang='$sharpbang'
21800 shmattype='$shmattype'
21801 shortsize='$shortsize'
21802 shrpenv='$shrpenv'
21803 shsharp='$shsharp'
21804 sig_count='$sig_count'
21805 sig_name='$sig_name'
21806 sig_name_init='$sig_name_init'
21807 sig_num='$sig_num'
21808 sig_num_init='$sig_num_init'
21809 sig_size='$sig_size'
21810 signal_t='$signal_t'
21811 sitearch='$sitearch'
21812 sitearchexp='$sitearchexp'
21813 sitebin='$sitebin'
21814 sitebinexp='$sitebinexp'
21815 sitehtml1dir='$sitehtml1dir'
21816 sitehtml1direxp='$sitehtml1direxp'
21817 sitehtml3dir='$sitehtml3dir'
21818 sitehtml3direxp='$sitehtml3direxp'
21819 sitelib='$sitelib'
21820 sitelib_stem='$sitelib_stem'
21821 sitelibexp='$sitelibexp'
21822 siteman1dir='$siteman1dir'
21823 siteman1direxp='$siteman1direxp'
21824 siteman3dir='$siteman3dir'
21825 siteman3direxp='$siteman3direxp'
21826 siteprefix='$siteprefix'
21827 siteprefixexp='$siteprefixexp'
21828 sitescript='$sitescript'
21829 sitescriptexp='$sitescriptexp'
21830 sizesize='$sizesize'
21831 sizetype='$sizetype'
21832 sleep='$sleep'
21833 smail='$smail'
21834 so='$so'
21835 sockethdr='$sockethdr'
21836 socketlib='$socketlib'
21837 socksizetype='$socksizetype'
21838 sort='$sort'
21839 spackage='$spackage'
21840 spitshell='$spitshell'
21841 srand48_r_proto='$srand48_r_proto'
21842 srandom_r_proto='$srandom_r_proto'
21843 src='$src'
21844 ssizetype='$ssizetype'
21845 startperl='$startperl'
21846 startsh='$startsh'
21847 static_ext='$static_ext'
21848 stdchar='$stdchar'
21849 stdio_base='$stdio_base'
21850 stdio_bufsiz='$stdio_bufsiz'
21851 stdio_cnt='$stdio_cnt'
21852 stdio_filbuf='$stdio_filbuf'
21853 stdio_ptr='$stdio_ptr'
21854 stdio_stream_array='$stdio_stream_array'
21855 strerror_r_proto='$strerror_r_proto'
21856 strings='$strings'
21857 submit='$submit'
21858 subversion='$subversion'
21859 sysman='$sysman'
21860 tail='$tail'
21861 tar='$tar'
21862 targetarch='$targetarch'
21863 tbl='$tbl'
21864 tee='$tee'
21865 test='$test'
21866 timeincl='$timeincl'
21867 timetype='$timetype'
21868 tmpnam_r_proto='$tmpnam_r_proto'
21869 to='$to'
21870 touch='$touch'
21871 tr='$tr'
21872 trnl='$trnl'
21873 troff='$troff'
21874 ttyname_r_proto='$ttyname_r_proto'
21875 u16size='$u16size'
21876 u16type='$u16type'
21877 u32size='$u32size'
21878 u32type='$u32type'
21879 u64size='$u64size'
21880 u64type='$u64type'
21881 u8size='$u8size'
21882 u8type='$u8type'
21883 uidformat='$uidformat'
21884 uidsign='$uidsign'
21885 uidsize='$uidsize'
21886 uidtype='$uidtype'
21887 uname='$uname'
21888 uniq='$uniq'
21889 uquadtype='$uquadtype'
21890 use5005threads='$use5005threads'
21891 use64bitall='$use64bitall'
21892 use64bitint='$use64bitint'
21893 usecrosscompile='$usecrosscompile'
21894 usedl='$usedl'
21895 usefaststdio='$usefaststdio'
21896 useithreads='$useithreads'
21897 uselargefiles='$uselargefiles'
21898 uselongdouble='$uselongdouble'
21899 usemallocwrap='$usemallocwrap'
21900 usemorebits='$usemorebits'
21901 usemultiplicity='$usemultiplicity'
21902 usemymalloc='$usemymalloc'
21903 usenm='$usenm'
21904 useopcode='$useopcode'
21905 useperlio='$useperlio'
21906 useposix='$useposix'
21907 usereentrant='$usereentrant'
21908 userelocatableinc='$userelocatableinc'
21909 usesfio='$usesfio'
21910 useshrplib='$useshrplib'
21911 usesitecustomize='$usesitecustomize'
21912 usesocks='$usesocks'
21913 usethreads='$usethreads'
21914 usevendorprefix='$usevendorprefix'
21915 usevfork='$usevfork'
21916 usrinc='$usrinc'
21917 uuname='$uuname'
21918 uvXUformat='$uvXUformat'
21919 uvoformat='$uvoformat'
21920 uvsize='$uvsize'
21921 uvtype='$uvtype'
21922 uvuformat='$uvuformat'
21923 uvxformat='$uvxformat'
21924 vendorarch='$vendorarch'
21925 vendorarchexp='$vendorarchexp'
21926 vendorbin='$vendorbin'
21927 vendorbinexp='$vendorbinexp'
21928 vendorhtml1dir='$vendorhtml1dir'
21929 vendorhtml1direxp='$vendorhtml1direxp'
21930 vendorhtml3dir='$vendorhtml3dir'
21931 vendorhtml3direxp='$vendorhtml3direxp'
21932 vendorlib='$vendorlib'
21933 vendorlib_stem='$vendorlib_stem'
21934 vendorlibexp='$vendorlibexp'
21935 vendorman1dir='$vendorman1dir'
21936 vendorman1direxp='$vendorman1direxp'
21937 vendorman3dir='$vendorman3dir'
21938 vendorman3direxp='$vendorman3direxp'
21939 vendorprefix='$vendorprefix'
21940 vendorprefixexp='$vendorprefixexp'
21941 vendorscript='$vendorscript'
21942 vendorscriptexp='$vendorscriptexp'
21943 version='$version'
21944 version_patchlevel_string='$version_patchlevel_string'
21945 versiononly='$versiononly'
21946 vi='$vi'
21947 voidflags='$voidflags'
21948 xlibpth='$xlibpth'
21949 yacc='$yacc'
21950 yaccflags='$yaccflags'
21951 zcat='$zcat'
21952 zip='$zip'
21953 EOT
21954
21955 : Add in command line options if available
21956 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21957
21958 : add special variables
21959 $test -f $src/patchlevel.h && \
21960 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21961 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21962 echo "PERL_CONFIG_SH=true" >>config.sh
21963
21964 : propagate old symbols
21965 if $test -f UU/config.sh; then
21966         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21967         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21968         $sort | $uniq -u >UU/oldsyms
21969         set X `cat UU/oldsyms`
21970         shift
21971         case $# in
21972         0) ;;
21973         *)
21974                 cat <<EOM
21975 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21976 EOM
21977                 echo "# Variables propagated from previous config.sh file." >>config.sh
21978                 for sym in `cat UU/oldsyms`; do
21979                         echo "    Propagating $hint variable "'$'"$sym..."
21980                         eval 'tmp="$'"${sym}"'"'
21981                         echo "$tmp" | \
21982                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21983                 done
21984                 ;;
21985         esac
21986 fi
21987
21988 : Finish up by extracting the .SH files
21989 case "$alldone" in
21990 exit)
21991         $rm -rf UU
21992         echo "Extraction done."
21993         exit 0
21994         ;;
21995 cont)
21996         ;;
21997 '')
21998         dflt=''
21999         nostick=true
22000         $cat <<EOM
22001
22002 If you'd like to make any changes to the config.sh file before I begin
22003 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22004
22005 EOM
22006         rp="Press return or use a shell escape to edit config.sh:"
22007         . UU/myread
22008         nostick=''
22009         case "$ans" in
22010         '') ;;
22011         *) : in case they cannot read
22012                 sh 1>&4 -c "$ans";;
22013         esac
22014         ;;
22015 esac
22016
22017 : if this fails, just run all the .SH files by hand
22018 . ./config.sh
22019
22020 echo " "
22021 exec 1>&4
22022 pwd=`pwd`
22023 . ./UU/extract
22024 cd "$pwd"
22025
22026 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22027         dflt=y
22028         case "$silent" in
22029         true) ;;
22030         *)
22031                 $cat <<EOM
22032
22033 Now you need to generate make dependencies by running "$make depend".
22034 You might prefer to run it in background: "$make depend > makedepend.out &"
22035 It can take a while, so you might not want to run it right now.
22036
22037 EOM
22038                 ;;
22039         esac
22040         rp="Run $make depend now?"
22041         . UU/myread
22042         case "$ans" in
22043         y*)
22044                 $make depend && echo "Now you must run '$make'."
22045                 ;;
22046         *)
22047                 echo "You must run '$make depend' then '$make'."
22048                 ;;
22049         esac
22050 elif test -f [Mm]akefile; then
22051         echo " "
22052         echo "Now you must run a $make."
22053 else
22054         echo "Configure done."
22055 fi
22056
22057 if $test -f Policy.sh; then
22058     $cat <<EOM
22059
22060 If you compile $package on a different machine or from a different object
22061 directory, copy the Policy.sh file from this object directory to the
22062 new one before you run Configure -- this will help you with most of
22063 the policy defaults.
22064
22065 EOM
22066 fi
22067 if $test -f config.msg; then
22068     echo "Hmm.  I also noted the following information while running:"
22069     echo " "
22070     $cat config.msg >&4
22071     $rm -f config.msg
22072 fi
22073 $rm -f kit*isdone ark*isdone
22074 $rm -rf UU
22075
22076 : End of Configure
22077