This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(tentative) regcomp.c: try convincing Coverity that data ptr in study_chunk is non...
[perl5.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 Mon Apr 17 14:14:39 CEST 2006 [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 initialinstalllocation=''
323 installbin=''
324 userelocatableinc=''
325 byteorder=''
326 cc=''
327 ccflags=''
328 cppflags=''
329 ldflags=''
330 lkflags=''
331 locincpth=''
332 optimize=''
333 cf_email=''
334 cf_by=''
335 cf_time=''
336 charsize=''
337 contains=''
338 cpp_stuff=''
339 cpplast=''
340 cppminus=''
341 cpprun=''
342 cppstdin=''
343 d__fwalk=''
344 d_access=''
345 d_accessx=''
346 d_aintl=''
347 d_alarm=''
348 asctime_r_proto=''
349 d_asctime_r=''
350 d_attribute_format=''
351 d_attribute_malloc=''
352 d_attribute_nonnull=''
353 d_attribute_noreturn=''
354 d_attribute_pure=''
355 d_attribute_unused=''
356 d_attribute_warn_unused_result=''
357 d_bcmp=''
358 d_bcopy=''
359 d_builtin_choose_expr=''
360 d_builtin_expect=''
361 d_bzero=''
362 d_casti32=''
363 castflags=''
364 d_castneg=''
365 d_chown=''
366 d_chroot=''
367 d_chsize=''
368 d_class=''
369 d_clearenv=''
370 d_closedir=''
371 d_void_closedir=''
372 d_cmsghdr_s=''
373 d_const=''
374 d_copysignl=''
375 cryptlib=''
376 d_crypt=''
377 crypt_r_proto=''
378 d_crypt_r=''
379 d_csh=''
380 full_csh=''
381 ctermid_r_proto=''
382 d_ctermid_r=''
383 ctime_r_proto=''
384 d_ctime_r=''
385 d_cuserid=''
386 d_dbl_dig=''
387 d_dbminitproto=''
388 d_difftime=''
389 d_dirfd=''
390 d_dlerror=''
391 d_dlopen=''
392 d_dlsymun=''
393 d_dosuid=''
394 d_suidsafe=''
395 d_drand48_r=''
396 drand48_r_proto=''
397 d_drand48proto=''
398 d_dup2=''
399 d_eaccess=''
400 d_endgrent=''
401 d_endgrent_r=''
402 endgrent_r_proto=''
403 d_endhent=''
404 d_endhostent_r=''
405 endhostent_r_proto=''
406 d_endnent=''
407 d_endnetent_r=''
408 endnetent_r_proto=''
409 d_endpent=''
410 d_endprotoent_r=''
411 endprotoent_r_proto=''
412 d_endpwent=''
413 d_endpwent_r=''
414 endpwent_r_proto=''
415 d_endsent=''
416 d_endservent_r=''
417 endservent_r_proto=''
418 d_faststdio=''
419 d_fchdir=''
420 d_fchmod=''
421 d_fchown=''
422 d_fcntl=''
423 d_fcntl_can_lock=''
424 d_fd_macros=''
425 d_fd_set=''
426 d_fds_bits=''
427 d_fgetpos=''
428 d_finite=''
429 d_finitel=''
430 d_flexfnam=''
431 d_flock=''
432 d_flockproto=''
433 d_fork=''
434 d_fp_class=''
435 d_fpclass=''
436 d_fpclassify=''
437 d_fpclassl=''
438 d_fpos64_t=''
439 d_frexpl=''
440 d_fs_data_s=''
441 d_fseeko=''
442 d_fsetpos=''
443 d_fstatfs=''
444 d_fsync=''
445 d_ftello=''
446 d_ftime=''
447 d_gettimeod=''
448 d_futimes=''
449 d_Gconvert=''
450 d_getcwd=''
451 d_getespwnam=''
452 d_getfsstat=''
453 d_getgrent=''
454 d_getgrent_r=''
455 getgrent_r_proto=''
456 d_getgrgid_r=''
457 getgrgid_r_proto=''
458 d_getgrnam_r=''
459 getgrnam_r_proto=''
460 d_getgrps=''
461 d_gethbyaddr=''
462 d_gethbyname=''
463 d_gethent=''
464 aphostname=''
465 d_gethname=''
466 d_phostname=''
467 d_uname=''
468 d_gethostbyaddr_r=''
469 gethostbyaddr_r_proto=''
470 d_gethostbyname_r=''
471 gethostbyname_r_proto=''
472 d_gethostent_r=''
473 gethostent_r_proto=''
474 d_gethostprotos=''
475 d_getitimer=''
476 d_getlogin=''
477 d_getlogin_r=''
478 getlogin_r_proto=''
479 d_getmnt=''
480 d_getmntent=''
481 d_getnbyaddr=''
482 d_getnbyname=''
483 d_getnent=''
484 d_getnetbyaddr_r=''
485 getnetbyaddr_r_proto=''
486 d_getnetbyname_r=''
487 getnetbyname_r_proto=''
488 d_getnetent_r=''
489 getnetent_r_proto=''
490 d_getnetprotos=''
491 d_getpagsz=''
492 d_getpent=''
493 d_getpgid=''
494 d_getpgrp2=''
495 d_bsdgetpgrp=''
496 d_getpgrp=''
497 d_getppid=''
498 d_getprior=''
499 d_getpbyname=''
500 d_getpbynumber=''
501 d_getprotobyname_r=''
502 getprotobyname_r_proto=''
503 d_getprotobynumber_r=''
504 getprotobynumber_r_proto=''
505 d_getprotoent_r=''
506 getprotoent_r_proto=''
507 d_getprotoprotos=''
508 d_getprpwnam=''
509 d_getpwent=''
510 d_getpwent_r=''
511 getpwent_r_proto=''
512 d_getpwnam_r=''
513 getpwnam_r_proto=''
514 d_getpwuid_r=''
515 getpwuid_r_proto=''
516 d_getsent=''
517 d_getservbyname_r=''
518 getservbyname_r_proto=''
519 d_getservbyport_r=''
520 getservbyport_r_proto=''
521 d_getservent_r=''
522 getservent_r_proto=''
523 d_getservprotos=''
524 d_getspnam=''
525 d_getspnam_r=''
526 getspnam_r_proto=''
527 d_getsbyname=''
528 d_getsbyport=''
529 d_gmtime_r=''
530 gmtime_r_proto=''
531 d_gnulibc=''
532 gnulibc_version=''
533 d_hasmntopt=''
534 d_htonl=''
535 d_ilogbl=''
536 d_inetaton=''
537 d_int64_t=''
538 d_isascii=''
539 d_isfinite=''
540 d_isinf=''
541 d_isnan=''
542 d_isnanl=''
543 d_killpg=''
544 d_lchown=''
545 d_ldbl_dig=''
546 d_libm_lib_version=''
547 d_link=''
548 d_localtime_r=''
549 localtime_r_proto=''
550 d_locconv=''
551 d_lockf=''
552 d_longdbl=''
553 longdblsize=''
554 d_longlong=''
555 longlongsize=''
556 d_lseekproto=''
557 d_lstat=''
558 d_madvise=''
559 d_malloc_good_size=''
560 d_malloc_size=''
561 d_mblen=''
562 d_mbstowcs=''
563 d_mbtowc=''
564 d_memchr=''
565 d_memcmp=''
566 d_memcpy=''
567 d_memmove=''
568 d_memset=''
569 d_mkdir=''
570 d_mkdtemp=''
571 d_mkfifo=''
572 d_mkstemp=''
573 d_mkstemps=''
574 d_mktime=''
575 d_mmap=''
576 mmaptype=''
577 d_modfl=''
578 d_modfl_pow32_bug=''
579 d_modflproto=''
580 d_mprotect=''
581 d_msg=''
582 d_msgctl=''
583 d_msgget=''
584 d_msghdr_s=''
585 d_msgrcv=''
586 d_msgsnd=''
587 d_msync=''
588 d_munmap=''
589 d_nice=''
590 d_nl_langinfo=''
591 d_off64_t=''
592 d_open3=''
593 d_fpathconf=''
594 d_pathconf=''
595 d_pause=''
596 d_pipe=''
597 d_poll=''
598 d_portable=''
599 d_procselfexe=''
600 procselfexe=''
601 d_old_pthread_create_joinable=''
602 old_pthread_create_joinable=''
603 d_pthread_atfork=''
604 d_pthread_attr_setscope=''
605 d_pthread_yield=''
606 d_sched_yield=''
607 sched_yield=''
608 d_qgcvt=''
609 d_random_r=''
610 random_r_proto=''
611 d_readdir64_r=''
612 readdir64_r_proto=''
613 d_readdir=''
614 d_rewinddir=''
615 d_seekdir=''
616 d_telldir=''
617 d_readdir_r=''
618 readdir_r_proto=''
619 d_readlink=''
620 d_readv=''
621 d_recvmsg=''
622 d_rename=''
623 d_rmdir=''
624 d_safebcpy=''
625 d_safemcpy=''
626 d_sanemcmp=''
627 d_sbrkproto=''
628 d_scalbnl=''
629 d_select=''
630 d_sem=''
631 d_semctl=''
632 d_semget=''
633 d_semop=''
634 d_sendmsg=''
635 d_setegid=''
636 d_seteuid=''
637 d_setgrent=''
638 d_setgrent_r=''
639 setgrent_r_proto=''
640 d_setgrps=''
641 d_sethent=''
642 d_sethostent_r=''
643 sethostent_r_proto=''
644 d_setitimer=''
645 d_setlinebuf=''
646 d_setlocale=''
647 d_setlocale_r=''
648 setlocale_r_proto=''
649 d_setnent=''
650 d_setnetent_r=''
651 setnetent_r_proto=''
652 d_setpent=''
653 d_setpgid=''
654 d_setpgrp2=''
655 d_bsdsetpgrp=''
656 d_setpgrp=''
657 d_setprior=''
658 d_setproctitle=''
659 d_setprotoent_r=''
660 setprotoent_r_proto=''
661 d_setpwent=''
662 d_setpwent_r=''
663 setpwent_r_proto=''
664 d_setregid=''
665 d_setresgid=''
666 d_setresuid=''
667 d_setreuid=''
668 d_setrgid=''
669 d_setruid=''
670 d_setsent=''
671 d_setservent_r=''
672 setservent_r_proto=''
673 d_setsid=''
674 d_setvbuf=''
675 d_sfio=''
676 usesfio=''
677 d_shm=''
678 d_shmat=''
679 d_shmatprototype=''
680 shmattype=''
681 d_shmctl=''
682 d_shmdt=''
683 d_shmget=''
684 d_sigaction=''
685 d_sigprocmask=''
686 d_sigsetjmp=''
687 usesitecustomize=''
688 d_snprintf=''
689 d_vsnprintf=''
690 d_sockatmark=''
691 d_sockatmarkproto=''
692 d_msg_ctrunc=''
693 d_msg_dontroute=''
694 d_msg_oob=''
695 d_msg_peek=''
696 d_msg_proxy=''
697 d_oldsock=''
698 d_scm_rights=''
699 d_socket=''
700 d_sockpair=''
701 sockethdr=''
702 socketlib=''
703 d_socklen_t=''
704 d_socks5_init=''
705 d_sprintf_returns_strlen=''
706 d_sqrtl=''
707 d_srand48_r=''
708 srand48_r_proto=''
709 d_srandom_r=''
710 srandom_r_proto=''
711 d_sresgproto=''
712 d_sresuproto=''
713 d_statblks=''
714 d_statfs_f_flags=''
715 d_statfs_s=''
716 d_fstatvfs=''
717 d_statvfs=''
718 d_stdio_cnt_lval=''
719 d_stdio_ptr_lval=''
720 d_stdio_ptr_lval_nochange_cnt=''
721 d_stdio_ptr_lval_sets_cnt=''
722 d_stdiobase=''
723 d_stdstdio=''
724 stdio_base=''
725 stdio_bufsiz=''
726 stdio_cnt=''
727 stdio_filbuf=''
728 stdio_ptr=''
729 d_index=''
730 d_strchr=''
731 d_strcoll=''
732 d_strctcpy=''
733 d_strerrm=''
734 d_strerror=''
735 d_sysernlst=''
736 d_syserrlst=''
737 d_strerror_r=''
738 strerror_r_proto=''
739 d_strftime=''
740 d_strlcat=''
741 d_strlcpy=''
742 d_strtod=''
743 d_strtol=''
744 d_strtold=''
745 d_strtoll=''
746 d_strtoq=''
747 d_strtoul=''
748 d_strtoull=''
749 d_strtouq=''
750 d_strxfrm=''
751 d_symlink=''
752 d_syscall=''
753 d_syscallproto=''
754 d_sysconf=''
755 d_system=''
756 d_tcgetpgrp=''
757 d_tcsetpgrp=''
758 d_telldirproto=''
759 d_time=''
760 timetype=''
761 clocktype=''
762 d_times=''
763 d_tmpnam_r=''
764 tmpnam_r_proto=''
765 d_truncate=''
766 d_ttyname_r=''
767 ttyname_r_proto=''
768 d_tzname=''
769 d_u32align=''
770 d_ualarm=''
771 d_umask=''
772 d_semctl_semid_ds=''
773 d_semctl_semun=''
774 d_union_semun=''
775 d_unordered=''
776 d_unsetenv=''
777 d_usleep=''
778 d_usleepproto=''
779 d_ustat=''
780 d_vfork=''
781 usevfork=''
782 d_voidsig=''
783 signal_t=''
784 d_volatile=''
785 d_charvspr=''
786 d_vprintf=''
787 d_wait4=''
788 d_waitpid=''
789 d_wcstombs=''
790 d_wctomb=''
791 d_writev=''
792 dlext=''
793 cccdlflags=''
794 ccdlflags=''
795 dlsrc=''
796 ld=''
797 lddlflags=''
798 usedl=''
799 doublesize=''
800 ebcdic=''
801 fflushNULL=''
802 fflushall=''
803 fpossize=''
804 fpostype=''
805 gccansipedantic=''
806 gccosandvers=''
807 gccversion=''
808 gidformat=''
809 gidsign=''
810 gidsize=''
811 gidtype=''
812 groupstype=''
813 h_fcntl=''
814 h_sysfile=''
815 html1dir=''
816 html1direxp=''
817 installhtml1dir=''
818 html3dir=''
819 html3direxp=''
820 installhtml3dir=''
821 i_arpainet=''
822 i_crypt=''
823 db_hashtype=''
824 db_prefixtype=''
825 db_version_major=''
826 db_version_minor=''
827 db_version_patch=''
828 i_db=''
829 i_dbm=''
830 i_rpcsvcdbm=''
831 d_dirnamlen=''
832 direntrytype=''
833 i_dirent=''
834 i_dld=''
835 i_dlfcn=''
836 i_fcntl=''
837 i_float=''
838 i_fp=''
839 i_fp_class=''
840 i_gdbm=''
841 d_grpasswd=''
842 i_grp=''
843 i_ieeefp=''
844 i_inttypes=''
845 i_langinfo=''
846 i_libutil=''
847 i_limits=''
848 i_locale=''
849 i_machcthr=''
850 i_malloc=''
851 i_math=''
852 i_memory=''
853 i_mntent=''
854 i_ndbm=''
855 i_netdb=''
856 i_neterrno=''
857 i_netinettcp=''
858 i_niin=''
859 i_sysin=''
860 i_poll=''
861 i_prot=''
862 i_pthread=''
863 d_pwage=''
864 d_pwchange=''
865 d_pwclass=''
866 d_pwcomment=''
867 d_pwexpire=''
868 d_pwgecos=''
869 d_pwpasswd=''
870 d_pwquota=''
871 i_pwd=''
872 i_sfio=''
873 i_shadow=''
874 i_socks=''
875 i_stddef=''
876 i_stdlib=''
877 i_string=''
878 strings=''
879 i_sunmath=''
880 i_sysaccess=''
881 i_sysdir=''
882 i_sysfile=''
883 d_voidtty=''
884 i_bsdioctl=''
885 i_sysfilio=''
886 i_sysioctl=''
887 i_syssockio=''
888 i_syslog=''
889 i_sysmman=''
890 i_sysmode=''
891 i_sysmount=''
892 i_sysndir=''
893 i_sysparam=''
894 i_sysresrc=''
895 i_syssecrt=''
896 i_sysselct=''
897 i_sysstat=''
898 i_sysstatfs=''
899 i_sysstatvfs=''
900 i_systimes=''
901 i_systypes=''
902 i_sysuio=''
903 i_sysun=''
904 i_sysutsname=''
905 i_sysvfs=''
906 i_syswait=''
907 i_sgtty=''
908 i_termio=''
909 i_termios=''
910 d_tm_tm_gmtoff=''
911 d_tm_tm_zone=''
912 i_systime=''
913 i_systimek=''
914 i_time=''
915 timeincl=''
916 i_unistd=''
917 i_ustat=''
918 i_utime=''
919 i_values=''
920 i_stdarg=''
921 i_varargs=''
922 i_varhdr=''
923 i_vfork=''
924 d_inc_version_list=''
925 inc_version_list=''
926 inc_version_list_init=''
927 installprefix=''
928 installprefixexp=''
929 installstyle=''
930 installusrbinperl=''
931 intsize=''
932 longsize=''
933 shortsize=''
934 issymlink=''
935 libc=''
936 ldlibpthname=''
937 libperl=''
938 shrpenv=''
939 useshrplib=''
940 glibpth=''
941 libpth=''
942 loclibpth=''
943 plibpth=''
944 xlibpth=''
945 ignore_versioned_solibs=''
946 libs=''
947 libsdirs=''
948 libsfiles=''
949 libsfound=''
950 libspath=''
951 lns=''
952 d_PRIEUldbl=''
953 d_PRIFUldbl=''
954 d_PRIGUldbl=''
955 d_PRIeldbl=''
956 d_PRIfldbl=''
957 d_PRIgldbl=''
958 d_SCNfldbl=''
959 sPRIEUldbl=''
960 sPRIFUldbl=''
961 sPRIGUldbl=''
962 sPRIeldbl=''
963 sPRIfldbl=''
964 sPRIgldbl=''
965 sSCNfldbl=''
966 lseeksize=''
967 lseektype=''
968 mad=''
969 madlyh=''
970 madlyobj=''
971 madlysrc=''
972 make_set_make=''
973 d_mymalloc=''
974 freetype=''
975 mallocobj=''
976 mallocsrc=''
977 malloctype=''
978 usemallocwrap=''
979 usemymalloc=''
980 installman1dir=''
981 man1dir=''
982 man1direxp=''
983 man1ext=''
984 installman3dir=''
985 man3dir=''
986 man3direxp=''
987 man3ext=''
988 modetype=''
989 multiarch=''
990 mydomain=''
991 myhostname=''
992 phostname=''
993 c=''
994 n=''
995 d_eofnblk=''
996 eagain=''
997 o_nonblock=''
998 rd_nodata=''
999 need_va_copy=''
1000 netdb_hlen_type=''
1001 netdb_host_type=''
1002 netdb_name_type=''
1003 netdb_net_type=''
1004 groupcat=''
1005 hostcat=''
1006 passcat=''
1007 orderlib=''
1008 ranlib=''
1009 d_perl_otherlibdirs=''
1010 otherlibdirs=''
1011 package=''
1012 spackage=''
1013 pager=''
1014 api_revision=''
1015 api_subversion=''
1016 api_version=''
1017 api_versionstring=''
1018 patchlevel=''
1019 perl_patchlevel=''
1020 revision=''
1021 subversion=''
1022 version=''
1023 version_patchlevel_string=''
1024 perl5=''
1025 perladmin=''
1026 perlpath=''
1027 d_nv_preserves_uv=''
1028 d_nv_zero_is_allbits_zero=''
1029 i16size=''
1030 i16type=''
1031 i32size=''
1032 i32type=''
1033 i64size=''
1034 i64type=''
1035 i8size=''
1036 i8type=''
1037 ivsize=''
1038 ivtype=''
1039 nv_preserves_uv_bits=''
1040 nvsize=''
1041 nvtype=''
1042 u16size=''
1043 u16type=''
1044 u32size=''
1045 u32type=''
1046 u64size=''
1047 u64type=''
1048 u8size=''
1049 u8type=''
1050 uvsize=''
1051 uvtype=''
1052 ivdformat=''
1053 nvEUformat=''
1054 nvFUformat=''
1055 nvGUformat=''
1056 nveformat=''
1057 nvfformat=''
1058 nvgformat=''
1059 uvXUformat=''
1060 uvoformat=''
1061 uvuformat=''
1062 uvxformat=''
1063 pidtype=''
1064 prefix=''
1065 prefixexp=''
1066 installprivlib=''
1067 privlib=''
1068 privlibexp=''
1069 prototype=''
1070 ptrsize=''
1071 d_PRIXU64=''
1072 d_PRId64=''
1073 d_PRIi64=''
1074 d_PRIo64=''
1075 d_PRIu64=''
1076 d_PRIx64=''
1077 sPRIXU64=''
1078 sPRId64=''
1079 sPRIi64=''
1080 sPRIo64=''
1081 sPRIu64=''
1082 sPRIx64=''
1083 d_quad=''
1084 quadkind=''
1085 quadtype=''
1086 uquadtype=''
1087 drand01=''
1088 randbits=''
1089 randfunc=''
1090 randseedtype=''
1091 seedfunc=''
1092 installscript=''
1093 scriptdir=''
1094 scriptdirexp=''
1095 selectminbits=''
1096 selecttype=''
1097 sh=''
1098 sig_count=''
1099 sig_name=''
1100 sig_name_init=''
1101 sig_num=''
1102 sig_num_init=''
1103 sig_size=''
1104 d_sitearch=''
1105 installsitearch=''
1106 sitearch=''
1107 sitearchexp=''
1108 installsitebin=''
1109 sitebin=''
1110 sitebinexp=''
1111 installsitehtml1dir=''
1112 sitehtml1dir=''
1113 sitehtml1direxp=''
1114 installsitehtml3dir=''
1115 sitehtml3dir=''
1116 sitehtml3direxp=''
1117 installsitelib=''
1118 sitelib=''
1119 sitelib_stem=''
1120 sitelibexp=''
1121 installsiteman1dir=''
1122 siteman1dir=''
1123 siteman1direxp=''
1124 installsiteman3dir=''
1125 siteman3dir=''
1126 siteman3direxp=''
1127 siteprefix=''
1128 siteprefixexp=''
1129 installsitescript=''
1130 sitescript=''
1131 sitescriptexp=''
1132 sizesize=''
1133 sizetype=''
1134 so=''
1135 socksizetype=''
1136 sharpbang=''
1137 shsharp=''
1138 spitshell=''
1139 src=''
1140 ssizetype=''
1141 startperl=''
1142 startsh=''
1143 stdchar=''
1144 d_stdio_stream_array=''
1145 stdio_stream_array=''
1146 sysman=''
1147 trnl=''
1148 uidformat=''
1149 uidsign=''
1150 uidsize=''
1151 uidtype=''
1152 archname64=''
1153 use64bitall=''
1154 use64bitint=''
1155 usefaststdio=''
1156 ccflags_uselargefiles=''
1157 ldflags_uselargefiles=''
1158 libswanted_uselargefiles=''
1159 uselargefiles=''
1160 uselongdouble=''
1161 usemorebits=''
1162 usemultiplicity=''
1163 nm_opt=''
1164 nm_so_opt=''
1165 runnm=''
1166 usenm=''
1167 useperlio=''
1168 usesocks=''
1169 d_oldpthreads=''
1170 use5005threads=''
1171 useithreads=''
1172 usereentrant=''
1173 usethreads=''
1174 incpath=''
1175 mips_type=''
1176 usrinc=''
1177 d_vendorarch=''
1178 installvendorarch=''
1179 vendorarch=''
1180 vendorarchexp=''
1181 d_vendorbin=''
1182 installvendorbin=''
1183 vendorbin=''
1184 vendorbinexp=''
1185 installvendorhtml1dir=''
1186 vendorhtml1dir=''
1187 vendorhtml1direxp=''
1188 installvendorhtml3dir=''
1189 vendorhtml3dir=''
1190 vendorhtml3direxp=''
1191 d_vendorlib=''
1192 installvendorlib=''
1193 vendorlib=''
1194 vendorlib_stem=''
1195 vendorlibexp=''
1196 installvendorman1dir=''
1197 vendorman1dir=''
1198 vendorman1direxp=''
1199 installvendorman3dir=''
1200 vendorman3dir=''
1201 vendorman3direxp=''
1202 usevendorprefix=''
1203 vendorprefix=''
1204 vendorprefixexp=''
1205 d_vendorscript=''
1206 installvendorscript=''
1207 vendorscript=''
1208 vendorscriptexp=''
1209 versiononly=''
1210 defvoidused=''
1211 voidflags=''
1212 yacc=''
1213 yaccflags=''
1214 CONFIG=''
1215
1216 define='define'
1217 undef='undef'
1218 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1219 rmlist=''
1220
1221 : We must find out about Eunice early
1222 eunicefix=':'
1223 if test -f /etc/unixtovms; then
1224         eunicefix=/etc/unixtovms
1225 fi
1226 if test -f /etc/unixtovms.exe; then
1227         eunicefix=/etc/unixtovms.exe
1228 fi
1229
1230 : Set executable suffix now -- needed before hints available
1231 if test -f "/libs/version.library"; then
1232 : Amiga OS
1233     _exe=""
1234 elif test -f "/system/gnu_library/bin/ar.pm"; then
1235 : Stratus VOS
1236     _exe=".pm"
1237 elif test -n "$DJGPP"; then
1238 : DOS DJGPP
1239     _exe=".exe"
1240 elif test -d c:/. -o -n "$is_os2" ; then
1241 : OS/2 or cygwin
1242     _exe=".exe"
1243 fi
1244
1245 i_whoami=''
1246 ccname=''
1247 ccversion=''
1248 perllibs=''
1249 : set useposix=false in your hint file to disable the POSIX extension.
1250 useposix=true
1251 : set useopcode=false in your hint file to disable the Opcode extension.
1252 useopcode=true
1253 : Trailing extension.  Override this in a hint file, if needed.
1254 : Extra object files, if any, needed on this platform.
1255 archobjs=''
1256 archname=''
1257 : Possible local include directories to search.
1258 : Set locincpth to "" in a hint file to defeat local include searches.
1259 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1260 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1261 :
1262 : no include file wanted by default
1263 inclwanted=''
1264
1265 : Enable -DEBUGGING and -DDEBUGGING from the command line
1266 EBUGGING=''
1267 DEBUGGING=old
1268
1269 groupstype=''
1270 libnames=''
1271 : change the next line if compiling for Xenix/286 on Xenix/386
1272 xlibpth='/usr/lib/386 /lib/386'
1273 : Possible local library directories to search.
1274 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1275 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1276
1277 : general looking path for locating libraries
1278 glibpth="/lib /usr/lib $xlibpth"
1279 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1280 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1281 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1282
1283 : Private path used by Configure to find libraries.  Its value
1284 : is prepended to libpth. This variable takes care of special
1285 : machines, like the mips.  Usually, it should be empty.
1286 plibpth=''
1287
1288 : default library list
1289 libswanted=''
1290 : some systems want to use only the non-versioned libso:s
1291 ignore_versioned_solibs=''
1292 siteman1dir=''
1293 siteman3dir=''
1294 sitescript=''
1295 archname64=''
1296 ccflags_uselargefiles=''
1297 ldflags_uselargefiles=''
1298 libswanted_uselargefiles=''
1299 : set usemultiplicity on the Configure command line to enable multiplicity.
1300 : set usesocks on the Configure command line to enable socks.
1301 : set usethreads on the Configure command line to enable threads.
1302 usereentrant='undef'
1303 : full support for void wanted by default
1304 defvoidused=15
1305
1306 : List of libraries we want.
1307 : If anyone needs extra -lxxx, put those in a hint file.
1308 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1309 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1310 : We probably want to search /usr/shlib before most other libraries.
1311 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1312 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1313 glibpth="/usr/shlib $glibpth"
1314 : Do not use vfork unless overridden by a hint file.
1315 usevfork=false
1316
1317 : Find the basic shell for Bourne shell scripts
1318 case "$sh" in
1319 '')
1320         case "$SYSTYPE" in
1321         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1322         *) xxx='/bin/sh';;
1323         esac
1324         if test -f "$xxx"; then
1325                 sh="$xxx"
1326         else
1327                 : Build up a list and do a single loop so we can 'break' out.
1328                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1329                 for xxx in sh bash ksh pdksh ash; do
1330                         for p in $pth; do
1331                                 try="$try ${p}/${xxx}"
1332                         done
1333                 done
1334                 for xxx in $try; do
1335                         if test -f "$xxx"; then
1336                                 sh="$xxx";
1337                                 break
1338                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1339                                 sh="$xxx";
1340                                 break
1341                         elif test -f "$xxx.exe"; then
1342                                 sh="$xxx";
1343                                 break
1344                         fi
1345                 done
1346         fi
1347         ;;
1348 esac
1349
1350 case "$sh" in
1351 '')     cat >&2 <<EOM
1352 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1353
1354 Usually it's in /bin/sh.  How did you even get this far?
1355 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1356 we'll try to straighten this all out.
1357 EOM
1358         exit 1
1359         ;;
1360 esac
1361
1362 : see if sh knows # comments
1363 if `$sh -c '#' >/dev/null 2>&1`; then
1364         shsharp=true
1365         spitshell=cat
1366         xcat=/bin/cat
1367         test -f $xcat$_exe || xcat=/usr/bin/cat
1368         if test ! -f $xcat$_exe; then
1369                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1370                         if test -f $p/cat$_exe; then
1371                                 xcat=$p/cat
1372                                 break
1373                         fi
1374                 done
1375                 if test ! -f $xcat$_exe; then
1376                         echo "Can't find cat anywhere!"
1377                         exit 1
1378                 fi
1379         fi
1380         echo "#!$xcat" >sharp
1381         $eunicefix sharp
1382         chmod +x sharp
1383         ./sharp > today
1384         if test -s today; then
1385                 sharpbang='#!'
1386         else
1387                 echo "#! $xcat" > sharp
1388                 $eunicefix sharp
1389                 chmod +x sharp
1390                 ./sharp > today
1391                 if test -s today; then
1392                         sharpbang='#! '
1393                 else
1394                         sharpbang=': use '
1395                 fi
1396         fi
1397 else
1398         echo " "
1399         echo "Your $sh doesn't grok # comments--I will strip them later on."
1400         shsharp=false
1401         cd ..
1402         echo "exec grep -v '^[  ]*#'" >spitshell
1403         chmod +x spitshell
1404         $eunicefix spitshell
1405         spitshell=`pwd`/spitshell
1406         cd UU
1407         echo "I presume that if # doesn't work, #! won't work either!"
1408         sharpbang=': use '
1409 fi
1410 rm -f sharp today
1411
1412 : figure out how to guarantee sh startup
1413 case "$startsh" in
1414 '') startsh=${sharpbang}${sh} ;;
1415 *)
1416 esac
1417 cat >sharp <<EOSS
1418 $startsh
1419 set abc
1420 test "$?abc" != 1
1421 EOSS
1422
1423 chmod +x sharp
1424 $eunicefix sharp
1425 if ./sharp; then
1426         : echo "Yup, it does."
1427 else
1428         echo "Hmm... '$startsh' does not guarantee sh startup..."
1429         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1430 fi
1431 rm -f sharp
1432
1433
1434 : Save command line options in file UU/cmdline.opt for later use in
1435 : generating config.sh.
1436 cat > cmdline.opt <<EOSH
1437 # Configure command line arguments.
1438 config_arg0='$0'
1439 config_args='$*'
1440 config_argc=$#
1441 EOSH
1442 argn=1
1443 args_exp=''
1444 args_sep=''
1445 for arg in "$@"; do
1446         cat >>cmdline.opt <<EOSH
1447 config_arg$argn='$arg'
1448 EOSH
1449         # Extreme backslashitis: replace each ' by '"'"'
1450         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1451 $arg
1452 EOC
1453         arg_exp=`cat cmdl.opt`
1454         args_exp="$args_exp$args_sep'$arg_exp'"
1455         argn=`expr $argn + 1`
1456         args_sep=' '
1457 done
1458 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1459 # used by ./hints/os2.sh
1460 rm -f cmdl.opt
1461
1462 : produce awk script to parse command line options
1463 cat >options.awk <<'EOF'
1464 BEGIN {
1465         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1466
1467         len = length(optstr);
1468         for (i = 1; i <= len; i++) {
1469                 c = substr(optstr, i, 1);
1470                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1471                 if (a == ":") {
1472                         arg[c] = 1;
1473                         i++;
1474                 }
1475                 opt[c] = 1;
1476         }
1477 }
1478 {
1479         expect = 0;
1480         str = $0;
1481         if (substr(str, 1, 1) != "-") {
1482                 printf("'%s'\n", str);
1483                 next;
1484         }
1485         len = length($0);
1486         for (i = 2; i <= len; i++) {
1487                 c = substr(str, i, 1);
1488                 if (!opt[c]) {
1489                         printf("-%s\n", substr(str, i));
1490                         next;
1491                 }
1492                 printf("-%s\n", c);
1493                 if (arg[c]) {
1494                         if (i < len)
1495                                 printf("'%s'\n", substr(str, i + 1));
1496                         else
1497                                 expect = 1;
1498                         next;
1499                 }
1500         }
1501 }
1502 END {
1503         if (expect)
1504                 print "?";
1505 }
1506 EOF
1507
1508 : process the command line options
1509 set X `for arg in "$@"; do echo "X$arg"; done |
1510         sed -e s/X// | awk -f options.awk`
1511 eval "set $*"
1512 shift
1513 rm -f options.awk
1514
1515 : set up default values
1516 fastread=''
1517 reuseval=false
1518 config_sh=''
1519 alldone=''
1520 error=''
1521 silent=''
1522 extractsh=''
1523 override=''
1524 knowitall=''
1525 rm -f optdef.sh posthint.sh
1526 cat >optdef.sh <<EOS
1527 $startsh
1528 EOS
1529
1530
1531 : option parsing
1532 while test $# -gt 0; do
1533         case "$1" in
1534         -d) shift; fastread=yes;;
1535         -e) shift; alldone=cont;;
1536         -f)
1537                 shift
1538                 cd ..
1539                 if test -r "$1"; then
1540                         config_sh="$1"
1541                 else
1542                         echo "$me: cannot read config file $1." >&2
1543                         error=true
1544                 fi
1545                 cd UU
1546                 shift;;
1547         -h) shift; error=true;;
1548         -r) shift; reuseval=true;;
1549         -s) shift; silent=true; realsilent=true;;
1550         -E) shift; alldone=exit;;
1551         -K) shift; knowitall=true;;
1552         -O) shift; override=true;;
1553         -S) shift; silent=true; extractsh=true;;
1554         -D)
1555                 shift
1556                 case "$1" in
1557                 *=)
1558                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1559                         echo "$me: ignoring -D $1" >&2
1560                         ;;
1561                 *=*) echo "$1" | \
1562                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1563                 *) echo "$1='define'" >> optdef.sh;;
1564                 esac
1565                 shift
1566                 ;;
1567         -U)
1568                 shift
1569                 case "$1" in
1570                 *=) echo "$1" >> optdef.sh;;
1571                 *=*)
1572                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1573                         echo "$me: ignoring -U $1" >&2
1574                         ;;
1575                 *) echo "$1='undef'" >> optdef.sh;;
1576                 esac
1577                 shift
1578                 ;;
1579         -A)
1580             shift
1581             xxx=''
1582             yyy="$1"
1583             zzz=''
1584             uuu=undef
1585             case "$yyy" in
1586             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1587                  case "$zzz" in
1588                  *:*) zzz='' ;;
1589                  *)   xxx=append
1590                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1591                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1592                  esac
1593                  ;;
1594             esac
1595             case "$xxx" in
1596             '')  case "$yyy" in
1597                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1598                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1599                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1600                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1601                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1602                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1603                  esac
1604                  ;;       
1605             esac
1606             case "$xxx" in
1607             append)
1608                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1609             clear)
1610                 echo "$yyy=''"                  >> posthint.sh ;;
1611             define)
1612                 case "$zzz" in
1613                 '') zzz=define ;;
1614                 esac
1615                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1616             eval)
1617                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1618             prepend)
1619                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1620             undef)
1621                 case "$zzz" in
1622                 '') zzz="$uuu" ;;
1623                 esac
1624                 echo "$yyy=$zzz"                >> posthint.sh ;;
1625             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1626             esac
1627             shift
1628             ;;
1629         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1630             exit 0;;
1631         --) break;;
1632         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1633         *) break;;
1634         esac
1635 done
1636
1637 case "$error" in
1638 true)
1639         cat >&2 <<EOM
1640 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1641                  [-U symbol] [-U symbol=] [-A command:symbol...]
1642   -d : use defaults for all answers.
1643   -e : go on without questioning past the production of config.sh.
1644   -f : specify an alternate default configuration file.
1645   -h : print this help message and exit (with an error status).
1646   -r : reuse C symbols value if possible (skips costly nm extraction).
1647   -s : silent mode, only echoes questions and essential information.
1648   -D : define symbol to have some value:
1649          -D symbol         symbol gets the value 'define'
1650          -D symbol=value   symbol gets the value 'value'
1651   -E : stop at the end of questions, after having produced config.sh.
1652   -K : do not use unless you know what you are doing.
1653   -O : let -D and -U override definitions from loaded configuration file.
1654   -S : perform variable substitutions on all .SH files (can mix with -f)
1655   -U : undefine symbol:
1656          -U symbol    symbol gets the value 'undef'
1657          -U symbol=   symbol gets completely empty
1658   -A : manipulate symbol after the platform specific hints have been applied:
1659          -A symbol=value                append " "value to symbol
1660          -A append:symbol=value         append value to symbol
1661          -A define:symbol=value         define symbol to have value
1662          -A clear:symbol                define symbol to be ''
1663          -A define:symbol               define symbol to be 'define'
1664          -A eval:symbol=value           define symbol to be eval of value
1665          -A prepend:symbol=value        prepend value to symbol
1666          -A undef:symbol                define symbol to be 'undef'
1667          -A undef:symbol=               define symbol to be ''
1668   -V : print version number and exit (with a zero status).
1669 EOM
1670         exit 1
1671         ;;
1672 esac
1673
1674 : Sanity checks
1675 case "$fastread$alldone" in
1676 yescont|yesexit) ;;
1677 *)
1678         case "$extractsh" in
1679         true) ;;
1680         *)
1681                 if test ! -t 0; then
1682                         echo "Say 'sh Configure', not 'sh <Configure'"
1683                         exit 1
1684                 fi
1685                 ;;
1686         esac
1687         ;;
1688 esac
1689
1690 exec 4>&1
1691 case "$silent" in
1692 true) exec 1>/dev/null;;
1693 esac
1694
1695 : run the defines and the undefines, if any, but leave the file out there...
1696 touch optdef.sh
1697 . ./optdef.sh
1698 : create the posthint manipulation script and leave the file out there...
1699 touch posthint.sh
1700
1701 : set package name
1702 package=perl5
1703 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1704 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1705 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1706 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1707 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1708 esac
1709
1710 : Some greps do not return status, grrr.
1711 echo "grimblepritz" >grimble
1712 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1713         contains=contains
1714 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1715         contains=grep
1716 else
1717         contains=contains
1718 fi
1719 rm -f grimble
1720 : the following should work in any shell
1721 case "$contains" in
1722 contains*)
1723         echo " "
1724         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1725         cat >contains <<'EOSS'
1726 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1727 EOSS
1728 chmod +x contains
1729 esac
1730
1731 : Find the path to the source tree
1732 case "$src" in
1733 '') case "$0" in
1734     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1735          case "$src" in
1736          /*)    ;;
1737          .)     ;;
1738          *)     src=`cd ../$src && pwd` ;;
1739          esac
1740          ;;
1741     *)   src='.';;
1742     esac;;
1743 esac
1744 case "$src" in
1745 '')     src=/
1746         rsrc=/
1747         ;;
1748 /*) rsrc="$src";;
1749 *) rsrc="../$src";;
1750 esac
1751 if test -f $rsrc/Configure && \
1752         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1753 then
1754    : found it, so we are ok.
1755 else
1756         rsrc=''
1757         for src in . .. ../.. ../../.. ../../../..; do
1758                 if test -f ../$src/Configure && \
1759                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1760                 then
1761                         rsrc=../$src
1762                         break
1763                 fi
1764         done
1765 fi
1766 case "$rsrc" in
1767 '')
1768         cat <<EOM >&4
1769
1770 Sorry, I can't seem to locate the source dir for $package.  Please start
1771 Configure with an explicit path -- i.e. /some/path/Configure.
1772
1773 EOM
1774         exit 1
1775         ;;
1776 ../.)   rsrc='..';;
1777 *)
1778         echo " "
1779         echo "Sources for $package found in \"$src\"." >&4
1780         ;;
1781 esac
1782
1783 : script used to extract .SH files with variable substitutions
1784 cat >extract <<'EOS'
1785 PERL_CONFIG_SH=true
1786 echo "Doing variable substitutions on .SH files..."
1787 if test -f MANIFEST; then
1788         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1789 else
1790         echo "(Looking for .SH files under the source directory.)"
1791         set x `(cd "$src"; find . -name "*.SH" -print)`
1792 fi
1793 shift
1794 case $# in
1795 0) set x `(cd "$src"; echo *.SH)`; shift;;
1796 esac
1797 if test ! -f "$src/$1"; then
1798         shift
1799 fi
1800 mkdir_p='
1801 name=$1;
1802 create="";
1803 while test $name; do
1804         if test ! -d "$name"; then
1805                 create="$name $create";
1806                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1807                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1808         else
1809                 name="";
1810         fi;
1811 done;
1812 for file in $create; do
1813         mkdir $file;
1814 done
1815 '
1816 for file in $*; do
1817         case "$src" in
1818         ".")
1819                 case "$file" in
1820                 */*)
1821                         dir=`expr X$file : 'X\(.*\)/'`
1822                         file=`expr X$file : 'X.*/\(.*\)'`
1823                         (cd "$dir" && . ./$file)
1824                         ;;
1825                 *)
1826                         . ./$file
1827                         ;;
1828                 esac
1829                 ;;
1830         *)
1831                 case "$file" in
1832                 */*)
1833                         dir=`expr X$file : 'X\(.*\)/'`
1834                         file=`expr X$file : 'X.*/\(.*\)'`
1835                         (set x $dir; shift; eval $mkdir_p)
1836                         sh <"$src/$dir/$file"
1837                         ;;
1838                 *)
1839                         sh <"$src/$file"
1840                         ;;
1841                 esac
1842                 ;;
1843         esac
1844 done
1845 if test -f "$src/config_h.SH"; then
1846         if test ! -f config.h; then
1847         : oops, they left it out of MANIFEST, probably, so do it anyway.
1848         . "$src/config_h.SH"
1849         fi
1850 fi
1851 EOS
1852
1853 : extract files and exit if asked to do so
1854 case "$extractsh" in
1855 true)
1856         case "$realsilent" in
1857         true) ;;
1858         *) exec 1>&4;;
1859         esac
1860         case "$config_sh" in
1861         '') config_sh='config.sh';;
1862         esac
1863         echo " "
1864         echo "Fetching answers from $config_sh..."
1865         cd ..
1866         . $config_sh
1867         test "$override" && . ./optdef.sh
1868         echo " "
1869         . UU/extract
1870         rm -rf UU
1871         echo "Extraction done."
1872         exit 0
1873         ;;
1874 esac
1875
1876 : Eunice requires " " instead of "", can you believe it
1877 echo " "
1878 : Here we go...
1879 echo "Beginning of configuration questions for $package."
1880
1881 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1882
1883 : first determine how to suppress newline on echo command
1884 echo " "
1885 echo "Checking echo to see how to suppress newlines..."
1886 (echo "hi there\c" ; echo " ") >.echotmp
1887 if $contains c .echotmp >/dev/null 2>&1 ; then
1888         echo "...using -n."
1889         n='-n'
1890         c=''
1891 else
1892         cat <<'EOM'
1893 ...using \c
1894 EOM
1895         n=''
1896         c='\c'
1897 fi
1898 echo $n "The star should be here-->$c"
1899 echo '*'
1900 rm -f .echotmp
1901
1902 : Now test for existence of everything in MANIFEST
1903 echo " "
1904 if test -f "$rsrc/MANIFEST"; then
1905         echo "First let's make sure your kit is complete.  Checking..." >&4
1906         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1907         rm -f missing
1908         tmppwd=`pwd`
1909         for filelist in x??; do
1910                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1911         done
1912         if test -s missing; then
1913                 cat missing >&4
1914                 cat >&4 <<'EOM'
1915
1916 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1917
1918 You have the option of continuing the configuration process, despite the
1919 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1920 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1921 and contact the author (perlbug@perl.org).
1922
1923 EOM
1924                 echo $n "Continue? [n] $c" >&4
1925                 read ans
1926                 case "$ans" in
1927                 y*)
1928                         echo "Continuing..." >&4
1929                         rm -f missing
1930                         ;;
1931                 *)
1932                         echo "ABORTING..." >&4
1933                         kill $$
1934                         ;;
1935                 esac
1936         else
1937                 echo "Looks good..."
1938         fi
1939 else
1940         echo "There is no MANIFEST file.  I hope your kit is complete !"
1941 fi
1942 rm -f missing x??
1943
1944 echo " "
1945 : Find the appropriate value for a newline for tr
1946 if test -n "$DJGPP"; then
1947        trnl='\012'
1948 fi
1949 if test X"$trnl" = X; then
1950         case "`echo foo|tr '\n' x 2>/dev/null`" in
1951         foox) trnl='\n' ;;
1952         esac
1953 fi
1954 if test X"$trnl" = X; then
1955         case "`echo foo|tr '\012' x 2>/dev/null`" in
1956         foox) trnl='\012' ;;
1957         esac
1958 fi
1959 if test X"$trnl" = X; then
1960        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1961        fooxy) trnl='\n\r' ;;
1962        esac
1963 fi
1964 if test X"$trnl" = X; then
1965         cat <<EOM >&2
1966
1967 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1968
1969 EOM
1970         exit 1
1971 fi
1972
1973 : compute the number of columns on the terminal for proper question formatting
1974 case "$COLUMNS" in
1975 '') COLUMNS='80';;
1976 esac
1977
1978 : set up the echo used in my read
1979 myecho="case \"\$xxxm\" in
1980 '') echo $n \"\$rp $c\" >&4;;
1981 *) case \"\$rp\" in
1982         '') echo $n \"[\$xxxm] $c\";;
1983         *)
1984                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1985                         echo \"\$rp\" >&4
1986                         echo $n \"[\$xxxm] $c\" >&4
1987                 else
1988                         echo $n \"\$rp [\$xxxm] $c\" >&4
1989                 fi
1990                 ;;
1991         esac;;
1992 esac"
1993
1994 : now set up to do reads with possible shell escape and default assignment
1995 cat <<EOSC >myread
1996 $startsh
1997 xxxm=\$dflt
1998 $myecho
1999 ans='!'
2000 case "\$fastread" in
2001 yes) case "\$dflt" in
2002         '') ;;
2003         *) ans='';
2004                 case "\$silent-\$rp" in
2005                 true-) ;;
2006                 *) echo " " >&4;;
2007                 esac;;
2008         esac;;
2009 *) case "\$silent" in
2010         true) case "\$rp" in
2011                 '') ans='';;
2012                 esac;;
2013         esac;;
2014 esac
2015 while expr "X\$ans" : "X!" >/dev/null; do
2016         read answ
2017         set x \$xxxm
2018         shift
2019         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2020         case  "\$answ" in
2021         "!")
2022                 sh 1>&4
2023                 echo " "
2024                 $myecho
2025                 ;;
2026         !*)
2027                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2028                 shift
2029                 sh 1>&4 -c "\$*"
2030                 echo " "
2031                 $myecho
2032                 ;;
2033         "\$ans")
2034                 case "\$ans" in
2035                 \\&*)
2036                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2037                         shift
2038                         case "\$1" in
2039                         -d)
2040                                 fastread=yes
2041                                 echo "(OK, I'll run with -d after this question.)" >&4
2042                                 ;;
2043                         -*)
2044                                 echo "*** Sorry, \$1 not supported yet." >&4
2045                                 ;;
2046                         esac
2047                         $myecho
2048                         ans=!
2049                         ;;
2050                 esac;;
2051         *)
2052                 case "\$aok" in
2053                 y)
2054                         echo "*** Substitution done -- please confirm."
2055                         xxxm="\$ans"
2056                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2057                         xxxm="\$ans"
2058                         ans=!
2059                         ;;
2060                 *)
2061                         echo "*** Error -- try again."
2062                         ans=!
2063                         ;;
2064                 esac
2065                 $myecho
2066                 ;;
2067         esac
2068         case "\$ans\$xxxm\$nostick" in
2069         '')
2070                 ans=!
2071                 $myecho
2072                 ;;
2073         esac
2074 done
2075 case "\$ans" in
2076 '') ans="\$xxxm";;
2077 esac
2078 EOSC
2079
2080 : create .config dir to save info across Configure sessions
2081 test -d ../.config || mkdir ../.config
2082 cat >../.config/README <<EOF
2083 This directory created by Configure to save information that should
2084 persist across sessions for $package.
2085
2086 You may safely delete it if you wish.
2087 EOF
2088
2089 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2090 case "$usedevel" in
2091 $define|true|[yY]*) ;;
2092 *) case "$xversion" in
2093    *[13579])
2094         cat >&4 <<EOH
2095 *** WHOA THERE!!! ***
2096
2097     This is an UNSTABLE DEVELOPMENT release.
2098     The version of this $package distribution is $xversion, that is, odd,
2099     (as opposed to even) and that signifies a development release.
2100     If you want a maintenance release, you want an even-numbered version.
2101
2102     Do ***NOT*** install this into production use.
2103     Data corruption and crashes are possible.
2104
2105     It is most seriously suggested that you do not continue any further
2106     unless you want to help in developing and debugging Perl.
2107
2108     If you *still* want to build perl, you can answer 'y' now,
2109     or pass -Dusedevel to Configure.
2110
2111 EOH
2112         rp='Do you really want to continue?'
2113         dflt='n'
2114         . ./myread
2115         case "$ans" in
2116         [yY]) echo >&4 "Okay, continuing."
2117               usedevel="$define" ;;
2118         *) echo >&4 "Okay, bye."
2119            exit 1
2120            ;;
2121         esac
2122         ;;
2123     esac
2124     ;;
2125 esac
2126 case "$usedevel" in
2127 $define|true|[yY]*)
2128         case "$versiononly" in
2129         '') versiononly="$define" ;;
2130         esac
2131         case "$installusrbinperl" in
2132         '') installusrbinperl="$undef" ;;
2133         esac
2134         ;;
2135 esac
2136
2137 : general instructions
2138 needman=true
2139 firsttime=true
2140 user=`(logname) 2>/dev/null`
2141 case "$user" in
2142 '') user=`whoami 2>&1`;;
2143 esac
2144 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2145         firsttime=false
2146         echo " "
2147         rp='Would you like to see the instructions?'
2148         dflt=n
2149         . ./myread
2150         case "$ans" in
2151         [yY]*) ;;
2152         *) needman=false;;
2153         esac
2154 fi
2155 if $needman; then
2156         cat <<EOH
2157
2158 This installation shell script will examine your system and ask you questions
2159 to determine how the perl5 package should be installed. If you get
2160 stuck on a question, you may use a ! shell escape to start a subshell or
2161 execute a command.  Many of the questions will have default answers in square
2162 brackets; typing carriage return will give you the default.
2163
2164 On some of the questions which ask for file or directory names you are allowed
2165 to use the ~name construct to specify the login directory belonging to "name",
2166 even if you don't have a shell which knows about that.  Questions where this is
2167 allowed will be marked "(~name ok)".
2168
2169 EOH
2170         rp=''
2171         dflt='Type carriage return to continue'
2172         . ./myread
2173         cat <<'EOH'
2174
2175 The prompter used in this script allows you to use shell variables and
2176 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2177 in the default answer, as if the default line was a set of arguments given to a
2178 script shell.  This means you may also use $* to repeat the whole default line,
2179 so you do not have to re-type everything to add something to the default.
2180
2181 Everytime there is a substitution, you will have to confirm.  If there is an
2182 error (e.g. an unmatched backtick), the default answer will remain unchanged
2183 and you will be prompted again.
2184
2185 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2186 the questions and use the computed defaults (or the previous answers if there
2187 was already a config.sh file). Type 'Configure -h' for a list of options.
2188 You may also start interactively and then answer '& -d' at any prompt to turn
2189 on the non-interactive behaviour for the remainder of the execution.
2190
2191 EOH
2192         . ./myread
2193         cat <<EOH
2194
2195 Much effort has been expended to ensure that this shell script will run on any
2196 Unix system.  If despite that it blows up on yours, your best bet is to edit
2197 Configure and run it again.  If you can't run Configure for some reason,
2198 you'll have to generate a config.sh file by hand.  Whatever problems you
2199 have, let me (perlbug@perl.org) know how I blew it.
2200
2201 This installation script affects things in two ways:
2202
2203 1) it may do direct variable substitutions on some of the files included
2204    in this kit.
2205 2) it builds a config.h file for inclusion in C programs.  You may edit
2206    any of these files as the need arises after running this script.
2207
2208 If you make a mistake on a question, there is no easy way to back up to it
2209 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2210 files.  Configure will offer to let you do this before it runs the SH files.
2211
2212 EOH
2213         dflt='Type carriage return to continue'
2214         . ./myread
2215         case "$firsttime" in
2216         true) echo $user >>../.config/instruct;;
2217         esac
2218 fi
2219
2220 : find out where common programs are
2221 echo " "
2222 echo "Locating common programs..." >&4
2223 cat <<EOSC >loc
2224 $startsh
2225 case \$# in
2226 0) exit 1;;
2227 esac
2228 thing=\$1
2229 shift
2230 dflt=\$1
2231 shift
2232 for dir in \$*; do
2233         case "\$thing" in
2234         .)
2235         if test -d \$dir/\$thing; then
2236                 echo \$dir
2237                 exit 0
2238         fi
2239         ;;
2240         *)
2241         for thisthing in \$dir/\$thing; do
2242                 : just loop through to pick last item
2243         done
2244         if test -f \$thisthing; then
2245                 echo \$thisthing
2246                 exit 0
2247         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2248                 echo \$thisthing
2249                 exit 0
2250         elif test -f \$dir/\$thing.exe; then
2251                 if test -n "$DJGPP"; then
2252                         echo \$dir/\$thing.exe
2253                 elif test "$eunicefix" != ":"; then
2254                         : on Eunice apparently
2255                         echo \$dir/\$thing
2256                         exit 0
2257                 fi
2258                 exit 0
2259         fi
2260         ;;
2261         esac
2262 done
2263 echo \$dflt
2264 exit 1
2265 EOSC
2266 chmod +x loc
2267 $eunicefix loc
2268 loclist="
2269 awk
2270 cat
2271 chmod
2272 comm
2273 cp
2274 echo
2275 expr
2276 grep
2277 ls
2278 mkdir
2279 rm
2280 sed
2281 sort
2282 touch
2283 tr
2284 uniq
2285 "
2286 trylist="
2287 Mcc
2288 ar
2289 bison
2290 byacc
2291 cpp
2292 csh
2293 date
2294 egrep
2295 gmake
2296 gzip
2297 less
2298 ln
2299 make
2300 more
2301 nm
2302 nroff
2303 pg
2304 test
2305 uname
2306 zip
2307 "
2308 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2309 pth="$pth /lib /usr/lib"
2310 for file in $loclist; do
2311         eval xxx=\$$file
2312         case "$xxx" in
2313         /*|?:[\\/]*)
2314                 if test -f "$xxx"; then
2315                         : ok
2316                 else
2317                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2318                         xxx=`./loc $file $file $pth`
2319                 fi
2320                 ;;
2321         '') xxx=`./loc $file $file $pth`;;
2322         *) xxx=`./loc $xxx $xxx $pth`;;
2323         esac
2324         eval $file=$xxx$_exe
2325         eval _$file=$xxx
2326         case "$xxx" in
2327         /*)
2328                 echo $file is in $xxx.
2329                 ;;
2330         ?:[\\/]*)
2331                 echo $file is in $xxx.
2332                 ;;
2333         *)
2334                 echo "I don't know where '$file' is, and my life depends on it." >&4
2335                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2336                 exit 1
2337                 ;;
2338         esac
2339 done
2340 echo " "
2341 echo "Don't worry if any of the following aren't found..."
2342 say=offhand
2343 for file in $trylist; do
2344         eval xxx=\$$file
2345         case "$xxx" in
2346         /*|?:[\\/]*)
2347                 if test -f "$xxx"; then
2348                         : ok
2349                 else
2350                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2351                         xxx=`./loc $file $file $pth`
2352                 fi
2353                 ;;
2354         '') xxx=`./loc $file $file $pth`;;
2355         *) xxx=`./loc $xxx $xxx $pth`;;
2356         esac
2357         eval $file=$xxx$_exe
2358         eval _$file=$xxx
2359         case "$xxx" in
2360         /*)
2361                 echo $file is in $xxx.
2362                 ;;
2363         ?:[\\/]*)
2364                 echo $file is in $xxx.
2365                 ;;
2366         *)
2367                 echo "I don't see $file out there, $say."
2368                 say=either
2369                 ;;
2370         esac
2371 done
2372 case "$egrep" in
2373 egrep)
2374         echo "Substituting grep for egrep."
2375         egrep=$grep
2376         _egrep=$grep
2377         ;;
2378 esac
2379 case "$ln" in
2380 ln)
2381         echo "Substituting cp for ln."
2382         ln=$cp
2383         _ln=$cp
2384         ;;
2385 esac
2386 case "$make" in
2387 make)   
2388         case "$gmake" in
2389         gmake)
2390         echo "I can't find make or gmake, and my life depends on it." >&4
2391         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2392         exit 1
2393         ;;
2394         esac
2395         ;;
2396 esac    
2397 case "$gmake" in
2398 gmake)  ;;
2399 *)      # We can't have osname yet.
2400         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2401                 # Assume that gmake, if found, is definitely GNU make
2402                 # and prefer it over the system make.
2403                 echo "Substituting gmake for make."
2404                 make=$gmake
2405                 _make=$gmake
2406         fi
2407         ;;
2408 esac
2409 case "$test" in
2410 test)
2411         echo "Hopefully test is built into your sh."
2412         ;;
2413 *)
2414         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2415                 echo "Using the test built into your sh."
2416                 test=test
2417                 _test=test
2418         fi
2419         ;;
2420 esac
2421 case "$echo" in
2422 echo)
2423         echo "Hopefully echo is built into your sh."
2424         ;;
2425 '') ;;
2426 *)
2427         echo " "
2428 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2429         $echo $n "hi there$c" >foo1
2430         echo $n "hi there$c" >foo2
2431         if cmp foo1 foo2 >/dev/null 2>&1; then
2432                 echo "They are compatible.  In fact, they may be identical."
2433         else
2434                 case "$n" in
2435                 '-n') n='' c='\c';;
2436                 *) n='-n' c='';;
2437                 esac
2438                 cat <<FOO
2439 They are not compatible!  You are probably running ksh on a non-USG system.
2440 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2441 have echo built in and we may have to run some Bourne shell scripts.  That
2442 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2443
2444 FOO
2445                 $echo $n "The star should be here-->$c"
2446                 $echo "*"
2447         fi
2448         $rm -f foo1 foo2
2449         ;;
2450 esac
2451
2452 cat <<EOS >trygcc
2453 $startsh
2454 EOS
2455 cat <<'EOSC' >>trygcc
2456 case "$cc" in
2457 '') ;;
2458 *)  $rm -f try try.*
2459     $cat >try.c <<EOM
2460 int main(int argc, char *argv[]) {
2461   return 0;
2462 }
2463 EOM
2464     if $cc -o try $ccflags $ldflags try.c; then
2465        :
2466     else
2467         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2468         despair=yes
2469         trygcc=yes
2470         case "$cc" in
2471         *gcc*) trygcc=no ;;
2472         esac
2473         case "`$cc -v -c try.c 2>&1`" in
2474         *gcc*) trygcc=no ;;
2475         esac
2476         if $test X"$trygcc" = Xyes; then
2477             if gcc -o try -c try.c; then
2478                 echo " "
2479                 echo "You seem to have a working gcc, though." >&4
2480                 rp="Would you like to use it?"
2481                 dflt=y
2482                 if $test -f myread; then
2483                     . ./myread
2484                 else
2485                     if $test -f UU/myread; then
2486                         . ./UU/myread
2487                     else
2488                         echo "Cannot find myread, sorry.  Aborting." >&2
2489                         exit 1
2490                     fi
2491                 fi  
2492                 case "$ans" in
2493                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2494                        if $test -f usethreads.cbu; then
2495                            $cat >&4 <<EOM 
2496
2497 *** However, any setting of the C compiler flags (e.g. for thread support)
2498 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2499 *** (together with e.g. -Dusethreads).
2500
2501 EOM
2502                        fi;;
2503                 esac
2504             fi
2505         fi
2506     fi
2507     $rm -f try try.*
2508     ;;
2509 esac
2510 EOSC
2511
2512 cat <<EOS >checkcc
2513 $startsh
2514 EOS
2515 cat <<'EOSC' >>checkcc
2516 case "$cc" in        
2517 '') ;;
2518 *)  $rm -f try try.*              
2519     $cat >try.c <<EOM
2520 int main(int argc, char *argv[]) {
2521   return 0;
2522 }
2523 EOM
2524     if $cc -o try $ccflags $ldflags try.c; then
2525        :
2526     else
2527         if $test X"$despair" = Xyes; then
2528            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2529         fi
2530         $cat >&4 <<EOM         
2531 You need to find a working C compiler.
2532 Either (purchase and) install the C compiler supplied by your OS vendor,
2533 or for a free C compiler try http://gcc.gnu.org/
2534 I cannot continue any further, aborting.
2535 EOM
2536         exit 1
2537     fi
2538     $rm -f try try.*
2539     ;;
2540 esac
2541 EOSC
2542
2543 : determine whether symbolic links are supported
2544 echo " "
2545 $touch blurfl
2546 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2547         echo "Symbolic links are supported." >&4
2548         lns="$ln -s"
2549 else
2550         echo "Symbolic links are NOT supported." >&4
2551         lns="$ln"
2552 fi
2553 $rm -f blurfl sym
2554
2555 : determine whether symbolic links are supported
2556 echo " "
2557 case "$lns" in
2558 *"ln"*" -s")
2559         echo "Checking how to test for symbolic links..." >&4
2560         $lns blurfl sym
2561         if $test "X$issymlink" = X; then
2562                 case "$newsh" in
2563                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2564                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2565                 esac
2566                 if test $? = 0; then
2567                         issymlink="test -h"
2568                 else
2569                         echo "Your builtin 'test -h' may be broken." >&4
2570                         case "$test" in
2571                         /*)     ;;
2572                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2573                                 for p in $pth
2574                                 do
2575                                         if test -f "$p/$test"; then
2576                                                 test="$p/$test"
2577                                                 break
2578                                         fi
2579                                 done
2580                                 ;;
2581                         esac
2582                         case "$test" in
2583                         /*)
2584                                 echo "Trying external '$test -h'." >&4
2585                                 issymlink="$test -h"
2586                                 if $test ! -h sym >/dev/null 2>&1; then
2587                                         echo "External '$test -h' is broken, too." >&4
2588                                         issymlink=''
2589                                 fi
2590                                 ;;
2591                         *)      issymlink='' ;;
2592                         esac
2593                 fi              
2594         fi
2595         if $test "X$issymlink" = X; then
2596                 if $test -L sym 2>/dev/null; then
2597                         issymlink="$test -L"
2598                         echo "The builtin '$test -L' worked." >&4
2599                 fi
2600         fi
2601         if $test "X$issymlink" != X; then
2602                 echo "You can test for symbolic links with '$issymlink'." >&4
2603         else
2604                 echo "I do not know how you can test for symbolic links." >&4
2605         fi
2606         $rm -f blurfl sym
2607         ;;
2608 *)      echo "No symbolic links, so not testing for their testing..." >&4
2609         ;;
2610 esac
2611 echo " "
2612
2613
2614 case "$mksymlinks" in
2615 $define|true|[yY]*)
2616         case "$src" in
2617         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2618                 exit 1
2619                 ;;
2620         *)      case "$lns:$issymlink" in
2621                 *"ln"*" -s:"*"test -"?)
2622                         echo "Creating the symbolic links..." >&4
2623                         echo "(First creating the subdirectories...)" >&4
2624                         cd ..
2625                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2626                                 read directory
2627                                 test -z "$directory" && break
2628                                 mkdir -p $directory
2629                         done
2630                         # Sanity check 1.
2631                         if test ! -d t/base; then
2632                                 echo "Failed to create the subdirectories.  Aborting." >&4
2633                                 exit 1
2634                         fi
2635                         echo "(Then creating the symlinks...)" >&4
2636                         awk '{print $1}' $src/MANIFEST | while true; do
2637                                 read filename
2638                                 test -z "$filename" && break
2639                                 if test -f $filename; then
2640                                         if $issymlink $filename; then
2641                                                 rm -f $filename
2642                                         fi
2643                                 fi
2644                                 if test -f $filename; then
2645                                         echo "$filename already exists, not symlinking."
2646                                 else
2647                                         ln -s $src/$filename $filename
2648                                 fi
2649                         done
2650                         # Sanity check 2.
2651                         if test ! -f t/base/lex.t; then
2652                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2653                                 exit 1
2654                         fi
2655                         cd UU
2656                         ;;
2657                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2658                         ;;
2659                 esac
2660                 ;;
2661         esac
2662         ;;
2663 esac
2664
2665
2666 case "$usecrosscompile" in
2667 $define|true|[yY]*)
2668         $echo "Cross-compiling..."
2669         croak=''
2670         case "$cc" in
2671         *-*-gcc) # A cross-compiling gcc, probably.
2672             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2673             ar=$targetarch-ar
2674             # leave out ld, choosing it is more complex
2675             nm=$targetarch-nm
2676             ranlib=$targetarch-ranlib
2677             $echo 'extern int foo;' > try.c
2678             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2679             shift
2680             if $test $# -gt 0; then
2681                 incpth="$incpth $*"
2682                 incpth="`$echo $incpth|$sed 's/^ //'`"
2683                 echo "Guessing incpth '$incpth'." >&4
2684                 for i in $*; do
2685                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2686                     if $test -d $j; then
2687                         libpth="$libpth $j"
2688                     fi
2689                 done   
2690                 libpth="`$echo $libpth|$sed 's/^ //'`"
2691                 echo "Guessing libpth '$libpth'." >&4
2692             fi
2693             $rm -f try.c
2694             ;;
2695         esac
2696         case "$targetarch" in
2697         '') echo "Targetarch not defined." >&4; croak=y ;;
2698         *)  echo "Using targetarch $targetarch." >&4 ;;
2699         esac
2700         case "$incpth" in
2701         '') echo "Incpth not defined." >&4; croak=y ;;
2702         *)  echo "Using incpth '$incpth'." >&4 ;;
2703         esac
2704         case "$libpth" in
2705         '') echo "Libpth not defined." >&4; croak=y ;;
2706         *)  echo "Using libpth '$libpth'." >&4 ;;
2707         esac
2708         case "$usrinc" in
2709         '') for i in $incpth; do
2710                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2711                     usrinc=$i
2712                     echo "Guessing usrinc $usrinc." >&4
2713                     break
2714                 fi
2715             done
2716             case "$usrinc" in
2717             '') echo "Usrinc not defined." >&4; croak=y ;;
2718             esac
2719             ;;
2720         *)  echo "Using usrinc $usrinc." >&4 ;;
2721         esac
2722         case "$targethost" in
2723         '') echo "Targethost not defined." >&4; croak=y ;;
2724         *)  echo "Using targethost $targethost." >&4
2725         esac
2726         locincpth=' '
2727         loclibpth=' '
2728         case "$croak" in
2729         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2730         esac
2731         case "$src" in
2732         /*) run=$src/Cross/run
2733             targetmkdir=$src/Cross/mkdir
2734             to=$src/Cross/to
2735             from=$src/Cross/from
2736             ;;
2737         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2738             run=$pwd/Cross/run
2739             targetmkdir=$pwd/Cross/mkdir
2740             to=$pwd/Cross/to
2741             from=$pwd/Cross/from
2742             ;;
2743         esac
2744         case "$targetrun" in
2745         '') targetrun=ssh ;;
2746         esac
2747         case "$targetto" in
2748         '') targetto=scp ;;
2749         esac
2750         case "$targetfrom" in
2751         '') targetfrom=scp ;;
2752         esac
2753         run=$run-$targetrun
2754         to=$to-$targetto
2755         from=$from-$targetfrom
2756         case "$targetdir" in
2757         '')  targetdir=/tmp
2758              echo "Guessing targetdir $targetdir." >&4
2759              ;;
2760         esac
2761         case "$targetuser" in
2762         '')  targetuser=root
2763              echo "Guessing targetuser $targetuser." >&4
2764              ;;
2765         esac
2766         case "$targetfrom" in
2767         scp)    q=-q ;;
2768         *)      q='' ;;
2769         esac
2770         case "$targetrun" in
2771         ssh|rsh)
2772             cat >$run <<EOF
2773 #!/bin/sh
2774 case "\$1" in
2775 -cwd)
2776   shift
2777   cwd=\$1
2778   shift
2779   ;;
2780 esac
2781 case "\$cwd" in
2782 '') cwd=$targetdir ;;
2783 esac
2784 exe=\$1
2785 shift
2786 if $test ! -f \$exe.xok; then
2787   $to \$exe
2788   $touch \$exe.xok
2789 fi
2790 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2791 EOF
2792             ;;
2793         *)  echo "Unknown targetrun '$targetrun'" >&4
2794             exit 1
2795             ;;
2796         esac
2797         case "$targetmkdir" in
2798         */Cross/mkdir)
2799             cat >$targetmkdir <<EOF
2800 #!/bin/sh
2801 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2802 EOF
2803             $chmod a+rx $targetmkdir
2804             ;;
2805         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2806             exit 1
2807             ;;
2808         esac
2809         case "$targetto" in
2810         scp|rcp)
2811             cat >$to <<EOF
2812 #!/bin/sh
2813 for f in \$@
2814 do
2815   case "\$f" in
2816   /*)
2817     $targetmkdir \`dirname \$f\`
2818     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2819     ;;
2820   *)
2821     $targetmkdir $targetdir/\`dirname \$f\`
2822     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2823     ;;
2824   esac
2825 done
2826 exit 0
2827 EOF
2828             ;;
2829         cp) cat >$to <<EOF
2830 #!/bin/sh
2831 for f in \$@
2832 do
2833   case "\$f" in
2834   /*)
2835     $mkdir -p $targetdir/\`dirname \$f\`
2836     $cp \$f $targetdir/\$f || exit 1
2837     ;;
2838   *)
2839     $targetmkdir $targetdir/\`dirname \$f\`
2840     $cp \$f $targetdir/\$f || exit 1
2841     ;;
2842   esac
2843 done
2844 exit 0
2845 EOF
2846             ;;
2847         *)  echo "Unknown targetto '$targetto'" >&4
2848             exit 1
2849             ;;
2850         esac
2851         case "$targetfrom" in
2852         scp|rcp)
2853           cat >$from <<EOF
2854 #!/bin/sh
2855 for f in \$@
2856 do
2857   $rm -f \$f
2858   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2859 done
2860 exit 0
2861 EOF
2862             ;;
2863         cp) cat >$from <<EOF
2864 #!/bin/sh
2865 for f in \$@
2866 do
2867   $rm -f \$f
2868   cp $targetdir/\$f . || exit 1
2869 done
2870 exit 0
2871 EOF
2872             ;;
2873         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2874             exit 1
2875             ;;
2876         esac
2877         if $test ! -f $run; then
2878             echo "Target 'run' script '$run' not found." >&4
2879         else
2880             $chmod a+rx $run
2881         fi
2882         if $test ! -f $to; then
2883             echo "Target 'to' script '$to' not found." >&4
2884         else
2885             $chmod a+rx $to
2886         fi
2887         if $test ! -f $from; then
2888             echo "Target 'from' script '$from' not found." >&4
2889         else
2890             $chmod a+rx $from
2891         fi
2892         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2893             exit 1
2894         fi
2895         cat >&4 <<EOF
2896 Using '$run' for remote execution,
2897 and '$from' and '$to'
2898 for remote file transfer.
2899 EOF
2900         ;;
2901 *)      run=''
2902         to=:
2903         from=:
2904         usecrosscompile='undef'
2905         targetarch=''
2906         ;;
2907 esac
2908
2909 : see whether [:lower:] and [:upper:] are supported character classes
2910 echo " "
2911 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2912 ABYZ)
2913         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2914         up='[:upper:]'
2915         low='[:lower:]'
2916         ;;
2917 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2918         # (0xd9 and 0xe2), therefore that is a nice testing point.
2919         if test "X$up" = X -o "X$low" = X; then
2920             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2921             rs) up='[A-Z]'
2922                 low='[a-z]'
2923                 ;;
2924             esac
2925         fi
2926         if test "X$up" = X -o "X$low" = X; then
2927             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2928             rs) up='A-Z'
2929                 low='a-z'
2930                 ;;
2931             esac
2932         fi
2933         if test "X$up" = X -o "X$low" = X; then
2934             case "`echo RS | od -x 2>/dev/null`" in
2935             *D9E2*|*d9e2*)
2936                 echo "Hey, this might be EBCDIC." >&4
2937                 if test "X$up" = X -o "X$low" = X; then
2938                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2939                     rs) up='[A-IJ-RS-Z]'
2940                         low='[a-ij-rs-z]'
2941                         ;;
2942                     esac
2943                 fi
2944                 if test "X$up" = X -o "X$low" = X; then
2945                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2946                     rs) up='A-IJ-RS-Z'
2947                         low='a-ij-rs-z'
2948                         ;;
2949                     esac
2950                 fi
2951                 ;;
2952             esac
2953         fi
2954 esac
2955 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2956 rs)
2957     echo "Using $up and $low to convert case." >&4
2958     ;;
2959 *)
2960     echo "I don't know how to translate letters from upper to lower case." >&4
2961     echo "Your tr is not acting any way I know of." >&4
2962     exit 1
2963     ;;
2964 esac
2965 : set up the translation script tr, must be called with ./tr of course
2966 cat >tr <<EOSC
2967 $startsh
2968 case "\$1\$2" in
2969 '[A-Z][a-z]') exec $tr '$up' '$low';;
2970 '[a-z][A-Z]') exec $tr '$low' '$up';;
2971 esac
2972 exec $tr "\$@"
2973 EOSC
2974 chmod +x tr
2975 $eunicefix tr
2976
2977 : Try to determine whether config.sh was made on this system
2978 case "$config_sh" in
2979 '')
2980 myuname=`$uname -a 2>/dev/null`
2981 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2982 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2983 # because the A-Z/a-z are not consecutive.
2984 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2985         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2986 newmyuname="$myuname"
2987 dflt=n
2988 case "$knowitall" in
2989 '')
2990         if test -f ../config.sh; then
2991                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2992                         eval "`grep myuname= ../config.sh`"
2993                 fi
2994                 if test "X$myuname" = "X$newmyuname"; then
2995                         dflt=y
2996                 fi
2997         fi
2998         ;;
2999 *) dflt=y;;
3000 esac
3001
3002 : Get old answers from old config file if Configure was run on the
3003 : same system, otherwise use the hints.
3004 hint=default
3005 cd ..
3006 if test -f config.sh; then
3007         echo " "
3008         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3009         . UU/myread
3010         case "$ans" in
3011         n*|N*) echo "OK, I'll ignore it."
3012                 mv config.sh config.sh.old
3013                 myuname="$newmyuname"
3014                 ;;
3015         *)  echo "Fetching default answers from your old config.sh file..." >&4
3016                 tmp_n="$n"
3017                 tmp_c="$c"
3018                 tmp_sh="$sh"
3019                 . ./config.sh
3020                 cp config.sh UU
3021                 n="$tmp_n"
3022                 c="$tmp_c"
3023                 : Older versions did not always set $sh.  Catch re-use of such
3024                 : an old config.sh.
3025                 case "$sh" in
3026                 '') sh="$tmp_sh" ;;
3027                 esac
3028                 hint=previous
3029                 ;;
3030         esac
3031 fi
3032 . ./UU/checkcc
3033 if test ! -f config.sh; then
3034         $cat <<EOM
3035
3036 First time through, eh?  I have some defaults handy for some systems
3037 that need some extra help getting the Configure answers right:
3038
3039 EOM
3040         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3041         dflt=''
3042         : Half the following guesses are probably wrong... If you have better
3043         : tests or hints, please send them to perlbug@perl.org
3044         : The metaconfig authors would also appreciate a copy...
3045         $test -f /irix && osname=irix
3046         $test -f /xenix && osname=sco_xenix
3047         $test -f /dynix && osname=dynix
3048         $test -f /dnix && osname=dnix
3049         $test -f /lynx.os && osname=lynxos
3050         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3051         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3052         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3053         $test -f /bin/mips && /bin/mips && osname=mips
3054         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3055                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3056         $test -d /usr/apollo/bin && osname=apollo
3057         $test -f /etc/saf/_sactab && osname=svr4
3058         $test -d /usr/include/minix && osname=minix
3059         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3060         if $test -d /MachTen -o -d /MachTen_Folder; then
3061                 osname=machten
3062                 if $test -x /sbin/version; then
3063                         osvers=`/sbin/version | $awk '{print $2}' |
3064                         $sed -e 's/[A-Za-z]$//'`
3065                 elif $test -x /usr/etc/version; then
3066                         osvers=`/usr/etc/version | $awk '{print $2}' |
3067                         $sed -e 's/[A-Za-z]$//'`
3068                 else
3069                         osvers="$2.$3"
3070                 fi
3071         fi
3072
3073         $test -f /sys/posix.dll &&
3074                 $test -f /usr/bin/what &&
3075                 set X `/usr/bin/what /sys/posix.dll` &&
3076                 $test "$3" = UWIN &&
3077                 osname=uwin &&
3078                 osvers="$5"
3079
3080         if $test -f $uname; then
3081                 set X $myuname
3082                 shift
3083
3084                 case "$5" in
3085                 fps*) osname=fps ;;
3086                 mips*)
3087                         case "$4" in
3088                         umips) osname=umips ;;
3089                         *) osname=mips ;;
3090                         esac;;
3091                 [23]100) osname=mips ;;
3092                 next*) osname=next ;;
3093                 i386*)
3094                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3095                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3096                                 osname='sco'
3097                                 osvers=$tmp
3098                         elif $test -f /etc/kconfig; then
3099                                 osname=isc
3100                                 if test "$lns" = "$ln -s"; then
3101                                         osvers=4
3102                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3103                                         osvers=3
3104                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3105                                         osvers=2
3106                                 fi
3107                         fi
3108                         tmp=''
3109                         ;;
3110                 pc*)
3111                         if test -n "$DJGPP"; then
3112                                 osname=dos
3113                                 osvers=djgpp
3114                         fi
3115                         ;;
3116                 esac
3117
3118                 case "$1" in
3119                 aix) osname=aix
3120                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3121                         case "$tmp" in
3122                         # oslevel can fail with:
3123                         # oslevel: Unable to acquire lock.
3124                         *not\ found) osvers="$4"."$3" ;;
3125                         '<3240'|'<>3240') osvers=3.2.0 ;;
3126                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3127                         '=3250'|'>3250') osvers=3.2.5 ;;
3128                         *) osvers=$tmp;;
3129                         esac
3130                         ;;
3131                 bsd386) osname=bsd386
3132                         osvers=`$uname -r`
3133                         ;;
3134                 cygwin*) osname=cygwin
3135                         osvers="$3"
3136                         ;;
3137                 *dc.osx) osname=dcosx
3138                         osvers="$3"
3139                         ;;
3140                 dnix) osname=dnix
3141                         osvers="$3"
3142                         ;;
3143                 domainos) osname=apollo
3144                         osvers="$3"
3145                         ;;
3146                 dgux)   osname=dgux
3147                         osvers="$3"
3148                         ;;
3149                 dragonfly) osname=dragonfly
3150                         osvers="$3"
3151                         ;;
3152                 dynixptx*) osname=dynixptx
3153                         osvers=`echo "$4"|sed 's/^v//'`
3154                         ;;
3155                 freebsd) osname=freebsd
3156                         osvers="$3" ;;
3157                 genix)  osname=genix ;;
3158                 gnu)    osname=gnu
3159                         osvers="$3" ;;
3160                 hp*)    osname=hpux
3161                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3162                         ;;
3163                 irix*)  osname=irix
3164                         case "$3" in
3165                         4*) osvers=4 ;;
3166                         5*) osvers=5 ;;
3167                         *)      osvers="$3" ;;
3168                         esac
3169                         ;;
3170                 linux)  osname=linux
3171                         case "$3" in
3172                         *)      osvers="$3" ;;
3173                         esac
3174                         ;;
3175                 MiNT)   osname=mint
3176                         ;;
3177                 netbsd*) osname=netbsd
3178                         osvers="$3"
3179                         ;;
3180                 news-os) osvers="$3"
3181                         case "$3" in
3182                         4*) osname=newsos4 ;;
3183                         *) osname=newsos ;;
3184                         esac
3185                         ;;
3186                 next*) osname=next ;;
3187                 nonstop-ux) osname=nonstopux ;;
3188                 openbsd) osname=openbsd
3189                         osvers="$3"
3190                         ;;
3191                 os2)    osname=os2
3192                         osvers="$4"
3193                         ;;
3194                 POSIX-BC | posix-bc ) osname=posix-bc
3195                         osvers="$3"
3196                         ;;
3197                 powerux | power_ux | powermax_os | powermaxos | \
3198                 powerunix | power_unix) osname=powerux
3199                         osvers="$3"
3200                         ;;
3201                 qnx) osname=qnx
3202                         osvers="$4"
3203                         ;;
3204                 solaris) osname=solaris
3205                         case "$3" in
3206                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3207                         *)      osvers="$3" ;;
3208                         esac
3209                         ;;
3210                 sunos) osname=sunos
3211                         case "$3" in
3212                         5*) osname=solaris
3213                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3214                         *)      osvers="$3" ;;
3215                         esac
3216                         ;;
3217                 titanos) osname=titanos
3218                         case "$3" in
3219                         1*) osvers=1 ;;
3220                         2*) osvers=2 ;;
3221                         3*) osvers=3 ;;
3222                         4*) osvers=4 ;;
3223                         *)      osvers="$3" ;;
3224                         esac
3225                         ;;
3226                 ultrix) osname=ultrix
3227                         osvers="$3"
3228                         ;;
3229                 osf1|mls+)      case "$5" in
3230                                 alpha)
3231                                         osname=dec_osf
3232                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3233                                         case "$osvers" in
3234                                         [1-9].[0-9]*) ;;
3235                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3236                                         esac
3237                                         ;;
3238                         hp*)    osname=hp_osf1  ;;
3239                         mips)   osname=mips_osf1 ;;
3240                         esac
3241                         ;;
3242                 # UnixWare 7.1.2 is known as Open UNIX 8
3243                 openunix|unixware) osname=svr5
3244                         osvers="$4"
3245                         ;;
3246                 uts)    osname=uts
3247                         osvers="$3"
3248                         ;;
3249                 vos) osvers="$3"
3250                         ;;
3251                 $2) case "$osname" in
3252                         *isc*) ;;
3253                         *freebsd*) ;;
3254                         svr*)
3255                                 : svr4.x or possibly later
3256                                 case "svr$3" in
3257                                 ${osname}*)
3258                                         osname=svr$3
3259                                         osvers=$4
3260                                         ;;
3261                                 esac
3262                                 case "$osname" in
3263                                 svr4.0)
3264                                         : Check for ESIX
3265                                         if test -f /stand/boot ; then
3266                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3267                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3268                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3269                                                         if test -n "$isesix"; then
3270                                                                 osname=esix4
3271                                                         fi
3272                                                 fi
3273                                         fi
3274                                         ;;
3275                                 esac
3276                                 ;;
3277                         *)      if test -f /etc/systemid; then
3278                                         osname=sco
3279                                         set `echo $3 | $sed 's/\./ /g'` $4
3280                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3281                                                 osvers=$1.$2.$3
3282                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3283                                                 osvers=$1.$2
3284                                         elif $test -f $src/hints/sco_$1.sh; then
3285                                                 osvers=$1
3286                                         fi
3287                                 else
3288                                         case "$osname" in
3289                                         '') : Still unknown.  Probably a generic Sys V.
3290                                                 osname="sysv"
3291                                                 osvers="$3"
3292                                                 ;;
3293                                         esac
3294                                 fi
3295                                 ;;
3296                         esac
3297                         ;;
3298                 *)      case "$osname" in
3299                         '') : Still unknown.  Probably a generic BSD.
3300                                 osname="$1"
3301                                 osvers="$3"
3302                                 ;;
3303                         esac
3304                         ;;
3305                 esac
3306         else
3307                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3308                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3309                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3310                                 osname=news_os
3311                         fi
3312                         $rm -f UU/kernel.what
3313                 elif test -d c:/. -o -n "$is_os2" ; then
3314                         set X $myuname
3315                         osname=os2
3316                         osvers="$5"
3317                 fi
3318         fi
3319
3320         case "$targetarch" in
3321         '') ;;
3322         *)  hostarch=$osname
3323             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3324             osvers=''
3325             ;;
3326         esac
3327
3328         : Now look for a hint file osname_osvers, unless one has been
3329         : specified already.
3330         case "$hintfile" in
3331         ''|' ')
3332                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3333                 : Also try without trailing minor version numbers.
3334                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3335                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3336                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3337                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3338                 case "$file" in
3339                 '') dflt=none ;;
3340                 *)  case "$osvers" in
3341                         '') dflt=$file
3342                                 ;;
3343                         *)  if $test -f $src/hints/$file.sh ; then
3344                                         dflt=$file
3345                                 elif $test -f $src/hints/$xfile.sh ; then
3346                                         dflt=$xfile
3347                                 elif $test -f $src/hints/$xxfile.sh ; then
3348                                         dflt=$xxfile
3349                                 elif $test -f $src/hints/$xxxfile.sh ; then
3350                                         dflt=$xxxfile
3351                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3352                                         dflt=$xxxxfile
3353                                 elif $test -f "$src/hints/${osname}.sh" ; then
3354                                         dflt="${osname}"
3355                                 else
3356                                         dflt=none
3357                                 fi
3358                                 ;;
3359                         esac
3360                         ;;
3361                 esac
3362                 if $test -f Policy.sh ; then
3363                         case "$dflt" in
3364                         *Policy*) ;;
3365                         none) dflt="Policy" ;;
3366                         *) dflt="Policy $dflt" ;;
3367                         esac
3368                 fi
3369                 ;;
3370         *)
3371                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3372                 ;;
3373         esac
3374
3375         if $test -f Policy.sh ; then
3376                 $cat <<EOM
3377
3378 There's also a Policy hint file available, which should make the
3379 site-specific (policy) questions easier to answer.
3380 EOM
3381
3382         fi
3383
3384         $cat <<EOM
3385
3386 You may give one or more space-separated answers, or "none" if appropriate.
3387 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3388 is a good thing.  DO NOT give a wrong version or a wrong OS.
3389
3390 EOM
3391
3392         rp="Which of these apply, if any?"
3393         . UU/myread
3394         tans=$ans
3395         for file in $tans; do
3396                 if $test X$file = XPolicy -a -f Policy.sh; then
3397                         . Policy.sh
3398                         $cat Policy.sh >> UU/config.sh
3399                 elif $test -f $src/hints/$file.sh; then
3400                         . $src/hints/$file.sh
3401                         $cat $src/hints/$file.sh >> UU/config.sh
3402                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3403                         : nothing
3404                 else
3405                         : Give one chance to correct a possible typo.
3406                         echo "$file.sh does not exist"
3407                         dflt=$file
3408                         rp="hint to use instead?"
3409                         . UU/myread
3410                         for file in $ans; do
3411                                 if $test -f "$src/hints/$file.sh"; then
3412                                         . $src/hints/$file.sh
3413                                         $cat $src/hints/$file.sh >> UU/config.sh
3414                                 elif $test X$ans = X -o X$ans = Xnone ; then
3415                                         : nothing
3416                                 else
3417                                         echo "$file.sh does not exist -- ignored."
3418                                 fi
3419                         done
3420                 fi
3421         done
3422
3423         hint=recommended
3424         : Remember our hint file for later.
3425         if $test -f "$src/hints/$file.sh" ; then
3426                 hintfile="$file"
3427         else
3428                 hintfile=''
3429         fi
3430 fi
3431 cd UU
3432 ;;
3433 *)
3434         echo " "
3435         echo "Fetching default answers from $config_sh..." >&4
3436         tmp_n="$n"
3437         tmp_c="$c"
3438         cd ..
3439         cp $config_sh config.sh 2>/dev/null
3440         chmod +w config.sh
3441         . ./config.sh
3442         cd UU
3443         cp ../config.sh .
3444         n="$tmp_n"
3445         c="$tmp_c"
3446         hint=previous
3447         ;;
3448 esac
3449 test "$override" && . ./optdef.sh
3450
3451 : Restore computed paths
3452 for file in $loclist $trylist; do
3453         eval $file="\$_$file"
3454 done
3455
3456 cat << EOM
3457
3458 Configure uses the operating system name and version to set some defaults.
3459 The default value is probably right if the name rings a bell. Otherwise,
3460 since spelling matters for me, either accept the default or answer "none"
3461 to leave it blank.
3462
3463 EOM
3464 case "$osname" in
3465         ''|' ')
3466                 case "$hintfile" in
3467                 ''|' '|none) dflt=none ;;
3468                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3469                 esac
3470                 ;;
3471         *) dflt="$osname" ;;
3472 esac
3473 rp="Operating system name?"
3474 . ./myread
3475 case "$ans" in
3476 none)  osname='' ;;
3477 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3478 esac
3479 echo " "
3480 case "$osvers" in
3481         ''|' ')
3482                 case "$hintfile" in
3483                 ''|' '|none) dflt=none ;;
3484                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3485                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3486                         case "$dflt" in
3487                         ''|' ') dflt=none ;;
3488                         esac
3489                         ;;
3490                 esac
3491                 ;;
3492         *) dflt="$osvers" ;;
3493 esac
3494 rp="Operating system version?"
3495 . ./myread
3496 case "$ans" in
3497 none)  osvers='' ;;
3498 *) osvers="$ans" ;;
3499 esac
3500
3501
3502 . ./posthint.sh
3503
3504 : who configured the system
3505 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3506 case "$cf_by" in
3507 "")
3508         cf_by=`(logname) 2>/dev/null`
3509         case "$cf_by" in
3510         "")
3511                 cf_by=`(whoami) 2>/dev/null`
3512                 case "$cf_by" in
3513                 "") cf_by=unknown ;;
3514                 esac ;;
3515         esac ;;
3516 esac
3517
3518 : decide how portable to be.  Allow command line overrides.
3519 case "$d_portable" in
3520 "$undef") ;;
3521 *)      d_portable="$define" ;;
3522 esac
3523
3524 : set up shell script to do ~ expansion
3525 cat >filexp <<EOSS
3526 $startsh
3527 : expand filename
3528 case "\$1" in
3529  ~/*|~)
3530         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3531         ;;
3532  ~*)
3533         if $test -f /bin/csh; then
3534                 /bin/csh -f -c "glob \$1"
3535                 failed=\$?
3536                 echo ""
3537                 exit \$failed
3538         else
3539                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3540                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3541                 if $test ! -d "\$dir"; then
3542                         me=\`basename \$0\`
3543                         echo "\$me: can't locate home directory for: \$name" >&2
3544                         exit 1
3545                 fi
3546                 case "\$1" in
3547                 */*)
3548                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3549                         ;;
3550                 *)
3551                         echo \$dir
3552                         ;;
3553                 esac
3554         fi
3555         ;;
3556 *)
3557         echo \$1
3558         ;;
3559 esac
3560 EOSS
3561 chmod +x filexp
3562 $eunicefix filexp
3563
3564 : now set up to get a file name
3565 cat <<EOS >getfile
3566 $startsh
3567 EOS
3568 cat <<'EOSC' >>getfile
3569 tilde=''
3570 fullpath=''
3571 already=''
3572 skip=''
3573 none_ok=''
3574 exp_file=''
3575 nopath_ok=''
3576 orig_rp="$rp"
3577 orig_dflt="$dflt"
3578 case "$gfpth" in
3579 '') gfpth='.' ;;
3580 esac
3581
3582 case "$fn" in
3583 *\(*)
3584         : getfile will accept an answer from the comma-separated list
3585         : enclosed in parentheses even if it does not meet other criteria.
3586         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3587         fn=`echo $fn | sed 's/(.*)//'`
3588         ;;
3589 esac
3590
3591 case "$fn" in
3592 *:*)
3593         loc_file=`expr $fn : '.*:\(.*\)'`
3594         fn=`expr $fn : '\(.*\):.*'`
3595         ;;
3596 esac
3597
3598 case "$fn" in
3599 *~*) tilde=true;;
3600 esac
3601 case "$fn" in
3602 */*) fullpath=true;;
3603 esac
3604 case "$fn" in
3605 *+*) skip=true;;
3606 esac
3607 case "$fn" in
3608 *n*) none_ok=true;;
3609 esac
3610 case "$fn" in
3611 *e*) exp_file=true;;
3612 esac
3613 case "$fn" in
3614 *p*) nopath_ok=true;;
3615 esac
3616
3617 case "$fn" in
3618 *f*) type='File';;
3619 *d*) type='Directory';;
3620 *l*) type='Locate';;
3621 esac
3622
3623 what="$type"
3624 case "$what" in
3625 Locate) what='File';;
3626 esac
3627
3628 case "$exp_file" in
3629 '')
3630         case "$d_portable" in
3631         "$define") ;;
3632         *) exp_file=true;;
3633         esac
3634         ;;
3635 esac
3636
3637 cd ..
3638 while test "$type"; do
3639         redo=''
3640         rp="$orig_rp"
3641         dflt="$orig_dflt"
3642         case "$tilde" in
3643         true) rp="$rp (~name ok)";;
3644         esac
3645         . UU/myread
3646         if test -f UU/getfile.ok && \
3647                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3648         then
3649                 value="$ans"
3650                 ansexp="$ans"
3651                 break
3652         fi
3653         case "$ans" in
3654         none)
3655                 value=''
3656                 ansexp=''
3657                 case "$none_ok" in
3658                 true) type='';;
3659                 esac
3660                 ;;
3661         *)
3662                 case "$tilde" in
3663                 '') value="$ans"
3664                         ansexp="$ans";;
3665                 *)
3666                         value=`UU/filexp $ans`
3667                         case $? in
3668                         0)
3669                                 if test "$ans" != "$value"; then
3670                                         echo "(That expands to $value on this system.)"
3671                                 fi
3672                                 ;;
3673                         *) value="$ans";;
3674                         esac
3675                         ansexp="$value"
3676                         case "$exp_file" in
3677                         '') value="$ans";;
3678                         esac
3679                         ;;
3680                 esac
3681                 case "$fullpath" in
3682                 true)
3683                         case "$ansexp" in
3684                         /*) value="$ansexp" ;;
3685                         [a-zA-Z]:/*) value="$ansexp" ;;
3686                         *)
3687                                 redo=true
3688                                 case "$already" in
3689                                 true)
3690                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3691                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3692                                         ;;
3693                                 *)
3694                                 echo "Please give a full path name, starting with slash." >&4
3695                                         case "$tilde" in
3696                                         true)
3697                                 echo "Note that using ~name is ok provided it expands well." >&4
3698                                                 already=true
3699                                                 ;;
3700                                         esac
3701                                 esac
3702                                 ;;
3703                         esac
3704                         ;;
3705                 esac
3706                 case "$redo" in
3707                 '')
3708                         case "$type" in
3709                         File)
3710                                 for fp in $gfpth; do
3711                                         if test "X$fp" = X.; then
3712                                             pf="$ansexp"
3713                                         else    
3714                                             pf="$fp/$ansexp"
3715                                         fi
3716                                         if test -f "$pf"; then
3717                                                 type=''
3718                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3719                                         then
3720                                                 echo "($value is not a plain file, but that's ok.)"
3721                                                 type=''
3722                                         fi
3723                                         if test X"$type" = X; then
3724                                             value="$pf"
3725                                             break
3726                                         fi
3727                                 done
3728                                 ;;
3729                         Directory)
3730                                 for fp in $gfpth; do
3731                                         if test "X$fp" = X.; then
3732                                             dir="$ans"
3733                                             direxp="$ansexp"
3734                                         else    
3735                                             dir="$fp/$ansexp"
3736                                             direxp="$fp/$ansexp"
3737                                         fi
3738                                         if test -d "$direxp"; then
3739                                                 type=''
3740                                                 value="$dir"
3741                                                 break
3742                                         fi
3743                                 done
3744                                 ;;
3745                         Locate)
3746                                 if test -d "$ansexp"; then
3747                                         echo "(Looking for $loc_file in directory $value.)"
3748                                         value="$value/$loc_file"
3749                                         ansexp="$ansexp/$loc_file"
3750                                 fi
3751                                 if test -f "$ansexp"; then
3752                                         type=''
3753                                 fi
3754                                 case "$nopath_ok" in
3755                                 true)   case "$value" in
3756                                         */*) ;;
3757                                         *)      echo "Assuming $value will be in people's path."
3758                                                 type=''
3759                                                 ;;
3760                                         esac
3761                                         ;;
3762                                 esac
3763                                 ;;
3764                         esac
3765
3766                         case "$skip" in
3767                         true) type='';
3768                         esac
3769
3770                         case "$type" in
3771                         '') ;;
3772                         *)
3773                                 if test "$fastread" = yes; then
3774                                         dflt=y
3775                                 else
3776                                         dflt=n
3777                                 fi
3778                                 rp="$what $value doesn't exist.  Use that name anyway?"
3779                                 . UU/myread
3780                                 dflt=''
3781                                 case "$ans" in
3782                                 y*) type='';;
3783                                 *) echo " ";;
3784                                 esac
3785                                 ;;
3786                         esac
3787                         ;;
3788                 esac
3789                 ;;
3790         esac
3791 done
3792 cd UU
3793 ans="$value"
3794 rp="$orig_rp"
3795 dflt="$orig_dflt"
3796 rm -f getfile.ok
3797 test "X$gfpthkeep" != Xy && gfpth=""
3798 EOSC
3799
3800 : determine root of directory hierarchy where package will be installed.
3801 case "$prefix" in
3802 '')
3803         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3804         ;;
3805 *?/)
3806         dflt=`echo "$prefix" | sed 's/.$//'`
3807         ;;
3808 *)
3809         dflt="$prefix"
3810         ;;
3811 esac
3812 $cat <<EOM
3813
3814 By default, $package will be installed in $dflt/bin, manual pages
3815 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3816 installation directories. Typically this is something like /usr/local.
3817 If you wish to have binaries under /usr/bin but other parts of the
3818 installation under /usr/local, that's ok: you will be prompted
3819 separately for each of the installation directories, the prefix being
3820 only used to set the defaults.
3821
3822 EOM
3823 fn=d~
3824 rp='Installation prefix to use?'
3825 . ./getfile
3826 oldprefix=''
3827 case "$prefix" in
3828 '') ;;
3829 *)
3830         case "$ans" in
3831         "$prefix") ;;
3832         *) oldprefix="$prefix";;
3833         esac
3834         ;;
3835 esac
3836 prefix="$ans"
3837 prefixexp="$ansexp"
3838
3839 case "$afsroot" in
3840 '')     afsroot=/afs ;;
3841 *)      afsroot=$afsroot ;;
3842 esac
3843
3844 : is AFS running?
3845 echo " "
3846 case "$afs" in
3847 $define|true)   afs=true ;;
3848 $undef|false)   afs=false ;;
3849 *)      if test -d $afsroot; then
3850                 afs=true
3851         else
3852                 afs=false
3853         fi
3854         ;;
3855 esac
3856 if $afs; then
3857         echo "AFS may be running... I'll be extra cautious then..." >&4
3858 else
3859         echo "AFS does not seem to be running..." >&4
3860 fi
3861
3862 : determine installation prefix for where package is to be installed.
3863 if $afs; then 
3864 $cat <<EOM
3865
3866 Since you are running AFS, I need to distinguish the directory in which
3867 files will reside from the directory in which they are installed (and from
3868 which they are presumably copied to the former directory by occult means).
3869
3870 EOM
3871         case "$installprefix" in
3872         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3873         *) dflt="$installprefix";;
3874         esac
3875 else
3876 $cat <<EOM
3877
3878 In some special cases, particularly when building $package for distribution,
3879 it is convenient to distinguish the directory in which files should be
3880 installed from the directory ($prefix) in which they will
3881 eventually reside.  For most users, these two directories are the same.
3882
3883 EOM
3884         case "$installprefix" in
3885         '') dflt=$prefix ;;
3886         *) dflt=$installprefix;;
3887         esac
3888 fi
3889 fn=d~
3890 rp='What installation prefix should I use for installing files?'
3891 . ./getfile
3892 installprefix="$ans"
3893 installprefixexp="$ansexp"
3894
3895 : Perform the prefixexp/installprefixexp correction if necessary
3896 cat <<EOS >installprefix
3897 $startsh
3898 EOS
3899 cat <<'EOSC' >>installprefix
3900 : Change installation prefix, if necessary.
3901 if $test X"$prefix" != X"$installprefix"; then
3902     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3903 else
3904     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3905 fi
3906 EOSC
3907 chmod +x installprefix
3908 $eunicefix installprefix
3909
3910 : Set variables such as privlib and privlibexp from the output of ./getfile
3911 : performing the prefixexp/installprefixexp correction if necessary.
3912 cat <<EOS >setprefixvar
3913 $startsh
3914 EOS
3915 cat <<'EOSC' >>setprefixvar
3916 eval "${prefixvar}=\"\$ans\""
3917 eval "${prefixvar}exp=\"\$ansexp\""
3918 . ./installprefix
3919 EOSC
3920 chmod +x setprefixvar
3921 $eunicefix setprefixvar
3922
3923 : set up the script used to warn in case of inconsistency
3924 cat <<EOS >whoa
3925 $startsh
3926 EOS
3927 cat <<'EOSC' >>whoa
3928 dflt=y
3929 echo " "
3930 echo "*** WHOA THERE!!! ***" >&4
3931 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3932 rp="    Keep the $hint value?"
3933 . ./myread
3934 case "$ans" in
3935 y) td=$was; tu=$was;;
3936 esac
3937 EOSC
3938
3939 : function used to set $1 to $val
3940 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3941 case "$val$was" in
3942 $define$undef) . ./whoa; eval "$var=\$td";;
3943 $undef$define) . ./whoa; eval "$var=\$tu";;
3944 *) eval "$var=$val";;
3945 esac'
3946
3947 case "$usesocks" in
3948 $define|true|[yY]*)     dflt='y';;
3949 *) dflt='n';;
3950 esac
3951 cat <<EOM
3952
3953 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3954 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3955 to use the PerlIO abstraction layer, this will be implicitly selected.
3956
3957 If this doesn't make any sense to you, just accept the default '$dflt'.
3958 EOM
3959 rp='Build Perl for SOCKS?'
3960 . ./myread
3961 case "$ans" in
3962 y|Y)    val="$define" ;;     
3963 *)      val="$undef" ;;
3964 esac
3965 set usesocks
3966 eval $setvar
3967
3968 case "$usesocks" in
3969 $define|true|[yY]*) useperlio="$define";;
3970 esac
3971
3972 case "$useperlio" in
3973 $define|true|[yY]*|'')  dflt='y';;
3974 *) dflt='n';;
3975 esac
3976 cat <<EOM
3977
3978 Previous version of $package used the standard IO mechanisms as
3979 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3980 alternate IO mechanisms via the PerlIO abstraction layer, but the
3981 stdio mechanism is still available if needed.  The abstraction layer
3982 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3983 Using PerlIO with sfio may cause problems with some extension modules.
3984
3985 If this doesn't make any sense to you, just accept the default '$dflt'.
3986 EOM
3987 rp='Use the PerlIO abstraction layer?'
3988 . ./myread
3989 case "$ans" in
3990 y|Y) 
3991         val="$define"
3992         ;;
3993 *)      
3994         echo "Ok, doing things the stdio way."
3995         val="$undef"
3996         ;;
3997 esac
3998 set useperlio
3999 eval $setvar 
4000
4001 case "$usesocks" in
4002 $define|true|[yY]*)
4003         case "$useperlio" in
4004         $define|true|[yY]*) ;;
4005         *)      cat >&4 <<EOM
4006
4007 You are using the SOCKS proxy protocol library which means that you
4008 should also use the PerlIO layer.  You may be headed for trouble.
4009
4010 EOM
4011                 ;;
4012         esac
4013         ;;
4014 esac
4015
4016         
4017 case "$usethreads" in
4018 $define|true|[yY]*)     dflt='y';;
4019 *)     # Catch case where user specified ithreads or 5005threads but
4020        # forgot -Dusethreads (A.D. 4/2002)
4021        case "$useithreads$use5005threads" in
4022        *$define*)      
4023                 case "$useperlio" in
4024                 "$define")      dflt='y' ;;
4025                 *)              dflt='n' ;;
4026                 esac
4027                 ;;
4028        *)       dflt='n';;
4029        esac
4030        ;;
4031 esac
4032 cat <<EOM
4033
4034 Perl can be built to take advantage of threads on some systems.
4035 To do so, Configure can be run with -Dusethreads.
4036
4037 Note that Perl built with threading support runs slightly slower
4038 and uses more memory than plain Perl. The current implementation
4039 is believed to be stable, but it is fairly new, and so should be
4040 treated with caution.
4041
4042 If this doesn't make any sense to you, just accept the default '$dflt'.
4043 EOM
4044 rp='Build a threading Perl?'
4045 . ./myread
4046 case "$ans" in
4047 y|Y)    val="$define" ;;
4048 *)      val="$undef" ;;
4049 esac
4050 set usethreads
4051 eval $setvar
4052
4053 case "$usethreads" in
4054 $define)
4055         $cat <<EOM
4056
4057 Since release 5.6, Perl has had two different threading implementations,
4058 the newer interpreter-based version (ithreads) with one interpreter per
4059 thread, and the older 5.005 version (5005threads).
4060 The 5005threads version is effectively unmaintained and will probably be
4061 removed in Perl 5.10, so there should be no need to build a Perl using it
4062 unless needed for backwards compatibility with some existing 5.005threads
4063 code.
4064
4065 EOM
4066         : Default to ithreads unless overridden on command line or with
4067         : old config.sh
4068         dflt='y'
4069         case "$use5005threads" in
4070                 $define|true|[yY]*) dflt='n';;
4071         esac
4072         case "$useithreads" in
4073                 $undef|false|[nN]*) dflt='n';;
4074         esac
4075         rp='Use the newer interpreter-based ithreads?'
4076         . ./myread
4077         case "$ans" in
4078         y|Y)    val="$define" ;;
4079         *)      val="$undef" ;;
4080         esac
4081         set useithreads
4082         eval $setvar
4083         : Now set use5005threads to the opposite value.
4084         case "$useithreads" in
4085         $define) val="$undef" ;;
4086         *) val="$define" ;;
4087         esac
4088         set use5005threads
4089         eval $setvar
4090         ;;
4091 *)
4092         useithreads="$undef"
4093         use5005threads="$undef"
4094         ;;
4095 esac
4096
4097 case "$useithreads$use5005threads" in
4098 "$define$define")
4099         $cat >&4 <<EOM
4100
4101 You cannot have both the ithreads and the 5.005 threads enabled
4102 at the same time.  Disabling the 5.005 threads since they are
4103 much less stable than the ithreads.
4104
4105 EOM
4106         use5005threads="$undef"
4107         ;;
4108 esac
4109
4110 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4111         cat >&4 <<EOF
4112 ***
4113 *** To build with ithreads you must also use the PerlIO layer.
4114 *** Cannot continue, aborting.
4115 ***
4116 EOF
4117         exit 1
4118 fi
4119
4120 case "$d_oldpthreads" in
4121 '')     : Configure tests would be welcome here.  For now, assume undef.
4122         val="$undef" ;;
4123 *)      val="$d_oldpthreads" ;;
4124 esac
4125 set d_oldpthreads
4126 eval $setvar
4127
4128
4129 : Look for a hint-file generated 'call-back-unit'.  If the
4130 : user has specified that a threading perl is to be built,
4131 : we may need to set or change some other defaults.
4132 if $test -f usethreads.cbu; then
4133     echo "Your platform has some specific hints regarding threaded builds, using them..."
4134     . ./usethreads.cbu
4135 else
4136     case "$usethreads" in
4137         "$define"|true|[yY]*)
4138                 $cat <<EOM
4139 (Your platform does not have any specific hints for threaded builds.
4140  Assuming POSIX threads, then.)
4141 EOM
4142         ;;
4143     esac
4144 fi
4145
4146 cat <<EOM
4147
4148 Perl can be built so that multiple Perl interpreters can coexist
4149 within the same Perl executable.
4150 EOM
4151
4152 case "$useithreads" in
4153 $define)
4154         cat <<EOM
4155 This multiple interpreter support is required for interpreter-based threads.
4156 EOM
4157         val="$define"
4158         ;;
4159 *)      case "$usemultiplicity" in
4160         $define|true|[yY]*)     dflt='y';;
4161         *) dflt='n';;
4162         esac
4163         echo " "
4164         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4165         rp='Build Perl for multiplicity?'
4166         . ./myread
4167         case "$ans" in
4168         y|Y)    val="$define" ;;
4169         *)      val="$undef" ;;
4170         esac
4171         ;;
4172 esac
4173 set usemultiplicity
4174 eval $setvar
4175
4176
4177 case "$usemorebits" in
4178 "$define"|true|[yY]*)
4179         use64bitint="$define"
4180         uselongdouble="$define"
4181         usemorebits="$define"
4182         ;;
4183 *)      usemorebits="$undef"
4184         ;;
4185 esac
4186
4187 : make some quick guesses about what we are up against
4188 echo " "
4189 $echo $n "Hmm...  $c"
4190 echo exit 1 >bsd
4191 echo exit 1 >usg
4192 echo exit 1 >v7
4193 echo exit 1 >osf1
4194 echo exit 1 >eunice
4195 echo exit 1 >xenix
4196 echo exit 1 >venix
4197 echo exit 1 >os2
4198 d_bsd="$undef"
4199 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4200 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4201 then
4202         echo "Looks kind of like an OSF/1 system, but we'll see..."
4203         echo exit 0 >osf1
4204 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4205         xxx=`./loc addbib blurfl $pth`
4206         if $test -f $xxx; then
4207         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4208                 echo exit 0 >bsd
4209                 echo exit 0 >usg
4210         else
4211                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4212                         echo "Looks kind of like an extended USG system, but we'll see..."
4213                 else
4214                         echo "Looks kind of like a USG system, but we'll see..."
4215                 fi
4216                 echo exit 0 >usg
4217         fi
4218 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4219         echo "Looks kind of like a BSD system, but we'll see..."
4220         d_bsd="$define"
4221         echo exit 0 >bsd
4222 else
4223         echo "Looks kind of like a Version 7 system, but we'll see..."
4224         echo exit 0 >v7
4225 fi
4226 case "$eunicefix" in
4227 *unixtovms*)
4228         $cat <<'EOI'
4229 There is, however, a strange, musty smell in the air that reminds me of
4230 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4231 EOI
4232         echo exit 0 >eunice
4233         d_eunice="$define"
4234 : it so happens the Eunice I know will not run shell scripts in Unix format
4235         ;;
4236 *)
4237         echo " "
4238         echo "Congratulations.  You aren't running Eunice."
4239         d_eunice="$undef"
4240         ;;
4241 esac
4242 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4243 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4244 : semicolon as a patch separator
4245 case "$p_" in
4246 :) ;;
4247 *)
4248         $cat <<'EOI'
4249 I have the feeling something is not exactly right, however...don't tell me...
4250 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4251 (Or you may be running DOS with DJGPP.)
4252 EOI
4253         echo exit 0 >os2
4254         ;;
4255 esac
4256 if test -f /xenix; then
4257         echo "Actually, this looks more like a XENIX system..."
4258         echo exit 0 >xenix
4259         d_xenix="$define"
4260 else
4261         echo " "
4262         echo "It's not Xenix..."
4263         d_xenix="$undef"
4264 fi
4265 chmod +x xenix
4266 $eunicefix xenix
4267 if test -f /venix; then
4268         echo "Actually, this looks more like a VENIX system..."
4269         echo exit 0 >venix
4270 else
4271         echo " "
4272         if ./xenix; then
4273                 : null
4274         else
4275                 echo "Nor is it Venix..."
4276         fi
4277 fi
4278 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4279 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4280 $rm -f foo
4281
4282 case "$cc" in
4283 '') dflt=cc;;
4284 *) dflt="$cc";;
4285 esac
4286 rp="Use which C compiler?"
4287 . ./myread
4288 cc="$ans"
4289
4290 : See if they have not cc but they do have gcc
4291 . ./trygcc
4292 : Look for a hint-file generated 'call-back-unit'.  Now that the
4293 : user has specified the compiler, we may need to set or change some
4294 : other defaults.
4295 if $test -f cc.cbu; then
4296     . ./cc.cbu
4297 fi
4298 . ./checkcc
4299
4300 echo " "
4301 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4302 $cat >try.c <<EOM
4303 #include <stdio.h>
4304 int main() {
4305 #ifdef __GNUC__
4306 #ifdef __VERSION__
4307         printf("%s\n", __VERSION__);
4308 #else
4309         printf("%s\n", "1");
4310 #endif
4311 #endif
4312         return(0);
4313 }
4314 EOM
4315 if $cc -o try $ccflags $ldflags try.c; then
4316         gccversion=`$run ./try`
4317         case "$gccversion" in
4318         '') echo "You are not using GNU cc." ;;
4319         *)  echo "You are using GNU cc $gccversion."
4320             ccname=gcc
4321             ;;
4322         esac
4323 else
4324         echo " "
4325         echo "*** WHOA THERE!!! ***" >&4
4326         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4327         case "$knowitall" in
4328         '')
4329         echo "    You'd better start hunting for one and let me know about it." >&4
4330                 exit 1
4331                 ;;
4332         esac
4333 fi
4334 $rm -f try try.*
4335 case "$gccversion" in
4336 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4337 esac
4338 case "$gccversion" in
4339 '') gccosandvers='' ;;
4340 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4341    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4342    gccshortvers=''
4343    case "$gccosandvers" in
4344    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4345    $osname$osvers) ;; # looking good
4346    $osname*) cat <<EOM >&4
4347
4348 *** WHOA THERE!!! ***
4349
4350     Your gcc has not been compiled for the exact release of
4351     your operating system ($gccosandvers versus $osname$osvers).
4352
4353     In general it is a good idea to keep gcc synchronized with
4354     the operating system because otherwise serious problems
4355     may ensue when trying to compile software, like Perl.
4356
4357     I'm trying to be optimistic here, though, and will continue.
4358     If later during the configuration and build icky compilation
4359     problems appear (headerfile conflicts being the most common
4360     manifestation), I suggest reinstalling the gcc to match
4361     your operating system release.
4362
4363 EOM
4364       ;;
4365    *) gccosandvers='' ;; # failed to parse, better be silent
4366    esac
4367    ;;
4368 esac
4369 case "$ccname" in
4370 '') ccname="$cc" ;;
4371 esac
4372
4373 # gcc 3.* complain about adding -Idirectories that they already know about,
4374 # so we will take those off from locincpth.
4375 case "$gccversion" in
4376 3*)
4377     echo "main(){}">try.c
4378     for incdir in $locincpth; do
4379        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4380              grep '^c[cp]p*[01]: warning: changing search order '`
4381        if test "X$warn" != X; then
4382            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4383        fi
4384     done
4385     $rm -f try try.*
4386 esac
4387
4388 : What should the include directory be ?
4389 echo " "
4390 $echo $n "Hmm...  $c"
4391 dflt='/usr/include'
4392 incpath=''
4393 mips_type=''
4394 if $test -f /bin/mips && /bin/mips; then
4395         echo "Looks like a MIPS system..."
4396         $cat >usr.c <<'EOCP'
4397 #ifdef SYSTYPE_BSD43
4398 /bsd43
4399 #endif
4400 EOCP
4401         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4402                 dflt='/bsd43/usr/include'
4403                 incpath='/bsd43'
4404                 mips_type='BSD 4.3'
4405         else
4406                 mips_type='System V'
4407         fi
4408         $rm -f usr.c usr.out
4409         echo "and you're compiling with the $mips_type compiler and libraries."
4410         xxx_prompt=y
4411         echo "exit 0" >mips
4412 else
4413         echo "Doesn't look like a MIPS system."
4414         xxx_prompt=n
4415         echo "exit 1" >mips
4416 fi
4417 chmod +x mips
4418 $eunicefix mips
4419 case "$usrinc" in
4420 '') ;;
4421 *) dflt="$usrinc";;
4422 esac
4423 case "$xxx_prompt" in
4424 y)      fn=d/
4425         echo " "
4426         rp='Where are the include files you want to use?'
4427         . ./getfile
4428         usrinc="$ans"
4429         ;;
4430 *)      usrinc="$dflt"
4431         ;;
4432 esac
4433
4434 : see how we invoke the C preprocessor
4435 echo " "
4436 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4437 cat <<'EOT' >testcpp.c
4438 #define ABC abc
4439 #define XYZ xyz
4440 ABC.XYZ
4441 EOT
4442 cd ..
4443 if test ! -f cppstdin; then
4444         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4445                 # AIX cc -E doesn't show the absolute headerfile
4446                 # locations but we'll cheat by using the -M flag.
4447                 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
4448         else
4449                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4450         fi
4451 else
4452         echo "Keeping your $hint cppstdin wrapper."
4453 fi
4454 chmod 755 cppstdin
4455 wrapper=`pwd`/cppstdin
4456 ok='false'
4457 cd UU
4458
4459 if $test "X$cppstdin" != "X" && \
4460         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4461         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4462 then
4463         echo "You used to use $cppstdin $cppminus so we'll use that again."
4464         case "$cpprun" in
4465         '') echo "But let's see if we can live without a wrapper..." ;;
4466         *)
4467                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4468                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4469                 then
4470                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4471                         ok='true'
4472                 else
4473                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4474                 fi
4475                 ;;
4476         esac
4477 else
4478         case "$cppstdin" in
4479         '') ;;
4480         *)
4481                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4482                 ;;
4483         esac
4484 fi
4485
4486 if $ok; then
4487         : nothing
4488 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4489         $cc -E <testcpp.c >testcpp.out 2>&1; \
4490         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4491         echo "Yup, it does."
4492         x_cpp="$cc -E"
4493         x_minus='';
4494 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4495         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4497         echo "Yup, it does."
4498         x_cpp="$cc -E"
4499         x_minus='-';
4500 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4501         $cc -P <testcpp.c >testcpp.out 2>&1; \
4502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4503         echo "Yipee, that works!"
4504         x_cpp="$cc -P"
4505         x_minus='';
4506 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4507         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4509         echo "At long last!"
4510         x_cpp="$cc -P"
4511         x_minus='-';
4512 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4513         $cpp <testcpp.c >testcpp.out 2>&1; \
4514         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4515         echo "It works!"
4516         x_cpp="$cpp"
4517         x_minus='';
4518 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4519         $cpp - <testcpp.c >testcpp.out 2>&1; \
4520         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4521         echo "Hooray, it works!  I was beginning to wonder."
4522         x_cpp="$cpp"
4523         x_minus='-';
4524 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4525         $wrapper <testcpp.c >testcpp.out 2>&1; \
4526         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4527         x_cpp="$wrapper"
4528         x_minus=''
4529         echo "Eureka!"
4530 else
4531         dflt=''
4532         rp="No dice.  I can't find a C preprocessor.  Name one:"
4533         . ./myread
4534         x_cpp="$ans"
4535         x_minus=''
4536         $x_cpp <testcpp.c >testcpp.out 2>&1
4537         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4538                 echo "OK, that will do." >&4
4539         else
4540 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4541                 exit 1
4542         fi
4543 fi
4544
4545 case "$ok" in
4546 false)
4547         cppstdin="$x_cpp"
4548         cppminus="$x_minus"
4549         cpprun="$x_cpp"
4550         cpplast="$x_minus"
4551         set X $x_cpp
4552         shift
4553         case "$1" in
4554         "$cpp")
4555                 echo "Perhaps can we force $cc -E using a wrapper..."
4556                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4557                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4558                 then
4559                         echo "Yup, we can."
4560                         cppstdin="$wrapper"
4561                         cppminus='';
4562                 else
4563                         echo "Nope, we'll have to live without it..."
4564                 fi
4565                 ;;
4566         esac
4567         case "$cpprun" in
4568         "$wrapper")
4569                 cpprun=''
4570                 cpplast=''
4571                 ;;
4572         esac
4573         ;;
4574 esac
4575
4576 case "$cppstdin" in
4577 "$wrapper"|'cppstdin') ;;
4578 *) $rm -f $wrapper;;
4579 esac
4580 $rm -f testcpp.c testcpp.out
4581
4582 : Set private lib path
4583 case "$plibpth" in
4584 '') if ./mips; then
4585                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4586         fi;;
4587 esac
4588 case "$libpth" in
4589 ' ') dlist='';;
4590 '') dlist="$loclibpth $plibpth $glibpth";;
4591 *) dlist="$libpth";;
4592 esac
4593
4594 : Now check and see which directories actually exist, avoiding duplicates
4595 libpth=''
4596 for xxx in $dlist
4597 do
4598     if $test -d $xxx; then
4599                 case " $libpth " in
4600                 *" $xxx "*) ;;
4601                 *) libpth="$libpth $xxx";;
4602                 esac
4603     fi
4604 done
4605 $cat <<'EOM'
4606
4607 Some systems have incompatible or broken versions of libraries.  Among
4608 the directories listed in the question below, please remove any you
4609 know not to be holding relevant libraries, and add any that are needed.
4610 Say "none" for none.
4611
4612 EOM
4613 case "$libpth" in
4614 '') dflt='none';;
4615 *)
4616         set X $libpth
4617         shift
4618         dflt=${1+"$@"}
4619         ;;
4620 esac
4621 rp="Directories to use for library searches?"
4622 . ./myread
4623 case "$ans" in
4624 none) libpth=' ';;
4625 *) libpth="$ans";;
4626 esac
4627
4628 : compute shared library extension
4629 case "$so" in
4630 '')
4631         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4632                 dflt='sl'
4633         else
4634                 dflt='so'
4635         fi
4636         ;;
4637 *) dflt="$so";;
4638 esac
4639 $cat <<EOM
4640
4641 On some systems, shared libraries may be available.  Answer 'none' if
4642 you want to suppress searching of shared libraries for the remainder
4643 of this configuration.
4644
4645 EOM
4646 rp='What is the file extension used for shared libraries?'
4647 . ./myread
4648 so="$ans"
4649
4650 : Define several unixisms.
4651 : Hints files or command line option can be used to override them.
4652 : The convoluted testing is in case hints files set either the old
4653 : or the new name.
4654 case "$_exe" in
4655 '')     case "$exe_ext" in
4656         '')     ;;
4657         *)      _exe="$exe_ext" ;;
4658         esac
4659         ;;
4660 esac
4661 case "$_a" in
4662 '')     case "$lib_ext" in
4663     '') _a='.a';;
4664         *)      _a="$lib_ext" ;;
4665         esac
4666         ;;
4667 esac
4668 case "$_o" in
4669 '') case "$obj_ext" in
4670         '')     _o='.o';;
4671         *)      _o="$obj_ext";;
4672         esac
4673         ;;
4674 esac
4675 case "$p_" in
4676 '') case "$path_sep" in
4677         '')     p_=':';;
4678         *)      p_="$path_sep";;
4679         esac
4680         ;;
4681 esac
4682 exe_ext=$_exe
4683 lib_ext=$_a
4684 obj_ext=$_o
4685 path_sep=$p_
4686
4687 : Which makefile gets called first.  This is used by make depend.
4688 case "$firstmakefile" in
4689 '') firstmakefile='makefile';;
4690 esac
4691
4692 case "$ccflags" in
4693 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4694 esac
4695
4696 case "$uselongdouble" in
4697 $define|true|[yY]*)     dflt='y';;
4698 *) dflt='n';;
4699 esac
4700 cat <<EOM
4701
4702 Perl can be built to take advantage of long doubles which
4703 (if available) may give more accuracy and range for floating point numbers.
4704
4705 If this doesn't make any sense to you, just accept the default '$dflt'.
4706 EOM
4707 rp='Try to use long doubles if available?'
4708 . ./myread
4709 case "$ans" in
4710 y|Y)    val="$define"   ;;
4711 *)      val="$undef"    ;;
4712 esac
4713 set uselongdouble
4714 eval $setvar
4715
4716 case "$uselongdouble" in
4717 true|[yY]*) uselongdouble="$define" ;;
4718 esac
4719
4720 : Look for a hint-file generated 'call-back-unit'.  If the
4721 : user has specified that long doubles should be used,
4722 : we may need to set or change some other defaults.
4723 if $test -f uselongdouble.cbu; then
4724     echo "Your platform has some specific hints regarding long doubles, using them..."
4725     . ./uselongdouble.cbu
4726 else
4727     case "$uselongdouble" in
4728         $define)
4729                 $cat <<EOM
4730 (Your platform does not have any specific hints for long doubles.)
4731 EOM
4732         ;;
4733     esac
4734 fi
4735
4736 : Looking for optional libraries
4737 echo " "
4738 echo "Checking for optional libraries..." >&4
4739 case "$libs" in
4740 ' '|'') dflt='';;
4741 *) dflt="$libs";;
4742 esac
4743 case "$libswanted" in
4744 '') libswanted='c_s';;
4745 esac
4746 case "$usesocks" in
4747 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4748 esac
4749 libsfound=''
4750 libsfiles=''
4751 libsdirs=''
4752 libspath=''
4753 for thisdir in $libpth $xlibpth; do
4754   test -d $thisdir && libspath="$libspath $thisdir"
4755 done
4756 for thislib in $libswanted; do
4757         for thisdir in $libspath; do
4758             xxx=''
4759             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4760                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4761                 $test -f "$xxx" && eval $libscheck
4762                 $test -f "$xxx" && libstyle=shared
4763             fi
4764             if test ! -f "$xxx"; then
4765                 xxx=$thisdir/lib$thislib.$so
4766                 $test -f "$xxx" && eval $libscheck
4767                 $test -f "$xxx" && libstyle=shared
4768             fi  
4769             if test ! -f "$xxx"; then
4770                 xxx=$thisdir/lib$thislib$_a
4771                 $test -f "$xxx" && eval $libscheck
4772                 $test -f "$xxx" && libstyle=static
4773             fi
4774             if test ! -f "$xxx"; then
4775                 xxx=$thisdir/$thislib$_a
4776                 $test -f "$xxx" && eval $libscheck
4777                 $test -f "$xxx" && libstyle=static
4778             fi
4779             if test ! -f "$xxx"; then
4780                 xxx=$thisdir/lib${thislib}_s$_a
4781                 $test -f "$xxx" && eval $libscheck
4782                 $test -f "$xxx" && libstyle=static
4783                 $test -f "$xxx" && thislib=${thislib}_s
4784             fi
4785             if test ! -f "$xxx"; then
4786                 xxx=$thisdir/Slib$thislib$_a
4787                 $test -f "$xxx" && eval $libscheck
4788                 $test -f "$xxx" && libstyle=static
4789             fi
4790             if $test -f "$xxx"; then
4791                 case "$libstyle" in
4792                 shared) echo "Found -l$thislib (shared)." ;;
4793                 static) echo "Found -l$thislib." ;;
4794                 *)      echo "Found -l$thislib ($libstyle)." ;;
4795                 esac
4796                 case " $dflt " in
4797                 *"-l$thislib "*);;
4798                 *) dflt="$dflt -l$thislib"
4799                    libsfound="$libsfound $xxx"
4800                    yyy=`basename $xxx`
4801                    libsfiles="$libsfiles $yyy"
4802                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4803                    case " $libsdirs " in
4804                    *" $yyy "*) ;;
4805                    *) libsdirs="$libsdirs $yyy" ;;
4806                    esac
4807                    ;;
4808                 esac
4809                 break
4810             fi  
4811         done
4812         if $test ! -f "$xxx"; then
4813             echo "No -l$thislib."
4814         fi
4815 done
4816 set X $dflt
4817 shift
4818 dflt="$*"
4819 case "$libs" in
4820 '') dflt="$dflt";;
4821 *) dflt="$libs";;
4822 esac
4823 case "$dflt" in
4824 ' '|'') dflt='none';;
4825 esac
4826
4827 $cat <<EOM
4828
4829 In order to compile $package on your machine, a number of libraries
4830 are usually needed.  Include any other special libraries here as well.
4831 Say "none" for none.  The default list is almost always right.
4832 EOM
4833
4834 echo " "
4835 rp="What libraries to use?"
4836 . ./myread
4837 case "$ans" in
4838 none) libs=' ';;
4839 *) libs="$ans";;
4840 esac
4841
4842 : determine optimization, if desired, or use for debug flag also
4843 case "$optimize" in
4844 ' '|$undef) dflt='none';;
4845 '') dflt='-O';;
4846 *) dflt="$optimize";;
4847 esac
4848 $cat <<EOH
4849
4850 By default, $package compiles with the -O flag to use the optimizer.
4851 Alternately, you might want to use the symbolic debugger, which uses
4852 the -g flag (on traditional Unix systems).  Either flag can be
4853 specified here.  To use neither flag, specify the word "none".
4854
4855 EOH
4856 rp="What optimizer/debugger flag should be used?"
4857 . ./myread
4858 optimize="$ans"
4859 case "$optimize" in
4860 'none') optimize=" ";;
4861 esac
4862
4863 : Check what DEBUGGING is required from the command line
4864 : -DEBUGGING      or -DDEBUGGING or
4865 : -DEBUGGING=both                       = -g + -DDEBUGGING
4866 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4867 : -DEBUGGING=none or -UDEBUGGING        =
4868 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4869 case "$EBUGGING" in
4870 '')     ;;
4871 *)      DEBUGGING=$EBUGGING ;;
4872 esac
4873
4874 case "$DEBUGGING" in
4875 -g|$define)
4876     case "$optimize" in
4877         *-g*) ;;
4878         *)    optimize="$optimize -g" ;;
4879     esac ;;
4880 none|$undef)
4881     case "$optimize" in
4882         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4883                 shift
4884                 optimize="$*"
4885                 ;;
4886     esac ;;
4887 esac
4888
4889 dflt=''
4890 case "$DEBUGGING" in
4891 both|$define) dflt='-DDEBUGGING'
4892 esac
4893
4894 : We will not override a previous value, but we might want to
4895 : augment a hint file
4896 case "$hint" in
4897 default|recommended)
4898         case "$gccversion" in
4899         1*) dflt="$dflt -fpcc-struct-return" ;;
4900         esac
4901         case "$optimize:$DEBUGGING" in
4902         *-g*:old) dflt="$dflt -DDEBUGGING";;
4903         esac
4904         case "$gccversion" in
4905         2*) if test -d /etc/conf/kconfig.d &&
4906                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4907                 then
4908                         # Interactive Systems (ISC) POSIX mode.
4909                         dflt="$dflt -posix"
4910                 fi
4911                 ;;
4912         esac
4913         case "$gccversion" in
4914         1*) ;;
4915         2.[0-8]*) ;;
4916         ?*)     echo " "
4917                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4918                 echo 'int main(void) { return 0; }' > gcctest.c
4919                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4920                         echo "Yes, it does." 2>&1
4921                         case "$ccflags" in
4922                         *strict-aliasing*)
4923                                 echo "Leaving current flags $ccflags alone." 2>&1
4924                                 ;;
4925                         *) dflt="$dflt -fno-strict-aliasing" ;;
4926                         esac
4927                 else
4928                         echo "Nope, it doesn't, but that's ok." 2>&1
4929                 fi
4930                 ;;
4931         esac
4932         # For gcc, adding -pipe speeds up compilations for some, but apparently
4933         # some assemblers can't read from stdin.  (It also slows down compilations
4934         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4935         case "$gccversion" in
4936         ?*)     echo " "
4937                 echo "Checking if your compiler accepts -pipe" 2>&1
4938                 echo 'int main(void) { return 0; }' > gcctest.c
4939                 if $cc -pipe -o gcctest gcctest.c; then
4940                         echo "Yes, it does." 2>&1
4941                         case "$ccflags" in
4942                         *-pipe*)
4943                                 echo "Leaving current flags $ccflags alone." 2>&1
4944                                 ;;
4945                         *) dflt="$dflt -pipe" ;;
4946                         esac
4947                 else
4948                         echo "Nope, it doesn't, but that's ok." 2>&1
4949                 fi
4950
4951                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4952                 echo 'int main(void) { return 0; }' > gcctest.c
4953                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4954                         echo "Yes, it does." 2>&1
4955                         case "$ccflags" in
4956                         *-Wdeclaration-after-statement*)
4957                                 echo "Leaving current flags $ccflags alone." 2>&1
4958                                 ;;
4959                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4960                         esac
4961                 else
4962                         echo "Nope, it doesn't, but that's ok." 2>&1
4963                 fi
4964                 ;;
4965         esac
4966         ;;
4967 esac
4968
4969 case "$mips_type" in
4970 *BSD*|'') inclwanted="$locincpth $usrinc";;
4971 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4972 esac
4973 for thisincl in $inclwanted; do
4974         if $test -d $thisincl; then
4975                 if $test x$thisincl != x$usrinc; then
4976                         case "$dflt" in
4977                         *" -I$thisincl "*);;
4978                         *) dflt="$dflt -I$thisincl ";;
4979                         esac
4980                 fi
4981         fi
4982 done
4983
4984 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4985         xxx=true;
4986 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4987         xxx=true;
4988 else
4989         xxx=false;
4990 fi;
4991 if $xxx; then
4992         case "$dflt" in
4993         *$2*);;
4994         *) dflt="$dflt -D$2";;
4995         esac;
4996 fi'
4997
4998 set signal.h LANGUAGE_C; eval $inctest
4999
5000 case "$usesocks" in
5001 $define)
5002         ccflags="$ccflags -DSOCKS"
5003         ;;
5004 esac
5005
5006 case "$hint" in
5007 default|recommended) dflt="$ccflags $dflt" ;;
5008 *) dflt="$ccflags";;
5009 esac
5010
5011 case "$dflt" in
5012 ''|' ') dflt=none;;
5013 esac
5014
5015 $cat <<EOH
5016
5017 Your C compiler may want other flags.  For this question you should include
5018 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5019 but you should NOT include libraries or ld flags like -lwhatever.  If you
5020 want $package to honor its debug switch, you should include -DDEBUGGING here.
5021 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5022
5023 To use no flags, specify the word "none".
5024
5025 EOH
5026 set X $dflt
5027 shift
5028 dflt=${1+"$@"}
5029 rp="Any additional cc flags?"
5030 . ./myread
5031 case "$ans" in
5032 none) ccflags='';;
5033 *) ccflags="$ans";;
5034 esac
5035
5036 : the following weeds options from ccflags that are of no interest to cpp
5037 case "$cppflags" in
5038 '') cppflags="$ccflags" ;;
5039 *)  cppflags="$cppflags $ccflags" ;;
5040 esac
5041 case "$gccversion" in
5042 1*) cppflags="$cppflags -D__GNUC__"
5043 esac
5044 case "$mips_type" in
5045 '');;
5046 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5047 esac
5048 case "$cppflags" in
5049 '');;
5050 *)
5051         echo " "
5052         echo "Let me guess what the preprocessor flags are..." >&4
5053         set X $cppflags
5054         shift
5055         cppflags=''
5056         $cat >cpp.c <<'EOM'
5057 #define BLURFL foo
5058
5059 BLURFL xx LFRULB
5060 EOM
5061         previous=''
5062         for flag in $*
5063         do
5064                 case "$flag" in
5065                 -*) ftry="$flag";;
5066                 *) ftry="$previous $flag";;
5067                 esac
5068                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5069                         >cpp1.out 2>/dev/null && \
5070                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5071                         >cpp2.out 2>/dev/null && \
5072                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5073                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5074                 then
5075                         cppflags="$cppflags $ftry"
5076                         previous=''
5077                 else
5078                         previous="$flag"
5079                 fi
5080         done
5081         set X $cppflags
5082         shift
5083         cppflags=${1+"$@"}
5084         case "$cppflags" in
5085         *-*)  echo "They appear to be: $cppflags";;
5086         esac
5087         $rm -f cpp.c cpp?.out
5088         ;;
5089 esac
5090
5091 : flags used in final linking phase
5092 case "$ldflags" in
5093 '') if ./venix; then
5094                 dflt='-i -z'
5095         else
5096                 dflt=''
5097         fi
5098         case "$ccflags" in
5099         *-posix*) dflt="$dflt -posix" ;;
5100         esac
5101         ;;
5102 *) dflt="$ldflags";;
5103 esac
5104
5105 : Try to guess additional flags to pick up local libraries.
5106 for thislibdir in $libpth; do
5107         case " $loclibpth " in
5108         *" $thislibdir "*)
5109                 case "$dflt " in
5110                 *"-L$thislibdir "*) ;;
5111                 *)  dflt="$dflt -L$thislibdir" ;;
5112                 esac
5113                 ;;
5114         esac
5115 done
5116
5117 case "$dflt" in
5118 '') dflt='none' ;;
5119 esac
5120
5121 $cat <<EOH
5122
5123 Your C linker may need flags.  For this question you should
5124 include -L/whatever and any other flags used by the C linker, but you
5125 should NOT include libraries like -lwhatever.
5126
5127 Make sure you include the appropriate -L/path flags if your C linker
5128 does not normally search all of the directories you specified above,
5129 namely
5130         $libpth
5131 To use no flags, specify the word "none".
5132
5133 EOH
5134
5135 rp="Any additional ld flags (NOT including libraries)?"
5136 . ./myread
5137 case "$ans" in
5138 none) ldflags='';;
5139 *) ldflags="$ans";;
5140 esac
5141 rmlist="$rmlist pdp11"
5142
5143 : coherency check
5144 echo " "
5145 echo "Checking your choice of C compiler and flags for coherency..." >&4
5146 $cat > try.c <<'EOF'
5147 #include <stdio.h>
5148 int main() { printf("Ok\n"); return(0); }
5149 EOF
5150 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5151 shift
5152 $cat >try.msg <<'EOM'
5153 I've tried to compile and run the following simple program:
5154
5155 EOM
5156 $cat try.c >> try.msg
5157
5158 $cat >> try.msg <<EOM
5159
5160 I used the command:
5161
5162         $*
5163         $run ./try
5164
5165 and I got the following output:
5166
5167 EOM
5168 dflt=y
5169 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5170         if $sh -c "$run ./try" >>try.msg 2>&1; then
5171                 xxx=`$run ./try`
5172                 case "$xxx" in
5173                 "Ok") dflt=n ;;
5174                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5175                         case " $libs " in
5176                         *" -lsfio "*)
5177                                 cat >> try.msg <<'EOQS'
5178 If $libs contains -lsfio, and sfio is mis-configured, then it
5179 sometimes (apparently) runs and exits with a 0 status, but with no
5180 output!  It may have to do with sfio's use of _exit vs. exit.
5181
5182 EOQS
5183                                 rp="You have a big problem.  Shall I abort Configure"
5184                                 dflt=y
5185                                 ;;
5186                         esac
5187                         ;;
5188                 esac
5189         else
5190                 echo "The program compiled OK, but exited with status $?." >>try.msg
5191                 rp="You have a problem.  Shall I abort Configure"
5192                 dflt=y
5193         fi
5194 else
5195         echo "I can't compile the test program." >>try.msg
5196         rp="You have a BIG problem.  Shall I abort Configure"
5197         dflt=y
5198 fi
5199 case "$dflt" in
5200 y)
5201         $cat try.msg >&4
5202         case "$knowitall" in
5203         '')
5204                 echo "(The supplied flags or libraries might be incorrect.)"
5205                 ;;
5206         *) dflt=n;;
5207         esac
5208         echo " "
5209         . ./myread
5210         case "$ans" in
5211         n*|N*) ;;
5212         *)      echo "Ok.  Stopping Configure." >&4
5213                 exit 1
5214                 ;;
5215         esac
5216         ;;
5217 n) echo "OK, that should do.";;
5218 esac
5219 $rm -f try try.* core
5220
5221 : define a shorthand compile call
5222 compile='
5223 mc_file=$1;
5224 shift;
5225 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5226 : define a shorthand compile call for compilations that should be ok.
5227 compile_ok='
5228 mc_file=$1;
5229 shift;
5230 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5231
5232 : determine filename position in cpp output
5233 echo " "
5234 echo "Computing filename position in cpp output for #include directives..." >&4
5235 case "$osname" in
5236 vos) testaccess=-e ;;
5237 *)   testaccess=-r ;;
5238 esac
5239 echo '#include <stdio.h>' > foo.c
5240 $cat >fieldn <<EOF
5241 $startsh
5242 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5243 $grep '^[       ]*#.*stdio\.h' | \
5244 while read cline; do
5245         pos=1
5246         set \$cline
5247         while $test \$# -gt 0; do
5248                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5249                         echo "\$pos"
5250                         exit 0
5251                 fi
5252                 shift
5253                 pos=\`expr \$pos + 1\`
5254         done
5255 done
5256 EOF
5257 chmod +x fieldn
5258 fieldn=`./fieldn`
5259 $rm -f foo.c fieldn
5260 case $fieldn in
5261 '') pos='???';;
5262 1) pos=first;;
5263 2) pos=second;;
5264 3) pos=third;;
5265 *) pos="${fieldn}th";;
5266 esac
5267 echo "Your cpp writes the filename in the $pos field of the line."
5268
5269 case "$osname" in
5270 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5271 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5272 *)   cppfilter='' ;;
5273 esac
5274 : locate header file
5275 $cat >findhdr <<EOF
5276 $startsh
5277 wanted=\$1
5278 name=''
5279 for usrincdir in $usrinc
5280 do
5281         if test -f \$usrincdir/\$wanted; then
5282                 echo "\$usrincdir/\$wanted"
5283                 exit 0
5284         fi
5285 done
5286 awkprg='{ print \$$fieldn }'
5287 echo "#include <\$wanted>" > foo\$\$.c
5288 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5289 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5290 while read cline; do
5291         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5292         case "\$name" in
5293         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5294         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5295         *) exit 2;;
5296         esac;
5297 done;
5298 #
5299 # status = 0: grep returned 0 lines, case statement not executed
5300 # status = 1: headerfile found
5301 # status = 2: while loop executed, no headerfile found
5302 #
5303 status=\$?
5304 $rm -f foo\$\$.c;
5305 if test \$status -eq 1; then
5306         exit 0;
5307 fi
5308 exit 1
5309 EOF
5310 chmod +x findhdr
5311
5312 : define an alternate in-header-list? function
5313 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5314 cont=true; xxf="echo \"<\$1> found.\" >&4";
5315 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5316 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5317 esac;
5318 case $# in 4) instead=instead;; *) instead="at last";; esac;
5319 while $test "$cont"; do
5320         xxx=`./findhdr $1`
5321         var=$2; eval "was=\$$2";
5322         if $test "$xxx" && $test -r "$xxx";
5323         then eval $xxf;
5324         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5325                 cont="";
5326         else eval $xxnf;
5327         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5328         set $yyy; shift; shift; yyy=$@;
5329         case $# in 0) cont="";;
5330         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5331                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5332         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5333                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5334         esac;
5335 done;
5336 while $test "$yyy";
5337 do set $yyy; var=$2; eval "was=\$$2";
5338         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5339         set $yyy; shift; shift; yyy=$@;
5340 done'
5341
5342 : see if stdlib is available
5343 set stdlib.h i_stdlib
5344 eval $inhdr
5345
5346 : check for lengths of integral types
5347 echo " "
5348 case "$intsize" in
5349 '')
5350         echo "Checking to see how big your integers are..." >&4
5351         $cat >try.c <<EOCP
5352 #include <stdio.h>
5353 #$i_stdlib I_STDLIB
5354 #ifdef I_STDLIB
5355 #include <stdlib.h>
5356 #endif
5357 int main()
5358 {
5359         printf("intsize=%d;\n", (int)sizeof(int));
5360         printf("longsize=%d;\n", (int)sizeof(long));
5361         printf("shortsize=%d;\n", (int)sizeof(short));
5362         exit(0);
5363 }
5364 EOCP
5365         set try
5366         if eval $compile_ok && $run ./try > /dev/null; then
5367                 eval `$run ./try`
5368                 echo "Your integers are $intsize bytes long."
5369                 echo "Your long integers are $longsize bytes long."
5370                 echo "Your short integers are $shortsize bytes long."
5371         else
5372                 $cat >&4 <<EOM
5373 !
5374 Help! I can't compile and run the intsize test program: please enlighten me!
5375 (This is probably a misconfiguration in your system or libraries, and
5376 you really ought to fix it.  Still, I'll try anyway.)
5377 !
5378 EOM
5379                 dflt=4
5380                 rp="What is the size of an integer (in bytes)?"
5381                 . ./myread
5382                 intsize="$ans"
5383                 dflt=$intsize
5384                 rp="What is the size of a long integer (in bytes)?"
5385                 . ./myread
5386                 longsize="$ans"
5387                 dflt=2
5388                 rp="What is the size of a short integer (in bytes)?"
5389                 . ./myread
5390                 shortsize="$ans"
5391         fi
5392         ;;
5393 esac
5394 $rm -f try try.*
5395
5396 : check for long long
5397 echo " "
5398 echo "Checking to see if you have long long..." >&4
5399 echo 'int main() { long long x = 7; return 0; }' > try.c
5400 set try
5401 if eval $compile; then
5402         val="$define"
5403         echo "You have long long."
5404 else
5405         val="$undef"
5406         echo "You do not have long long."
5407 fi
5408 $rm try.*
5409 set d_longlong
5410 eval $setvar
5411
5412 : check for length of long long
5413 case "${d_longlong}${longlongsize}" in
5414 $define)
5415         echo " "
5416         echo "Checking to see how big your long longs are..." >&4
5417         $cat >try.c <<'EOCP'
5418 #include <stdio.h>
5419 int main()
5420 {
5421     printf("%d\n", (int)sizeof(long long));
5422     return(0);
5423 }
5424 EOCP
5425         set try
5426         if eval $compile_ok; then
5427                 longlongsize=`$run ./try`
5428                 echo "Your long longs are $longlongsize bytes long."
5429         else
5430                 dflt='8'
5431                 echo " "
5432                 echo "(I can't seem to compile the test program.  Guessing...)"
5433                 rp="What is the size of a long long (in bytes)?"
5434                 . ./myread
5435                 longlongsize="$ans"
5436         fi
5437         if $test "X$longsize" = "X$longlongsize"; then
5438                 echo "(That isn't any different from an ordinary long.)"
5439         fi      
5440         ;;
5441 esac
5442 $rm -f try.* try
5443
5444 : see if inttypes.h is available
5445 : we want a real compile instead of Inhdr because some systems
5446 : have an inttypes.h which includes non-existent headers
5447 echo " "
5448 $cat >try.c <<EOCP
5449 #include <inttypes.h>
5450 int main() {
5451         static int32_t foo32 = 0x12345678;
5452 }
5453 EOCP
5454 set try
5455 if eval $compile; then
5456         echo "<inttypes.h> found." >&4
5457         val="$define"
5458 else
5459         echo "<inttypes.h> NOT found." >&4
5460         val="$undef"
5461 fi
5462 $rm -f try.c try
5463 set i_inttypes
5464 eval $setvar
5465
5466 : check for int64_t
5467 echo " "
5468 echo "Checking to see if you have int64_t..." >&4
5469 $cat >try.c <<EOCP
5470 #include <sys/types.h>
5471 #$i_inttypes I_INTTYPES
5472 #ifdef I_INTTYPES
5473 #include <inttypes.h>
5474 #endif
5475 int main() { int64_t x = 7; }
5476 EOCP
5477 set try
5478 if eval $compile; then
5479         val="$define"
5480         echo "You have int64_t."
5481 else
5482         val="$undef"
5483         echo "You do not have int64_t."
5484 fi
5485 $rm -f try try.*
5486 set d_int64_t
5487 eval $setvar
5488
5489
5490 echo " "
5491 echo "Checking which 64-bit integer type we could use..." >&4
5492
5493 case "$intsize" in
5494 8) val=int
5495    set quadtype
5496    eval $setvar
5497    val='"unsigned int"'
5498    set uquadtype
5499    eval $setvar
5500    quadkind=1
5501    ;;
5502 *) case "$longsize" in
5503    8) val=long
5504       set quadtype
5505       eval $setvar
5506       val='"unsigned long"'
5507       set uquadtype
5508       eval $setvar
5509       quadkind=2
5510       ;;
5511    *) case "$d_longlong:$longlongsize" in
5512       define:8)
5513         val='"long long"'
5514         set quadtype
5515         eval $setvar
5516         val='"unsigned long long"'
5517         set uquadtype
5518         eval $setvar
5519         quadkind=3
5520         ;;
5521       *) case "$d_int64_t" in
5522          define)
5523            val=int64_t
5524            set quadtype
5525            eval $setvar
5526            val=uint64_t
5527            set uquadtype
5528            eval $setvar
5529            quadkind=4
5530            ;;
5531          esac
5532          ;;
5533       esac
5534       ;;
5535    esac
5536    ;;
5537 esac
5538
5539 case "$quadtype" in
5540 '')     echo "Alas, no 64-bit integer types in sight." >&4
5541         d_quad="$undef"
5542         ;;
5543 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5544         d_quad="$define"
5545         ;;
5546 esac
5547
5548
5549 case "$uselonglong" in
5550 "$define"|true|[yY]*)
5551         cat <<EOM >&4
5552
5553 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5554 EOM
5555         use64bitint="$define"
5556         ;;
5557 esac                          
5558 case "$use64bits" in
5559 "$define"|true|[yY]*)
5560         cat <<EOM >&4
5561
5562 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5563 EOM
5564         use64bitint="$define"
5565         ;;
5566 esac                          
5567 case "$use64bitints" in
5568 "$define"|true|[yY]*)
5569         cat <<EOM >&4
5570
5571 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5572 EOM
5573         use64bitint="$define"
5574         ;;
5575 esac                          
5576 case "$use64bitsint" in
5577 "$define"|true|[yY]*)
5578         cat <<EOM >&4
5579
5580 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5581 EOM
5582         use64bitint="$define"
5583         ;;
5584 esac                          
5585 case "$uselonglongs" in
5586 "$define"|true|[yY]*)
5587         cat <<EOM >&4
5588
5589 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5590 EOM
5591         use64bitint="$define"
5592         ;;
5593 esac                          
5594 case "$use64bitsall" in
5595 "$define"|true|[yY]*)
5596         cat <<EOM >&4
5597
5598 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5599 EOM
5600         use64bitall="$define"
5601         ;;
5602 esac                          
5603
5604 case "$ccflags" in
5605 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5606 esac
5607 case "$use64bitall" in
5608 "$define"|true|[yY]*) use64bitint="$define" ;;
5609 esac
5610
5611 case "$longsize" in
5612 8) cat <<EOM
5613
5614 You have natively 64-bit long integers.
5615 EOM
5616    val="$define"
5617    ;;
5618 *) case "$use64bitint" in
5619    "$define"|true|[yY]*) dflt='y';;
5620    *) dflt='n';;
5621    esac
5622    case "$d_quad" in
5623    "$define") ;;
5624    *) dflt='n' ;;
5625    esac
5626    cat <<EOM
5627
5628 Perl can be built to take advantage of 64-bit integer types
5629 on some systems.  To do so, Configure can be run with -Duse64bitint.
5630 Choosing this option will most probably introduce binary incompatibilities.
5631
5632 If this doesn't make any sense to you, just accept the default '$dflt'.
5633 (The default has been chosen based on your configuration.)
5634 EOM
5635    rp='Try to use 64-bit integers, if available?'
5636    . ./myread
5637    case "$ans" in
5638    [yY]*) val="$define" ;;
5639    *)     val="$undef"  ;;
5640    esac
5641    ;;
5642 esac
5643 set use64bitint
5644 eval $setvar
5645
5646 case "$use64bitall" in
5647 "$define"|true|[yY]*) dflt='y' ;;
5648 *) case "$longsize" in
5649    8) dflt='y' ;;
5650    *) dflt='n' ;;
5651    esac
5652    ;;
5653 esac    
5654 cat <<EOM
5655
5656 You may also choose to try maximal 64-bitness.  It means using as much
5657 64-bitness as possible on the platform.  This in turn means even more
5658 binary incompatibilities.  On the other hand, your platform may not
5659 have any more 64-bitness available than what you already have chosen.
5660
5661 If this doesn't make any sense to you, just accept the default '$dflt'.
5662 (The default has been chosen based on your configuration.)
5663 EOM
5664 rp='Try to use maximal 64-bit support, if available?'
5665 . ./myread
5666 case "$ans" in
5667 [yY]*) val="$define" ;;
5668 *)     val="$undef"  ;;
5669 esac
5670 set use64bitall
5671 eval $setvar
5672 case "$use64bitall" in
5673 "$define")
5674         case "$use64bitint" in
5675         "$undef")
5676                 cat <<EOM
5677
5678 Since you have chosen a maximally 64-bit build, I'm also turning on
5679 the use of 64-bit integers.
5680 EOM
5681                 use64bitint="$define" ;;
5682         esac
5683         ;;
5684 esac
5685
5686 : Look for a hint-file generated 'call-back-unit'.  If the
5687 : user has specified that a 64-bit perl is to be built,
5688 : we may need to set or change some other defaults.
5689 if $test -f use64bitint.cbu; then
5690         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5691         . ./use64bitint.cbu
5692 fi
5693 case "$use64bitint" in
5694 "$define"|true|[yY]*)
5695         case "$longsize" in
5696         4) case "$archname64" in
5697            '') archname64=64int ;;
5698            esac
5699            ;;
5700         esac
5701         ;;
5702 esac
5703
5704 : Look for a hint-file generated 'call-back-unit'.  If the
5705 : user has specified that a maximally 64-bit perl is to be built,
5706 : we may need to set or change some other defaults.
5707 if $test -f use64bitall.cbu; then
5708         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5709         . ./use64bitall.cbu
5710 fi
5711 case "$use64bitall" in
5712 "$define"|true|[yY]*)
5713         case "$longsize" in
5714         4) case "$archname64" in
5715            ''|64int) archname64=64all ;;
5716            esac
5717            ;;
5718         esac
5719         ;;
5720 esac
5721
5722 case "$d_quad:$use64bitint" in
5723 $undef:$define)
5724         cat >&4 <<EOF
5725
5726 *** You have chosen to use 64-bit integers,
5727 *** but none can be found.
5728 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5729 *** Cannot continue, aborting.
5730
5731 EOF
5732         exit 1
5733         ;;
5734 esac
5735
5736 : check for length of double
5737 echo " "
5738 case "$doublesize" in
5739 '')
5740         echo "Checking to see how big your double precision numbers are..." >&4
5741         $cat >try.c <<EOCP
5742 #include <stdio.h>
5743 #$i_stdlib I_STDLIB
5744 #ifdef I_STDLIB
5745 #include <stdlib.h>
5746 #endif
5747 int main()
5748 {
5749     printf("%d\n", (int)sizeof(double));
5750     exit(0);
5751 }
5752 EOCP
5753         set try
5754         if eval $compile_ok; then
5755                 doublesize=`$run ./try`
5756                 echo "Your double is $doublesize bytes long."
5757         else
5758                 dflt='8'
5759                 echo "(I can't seem to compile the test program.  Guessing...)"
5760                 rp="What is the size of a double precision number (in bytes)?"
5761                 . ./myread
5762                 doublesize="$ans"
5763         fi
5764         ;;
5765 esac
5766 $rm -f try.c try
5767
5768 : check for long doubles
5769 echo " "
5770 echo "Checking to see if you have long double..." >&4
5771 echo 'int main() { long double x = 7.0; }' > try.c
5772 set try
5773 if eval $compile; then
5774         val="$define"
5775         echo "You have long double."
5776 else
5777         val="$undef"
5778         echo "You do not have long double."
5779 fi
5780 $rm try.*
5781 set d_longdbl
5782 eval $setvar
5783
5784 : check for length of long double
5785 case "${d_longdbl}${longdblsize}" in
5786 $define)
5787         echo " "
5788         echo "Checking to see how big your long doubles are..." >&4
5789         $cat >try.c <<'EOCP'
5790 #include <stdio.h>
5791 int main()
5792 {
5793         printf("%d\n", sizeof(long double));
5794 }
5795 EOCP
5796         set try
5797         set try
5798         if eval $compile; then
5799                 longdblsize=`$run ./try`
5800                 echo "Your long doubles are $longdblsize bytes long."
5801         else
5802                 dflt='8'
5803                 echo " "
5804                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5805                 rp="What is the size of a long double (in bytes)?"
5806                 . ./myread
5807                 longdblsize="$ans"
5808         fi
5809         if $test "X$doublesize" = "X$longdblsize"; then
5810                 echo "That isn't any different from an ordinary double."
5811                 echo "I'll keep your setting anyway, but you may see some"
5812                 echo "harmless compilation warnings."
5813         fi      
5814         ;;
5815 esac
5816 $rm -f try.* try
5817
5818 : determine the architecture name
5819 echo " "
5820 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5821         tarch=`arch`"-$osname"
5822 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5823         if uname -m > tmparch 2>&1 ; then
5824                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5825                         -e 's/$/'"-$osname/" tmparch`
5826         else
5827                 tarch="$osname"
5828         fi
5829         $rm -f tmparch
5830 else
5831         tarch="$osname"
5832 fi
5833 case "$myarchname" in
5834 ''|"$tarch") ;;
5835 *)
5836         echo "(Your architecture name used to be $myarchname.)"
5837         archname=''
5838         ;;
5839 esac
5840 case "$targetarch" in
5841 '') ;;
5842 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5843 esac
5844 myarchname="$tarch"
5845 case "$archname" in
5846 '') dflt="$tarch";;
5847 *) dflt="$archname";;
5848 esac
5849 rp='What is your architecture name'
5850 . ./myread
5851 archname="$ans"
5852 case "$usethreads" in
5853 $define)
5854         echo "Threads selected." >&4
5855         case "$archname" in
5856         *-thread*) echo "...and architecture name already has -thread." >&4
5857                 ;;
5858         *)      archname="$archname-thread"
5859                 echo "...setting architecture name to $archname." >&4
5860                 ;;
5861         esac
5862         ;;
5863 esac
5864 case "$usemultiplicity" in
5865 $define)
5866         echo "Multiplicity selected." >&4
5867         case "$archname" in
5868         *-multi*) echo "...and architecture name already has -multi." >&4
5869                 ;;
5870         *)      archname="$archname-multi"
5871                 echo "...setting architecture name to $archname." >&4
5872                 ;;
5873         esac
5874         ;;
5875 esac
5876 case "$use64bitint$use64bitall" in
5877 *"$define"*)
5878         case "$archname64" in
5879         '')
5880                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5881                 ;;
5882         *)
5883                 case "$use64bitint" in
5884                 "$define") echo "64 bit integers selected." >&4 ;;
5885                 esac
5886                 case "$use64bitall" in
5887                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5888                 esac
5889                 case "$archname" in
5890                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5891                         ;;
5892                 *)      archname="$archname-$archname64"
5893                         echo "...setting architecture name to $archname." >&4
5894                         ;;
5895                 esac
5896                 ;;
5897         esac
5898 esac
5899 case "$uselongdouble" in
5900 $define)
5901         echo "Long doubles selected." >&4
5902         case "$longdblsize" in
5903         $doublesize)
5904                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5905                 ;;
5906         *)
5907                 case "$archname" in
5908                 *-ld*) echo "...and architecture name already has -ld." >&4
5909                         ;;
5910                 *)      archname="$archname-ld"
5911                         echo "...setting architecture name to $archname." >&4
5912                         ;;
5913                 esac
5914                 ;;
5915         esac
5916         ;;
5917 esac
5918 case "$useperlio" in
5919 $define)
5920         echo "Perlio selected." >&4
5921         ;;
5922 *)
5923         echo "Perlio not selected, using stdio." >&4
5924         case "$archname" in
5925         *-stdio*) echo "...and architecture name already has -stdio." >&4
5926                 ;;
5927         *)      archname="$archname-stdio"
5928                 echo "...setting architecture name to $archname." >&4
5929                 ;;
5930         esac
5931         ;;
5932 esac
5933 if $test -f archname.cbu; then
5934         echo "Your platform has some specific hints for architecture name, using them..."
5935         . ./archname.cbu
5936 fi
5937
5938 : set the prefixit variable, to compute a suitable default value
5939 prefixit='case "$3" in
5940 ""|none)
5941         case "$oldprefix" in
5942         "") eval "$1=\"\$$2\"";;
5943         *)
5944                 case "$3" in
5945                 "") eval "$1=";;
5946                 none)
5947                         eval "tp=\"\$$2\"";
5948                         case "$tp" in
5949                         ""|" ") eval "$1=\"\$$2\"";;
5950                         *) eval "$1=";;
5951                         esac;;
5952                 esac;;
5953         esac;;
5954 *)
5955         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5956         case "$tp" in
5957         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5958         /*-$oldprefix/*|\~*-$oldprefix/*)
5959                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5960         *) eval "$1=\"\$$2\"";;
5961         esac;;
5962 esac'
5963
5964 : get the patchlevel
5965 echo " "
5966 echo "Getting the current patchlevel..." >&4
5967 if $test -r $rsrc/patchlevel.h;then
5968         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5969         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5970         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5971         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5972         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5973         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5974         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5975 else
5976         revision=0
5977         patchlevel=0
5978         subversion=0
5979         api_revision=0
5980         api_version=0
5981         api_subversion=0
5982         perl_patchlevel=0
5983         $echo "(You do not have patchlevel.h.  Eek.)"
5984 fi
5985 if $test -r $rsrc/.patch ; then
5986         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5987                 perl_patchlevel=`cat $rsrc/.patch`
5988         fi
5989 fi
5990 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5991 version_patchlevel_string="version $patchlevel subversion $subversion"
5992 case "$perl_patchlevel" in
5993 0|'') ;;
5994 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5995 esac
5996
5997 $echo "(You have $package $version_patchlevel_string.)"
5998
5999 case "$osname" in
6000 dos|vms)
6001         : XXX Should be a Configure test for double-dots in filenames.
6002         version=`echo $revision $patchlevel $subversion | \
6003                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6004         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6005                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6006         ;;
6007 *)
6008         version=`echo $revision $patchlevel $subversion | \
6009                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6010         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6011                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6012         ;;
6013 esac
6014 : Special case the 5.005_xx maintenance series, which used 5.005
6015 : without any subversion label as a subdirectory in $sitelib
6016 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6017         api_versionstring='5.005'
6018 fi
6019
6020 : determine installation style
6021 : For now, try to deduce it from prefix unless it is already set.
6022 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6023 case "$installstyle" in
6024 '')     case "$prefix" in
6025                 *perl*) dflt='lib';;
6026                 *) dflt='lib/perl5' ;;
6027         esac
6028         ;;
6029 *)      dflt="$installstyle" ;;
6030 esac
6031 : Probably not worth prompting for this since we prompt for all
6032 : the directories individually, and the prompt would be too long and
6033 : confusing anyway.
6034 installstyle=$dflt
6035
6036 : determine where public executables go
6037 echo " "
6038 set dflt bin bin
6039 eval $prefixit
6040 fn=d~
6041 rp='Pathname where the public executables will reside?'
6042 . ./getfile
6043 if $test "X$ansexp" != "X$binexp"; then
6044         installbin=''
6045 fi
6046 prefixvar=bin
6047 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6048 . ./setprefixvar
6049
6050 case "$userelocatableinc" in
6051 $define|true|[yY]*)     dflt='y' ;;
6052 *)                      dflt='n' ;;
6053 esac
6054 cat <<EOM
6055
6056 Would you like to build Perl so that the installation is relocatable, so that
6057 library paths in @INC are determined relative to the path of the perl binary?
6058 This is not advised for system Perl installs, or if you need to run setid
6059 scripts or scripts under taint mode.
6060
6061 If this doesn't make any sense to you, just accept the default '$dflt'.
6062 EOM
6063 rp='Use relocatable @INC?'
6064 . ./myread
6065 case "$ans" in
6066 y|Y)    val="$define" ;;
6067 *)      val="$undef"  ;;
6068 esac
6069 set userelocatableinc
6070 eval $setvar
6071
6072 : Default prefix is now "up one level from where the binaries are"
6073 case "$userelocatableinc" in
6074 $define|true|[yY]*)
6075     initialinstalllocation="$binexp"
6076     bin=".../"
6077     binexp=".../"
6078     prefix=".../.."
6079     prefixexp=".../.."
6080     installprefixexp=".../.."
6081     ;;
6082 esac
6083
6084 : determine where private library files go
6085 : Usual default is /usr/local/lib/perl5/$version.
6086 : Also allow things like /opt/perl/lib/$version, since
6087 : /opt/perl/lib/perl5... would be redundant.
6088 : The default "style" setting is made in installstyle.U
6089 case "$installstyle" in
6090 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6091 *)       set dflt privlib lib/$version ;;
6092 esac
6093 eval $prefixit
6094 $cat <<EOM
6095
6096 There are some auxiliary files for $package that need to be put into a
6097 private library directory that is accessible by everyone.
6098
6099 EOM
6100 fn=$binexp
6101 fn=d~+
6102 rp='Pathname where the private library files will reside?'
6103 . ./getfile
6104 prefixvar=privlib
6105 . ./setprefixvar
6106
6107 : set the prefixup variable, to restore leading tilda escape
6108 prefixup='case "$prefixexp" in
6109 "$prefix") ;;
6110 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6111 esac'
6112
6113 : determine where public architecture dependent libraries go
6114 set archlib archlib
6115 eval $prefixit
6116 : privlib default is /usr/local/lib/$package/$version
6117 : archlib default is /usr/local/lib/$package/$version/$archname
6118 : privlib may have an optional trailing /share.
6119 tdflt=`echo $privlib | $sed 's,/share$,,'`
6120 tdflt=$tdflt/$archname
6121 case "$archlib" in
6122 '')     dflt=$tdflt
6123         ;;
6124 *)      dflt="$archlib"
6125     ;;
6126 esac
6127 $cat <<EOM
6128
6129 $spackage contains architecture-dependent library files.  If you are
6130 sharing libraries in a heterogeneous environment, you might store
6131 these files in a separate location.  Otherwise, you can just include
6132 them with the rest of the public library files.
6133
6134 EOM
6135 fn=$binexp
6136 fn=d+~
6137 rp='Where do you want to put the public architecture-dependent libraries?'
6138 . ./getfile
6139 prefixvar=archlib
6140 . ./setprefixvar
6141 if $test X"$archlib" = X"$privlib"; then
6142         d_archlib="$undef"
6143 else
6144         d_archlib="$define"
6145 fi
6146
6147 : see if setuid scripts can be secure
6148 $cat <<EOM
6149
6150 Some kernels have a bug that prevents setuid #! scripts from being
6151 secure.  Some sites have disabled setuid #! scripts because of this.
6152
6153 First let's decide if your kernel supports secure setuid #! scripts.
6154 (If setuid #! scripts would be secure but have been disabled anyway,
6155 don't say that they are secure if asked.)
6156
6157 EOM
6158
6159 val="$undef"
6160 if $test -d /dev/fd; then
6161         echo "#!$ls" >reflect
6162         chmod +x,u+s reflect
6163         ./reflect >flect 2>&1
6164         if $contains "/dev/fd" flect >/dev/null; then
6165                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6166                 val="$define"
6167         else
6168                 $cat <<EOM
6169 If you are not sure if they are secure, I can check but I'll need a
6170 username and password different from the one you are using right now.
6171 If you don't have such a username or don't want me to test, simply
6172 enter 'none'.
6173
6174 EOM
6175                 rp='Other username to test security of setuid scripts with?'
6176                 dflt='none'
6177                 . ./myread
6178                 case "$ans" in
6179                 n|none)
6180                         case "$d_suidsafe" in
6181                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6182                                 dflt=n;;
6183                         "$undef")
6184                                 echo "Well, the $hint value is *not* secure." >&4
6185                                 dflt=n;;
6186                         *)      echo "Well, the $hint value *is* secure." >&4
6187                                 dflt=y;;
6188                         esac
6189                         ;;
6190                 *)
6191                         $rm -f reflect flect
6192                         echo "#!$ls" >reflect
6193                         chmod +x,u+s reflect
6194                         echo >flect
6195                         chmod a+w flect
6196                         echo '"su" will (probably) prompt you for '"$ans's password."
6197                         su $ans -c './reflect >flect'
6198                         if $contains "/dev/fd" flect >/dev/null; then
6199                                 echo "Okay, it looks like setuid scripts are secure." >&4
6200                                 dflt=y
6201                         else
6202                                 echo "I don't think setuid scripts are secure." >&4
6203                                 dflt=n
6204                         fi
6205                         ;;
6206                 esac
6207                 rp='Does your kernel have *secure* setuid scripts?'
6208                 . ./myread
6209                 case "$ans" in
6210                 [yY]*)  val="$define";;
6211                 *)      val="$undef";;
6212                 esac
6213         fi
6214 else
6215         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6216         echo "(That's for file descriptors, not floppy disks.)"
6217         val="$undef"
6218 fi
6219 set d_suidsafe
6220 eval $setvar
6221
6222 $rm -f reflect flect
6223
6224 : now see if they want to do setuid emulation
6225 echo " "
6226 val="$undef"
6227 case "$d_suidsafe" in
6228 "$define")
6229         val="$undef"
6230         echo "No need to emulate SUID scripts since they are secure here." >&4
6231         ;;
6232 *)
6233         $cat <<EOM
6234 Some systems have disabled setuid scripts, especially systems where
6235 setuid scripts cannot be secure.  On systems where setuid scripts have
6236 been disabled, the setuid/setgid bits on scripts are currently
6237 useless.  It is possible for $package to detect those bits and emulate
6238 setuid/setgid in a secure fashion.  This emulation will only work if
6239 setuid scripts have been disabled in your kernel.
6240
6241 EOM
6242         case "$d_dosuid" in
6243         "$define") dflt=y ;;
6244         *) dflt=n ;;
6245         esac
6246         rp="Do you want to do setuid/setgid emulation?"
6247         . ./myread
6248         case "$ans" in
6249         [yY]*)  val="$define";;
6250         *)      val="$undef";;
6251         esac
6252         ;;
6253 esac
6254 set d_dosuid
6255 eval $setvar
6256
6257 : Find perl5.005 or later.
6258 echo "Looking for a previously installed perl5.005 or later... "
6259 case "$perl5" in
6260 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6261                 : Check if this perl is recent and can load a simple module
6262                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6263                         perl5=$tdir/perl
6264                         break;
6265                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6266                         perl5=$tdir/perl5
6267                         break;
6268                 fi
6269         done
6270         ;;
6271 *)      perl5="$perl5"
6272         ;;
6273 esac
6274 case "$perl5" in
6275 '')     echo "None found.  That's ok.";;
6276 *)      echo "Using $perl5." ;;
6277 esac
6278
6279 $cat <<EOM
6280
6281 After $package is installed, you may wish to install various
6282 add-on modules and utilities.  Typically, these add-ons will
6283 be installed under $prefix with the rest
6284 of this package.  However, you may wish to install such add-ons
6285 elsewhere under a different prefix.
6286
6287 If you do not wish to put everything under a single prefix, that's
6288 ok.  You will be prompted for the individual locations; this siteprefix
6289 is only used to suggest the defaults.
6290
6291 The default should be fine for most people.
6292
6293 EOM
6294 fn=d~+
6295 rp='Installation prefix to use for add-on modules and utilities?'
6296 : XXX Here might be another good place for an installstyle setting.
6297 case "$siteprefix" in
6298 '') dflt=$prefix ;;
6299 *)  dflt=$siteprefix ;;
6300 esac
6301 . ./getfile
6302 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6303 oldsiteprefix=''
6304 case "$siteprefix" in
6305 '') ;;
6306 *)      case "$ans" in
6307         "$prefix") ;;
6308         *) oldsiteprefix="$prefix";;
6309         esac
6310         ;;
6311 esac
6312 siteprefix="$ans"
6313 siteprefixexp="$ansexp"
6314
6315 : determine where site specific libraries go.
6316 : Usual default is /usr/local/lib/perl5/site_perl/$version
6317 : The default "style" setting is made in installstyle.U
6318 : XXX No longer works with Prefixit stuff.
6319 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6320 case "$sitelib" in
6321 '') case "$installstyle" in
6322         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6323         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6324         esac
6325         ;;
6326 *)      dflt="$sitelib"
6327         ;;
6328 esac
6329 $cat <<EOM
6330
6331 The installation process will create a directory for
6332 site-specific extensions and modules.  Most users find it convenient
6333 to place all site-specific files in this directory rather than in the
6334 main distribution directory.
6335
6336 EOM
6337 fn=d~+
6338 rp='Pathname for the site-specific library files?'
6339 . ./getfile
6340 prefixvar=sitelib
6341 . ./setprefixvar
6342 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6343
6344 : Determine list of previous versions to include in @INC
6345 $cat > getverlist <<EOPL
6346 #!$perl5 -w
6347 use File::Basename;
6348 \$api_versionstring = "$api_versionstring";
6349 \$version = "$version";
6350 \$stem = "$sitelib_stem";
6351 \$archname = "$archname";
6352 EOPL
6353         $cat >> getverlist <<'EOPL'
6354 # Can't have leading @ because metaconfig interprets it as a command!
6355 ;@inc_version_list=();
6356 # XXX Redo to do opendir/readdir?
6357 if (-d $stem) {
6358     chdir($stem);
6359     ;@candidates = glob("5.*");
6360 }
6361 else {
6362     ;@candidates = ();
6363 }
6364
6365 # XXX ToDo:  These comparisons must be reworked when two-digit
6366 # subversions come along, so that 5.7.10 compares as greater than
6367 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6368 # widespread that we can use the built-in version vectors rather
6369 # than reinventing them here.  For 5.6.0, however, we must
6370 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6371 foreach $d (@candidates) {
6372     if ($d lt $version) {
6373         if ($d ge $api_versionstring) {
6374             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6375         }
6376         elsif ($d ge "5.005") {
6377             unshift(@inc_version_list, grep { -d } $d);
6378         }
6379     }
6380     else {
6381         # Skip newer version.  I.e. don't look in
6382         # 5.7.0 if we're installing 5.6.1.
6383     }
6384 }
6385
6386 if (@inc_version_list) {
6387     print join(' ', @inc_version_list);
6388 }
6389 else {
6390     # Blank space to preserve value for next Configure run.
6391     print " ";
6392 }
6393 EOPL
6394 chmod +x getverlist
6395 case "$inc_version_list" in
6396 '')     if test -x "$perl5$exe_ext"; then
6397                 dflt=`$perl5 getverlist`
6398         else
6399                 dflt='none'
6400         fi
6401         ;;
6402 $undef) dflt='none' ;;
6403 *)  eval dflt=\"$inc_version_list\" ;;
6404 esac
6405 case "$dflt" in
6406 ''|' ') dflt=none ;;
6407 esac
6408 case "$dflt" in
6409 5.005) dflt=none ;;
6410 esac
6411 $cat <<EOM
6412
6413 In order to ease the process of upgrading, this version of perl
6414 can be configured to use modules built and installed with earlier
6415 versions of perl that were installed under $prefix.  Specify here
6416 the list of earlier versions that this version of perl should check.
6417 If Configure detected no earlier versions of perl installed under
6418 $prefix, then the list will be empty.  Answer 'none' to tell perl
6419 to not search earlier versions.
6420
6421 The default should almost always be sensible, so if you're not sure,
6422 just accept the default.
6423 EOM
6424
6425 rp='List of earlier versions to include in @INC?'
6426 . ./myread
6427 case "$ans" in
6428 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6429 *) inc_version_list="$ans" ;;
6430 esac
6431 case "$inc_version_list" in
6432 ''|' ')
6433         inc_version_list_init='0'
6434         d_inc_version_list="$undef"
6435         ;;
6436 *)      inc_version_list_init=`echo $inc_version_list |
6437                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6438         d_inc_version_list="$define"
6439         ;;
6440 esac
6441 $rm -f getverlist
6442
6443 : see if this is a malloc.h system
6444 : we want a real compile instead of Inhdr because some systems have a
6445 : malloc.h that just gives a compile error saying to use stdlib.h instead
6446 echo " "
6447 $cat >try.c <<EOCP
6448 #include <stdlib.h>
6449 #include <malloc.h>
6450 int main () { return 0; }
6451 EOCP
6452 set try
6453 if eval $compile; then
6454     echo "<malloc.h> found." >&4
6455     val="$define"
6456 else
6457     echo "<malloc.h> NOT found." >&4
6458     val="$undef"
6459 fi
6460 $rm -f try.c try
6461 set i_malloc
6462 eval $setvar
6463
6464 : check for void type
6465 echo " "
6466 echo "Checking to see how well your C compiler groks the void type..." >&4
6467 case "$voidflags" in
6468 '')
6469         $cat >try.c <<EOCP
6470 #$i_stdlib I_STDLIB
6471 #ifdef I_STDLIB
6472 #include <stdlib.h>
6473 #endif
6474 #if TRY & 1
6475 void sub() {
6476 #else
6477 sub() {
6478 #endif
6479         extern void moo();      /* function returning void */
6480         void (*goo)();          /* ptr to func returning void */
6481 #if TRY & 8
6482         void *hue;              /* generic ptr */
6483 #endif
6484 #if TRY & 2
6485         void (*foo[10])();
6486 #endif
6487
6488 #if TRY & 4
6489         if(goo == moo) {
6490                 exit(0);
6491         }
6492 #endif
6493         exit(0);
6494 }
6495 int main() { sub(); }
6496 EOCP
6497         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6498                 voidflags=$defvoidused
6499         echo "Good.  It appears to support void to the level $package wants.">&4
6500                 if $contains warning .out >/dev/null 2>&1; then
6501                         echo "However, you might get some warnings that look like this:"
6502                         $cat .out
6503                 fi
6504         else
6505 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6506                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6507                         echo "It supports 1..."
6508                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6509                                 echo "It also supports 2..."
6510                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6511                                         voidflags=7
6512                                         echo "And it supports 4 but not 8 definitely."
6513                                 else
6514                                         echo "It doesn't support 4..."
6515                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6516                                                 voidflags=11
6517                                                 echo "But it supports 8."
6518                                         else
6519                                                 voidflags=3
6520                                                 echo "Neither does it support 8."
6521                                         fi
6522                                 fi
6523                         else
6524                                 echo "It does not support 2..."
6525                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6526                                         voidflags=13
6527                                         echo "But it supports 4 and 8."
6528                                 else
6529                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6530                                                 voidflags=5
6531                                                 echo "And it supports 4 but has not heard about 8."
6532                                         else
6533                                                 echo "However it supports 8 but not 4."
6534                                         fi
6535                                 fi
6536                         fi
6537                 else
6538                         echo "There is no support at all for void."
6539                         voidflags=0
6540                 fi
6541         fi
6542 esac
6543 case "$voidflags" in
6544 "$defvoidused") ;;
6545 *)      $cat >&4 <<'EOM'
6546   Support flag bits are:
6547     1: basic void declarations.
6548     2: arrays of pointers to functions returning void.
6549     4: operations between pointers to and addresses of void functions.
6550     8: generic void pointers.
6551 EOM
6552         dflt="$voidflags";
6553         rp="Your void support flags add up to what?"
6554         . ./myread
6555         voidflags="$ans"
6556         ;;
6557 esac
6558 $rm -f try.* .out
6559
6560 : check for length of pointer
6561 echo " "
6562 case "$ptrsize" in
6563 '')
6564         echo "Checking to see how big your pointers are..." >&4
6565         if test "$voidflags" -gt 7; then
6566                 echo '#define VOID_PTR char *' > try.c
6567         else
6568                 echo '#define VOID_PTR void *' > try.c
6569         fi
6570         $cat >>try.c <<EOCP
6571 #include <stdio.h>
6572 #$i_stdlib I_STDLIB
6573 #ifdef I_STDLIB
6574 #include <stdlib.h>
6575 #endif
6576 int main()
6577 {
6578     printf("%d\n", (int)sizeof(VOID_PTR));
6579     exit(0);
6580 }
6581 EOCP
6582         set try
6583         if eval $compile_ok; then
6584                 ptrsize=`$run ./try`
6585                 echo "Your pointers are $ptrsize bytes long."
6586         else
6587                 dflt='4'
6588                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6589                 rp="What is the size of a pointer (in bytes)?"
6590                 . ./myread
6591                 ptrsize="$ans"
6592         fi
6593         ;;
6594 esac
6595 $rm -f try.c try
6596 case "$use64bitall" in
6597 "$define"|true|[yY]*)
6598         case "$ptrsize" in
6599         4)      cat <<EOM >&4
6600
6601 *** You have chosen a maximally 64-bit build,
6602 *** but your pointers are only 4 bytes wide.
6603 *** Please rerun Configure without -Duse64bitall.
6604 EOM
6605                 case "$d_quad" in
6606                 define)
6607                         cat <<EOM >&4
6608 *** Since you have quads, you could possibly try with -Duse64bitint.
6609 EOM
6610                         ;;
6611                 esac
6612                 cat <<EOM >&4
6613 *** Cannot continue, aborting.
6614
6615 EOM
6616
6617                 exit 1
6618                 ;;
6619         esac
6620         ;;
6621 esac
6622
6623
6624 : determine whether to use malloc wrapping
6625 echo " "
6626 case "$usemallocwrap" in
6627 [yY]*|true|$define)     dflt='y' ;;
6628 [nN]*|false|$undef)     dflt='n' ;;
6629 *)      case "$usedevel" in
6630         [yY]*|true|$define)     dflt='y' ;;
6631         *) dflt='n' ;;
6632         esac
6633         ;;
6634 esac
6635 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6636 . ./myread
6637 usemallocwrap="$ans"
6638 case "$ans" in
6639 y*|true)
6640         usemallocwrap="$define" ;;
6641 *)
6642         usemallocwrap="$undef" ;;
6643 esac
6644
6645 : determine which malloc to compile in
6646 echo " "
6647 case "$usemymalloc" in
6648 [yY]*|true|$define)     dflt='y' ;;
6649 [nN]*|false|$undef)     dflt='n' ;;
6650 *)      case "$ptrsize" in
6651         4) dflt='y' ;;
6652         *) dflt='n' ;;
6653         esac
6654         ;;
6655 esac
6656 rp="Do you wish to attempt to use the malloc that comes with $package?"
6657 . ./myread
6658 usemymalloc="$ans"
6659 case "$ans" in
6660 y*|true)
6661         usemymalloc='y'
6662         mallocsrc='malloc.c'
6663         mallocobj="malloc$_o"
6664         d_mymalloc="$define"
6665         case "$libs" in
6666         *-lmalloc*)
6667                 : Remove malloc from list of libraries to use
6668                 echo "Removing unneeded -lmalloc from library list" >&4
6669                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6670                 shift
6671                 libs="$*"
6672                 echo "libs = $libs" >&4
6673                 ;;
6674         esac
6675         ;;
6676 *)
6677         usemymalloc='n'
6678         mallocsrc=''
6679         mallocobj=''
6680         d_mymalloc="$undef"
6681         ;;
6682 esac
6683
6684 : compute the return types of malloc and free
6685 echo " "
6686 $cat >malloc.c <<END
6687 #$i_malloc I_MALLOC
6688 #$i_stdlib I_STDLIB
6689 #include <stdio.h>
6690 #include <sys/types.h>
6691 #ifdef I_MALLOC
6692 #include <malloc.h>
6693 #endif
6694 #ifdef I_STDLIB
6695 #include <stdlib.h>
6696 #endif
6697 #ifdef TRY_MALLOC
6698 void *malloc();
6699 #endif
6700 #ifdef TRY_FREE
6701 void free();
6702 #endif
6703 END
6704 case "$malloctype" in
6705 '')
6706         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6707                 malloctype='void *'
6708         else
6709                 malloctype='char *'
6710         fi
6711         ;;
6712 esac
6713 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6714
6715 case "$freetype" in
6716 '')
6717         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6718                 freetype='void'
6719         else
6720                 freetype='int'
6721         fi
6722         ;;
6723 esac
6724 echo "Your system uses $freetype free(), it would seem." >&4
6725 $rm -f malloc.[co]
6726 : determine where site specific architecture-dependent libraries go.
6727 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6728 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6729 : sitelib may have an optional trailing /share.
6730 case "$sitearch" in
6731 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6732         dflt="$dflt/$archname"
6733         ;;
6734 *)      dflt="$sitearch"
6735         ;;
6736 esac
6737 set sitearch sitearch none
6738 eval $prefixit
6739 $cat <<EOM
6740
6741 The installation process will also create a directory for
6742 architecture-dependent site-specific extensions and modules.
6743
6744 EOM
6745 fn=d~+
6746 rp='Pathname for the site-specific architecture-dependent library files?'
6747 . ./getfile
6748 prefixvar=sitearch
6749 . ./setprefixvar
6750 if $test X"$sitearch" = X"$sitelib"; then
6751         d_sitearch="$undef"
6752 else
6753         d_sitearch="$define"
6754 fi
6755
6756 $cat <<EOM
6757
6758 The installation process will also create a directory for
6759 vendor-supplied add-ons.  Vendors who supply perl with their system
6760 may find it convenient to place all vendor-supplied files in this
6761 directory rather than in the main distribution directory.  This will
6762 ease upgrades between binary-compatible maintenance versions of perl.
6763
6764 Of course you may also use these directories in whatever way you see
6765 fit.  For example, you might use them to access modules shared over a
6766 company-wide network.
6767
6768 The default answer should be fine for most people.
6769 This causes further questions about vendor add-ons to be skipped
6770 and no vendor-specific directories will be configured for perl.
6771
6772 EOM
6773 rp='Do you want to configure vendor-specific add-on directories?'
6774 case "$usevendorprefix" in
6775 define|true|[yY]*) dflt=y ;;
6776 *)      : User may have set vendorprefix directly on Configure command line.
6777         case "$vendorprefix" in
6778         ''|' ') dflt=n ;;
6779         *)      dflt=y ;;
6780         esac
6781         ;;
6782 esac
6783 . ./myread
6784 case "$ans" in
6785 [yY]*)  fn=d~+
6786         rp='Installation prefix to use for vendor-supplied add-ons?'
6787         case "$vendorprefix" in
6788         '') dflt='' ;;
6789         *)  dflt=$vendorprefix ;;
6790         esac
6791         . ./getfile
6792         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6793         oldvendorprefix=''
6794         case "$vendorprefix" in
6795         '') ;;
6796         *)      case "$ans" in
6797                 "$prefix") ;;
6798                 *) oldvendorprefix="$prefix";;
6799                 esac
6800                 ;;
6801         esac
6802         usevendorprefix="$define"
6803         vendorprefix="$ans"
6804         vendorprefixexp="$ansexp"
6805         ;;
6806 *)      usevendorprefix="$undef"
6807         vendorprefix=''
6808         vendorprefixexp=''
6809         ;;
6810 esac
6811
6812 case "$vendorprefix" in
6813 '')     d_vendorlib="$undef"
6814         vendorlib=''
6815         vendorlibexp=''
6816         ;;
6817 *)      d_vendorlib="$define"
6818         : determine where vendor-supplied modules go.
6819         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6820         case "$vendorlib" in
6821         '')
6822                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6823                 case "$installstyle" in
6824                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6825                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6826                 esac
6827                 ;;
6828         *)      dflt="$vendorlib"
6829                 ;;
6830         esac
6831         fn=d~+
6832         rp='Pathname for the vendor-supplied library files?'
6833         . ./getfile
6834         vendorlib="$ans"
6835         vendorlibexp="$ansexp"
6836         ;;
6837 esac
6838 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6839 prefixvar=vendorlib
6840 . ./installprefix
6841
6842 case "$vendorprefix" in
6843 '')     d_vendorarch="$undef"
6844         vendorarch=''
6845         vendorarchexp=''
6846         ;;
6847 *)      d_vendorarch="$define"
6848         : determine where vendor-supplied architecture-dependent libraries go.
6849         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6850         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6851         : vendorlib may have an optional trailing /share.
6852         case "$vendorarch" in
6853         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6854                 dflt="$dflt/$archname"
6855                 ;;
6856         *)      dflt="$vendorarch" ;;
6857         esac
6858         fn=d~+
6859         rp='Pathname for vendor-supplied architecture-dependent files?'
6860         . ./getfile
6861         vendorarch="$ans"
6862         vendorarchexp="$ansexp"
6863         ;;
6864 esac
6865 prefixvar=vendorarch
6866 . ./installprefix
6867
6868 : Final catch-all directories to search
6869 $cat <<EOM
6870
6871 Lastly, you can have perl look in other directories for extensions and
6872 modules in addition to those already specified.
6873 These directories will be searched after 
6874         $sitearch 
6875         $sitelib 
6876 EOM
6877 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6878 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6879 echo ' '
6880 case "$otherlibdirs" in
6881 ''|' ') dflt='none' ;;
6882 *)      dflt="$otherlibdirs" ;;
6883 esac
6884 $cat <<EOM
6885 Enter a colon-separated set of extra paths to include in perl's @INC
6886 search path, or enter 'none' for no extra paths.
6887
6888 EOM
6889
6890 rp='Colon-separated list of additional directories for perl to search?'
6891 . ./myread
6892 case "$ans" in
6893 ' '|''|none)    otherlibdirs=' ' ;;     
6894 *)      otherlibdirs="$ans" ;;
6895 esac
6896 case "$otherlibdirs" in
6897 ' ') val=$undef ;;
6898 *)      val=$define ;;
6899 esac
6900 set d_perl_otherlibdirs
6901 eval $setvar
6902
6903 : Cruising for prototypes
6904 echo " "
6905 echo "Checking out function prototypes..." >&4
6906 $cat >prototype.c <<EOCP
6907 #$i_stdlib I_STDLIB
6908 #ifdef I_STDLIB
6909 #include <stdlib.h>
6910 #endif
6911 int main(int argc, char *argv[]) {
6912         exit(0);}
6913 EOCP
6914 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6915         echo "Your C compiler appears to support function prototypes."
6916         val="$define"
6917 else
6918         echo "Your C compiler doesn't seem to understand function prototypes."
6919         val="$undef"
6920 fi
6921 set prototype
6922 eval $setvar
6923 $rm -f prototype*
6924
6925 case "$prototype" in
6926 "$define") ;;
6927 *)      ansi2knr='ansi2knr'
6928         echo " "
6929         cat <<EOM >&4
6930
6931 $me:  FATAL ERROR:
6932 This version of $package can only be compiled by a compiler that 
6933 understands function prototypes.  Unfortunately, your C compiler 
6934         $cc $ccflags
6935 doesn't seem to understand them.  Sorry about that.
6936
6937 If GNU cc is available for your system, perhaps you could try that instead.  
6938
6939 Eventually, we hope to support building Perl with pre-ANSI compilers.
6940 If you would like to help in that effort, please contact <perlbug@perl.org>.
6941
6942 Aborting Configure now.
6943 EOM
6944         exit 2
6945         ;;
6946 esac
6947
6948 echo " "
6949 case "$extras" in
6950 '') dflt='n';;
6951 *) dflt='y';;
6952 esac
6953 cat <<EOM
6954 Perl can be built with extra modules or bundles of modules which
6955 will be fetched from the CPAN and installed alongside Perl.
6956
6957 Notice that you will need access to the CPAN; either via the Internet,
6958 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6959 be asked later to configure the CPAN.pm module which will in turn do
6960 the installation of the rest of the extra modules or bundles.)
6961
6962 Notice also that if the modules require any external software such as
6963 libraries and headers (the libz library and the zlib.h header for the
6964 Compress::Zlib module, for example) you MUST have any such software
6965 already installed, this configuration process will NOT install such
6966 things for you.
6967
6968 If this doesn't make any sense to you, just accept the default '$dflt'.
6969 EOM
6970 rp='Install any extra modules (y or n)?'
6971 . ./myread
6972 case "$ans" in
6973 y|Y)
6974         cat <<EOM
6975
6976 Please list any extra modules or bundles to be installed from CPAN,
6977 with spaces between the names.  The names can be in any format the
6978 'install' command of CPAN.pm will understand.  (Answer 'none',
6979 without the quotes, to install no extra modules or bundles.)
6980 EOM
6981         rp='Extras?'
6982         dflt="$extras"
6983         . ./myread
6984         extras="$ans"
6985 esac
6986 case "$extras" in
6987 ''|'none')
6988         val=''
6989         $rm -f ../extras.lst
6990         ;;
6991 *)      echo "(Saving the list of extras for later...)"
6992         echo "$extras" > ../extras.lst
6993         val="'$extras'"
6994         ;;
6995 esac
6996 set extras
6997 eval $setvar
6998 echo " "
6999
7000 : determine where html pages for programs go
7001 set html1dir html1dir none
7002 eval $prefixit
7003 $cat <<EOM
7004
7005 If you wish to install html files for programs in $spackage, indicate
7006 the appropriate directory here.  To skip installing html files,
7007 answer "none".
7008 EOM
7009 case "$html1dir" in
7010 ''|none|$undef|' ') dflt=none ;;
7011 *) dflt=$html1dir ;;
7012 esac
7013 fn=dn+~
7014 rp="Directory for the main $spackage html pages?"
7015 . ./getfile
7016 prefixvar=html1dir
7017 . ./setprefixvar
7018 : Use ' ' for none so value is preserved next time through Configure
7019 $test X"$html1dir" = "X" && html1dir=' '
7020
7021 : determine where html pages for libraries and modules go
7022 set html3dir html3dir none
7023 eval $prefixit
7024 $cat <<EOM
7025
7026 If you wish to install html files for modules associated with $spackage,
7027 indicate the appropriate directory here.  To skip installing html files,
7028 answer "none".
7029 EOM
7030 : There is no obvious default.  If they have specified html1dir, then
7031 : try to key off that, possibly changing .../html1 into .../html3.
7032 case "$html3dir" in
7033 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7034 *) dflt=$html3dir ;;
7035 esac
7036 fn=dn+~
7037 rp="Directory for the $spackage module html pages?"
7038 . ./getfile
7039 prefixvar=html3dir
7040 . ./setprefixvar
7041 : Use ' ' for none so value is preserved next time through Configure
7042 $test X"$html3dir" = "X" && html3dir=' '
7043
7044 : determine whether to install perl also as /usr/bin/perl
7045
7046 echo " "
7047 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7048         $cat <<EOM
7049 Many scripts expect perl to be installed as /usr/bin/perl.
7050
7051 If you want to, I can install the perl you are about to compile
7052 as /usr/bin/perl (in addition to $bin/perl).
7053 EOM
7054         if test -f /usr/bin/perl; then
7055             $cat <<EOM
7056
7057 However, please note that because you already have a /usr/bin/perl,
7058 overwriting that with a new Perl would very probably cause problems.
7059 Therefore I'm assuming you don't want to do that (unless you insist).
7060
7061 EOM
7062             case "$installusrbinperl" in
7063             "$define"|[yY]*)    dflt='y';;
7064             *)                  dflt='n';;
7065             esac
7066         else
7067             $cat <<EOM
7068
7069 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7070
7071 EOM
7072             case "$installusrbinperl" in
7073             "$undef"|[nN]*)     dflt='n';;
7074             *)                  dflt='y';;
7075             esac
7076         fi
7077         rp="Do you want to install perl as /usr/bin/perl?"
7078         . ./myread
7079         case "$ans" in
7080         [yY]*)  val="$define";;
7081         *)      val="$undef" ;;
7082         esac
7083 else
7084         val="$undef"
7085 fi
7086 set installusrbinperl
7087 eval $setvar
7088
7089 echo " "
7090 echo "Checking for GNU C Library..." >&4
7091 cat >try.c <<'EOCP'
7092 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7093    alone are insufficient to distinguish different versions, such as
7094    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7095    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7096 */
7097 #include <stdio.h>
7098 int main(void)
7099 {
7100 #ifdef __GLIBC__
7101 #   ifdef __GLIBC_MINOR__
7102 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7103 #           include <gnu/libc-version.h>
7104             printf("%s\n",  gnu_get_libc_version());
7105 #       else
7106             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7107 #       endif
7108 #   else
7109         printf("%d\n",  __GLIBC__);
7110 #   endif
7111     return 0;
7112 #else
7113     return 1;
7114 #endif
7115 }
7116 EOCP
7117 set try
7118 if eval $compile_ok && $run ./try > glibc.ver; then
7119         val="$define"
7120         gnulibc_version=`$cat glibc.ver`
7121         echo "You are using the GNU C Library version $gnulibc_version"
7122 else
7123         val="$undef"
7124         gnulibc_version=''
7125         echo "You are not using the GNU C Library"
7126 fi
7127 $rm -f try try.* glibc.ver
7128 set d_gnulibc
7129 eval $setvar
7130
7131 : see if nm is to be used to determine whether a symbol is defined or not
7132 case "$usenm" in
7133 '')
7134         dflt=''
7135         case "$d_gnulibc" in
7136         "$define")
7137                 echo " "
7138                 echo "nm probably won't work on the GNU C Library." >&4
7139                 dflt=n
7140                 ;;
7141         esac
7142         case "$dflt" in
7143         '') 
7144                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7145                         echo " "
7146                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7147                         echo "'nm' won't be sufficient on this sytem." >&4
7148                         dflt=n
7149                 fi
7150                 ;;
7151         esac
7152         case "$dflt" in
7153         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7154                 if $test $dflt -gt 20; then
7155                         dflt=y
7156                 else
7157                         dflt=n
7158                 fi
7159                 ;;
7160         esac
7161         ;;
7162 *)
7163         case "$usenm" in
7164         true|$define) dflt=y;;
7165         *) dflt=n;;
7166         esac
7167         ;;
7168 esac
7169 $cat <<EOM
7170
7171 I can use $nm to extract the symbols from your C libraries. This
7172 is a time consuming task which may generate huge output on the disk (up
7173 to 3 megabytes) but that should make the symbols extraction faster. The
7174 alternative is to skip the 'nm' extraction part and to compile a small
7175 test program instead to determine whether each symbol is present. If
7176 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7177 this may be the best solution.
7178
7179 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7180
7181 EOM
7182 rp="Shall I use $nm to extract C symbols from the libraries?"
7183 . ./myread
7184 case "$ans" in
7185 [Nn]*) usenm=false;;
7186 *) usenm=true;;
7187 esac
7188
7189 runnm=$usenm
7190 case "$reuseval" in
7191 true) runnm=false;;
7192 esac
7193
7194 : nm options which may be necessary
7195 case "$nm_opt" in
7196 '') if $test -f /mach_boot; then
7197                 nm_opt=''       # Mach
7198         elif $test -d /usr/ccs/lib; then
7199                 nm_opt='-p'     # Solaris (and SunOS?)
7200         elif $test -f /dgux; then
7201                 nm_opt='-p'     # DG-UX
7202         elif $test -f /lib64/rld; then
7203                 nm_opt='-p'     # 64-bit Irix
7204         else
7205                 nm_opt=''
7206         fi;;
7207 esac
7208
7209 : nm options which may be necessary for shared libraries but illegal
7210 : for archive libraries.  Thank you, Linux.
7211 case "$nm_so_opt" in
7212 '')     case "$myuname" in
7213         *linux*|gnu*)
7214                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7215                         nm_so_opt='--dynamic'
7216                 fi
7217                 ;;
7218         esac
7219         ;;
7220 esac
7221
7222 case "$runnm" in
7223 true)
7224 : get list of predefined functions in a handy place
7225 echo " "
7226 case "$libc" in
7227 '') libc=unknown
7228         case "$libs" in
7229         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7230         esac
7231         ;;
7232 esac
7233 case "$libs" in
7234 '') ;;
7235 *)  for thislib in $libs; do
7236         case "$thislib" in
7237         -lc|-lc_s)
7238                 : Handle C library specially below.
7239                 ;;
7240         -l*)
7241                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7242                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7243                         :
7244                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7245                         :
7246                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7247                         :
7248                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7249                         :
7250                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7251                         :
7252                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7253                         :
7254                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7255                         :
7256                 else
7257                         try=''
7258                 fi
7259                 libnames="$libnames $try"
7260                 ;;
7261         *) libnames="$libnames $thislib" ;;
7262         esac
7263         done
7264         ;;
7265 esac
7266 xxx=normal
7267 case "$libc" in
7268 unknown)
7269         set /lib/libc.$so
7270         for xxx in $libpth; do
7271                 $test -r $1 || set $xxx/libc.$so
7272                 : The messy sed command sorts on library version numbers.
7273                 $test -r $1 || \
7274                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7275                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7276                                 h
7277                                 s/[0-9][0-9]*/0000&/g
7278                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7279                                 G
7280                                 s/\n/ /' | \
7281                          $sort | $sed -e 's/^.* //'`
7282                 eval set \$$#
7283         done
7284         $test -r $1 || set /usr/ccs/lib/libc.$so
7285         $test -r $1 || set /lib/libsys_s$_a
7286         ;;
7287 *)
7288         set blurfl
7289         ;;
7290 esac
7291 if $test -r "$1"; then
7292         echo "Your (shared) C library seems to be in $1."
7293         libc="$1"
7294 elif $test -r /lib/libc && $test -r /lib/clib; then
7295         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7296         xxx=apollo
7297         libc='/lib/clib /lib/libc'
7298         if $test -r /lib/syslib; then
7299                 echo "(Your math library is in /lib/syslib.)"
7300                 libc="$libc /lib/syslib"
7301         fi
7302 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7303         echo "Your C library seems to be in $libc, as you said before."
7304 elif $test -r $incpath/usr/lib/libc$_a; then
7305         libc=$incpath/usr/lib/libc$_a;
7306         echo "Your C library seems to be in $libc.  That's fine."
7307 elif $test -r /lib/libc$_a; then
7308         libc=/lib/libc$_a;
7309         echo "Your C library seems to be in $libc.  You're normal."
7310 else
7311         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7312                 :
7313         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7314                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7315         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7316                 :
7317         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7318                 :
7319         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7320                 :
7321         else
7322                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7323         fi
7324         if $test -r "$tans"; then
7325                 echo "Your C library seems to be in $tans, of all places."
7326                 libc=$tans
7327         else
7328                 libc='blurfl'
7329         fi
7330 fi
7331 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7332         dflt="$libc"
7333         cat <<EOM
7334
7335 If the guess above is wrong (which it might be if you're using a strange
7336 compiler, or your machine supports multiple models), you can override it here.
7337
7338 EOM
7339 else
7340         dflt=''
7341         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7342         cat >&4 <<EOM
7343 I can't seem to find your C library.  I've looked in the following places:
7344
7345 EOM
7346         $sed 's/^/      /' libpath
7347         cat <<EOM
7348
7349 None of these seems to contain your C library. I need to get its name...
7350
7351 EOM
7352 fi
7353 fn=f
7354 rp='Where is your C library?'
7355 . ./getfile
7356 libc="$ans"
7357
7358 echo " "
7359 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7360 set X `cat libnames`
7361 shift
7362 xxx=files
7363 case $# in 1) xxx=file; esac
7364 echo "Extracting names from the following $xxx for later perusal:" >&4
7365 echo " "
7366 $sed 's/^/      /' libnames >&4
7367 echo " "
7368 $echo $n "This may take a while...$c" >&4
7369
7370 for file in $*; do
7371         case $file in
7372         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7373         *) $nm $nm_opt $file 2>/dev/null;;
7374         esac
7375 done >libc.tmp
7376
7377 $echo $n ".$c"
7378 $grep fprintf libc.tmp > libc.ptf
7379 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7380 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7381 xxx='[ADTSIW]'
7382 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7383         eval $xscan;\
7384         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7385                 eval $xrun
7386 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7387         eval $xscan;\
7388         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7389                 eval $xrun
7390 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7391         eval $xscan;\
7392         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7393                 eval $xrun
7394 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7395         eval $xscan;\
7396         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7397                 eval $xrun
7398 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7399         eval $xscan;\
7400         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7401                 eval $xrun
7402 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7403         eval $xscan;\
7404         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7405                 eval $xrun
7406 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7407                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7408         eval $xscan;\
7409         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7410                 eval $xrun
7411 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7412         eval $xscan;\
7413         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7414                 eval $xrun
7415 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7416         eval $xscan;\
7417         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7418                 eval $xrun
7419 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7420         eval $xscan;\
7421         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7422                 eval $xrun
7423 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7424         eval $xscan;\
7425         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7426                 eval $xrun
7427 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7428         eval $xscan;\
7429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7430                 eval $xrun
7431 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7432         eval $xscan;\
7433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7434                 eval $xrun
7435 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7436         eval $xscan;\
7437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7438                 eval $xrun
7439 else
7440         $nm -p $* 2>/dev/null >libc.tmp
7441         $grep fprintf libc.tmp > libc.ptf
7442         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7443                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7444         then
7445                 nm_opt='-p'
7446                 eval $xrun
7447         else
7448                 echo " "
7449                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7450                 com=''
7451                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7452                         for thisname in $libnames $libc; do
7453                                 $ar t $thisname >>libc.tmp
7454                         done
7455                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7456                         echo "Ok." >&4
7457                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7458                         # Repeat libc to extract forwarders to DLL entries too
7459                         for thisname in $libnames $libc; do
7460                                 $ar tv $thisname >>libc.tmp
7461                                 # Revision 50 of EMX has bug in $ar.
7462                                 # it will not extract forwarders to DLL entries
7463                                 # Use emximp which will extract exactly them.
7464                                 emximp -o tmp.imp $thisname \
7465                                     2>/dev/null && \
7466                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7467                                     < tmp.imp >>libc.tmp
7468                                 $rm tmp.imp
7469                         done
7470                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7471                         echo "Ok." >&4
7472                 else
7473                         echo "$ar didn't seem to work right." >&4
7474                         echo "Maybe this is a Cray...trying bld instead..." >&4
7475                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7476                         then
7477                                 for thisname in $libnames; do
7478                                         bld t $libnames | \
7479                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7480                                         $ar t $thisname >>libc.tmp
7481                                 done
7482                                 echo "Ok." >&4
7483                         else
7484                                 echo "That didn't work either.  Giving up." >&4
7485                                 exit 1
7486                         fi
7487                 fi
7488         fi
7489 fi
7490 nm_extract="$com"
7491 case "$PASE" in
7492 define)
7493     echo " "
7494     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7495     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7496     ;;
7497 *)  if $test -f /lib/syscalls.exp; then
7498         echo " "
7499         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7500         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7501     fi
7502     ;;
7503 esac
7504 ;;
7505 esac
7506 $rm -f libnames libpath
7507
7508 : see if dld is available
7509 set dld.h i_dld
7510 eval $inhdr
7511
7512 : is a C symbol defined?
7513 csym='tlook=$1;
7514 case "$3" in
7515 -v) tf=libc.tmp; tdc="";;
7516 -a) tf=libc.tmp; tdc="[]";;
7517 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7518 esac;
7519 tx=yes;
7520 case "$reuseval-$4" in
7521 true-) ;;
7522 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7523 esac;
7524 case "$tx" in
7525 yes)
7526         tval=false;
7527         if $test "$runnm" = true; then
7528                 if $contains $tlook $tf >/dev/null 2>&1; then
7529                         tval=true;
7530                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7531                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7532                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7533                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7534                         $rm -f try$_exe try.c core core.* try.core;
7535                 fi;
7536         else
7537                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7538                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7539                 $rm -f try$_exe try.c;
7540         fi;
7541         ;;
7542 *)
7543         case "$tval" in
7544         $define) tval=true;;
7545         *) tval=false;;
7546         esac;
7547         ;;
7548 esac;
7549 eval "$2=$tval"'
7550
7551 : define an is-in-libc? function
7552 inlibc='echo " "; td=$define; tu=$undef;
7553 sym=$1; var=$2; eval "was=\$$2";
7554 tx=yes;
7555 case "$reuseval$was" in
7556 true) ;;
7557 true*) tx=no;;
7558 esac;
7559 case "$tx" in
7560 yes)
7561         set $sym tres -f;
7562         eval $csym;
7563         case "$tres" in
7564         true)
7565                 echo "$sym() found." >&4;
7566                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7567         *)
7568                 echo "$sym() NOT found." >&4;
7569                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7570         esac;;
7571 *)
7572         case "$was" in
7573         $define) echo "$sym() found." >&4;;
7574         *) echo "$sym() NOT found." >&4;;
7575         esac;;
7576 esac'
7577
7578 : see if dlopen exists
7579 xxx_runnm="$runnm"
7580 runnm=false
7581 set dlopen d_dlopen
7582 eval $inlibc
7583 runnm="$xxx_runnm"
7584
7585 : determine which dynamic loading, if any, to compile in
7586 echo " "
7587 dldir="ext/DynaLoader"
7588 case "$usedl" in
7589 $define|y|true)
7590         dflt='y'
7591         usedl="$define"
7592         ;;
7593 $undef|n|false)
7594         dflt='n'
7595         usedl="$undef"
7596         ;;
7597 *) 
7598         dflt='n'
7599         case "$d_dlopen" in
7600             $define) dflt='y' ;;
7601         esac
7602         case "$i_dld" in
7603             $define) dflt='y' ;;
7604         esac
7605         : Does a dl_xxx.xs file exist for this operating system
7606         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7607         ;;
7608 esac
7609 rp="Do you wish to use dynamic loading?"
7610 . ./myread
7611 usedl="$ans"
7612 case "$ans" in
7613 y*) usedl="$define"
7614         case "$dlsrc" in
7615         '')
7616                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7617                         dflt="$dldir/dl_${osname}.xs"
7618                 elif $test "$d_dlopen" = "$define" ; then
7619                         dflt="$dldir/dl_dlopen.xs"
7620                 elif $test "$i_dld" = "$define" ; then
7621                         dflt="$dldir/dl_dld.xs"
7622                 else
7623                         dflt=''
7624                 fi
7625                 ;;
7626         *)      dflt="$dldir/$dlsrc"
7627                 ;;
7628         esac
7629     echo "The following dynamic loading files are available:"
7630         : Can not go over to $dldir because getfile has path hard-coded in.
7631         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7632         rp="Source file to use for dynamic loading"
7633         fn="fne"
7634         gfpth="$src"
7635         . ./getfile
7636         usedl="$define"
7637         : emulate basename
7638         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7639
7640         $cat << EOM
7641
7642 Some systems may require passing special flags to $cc -c to
7643 compile modules that will be used to create a shared library.
7644 To use no flags, say "none".
7645
7646 EOM
7647     case "$cccdlflags" in
7648     '') case "$gccversion" in
7649                 '') case "$osname" in
7650                         hpux)   dflt='+z' ;;
7651                         next)   dflt='none' ;;
7652                         irix*)  dflt='-KPIC' ;;
7653                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7654                         sunos)  dflt='-pic' ;;
7655                         *)      dflt='none' ;;
7656                     esac
7657                         ;;
7658                 *)  case "$osname" in
7659                         darwin) dflt='none' ;;
7660                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7661                         *)      dflt='-fpic' ;;
7662                     esac ;;
7663             esac ;;
7664         ' ') dflt='none' ;;
7665     *)  dflt="$cccdlflags" ;;
7666     esac
7667     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7668     . ./myread
7669     case "$ans" in
7670     none) cccdlflags=' ' ;;
7671     *) cccdlflags="$ans" ;;
7672     esac
7673
7674     cat << EOM
7675
7676 Some systems use ld to create libraries that can be dynamically loaded,
7677 while other systems (such as those using ELF) use $cc.
7678
7679 EOM
7680         case "$ld" in
7681         '')     $cat >try.c <<EOM
7682 /* Test for whether ELF binaries are produced */
7683 #include <fcntl.h>
7684 #$i_stdlib I_STDLIB
7685 #ifdef I_STDLIB
7686 #include <stdlib.h>
7687 #endif
7688 int main() {
7689         char b[4];
7690         int i = open("a.out",O_RDONLY);
7691         if(i == -1) 
7692                 exit(1); /* fail */
7693         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7694                 exit(0); /* succeed (yes, it's ELF) */
7695         else
7696                 exit(1); /* fail */
7697 }
7698 EOM
7699                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7700                         cat <<EOM
7701 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7702 EOM
7703                         dflt="$cc"
7704                 else
7705                         echo "I'll use ld to build dynamic libraries."
7706                         dflt='ld'
7707                 fi
7708                 rm -f try.c a.out
7709                 ;;
7710         *)      dflt="$ld"
7711                 ;;
7712         esac
7713
7714     rp="What command should be used to create dynamic libraries?"
7715     . ./myread
7716         ld="$ans"
7717
7718     cat << EOM
7719
7720 Some systems may require passing special flags to $ld to create a
7721 library that can be dynamically loaded.  If your ld flags include
7722 -L/other/path options to locate libraries outside your loader's normal
7723 search path, you may need to specify those -L options here as well.  To
7724 use no flags, say "none".
7725
7726 EOM
7727     case "$lddlflags" in
7728     '') case "$osname" in
7729                         beos) dflt='-nostart' ;;
7730                         hpux) dflt='-b';
7731                               case "$gccversion" in
7732                               '') dflt="$dflt +vnocompatwarnings" ;;
7733                               esac
7734                               ;;        
7735                         linux|irix*|gnu*)       dflt='-shared' ;;
7736                         next)  dflt='none' ;;
7737                         solaris) dflt='-G' ;;
7738                         sunos) dflt='-assert nodefinitions' ;;
7739                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7740                 *)     dflt='none' ;;
7741                         esac
7742                         ;;
7743     *) dflt="$lddlflags" ;;
7744     esac
7745
7746         : Try to guess additional flags to pick up local libraries.
7747         : Be careful not to append to a plain 'none'
7748         case "$dflt" in
7749         none) dflt='' ;;
7750         esac
7751         for thisflag in $ldflags; do
7752                 case "$thisflag" in
7753                 -L*|-R*|-Wl,-R*)
7754                         case " $dflt " in
7755                         *" $thisflag "*) ;;
7756                         *) dflt="$dflt $thisflag" ;;
7757                         esac
7758                         ;;
7759                 esac
7760         done
7761
7762         case "$dflt" in
7763         ''|' ') dflt='none' ;;
7764         esac
7765
7766     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7767     . ./myread
7768     case "$ans" in
7769     none) lddlflags=' ' ;;
7770     *) lddlflags="$ans" ;;
7771     esac
7772
7773         cat <<EOM
7774
7775 Some systems may require passing special flags to $cc to indicate that
7776 the resulting executable will use dynamic linking.  To use no flags,
7777 say "none".
7778
7779 EOM
7780     case "$ccdlflags" in
7781     '') case "$osname" in
7782             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7783             next|sunos) dflt='none' ;;
7784             *)          dflt='none' ;;
7785             esac ;;
7786     ' ')  dflt='none' ;;
7787     *)  dflt="$ccdlflags" ;;
7788     esac
7789     rp="Any special flags to pass to $cc to use dynamic linking?"
7790     . ./myread
7791     case "$ans" in
7792     none) ccdlflags=' ' ;;
7793     *) ccdlflags="$ans" ;;
7794     esac
7795     ;;
7796 *)  usedl="$undef"
7797         ld='ld'
7798     dlsrc='dl_none.xs'
7799     lddlflags=''
7800     ccdlflags=''
7801     ;;
7802 esac
7803
7804 also=''
7805 case "$usedl" in
7806 $undef)
7807         # No dynamic loading being used, so don't bother even to prompt.
7808         useshrplib='false'
7809         ;;
7810 *)      case "$useshrplib" in
7811         '')     case "$osname" in
7812                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7813                         dflt=y
7814                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7815                         ;;
7816                 next*)
7817                         case "$osvers" in
7818                         4*)     dflt=y
7819                                 also='Building a shared libperl is needed for MAB support.'
7820                                 ;;
7821                         *)      dflt=n
7822                                 ;;
7823                         esac
7824                         ;;
7825                 *)      dflt=n
7826                         ;;
7827                 esac
7828                 ;;
7829         $define|true|[Yy]*)
7830                 dflt=y
7831                 ;;
7832         *)      dflt=n
7833                 ;;
7834         esac
7835         $cat << EOM
7836
7837 The perl executable is normally obtained by linking perlmain.c with
7838 libperl${_a}, any static extensions (usually just DynaLoader), and
7839 any other libraries needed on this system (such as -lm, etc.).  Since
7840 your system supports dynamic loading, it is probably possible to build
7841 a shared libperl.$so.  If you will have more than one executable linked
7842 to libperl.$so, this will significantly reduce the size of each
7843 executable, but it may have a noticeable effect on performance.  The
7844 default is probably sensible for your system.
7845 $also
7846
7847 EOM
7848         rp="Build a shared libperl.$so (y/n)"
7849         . ./myread
7850         case "$ans" in
7851         true|$define|[Yy]*)
7852                 useshrplib='true'  ;;
7853         *)      useshrplib='false' ;;
7854         esac
7855         ;;
7856 esac
7857
7858 case "$useshrplib" in
7859 true)
7860         case "$libperl" in
7861         '')
7862                 # Figure out a good name for libperl.so.  Since it gets stored in
7863                 # a version-specific architecture-dependent library, the version
7864                 # number isn't really that important, except for making cc/ld happy.
7865                 #
7866                 # A name such as libperl.so.3.1
7867                 majmin="libperl.$so.$patchlevel.$subversion"
7868                 # A name such as libperl.so.301
7869                 majonly=`echo $patchlevel $subversion |
7870                         $awk '{printf "%d%02d", $1, $2}'`
7871                 majonly=libperl.$so.$majonly
7872                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7873                 # rely on figuring it out from the naming of libc.
7874                 case "${osname}${osvers}" in
7875                 next4*)
7876                         dflt=libperl.5.$so
7877                         # XXX How handle the --version stuff for MAB?
7878                         ;;
7879                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7880                         dflt=libperl.$so
7881                         ;;
7882                 cygwin*) # ld links against an importlib
7883                         dflt=libperl$lib_ext
7884                         ;;
7885                 *)      # Try to guess based on whether libc has major.minor.
7886                         case "$libc" in
7887                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7888                         *libc.$so.[0-9]*) dflt=$majonly ;;
7889                         *)      dflt=libperl.$so ;;
7890                         esac
7891                         ;;
7892                 esac
7893                 ;;
7894         *)      dflt=$libperl
7895                 ;;
7896         esac
7897         cat << EOM
7898
7899 I need to select a good name for the shared libperl.  If your system uses
7900 library names with major and minor numbers, then you might want something
7901 like $majmin.  Alternatively, if your system uses a single version
7902 number for shared libraries, then you might want to use $majonly.
7903 Or, your system might be quite happy with a simple libperl.$so.
7904
7905 Since the shared libperl will get installed into a version-specific
7906 architecture-dependent directory, the version number of the shared perl
7907 library probably isn't important, so the default should be o.k.
7908
7909 EOM
7910         rp='What name do you want to give to the shared libperl?'
7911         . ./myread
7912         libperl=$ans
7913         echo "Ok, I'll use $libperl"
7914         ;;
7915 *)
7916         libperl="libperl${_a}"
7917         ;;
7918 esac
7919
7920 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7921 case "$shrpdir" in
7922 '') ;;
7923 *)      $cat >&4 <<EOM
7924 WARNING:  Use of the shrpdir variable for the installation location of
7925 the shared $libperl is not supported.  It was never documented and
7926 will not work in this version.  Let me (perlbug@perl.org)
7927 know of any problems this may cause.
7928
7929 EOM
7930         case "$shrpdir" in
7931         "$archlibexp/CORE")
7932                 $cat >&4 <<EOM
7933 But your current setting of $shrpdir is
7934 the default anyway, so it's harmless.
7935 EOM
7936                 ;;
7937         *)
7938                 $cat >&4 <<EOM
7939 Further, your current attempted setting of $shrpdir
7940 conflicts with the value of $archlibexp/CORE
7941 that installperl will use.
7942 EOM
7943                 ;;
7944         esac
7945         ;;
7946 esac
7947
7948 # How will the perl executable find the installed shared $libperl?
7949 # Add $xxx to ccdlflags.
7950 # If we can't figure out a command-line option, use $shrpenv to
7951 # set env LD_RUN_PATH.  The main perl makefile uses this.
7952 shrpdir=$archlibexp/CORE
7953 xxx=''
7954 tmp_shrpenv=''
7955 if "$useshrplib"; then
7956     case "$osname" in 
7957         aix)
7958                 # We'll set it in Makefile.SH...
7959                 ;;
7960         solaris)
7961                 xxx="-R $shrpdir"
7962                 ;;
7963         freebsd|netbsd|openbsd|interix|dragonfly)
7964                 xxx="-Wl,-R$shrpdir"
7965                 ;;
7966         bsdos|linux|irix*|dec_osf|gnu*)
7967                 xxx="-Wl,-rpath,$shrpdir"
7968                 ;;
7969         next)
7970                 # next doesn't like the default...
7971                 ;;
7972         beos)
7973                 # beos doesn't like the default, either.
7974                 ;;
7975         hpux*)
7976                 # hpux doesn't like the default, either.
7977                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7978                 ;;
7979         *)
7980                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7981                 ;;
7982         esac
7983         case "$xxx" in
7984         '') ;;
7985         *)      
7986                 # Only add $xxx if it isn't already in ccdlflags.
7987                 case " $ccdlflags " in
7988                 *" $xxx "*)     ;;
7989                 *)      ccdlflags="$ccdlflags $xxx"
7990                         cat <<EOM >&4
7991
7992 Adding $xxx to the flags
7993 passed to $ld so that the perl executable will find the 
7994 installed shared $libperl.
7995
7996 EOM
7997                         ;;
7998                 esac
7999                 ;;
8000         esac
8001 fi
8002 # Fix ccdlflags in AIX for building external extensions.
8003 # (For building Perl itself bare -bE:perl.exp is needed,
8004 #  Makefile.SH takes care of this.)
8005 case "$osname" in
8006 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8007 esac
8008 # Respect a hint or command-line value.
8009 case "$shrpenv" in
8010 '') shrpenv="$tmp_shrpenv" ;;
8011 esac
8012 case "$ldlibpthname" in
8013 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8014 none)   ldlibpthname='' ;;
8015 esac
8016
8017 : determine where manual pages are on this system
8018 echo " "
8019 case "$sysman" in
8020 '') 
8021         syspath='/usr/share/man/man1 /usr/man/man1'
8022         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8023         syspath="$syspath /usr/man/u_man/man1"
8024         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8025         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8026         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8027         sysman=`./loc . /usr/man/man1 $syspath`
8028         ;;
8029 esac
8030 if $test -d "$sysman"; then
8031         echo "System manual is in $sysman." >&4
8032 else
8033         echo "Could not find manual pages in source form." >&4
8034 fi
8035
8036 : determine where manual pages go
8037 set man1dir man1dir none
8038 eval $prefixit
8039 $cat <<EOM
8040
8041 $spackage has manual pages available in source form.
8042 EOM
8043 case "$nroff" in
8044 nroff)
8045         echo "However, you don't have nroff, so they're probably useless to you."
8046         case "$man1dir" in
8047         '') man1dir="none";;
8048         esac;;
8049 esac
8050 echo "If you don't want the manual sources installed, answer 'none'."
8051 case "$man1dir" in
8052 ' ') dflt=none
8053         ;;
8054 '')
8055         lookpath="$prefixexp/share/man/man1"
8056         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8057         lookpath="$lookpath $prefixexp/man/p_man/man1"
8058         lookpath="$lookpath $prefixexp/man/u_man/man1"
8059         lookpath="$lookpath $prefixexp/man/man.1"
8060         case "$sysman" in
8061         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8062         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8063         esac
8064         set dflt
8065         eval $prefixup
8066         ;;
8067 *)  dflt="$man1dir"
8068         ;;
8069 esac
8070 echo " "
8071 fn=dn+~
8072 rp="Where do the main $spackage manual pages (source) go?"
8073 . ./getfile
8074 if $test "X$man1direxp" != "X$ansexp"; then
8075         installman1dir=''
8076 fi
8077 prefixvar=man1dir
8078 . ./setprefixvar
8079
8080 case "$man1dir" in
8081 '')     man1dir=' '
8082         installman1dir='';;
8083 esac
8084
8085 : What suffix to use on installed man pages
8086
8087 case "$man1dir" in
8088 ' ')
8089         man1ext='0'
8090         ;;
8091 *)
8092         rp="What suffix should be used for the main $spackage man pages?"
8093         case "$man1ext" in
8094         '')     case "$man1dir" in
8095                 *1)  dflt=1 ;;
8096                 *1p) dflt=1p ;;
8097                 *1pm) dflt=1pm ;;
8098                 *l) dflt=l;;
8099                 *n) dflt=n;;
8100                 *o) dflt=o;;
8101                 *p) dflt=p;;
8102                 *C) dflt=C;;
8103                 *L) dflt=L;;
8104                 *L1) dflt=L1;;
8105                 *) dflt=1;;
8106                 esac
8107                 ;;
8108         *)      dflt="$man1ext";;
8109         esac
8110         . ./myread
8111         man1ext="$ans"
8112         ;;
8113 esac
8114
8115 : see if we can have long filenames
8116 echo " "
8117 first=123456789abcdef
8118 $rm -f $first
8119 if (echo hi >$first) 2>/dev/null; then
8120         if $test -f 123456789abcde; then
8121                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8122                 val="$undef"
8123         else
8124                 echo 'You can have filenames longer than 14 characters.'>&4
8125                 val="$define"
8126         fi
8127 else
8128         $cat <<'EOM'
8129 You can't have filenames longer than 14 chars.
8130 You can't even think about them!
8131 EOM
8132         val="$undef"
8133 fi 
8134 set d_flexfnam
8135 eval $setvar
8136 $rm -rf 123456789abcde*
8137
8138 : determine where library module manual pages go
8139 set man3dir man3dir none
8140 eval $prefixit
8141 $cat <<EOM
8142
8143 $spackage has manual pages for many of the library modules.
8144 EOM
8145
8146 case "$nroff" in
8147 nroff)
8148         $cat <<'EOM'
8149 However, you don't have nroff, so they're probably useless to you.
8150 EOM
8151         case "$man3dir" in
8152         '') man3dir="none";;
8153         esac;;
8154 esac
8155
8156 case "$d_flexfnam" in
8157 undef)
8158         $cat <<'EOM'
8159 However, your system can't handle the long file names like File::Basename.3.
8160 EOM
8161         case "$man3dir" in
8162         '') man3dir="none";;
8163         esac;;
8164 esac
8165
8166 echo "If you don't want the manual sources installed, answer 'none'."
8167 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8168 case "$man3dir" in
8169 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8170         if $test -d "$privlib/man/man3"; then
8171                 cat <<EOM >&4
8172
8173 WARNING:  Previous versions of perl installed man3 pages into
8174 $privlib/man/man3.  This version will suggest a
8175 new default of $dflt.
8176 EOM
8177                 tdflt=$dflt
8178                 dflt='n'
8179                 rp='Do you wish to preserve the old behavior?(y/n)'
8180                 . ./myread
8181                 case "$ans" in
8182                 y*) dflt="$privlib/man/man3" ;;
8183                 *)  dflt=$tdflt ;;
8184                 esac
8185     fi
8186         ;;
8187 *)      dflt="$man3dir" ;;
8188 esac
8189 case "$dflt" in
8190 ' ') dflt=none ;;
8191 esac
8192 echo " "
8193 fn=dn+~
8194 rp="Where do the $package library man pages (source) go?"
8195 . ./getfile
8196 prefixvar=man3dir
8197 . ./setprefixvar
8198
8199 case "$man3dir" in
8200 '')     man3dir=' '
8201         installman3dir='';;
8202 esac
8203
8204 : What suffix to use on installed man pages
8205 case "$man3dir" in
8206 ' ')
8207         man3ext='0'
8208         ;;
8209 *)
8210         rp="What suffix should be used for the $package library man pages?"
8211         case "$man3ext" in
8212         '')     case "$man3dir" in
8213                 *3)  dflt=3 ;;
8214                 *3p) dflt=3p ;;
8215                 *3pm) dflt=3pm ;;
8216                 *l) dflt=l;;
8217                 *n) dflt=n;;
8218                 *o) dflt=o;;
8219                 *p) dflt=p;;
8220                 *C) dflt=C;;
8221                 *L) dflt=L;;
8222                 *L3) dflt=L3;;
8223                 *) dflt=3;;
8224                 esac
8225                 ;;
8226         *)      dflt="$man3ext";;
8227         esac
8228         . ./myread
8229         man3ext="$ans"
8230         ;;
8231 esac
8232
8233 : see if we have to deal with yellow pages, now NIS.
8234 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8235         if $test -f /usr/etc/nibindd; then
8236                 echo " "
8237                 echo "I'm fairly confident you're on a NeXT."
8238                 echo " "
8239                 rp='Do you get the hosts file via NetInfo?'
8240                 dflt=y
8241                 case "$hostcat" in
8242                 nidump*) ;;
8243                 '') ;;
8244                 *) dflt=n;;
8245                 esac
8246                 . ./myread
8247                 case "$ans" in
8248                 y*) hostcat='nidump hosts .';;
8249                 *)      case "$hostcat" in
8250                         nidump*) hostcat='';;
8251                         esac
8252                         ;;
8253                 esac
8254         fi
8255         case "$hostcat" in
8256         nidump*) ;;
8257         *)
8258                 case "$hostcat" in
8259                 *ypcat*) dflt=y;;
8260                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8261                                 dflt=y
8262                         else
8263                                 dflt=n
8264                         fi;;
8265                 *) dflt=n;;
8266                 esac
8267                 echo " "
8268                 rp='Are you getting the hosts file via yellow pages?'
8269                 . ./myread
8270                 case "$ans" in
8271                 y*) hostcat='ypcat hosts';;
8272                 *) hostcat='cat /etc/hosts';;
8273                 esac
8274                 ;;
8275         esac
8276 fi
8277 case "$hostcat" in
8278 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8279 esac
8280 case "$groupcat" in
8281 '') test -f /etc/group && groupcat='cat /etc/group';;
8282 esac
8283 case "$passcat" in
8284 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8285 esac
8286
8287 : now get the host name
8288 echo " "
8289 echo "Figuring out host name..." >&4
8290 case "$myhostname" in
8291 '') cont=true
8292         echo 'Maybe "hostname" will work...'
8293         if tans=`sh -c hostname 2>&1` ; then
8294                 myhostname=$tans
8295                 phostname=hostname
8296                 cont=''
8297         fi
8298         ;;
8299 *) cont='';;
8300 esac
8301 if $test "$cont"; then
8302         if ./xenix; then
8303                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8304                 if tans=`cat /etc/systemid 2>&1` ; then
8305                         myhostname=$tans
8306                         phostname='cat /etc/systemid'
8307                         echo "Whadyaknow.  Xenix always was a bit strange..."
8308                         cont=''
8309                 fi
8310         elif $test -r /etc/systemid; then
8311                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8312         fi
8313 fi
8314 if $test "$cont"; then
8315         echo 'No, maybe "uuname -l" will work...'
8316         if tans=`sh -c 'uuname -l' 2>&1` ; then
8317                 myhostname=$tans
8318                 phostname='uuname -l'
8319         else
8320                 echo 'Strange.  Maybe "uname -n" will work...'
8321                 if tans=`sh -c 'uname -n' 2>&1` ; then
8322                         myhostname=$tans
8323                         phostname='uname -n'
8324                 else
8325                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8326                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8327                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8328                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8329                         else
8330                                 case "$myhostname" in
8331                                 '') echo "Does this machine have an identity crisis or something?"
8332                                         phostname='';;
8333                                 *)
8334                                         echo "Well, you said $myhostname before..."
8335                                         phostname='echo $myhostname';;
8336                                 esac
8337                         fi
8338                 fi
8339         fi
8340 fi
8341 case "$myhostname" in
8342 '') myhostname=noname ;;
8343 esac
8344 : you do not want to know about this
8345 set $myhostname
8346 myhostname=$1
8347
8348 : verify guess
8349 if $test "$myhostname" ; then
8350         dflt=y
8351         rp='Your host name appears to be "'$myhostname'".'" Right?"
8352         . ./myread
8353         case "$ans" in
8354         y*) ;;
8355         *) myhostname='';;
8356         esac
8357 fi
8358
8359 : bad guess or no guess
8360 while $test "X$myhostname" = X ; do
8361         dflt=''
8362         rp="Please type the (one word) name of your host:"
8363         . ./myread
8364         myhostname="$ans"
8365 done
8366
8367 : translate upper to lower if necessary
8368 case "$myhostname" in
8369 *[A-Z]*)
8370         echo "(Normalizing case in your host name)"
8371         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8372         ;;
8373 esac
8374
8375 case "$myhostname" in
8376 *.*)
8377         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8378         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8379         echo "(Trimming domain name from host name--host name is now $myhostname)"
8380         ;;
8381 *) case "$mydomain" in
8382         '')
8383                 {
8384                         test "X$hostcat" = "Xypcat hosts" &&
8385                         ypmatch "$myhostname" hosts 2>/dev/null |\
8386                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8387                         $test -s hosts
8388                 } || {
8389                         test "X$hostcat" != "X" &&
8390                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8391                                         /[       ]$myhostname[  . ]/p" > hosts
8392                 }
8393                 tmp_re="[       . ]"
8394                 if $test -f hosts; then
8395                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8396                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8397                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8398                                 hosts | $sort | $uniq | \
8399                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8400                         case `$echo X$dflt` in
8401                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8402                                 dflt=.
8403                                 ;;
8404                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8405                                 ;;
8406                         esac
8407                 else
8408                         echo "(I cannot locate a hosts database anywhere)"
8409                         dflt=.
8410                 fi
8411                 case "$dflt" in
8412                 .)
8413                         tans=`./loc resolv.conf X /etc /usr/etc`
8414                         if $test -f "$tans"; then
8415                                 echo "(Attempting domain name extraction from $tans)"
8416                                 dflt=.`$sed -n -e 's/   / /g' \
8417                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8418                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8419                                 case "$dflt" in
8420                                 .) dflt=.`$sed -n -e 's/        / /g' \
8421                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8422                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8423                                         ;;
8424                                 esac
8425                         fi
8426                         ;;
8427                 esac
8428                 case "$dflt" in
8429                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8430                         dflt=.`sh -c domainname 2>/dev/null`
8431                         case "$dflt" in
8432                         '') dflt='.';;
8433                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8434                         esac
8435                         ;;
8436                 esac
8437                 case "$dflt$osname" in
8438                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8439                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8440                         ;;
8441                 esac
8442                 case "$dflt" in
8443                 .) echo "(Lost all hope -- silly guess then)"
8444                         dflt='.nonet'
8445                         ;;
8446                 esac
8447                 $rm -f hosts
8448                 ;;
8449         *) dflt="$mydomain";;
8450         esac;;
8451 esac
8452 echo " "
8453 rp="What is your domain name?"
8454 . ./myread
8455 tans="$ans"
8456 case "$ans" in
8457 '') ;;
8458 .*) ;;
8459 *) tans=".$tans";;
8460 esac
8461 mydomain="$tans"
8462
8463 : translate upper to lower if necessary
8464 case "$mydomain" in
8465 *[A-Z]*)
8466         echo "(Normalizing case in your domain name)"
8467         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8468         ;;
8469 esac
8470
8471 : a little sanity check here
8472 case "$phostname" in
8473 '') ;;
8474 *)
8475         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8476         $myhostname$mydomain|$myhostname) ;;
8477         *)
8478                 case "$phostname" in
8479                 sed*)
8480                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8481                         ;;
8482                 *)
8483                         echo "(That doesn't agree with your $phostname command, by the way.)"
8484                         ;;
8485                 esac
8486         ;;
8487         esac
8488         ;;
8489 esac
8490
8491 $cat <<EOM
8492
8493 I need to get your e-mail address in Internet format if possible, i.e.
8494 something like user@host.domain. Please answer accurately since I have
8495 no easy means to double check it. The default value provided below
8496 is most probably close to reality but may not be valid from outside
8497 your organization...
8498
8499 EOM
8500 cont=x
8501 while test "$cont"; do
8502         case "$cf_email" in
8503         '') dflt="$cf_by@$myhostname$mydomain";;
8504         *) dflt="$cf_email";;
8505         esac
8506         rp='What is your e-mail address?'
8507         . ./myread
8508         cf_email="$ans"
8509         case "$cf_email" in
8510         *@*.*) cont='' ;;
8511         *)
8512                 rp='Address does not look like an Internet one.  Use it anyway?'
8513                 case "$fastread" in
8514                 yes) dflt=y ;;
8515                 *) dflt=n ;;
8516                 esac
8517                 . ./myread
8518                 case "$ans" in
8519                 y*) cont='' ;;
8520                 *) echo " " ;;
8521                 esac
8522                 ;;
8523         esac
8524 done
8525
8526 $cat <<EOM
8527
8528 If you or somebody else will be maintaining perl at your site, please
8529 fill in the correct e-mail address here so that they may be contacted
8530 if necessary. Currently, the "perlbug" program included with perl
8531 will send mail to this address in addition to perlbug@perl.org. You may
8532 enter "none" for no administrator.
8533
8534 EOM
8535 case "$perladmin" in
8536 '') dflt="$cf_email";;
8537 *) dflt="$perladmin";;
8538 esac
8539 rp='Perl administrator e-mail address'
8540 . ./myread
8541 perladmin="$ans"
8542
8543 : determine whether to only install version-specific parts.
8544 echo " "
8545 $cat <<EOM
8546 Do you want to install only the version-specific parts of the perl
8547 distribution?  Usually you do *not* want to do this.
8548 EOM
8549 case "$versiononly" in
8550 "$define"|[Yy]*|true) dflt='y' ;;
8551 *) dflt='n';
8552 esac
8553 rp="Do you want to install only the version-specific parts of perl?"
8554 . ./myread
8555 case "$ans" in
8556 [yY]*)  val="$define";;
8557 *)      val="$undef" ;;
8558 esac
8559 set versiononly
8560 eval $setvar
8561
8562 case "$versiononly" in
8563 "$define") inc_version_list=''
8564            inc_version_list_init=0
8565            ;;
8566 esac
8567
8568 : figure out how to guarantee perl startup
8569 case "$startperl" in
8570 '')
8571         case "$sharpbang" in
8572         *!)
8573                 $cat <<EOH
8574
8575 I can use the #! construct to start perl on your system. This will
8576 make startup of perl scripts faster, but may cause problems if you
8577 want to share those scripts and perl is not in a standard place
8578 ($binexp/perl) on all your platforms. The alternative is to force
8579 a shell by starting the script with a single ':' character.
8580
8581 EOH
8582                 case "$versiononly" in
8583                 "$define")      dflt="$binexp/perl$version";;  
8584                 *)              dflt="$binexp/perl";;
8585                 esac
8586                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8587                 . ./myread
8588                 case "$ans" in
8589                 none)   startperl=": # use perl";;
8590                 *)      startperl="#!$ans"
8591                         if $test 30 -lt `echo "$ans" | wc -c`; then
8592                                 $cat >&4 <<EOM
8593
8594 WARNING:  Some systems limit the #! command to 32 characters.
8595 If you experience difficulty running Perl scripts with #!, try
8596 installing Perl in a directory with a shorter pathname.
8597
8598 EOM
8599                         fi ;;
8600                 esac
8601                 ;;
8602         *) startperl=": # use perl"
8603                 ;;
8604         esac
8605         ;;
8606 esac
8607 echo "I'll use $startperl to start perl scripts."
8608
8609 : figure best path for perl in scripts
8610 case "$perlpath" in
8611 '')
8612         case "$versiononly" in
8613         "$define")      perlpath="$binexp/perl$version";;
8614         *)              perlpath="$binexp/perl";;
8615         esac
8616         case "$startperl" in
8617         *!*) ;;
8618         *)
8619                 $cat <<EOH
8620
8621 I will use the "eval 'exec'" idiom to start Perl on your system.
8622 I can use the full path of your Perl binary for this purpose, but
8623 doing so may cause problems if you want to share those scripts and
8624 Perl is not always in a standard place ($binexp/perl).
8625
8626 EOH
8627                 dflt="$binexp/perl"
8628                 rp="What path shall I use in \"eval 'exec'\"?"
8629                 . ./myread
8630                 perlpath="$ans"
8631                 ;;
8632         esac
8633         ;;
8634 esac
8635 case "$startperl" in
8636 *!*)    ;;
8637 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8638 esac
8639
8640 : determine where public executable scripts go
8641 set scriptdir scriptdir
8642 eval $prefixit
8643 case "$scriptdir" in
8644 '')
8645         dflt="$bin"
8646         : guess some guesses
8647         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8648         $test -d /usr/share/bin     && dflt=/usr/share/bin
8649         $test -d /usr/local/script  && dflt=/usr/local/script
8650         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8651         $test -d $prefixexp/script  && dflt=$prefixexp/script
8652         set dflt
8653         eval $prefixup
8654         ;;
8655 *)  dflt="$scriptdir"
8656         ;;
8657 esac
8658 $cat <<EOM
8659
8660 Some installations have a separate directory just for executable scripts so
8661 that they can mount it across multiple architectures but keep the scripts in
8662 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8663 Or you might just lump your scripts in with all your other executables.
8664
8665 EOM
8666 fn=d~
8667 rp='Where do you keep publicly executable scripts?'
8668 . ./getfile
8669 if $test "X$ansexp" != "X$scriptdirexp"; then
8670         installscript=''
8671 fi
8672 installscriptdir=''
8673 prefixvar=scriptdir
8674 . ./setprefixvar
8675 : A little fix up for an irregularly named variable.
8676 installscript="$installscriptdir"
8677
8678 : determine where add-on public executables go
8679 case "$sitebin" in
8680 '')     dflt=$siteprefix/bin ;;
8681 *)      dflt=$sitebin ;;
8682 esac
8683 fn=d~
8684 rp='Pathname where the add-on public executables should be installed?'
8685 . ./getfile
8686 prefixvar=sitebin
8687 . ./setprefixvar
8688
8689 : determine where add-on html pages go
8690 : There is no standard location, so try to copy the previously-selected
8691 : directory structure for the core html pages.
8692 case "$sitehtml1dir" in
8693 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8694 *)     dflt=$sitehtml1dir ;;
8695 esac
8696 case "$dflt" in
8697 ''|' ') dflt=none ;;
8698 esac
8699 fn=dn+~
8700 rp='Pathname where the site-specific html pages should be installed?'
8701 . ./getfile
8702 prefixvar=sitehtml1dir
8703 . ./setprefixvar
8704
8705 : determine where add-on library html pages go
8706 : There is no standard location, so try to copy the previously-selected
8707 : directory structure for the core html pages.
8708 case "$sitehtml3dir" in
8709 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8710 *)     dflt=$sitehtml3dir ;;
8711 esac
8712 case "$dflt" in
8713 ''|' ') dflt=none ;;
8714 esac
8715 fn=dn+~
8716 rp='Pathname where the site-specific library html pages should be installed?'
8717 . ./getfile
8718 prefixvar=sitehtml3dir
8719 . ./setprefixvar
8720
8721 : determine where add-on manual pages go
8722 case "$siteman1dir" in
8723 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8724 *)      dflt=$siteman1dir ;;
8725 esac
8726 case "$dflt" in
8727 ''|' ') dflt=none ;;
8728 esac
8729 fn=dn+~
8730 rp='Pathname where the site-specific manual pages should be installed?'
8731 . ./getfile
8732 prefixvar=siteman1dir
8733 . ./setprefixvar
8734
8735 : determine where add-on library man pages go
8736 case "$siteman3dir" in
8737 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8738 *)      dflt=$siteman3dir ;;
8739 esac
8740 case "$dflt" in
8741 ''|' ') dflt=none ;;
8742 esac
8743 fn=dn+~
8744 rp='Pathname where the site-specific library manual pages should be installed?'
8745 . ./getfile
8746 prefixvar=siteman3dir
8747 . ./setprefixvar
8748
8749 : determine where add-on public executable scripts go
8750 case "$sitescript" in
8751 '')     dflt=$siteprefix/script
8752         $test -d $dflt || dflt=$sitebin ;;
8753 *)  dflt="$sitescript" ;;
8754 esac
8755 fn=d~+
8756 rp='Pathname where add-on public executable scripts should be installed?'
8757 . ./getfile
8758 prefixvar=sitescript
8759 . ./setprefixvar
8760
8761 case "$usefaststdio" in
8762 $define|true|[yY]*|'')
8763         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8764         case "$xversion" in
8765         [68])   dflt='y' ;;
8766         *)      dflt='n' ;;
8767         esac
8768         ;;
8769 *) dflt='n';;
8770 esac
8771 cat <<EOM
8772
8773 Perl can be built to use 'fast stdio', which means using the stdio
8774 library but also directly manipulating the stdio buffers to enable
8775 faster I/O.  Using stdio is better for backward compatibility (especially
8776 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8777 interface has been preferred instead of stdio.
8778
8779 If this doesn't make any sense to you, just accept the default '$dflt'.
8780 EOM
8781 rp='Use the "fast stdio" if available?'
8782 . ./myread
8783 case "$ans" in
8784 y|Y)    val="$define" ;;     
8785 *)      val="$undef" ;;
8786 esac
8787 set usefaststdio
8788 eval $setvar
8789
8790
8791 : define an is-a-typedef? function
8792 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8793 case "$inclist" in
8794 "") inclist="sys/types.h";;
8795 esac;
8796 eval "varval=\$$var";
8797 case "$varval" in
8798 "")
8799         $rm -f temp.c;
8800         for inc in $inclist; do
8801                 echo "#include <$inc>" >>temp.c;
8802         done;
8803         echo "#ifdef $type" >> temp.c;
8804         echo "printf(\"We have $type\");" >> temp.c;
8805         echo "#endif" >> temp.c;
8806         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8807         if $contains $type temp.E >/dev/null 2>&1; then
8808                 eval "$var=\$type";
8809         else
8810                 eval "$var=\$def";
8811         fi;
8812         $rm -f temp.?;;
8813 *) eval "$var=\$varval";;
8814 esac'
8815
8816 : define an is-a-typedef? function that prompts if the type is not available.
8817 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8818 case "$inclist" in
8819 "") inclist="sys/types.h";;
8820 esac;
8821 eval "varval=\$$var";
8822 case "$varval" in
8823 "")
8824         $rm -f temp.c;
8825         for inc in $inclist; do
8826                 echo "#include <$inc>" >>temp.c;
8827         done;
8828         echo "#ifdef $type" >> temp.c;
8829         echo "printf(\"We have $type\");" >> temp.c;
8830         echo "#endif" >> temp.c;
8831         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8832         echo " " ;
8833         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8834         if $contains $type temp.E >/dev/null 2>&1; then
8835                 echo "$type found." >&4;
8836                 eval "$var=\$type";
8837         else
8838                 echo "$type NOT found." >&4;
8839                 dflt="$def";
8840                 . ./myread ;
8841                 eval "$var=\$ans";
8842         fi;
8843         $rm -f temp.?;;
8844 *) eval "$var=\$varval";;
8845 esac'
8846
8847 : see what type lseek is declared as in the kernel
8848 rp="What is the type used for lseek's offset on this system?"
8849 set off_t lseektype long stdio.h sys/types.h
8850 eval $typedef_ask
8851
8852 echo " "
8853 echo "Checking to see how big your file offsets are..." >&4
8854 $cat >try.c <<EOCP
8855 #include <sys/types.h>
8856 #include <stdio.h>
8857 int main()
8858 {
8859     printf("%d\n", (int)sizeof($lseektype));
8860     return(0); 
8861 }
8862 EOCP
8863 set try
8864 if eval $compile_ok; then
8865         lseeksize=`$run ./try`
8866         echo "Your file offsets are $lseeksize bytes long."
8867 else
8868         dflt=$longsize
8869         echo " "
8870         echo "(I can't seem to compile the test program.  Guessing...)"
8871         rp="What is the size of your file offsets (in bytes)?"
8872         . ./myread
8873         lseeksize="$ans"
8874 fi
8875 $rm -f try.c try
8876
8877 : see what type file positions are declared as in the library
8878 rp="What is the type for file position used by fsetpos()?"
8879 set fpos_t fpostype long stdio.h sys/types.h
8880 eval $typedef_ask
8881
8882 echo " "
8883 case "$fpostype" in
8884 *_t) zzz="$fpostype"    ;;
8885 *)   zzz="fpos_t"       ;;
8886 esac
8887 echo "Checking the size of $zzz..." >&4 
8888 cat > try.c <<EOCP
8889 #include <sys/types.h>
8890 #include <stdio.h>
8891 #$i_stdlib I_STDLIB
8892 #ifdef I_STDLIB
8893 #include <stdlib.h>
8894 #endif
8895 int main() {
8896     printf("%d\n", (int)sizeof($fpostype));
8897     exit(0);
8898 }
8899 EOCP
8900 set try
8901 if eval $compile_ok; then
8902         yyy=`$run ./try`
8903         case "$yyy" in
8904         '')     fpossize=4
8905                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8906                 ;;
8907         *)      fpossize=$yyy
8908                 echo "Your $zzz is $fpossize bytes long."
8909                 ;;
8910         esac
8911 else
8912         dflt="$longsize"
8913         echo " " >&4
8914         echo "(I can't compile the test program.  Guessing...)" >&4
8915         rp="What is the size of your file positions (in bytes)?"
8916         . ./myread
8917         fpossize="$ans"
8918 fi
8919
8920 # Backward compatibility (uselfs is deprecated).
8921 case "$uselfs" in
8922 "$define"|true|[yY]*)
8923         cat <<EOM >&4
8924
8925 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8926 EOM
8927         uselargefiles="$define"
8928         ;;
8929 esac                          
8930
8931 case "$lseeksize:$fpossize" in
8932 8:8) cat <<EOM
8933
8934 You can have files larger than 2 gigabytes.
8935 EOM
8936    val="$define" ;;
8937 *)    case "$uselargefiles" in
8938    "$undef"|false|[nN]*) dflt='n' ;;
8939    *)   dflt='y' ;;
8940    esac
8941    cat <<EOM
8942
8943 Perl can be built to understand large files (files larger than 2 gigabytes)
8944 on some systems.  To do so, Configure can be run with -Duselargefiles.
8945
8946 If this doesn't make any sense to you, just accept the default '$dflt'.
8947 EOM
8948    rp='Try to understand large files, if available?'
8949    . ./myread
8950    case "$ans" in
8951    y|Y)         val="$define" ;;
8952    *)           val="$undef"  ;;
8953    esac
8954    ;;
8955 esac
8956 set uselargefiles
8957 eval $setvar
8958 : Look for a hint-file generated 'call-back-unit'.  If the
8959 : user has specified that a large files perl is to be built,
8960 : we may need to set or change some other defaults.
8961 if $test -f uselargefiles.cbu; then
8962         echo "Your platform has some specific hints regarding large file builds, using them..."
8963         . ./uselargefiles.cbu
8964 fi
8965 case "$uselargefiles" in
8966 "$define")
8967         if $test -f uselargefiles.cbu; then
8968                 echo " "
8969                 echo "Rechecking to see how big your file offsets are..." >&4
8970                 $cat >try.c <<EOCP
8971 #include <sys/types.h>
8972 #include <stdio.h>
8973 int main()
8974 {
8975     printf("%d\n", (int)sizeof($lseektype));
8976     return(0); 
8977 }
8978 EOCP
8979                 set try
8980                 if eval $compile_ok; then
8981                         lseeksize=`$run ./try`
8982                         $echo "Your file offsets are now $lseeksize bytes long."
8983                 else
8984                         dflt="$lseeksize"
8985                         echo " "
8986                         echo "(I can't seem to compile the test program.  Guessing...)"
8987                         rp="What is the size of your file offsets (in bytes)?"
8988                         . ./myread
8989                         lseeksize="$ans"
8990                 fi
8991                 case "$fpostype" in
8992                 *_t) zzz="$fpostype"    ;;
8993                 *)   zzz="fpos_t"       ;;
8994                 esac
8995                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8996                 $cat > try.c <<EOCP
8997 #include <sys/types.h>
8998 #include <stdio.h>
8999 #$i_stdlib I_STDLIB
9000 #ifdef I_STDLIB
9001 #include <stdlib.h>
9002 #endif
9003 int main() {
9004     printf("%d\n", (int)sizeof($fpostype));
9005     return(0);
9006 }
9007 EOCP
9008                 set try
9009                 if eval $compile_ok; then
9010                         yyy=`$run ./try`
9011                         dflt="$lseeksize"
9012                         case "$yyy" in
9013                         '')     echo " "
9014                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9015                                 ;;
9016                         *)      fpossize=$yyy
9017                                 echo " $fpossize bytes." >&4
9018                                 ;;
9019                         esac
9020                 else
9021                         dflt="$fpossize"
9022                         echo " "
9023                         echo "(I can't compile the test program.  Guessing...)" >&4
9024                         rp="What is the size of your file positions (in bytes)?"
9025                         . ./myread
9026                         fpossize="$ans"
9027                 fi
9028                 $rm -f try.c try
9029         fi
9030         ;;
9031 esac
9032
9033 case "$vendorprefix" in
9034 '')     d_vendorbin="$undef"
9035         vendorbin=''
9036         vendorbinexp=''
9037         ;;
9038 *)      d_vendorbin="$define"
9039         : determine where vendor-supplied executables go.
9040         case "$vendorbin" in
9041         '') dflt=$vendorprefix/bin ;;
9042         *)      dflt="$vendorbin" ;;
9043         esac
9044         fn=d~+
9045         rp='Pathname for the vendor-supplied executables directory?'
9046         . ./getfile
9047         vendorbin="$ans"
9048         vendorbinexp="$ansexp"
9049         ;;
9050 esac
9051 prefixvar=vendorbin
9052 . ./installprefix
9053
9054 case "$vendorprefix" in
9055 '')     vendorhtml1dir=''
9056         vendorhtml1direxp=''
9057         ;;
9058 *)      : determine where vendor-supplied html pages go.
9059         : There is no standard location, so try to copy the previously-selected
9060         : directory structure for the core html pages.
9061         : XXX Better default suggestions would be welcome.
9062         case "$vendorhtml1dir" in
9063         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9064         *)      dflt=$vendorhtml1dir ;;
9065         esac
9066         case "$dflt" in
9067         ''|' ') dflt=none ;;
9068         esac
9069         fn=dn+~
9070         rp='Pathname for the vendor-supplied html pages?'
9071         . ./getfile
9072         vendorhtml1dir="$ans"
9073         vendorhtml1direxp="$ansexp"
9074         ;;
9075 esac
9076 : Use ' ' for none so value is preserved next time through Configure
9077 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9078 prefixvar=vendorhtml1dir
9079 . ./installprefix
9080
9081 case "$vendorprefix" in
9082 '')     vendorhtml3dir=''
9083         vendorhtml3direxp=''
9084         ;;
9085 *)      : determine where vendor-supplied module html pages go.
9086         : There is no standard location, so try to copy the previously-selected
9087         : directory structure for the core html pages.
9088         : XXX Better default suggestions would be welcome.
9089         case "$vendorhtml3dir" in
9090         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9091         *)      dflt=$vendorhtml3dir ;;
9092         esac
9093         case "$dflt" in
9094         ''|' ') dflt=none ;;
9095         esac
9096         fn=dn+~
9097         rp='Pathname for the vendor-supplied html pages?'
9098         . ./getfile
9099         vendorhtml3dir="$ans"
9100         vendorhtml3direxp="$ansexp"
9101         ;;
9102 esac
9103 : Use ' ' for none so value is preserved next time through Configure
9104 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9105 prefixvar=vendorhtml3dir
9106 . ./installprefix
9107
9108 case "$vendorprefix" in
9109 '')     vendorman1dir=''
9110         vendorman1direxp=''
9111         ;;
9112 *)      : determine where vendor-supplied manual pages go.
9113         case "$vendorman1dir" in
9114         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9115         *)      dflt=$vendorman1dir ;;
9116         esac
9117         case "$dflt" in
9118         ''|' ') dflt=none ;;
9119         esac
9120         fn=nd~+
9121         rp='Pathname for the vendor-supplied manual section 1 pages?'
9122         . ./getfile
9123         vendorman1dir="$ans"
9124         vendorman1direxp="$ansexp"
9125         ;;
9126 esac
9127 : Use ' ' for none so value is preserved next time through Configure
9128 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9129 prefixvar=vendorman1dir
9130 . ./installprefix
9131
9132 case "$vendorprefix" in
9133 '')     vendorman3dir=''
9134         vendorman3direxp=''
9135         ;;
9136 *)      : determine where vendor-supplied module manual pages go.
9137         case "$vendorman3dir" in
9138         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9139         *)      dflt=$vendorman3dir ;;
9140         esac
9141         case "$dflt" in
9142         ''|' ') dflt=none ;;
9143         esac
9144         fn=nd~+
9145         rp='Pathname for the vendor-supplied manual section 3 pages?'
9146         . ./getfile
9147         vendorman3dir="$ans"
9148         vendorman3direxp="$ansexp"
9149         ;;
9150 esac
9151 : Use ' ' for none so value is preserved next time through Configure
9152 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9153 prefixvar=vendorman3dir
9154 . ./installprefix
9155
9156 case "$vendorprefix" in
9157 '')     d_vendorscript="$undef"
9158         vendorscript=''
9159         vendorscriptexp=''
9160         ;;
9161 *)      d_vendorscript="$define"
9162         : determine where vendor-supplied scripts go.
9163         case "$vendorscript" in
9164         '')     dflt=$vendorprefix/script
9165                 $test -d $dflt || dflt=$vendorbin ;;
9166         *)  dflt="$vendorscript" ;;
9167         esac
9168         $cat <<EOM
9169
9170 The installation process will create a directory for
9171 vendor-supplied scripts.
9172
9173 EOM
9174         fn=d~+
9175         rp='Pathname for the vendor-supplied scripts directory?'
9176         . ./getfile
9177         vendorscript="$ans"
9178         vendorscriptexp="$ansexp"
9179         ;;
9180 esac
9181 prefixvar=vendorscript
9182 . ./installprefix
9183
9184 : see if qgcvt exists
9185 set qgcvt d_qgcvt
9186 eval $inlibc
9187
9188 echo " "
9189
9190 if $test X"$d_longdbl" = X"$define"; then
9191
9192 echo "Checking how to print long doubles..." >&4
9193
9194 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9195         $cat >try.c <<'EOCP'
9196 #include <sys/types.h>
9197 #include <stdio.h>
9198 int main() {
9199   double d = 123.456;
9200   printf("%.3f\n", d);
9201 }
9202 EOCP
9203         set try
9204         if eval $compile; then
9205                 yyy=`$run ./try`
9206                 case "$yyy" in
9207                 123.456)
9208                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9209                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9210                         echo "We will use %f."
9211                         ;;
9212                 esac
9213         fi
9214 fi
9215
9216 if $test X"$sPRIfldbl" = X; then
9217         $cat >try.c <<'EOCP'
9218 #include <sys/types.h>
9219 #include <stdio.h>
9220 int main() {
9221   long double d = 123.456;
9222   printf("%.3Lf\n", d);
9223 }
9224 EOCP
9225         set try
9226         if eval $compile; then
9227                 yyy=`$run ./try`
9228                 case "$yyy" in
9229                 123.456)
9230                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9231                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9232                         echo "We will use %Lf."
9233                         ;;
9234                 esac
9235         fi
9236 fi
9237
9238 if $test X"$sPRIfldbl" = X; then
9239         $cat >try.c <<'EOCP'
9240 #include <sys/types.h>
9241 #include <stdio.h>
9242 int main() {
9243   long double d = 123.456;
9244   printf("%.3llf\n", d);
9245 }
9246 EOCP
9247         set try
9248         if eval $compile; then
9249                 yyy=`$run ./try`
9250                 case "$yyy" in
9251                 123.456)
9252                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9253                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9254                         echo "We will use %llf."
9255                         ;;
9256                 esac
9257         fi
9258 fi
9259
9260 if $test X"$sPRIfldbl" = X; then
9261         $cat >try.c <<'EOCP'
9262 #include <sys/types.h>
9263 #include <stdio.h>
9264 int main() {
9265   long double d = 123.456;
9266   printf("%.3lf\n", d);
9267 }
9268 EOCP
9269         set try
9270         if eval $compile; then
9271                 yyy=`$run ./try`
9272                 case "$yyy" in
9273                 123.456)
9274                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9275                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9276                         echo "We will use %lf."
9277                         ;;
9278                 esac
9279         fi
9280 fi
9281
9282 if $test X"$sPRIfldbl" = X; then
9283         echo "Cannot figure out how to print long doubles." >&4
9284 else
9285         sSCNfldbl=$sPRIfldbl    # expect consistency
9286 fi
9287
9288 $rm -f try try.*
9289
9290 fi # d_longdbl
9291
9292 case "$sPRIfldbl" in
9293 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9294         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9295         d_SCNfldbl="$undef";
9296         ;;
9297 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9298         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9299         d_SCNfldbl="$define";
9300         ;;
9301 esac
9302
9303 : Check how to convert floats to strings.
9304
9305 if test "X$d_Gconvert" = X; then
9306
9307 echo " "
9308 echo "Checking for an efficient way to convert floats to strings."
9309 echo " " > try.c
9310 case "$uselongdouble" in
9311 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9312 esac
9313 case "$d_longdbl" in
9314 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9315 esac
9316 case "$d_PRIgldbl" in
9317 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9318 esac
9319 $cat >>try.c <<EOP
9320 #ifdef TRY_gconvert
9321 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9322 char *myname = "gconvert";
9323 #endif
9324 #ifdef TRY_gcvt
9325 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9326 char *myname = "gcvt";
9327 #endif
9328 #ifdef TRY_qgcvt
9329 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9330 char *myname = "qgcvt";
9331 #define DOUBLETYPE long double
9332 #endif
9333 #ifdef TRY_sprintf
9334 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9335 #ifdef HAS_PRIgldbl
9336 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9337 #else
9338 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9339 #endif
9340 #else
9341 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9342 #endif
9343 char *myname = "sprintf";
9344 #endif
9345
9346 #ifndef DOUBLETYPE
9347 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9348 #define DOUBLETYPE long double
9349 #else
9350 #define DOUBLETYPE double
9351 #endif
9352 #endif
9353
9354 #include <stdio.h>
9355
9356 #define I_STDLIB $i_stdlib
9357 #ifdef I_STDLIB
9358 #include <stdlib.h>
9359 #endif
9360
9361 int
9362 checkit(expect, got)
9363 char *expect;
9364 char *got;
9365 {
9366     if (strcmp(expect, got)) {
9367                 printf("%s oddity:  Expected %s, got %s\n",
9368                         myname, expect, got);
9369                 exit(1);
9370         }
9371 }
9372
9373 int main()
9374
9375         char buf[64]; 
9376         buf[63] = '\0';
9377
9378         /* This must be 1st test on (which?) platform */
9379         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9380         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9381         checkit("0.1", buf);
9382
9383         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9384         checkit("0.01", buf);
9385
9386         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9387         checkit("0.001", buf);
9388
9389         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9390         checkit("0.0001", buf);
9391
9392         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9393         if (strlen(buf) > 5)
9394             checkit("9e-005", buf); /* for Microsoft ?? */
9395         else
9396             checkit("9e-05", buf);
9397
9398         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9399         checkit("1", buf);
9400
9401         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9402         checkit("1.1", buf);
9403
9404         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9405         checkit("1.01", buf);
9406
9407         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9408         checkit("1.001", buf);
9409
9410         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9411         checkit("1.0001", buf);
9412
9413         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9414         checkit("1.00001", buf);
9415
9416         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9417         checkit("1.000001", buf);
9418
9419         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9420         checkit("0", buf);
9421
9422         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9423         checkit("-1", buf);
9424
9425         /* Some Linux gcvt's give 1.e+5 here. */
9426         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9427         checkit("100000", buf);
9428         
9429         /* Some Linux gcvt's give -1.e+5 here. */
9430         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9431         checkit("-100000", buf);
9432
9433         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9434         checkit("123.456", buf);
9435
9436         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9437         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9438         /* 34 should be enough to scare even long double
9439          * places into using the e notation. */
9440         if (strlen(buf) > 5)
9441             checkit("1e+034", buf); /* for Microsoft */
9442         else
9443             checkit("1e+34", buf);
9444
9445         /* For Perl, if you add additional tests here, also add them to
9446          * t/base/num.t for benefit of platforms not using Configure or
9447          * overriding d_Gconvert */
9448
9449         exit(0);
9450 }
9451 EOP
9452 : first add preferred functions to our list
9453 xxx_list=""
9454 for xxx_convert in $gconvert_preference; do
9455     case $xxx_convert in
9456     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9457     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9458     esac 
9459 done
9460 : then add any others
9461 for xxx_convert in gconvert gcvt sprintf; do
9462     case "$xxx_list" in
9463     *$xxx_convert*) ;;
9464     *) xxx_list="$xxx_list $xxx_convert" ;;
9465     esac 
9466 done
9467
9468 case "$d_longdbl$uselongdouble" in
9469 "$define$define")
9470     : again, add prefered functions to our list first
9471     xxx_ld_list=""
9472     for xxx_convert in $gconvert_ld_preference; do
9473         case $xxx_convert in
9474         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9475         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9476         esac
9477     done
9478     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9479     for xxx_convert in qgcvt sprintf $xxx_list; do
9480         case "$xxx_ld_list" in
9481         $xxx_convert*|*" $xxx_convert"*) ;;
9482         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9483         esac
9484     done
9485     : if sprintf cannot do long doubles, move it to the end
9486     if test "$d_PRIgldbl" != "$define"; then
9487         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9488     fi
9489     : if no qgcvt, remove it
9490     if test "$d_qgcvt" != "$define"; then
9491         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9492     fi
9493     : use the ld_list
9494     xxx_list="$xxx_ld_list"
9495     ;;
9496 esac
9497
9498 for xxx_convert in $xxx_list; do
9499         echo "Trying $xxx_convert..."
9500         $rm -f try try$_o
9501         set try -DTRY_$xxx_convert
9502         if eval $compile; then
9503                 echo "$xxx_convert() found." >&4
9504                 if $run ./try; then
9505                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9506                         break;
9507                 else
9508                         echo "...But $xxx_convert didn't work as I expected."
9509                         xxx_convert=''
9510                 fi
9511         else
9512                 echo "$xxx_convert NOT found." >&4
9513         fi
9514 done
9515
9516 if test X$xxx_convert = X; then
9517     echo "*** WHOA THERE!!! ***" >&4
9518     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9519     xxx_convert=sprintf
9520 fi
9521
9522 case "$xxx_convert" in
9523 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9524 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9525 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9526 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9527    "$define$define$define")
9528       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9529    "$define$define$undef")
9530       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9531    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9532    esac
9533    ;;  
9534 esac
9535
9536 fi
9537
9538 : see if _fwalk exists
9539 set fwalk d__fwalk
9540 eval $inlibc
9541
9542 : Initialize h_fcntl
9543 h_fcntl=false
9544
9545 : Initialize h_sysfile
9546 h_sysfile=false
9547
9548 : access call always available on UNIX
9549 set access d_access
9550 eval $inlibc
9551
9552 : locate the flags for 'access()'
9553 case "$d_access" in
9554 "$define")
9555         echo " "
9556         $cat >access.c <<EOCP
9557 #include <sys/types.h>
9558 #ifdef I_FCNTL
9559 #include <fcntl.h>
9560 #endif
9561 #ifdef I_SYS_FILE
9562 #include <sys/file.h>
9563 #endif
9564 #ifdef I_UNISTD
9565 #include <unistd.h>
9566 #endif
9567 #$i_stdlib I_STDLIB
9568 #ifdef I_STDLIB
9569 #include <stdlib.h>
9570 #endif
9571 int main() {
9572         exit(R_OK);
9573 }
9574 EOCP
9575         : check sys/file.h first, no particular reason here
9576         if $test `./findhdr sys/file.h` && \
9577                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9578                 h_sysfile=true;
9579                 echo "<sys/file.h> defines the *_OK access constants." >&4
9580         elif $test `./findhdr fcntl.h` && \
9581                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9582                 h_fcntl=true;
9583                 echo "<fcntl.h> defines the *_OK access constants." >&4
9584         elif $test `./findhdr unistd.h` && \
9585                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9586                 echo "<unistd.h> defines the *_OK access constants." >&4
9587         else
9588                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9589         fi
9590         ;;
9591 esac
9592 $rm -f access*
9593
9594 : see if accessx exists
9595 set accessx d_accessx
9596 eval $inlibc
9597
9598 : see if aintl exists
9599 set aintl d_aintl
9600 eval $inlibc
9601
9602 : see if alarm exists
9603 set alarm d_alarm
9604 eval $inlibc
9605
9606 : see if POSIX threads are available
9607 set pthread.h i_pthread
9608 eval $inhdr
9609
9610 : define a fucntion to check prototypes
9611 $cat > protochk <<EOSH
9612 $startsh
9613 cc="$cc"
9614 optimize="$optimize"
9615 ccflags="$ccflags"
9616 prototype="$prototype"
9617 define="$define"
9618 rm=$rm
9619 usethreads=$usethreads
9620 i_pthread=$i_pthread
9621 pthread_h_first=$pthread_h_first
9622 EOSH
9623
9624 $cat >> protochk <<'EOSH'
9625
9626 $rm -f try.c
9627 foo="$1"
9628 shift
9629 while test $# -ge 2; do
9630         case "$1" in
9631                 $define) echo "#include <$2>" >> try.c ;;
9632                 literal) echo "$2" >> try.c ;;
9633         esac
9634     # Extra magic for the benefit of systems that need pthread.h
9635     # to be included early to correctly detect threadsafe functions.
9636     # Such functions must guarantee themselves, though, that the usethreads
9637     # and i_pthread have been defined, before calling protochk.
9638     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9639         echo "#include <pthread.h>" >> try.c
9640         pthread_h_done=yes
9641     fi
9642     shift 2
9643 done
9644 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9645 cat >> try.c <<'EOCP'
9646 #ifdef CAN_PROTOTYPE
9647 #define _(args) args
9648 #else
9649 #define _(args) ()
9650 #endif
9651 EOCP
9652 echo "$foo" >> try.c
9653 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9654 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9655 status=$?
9656 $rm -f try.[co]
9657 exit $status
9658 EOSH
9659 chmod +x protochk
9660 $eunicefix protochk
9661
9662 hasproto='varname=$1; func=$2; shift; shift;
9663 while $test $# -ge 2; do
9664         case "$1" in
9665         $define) echo "#include <$2>";;
9666         esac ;
9667     shift 2;
9668 done > try.c;
9669 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9670 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9671         echo "$func() prototype found.";
9672         val="$define";
9673 else
9674         echo "$func() prototype NOT found.";
9675         val="$undef";
9676 fi;
9677 set $varname;
9678 eval $setvar;
9679 $rm -f try.c tryout.c'
9680
9681 : see if sys/types.h has to be included
9682 set sys/types.h i_systypes
9683 eval $inhdr
9684
9685 : see if sys/select.h has to be included
9686 set sys/select.h i_sysselct
9687 eval $inhdr
9688
9689 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9690 while $test $# -ge 2; do
9691         case "$1" in
9692         $define) echo "#include <$2>";;
9693         esac ;
9694     shift 2;
9695 done > try.c;
9696 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9697 set try;
9698 if eval $compile; then
9699         val="$define";
9700 else
9701         val="$undef";
9702 fi;
9703 set $varname;
9704 eval $setvar;
9705 $rm -f try.c try.o'
9706
9707 : see if we should include time.h, sys/time.h, or both
9708 echo " "
9709 if test "X$timeincl" = X; then
9710         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9711         $echo $n "I'm now running the test program...$c"
9712         $cat >try.c <<EOCP
9713 #include <sys/types.h>
9714 #ifdef I_TIME
9715 #include <time.h>
9716 #endif
9717 #ifdef I_SYSTIME
9718 #ifdef SYSTIMEKERNEL
9719 #define KERNEL
9720 #endif
9721 #include <sys/time.h>
9722 #endif
9723 #ifdef I_SYSSELECT
9724 #include <sys/select.h>
9725 #endif
9726 #$i_stdlib I_STDLIB
9727 #ifdef I_STDLIB
9728 #include <stdlib.h>
9729 #endif
9730 int main()
9731 {
9732         struct tm foo;
9733 #ifdef S_TIMEVAL
9734         struct timeval bar;
9735 #endif
9736 #ifdef S_TIMEZONE
9737         struct timezone tzp;
9738 #endif
9739         if (foo.tm_sec == foo.tm_sec)
9740                 exit(0);
9741 #ifdef S_TIMEVAL
9742         if (bar.tv_sec == bar.tv_sec)
9743                 exit(0);
9744 #endif
9745         exit(1);
9746 }
9747 EOCP
9748         flags=''
9749         for s_timezone in '-DS_TIMEZONE' ''; do
9750         sysselect=''
9751         for s_timeval in '-DS_TIMEVAL' ''; do
9752         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9753         for i_time in '' '-DI_TIME'; do
9754         for i_systime in '-DI_SYSTIME' ''; do
9755                 case "$flags" in
9756                 '') $echo $n ".$c"
9757                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9758                         if eval $compile; then
9759                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9760                                 shift
9761                                 flags="$*"
9762                                 echo " "
9763                                 $echo $n "Succeeded with $flags$c"
9764                         fi
9765                         ;;
9766                 esac
9767         done
9768         done
9769         done
9770         done
9771         done
9772         timeincl=''
9773         echo " "
9774         case "$flags" in
9775         *SYSTIMEKERNEL*) i_systimek="$define"
9776                 timeincl=`./findhdr sys/time.h`
9777                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9778         *) i_systimek="$undef";;
9779         esac
9780         case "$flags" in
9781         *I_TIME*) i_time="$define"
9782                 timeincl=`./findhdr time.h`" $timeincl"
9783                 echo "We'll include <time.h>." >&4;;
9784         *) i_time="$undef";;
9785         esac
9786         case "$flags" in
9787         *I_SYSTIME*) i_systime="$define"
9788                 timeincl=`./findhdr sys/time.h`" $timeincl"
9789                 echo "We'll include <sys/time.h>." >&4;;
9790         *) i_systime="$undef";;
9791         esac
9792         $rm -f try.c try
9793 fi
9794 : see if struct tm knows about tm_zone
9795 case "$i_systime$i_time" in
9796 *$define*) 
9797         echo " "
9798         echo "Checking to see if your struct tm has tm_zone field..." >&4
9799         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9800         eval $hasfield
9801         ;;
9802 *)      val="$undef"
9803         set d_tm_tm_zone
9804         eval $setvar
9805         ;;
9806 esac
9807 case "$d_tm_tm_zone" in
9808 "$define")      echo "Yes, it does."   ;;
9809 *)              echo "No, it doesn't." ;;
9810 esac
9811 : see if struct tm knows about tm_gmtoff
9812 case "$i_systime$i_time" in
9813 *$define*) 
9814         echo " "
9815         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9816         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9817         eval $hasfield
9818         ;;
9819 *)      val="$undef"
9820         set d_tm_tm_gmtoff
9821         eval $setvar
9822         ;;
9823 esac
9824 case "$d_tm_tm_gmtoff" in
9825 "$define")      echo "Yes, it does."   ;;
9826 *)              echo "No, it doesn't." ;;
9827 esac
9828
9829 : see if asctime_r exists
9830 set asctime_r d_asctime_r
9831 eval $inlibc
9832 case "$d_asctime_r" in
9833 "$define")
9834         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9835         case "$d_asctime_r_proto:$usethreads" in
9836         ":define")      d_asctime_r_proto=define
9837                 set d_asctime_r_proto asctime_r $hdrs
9838                 eval $hasproto ;;
9839         *)      ;;
9840         esac
9841         case "$d_asctime_r_proto" in
9842         define)
9843         case "$asctime_r_proto" in
9844         ''|0) try='char* asctime_r(const struct tm*, char*);'
9845         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9846         esac
9847         case "$asctime_r_proto" in
9848         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9849         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9850         esac
9851         case "$asctime_r_proto" in
9852         ''|0) try='int asctime_r(const struct tm*, char*);'
9853         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9854         esac
9855         case "$asctime_r_proto" in
9856         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9857         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9858         esac
9859         case "$asctime_r_proto" in
9860         ''|0)   d_asctime_r=undef
9861                 asctime_r_proto=0
9862                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9863         * )     case "$asctime_r_proto" in
9864                 REENTRANT_PROTO*) ;;
9865                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9866                 esac
9867                 echo "Prototype: $try" ;;
9868         esac
9869         ;;
9870         *)      case "$usethreads" in
9871                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9872                 esac
9873                 d_asctime_r=undef
9874                 asctime_r_proto=0
9875                 ;;
9876         esac
9877         ;;
9878 *)      asctime_r_proto=0
9879         ;;
9880 esac
9881
9882 : see if atolf exists
9883 set atolf d_atolf
9884 eval $inlibc
9885
9886 : see if atoll exists
9887 set atoll d_atoll
9888 eval $inlibc
9889
9890 : Look for GCC-style attribute format
9891 case "$d_attribute_format" in
9892 '')
9893 echo " "
9894 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9895 $cat >attrib.c <<'EOCP'
9896 #include <stdio.h>
9897 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9898 EOCP
9899 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9900         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9901                 echo "Your C compiler doesn't support __attribute__((format))."
9902                 val="$undef"
9903         else
9904                 echo "Your C compiler supports __attribute__((format))."
9905                 val="$define"
9906         fi
9907 else
9908         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9909         val="$undef"
9910 fi
9911 ;;
9912 *) val="$d_attribute_format" ;;
9913 esac
9914 set d_attribute_format
9915 eval $setvar
9916 $rm -f attrib*
9917
9918 : Look for GCC-style attribute malloc
9919 case "$d_attribute_malloc" in
9920 '')
9921 echo " "
9922 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9923 $cat >attrib.c <<'EOCP'
9924 #include <stdio.h>
9925 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9926 EOCP
9927 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9928         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9929                 echo "Your C compiler doesn't support __attribute__((malloc))."
9930                 val="$undef"
9931         else
9932                 echo "Your C compiler supports __attribute__((malloc))."
9933                 val="$define"
9934         fi
9935 else
9936         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9937         val="$undef"
9938 fi
9939 ;;
9940 *) val="$d_attribute_malloc" ;;
9941 esac
9942 set d_attribute_malloc
9943 eval $setvar
9944 $rm -f attrib*
9945
9946 : Look for GCC-style attribute nonnull
9947 case "$d_attribute_nonnull" in
9948 '')
9949 echo " "
9950 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9951 $cat >attrib.c <<'EOCP'
9952 #include <stdio.h>
9953 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9954 EOCP
9955 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9956         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9957                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9958                 val="$undef"
9959         else
9960                 echo "Your C compiler supports __attribute__((nonnull))."
9961                 val="$define"
9962         fi
9963 else
9964         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9965         val="$undef"
9966 fi
9967 ;;
9968 *) val="$d_attribute_nonnull" ;;
9969 esac
9970 set d_attribute_nonnull
9971 eval $setvar
9972 $rm -f attrib*
9973
9974 : Look for GCC-style attribute noreturn
9975 case "$d_attribute_noreturn" in
9976 '')
9977 echo " "
9978 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9979 $cat >attrib.c <<'EOCP'
9980 #include <stdio.h>
9981 void fall_over_dead( void ) __attribute__((noreturn));
9982 EOCP
9983 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9984         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9985                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9986                 val="$undef"
9987         else
9988                 echo "Your C compiler supports __attribute__((noreturn))."
9989                 val="$define"
9990         fi
9991 else
9992         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9993         val="$undef"
9994 fi
9995 ;;
9996 *) val="$d_attribute_noreturn" ;;
9997 esac
9998 set d_attribute_noreturn
9999 eval $setvar
10000 $rm -f attrib*
10001
10002 : Look for GCC-style attribute pure
10003 case "$d_attribute_pure" in
10004 '')
10005 echo " "
10006 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10007 $cat >attrib.c <<'EOCP'
10008 #include <stdio.h>
10009 int square( int n ) __attribute__((pure));
10010 EOCP
10011 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10012         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10013                 echo "Your C compiler doesn't support __attribute__((pure))."
10014                 val="$undef"
10015         else
10016                 echo "Your C compiler supports __attribute__((pure))."
10017                 val="$define"
10018         fi
10019 else
10020         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10021         val="$undef"
10022 fi
10023 ;;
10024 *) val="$d_attribute_pure" ;;
10025 esac
10026 set d_attribute_pure
10027 eval $setvar
10028 $rm -f attrib*
10029
10030 : Look for GCC-style attribute unused
10031 case "$d_attribute_unused" in
10032 '')
10033 echo " "
10034 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10035 $cat >attrib.c <<'EOCP'
10036 #include <stdio.h>
10037 int do_something( int dummy __attribute__((unused)), int n );
10038 EOCP
10039 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10040         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10041                 echo "Your C compiler doesn't support __attribute__((unused))."
10042                 val="$undef"
10043         else
10044                 echo "Your C compiler supports __attribute__((unused))."
10045                 val="$define"
10046         fi
10047 else
10048         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10049         val="$undef"
10050 fi
10051 ;;
10052 *) val="$d_attribute_unused" ;;
10053 esac
10054 set d_attribute_unused
10055 eval $setvar
10056 $rm -f attrib*
10057
10058 : Look for GCC-style attribute warn_unused_result
10059 case "$d_attribute_warn_unused_result" in
10060 '')
10061 echo " "
10062 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10063 $cat >attrib.c <<'EOCP'
10064 #include <stdio.h>
10065 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10066 EOCP
10067 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10068         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10069                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10070                 val="$undef"
10071         else
10072                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10073                 val="$define"
10074         fi
10075 else
10076         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10077         val="$undef"
10078 fi
10079 ;;
10080 *) val="$d_attribute_warn_unused_result" ;;
10081 esac
10082 set d_attribute_warn_unused_result
10083 eval $setvar
10084 $rm -f attrib*
10085
10086 : see if bcmp exists
10087 set bcmp d_bcmp
10088 eval $inlibc
10089
10090 : see if bcopy exists
10091 set bcopy d_bcopy
10092 eval $inlibc
10093
10094 : see if this is a unistd.h system
10095 set unistd.h i_unistd
10096 eval $inhdr
10097
10098 : see if getpgrp exists
10099 set getpgrp d_getpgrp
10100 eval $inlibc
10101
10102 case "$d_getpgrp" in
10103 "$define")
10104         echo " "
10105         echo "Checking to see which flavor of getpgrp is in use..."
10106         $cat >try.c <<EOP
10107 #$i_unistd I_UNISTD
10108 #include <sys/types.h>
10109 #ifdef I_UNISTD
10110 #  include <unistd.h>
10111 #endif
10112 #$i_stdlib I_STDLIB
10113 #ifdef I_STDLIB
10114 #include <stdlib.h>
10115 #endif
10116 int main()
10117 {
10118         if (getuid() == 0) {
10119                 printf("(I see you are running Configure as super-user...)\n");
10120                 setuid(1);
10121         }
10122 #ifdef TRY_BSD_PGRP
10123         if (getpgrp(1) == 0)
10124                 exit(0);
10125 #else
10126         if (getpgrp() > 0)
10127                 exit(0);
10128 #endif
10129         exit(1);
10130 }
10131 EOP
10132         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10133                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10134                 val="$define"
10135         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10136                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10137                 val="$undef"
10138         else
10139                 echo "I can't seem to compile and run the test program."
10140                 if ./usg; then
10141                         xxx="a USG one, i.e. you use getpgrp()."
10142                 else
10143                         # SVR4 systems can appear rather BSD-ish.
10144                         case "$i_unistd" in
10145                         $undef)
10146                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10147                                 val="$define"
10148                                 ;;
10149                         $define)
10150                                 xxx="probably a USG one, i.e. you use getpgrp()."
10151                                 val="$undef"
10152                                 ;;
10153                         esac
10154                 fi
10155                 echo "Assuming your getpgrp is $xxx" >&4
10156         fi
10157         ;;
10158 *) val="$undef";;
10159 esac
10160 set d_bsdgetpgrp
10161 eval $setvar
10162 $rm -f try try.*
10163
10164 : see if setpgrp exists
10165 set setpgrp d_setpgrp
10166 eval $inlibc
10167
10168 case "$d_setpgrp" in
10169 "$define")
10170         echo " "
10171         echo "Checking to see which flavor of setpgrp is in use..."
10172         $cat >try.c <<EOP
10173 #$i_unistd I_UNISTD
10174 #include <sys/types.h>
10175 #ifdef I_UNISTD
10176 #  include <unistd.h>
10177 #endif
10178 #$i_stdlib I_STDLIB
10179 #ifdef I_STDLIB
10180 #include <stdlib.h>
10181 #endif
10182 int main()
10183 {
10184         if (getuid() == 0) {
10185                 printf("(I see you are running Configure as super-user...)\n");
10186                 setuid(1);
10187         }
10188 #ifdef TRY_BSD_PGRP
10189         if (-1 == setpgrp(1, 1))
10190                 exit(0);
10191 #else
10192         if (setpgrp() != -1)
10193                 exit(0);
10194 #endif
10195         exit(1);
10196 }
10197 EOP
10198         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10199                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10200                 val="$define"
10201         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10202                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10203                 val="$undef"
10204         else
10205                 echo "(I can't seem to compile and run the test program.)"
10206                 if ./usg; then
10207                         xxx="a USG one, i.e. you use setpgrp()."
10208                 else
10209                         # SVR4 systems can appear rather BSD-ish.
10210                         case "$i_unistd" in
10211                         $undef)
10212                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10213                                 val="$define"
10214                                 ;;
10215                         $define)
10216                                 xxx="probably a USG one, i.e. you use setpgrp()."
10217                                 val="$undef"
10218                                 ;;
10219                         esac
10220                 fi
10221                 echo "Assuming your setpgrp is $xxx" >&4
10222         fi
10223         ;;
10224 *) val="$undef";;
10225 esac
10226 set d_bsdsetpgrp
10227 eval $setvar
10228 $rm -f try try.*
10229 : Look for GCC-style __builtin_choose_expr
10230 case "$d_builtin_choose_expr" in
10231 '')
10232     echo " "
10233     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10234     $cat >try.c <<'EOCP'
10235 #include <assert.h>
10236 #include <stdlib.h>
10237 #include <stdio.h>
10238
10239 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10240
10241 int main(void) {
10242     assert( SYRINX(1) == 2112 );
10243     assert( SYRINX(1) != 5150 );
10244     assert( SYRINX(0) == 5150 );
10245     assert( SYRINX(0) != 2112 );
10246     puts( "All good!" );
10247     exit(0);
10248 }
10249
10250 EOCP
10251     set try
10252     if eval $compile; then
10253         echo "Your C compiler supports __builtin_choose_expr."
10254         val="$define"
10255     else
10256         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10257         val="$undef"
10258     fi
10259 ;;
10260 *) val="$d_builtin_choose_expr" ;;
10261 esac
10262
10263 set d_builtin_choose_expr
10264 eval $setvar
10265 $rm -f try.* try core core.try.*
10266
10267 : Look for GCC-style __builtin_expect
10268 case "$d_builtin_expect" in
10269 '')
10270     echo " "
10271     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10272     $cat >builtin.c <<'EOCP'
10273 int main(void) {
10274     int n = 50;
10275     if ( __builtin_expect(n, 0) ) n = 1;
10276 }
10277 EOCP
10278     set try
10279     if eval $compile; then
10280         echo "Your C compiler supports __builtin_choose_expr."
10281         val="$define"
10282     else
10283         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10284         val="$undef"
10285     fi
10286     ;;
10287 *) val="$d_builtin_expect" ;;
10288 esac
10289
10290 set d_builtin_expect
10291 eval $setvar
10292 $rm -f try.* try core core.try.*
10293
10294 : see if bzero exists
10295 set bzero d_bzero
10296 eval $inlibc
10297
10298 : see if signal is declared as pointer to function returning int or void
10299 echo " "
10300 xxx=`./findhdr signal.h`
10301 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10302 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10303         echo "You have int (*signal())() instead of void." >&4
10304         val="$undef"
10305 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10306         echo "You have void (*signal())()." >&4
10307         val="$define"
10308 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10309         echo "You have int (*signal())() instead of void." >&4
10310         val="$undef"
10311 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10312         echo "You have void (*signal())()." >&4
10313         val="$define"
10314 else
10315         case "$d_voidsig" in
10316         '')
10317         echo "I can't determine whether signal handler returns void or int..." >&4
10318                 dflt=void
10319                 rp="What type does your signal handler return?"
10320                 . ./myread
10321                 case "$ans" in
10322                 v*) val="$define";;
10323                 *) val="$undef";;
10324                 esac;;
10325         "$define")
10326                 echo "As you already told me, signal handler returns void." >&4
10327                 val="$define"
10328                 ;;
10329         *)      echo "As you already told me, signal handler returns int." >&4
10330                 val="$undef"
10331                 ;;
10332         esac
10333 fi
10334 set d_voidsig
10335 eval $setvar
10336 case "$d_voidsig" in
10337 "$define") signal_t="void";;
10338 *) signal_t="int";;
10339 esac
10340 $rm -f $$.tmp
10341
10342 : check for ability to cast large floats to 32-bit ints.
10343 echo " "
10344 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10345 if $test "$intsize" -ge 4; then
10346         xxx=int
10347 else
10348         xxx=long
10349 fi
10350 $cat >try.c <<EOCP
10351 #include <stdio.h>
10352 #$i_stdlib I_STDLIB
10353 #ifdef I_STDLIB
10354 #include <stdlib.h>
10355 #endif
10356 #include <sys/types.h>
10357 #include <signal.h>
10358 $signal_t blech(s) int s; { exit(3); }
10359 int main()
10360 {
10361         $xxx i32;
10362         double f, g;
10363         int result = 0;
10364         char str[16];
10365         signal(SIGFPE, blech);
10366
10367         /* Don't let compiler optimize the test away.  Store the number 
10368            in a writable string for gcc to pass to sscanf under HP/UX.
10369         */
10370         sprintf(str, "2147483647");
10371         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10372         g = 10 * f;
10373         i32  = ($xxx) g;
10374
10375         /* x86 processors will probably give 0x8000 0000, which is a
10376            sign change.  We don't want that.  We want to mimic SPARC
10377            behavior here, which is to preserve the sign and give
10378            back 0x7fff ffff.
10379         */
10380         if (i32 != ($xxx) f)
10381                 result |= 1;
10382         exit(result);
10383 }
10384 EOCP
10385 set try
10386 if eval $compile_ok; then
10387         $run ./try
10388         yyy=$?
10389 else
10390         echo "(I can't seem to compile the test program--assuming it can't)"
10391         yyy=1
10392 fi
10393 case "$yyy" in
10394 0)      val="$define"
10395         echo "Yup, it can."
10396         ;;
10397 *)      val="$undef"
10398         echo "Nope, it can't."
10399         ;;
10400 esac
10401 set d_casti32
10402 eval $setvar
10403 $rm -f try try.*
10404
10405 : check for ability to cast negative floats to unsigned
10406 echo " "
10407 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10408 $cat >try.c <<EOCP
10409 #include <stdio.h>
10410 #$i_stdlib I_STDLIB
10411 #ifdef I_STDLIB
10412 #include <stdlib.h>
10413 #endif
10414 #include <sys/types.h>
10415 #include <signal.h>
10416 $signal_t blech(s) int s; { exit(7); }
10417 $signal_t blech_in_list(s) int s; { exit(4); }
10418 unsigned long dummy_long(p) unsigned long p; { return p; }
10419 unsigned int dummy_int(p) unsigned int p; { return p; }
10420 unsigned short dummy_short(p) unsigned short p; { return p; }
10421 int main()
10422 {
10423         double f;
10424         unsigned long along;
10425         unsigned int aint;
10426         unsigned short ashort;
10427         int result = 0;
10428         char str[16];
10429         
10430         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10431            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10432            optimized the whole file away
10433         */
10434         /* Store the number in a writable string for gcc to pass to 
10435            sscanf under HP/UX.
10436         */
10437         sprintf(str, "-123");
10438         sscanf(str, "%lf", &f);  /* f = -123.; */
10439
10440         signal(SIGFPE, blech);
10441         along = (unsigned long)f;
10442         aint = (unsigned int)f;
10443         ashort = (unsigned short)f;
10444         if (along != (unsigned long)-123)
10445                 result |= 1;
10446         if (aint != (unsigned int)-123)
10447                 result |= 1;
10448         if (ashort != (unsigned short)-123)
10449                 result |= 1;
10450         sprintf(str, "1073741824.");
10451         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10452         f = f + f;
10453         along = 0;
10454         along = (unsigned long)f;
10455         if (along != 0x80000000)
10456                 result |= 2;
10457         f -= 1.;
10458         along = 0;
10459         along = (unsigned long)f;
10460         if (along != 0x7fffffff)
10461                 result |= 1;
10462         f += 2.;
10463         along = 0;
10464         along = (unsigned long)f;
10465         if (along != 0x80000001)
10466                 result |= 2;
10467         if (result)
10468                 exit(result);
10469         signal(SIGFPE, blech_in_list);
10470         sprintf(str, "123.");
10471         sscanf(str, "%lf", &f);  /* f = 123.; */
10472         along = dummy_long((unsigned long)f);
10473         aint = dummy_int((unsigned int)f);
10474         ashort = dummy_short((unsigned short)f);
10475         if (along != (unsigned long)123)
10476                 result |= 4;
10477         if (aint != (unsigned int)123)
10478                 result |= 4;
10479         if (ashort != (unsigned short)123)
10480                 result |= 4;
10481         exit(result);
10482
10483 }
10484 EOCP
10485 set try
10486 if eval $compile_ok; then
10487         $run ./try
10488         castflags=$?
10489 else
10490         echo "(I can't seem to compile the test program--assuming it can't)"
10491         castflags=7
10492 fi
10493 case "$castflags" in
10494 0)      val="$define"
10495         echo "Yup, it can."
10496         ;;
10497 *)      val="$undef"
10498         echo "Nope, it can't."
10499         ;;
10500 esac
10501 set d_castneg
10502 eval $setvar
10503 $rm -f try.*
10504
10505 : see if vprintf exists
10506 echo " "
10507 if set vprintf val -f d_vprintf; eval $csym; $val; then
10508         echo 'vprintf() found.' >&4
10509         val="$define"
10510         $cat >try.c <<EOF
10511 #include <varargs.h>
10512 #$i_stdlib I_STDLIB
10513 #ifdef I_STDLIB
10514 #include <stdlib.h>
10515 #endif
10516
10517 int main() { xxx("foo"); }
10518
10519 xxx(va_alist)
10520 va_dcl
10521 {
10522         va_list args;
10523         char buf[10];
10524
10525         va_start(args);
10526         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10527 }
10528 EOF
10529         set try
10530         if eval $compile && $run ./try; then
10531                 echo "Your vsprintf() returns (int)." >&4
10532                 val2="$undef"
10533         else
10534                 echo "Your vsprintf() returns (char*)." >&4
10535                 val2="$define"
10536         fi
10537 else
10538         echo 'vprintf() NOT found.' >&4
10539                 val="$undef"
10540                 val2="$undef"
10541 fi
10542 $rm -f try try.*
10543 set d_vprintf
10544 eval $setvar
10545 val=$val2
10546 set d_charvspr
10547 eval $setvar
10548
10549 : see if chown exists
10550 set chown d_chown
10551 eval $inlibc
10552
10553 : see if chroot exists
10554 set chroot d_chroot
10555 eval $inlibc
10556
10557 : see if chsize exists
10558 set chsize d_chsize
10559 eval $inlibc
10560
10561 : see if class exists
10562 set class d_class
10563 eval $inlibc
10564
10565 : see if clearenv exists
10566 set clearenv d_clearenv
10567 eval $inlibc
10568
10569 hasstruct='varname=$1; struct=$2; shift; shift;
10570 while $test $# -ge 2; do
10571         case "$1" in
10572         $define) echo "#include <$2>";;
10573         esac ;
10574     shift 2;
10575 done > try.c;
10576 echo "int main () { struct $struct foo; }" >> try.c;
10577 set try;
10578 if eval $compile; then
10579         val="$define";
10580 else
10581         val="$undef";
10582 fi;
10583 set $varname;
10584 eval $setvar;
10585 $rm -f try.c try.o'
10586
10587 socketlib=''
10588 sockethdr=''
10589 : see whether socket exists
10590 echo " "
10591 $echo $n "Hmm... $c" >&4
10592 if set socket val -f d_socket; eval $csym; $val; then
10593         echo "Looks like you have Berkeley networking support." >&4
10594         d_socket="$define"
10595         if set setsockopt val -f; eval $csym; $val; then
10596                 d_oldsock="$undef"
10597         else
10598                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10599                 d_oldsock="$define"
10600         fi
10601 else
10602         if $contains socklib libc.list >/dev/null 2>&1; then
10603                 echo "Looks like you have Berkeley networking support." >&4
10604                 d_socket="$define"
10605                 : we will have to assume that it supports the 4.2 BSD interface
10606                 d_oldsock="$undef"
10607         else
10608                 echo "You don't have Berkeley networking in libc$_a..." >&4
10609                 if test "X$d_socket" = "X$define"; then
10610                    echo "...but you seem to believe that you have sockets." >&4
10611                 else
10612                         for net in net socket
10613                         do
10614                                 if test -f /usr/lib/lib$net$_a; then
10615                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10616                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10617                                         if $contains socket libc.list >/dev/null 2>&1; then
10618                                                 d_socket="$define"
10619                                                 socketlib="-l$net"
10620                                                 case "$net" in
10621                                                 net)
10622                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10623                                                         sockethdr="-I/usr/netinclude"
10624                                                         ;;
10625                                                 esac
10626                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10627                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10628                                                         d_oldsock="$undef"
10629                                                 else
10630                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10631                                                         d_oldsock="$define"
10632                                                 fi
10633                                                 break
10634                                         fi
10635                                 fi
10636                         done
10637                         if test "X$d_socket" != "X$define"; then
10638                            echo "or anywhere else I see." >&4
10639                            d_socket="$undef"
10640                            d_oldsock="$undef"
10641                         fi
10642                 fi
10643         fi
10644 fi
10645
10646 : see if socketpair exists
10647 set socketpair d_sockpair
10648 eval $inlibc
10649
10650
10651 echo " "
10652 echo "Checking the availability of certain socket constants..." >&4
10653 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10654         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10655         $cat >try.c <<EOF
10656 #include <sys/types.h>
10657 #include <sys/socket.h>
10658 int main() {
10659     int i = $ENUM;
10660 }
10661 EOF
10662         val="$undef"
10663         set try; if eval $compile; then
10664                 val="$define"
10665         fi
10666         set d_${enum}; eval $setvar
10667         $rm -f try.c try
10668 done
10669
10670 : see if this is a sys/uio.h system
10671 set sys/uio.h i_sysuio
10672 eval $inhdr
10673
10674
10675 echo " "
10676 echo "Checking to see if your system supports struct cmsghdr..." >&4
10677 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10678 eval $hasstruct
10679 case "$d_cmsghdr_s" in
10680 "$define")      echo "Yes, it does."   ;;
10681 *)              echo "No, it doesn't." ;;
10682 esac
10683
10684
10685 : check for const keyword
10686 echo " "
10687 echo 'Checking to see if your C compiler knows about "const"...' >&4
10688 $cat >const.c <<'EOCP'
10689 typedef struct spug { int drokk; } spug;
10690 int main()
10691 {
10692         const char *foo;
10693         const spug y;
10694 }
10695 EOCP
10696 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10697         val="$define"
10698         echo "Yup, it does."
10699 else
10700         val="$undef"
10701         echo "Nope, it doesn't."
10702 fi
10703 set d_const
10704 eval $setvar
10705
10706 : see if copysignl exists
10707 set copysignl d_copysignl
10708 eval $inlibc
10709
10710 : see if crypt exists
10711 echo " "
10712 set crypt d_crypt
10713 eval $inlibc
10714 case "$d_crypt" in
10715 $define) cryptlib='' ;;
10716 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10717                 echo 'crypt() found.' >&4
10718                 val="$define"
10719                 cryptlib=''
10720         else
10721                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10722                 if $test -z "$cryptlib"; then
10723                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10724                 else
10725                         cryptlib=-lcrypt
10726                 fi
10727                 if $test -z "$cryptlib"; then
10728                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10729                 else
10730                         cryptlib=-lcrypt
10731                 fi
10732                 if $test -z "$cryptlib"; then
10733                         cryptlib=`./loc libcrypt$_a "" $libpth`
10734                 else
10735                         cryptlib=-lcrypt
10736                 fi
10737                 if $test -z "$cryptlib"; then
10738                         echo 'crypt() NOT found.' >&4
10739                         val="$undef"
10740                 else
10741                         val="$define"
10742                 fi
10743         fi
10744         set d_crypt
10745         eval $setvar
10746         ;;
10747 esac
10748
10749 : see if this is a crypt.h system
10750 set crypt.h i_crypt
10751 eval $inhdr
10752
10753 : see if crypt_r exists
10754 set crypt_r d_crypt_r
10755 eval $inlibc
10756 case "$d_crypt_r" in
10757 "$define")
10758         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10759         case "$d_crypt_r_proto:$usethreads" in
10760         ":define")      d_crypt_r_proto=define
10761                 set d_crypt_r_proto crypt_r $hdrs
10762                 eval $hasproto ;;
10763         *)      ;;
10764         esac
10765         case "$d_crypt_r_proto" in
10766         define)
10767         case "$crypt_r_proto" in
10768         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10769         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10770         esac
10771         case "$crypt_r_proto" in
10772         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10773         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10774         esac
10775         case "$crypt_r_proto" in
10776         ''|0)   d_crypt_r=undef
10777                 crypt_r_proto=0
10778                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10779         * )     case "$crypt_r_proto" in
10780                 REENTRANT_PROTO*) ;;
10781                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10782                 esac
10783                 echo "Prototype: $try" ;;
10784         esac
10785         ;;
10786         *)      case "$usethreads" in
10787                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10788                 esac
10789                 d_crypt_r=undef
10790                 crypt_r_proto=0
10791                 ;;
10792         esac
10793         ;;
10794 *)      crypt_r_proto=0
10795         ;;
10796 esac
10797
10798 : get csh whereabouts
10799 case "$csh" in
10800 'csh') val="$undef" ;;
10801 *) val="$define" ;;
10802 esac
10803 set d_csh
10804 eval $setvar
10805 : Respect a hint or command line value for full_csh.
10806 case "$full_csh" in
10807 '') full_csh=$csh ;;
10808 esac
10809
10810 : see if ctermid_r exists
10811 set ctermid_r d_ctermid_r
10812 eval $inlibc
10813 case "$d_ctermid_r" in
10814 "$define")
10815         hdrs="$i_systypes sys/types.h define stdio.h "
10816         case "$d_ctermid_r_proto:$usethreads" in
10817         ":define")      d_ctermid_r_proto=define
10818                 set d_ctermid_r_proto ctermid_r $hdrs
10819                 eval $hasproto ;;
10820         *)      ;;
10821         esac
10822         case "$d_ctermid_r_proto" in
10823         define)
10824         case "$ctermid_r_proto" in
10825         ''|0) try='char* ctermid_r(char*);'
10826         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10827         esac
10828         case "$ctermid_r_proto" in
10829         ''|0)   d_ctermid_r=undef
10830                 ctermid_r_proto=0
10831                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10832         * )     case "$ctermid_r_proto" in
10833                 REENTRANT_PROTO*) ;;
10834                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10835                 esac
10836                 echo "Prototype: $try" ;;
10837         esac
10838         ;;
10839         *)      case "$usethreads" in
10840                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10841                 esac
10842                 d_ctermid_r=undef
10843                 ctermid_r_proto=0
10844                 ;;
10845         esac
10846         ;;
10847 *)      ctermid_r_proto=0
10848         ;;
10849 esac
10850
10851 : see if ctime_r exists
10852 set ctime_r d_ctime_r
10853 eval $inlibc
10854 case "$d_ctime_r" in
10855 "$define")
10856         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10857         case "$d_ctime_r_proto:$usethreads" in
10858         ":define")      d_ctime_r_proto=define
10859                 set d_ctime_r_proto ctime_r $hdrs
10860                 eval $hasproto ;;
10861         *)      ;;
10862         esac
10863         case "$d_ctime_r_proto" in
10864         define)
10865         case "$ctime_r_proto" in
10866         ''|0) try='char* ctime_r(const time_t*, char*);'
10867         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10868         esac
10869         case "$ctime_r_proto" in
10870         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10871         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10872         esac
10873         case "$ctime_r_proto" in
10874         ''|0) try='int ctime_r(const time_t*, char*);'
10875         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10876         esac
10877         case "$ctime_r_proto" in
10878         ''|0) try='int ctime_r(const time_t*, char*, int);'
10879         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10880         esac
10881         case "$ctime_r_proto" in
10882         ''|0)   d_ctime_r=undef
10883                 ctime_r_proto=0
10884                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10885         * )     case "$ctime_r_proto" in
10886                 REENTRANT_PROTO*) ;;
10887                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10888                 esac
10889                 echo "Prototype: $try" ;;
10890         esac
10891         ;;
10892         *)      case "$usethreads" in
10893                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10894                 esac
10895                 d_ctime_r=undef
10896                 ctime_r_proto=0
10897                 ;;
10898         esac
10899         ;;
10900 *)      ctime_r_proto=0
10901         ;;
10902 esac
10903
10904 : see if cuserid exists
10905 set cuserid d_cuserid
10906 eval $inlibc
10907
10908 : see if this is a limits.h system
10909 set limits.h i_limits
10910 eval $inhdr
10911
10912 : see if this is a float.h system
10913 set float.h i_float
10914 eval $inhdr
10915
10916 : See if number of significant digits in a double precision number is known
10917 echo " "
10918 $cat >dbl_dig.c <<EOM
10919 #$i_limits I_LIMITS
10920 #$i_float I_FLOAT
10921 #ifdef I_LIMITS
10922 #include <limits.h>
10923 #endif
10924 #ifdef I_FLOAT
10925 #include <float.h>
10926 #endif
10927 #ifdef DBL_DIG
10928 printf("Contains DBL_DIG");
10929 #endif
10930 EOM
10931 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10932 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10933         echo "DBL_DIG found." >&4
10934         val="$define"
10935 else
10936         echo "DBL_DIG NOT found." >&4
10937         val="$undef"
10938 fi
10939 $rm -f dbl_dig.?
10940 set d_dbl_dig
10941 eval $setvar
10942
10943 : see if dbm.h is available
10944 : see if dbmclose exists
10945 set dbmclose d_dbmclose
10946 eval $inlibc
10947
10948 case "$d_dbmclose" in
10949 $define)
10950         set dbm.h i_dbm
10951         eval $inhdr
10952         case "$i_dbm" in
10953         $define)
10954                 val="$undef"
10955                 set i_rpcsvcdbm
10956                 eval $setvar
10957                 ;;
10958         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10959                 eval $inhdr
10960                 ;;
10961         esac
10962         ;;
10963 *)      echo "We won't be including <dbm.h>"
10964         val="$undef"
10965         set i_dbm
10966         eval $setvar
10967         val="$undef"
10968         set i_rpcsvcdbm
10969         eval $setvar
10970         ;;
10971 esac
10972
10973 : see if prototype for dbminit is available
10974 echo " "
10975 set d_dbminitproto dbminit $i_dbm dbm.h
10976 eval $hasproto
10977
10978 : see if difftime exists
10979 set difftime d_difftime
10980 eval $inlibc
10981
10982 : see if this is a dirent system
10983 echo " "
10984 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10985         val="$define"
10986         echo "<dirent.h> found." >&4
10987 else
10988         val="$undef"
10989         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10990                 echo "<sys/dir.h> found." >&4
10991                 echo " "
10992         else
10993                 xinc=`./findhdr sys/ndir.h`
10994         fi
10995         echo "<dirent.h> NOT found." >&4
10996 fi
10997 set i_dirent
10998 eval $setvar
10999
11000 : Look for type of directory structure.
11001 echo " "
11002 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11003
11004 case "$direntrytype" in
11005 ''|' ')
11006         case "$i_dirent" in
11007         $define) guess1='struct dirent' ;;
11008         *) guess1='struct direct'  ;;
11009         esac
11010         ;;
11011 *)      guess1="$direntrytype"
11012         ;;
11013 esac
11014
11015 case "$guess1" in
11016 'struct dirent') guess2='struct direct' ;;
11017 *) guess2='struct dirent' ;;
11018 esac
11019                 
11020 if $contains "$guess1" try.c >/dev/null 2>&1; then
11021         direntrytype="$guess1"
11022         echo "Your directory entries are $direntrytype." >&4
11023 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11024         direntrytype="$guess2"
11025         echo "Your directory entries seem to be $direntrytype." >&4
11026 else
11027         echo "I don't recognize your system's directory entries." >&4
11028         rp="What type is used for directory entries on this system?"
11029         dflt="$guess1"
11030         . ./myread
11031         direntrytype="$ans"
11032 fi
11033 $rm -f try.c
11034
11035
11036 : see if the directory entry stores field length
11037 echo " "
11038 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11039 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11040         echo "Good, your directory entry keeps length information in d_namlen." >&4
11041         val="$define"
11042 else
11043         echo "Your directory entry does not know about the d_namlen field." >&4
11044         val="$undef"
11045 fi
11046 set d_dirnamlen
11047 eval $setvar
11048 $rm -f try.c
11049
11050 : see if this is an sysdir system
11051 set sys/dir.h i_sysdir
11052 eval $inhdr
11053
11054 : see if this is an sysndir system
11055 set sys/ndir.h i_sysndir
11056 eval $inhdr
11057
11058 : Look for dirfd
11059 echo " "
11060 $cat >dirfd.c <<EOM
11061 #include <stdio.h>
11062 #$i_stdlib I_STDLIB
11063 #ifdef I_STDLIB
11064 #include <stdlib.h>
11065 #endif
11066 #$i_dirent I_DIRENT             /**/
11067 #$i_sysdir I_SYS_DIR            /**/
11068 #$i_sysndir I_SYS_NDIR          /**/
11069 #$i_systypes I_SYS_TYPES        /**/
11070 #if defined(I_SYS_TYPES)
11071 #include <sys/types.h>
11072 #endif
11073 #if defined(I_DIRENT)
11074 #include <dirent.h>
11075 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11076 #include <sys/dir.h>
11077 #endif
11078 #else
11079 #ifdef I_SYS_NDIR
11080 #include <sys/ndir.h>
11081 #else
11082 #ifdef I_SYS_DIR
11083 #ifdef hp9000s500
11084 #include <ndir.h>       /* may be wrong in the future */
11085 #else
11086 #include <sys/dir.h>
11087 #endif
11088 #endif
11089 #endif
11090 #endif 
11091 int main() {
11092         DIR *dirp = opendir(".");
11093         if (dirfd(dirp) >= 0)
11094                 exit(0);
11095         else
11096                 exit(1);
11097 }
11098 EOM
11099 val=$undef
11100 set dirfd
11101 if eval $compile; then
11102         val="$define"
11103 fi
11104 case "$val" in
11105 $define)        echo "dirfd() found." >&4       ;;
11106 *)              echo "dirfd() NOT found." >&4   ;;
11107 esac
11108 set d_dirfd
11109 eval $setvar
11110 $rm -f dirfd*
11111
11112 : see if dlerror exists
11113 xxx_runnm="$runnm"
11114 runnm=false
11115 set dlerror d_dlerror
11116 eval $inlibc
11117 runnm="$xxx_runnm"
11118
11119 : see if dlfcn is available
11120 set dlfcn.h i_dlfcn
11121 eval $inhdr
11122
11123 case "$usedl" in
11124 $define|y|true)
11125         $cat << EOM
11126
11127 On a few systems, the dynamically loaded modules that perl generates and uses
11128 will need a different extension than shared libs. The default will probably
11129 be appropriate.
11130
11131 EOM
11132         case "$dlext" in
11133         '')     dflt="$so" ;;
11134         *)      dflt="$dlext" ;;
11135         esac
11136         rp='What is the extension of dynamically loaded modules'
11137         . ./myread
11138         dlext="$ans"
11139         ;;
11140 *)
11141         dlext="none"
11142         ;;
11143 esac
11144
11145 : Check if dlsym need a leading underscore
11146 echo " "
11147 val="$undef"
11148
11149 case "$dlsrc" in
11150 dl_dlopen.xs)
11151         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11152         $cat >dyna.c <<'EOM'
11153 fred () { }
11154 EOM
11155
11156 $cat >fred.c<<EOM
11157
11158 #include <stdio.h>
11159 #$i_stdlib I_STDLIB
11160 #ifdef I_STDLIB
11161 #include <stdlib.h>
11162 #endif
11163 #$i_dlfcn I_DLFCN
11164 #ifdef I_DLFCN
11165 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11166 #else
11167 #include <sys/types.h>
11168 #include <nlist.h>
11169 #include <link.h>
11170 #endif
11171
11172 extern int fred() ;
11173
11174 int main()
11175 {
11176     void * handle ;
11177     void * symbol ;
11178 #ifndef RTLD_LAZY
11179     int mode = 1 ;
11180 #else
11181     int mode = RTLD_LAZY ;
11182 #endif
11183     handle = dlopen("./dyna.$dlext", mode) ;
11184     if (handle == NULL) {
11185         printf ("1\n") ;
11186         fflush (stdout) ;
11187         exit(0);
11188     }
11189     symbol = dlsym(handle, "fred") ;
11190     if (symbol == NULL) {
11191         /* try putting a leading underscore */
11192         symbol = dlsym(handle, "_fred") ;
11193         if (symbol == NULL) {
11194             printf ("2\n") ;
11195             fflush (stdout) ;
11196             exit(0);
11197         }
11198         printf ("3\n") ;
11199     }
11200     else
11201         printf ("4\n") ;
11202     fflush (stdout) ;
11203     exit(0);
11204 }
11205 EOM
11206         : Call the object file tmp-dyna.o in case dlext=o.
11207         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11208                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11209                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11210                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11211                 xxx=`$run ./fred`
11212                 case $xxx in
11213                 1)      echo "Test program failed using dlopen." >&4
11214                         echo "Perhaps you should not use dynamic loading." >&4;;
11215                 2)      echo "Test program failed using dlsym." >&4
11216                         echo "Perhaps you should not use dynamic loading." >&4;;
11217                 3)      echo "dlsym needs a leading underscore" >&4
11218                         val="$define" ;;
11219                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11220                 esac
11221         else
11222                 echo "I can't compile and run the test program." >&4
11223                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11224         fi
11225         ;;
11226 esac
11227                 
11228 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11229
11230 set d_dlsymun
11231 eval $setvar
11232
11233 : see if drand48_r exists
11234 set drand48_r d_drand48_r
11235 eval $inlibc
11236 case "$d_drand48_r" in
11237 "$define")
11238         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11239         case "$d_drand48_r_proto:$usethreads" in
11240         ":define")      d_drand48_r_proto=define
11241                 set d_drand48_r_proto drand48_r $hdrs
11242                 eval $hasproto ;;
11243         *)      ;;
11244         esac
11245         case "$d_drand48_r_proto" in
11246         define)
11247         case "$drand48_r_proto" in
11248         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11249         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11250         esac
11251         case "$drand48_r_proto" in
11252         ''|0)   d_drand48_r=undef
11253                 drand48_r_proto=0
11254                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11255         * )     case "$drand48_r_proto" in
11256                 REENTRANT_PROTO*) ;;
11257                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11258                 esac
11259                 echo "Prototype: $try" ;;
11260         esac
11261         ;;
11262         *)      case "$usethreads" in
11263                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11264                 esac
11265                 d_drand48_r=undef
11266                 drand48_r_proto=0
11267                 ;;
11268         esac
11269         ;;
11270 *)      drand48_r_proto=0
11271         ;;
11272 esac
11273
11274 : see if prototype for drand48 is available
11275 echo " "
11276 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11277 eval $hasproto
11278
11279 : see if dup2 exists
11280 set dup2 d_dup2
11281 eval $inlibc
11282
11283 : see if eaccess exists
11284 set eaccess d_eaccess
11285 eval $inlibc
11286
11287 : see if endgrent exists
11288 set endgrent d_endgrent
11289 eval $inlibc
11290
11291 : see if this is an grp system
11292 set grp.h i_grp
11293 eval $inhdr
11294
11295 case "$i_grp" in
11296 $define)
11297         xxx=`./findhdr grp.h`
11298         $cppstdin $cppflags $cppminus < $xxx >$$.h
11299
11300         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11301                 val="$define"
11302         else
11303                 val="$undef"
11304         fi
11305         set d_grpasswd
11306         eval $setvar
11307
11308         $rm -f $$.h
11309         ;;
11310 *)
11311         val="$undef";
11312         set d_grpasswd; eval $setvar
11313         ;;
11314 esac
11315
11316 : see if endgrent_r exists
11317 set endgrent_r d_endgrent_r
11318 eval $inlibc
11319 case "$d_endgrent_r" in
11320 "$define")
11321         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11322         case "$d_endgrent_r_proto:$usethreads" in
11323         ":define")      d_endgrent_r_proto=define
11324                 set d_endgrent_r_proto endgrent_r $hdrs
11325                 eval $hasproto ;;
11326         *)      ;;
11327         esac
11328         case "$d_endgrent_r_proto" in
11329         define)
11330         case "$endgrent_r_proto" in
11331         ''|0) try='int endgrent_r(FILE**);'
11332         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11333         esac
11334         case "$endgrent_r_proto" in
11335         ''|0) try='void endgrent_r(FILE**);'
11336         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11337         esac
11338         case "$endgrent_r_proto" in
11339         ''|0)   d_endgrent_r=undef
11340                 endgrent_r_proto=0
11341                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11342         * )     case "$endgrent_r_proto" in
11343                 REENTRANT_PROTO*) ;;
11344                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11345                 esac
11346                 echo "Prototype: $try" ;;
11347         esac
11348         ;;
11349         *)      case "$usethreads" in
11350                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11351                 esac
11352                 d_endgrent_r=undef
11353                 endgrent_r_proto=0
11354                 ;;
11355         esac
11356         ;;
11357 *)      endgrent_r_proto=0
11358         ;;
11359 esac
11360
11361 : see if endhostent exists
11362 set endhostent d_endhent
11363 eval $inlibc
11364
11365 : see if this is a netdb.h system
11366 set netdb.h i_netdb
11367 eval $inhdr
11368
11369 : see if endhostent_r exists
11370 set endhostent_r d_endhostent_r
11371 eval $inlibc
11372 case "$d_endhostent_r" in
11373 "$define")
11374         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11375         case "$d_endhostent_r_proto:$usethreads" in
11376         ":define")      d_endhostent_r_proto=define
11377                 set d_endhostent_r_proto endhostent_r $hdrs
11378                 eval $hasproto ;;
11379         *)      ;;
11380         esac
11381         case "$d_endhostent_r_proto" in
11382         define)
11383         case "$endhostent_r_proto" in
11384         ''|0) try='int endhostent_r(struct hostent_data*);'
11385         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11386         esac
11387         case "$endhostent_r_proto" in
11388         ''|0) try='void endhostent_r(struct hostent_data*);'
11389         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11390         esac
11391         case "$endhostent_r_proto" in
11392         ''|0)   d_endhostent_r=undef
11393                 endhostent_r_proto=0
11394                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11395         * )     case "$endhostent_r_proto" in
11396                 REENTRANT_PROTO*) ;;
11397                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11398                 esac
11399                 echo "Prototype: $try" ;;
11400         esac
11401         ;;
11402         *)      case "$usethreads" in
11403                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11404                 esac
11405                 d_endhostent_r=undef
11406                 endhostent_r_proto=0
11407                 ;;
11408         esac
11409         ;;
11410 *)      endhostent_r_proto=0
11411         ;;
11412 esac
11413
11414 : see if endnetent exists
11415 set endnetent d_endnent
11416 eval $inlibc
11417
11418 : see if endnetent_r exists
11419 set endnetent_r d_endnetent_r
11420 eval $inlibc
11421 case "$d_endnetent_r" in
11422 "$define")
11423         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11424         case "$d_endnetent_r_proto:$usethreads" in
11425         ":define")      d_endnetent_r_proto=define
11426                 set d_endnetent_r_proto endnetent_r $hdrs
11427                 eval $hasproto ;;
11428         *)      ;;
11429         esac
11430         case "$d_endnetent_r_proto" in
11431         define)
11432         case "$endnetent_r_proto" in
11433         ''|0) try='int endnetent_r(struct netent_data*);'
11434         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11435         esac
11436         case "$endnetent_r_proto" in
11437         ''|0) try='void endnetent_r(struct netent_data*);'
11438         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11439         esac
11440         case "$endnetent_r_proto" in
11441         ''|0)   d_endnetent_r=undef
11442                 endnetent_r_proto=0
11443                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11444         * )     case "$endnetent_r_proto" in
11445                 REENTRANT_PROTO*) ;;
11446                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11447                 esac
11448                 echo "Prototype: $try" ;;
11449         esac
11450         ;;
11451         *)      case "$usethreads" in
11452                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11453                 esac
11454                 d_endnetent_r=undef
11455                 endnetent_r_proto=0
11456                 ;;
11457         esac
11458         ;;
11459 *)      endnetent_r_proto=0
11460         ;;
11461 esac
11462
11463 : see if endprotoent exists
11464 set endprotoent d_endpent
11465 eval $inlibc
11466
11467 : see if endprotoent_r exists
11468 set endprotoent_r d_endprotoent_r
11469 eval $inlibc
11470 case "$d_endprotoent_r" in
11471 "$define")
11472         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11473         case "$d_endprotoent_r_proto:$usethreads" in
11474         ":define")      d_endprotoent_r_proto=define
11475                 set d_endprotoent_r_proto endprotoent_r $hdrs
11476                 eval $hasproto ;;
11477         *)      ;;
11478         esac
11479         case "$d_endprotoent_r_proto" in
11480         define)
11481         case "$endprotoent_r_proto" in
11482         ''|0) try='int endprotoent_r(struct protoent_data*);'
11483         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11484         esac
11485         case "$endprotoent_r_proto" in
11486         ''|0) try='void endprotoent_r(struct protoent_data*);'
11487         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11488         esac
11489         case "$endprotoent_r_proto" in
11490         ''|0)   d_endprotoent_r=undef
11491                 endprotoent_r_proto=0
11492                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11493         * )     case "$endprotoent_r_proto" in
11494                 REENTRANT_PROTO*) ;;
11495                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11496                 esac
11497                 echo "Prototype: $try" ;;
11498         esac
11499         ;;
11500         *)      case "$usethreads" in
11501                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11502                 esac
11503                 d_endprotoent_r=undef
11504                 endprotoent_r_proto=0
11505                 ;;
11506         esac
11507         ;;
11508 *)      endprotoent_r_proto=0
11509         ;;
11510 esac
11511
11512 : see if endpwent exists
11513 set endpwent d_endpwent
11514 eval $inlibc
11515
11516 : see if this is a pwd.h system
11517 set pwd.h i_pwd
11518 eval $inhdr
11519
11520 case "$i_pwd" in
11521 $define)
11522         xxx=`./findhdr pwd.h`
11523         $cppstdin $cppflags $cppminus < $xxx >$$.h
11524
11525         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11526                 val="$define"
11527         else
11528                 val="$undef"
11529         fi
11530         set d_pwquota
11531         eval $setvar
11532
11533         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11534                 val="$define"
11535         else
11536                 val="$undef"
11537         fi
11538         set d_pwage
11539         eval $setvar
11540
11541         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11542                 val="$define"
11543         else
11544                 val="$undef"
11545         fi
11546         set d_pwchange
11547         eval $setvar
11548
11549         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11550                 val="$define"
11551         else
11552                 val="$undef"
11553         fi
11554         set d_pwclass
11555         eval $setvar
11556
11557         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11558                 val="$define"
11559         else
11560                 val="$undef"
11561         fi
11562         set d_pwexpire
11563         eval $setvar
11564
11565         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11566                 val="$define"
11567         else
11568                 val="$undef"
11569         fi
11570         set d_pwcomment
11571         eval $setvar
11572
11573         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11574                 val="$define"
11575         else
11576                 val="$undef"
11577         fi
11578         set d_pwgecos
11579         eval $setvar
11580
11581         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11582                 val="$define"
11583         else
11584                 val="$undef"
11585         fi
11586         set d_pwpasswd
11587         eval $setvar
11588
11589         $rm -f $$.h
11590         ;;
11591 *)
11592         val="$undef"; 
11593         set d_pwquota; eval $setvar
11594         set d_pwage; eval $setvar
11595         set d_pwchange; eval $setvar
11596         set d_pwclass; eval $setvar
11597         set d_pwexpire; eval $setvar
11598         set d_pwcomment; eval $setvar
11599         set d_pwgecos; eval $setvar
11600         set d_pwpasswd; eval $setvar
11601         ;;
11602 esac
11603
11604 : see if endpwent_r exists
11605 set endpwent_r d_endpwent_r
11606 eval $inlibc
11607 case "$d_endpwent_r" in
11608 "$define")
11609         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11610         case "$d_endpwent_r_proto:$usethreads" in
11611         ":define")      d_endpwent_r_proto=define
11612                 set d_endpwent_r_proto endpwent_r $hdrs
11613                 eval $hasproto ;;
11614         *)      ;;
11615         esac
11616         case "$d_endpwent_r_proto" in
11617         define)
11618         case "$endpwent_r_proto" in
11619         ''|0) try='int endpwent_r(FILE**);'
11620         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11621         esac
11622         case "$endpwent_r_proto" in
11623         ''|0) try='void endpwent_r(FILE**);'
11624         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11625         esac
11626         case "$endpwent_r_proto" in
11627         ''|0)   d_endpwent_r=undef
11628                 endpwent_r_proto=0
11629                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11630         * )     case "$endpwent_r_proto" in
11631                 REENTRANT_PROTO*) ;;
11632                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11633                 esac
11634                 echo "Prototype: $try" ;;
11635         esac
11636         ;;
11637         *)      case "$usethreads" in
11638                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11639                 esac
11640                 d_endpwent_r=undef
11641                 endpwent_r_proto=0
11642                 ;;
11643         esac
11644         ;;
11645 *)      endpwent_r_proto=0
11646         ;;
11647 esac
11648
11649 : see if endservent exists
11650 set endservent d_endsent
11651 eval $inlibc
11652
11653 : see if endservent_r exists
11654 set endservent_r d_endservent_r
11655 eval $inlibc
11656 case "$d_endservent_r" in
11657 "$define")
11658         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11659         case "$d_endservent_r_proto:$usethreads" in
11660         ":define")      d_endservent_r_proto=define
11661                 set d_endservent_r_proto endservent_r $hdrs
11662                 eval $hasproto ;;
11663         *)      ;;
11664         esac
11665         case "$d_endservent_r_proto" in
11666         define)
11667         case "$endservent_r_proto" in
11668         ''|0) try='int endservent_r(struct servent_data*);'
11669         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11670         esac
11671         case "$endservent_r_proto" in
11672         ''|0) try='void endservent_r(struct servent_data*);'
11673         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11674         esac
11675         case "$endservent_r_proto" in
11676         ''|0)   d_endservent_r=undef
11677                 endservent_r_proto=0
11678                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11679         * )     case "$endservent_r_proto" in
11680                 REENTRANT_PROTO*) ;;
11681                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11682                 esac
11683                 echo "Prototype: $try" ;;
11684         esac
11685         ;;
11686         *)      case "$usethreads" in
11687                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11688                 esac
11689                 d_endservent_r=undef
11690                 endservent_r_proto=0
11691                 ;;
11692         esac
11693         ;;
11694 *)      endservent_r_proto=0
11695         ;;
11696 esac
11697
11698 : Locate the flags for 'open()'
11699 echo " "
11700 $cat >try.c <<EOCP
11701 #include <sys/types.h>
11702 #ifdef I_FCNTL
11703 #include <fcntl.h>
11704 #endif
11705 #ifdef I_SYS_FILE
11706 #include <sys/file.h>
11707 #endif
11708 #$i_stdlib I_STDLIB
11709 #ifdef I_STDLIB
11710 #include <stdlib.h>
11711 #endif
11712 int main() {
11713         if(O_RDONLY);
11714 #ifdef O_TRUNC
11715         exit(0);
11716 #else
11717         exit(1);
11718 #endif
11719 }
11720 EOCP
11721 : check sys/file.h first to get FREAD on Sun
11722 if $test `./findhdr sys/file.h` && \
11723                 set try -DI_SYS_FILE && eval $compile; then
11724         h_sysfile=true;
11725         echo "<sys/file.h> defines the O_* constants..." >&4
11726         if $run ./try; then
11727                 echo "and you have the 3 argument form of open()." >&4
11728                 val="$define"
11729         else
11730                 echo "but not the 3 argument form of open().  Oh, well." >&4
11731                 val="$undef"
11732         fi
11733 elif $test `./findhdr fcntl.h` && \
11734                 set try -DI_FCNTL && eval $compile; then
11735         h_fcntl=true;
11736         echo "<fcntl.h> defines the O_* constants..." >&4
11737         if $run ./try; then
11738                 echo "and you have the 3 argument form of open()." >&4
11739                 val="$define"
11740         else
11741                 echo "but not the 3 argument form of open().  Oh, well." >&4
11742                 val="$undef"
11743         fi
11744 else
11745         val="$undef"
11746         echo "I can't find the O_* constant definitions!  You got problems." >&4
11747 fi
11748 set d_open3
11749 eval $setvar
11750 $rm -f try try.*
11751
11752 : see which of string.h or strings.h is needed
11753 echo " "
11754 strings=`./findhdr string.h`
11755 if $test "$strings" && $test -r "$strings"; then
11756         echo "Using <string.h> instead of <strings.h>." >&4
11757         val="$define"
11758 else
11759         val="$undef"
11760         strings=`./findhdr strings.h`
11761         if $test "$strings" && $test -r "$strings"; then
11762                 echo "Using <strings.h> instead of <string.h>." >&4
11763         else
11764                 echo "No string header found -- You'll surely have problems." >&4
11765         fi
11766 fi
11767 set i_string
11768 eval $setvar
11769 case "$i_string" in
11770 "$undef") strings=`./findhdr strings.h`;;
11771 *)        strings=`./findhdr string.h`;;
11772 esac
11773
11774 : see if this is a sys/file.h system
11775 val=''
11776 set sys/file.h val
11777 eval $inhdr
11778
11779 : do we need to include sys/file.h ?
11780 case "$val" in
11781 "$define")
11782         echo " "
11783         if $h_sysfile; then
11784                 val="$define"
11785                 echo "We'll be including <sys/file.h>." >&4
11786         else
11787                 val="$undef"
11788                 echo "We won't be including <sys/file.h>." >&4
11789         fi
11790         ;;
11791 *)
11792         h_sysfile=false
11793         ;;
11794 esac
11795 set i_sysfile
11796 eval $setvar
11797
11798 : see if fcntl.h is there
11799 val=''
11800 set fcntl.h val
11801 eval $inhdr
11802
11803 : see if we can include fcntl.h
11804 case "$val" in
11805 "$define")
11806         echo " "
11807         if $h_fcntl; then
11808                 val="$define"
11809                 echo "We'll be including <fcntl.h>." >&4
11810         else
11811                 val="$undef"
11812                 if $h_sysfile; then
11813         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11814                 else
11815                         echo "We won't be including <fcntl.h>." >&4
11816                 fi
11817         fi
11818         ;;
11819 *)
11820         h_fcntl=false
11821         val="$undef"
11822         ;;
11823 esac
11824 set i_fcntl
11825 eval $setvar
11826
11827 : check for non-blocking I/O stuff
11828 case "$h_sysfile" in
11829 true) echo "#include <sys/file.h>" > head.c;;
11830 *)
11831        case "$h_fcntl" in
11832        true) echo "#include <fcntl.h>" > head.c;;
11833        *) echo "#include <sys/fcntl.h>" > head.c;;
11834        esac
11835        ;;
11836 esac
11837 echo " "
11838 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11839 case "$o_nonblock" in
11840 '')
11841         $cat head.c > try.c
11842         $cat >>try.c <<EOCP
11843 #include <stdio.h>
11844 #$i_stdlib I_STDLIB
11845 #ifdef I_STDLIB
11846 #include <stdlib.h>
11847 #endif
11848 #$i_fcntl I_FCNTL
11849 #ifdef I_FCNTL
11850 #include <fcntl.h>
11851 #endif
11852 int main() {
11853 #ifdef O_NONBLOCK
11854         printf("O_NONBLOCK\n");
11855         exit(0);
11856 #endif
11857 #ifdef O_NDELAY
11858         printf("O_NDELAY\n");
11859         exit(0);
11860 #endif
11861 #ifdef FNDELAY
11862         printf("FNDELAY\n");
11863         exit(0);
11864 #endif
11865         exit(0);
11866 }
11867 EOCP
11868         set try
11869         if eval $compile_ok; then
11870                 o_nonblock=`$run ./try`
11871                 case "$o_nonblock" in
11872                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11873                 *) echo "Seems like we can use $o_nonblock.";;
11874                 esac
11875         else
11876                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11877         fi
11878         ;;
11879 *) echo "Using $hint value $o_nonblock.";;
11880 esac
11881 $rm -f try try.* .out core
11882
11883 echo " "
11884 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11885 case "$eagain" in
11886 '')
11887         $cat head.c > try.c
11888         $cat >>try.c <<EOCP
11889 #include <errno.h>
11890 #include <sys/types.h>
11891 #include <signal.h>
11892 #include <stdio.h> 
11893 #$i_stdlib I_STDLIB
11894 #ifdef I_STDLIB
11895 #include <stdlib.h>
11896 #endif
11897 #$i_fcntl I_FCNTL
11898 #ifdef I_FCNTL
11899 #include <fcntl.h>
11900 #endif
11901 #define MY_O_NONBLOCK $o_nonblock
11902 #ifndef errno  /* XXX need better Configure test */
11903 extern int errno;
11904 #endif
11905 #$i_unistd I_UNISTD
11906 #ifdef I_UNISTD
11907 #include <unistd.h>
11908 #endif
11909 #$i_string I_STRING
11910 #ifdef I_STRING
11911 #include <string.h>
11912 #else
11913 #include <strings.h>
11914 #endif
11915 $signal_t blech(x) int x; { exit(3); }
11916 EOCP
11917         $cat >> try.c <<'EOCP'
11918 int main()
11919 {
11920         int pd[2];
11921         int pu[2];
11922         char buf[1];
11923         char string[100];
11924
11925         pipe(pd);       /* Down: child -> parent */
11926         pipe(pu);       /* Up: parent -> child */
11927         if (0 != fork()) {
11928                 int ret;
11929                 close(pd[1]);   /* Parent reads from pd[0] */
11930                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11931 #ifdef F_SETFL
11932                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11933                         exit(1);
11934 #else
11935                 exit(4);
11936 #endif
11937                 signal(SIGALRM, blech);
11938                 alarm(5);
11939                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11940                         exit(2);
11941                 sprintf(string, "%d\n", ret);
11942                 write(2, string, strlen(string));
11943                 alarm(0);
11944 #ifdef EAGAIN
11945                 if (errno == EAGAIN) {
11946                         printf("EAGAIN\n");
11947                         goto ok;
11948                 }
11949 #endif
11950 #ifdef EWOULDBLOCK
11951                 if (errno == EWOULDBLOCK)
11952                         printf("EWOULDBLOCK\n");
11953 #endif
11954         ok:
11955                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11956                 sleep(2);                               /* Give it time to close our pipe */
11957                 alarm(5);
11958                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11959                 alarm(0);
11960                 sprintf(string, "%d\n", ret);
11961                 write(4, string, strlen(string));
11962                 exit(0);
11963         }
11964
11965         close(pd[0]);                   /* We write to pd[1] */
11966         close(pu[1]);                   /* We read from pu[0] */
11967         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11968         close(pd[1]);                   /* Pipe pd is now fully closed! */
11969         exit(0);                                /* Bye bye, thank you for playing! */
11970 }
11971 EOCP
11972         set try
11973         if eval $compile_ok; then
11974                 echo "$startsh" >mtry
11975                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11976                 chmod +x mtry
11977                 ./mtry >/dev/null 2>&1
11978                 case $? in
11979                 0) eagain=`$cat try.out`;;
11980                 1) echo "Could not perform non-blocking setting!";;
11981                 2) echo "I did a successful read() for something that was not there!";;
11982                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11983                 4) echo "Could not find F_SETFL!";;
11984                 *) echo "Something terribly wrong happened during testing.";;
11985                 esac
11986                 rd_nodata=`$cat try.ret`
11987                 echo "A read() system call with no data present returns $rd_nodata."
11988                 case "$rd_nodata" in
11989                 0|-1) ;;
11990                 *)
11991                         echo "(That's peculiar, fixing that to be -1.)"
11992                         rd_nodata=-1
11993                         ;;
11994                 esac
11995                 case "$eagain" in
11996                 '')
11997                         echo "Forcing errno EAGAIN on read() with no data available."
11998                         eagain=EAGAIN
11999                         ;;
12000                 *)
12001                         echo "Your read() sets errno to $eagain when no data is available."
12002                         ;;
12003                 esac
12004                 status=`$cat try.err`
12005                 case "$status" in
12006                 0) echo "And it correctly returns 0 to signal EOF.";;
12007                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12008                 *) echo "However, your read() returns '$status' on EOF??";;
12009                 esac
12010                 val="$define"
12011                 if test "$status" = "$rd_nodata"; then
12012                         echo "WARNING: you can't distinguish between EOF and no data!"
12013                         val="$undef"
12014                 fi
12015         else
12016                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12017                 eagain=EAGAIN
12018         fi
12019         set d_eofnblk
12020         eval $setvar
12021         ;;
12022 *)
12023         echo "Using $hint value $eagain."
12024         echo "Your read() returns $rd_nodata when no data is present."
12025         case "$d_eofnblk" in
12026         "$define") echo "And you can see EOF because read() returns 0.";;
12027         "$undef") echo "But you can't see EOF status from read() returned value.";;
12028         *)
12029                 echo "(Assuming you can't see EOF status from read anyway.)"
12030                 d_eofnblk=$undef
12031                 ;;
12032         esac
12033         ;;
12034 esac
12035 $rm -f try try.* .out core head.c mtry
12036
12037 : see if _ptr and _cnt from stdio act std
12038 echo " "
12039
12040 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12041         echo "(Looks like you have stdio.h from BSD.)"
12042         case "$stdio_ptr" in
12043         '') stdio_ptr='((fp)->_p)'
12044                 ptr_lval=$define
12045                 ;;
12046         *)      ptr_lval=$d_stdio_ptr_lval;;
12047         esac
12048         case "$stdio_cnt" in
12049         '') stdio_cnt='((fp)->_r)'
12050                 cnt_lval=$define
12051                 ;;
12052         *)      cnt_lval=$d_stdio_cnt_lval;;
12053         esac
12054         case "$stdio_base" in
12055         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12056         esac
12057         case "$stdio_bufsiz" in
12058         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12059         esac
12060 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12061         echo "(Looks like you have stdio.h from Linux.)"
12062         case "$stdio_ptr" in
12063         '') stdio_ptr='((fp)->_IO_read_ptr)'
12064                 ptr_lval=$define
12065                 ;;
12066         *)      ptr_lval=$d_stdio_ptr_lval;;
12067         esac
12068         case "$stdio_cnt" in
12069         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12070                 cnt_lval=$undef
12071                 ;;
12072         *)      cnt_lval=$d_stdio_cnt_lval;;
12073         esac
12074         case "$stdio_base" in
12075         '') stdio_base='((fp)->_IO_read_base)';;
12076         esac
12077         case "$stdio_bufsiz" in
12078         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12079         esac
12080 else
12081         case "$stdio_ptr" in
12082         '') stdio_ptr='((fp)->_ptr)'
12083                 ptr_lval=$define
12084                 ;;
12085         *)      ptr_lval=$d_stdio_ptr_lval;;
12086         esac
12087         case "$stdio_cnt" in
12088         '') stdio_cnt='((fp)->_cnt)'
12089                 cnt_lval=$define
12090                 ;;
12091         *)      cnt_lval=$d_stdio_cnt_lval;;
12092         esac
12093         case "$stdio_base" in
12094         '') stdio_base='((fp)->_base)';;
12095         esac
12096         case "$stdio_bufsiz" in
12097         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12098         esac
12099 fi
12100
12101 : test whether _ptr and _cnt really work
12102 echo "Checking how std your stdio is..." >&4
12103 $cat >try.c <<EOP
12104 #include <stdio.h>
12105 #$i_stdlib I_STDLIB
12106 #ifdef I_STDLIB
12107 #include <stdlib.h>
12108 #endif
12109 #define FILE_ptr(fp)    $stdio_ptr
12110 #define FILE_cnt(fp)    $stdio_cnt
12111 int main() {
12112         FILE *fp = fopen("try.c", "r");
12113         char c = getc(fp);
12114         if (
12115                 18 <= FILE_cnt(fp) &&
12116                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12117         )
12118                 exit(0);
12119         exit(1);
12120 }
12121 EOP
12122 val="$undef"
12123 set try
12124 if eval $compile && $to try.c; then
12125         if $run ./try; then
12126                 echo "Your stdio acts pretty std."
12127                 val="$define"
12128         else
12129                 echo "Your stdio isn't very std."
12130         fi
12131 else
12132         echo "Your stdio doesn't appear very std."
12133 fi
12134 $rm -f try.c try
12135
12136 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12137 # direct buffer manipulation no longer works.  The Configure tests
12138 # should be changed to correctly detect this, but until then,
12139 # the following check should at least let perl compile and run.
12140 # (This quick fix should be updated before 5.8.1.)
12141 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12142 # A. Dougherty, June 3, 2002.
12143 case "$d_gnulibc" in
12144 $define)
12145         case "$gnulibc_version" in
12146         2.[01]*)  ;;
12147         2.2) ;;
12148         2.2.[0-9]) ;;
12149         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12150                 val="$undef"
12151                 ;;
12152         esac
12153         ;;
12154 esac
12155 set d_stdstdio
12156 eval $setvar
12157
12158 : Can _ptr be used as an lvalue?
12159 case "$d_stdstdio$ptr_lval" in
12160 $define$define) val=$define ;;
12161 *) val=$undef ;;
12162 esac
12163 set d_stdio_ptr_lval
12164 eval $setvar
12165
12166 : Can _cnt be used as an lvalue?
12167 case "$d_stdstdio$cnt_lval" in
12168 $define$define) val=$define ;;
12169 *) val=$undef ;;
12170 esac
12171 set d_stdio_cnt_lval
12172 eval $setvar
12173
12174
12175 : test whether setting _ptr sets _cnt as a side effect
12176 d_stdio_ptr_lval_sets_cnt="$undef"
12177 d_stdio_ptr_lval_nochange_cnt="$undef"
12178 case "$d_stdio_ptr_lval$d_stdstdio" in
12179 $define$define)
12180         echo "Checking to see what happens if we set the stdio ptr..." >&4
12181 $cat >try.c <<EOP
12182 #include <stdio.h>
12183 /* Can we scream? */
12184 /* Eat dust sed :-) */
12185 /* In the buffer space, no one can hear you scream. */
12186 #$i_stdlib I_STDLIB
12187 #ifdef I_STDLIB
12188 #include <stdlib.h>
12189 #endif
12190 #define FILE_ptr(fp)    $stdio_ptr
12191 #define FILE_cnt(fp)    $stdio_cnt
12192 #include <sys/types.h>
12193 int main() {
12194         FILE *fp = fopen("try.c", "r");
12195         int c;
12196         char *ptr;
12197         size_t cnt;
12198         if (!fp) {
12199             puts("Fail even to read");
12200             exit(1);
12201         }
12202         c = getc(fp); /* Read away the first # */
12203         if (c == EOF) {
12204             puts("Fail even to read");
12205             exit(1);
12206         }
12207         if (!(
12208                 18 <= FILE_cnt(fp) &&
12209                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12210         )) {
12211                 puts("Fail even to read");
12212                 exit (1);
12213         }
12214         ptr = (char*) FILE_ptr(fp);
12215         cnt = (size_t)FILE_cnt(fp);
12216
12217         FILE_ptr(fp) += 42;
12218
12219         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12220                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12221                 exit (1);
12222         }
12223         if (FILE_cnt(fp) <= 20) {
12224                 printf ("Fail (<20 chars to test)");
12225                 exit (1);
12226         }
12227         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12228                 puts("Fail compare");
12229                 exit (1);
12230         }
12231         if (cnt == FILE_cnt(fp)) {
12232                 puts("Pass_unchanged");
12233                 exit (0);
12234         }       
12235         if (FILE_cnt(fp) == (cnt - 42)) {
12236                 puts("Pass_changed");
12237                 exit (0);
12238         }
12239         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12240         return 1;
12241
12242 }
12243 EOP
12244         set try
12245         if eval $compile && $to try.c; then
12246                 case `$run ./try` in
12247                 Pass_changed)
12248                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12249                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12250                 Pass_unchanged)
12251                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12252                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12253                 Fail*)
12254                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12255                 *)
12256                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12257         esac
12258         else
12259                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12260         fi
12261         $rm -f try.c try
12262         ;;
12263 esac
12264
12265 : see if _base is also standard
12266 val="$undef"
12267 case "$d_stdstdio" in
12268 $define)
12269         $cat >try.c <<EOP
12270 #include <stdio.h>
12271 #$i_stdlib I_STDLIB
12272 #ifdef I_STDLIB
12273 #include <stdlib.h>
12274 #endif
12275 #define FILE_base(fp)   $stdio_base
12276 #define FILE_bufsiz(fp) $stdio_bufsiz
12277 int main() {
12278         FILE *fp = fopen("try.c", "r");
12279         char c = getc(fp);
12280         if (
12281                 19 <= FILE_bufsiz(fp) &&
12282                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12283         )
12284                 exit(0);
12285         exit(1);
12286 }
12287 EOP
12288         set try
12289         if eval $compile && $to try.c; then
12290                 if $run ./try; then
12291                         echo "And its _base field acts std."
12292                         val="$define"
12293                 else
12294                         echo "But its _base field isn't std."
12295                 fi
12296         else
12297                 echo "However, it seems to be lacking the _base field."
12298         fi
12299         $rm -f try.c try
12300         ;;
12301 esac
12302 set d_stdiobase
12303 eval $setvar
12304
12305 : see if fast_stdio exists
12306 val="$undef"
12307 case "$d_stdstdio:$d_stdio_ptr_lval" in
12308 "$define:$define")
12309         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12310         *$define*)
12311                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12312                 val="$define"
12313                 ;;
12314         esac
12315         ;;
12316 esac
12317 set d_faststdio
12318 eval $setvar
12319
12320
12321
12322 : see if fchdir exists
12323 set fchdir d_fchdir
12324 eval $inlibc
12325
12326 : see if fchmod exists
12327 set fchmod d_fchmod
12328 eval $inlibc
12329
12330 : see if fchown exists
12331 set fchown d_fchown
12332 eval $inlibc
12333
12334 : see if this is an fcntl system
12335 set fcntl d_fcntl
12336 eval $inlibc
12337
12338 echo " "
12339 : See if fcntl-based locking works.
12340 $cat >try.c <<EOCP
12341 #$i_stdlib I_STDLIB
12342 #ifdef I_STDLIB
12343 #include <stdlib.h>
12344 #endif
12345 #include <unistd.h>
12346 #include <fcntl.h>
12347 #include <signal.h>
12348 $signal_t blech(x) int x; { exit(3); }
12349 int main() {
12350 #if defined(F_SETLK) && defined(F_SETLKW)
12351      struct flock flock;
12352      int retval, fd;
12353      fd = open("try.c", O_RDONLY);
12354      flock.l_type = F_RDLCK;
12355      flock.l_whence = SEEK_SET;
12356      flock.l_start = flock.l_len = 0;
12357      signal(SIGALRM, blech);
12358      alarm(10);
12359      retval = fcntl(fd, F_SETLK, &flock);
12360      close(fd);
12361      (retval < 0 ? exit(2) : exit(0));
12362 #else
12363      exit(2);
12364 #endif
12365 }
12366 EOCP
12367 echo "Checking if fcntl-based file locking works... "
12368 case "$d_fcntl" in
12369 "$define")
12370         set try
12371         if eval $compile_ok; then
12372                 if $run ./try; then
12373                         echo "Yes, it seems to work."
12374                         val="$define"
12375                 else
12376                         echo "Nope, it didn't work."
12377                         val="$undef"
12378                         case "$?" in
12379                         3) $cat >&4 <<EOM
12380 ***
12381 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12382 *** This is (almost) impossible.
12383 *** If your NFS lock daemons are not feeling well, something like
12384 *** this may happen, please investigate.  Cannot continue, aborting.
12385 ***
12386 EOM
12387                                 exit 1
12388                                 ;;
12389                         esac
12390                 fi
12391         else
12392                 echo "I'm unable to compile the test program, so I'll assume not."
12393                 val="$undef"
12394         fi
12395         ;;
12396 *) val="$undef";
12397         echo "Nope, since you don't even have fcntl()."
12398         ;;
12399 esac
12400 set d_fcntl_can_lock
12401 eval $setvar
12402 $rm -f try*
12403
12404
12405 : check for fd_set items
12406 $cat <<EOM
12407
12408 Checking to see how well your C compiler handles fd_set and friends ...
12409 EOM
12410 $cat >try.c <<EOCP
12411 #$i_stdlib I_STDLIB
12412 #ifdef I_STDLIB
12413 #include <stdlib.h>
12414 #endif
12415 #$i_systime I_SYS_TIME
12416 #$i_sysselct I_SYS_SELECT
12417 #$d_socket HAS_SOCKET
12418 #include <sys/types.h>
12419 #ifdef HAS_SOCKET
12420 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12421 #endif
12422 #ifdef I_SYS_TIME
12423 #include <sys/time.h>
12424 #endif
12425 #ifdef I_SYS_SELECT
12426 #include <sys/select.h>
12427 #endif
12428 int main() {
12429         fd_set fds;
12430
12431 #ifdef TRYBITS
12432         if(fds.fds_bits);
12433 #endif
12434
12435 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12436         exit(0);
12437 #else
12438         exit(1);
12439 #endif
12440 }
12441 EOCP
12442 set try -DTRYBITS
12443 if eval $compile; then
12444         d_fds_bits="$define"
12445         d_fd_set="$define"
12446         echo "Well, your system knows about the normal fd_set typedef..." >&4
12447         if $run ./try; then
12448                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12449                 d_fd_macros="$define"
12450         else
12451                 $cat >&4 <<'EOM'
12452 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12453 EOM
12454                 d_fd_macros="$undef"
12455         fi
12456 else
12457         $cat <<'EOM'
12458 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12459 EOM
12460         set try
12461         if eval $compile; then
12462                 d_fds_bits="$undef"
12463                 d_fd_set="$define"
12464                 echo "Well, your system has some sort of fd_set available..." >&4
12465                 if $run ./try; then
12466                         echo "and you have the normal fd_set macros." >&4
12467                         d_fd_macros="$define"
12468                 else
12469                         $cat <<'EOM'
12470 but not the normal fd_set macros!  Gross!  More work for me...
12471 EOM
12472                         d_fd_macros="$undef"
12473                 fi
12474         else
12475         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12476                 d_fd_set="$undef"
12477                 d_fds_bits="$undef"
12478                 d_fd_macros="$undef"
12479         fi
12480 fi
12481 $rm -f try try.*
12482
12483 : see if fgetpos exists
12484 set fgetpos d_fgetpos
12485 eval $inlibc
12486
12487 : see if finite exists
12488 set finite d_finite
12489 eval $inlibc
12490
12491 : see if finitel exists
12492 set finitel d_finitel
12493 eval $inlibc
12494
12495 : see if flock exists
12496 set flock d_flock
12497 eval $inlibc
12498
12499 : see if prototype for flock is available
12500 echo " "
12501 set d_flockproto flock $i_sysfile sys/file.h
12502 eval $hasproto
12503
12504 : see if fork exists
12505 set fork d_fork
12506 eval $inlibc
12507
12508 : see if fp_class exists
12509 set fp_class d_fp_class
12510 eval $inlibc
12511
12512 : see if pathconf exists
12513 set pathconf d_pathconf
12514 eval $inlibc
12515
12516 : see if fpathconf exists
12517 set fpathconf d_fpathconf
12518 eval $inlibc
12519
12520 : see if fpclass exists
12521 set fpclass d_fpclass
12522 eval $inlibc
12523
12524 : see if fpclassify exists
12525 set fpclassify d_fpclassify
12526 eval $inlibc
12527
12528 : see if fpclassl exists
12529 set fpclassl d_fpclassl
12530 eval $inlibc
12531
12532
12533 : check for fpos64_t
12534 echo " "
12535 echo "Checking to see if you have fpos64_t..." >&4
12536 $cat >try.c <<EOCP
12537 #include <stdio.h>
12538 int main() { fpos64_t x = 7; }
12539 EOCP
12540 set try
12541 if eval $compile; then
12542         val="$define"
12543         echo "You have fpos64_t."
12544 else
12545         val="$undef"
12546         echo "You do not have fpos64_t."
12547         case "$fpossize" in
12548         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12549         esac
12550 fi
12551 $rm -f try.* try
12552 set d_fpos64_t
12553 eval $setvar
12554
12555 : see if frexpl exists
12556 set frexpl d_frexpl
12557 eval $inlibc
12558
12559 : see if this is a sys/param system
12560 set sys/param.h i_sysparam
12561 eval $inhdr
12562
12563 : see if this is a sys/mount.h system
12564 set sys/mount.h i_sysmount
12565 eval $inhdr
12566
12567
12568 echo " "
12569 echo "Checking to see if your system supports struct fs_data..." >&4
12570 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12571 eval $hasstruct
12572 case "$d_fs_data_s" in
12573 "$define")      echo "Yes, it does."   ;;
12574 *)              echo "No, it doesn't." ;;
12575 esac
12576
12577 : see if fseeko exists
12578 set fseeko d_fseeko
12579 eval $inlibc
12580 case "$longsize" in
12581 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12582 esac
12583
12584 : see if fsetpos exists
12585 set fsetpos d_fsetpos
12586 eval $inlibc
12587
12588
12589 : see if fstatfs exists
12590 set fstatfs d_fstatfs
12591 eval $inlibc
12592
12593
12594 : see if statvfs exists
12595 set statvfs d_statvfs
12596 eval $inlibc
12597
12598 : see if fstatvfs exists
12599 set fstatvfs d_fstatvfs
12600 eval $inlibc
12601
12602
12603 : see if fsync exists
12604 set fsync d_fsync
12605 eval $inlibc
12606
12607 : see if ftello exists
12608 set ftello d_ftello
12609 eval $inlibc
12610 case "$longsize" in
12611 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12612 esac
12613
12614 d_futimes="$undef"
12615 : check for a working futimes
12616 echo " "
12617 echo "Checking for a working futimes()" >&4
12618 $cat >try.c <<EOCP
12619 #include <stdio.h>
12620 #include <sys/time.h>
12621 #include <errno.h>
12622 #include <fcntl.h>
12623
12624 int main ()
12625 {
12626     int fd, rv;
12627     fd = open ("try.c", O_RDWR);
12628     if (-1 == fd) exit (1);
12629     rv = futimes (fd, NULL);
12630     exit (rv == -1 ? errno : 0);
12631 }
12632 EOCP
12633 set try
12634 if eval $compile; then
12635     `$run ./try`
12636     rc=$?
12637     case "$rc" in
12638         0)  echo "Yes, it does" >&4
12639             d_futimes="$define"
12640             ;;
12641         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12642             ;;
12643     esac
12644 else
12645     echo "No, it does not (probably harmless)\n" >&4
12646 fi
12647 $rm -f try.* try core core.try.*
12648
12649 : see if getcwd exists
12650 set getcwd d_getcwd
12651 eval $inlibc
12652
12653 : see if getespwnam exists
12654 set getespwnam d_getespwnam
12655 eval $inlibc
12656
12657
12658 : see if getfsstat exists
12659 set getfsstat d_getfsstat
12660 eval $inlibc
12661
12662 : see if getgrent exists
12663 set getgrent d_getgrent
12664 eval $inlibc
12665
12666 : see if getgrent_r exists
12667 set getgrent_r d_getgrent_r
12668 eval $inlibc
12669 case "$d_getgrent_r" in
12670 "$define")
12671         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12672         case "$d_getgrent_r_proto:$usethreads" in
12673         ":define")      d_getgrent_r_proto=define
12674                 set d_getgrent_r_proto getgrent_r $hdrs
12675                 eval $hasproto ;;
12676         *)      ;;
12677         esac
12678         case "$d_getgrent_r_proto" in
12679         define)
12680         case "$getgrent_r_proto" in
12681         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12682         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12683         esac
12684         case "$getgrent_r_proto" in
12685         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12686         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12687         esac
12688         case "$getgrent_r_proto" in
12689         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12690         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12691         esac
12692         case "$getgrent_r_proto" in
12693         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12694         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12695         esac
12696         case "$getgrent_r_proto" in
12697         ''|0) try='int getgrent_r(struct group*, char*, int);'
12698         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12699         esac
12700         case "$getgrent_r_proto" in
12701         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12702         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12703         esac
12704         case "$getgrent_r_proto" in
12705         ''|0)   d_getgrent_r=undef
12706                 getgrent_r_proto=0
12707                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12708         * )     case "$getgrent_r_proto" in
12709                 REENTRANT_PROTO*) ;;
12710                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12711                 esac
12712                 echo "Prototype: $try" ;;
12713         esac
12714         ;;
12715         *)      case "$usethreads" in
12716                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12717                 esac
12718                 d_getgrent_r=undef
12719                 getgrent_r_proto=0
12720                 ;;
12721         esac
12722         ;;
12723 *)      getgrent_r_proto=0
12724         ;;
12725 esac
12726
12727 : see if getgrgid_r exists
12728 set getgrgid_r d_getgrgid_r
12729 eval $inlibc
12730 case "$d_getgrgid_r" in
12731 "$define")
12732         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12733         case "$d_getgrgid_r_proto:$usethreads" in
12734         ":define")      d_getgrgid_r_proto=define
12735                 set d_getgrgid_r_proto getgrgid_r $hdrs
12736                 eval $hasproto ;;
12737         *)      ;;
12738         esac
12739         case "$d_getgrgid_r_proto" in
12740         define)
12741         case "$getgrgid_r_proto" in
12742         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12743         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12744         esac
12745         case "$getgrgid_r_proto" in
12746         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12747         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12748         esac
12749         case "$getgrgid_r_proto" in
12750         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12751         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12752         esac
12753         case "$getgrgid_r_proto" in
12754         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12755         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12756         esac
12757         case "$getgrgid_r_proto" in
12758         ''|0)   d_getgrgid_r=undef
12759                 getgrgid_r_proto=0
12760                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12761         * )     case "$getgrgid_r_proto" in
12762                 REENTRANT_PROTO*) ;;
12763                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12764                 esac
12765                 echo "Prototype: $try" ;;
12766         esac
12767         ;;
12768         *)      case "$usethreads" in
12769                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12770                 esac
12771                 d_getgrgid_r=undef
12772                 getgrgid_r_proto=0
12773                 ;;
12774         esac
12775         ;;
12776 *)      getgrgid_r_proto=0
12777         ;;
12778 esac
12779
12780 : see if getgrnam_r exists
12781 set getgrnam_r d_getgrnam_r
12782 eval $inlibc
12783 case "$d_getgrnam_r" in
12784 "$define")
12785         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12786         case "$d_getgrnam_r_proto:$usethreads" in
12787         ":define")      d_getgrnam_r_proto=define
12788                 set d_getgrnam_r_proto getgrnam_r $hdrs
12789                 eval $hasproto ;;
12790         *)      ;;
12791         esac
12792         case "$d_getgrnam_r_proto" in
12793         define)
12794         case "$getgrnam_r_proto" in
12795         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12796         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12797         esac
12798         case "$getgrnam_r_proto" in
12799         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12800         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12801         esac
12802         case "$getgrnam_r_proto" in
12803         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12804         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12805         esac
12806         case "$getgrnam_r_proto" in
12807         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12808         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12809         esac
12810         case "$getgrnam_r_proto" in
12811         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12812         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12813         esac
12814         case "$getgrnam_r_proto" in
12815         ''|0)   d_getgrnam_r=undef
12816                 getgrnam_r_proto=0
12817                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12818         * )     case "$getgrnam_r_proto" in
12819                 REENTRANT_PROTO*) ;;
12820                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12821                 esac
12822                 echo "Prototype: $try" ;;
12823         esac
12824         ;;
12825         *)      case "$usethreads" in
12826                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12827                 esac
12828                 d_getgrnam_r=undef
12829                 getgrnam_r_proto=0
12830                 ;;
12831         esac
12832         ;;
12833 *)      getgrnam_r_proto=0
12834         ;;
12835 esac
12836
12837 : see if gethostbyaddr exists
12838 set gethostbyaddr d_gethbyaddr
12839 eval $inlibc
12840
12841 : see if gethostbyname exists
12842 set gethostbyname d_gethbyname
12843 eval $inlibc
12844
12845 : see if gethostent exists
12846 set gethostent d_gethent
12847 eval $inlibc
12848
12849 : see how we will look up host name
12850 echo " "
12851 call=''
12852 if set gethostname val -f d_gethname; eval $csym; $val; then
12853         echo 'gethostname() found.' >&4
12854         d_gethname="$define"
12855         call=gethostname
12856 fi
12857 if set uname val -f d_uname; eval $csym; $val; then
12858         if ./xenix; then
12859                 $cat <<'EOM'
12860 uname() was found, but you're running xenix, and older versions of xenix
12861 have a broken uname(). If you don't really know whether your xenix is old
12862 enough to have a broken system call, use the default answer.
12863
12864 EOM
12865                 dflt=y
12866                 case "$d_uname" in
12867                 "$define") dflt=n;;
12868                 esac
12869                 rp='Is your uname() broken?'
12870                 . ./myread
12871                 case "$ans" in
12872                 n*) d_uname="$define"; call=uname;;
12873                 esac
12874         else
12875                 echo 'uname() found.' >&4
12876                 d_uname="$define"
12877                 case "$call" in
12878                 '') call=uname ;;
12879                 esac
12880         fi
12881 fi
12882 case "$d_gethname" in
12883 '') d_gethname="$undef";;
12884 esac
12885 case "$d_uname" in
12886 '') d_uname="$undef";;
12887 esac
12888 case "$d_uname$d_gethname" in
12889 *define*)
12890         dflt=n
12891         cat <<EOM
12892  
12893 Every now and then someone has a $call() that lies about the hostname
12894 but can't be fixed for political or economic reasons.  If you wish, I can
12895 pretend $call() isn't there and maybe compute hostname at run-time
12896 thanks to the '$phostname' command.
12897
12898 EOM
12899         rp="Shall I ignore $call() from now on?"
12900         . ./myread
12901         case "$ans" in
12902         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12903         esac;;
12904 esac
12905 case "$phostname" in
12906 '') aphostname='';;
12907 *) case "$aphostname" in
12908         /*) ;;
12909         *) set X $phostname
12910                 shift
12911                 file=$1
12912                 shift
12913                 file=`./loc $file $file $pth`
12914                 aphostname=`echo $file $*`
12915                 ;;
12916         esac
12917         ;;
12918 esac
12919 case "$d_uname$d_gethname" in
12920 *define*) ;;
12921 *)
12922         case "$phostname" in
12923         '')
12924                 echo "There will be no way for $package to get your hostname." >&4;;
12925         *)
12926         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12927                 ;;
12928         esac;;
12929 esac
12930 case "$d_phostname" in
12931 '') d_phostname="$undef";;
12932 esac
12933
12934 : see if gethostbyaddr_r exists
12935 set gethostbyaddr_r d_gethostbyaddr_r
12936 eval $inlibc
12937 case "$d_gethostbyaddr_r" in
12938 "$define")
12939         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12940         case "$d_gethostbyaddr_r_proto:$usethreads" in
12941         ":define")      d_gethostbyaddr_r_proto=define
12942                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12943                 eval $hasproto ;;
12944         *)      ;;
12945         esac
12946         case "$d_gethostbyaddr_r_proto" in
12947         define)
12948         case "$gethostbyaddr_r_proto" in
12949         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12950         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12951         esac
12952         case "$gethostbyaddr_r_proto" in
12953         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12954         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12955         esac
12956         case "$gethostbyaddr_r_proto" in
12957         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12958         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12959         esac
12960         case "$gethostbyaddr_r_proto" in
12961         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12962         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12963         esac
12964         case "$gethostbyaddr_r_proto" in
12965         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12966         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12967         esac
12968         case "$gethostbyaddr_r_proto" in
12969         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12970         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12971         esac
12972         case "$gethostbyaddr_r_proto" in
12973         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12974         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12975         esac
12976         case "$gethostbyaddr_r_proto" in
12977         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12978         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12979         esac
12980         case "$gethostbyaddr_r_proto" in
12981         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12982         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12983         esac
12984         case "$gethostbyaddr_r_proto" in
12985         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12986         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12987         esac
12988         case "$gethostbyaddr_r_proto" in
12989         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12990         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12991         esac
12992         case "$gethostbyaddr_r_proto" in
12993         ''|0)   d_gethostbyaddr_r=undef
12994                 gethostbyaddr_r_proto=0
12995                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12996         * )     case "$gethostbyaddr_r_proto" in
12997                 REENTRANT_PROTO*) ;;
12998                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12999                 esac
13000                 echo "Prototype: $try" ;;
13001         esac
13002         ;;
13003         *)      case "$usethreads" in
13004                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13005                 esac
13006                 d_gethostbyaddr_r=undef
13007                 gethostbyaddr_r_proto=0
13008                 ;;
13009         esac
13010         ;;
13011 *)      gethostbyaddr_r_proto=0
13012         ;;
13013 esac
13014
13015 : see if gethostbyname_r exists
13016 set gethostbyname_r d_gethostbyname_r
13017 eval $inlibc
13018 case "$d_gethostbyname_r" in
13019 "$define")
13020         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13021         case "$d_gethostbyname_r_proto:$usethreads" in
13022         ":define")      d_gethostbyname_r_proto=define
13023                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13024                 eval $hasproto ;;
13025         *)      ;;
13026         esac
13027         case "$d_gethostbyname_r_proto" in
13028         define)
13029         case "$gethostbyname_r_proto" in
13030         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13031         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13032         esac
13033         case "$gethostbyname_r_proto" in
13034         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13035         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13036         esac
13037         case "$gethostbyname_r_proto" in
13038         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13039         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13040         esac
13041         case "$gethostbyname_r_proto" in
13042         ''|0)   d_gethostbyname_r=undef
13043                 gethostbyname_r_proto=0
13044                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13045         * )     case "$gethostbyname_r_proto" in
13046                 REENTRANT_PROTO*) ;;
13047                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13048                 esac
13049                 echo "Prototype: $try" ;;
13050         esac
13051         ;;
13052         *)      case "$usethreads" in
13053                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13054                 esac
13055                 d_gethostbyname_r=undef
13056                 gethostbyname_r_proto=0
13057                 ;;
13058         esac
13059         ;;
13060 *)      gethostbyname_r_proto=0
13061         ;;
13062 esac
13063
13064 : see if gethostent_r exists
13065 set gethostent_r d_gethostent_r
13066 eval $inlibc
13067 case "$d_gethostent_r" in
13068 "$define")
13069         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13070         case "$d_gethostent_r_proto:$usethreads" in
13071         ":define")      d_gethostent_r_proto=define
13072                 set d_gethostent_r_proto gethostent_r $hdrs
13073                 eval $hasproto ;;
13074         *)      ;;
13075         esac
13076         case "$d_gethostent_r_proto" in
13077         define)
13078         case "$gethostent_r_proto" in
13079         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13080         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13081         esac
13082         case "$gethostent_r_proto" in
13083         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13084         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13085         esac
13086         case "$gethostent_r_proto" in
13087         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13088         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13089         esac
13090         case "$gethostent_r_proto" in
13091         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13092         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13093         esac
13094         case "$gethostent_r_proto" in
13095         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13096         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13097         esac
13098         case "$gethostent_r_proto" in
13099         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13100         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13101         esac
13102         case "$gethostent_r_proto" in
13103         ''|0)   d_gethostent_r=undef
13104                 gethostent_r_proto=0
13105                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13106         * )     case "$gethostent_r_proto" in
13107                 REENTRANT_PROTO*) ;;
13108                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13109                 esac
13110                 echo "Prototype: $try" ;;
13111         esac
13112         ;;
13113         *)      case "$usethreads" in
13114                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13115                 esac
13116                 d_gethostent_r=undef
13117                 gethostent_r_proto=0
13118                 ;;
13119         esac
13120         ;;
13121 *)      gethostent_r_proto=0
13122         ;;
13123 esac
13124
13125 : see if prototypes for various gethostxxx netdb.h functions are available
13126 echo " "
13127 set d_gethostprotos gethostent $i_netdb netdb.h
13128 eval $hasproto
13129
13130 : see if getitimer exists
13131 set getitimer d_getitimer
13132 eval $inlibc
13133
13134 : see if getlogin exists
13135 set getlogin d_getlogin
13136 eval $inlibc
13137
13138 : see if getlogin_r exists
13139 set getlogin_r d_getlogin_r
13140 eval $inlibc
13141 case "$d_getlogin_r" in
13142 "$define")
13143         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13144         case "$d_getlogin_r_proto:$usethreads" in
13145         ":define")      d_getlogin_r_proto=define
13146                 set d_getlogin_r_proto getlogin_r $hdrs
13147                 eval $hasproto ;;
13148         *)      ;;
13149         esac
13150         case "$d_getlogin_r_proto" in
13151         define)
13152         case "$getlogin_r_proto" in
13153         ''|0) try='int getlogin_r(char*, size_t);'
13154         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13155         esac
13156         case "$getlogin_r_proto" in
13157         ''|0) try='int getlogin_r(char*, int);'
13158         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13159         esac
13160         case "$getlogin_r_proto" in
13161         ''|0) try='char* getlogin_r(char*, size_t);'
13162         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13163         esac
13164         case "$getlogin_r_proto" in
13165         ''|0) try='char* getlogin_r(char*, int);'
13166         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13167         esac
13168         case "$getlogin_r_proto" in
13169         ''|0)   d_getlogin_r=undef
13170                 getlogin_r_proto=0
13171                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13172         * )     case "$getlogin_r_proto" in
13173                 REENTRANT_PROTO*) ;;
13174                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13175                 esac
13176                 echo "Prototype: $try" ;;
13177         esac
13178         ;;
13179         *)      case "$usethreads" in
13180                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13181                 esac
13182                 d_getlogin_r=undef
13183                 getlogin_r_proto=0
13184                 ;;
13185         esac
13186         ;;
13187 *)      getlogin_r_proto=0
13188         ;;
13189 esac
13190
13191 : see if getmnt exists
13192 set getmnt d_getmnt
13193 eval $inlibc
13194
13195 : see if getmntent exists
13196 set getmntent d_getmntent
13197 eval $inlibc
13198
13199 : see if getnetbyaddr exists
13200 set getnetbyaddr d_getnbyaddr
13201 eval $inlibc
13202
13203 : see if getnetbyname exists
13204 set getnetbyname d_getnbyname
13205 eval $inlibc
13206
13207 : see if getnetent exists
13208 set getnetent d_getnent
13209 eval $inlibc
13210
13211 : see if getnetbyaddr_r exists
13212 set getnetbyaddr_r d_getnetbyaddr_r
13213 eval $inlibc
13214 case "$d_getnetbyaddr_r" in
13215 "$define")
13216         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13217         case "$d_getnetbyaddr_r_proto:$usethreads" in
13218         ":define")      d_getnetbyaddr_r_proto=define
13219                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13220                 eval $hasproto ;;
13221         *)      ;;
13222         esac
13223         case "$d_getnetbyaddr_r_proto" in
13224         define)
13225         case "$getnetbyaddr_r_proto" in
13226         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13227         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13228         esac
13229         case "$getnetbyaddr_r_proto" in
13230         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13231         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13232         esac
13233         case "$getnetbyaddr_r_proto" in
13234         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13235         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13236         esac
13237         case "$getnetbyaddr_r_proto" in
13238         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13239         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13240         esac
13241         case "$getnetbyaddr_r_proto" in
13242         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13243         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13244         esac
13245         case "$getnetbyaddr_r_proto" in
13246         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13247         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13248         esac
13249         case "$getnetbyaddr_r_proto" in
13250         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13251         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13252         esac
13253         case "$getnetbyaddr_r_proto" in
13254         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13255         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13256         esac
13257         case "$getnetbyaddr_r_proto" in
13258         ''|0)   d_getnetbyaddr_r=undef
13259                 getnetbyaddr_r_proto=0
13260                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13261         * )     case "$getnetbyaddr_r_proto" in
13262                 REENTRANT_PROTO*) ;;
13263                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13264                 esac
13265                 echo "Prototype: $try" ;;
13266         esac
13267         ;;
13268         *)      case "$usethreads" in
13269                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13270                 esac
13271                 d_getnetbyaddr_r=undef
13272                 getnetbyaddr_r_proto=0
13273                 ;;
13274         esac
13275         ;;
13276 *)      getnetbyaddr_r_proto=0
13277         ;;
13278 esac
13279
13280 : see if getnetbyname_r exists
13281 set getnetbyname_r d_getnetbyname_r
13282 eval $inlibc
13283 case "$d_getnetbyname_r" in
13284 "$define")
13285         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13286         case "$d_getnetbyname_r_proto:$usethreads" in
13287         ":define")      d_getnetbyname_r_proto=define
13288                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13289                 eval $hasproto ;;
13290         *)      ;;
13291         esac
13292         case "$d_getnetbyname_r_proto" in
13293         define)
13294         case "$getnetbyname_r_proto" in
13295         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13296         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13297         esac
13298         case "$getnetbyname_r_proto" in
13299         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13300         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13301         esac
13302         case "$getnetbyname_r_proto" in
13303         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13304         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13305         esac
13306         case "$getnetbyname_r_proto" in
13307         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13308         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13309         esac
13310         case "$getnetbyname_r_proto" in
13311         ''|0)   d_getnetbyname_r=undef
13312                 getnetbyname_r_proto=0
13313                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13314         * )     case "$getnetbyname_r_proto" in
13315                 REENTRANT_PROTO*) ;;
13316                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13317                 esac
13318                 echo "Prototype: $try" ;;
13319         esac
13320         ;;
13321         *)      case "$usethreads" in
13322                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13323                 esac
13324                 d_getnetbyname_r=undef
13325                 getnetbyname_r_proto=0
13326                 ;;
13327         esac
13328         ;;
13329 *)      getnetbyname_r_proto=0
13330         ;;
13331 esac
13332
13333 : see if getnetent_r exists
13334 set getnetent_r d_getnetent_r
13335 eval $inlibc
13336 case "$d_getnetent_r" in
13337 "$define")
13338         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13339         case "$d_getnetent_r_proto:$usethreads" in
13340         ":define")      d_getnetent_r_proto=define
13341                 set d_getnetent_r_proto getnetent_r $hdrs
13342                 eval $hasproto ;;
13343         *)      ;;
13344         esac
13345         case "$d_getnetent_r_proto" in
13346         define)
13347         case "$getnetent_r_proto" in
13348         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13349         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13350         esac
13351         case "$getnetent_r_proto" in
13352         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13353         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13354         esac
13355         case "$getnetent_r_proto" in
13356         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13357         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13358         esac
13359         case "$getnetent_r_proto" in
13360         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13361         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13362         esac
13363         case "$getnetent_r_proto" in
13364         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13365         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13366         esac
13367         case "$getnetent_r_proto" in
13368         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13369         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13370         esac
13371         case "$getnetent_r_proto" in
13372         ''|0)   d_getnetent_r=undef
13373                 getnetent_r_proto=0
13374                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13375         * )     case "$getnetent_r_proto" in
13376                 REENTRANT_PROTO*) ;;
13377                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13378                 esac
13379                 echo "Prototype: $try" ;;
13380         esac
13381         ;;
13382         *)      case "$usethreads" in
13383                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13384                 esac
13385                 d_getnetent_r=undef
13386                 getnetent_r_proto=0
13387                 ;;
13388         esac
13389         ;;
13390 *)      getnetent_r_proto=0
13391         ;;
13392 esac
13393
13394 : see if prototypes for various getnetxxx netdb.h functions are available
13395 echo " "
13396 set d_getnetprotos getnetent $i_netdb netdb.h
13397 eval $hasproto
13398
13399 : see if getpagesize exists
13400 set getpagesize d_getpagsz
13401 eval $inlibc
13402
13403
13404 : see if getprotobyname exists
13405 set getprotobyname d_getpbyname
13406 eval $inlibc
13407
13408 : see if getprotobynumber exists
13409 set getprotobynumber d_getpbynumber
13410 eval $inlibc
13411
13412 : see if getprotoent exists
13413 set getprotoent d_getpent
13414 eval $inlibc
13415
13416 : see if getpgid exists
13417 set getpgid d_getpgid
13418 eval $inlibc
13419
13420 : see if getpgrp2 exists
13421 set getpgrp2 d_getpgrp2
13422 eval $inlibc
13423
13424 : see if getppid exists
13425 set getppid d_getppid
13426 eval $inlibc
13427
13428 : see if getpriority exists
13429 set getpriority d_getprior
13430 eval $inlibc
13431
13432 : see if getprotobyname_r exists
13433 set getprotobyname_r d_getprotobyname_r
13434 eval $inlibc
13435 case "$d_getprotobyname_r" in
13436 "$define")
13437         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13438         case "$d_getprotobyname_r_proto:$usethreads" in
13439         ":define")      d_getprotobyname_r_proto=define
13440                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13441                 eval $hasproto ;;
13442         *)      ;;
13443         esac
13444         case "$d_getprotobyname_r_proto" in
13445         define)
13446         case "$getprotobyname_r_proto" in
13447         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13448         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13449         esac
13450         case "$getprotobyname_r_proto" in
13451         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13452         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13453         esac
13454         case "$getprotobyname_r_proto" in
13455         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13456         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13457         esac
13458         case "$getprotobyname_r_proto" in
13459         ''|0)   d_getprotobyname_r=undef
13460                 getprotobyname_r_proto=0
13461                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13462         * )     case "$getprotobyname_r_proto" in
13463                 REENTRANT_PROTO*) ;;
13464                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13465                 esac
13466                 echo "Prototype: $try" ;;
13467         esac
13468         ;;
13469         *)      case "$usethreads" in
13470                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13471                 esac
13472                 d_getprotobyname_r=undef
13473                 getprotobyname_r_proto=0
13474                 ;;
13475         esac
13476         ;;
13477 *)      getprotobyname_r_proto=0
13478         ;;
13479 esac
13480
13481 : see if getprotobynumber_r exists
13482 set getprotobynumber_r d_getprotobynumber_r
13483 eval $inlibc
13484 case "$d_getprotobynumber_r" in
13485 "$define")
13486         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13487         case "$d_getprotobynumber_r_proto:$usethreads" in
13488         ":define")      d_getprotobynumber_r_proto=define
13489                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13490                 eval $hasproto ;;
13491         *)      ;;
13492         esac
13493         case "$d_getprotobynumber_r_proto" in
13494         define)
13495         case "$getprotobynumber_r_proto" in
13496         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13497         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13498         esac
13499         case "$getprotobynumber_r_proto" in
13500         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13501         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13502         esac
13503         case "$getprotobynumber_r_proto" in
13504         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13505         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13506         esac
13507         case "$getprotobynumber_r_proto" in
13508         ''|0)   d_getprotobynumber_r=undef
13509                 getprotobynumber_r_proto=0
13510                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13511         * )     case "$getprotobynumber_r_proto" in
13512                 REENTRANT_PROTO*) ;;
13513                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13514                 esac
13515                 echo "Prototype: $try" ;;
13516         esac
13517         ;;
13518         *)      case "$usethreads" in
13519                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13520                 esac
13521                 d_getprotobynumber_r=undef
13522                 getprotobynumber_r_proto=0
13523                 ;;
13524         esac
13525         ;;
13526 *)      getprotobynumber_r_proto=0
13527         ;;
13528 esac
13529
13530 : see if getprotoent_r exists
13531 set getprotoent_r d_getprotoent_r
13532 eval $inlibc
13533 case "$d_getprotoent_r" in
13534 "$define")
13535         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13536         case "$d_getprotoent_r_proto:$usethreads" in
13537         ":define")      d_getprotoent_r_proto=define
13538                 set d_getprotoent_r_proto getprotoent_r $hdrs
13539                 eval $hasproto ;;
13540         *)      ;;
13541         esac
13542         case "$d_getprotoent_r_proto" in
13543         define)
13544         case "$getprotoent_r_proto" in
13545         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13546         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13547         esac
13548         case "$getprotoent_r_proto" in
13549         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13550         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13551         esac
13552         case "$getprotoent_r_proto" in
13553         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13554         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13555         esac
13556         case "$getprotoent_r_proto" in
13557         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13558         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13559         esac
13560         case "$getprotoent_r_proto" in
13561         ''|0)   d_getprotoent_r=undef
13562                 getprotoent_r_proto=0
13563                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13564         * )     case "$getprotoent_r_proto" in
13565                 REENTRANT_PROTO*) ;;
13566                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13567                 esac
13568                 echo "Prototype: $try" ;;
13569         esac
13570         ;;
13571         *)      case "$usethreads" in
13572                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13573                 esac
13574                 d_getprotoent_r=undef
13575                 getprotoent_r_proto=0
13576                 ;;
13577         esac
13578         ;;
13579 *)      getprotoent_r_proto=0
13580         ;;
13581 esac
13582
13583 : see if prototypes for various getprotoxxx netdb.h functions are available
13584 echo " "
13585 set d_getprotoprotos getprotoent $i_netdb netdb.h
13586 eval $hasproto
13587
13588 : see if getprpwnam exists
13589 set getprpwnam d_getprpwnam
13590 eval $inlibc
13591
13592 : see if getpwent exists
13593 set getpwent d_getpwent
13594 eval $inlibc
13595
13596 : see if getpwent_r exists
13597 set getpwent_r d_getpwent_r
13598 eval $inlibc
13599 case "$d_getpwent_r" in
13600 "$define")
13601         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13602         case "$d_getpwent_r_proto:$usethreads" in
13603         ":define")      d_getpwent_r_proto=define
13604                 set d_getpwent_r_proto getpwent_r $hdrs
13605                 eval $hasproto ;;
13606         *)      ;;
13607         esac
13608         case "$d_getpwent_r_proto" in
13609         define)
13610         case "$getpwent_r_proto" in
13611         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13612         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13613         esac
13614         case "$getpwent_r_proto" in
13615         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13616         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13617         esac
13618         case "$getpwent_r_proto" in
13619         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13620         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13621         esac
13622         case "$getpwent_r_proto" in
13623         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13624         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13625         esac
13626         case "$getpwent_r_proto" in
13627         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13628         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13629         esac
13630         case "$getpwent_r_proto" in
13631         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13632         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13633         esac
13634         case "$getpwent_r_proto" in
13635         ''|0)   d_getpwent_r=undef
13636                 getpwent_r_proto=0
13637                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13638         * )     case "$getpwent_r_proto" in
13639                 REENTRANT_PROTO*) ;;
13640                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13641                 esac
13642                 echo "Prototype: $try" ;;
13643         esac
13644         ;;
13645         *)      case "$usethreads" in
13646                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13647                 esac
13648                 d_getpwent_r=undef
13649                 getpwent_r_proto=0
13650                 ;;
13651         esac
13652         ;;
13653 *)      getpwent_r_proto=0
13654         ;;
13655 esac
13656
13657 : see if getpwnam_r exists
13658 set getpwnam_r d_getpwnam_r
13659 eval $inlibc
13660 case "$d_getpwnam_r" in
13661 "$define")
13662         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13663         case "$d_getpwnam_r_proto:$usethreads" in
13664         ":define")      d_getpwnam_r_proto=define
13665                 set d_getpwnam_r_proto getpwnam_r $hdrs
13666                 eval $hasproto ;;
13667         *)      ;;
13668         esac
13669         case "$d_getpwnam_r_proto" in
13670         define)
13671         case "$getpwnam_r_proto" in
13672         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13673         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13674         esac
13675         case "$getpwnam_r_proto" in
13676         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13677         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13678         esac
13679         case "$getpwnam_r_proto" in
13680         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13681         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13682         esac
13683         case "$getpwnam_r_proto" in
13684         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13685         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13686         esac
13687         case "$getpwnam_r_proto" in
13688         ''|0)   d_getpwnam_r=undef
13689                 getpwnam_r_proto=0
13690                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13691         * )     case "$getpwnam_r_proto" in
13692                 REENTRANT_PROTO*) ;;
13693                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13694                 esac
13695                 echo "Prototype: $try" ;;
13696         esac
13697         ;;
13698         *)      case "$usethreads" in
13699                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13700                 esac
13701                 d_getpwnam_r=undef
13702                 getpwnam_r_proto=0
13703                 ;;
13704         esac
13705         ;;
13706 *)      getpwnam_r_proto=0
13707         ;;
13708 esac
13709
13710 : see if getpwuid_r exists
13711 set getpwuid_r d_getpwuid_r
13712 eval $inlibc
13713 case "$d_getpwuid_r" in
13714 "$define")
13715         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13716         case "$d_getpwuid_r_proto:$usethreads" in
13717         ":define")      d_getpwuid_r_proto=define
13718                 set d_getpwuid_r_proto getpwuid_r $hdrs
13719                 eval $hasproto ;;
13720         *)      ;;
13721         esac
13722         case "$d_getpwuid_r_proto" in
13723         define)
13724         case "$getpwuid_r_proto" in
13725         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13726         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13727         esac
13728         case "$getpwuid_r_proto" in
13729         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13730         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13731         esac
13732         case "$getpwuid_r_proto" in
13733         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13734         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13735         esac
13736         case "$getpwuid_r_proto" in
13737         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13738         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13739         esac
13740         case "$getpwuid_r_proto" in
13741         ''|0)   d_getpwuid_r=undef
13742                 getpwuid_r_proto=0
13743                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13744         * )     case "$getpwuid_r_proto" in
13745                 REENTRANT_PROTO*) ;;
13746                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13747                 esac
13748                 echo "Prototype: $try" ;;
13749         esac
13750         ;;
13751         *)      case "$usethreads" in
13752                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13753                 esac
13754                 d_getpwuid_r=undef
13755                 getpwuid_r_proto=0
13756                 ;;
13757         esac
13758         ;;
13759 *)      getpwuid_r_proto=0
13760         ;;
13761 esac
13762
13763
13764 : see if getservbyname exists
13765 set getservbyname d_getsbyname
13766 eval $inlibc
13767
13768 : see if getservbyport exists
13769 set getservbyport d_getsbyport
13770 eval $inlibc
13771
13772 : see if getservent exists
13773 set getservent d_getsent
13774 eval $inlibc
13775
13776 : see if getservbyname_r exists
13777 set getservbyname_r d_getservbyname_r
13778 eval $inlibc
13779 case "$d_getservbyname_r" in
13780 "$define")
13781         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13782         case "$d_getservbyname_r_proto:$usethreads" in
13783         ":define")      d_getservbyname_r_proto=define
13784                 set d_getservbyname_r_proto getservbyname_r $hdrs
13785                 eval $hasproto ;;
13786         *)      ;;
13787         esac
13788         case "$d_getservbyname_r_proto" in
13789         define)
13790         case "$getservbyname_r_proto" in
13791         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13792         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13793         esac
13794         case "$getservbyname_r_proto" in
13795         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13796         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13797         esac
13798         case "$getservbyname_r_proto" in
13799         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13800         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13801         esac
13802         case "$getservbyname_r_proto" in
13803         ''|0)   d_getservbyname_r=undef
13804                 getservbyname_r_proto=0
13805                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13806         * )     case "$getservbyname_r_proto" in
13807                 REENTRANT_PROTO*) ;;
13808                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13809                 esac
13810                 echo "Prototype: $try" ;;
13811         esac
13812         ;;
13813         *)      case "$usethreads" in
13814                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13815                 esac
13816                 d_getservbyname_r=undef
13817                 getservbyname_r_proto=0
13818                 ;;
13819         esac
13820         ;;
13821 *)      getservbyname_r_proto=0
13822         ;;
13823 esac
13824
13825 : see if getservbyport_r exists
13826 set getservbyport_r d_getservbyport_r
13827 eval $inlibc
13828 case "$d_getservbyport_r" in
13829 "$define")
13830         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13831         case "$d_getservbyport_r_proto:$usethreads" in
13832         ":define")      d_getservbyport_r_proto=define
13833                 set d_getservbyport_r_proto getservbyport_r $hdrs
13834                 eval $hasproto ;;
13835         *)      ;;
13836         esac
13837         case "$d_getservbyport_r_proto" in
13838         define)
13839         case "$getservbyport_r_proto" in
13840         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13841         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13842         esac
13843         case "$getservbyport_r_proto" in
13844         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13845         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13846         esac
13847         case "$getservbyport_r_proto" in
13848         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13849         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13850         esac
13851         case "$getservbyport_r_proto" in
13852         ''|0)   d_getservbyport_r=undef
13853                 getservbyport_r_proto=0
13854                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13855         * )     case "$getservbyport_r_proto" in
13856                 REENTRANT_PROTO*) ;;
13857                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13858                 esac
13859                 echo "Prototype: $try" ;;
13860         esac
13861         ;;
13862         *)      case "$usethreads" in
13863                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13864                 esac
13865                 d_getservbyport_r=undef
13866                 getservbyport_r_proto=0
13867                 ;;
13868         esac
13869         ;;
13870 *)      getservbyport_r_proto=0
13871         ;;
13872 esac
13873
13874 : see if getservent_r exists
13875 set getservent_r d_getservent_r
13876 eval $inlibc
13877 case "$d_getservent_r" in
13878 "$define")
13879         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13880         case "$d_getservent_r_proto:$usethreads" in
13881         ":define")      d_getservent_r_proto=define
13882                 set d_getservent_r_proto getservent_r $hdrs
13883                 eval $hasproto ;;
13884         *)      ;;
13885         esac
13886         case "$d_getservent_r_proto" in
13887         define)
13888         case "$getservent_r_proto" in
13889         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13890         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13891         esac
13892         case "$getservent_r_proto" in
13893         ''|0) try='int getservent_r(struct servent*, char*, int);'
13894         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13895         esac
13896         case "$getservent_r_proto" in
13897         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13898         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13899         esac
13900         case "$getservent_r_proto" in
13901         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13902         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13903         esac
13904         case "$getservent_r_proto" in
13905         ''|0)   d_getservent_r=undef
13906                 getservent_r_proto=0
13907                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13908         * )     case "$getservent_r_proto" in
13909                 REENTRANT_PROTO*) ;;
13910                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13911                 esac
13912                 echo "Prototype: $try" ;;
13913         esac
13914         ;;
13915         *)      case "$usethreads" in
13916                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13917                 esac
13918                 d_getservent_r=undef
13919                 getservent_r_proto=0
13920                 ;;
13921         esac
13922         ;;
13923 *)      getservent_r_proto=0
13924         ;;
13925 esac
13926
13927 : see if prototypes for various getservxxx netdb.h functions are available
13928 echo " "
13929 set d_getservprotos getservent $i_netdb netdb.h
13930 eval $hasproto
13931
13932 : see if getspnam exists
13933 set getspnam d_getspnam
13934 eval $inlibc
13935
13936 : see if this is a shadow.h system
13937 set shadow.h i_shadow
13938 eval $inhdr
13939
13940 : see if getspnam_r exists
13941 set getspnam_r d_getspnam_r
13942 eval $inlibc
13943 case "$d_getspnam_r" in
13944 "$define")
13945         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13946         case "$d_getspnam_r_proto:$usethreads" in
13947         ":define")      d_getspnam_r_proto=define
13948                 set d_getspnam_r_proto getspnam_r $hdrs
13949                 eval $hasproto ;;
13950         *)      ;;
13951         esac
13952         case "$d_getspnam_r_proto" in
13953         define)
13954         case "$getspnam_r_proto" in
13955         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13956         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13957         esac
13958         case "$getspnam_r_proto" in
13959         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13960         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13961         esac
13962         case "$getspnam_r_proto" in
13963         ''|0)   d_getspnam_r=undef
13964                 getspnam_r_proto=0
13965                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13966         * )     case "$getspnam_r_proto" in
13967                 REENTRANT_PROTO*) ;;
13968                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13969                 esac
13970                 echo "Prototype: $try" ;;
13971         esac
13972         ;;
13973         *)      case "$usethreads" in
13974                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13975                 esac
13976                 d_getspnam_r=undef
13977                 getspnam_r_proto=0
13978                 ;;
13979         esac
13980         ;;
13981 *)      getspnam_r_proto=0
13982         ;;
13983 esac
13984
13985 : see if gettimeofday or ftime exists
13986 set gettimeofday d_gettimeod
13987 eval $inlibc
13988 case "$d_gettimeod" in
13989 "$undef")
13990         set ftime d_ftime 
13991         eval $inlibc
13992         ;;
13993 *)
13994         val="$undef"; set d_ftime; eval $setvar
13995         ;;
13996 esac
13997 case "$d_gettimeod$d_ftime" in
13998 "$undef$undef")
13999         echo " "
14000         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14001         ;;
14002 esac
14003
14004 : see if gmtime_r exists
14005 set gmtime_r d_gmtime_r
14006 eval $inlibc
14007 case "$d_gmtime_r" in
14008 "$define")
14009         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14010         case "$d_gmtime_r_proto:$usethreads" in
14011         ":define")      d_gmtime_r_proto=define
14012                 set d_gmtime_r_proto gmtime_r $hdrs
14013                 eval $hasproto ;;
14014         *)      ;;
14015         esac
14016         case "$d_gmtime_r_proto" in
14017         define)
14018         case "$gmtime_r_proto" in
14019         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14020         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14021         esac
14022         case "$gmtime_r_proto" in
14023         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14024         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14025         esac
14026         case "$gmtime_r_proto" in
14027         ''|0)   d_gmtime_r=undef
14028                 gmtime_r_proto=0
14029                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14030         * )     case "$gmtime_r_proto" in
14031                 REENTRANT_PROTO*) ;;
14032                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14033                 esac
14034                 echo "Prototype: $try" ;;
14035         esac
14036         ;;
14037         *)      case "$usethreads" in
14038                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14039                 esac
14040                 d_gmtime_r=undef
14041                 gmtime_r_proto=0
14042                 ;;
14043         esac
14044         ;;
14045 *)      gmtime_r_proto=0
14046         ;;
14047 esac
14048
14049 : see if hasmntopt exists
14050 set hasmntopt d_hasmntopt
14051 eval $inlibc
14052
14053 : see if this is a netinet/in.h or sys/in.h system
14054 set netinet/in.h i_niin sys/in.h i_sysin
14055 eval $inhdr
14056
14057 : see if arpa/inet.h has to be included
14058 set arpa/inet.h i_arpainet
14059 eval $inhdr
14060
14061 : see if htonl --and friends-- exists
14062 val=''
14063 set htonl val
14064 eval $inlibc
14065
14066 : Maybe they are macros.
14067 case "$val" in
14068 $undef)
14069         $cat >htonl.c <<EOM
14070 #include <stdio.h>
14071 #include <sys/types.h>
14072 #$i_niin I_NETINET_IN
14073 #$i_sysin I_SYS_IN
14074 #$i_arpainet I_ARPA_INET
14075 #ifdef I_NETINET_IN
14076 #include <netinet/in.h>
14077 #endif
14078 #ifdef I_SYS_IN
14079 #include <sys/in.h>
14080 #endif
14081 #ifdef I_ARPA_INET
14082 #include <arpa/inet.h>
14083 #endif
14084 #ifdef htonl
14085 printf("Defined as a macro.");
14086 #endif
14087 EOM
14088         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14089         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14090                 val="$define"
14091                 echo "But it seems to be defined as a macro." >&4
14092         fi
14093         $rm -f htonl.?
14094         ;;
14095 esac
14096 set d_htonl
14097 eval $setvar
14098
14099 : see if ilogbl exists
14100 set ilogbl d_ilogbl
14101 eval $inlibc
14102
14103 : index or strchr
14104 echo " "
14105 if set index val -f; eval $csym; $val; then
14106         if set strchr val -f d_strchr; eval $csym; $val; then
14107                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14108                         val="$define"
14109                         vali="$undef"
14110                         echo "strchr() found." >&4
14111                 else
14112                         val="$undef"
14113                         vali="$define"
14114                         echo "index() found." >&4
14115                 fi
14116         else
14117                 val="$undef"
14118                 vali="$define"
14119                 echo "index() found." >&4
14120         fi
14121 else
14122         if set strchr val -f d_strchr; eval $csym; $val; then
14123                 val="$define"
14124                 vali="$undef"
14125                 echo "strchr() found." >&4
14126         else
14127                 echo "No index() or strchr() found!" >&4
14128                 val="$undef"
14129                 vali="$undef"
14130         fi
14131 fi
14132 set d_strchr; eval $setvar
14133 val="$vali"
14134 set d_index; eval $setvar
14135
14136 : check whether inet_aton exists
14137 set inet_aton d_inetaton
14138 eval $inlibc
14139
14140 : Look for isascii
14141 echo " "
14142 $cat >isascii.c <<EOCP
14143 #include <stdio.h>
14144 #include <ctype.h>
14145 #$i_stdlib I_STDLIB
14146 #ifdef I_STDLIB
14147 #include <stdlib.h>
14148 #endif
14149 int main() {
14150         int c = 'A';
14151         if (isascii(c))
14152                 exit(0);
14153         else
14154                 exit(1);
14155 }
14156 EOCP
14157 set isascii
14158 if eval $compile; then
14159         echo "isascii() found." >&4
14160         val="$define"
14161 else
14162         echo "isascii() NOT found." >&4
14163         val="$undef"
14164 fi
14165 set d_isascii
14166 eval $setvar
14167 $rm -f isascii*
14168
14169 : see if isfinite exists
14170 set isfinite d_isfinite
14171 eval $inlibc
14172
14173 : see if isinf exists
14174 set isinf d_isinf
14175 eval $inlibc
14176
14177 : see if isnan exists
14178 set isnan d_isnan
14179 eval $inlibc
14180
14181 : see if isnanl exists
14182 set isnanl d_isnanl
14183 eval $inlibc
14184
14185 : see if killpg exists
14186 set killpg d_killpg
14187 eval $inlibc
14188
14189 : see if lchown exists
14190 echo " "
14191 $cat > try.c <<'EOCP'
14192 /* System header to define __stub macros and hopefully few prototypes,
14193     which can conflict with char lchown(); below.  */
14194 #include <assert.h>
14195 /* Override any gcc2 internal prototype to avoid an error.  */
14196 /* We use char because int might match the return type of a gcc2
14197    builtin and then its argument prototype would still apply.  */
14198 char lchown();
14199 int main() {
14200     /*  The GNU C library defines this for functions which it implements
14201         to always fail with ENOSYS.  Some functions are actually named
14202         something starting with __ and the normal name is an alias.  */
14203 #if defined (__stub_lchown) || defined (__stub___lchown)
14204 choke me
14205 #else
14206 lchown();
14207 #endif
14208 ; return 0; }
14209 EOCP
14210 set try
14211 if eval $compile; then
14212     $echo "lchown() found." >&4
14213     val="$define"
14214 else
14215     $echo "lchown() NOT found." >&4
14216     val="$undef"
14217 fi
14218 set d_lchown
14219 eval $setvar
14220
14221 : See if number of significant digits in a double precision number is known
14222 echo " "
14223 $cat >ldbl_dig.c <<EOM
14224 #$i_limits I_LIMITS
14225 #$i_float I_FLOAT
14226 #ifdef I_LIMITS
14227 #include <limits.h>
14228 #endif
14229 #ifdef I_FLOAT
14230 #include <float.h>
14231 #endif
14232 #ifdef LDBL_DIG
14233 printf("Contains LDBL_DIG");
14234 #endif
14235 EOM
14236 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14237 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14238         echo "LDBL_DIG found." >&4
14239         val="$define"
14240 else
14241         echo "LDBL_DIG NOT found." >&4
14242         val="$undef"
14243 fi
14244 $rm -f ldbl_dig.?
14245 set d_ldbl_dig
14246 eval $setvar
14247
14248 : see if this is a math.h system
14249 set math.h i_math
14250 eval $inhdr
14251
14252 d_libm_lib_version="$undef"
14253 case $i_math in
14254     $define)
14255         : check to see if math.h defines _LIB_VERSION
14256         echo " "
14257         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14258         $cat >try.c <<EOCP
14259 #include <unistd.h>
14260 #include <math.h>
14261 int main (int argc, char *argv[])
14262 {
14263     printf ("%d\n", _LIB_VERSION);
14264     return (0);
14265     } /* main */
14266 EOCP
14267         set try
14268         if eval $compile; then
14269             foo=`$run ./try`
14270             echo "Yes, it does ($foo)" >&4
14271             d_libm_lib_version="$define"
14272         else
14273             echo "No, it does not (probably harmless)\n" >&4
14274             fi
14275         $rm -f try.* try core core.try.*
14276         ;;
14277
14278     esac
14279
14280 : see if link exists
14281 set link d_link
14282 eval $inlibc
14283
14284 : see if localtime_r exists
14285 set localtime_r d_localtime_r
14286 eval $inlibc
14287 case "$d_localtime_r" in
14288 "$define")
14289         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14290         case "$d_localtime_r_proto:$usethreads" in
14291         ":define")      d_localtime_r_proto=define
14292                 set d_localtime_r_proto localtime_r $hdrs
14293                 eval $hasproto ;;
14294         *)      ;;
14295         esac
14296         case "$d_localtime_r_proto" in
14297         define)
14298         case "$localtime_r_proto" in
14299         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14300         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14301         esac
14302         case "$localtime_r_proto" in
14303         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14304         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14305         esac
14306         case "$localtime_r_proto" in
14307         ''|0)   d_localtime_r=undef
14308                 localtime_r_proto=0
14309                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14310         * )     case "$localtime_r_proto" in
14311                 REENTRANT_PROTO*) ;;
14312                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14313                 esac
14314                 echo "Prototype: $try" ;;
14315         esac
14316         ;;
14317         *)      case "$usethreads" in
14318                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14319                 esac
14320                 d_localtime_r=undef
14321                 localtime_r_proto=0
14322                 ;;
14323         esac
14324         ;;
14325 *)      localtime_r_proto=0
14326         ;;
14327 esac
14328
14329 : see if localeconv exists
14330 set localeconv d_locconv
14331 eval $inlibc
14332
14333 : see if lockf exists
14334 set lockf d_lockf
14335 eval $inlibc
14336
14337 : see if prototype for lseek is available
14338 echo " "
14339 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14340 eval $hasproto
14341
14342 : see if lstat exists
14343 set lstat d_lstat
14344 eval $inlibc
14345
14346 : see if madvise exists
14347 set madvise d_madvise
14348 eval $inlibc
14349
14350 : see if malloc_size exists
14351 set malloc_size d_malloc_size
14352 eval $inlibc
14353
14354 : see if malloc_size_good exists
14355 set malloc_good_size d_malloc_good_size
14356 eval $inlibc
14357
14358 : see if mblen exists
14359 set mblen d_mblen
14360 eval $inlibc
14361
14362 : see if mbstowcs exists
14363 set mbstowcs d_mbstowcs
14364 eval $inlibc
14365
14366 : see if mbtowc exists
14367 set mbtowc d_mbtowc
14368 eval $inlibc
14369
14370 : see if memchr exists
14371 set memchr d_memchr
14372 eval $inlibc
14373
14374 : see if memcmp exists
14375 set memcmp d_memcmp
14376 eval $inlibc
14377
14378 : see if memcpy exists
14379 set memcpy d_memcpy
14380 eval $inlibc
14381
14382 : see if memmove exists
14383 set memmove d_memmove
14384 eval $inlibc
14385
14386 : see if memset exists
14387 set memset d_memset
14388 eval $inlibc
14389
14390 : see if mkdir exists
14391 set mkdir d_mkdir
14392 eval $inlibc
14393
14394 : see if mkdtemp exists
14395 set mkdtemp d_mkdtemp
14396 eval $inlibc
14397
14398 : see if mkfifo exists
14399 set mkfifo d_mkfifo
14400 eval $inlibc
14401
14402 : see if mkstemp exists
14403 set mkstemp d_mkstemp
14404 eval $inlibc
14405
14406 : see if mkstemps exists
14407 set mkstemps d_mkstemps
14408 eval $inlibc
14409
14410 : see if mktime exists
14411 set mktime d_mktime
14412 eval $inlibc
14413
14414 : see if this is a sys/mman.h system
14415 set sys/mman.h i_sysmman
14416 eval $inhdr
14417
14418 : see if mmap exists
14419 set mmap d_mmap
14420 eval $inlibc
14421 : see what shmat returns
14422 : default to something harmless
14423 mmaptype='void *'
14424 case "$i_sysmman$d_mmap" in
14425 "$define$define")
14426         $cat >mmap.c <<'END'
14427 #include <sys/mman.h>
14428 void *mmap();
14429 END
14430         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14431                 mmaptype='void *'
14432         else
14433                 mmaptype='caddr_t'
14434         fi
14435         echo "and it returns ($mmaptype)." >&4
14436         ;;
14437 esac
14438
14439
14440
14441 : see if sqrtl exists
14442 set sqrtl d_sqrtl
14443 eval $inlibc
14444
14445 : see if scalbnl exists
14446 set scalbnl d_scalbnl
14447 eval $inlibc
14448
14449 : see if modfl exists
14450 set modfl d_modfl
14451 eval $inlibc
14452
14453 : see if prototype for modfl is available
14454 echo " "
14455 set d_modflproto modfl $i_math math.h
14456 eval $hasproto
14457
14458 d_modfl_pow32_bug="$undef"
14459
14460 case "$d_longdbl$d_modfl" in
14461 $define$define)
14462         $cat <<EOM
14463 Checking to see whether your modfl() is okay for large values...
14464 EOM
14465 $cat >try.c <<EOCP
14466 #include <math.h> 
14467 #include <stdio.h>
14468 EOCP
14469 if $test "X$d_modflproto" != "X$define"; then
14470         $cat >>try.c <<EOCP
14471 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14472 long double modfl (long double, long double *);
14473 EOCP
14474 fi
14475 $cat >>try.c <<EOCP
14476 int main() {
14477     long double nv = 4294967303.15;
14478     long double v, w;
14479     v = modfl(nv, &w);         
14480 #ifdef __GLIBC__
14481     printf("glibc");
14482 #endif
14483     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14484     return 0;
14485 }
14486 EOCP
14487         case "$osname:$gccversion" in
14488         aix:)   saveccflags="$ccflags"
14489                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14490         esac
14491         set try
14492         if eval $compile; then
14493                 foo=`$run ./try`
14494                 case "$foo" in
14495                 *" 4294967303.150000 1.150000 4294967302.000000")
14496                         echo >&4 "Your modfl() is broken for large values."
14497                         d_modfl_pow32_bug="$define"
14498                         case "$foo" in
14499                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14500                         ;;
14501                         esac
14502                         ;;
14503                 *" 4294967303.150000 0.150000 4294967303.000000")
14504                         echo >&4 "Your modfl() seems okay for large values."
14505                         ;;
14506                 *)      echo >&4 "I don't understand your modfl() at all."
14507                         d_modfl="$undef"
14508                         ;;
14509                 esac
14510                 $rm -f try.* try core core.try.*
14511         else
14512                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14513                 d_modfl="$undef"
14514         fi
14515         case "$osname:$gccversion" in
14516         aix:)   ccflags="$saveccflags" ;; # restore
14517         esac
14518         ;;
14519 esac
14520
14521 if $test "$uselongdouble" = "$define"; then
14522     message=""
14523     if $test "$d_sqrtl" != "$define"; then
14524         message="$message sqrtl"
14525     fi
14526     if $test "$d_modfl" != "$define"; then
14527         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14528             echo "You have both aintl and copysignl, so I can emulate modfl."
14529         else
14530             message="$message modfl"
14531         fi
14532     fi
14533     if $test "$d_frexpl" != "$define"; then
14534         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14535             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14536         else
14537             message="$message frexpl"
14538         fi
14539     fi
14540
14541     if $test "$message" != ""; then
14542         $cat <<EOM >&4
14543
14544 *** You requested the use of long doubles but you do not seem to have
14545 *** the following mathematical functions needed for long double support:
14546 ***    $message
14547 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14548 *** Cannot continue, aborting.
14549
14550 EOM
14551
14552         exit 1
14553     fi
14554 fi
14555
14556 : see if mprotect exists
14557 set mprotect d_mprotect
14558 eval $inlibc
14559
14560 : see if msgctl exists
14561 set msgctl d_msgctl
14562 eval $inlibc
14563
14564 : see if msgget exists
14565 set msgget d_msgget
14566 eval $inlibc
14567
14568 : see if msgsnd exists
14569 set msgsnd d_msgsnd
14570 eval $inlibc
14571
14572 : see if msgrcv exists
14573 set msgrcv d_msgrcv
14574 eval $inlibc
14575
14576 : see how much of the 'msg*(2)' library is present.
14577 h_msg=true
14578 echo " "
14579 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14580 *"$undef"*) h_msg=false;;
14581 esac
14582 case "$osname" in
14583 freebsd)
14584     case "`ipcs 2>&1`" in
14585     "SVID messages"*"not configured"*)
14586         echo "Your $osname does not have the msg*(2) configured." >&4
14587         h_msg=false
14588         val="$undef"
14589         set msgctl d_msgctl
14590         eval $setvar
14591         set msgget d_msgget
14592         eval $setvar
14593         set msgsnd d_msgsnd
14594         eval $setvar
14595         set msgrcv d_msgrcv
14596         eval $setvar
14597         ;;
14598     esac
14599     ;;
14600 esac
14601 : we could also check for sys/ipc.h ...
14602 if $h_msg && $test `./findhdr sys/msg.h`; then
14603         echo "You have the full msg*(2) library." >&4
14604         val="$define"
14605 else
14606         echo "You don't have the full msg*(2) library." >&4
14607         val="$undef"
14608 fi
14609 set d_msg
14610 eval $setvar
14611
14612
14613 echo " "
14614 echo "Checking to see if your system supports struct msghdr..." >&4
14615 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14616 eval $hasstruct
14617 case "$d_msghdr_s" in
14618 "$define")      echo "Yes, it does."   ;;
14619 *)              echo "No, it doesn't." ;;
14620 esac
14621
14622
14623 : see if msync exists
14624 set msync d_msync
14625 eval $inlibc
14626
14627 : see if munmap exists
14628 set munmap d_munmap
14629 eval $inlibc
14630
14631 : see if nice exists
14632 set nice d_nice
14633 eval $inlibc
14634
14635 : see if this is a langinfo.h system
14636 set langinfo.h i_langinfo
14637 eval $inhdr
14638
14639 : see if nl_langinfo exists
14640 set nl_langinfo d_nl_langinfo
14641 eval $inlibc
14642
14643 : check for length of character
14644 echo " "
14645 case "$charsize" in
14646 '')
14647         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14648         $cat >try.c <<EOCP
14649 #include <stdio.h>
14650 #$i_stdlib I_STDLIB
14651 #ifdef I_STDLIB
14652 #include <stdlib.h>
14653 #endif
14654 int main()
14655 {
14656     printf("%d\n", (int)sizeof(char));
14657     exit(0);
14658 }
14659 EOCP
14660         set try
14661         if eval $compile_ok; then
14662                 dflt=`$run ./try`
14663         else
14664                 dflt='1'
14665                 echo "(I can't seem to compile the test program.  Guessing...)"
14666         fi
14667         ;;
14668 *)
14669         dflt="$charsize"
14670         ;;
14671 esac
14672 rp="What is the size of a character (in bytes)?"
14673 . ./myread
14674 charsize="$ans"
14675 $rm -f try.c try
14676
14677 : check for volatile keyword
14678 echo " "
14679 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14680 $cat >try.c <<'EOCP'
14681 int main()
14682 {
14683         typedef struct _goo_struct goo_struct;
14684         goo_struct * volatile goo = ((goo_struct *)0);
14685         struct _goo_struct {
14686                 long long_int;
14687                 int reg_int;
14688                 char char_var;
14689         };
14690         typedef unsigned short foo_t;
14691         char *volatile foo;
14692         volatile int bar;
14693         volatile foo_t blech;
14694         foo = foo;
14695 }
14696 EOCP
14697 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14698         val="$define"
14699         echo "Yup, it does."
14700 else
14701         val="$undef"
14702         echo "Nope, it doesn't."
14703 fi
14704 set d_volatile
14705 eval $setvar
14706 $rm -f try.*
14707
14708
14709 echo " "
14710 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14711
14712 case "$use64bitint:$d_quad:$quadtype" in
14713 define:define:?*)
14714         ivtype="$quadtype"
14715         uvtype="$uquadtype"
14716         ivsize=8
14717         uvsize=8
14718         ;;
14719 *)      ivtype="long"
14720         uvtype="unsigned long"
14721         ivsize=$longsize
14722         uvsize=$longsize
14723         ;;
14724 esac
14725
14726 case "$uselongdouble:$d_longdbl" in
14727 define:define)
14728         nvtype="long double"
14729         nvsize=$longdblsize
14730         ;;
14731 *)      nvtype=double
14732         nvsize=$doublesize
14733         ;;
14734 esac
14735
14736 $echo "(IV will be "$ivtype", $ivsize bytes)"
14737 $echo "(UV will be "$uvtype", $uvsize bytes)"
14738 $echo "(NV will be "$nvtype", $nvsize bytes)"
14739
14740 $cat >try.c <<EOCP
14741 #$i_inttypes I_INTTYPES
14742 #ifdef I_INTTYPES
14743 #include <inttypes.h>
14744 #endif
14745 #include <stdio.h>
14746 int main() {
14747 #ifdef INT8
14748    int8_t i =  INT8_MAX;
14749   uint8_t u = UINT8_MAX;
14750   printf("int8_t\n");
14751 #endif
14752 #ifdef INT16
14753    int16_t i =  INT16_MAX;
14754   uint16_t i = UINT16_MAX;
14755   printf("int16_t\n");
14756 #endif
14757 #ifdef INT32
14758    int32_t i =  INT32_MAX;
14759   uint32_t u = UINT32_MAX;
14760   printf("int32_t\n");
14761 #endif
14762 }
14763 EOCP
14764
14765 case "$i8type" in
14766 '')     case "$charsize" in
14767         1)      i8type=char
14768                 u8type="unsigned char"
14769                 i8size=$charsize
14770                 u8size=$charsize
14771                 ;;
14772         esac
14773         ;;
14774 esac
14775 case "$i8type" in
14776 '')     set try -DINT8
14777         if eval $compile; then
14778                 case "`$run ./try`" in
14779                 int8_t) i8type=int8_t
14780                         u8type=uint8_t
14781                         i8size=1
14782                         u8size=1
14783                         ;;
14784                 esac
14785         fi
14786         ;;
14787 esac
14788 case "$i8type" in
14789 '')     if $test $charsize -ge 1; then
14790                 i8type=char
14791                 u8type="unsigned char"
14792                 i8size=$charsize
14793                 u8size=$charsize
14794         fi
14795         ;;
14796 esac
14797
14798 case "$i16type" in
14799 '')     case "$shortsize" in
14800         2)      i16type=short
14801                 u16type="unsigned short"
14802                 i16size=$shortsize
14803                 u16size=$shortsize
14804                 ;;
14805         esac
14806         ;;
14807 esac
14808 case "$i16type" in
14809 '')     set try -DINT16
14810         if eval $compile; then
14811                 case "`$run ./try`" in
14812                 int16_t)
14813                         i16type=int16_t
14814                         u16type=uint16_t
14815                         i16size=2
14816                         u16size=2
14817                         ;;
14818                 esac
14819         fi
14820         ;;
14821 esac
14822 case "$i16type" in
14823 '')     if $test $shortsize -ge 2; then
14824                 i16type=short
14825                 u16type="unsigned short"
14826                 i16size=$shortsize
14827                 u16size=$shortsize
14828         fi
14829         ;;
14830 esac
14831
14832 case "$i32type" in
14833 '')     case "$longsize" in
14834         4)      i32type=long
14835                 u32type="unsigned long"
14836                 i32size=$longsize
14837                 u32size=$longsize
14838                 ;;
14839         *)      case "$intsize" in
14840                 4)      i32type=int
14841                         u32type="unsigned int"
14842                         i32size=$intsize
14843                         u32size=$intsize
14844                         ;;
14845                 esac
14846                 ;;
14847         esac
14848         ;;
14849 esac
14850 case "$i32type" in
14851 '')     set try -DINT32
14852         if eval $compile; then
14853                 case "`$run ./try`" in
14854                 int32_t)
14855                         i32type=int32_t
14856                         u32type=uint32_t
14857                         i32size=4
14858                         u32size=4
14859                         ;;
14860                 esac
14861         fi
14862         ;;
14863 esac
14864 case "$i32type" in
14865 '')     if $test $intsize -ge 4; then
14866                 i32type=int
14867                 u32type="unsigned int"
14868                 i32size=$intsize
14869                 u32size=$intsize
14870         fi
14871         ;;
14872 esac
14873
14874 case "$i64type" in
14875 '')     case "$d_quad:$quadtype" in
14876         define:?*)
14877                 i64type="$quadtype"
14878                 u64type="$uquadtype"
14879                 i64size=8
14880                 u64size=8
14881                 ;;
14882         esac
14883         ;;
14884 esac
14885
14886 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14887 : volatile so that the compiler has to store it out to memory.
14888 if test X"$d_volatile" = X"$define"; then
14889         volatile=volatile
14890 fi
14891 $cat <<EOP >try.c
14892 #include <stdio.h>
14893 #$i_stdlib I_STDLIB
14894 #ifdef I_STDLIB
14895 #include <stdlib.h>
14896 #endif
14897 #include <sys/types.h>
14898 #include <signal.h>
14899 #ifdef SIGFPE
14900 $volatile int bletched = 0;
14901 $signal_t blech(s) int s; { bletched = 1; }
14902 #endif
14903 int main() {
14904     $uvtype u = 0;
14905     $nvtype d;
14906     int     n = 8 * $uvsize;
14907     int     i;
14908 #ifdef SIGFPE
14909     signal(SIGFPE, blech);
14910 #endif
14911
14912     for (i = 0; i < n; i++) {
14913       u = u << 1 | ($uvtype)1;
14914       d = ($nvtype)u;
14915       if (($uvtype)d != u)
14916         break;
14917       if (d <= 0)
14918         break;
14919       d = ($nvtype)(u - 1);
14920       if (($uvtype)d != (u - 1))
14921         break;
14922 #ifdef SIGFPE
14923       if (bletched) {
14924         break;
14925 #endif
14926       } 
14927     }
14928     printf("%d\n", ((i == n) ? -n : i));
14929     exit(0);
14930 }
14931 EOP
14932 set try
14933
14934 d_nv_preserves_uv="$undef"
14935 if eval $compile; then
14936         nv_preserves_uv_bits="`$run ./try`"
14937 fi
14938 case "$nv_preserves_uv_bits" in
14939 \-[1-9]*)       
14940         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14941         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14942         d_nv_preserves_uv="$define"
14943         ;;
14944 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14945         d_nv_preserves_uv="$undef" ;;
14946 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14947         nv_preserves_uv_bits="$undef" ;;
14948 esac
14949
14950 $rm -f try.* try
14951
14952 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14953 : volatile so that the compiler has to store it out to memory.
14954 if test X"$d_volatile" = X"$define"; then
14955         volatile=volatile
14956 fi
14957 $cat <<EOP >try.c
14958 #include <stdio.h>
14959 #$i_stdlib I_STDLIB
14960 #ifdef I_STDLIB
14961 #include <stdlib.h>
14962 #endif
14963 #$i_string I_STRING
14964 #ifdef I_STRING
14965 #  include <string.h>
14966 #else
14967 #  include <strings.h>
14968 #endif
14969 #include <sys/types.h>
14970 #include <signal.h>
14971 #ifdef SIGFPE
14972 $volatile int bletched = 0;
14973 $signal_t blech(s) int s; { bletched = 1; }
14974 #endif
14975
14976 int checkit($nvtype d, char *where) {
14977     unsigned char *p = (char *)&d;
14978     unsigned char *end = p + sizeof(d);
14979     int fail = 0;
14980
14981     while (p < end)
14982         fail += *p++;
14983
14984     if (!fail)
14985         return 0;
14986
14987     p = (char *)&d;
14988     printf("No - %s: 0x", where);
14989     while (p < end)
14990         printf ("%02X", *p++);
14991     printf("\n");
14992     return 1;
14993 }
14994
14995 int main(int argc, char **argv) {
14996     $nvtype d = 0.0;
14997     int fail = 0;
14998     fail += checkit(d, "0.0");
14999
15000     /* The compiler shouldn't be assuming that bletched is 0  */
15001     d = bletched;
15002
15003     fail += checkit(d, "bleched");
15004
15005 #ifdef SIGFPE
15006     signal(SIGFPE, blech);
15007 #endif
15008
15009     /* Paranoia - the compiler should have no way of knowing that ANSI says
15010        that argv[argc] will always be NULL.  Actually, if it did assume this it
15011        would be buggy, as this is C and main() can be called from elsewhere in
15012        the program.  */
15013     d = argv[argc] ? 1 : 0;
15014
15015     if (d) {
15016         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15017     }
15018
15019     fail += checkit(d, "ternary");
15020
15021     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15022
15023     if (d != 0.0) {
15024         printf("No - memset doesn't give 0.0\n");
15025         /* This might just blow up:  */
15026         printf("(gives %g)\n", d);
15027         return 1;
15028     }
15029     
15030 #ifdef SIGFPE
15031     if (bletched) {
15032         printf("No - something bleched\n");
15033         return 1;
15034     }
15035 #endif
15036     if (fail) {
15037       printf("No - %d fail(s)\n", fail);
15038       return 1;
15039     }
15040     printf("Yes\n");
15041     return 0;
15042 }
15043 EOP
15044 set try
15045
15046 d_nv_zero_is_allbits_zero="$undef"
15047 if eval $compile; then
15048     xxx="`$run ./try`"
15049     case "$?" in
15050         0)
15051             case "$xxx" in
15052                 Yes)  cat >&4 <<EOM
15053 0.0 is represented as all bits zero in memory
15054 EOM
15055                     d_nv_zero_is_allbits_zero="$define"
15056                     ;;
15057                 *)  cat >&4 <<EOM
15058 0.0 is not represented as all bits zero in memory
15059 EOM
15060                     d_nv_zero_is_allbits_zero="$undef"
15061                     ;;
15062             esac
15063             ;;
15064         *)  cat >&4 <<EOM
15065 0.0 is not represented as all bits zero in memory
15066 EOM
15067             d_nv_zero_is_allbits_zero="$undef"
15068             ;;
15069     esac
15070 fi
15071
15072 $rm -f try.* try
15073
15074
15075 : check for off64_t
15076 echo " "
15077 echo "Checking to see if you have off64_t..." >&4
15078 $cat >try.c <<EOCP
15079 #include <sys/types.h>
15080 #include <unistd.h>
15081 int main() { off64_t x = 7; }
15082 EOCP
15083 set try
15084 if eval $compile; then
15085         val="$define"
15086         echo "You have off64_t."
15087 else
15088         val="$undef"
15089         echo "You do not have off64_t."
15090         case "$lseeksize" in
15091         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15092         esac
15093 fi
15094 $rm -f try.* try
15095 set d_off64_t
15096 eval $setvar
15097
15098 : how to create joinable pthreads
15099 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15100         echo " "
15101         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15102         $cat >try.c <<'EOCP'
15103 #include <pthread.h>
15104 int main() {
15105     int detachstate = JOINABLE;
15106 }
15107 EOCP
15108         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15109         if eval $compile; then
15110                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15111                 val="$undef" # Yes, undef.
15112                 set d_old_pthread_create_joinable
15113                 eval $setvar
15114                 val=""
15115                 set old_pthread_create_joinable
15116                 eval $setvar
15117         else
15118                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15119                 if eval $compile; then
15120                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15121                         val="$define"
15122                         set d_old_pthread_create_joinable
15123                         eval $setvar
15124                         val=PTHREAD_CREATE_UNDETACHED
15125                         set old_pthread_create_joinable
15126                         eval $setvar
15127                 else            
15128                         set try -DJOINABLE=__UNDETACHED
15129                         if eval $compile; then
15130                                 echo "You seem to use __UNDETACHED." >&4
15131                                 val="$define"
15132                                 set d_old_pthread_create_joinable
15133                                 eval $setvar
15134                                 val=__UNDETACHED
15135                                 set old_pthread_create_joinable
15136                                 eval $setvar
15137                         else
15138                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15139                                 val="$define"
15140                                 set d_old_pthread_create_joinable
15141                                 eval $setvar
15142                                 val=0
15143                                 set old_pthread_create_joinable
15144                                 eval $setvar
15145                         fi
15146                 fi
15147         fi
15148         $rm -f try try.*
15149 else
15150     d_old_pthread_create_joinable="$undef"
15151     old_pthread_create_joinable=""
15152 fi
15153
15154 : see if pause exists
15155 set pause d_pause
15156 eval $inlibc
15157
15158 : see if pipe exists
15159 set pipe d_pipe
15160 eval $inlibc
15161
15162 : see if poll exists
15163 set poll d_poll
15164 eval $inlibc
15165
15166 : see if readlink exists
15167 set readlink d_readlink
15168 eval $inlibc
15169
15170 echo " "
15171 procselfexe=''
15172 val="$undef"
15173 case "$d_readlink" in
15174 "$define")
15175         if $issymlink /proc/self/exe ; then
15176                 $ls -l /proc/self/exe > reflect
15177                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15178                         echo "You have Linux-like /proc/self/exe."
15179                         procselfexe='"/proc/self/exe"'
15180                         val="$define"
15181                 fi
15182         fi
15183         if $issymlink /proc/curproc/file ; then
15184                 $ls -l /proc/curproc/file > reflect
15185                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15186                         echo "You have BSD-like /proc/curproc/file."
15187                         procselfexe='"/proc/curproc/file"'
15188                         val="$define"
15189                 fi
15190         fi
15191         ;;
15192 esac
15193 $rm -f reflect
15194 set d_procselfexe
15195 eval $setvar
15196
15197 : see whether the pthread_atfork exists
15198 $cat >try.c <<EOP
15199 #include <pthread.h>
15200 #include <stdio.h>
15201 int main() {
15202 #ifdef  PTHREAD_ATFORK
15203         pthread_atfork(NULL,NULL,NULL);
15204 #endif
15205 }
15206 EOP
15207
15208 : see if pthread_atfork exists
15209 set try -DPTHREAD_ATFORK
15210 if eval $compile; then
15211     val="$define"
15212 else
15213     val="$undef"
15214 fi
15215 case "$usethreads" in
15216 $define)
15217         case "$val" in
15218         $define) echo 'pthread_atfork found.' >&4        ;;
15219         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15220         esac
15221 esac
15222 set d_pthread_atfork
15223 eval $setvar
15224
15225 : see if pthread_attr_setscope exists
15226 set pthread_attr_setscope d_pthread_attr_setscope
15227 eval $inlibc
15228
15229
15230 : see whether the various POSIXish _yields exist
15231 $cat >try.c <<EOP
15232 #include <pthread.h>
15233 #include <stdio.h>
15234 int main() {
15235 #ifdef SCHED_YIELD
15236         sched_yield();
15237 #else
15238 #ifdef PTHREAD_YIELD
15239         pthread_yield();
15240 #else
15241 #ifdef PTHREAD_YIELD_NULL
15242         pthread_yield(NULL);
15243 #endif
15244 #endif
15245 #endif
15246 }
15247 EOP
15248 : see if sched_yield exists
15249 set try -DSCHED_YIELD
15250 if eval $compile; then
15251     val="$define"
15252     sched_yield='sched_yield()'
15253 else
15254     val="$undef"
15255 fi
15256 case "$usethreads" in
15257 $define)
15258         case "$val" in
15259         $define) echo 'sched_yield() found.' >&4        ;;
15260         *)       echo 'sched_yield() NOT found.' >&4    ;;
15261         esac
15262 esac
15263 set d_sched_yield
15264 eval $setvar
15265
15266 : see if pthread_yield exists
15267 set try -DPTHREAD_YIELD
15268 if eval $compile; then
15269     val="$define"
15270     case "$sched_yield" in
15271     '') sched_yield='pthread_yield()' ;;
15272     esac
15273 else
15274     set try -DPTHREAD_YIELD_NULL
15275     if eval $compile; then
15276         val="$define"
15277         case "$sched_yield" in
15278         '') sched_yield='pthread_yield(NULL)' ;;
15279         esac
15280     else
15281         val="$undef"
15282     fi
15283 fi
15284 case "$usethreads" in
15285 $define)
15286         case "$val" in
15287         $define) echo 'pthread_yield() found.' >&4      ;;
15288         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15289         esac
15290         ;;
15291 esac
15292 set d_pthread_yield
15293 eval $setvar
15294
15295 case "$sched_yield" in
15296 '') sched_yield=undef ;;
15297 esac
15298
15299 $rm -f try try.*
15300
15301 : see if random_r exists
15302 set random_r d_random_r
15303 eval $inlibc
15304 case "$d_random_r" in
15305 "$define")
15306         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15307         case "$d_random_r_proto:$usethreads" in
15308         ":define")      d_random_r_proto=define
15309                 set d_random_r_proto random_r $hdrs
15310                 eval $hasproto ;;
15311         *)      ;;
15312         esac
15313         case "$d_random_r_proto" in
15314         define)
15315         case "$random_r_proto" in
15316         ''|0) try='int random_r(int*, struct random_data*);'
15317         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15318         esac
15319         case "$random_r_proto" in
15320         ''|0) try='int random_r(long*, struct random_data*);'
15321         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15322         esac
15323         case "$random_r_proto" in
15324         ''|0) try='int random_r(struct random_data*, int32_t*);'
15325         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15326         esac
15327         case "$random_r_proto" in
15328         ''|0)   d_random_r=undef
15329                 random_r_proto=0
15330                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15331         * )     case "$random_r_proto" in
15332                 REENTRANT_PROTO*) ;;
15333                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15334                 esac
15335                 echo "Prototype: $try" ;;
15336         esac
15337         ;;
15338         *)      case "$usethreads" in
15339                 define) echo "random_r has no prototype, not using it." >&4 ;;
15340                 esac
15341                 d_random_r=undef
15342                 random_r_proto=0
15343                 ;;
15344         esac
15345         ;;
15346 *)      random_r_proto=0
15347         ;;
15348 esac
15349
15350 : see if readdir and friends exist
15351 set readdir d_readdir
15352 eval $inlibc
15353 set seekdir d_seekdir
15354 eval $inlibc
15355 set telldir d_telldir
15356 eval $inlibc
15357 set rewinddir d_rewinddir
15358 eval $inlibc
15359
15360 : see if readdir64_r exists
15361 set readdir64_r d_readdir64_r
15362 eval $inlibc
15363 case "$d_readdir64_r" in
15364 "$define")
15365         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15366         case "$d_readdir64_r_proto:$usethreads" in
15367         ":define")      d_readdir64_r_proto=define
15368                 set d_readdir64_r_proto readdir64_r $hdrs
15369                 eval $hasproto ;;
15370         *)      ;;
15371         esac
15372         case "$d_readdir64_r_proto" in
15373         define)
15374         case "$readdir64_r_proto" in
15375         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15376         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15377         esac
15378         case "$readdir64_r_proto" in
15379         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15380         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15381         esac
15382         case "$readdir64_r_proto" in
15383         ''|0)   d_readdir64_r=undef
15384                 readdir64_r_proto=0
15385                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15386         * )     case "$readdir64_r_proto" in
15387                 REENTRANT_PROTO*) ;;
15388                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15389                 esac
15390                 echo "Prototype: $try" ;;
15391         esac
15392         ;;
15393         *)      case "$usethreads" in
15394                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15395                 esac
15396                 d_readdir64_r=undef
15397                 readdir64_r_proto=0
15398                 ;;
15399         esac
15400         ;;
15401 *)      readdir64_r_proto=0
15402         ;;
15403 esac
15404
15405 : see if readdir_r exists
15406 set readdir_r d_readdir_r
15407 eval $inlibc
15408 case "$d_readdir_r" in
15409 "$define")
15410         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15411         case "$d_readdir_r_proto:$usethreads" in
15412         ":define")      d_readdir_r_proto=define
15413                 set d_readdir_r_proto readdir_r $hdrs
15414                 eval $hasproto ;;
15415         *)      ;;
15416         esac
15417         case "$d_readdir_r_proto" in
15418         define)
15419         case "$readdir_r_proto" in
15420         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15421         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15422         esac
15423         case "$readdir_r_proto" in
15424         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15425         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15426         esac
15427         case "$readdir_r_proto" in
15428         ''|0)   d_readdir_r=undef
15429                 readdir_r_proto=0
15430                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15431         * )     case "$readdir_r_proto" in
15432                 REENTRANT_PROTO*) ;;
15433                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15434                 esac
15435                 echo "Prototype: $try" ;;
15436         esac
15437         ;;
15438         *)      case "$usethreads" in
15439                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15440                 esac
15441                 d_readdir_r=undef
15442                 readdir_r_proto=0
15443                 ;;
15444         esac
15445         ;;
15446 *)      readdir_r_proto=0
15447         ;;
15448 esac
15449
15450 : see if readv exists
15451 set readv d_readv
15452 eval $inlibc
15453
15454 : see if recvmsg exists
15455 set recvmsg d_recvmsg
15456 eval $inlibc
15457
15458 : see if rename exists
15459 set rename d_rename
15460 eval $inlibc
15461
15462 : see if rmdir exists
15463 set rmdir d_rmdir
15464 eval $inlibc
15465
15466 : see if memory.h is available.
15467 val=''
15468 set memory.h val
15469 eval $inhdr
15470
15471 : See if it conflicts with string.h
15472 case "$val" in
15473 $define)
15474         case "$strings" in
15475         '') ;;
15476         *)
15477                 $cppstdin $cppflags $cppminus < $strings > mem.h
15478                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15479                         echo " "
15480                         echo "We won't be including <memory.h>."
15481                         val="$undef"
15482                 fi
15483                 $rm -f mem.h
15484                 ;;
15485         esac
15486 esac
15487 set i_memory
15488 eval $setvar
15489
15490 : can bcopy handle overlapping blocks?
15491 echo " "
15492 val="$undef"
15493 case "$d_memmove" in
15494 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15495 *)      case "$d_bcopy" in
15496         "$define")
15497                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15498                 $cat >try.c <<EOCP
15499 #$i_memory I_MEMORY
15500 #$i_stdlib I_STDLIB
15501 #$i_string I_STRING
15502 #$i_unistd I_UNISTD
15503 EOCP
15504         $cat >>try.c <<'EOCP'
15505 #include <stdio.h>
15506 #ifdef I_MEMORY
15507 #  include <memory.h>
15508 #endif
15509 #ifdef I_STDLIB
15510 #  include <stdlib.h>
15511 #endif
15512 #ifdef I_STRING
15513 #  include <string.h>
15514 #else
15515 #  include <strings.h>
15516 #endif
15517 #ifdef I_UNISTD
15518 #  include <unistd.h>  /* Needed for NetBSD */
15519 #endif
15520 int main()
15521 {
15522 char buf[128], abc[128];
15523 char *b;
15524 int len;
15525 int off;
15526 int align;
15527
15528 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15529    try to store the string in read-only memory. */
15530 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15531
15532 for (align = 7; align >= 0; align--) {
15533         for (len = 36; len; len--) {
15534                 b = buf+align;
15535                 bcopy(abc, b, len);
15536                 for (off = 1; off <= len; off++) {
15537                         bcopy(b, b+off, len);
15538                         bcopy(b+off, b, len);
15539                         if (bcmp(b, abc, len))
15540                                 exit(1);
15541                 }
15542         }
15543 }
15544 exit(0);
15545 }
15546 EOCP
15547                 set try
15548                 if eval $compile_ok; then
15549                         if ./try 2>/dev/null; then
15550                                 echo "Yes, it can."
15551                                 val="$define"
15552                         else
15553                                 echo "It can't, sorry."
15554                         fi
15555                 else
15556                         echo "(I can't compile the test program, so we'll assume not...)"
15557                 fi
15558                 ;;
15559         esac
15560         $rm -f try.* try core
15561         ;;
15562 esac
15563 set d_safebcpy
15564 eval $setvar
15565
15566 : can memcpy handle overlapping blocks?
15567 echo " "
15568 val="$undef"
15569 case "$d_memmove" in
15570 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15571 *)      case "$d_memcpy" in
15572         "$define")
15573                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15574                 $cat >try.c <<EOCP
15575 #$i_memory I_MEMORY
15576 #$i_stdlib I_STDLIB
15577 #$i_string I_STRING
15578 #$i_unistd I_UNISTD
15579 EOCP
15580         $cat >>try.c <<'EOCP'
15581 #include <stdio.h>
15582 #ifdef I_MEMORY
15583 #  include <memory.h>
15584 #endif
15585 #ifdef I_STDLIB
15586 #  include <stdlib.h>
15587 #endif
15588 #ifdef I_STRING
15589 #  include <string.h>
15590 #else
15591 #  include <strings.h>
15592 #endif
15593 #ifdef I_UNISTD
15594 #  include <unistd.h>  /* Needed for NetBSD */
15595 #endif
15596 int main()
15597 {
15598 char buf[128], abc[128];
15599 char *b;
15600 int len;
15601 int off;
15602 int align;
15603
15604 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15605    try to store the string in read-only memory. */
15606 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15607
15608 for (align = 7; align >= 0; align--) {
15609         for (len = 36; len; len--) {
15610                 b = buf+align;
15611                 memcpy(b, abc, len);
15612                 for (off = 1; off <= len; off++) {
15613                         memcpy(b+off, b, len);
15614                         memcpy(b, b+off, len);
15615                         if (memcmp(b, abc, len))
15616                                 exit(1);
15617                 }
15618         }
15619 }
15620 exit(0);
15621 }
15622 EOCP
15623                 set try
15624                 if eval $compile_ok; then
15625                         if ./try 2>/dev/null; then
15626                                 echo "Yes, it can."
15627                                 val="$define"
15628                         else
15629                                 echo "It can't, sorry."
15630                         fi
15631                 else
15632                         echo "(I can't compile the test program, so we'll assume not...)"
15633                 fi
15634                 ;;
15635         esac
15636         $rm -f try.* try core
15637         ;;
15638 esac
15639 set d_safemcpy
15640 eval $setvar
15641
15642 : can memcmp be trusted to compare relative magnitude?
15643 val="$undef"
15644 case "$d_memcmp" in
15645 "$define")
15646         echo " "
15647         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15648         $cat >try.c <<EOCP
15649 #$i_memory I_MEMORY
15650 #$i_stdlib I_STDLIB
15651 #$i_string I_STRING
15652 #$i_unistd I_UNISTD
15653 EOCP
15654         $cat >>try.c <<'EOCP'
15655 #include <stdio.h>
15656 #ifdef I_MEMORY
15657 #  include <memory.h>
15658 #endif
15659 #ifdef I_STDLIB
15660 #  include <stdlib.h>
15661 #endif
15662 #ifdef I_STRING
15663 #  include <string.h>
15664 #else
15665 #  include <strings.h>
15666 #endif
15667 #ifdef I_UNISTD
15668 #  include <unistd.h>  /* Needed for NetBSD */
15669 #endif
15670 int main()
15671 {
15672 char a = -1;
15673 char b = 0;
15674 if ((a < b) && memcmp(&a, &b, 1) < 0)
15675         exit(1);
15676 exit(0);
15677 }
15678 EOCP
15679         set try
15680         if eval $compile_ok; then
15681                 if $run ./try 2>/dev/null; then
15682                         echo "Yes, it can."
15683                         val="$define"
15684                 else
15685                         echo "No, it can't (it uses signed chars)."
15686                 fi
15687         else
15688                 echo "(I can't compile the test program, so we'll assume not...)"
15689         fi
15690         ;;
15691 esac
15692 $rm -f try.* try core
15693 set d_sanemcmp
15694 eval $setvar
15695
15696 : see if prototype for sbrk is available
15697 echo " "
15698 set d_sbrkproto sbrk $i_unistd unistd.h
15699 eval $hasproto
15700
15701 : see if select exists
15702 set select d_select
15703 eval $inlibc
15704
15705 : see if semctl exists
15706 set semctl d_semctl
15707 eval $inlibc
15708
15709 : see if semget exists
15710 set semget d_semget
15711 eval $inlibc
15712
15713 : see if semop exists
15714 set semop d_semop
15715 eval $inlibc
15716
15717 : see how much of the 'sem*(2)' library is present.
15718 h_sem=true
15719 echo " "
15720 case "$d_semctl$d_semget$d_semop" in
15721 *"$undef"*) h_sem=false;;
15722 esac
15723 case "$osname" in
15724 freebsd)
15725     case "`ipcs 2>&1`" in
15726     "SVID messages"*"not configured"*)
15727         echo "Your $osname does not have the sem*(2) configured." >&4
15728         h_sem=false
15729         val="$undef"
15730         set semctl d_semctl
15731         eval $setvar
15732         set semget d_semget
15733         eval $setvar
15734         set semop d_semop
15735         eval $setvar
15736         ;;
15737     esac
15738     ;;
15739 esac
15740 : we could also check for sys/ipc.h ...
15741 if $h_sem && $test `./findhdr sys/sem.h`; then
15742         echo "You have the full sem*(2) library." >&4
15743         val="$define"
15744 else
15745         echo "You don't have the full sem*(2) library." >&4
15746         val="$undef"
15747 fi
15748 set d_sem
15749 eval $setvar
15750
15751 : see whether sys/sem.h defines union semun
15752 echo " "
15753 $cat > try.c <<'END'
15754 #include <sys/types.h>
15755 #include <sys/ipc.h>
15756 #include <sys/sem.h>
15757 int main () { union semun semun; semun.buf = 0; }
15758 END
15759 set try
15760 if eval $compile; then
15761     echo "You have union semun in <sys/sem.h>." >&4
15762     val="$define"
15763 else
15764     echo "You do not have union semun in <sys/sem.h>." >&4
15765     val="$undef"
15766 fi
15767 $rm -f try try.c
15768 set d_union_semun
15769 eval $setvar
15770
15771 : see how to do semctl IPC_STAT
15772 case "$d_sem" in
15773 $define)
15774     echo " "
15775     $cat > try.h <<END
15776 #ifndef S_IRUSR
15777 #   ifdef S_IREAD
15778 #       define S_IRUSR S_IREAD
15779 #       define S_IWUSR S_IWRITE
15780 #       define S_IXUSR S_IEXEC
15781 #   else
15782 #       define S_IRUSR 0400
15783 #       define S_IWUSR 0200
15784 #       define S_IXUSR 0100
15785 #   endif
15786 #   define S_IRGRP (S_IRUSR>>3)
15787 #   define S_IWGRP (S_IWUSR>>3)
15788 #   define S_IXGRP (S_IXUSR>>3)
15789 #   define S_IROTH (S_IRUSR>>6)
15790 #   define S_IWOTH (S_IWUSR>>6)
15791 #   define S_IXOTH (S_IXUSR>>6)
15792 #endif
15793 #ifndef S_IRWXU
15794 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15795 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15796 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15797 #endif
15798 END
15799     : see whether semctl IPC_STAT can use union semun
15800     case "$d_semctl_semun" in
15801     '')
15802       val="$undef"
15803       $cat > try.c <<END
15804 #include <sys/types.h>
15805 #include <sys/ipc.h>
15806 #include <sys/sem.h>
15807 #include <sys/stat.h>
15808 #include <stdio.h>
15809 #include <errno.h>
15810 #include "try.h"
15811 #ifndef errno
15812 extern int errno;
15813 #endif
15814 #$d_union_semun HAS_UNION_SEMUN
15815 int main() {
15816     union semun
15817 #ifndef HAS_UNION_SEMUN
15818     {
15819         int val;
15820         struct semid_ds *buf;
15821         unsigned short *array;
15822     }
15823 #endif
15824     arg;
15825     int sem, st;
15826
15827 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15828     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15829     if (sem > -1) {
15830         struct semid_ds argbuf;
15831         arg.buf = &argbuf;
15832 #       ifdef IPC_STAT
15833         st = semctl(sem, 0, IPC_STAT, arg);
15834         if (st == 0)
15835             printf("semun\n");
15836         else
15837 #       endif /* IPC_STAT */
15838             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15839 #       ifdef IPC_RMID
15840         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15841 #       endif /* IPC_RMID */
15842             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15843     } else
15844 #endif /* IPC_PRIVATE && ... */
15845         printf("semget failed: errno = %d\n", errno);
15846   return 0;
15847 }
15848 END
15849       set try
15850       if eval $compile; then
15851           xxx=`$run ./try`
15852           case "$xxx" in
15853           semun) val="$define" ;;
15854           esac
15855       fi
15856       $rm -f try try.c
15857       set d_semctl_semun
15858       eval $setvar
15859       ;;
15860     esac
15861     case "$d_semctl_semun" in
15862     $define)
15863         echo "You can use union semun for semctl IPC_STAT." >&4
15864         also='also'
15865         ;;
15866     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15867         also=''
15868         ;;
15869     esac
15870
15871     : see whether semctl IPC_STAT can use struct semid_ds pointer
15872     case "$d_semctl_semid_ds" in
15873     '')
15874       val="$undef"
15875       $cat > try.c <<'END'
15876 #include <sys/types.h>
15877 #include <sys/ipc.h>
15878 #include <sys/sem.h>
15879 #include <sys/stat.h>
15880 #include "try.h"
15881 #include <stdio.h>
15882 #include <errno.h>
15883 #ifndef errno
15884 extern int errno;
15885 #endif
15886 int main() {
15887     struct semid_ds arg;
15888     int sem, st;
15889
15890 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15891     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15892     if (sem > -1) {
15893 #       ifdef IPC_STAT
15894         st = semctl(sem, 0, IPC_STAT, &arg);
15895         if (st == 0)
15896             printf("semid_ds\n");
15897         else
15898 #       endif /* IPC_STAT */
15899             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15900 #       ifdef IPC_RMID
15901         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15902 #       endif /* IPC_RMID */
15903             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15904     } else
15905 #endif /* IPC_PRIVATE && ... */
15906         printf("semget failed: errno = %d\n", errno);
15907
15908     return 0;
15909 }
15910 END
15911       set try
15912       if eval $compile; then
15913           xxx=`$run ./try`
15914           case "$xxx" in
15915           semid_ds) val="$define" ;;
15916           esac
15917       fi
15918       $rm -f try try.c
15919       set d_semctl_semid_ds
15920       eval $setvar
15921       ;;
15922     esac
15923     case "$d_semctl_semid_ds" in
15924     $define)
15925         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15926         ;;
15927     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15928         ;;
15929     esac
15930     $rm -f try.h
15931     ;;
15932 *)  val="$undef"
15933
15934     # We do not have the full sem*(2) library, so assume we can not
15935     # use either.
15936
15937     set d_semctl_semun
15938     eval $setvar
15939
15940     set d_semctl_semid_ds
15941     eval $setvar
15942     ;;
15943 esac
15944
15945 : see if sendmsg exists
15946 set sendmsg d_sendmsg
15947 eval $inlibc
15948
15949 : see if setegid exists
15950 set setegid d_setegid
15951 eval $inlibc
15952
15953 : see if seteuid exists
15954 set seteuid d_seteuid
15955 eval $inlibc
15956
15957 : see if setgrent exists
15958 set setgrent d_setgrent
15959 eval $inlibc
15960
15961 : see if setgrent_r exists
15962 set setgrent_r d_setgrent_r
15963 eval $inlibc
15964 case "$d_setgrent_r" in
15965 "$define")
15966         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15967         case "$d_setgrent_r_proto:$usethreads" in
15968         ":define")      d_setgrent_r_proto=define
15969                 set d_setgrent_r_proto setgrent_r $hdrs
15970                 eval $hasproto ;;
15971         *)      ;;
15972         esac
15973         case "$d_setgrent_r_proto" in
15974         define)
15975         case "$setgrent_r_proto" in
15976         ''|0) try='int setgrent_r(FILE**);'
15977         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15978         esac
15979         case "$setgrent_r_proto" in
15980         ''|0) try='void setgrent_r(FILE**);'
15981         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15982         esac
15983         case "$setgrent_r_proto" in
15984         ''|0)   d_setgrent_r=undef
15985                 setgrent_r_proto=0
15986                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15987         * )     case "$setgrent_r_proto" in
15988                 REENTRANT_PROTO*) ;;
15989                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15990                 esac
15991                 echo "Prototype: $try" ;;
15992         esac
15993         ;;
15994         *)      case "$usethreads" in
15995                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15996                 esac
15997                 d_setgrent_r=undef
15998                 setgrent_r_proto=0
15999                 ;;
16000         esac
16001         ;;
16002 *)      setgrent_r_proto=0
16003         ;;
16004 esac
16005
16006 : see if sethostent exists
16007 set sethostent d_sethent
16008 eval $inlibc
16009
16010 : see if sethostent_r exists
16011 set sethostent_r d_sethostent_r
16012 eval $inlibc
16013 case "$d_sethostent_r" in
16014 "$define")
16015         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16016         case "$d_sethostent_r_proto:$usethreads" in
16017         ":define")      d_sethostent_r_proto=define
16018                 set d_sethostent_r_proto sethostent_r $hdrs
16019                 eval $hasproto ;;
16020         *)      ;;
16021         esac
16022         case "$d_sethostent_r_proto" in
16023         define)
16024         case "$sethostent_r_proto" in
16025         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16026         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16027         esac
16028         case "$sethostent_r_proto" in
16029         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16030         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16031         esac
16032         case "$sethostent_r_proto" in
16033         ''|0)   d_sethostent_r=undef
16034                 sethostent_r_proto=0
16035                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16036         * )     case "$sethostent_r_proto" in
16037                 REENTRANT_PROTO*) ;;
16038                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16039                 esac
16040                 echo "Prototype: $try" ;;
16041         esac
16042         ;;
16043         *)      case "$usethreads" in
16044                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16045                 esac
16046                 d_sethostent_r=undef
16047                 sethostent_r_proto=0
16048                 ;;
16049         esac
16050         ;;
16051 *)      sethostent_r_proto=0
16052         ;;
16053 esac
16054
16055 : see if setitimer exists
16056 set setitimer d_setitimer
16057 eval $inlibc
16058
16059 : see if setlinebuf exists
16060 set setlinebuf d_setlinebuf
16061 eval $inlibc
16062
16063 : see if setlocale exists
16064 set setlocale d_setlocale
16065 eval $inlibc
16066
16067 : see if locale.h is available
16068 set locale.h i_locale
16069 eval $inhdr
16070
16071 : see if setlocale_r exists
16072 set setlocale_r d_setlocale_r
16073 eval $inlibc
16074 case "$d_setlocale_r" in
16075 "$define")
16076         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16077         case "$d_setlocale_r_proto:$usethreads" in
16078         ":define")      d_setlocale_r_proto=define
16079                 set d_setlocale_r_proto setlocale_r $hdrs
16080                 eval $hasproto ;;
16081         *)      ;;
16082         esac
16083         case "$d_setlocale_r_proto" in
16084         define)
16085         case "$setlocale_r_proto" in
16086         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16087         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16088         esac
16089         case "$setlocale_r_proto" in
16090         ''|0)   d_setlocale_r=undef
16091                 setlocale_r_proto=0
16092                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16093         * )     case "$setlocale_r_proto" in
16094                 REENTRANT_PROTO*) ;;
16095                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16096                 esac
16097                 echo "Prototype: $try" ;;
16098         esac
16099         ;;
16100         *)      case "$usethreads" in
16101                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16102                 esac
16103                 d_setlocale_r=undef
16104                 setlocale_r_proto=0
16105                 ;;
16106         esac
16107         ;;
16108 *)      setlocale_r_proto=0
16109         ;;
16110 esac
16111
16112 : see if setnetent exists
16113 set setnetent d_setnent
16114 eval $inlibc
16115
16116 : see if setnetent_r exists
16117 set setnetent_r d_setnetent_r
16118 eval $inlibc
16119 case "$d_setnetent_r" in
16120 "$define")
16121         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16122         case "$d_setnetent_r_proto:$usethreads" in
16123         ":define")      d_setnetent_r_proto=define
16124                 set d_setnetent_r_proto setnetent_r $hdrs
16125                 eval $hasproto ;;
16126         *)      ;;
16127         esac
16128         case "$d_setnetent_r_proto" in
16129         define)
16130         case "$setnetent_r_proto" in
16131         ''|0) try='int setnetent_r(int, struct netent_data*);'
16132         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16133         esac
16134         case "$setnetent_r_proto" in
16135         ''|0) try='void setnetent_r(int, struct netent_data*);'
16136         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16137         esac
16138         case "$setnetent_r_proto" in
16139         ''|0)   d_setnetent_r=undef
16140                 setnetent_r_proto=0
16141                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16142         * )     case "$setnetent_r_proto" in
16143                 REENTRANT_PROTO*) ;;
16144                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16145                 esac
16146                 echo "Prototype: $try" ;;
16147         esac
16148         ;;
16149         *)      case "$usethreads" in
16150                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16151                 esac
16152                 d_setnetent_r=undef
16153                 setnetent_r_proto=0
16154                 ;;
16155         esac
16156         ;;
16157 *)      setnetent_r_proto=0
16158         ;;
16159 esac
16160
16161 : see if setprotoent exists
16162 set setprotoent d_setpent
16163 eval $inlibc
16164
16165 : see if setpgid exists
16166 set setpgid d_setpgid
16167 eval $inlibc
16168
16169 : see if setpgrp2 exists
16170 set setpgrp2 d_setpgrp2
16171 eval $inlibc
16172
16173 : see if setpriority exists
16174 set setpriority d_setprior
16175 eval $inlibc
16176
16177 : see if setproctitle exists
16178 set setproctitle d_setproctitle
16179 eval $inlibc
16180
16181 : see if setprotoent_r exists
16182 set setprotoent_r d_setprotoent_r
16183 eval $inlibc
16184 case "$d_setprotoent_r" in
16185 "$define")
16186         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16187         case "$d_setprotoent_r_proto:$usethreads" in
16188         ":define")      d_setprotoent_r_proto=define
16189                 set d_setprotoent_r_proto setprotoent_r $hdrs
16190                 eval $hasproto ;;
16191         *)      ;;
16192         esac
16193         case "$d_setprotoent_r_proto" in
16194         define)
16195         case "$setprotoent_r_proto" in
16196         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16197         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16198         esac
16199         case "$setprotoent_r_proto" in
16200         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16201         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16202         esac
16203         case "$setprotoent_r_proto" in
16204         ''|0)   d_setprotoent_r=undef
16205                 setprotoent_r_proto=0
16206                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16207         * )     case "$setprotoent_r_proto" in
16208                 REENTRANT_PROTO*) ;;
16209                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16210                 esac
16211                 echo "Prototype: $try" ;;
16212         esac
16213         ;;
16214         *)      case "$usethreads" in
16215                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16216                 esac
16217                 d_setprotoent_r=undef
16218                 setprotoent_r_proto=0
16219                 ;;
16220         esac
16221         ;;
16222 *)      setprotoent_r_proto=0
16223         ;;
16224 esac
16225
16226 : see if setpwent exists
16227 set setpwent d_setpwent
16228 eval $inlibc
16229
16230 : see if setpwent_r exists
16231 set setpwent_r d_setpwent_r
16232 eval $inlibc
16233 case "$d_setpwent_r" in
16234 "$define")
16235         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16236         case "$d_setpwent_r_proto:$usethreads" in
16237         ":define")      d_setpwent_r_proto=define
16238                 set d_setpwent_r_proto setpwent_r $hdrs
16239                 eval $hasproto ;;
16240         *)      ;;
16241         esac
16242         case "$d_setpwent_r_proto" in
16243         define)
16244         case "$setpwent_r_proto" in
16245         ''|0) try='int setpwent_r(FILE**);'
16246         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16247         esac
16248         case "$setpwent_r_proto" in
16249         ''|0) try='void setpwent_r(FILE**);'
16250         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16251         esac
16252         case "$setpwent_r_proto" in
16253         ''|0)   d_setpwent_r=undef
16254                 setpwent_r_proto=0
16255                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16256         * )     case "$setpwent_r_proto" in
16257                 REENTRANT_PROTO*) ;;
16258                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16259                 esac
16260                 echo "Prototype: $try" ;;
16261         esac
16262         ;;
16263         *)      case "$usethreads" in
16264                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16265                 esac
16266                 d_setpwent_r=undef
16267                 setpwent_r_proto=0
16268                 ;;
16269         esac
16270         ;;
16271 *)      setpwent_r_proto=0
16272         ;;
16273 esac
16274
16275 : see if setregid exists
16276 set setregid d_setregid
16277 eval $inlibc
16278 set setresgid d_setresgid
16279 eval $inlibc
16280
16281 : see if setreuid exists
16282 set setreuid d_setreuid
16283 eval $inlibc
16284 set setresuid d_setresuid
16285 eval $inlibc
16286
16287 : see if setrgid exists
16288 set setrgid d_setrgid
16289 eval $inlibc
16290
16291 : see if setruid exists
16292 set setruid d_setruid
16293 eval $inlibc
16294
16295 : see if setservent exists
16296 set setservent d_setsent
16297 eval $inlibc
16298
16299 : see if setservent_r exists
16300 set setservent_r d_setservent_r
16301 eval $inlibc
16302 case "$d_setservent_r" in
16303 "$define")
16304         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16305         case "$d_setservent_r_proto:$usethreads" in
16306         ":define")      d_setservent_r_proto=define
16307                 set d_setservent_r_proto setservent_r $hdrs
16308                 eval $hasproto ;;
16309         *)      ;;
16310         esac
16311         case "$d_setservent_r_proto" in
16312         define)
16313         case "$setservent_r_proto" in
16314         ''|0) try='int setservent_r(int, struct servent_data*);'
16315         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16316         esac
16317         case "$setservent_r_proto" in
16318         ''|0) try='void setservent_r(int, struct servent_data*);'
16319         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16320         esac
16321         case "$setservent_r_proto" in
16322         ''|0)   d_setservent_r=undef
16323                 setservent_r_proto=0
16324                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16325         * )     case "$setservent_r_proto" in
16326                 REENTRANT_PROTO*) ;;
16327                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16328                 esac
16329                 echo "Prototype: $try" ;;
16330         esac
16331         ;;
16332         *)      case "$usethreads" in
16333                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16334                 esac
16335                 d_setservent_r=undef
16336                 setservent_r_proto=0
16337                 ;;
16338         esac
16339         ;;
16340 *)      setservent_r_proto=0
16341         ;;
16342 esac
16343
16344 : see if setsid exists
16345 set setsid d_setsid
16346 eval $inlibc
16347
16348 : see if setvbuf exists
16349 set setvbuf d_setvbuf
16350 eval $inlibc
16351
16352 : see if sfio.h is available
16353 set sfio.h i_sfio
16354 eval $inhdr
16355
16356
16357 : see if sfio library is available
16358 case "$i_sfio" in
16359 $define)
16360         val=''
16361         set sfreserve val
16362         eval $inlibc
16363         ;;
16364 *)
16365         val="$undef"
16366         ;;
16367 esac
16368 : Ok, but do we want to use it.
16369 case "$val" in
16370 $define)
16371         case "$usesfio" in
16372         true|$define|[yY]*) dflt='y';;
16373         *) dflt='n';;
16374         esac
16375         echo "$package can use the sfio library, but it is experimental."
16376         case "$useperlio" in
16377         "$undef")
16378             echo "For sfio also the PerlIO abstraction layer is needed."
16379             echo "Earlier you said you wouldn't want that."
16380             ;;
16381         esac
16382         rp="You seem to have sfio available, do you want to try using it?"
16383         . ./myread
16384         case "$ans" in
16385         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16386                 useperlio="$define"
16387                 val="$define"
16388                 ;;
16389         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16390                 val="$undef"
16391                 ;;
16392         esac
16393         ;;
16394 *)      case "$usesfio" in
16395         true|$define|[yY]*)
16396                 echo "Sorry, cannot find sfio on this machine." >&4
16397                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16398                 val="$undef"
16399                 ;;
16400         esac
16401         ;;
16402 esac
16403 set d_sfio
16404 eval $setvar
16405 case "$d_sfio" in
16406 $define) usesfio='true';;
16407 *) usesfio='false';;
16408 esac
16409 case "$d_sfio" in
16410 $define) ;;
16411 *)      : Remove sfio from list of libraries to use
16412         case "$libs" in
16413         *-lsfio*)
16414                 echo "Removing unneeded -lsfio from library list" >&4
16415                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16416                 shift
16417                 libs="$*"
16418                 echo "libs = $libs" >&4
16419                 ;;
16420         esac
16421 ;;
16422 esac
16423
16424
16425 : see if shmctl exists
16426 set shmctl d_shmctl
16427 eval $inlibc
16428
16429 : see if shmget exists
16430 set shmget d_shmget
16431 eval $inlibc
16432
16433 : see if shmat exists
16434 set shmat d_shmat
16435 eval $inlibc
16436 : see what shmat returns
16437 case "$d_shmat" in
16438 "$define")
16439         $cat >shmat.c <<'END'
16440 #include <sys/shm.h>
16441 void *shmat();
16442 END
16443         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16444                 shmattype='void *'
16445         else
16446                 shmattype='char *'
16447         fi
16448         echo "and it returns ($shmattype)." >&4
16449         : see if a prototype for shmat is available
16450         xxx=`./findhdr sys/shm.h`
16451         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16452         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16453                 val="$define"
16454         else
16455                 val="$undef"
16456         fi
16457         $rm -f shmat.[co]
16458         ;;
16459 *)
16460         val="$undef"
16461         ;;
16462 esac
16463 set d_shmatprototype
16464 eval $setvar
16465
16466 : see if shmdt exists
16467 set shmdt d_shmdt
16468 eval $inlibc
16469
16470 : see how much of the 'shm*(2)' library is present.
16471 h_shm=true
16472 echo " "
16473 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16474 *"$undef"*) h_shm=false;;
16475 esac
16476 case "$osname" in
16477 freebsd)
16478     case "`ipcs 2>&1`" in
16479     "SVID shared memory"*"not configured"*)
16480         echo "Your $osname does not have the shm*(2) configured." >&4
16481         h_shm=false
16482         val="$undef"
16483         set shmctl d_shmctl
16484         evat $setvar
16485         set shmget d_shmget
16486         evat $setvar
16487         set shmat d_shmat
16488         evat $setvar
16489         set shmdt d_shmdt
16490         evat $setvar
16491         ;;
16492     esac
16493     ;;
16494 esac
16495 : we could also check for sys/ipc.h ...
16496 if $h_shm && $test `./findhdr sys/shm.h`; then
16497         echo "You have the full shm*(2) library." >&4
16498         val="$define"
16499 else
16500         echo "You don't have the full shm*(2) library." >&4
16501         val="$undef"
16502 fi
16503 set d_shm
16504 eval $setvar
16505
16506 echo " "
16507 : see if we have sigaction
16508 if set sigaction val -f d_sigaction; eval $csym; $val; then
16509         echo 'sigaction() found.' >&4
16510         $cat > try.c <<EOP
16511 #include <stdio.h>
16512 #include <sys/types.h>
16513 #include <signal.h>
16514 #$i_stdlib I_STDLIB
16515 #ifdef I_STDLIB
16516 #include <stdlib.h>
16517 #endif
16518 int main()
16519 {
16520     struct sigaction act, oact;
16521     act.sa_flags = 0;
16522     oact.sa_handler = 0;
16523     /* so that act and oact are used */
16524     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16525 }
16526 EOP
16527         set try
16528         if eval $compile_ok; then
16529                 val="$define"
16530         else
16531                 echo "But you don't seem to have a useable struct sigaction." >&4
16532                 val="$undef"
16533         fi
16534 else
16535         echo 'sigaction NOT found.' >&4
16536         val="$undef"
16537 fi
16538 set d_sigaction; eval $setvar
16539 $rm -f try try$_o try.c
16540
16541 : see if sigprocmask exists
16542 set sigprocmask d_sigprocmask
16543 eval $inlibc
16544
16545 : see if sigsetjmp exists
16546 echo " "
16547 case "$d_sigsetjmp" in
16548 '')
16549         $cat >try.c <<EOP
16550 #include <setjmp.h>
16551 #$i_stdlib I_STDLIB
16552 #ifdef I_STDLIB
16553 #include <stdlib.h>
16554 #endif
16555 sigjmp_buf env;
16556 int set = 1;
16557 int main()
16558 {
16559         if (sigsetjmp(env,1))
16560                 exit(set);
16561         set = 0;
16562         siglongjmp(env, 1);
16563         exit(1);
16564 }
16565 EOP
16566         set try
16567         if eval $compile; then
16568                 if $run ./try >/dev/null 2>&1; then
16569                         echo "POSIX sigsetjmp found." >&4
16570                         val="$define"
16571                 else
16572                         $cat >&4 <<EOM
16573 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16574 I'll ignore them.
16575 EOM
16576                         val="$undef"
16577                 fi
16578         else
16579                 echo "sigsetjmp not found." >&4
16580                 val="$undef"
16581         fi
16582         ;;
16583 *) val="$d_sigsetjmp"
16584         case "$d_sigsetjmp" in
16585         $define) echo "POSIX sigsetjmp found." >&4;;
16586         $undef) echo "sigsetjmp not found." >&4;;
16587         esac
16588         ;;
16589 esac
16590 set d_sigsetjmp
16591 eval $setvar
16592 $rm -f try.c try
16593
16594 : see if snprintf exists
16595 set snprintf d_snprintf
16596 eval $inlibc
16597
16598 : see if vsnprintf exists
16599 set vsnprintf d_vsnprintf
16600 eval $inlibc
16601
16602 case "$d_snprintf-$d_vsnprintf" in
16603 "$define-$define")
16604     $cat <<EOM
16605 Checking whether your snprintf() and vsnprintf() work okay...
16606 EOM
16607     $cat >try.c <<'EOCP'
16608 /* v?snprintf testing logic courtesy of Russ Allbery.
16609  * According to C99:
16610  * - if the buffer is too short it still must be \0-terminated
16611  * - if the buffer is too short the potentially required length
16612  *   must be returned and not -1
16613  * - if the buffer is NULL the potentially required length
16614  *   must be returned and not -1 or core dump
16615  */
16616 #include <stdio.h>
16617 #include <stdarg.h>
16618
16619 char buf[2];
16620
16621 int test (char *format, ...)
16622 {
16623     va_list args;
16624     int count;
16625
16626     va_start (args, format);
16627     count = vsnprintf (buf, sizeof buf, format, args);
16628     va_end (args);
16629     return count;
16630 }
16631
16632 int main ()
16633 {
16634     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16635              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16636 }
16637 EOCP
16638     set try
16639     if eval $compile; then
16640         `$run ./try`
16641         case "$?" in
16642         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16643         *) cat <<EOM >&4
16644 Your snprintf() and snprintf() don't seem to be working okay.
16645 EOM
16646            d_snprintf="$undef"
16647            d_vsnprintf="$undef"
16648            ;;
16649         esac
16650     else
16651         echo "(I can't seem to compile the test program--assuming they don't)"
16652         d_snprintf="$undef"
16653         d_vsnprintf="$undef"
16654     fi
16655     $rm -f try.* try core core.try.*
16656     ;;
16657 esac
16658
16659 : see if sockatmark exists
16660 set sockatmark d_sockatmark
16661 eval $inlibc
16662
16663 : see if prototype for sockatmark is available
16664 echo " "
16665 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16666 eval $hasproto
16667
16668 : see if socks5_init exists
16669 set socks5_init d_socks5_init
16670 eval $inlibc
16671
16672 : see if sprintf returns the length of the string in the buffer as per ANSI
16673 $echo "Checking whether sprintf returns the length of the string..." >&4
16674 $cat <<EOP >try.c
16675 #include <stdio.h>
16676 #$i_stdlib I_STDLIB
16677 #ifdef I_STDLIB
16678 #include <stdlib.h>
16679 #endif
16680 #$i_string I_STRING
16681 #ifdef I_STRING
16682 #  include <string.h>
16683 #else
16684 #  include <strings.h>
16685 #endif
16686 #$i_math I_MATH
16687 #ifdef I_MATH
16688 #include <math.h>
16689 #endif
16690
16691 char buffer[256];
16692
16693 int check (size_t expect, int test) {
16694   size_t got = strlen(buffer);
16695   if (expect == got)
16696     return 0;
16697
16698   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16699        test, buffer);
16700   exit (test);
16701 }
16702
16703 int main(int argc, char **argv) {
16704   int test = 0;
16705
16706   check(sprintf(buffer, ""), ++test);
16707   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16708   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16709
16710   return 0;
16711 }
16712 EOP
16713 set try
16714
16715 d_sprintf_returns_strlen="$undef"
16716 if eval $compile; then
16717     xxx="`$run ./try`"
16718     case "$?" in
16719         0) cat >&4 <<EOM
16720 sprintf returns the length of the string (as ANSI says it should)
16721 EOM
16722         d_sprintf_returns_strlen="$define"
16723         ;;
16724         *) cat >&4 <<EOM
16725 sprintf does not return the length of the string (how old is this system?)
16726 EOM
16727         d_sprintf_returns_strlen="$undef"
16728         ;;
16729     esac
16730 fi
16731
16732 $rm -f try.* try
16733
16734 : see if srand48_r exists
16735 set srand48_r d_srand48_r
16736 eval $inlibc
16737 case "$d_srand48_r" in
16738 "$define")
16739         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16740         case "$d_srand48_r_proto:$usethreads" in
16741         ":define")      d_srand48_r_proto=define
16742                 set d_srand48_r_proto srand48_r $hdrs
16743                 eval $hasproto ;;
16744         *)      ;;
16745         esac
16746         case "$d_srand48_r_proto" in
16747         define)
16748         case "$srand48_r_proto" in
16749         ''|0) try='int srand48_r(long, struct drand48_data*);'
16750         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16751         esac
16752         case "$srand48_r_proto" in
16753         ''|0)   d_srand48_r=undef
16754                 srand48_r_proto=0
16755                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16756         * )     case "$srand48_r_proto" in
16757                 REENTRANT_PROTO*) ;;
16758                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16759                 esac
16760                 echo "Prototype: $try" ;;
16761         esac
16762         ;;
16763         *)      case "$usethreads" in
16764                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16765                 esac
16766                 d_srand48_r=undef
16767                 srand48_r_proto=0
16768                 ;;
16769         esac
16770         ;;
16771 *)      srand48_r_proto=0
16772         ;;
16773 esac
16774
16775 : see if srandom_r exists
16776 set srandom_r d_srandom_r
16777 eval $inlibc
16778 case "$d_srandom_r" in
16779 "$define")
16780         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16781         case "$d_srandom_r_proto:$usethreads" in
16782         ":define")      d_srandom_r_proto=define
16783                 set d_srandom_r_proto srandom_r $hdrs
16784                 eval $hasproto ;;
16785         *)      ;;
16786         esac
16787         case "$d_srandom_r_proto" in
16788         define)
16789         case "$srandom_r_proto" in
16790         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16791         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16792         esac
16793         case "$srandom_r_proto" in
16794         ''|0)   d_srandom_r=undef
16795                 srandom_r_proto=0
16796                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16797         * )     case "$srandom_r_proto" in
16798                 REENTRANT_PROTO*) ;;
16799                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16800                 esac
16801                 echo "Prototype: $try" ;;
16802         esac
16803         ;;
16804         *)      case "$usethreads" in
16805                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16806                 esac
16807                 d_srandom_r=undef
16808                 srandom_r_proto=0
16809                 ;;
16810         esac
16811         ;;
16812 *)      srandom_r_proto=0
16813         ;;
16814 esac
16815
16816 : see if prototype for setresgid is available
16817 echo " "
16818 set d_sresgproto setresgid $i_unistd unistd.h
16819 eval $hasproto
16820
16821 : see if prototype for setresuid is available
16822 echo " "
16823 set d_sresuproto setresuid $i_unistd unistd.h
16824 eval $hasproto
16825
16826 : see if sys/stat.h is available
16827 set sys/stat.h i_sysstat
16828 eval $inhdr
16829
16830
16831 : see if stat knows about block sizes
16832 echo " "
16833 echo "Checking to see if your struct stat has st_blocks field..." >&4
16834 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16835 eval $hasfield
16836
16837
16838 : see if this is a sys/vfs.h system
16839 set sys/vfs.h i_sysvfs
16840 eval $inhdr
16841
16842
16843 : see if this is a sys/statfs.h system
16844 set sys/statfs.h i_sysstatfs
16845 eval $inhdr
16846
16847
16848 echo " "
16849 echo "Checking to see if your system supports struct statfs..." >&4
16850 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
16851 eval $hasstruct
16852 case "$d_statfs_s" in
16853 "$define")      echo "Yes, it does."   ;;
16854 *)              echo "No, it doesn't." ;;
16855 esac
16856
16857
16858
16859 : see if struct statfs knows about f_flags
16860 case "$d_statfs_s" in
16861 define) 
16862         echo " "
16863         echo "Checking to see if your struct statfs has f_flags field..." >&4
16864         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
16865         eval $hasfield
16866         ;;
16867 *)      val="$undef"
16868         set d_statfs_f_flags
16869         eval $setvar
16870         ;;
16871 esac
16872 case "$d_statfs_f_flags" in
16873 "$define")      echo "Yes, it does."   ;;
16874 *)              echo "No, it doesn't." ;;
16875 esac
16876
16877 $cat >&4 <<EOM
16878 Checking how to access stdio streams by file descriptor number...
16879 EOM
16880 case "$stdio_stream_array" in
16881 '')     $cat >try.c <<EOCP
16882 #include <stdio.h>
16883 int main() {
16884   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16885     printf("yes\n");
16886 }
16887 EOCP
16888         for s in _iob __iob __sF
16889         do
16890                 set try -DSTDIO_STREAM_ARRAY=$s
16891                 if eval $compile; then
16892                         case "`$run ./try`" in
16893                         yes)    stdio_stream_array=$s; break ;;
16894                         esac
16895                 fi
16896         done
16897         $rm -f try.* try$exe_ext
16898 esac
16899 case "$stdio_stream_array" in
16900 '')     $cat >&4 <<EOM
16901 I can't figure out how to access stdio streams by file descriptor number.
16902 EOM
16903         d_stdio_stream_array="$undef"
16904         ;;
16905 *)      $cat >&4 <<EOM
16906 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16907 EOM
16908         d_stdio_stream_array="$define"
16909         ;;
16910 esac
16911
16912 : see if strcoll exists
16913 set strcoll d_strcoll
16914 eval $inlibc
16915
16916 : check for structure copying
16917 echo " "
16918 echo "Checking to see if your C compiler can copy structs..." >&4
16919 $cat >try.c <<'EOCP'
16920 int main()
16921 {
16922         struct blurfl {
16923                 int dyick;
16924         } foo, bar;
16925
16926         foo = bar;
16927 }
16928 EOCP
16929 if $cc -c try.c >/dev/null 2>&1 ; then
16930         val="$define"
16931         echo "Yup, it can."
16932 else
16933         val="$undef"
16934         echo "Nope, it can't."
16935 fi
16936 set d_strctcpy
16937 eval $setvar
16938 $rm -f try.*
16939
16940 : see if strerror and/or sys_errlist[] exist
16941 echo " "
16942 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16943     if set strerror val -f d_strerror; eval $csym; $val; then
16944                 echo 'strerror() found.' >&4
16945                 d_strerror="$define"
16946                 d_strerrm='strerror(e)'
16947                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16948                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16949                         d_syserrlst="$define"
16950                 else
16951                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16952                         d_syserrlst="$undef"
16953                 fi
16954     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16955                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16956                 echo 'strerror() found in string header.' >&4
16957                 d_strerror="$define"
16958                 d_strerrm='strerror(e)'
16959                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16960                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16961                                 d_syserrlst="$define"
16962                 else
16963                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16964                         d_syserrlst="$undef"
16965                 fi
16966     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16967                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16968                 d_strerror="$undef"
16969                 d_syserrlst="$define"
16970                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16971     else
16972                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16973                 d_strerror="$undef"
16974                 d_syserrlst="$undef"
16975                 d_strerrm='"unknown"'
16976     fi
16977 fi
16978
16979 : see if strerror_r exists
16980 set strerror_r d_strerror_r
16981 eval $inlibc
16982 case "$d_strerror_r" in
16983 "$define")
16984         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16985         case "$d_strerror_r_proto:$usethreads" in
16986         ":define")      d_strerror_r_proto=define
16987                 set d_strerror_r_proto strerror_r $hdrs
16988                 eval $hasproto ;;
16989         *)      ;;
16990         esac
16991         case "$d_strerror_r_proto" in
16992         define)
16993         case "$strerror_r_proto" in
16994         ''|0) try='int strerror_r(int, char*, size_t);'
16995         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16996         esac
16997         case "$strerror_r_proto" in
16998         ''|0) try='int strerror_r(int, char*, int);'
16999         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17000         esac
17001         case "$strerror_r_proto" in
17002         ''|0) try='char* strerror_r(int, char*, size_t);'
17003         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17004         esac
17005         case "$strerror_r_proto" in
17006         ''|0)   d_strerror_r=undef
17007                 strerror_r_proto=0
17008                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17009         * )     case "$strerror_r_proto" in
17010                 REENTRANT_PROTO*) ;;
17011                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17012                 esac
17013                 echo "Prototype: $try" ;;
17014         esac
17015         ;;
17016         *)      case "$usethreads" in
17017                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17018                 esac
17019                 d_strerror_r=undef
17020                 strerror_r_proto=0
17021                 ;;
17022         esac
17023         ;;
17024 *)      strerror_r_proto=0
17025         ;;
17026 esac
17027
17028 : see if strftime exists
17029 set strftime d_strftime
17030 eval $inlibc
17031
17032 : see if strlcat exists
17033 set strlcat d_strlcat
17034 eval $inlibc
17035
17036 : see if strlcpy exists
17037 set strlcpy d_strlcpy
17038 eval $inlibc
17039
17040 : see if strtod exists
17041 set strtod d_strtod
17042 eval $inlibc
17043
17044 : see if strtol exists
17045 set strtol d_strtol
17046 eval $inlibc
17047
17048 : see if strtold exists
17049 set strtold d_strtold
17050 eval $inlibc
17051
17052 : see if strtoll exists
17053 set strtoll d_strtoll
17054 eval $inlibc
17055
17056 case "$d_longlong-$d_strtoll" in
17057 "$define-$define")
17058         $cat <<EOM
17059 Checking whether your strtoll() works okay...
17060 EOM
17061         $cat >try.c <<'EOCP'
17062 #include <errno.h>
17063 #ifdef __hpux
17064 #define strtoll __strtoll
17065 #endif
17066 #ifdef __EMX__
17067 #define strtoll _strtoll
17068 #endif
17069 #include <stdio.h>
17070 extern long long int strtoll(char *s, char **, int); 
17071 static int bad = 0;
17072 int check(char *s, long long ell, int een) {
17073         long long gll;
17074         errno = 0;
17075         gll = strtoll(s, 0, 10);
17076         if (!((gll == ell) && (errno == een)))
17077                 bad++;
17078 }
17079 int main() {
17080         check(" 1",                                      1LL, 0);
17081         check(" 0",                                      0LL, 0);
17082         check("-1",                                     -1LL, 0);
17083         check("-9223372036854775808", -9223372036854775808LL, 0);
17084         check("-9223372036854775808", -9223372036854775808LL, 0);
17085         check(" 9223372036854775807",  9223372036854775807LL, 0);
17086         check("-9223372036854775808", -9223372036854775808LL, 0);
17087         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17088         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17089         if (!bad)
17090                 printf("ok\n");
17091 }
17092 EOCP
17093         set try
17094         if eval $compile; then
17095                 yyy=`$run ./try`
17096                 case "$yyy" in
17097                 ok) echo "Your strtoll() seems to be working okay." ;;
17098                 *) cat <<EOM >&4
17099 Your strtoll() doesn't seem to be working okay.
17100 EOM
17101                    d_strtoll="$undef"
17102                    ;;
17103                 esac
17104         else
17105                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17106                 d_strtoll="$undef"
17107         fi
17108         ;;
17109 esac
17110
17111 : see if strtoq exists
17112 set strtoq d_strtoq
17113 eval $inlibc
17114
17115 : see if strtoul exists
17116 set strtoul d_strtoul
17117 eval $inlibc
17118
17119 case "$d_strtoul" in
17120 "$define")
17121         $cat <<EOM
17122 Checking whether your strtoul() works okay...
17123 EOM
17124         $cat >try.c <<'EOCP'
17125 #include <errno.h>
17126 #include <stdio.h>
17127 extern unsigned long int strtoul(char *s, char **, int); 
17128 static int bad = 0;
17129 void check(char *s, unsigned long eul, int een) {
17130         unsigned long gul;
17131         errno = 0;
17132         gul = strtoul(s, 0, 10);
17133         if (!((gul == eul) && (errno == een)))
17134                 bad++;
17135 }
17136 int main() {
17137         check(" 1", 1L, 0);
17138         check(" 0", 0L, 0);
17139 EOCP
17140         case "$longsize" in
17141         8)
17142             $cat >>try.c <<'EOCP'
17143         check("18446744073709551615", 18446744073709551615UL, 0);
17144         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17145 #if 0 /* strtoul() for /^-/ strings is undefined. */
17146         check("-1", 18446744073709551615UL, 0);
17147         check("-18446744073709551614", 2, 0);
17148         check("-18446744073709551615", 1, 0);
17149         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17150         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17151 #endif
17152 EOCP
17153                 ;;
17154         4)
17155                     $cat >>try.c <<'EOCP'
17156         check("4294967295", 4294967295UL, 0);
17157         check("4294967296", 4294967295UL, ERANGE);
17158 #if 0 /* strtoul() for /^-/ strings is undefined. */
17159         check("-1", 4294967295UL, 0);
17160         check("-4294967294", 2, 0);
17161         check("-4294967295", 1, 0);
17162         check("-4294967296", 4294967295UL, ERANGE);
17163         check("-4294967297", 4294967295UL, ERANGE);
17164 #endif
17165 EOCP
17166                 ;;
17167         *)
17168 : Should we write these tests to be more portable by sprintf-ing
17169 : ~0 and then manipulating that char string as input for strtol?
17170                 ;;
17171         esac
17172         $cat >>try.c <<'EOCP'
17173         if (!bad)
17174                 printf("ok\n");
17175         return 0;
17176 }
17177 EOCP
17178         set try
17179         if eval $compile; then
17180                 case "`$run ./try`" in
17181                 ok) echo "Your strtoul() seems to be working okay." ;;
17182                 *) cat <<EOM >&4
17183 Your strtoul() doesn't seem to be working okay.
17184 EOM
17185                    d_strtoul="$undef"
17186                    ;;
17187                 esac
17188         fi
17189         ;;
17190 esac
17191
17192 : see if strtoull exists
17193 set strtoull d_strtoull
17194 eval $inlibc
17195
17196 case "$d_longlong-$d_strtoull" in
17197 "$define-$define")
17198         $cat <<EOM
17199 Checking whether your strtoull() works okay...
17200 EOM
17201         $cat >try.c <<'EOCP'
17202 #include <errno.h>
17203 #ifdef __hpux
17204 #define strtoull __strtoull
17205 #endif
17206 #include <stdio.h>
17207 extern unsigned long long int strtoull(char *s, char **, int); 
17208 static int bad = 0;
17209 int check(char *s, long long eull, int een) {
17210         long long gull;
17211         errno = 0;
17212         gull = strtoull(s, 0, 10);
17213         if (!((gull == eull) && (errno == een)))
17214                 bad++;
17215 }
17216 int main() {
17217         check(" 1",                                        1LL, 0);
17218         check(" 0",                                        0LL, 0);
17219         check("18446744073709551615",  18446744073709551615ULL, 0);
17220         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17221 #if 0 /* strtoull() for /^-/ strings is undefined. */
17222         check("-1",                    18446744073709551615ULL, 0);
17223         check("-18446744073709551614",                     2LL, 0);
17224         check("-18446744073709551615",                     1LL, 0);
17225         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17226         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17227 #endif
17228         if (!bad)
17229                 printf("ok\n");
17230 }
17231 EOCP
17232         set try
17233         if eval $compile; then
17234                 case "`$run ./try`" in
17235                 ok) echo "Your strtoull() seems to be working okay." ;;
17236                 *) cat <<EOM >&4
17237 Your strtoull() doesn't seem to be working okay.
17238 EOM
17239                    d_strtoull="$undef"
17240                    ;;
17241                 esac
17242         fi
17243         ;;
17244 esac
17245
17246 : see if strtouq exists
17247 set strtouq d_strtouq
17248 eval $inlibc
17249
17250 case "$d_strtouq" in
17251 "$define")
17252         $cat <<EOM
17253 Checking whether your strtouq() works okay...
17254 EOM
17255         $cat >try.c <<'EOCP'
17256 #include <errno.h>
17257 #include <stdio.h>
17258 extern unsigned long long int strtouq(char *s, char **, int); 
17259 static int bad = 0;
17260 void check(char *s, unsigned long long eull, int een) {
17261         unsigned long long gull;
17262         errno = 0;
17263         gull = strtouq(s, 0, 10);
17264         if (!((gull == eull) && (errno == een)))
17265                 bad++;
17266 }
17267 int main() {
17268         check(" 1",                                        1LL, 0);
17269         check(" 0",                                        0LL, 0);
17270         check("18446744073709551615",  18446744073709551615ULL, 0);
17271         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17272 #if 0 /* strtouq() for /^-/ strings is undefined. */
17273         check("-1",                    18446744073709551615ULL, 0);
17274         check("-18446744073709551614",                     2LL, 0);
17275         check("-18446744073709551615",                     1LL, 0);
17276         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17277         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17278 #endif
17279         if (!bad)
17280                 printf("ok\n");
17281         return 0;
17282 }
17283 EOCP
17284         set try
17285         if eval $compile; then
17286                 case "`$run ./try`" in
17287                 ok) echo "Your strtouq() seems to be working okay." ;;
17288                 *) cat <<EOM >&4
17289 Your strtouq() doesn't seem to be working okay.
17290 EOM
17291                    d_strtouq="$undef"
17292                    ;;
17293                 esac
17294         fi
17295         ;;
17296 esac
17297
17298 : see if strxfrm exists
17299 set strxfrm d_strxfrm
17300 eval $inlibc
17301
17302 : see if symlink exists
17303 set symlink d_symlink
17304 eval $inlibc
17305
17306 : see if syscall exists
17307 set syscall d_syscall
17308 eval $inlibc
17309
17310 : see if prototype for syscall is available
17311 echo " "
17312 set d_syscallproto syscall $i_unistd unistd.h
17313 eval $hasproto
17314
17315 : see if sysconf exists
17316 set sysconf d_sysconf
17317 eval $inlibc
17318
17319 : see if system exists
17320 set system d_system
17321 eval $inlibc
17322
17323 : see if tcgetpgrp exists
17324 set tcgetpgrp d_tcgetpgrp
17325 eval $inlibc
17326
17327 : see if tcsetpgrp exists
17328 set tcsetpgrp d_tcsetpgrp
17329 eval $inlibc
17330
17331 : see if prototype for telldir is available
17332 echo " "
17333 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17334 eval $hasproto
17335
17336 : see if time exists
17337 echo " "
17338 if test "X$d_time" = X -o X"$timetype" = X; then
17339     if set time val -f d_time; eval $csym; $val; then
17340                 echo 'time() found.' >&4
17341                 val="$define"
17342                 rp="What is the type returned by time() on this system?"
17343                 set time_t timetype long stdio.h sys/types.h
17344                 eval $typedef_ask
17345     else
17346                 echo 'time() not found, hope that will do.' >&4
17347                 val="$undef"
17348                 timetype='int';
17349     fi
17350     set d_time
17351     eval $setvar
17352 fi
17353
17354 : see if this is a sys/times.h system
17355 set sys/times.h i_systimes
17356 eval $inhdr
17357
17358 : see if times exists
17359 echo " "
17360 if set times val -f d_times; eval $csym; $val; then
17361         echo 'times() found.' >&4
17362         d_times="$define"
17363         inc=''
17364         case "$i_systimes" in
17365         "$define") inc='sys/times.h';;
17366         esac
17367         rp="What is the type returned by times() on this system?"
17368         set clock_t clocktype long stdio.h sys/types.h $inc
17369         eval $typedef_ask
17370 else
17371         echo 'times() NOT found, hope that will do.' >&4
17372         d_times="$undef"
17373         clocktype='int'
17374 fi
17375
17376 : see if tmpnam_r exists
17377 set tmpnam_r d_tmpnam_r
17378 eval $inlibc
17379 case "$d_tmpnam_r" in
17380 "$define")
17381         hdrs="$i_systypes sys/types.h define stdio.h "
17382         case "$d_tmpnam_r_proto:$usethreads" in
17383         ":define")      d_tmpnam_r_proto=define
17384                 set d_tmpnam_r_proto tmpnam_r $hdrs
17385                 eval $hasproto ;;
17386         *)      ;;
17387         esac
17388         case "$d_tmpnam_r_proto" in
17389         define)
17390         case "$tmpnam_r_proto" in
17391         ''|0) try='char* tmpnam_r(char*);'
17392         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17393         esac
17394         case "$tmpnam_r_proto" in
17395         ''|0)   d_tmpnam_r=undef
17396                 tmpnam_r_proto=0
17397                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17398         * )     case "$tmpnam_r_proto" in
17399                 REENTRANT_PROTO*) ;;
17400                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17401                 esac
17402                 echo "Prototype: $try" ;;
17403         esac
17404         ;;
17405         *)      case "$usethreads" in
17406                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17407                 esac
17408                 d_tmpnam_r=undef
17409                 tmpnam_r_proto=0
17410                 ;;
17411         esac
17412         ;;
17413 *)      tmpnam_r_proto=0
17414         ;;
17415 esac
17416
17417 : see if truncate exists
17418 set truncate d_truncate
17419 eval $inlibc
17420
17421 : see if ttyname_r exists
17422 set ttyname_r d_ttyname_r
17423 eval $inlibc
17424 case "$d_ttyname_r" in
17425 "$define")
17426         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17427         case "$d_ttyname_r_proto:$usethreads" in
17428         ":define")      d_ttyname_r_proto=define
17429                 set d_ttyname_r_proto ttyname_r $hdrs
17430                 eval $hasproto ;;
17431         *)      ;;
17432         esac
17433         case "$d_ttyname_r_proto" in
17434         define)
17435         case "$ttyname_r_proto" in
17436         ''|0) try='int ttyname_r(int, char*, size_t);'
17437         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17438         esac
17439         case "$ttyname_r_proto" in
17440         ''|0) try='int ttyname_r(int, char*, int);'
17441         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17442         esac
17443         case "$ttyname_r_proto" in
17444         ''|0) try='char* ttyname_r(int, char*, int);'
17445         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17446         esac
17447         case "$ttyname_r_proto" in
17448         ''|0)   d_ttyname_r=undef
17449                 ttyname_r_proto=0
17450                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17451         * )     case "$ttyname_r_proto" in
17452                 REENTRANT_PROTO*) ;;
17453                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17454                 esac
17455                 echo "Prototype: $try" ;;
17456         esac
17457         ;;
17458         *)      case "$usethreads" in
17459                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17460                 esac
17461                 d_ttyname_r=undef
17462                 ttyname_r_proto=0
17463                 ;;
17464         esac
17465         ;;
17466 *)      ttyname_r_proto=0
17467         ;;
17468 esac
17469
17470 : see if tzname[] exists
17471 echo " "
17472 if set tzname val -a d_tzname; eval $csym; $val; then
17473         val="$define"
17474         echo 'tzname[] found.' >&4
17475 else
17476         val="$undef"
17477         echo 'tzname[] NOT found.' >&4
17478 fi
17479 set d_tzname
17480 eval $setvar
17481
17482 case "$osname" in
17483 next|rhapsody|darwin) multiarch="$define" ;;
17484 esac
17485 case "$multiarch" in
17486 ''|[nN]*) multiarch="$undef" ;;
17487 esac
17488
17489 : check for ordering of bytes in a UV
17490 echo " "
17491 case "$usecrosscompile$multiarch" in
17492 *$define*)
17493         $cat <<EOM
17494 You seem to be either cross-compiling or doing a multiarchitecture build,
17495 skipping the byteorder check.
17496
17497 EOM
17498         byteorder='ffff'
17499         ;;
17500 *)
17501         case "$byteorder" in
17502         '')
17503                 $cat <<'EOM'
17504 In the following, larger digits indicate more significance.  A big-endian
17505 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17506 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17507 machines may have weird orders like 3412.  A Cray will report 87654321,
17508 an Alpha will report 12345678. If the test program works the default is
17509 probably right.
17510 I'm now running the test program...
17511 EOM
17512                 $cat >try.c <<EOCP
17513 #include <stdio.h>
17514 #$i_stdlib I_STDLIB
17515 #ifdef I_STDLIB
17516 #include <stdlib.h>
17517 #endif
17518 #include <sys/types.h>
17519 typedef $uvtype UV;
17520 int main()
17521 {
17522         int i;
17523         union {
17524                 UV l;
17525                 char c[$uvsize];
17526         } u;
17527
17528         if ($uvsize > 4)
17529                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17530         else
17531                 u.l = (UV)0x04030201;
17532         for (i = 0; i < $uvsize; i++)
17533                 printf("%c", u.c[i]+'0');
17534         printf("\n");
17535         exit(0);
17536 }
17537 EOCP
17538                 xxx_prompt=y
17539                 set try
17540                 if eval $compile && ./try > /dev/null; then
17541                         dflt=`$run ./try`
17542                         case "$dflt" in
17543                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17544                                 echo "(The test program ran ok.)"
17545                                 echo "byteorder=$dflt"
17546                                 xxx_prompt=n
17547                         ;;
17548                         ????|????????) echo "(The test program ran ok.)" ;;
17549                         *) echo "(The test program didn't run right for some reason.)" ;;
17550                         esac
17551                 else
17552                         dflt='4321'
17553                         cat <<'EOM'
17554 (I can't seem to compile the test program.  Guessing big-endian...)
17555 EOM
17556                 fi
17557                 case "$xxx_prompt" in
17558                 y)
17559                         rp="What is the order of bytes in $uvtype?"
17560                         . ./myread
17561                         byteorder="$ans"
17562                         ;;
17563                 *)      byteorder=$dflt
17564                         ;;
17565                 esac
17566                 ;;
17567         esac
17568         $rm -f try.c try
17569         ;;
17570 esac
17571
17572
17573 $cat <<EOM
17574
17575 Checking to see whether you can access character data unalignedly...
17576 EOM
17577 case "$d_u32align" in
17578 '')   $cat >try.c <<EOCP
17579 #include <stdio.h>
17580 #$i_stdlib I_STDLIB
17581 #ifdef I_STDLIB
17582 #include <stdlib.h>
17583 #endif
17584 #define U32 $u32type
17585 #define BYTEORDER 0x$byteorder
17586 #define U8 $u8type
17587 #include <signal.h>
17588 #ifdef SIGBUS
17589 $signal_t bletch(s) int s; { exit(4); }
17590 #endif
17591 int main() {
17592 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17593     U8 buf[8];
17594     U32 *up;
17595     int i;
17596
17597     if (sizeof(U32) != 4) {
17598         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17599         exit(1);
17600     }
17601
17602     fflush(stdout);
17603
17604 #ifdef SIGBUS
17605     signal(SIGBUS, bletch);
17606 #endif
17607
17608     buf[0] = 0;
17609     buf[1] = 0;
17610     buf[2] = 0;
17611     buf[3] = 1;
17612     buf[4] = 0;
17613     buf[5] = 0;
17614     buf[6] = 0;
17615     buf[7] = 1;
17616
17617     for (i = 0; i < 4; i++) {
17618         up = (U32*)(buf + i);
17619         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17620                (*up == 1 << (8*(3-i)))  /* little-endian */
17621               )
17622            )
17623         {
17624             printf("read failed (%x)\n", *up);
17625             exit(2);
17626         }
17627     }
17628
17629     /* write test */
17630     for (i = 0; i < 4; i++) {
17631         up = (U32*)(buf + i);
17632         *up = 0xBeef;
17633         if (*up != 0xBeef) {
17634             printf("write failed (%x)\n", *up);
17635             exit(3);
17636         }
17637     }
17638
17639     exit(0);
17640 #else
17641     printf("1\n");
17642     exit(1);
17643 #endif
17644     return 0;
17645 }
17646 EOCP
17647 set try
17648 if eval $compile_ok; then
17649         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17650         $run ./try 2>&1 >/dev/null
17651         case "$?" in
17652         0)      cat >&4 <<EOM
17653 You can access character data pretty unalignedly.
17654 EOM
17655                 d_u32align="$undef"
17656                 ;;
17657         *)      cat >&4 <<EOM
17658 It seems that you must access character data in an aligned manner.
17659 EOM
17660                 d_u32align="$define"
17661                 ;;
17662         esac
17663 else
17664         rp='Can you access character data at unaligned addresses?'
17665         dflt='n'
17666         . ./myread
17667         case "$ans" in
17668         [yY]*)  d_u32align="$undef"  ;;
17669         *)      d_u32align="$define" ;;
17670         esac
17671 fi
17672 $rm -f core core.try.* try.core
17673 ;;
17674 esac
17675
17676 : see if ualarm exists
17677 set ualarm d_ualarm
17678 eval $inlibc
17679
17680 : see if umask exists
17681 set umask d_umask
17682 eval $inlibc
17683
17684 : see if unordered exists
17685 set unordered d_unordered
17686 eval $inlibc
17687
17688 : see if unsetenv exists
17689 set unsetenv d_unsetenv
17690 eval $inlibc
17691
17692 : see if usleep exists
17693 set usleep d_usleep
17694 eval $inlibc
17695
17696 : see if prototype for usleep is available
17697 echo " "
17698 set d_usleepproto usleep $i_unistd unistd.h
17699 eval $hasproto
17700
17701 : see if ustat exists
17702 set ustat d_ustat
17703 eval $inlibc
17704
17705 : backward compatibility for d_hvfork
17706 if test X$d_hvfork != X; then
17707         d_vfork="$d_hvfork"
17708         d_hvfork=''
17709 fi
17710 : see if there is a vfork
17711 val=''
17712 set vfork val
17713 eval $inlibc
17714
17715 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17716 : perl on Solaris 2.x, and probably elsewhere.
17717 case "$val" in
17718 $define)
17719         echo " "
17720         case "$usevfork" in
17721         false) dflt='n';;
17722         *) dflt='y';;
17723         esac
17724         cat <<'EOM'
17725  
17726 Perl can only use a vfork() that doesn't suffer from strict
17727 restrictions on calling functions or modifying global data in
17728 the child.  For example, glibc-2.1 contains such a vfork()
17729 that is unsuitable.  If your system provides a proper fork()
17730 call, chances are that you do NOT want perl to use vfork().
17731
17732 EOM
17733         rp="Do you still want to use vfork()?"
17734         . ./myread
17735         case "$ans" in
17736         y|Y) ;;
17737         *)
17738                 echo "Ok, we won't use vfork()."
17739                 val="$undef"
17740                 ;;
17741         esac
17742         ;;
17743 esac
17744 set d_vfork
17745 eval $setvar
17746 case "$d_vfork" in
17747 $define) usevfork='true';;
17748 *) usevfork='false';;
17749 esac
17750
17751 : see if closedir exists
17752 set closedir d_closedir
17753 eval $inlibc
17754
17755 case "$d_closedir" in
17756 "$define")
17757         echo " "
17758         echo "Checking whether closedir() returns a status..." >&4
17759         cat > try.c <<EOM
17760 #$i_dirent I_DIRENT             /**/
17761 #$i_sysdir I_SYS_DIR            /**/
17762 #$i_sysndir I_SYS_NDIR          /**/
17763 #$i_systypes I_SYS_TYPES        /**/
17764
17765 #if defined(I_SYS_TYPES)
17766 #include <sys/types.h>
17767 #endif
17768 #if defined(I_DIRENT)
17769 #include <dirent.h>
17770 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17771 #include <sys/dir.h>
17772 #endif
17773 #else
17774 #ifdef I_SYS_NDIR
17775 #include <sys/ndir.h>
17776 #else
17777 #ifdef I_SYS_DIR
17778 #ifdef hp9000s500
17779 #include <ndir.h>       /* may be wrong in the future */
17780 #else
17781 #include <sys/dir.h>
17782 #endif
17783 #endif
17784 #endif
17785 #endif 
17786 int main() { return closedir(opendir(".")); }
17787 EOM
17788         set try
17789         if eval $compile_ok; then
17790                 if $run ./try > /dev/null 2>&1 ; then
17791                         echo "Yes, it does."
17792                         val="$undef"
17793                 else
17794                         echo "No, it doesn't."
17795                         val="$define"
17796                 fi
17797         else
17798                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17799                 val="$define"
17800         fi
17801         ;;
17802 *)
17803         val="$undef";
17804         ;;
17805 esac
17806 set d_void_closedir
17807 eval $setvar
17808 $rm -f try try.*
17809 : see if there is a wait4
17810 set wait4 d_wait4
17811 eval $inlibc
17812
17813 : see if waitpid exists
17814 set waitpid d_waitpid
17815 eval $inlibc
17816
17817 : see if wcstombs exists
17818 set wcstombs d_wcstombs
17819 eval $inlibc
17820
17821 : see if wctomb exists
17822 set wctomb d_wctomb
17823 eval $inlibc
17824
17825 : see if writev exists
17826 set writev d_writev
17827 eval $inlibc
17828
17829 : preserve RCS keywords in files with variable substitution, grrr
17830 Date='$Date'
17831 Id='$Id'
17832 Log='$Log'
17833 RCSfile='$RCSfile'
17834 Revision='$Revision'
17835
17836 : check for alignment requirements
17837 echo " "
17838 case "$usecrosscompile$multiarch" in
17839 *$define*)
17840         $cat <<EOM
17841 You seem to be either cross-compiling or doing a multiarchitecture build,
17842 skipping the memory alignment check.
17843
17844 EOM
17845         case "$alignbytes" in
17846         '') alignbytes=8 ;;
17847         esac
17848         ;;
17849 *)
17850         case "$alignbytes" in
17851         '') echo "Checking alignment constraints..." >&4
17852                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17853                         $cat >try.c <<'EOCP'
17854 typedef long double NV;
17855 EOCP
17856                 else
17857                         $cat >try.c <<'EOCP'
17858 typedef double NV;
17859 EOCP
17860                 fi
17861                 $cat >>try.c <<'EOCP'
17862 #include <stdio.h>
17863 struct foobar {
17864         char foo;
17865         NV bar;
17866 } try_algn;
17867 int main()
17868 {
17869     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17870     return(0);
17871 }
17872 EOCP
17873                 set try
17874                 if eval $compile_ok; then
17875                         dflt=`$run ./try`
17876                 else
17877                         dflt='8'
17878                         echo "(I can't seem to compile the test program...)"
17879                 fi
17880                 ;;
17881         *) dflt="$alignbytes"
17882                 ;;
17883         esac
17884         rp="Doubles must be aligned on a how-many-byte boundary?"
17885         . ./myread
17886         alignbytes="$ans"
17887         $rm -f try.c try
17888         ;;
17889 esac
17890
17891
17892 : set the base revision
17893 baserev=5.0
17894
17895 : how do we concatenate cpp tokens here?
17896 echo " "
17897 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17898 $cat >cpp_stuff.c <<'EOCP'
17899 #define RCAT(a,b)a/**/b
17900 #define ACAT(a,b)a ## b
17901 RCAT(Rei,ser)
17902 ACAT(Cir,cus)
17903 EOCP
17904 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17905 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17906         echo "Oh!  Smells like ANSI's been here." >&4
17907         echo "We can catify or stringify, separately or together!"
17908         cpp_stuff=42
17909 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17910         echo "Ah, yes!  The good old days!" >&4
17911         echo "However, in the good old days we don't know how to stringify and"
17912         echo "catify at the same time."
17913         cpp_stuff=1
17914 else
17915         $cat >&4 <<EOM
17916 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17917 You're going to have to edit the values of CAT[2-5] in config.h...
17918 EOM
17919         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17920 fi
17921 $rm -f cpp_stuff.*
17922
17923 : see if this is a db.h system
17924 set db.h i_db
17925 eval $inhdr
17926
17927 case "$i_db" in
17928 $define)
17929         : Check db version.
17930         echo " "
17931         echo "Checking Berkeley DB version ..." >&4
17932         $cat >try.c <<EOCP
17933 #$d_const HASCONST
17934 #ifndef HASCONST
17935 #define const
17936 #endif
17937 #include <sys/types.h>
17938 #include <stdio.h>
17939 #$i_stdlib I_STDLIB
17940 #ifdef I_STDLIB
17941 #include <stdlib.h>
17942 #endif
17943 #include <db.h>
17944 int main(int argc, char *argv[])
17945 {
17946 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17947     int Major, Minor, Patch ;
17948     unsigned long Version ;
17949     (void)db_version(&Major, &Minor, &Patch) ;
17950     if (argc == 2) {
17951         printf("%d %d %d %d %d %d\n",
17952                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17953                Major, Minor, Patch);
17954         exit(0);
17955     }
17956     printf("You have Berkeley DB Version 2 or greater.\n");
17957
17958     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17959                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17960     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17961                 Major, Minor, Patch) ;
17962
17963     /* check that db.h & libdb are compatible */
17964     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17965         printf("db.h and libdb are incompatible.\n") ;
17966         exit(3);        
17967     }
17968
17969     printf("db.h and libdb are compatible.\n") ;
17970
17971     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17972                 + DB_VERSION_PATCH ;
17973
17974     /* needs to be >= 2.3.4 */
17975     if (Version < 2003004) {
17976     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17977         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17978         exit(2);        
17979     }
17980
17981     exit(0);
17982 #else
17983 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17984     if (argc == 2) {
17985         printf("1 0 0\n");
17986         exit(0);
17987     }
17988     printf("You have Berkeley DB Version 1.\n");
17989     exit(0);    /* DB version < 2: the coast is clear. */
17990 #else
17991     exit(1);    /* <db.h> not Berkeley DB? */
17992 #endif
17993 #endif
17994 }
17995 EOCP
17996         set try
17997         if eval $compile_ok && $run ./try; then
17998                 echo 'Looks OK.' >&4
17999                 set `$run ./try 1`
18000                 db_version_major=$1
18001                 db_version_minor=$2
18002                 db_version_patch=$3
18003         else
18004                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18005                 i_db=$undef
18006                 case " $libs " in
18007                 *"-ldb "*)
18008                         : Remove db from list of libraries to use
18009                         echo "Removing unusable -ldb from library list" >&4
18010                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18011                         shift
18012                         libs="$*"
18013                         echo "libs = $libs" >&4
18014                         ;;
18015                 esac
18016         fi
18017         $rm -f try.*
18018         ;;
18019 esac
18020
18021 case "$i_db" in
18022 define)
18023         : Check the return type needed for hash 
18024         echo " "
18025         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18026         $cat >try.c <<EOCP
18027 #$d_const HASCONST
18028 #ifndef HASCONST
18029 #define const
18030 #endif
18031 #include <sys/types.h>
18032 #include <db.h>
18033
18034 #ifndef DB_VERSION_MAJOR
18035 u_int32_t hash_cb (ptr, size)
18036 const void *ptr;
18037 size_t size;
18038 {
18039 }
18040 HASHINFO info;
18041 int main()
18042 {
18043         info.hash = hash_cb;
18044 }
18045 #endif
18046 EOCP
18047         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18048                 if $contains warning try.out >>/dev/null 2>&1 ; then
18049                         db_hashtype='int'
18050                 else
18051                         db_hashtype='u_int32_t'
18052                 fi
18053         else
18054                 : XXX Maybe we should just give up here.
18055                 db_hashtype=u_int32_t
18056                 $cat try.out >&4
18057                 echo "Help:  I can't seem to compile the db test program." >&4
18058                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18059         fi
18060         $rm -f try.*
18061         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18062         ;;
18063 *)      db_hashtype=u_int32_t
18064         ;;
18065 esac
18066 case "$i_db" in
18067 define)
18068         : Check the return type needed for prefix 
18069         echo " "
18070         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18071         cat >try.c <<EOCP
18072 #$d_const HASCONST
18073 #ifndef HASCONST
18074 #define const
18075 #endif
18076 #include <sys/types.h>
18077 #include <db.h>
18078
18079 #ifndef DB_VERSION_MAJOR
18080 size_t prefix_cb (key1, key2)
18081 const DBT *key1;
18082 const DBT *key2;
18083 {
18084 }
18085 BTREEINFO info;
18086 int main()
18087 {
18088         info.prefix = prefix_cb;
18089 }
18090 #endif
18091 EOCP
18092         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18093                 if $contains warning try.out >>/dev/null 2>&1 ; then
18094                         db_prefixtype='int'
18095                 else
18096                         db_prefixtype='size_t'
18097                 fi
18098         else
18099                 db_prefixtype='size_t'
18100                 : XXX Maybe we should just give up here.
18101                 $cat try.out >&4
18102                 echo "Help:  I can't seem to compile the db test program." >&4
18103                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18104         fi
18105         $rm -f try.*
18106         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18107         ;;
18108 *)      db_prefixtype='size_t'
18109         ;;
18110 esac
18111
18112
18113 : How can we generate normalized random numbers ?
18114 echo " "
18115 echo "Looking for a random number function..." >&4
18116 case "$randfunc" in
18117 '')
18118         if set drand48 val -f; eval $csym; $val; then
18119                 dflt="drand48"
18120                 echo "Good, found drand48()." >&4
18121         elif set random val -f; eval $csym; $val; then
18122                 dflt="random"
18123                 echo "OK, found random()." >&4
18124         else
18125                 dflt="rand"
18126                 echo "Yick, looks like I have to use rand()." >&4
18127         fi
18128         echo " "
18129         ;;
18130 *)
18131         dflt="$randfunc"
18132         ;;
18133 esac
18134 cont=true
18135
18136 case "$ccflags" in
18137 *-Dmy_rand=*|*-Dmy_srand=*)
18138         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18139         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18140         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18141         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18142         ;;
18143 esac
18144
18145 while $test "$cont"; do
18146         rp="Use which function to generate random numbers?"
18147         . ./myread
18148         if $test "$ans" = "$dflt"; then
18149                 : null
18150         else
18151                 randbits=''
18152         fi
18153         randfunc="$ans"
18154         if set $ans val -f; eval $csym; $val; then
18155                 cont=''
18156         else
18157                 dflt=y
18158                 rp="I cannot find function $ans. Use that name anyway?"
18159                 . ./myread
18160                 dflt=rand
18161                 case "$ans" in
18162                         [yY]*) cont='';;
18163                 esac
18164         fi
18165         case "$cont" in
18166         '')
18167                 case "$randfunc" in
18168                 drand48)
18169                         drand01="drand48()"
18170                         seedfunc="srand48"
18171                         randbits=48
18172                         randseedtype=long
18173                         ;;
18174                 rand|random)
18175                         case "$randbits" in
18176                         '')
18177 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18178                                 $cat >try.c <<EOCP
18179 #$i_unistd I_UNISTD
18180 #$i_stdlib I_STDLIB
18181 #include <stdio.h>
18182 #ifdef I_UNISTD
18183 #  include <unistd.h>
18184 #endif
18185 #ifdef I_STDLIB
18186 #  include <stdlib.h>
18187 #endif
18188 int main()
18189 {
18190         register int i;
18191         register unsigned long tmp;
18192         register unsigned long max = 0L;
18193
18194         for (i = 1000; i; i--) {
18195                 tmp = (unsigned long) $randfunc();
18196                 if (tmp > max) max = tmp;
18197         }
18198         for (i = 0; max; i++)
18199                 max /= 2;
18200         printf("%d\n",i);
18201 }
18202 EOCP
18203                                 set try
18204                                 if eval $compile_ok; then
18205                                         dflt=`try`
18206                                 else
18207                                         dflt='?'
18208                                         echo "(I can't seem to compile the test program...)"
18209                                 fi
18210                                 ;;
18211                         *)
18212                                 dflt="$randbits"
18213                                 ;;
18214                         esac
18215                         rp="How many bits does your $randfunc() function produce?"
18216                         . ./myread
18217                         randbits="$ans"
18218                         $rm -f try.c try
18219                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18220                         seedfunc="s$randfunc"
18221                         randseedtype=unsigned
18222                         ;;
18223                 *)
18224                         dflt="31"
18225                         rp="How many bits does your $randfunc() function produce?"
18226                         . ./myread
18227                         randbits="$ans"
18228                         seedfunc="s$randfunc"
18229                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18230                         if set $seedfunc val -f; eval $csym; $val; then
18231                                 echo "(Using $seedfunc() to seed random generator)"
18232                         else
18233                                 echo "(Warning: no $seedfunc() to seed random generator)"
18234                                 seedfunc=rand
18235                         fi
18236                         randseedtype=unsigned
18237                         ;;
18238                 esac
18239                 ;;
18240         esac
18241 done
18242
18243 echo " "
18244 echo "Determining whether or not we are on an EBCDIC system..." >&4
18245 $cat >try.c <<'EOM'
18246 int main()
18247 {
18248   if ('M'==0xd4) return 0;
18249   return 1;
18250 }
18251 EOM
18252
18253 val=$undef
18254 set try
18255 if eval $compile_ok; then
18256         if $run ./try; then
18257                 echo "You seem to speak EBCDIC." >&4
18258                 val="$define"
18259         else
18260                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18261         fi
18262 else
18263         echo "I'm unable to compile the test program." >&4
18264         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18265 fi
18266 $rm -f try try.*
18267 set ebcdic
18268 eval $setvar
18269
18270 echo " "
18271 $cat >&4 <<EOM
18272 Checking how to flush all pending stdio output...
18273 EOM
18274 # I only know how to find the first 32 possibly open files on SunOS.
18275 # See also hints/sunos_4_1.sh and util.c  --AD
18276 case "$osname" in
18277 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18278 esac
18279 $cat >>try.c <<EOCP
18280 #include <stdio.h>
18281 #$i_stdlib I_STDLIB
18282 #ifdef I_STDLIB
18283 #include <stdlib.h>
18284 #endif
18285 #$i_unistd I_UNISTD
18286 #ifdef I_UNISTD
18287 # include <unistd.h>
18288 #endif
18289 #$d_sysconf HAS_SYSCONF
18290 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18291 #ifdef HAS_STDIO_STREAM_ARRAY
18292 # define STDIO_STREAM_ARRAY $stdio_stream_array
18293 #endif
18294 int main() {
18295   FILE* p;
18296   unlink("try.out");
18297   p = fopen("try.out", "w");
18298 #ifdef TRY_FPUTC
18299   fputc('x', p);
18300 #else
18301 # ifdef TRY_FPRINTF
18302   fprintf(p, "x");
18303 # endif
18304 #endif
18305 #ifdef TRY_FFLUSH_NULL
18306   fflush(NULL);
18307 #endif
18308 #ifdef TRY_FFLUSH_ALL
18309   {
18310     long open_max = -1;
18311 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18312     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18313 # else
18314 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18315     open_max = sysconf(_SC_OPEN_MAX);
18316 #  else
18317 #   ifdef FOPEN_MAX
18318     open_max = FOPEN_MAX;
18319 #   else
18320 #    ifdef OPEN_MAX
18321     open_max = OPEN_MAX;
18322 #    else
18323 #     ifdef _NFILE
18324     open_max = _NFILE;
18325 #     endif
18326 #    endif
18327 #   endif
18328 #  endif
18329 # endif 
18330 # ifdef HAS_STDIO_STREAM_ARRAY
18331     if (open_max > 0) {
18332       long i;
18333       for (i = 0; i < open_max; i++)
18334             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18335                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18336                 STDIO_STREAM_ARRAY[i]._flag)
18337                 fflush(&STDIO_STREAM_ARRAY[i]);
18338     }   
18339   }
18340 # endif
18341 #endif
18342   _exit(42);
18343 }
18344 EOCP
18345 : first we have to find out how _not_ to flush
18346 $to try.c
18347 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18348     output=''
18349     set try -DTRY_FPUTC
18350     if eval $compile; then
18351             $run ./try 2>/dev/null
18352             code="$?"
18353             $from try.out
18354             if $test ! -s try.out -a "X$code" = X42; then
18355                 output=-DTRY_FPUTC
18356             fi
18357     fi
18358     case "$output" in
18359     '')
18360             set try -DTRY_FPRINTF
18361             if eval $compile; then
18362                     $run ./try 2>/dev/null
18363                     code="$?"
18364                     $from try.out
18365                     if $test ! -s try.out -a "X$code" = X42; then
18366                         output=-DTRY_FPRINTF
18367                     fi
18368             fi
18369         ;;
18370     esac
18371 fi
18372 : check for fflush NULL behaviour
18373 case "$fflushNULL" in
18374 '')     set try -DTRY_FFLUSH_NULL $output
18375         if eval $compile; then
18376                 $run ./try 2>/dev/null
18377                 code="$?"
18378                 $from try.out
18379                 if $test -s try.out -a "X$code" = X42; then
18380                         fflushNULL="`$cat try.out`"
18381                 else
18382                         if $test "X$code" != X42; then
18383                                 $cat >&4 <<EOM
18384 (If this test failed, don't worry, we'll try another method shortly.)
18385 EOM
18386                         fi
18387                 fi
18388         fi
18389         $rm -f core try.core core.try.*
18390         case "$fflushNULL" in
18391         x)      $cat >&4 <<EOM
18392 Your fflush(NULL) works okay for output streams.
18393 Let's see if it clobbers input pipes...
18394 EOM
18395 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18396 # bug that improperly flushes the input end of pipes.  So we avoid the
18397 # autoflush on fork/system/exec support for now. :-(
18398 $cat >tryp.c <<EOCP
18399 #include <stdio.h>
18400 int
18401 main(int argc, char **argv)
18402 {
18403     char buf[1024];
18404     int i;
18405     char *bp = buf;
18406     while (1) {
18407         while ((i = getc(stdin)) != -1
18408                && (*bp++ = i) != '\n'
18409                && bp < &buf[1024])
18410         /* DO NOTHING */ ;
18411         *bp = '\0';
18412         fprintf(stdout, "%s", buf);
18413         fflush(NULL);
18414         if (i == -1)
18415             return 0;
18416         bp = buf;
18417     }
18418 }
18419 EOCP
18420                 fflushNULL="$define"
18421                 set tryp
18422                 if eval $compile; then
18423                     $rm -f tryp.out
18424                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18425                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18426                        $cat >&4 <<EOM
18427 fflush(NULL) seems to behave okay with input streams.
18428 EOM
18429                         fflushNULL="$define"
18430                     else
18431                         $cat >&4 <<EOM
18432 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18433 EOM
18434                         fflushNULL="$undef"
18435                     fi
18436                 fi
18437                 $rm -f core tryp.c tryp.core core.tryp.*
18438                 ;;
18439         '')     $cat >&4 <<EOM
18440 Your fflush(NULL) isn't working (contrary to ANSI C).
18441 EOM
18442                 fflushNULL="$undef"
18443                 ;;
18444         *)      $cat >&4 <<EOM
18445 Cannot figure out whether your fflush(NULL) works or not.
18446 I'm assuming it doesn't (contrary to ANSI C).
18447 EOM
18448                 fflushNULL="$undef"
18449                 ;;
18450         esac
18451         ;;
18452 $define|true|[yY]*)
18453         fflushNULL="$define"
18454         ;;
18455 *)
18456         fflushNULL="$undef"
18457         ;;
18458 esac
18459 : check explicit looping only if NULL did not work, and if the pipe
18460 : bug does not show up on an explicit flush too
18461 case "$fflushNULL" in
18462 "$undef")
18463         $cat >tryp.c <<EOCP
18464 #include <stdio.h>
18465 int
18466 main(int argc, char **argv)
18467 {
18468     char buf[1024];
18469     int i;
18470     char *bp = buf;
18471     while (1) {
18472         while ((i = getc(stdin)) != -1
18473                && (*bp++ = i) != '\n'
18474                && bp < &buf[1024])
18475         /* DO NOTHING */ ;
18476         *bp = '\0';
18477         fprintf(stdout, "%s", buf);
18478         fflush(stdin);
18479         if (i == -1)
18480             return 0;
18481         bp = buf;
18482     }
18483 }
18484 EOCP
18485         set tryp
18486         if eval $compile; then
18487             $rm -f tryp.out
18488             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18489             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18490                $cat >&4 <<EOM
18491 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18492 EOM
18493                 : now check for fflushall behaviour
18494                 case "$fflushall" in
18495                 '')     set try -DTRY_FFLUSH_ALL $output
18496                         if eval $compile; then
18497                                 $cat >&4 <<EOM
18498 (Now testing the other method--but note that this also may fail.)
18499 EOM
18500                                 $run ./try 2>/dev/null
18501                                 code=$?
18502                                 $from try.out
18503                                 if $test -s try.out -a "X$code" = X42; then
18504                                         fflushall="`$cat try.out`"
18505                                 fi
18506                         fi
18507                         $rm -f core try.core core.try.*
18508                         case "$fflushall" in
18509                         x)      $cat >&4 <<EOM
18510 Whew. Flushing explicitly all the stdio streams works.
18511 EOM
18512                                 fflushall="$define"
18513                                 ;;
18514                         '')     $cat >&4 <<EOM
18515 Sigh. Flushing explicitly all the stdio streams doesn't work.
18516 EOM
18517                                 fflushall="$undef"
18518                                 ;;
18519                         *)      $cat >&4 <<EOM
18520 Cannot figure out whether flushing stdio streams explicitly works or not.
18521 I'm assuming it doesn't.
18522 EOM
18523                                 fflushall="$undef"
18524                                 ;;
18525                         esac
18526                         ;;
18527                 "$define"|true|[yY]*)
18528                         fflushall="$define"
18529                         ;;
18530                 *)
18531                         fflushall="$undef"
18532                         ;;
18533                 esac
18534             else
18535                 $cat >&4 <<EOM
18536 All is futile.  Even fflush(stdin) clobbers input pipes!
18537 EOM
18538                 fflushall="$undef"
18539             fi
18540         else
18541             fflushall="$undef"
18542         fi
18543         $rm -f core tryp.c tryp.core core.tryp.*
18544         ;;
18545 *)      fflushall="$undef"
18546         ;;
18547 esac
18548
18549 case "$fflushNULL$fflushall" in
18550 undefundef)
18551         $cat <<EOM
18552 OK, I give up.  I cannot figure out how to flush pending stdio output.
18553 We won't be flushing handles at all before fork/exec/popen.
18554 EOM
18555         ;;
18556 esac
18557 $rm -f try.* try$exe_ext
18558
18559 : Store the full pathname to the ar program for use in the C program
18560 : Respect a hint or command line value for full_ar.
18561 case "$full_ar" in
18562 '') full_ar=$ar ;;
18563 esac
18564
18565 : Store the full pathname to the sed program for use in the C program
18566 full_sed=$sed
18567
18568 : see what type gids are declared as in the kernel
18569 echo " "
18570 echo "Looking for the type for group ids returned by getgid()."
18571 set gid_t gidtype xxx stdio.h sys/types.h
18572 eval $typedef
18573 case "$gidtype" in
18574 xxx)
18575         xxx=`./findhdr sys/user.h`
18576         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18577         case $1 in
18578         unsigned) dflt="$1 $2" ;;
18579         *) dflt="$1" ;;
18580         esac
18581         ;;
18582 *) dflt="$gidtype";;
18583 esac
18584 case "$gidtype" in
18585 gid_t) echo "gid_t found." ;;
18586 *)      rp="What is the type for group ids returned by getgid()?"
18587         . ./myread
18588         gidtype="$ans"
18589         ;;
18590 esac
18591
18592 echo " "
18593 case "$gidtype" in
18594 *_t) zzz="$gidtype"     ;;
18595 *)   zzz="gid"          ;;
18596 esac
18597 echo "Checking the size of $zzz..." >&4 
18598 cat > try.c <<EOCP
18599 #include <sys/types.h>
18600 #include <stdio.h>
18601 #$i_stdlib I_STDLIB
18602 #ifdef I_STDLIB
18603 #include <stdlib.h>
18604 #endif
18605 int main() {
18606     printf("%d\n", (int)sizeof($gidtype));
18607     exit(0);
18608 }
18609 EOCP
18610 set try
18611 if eval $compile_ok; then
18612         yyy=`$run ./try`
18613         case "$yyy" in
18614         '')     gidsize=4
18615                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18616                 ;;
18617         *)      gidsize=$yyy
18618                 echo "Your $zzz is $gidsize bytes long."
18619                 ;;
18620         esac
18621 else
18622         gidsize=4
18623         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18624 fi
18625
18626
18627 echo " "
18628 case "$gidtype" in
18629 *_t) zzz="$gidtype"     ;;
18630 *)   zzz="gid"          ;;
18631 esac
18632 echo "Checking the sign of $zzz..." >&4 
18633 cat > try.c <<EOCP
18634 #include <sys/types.h>
18635 #include <stdio.h>
18636 int main() {
18637         $gidtype foo = -1;
18638         if (foo < 0)
18639                 printf("-1\n");
18640         else
18641                 printf("1\n");
18642 }
18643 EOCP
18644 set try
18645 if eval $compile; then
18646         yyy=`$run ./try`
18647         case "$yyy" in
18648         '')     gidsign=1
18649                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18650                 ;;
18651         *)      gidsign=$yyy
18652                 case "$gidsign" in
18653                  1) echo "Your $zzz is unsigned." ;;
18654                 -1) echo "Your $zzz is signed."   ;;
18655                 esac
18656                 ;;
18657         esac
18658 else
18659         gidsign=1
18660         echo "(I can't compile the test program--guessing unsigned.)" >&4
18661 fi
18662
18663
18664 echo " "
18665
18666 if $test X"$quadtype" != X; then
18667
18668 echo "Checking how to print 64-bit integers..." >&4
18669
18670 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18671         $cat >try.c <<'EOCP'
18672 #include <sys/types.h>
18673 #include <stdio.h>
18674 int main() {
18675   int q = 12345678901;
18676   printf("%ld\n", q);
18677 }
18678 EOCP
18679         set try
18680         if eval $compile; then
18681                 yyy=`$run ./try`
18682                 case "$yyy" in
18683                 12345678901)
18684                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18685                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18686                         echo "We will use %d."
18687                         ;;
18688                 esac
18689         fi
18690 fi
18691
18692 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18693         $cat >try.c <<'EOCP'
18694 #include <sys/types.h>
18695 #include <stdio.h>
18696 int main() {
18697   long q = 12345678901;
18698   printf("%ld\n", q);
18699 }
18700 EOCP
18701         set try
18702         if eval $compile; then
18703                 yyy=`$run ./try`
18704                 case "$yyy" in
18705                 12345678901)
18706                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18707                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18708                         echo "We will use %ld."
18709                         ;;
18710                 esac
18711         fi
18712 fi
18713
18714 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18715         $cat >try.c <<'EOCP'
18716 #include <sys/types.h>
18717 #include <inttypes.h>
18718 #include <stdio.h>
18719 int main() {
18720   int64_t q = 12345678901;
18721   printf("%" PRId64 "\n", q);
18722 }
18723 EOCP
18724         set try
18725         if eval $compile; then
18726                 yyy=`$run ./try`
18727                 case "$yyy" in
18728                 12345678901)
18729                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18730                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18731                         echo "We will use the C9X style."
18732                         ;;
18733                 esac
18734         fi
18735 fi
18736
18737 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18738         $cat >try.c <<EOCP
18739 #include <sys/types.h>
18740 #include <stdio.h>
18741 int main() {
18742   $quadtype q = 12345678901;
18743   printf("%Ld\n", q);
18744 }
18745 EOCP
18746         set try
18747         if eval $compile; then
18748                 yyy=`$run ./try`
18749                 case "$yyy" in
18750                 12345678901)
18751                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18752                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18753                         echo "We will use %Ld."
18754                         ;;
18755                 esac
18756         fi
18757 fi
18758
18759 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18760         $cat >try.c <<'EOCP'
18761 #include <sys/types.h>
18762 #include <stdio.h>
18763 int main() {
18764   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18765   printf("%lld\n", q);
18766 }
18767 EOCP
18768         set try
18769         if eval $compile; then
18770                 yyy=`$run ./try`
18771                 case "$yyy" in
18772                 12345678901)
18773                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18774                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18775                         echo "We will use the %lld style."
18776                         ;;
18777                 esac
18778         fi
18779 fi
18780
18781 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18782         $cat >try.c <<EOCP
18783 #include <sys/types.h>
18784 #include <stdio.h>
18785 int main() {
18786   $quadtype q = 12345678901;
18787   printf("%qd\n", q);
18788 }
18789 EOCP
18790         set try
18791         if eval $compile; then
18792                 yyy=`$run ./try`
18793                 case "$yyy" in
18794                 12345678901)
18795                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18796                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18797                         echo "We will use %qd."
18798                         ;;
18799                 esac
18800         fi
18801 fi
18802
18803 if $test X"$sPRId64" = X; then
18804         echo "Cannot figure out how to print 64-bit integers." >&4
18805 fi
18806
18807 $rm -f try try.*
18808
18809 fi
18810
18811 case "$sPRId64" in
18812 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18813         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18814         ;;
18815 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18816         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18817         ;;
18818 esac
18819
18820
18821 echo " "
18822 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18823
18824 if $test X"$ivsize" = X8; then
18825         ivdformat="$sPRId64"
18826         uvuformat="$sPRIu64"
18827         uvoformat="$sPRIo64"
18828         uvxformat="$sPRIx64"
18829         uvXUformat="$sPRIXU64"
18830 else
18831         if $test X"$ivsize" = X"$longsize"; then
18832                 ivdformat='"ld"'
18833                 uvuformat='"lu"'
18834                 uvoformat='"lo"'
18835                 uvxformat='"lx"'
18836                 uvXUformat='"lX"'
18837         else
18838                 if $test X"$ivsize" = X"$intsize"; then
18839                         ivdformat='"d"'
18840                         uvuformat='"u"'
18841                         uvoformat='"o"'
18842                         uvxformat='"x"'
18843                         uvXUformat='"X"'
18844                 else
18845                         : far out
18846                         if $test X"$ivsize" = X"$shortsize"; then
18847                                 ivdformat='"hd"'
18848                                 uvuformat='"hu"'
18849                                 uvoformat='"ho"'
18850                                 uvxformat='"hx"'
18851                                 uvXUformat='"hX"'
18852                         fi
18853                 fi
18854         fi
18855 fi
18856
18857 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18858         nveformat="$sPRIeldbl"
18859         nvfformat="$sPRIfldbl"
18860         nvgformat="$sPRIgldbl"
18861         nvEUformat="$sPRIEUldbl"
18862         nvFUformat="$sPRIFUldbl"
18863         nvGUformat="$sPRIGUldbl"
18864 else
18865         nveformat='"e"'
18866         nvfformat='"f"'
18867         nvgformat='"g"'
18868         nvEUformat='"E"'
18869         nvFUformat='"F"'
18870         nvGUformat='"G"'
18871 fi
18872
18873 case "$ivdformat" in
18874 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18875     exit 1
18876     ;;
18877 esac
18878
18879
18880 echo " "
18881 $echo "Checking the format string to be used for gids..." >&4
18882
18883 case "$gidsign" in
18884 -1)     if $test X"$gidsize" = X"$ivsize"; then
18885                 gidformat="$ivdformat"
18886         else
18887                 if $test X"$gidsize" = X"$longsize"; then
18888                         gidformat='"ld"'
18889                 else
18890                         if $test X"$gidsize" = X"$intsize"; then
18891                                 gidformat='"d"'
18892                         else
18893                                 if $test X"$gidsize" = X"$shortsize"; then
18894                                         gidformat='"hd"'
18895                                 fi
18896                         fi
18897                 fi
18898         fi
18899         ;;
18900 *)      if $test X"$gidsize" = X"$uvsize"; then
18901                 gidformat="$uvuformat"
18902         else
18903                 if $test X"$gidsize" = X"$longsize"; then
18904                         gidformat='"lu"'
18905                 else
18906                         if $test X"$gidsize" = X"$intsize"; then
18907                                 gidformat='"u"'
18908                         else
18909                                 if $test X"$gidsize" = X"$shortsize"; then
18910                                         gidformat='"hu"'
18911                                 fi
18912                         fi
18913                 fi
18914         fi
18915         ;;
18916 esac
18917
18918 : see if getgroups exists
18919 set getgroups d_getgrps
18920 eval $inlibc
18921
18922 : see if setgroups exists
18923 set setgroups d_setgrps
18924 eval $inlibc
18925
18926
18927 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18928 echo " "
18929 case "$d_getgrps$d_setgrps" in
18930 *define*)
18931         case "$groupstype" in
18932         '') dflt="$gidtype" ;;
18933         *)  dflt="$groupstype" ;;
18934         esac
18935         $cat <<EOM
18936 What type of pointer is the second argument to getgroups() and setgroups()?
18937 Usually this is the same as group ids, $gidtype, but not always.
18938
18939 EOM
18940         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18941         . ./myread
18942         groupstype="$ans"
18943         ;;
18944 *)  groupstype="$gidtype";;
18945 esac
18946
18947
18948 case "$mad" in
18949 $define|true|[yY]*)     dflt='y' ;;
18950 *)                      dflt='n' ;;
18951 esac
18952 cat <<EOM
18953
18954 Would you like to build with Misc Attribute Decoration? This is development
18955 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18956 overhead on the interpreter.
18957
18958 If this doesn't make any sense to you, just accept the default '$dflt'.
18959 EOM
18960 rp='Build Perl with MAD?'
18961 . ./myread
18962 case "$ans" in
18963 y|Y)    val="$define"
18964         madlyh='madly.h madly.act madly.tab'
18965         madlysrc='madly.c'
18966         madlyobj="madly$_o" ;;
18967 *)      val="$undef"
18968         madlyh=''
18969         madlysrc=''
18970         madlyobj='' ;;
18971 esac
18972 set mad
18973 eval $setvar
18974
18975 echo " "
18976 echo "Checking if your $make program sets \$(MAKE)..." >&4
18977 case "$make_set_make" in
18978 '')
18979         $sed 's/^X //' > testmake.mak << 'EOF'
18980 Xall:
18981 X       @echo 'maketemp="$(MAKE)"'
18982 EOF
18983         case "`$make -f testmake.mak 2>/dev/null`" in
18984         *maketemp=*) make_set_make='#' ;;
18985         *)      make_set_make="MAKE=$make" ;;
18986         esac
18987         $rm -f testmake.mak
18988         ;;
18989 esac
18990 case "$make_set_make" in
18991 '#') echo "Yup, it does.";;
18992 *) echo "Nope, it doesn't.";;
18993 esac
18994
18995 : see what type is used for mode_t
18996 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18997 set mode_t modetype int stdio.h sys/types.h
18998 eval $typedef_ask
18999
19000 : see if stdarg is available
19001 echo " "
19002 if $test `./findhdr stdarg.h`; then
19003         echo "<stdarg.h> found." >&4
19004         valstd="$define"
19005 else
19006         echo "<stdarg.h> NOT found." >&4
19007         valstd="$undef"
19008 fi
19009
19010 : see if varags is available
19011 echo " "
19012 if $test `./findhdr varargs.h`; then
19013         echo "<varargs.h> found." >&4
19014 else
19015         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19016 fi
19017
19018 : set up the varargs testing programs
19019 $cat > varargs.c <<EOP
19020 #ifdef I_STDARG
19021 #include <stdarg.h>
19022 #endif
19023 #ifdef I_VARARGS
19024 #include <varargs.h>
19025 #endif
19026
19027 #ifdef I_STDARG
19028 int f(char *p, ...)
19029 #else
19030 int f(va_alist)
19031 va_dcl
19032 #endif
19033 {
19034         va_list ap;
19035 #ifndef I_STDARG
19036         char *p;
19037 #endif
19038 #ifdef I_STDARG
19039         va_start(ap,p);
19040 #else
19041         va_start(ap);
19042         p = va_arg(ap, char *);
19043 #endif
19044         va_end(ap);
19045 }
19046 EOP
19047 $cat > varargs <<EOP
19048 $startsh
19049 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19050         echo "true"
19051 else
19052         echo "false"
19053 fi
19054 $rm -f varargs$_o
19055 EOP
19056 chmod +x varargs
19057
19058 : now check which varargs header should be included
19059 echo " "
19060 i_varhdr=''
19061 case "$valstd" in
19062 "$define")
19063         if `./varargs I_STDARG`; then
19064                 val='stdarg.h'
19065         elif `./varargs I_VARARGS`; then
19066                 val='varargs.h'
19067         fi
19068         ;;
19069 *)
19070         if `./varargs I_VARARGS`; then
19071                 val='varargs.h'
19072         fi
19073         ;;
19074 esac
19075 case "$val" in
19076 '')
19077 echo "I could not find the definition for va_dcl... You have problems..." >&4
19078         val="$undef"; set i_stdarg; eval $setvar
19079         val="$undef"; set i_varargs; eval $setvar
19080         ;;
19081 *) 
19082         set i_varhdr
19083         eval $setvar
19084         case "$i_varhdr" in
19085         stdarg.h)
19086                 val="$define"; set i_stdarg; eval $setvar
19087                 val="$undef"; set i_varargs; eval $setvar
19088                 ;;
19089         varargs.h)
19090                 val="$undef"; set i_stdarg; eval $setvar
19091                 val="$define"; set i_varargs; eval $setvar
19092                 ;;
19093         esac
19094         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19095 esac
19096 $rm -f varargs*
19097
19098 : see if we need va_copy
19099 echo " "
19100 case "$i_stdarg" in
19101 "$define")
19102         $cat >try.c <<EOCP
19103 #include <stdarg.h>
19104 #include <stdio.h>
19105 #$i_stdlib I_STDLIB
19106 #ifdef I_STDLIB
19107 #include <stdlib.h>
19108 #endif
19109 #include <signal.h>
19110
19111 int
19112 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19113 {
19114   return vfprintf(f, fmt, *valp);
19115 }
19116  
19117 int    
19118 myvfprintf(FILE *f, const  char *fmt, va_list val)
19119 {
19120   return ivfprintf(f, fmt, &val);
19121 }
19122       
19123 int
19124 myprintf(char *fmt, ...) 
19125 {
19126   va_list val;
19127   va_start(val, fmt);
19128   return myvfprintf(stdout, fmt, val); 
19129 }         
19130
19131 int
19132 main(int ac, char **av)
19133 {
19134   signal(SIGSEGV, exit);
19135
19136   myprintf("%s%cs all right, then\n", "that", '\'');                            
19137   exit(0);      
19138 }
19139 EOCP
19140         set try
19141         if eval $compile && $run ./try 2>&1 >/dev/null; then
19142                 case "`$run ./try`" in
19143                 "that's all right, then")
19144                         okay=yes
19145                         ;;
19146                 esac
19147         fi
19148         case "$okay" in
19149         yes)    echo "It seems that you don't need va_copy()." >&4
19150                 need_va_copy="$undef"
19151                 ;;
19152         *)      echo "It seems that va_copy() or similar will be needed." >&4
19153                 need_va_copy="$define"
19154                 ;;
19155         esac
19156         $rm -f try.* core core.* *.core *.core.*
19157         ;;
19158 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19159         ;;
19160 esac
19161
19162 : see what type is used for size_t
19163 rp="What is the type used for the length parameter for string functions?"
19164 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19165 eval $typedef_ask
19166
19167 : check for type of arguments to gethostbyaddr. 
19168 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19169         case "$d_gethbyaddr" in
19170         $define)
19171                 $cat <<EOM
19172
19173 Checking to see what type of arguments are accepted by gethostbyaddr().
19174 EOM
19175                 hdrs="$define sys/types.h
19176                         $d_socket sys/socket.h 
19177                         $i_niin netinet/in.h 
19178                         $i_netdb netdb.h
19179                         $i_unistd unistd.h"
19180                 : The first arg can 'char *' or 'void *'
19181                 : The second arg is some of integral type
19182                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19183                         for yyy in size_t long int; do
19184                                 case "$netdb_host_type" in
19185                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19186                                         if ./protochk "$try" $hdrs; then
19187                                                 echo "Your system accepts $xxx for the first arg."
19188                                                 echo "...and $yyy for the second arg."
19189                                                 netdb_host_type="$xxx"
19190                                                 netdb_hlen_type="$yyy"
19191                                         fi
19192                                         ;;
19193                                 esac
19194                         done
19195                 done
19196                 : In case none of those worked, prompt the user.
19197                 case "$netdb_host_type" in
19198                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19199                         dflt='char *'
19200                         . ./myread
19201                         netdb_host_type=$ans
19202                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19203                         dflt="$sizetype"
19204                         . ./myread
19205                         netdb_hlen_type=$ans
19206                         ;;
19207                 esac
19208                 ;;
19209         *)      : no gethostbyaddr, so pick harmless defaults
19210                 netdb_host_type='char *'
19211                 netdb_hlen_type="$sizetype"
19212                 ;;
19213         esac
19214         # Remove the "const" if needed. -- but then we'll have a 
19215         # prototype clash!
19216         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19217 fi
19218
19219 : check for type of argument to gethostbyname. 
19220 if test "X$netdb_name_type" = X ; then
19221         case "$d_gethbyname" in
19222         $define)
19223                 $cat <<EOM
19224
19225 Checking to see what type of argument is accepted by gethostbyname().
19226 EOM
19227                 hdrs="$define sys/types.h
19228                         $d_socket sys/socket.h 
19229                         $i_niin netinet/in.h 
19230                         $i_netdb netdb.h
19231                         $i_unistd unistd.h"
19232                 for xxx in "const char *" "char *"; do
19233                         case "$netdb_name_type" in
19234                         '')     try="extern struct hostent *gethostbyname($xxx);"
19235                                 if ./protochk "$try" $hdrs; then
19236                                         echo "Your system accepts $xxx."
19237                                         netdb_name_type="$xxx"
19238                                 fi
19239                                 ;;
19240                         esac
19241                 done
19242                 : In case none of those worked, prompt the user.
19243                 case "$netdb_name_type" in
19244                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19245                         dflt='char *'
19246                         . ./myread
19247                         netdb_name_type=$ans
19248                         ;;
19249                 esac
19250                 ;;
19251         *)      : no gethostbyname, so pick harmless default
19252                 netdb_name_type='char *'
19253                 ;;
19254         esac
19255 fi
19256
19257 : check for type of 1st argument to getnetbyaddr. 
19258 if test "X$netdb_net_type" = X ; then
19259         case "$d_getnbyaddr" in
19260         $define)
19261                 $cat <<EOM
19262
19263 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19264 EOM
19265                 hdrs="$define sys/types.h
19266                         $d_socket sys/socket.h 
19267                         $i_niin netinet/in.h 
19268                         $i_netdb netdb.h
19269                         $i_unistd unistd.h"
19270                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19271                         case "$netdb_net_type" in
19272                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19273                                 if ./protochk "$try" $hdrs; then
19274                                         echo "Your system accepts $xxx."
19275                                         netdb_net_type="$xxx"
19276                                 fi
19277                                 ;;
19278                         esac
19279                 done
19280                 : In case none of those worked, prompt the user.
19281                 case "$netdb_net_type" in
19282                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19283                         dflt='long'
19284                         . ./myread
19285                         netdb_net_type=$ans
19286                         ;;
19287                 esac
19288                 ;;
19289         *)      : no getnetbyaddr, so pick harmless default
19290                 netdb_net_type='long'
19291                 ;;
19292         esac
19293 fi
19294 : locate the preferred pager for this system
19295 fn=f/
19296 case "$pager" in
19297 '')
19298         dflt=''
19299         case "$pg" in
19300         /*) dflt=$pg;;
19301         [a-zA-Z]:/*) dflt=$pg;;
19302         esac
19303         case "$more" in
19304         /*) dflt=$more;;
19305         [a-zA-Z]:/*) dflt=$more;;
19306         esac
19307         case "$less" in
19308         /*) dflt=$less;;
19309         [a-zA-Z]:/*) dflt=$less;;
19310         esac
19311         case "$dflt" in
19312         '') dflt=/usr/ucb/more;;
19313         esac
19314         ;;
19315 *)      dflt="$pager"
19316         : Instruct ./getfile to trust the hinted or previous pager value,
19317         : even if it does not begin with a slash.  For example, on os2,
19318         : pager might be cmd /c more.  See comments in UU/getfile.
19319         fn="f/($pager)"
19320         ;;
19321 esac
19322 echo " "
19323 rp='What pager is used on your system?'
19324 . ./getfile
19325 pager="$ans"
19326
19327 : see what type pids are declared as in the kernel
19328 rp="What is the type of process ids on this system?"
19329 set pid_t pidtype int stdio.h sys/types.h
19330 eval $typedef_ask
19331
19332 : see if ar generates random libraries by itself
19333 echo " "
19334 echo "Checking how to generate random libraries on your machine..." >&4
19335 echo 'int bar1() { return bar2(); }' > bar1.c
19336 echo 'int bar2() { return 2; }' > bar2.c
19337 $cat > foo.c <<EOP
19338 #$i_stdlib I_STDLIB
19339 #ifdef I_STDLIB
19340 #include <stdlib.h>
19341 #endif
19342 int main() { printf("%d\n", bar1()); exit(0); }
19343 EOP
19344 $cc $ccflags -c bar1.c >/dev/null 2>&1
19345 $cc $ccflags -c bar2.c >/dev/null 2>&1
19346 $cc $ccflags -c foo.c >/dev/null 2>&1
19347 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19348 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19349         $run ./foobar >/dev/null 2>&1; then
19350         echo "$ar appears to generate random libraries itself."
19351         orderlib=false
19352         if [ "X$ranlib" = "X" ]; then
19353             ranlib=":"
19354         fi
19355 elif $ar s bar$_a >/dev/null 2>&1 &&
19356         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19357         $run ./foobar >/dev/null 2>&1; then
19358                 echo "a table of contents needs to be added with '$ar s'."
19359                 orderlib=false
19360                 ranlib="$ar s"
19361 elif $ar ts bar$_a >/dev/null 2>&1 &&
19362         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19363         $run ./foobar >/dev/null 2>&1; then
19364                 echo "a table of contents needs to be added with '$ar ts'."
19365                 orderlib=false
19366                 ranlib="$ar ts"
19367 else
19368         case "$ranlib" in
19369         :) ranlib='';;
19370         '')
19371                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19372                 $test -f $ranlib || ranlib=''
19373                 ;;
19374         esac
19375         if $test -n "$ranlib"; then
19376                 echo "your system has '$ranlib'; we'll use that."
19377                 orderlib=false
19378         else
19379                 echo "your system doesn't seem to support random libraries"
19380                 echo "so we'll use lorder and tsort to order the libraries."
19381                 orderlib=true
19382                 ranlib=":"
19383         fi
19384 fi
19385 $rm -f foo* bar*
19386
19387 : check for type of arguments to select. 
19388 case "$selecttype" in
19389 '') case "$d_select" in
19390         $define)
19391                 echo " "
19392                 $cat <<EOM
19393 Checking to see what type of arguments are accepted by select().
19394 EOM
19395                 hdrs="$define sys/types.h
19396                         $i_systime sys/time.h 
19397                         $i_sysselct sys/select.h
19398                         $d_socket sys/socket.h"
19399                 : The first arg can be int, unsigned, or size_t
19400                 : The last arg may or may not be 'const'
19401                 val=''
19402                 : void pointer has been seen but using that
19403                 : breaks the selectminbits test
19404                 for xxx in 'fd_set *' 'int *'; do
19405                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19406                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19407                                         case "$val" in
19408                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19409                                                 if ./protochk "$try" $hdrs; then
19410                                                         echo "Your system accepts $xxx."
19411                                                         val="$xxx"
19412                                                 fi
19413                                                 ;;
19414                                         esac
19415                                 done
19416                         done
19417                 done
19418                 case "$val" in
19419                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19420                         case "$d_fd_set" in
19421                                 $define) dflt="fd_set *" ;;
19422                                 *)              dflt="int *" ;;
19423                         esac
19424                         . ./myread
19425                         val=$ans
19426                         ;;
19427                 esac
19428                 selecttype="$val"
19429                 ;;
19430         *)      : no select, so pick a harmless default
19431                 selecttype='int *'
19432                 ;;
19433         esac
19434         ;;
19435 esac
19436
19437 : check for the select 'width'
19438 case "$selectminbits" in
19439 '') safebits=`expr $ptrsize \* 8`
19440     case "$d_select" in
19441         $define)
19442                 $cat <<EOM
19443
19444 Checking to see on how many bits at a time your select() operates...
19445 EOM
19446                 $cat >try.c <<EOCP
19447 #include <sys/types.h>
19448 #$i_time I_TIME
19449 #$i_systime I_SYS_TIME
19450 #$i_systimek I_SYS_TIME_KERNEL
19451 #ifdef I_TIME
19452 #   include <time.h>
19453 #endif
19454 #ifdef I_SYS_TIME
19455 #   ifdef I_SYS_TIME_KERNEL
19456 #       define KERNEL
19457 #   endif
19458 #   include <sys/time.h>
19459 #   ifdef I_SYS_TIME_KERNEL
19460 #       undef KERNEL
19461 #   endif
19462 #endif
19463 #$i_sysselct I_SYS_SELECT
19464 #ifdef I_SYS_SELECT
19465 #include <sys/select.h>
19466 #endif
19467 #$d_socket HAS_SOCKET
19468 #ifdef HAS_SOCKET
19469 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19470 #endif
19471 #include <stdio.h>
19472 #$i_stdlib I_STDLIB
19473 #ifdef I_STDLIB
19474 #include <stdlib.h>
19475 #endif
19476 $selecttype b;
19477 #define S sizeof(*(b))
19478 #define MINBITS 64
19479 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19480 #define NBITS  (NBYTES * 8)
19481 int main() {
19482     char *s = malloc(NBYTES);
19483     struct timeval t;
19484     int i;
19485     FILE* fp;
19486     int fd;
19487
19488     if (!s)
19489         exit(1);
19490     fclose(stdin);
19491     fp = fopen("try.c", "r");
19492     if (fp == 0)
19493       exit(2);
19494     fd = fileno(fp);
19495     if (fd < 0)
19496       exit(3);
19497     b = ($selecttype)s;
19498     for (i = 0; i < NBITS; i++)
19499         FD_SET(i, b);
19500     t.tv_sec  = 0;
19501     t.tv_usec = 0;
19502     select(fd + 1, b, 0, 0, &t);
19503     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19504     free(s);
19505     printf("%d\n", i + 1);
19506     return 0;
19507 }
19508 EOCP
19509                 set try
19510                 if eval $compile_ok; then
19511                         selectminbits=`$run ./try`
19512                         case "$selectminbits" in
19513                         '')     cat >&4 <<EOM
19514 Cannot figure out on how many bits at a time your select() operates.
19515 I'll play safe and guess it is $safebits bits.
19516 EOM
19517                                 selectminbits=$safebits
19518                                 bits="$safebits bits"
19519                                 ;;
19520                         1)      bits="1 bit" ;;
19521                         *)      bits="$selectminbits bits" ;;
19522                         esac
19523                         echo "Your select() operates on $bits at a time." >&4
19524                 else
19525                         rp='What is the minimum number of bits your select() operates on?'
19526                         case "$byteorder" in
19527                         12345678)       dflt=64 ;;
19528                         1234)           dflt=32 ;;
19529                         *)              dflt=1  ;;
19530                         esac
19531                         . ./myread
19532                         val=$ans
19533                         selectminbits="$val"
19534                 fi
19535                 $rm -f try.* try
19536                 ;;
19537         *)      : no select, so pick a harmless default
19538                 selectminbits=$safebits
19539                 ;;
19540         esac
19541         ;;
19542 esac
19543
19544 : Trace out the files included by signal.h, then look for SIGxxx names.
19545 : Remove SIGARRAYSIZE used by HPUX.
19546 : Remove SIGSTKSIZE used by Linux.
19547 : Remove SIGSTKSZ used by Posix.
19548 : Remove SIGTYP void lines used by OS2.
19549 : Some cpps, like os390, dont give the file name anywhere
19550 if [ "X$fieldn" = X ]; then
19551         : Just make some guesses.  We check them later.
19552         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19553 else
19554         xxx=`echo '#include <signal.h>' |
19555         $cppstdin $cppminus $cppflags 2>/dev/null |
19556         $grep '^[       ]*#.*include' | 
19557         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19558 fi
19559 : Check this list of files to be sure we have parsed the cpp output ok.
19560 : This will also avoid potentially non-existent files, such 
19561 : as ../foo/bar.h
19562 xxxfiles=''
19563 for xx in $xxx /dev/null ; do
19564         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19565 done
19566 : If we have found no files, at least try signal.h
19567 case "$xxxfiles" in
19568 '')     xxxfiles=`./findhdr signal.h` ;;
19569 esac
19570 xxx=`awk '
19571 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19572         print substr($2, 4, 20)
19573 }
19574 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19575         print substr($3, 4, 20)
19576 }' $xxxfiles`
19577 : Append some common names just in case the awk scan failed.
19578 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19579 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19580 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19581 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19582 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19583
19584 : generate a few handy files for later
19585 $cat > signal.c <<EOCP
19586 #include <sys/types.h>
19587 #include <signal.h>
19588 #$i_stdlib I_STDLIB
19589 #ifdef I_STDLIB
19590 #include <stdlib.h>
19591 #endif
19592 #include <stdio.h>
19593 int main() {
19594
19595 /* Strange style to avoid deeply-nested #if/#else/#endif */
19596 #ifndef NSIG
19597 #  ifdef _NSIG
19598 #    define NSIG (_NSIG)
19599 #  endif
19600 #endif
19601
19602 #ifndef NSIG
19603 #  ifdef SIGMAX
19604 #    define NSIG (SIGMAX+1)
19605 #  endif
19606 #endif
19607
19608 #ifndef NSIG
19609 #  ifdef SIG_MAX
19610 #    define NSIG (SIG_MAX+1)
19611 #  endif
19612 #endif
19613
19614 #ifndef NSIG
19615 #  ifdef _SIG_MAX
19616 #    define NSIG (_SIG_MAX+1)
19617 #  endif
19618 #endif
19619
19620 #ifndef NSIG
19621 #  ifdef MAXSIG
19622 #    define NSIG (MAXSIG+1)
19623 #  endif
19624 #endif
19625
19626 #ifndef NSIG
19627 #  ifdef MAX_SIG
19628 #    define NSIG (MAX_SIG+1)
19629 #  endif
19630 #endif
19631
19632 #ifndef NSIG
19633 #  ifdef SIGARRAYSIZE
19634 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19635 #  endif
19636 #endif
19637
19638 #ifndef NSIG
19639 #  ifdef _sys_nsig
19640 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19641 #  endif
19642 #endif
19643
19644 /* Default to some arbitrary number that's big enough to get most
19645    of the common signals.
19646 */
19647 #ifndef NSIG
19648 #    define NSIG 50
19649 #endif
19650
19651 printf("NSIG %d\n", NSIG);
19652
19653 #ifndef JUST_NSIG
19654
19655 EOCP
19656
19657 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19658 {
19659         printf "#ifdef SIG"; printf $1; printf "\n"
19660         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19661         printf $1; printf ");\n"
19662         printf "#endif\n"
19663 }
19664 END {
19665         printf "#endif /* JUST_NSIG */\n";
19666         printf "exit(0);\n}\n";
19667 }
19668 ' >>signal.c
19669 $cat >signal.awk <<'EOP'
19670 BEGIN { ndups = 0 }
19671 $1 ~ /^NSIG$/ { nsig = $2 }
19672 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19673     if ($2 > maxsig) { maxsig = $2 }
19674     if (sig_name[$2]) {
19675         dup_name[ndups] = $1
19676         dup_num[ndups] = $2
19677         ndups++ 
19678     }
19679     else {
19680         sig_name[$2] = $1
19681         sig_num[$2] = $2
19682     }
19683 }
19684 END { 
19685     if (nsig == 0) {
19686         nsig = maxsig + 1
19687     }
19688     printf("NSIG %d\n", nsig);
19689     for (n = 1; n < nsig; n++) {
19690         if (sig_name[n]) {
19691             printf("%s %d\n", sig_name[n], sig_num[n])
19692         }
19693         else {
19694             printf("NUM%d %d\n", n, n) 
19695         }
19696     }
19697     for (n = 0; n < ndups; n++) {
19698         printf("%s %d\n", dup_name[n], dup_num[n])
19699     }
19700 }
19701 EOP
19702 $cat >signal_cmd <<EOS
19703 $startsh
19704 if $test -s signal.lst; then
19705     echo "Using your existing signal.lst file"
19706         exit 0
19707 fi
19708 xxx="$xxx"
19709 EOS
19710 $cat >>signal_cmd <<'EOS'
19711
19712 set signal
19713 if eval $compile_ok; then
19714         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19715 else
19716         echo "(I can't seem be able to compile the whole test program)" >&4
19717         echo "(I'll try it in little pieces.)" >&4
19718         set signal -DJUST_NSIG
19719         if eval $compile_ok; then
19720                 $run ./signal$_exe > signal.nsg
19721                 $cat signal.nsg
19722         else
19723                 echo "I can't seem to figure out how many signals you have." >&4
19724                 echo "Guessing 50." >&4
19725                 echo 'NSIG 50' > signal.nsg
19726         fi
19727         : Now look at all the signal names, one at a time.
19728         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19729                 $cat > signal.c <<EOCP
19730 #include <sys/types.h>
19731 #include <signal.h>
19732 #include <stdio.h>
19733 int main() {
19734 printf("$xx %d\n", SIG${xx});
19735 return 0;
19736 }
19737 EOCP
19738                 set signal
19739                 if eval $compile; then
19740                         echo "SIG${xx} found."
19741                         $run ./signal$_exe  >> signal.ls1
19742                 else
19743                         echo "SIG${xx} NOT found."
19744                 fi
19745         done
19746         if $test -s signal.ls1; then
19747                 $cat signal.nsg signal.ls1 |
19748                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19749         fi
19750
19751 fi
19752 if $test -s signal.lst; then
19753         :
19754 else
19755         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19756         echo 'kill -l' >signal
19757         set X `csh -f <signal`
19758         $rm -f signal
19759         shift
19760         case $# in
19761         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19762         esac
19763         echo $@ | $tr ' ' $trnl | \
19764             $awk '{ printf "%s %d\n", $1, ++s; }
19765                   END { printf "NSIG %d\n", ++s }' >signal.lst
19766 fi
19767 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19768 EOS
19769 chmod a+x signal_cmd
19770 $eunicefix signal_cmd
19771
19772 : generate list of signal names
19773 echo " "
19774 case "$sig_name_init" in
19775 '') doinit=yes ;;
19776 *)  case "$sig_num_init" in
19777     ''|*,*) doinit=yes ;;
19778     esac ;;
19779 esac
19780 case "$doinit" in
19781 yes)
19782         echo "Generating a list of signal names and numbers..." >&4
19783         . ./signal_cmd
19784         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19785         sig_name=`$awk 'BEGIN { printf "ZERO " }
19786                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19787         sig_num=`$awk  'BEGIN { printf "0 " }
19788                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19789         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19790                              !/^NSIG/   { printf "\"%s\", ", $1 }
19791                              END        { printf "0\n" }' signal.lst`
19792         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19793                              !/^NSIG/   { printf "%d, ", $2}
19794                              END        { printf "0\n"}' signal.lst`
19795         ;;
19796 esac
19797 echo "The following $sig_count signals are available:"
19798 echo " "
19799 echo $sig_name | $awk \
19800 'BEGIN { linelen = 0 }
19801 {
19802         for (i = 1; i <= NF; i++) {
19803                 name = "SIG" $i " "
19804                 linelen = linelen + length(name)
19805                 if (linelen > 70) {
19806                         printf "\n"
19807                         linelen = length(name)
19808                 }
19809                 printf "%s", name
19810         }
19811         printf "\n"
19812 }'
19813 sig_size=`echo $sig_name | awk '{print NF}'`
19814 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19815
19816 echo " "
19817 case "$sizetype" in
19818 *_t) zzz="$sizetype"    ;;
19819 *)   zzz="filesize"     ;;
19820 esac
19821 echo "Checking the size of $zzz..." >&4 
19822 cat > try.c <<EOCP
19823 #include <sys/types.h>
19824 #include <stdio.h>
19825 #$i_stdlib I_STDLIB
19826 #ifdef I_STDLIB
19827 #include <stdlib.h>
19828 #endif
19829 int main() {
19830     printf("%d\n", (int)sizeof($sizetype));
19831     exit(0);
19832 }
19833 EOCP
19834 set try
19835 if eval $compile_ok; then
19836         yyy=`$run ./try`
19837         case "$yyy" in
19838         '')     sizesize=4
19839                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19840                 ;;
19841         *)      sizesize=$yyy
19842                 echo "Your $zzz size is $sizesize bytes."
19843                 ;;
19844         esac
19845 else
19846         sizesize=4
19847         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19848 fi
19849
19850
19851 : check for socklen_t
19852 echo " "
19853 echo "Checking to see if you have socklen_t..." >&4
19854 $cat >try.c <<EOCP
19855 #include <sys/types.h>
19856 #$d_socket HAS_SOCKET
19857 #ifdef HAS_SOCKET
19858 #include <sys/socket.h>
19859 #endif
19860 int main() { socklen_t x = 16; }
19861 EOCP
19862 set try
19863 if eval $compile; then
19864         val="$define"
19865         echo "You have socklen_t."
19866 else
19867         val="$undef"
19868         echo "You do not have socklen_t."
19869         case "$sizetype" in
19870         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19871         esac
19872 fi
19873 $rm -f try try.*
19874 set d_socklen_t
19875 eval $setvar
19876
19877 : see if this is a socks.h system
19878 set socks.h i_socks
19879 eval $inhdr
19880
19881 : check for type of the size argument to socket calls
19882 case "$d_socket" in
19883 "$define")
19884         $cat <<EOM
19885
19886 Checking to see what type is the last argument of accept().
19887 EOM
19888         yyy=''
19889         case "$d_socklen_t" in
19890         "$define") yyy="$yyy socklen_t"
19891         esac
19892         yyy="$yyy $sizetype int long unsigned"
19893         for xxx in $yyy; do
19894                 case "$socksizetype" in
19895                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19896                         case "$usesocks" in
19897                         "$define")
19898                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19899                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19900                                         socksizetype="$xxx"
19901                                 fi
19902                                 ;;
19903                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19904                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19905                                         socksizetype="$xxx"
19906                                 fi
19907                                 ;;
19908                         esac
19909                         ;;
19910                 esac
19911         done
19912 : In case none of those worked, prompt the user.
19913         case "$socksizetype" in
19914         '')     rp='What is the type for socket address structure sizes?'
19915                 dflt='int'
19916                 . ./myread
19917                 socksizetype=$ans
19918                 ;;
19919         esac
19920         ;;
19921 *)      : no sockets, so pick relatively harmless default
19922         socksizetype='int'
19923         ;;
19924 esac
19925
19926 : see what type is used for signed size_t
19927 set ssize_t ssizetype int stdio.h sys/types.h
19928 eval $typedef
19929 dflt="$ssizetype"
19930 $cat > try.c <<EOM
19931 #include <stdio.h>
19932 #$i_stdlib I_STDLIB
19933 #ifdef I_STDLIB
19934 #include <stdlib.h>
19935 #endif
19936 #include <sys/types.h>
19937 #define Size_t $sizetype
19938 #define SSize_t $dflt
19939 int main()
19940 {
19941         if (sizeof(Size_t) == sizeof(SSize_t))
19942                 printf("$dflt\n");
19943         else if (sizeof(Size_t) == sizeof(int))
19944                 printf("int\n");
19945         else 
19946                 printf("long\n");
19947         exit(0);
19948 }
19949 EOM
19950 echo " "
19951 set try
19952 if eval $compile_ok && $run ./try > /dev/null; then
19953         ssizetype=`$run ./try`
19954         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19955 else
19956         $cat >&4 <<EOM
19957 Help! I can't compile and run the ssize_t test program: please enlighten me!
19958 (This is probably a misconfiguration in your system or libraries, and
19959 you really ought to fix it.  Still, I'll try anyway.)
19960
19961 I need a type that is the same size as $sizetype, but is guaranteed to
19962 be signed.  Common values are ssize_t, int and long.
19963
19964 EOM
19965         rp="What signed type is the same size as $sizetype?"
19966         . ./myread
19967         ssizetype="$ans"
19968 fi
19969 $rm -f try try.*
19970
19971 : see what type of char stdio uses.
19972 echo " "
19973 echo '#include <stdio.h>' > stdio.c
19974 $cppstdin $cppminus < stdio.c > stdioh
19975 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19976         echo "Your stdio uses unsigned chars." >&4
19977         stdchar="unsigned char"
19978 else
19979         echo "Your stdio uses signed chars." >&4
19980         stdchar="char"
19981 fi
19982 $rm -f stdio.* stdioh
19983
19984 : see what type uids are declared as in the kernel
19985 echo " "
19986 echo "Looking for the type for user ids returned by getuid()."
19987 set uid_t uidtype xxx stdio.h sys/types.h
19988 eval $typedef
19989 case "$uidtype" in
19990 xxx)
19991         xxx=`./findhdr sys/user.h`
19992         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19993         case $1 in
19994         unsigned) dflt="$1 $2" ;;
19995         *) dflt="$1" ;;
19996         esac
19997         ;;
19998 *) dflt="$uidtype";;
19999 esac
20000 case "$uidtype" in
20001 uid_t)  echo "uid_t found." ;;
20002 *)      rp="What is the type for user ids returned by getuid()?"
20003         . ./myread
20004         uidtype="$ans"
20005         ;;
20006 esac
20007
20008 echo " "
20009 case "$uidtype" in
20010 *_t) zzz="$uidtype"     ;;
20011 *)   zzz="uid"          ;;
20012 esac
20013 echo "Checking the size of $zzz..." >&4 
20014 cat > try.c <<EOCP
20015 #include <sys/types.h>
20016 #include <stdio.h>
20017 #$i_stdlib I_STDLIB
20018 #ifdef I_STDLIB
20019 #include <stdlib.h>
20020 #endif
20021 int main() {
20022     printf("%d\n", (int)sizeof($uidtype));
20023     exit(0);
20024 }
20025 EOCP
20026 set try
20027 if eval $compile_ok; then
20028         yyy=`$run ./try`
20029         case "$yyy" in
20030         '')     uidsize=4
20031                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20032                 ;;
20033         *)      uidsize=$yyy
20034                 echo "Your $zzz is $uidsize bytes long."
20035                 ;;
20036         esac
20037 else
20038         uidsize=4
20039         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20040 fi
20041
20042 echo " "
20043 case "$uidtype" in
20044 *_t) zzz="$uidtype"     ;;
20045 *)   zzz="uid"          ;;
20046 esac
20047 echo "Checking the sign of $zzz..." >&4
20048 cat > try.c <<EOCP
20049 #include <sys/types.h>
20050 #include <stdio.h>
20051 int main() {
20052         $uidtype foo = -1;
20053         if (foo < 0)
20054                 printf("-1\n");
20055         else
20056                 printf("1\n");
20057 }
20058 EOCP
20059 set try
20060 if eval $compile; then
20061         yyy=`$run ./try`
20062         case "$yyy" in
20063         '')     uidsign=1
20064                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20065                 ;;
20066         *)      uidsign=$yyy
20067                 case "$uidsign" in
20068                  1) echo "Your $zzz is unsigned." ;;
20069                 -1) echo "Your $zzz is signed."   ;;
20070                 esac
20071                 ;;
20072         esac
20073 else
20074         uidsign=1
20075         echo "(I can't compile the test program--guessing unsigned.)" >&4
20076 fi
20077
20078
20079
20080 echo " "
20081 $echo "Checking the format string to be used for uids..." >&4
20082
20083 case "$uidsign" in
20084 -1)     if $test X"$uidsize" = X"$ivsize"; then
20085                 uidformat="$ivdformat"
20086         else
20087                 if $test X"$uidsize" = X"$longsize"; then
20088                         uidformat='"ld"'
20089                 else
20090                         if $test X"$uidsize" = X"$intsize"; then
20091                                 uidformat='"d"'
20092                         else
20093                                 if $test X"$uidsize" = X"$shortsize"; then
20094                                         uidformat='"hd"'
20095                                 fi
20096                         fi
20097                 fi
20098         fi
20099         ;;
20100 *)      if $test X"$uidsize" = X"$uvsize"; then
20101                 uidformat="$uvuformat"
20102         else
20103                 if $test X"$uidsize" = X"$longsize"; then
20104                         uidformat='"lu"'
20105                 else
20106                         if $test X"$uidsize" = X"$intsize"; then
20107                                 uidformat='"u"'
20108                         else
20109                                 if $test X"$uidsize" = X"$shortsize"; then
20110                                         uidformat='"hu"'
20111                                 fi
20112                         fi
20113                 fi
20114         fi
20115         ;;
20116 esac
20117
20118
20119 case "$usesitecustomize" in
20120     $define|true|[Yy]*)
20121         usesitecustomize="$define"
20122         ;;
20123     *)
20124         usesitecustomize="$undef"
20125         ;;
20126     esac
20127
20128 : determine compiler compiler
20129 case "$yacc" in
20130 '')
20131         dflt=yacc;;
20132 *)
20133         dflt="$yacc";;
20134 esac
20135 echo " "
20136 comp='yacc'
20137 if $test -f "$byacc$_exe"; then
20138         dflt="$byacc"
20139         comp="byacc or $comp"
20140 fi
20141 if $test -f "$bison$_exe"; then
20142         comp="$comp or bison -y"
20143 fi
20144 rp="Which compiler compiler ($comp) shall I use?"
20145 . ./myread
20146 yacc="$ans"
20147 case "$yacc" in
20148 *bis*)
20149         case "$yacc" in
20150         *-y*) ;;
20151         *)
20152                 yacc="$yacc -y"
20153                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20154                 ;;
20155         esac
20156         ;;
20157 esac
20158
20159 : see if this is a fp.h system
20160 set fp.h i_fp
20161 eval $inhdr
20162
20163 : see if this is a fp_class.h system
20164 set fp_class.h i_fp_class
20165 eval $inhdr
20166
20167 : see if this is a ieeefp.h system
20168 case "$i_ieeefp" in
20169 '' ) set ieeefp.h i_ieeefp
20170      eval $inhdr
20171      ;;
20172 esac
20173
20174 : see if this is a libutil.h system
20175 set libutil.h i_libutil
20176 eval $inhdr
20177
20178 : see if mach cthreads are available
20179 if test "X$usethreads" = "X$define"; then
20180         set mach/cthreads.h i_machcthr
20181         eval $inhdr
20182 else
20183         i_machcthr="$undef"
20184 fi
20185
20186
20187
20188 : see if this is a mntent.h system
20189 set mntent.h i_mntent
20190 eval $inhdr
20191
20192 : see if ndbm.h is available
20193 set ndbm.h t_ndbm
20194 eval $inhdr
20195
20196 case "$t_ndbm" in
20197 $undef)
20198     # Some Linux distributions such as RedHat 7.1 put the
20199     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20200     if $test -f /usr/include/gdbm/ndbm.h; then
20201         echo '<gdbm/ndbm.h> found.'
20202         ccflags="$ccflags -I/usr/include/gdbm"
20203         cppflags="$cppflags -I/usr/include/gdbm"
20204         t_ndbm=$define
20205     fi
20206     ;;
20207 esac
20208
20209 case "$t_ndbm" in
20210 $define)
20211         : see if dbm_open exists
20212         set dbm_open d_dbm_open
20213         eval $inlibc
20214         case "$d_dbm_open" in
20215         $undef)
20216                 t_ndbm="$undef"
20217                 echo "We won't be including <ndbm.h>"
20218                 ;;
20219         esac
20220         ;;
20221 esac
20222 val="$t_ndbm"
20223 set i_ndbm
20224 eval $setvar
20225
20226 : see if net/errno.h is available
20227 val=''
20228 set net/errno.h val
20229 eval $inhdr
20230
20231 : Unfortunately, it causes problems on some systems.  Arrgh.
20232 case "$val" in
20233 $define)
20234         cat > try.c <<'EOM'
20235 #include <stdio.h>
20236 #include <errno.h>
20237 #include <net/errno.h>
20238 int func()
20239 {
20240         return ENOTSOCK;
20241 }
20242 EOM
20243         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20244                 echo "We'll be including <net/errno.h>." >&4
20245         else
20246                 echo "We won't be including <net/errno.h>." >&4
20247                 val="$undef"
20248         fi
20249         $rm -f try.* try
20250         ;;
20251 esac
20252 set i_neterrno
20253 eval $setvar
20254
20255 : see if netinet/tcp.h is available
20256 set netinet/tcp.h i_netinettcp
20257 eval $inhdr
20258
20259 : see if this is a poll.h system
20260 set poll.h i_poll
20261 eval $inhdr
20262
20263 : see if this is a prot.h system
20264 set prot.h i_prot
20265 eval $inhdr
20266
20267 echo " "
20268 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20269 $cat <<'EOSH' > Cppsym.know
20270 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20271 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20272 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20273 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20274 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20275 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20276 bull c cadmus clipper CMU COFF COMPILER_VERSION
20277 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20278 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20279 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20280 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20281 GLIBC GLIBC_MINOR
20282 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20283 H3050R H3050RX hbullx20 hcx host_mips
20284 hp200 hp300 hp700 HP700 hp800 hp9000
20285 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20286 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20287 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20288 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20289 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20290 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20291 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20292 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20293 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20294 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20295 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20296 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20297 MATH_HAS_NO_SIDE_EFFECTS
20298 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20299 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20300 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20301 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20302 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20303 NetBSD news1500 news1700 news1800 news1900 news3700
20304 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20305 ns32016 ns32332 ns32k nsc32000
20306 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20307 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20308 pc532 pdp11 PGC PIC plexus PORTAR posix
20309 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20310 POSIX_C_SOURCE POSIX_SOURCE POWER
20311 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20312 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20313 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20314 sony sony_news sonyrisc sparc sparclite spectrum
20315 stardent stdc STDC_EXT stratos sun sun3 sun386
20316 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20317 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20318 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20319 sysV68 sysV88 Tek4132 Tek4300 titan
20320 TM3200 TM5400 TM5600
20321 tower tower32 tower32_200 tower32_600 tower32_700
20322 tower32_800 tower32_850 tss
20323 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20324 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20325 unix UNIX95 UNIX99 unixpc unos
20326 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20327 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20328 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20329 USGr4 USGr4_2
20330 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20331 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20332 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20333 z8000
20334 EOSH
20335 # Maybe put other stuff here too.
20336 cat <<EOSH >>Cppsym.know
20337 $osname
20338 EOSH
20339 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20340 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20341 $cat Cppsym.know > Cppsym.c
20342 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20343 $rm -f Cppsym.a Cppsym.b Cppsym.c
20344 cat <<EOSH > Cppsym
20345 $startsh
20346 if $test \$# -gt 0; then
20347     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20348     if $test -s Cppsym.got; then
20349         $rm -f Cppsym.got
20350         exit 0
20351     fi
20352     $rm -f Cppsym.got
20353     exit 1
20354 else
20355     $tr " " "$trnl" | ./Cppsym.try
20356     exit 0
20357 fi
20358 EOSH
20359 chmod +x Cppsym
20360 $eunicefix Cppsym
20361 cat <<EOSH > Cppsym.try
20362 $startsh
20363 cat <<'EOCP' > try.c
20364 #include <stdio.h>
20365 #if cpp_stuff == 1
20366 #define STRINGIFY(a)    "a"
20367 #endif
20368 #if cpp_stuff == 42
20369 #define StGiFy(a)  #a
20370 #define STRINGIFY(a)    StGiFy(a)
20371 #endif
20372 #if $cpp_stuff != 1 && $cpp_stuff != 42
20373 #   include "Bletch: How does this C preprocessor stringify macros?"
20374 #endif
20375 int main() {
20376 EOCP
20377 $awk \\
20378 EOSH
20379 cat <<'EOSH' >> Cppsym.try
20380 'length($1) > 0 {
20381     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20382     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20383     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20384     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20385 }'       >> try.c
20386 echo 'return 0;}' >> try.c
20387 EOSH
20388 cat <<EOSH >> Cppsym.try
20389 ccflags="$ccflags"
20390 case "$osname-$gccversion" in
20391 irix-) ccflags="\$ccflags -woff 1178" ;;
20392 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20393 esac
20394 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20395 EOSH
20396 chmod +x Cppsym.try
20397 $eunicefix Cppsym.try
20398 ./Cppsym < Cppsym.know > Cppsym.true
20399 : Add in any linux cpp "predefined macros":
20400 case "$osname::$gccversion" in
20401   *linux*::*.*)
20402     tHdrH=_tmpHdr
20403     rm -f $tHdrH'.h' $tHdrH
20404     touch $tHdrH'.h'
20405     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20406        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20407        if [ -s $tHdrH'_cppsym.real' ]; then
20408           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20409        fi
20410     fi
20411     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20412   ;;
20413 esac
20414 : now check the C compiler for additional symbols
20415 postprocess_cc_v=''
20416 case "$osname" in
20417 aix) postprocess_cc_v="|$tr , ' '" ;;
20418 esac
20419 $cat >ccsym <<EOS
20420 $startsh
20421 $cat >tmp.c <<EOF
20422 extern int foo;
20423 EOF
20424 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20425 do
20426         case "\$i" in
20427         -D*) echo "\$i" | $sed 's/^-D//';;
20428         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20429         esac
20430 done
20431 $rm -f try.c
20432 EOS
20433 postprocess_cc_v=''
20434 chmod +x ccsym
20435 $eunicefix ccsym
20436 ./ccsym > ccsym1.raw
20437 if $test -s ccsym1.raw; then
20438        $sort ccsym1.raw | $uniq >ccsym.raw
20439 else
20440        mv ccsym1.raw ccsym.raw
20441 fi
20442
20443 $awk '/\=/ { print $0; next }
20444         { print $0"=1" }' ccsym.raw >ccsym.list
20445 $comm -13 Cppsym.true ccsym.list >ccsym.own
20446 $comm -12 Cppsym.true ccsym.list >ccsym.com
20447 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20448 also=''
20449 if $test -z ccsym.raw; then
20450         echo "Your C compiler doesn't seem to define any symbols!" >&4
20451         echo " "
20452         echo "However, your C preprocessor defines the following symbols:"
20453         $cat Cppsym.true
20454         ccsymbols=''
20455         cppsymbols=`$cat Cppsym.true`
20456         cppsymbols=`echo $cppsymbols`
20457         cppccsymbols="$cppsymbols"
20458 else
20459         if $test -s ccsym.com; then
20460                 echo "Your C compiler and pre-processor define these symbols:"
20461                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20462                 also='also '
20463                 symbols='ones'
20464                 cppccsymbols=`$cat ccsym.com`
20465                 cppccsymbols=`echo $cppccsymbols`
20466                 $test "$silent" || sleep 1
20467         fi
20468         if $test -s ccsym.cpp; then
20469                 $test "$also" && echo " "
20470                 echo "Your C pre-processor ${also}defines the following symbols:"
20471                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20472                 also='further '
20473                 cppsymbols=`$cat ccsym.cpp`
20474                 cppsymbols=`echo $cppsymbols`
20475                 $test "$silent" || sleep 1
20476         fi
20477         if $test -s ccsym.own; then
20478                 $test "$also" && echo " "
20479                 echo "Your C compiler ${also}defines the following cpp symbols:"
20480                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20481                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20482                 ccsymbols=`$cat ccsym.own`
20483                 ccsymbols=`echo $ccsymbols`
20484                 $test "$silent" || sleep 1
20485         fi
20486 fi
20487
20488 : see if this is a termio system
20489 val="$undef"
20490 val2="$undef"
20491 val3="$undef"
20492 if $test `./findhdr termios.h`; then
20493         set tcsetattr i_termios
20494         eval $inlibc
20495         val3="$i_termios"
20496 fi
20497 echo " "
20498 case "$val3" in
20499 "$define") echo "You have POSIX termios.h... good!" >&4;;
20500 *) if ./Cppsym pyr; then
20501                 case "`/bin/universe`" in
20502                 ucb) if $test `./findhdr sgtty.h`; then
20503                                 val2="$define"
20504                                 echo "<sgtty.h> found." >&4
20505                         else
20506                                 echo "System is pyramid with BSD universe."
20507                                 echo "<sgtty.h> not found--you could have problems." >&4
20508                         fi;;
20509                 *) if $test `./findhdr termio.h`; then
20510                                 val="$define"
20511                                 echo "<termio.h> found." >&4
20512                         else
20513                                 echo "System is pyramid with USG universe."
20514                                 echo "<termio.h> not found--you could have problems." >&4
20515                         fi;;
20516                 esac
20517         elif ./usg; then
20518                 if $test `./findhdr termio.h`; then
20519                         echo "<termio.h> found." >&4
20520                         val="$define"
20521                 elif $test `./findhdr sgtty.h`; then
20522                         echo "<sgtty.h> found." >&4
20523                         val2="$define"
20524                 else
20525 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20526                 fi
20527         else
20528                 if $test `./findhdr sgtty.h`; then
20529                         echo "<sgtty.h> found." >&4
20530                         val2="$define"
20531                 elif $test `./findhdr termio.h`; then
20532                         echo "<termio.h> found." >&4
20533                         val="$define"
20534                 else
20535 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20536                 fi
20537         fi;;
20538 esac
20539 set i_termio; eval $setvar
20540 val=$val2; set i_sgtty; eval $setvar
20541 val=$val3; set i_termios; eval $setvar
20542
20543 : see if stddef is available
20544 set stddef.h i_stddef
20545 eval $inhdr
20546
20547 : see if this is a sunmath.h system
20548 set sunmath.h i_sunmath
20549 eval $inhdr
20550
20551 : see if sys/access.h is available
20552 set sys/access.h i_sysaccess
20553 eval $inhdr
20554
20555 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20556 set sys/filio.h i_sysfilio
20557 eval $inhdr
20558 echo " "
20559 if $test `./findhdr sys/ioctl.h`; then
20560         val="$define"
20561         echo '<sys/ioctl.h> found.' >&4
20562 else
20563         val="$undef"
20564         if $test $i_sysfilio = "$define"; then
20565             echo '<sys/ioctl.h> NOT found.' >&4
20566         else
20567                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20568                 $test $i_termio = "$define" && xxx="termio.h"
20569                 $test $i_termios = "$define" && xxx="termios.h"
20570 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20571         fi
20572 fi
20573 set i_sysioctl
20574 eval $setvar
20575
20576 : see if socket ioctl defs are in sys/sockio.h
20577 echo " "
20578 xxx=`./findhdr sys/sockio.h`
20579 if $test "$xxx"; then
20580         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20581                 val="$define"
20582                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20583         else
20584                 val="$undef"
20585                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20586         fi
20587 else
20588         val="$undef"
20589         $cat <<EOM
20590 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20591 EOM
20592 fi
20593 set i_syssockio
20594 eval $setvar
20595
20596
20597 : see if this is a syslog.h system
20598 set syslog.h i_syslog
20599 eval $inhdr
20600
20601
20602 : see if this is a sys/mode.h system
20603 set sys/mode.h i_sysmode
20604 eval $inhdr
20605
20606 : see if sys/resource.h has to be included
20607 set sys/resource.h i_sysresrc
20608 eval $inhdr
20609
20610 : see if sys/security.h is available
20611 set sys/security.h i_syssecrt
20612 eval $inhdr
20613
20614 : see if this is a sys/statvfs.h system
20615 set sys/statvfs.h i_sysstatvfs
20616 eval $inhdr
20617
20618 : see if this is a sys/un.h system
20619 set sys/un.h i_sysun
20620 eval $inhdr
20621
20622
20623 : see if this is a sys/utsname.h system
20624 set sys/utsname.h i_sysutsname
20625 eval $inhdr
20626
20627 : see if this is a syswait system
20628 set sys/wait.h i_syswait
20629 eval $inhdr
20630
20631 : see if this is a ustat.h system
20632 set ustat.h i_ustat
20633 eval $inhdr
20634
20635 : see if this is an utime system
20636 set utime.h i_utime
20637 eval $inhdr
20638
20639 : see if this is a values.h system
20640 set values.h i_values
20641 eval $inhdr
20642
20643 : see if this is a vfork system
20644 case "$d_vfork" in
20645 "$define")
20646         set vfork.h i_vfork
20647         eval $inhdr
20648         ;;
20649 *)
20650         i_vfork="$undef"
20651         ;;
20652 esac
20653
20654 : see if gdbm.h is available
20655 set gdbm.h t_gdbm
20656 eval $inhdr
20657 case "$t_gdbm" in
20658 $define)
20659         : see if gdbm_open exists
20660         set gdbm_open d_gdbm_open
20661         eval $inlibc
20662         case "$d_gdbm_open" in
20663         $undef)
20664                 t_gdbm="$undef"
20665                 echo "We won't be including <gdbm.h>"
20666                 ;;
20667         esac
20668         ;;
20669 esac
20670 val="$t_gdbm"
20671 set i_gdbm
20672 eval $setvar
20673
20674 echo " "
20675 echo "Looking for extensions..." >&4
20676 : If we are using the old config.sh, known_extensions may contain
20677 : old or inaccurate or duplicate values.
20678 known_extensions=''
20679 nonxs_extensions=''
20680 : We do not use find because it might not be available.
20681 : We do not just use MANIFEST because the user may have dropped
20682 : some additional extensions into the source tree and expect them
20683 : to be built.
20684
20685 : Function to recursively find available extensions, ignoring DynaLoader
20686 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20687 find_extensions='
20688     for xxx in *; do
20689        case "$xxx" in
20690            DynaLoader|dynaload) ;;
20691            *)
20692            if $test -f $xxx/$xxx.xs; then
20693                known_extensions="$known_extensions $1$xxx";
20694            elif $test -f $xxx/Makefile.PL; then
20695                nonxs_extensions="$nonxs_extensions $1$xxx";
20696            else
20697                if $test -d $xxx -a $# -lt 10; then
20698                    set $1$xxx/ $*;
20699                    cd "$xxx";
20700                    eval $find_extensions;
20701                    cd ..;
20702                    shift;
20703                fi;
20704            fi
20705            ;;
20706        esac;
20707     done'
20708 tdir=`pwd`
20709 cd "$rsrc/ext"
20710 set X
20711 shift
20712 eval $find_extensions
20713 # Special case:  Add in threads/shared since it is not picked up by the
20714 # recursive find above (and adding in general recursive finding breaks
20715 # SDBM_File/sdbm).  A.D.  10/25/2001.
20716 known_extensions="$known_extensions threads/shared"
20717 set X $nonxs_extensions
20718 shift
20719 nonxs_extensions="$*"
20720 set X $known_extensions
20721 shift
20722 known_extensions="$*"
20723 cd "$tdir"
20724
20725 : Now see which are supported on this system.
20726 avail_ext=''
20727 for xxx in $known_extensions ; do
20728         case "$xxx" in
20729         DB_File|db_file)
20730                 case "$i_db" in
20731                 $define) avail_ext="$avail_ext $xxx" ;;
20732                 esac
20733                 ;;
20734         GDBM_File|gdbm_fil)
20735                 case "$i_gdbm" in 
20736                 $define) avail_ext="$avail_ext $xxx" ;;
20737                 esac
20738                 ;;
20739         I18N/Langinfo|i18n_lan)
20740                 case "$i_langinfo$d_nl_langinfo" in 
20741                 $define$define) avail_ext="$avail_ext $xxx" ;;
20742                 esac
20743                 ;;
20744         NDBM_File|ndbm_fil)
20745                 case "$i_ndbm" in
20746                 $define)
20747                     case "$osname-$use64bitint" in
20748                     hpux-define)
20749                         case "$libs" in
20750                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20751                         esac
20752                         ;;
20753                     *) avail_ext="$avail_ext $xxx" ;;
20754                     esac
20755                     ;;
20756                 esac
20757                 ;;
20758         ODBM_File|odbm_fil) 
20759                 case "${i_dbm}${i_rpcsvcdbm}" in
20760                 *"${define}"*)
20761                     case "$osname-$use64bitint" in
20762                     hpux-define)
20763                         case "$libs" in
20764                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20765                         esac
20766                         ;;
20767                     *) avail_ext="$avail_ext $xxx" ;;
20768                     esac
20769                     ;;
20770                 esac
20771                 ;;
20772         POSIX|posix)
20773                 case "$useposix" in
20774                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20775                 esac
20776                 ;;
20777         Opcode|opcode)
20778                 case "$useopcode" in
20779                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20780                 esac
20781                 ;;
20782         Socket|socket)
20783                 case "$d_socket" in 
20784                 true|$define|y)
20785                     case "$osname" in
20786                     beos) ;; # not unless BONE
20787                     *) avail_ext="$avail_ext $xxx" ;;
20788                     esac
20789                     ;;
20790                 esac
20791                 ;;
20792         Sys/Syslog|sys/syslog)
20793                 : XXX syslog requires socket
20794                 case "$d_socket" in 
20795                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20796                 esac
20797                 ;;
20798         Thread|thread)
20799                 case "$usethreads" in
20800                 true|$define|y)
20801                         case "$useithreads" in
20802                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20803                         esac
20804                 esac
20805                 ;;
20806         XS/APItest|xs/apitest)
20807                 # This is just for testing.  Skip it unless we have dynamic loading.
20808
20809                 case "$usedl" in
20810                 $define) avail_ext="$avail_ext $xxx" ;;
20811                 esac
20812                 ;;
20813         XS/Typemap|xs/typemap)
20814                 # This is just for testing.  Skip it unless we have dynamic loading.
20815                 case "$usedl" in
20816                 $define) avail_ext="$avail_ext $xxx" ;;
20817                 esac
20818                 ;;
20819         threads|threads/shared)
20820                 # threads and threads::shared are special cases.
20821                 # To stop people from asking "Perl 5.8.0 was supposed
20822                 # to have this new fancy threads implementation but my
20823                 # perl doesn't have it" and from people trying to
20824                 # (re)install the threads module using CPAN.pm and
20825                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20826                 # the threads.pm and threads/shared.pm will always be
20827                 # there, croaking informatively ("you need to rebuild
20828                 # all of Perl with threads, sorry") when threads haven't
20829                 # been compiled in.
20830                 # --jhi
20831                 avail_ext="$avail_ext $xxx"
20832                 ;;
20833         IPC/SysV|ipc/sysv)
20834                 : XXX Do we need a useipcsysv variable here
20835                 case "${d_msg}${d_sem}${d_shm}" in 
20836                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20837                 esac
20838                 ;;
20839         *)      avail_ext="$avail_ext $xxx"
20840                 ;;
20841         esac
20842 done
20843
20844 set X $avail_ext
20845 shift
20846 avail_ext="$*"
20847
20848 case "$onlyextensions" in
20849 '') ;;
20850 *)  keepextensions=''
20851     echo "You have requested that only certains extensions be included..." >&4
20852     for i in $onlyextensions; do
20853         case " $avail_ext " in
20854         *" $i "*)
20855             echo "Keeping extension $i."
20856             keepextensions="$keepextensions $i"
20857             ;;
20858         *) echo "Ignoring extension $i." ;;
20859         esac
20860     done
20861     avail_ext="$keepextensions"
20862     ;;
20863 esac
20864
20865 case "$noextensions" in
20866 '') ;;
20867 *)  keepextensions=''
20868     echo "You have requested that certain extensions be ignored..." >&4
20869     for i in $avail_ext; do
20870         case " $noextensions " in
20871         *" $i "*) echo "Ignoring extension $i." ;;
20872         *) echo "Keeping extension $i.";
20873            keepextensions="$keepextensions $i"
20874            ;;
20875         esac
20876     done
20877     avail_ext="$keepextensions"
20878     ;;
20879 esac
20880
20881 : Now see which nonxs extensions are supported on this system.
20882 : For now assume all are.
20883 nonxs_ext=''
20884 for xxx in $nonxs_extensions ; do
20885         case "$xxx" in
20886         *)      nonxs_ext="$nonxs_ext $xxx"
20887                 ;;
20888         esac
20889 done
20890
20891 set X $nonxs_ext
20892 shift
20893 nonxs_ext="$*"
20894
20895 case $usedl in
20896 $define)
20897         $cat <<EOM
20898 A number of extensions are supplied with $package.  You may choose to
20899 compile these extensions for dynamic loading (the default), compile
20900 them into the $package executable (static loading), or not include
20901 them at all.  Answer "none" to include no extensions.
20902 Note that DynaLoader is always built and need not be mentioned here.
20903
20904 EOM
20905         case "$dynamic_ext" in
20906         '')
20907                 : Exclude those listed in static_ext
20908                 dflt=''
20909                 for xxx in $avail_ext; do
20910                         case " $static_ext " in
20911                         *" $xxx "*) ;;
20912                         *) dflt="$dflt $xxx" ;;
20913                         esac
20914                 done
20915                 set X $dflt
20916                 shift
20917                 dflt="$*"
20918                 ;;
20919         *)      dflt="$dynamic_ext"
20920                 # Perhaps we are reusing an old out-of-date config.sh.
20921                 case "$hint" in
20922                 previous)
20923                         if test X"$dynamic_ext" != X"$avail_ext"; then
20924                                 $cat <<EOM
20925 NOTICE:  Your previous config.sh list may be incorrect. 
20926 The extensions now available to you are 
20927         ${avail_ext}
20928 but the default list from your previous config.sh is
20929         ${dynamic_ext} 
20930
20931 EOM
20932                         fi
20933                         ;;
20934                 esac
20935                 ;;
20936         esac
20937         case "$dflt" in
20938         '')     dflt=none;;
20939         esac
20940         rp="What extensions do you wish to load dynamically?"
20941         . ./myread
20942         case "$ans" in
20943         none) dynamic_ext=' ' ;;
20944         *) dynamic_ext="$ans" ;;
20945         esac
20946
20947         case "$static_ext" in
20948         '')
20949                 : Exclude those already listed in dynamic linking
20950                 dflt=''
20951                 for xxx in $avail_ext; do
20952                         case " $dynamic_ext " in
20953                         *" $xxx "*) ;;
20954                         *) dflt="$dflt $xxx" ;;
20955                         esac
20956                 done
20957                 set X $dflt
20958                 shift
20959                 dflt="$*"
20960                 ;;
20961         *)  dflt="$static_ext" 
20962                 ;;
20963         esac
20964
20965         case "$dflt" in
20966         '')     dflt=none;;
20967         esac
20968         rp="What extensions do you wish to load statically?"
20969         . ./myread
20970         case "$ans" in
20971         none) static_ext=' ' ;;
20972         *) static_ext="$ans" ;;
20973         esac
20974         ;;
20975 *)
20976         $cat <<EOM
20977 A number of extensions are supplied with $package.  Answer "none" 
20978 to include no extensions. 
20979 Note that DynaLoader is always built and need not be mentioned here.
20980
20981 EOM
20982         case "$static_ext" in
20983         '') dflt="$avail_ext" ;;
20984         *)      dflt="$static_ext"
20985                 # Perhaps we are reusing an old out-of-date config.sh.
20986                 case "$hint" in
20987                 previous)
20988                         if test X"$static_ext" != X"$avail_ext"; then
20989                                 $cat <<EOM
20990 NOTICE:  Your previous config.sh list may be incorrect. 
20991 The extensions now available to you are 
20992         ${avail_ext}
20993 but the default list from your previous config.sh is
20994         ${static_ext} 
20995
20996 EOM
20997                         fi
20998                         ;;
20999                 esac
21000                 ;;
21001         esac
21002         : Exclude those that are not xs extensions
21003         case "$dflt" in
21004         '')     dflt=none;;
21005         esac
21006         rp="What extensions do you wish to include?"
21007         . ./myread
21008         case "$ans" in
21009         none) static_ext=' ' ;;
21010         *) static_ext="$ans" ;;
21011         esac
21012         ;;
21013 esac
21014 #        
21015 # Encode is a special case.  If we are building Encode as a static
21016 # extension, we need to explicitly list its subextensions as well.
21017 # For other nested extensions, this is handled automatically by
21018 # the appropriate Makefile.PL.
21019 case " $static_ext " in
21020         *" Encode "*) # Add the subextensions of Encode
21021         cd "$rsrc/ext"
21022         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21023                 static_ext="$static_ext Encode/$xxx"
21024         done
21025         cd "$tdir"
21026         ;;
21027 esac
21028
21029 set X $dynamic_ext $static_ext $nonxs_ext
21030 shift
21031 extensions="$*"
21032
21033 # Sanity check:  We require an extension suitable for use with
21034 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21035 # should show up as failures in the test suite, but it's helpful to
21036 # catch them now.) The 'extensions' list is normally sorted
21037 # alphabetically, so we need to accept either
21038 #    DB_File ... Fcntl ... IO  ....
21039 # or something like
21040 #    Fcntl ... NDBM_File ... IO  ....
21041 case " $extensions"  in
21042 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21043 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21044 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21045 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21046    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21047    ;;
21048 esac
21049
21050 : Remove libraries needed only for extensions
21051 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21052 : The exception is SunOS 4.x, which needs them.
21053 case "${osname}X${osvers}" in
21054 sunos*X4*)
21055     perllibs="$libs"
21056     ;;
21057 *) case "$usedl" in
21058     $define|true|[yY]*)
21059             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21060             shift
21061             perllibs="$*"
21062             ;;
21063     *)  perllibs="$libs"
21064             ;;
21065     esac
21066     ;;
21067 esac
21068
21069 : Remove build directory name from cppstdin so it can be used from
21070 : either the present location or the final installed location.
21071 echo " "
21072 : Get out of the UU directory to get correct path name.
21073 cd ..
21074 case "$cppstdin" in
21075 `pwd`/cppstdin)
21076         echo "Stripping down cppstdin path name"
21077         cppstdin=cppstdin
21078         ;;
21079 esac
21080 cd UU
21081
21082 : end of configuration questions
21083 echo " "
21084 echo "End of configuration questions."
21085 echo " "
21086
21087 : back to where it started
21088 if test -d ../UU; then
21089         cd ..
21090 fi
21091
21092 : configuration may be patched via a 'config.arch' file
21093 if $test -f config.arch; then
21094         echo "I see a config.arch file, loading it."
21095         . ./config.arch
21096 fi
21097
21098 : configuration may be patched via a 'config.over' file
21099 if $test -f config.over; then
21100         echo " "
21101         dflt=y
21102         rp='I see a config.over file.  Do you wish to load it?'
21103         . UU/myread
21104         case "$ans" in
21105         n*) echo "OK, I'll ignore it.";;
21106         *)      . ./config.over
21107                 echo "Configuration override changes have been loaded."
21108                 ;;
21109         esac
21110 fi
21111
21112 : in case they want portability, strip down executable paths
21113 case "$d_portable" in
21114 "$define")
21115         echo " "
21116         echo "Stripping down executable paths..." >&4
21117         for file in $loclist $trylist; do
21118                 eval temp=\$$file
21119                 eval $file=`basename $temp`
21120         done
21121         ;;
21122 esac
21123
21124 : create config.sh file
21125 echo " "
21126 echo "Creating config.sh..." >&4
21127 $spitshell <<EOT >config.sh
21128 $startsh
21129 #
21130 # This file was produced by running the Configure script. It holds all the
21131 # definitions figured out by Configure. Should you modify one of these values,
21132 # do not forget to propagate your changes by running "Configure -der". You may
21133 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21134 #
21135
21136 # Package name      : $package
21137 # Source directory  : $src
21138 # Configuration time: $cf_time
21139 # Configured by     : $cf_by
21140 # Target system     : $myuname
21141
21142 Author='$Author'
21143 Date='$Date'
21144 Header='$Header'
21145 Id='$Id'
21146 Locker='$Locker'
21147 Log='$Log'
21148 Mcc='$Mcc'
21149 RCSfile='$RCSfile'
21150 Revision='$Revision'
21151 Source='$Source'
21152 State='$State'
21153 _a='$_a'
21154 _exe='$_exe'
21155 _o='$_o'
21156 afs='$afs'
21157 afsroot='$afsroot'
21158 alignbytes='$alignbytes'
21159 ansi2knr='$ansi2knr'
21160 aphostname='$aphostname'
21161 api_revision='$api_revision'
21162 api_subversion='$api_subversion'
21163 api_version='$api_version'
21164 api_versionstring='$api_versionstring'
21165 ar='$ar'
21166 archlib='$archlib'
21167 archlibexp='$archlibexp'
21168 archname64='$archname64'
21169 archname='$archname'
21170 archobjs='$archobjs'
21171 asctime_r_proto='$asctime_r_proto'
21172 awk='$awk'
21173 baserev='$baserev'
21174 bash='$bash'
21175 bin='$bin'
21176 binexp='$binexp'
21177 bison='$bison'
21178 byacc='$byacc'
21179 byteorder='$byteorder'
21180 c='$c'
21181 castflags='$castflags'
21182 cat='$cat'
21183 cc='$cc'
21184 cccdlflags='$cccdlflags'
21185 ccdlflags='$ccdlflags'
21186 ccflags='$ccflags'
21187 ccflags_uselargefiles='$ccflags_uselargefiles'
21188 ccname='$ccname'
21189 ccsymbols='$ccsymbols'
21190 ccversion='$ccversion'
21191 cf_by='$cf_by'
21192 cf_email='$cf_email'
21193 cf_time='$cf_time'
21194 charsize='$charsize'
21195 chgrp='$chgrp'
21196 chmod='$chmod'
21197 chown='$chown'
21198 clocktype='$clocktype'
21199 comm='$comm'
21200 compress='$compress'
21201 contains='$contains'
21202 cp='$cp'
21203 cpio='$cpio'
21204 cpp='$cpp'
21205 cpp_stuff='$cpp_stuff'
21206 cppccsymbols='$cppccsymbols'
21207 cppflags='$cppflags'
21208 cpplast='$cpplast'
21209 cppminus='$cppminus'
21210 cpprun='$cpprun'
21211 cppstdin='$cppstdin'
21212 cppsymbols='$cppsymbols'
21213 crypt_r_proto='$crypt_r_proto'
21214 cryptlib='$cryptlib'
21215 csh='$csh'
21216 ctermid_r_proto='$ctermid_r_proto'
21217 ctime_r_proto='$ctime_r_proto'
21218 d_Gconvert='$d_Gconvert'
21219 d_PRIEUldbl='$d_PRIEUldbl'
21220 d_PRIFUldbl='$d_PRIFUldbl'
21221 d_PRIGUldbl='$d_PRIGUldbl'
21222 d_PRIXU64='$d_PRIXU64'
21223 d_PRId64='$d_PRId64'
21224 d_PRIeldbl='$d_PRIeldbl'
21225 d_PRIfldbl='$d_PRIfldbl'
21226 d_PRIgldbl='$d_PRIgldbl'
21227 d_PRIi64='$d_PRIi64'
21228 d_PRIo64='$d_PRIo64'
21229 d_PRIu64='$d_PRIu64'
21230 d_PRIx64='$d_PRIx64'
21231 d_SCNfldbl='$d_SCNfldbl'
21232 d__fwalk='$d__fwalk'
21233 d_access='$d_access'
21234 d_accessx='$d_accessx'
21235 d_aintl='$d_aintl'
21236 d_alarm='$d_alarm'
21237 d_archlib='$d_archlib'
21238 d_asctime_r='$d_asctime_r'
21239 d_atolf='$d_atolf'
21240 d_atoll='$d_atoll'
21241 d_attribute_format='$d_attribute_format'
21242 d_attribute_malloc='$d_attribute_malloc'
21243 d_attribute_nonnull='$d_attribute_nonnull'
21244 d_attribute_noreturn='$d_attribute_noreturn'
21245 d_attribute_pure='$d_attribute_pure'
21246 d_attribute_unused='$d_attribute_unused'
21247 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21248 d_bcmp='$d_bcmp'
21249 d_bcopy='$d_bcopy'
21250 d_bsd='$d_bsd'
21251 d_bsdgetpgrp='$d_bsdgetpgrp'
21252 d_bsdsetpgrp='$d_bsdsetpgrp'
21253 d_builtin_choose_expr='$d_builtin_choose_expr'
21254 d_builtin_expect='$d_builtin_expect'
21255 d_bzero='$d_bzero'
21256 d_casti32='$d_casti32'
21257 d_castneg='$d_castneg'
21258 d_charvspr='$d_charvspr'
21259 d_chown='$d_chown'
21260 d_chroot='$d_chroot'
21261 d_chsize='$d_chsize'
21262 d_class='$d_class'
21263 d_clearenv='$d_clearenv'
21264 d_closedir='$d_closedir'
21265 d_cmsghdr_s='$d_cmsghdr_s'
21266 d_const='$d_const'
21267 d_copysignl='$d_copysignl'
21268 d_crypt='$d_crypt'
21269 d_crypt_r='$d_crypt_r'
21270 d_csh='$d_csh'
21271 d_ctermid_r='$d_ctermid_r'
21272 d_ctime_r='$d_ctime_r'
21273 d_cuserid='$d_cuserid'
21274 d_dbl_dig='$d_dbl_dig'
21275 d_dbminitproto='$d_dbminitproto'
21276 d_difftime='$d_difftime'
21277 d_dirfd='$d_dirfd'
21278 d_dirnamlen='$d_dirnamlen'
21279 d_dlerror='$d_dlerror'
21280 d_dlopen='$d_dlopen'
21281 d_dlsymun='$d_dlsymun'
21282 d_dosuid='$d_dosuid'
21283 d_drand48_r='$d_drand48_r'
21284 d_drand48proto='$d_drand48proto'
21285 d_dup2='$d_dup2'
21286 d_eaccess='$d_eaccess'
21287 d_endgrent='$d_endgrent'
21288 d_endgrent_r='$d_endgrent_r'
21289 d_endhent='$d_endhent'
21290 d_endhostent_r='$d_endhostent_r'
21291 d_endnent='$d_endnent'
21292 d_endnetent_r='$d_endnetent_r'
21293 d_endpent='$d_endpent'
21294 d_endprotoent_r='$d_endprotoent_r'
21295 d_endpwent='$d_endpwent'
21296 d_endpwent_r='$d_endpwent_r'
21297 d_endsent='$d_endsent'
21298 d_endservent_r='$d_endservent_r'
21299 d_eofnblk='$d_eofnblk'
21300 d_eunice='$d_eunice'
21301 d_faststdio='$d_faststdio'
21302 d_fchdir='$d_fchdir'
21303 d_fchmod='$d_fchmod'
21304 d_fchown='$d_fchown'
21305 d_fcntl='$d_fcntl'
21306 d_fcntl_can_lock='$d_fcntl_can_lock'
21307 d_fd_macros='$d_fd_macros'
21308 d_fd_set='$d_fd_set'
21309 d_fds_bits='$d_fds_bits'
21310 d_fgetpos='$d_fgetpos'
21311 d_finite='$d_finite'
21312 d_finitel='$d_finitel'
21313 d_flexfnam='$d_flexfnam'
21314 d_flock='$d_flock'
21315 d_flockproto='$d_flockproto'
21316 d_fork='$d_fork'
21317 d_fp_class='$d_fp_class'
21318 d_fpathconf='$d_fpathconf'
21319 d_fpclass='$d_fpclass'
21320 d_fpclassify='$d_fpclassify'
21321 d_fpclassl='$d_fpclassl'
21322 d_fpos64_t='$d_fpos64_t'
21323 d_frexpl='$d_frexpl'
21324 d_fs_data_s='$d_fs_data_s'
21325 d_fseeko='$d_fseeko'
21326 d_fsetpos='$d_fsetpos'
21327 d_fstatfs='$d_fstatfs'
21328 d_fstatvfs='$d_fstatvfs'
21329 d_fsync='$d_fsync'
21330 d_ftello='$d_ftello'
21331 d_ftime='$d_ftime'
21332 d_futimes='$d_futimes'
21333 d_getcwd='$d_getcwd'
21334 d_getespwnam='$d_getespwnam'
21335 d_getfsstat='$d_getfsstat'
21336 d_getgrent='$d_getgrent'
21337 d_getgrent_r='$d_getgrent_r'
21338 d_getgrgid_r='$d_getgrgid_r'
21339 d_getgrnam_r='$d_getgrnam_r'
21340 d_getgrps='$d_getgrps'
21341 d_gethbyaddr='$d_gethbyaddr'
21342 d_gethbyname='$d_gethbyname'
21343 d_gethent='$d_gethent'
21344 d_gethname='$d_gethname'
21345 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21346 d_gethostbyname_r='$d_gethostbyname_r'
21347 d_gethostent_r='$d_gethostent_r'
21348 d_gethostprotos='$d_gethostprotos'
21349 d_getitimer='$d_getitimer'
21350 d_getlogin='$d_getlogin'
21351 d_getlogin_r='$d_getlogin_r'
21352 d_getmnt='$d_getmnt'
21353 d_getmntent='$d_getmntent'
21354 d_getnbyaddr='$d_getnbyaddr'
21355 d_getnbyname='$d_getnbyname'
21356 d_getnent='$d_getnent'
21357 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21358 d_getnetbyname_r='$d_getnetbyname_r'
21359 d_getnetent_r='$d_getnetent_r'
21360 d_getnetprotos='$d_getnetprotos'
21361 d_getpagsz='$d_getpagsz'
21362 d_getpbyname='$d_getpbyname'
21363 d_getpbynumber='$d_getpbynumber'
21364 d_getpent='$d_getpent'
21365 d_getpgid='$d_getpgid'
21366 d_getpgrp2='$d_getpgrp2'
21367 d_getpgrp='$d_getpgrp'
21368 d_getppid='$d_getppid'
21369 d_getprior='$d_getprior'
21370 d_getprotobyname_r='$d_getprotobyname_r'
21371 d_getprotobynumber_r='$d_getprotobynumber_r'
21372 d_getprotoent_r='$d_getprotoent_r'
21373 d_getprotoprotos='$d_getprotoprotos'
21374 d_getprpwnam='$d_getprpwnam'
21375 d_getpwent='$d_getpwent'
21376 d_getpwent_r='$d_getpwent_r'
21377 d_getpwnam_r='$d_getpwnam_r'
21378 d_getpwuid_r='$d_getpwuid_r'
21379 d_getsbyname='$d_getsbyname'
21380 d_getsbyport='$d_getsbyport'
21381 d_getsent='$d_getsent'
21382 d_getservbyname_r='$d_getservbyname_r'
21383 d_getservbyport_r='$d_getservbyport_r'
21384 d_getservent_r='$d_getservent_r'
21385 d_getservprotos='$d_getservprotos'
21386 d_getspnam='$d_getspnam'
21387 d_getspnam_r='$d_getspnam_r'
21388 d_gettimeod='$d_gettimeod'
21389 d_gmtime_r='$d_gmtime_r'
21390 d_gnulibc='$d_gnulibc'
21391 d_grpasswd='$d_grpasswd'
21392 d_hasmntopt='$d_hasmntopt'
21393 d_htonl='$d_htonl'
21394 d_ilogbl='$d_ilogbl'
21395 d_inc_version_list='$d_inc_version_list'
21396 d_index='$d_index'
21397 d_inetaton='$d_inetaton'
21398 d_int64_t='$d_int64_t'
21399 d_isascii='$d_isascii'
21400 d_isfinite='$d_isfinite'
21401 d_isinf='$d_isinf'
21402 d_isnan='$d_isnan'
21403 d_isnanl='$d_isnanl'
21404 d_killpg='$d_killpg'
21405 d_lchown='$d_lchown'
21406 d_ldbl_dig='$d_ldbl_dig'
21407 d_libm_lib_version='$d_libm_lib_version'
21408 d_link='$d_link'
21409 d_localtime_r='$d_localtime_r'
21410 d_locconv='$d_locconv'
21411 d_lockf='$d_lockf'
21412 d_longdbl='$d_longdbl'
21413 d_longlong='$d_longlong'
21414 d_lseekproto='$d_lseekproto'
21415 d_lstat='$d_lstat'
21416 d_madvise='$d_madvise'
21417 d_malloc_good_size='$d_malloc_good_size'
21418 d_malloc_size='$d_malloc_size'
21419 d_mblen='$d_mblen'
21420 d_mbstowcs='$d_mbstowcs'
21421 d_mbtowc='$d_mbtowc'
21422 d_memchr='$d_memchr'
21423 d_memcmp='$d_memcmp'
21424 d_memcpy='$d_memcpy'
21425 d_memmove='$d_memmove'
21426 d_memset='$d_memset'
21427 d_mkdir='$d_mkdir'
21428 d_mkdtemp='$d_mkdtemp'
21429 d_mkfifo='$d_mkfifo'
21430 d_mkstemp='$d_mkstemp'
21431 d_mkstemps='$d_mkstemps'
21432 d_mktime='$d_mktime'
21433 d_mmap='$d_mmap'
21434 d_modfl='$d_modfl'
21435 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21436 d_modflproto='$d_modflproto'
21437 d_mprotect='$d_mprotect'
21438 d_msg='$d_msg'
21439 d_msg_ctrunc='$d_msg_ctrunc'
21440 d_msg_dontroute='$d_msg_dontroute'
21441 d_msg_oob='$d_msg_oob'
21442 d_msg_peek='$d_msg_peek'
21443 d_msg_proxy='$d_msg_proxy'
21444 d_msgctl='$d_msgctl'
21445 d_msgget='$d_msgget'
21446 d_msghdr_s='$d_msghdr_s'
21447 d_msgrcv='$d_msgrcv'
21448 d_msgsnd='$d_msgsnd'
21449 d_msync='$d_msync'
21450 d_munmap='$d_munmap'
21451 d_mymalloc='$d_mymalloc'
21452 d_nice='$d_nice'
21453 d_nl_langinfo='$d_nl_langinfo'
21454 d_nv_preserves_uv='$d_nv_preserves_uv'
21455 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21456 d_off64_t='$d_off64_t'
21457 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21458 d_oldpthreads='$d_oldpthreads'
21459 d_oldsock='$d_oldsock'
21460 d_open3='$d_open3'
21461 d_pathconf='$d_pathconf'
21462 d_pause='$d_pause'
21463 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21464 d_phostname='$d_phostname'
21465 d_pipe='$d_pipe'
21466 d_poll='$d_poll'
21467 d_portable='$d_portable'
21468 d_procselfexe='$d_procselfexe'
21469 d_pthread_atfork='$d_pthread_atfork'
21470 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21471 d_pthread_yield='$d_pthread_yield'
21472 d_pwage='$d_pwage'
21473 d_pwchange='$d_pwchange'
21474 d_pwclass='$d_pwclass'
21475 d_pwcomment='$d_pwcomment'
21476 d_pwexpire='$d_pwexpire'
21477 d_pwgecos='$d_pwgecos'
21478 d_pwpasswd='$d_pwpasswd'
21479 d_pwquota='$d_pwquota'
21480 d_qgcvt='$d_qgcvt'
21481 d_quad='$d_quad'
21482 d_random_r='$d_random_r'
21483 d_readdir64_r='$d_readdir64_r'
21484 d_readdir='$d_readdir'
21485 d_readdir_r='$d_readdir_r'
21486 d_readlink='$d_readlink'
21487 d_readv='$d_readv'
21488 d_recvmsg='$d_recvmsg'
21489 d_rename='$d_rename'
21490 d_rewinddir='$d_rewinddir'
21491 d_rmdir='$d_rmdir'
21492 d_safebcpy='$d_safebcpy'
21493 d_safemcpy='$d_safemcpy'
21494 d_sanemcmp='$d_sanemcmp'
21495 d_sbrkproto='$d_sbrkproto'
21496 d_scalbnl='$d_scalbnl'
21497 d_sched_yield='$d_sched_yield'
21498 d_scm_rights='$d_scm_rights'
21499 d_seekdir='$d_seekdir'
21500 d_select='$d_select'
21501 d_sem='$d_sem'
21502 d_semctl='$d_semctl'
21503 d_semctl_semid_ds='$d_semctl_semid_ds'
21504 d_semctl_semun='$d_semctl_semun'
21505 d_semget='$d_semget'
21506 d_semop='$d_semop'
21507 d_sendmsg='$d_sendmsg'
21508 d_setegid='$d_setegid'
21509 d_seteuid='$d_seteuid'
21510 d_setgrent='$d_setgrent'
21511 d_setgrent_r='$d_setgrent_r'
21512 d_setgrps='$d_setgrps'
21513 d_sethent='$d_sethent'
21514 d_sethostent_r='$d_sethostent_r'
21515 d_setitimer='$d_setitimer'
21516 d_setlinebuf='$d_setlinebuf'
21517 d_setlocale='$d_setlocale'
21518 d_setlocale_r='$d_setlocale_r'
21519 d_setnent='$d_setnent'
21520 d_setnetent_r='$d_setnetent_r'
21521 d_setpent='$d_setpent'
21522 d_setpgid='$d_setpgid'
21523 d_setpgrp2='$d_setpgrp2'
21524 d_setpgrp='$d_setpgrp'
21525 d_setprior='$d_setprior'
21526 d_setproctitle='$d_setproctitle'
21527 d_setprotoent_r='$d_setprotoent_r'
21528 d_setpwent='$d_setpwent'
21529 d_setpwent_r='$d_setpwent_r'
21530 d_setregid='$d_setregid'
21531 d_setresgid='$d_setresgid'
21532 d_setresuid='$d_setresuid'
21533 d_setreuid='$d_setreuid'
21534 d_setrgid='$d_setrgid'
21535 d_setruid='$d_setruid'
21536 d_setsent='$d_setsent'
21537 d_setservent_r='$d_setservent_r'
21538 d_setsid='$d_setsid'
21539 d_setvbuf='$d_setvbuf'
21540 d_sfio='$d_sfio'
21541 d_shm='$d_shm'
21542 d_shmat='$d_shmat'
21543 d_shmatprototype='$d_shmatprototype'
21544 d_shmctl='$d_shmctl'
21545 d_shmdt='$d_shmdt'
21546 d_shmget='$d_shmget'
21547 d_sigaction='$d_sigaction'
21548 d_sigprocmask='$d_sigprocmask'
21549 d_sigsetjmp='$d_sigsetjmp'
21550 d_sitearch='$d_sitearch'
21551 d_snprintf='$d_snprintf'
21552 d_sockatmark='$d_sockatmark'
21553 d_sockatmarkproto='$d_sockatmarkproto'
21554 d_socket='$d_socket'
21555 d_socklen_t='$d_socklen_t'
21556 d_sockpair='$d_sockpair'
21557 d_socks5_init='$d_socks5_init'
21558 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21559 d_sqrtl='$d_sqrtl'
21560 d_srand48_r='$d_srand48_r'
21561 d_srandom_r='$d_srandom_r'
21562 d_sresgproto='$d_sresgproto'
21563 d_sresuproto='$d_sresuproto'
21564 d_statblks='$d_statblks'
21565 d_statfs_f_flags='$d_statfs_f_flags'
21566 d_statfs_s='$d_statfs_s'
21567 d_statvfs='$d_statvfs'
21568 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21569 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21570 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21571 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21572 d_stdio_stream_array='$d_stdio_stream_array'
21573 d_stdiobase='$d_stdiobase'
21574 d_stdstdio='$d_stdstdio'
21575 d_strchr='$d_strchr'
21576 d_strcoll='$d_strcoll'
21577 d_strctcpy='$d_strctcpy'
21578 d_strerrm='$d_strerrm'
21579 d_strerror='$d_strerror'
21580 d_strerror_r='$d_strerror_r'
21581 d_strftime='$d_strftime'
21582 d_strlcat='$d_strlcat'
21583 d_strlcpy='$d_strlcpy'
21584 d_strtod='$d_strtod'
21585 d_strtol='$d_strtol'
21586 d_strtold='$d_strtold'
21587 d_strtoll='$d_strtoll'
21588 d_strtoq='$d_strtoq'
21589 d_strtoul='$d_strtoul'
21590 d_strtoull='$d_strtoull'
21591 d_strtouq='$d_strtouq'
21592 d_strxfrm='$d_strxfrm'
21593 d_suidsafe='$d_suidsafe'
21594 d_symlink='$d_symlink'
21595 d_syscall='$d_syscall'
21596 d_syscallproto='$d_syscallproto'
21597 d_sysconf='$d_sysconf'
21598 d_sysernlst='$d_sysernlst'
21599 d_syserrlst='$d_syserrlst'
21600 d_system='$d_system'
21601 d_tcgetpgrp='$d_tcgetpgrp'
21602 d_tcsetpgrp='$d_tcsetpgrp'
21603 d_telldir='$d_telldir'
21604 d_telldirproto='$d_telldirproto'
21605 d_time='$d_time'
21606 d_times='$d_times'
21607 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21608 d_tm_tm_zone='$d_tm_tm_zone'
21609 d_tmpnam_r='$d_tmpnam_r'
21610 d_truncate='$d_truncate'
21611 d_ttyname_r='$d_ttyname_r'
21612 d_tzname='$d_tzname'
21613 d_u32align='$d_u32align'
21614 d_ualarm='$d_ualarm'
21615 d_umask='$d_umask'
21616 d_uname='$d_uname'
21617 d_union_semun='$d_union_semun'
21618 d_unordered='$d_unordered'
21619 d_unsetenv='$d_unsetenv'
21620 d_usleep='$d_usleep'
21621 d_usleepproto='$d_usleepproto'
21622 d_ustat='$d_ustat'
21623 d_vendorarch='$d_vendorarch'
21624 d_vendorbin='$d_vendorbin'
21625 d_vendorlib='$d_vendorlib'
21626 d_vendorscript='$d_vendorscript'
21627 d_vfork='$d_vfork'
21628 d_void_closedir='$d_void_closedir'
21629 d_voidsig='$d_voidsig'
21630 d_voidtty='$d_voidtty'
21631 d_volatile='$d_volatile'
21632 d_vprintf='$d_vprintf'
21633 d_vsnprintf='$d_vsnprintf'
21634 d_wait4='$d_wait4'
21635 d_waitpid='$d_waitpid'
21636 d_wcstombs='$d_wcstombs'
21637 d_wctomb='$d_wctomb'
21638 d_writev='$d_writev'
21639 d_xenix='$d_xenix'
21640 date='$date'
21641 db_hashtype='$db_hashtype'
21642 db_prefixtype='$db_prefixtype'
21643 db_version_major='$db_version_major'
21644 db_version_minor='$db_version_minor'
21645 db_version_patch='$db_version_patch'
21646 defvoidused='$defvoidused'
21647 direntrytype='$direntrytype'
21648 dlext='$dlext'
21649 dlsrc='$dlsrc'
21650 doublesize='$doublesize'
21651 drand01='$drand01'
21652 drand48_r_proto='$drand48_r_proto'
21653 dynamic_ext='$dynamic_ext'
21654 eagain='$eagain'
21655 ebcdic='$ebcdic'
21656 echo='$echo'
21657 egrep='$egrep'
21658 emacs='$emacs'
21659 endgrent_r_proto='$endgrent_r_proto'
21660 endhostent_r_proto='$endhostent_r_proto'
21661 endnetent_r_proto='$endnetent_r_proto'
21662 endprotoent_r_proto='$endprotoent_r_proto'
21663 endpwent_r_proto='$endpwent_r_proto'
21664 endservent_r_proto='$endservent_r_proto'
21665 eunicefix='$eunicefix'
21666 exe_ext='$exe_ext'
21667 expr='$expr'
21668 extensions='$extensions'
21669 extras='$extras'
21670 fflushNULL='$fflushNULL'
21671 fflushall='$fflushall'
21672 find='$find'
21673 firstmakefile='$firstmakefile'
21674 flex='$flex'
21675 fpossize='$fpossize'
21676 fpostype='$fpostype'
21677 freetype='$freetype'
21678 from='$from'
21679 full_ar='$full_ar'
21680 full_csh='$full_csh'
21681 full_sed='$full_sed'
21682 gccansipedantic='$gccansipedantic'
21683 gccosandvers='$gccosandvers'
21684 gccversion='$gccversion'
21685 getgrent_r_proto='$getgrent_r_proto'
21686 getgrgid_r_proto='$getgrgid_r_proto'
21687 getgrnam_r_proto='$getgrnam_r_proto'
21688 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21689 gethostbyname_r_proto='$gethostbyname_r_proto'
21690 gethostent_r_proto='$gethostent_r_proto'
21691 getlogin_r_proto='$getlogin_r_proto'
21692 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21693 getnetbyname_r_proto='$getnetbyname_r_proto'
21694 getnetent_r_proto='$getnetent_r_proto'
21695 getprotobyname_r_proto='$getprotobyname_r_proto'
21696 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21697 getprotoent_r_proto='$getprotoent_r_proto'
21698 getpwent_r_proto='$getpwent_r_proto'
21699 getpwnam_r_proto='$getpwnam_r_proto'
21700 getpwuid_r_proto='$getpwuid_r_proto'
21701 getservbyname_r_proto='$getservbyname_r_proto'
21702 getservbyport_r_proto='$getservbyport_r_proto'
21703 getservent_r_proto='$getservent_r_proto'
21704 getspnam_r_proto='$getspnam_r_proto'
21705 gidformat='$gidformat'
21706 gidsign='$gidsign'
21707 gidsize='$gidsize'
21708 gidtype='$gidtype'
21709 glibpth='$glibpth'
21710 gmake='$gmake'
21711 gmtime_r_proto='$gmtime_r_proto'
21712 gnulibc_version='$gnulibc_version'
21713 grep='$grep'
21714 groupcat='$groupcat'
21715 groupstype='$groupstype'
21716 gzip='$gzip'
21717 h_fcntl='$h_fcntl'
21718 h_sysfile='$h_sysfile'
21719 hint='$hint'
21720 hostcat='$hostcat'
21721 html1dir='$html1dir'
21722 html1direxp='$html1direxp'
21723 html3dir='$html3dir'
21724 html3direxp='$html3direxp'
21725 i16size='$i16size'
21726 i16type='$i16type'
21727 i32size='$i32size'
21728 i32type='$i32type'
21729 i64size='$i64size'
21730 i64type='$i64type'
21731 i8size='$i8size'
21732 i8type='$i8type'
21733 i_arpainet='$i_arpainet'
21734 i_bsdioctl='$i_bsdioctl'
21735 i_crypt='$i_crypt'
21736 i_db='$i_db'
21737 i_dbm='$i_dbm'
21738 i_dirent='$i_dirent'
21739 i_dld='$i_dld'
21740 i_dlfcn='$i_dlfcn'
21741 i_fcntl='$i_fcntl'
21742 i_float='$i_float'
21743 i_fp='$i_fp'
21744 i_fp_class='$i_fp_class'
21745 i_gdbm='$i_gdbm'
21746 i_grp='$i_grp'
21747 i_ieeefp='$i_ieeefp'
21748 i_inttypes='$i_inttypes'
21749 i_langinfo='$i_langinfo'
21750 i_libutil='$i_libutil'
21751 i_limits='$i_limits'
21752 i_locale='$i_locale'
21753 i_machcthr='$i_machcthr'
21754 i_malloc='$i_malloc'
21755 i_math='$i_math'
21756 i_memory='$i_memory'
21757 i_mntent='$i_mntent'
21758 i_ndbm='$i_ndbm'
21759 i_netdb='$i_netdb'
21760 i_neterrno='$i_neterrno'
21761 i_netinettcp='$i_netinettcp'
21762 i_niin='$i_niin'
21763 i_poll='$i_poll'
21764 i_prot='$i_prot'
21765 i_pthread='$i_pthread'
21766 i_pwd='$i_pwd'
21767 i_rpcsvcdbm='$i_rpcsvcdbm'
21768 i_sfio='$i_sfio'
21769 i_sgtty='$i_sgtty'
21770 i_shadow='$i_shadow'
21771 i_socks='$i_socks'
21772 i_stdarg='$i_stdarg'
21773 i_stddef='$i_stddef'
21774 i_stdlib='$i_stdlib'
21775 i_string='$i_string'
21776 i_sunmath='$i_sunmath'
21777 i_sysaccess='$i_sysaccess'
21778 i_sysdir='$i_sysdir'
21779 i_sysfile='$i_sysfile'
21780 i_sysfilio='$i_sysfilio'
21781 i_sysin='$i_sysin'
21782 i_sysioctl='$i_sysioctl'
21783 i_syslog='$i_syslog'
21784 i_sysmman='$i_sysmman'
21785 i_sysmode='$i_sysmode'
21786 i_sysmount='$i_sysmount'
21787 i_sysndir='$i_sysndir'
21788 i_sysparam='$i_sysparam'
21789 i_sysresrc='$i_sysresrc'
21790 i_syssecrt='$i_syssecrt'
21791 i_sysselct='$i_sysselct'
21792 i_syssockio='$i_syssockio'
21793 i_sysstat='$i_sysstat'
21794 i_sysstatfs='$i_sysstatfs'
21795 i_sysstatvfs='$i_sysstatvfs'
21796 i_systime='$i_systime'
21797 i_systimek='$i_systimek'
21798 i_systimes='$i_systimes'
21799 i_systypes='$i_systypes'
21800 i_sysuio='$i_sysuio'
21801 i_sysun='$i_sysun'
21802 i_sysutsname='$i_sysutsname'
21803 i_sysvfs='$i_sysvfs'
21804 i_syswait='$i_syswait'
21805 i_termio='$i_termio'
21806 i_termios='$i_termios'
21807 i_time='$i_time'
21808 i_unistd='$i_unistd'
21809 i_ustat='$i_ustat'
21810 i_utime='$i_utime'
21811 i_values='$i_values'
21812 i_varargs='$i_varargs'
21813 i_varhdr='$i_varhdr'
21814 i_vfork='$i_vfork'
21815 ignore_versioned_solibs='$ignore_versioned_solibs'
21816 inc_version_list='$inc_version_list'
21817 inc_version_list_init='$inc_version_list_init'
21818 incpath='$incpath'
21819 inews='$inews'
21820 initialinstalllocation='$initialinstalllocation'
21821 installarchlib='$installarchlib'
21822 installbin='$installbin'
21823 installhtml1dir='$installhtml1dir'
21824 installhtml3dir='$installhtml3dir'
21825 installman1dir='$installman1dir'
21826 installman3dir='$installman3dir'
21827 installprefix='$installprefix'
21828 installprefixexp='$installprefixexp'
21829 installprivlib='$installprivlib'
21830 installscript='$installscript'
21831 installsitearch='$installsitearch'
21832 installsitebin='$installsitebin'
21833 installsitehtml1dir='$installsitehtml1dir'
21834 installsitehtml3dir='$installsitehtml3dir'
21835 installsitelib='$installsitelib'
21836 installsiteman1dir='$installsiteman1dir'
21837 installsiteman3dir='$installsiteman3dir'
21838 installsitescript='$installsitescript'
21839 installstyle='$installstyle'
21840 installusrbinperl='$installusrbinperl'
21841 installvendorarch='$installvendorarch'
21842 installvendorbin='$installvendorbin'
21843 installvendorhtml1dir='$installvendorhtml1dir'
21844 installvendorhtml3dir='$installvendorhtml3dir'
21845 installvendorlib='$installvendorlib'
21846 installvendorman1dir='$installvendorman1dir'
21847 installvendorman3dir='$installvendorman3dir'
21848 installvendorscript='$installvendorscript'
21849 intsize='$intsize'
21850 issymlink='$issymlink'
21851 ivdformat='$ivdformat'
21852 ivsize='$ivsize'
21853 ivtype='$ivtype'
21854 known_extensions='$known_extensions'
21855 ksh='$ksh'
21856 ld='$ld'
21857 lddlflags='$lddlflags'
21858 ldflags='$ldflags'
21859 ldflags_uselargefiles='$ldflags_uselargefiles'
21860 ldlibpthname='$ldlibpthname'
21861 less='$less'
21862 lib_ext='$lib_ext'
21863 libc='$libc'
21864 libperl='$libperl'
21865 libpth='$libpth'
21866 libs='$libs'
21867 libsdirs='$libsdirs'
21868 libsfiles='$libsfiles'
21869 libsfound='$libsfound'
21870 libspath='$libspath'
21871 libswanted='$libswanted'
21872 libswanted_uselargefiles='$libswanted_uselargefiles'
21873 line='$line'
21874 lint='$lint'
21875 lkflags='$lkflags'
21876 ln='$ln'
21877 lns='$lns'
21878 localtime_r_proto='$localtime_r_proto'
21879 locincpth='$locincpth'
21880 loclibpth='$loclibpth'
21881 longdblsize='$longdblsize'
21882 longlongsize='$longlongsize'
21883 longsize='$longsize'
21884 lp='$lp'
21885 lpr='$lpr'
21886 ls='$ls'
21887 lseeksize='$lseeksize'
21888 lseektype='$lseektype'
21889 mad='$mad'
21890 madlyh='$madlyh'
21891 madlyobj='$madlyobj'
21892 madlysrc='$madlysrc'
21893 mail='$mail'
21894 mailx='$mailx'
21895 make='$make'
21896 make_set_make='$make_set_make'
21897 mallocobj='$mallocobj'
21898 mallocsrc='$mallocsrc'
21899 malloctype='$malloctype'
21900 man1dir='$man1dir'
21901 man1direxp='$man1direxp'
21902 man1ext='$man1ext'
21903 man3dir='$man3dir'
21904 man3direxp='$man3direxp'
21905 man3ext='$man3ext'
21906 mips_type='$mips_type'
21907 mistrustnm='$mistrustnm'
21908 mkdir='$mkdir'
21909 mmaptype='$mmaptype'
21910 modetype='$modetype'
21911 more='$more'
21912 multiarch='$multiarch'
21913 mv='$mv'
21914 myarchname='$myarchname'
21915 mydomain='$mydomain'
21916 myhostname='$myhostname'
21917 myuname='$myuname'
21918 n='$n'
21919 need_va_copy='$need_va_copy'
21920 netdb_hlen_type='$netdb_hlen_type'
21921 netdb_host_type='$netdb_host_type'
21922 netdb_name_type='$netdb_name_type'
21923 netdb_net_type='$netdb_net_type'
21924 nm='$nm'
21925 nm_opt='$nm_opt'
21926 nm_so_opt='$nm_so_opt'
21927 nonxs_ext='$nonxs_ext'
21928 nroff='$nroff'
21929 nvEUformat='$nvEUformat'
21930 nvFUformat='$nvFUformat'
21931 nvGUformat='$nvGUformat'
21932 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21933 nveformat='$nveformat'
21934 nvfformat='$nvfformat'
21935 nvgformat='$nvgformat'
21936 nvsize='$nvsize'
21937 nvtype='$nvtype'
21938 o_nonblock='$o_nonblock'
21939 obj_ext='$obj_ext'
21940 old_pthread_create_joinable='$old_pthread_create_joinable'
21941 optimize='$optimize'
21942 orderlib='$orderlib'
21943 osname='$osname'
21944 osvers='$osvers'
21945 otherlibdirs='$otherlibdirs'
21946 package='$package'
21947 pager='$pager'
21948 passcat='$passcat'
21949 patchlevel='$patchlevel'
21950 path_sep='$path_sep'
21951 perl5='$perl5'
21952 perl='$perl'
21953 perl_patchlevel='$perl_patchlevel'
21954 perladmin='$perladmin'
21955 perllibs='$perllibs'
21956 perlpath='$perlpath'
21957 pg='$pg'
21958 phostname='$phostname'
21959 pidtype='$pidtype'
21960 plibpth='$plibpth'
21961 pmake='$pmake'
21962 pr='$pr'
21963 prefix='$prefix'
21964 prefixexp='$prefixexp'
21965 privlib='$privlib'
21966 privlibexp='$privlibexp'
21967 procselfexe='$procselfexe'
21968 prototype='$prototype'
21969 ptrsize='$ptrsize'
21970 quadkind='$quadkind'
21971 quadtype='$quadtype'
21972 randbits='$randbits'
21973 randfunc='$randfunc'
21974 random_r_proto='$random_r_proto'
21975 randseedtype='$randseedtype'
21976 ranlib='$ranlib'
21977 rd_nodata='$rd_nodata'
21978 readdir64_r_proto='$readdir64_r_proto'
21979 readdir_r_proto='$readdir_r_proto'
21980 revision='$revision'
21981 rm='$rm'
21982 rmail='$rmail'
21983 run='$run'
21984 runnm='$runnm'
21985 sPRIEUldbl='$sPRIEUldbl'
21986 sPRIFUldbl='$sPRIFUldbl'
21987 sPRIGUldbl='$sPRIGUldbl'
21988 sPRIXU64='$sPRIXU64'
21989 sPRId64='$sPRId64'
21990 sPRIeldbl='$sPRIeldbl'
21991 sPRIfldbl='$sPRIfldbl'
21992 sPRIgldbl='$sPRIgldbl'
21993 sPRIi64='$sPRIi64'
21994 sPRIo64='$sPRIo64'
21995 sPRIu64='$sPRIu64'
21996 sPRIx64='$sPRIx64'
21997 sSCNfldbl='$sSCNfldbl'
21998 sched_yield='$sched_yield'
21999 scriptdir='$scriptdir'
22000 scriptdirexp='$scriptdirexp'
22001 sed='$sed'
22002 seedfunc='$seedfunc'
22003 selectminbits='$selectminbits'
22004 selecttype='$selecttype'
22005 sendmail='$sendmail'
22006 setgrent_r_proto='$setgrent_r_proto'
22007 sethostent_r_proto='$sethostent_r_proto'
22008 setlocale_r_proto='$setlocale_r_proto'
22009 setnetent_r_proto='$setnetent_r_proto'
22010 setprotoent_r_proto='$setprotoent_r_proto'
22011 setpwent_r_proto='$setpwent_r_proto'
22012 setservent_r_proto='$setservent_r_proto'
22013 sh='$sh'
22014 shar='$shar'
22015 sharpbang='$sharpbang'
22016 shmattype='$shmattype'
22017 shortsize='$shortsize'
22018 shrpenv='$shrpenv'
22019 shsharp='$shsharp'
22020 sig_count='$sig_count'
22021 sig_name='$sig_name'
22022 sig_name_init='$sig_name_init'
22023 sig_num='$sig_num'
22024 sig_num_init='$sig_num_init'
22025 sig_size='$sig_size'
22026 signal_t='$signal_t'
22027 sitearch='$sitearch'
22028 sitearchexp='$sitearchexp'
22029 sitebin='$sitebin'
22030 sitebinexp='$sitebinexp'
22031 sitehtml1dir='$sitehtml1dir'
22032 sitehtml1direxp='$sitehtml1direxp'
22033 sitehtml3dir='$sitehtml3dir'
22034 sitehtml3direxp='$sitehtml3direxp'
22035 sitelib='$sitelib'
22036 sitelib_stem='$sitelib_stem'
22037 sitelibexp='$sitelibexp'
22038 siteman1dir='$siteman1dir'
22039 siteman1direxp='$siteman1direxp'
22040 siteman3dir='$siteman3dir'
22041 siteman3direxp='$siteman3direxp'
22042 siteprefix='$siteprefix'
22043 siteprefixexp='$siteprefixexp'
22044 sitescript='$sitescript'
22045 sitescriptexp='$sitescriptexp'
22046 sizesize='$sizesize'
22047 sizetype='$sizetype'
22048 sleep='$sleep'
22049 smail='$smail'
22050 so='$so'
22051 sockethdr='$sockethdr'
22052 socketlib='$socketlib'
22053 socksizetype='$socksizetype'
22054 sort='$sort'
22055 spackage='$spackage'
22056 spitshell='$spitshell'
22057 srand48_r_proto='$srand48_r_proto'
22058 srandom_r_proto='$srandom_r_proto'
22059 src='$src'
22060 ssizetype='$ssizetype'
22061 startperl='$startperl'
22062 startsh='$startsh'
22063 static_ext='$static_ext'
22064 stdchar='$stdchar'
22065 stdio_base='$stdio_base'
22066 stdio_bufsiz='$stdio_bufsiz'
22067 stdio_cnt='$stdio_cnt'
22068 stdio_filbuf='$stdio_filbuf'
22069 stdio_ptr='$stdio_ptr'
22070 stdio_stream_array='$stdio_stream_array'
22071 strerror_r_proto='$strerror_r_proto'
22072 strings='$strings'
22073 submit='$submit'
22074 subversion='$subversion'
22075 sysman='$sysman'
22076 tail='$tail'
22077 tar='$tar'
22078 targetarch='$targetarch'
22079 tbl='$tbl'
22080 tee='$tee'
22081 test='$test'
22082 timeincl='$timeincl'
22083 timetype='$timetype'
22084 tmpnam_r_proto='$tmpnam_r_proto'
22085 to='$to'
22086 touch='$touch'
22087 tr='$tr'
22088 trnl='$trnl'
22089 troff='$troff'
22090 ttyname_r_proto='$ttyname_r_proto'
22091 u16size='$u16size'
22092 u16type='$u16type'
22093 u32size='$u32size'
22094 u32type='$u32type'
22095 u64size='$u64size'
22096 u64type='$u64type'
22097 u8size='$u8size'
22098 u8type='$u8type'
22099 uidformat='$uidformat'
22100 uidsign='$uidsign'
22101 uidsize='$uidsize'
22102 uidtype='$uidtype'
22103 uname='$uname'
22104 uniq='$uniq'
22105 uquadtype='$uquadtype'
22106 use5005threads='$use5005threads'
22107 use64bitall='$use64bitall'
22108 use64bitint='$use64bitint'
22109 usecrosscompile='$usecrosscompile'
22110 usedl='$usedl'
22111 usefaststdio='$usefaststdio'
22112 useithreads='$useithreads'
22113 uselargefiles='$uselargefiles'
22114 uselongdouble='$uselongdouble'
22115 usemallocwrap='$usemallocwrap'
22116 usemorebits='$usemorebits'
22117 usemultiplicity='$usemultiplicity'
22118 usemymalloc='$usemymalloc'
22119 usenm='$usenm'
22120 useopcode='$useopcode'
22121 useperlio='$useperlio'
22122 useposix='$useposix'
22123 usereentrant='$usereentrant'
22124 userelocatableinc='$userelocatableinc'
22125 usesfio='$usesfio'
22126 useshrplib='$useshrplib'
22127 usesitecustomize='$usesitecustomize'
22128 usesocks='$usesocks'
22129 usethreads='$usethreads'
22130 usevendorprefix='$usevendorprefix'
22131 usevfork='$usevfork'
22132 usrinc='$usrinc'
22133 uuname='$uuname'
22134 uvXUformat='$uvXUformat'
22135 uvoformat='$uvoformat'
22136 uvsize='$uvsize'
22137 uvtype='$uvtype'
22138 uvuformat='$uvuformat'
22139 uvxformat='$uvxformat'
22140 vendorarch='$vendorarch'
22141 vendorarchexp='$vendorarchexp'
22142 vendorbin='$vendorbin'
22143 vendorbinexp='$vendorbinexp'
22144 vendorhtml1dir='$vendorhtml1dir'
22145 vendorhtml1direxp='$vendorhtml1direxp'
22146 vendorhtml3dir='$vendorhtml3dir'
22147 vendorhtml3direxp='$vendorhtml3direxp'
22148 vendorlib='$vendorlib'
22149 vendorlib_stem='$vendorlib_stem'
22150 vendorlibexp='$vendorlibexp'
22151 vendorman1dir='$vendorman1dir'
22152 vendorman1direxp='$vendorman1direxp'
22153 vendorman3dir='$vendorman3dir'
22154 vendorman3direxp='$vendorman3direxp'
22155 vendorprefix='$vendorprefix'
22156 vendorprefixexp='$vendorprefixexp'
22157 vendorscript='$vendorscript'
22158 vendorscriptexp='$vendorscriptexp'
22159 version='$version'
22160 version_patchlevel_string='$version_patchlevel_string'
22161 versiononly='$versiononly'
22162 vi='$vi'
22163 voidflags='$voidflags'
22164 xlibpth='$xlibpth'
22165 yacc='$yacc'
22166 yaccflags='$yaccflags'
22167 zcat='$zcat'
22168 zip='$zip'
22169 EOT
22170
22171 : Add in command line options if available
22172 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22173
22174 : add special variables
22175 $test -f $src/patchlevel.h && \
22176 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22177 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22178 echo "PERL_CONFIG_SH=true" >>config.sh
22179
22180 : propagate old symbols
22181 if $test -f UU/config.sh; then
22182         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22183         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22184         $sort | $uniq -u >UU/oldsyms
22185         set X `cat UU/oldsyms`
22186         shift
22187         case $# in
22188         0) ;;
22189         *)
22190                 cat <<EOM
22191 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22192 EOM
22193                 echo "# Variables propagated from previous config.sh file." >>config.sh
22194                 for sym in `cat UU/oldsyms`; do
22195                         echo "    Propagating $hint variable "'$'"$sym..."
22196                         eval 'tmp="$'"${sym}"'"'
22197                         echo "$tmp" | \
22198                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22199                 done
22200                 ;;
22201         esac
22202 fi
22203
22204 : Finish up by extracting the .SH files
22205 case "$alldone" in
22206 exit)
22207         $rm -rf UU
22208         echo "Extraction done."
22209         exit 0
22210         ;;
22211 cont)
22212         ;;
22213 '')
22214         dflt=''
22215         nostick=true
22216         $cat <<EOM
22217
22218 If you'd like to make any changes to the config.sh file before I begin
22219 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22220
22221 EOM
22222         rp="Press return or use a shell escape to edit config.sh:"
22223         . UU/myread
22224         nostick=''
22225         case "$ans" in
22226         '') ;;
22227         *) : in case they cannot read
22228                 sh 1>&4 -c "$ans";;
22229         esac
22230         ;;
22231 esac
22232
22233 : if this fails, just run all the .SH files by hand
22234 . ./config.sh
22235
22236 echo " "
22237 exec 1>&4
22238 pwd=`pwd`
22239 . ./UU/extract
22240 cd "$pwd"
22241
22242 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22243         dflt=y
22244         case "$silent" in
22245         true) ;;
22246         *)
22247                 $cat <<EOM
22248
22249 Now you need to generate make dependencies by running "$make depend".
22250 You might prefer to run it in background: "$make depend > makedepend.out &"
22251 It can take a while, so you might not want to run it right now.
22252
22253 EOM
22254                 ;;
22255         esac
22256         rp="Run $make depend now?"
22257         . UU/myread
22258         case "$ans" in
22259         y*)
22260                 $make depend && echo "Now you must run '$make'."
22261                 ;;
22262         *)
22263                 echo "You must run '$make depend' then '$make'."
22264                 ;;
22265         esac
22266 elif test -f [Mm]akefile; then
22267         echo " "
22268         echo "Now you must run a $make."
22269 else
22270         echo "Configure done."
22271 fi
22272
22273 if $test -f Policy.sh; then
22274     $cat <<EOM
22275
22276 If you compile $package on a different machine or from a different object
22277 directory, copy the Policy.sh file from this object directory to the
22278 new one before you run Configure -- this will help you with most of
22279 the policy defaults.
22280
22281 EOM
22282 fi
22283 if $test -f config.msg; then
22284     echo "Hmm.  I also noted the following information while running:"
22285     echo " "
22286     $cat config.msg >&4
22287     $rm -f config.msg
22288 fi
22289 $rm -f kit*isdone ark*isdone
22290 $rm -rf UU
22291
22292 : End of Configure
22293