First stab at rather shaky Configure support for relocatable @INC.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Mar  8 09:08:03 CET 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 installbin=''
323 byteorder=''
324 cc=''
325 ccflags=''
326 cppflags=''
327 ldflags=''
328 lkflags=''
329 locincpth=''
330 optimize=''
331 cf_email=''
332 cf_by=''
333 cf_time=''
334 charsize=''
335 contains=''
336 cpp_stuff=''
337 cpplast=''
338 cppminus=''
339 cpprun=''
340 cppstdin=''
341 d__fwalk=''
342 d_access=''
343 d_accessx=''
344 d_aintl=''
345 d_alarm=''
346 asctime_r_proto=''
347 d_asctime_r=''
348 d_attribute_format=''
349 d_attribute_malloc=''
350 d_attribute_nonnull=''
351 d_attribute_noreturn=''
352 d_attribute_pure=''
353 d_attribute_unused=''
354 d_attribute_warn_unused_result=''
355 d_bcmp=''
356 d_bcopy=''
357 d_builtin_choose_expr=''
358 d_builtin_expect=''
359 d_bzero=''
360 d_casti32=''
361 castflags=''
362 d_castneg=''
363 d_chown=''
364 d_chroot=''
365 d_chsize=''
366 d_class=''
367 d_clearenv=''
368 d_closedir=''
369 d_void_closedir=''
370 d_cmsghdr_s=''
371 d_const=''
372 d_copysignl=''
373 cryptlib=''
374 d_crypt=''
375 crypt_r_proto=''
376 d_crypt_r=''
377 d_csh=''
378 full_csh=''
379 ctermid_r_proto=''
380 d_ctermid_r=''
381 ctime_r_proto=''
382 d_ctime_r=''
383 d_cuserid=''
384 d_dbl_dig=''
385 d_dbminitproto=''
386 d_difftime=''
387 d_dirfd=''
388 d_dlerror=''
389 d_dlopen=''
390 d_dlsymun=''
391 d_dosuid=''
392 d_suidsafe=''
393 d_drand48_r=''
394 drand48_r_proto=''
395 d_drand48proto=''
396 d_dup2=''
397 d_eaccess=''
398 d_endgrent=''
399 d_endgrent_r=''
400 endgrent_r_proto=''
401 d_endhent=''
402 d_endhostent_r=''
403 endhostent_r_proto=''
404 d_endnent=''
405 d_endnetent_r=''
406 endnetent_r_proto=''
407 d_endpent=''
408 d_endprotoent_r=''
409 endprotoent_r_proto=''
410 d_endpwent=''
411 d_endpwent_r=''
412 endpwent_r_proto=''
413 d_endsent=''
414 d_endservent_r=''
415 endservent_r_proto=''
416 d_faststdio=''
417 d_fchdir=''
418 d_fchmod=''
419 d_fchown=''
420 d_fcntl=''
421 d_fcntl_can_lock=''
422 d_fd_macros=''
423 d_fd_set=''
424 d_fds_bits=''
425 d_fgetpos=''
426 d_finite=''
427 d_finitel=''
428 d_flexfnam=''
429 d_flock=''
430 d_flockproto=''
431 d_fork=''
432 d_fp_class=''
433 d_fpclass=''
434 d_fpclassify=''
435 d_fpclassl=''
436 d_fpos64_t=''
437 d_frexpl=''
438 d_fs_data_s=''
439 d_fseeko=''
440 d_fsetpos=''
441 d_fstatfs=''
442 d_fsync=''
443 d_ftello=''
444 d_ftime=''
445 d_gettimeod=''
446 d_futimes=''
447 d_Gconvert=''
448 d_getcwd=''
449 d_getespwnam=''
450 d_getfsstat=''
451 d_getgrent=''
452 d_getgrent_r=''
453 getgrent_r_proto=''
454 d_getgrgid_r=''
455 getgrgid_r_proto=''
456 d_getgrnam_r=''
457 getgrnam_r_proto=''
458 d_getgrps=''
459 d_gethbyaddr=''
460 d_gethbyname=''
461 d_gethent=''
462 aphostname=''
463 d_gethname=''
464 d_phostname=''
465 d_uname=''
466 d_gethostbyaddr_r=''
467 gethostbyaddr_r_proto=''
468 d_gethostbyname_r=''
469 gethostbyname_r_proto=''
470 d_gethostent_r=''
471 gethostent_r_proto=''
472 d_gethostprotos=''
473 d_getitimer=''
474 d_getlogin=''
475 d_getlogin_r=''
476 getlogin_r_proto=''
477 d_getmnt=''
478 d_getmntent=''
479 d_getnbyaddr=''
480 d_getnbyname=''
481 d_getnent=''
482 d_getnetbyaddr_r=''
483 getnetbyaddr_r_proto=''
484 d_getnetbyname_r=''
485 getnetbyname_r_proto=''
486 d_getnetent_r=''
487 getnetent_r_proto=''
488 d_getnetprotos=''
489 d_getpagsz=''
490 d_getpent=''
491 d_getpgid=''
492 d_getpgrp2=''
493 d_bsdgetpgrp=''
494 d_getpgrp=''
495 d_getppid=''
496 d_getprior=''
497 d_getpbyname=''
498 d_getpbynumber=''
499 d_getprotobyname_r=''
500 getprotobyname_r_proto=''
501 d_getprotobynumber_r=''
502 getprotobynumber_r_proto=''
503 d_getprotoent_r=''
504 getprotoent_r_proto=''
505 d_getprotoprotos=''
506 d_getprpwnam=''
507 d_getpwent=''
508 d_getpwent_r=''
509 getpwent_r_proto=''
510 d_getpwnam_r=''
511 getpwnam_r_proto=''
512 d_getpwuid_r=''
513 getpwuid_r_proto=''
514 d_getsent=''
515 d_getservbyname_r=''
516 getservbyname_r_proto=''
517 d_getservbyport_r=''
518 getservbyport_r_proto=''
519 d_getservent_r=''
520 getservent_r_proto=''
521 d_getservprotos=''
522 d_getspnam=''
523 d_getspnam_r=''
524 getspnam_r_proto=''
525 d_getsbyname=''
526 d_getsbyport=''
527 d_gmtime_r=''
528 gmtime_r_proto=''
529 d_gnulibc=''
530 gnulibc_version=''
531 d_hasmntopt=''
532 d_htonl=''
533 d_ilogbl=''
534 d_inetaton=''
535 d_int64_t=''
536 d_isascii=''
537 d_isfinite=''
538 d_isinf=''
539 d_isnan=''
540 d_isnanl=''
541 d_killpg=''
542 d_lchown=''
543 d_ldbl_dig=''
544 d_libm_lib_version=''
545 d_link=''
546 d_localtime_r=''
547 localtime_r_proto=''
548 d_locconv=''
549 d_lockf=''
550 d_longdbl=''
551 longdblsize=''
552 d_longlong=''
553 longlongsize=''
554 d_lseekproto=''
555 d_lstat=''
556 d_madvise=''
557 d_malloc_good_size=''
558 d_malloc_size=''
559 d_mblen=''
560 d_mbstowcs=''
561 d_mbtowc=''
562 d_memchr=''
563 d_memcmp=''
564 d_memcpy=''
565 d_memmove=''
566 d_memset=''
567 d_mkdir=''
568 d_mkdtemp=''
569 d_mkfifo=''
570 d_mkstemp=''
571 d_mkstemps=''
572 d_mktime=''
573 d_mmap=''
574 mmaptype=''
575 d_modfl=''
576 d_modfl_pow32_bug=''
577 d_modflproto=''
578 d_mprotect=''
579 d_msg=''
580 d_msgctl=''
581 d_msgget=''
582 d_msghdr_s=''
583 d_msgrcv=''
584 d_msgsnd=''
585 d_msync=''
586 d_munmap=''
587 d_nice=''
588 d_nl_langinfo=''
589 d_off64_t=''
590 d_open3=''
591 d_fpathconf=''
592 d_pathconf=''
593 d_pause=''
594 d_pipe=''
595 d_poll=''
596 d_portable=''
597 d_procselfexe=''
598 procselfexe=''
599 d_old_pthread_create_joinable=''
600 old_pthread_create_joinable=''
601 d_pthread_atfork=''
602 d_pthread_attr_setscope=''
603 d_pthread_yield=''
604 d_sched_yield=''
605 sched_yield=''
606 d_qgcvt=''
607 d_random_r=''
608 random_r_proto=''
609 d_readdir64_r=''
610 readdir64_r_proto=''
611 d_readdir=''
612 d_rewinddir=''
613 d_seekdir=''
614 d_telldir=''
615 d_readdir_r=''
616 readdir_r_proto=''
617 d_readlink=''
618 d_readv=''
619 d_recvmsg=''
620 d_rename=''
621 d_rmdir=''
622 d_safebcpy=''
623 d_safemcpy=''
624 d_sanemcmp=''
625 d_sbrkproto=''
626 d_scalbnl=''
627 d_select=''
628 d_sem=''
629 d_semctl=''
630 d_semget=''
631 d_semop=''
632 d_sendmsg=''
633 d_setegid=''
634 d_seteuid=''
635 d_setgrent=''
636 d_setgrent_r=''
637 setgrent_r_proto=''
638 d_setgrps=''
639 d_sethent=''
640 d_sethostent_r=''
641 sethostent_r_proto=''
642 d_setitimer=''
643 d_setlinebuf=''
644 d_setlocale=''
645 d_setlocale_r=''
646 setlocale_r_proto=''
647 d_setnent=''
648 d_setnetent_r=''
649 setnetent_r_proto=''
650 d_setpent=''
651 d_setpgid=''
652 d_setpgrp2=''
653 d_bsdsetpgrp=''
654 d_setpgrp=''
655 d_setprior=''
656 d_setproctitle=''
657 d_setprotoent_r=''
658 setprotoent_r_proto=''
659 d_setpwent=''
660 d_setpwent_r=''
661 setpwent_r_proto=''
662 d_setregid=''
663 d_setresgid=''
664 d_setresuid=''
665 d_setreuid=''
666 d_setrgid=''
667 d_setruid=''
668 d_setsent=''
669 d_setservent_r=''
670 setservent_r_proto=''
671 d_setsid=''
672 d_setvbuf=''
673 d_sfio=''
674 usesfio=''
675 d_shm=''
676 d_shmat=''
677 d_shmatprototype=''
678 shmattype=''
679 d_shmctl=''
680 d_shmdt=''
681 d_shmget=''
682 d_sigaction=''
683 d_sigprocmask=''
684 d_sigsetjmp=''
685 usesitecustomize=''
686 d_snprintf=''
687 d_vsnprintf=''
688 d_sockatmark=''
689 d_sockatmarkproto=''
690 d_msg_ctrunc=''
691 d_msg_dontroute=''
692 d_msg_oob=''
693 d_msg_peek=''
694 d_msg_proxy=''
695 d_oldsock=''
696 d_scm_rights=''
697 d_socket=''
698 d_sockpair=''
699 sockethdr=''
700 socketlib=''
701 d_socklen_t=''
702 d_socks5_init=''
703 d_sprintf_returns_strlen=''
704 d_sqrtl=''
705 d_srand48_r=''
706 srand48_r_proto=''
707 d_srandom_r=''
708 srandom_r_proto=''
709 d_sresgproto=''
710 d_sresuproto=''
711 d_statblks=''
712 d_statfs_f_flags=''
713 d_statfs_s=''
714 d_fstatvfs=''
715 d_statvfs=''
716 d_stdio_cnt_lval=''
717 d_stdio_ptr_lval=''
718 d_stdio_ptr_lval_nochange_cnt=''
719 d_stdio_ptr_lval_sets_cnt=''
720 d_stdiobase=''
721 d_stdstdio=''
722 stdio_base=''
723 stdio_bufsiz=''
724 stdio_cnt=''
725 stdio_filbuf=''
726 stdio_ptr=''
727 d_index=''
728 d_strchr=''
729 d_strcoll=''
730 d_strctcpy=''
731 d_strerrm=''
732 d_strerror=''
733 d_sysernlst=''
734 d_syserrlst=''
735 d_strerror_r=''
736 strerror_r_proto=''
737 d_strftime=''
738 d_strlcat=''
739 d_strlcpy=''
740 d_strtod=''
741 d_strtol=''
742 d_strtold=''
743 d_strtoll=''
744 d_strtoq=''
745 d_strtoul=''
746 d_strtoull=''
747 d_strtouq=''
748 d_strxfrm=''
749 d_symlink=''
750 d_syscall=''
751 d_syscallproto=''
752 d_sysconf=''
753 d_system=''
754 d_tcgetpgrp=''
755 d_tcsetpgrp=''
756 d_telldirproto=''
757 d_time=''
758 timetype=''
759 clocktype=''
760 d_times=''
761 d_tmpnam_r=''
762 tmpnam_r_proto=''
763 d_truncate=''
764 d_ttyname_r=''
765 ttyname_r_proto=''
766 d_tzname=''
767 d_u32align=''
768 d_ualarm=''
769 d_umask=''
770 d_semctl_semid_ds=''
771 d_semctl_semun=''
772 d_union_semun=''
773 d_unordered=''
774 d_unsetenv=''
775 d_usleep=''
776 d_usleepproto=''
777 d_ustat=''
778 d_vfork=''
779 usevfork=''
780 d_voidsig=''
781 signal_t=''
782 d_volatile=''
783 d_charvspr=''
784 d_vprintf=''
785 d_wait4=''
786 d_waitpid=''
787 d_wcstombs=''
788 d_wctomb=''
789 d_writev=''
790 dlext=''
791 cccdlflags=''
792 ccdlflags=''
793 dlsrc=''
794 ld=''
795 lddlflags=''
796 usedl=''
797 doublesize=''
798 ebcdic=''
799 fflushNULL=''
800 fflushall=''
801 fpossize=''
802 fpostype=''
803 gccansipedantic=''
804 gccosandvers=''
805 gccversion=''
806 gidformat=''
807 gidsign=''
808 gidsize=''
809 gidtype=''
810 groupstype=''
811 h_fcntl=''
812 h_sysfile=''
813 html1dir=''
814 html1direxp=''
815 installhtml1dir=''
816 html3dir=''
817 html3direxp=''
818 installhtml3dir=''
819 i_arpainet=''
820 i_crypt=''
821 db_hashtype=''
822 db_prefixtype=''
823 db_version_major=''
824 db_version_minor=''
825 db_version_patch=''
826 i_db=''
827 i_dbm=''
828 i_rpcsvcdbm=''
829 d_dirnamlen=''
830 direntrytype=''
831 i_dirent=''
832 i_dld=''
833 i_dlfcn=''
834 i_fcntl=''
835 i_float=''
836 i_fp=''
837 i_fp_class=''
838 i_gdbm=''
839 d_grpasswd=''
840 i_grp=''
841 i_ieeefp=''
842 i_inttypes=''
843 i_langinfo=''
844 i_libutil=''
845 i_limits=''
846 i_locale=''
847 i_machcthr=''
848 i_malloc=''
849 i_math=''
850 i_memory=''
851 i_mntent=''
852 i_ndbm=''
853 i_netdb=''
854 i_neterrno=''
855 i_netinettcp=''
856 i_niin=''
857 i_sysin=''
858 i_poll=''
859 i_prot=''
860 i_pthread=''
861 d_pwage=''
862 d_pwchange=''
863 d_pwclass=''
864 d_pwcomment=''
865 d_pwexpire=''
866 d_pwgecos=''
867 d_pwpasswd=''
868 d_pwquota=''
869 i_pwd=''
870 i_sfio=''
871 i_shadow=''
872 i_socks=''
873 i_stddef=''
874 i_stdlib=''
875 i_string=''
876 strings=''
877 i_sunmath=''
878 i_sysaccess=''
879 i_sysdir=''
880 i_sysfile=''
881 d_voidtty=''
882 i_bsdioctl=''
883 i_sysfilio=''
884 i_sysioctl=''
885 i_syssockio=''
886 i_syslog=''
887 i_sysmman=''
888 i_sysmode=''
889 i_sysmount=''
890 i_sysndir=''
891 i_sysparam=''
892 i_sysresrc=''
893 i_syssecrt=''
894 i_sysselct=''
895 i_sysstat=''
896 i_sysstatfs=''
897 i_sysstatvfs=''
898 i_systimes=''
899 i_systypes=''
900 i_sysuio=''
901 i_sysun=''
902 i_sysutsname=''
903 i_sysvfs=''
904 i_syswait=''
905 i_sgtty=''
906 i_termio=''
907 i_termios=''
908 d_tm_tm_gmtoff=''
909 d_tm_tm_zone=''
910 i_systime=''
911 i_systimek=''
912 i_time=''
913 timeincl=''
914 i_unistd=''
915 i_ustat=''
916 i_utime=''
917 i_values=''
918 i_stdarg=''
919 i_varargs=''
920 i_varhdr=''
921 i_vfork=''
922 inc_version_list=''
923 inc_version_list_init=''
924 installprefix=''
925 installprefixexp=''
926 installstyle=''
927 installusrbinperl=''
928 intsize=''
929 longsize=''
930 shortsize=''
931 issymlink=''
932 libc=''
933 ldlibpthname=''
934 libperl=''
935 shrpenv=''
936 useshrplib=''
937 glibpth=''
938 libpth=''
939 loclibpth=''
940 plibpth=''
941 xlibpth=''
942 ignore_versioned_solibs=''
943 libs=''
944 libsdirs=''
945 libsfiles=''
946 libsfound=''
947 libspath=''
948 lns=''
949 d_PRIEUldbl=''
950 d_PRIFUldbl=''
951 d_PRIGUldbl=''
952 d_PRIeldbl=''
953 d_PRIfldbl=''
954 d_PRIgldbl=''
955 d_SCNfldbl=''
956 sPRIEUldbl=''
957 sPRIFUldbl=''
958 sPRIGUldbl=''
959 sPRIeldbl=''
960 sPRIfldbl=''
961 sPRIgldbl=''
962 sSCNfldbl=''
963 lseeksize=''
964 lseektype=''
965 mad=''
966 make_set_make=''
967 d_mymalloc=''
968 freetype=''
969 madlyh=''
970 madlyobj=''
971 madlysrc=''
972 mallocobj=''
973 mallocsrc=''
974 malloctype=''
975 usemallocwrap=''
976 usemymalloc=''
977 installman1dir=''
978 man1dir=''
979 man1direxp=''
980 man1ext=''
981 installman3dir=''
982 man3dir=''
983 man3direxp=''
984 man3ext=''
985 modetype=''
986 multiarch=''
987 mydomain=''
988 myhostname=''
989 phostname=''
990 c=''
991 n=''
992 d_eofnblk=''
993 eagain=''
994 o_nonblock=''
995 rd_nodata=''
996 need_va_copy=''
997 netdb_hlen_type=''
998 netdb_host_type=''
999 netdb_name_type=''
1000 netdb_net_type=''
1001 groupcat=''
1002 hostcat=''
1003 passcat=''
1004 orderlib=''
1005 ranlib=''
1006 d_perl_otherlibdirs=''
1007 otherlibdirs=''
1008 package=''
1009 spackage=''
1010 pager=''
1011 api_revision=''
1012 api_subversion=''
1013 api_version=''
1014 api_versionstring=''
1015 patchlevel=''
1016 perl_patchlevel=''
1017 revision=''
1018 subversion=''
1019 version=''
1020 version_patchlevel_string=''
1021 perl5=''
1022 perladmin=''
1023 perlpath=''
1024 d_nv_preserves_uv=''
1025 d_nv_zero_is_allbits_zero=''
1026 i16size=''
1027 i16type=''
1028 i32size=''
1029 i32type=''
1030 i64size=''
1031 i64type=''
1032 i8size=''
1033 i8type=''
1034 ivsize=''
1035 ivtype=''
1036 nv_preserves_uv_bits=''
1037 nvsize=''
1038 nvtype=''
1039 u16size=''
1040 u16type=''
1041 u32size=''
1042 u32type=''
1043 u64size=''
1044 u64type=''
1045 u8size=''
1046 u8type=''
1047 uvsize=''
1048 uvtype=''
1049 ivdformat=''
1050 nvEUformat=''
1051 nvFUformat=''
1052 nvGUformat=''
1053 nveformat=''
1054 nvfformat=''
1055 nvgformat=''
1056 uvXUformat=''
1057 uvoformat=''
1058 uvuformat=''
1059 uvxformat=''
1060 pidtype=''
1061 prefix=''
1062 prefixexp=''
1063 installprivlib=''
1064 privlib=''
1065 privlibexp=''
1066 prototype=''
1067 ptrsize=''
1068 d_PRIXU64=''
1069 d_PRId64=''
1070 d_PRIi64=''
1071 d_PRIo64=''
1072 d_PRIu64=''
1073 d_PRIx64=''
1074 sPRIXU64=''
1075 sPRId64=''
1076 sPRIi64=''
1077 sPRIo64=''
1078 sPRIu64=''
1079 sPRIx64=''
1080 d_quad=''
1081 quadkind=''
1082 quadtype=''
1083 uquadtype=''
1084 drand01=''
1085 randbits=''
1086 randfunc=''
1087 randseedtype=''
1088 seedfunc=''
1089 installscript=''
1090 scriptdir=''
1091 scriptdirexp=''
1092 selectminbits=''
1093 selecttype=''
1094 sh=''
1095 sig_count=''
1096 sig_name=''
1097 sig_name_init=''
1098 sig_num=''
1099 sig_num_init=''
1100 sig_size=''
1101 installsitearch=''
1102 sitearch=''
1103 sitearchexp=''
1104 installsitebin=''
1105 sitebin=''
1106 sitebinexp=''
1107 installsitehtml1dir=''
1108 sitehtml1dir=''
1109 sitehtml1direxp=''
1110 installsitehtml3dir=''
1111 sitehtml3dir=''
1112 sitehtml3direxp=''
1113 installsitelib=''
1114 sitelib=''
1115 sitelib_stem=''
1116 sitelibexp=''
1117 installsiteman1dir=''
1118 siteman1dir=''
1119 siteman1direxp=''
1120 installsiteman3dir=''
1121 siteman3dir=''
1122 siteman3direxp=''
1123 siteprefix=''
1124 siteprefixexp=''
1125 installsitescript=''
1126 sitescript=''
1127 sitescriptexp=''
1128 sizesize=''
1129 sizetype=''
1130 so=''
1131 socksizetype=''
1132 sharpbang=''
1133 shsharp=''
1134 spitshell=''
1135 src=''
1136 ssizetype=''
1137 startperl=''
1138 startsh=''
1139 stdchar=''
1140 d_stdio_stream_array=''
1141 stdio_stream_array=''
1142 sysman=''
1143 trnl=''
1144 uidformat=''
1145 uidsign=''
1146 uidsize=''
1147 uidtype=''
1148 archname64=''
1149 use64bitall=''
1150 use64bitint=''
1151 usefaststdio=''
1152 ccflags_uselargefiles=''
1153 ldflags_uselargefiles=''
1154 libswanted_uselargefiles=''
1155 uselargefiles=''
1156 uselongdouble=''
1157 usemorebits=''
1158 usemultiplicity=''
1159 nm_opt=''
1160 nm_so_opt=''
1161 runnm=''
1162 usenm=''
1163 useperlio=''
1164 userelocatableinc=''
1165 usesocks=''
1166 d_oldpthreads=''
1167 use5005threads=''
1168 useithreads=''
1169 usereentrant=''
1170 usethreads=''
1171 incpath=''
1172 mips_type=''
1173 usrinc=''
1174 d_vendorarch=''
1175 installvendorarch=''
1176 vendorarch=''
1177 vendorarchexp=''
1178 d_vendorbin=''
1179 installvendorbin=''
1180 vendorbin=''
1181 vendorbinexp=''
1182 installvendorhtml1dir=''
1183 vendorhtml1dir=''
1184 vendorhtml1direxp=''
1185 installvendorhtml3dir=''
1186 vendorhtml3dir=''
1187 vendorhtml3direxp=''
1188 d_vendorlib=''
1189 installvendorlib=''
1190 vendorlib=''
1191 vendorlib_stem=''
1192 vendorlibexp=''
1193 installvendorman1dir=''
1194 vendorman1dir=''
1195 vendorman1direxp=''
1196 installvendorman3dir=''
1197 vendorman3dir=''
1198 vendorman3direxp=''
1199 usevendorprefix=''
1200 vendorprefix=''
1201 vendorprefixexp=''
1202 d_vendorscript=''
1203 installvendorscript=''
1204 vendorscript=''
1205 vendorscriptexp=''
1206 versiononly=''
1207 defvoidused=''
1208 voidflags=''
1209 yacc=''
1210 yaccflags=''
1211 CONFIG=''
1212
1213 define='define'
1214 undef='undef'
1215 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1216 rmlist=''
1217
1218 : We must find out about Eunice early
1219 eunicefix=':'
1220 if test -f /etc/unixtovms; then
1221         eunicefix=/etc/unixtovms
1222 fi
1223 if test -f /etc/unixtovms.exe; then
1224         eunicefix=/etc/unixtovms.exe
1225 fi
1226
1227 : Set executable suffix now -- needed before hints available
1228 if test -f "/libs/version.library"; then
1229 : Amiga OS
1230     _exe=""
1231 elif test -f "/system/gnu_library/bin/ar.pm"; then
1232 : Stratus VOS
1233     _exe=".pm"
1234 elif test -n "$DJGPP"; then
1235 : DOS DJGPP
1236     _exe=".exe"
1237 elif test -d c:/. -o -n "$is_os2" ; then
1238 : OS/2 or cygwin
1239     _exe=".exe"
1240 fi
1241
1242 i_whoami=''
1243 ccname=''
1244 ccversion=''
1245 perllibs=''
1246 : set useposix=false in your hint file to disable the POSIX extension.
1247 useposix=true
1248 : set useopcode=false in your hint file to disable the Opcode extension.
1249 useopcode=true
1250 : Trailing extension.  Override this in a hint file, if needed.
1251 : Extra object files, if any, needed on this platform.
1252 archobjs=''
1253 archname=''
1254 : Possible local include directories to search.
1255 : Set locincpth to "" in a hint file to defeat local include searches.
1256 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1257 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1258 :
1259 : no include file wanted by default
1260 inclwanted=''
1261
1262 groupstype=''
1263 libnames=''
1264 : change the next line if compiling for Xenix/286 on Xenix/386
1265 xlibpth='/usr/lib/386 /lib/386'
1266 : Possible local library directories to search.
1267 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1268 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1269
1270 : general looking path for locating libraries
1271 glibpth="/lib /usr/lib $xlibpth"
1272 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1273 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1274 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1275
1276 : Private path used by Configure to find libraries.  Its value
1277 : is prepended to libpth. This variable takes care of special
1278 : machines, like the mips.  Usually, it should be empty.
1279 plibpth=''
1280
1281 : default library list
1282 libswanted=''
1283 : some systems want to use only the non-versioned libso:s
1284 ignore_versioned_solibs=''
1285 siteman1dir=''
1286 siteman3dir=''
1287 sitescript=''
1288 archname64=''
1289 ccflags_uselargefiles=''
1290 ldflags_uselargefiles=''
1291 libswanted_uselargefiles=''
1292 : set usemultiplicity on the Configure command line to enable multiplicity.
1293 : set usesocks on the Configure command line to enable socks.
1294 : set usethreads on the Configure command line to enable threads.
1295 usereentrant='undef'
1296 : full support for void wanted by default
1297 defvoidused=15
1298
1299 : List of libraries we want.
1300 : If anyone needs extra -lxxx, put those in a hint file.
1301 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1302 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1303 : We probably want to search /usr/shlib before most other libraries.
1304 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1305 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1306 glibpth="/usr/shlib $glibpth"
1307 : Do not use vfork unless overridden by a hint file.
1308 usevfork=false
1309
1310 : Find the basic shell for Bourne shell scripts
1311 case "$sh" in
1312 '')
1313         case "$SYSTYPE" in
1314         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1315         *) xxx='/bin/sh';;
1316         esac
1317         if test -f "$xxx"; then
1318                 sh="$xxx"
1319         else
1320                 : Build up a list and do a single loop so we can 'break' out.
1321                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1322                 for xxx in sh bash ksh pdksh ash; do
1323                         for p in $pth; do
1324                                 try="$try ${p}/${xxx}"
1325                         done
1326                 done
1327                 for xxx in $try; do
1328                         if test -f "$xxx"; then
1329                                 sh="$xxx";
1330                                 break
1331                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1332                                 sh="$xxx";
1333                                 break
1334                         elif test -f "$xxx.exe"; then
1335                                 sh="$xxx";
1336                                 break
1337                         fi
1338                 done
1339         fi
1340         ;;
1341 esac
1342
1343 case "$sh" in
1344 '')     cat >&2 <<EOM
1345 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1346
1347 Usually it's in /bin/sh.  How did you even get this far?
1348 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1349 we'll try to straighten this all out.
1350 EOM
1351         exit 1
1352         ;;
1353 esac
1354
1355 : see if sh knows # comments
1356 if `$sh -c '#' >/dev/null 2>&1`; then
1357         shsharp=true
1358         spitshell=cat
1359         xcat=/bin/cat
1360         test -f $xcat$_exe || xcat=/usr/bin/cat
1361         if test ! -f $xcat$_exe; then
1362                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1363                         if test -f $p/cat$_exe; then
1364                                 xcat=$p/cat
1365                                 break
1366                         fi
1367                 done
1368                 if test ! -f $xcat$_exe; then
1369                         echo "Can't find cat anywhere!"
1370                         exit 1
1371                 fi
1372         fi
1373         echo "#!$xcat" >sharp
1374         $eunicefix sharp
1375         chmod +x sharp
1376         ./sharp > today
1377         if test -s today; then
1378                 sharpbang='#!'
1379         else
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                         sharpbang=': use '
1388                 fi
1389         fi
1390 else
1391         echo " "
1392         echo "Your $sh doesn't grok # comments--I will strip them later on."
1393         shsharp=false
1394         cd ..
1395         echo "exec grep -v '^[  ]*#'" >spitshell
1396         chmod +x spitshell
1397         $eunicefix spitshell
1398         spitshell=`pwd`/spitshell
1399         cd UU
1400         echo "I presume that if # doesn't work, #! won't work either!"
1401         sharpbang=': use '
1402 fi
1403 rm -f sharp today
1404
1405 : figure out how to guarantee sh startup
1406 case "$startsh" in
1407 '') startsh=${sharpbang}${sh} ;;
1408 *)
1409 esac
1410 cat >sharp <<EOSS
1411 $startsh
1412 set abc
1413 test "$?abc" != 1
1414 EOSS
1415
1416 chmod +x sharp
1417 $eunicefix sharp
1418 if ./sharp; then
1419         : echo "Yup, it does."
1420 else
1421         echo "Hmm... '$startsh' does not guarantee sh startup..."
1422         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1423 fi
1424 rm -f sharp
1425
1426
1427 : Save command line options in file UU/cmdline.opt for later use in
1428 : generating config.sh.
1429 cat > cmdline.opt <<EOSH
1430 # Configure command line arguments.
1431 config_arg0='$0'
1432 config_args='$*'
1433 config_argc=$#
1434 EOSH
1435 argn=1
1436 args_exp=''
1437 args_sep=''
1438 for arg in "$@"; do
1439         cat >>cmdline.opt <<EOSH
1440 config_arg$argn='$arg'
1441 EOSH
1442         # Extreme backslashitis: replace each ' by '"'"'
1443         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1444 $arg
1445 EOC
1446         arg_exp=`cat cmdl.opt`
1447         args_exp="$args_exp$args_sep'$arg_exp'"
1448         argn=`expr $argn + 1`
1449         args_sep=' '
1450 done
1451 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1452 # used by ./hints/os2.sh
1453 rm -f cmdl.opt
1454
1455 : produce awk script to parse command line options
1456 cat >options.awk <<'EOF'
1457 BEGIN {
1458         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1459
1460         len = length(optstr);
1461         for (i = 1; i <= len; i++) {
1462                 c = substr(optstr, i, 1);
1463                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1464                 if (a == ":") {
1465                         arg[c] = 1;
1466                         i++;
1467                 }
1468                 opt[c] = 1;
1469         }
1470 }
1471 {
1472         expect = 0;
1473         str = $0;
1474         if (substr(str, 1, 1) != "-") {
1475                 printf("'%s'\n", str);
1476                 next;
1477         }
1478         len = length($0);
1479         for (i = 2; i <= len; i++) {
1480                 c = substr(str, i, 1);
1481                 if (!opt[c]) {
1482                         printf("-%s\n", substr(str, i));
1483                         next;
1484                 }
1485                 printf("-%s\n", c);
1486                 if (arg[c]) {
1487                         if (i < len)
1488                                 printf("'%s'\n", substr(str, i + 1));
1489                         else
1490                                 expect = 1;
1491                         next;
1492                 }
1493         }
1494 }
1495 END {
1496         if (expect)
1497                 print "?";
1498 }
1499 EOF
1500
1501 : process the command line options
1502 set X `for arg in "$@"; do echo "X$arg"; done |
1503         sed -e s/X// | awk -f options.awk`
1504 eval "set $*"
1505 shift
1506 rm -f options.awk
1507
1508 : set up default values
1509 fastread=''
1510 reuseval=false
1511 config_sh=''
1512 alldone=''
1513 error=''
1514 silent=''
1515 extractsh=''
1516 override=''
1517 knowitall=''
1518 rm -f optdef.sh posthint.sh
1519 cat >optdef.sh <<EOS
1520 $startsh
1521 EOS
1522
1523
1524 : option parsing
1525 while test $# -gt 0; do
1526         case "$1" in
1527         -d) shift; fastread=yes;;
1528         -e) shift; alldone=cont;;
1529         -f)
1530                 shift
1531                 cd ..
1532                 if test -r "$1"; then
1533                         config_sh="$1"
1534                 else
1535                         echo "$me: cannot read config file $1." >&2
1536                         error=true
1537                 fi
1538                 cd UU
1539                 shift;;
1540         -h) shift; error=true;;
1541         -r) shift; reuseval=true;;
1542         -s) shift; silent=true; realsilent=true;;
1543         -E) shift; alldone=exit;;
1544         -K) shift; knowitall=true;;
1545         -O) shift; override=true;;
1546         -S) shift; silent=true; extractsh=true;;
1547         -D)
1548                 shift
1549                 case "$1" in
1550                 *=)
1551                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1552                         echo "$me: ignoring -D $1" >&2
1553                         ;;
1554                 *=*) echo "$1" | \
1555                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1556                 *) echo "$1='define'" >> optdef.sh;;
1557                 esac
1558                 shift
1559                 ;;
1560         -U)
1561                 shift
1562                 case "$1" in
1563                 *=) echo "$1" >> optdef.sh;;
1564                 *=*)
1565                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1566                         echo "$me: ignoring -U $1" >&2
1567                         ;;
1568                 *) echo "$1='undef'" >> optdef.sh;;
1569                 esac
1570                 shift
1571                 ;;
1572         -A)
1573             shift
1574             xxx=''
1575             yyy="$1"
1576             zzz=''
1577             uuu=undef
1578             case "$yyy" in
1579             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1580                  case "$zzz" in
1581                  *:*) zzz='' ;;
1582                  *)   xxx=append
1583                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1584                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1585                  esac
1586                  ;;
1587             esac
1588             case "$xxx" in
1589             '')  case "$yyy" in
1590                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1591                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1592                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1593                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1594                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1595                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1596                  esac
1597                  ;;       
1598             esac
1599             case "$xxx" in
1600             append)
1601                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1602             clear)
1603                 echo "$yyy=''"                  >> posthint.sh ;;
1604             define)
1605                 case "$zzz" in
1606                 '') zzz=define ;;
1607                 esac
1608                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1609             eval)
1610                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1611             prepend)
1612                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1613             undef)
1614                 case "$zzz" in
1615                 '') zzz="$uuu" ;;
1616                 esac
1617                 echo "$yyy=$zzz"                >> posthint.sh ;;
1618             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1619             esac
1620             shift
1621             ;;
1622         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1623             exit 0;;
1624         --) break;;
1625         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1626         *) break;;
1627         esac
1628 done
1629
1630 case "$error" in
1631 true)
1632         cat >&2 <<EOM
1633 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1634                  [-U symbol] [-U symbol=] [-A command:symbol...]
1635   -d : use defaults for all answers.
1636   -e : go on without questioning past the production of config.sh.
1637   -f : specify an alternate default configuration file.
1638   -h : print this help message and exit (with an error status).
1639   -r : reuse C symbols value if possible (skips costly nm extraction).
1640   -s : silent mode, only echoes questions and essential information.
1641   -D : define symbol to have some value:
1642          -D symbol         symbol gets the value 'define'
1643          -D symbol=value   symbol gets the value 'value'
1644   -E : stop at the end of questions, after having produced config.sh.
1645   -K : do not use unless you know what you are doing.
1646   -O : let -D and -U override definitions from loaded configuration file.
1647   -S : perform variable substitutions on all .SH files (can mix with -f)
1648   -U : undefine symbol:
1649          -U symbol    symbol gets the value 'undef'
1650          -U symbol=   symbol gets completely empty
1651   -A : manipulate symbol after the platform specific hints have been applied:
1652          -A symbol=value                append " "value to symbol
1653          -A append:symbol=value         append value to symbol
1654          -A define:symbol=value         define symbol to have value
1655          -A clear:symbol                define symbol to be ''
1656          -A define:symbol               define symbol to be 'define'
1657          -A eval:symbol=value           define symbol to be eval of value
1658          -A prepend:symbol=value        prepend value to symbol
1659          -A undef:symbol                define symbol to be 'undef'
1660          -A undef:symbol=               define symbol to be ''
1661   -V : print version number and exit (with a zero status).
1662 EOM
1663         exit 1
1664         ;;
1665 esac
1666
1667 : Sanity checks
1668 case "$fastread$alldone" in
1669 yescont|yesexit) ;;
1670 *)
1671         case "$extractsh" in
1672         true) ;;
1673         *)
1674                 if test ! -t 0; then
1675                         echo "Say 'sh Configure', not 'sh <Configure'"
1676                         exit 1
1677                 fi
1678                 ;;
1679         esac
1680         ;;
1681 esac
1682
1683 exec 4>&1
1684 case "$silent" in
1685 true) exec 1>/dev/null;;
1686 esac
1687
1688 : run the defines and the undefines, if any, but leave the file out there...
1689 touch optdef.sh
1690 . ./optdef.sh
1691 : create the posthint manipulation script and leave the file out there...
1692 touch posthint.sh
1693
1694 : set package name
1695 package=perl5
1696 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1697 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1698 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1699 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1700 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1701 esac
1702
1703 : Some greps do not return status, grrr.
1704 echo "grimblepritz" >grimble
1705 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1706         contains=contains
1707 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1708         contains=grep
1709 else
1710         contains=contains
1711 fi
1712 rm -f grimble
1713 : the following should work in any shell
1714 case "$contains" in
1715 contains*)
1716         echo " "
1717         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1718         cat >contains <<'EOSS'
1719 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1720 EOSS
1721 chmod +x contains
1722 esac
1723
1724 : Find the path to the source tree
1725 case "$src" in
1726 '') case "$0" in
1727     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1728          case "$src" in
1729          /*)    ;;
1730          .)     ;;
1731          *)     src=`cd ../$src && pwd` ;;
1732          esac
1733          ;;
1734     *)   src='.';;
1735     esac;;
1736 esac
1737 case "$src" in
1738 '')     src=/
1739         rsrc=/
1740         ;;
1741 /*) rsrc="$src";;
1742 *) rsrc="../$src";;
1743 esac
1744 if test -f $rsrc/Configure && \
1745         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1746 then
1747    : found it, so we are ok.
1748 else
1749         rsrc=''
1750         for src in . .. ../.. ../../.. ../../../..; do
1751                 if test -f ../$src/Configure && \
1752                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1753                 then
1754                         rsrc=../$src
1755                         break
1756                 fi
1757         done
1758 fi
1759 case "$rsrc" in
1760 '')
1761         cat <<EOM >&4
1762
1763 Sorry, I can't seem to locate the source dir for $package.  Please start
1764 Configure with an explicit path -- i.e. /some/path/Configure.
1765
1766 EOM
1767         exit 1
1768         ;;
1769 ../.)   rsrc='..';;
1770 *)
1771         echo " "
1772         echo "Sources for $package found in \"$src\"." >&4
1773         ;;
1774 esac
1775
1776 : script used to extract .SH files with variable substitutions
1777 cat >extract <<'EOS'
1778 PERL_CONFIG_SH=true
1779 echo "Doing variable substitutions on .SH files..."
1780 if test -f MANIFEST; then
1781         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1782 else
1783         echo "(Looking for .SH files under the source directory.)"
1784         set x `(cd "$src"; find . -name "*.SH" -print)`
1785 fi
1786 shift
1787 case $# in
1788 0) set x `(cd "$src"; echo *.SH)`; shift;;
1789 esac
1790 if test ! -f "$src/$1"; then
1791         shift
1792 fi
1793 mkdir_p='
1794 name=$1;
1795 create="";
1796 while test $name; do
1797         if test ! -d "$name"; then
1798                 create="$name $create";
1799                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1800                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1801         else
1802                 name="";
1803         fi;
1804 done;
1805 for file in $create; do
1806         mkdir $file;
1807 done
1808 '
1809 for file in $*; do
1810         case "$src" in
1811         ".")
1812                 case "$file" in
1813                 */*)
1814                         dir=`expr X$file : 'X\(.*\)/'`
1815                         file=`expr X$file : 'X.*/\(.*\)'`
1816                         (cd "$dir" && . ./$file)
1817                         ;;
1818                 *)
1819                         . ./$file
1820                         ;;
1821                 esac
1822                 ;;
1823         *)
1824                 case "$file" in
1825                 */*)
1826                         dir=`expr X$file : 'X\(.*\)/'`
1827                         file=`expr X$file : 'X.*/\(.*\)'`
1828                         (set x $dir; shift; eval $mkdir_p)
1829                         sh <"$src/$dir/$file"
1830                         ;;
1831                 *)
1832                         sh <"$src/$file"
1833                         ;;
1834                 esac
1835                 ;;
1836         esac
1837 done
1838 if test -f "$src/config_h.SH"; then
1839         if test ! -f config.h; then
1840         : oops, they left it out of MANIFEST, probably, so do it anyway.
1841         . "$src/config_h.SH"
1842         fi
1843 fi
1844 EOS
1845
1846 : extract files and exit if asked to do so
1847 case "$extractsh" in
1848 true)
1849         case "$realsilent" in
1850         true) ;;
1851         *) exec 1>&4;;
1852         esac
1853         case "$config_sh" in
1854         '') config_sh='config.sh';;
1855         esac
1856         echo " "
1857         echo "Fetching answers from $config_sh..."
1858         cd ..
1859         . $config_sh
1860         test "$override" && . ./optdef.sh
1861         echo " "
1862         . UU/extract
1863         rm -rf UU
1864         echo "Extraction done."
1865         exit 0
1866         ;;
1867 esac
1868
1869 : Eunice requires " " instead of "", can you believe it
1870 echo " "
1871 : Here we go...
1872 echo "Beginning of configuration questions for $package."
1873
1874 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1875
1876 : first determine how to suppress newline on echo command
1877 echo " "
1878 echo "Checking echo to see how to suppress newlines..."
1879 (echo "hi there\c" ; echo " ") >.echotmp
1880 if $contains c .echotmp >/dev/null 2>&1 ; then
1881         echo "...using -n."
1882         n='-n'
1883         c=''
1884 else
1885         cat <<'EOM'
1886 ...using \c
1887 EOM
1888         n=''
1889         c='\c'
1890 fi
1891 echo $n "The star should be here-->$c"
1892 echo '*'
1893 rm -f .echotmp
1894
1895 : Now test for existence of everything in MANIFEST
1896 echo " "
1897 if test -f "$rsrc/MANIFEST"; then
1898         echo "First let's make sure your kit is complete.  Checking..." >&4
1899         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1900         rm -f missing
1901         tmppwd=`pwd`
1902         for filelist in x??; do
1903                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1904         done
1905         if test -s missing; then
1906                 cat missing >&4
1907                 cat >&4 <<'EOM'
1908
1909 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1910
1911 You have the option of continuing the configuration process, despite the
1912 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1913 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1914 and contact the author (perlbug@perl.org).
1915
1916 EOM
1917                 echo $n "Continue? [n] $c" >&4
1918                 read ans
1919                 case "$ans" in
1920                 y*)
1921                         echo "Continuing..." >&4
1922                         rm -f missing
1923                         ;;
1924                 *)
1925                         echo "ABORTING..." >&4
1926                         kill $$
1927                         ;;
1928                 esac
1929         else
1930                 echo "Looks good..."
1931         fi
1932 else
1933         echo "There is no MANIFEST file.  I hope your kit is complete !"
1934 fi
1935 rm -f missing x??
1936
1937 echo " "
1938 : Find the appropriate value for a newline for tr
1939 if test -n "$DJGPP"; then
1940        trnl='\012'
1941 fi
1942 if test X"$trnl" = X; then
1943         case "`echo foo|tr '\n' x 2>/dev/null`" in
1944         foox) trnl='\n' ;;
1945         esac
1946 fi
1947 if test X"$trnl" = X; then
1948         case "`echo foo|tr '\012' x 2>/dev/null`" in
1949         foox) trnl='\012' ;;
1950         esac
1951 fi
1952 if test X"$trnl" = X; then
1953        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1954        fooxy) trnl='\n\r' ;;
1955        esac
1956 fi
1957 if test X"$trnl" = X; then
1958         cat <<EOM >&2
1959
1960 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1961
1962 EOM
1963         exit 1
1964 fi
1965
1966 : compute the number of columns on the terminal for proper question formatting
1967 case "$COLUMNS" in
1968 '') COLUMNS='80';;
1969 esac
1970
1971 : set up the echo used in my read
1972 myecho="case \"\$xxxm\" in
1973 '') echo $n \"\$rp $c\" >&4;;
1974 *) case \"\$rp\" in
1975         '') echo $n \"[\$xxxm] $c\";;
1976         *)
1977                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1978                         echo \"\$rp\" >&4
1979                         echo $n \"[\$xxxm] $c\" >&4
1980                 else
1981                         echo $n \"\$rp [\$xxxm] $c\" >&4
1982                 fi
1983                 ;;
1984         esac;;
1985 esac"
1986
1987 : now set up to do reads with possible shell escape and default assignment
1988 cat <<EOSC >myread
1989 $startsh
1990 xxxm=\$dflt
1991 $myecho
1992 ans='!'
1993 case "\$fastread" in
1994 yes) case "\$dflt" in
1995         '') ;;
1996         *) ans='';
1997                 case "\$silent-\$rp" in
1998                 true-) ;;
1999                 *) echo " " >&4;;
2000                 esac;;
2001         esac;;
2002 *) case "\$silent" in
2003         true) case "\$rp" in
2004                 '') ans='';;
2005                 esac;;
2006         esac;;
2007 esac
2008 while expr "X\$ans" : "X!" >/dev/null; do
2009         read answ
2010         set x \$xxxm
2011         shift
2012         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2013         case  "\$answ" in
2014         "!")
2015                 sh 1>&4
2016                 echo " "
2017                 $myecho
2018                 ;;
2019         !*)
2020                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2021                 shift
2022                 sh 1>&4 -c "\$*"
2023                 echo " "
2024                 $myecho
2025                 ;;
2026         "\$ans")
2027                 case "\$ans" in
2028                 \\&*)
2029                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2030                         shift
2031                         case "\$1" in
2032                         -d)
2033                                 fastread=yes
2034                                 echo "(OK, I'll run with -d after this question.)" >&4
2035                                 ;;
2036                         -*)
2037                                 echo "*** Sorry, \$1 not supported yet." >&4
2038                                 ;;
2039                         esac
2040                         $myecho
2041                         ans=!
2042                         ;;
2043                 esac;;
2044         *)
2045                 case "\$aok" in
2046                 y)
2047                         echo "*** Substitution done -- please confirm."
2048                         xxxm="\$ans"
2049                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2050                         xxxm="\$ans"
2051                         ans=!
2052                         ;;
2053                 *)
2054                         echo "*** Error -- try again."
2055                         ans=!
2056                         ;;
2057                 esac
2058                 $myecho
2059                 ;;
2060         esac
2061         case "\$ans\$xxxm\$nostick" in
2062         '')
2063                 ans=!
2064                 $myecho
2065                 ;;
2066         esac
2067 done
2068 case "\$ans" in
2069 '') ans="\$xxxm";;
2070 esac
2071 EOSC
2072
2073 : create .config dir to save info across Configure sessions
2074 test -d ../.config || mkdir ../.config
2075 cat >../.config/README <<EOF
2076 This directory created by Configure to save information that should
2077 persist across sessions for $package.
2078
2079 You may safely delete it if you wish.
2080 EOF
2081
2082 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2083 case "$usedevel" in
2084 $define|true|[yY]*) ;;
2085 *) case "$xversion" in
2086    *[13579])
2087         cat >&4 <<EOH
2088 *** WHOA THERE!!! ***
2089
2090     This is an UNSTABLE DEVELOPMENT release.
2091     The version of this $package distribution is $xversion, that is, odd,
2092     (as opposed to even) and that signifies a development release.
2093     If you want a maintenance release, you want an even-numbered version.
2094
2095     Do ***NOT*** install this into production use.
2096     Data corruption and crashes are possible.
2097
2098     It is most seriously suggested that you do not continue any further
2099     unless you want to help in developing and debugging Perl.
2100
2101     If you *still* want to build perl, you can answer 'y' now,
2102     or pass -Dusedevel to Configure.
2103
2104 EOH
2105         rp='Do you really want to continue?'
2106         dflt='n'
2107         . ./myread
2108         case "$ans" in
2109         [yY]) echo >&4 "Okay, continuing."
2110               usedevel="$define" ;;
2111         *) echo >&4 "Okay, bye."
2112            exit 1
2113            ;;
2114         esac
2115         ;;
2116     esac
2117     ;;
2118 esac
2119 case "$usedevel" in
2120 $define|true|[yY]*)
2121         case "$versiononly" in
2122         '') versiononly="$define" ;;
2123         esac
2124         case "$installusrbinperl" in
2125         '') installusrbinperl="$undef" ;;
2126         esac
2127         ;;
2128 esac
2129
2130 : general instructions
2131 needman=true
2132 firsttime=true
2133 user=`(logname) 2>/dev/null`
2134 case "$user" in
2135 '') user=`whoami 2>&1`;;
2136 esac
2137 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2138         firsttime=false
2139         echo " "
2140         rp='Would you like to see the instructions?'
2141         dflt=n
2142         . ./myread
2143         case "$ans" in
2144         [yY]*) ;;
2145         *) needman=false;;
2146         esac
2147 fi
2148 if $needman; then
2149         cat <<EOH
2150
2151 This installation shell script will examine your system and ask you questions
2152 to determine how the perl5 package should be installed. If you get
2153 stuck on a question, you may use a ! shell escape to start a subshell or
2154 execute a command.  Many of the questions will have default answers in square
2155 brackets; typing carriage return will give you the default.
2156
2157 On some of the questions which ask for file or directory names you are allowed
2158 to use the ~name construct to specify the login directory belonging to "name",
2159 even if you don't have a shell which knows about that.  Questions where this is
2160 allowed will be marked "(~name ok)".
2161
2162 EOH
2163         rp=''
2164         dflt='Type carriage return to continue'
2165         . ./myread
2166         cat <<'EOH'
2167
2168 The prompter used in this script allows you to use shell variables and
2169 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2170 in the default answer, as if the default line was a set of arguments given to a
2171 script shell.  This means you may also use $* to repeat the whole default line,
2172 so you do not have to re-type everything to add something to the default.
2173
2174 Everytime there is a substitution, you will have to confirm.  If there is an
2175 error (e.g. an unmatched backtick), the default answer will remain unchanged
2176 and you will be prompted again.
2177
2178 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2179 the questions and use the computed defaults (or the previous answers if there
2180 was already a config.sh file). Type 'Configure -h' for a list of options.
2181 You may also start interactively and then answer '& -d' at any prompt to turn
2182 on the non-interactive behaviour for the remainder of the execution.
2183
2184 EOH
2185         . ./myread
2186         cat <<EOH
2187
2188 Much effort has been expended to ensure that this shell script will run on any
2189 Unix system.  If despite that it blows up on yours, your best bet is to edit
2190 Configure and run it again.  If you can't run Configure for some reason,
2191 you'll have to generate a config.sh file by hand.  Whatever problems you
2192 have, let me (perlbug@perl.org) know how I blew it.
2193
2194 This installation script affects things in two ways:
2195
2196 1) it may do direct variable substitutions on some of the files included
2197    in this kit.
2198 2) it builds a config.h file for inclusion in C programs.  You may edit
2199    any of these files as the need arises after running this script.
2200
2201 If you make a mistake on a question, there is no easy way to back up to it
2202 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2203 files.  Configure will offer to let you do this before it runs the SH files.
2204
2205 EOH
2206         dflt='Type carriage return to continue'
2207         . ./myread
2208         case "$firsttime" in
2209         true) echo $user >>../.config/instruct;;
2210         esac
2211 fi
2212
2213 : find out where common programs are
2214 echo " "
2215 echo "Locating common programs..." >&4
2216 cat <<EOSC >loc
2217 $startsh
2218 case \$# in
2219 0) exit 1;;
2220 esac
2221 thing=\$1
2222 shift
2223 dflt=\$1
2224 shift
2225 for dir in \$*; do
2226         case "\$thing" in
2227         .)
2228         if test -d \$dir/\$thing; then
2229                 echo \$dir
2230                 exit 0
2231         fi
2232         ;;
2233         *)
2234         for thisthing in \$dir/\$thing; do
2235                 : just loop through to pick last item
2236         done
2237         if test -f \$thisthing; then
2238                 echo \$thisthing
2239                 exit 0
2240         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2241                 echo \$thisthing
2242                 exit 0
2243         elif test -f \$dir/\$thing.exe; then
2244                 if test -n "$DJGPP"; then
2245                         echo \$dir/\$thing.exe
2246                 elif test "$eunicefix" != ":"; then
2247                         : on Eunice apparently
2248                         echo \$dir/\$thing
2249                         exit 0
2250                 fi
2251                 exit 0
2252         fi
2253         ;;
2254         esac
2255 done
2256 echo \$dflt
2257 exit 1
2258 EOSC
2259 chmod +x loc
2260 $eunicefix loc
2261 loclist="
2262 awk
2263 cat
2264 chmod
2265 comm
2266 cp
2267 echo
2268 expr
2269 grep
2270 ls
2271 mkdir
2272 rm
2273 sed
2274 sort
2275 touch
2276 tr
2277 uniq
2278 "
2279 trylist="
2280 Mcc
2281 ar
2282 bison
2283 byacc
2284 cpp
2285 csh
2286 date
2287 egrep
2288 gmake
2289 gzip
2290 less
2291 ln
2292 make
2293 more
2294 nm
2295 nroff
2296 pg
2297 test
2298 uname
2299 zip
2300 "
2301 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2302 pth="$pth /lib /usr/lib"
2303 for file in $loclist; do
2304         eval xxx=\$$file
2305         case "$xxx" in
2306         /*|?:[\\/]*)
2307                 if test -f "$xxx"; then
2308                         : ok
2309                 else
2310                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2311                         xxx=`./loc $file $file $pth`
2312                 fi
2313                 ;;
2314         '') xxx=`./loc $file $file $pth`;;
2315         *) xxx=`./loc $xxx $xxx $pth`;;
2316         esac
2317         eval $file=$xxx$_exe
2318         eval _$file=$xxx
2319         case "$xxx" in
2320         /*)
2321                 echo $file is in $xxx.
2322                 ;;
2323         ?:[\\/]*)
2324                 echo $file is in $xxx.
2325                 ;;
2326         *)
2327                 echo "I don't know where '$file' is, and my life depends on it." >&4
2328                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2329                 exit 1
2330                 ;;
2331         esac
2332 done
2333 echo " "
2334 echo "Don't worry if any of the following aren't found..."
2335 say=offhand
2336 for file in $trylist; do
2337         eval xxx=\$$file
2338         case "$xxx" in
2339         /*|?:[\\/]*)
2340                 if test -f "$xxx"; then
2341                         : ok
2342                 else
2343                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2344                         xxx=`./loc $file $file $pth`
2345                 fi
2346                 ;;
2347         '') xxx=`./loc $file $file $pth`;;
2348         *) xxx=`./loc $xxx $xxx $pth`;;
2349         esac
2350         eval $file=$xxx$_exe
2351         eval _$file=$xxx
2352         case "$xxx" in
2353         /*)
2354                 echo $file is in $xxx.
2355                 ;;
2356         ?:[\\/]*)
2357                 echo $file is in $xxx.
2358                 ;;
2359         *)
2360                 echo "I don't see $file out there, $say."
2361                 say=either
2362                 ;;
2363         esac
2364 done
2365 case "$egrep" in
2366 egrep)
2367         echo "Substituting grep for egrep."
2368         egrep=$grep
2369         _egrep=$grep
2370         ;;
2371 esac
2372 case "$ln" in
2373 ln)
2374         echo "Substituting cp for ln."
2375         ln=$cp
2376         _ln=$cp
2377         ;;
2378 esac
2379 case "$make" in
2380 make)   
2381         case "$gmake" in
2382         gmake)
2383         echo "I can't find make or gmake, and my life depends on it." >&4
2384         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2385         exit 1
2386         ;;
2387         esac
2388         ;;
2389 esac    
2390 case "$gmake" in
2391 gmake)  ;;
2392 *)      # We can't have osname yet.
2393         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2394                 # Assume that gmake, if found, is definitely GNU make
2395                 # and prefer it over the system make.
2396                 echo "Substituting gmake for make."
2397                 make=$gmake
2398                 _make=$gmake
2399         fi
2400         ;;
2401 esac
2402 case "$test" in
2403 test)
2404         echo "Hopefully test is built into your sh."
2405         ;;
2406 *)
2407         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2408                 echo "Using the test built into your sh."
2409                 test=test
2410                 _test=test
2411         fi
2412         ;;
2413 esac
2414 case "$echo" in
2415 echo)
2416         echo "Hopefully echo is built into your sh."
2417         ;;
2418 '') ;;
2419 *)
2420         echo " "
2421 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2422         $echo $n "hi there$c" >foo1
2423         echo $n "hi there$c" >foo2
2424         if cmp foo1 foo2 >/dev/null 2>&1; then
2425                 echo "They are compatible.  In fact, they may be identical."
2426         else
2427                 case "$n" in
2428                 '-n') n='' c='\c';;
2429                 *) n='-n' c='';;
2430                 esac
2431                 cat <<FOO
2432 They are not compatible!  You are probably running ksh on a non-USG system.
2433 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2434 have echo built in and we may have to run some Bourne shell scripts.  That
2435 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2436
2437 FOO
2438                 $echo $n "The star should be here-->$c"
2439                 $echo "*"
2440         fi
2441         $rm -f foo1 foo2
2442         ;;
2443 esac
2444
2445 cat <<EOS >trygcc
2446 $startsh
2447 EOS
2448 cat <<'EOSC' >>trygcc
2449 case "$cc" in
2450 '') ;;
2451 *)  $rm -f try try.*
2452     $cat >try.c <<EOM
2453 int main(int argc, char *argv[]) {
2454   return 0;
2455 }
2456 EOM
2457     if $cc -o try $ccflags $ldflags try.c; then
2458        :
2459     else
2460         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2461         despair=yes
2462         trygcc=yes
2463         case "$cc" in
2464         *gcc*) trygcc=no ;;
2465         esac
2466         case "`$cc -v -c try.c 2>&1`" in
2467         *gcc*) trygcc=no ;;
2468         esac
2469         if $test X"$trygcc" = Xyes; then
2470             if gcc -o try -c try.c; then
2471                 echo " "
2472                 echo "You seem to have a working gcc, though." >&4
2473                 rp="Would you like to use it?"
2474                 dflt=y
2475                 if $test -f myread; then
2476                     . ./myread
2477                 else
2478                     if $test -f UU/myread; then
2479                         . ./UU/myread
2480                     else
2481                         echo "Cannot find myread, sorry.  Aborting." >&2
2482                         exit 1
2483                     fi
2484                 fi  
2485                 case "$ans" in
2486                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2487                        if $test -f usethreads.cbu; then
2488                            $cat >&4 <<EOM 
2489
2490 *** However, any setting of the C compiler flags (e.g. for thread support)
2491 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2492 *** (together with e.g. -Dusethreads).
2493
2494 EOM
2495                        fi;;
2496                 esac
2497             fi
2498         fi
2499     fi
2500     $rm -f try try.*
2501     ;;
2502 esac
2503 EOSC
2504
2505 cat <<EOS >checkcc
2506 $startsh
2507 EOS
2508 cat <<'EOSC' >>checkcc
2509 case "$cc" in        
2510 '') ;;
2511 *)  $rm -f try try.*              
2512     $cat >try.c <<EOM
2513 int main(int argc, char *argv[]) {
2514   return 0;
2515 }
2516 EOM
2517     if $cc -o try $ccflags $ldflags try.c; then
2518        :
2519     else
2520         if $test X"$despair" = Xyes; then
2521            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2522         fi
2523         $cat >&4 <<EOM         
2524 You need to find a working C compiler.
2525 Either (purchase and) install the C compiler supplied by your OS vendor,
2526 or for a free C compiler try http://gcc.gnu.org/
2527 I cannot continue any further, aborting.
2528 EOM
2529         exit 1
2530     fi
2531     $rm -f try try.*
2532     ;;
2533 esac
2534 EOSC
2535
2536 : determine whether symbolic links are supported
2537 echo " "
2538 $touch blurfl
2539 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2540         echo "Symbolic links are supported." >&4
2541         lns="$ln -s"
2542 else
2543         echo "Symbolic links are NOT supported." >&4
2544         lns="$ln"
2545 fi
2546 $rm -f blurfl sym
2547
2548 : determine whether symbolic links are supported
2549 echo " "
2550 case "$lns" in
2551 *"ln"*" -s")
2552         echo "Checking how to test for symbolic links..." >&4
2553         $lns blurfl sym
2554         if $test "X$issymlink" = X; then
2555                 case "$newsh" in
2556                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2557                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2558                 esac
2559                 if test $? = 0; then
2560                         issymlink="test -h"
2561                 else
2562                         echo "Your builtin 'test -h' may be broken." >&4
2563                         case "$test" in
2564                         /*)     ;;
2565                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2566                                 for p in $pth
2567                                 do
2568                                         if test -f "$p/$test"; then
2569                                                 test="$p/$test"
2570                                                 break
2571                                         fi
2572                                 done
2573                                 ;;
2574                         esac
2575                         case "$test" in
2576                         /*)
2577                                 echo "Trying external '$test -h'." >&4
2578                                 issymlink="$test -h"
2579                                 if $test ! -h sym >/dev/null 2>&1; then
2580                                         echo "External '$test -h' is broken, too." >&4
2581                                         issymlink=''
2582                                 fi
2583                                 ;;
2584                         *)      issymlink='' ;;
2585                         esac
2586                 fi              
2587         fi
2588         if $test "X$issymlink" = X; then
2589                 if $test -L sym 2>/dev/null; then
2590                         issymlink="$test -L"
2591                         echo "The builtin '$test -L' worked." >&4
2592                 fi
2593         fi
2594         if $test "X$issymlink" != X; then
2595                 echo "You can test for symbolic links with '$issymlink'." >&4
2596         else
2597                 echo "I do not know how you can test for symbolic links." >&4
2598         fi
2599         $rm -f blurfl sym
2600         ;;
2601 *)      echo "No symbolic links, so not testing for their testing..." >&4
2602         ;;
2603 esac
2604 echo " "
2605
2606
2607 case "$mksymlinks" in
2608 $define|true|[yY]*)
2609         case "$src" in
2610         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2611                 exit 1
2612                 ;;
2613         *)      case "$lns:$issymlink" in
2614                 *"ln"*" -s:"*"test -"?)
2615                         echo "Creating the symbolic links..." >&4
2616                         echo "(First creating the subdirectories...)" >&4
2617                         cd ..
2618                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2619                                 read directory
2620                                 test -z "$directory" && break
2621                                 mkdir -p $directory
2622                         done
2623                         # Sanity check 1.
2624                         if test ! -d t/base; then
2625                                 echo "Failed to create the subdirectories.  Aborting." >&4
2626                                 exit 1
2627                         fi
2628                         echo "(Then creating the symlinks...)" >&4
2629                         awk '{print $1}' $src/MANIFEST | while true; do
2630                                 read filename
2631                                 test -z "$filename" && break
2632                                 if test -f $filename; then
2633                                         if $issymlink $filename; then
2634                                                 rm -f $filename
2635                                         fi
2636                                 fi
2637                                 if test -f $filename; then
2638                                         echo "$filename already exists, not symlinking."
2639                                 else
2640                                         ln -s $src/$filename $filename
2641                                 fi
2642                         done
2643                         # Sanity check 2.
2644                         if test ! -f t/base/lex.t; then
2645                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2646                                 exit 1
2647                         fi
2648                         cd UU
2649                         ;;
2650                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2651                         ;;
2652                 esac
2653                 ;;
2654         esac
2655         ;;
2656 esac
2657
2658
2659 case "$usecrosscompile" in
2660 $define|true|[yY]*)
2661         $echo "Cross-compiling..."
2662         croak=''
2663         case "$cc" in
2664         *-*-gcc) # A cross-compiling gcc, probably.
2665             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2666             ar=$targetarch-ar
2667             # leave out ld, choosing it is more complex
2668             nm=$targetarch-nm
2669             ranlib=$targetarch-ranlib
2670             $echo 'extern int foo;' > try.c
2671             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2672             shift
2673             if $test $# -gt 0; then
2674                 incpth="$incpth $*"
2675                 incpth="`$echo $incpth|$sed 's/^ //'`"
2676                 echo "Guessing incpth '$incpth'." >&4
2677                 for i in $*; do
2678                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2679                     if $test -d $j; then
2680                         libpth="$libpth $j"
2681                     fi
2682                 done   
2683                 libpth="`$echo $libpth|$sed 's/^ //'`"
2684                 echo "Guessing libpth '$libpth'." >&4
2685             fi
2686             $rm -f try.c
2687             ;;
2688         esac
2689         case "$targetarch" in
2690         '') echo "Targetarch not defined." >&4; croak=y ;;
2691         *)  echo "Using targetarch $targetarch." >&4 ;;
2692         esac
2693         case "$incpth" in
2694         '') echo "Incpth not defined." >&4; croak=y ;;
2695         *)  echo "Using incpth '$incpth'." >&4 ;;
2696         esac
2697         case "$libpth" in
2698         '') echo "Libpth not defined." >&4; croak=y ;;
2699         *)  echo "Using libpth '$libpth'." >&4 ;;
2700         esac
2701         case "$usrinc" in
2702         '') for i in $incpth; do
2703                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2704                     usrinc=$i
2705                     echo "Guessing usrinc $usrinc." >&4
2706                     break
2707                 fi
2708             done
2709             case "$usrinc" in
2710             '') echo "Usrinc not defined." >&4; croak=y ;;
2711             esac
2712             ;;
2713         *)  echo "Using usrinc $usrinc." >&4 ;;
2714         esac
2715         case "$targethost" in
2716         '') echo "Targethost not defined." >&4; croak=y ;;
2717         *)  echo "Using targethost $targethost." >&4
2718         esac
2719         locincpth=' '
2720         loclibpth=' '
2721         case "$croak" in
2722         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2723         esac
2724         case "$src" in
2725         /*) run=$src/Cross/run
2726             targetmkdir=$src/Cross/mkdir
2727             to=$src/Cross/to
2728             from=$src/Cross/from
2729             ;;
2730         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2731             run=$pwd/Cross/run
2732             targetmkdir=$pwd/Cross/mkdir
2733             to=$pwd/Cross/to
2734             from=$pwd/Cross/from
2735             ;;
2736         esac
2737         case "$targetrun" in
2738         '') targetrun=ssh ;;
2739         esac
2740         case "$targetto" in
2741         '') targetto=scp ;;
2742         esac
2743         case "$targetfrom" in
2744         '') targetfrom=scp ;;
2745         esac
2746         run=$run-$targetrun
2747         to=$to-$targetto
2748         from=$from-$targetfrom
2749         case "$targetdir" in
2750         '')  targetdir=/tmp
2751              echo "Guessing targetdir $targetdir." >&4
2752              ;;
2753         esac
2754         case "$targetuser" in
2755         '')  targetuser=root
2756              echo "Guessing targetuser $targetuser." >&4
2757              ;;
2758         esac
2759         case "$targetfrom" in
2760         scp)    q=-q ;;
2761         *)      q='' ;;
2762         esac
2763         case "$targetrun" in
2764         ssh|rsh)
2765             cat >$run <<EOF
2766 #!/bin/sh
2767 case "\$1" in
2768 -cwd)
2769   shift
2770   cwd=\$1
2771   shift
2772   ;;
2773 esac
2774 case "\$cwd" in
2775 '') cwd=$targetdir ;;
2776 esac
2777 exe=\$1
2778 shift
2779 if $test ! -f \$exe.xok; then
2780   $to \$exe
2781   $touch \$exe.xok
2782 fi
2783 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2784 EOF
2785             ;;
2786         *)  echo "Unknown targetrun '$targetrun'" >&4
2787             exit 1
2788             ;;
2789         esac
2790         case "$targetmkdir" in
2791         */Cross/mkdir)
2792             cat >$targetmkdir <<EOF
2793 #!/bin/sh
2794 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2795 EOF
2796             $chmod a+rx $targetmkdir
2797             ;;
2798         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2799             exit 1
2800             ;;
2801         esac
2802         case "$targetto" in
2803         scp|rcp)
2804             cat >$to <<EOF
2805 #!/bin/sh
2806 for f in \$@
2807 do
2808   case "\$f" in
2809   /*)
2810     $targetmkdir \`dirname \$f\`
2811     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2812     ;;
2813   *)
2814     $targetmkdir $targetdir/\`dirname \$f\`
2815     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2816     ;;
2817   esac
2818 done
2819 exit 0
2820 EOF
2821             ;;
2822         cp) cat >$to <<EOF
2823 #!/bin/sh
2824 for f in \$@
2825 do
2826   case "\$f" in
2827   /*)
2828     $mkdir -p $targetdir/\`dirname \$f\`
2829     $cp \$f $targetdir/\$f || exit 1
2830     ;;
2831   *)
2832     $targetmkdir $targetdir/\`dirname \$f\`
2833     $cp \$f $targetdir/\$f || exit 1
2834     ;;
2835   esac
2836 done
2837 exit 0
2838 EOF
2839             ;;
2840         *)  echo "Unknown targetto '$targetto'" >&4
2841             exit 1
2842             ;;
2843         esac
2844         case "$targetfrom" in
2845         scp|rcp)
2846           cat >$from <<EOF
2847 #!/bin/sh
2848 for f in \$@
2849 do
2850   $rm -f \$f
2851   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2852 done
2853 exit 0
2854 EOF
2855             ;;
2856         cp) cat >$from <<EOF
2857 #!/bin/sh
2858 for f in \$@
2859 do
2860   $rm -f \$f
2861   cp $targetdir/\$f . || exit 1
2862 done
2863 exit 0
2864 EOF
2865             ;;
2866         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2867             exit 1
2868             ;;
2869         esac
2870         if $test ! -f $run; then
2871             echo "Target 'run' script '$run' not found." >&4
2872         else
2873             $chmod a+rx $run
2874         fi
2875         if $test ! -f $to; then
2876             echo "Target 'to' script '$to' not found." >&4
2877         else
2878             $chmod a+rx $to
2879         fi
2880         if $test ! -f $from; then
2881             echo "Target 'from' script '$from' not found." >&4
2882         else
2883             $chmod a+rx $from
2884         fi
2885         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2886             exit 1
2887         fi
2888         cat >&4 <<EOF
2889 Using '$run' for remote execution,
2890 and '$from' and '$to'
2891 for remote file transfer.
2892 EOF
2893         ;;
2894 *)      run=''
2895         to=:
2896         from=:
2897         usecrosscompile='undef'
2898         targetarch=''
2899         ;;
2900 esac
2901
2902 : see whether [:lower:] and [:upper:] are supported character classes
2903 echo " "
2904 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2905 ABYZ)
2906         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2907         up='[:upper:]'
2908         low='[:lower:]'
2909         ;;
2910 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2911         # (0xd9 and 0xe2), therefore that is a nice testing point.
2912         if test "X$up" = X -o "X$low" = X; then
2913             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2914             rs) up='[A-Z]'
2915                 low='[a-z]'
2916                 ;;
2917             esac
2918         fi
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 | od -x 2>/dev/null`" in
2928             *D9E2*|*d9e2*)
2929                 echo "Hey, this might be EBCDIC." >&4
2930                 if test "X$up" = X -o "X$low" = X; then
2931                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2932                     rs) up='[A-IJ-RS-Z]'
2933                         low='[a-ij-rs-z]'
2934                         ;;
2935                     esac
2936                 fi
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                 ;;
2945             esac
2946         fi
2947 esac
2948 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2949 rs)
2950     echo "Using $up and $low to convert case." >&4
2951     ;;
2952 *)
2953     echo "I don't know how to translate letters from upper to lower case." >&4
2954     echo "Your tr is not acting any way I know of." >&4
2955     exit 1
2956     ;;
2957 esac
2958 : set up the translation script tr, must be called with ./tr of course
2959 cat >tr <<EOSC
2960 $startsh
2961 case "\$1\$2" in
2962 '[A-Z][a-z]') exec $tr '$up' '$low';;
2963 '[a-z][A-Z]') exec $tr '$low' '$up';;
2964 esac
2965 exec $tr "\$@"
2966 EOSC
2967 chmod +x tr
2968 $eunicefix tr
2969
2970 : Try to determine whether config.sh was made on this system
2971 case "$config_sh" in
2972 '')
2973 myuname=`$uname -a 2>/dev/null`
2974 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2975 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2976 # because the A-Z/a-z are not consecutive.
2977 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2978         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2979 newmyuname="$myuname"
2980 dflt=n
2981 case "$knowitall" in
2982 '')
2983         if test -f ../config.sh; then
2984                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2985                         eval "`grep myuname= ../config.sh`"
2986                 fi
2987                 if test "X$myuname" = "X$newmyuname"; then
2988                         dflt=y
2989                 fi
2990         fi
2991         ;;
2992 *) dflt=y;;
2993 esac
2994
2995 : Get old answers from old config file if Configure was run on the
2996 : same system, otherwise use the hints.
2997 hint=default
2998 cd ..
2999 if test -f config.sh; then
3000         echo " "
3001         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3002         . UU/myread
3003         case "$ans" in
3004         n*|N*) echo "OK, I'll ignore it."
3005                 mv config.sh config.sh.old
3006                 myuname="$newmyuname"
3007                 ;;
3008         *)  echo "Fetching default answers from your old config.sh file..." >&4
3009                 tmp_n="$n"
3010                 tmp_c="$c"
3011                 tmp_sh="$sh"
3012                 . ./config.sh
3013                 cp config.sh UU
3014                 n="$tmp_n"
3015                 c="$tmp_c"
3016                 : Older versions did not always set $sh.  Catch re-use of such
3017                 : an old config.sh.
3018                 case "$sh" in
3019                 '') sh="$tmp_sh" ;;
3020                 esac
3021                 hint=previous
3022                 ;;
3023         esac
3024 fi
3025 . ./UU/checkcc
3026 if test ! -f config.sh; then
3027         $cat <<EOM
3028
3029 First time through, eh?  I have some defaults handy for some systems
3030 that need some extra help getting the Configure answers right:
3031
3032 EOM
3033         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3034         dflt=''
3035         : Half the following guesses are probably wrong... If you have better
3036         : tests or hints, please send them to perlbug@perl.org
3037         : The metaconfig authors would also appreciate a copy...
3038         $test -f /irix && osname=irix
3039         $test -f /xenix && osname=sco_xenix
3040         $test -f /dynix && osname=dynix
3041         $test -f /dnix && osname=dnix
3042         $test -f /lynx.os && osname=lynxos
3043         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3044         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3045         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3046         $test -f /bin/mips && /bin/mips && osname=mips
3047         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3048                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3049         $test -d /usr/apollo/bin && osname=apollo
3050         $test -f /etc/saf/_sactab && osname=svr4
3051         $test -d /usr/include/minix && osname=minix
3052         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3053         if $test -d /MachTen -o -d /MachTen_Folder; then
3054                 osname=machten
3055                 if $test -x /sbin/version; then
3056                         osvers=`/sbin/version | $awk '{print $2}' |
3057                         $sed -e 's/[A-Za-z]$//'`
3058                 elif $test -x /usr/etc/version; then
3059                         osvers=`/usr/etc/version | $awk '{print $2}' |
3060                         $sed -e 's/[A-Za-z]$//'`
3061                 else
3062                         osvers="$2.$3"
3063                 fi
3064         fi
3065
3066         $test -f /sys/posix.dll &&
3067                 $test -f /usr/bin/what &&
3068                 set X `/usr/bin/what /sys/posix.dll` &&
3069                 $test "$3" = UWIN &&
3070                 osname=uwin &&
3071                 osvers="$5"
3072
3073         if $test -f $uname; then
3074                 set X $myuname
3075                 shift
3076
3077                 case "$5" in
3078                 fps*) osname=fps ;;
3079                 mips*)
3080                         case "$4" in
3081                         umips) osname=umips ;;
3082                         *) osname=mips ;;
3083                         esac;;
3084                 [23]100) osname=mips ;;
3085                 next*) osname=next ;;
3086                 i386*)
3087                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3088                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3089                                 osname='sco'
3090                                 osvers=$tmp
3091                         elif $test -f /etc/kconfig; then
3092                                 osname=isc
3093                                 if test "$lns" = "$ln -s"; then
3094                                         osvers=4
3095                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3096                                         osvers=3
3097                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3098                                         osvers=2
3099                                 fi
3100                         fi
3101                         tmp=''
3102                         ;;
3103                 pc*)
3104                         if test -n "$DJGPP"; then
3105                                 osname=dos
3106                                 osvers=djgpp
3107                         fi
3108                         ;;
3109                 esac
3110
3111                 case "$1" in
3112                 aix) osname=aix
3113                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3114                         case "$tmp" in
3115                         # oslevel can fail with:
3116                         # oslevel: Unable to acquire lock.
3117                         *not\ found) osvers="$4"."$3" ;;
3118                         '<3240'|'<>3240') osvers=3.2.0 ;;
3119                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3120                         '=3250'|'>3250') osvers=3.2.5 ;;
3121                         *) osvers=$tmp;;
3122                         esac
3123                         ;;
3124                 bsd386) osname=bsd386
3125                         osvers=`$uname -r`
3126                         ;;
3127                 cygwin*) osname=cygwin
3128                         osvers="$3"
3129                         ;;
3130                 *dc.osx) osname=dcosx
3131                         osvers="$3"
3132                         ;;
3133                 dnix) osname=dnix
3134                         osvers="$3"
3135                         ;;
3136                 domainos) osname=apollo
3137                         osvers="$3"
3138                         ;;
3139                 dgux)   osname=dgux
3140                         osvers="$3"
3141                         ;;
3142                 dragonfly) osname=dragonfly
3143                         osvers="$3"
3144                         ;;
3145                 dynixptx*) osname=dynixptx
3146                         osvers=`echo "$4"|sed 's/^v//'`
3147                         ;;
3148                 freebsd) osname=freebsd
3149                         osvers="$3" ;;
3150                 genix)  osname=genix ;;
3151                 gnu)    osname=gnu
3152                         osvers="$3" ;;
3153                 hp*)    osname=hpux
3154                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3155                         ;;
3156                 irix*)  osname=irix
3157                         case "$3" in
3158                         4*) osvers=4 ;;
3159                         5*) osvers=5 ;;
3160                         *)      osvers="$3" ;;
3161                         esac
3162                         ;;
3163                 linux)  osname=linux
3164                         case "$3" in
3165                         *)      osvers="$3" ;;
3166                         esac
3167                         ;;
3168                 MiNT)   osname=mint
3169                         ;;
3170                 netbsd*) osname=netbsd
3171                         osvers="$3"
3172                         ;;
3173                 news-os) osvers="$3"
3174                         case "$3" in
3175                         4*) osname=newsos4 ;;
3176                         *) osname=newsos ;;
3177                         esac
3178                         ;;
3179                 next*) osname=next ;;
3180                 nonstop-ux) osname=nonstopux ;;
3181                 openbsd) osname=openbsd
3182                         osvers="$3"
3183                         ;;
3184                 os2)    osname=os2
3185                         osvers="$4"
3186                         ;;
3187                 POSIX-BC | posix-bc ) osname=posix-bc
3188                         osvers="$3"
3189                         ;;
3190                 powerux | power_ux | powermax_os | powermaxos | \
3191                 powerunix | power_unix) osname=powerux
3192                         osvers="$3"
3193                         ;;
3194                 qnx) osname=qnx
3195                         osvers="$4"
3196                         ;;
3197                 solaris) osname=solaris
3198                         case "$3" in
3199                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3200                         *)      osvers="$3" ;;
3201                         esac
3202                         ;;
3203                 sunos) osname=sunos
3204                         case "$3" in
3205                         5*) osname=solaris
3206                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3207                         *)      osvers="$3" ;;
3208                         esac
3209                         ;;
3210                 titanos) osname=titanos
3211                         case "$3" in
3212                         1*) osvers=1 ;;
3213                         2*) osvers=2 ;;
3214                         3*) osvers=3 ;;
3215                         4*) osvers=4 ;;
3216                         *)      osvers="$3" ;;
3217                         esac
3218                         ;;
3219                 ultrix) osname=ultrix
3220                         osvers="$3"
3221                         ;;
3222                 osf1|mls+)      case "$5" in
3223                                 alpha)
3224                                         osname=dec_osf
3225                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3226                                         case "$osvers" in
3227                                         [1-9].[0-9]*) ;;
3228                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3229                                         esac
3230                                         ;;
3231                         hp*)    osname=hp_osf1  ;;
3232                         mips)   osname=mips_osf1 ;;
3233                         esac
3234                         ;;
3235                 # UnixWare 7.1.2 is known as Open UNIX 8
3236                 openunix|unixware) osname=svr5
3237                         osvers="$4"
3238                         ;;
3239                 uts)    osname=uts
3240                         osvers="$3"
3241                         ;;
3242                 vos) osvers="$3"
3243                         ;;
3244                 $2) case "$osname" in
3245                         *isc*) ;;
3246                         *freebsd*) ;;
3247                         svr*)
3248                                 : svr4.x or possibly later
3249                                 case "svr$3" in
3250                                 ${osname}*)
3251                                         osname=svr$3
3252                                         osvers=$4
3253                                         ;;
3254                                 esac
3255                                 case "$osname" in
3256                                 svr4.0)
3257                                         : Check for ESIX
3258                                         if test -f /stand/boot ; then
3259                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3260                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3261                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3262                                                         if test -n "$isesix"; then
3263                                                                 osname=esix4
3264                                                         fi
3265                                                 fi
3266                                         fi
3267                                         ;;
3268                                 esac
3269                                 ;;
3270                         *)      if test -f /etc/systemid; then
3271                                         osname=sco
3272                                         set `echo $3 | $sed 's/\./ /g'` $4
3273                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3274                                                 osvers=$1.$2.$3
3275                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3276                                                 osvers=$1.$2
3277                                         elif $test -f $src/hints/sco_$1.sh; then
3278                                                 osvers=$1
3279                                         fi
3280                                 else
3281                                         case "$osname" in
3282                                         '') : Still unknown.  Probably a generic Sys V.
3283                                                 osname="sysv"
3284                                                 osvers="$3"
3285                                                 ;;
3286                                         esac
3287                                 fi
3288                                 ;;
3289                         esac
3290                         ;;
3291                 *)      case "$osname" in
3292                         '') : Still unknown.  Probably a generic BSD.
3293                                 osname="$1"
3294                                 osvers="$3"
3295                                 ;;
3296                         esac
3297                         ;;
3298                 esac
3299         else
3300                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3301                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3302                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3303                                 osname=news_os
3304                         fi
3305                         $rm -f UU/kernel.what
3306                 elif test -d c:/. -o -n "$is_os2" ; then
3307                         set X $myuname
3308                         osname=os2
3309                         osvers="$5"
3310                 fi
3311         fi
3312
3313         case "$targetarch" in
3314         '') ;;
3315         *)  hostarch=$osname
3316             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3317             osvers=''
3318             ;;
3319         esac
3320
3321         : Now look for a hint file osname_osvers, unless one has been
3322         : specified already.
3323         case "$hintfile" in
3324         ''|' ')
3325                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3326                 : Also try without trailing minor version numbers.
3327                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3328                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3329                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3330                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3331                 case "$file" in
3332                 '') dflt=none ;;
3333                 *)  case "$osvers" in
3334                         '') dflt=$file
3335                                 ;;
3336                         *)  if $test -f $src/hints/$file.sh ; then
3337                                         dflt=$file
3338                                 elif $test -f $src/hints/$xfile.sh ; then
3339                                         dflt=$xfile
3340                                 elif $test -f $src/hints/$xxfile.sh ; then
3341                                         dflt=$xxfile
3342                                 elif $test -f $src/hints/$xxxfile.sh ; then
3343                                         dflt=$xxxfile
3344                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3345                                         dflt=$xxxxfile
3346                                 elif $test -f "$src/hints/${osname}.sh" ; then
3347                                         dflt="${osname}"
3348                                 else
3349                                         dflt=none
3350                                 fi
3351                                 ;;
3352                         esac
3353                         ;;
3354                 esac
3355                 if $test -f Policy.sh ; then
3356                         case "$dflt" in
3357                         *Policy*) ;;
3358                         none) dflt="Policy" ;;
3359                         *) dflt="Policy $dflt" ;;
3360                         esac
3361                 fi
3362                 ;;
3363         *)
3364                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3365                 ;;
3366         esac
3367
3368         if $test -f Policy.sh ; then
3369                 $cat <<EOM
3370
3371 There's also a Policy hint file available, which should make the
3372 site-specific (policy) questions easier to answer.
3373 EOM
3374
3375         fi
3376
3377         $cat <<EOM
3378
3379 You may give one or more space-separated answers, or "none" if appropriate.
3380 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3381 is a good thing.  DO NOT give a wrong version or a wrong OS.
3382
3383 EOM
3384
3385         rp="Which of these apply, if any?"
3386         . UU/myread
3387         tans=$ans
3388         for file in $tans; do
3389                 if $test X$file = XPolicy -a -f Policy.sh; then
3390                         . Policy.sh
3391                         $cat Policy.sh >> UU/config.sh
3392                 elif $test -f $src/hints/$file.sh; then
3393                         . $src/hints/$file.sh
3394                         $cat $src/hints/$file.sh >> UU/config.sh
3395                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3396                         : nothing
3397                 else
3398                         : Give one chance to correct a possible typo.
3399                         echo "$file.sh does not exist"
3400                         dflt=$file
3401                         rp="hint to use instead?"
3402                         . UU/myread
3403                         for file in $ans; do
3404                                 if $test -f "$src/hints/$file.sh"; then
3405                                         . $src/hints/$file.sh
3406                                         $cat $src/hints/$file.sh >> UU/config.sh
3407                                 elif $test X$ans = X -o X$ans = Xnone ; then
3408                                         : nothing
3409                                 else
3410                                         echo "$file.sh does not exist -- ignored."
3411                                 fi
3412                         done
3413                 fi
3414         done
3415
3416         hint=recommended
3417         : Remember our hint file for later.
3418         if $test -f "$src/hints/$file.sh" ; then
3419                 hintfile="$file"
3420         else
3421                 hintfile=''
3422         fi
3423 fi
3424 cd UU
3425 ;;
3426 *)
3427         echo " "
3428         echo "Fetching default answers from $config_sh..." >&4
3429         tmp_n="$n"
3430         tmp_c="$c"
3431         cd ..
3432         cp $config_sh config.sh 2>/dev/null
3433         chmod +w config.sh
3434         . ./config.sh
3435         cd UU
3436         cp ../config.sh .
3437         n="$tmp_n"
3438         c="$tmp_c"
3439         hint=previous
3440         ;;
3441 esac
3442 test "$override" && . ./optdef.sh
3443
3444 : Restore computed paths
3445 for file in $loclist $trylist; do
3446         eval $file="\$_$file"
3447 done
3448
3449 cat << EOM
3450
3451 Configure uses the operating system name and version to set some defaults.
3452 The default value is probably right if the name rings a bell. Otherwise,
3453 since spelling matters for me, either accept the default or answer "none"
3454 to leave it blank.
3455
3456 EOM
3457 case "$osname" in
3458         ''|' ')
3459                 case "$hintfile" in
3460                 ''|' '|none) dflt=none ;;
3461                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3462                 esac
3463                 ;;
3464         *) dflt="$osname" ;;
3465 esac
3466 rp="Operating system name?"
3467 . ./myread
3468 case "$ans" in
3469 none)  osname='' ;;
3470 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3471 esac
3472 echo " "
3473 case "$osvers" in
3474         ''|' ')
3475                 case "$hintfile" in
3476                 ''|' '|none) dflt=none ;;
3477                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3478                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3479                         case "$dflt" in
3480                         ''|' ') dflt=none ;;
3481                         esac
3482                         ;;
3483                 esac
3484                 ;;
3485         *) dflt="$osvers" ;;
3486 esac
3487 rp="Operating system version?"
3488 . ./myread
3489 case "$ans" in
3490 none)  osvers='' ;;
3491 *) osvers="$ans" ;;
3492 esac
3493
3494
3495 . ./posthint.sh
3496
3497 : who configured the system
3498 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3499 case "$cf_by" in
3500 "")
3501         cf_by=`(logname) 2>/dev/null`
3502         case "$cf_by" in
3503         "")
3504                 cf_by=`(whoami) 2>/dev/null`
3505                 case "$cf_by" in
3506                 "") cf_by=unknown ;;
3507                 esac ;;
3508         esac ;;
3509 esac
3510
3511 : set up the script used to warn in case of inconsistency
3512 cat <<EOS >whoa
3513 $startsh
3514 EOS
3515 cat <<'EOSC' >>whoa
3516 dflt=y
3517 echo " "
3518 echo "*** WHOA THERE!!! ***" >&4
3519 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3520 rp="    Keep the $hint value?"
3521 . ./myread
3522 case "$ans" in
3523 y) td=$was; tu=$was;;
3524 esac
3525 EOSC
3526
3527 : function used to set $1 to $val
3528 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3529 case "$val$was" in
3530 $define$undef) . ./whoa; eval "$var=\$td";;
3531 $undef$define) . ./whoa; eval "$var=\$tu";;
3532 *) eval "$var=$val";;
3533 esac'
3534
3535 case "$usesocks" in
3536 $define|true|[yY]*)     dflt='y';;
3537 *) dflt='n';;
3538 esac
3539 cat <<EOM
3540
3541 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3542 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3543 to use the PerlIO abstraction layer, this will be implicitly selected.
3544
3545 If this doesn't make any sense to you, just accept the default '$dflt'.
3546 EOM
3547 rp='Build Perl for SOCKS?'
3548 . ./myread
3549 case "$ans" in
3550 y|Y)    val="$define" ;;     
3551 *)      val="$undef" ;;
3552 esac
3553 set usesocks
3554 eval $setvar
3555
3556 case "$usesocks" in
3557 $define|true|[yY]*) useperlio="$define";;
3558 esac
3559
3560 case "$useperlio" in
3561 $define|true|[yY]*|'')  dflt='y';;
3562 *) dflt='n';;
3563 esac
3564 cat <<EOM
3565
3566 Previous version of $package used the standard IO mechanisms as
3567 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3568 alternate IO mechanisms via the PerlIO abstraction layer, but the
3569 stdio mechanism is still available if needed.  The abstraction layer
3570 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3571 Using PerlIO with sfio may cause problems with some extension modules.
3572
3573 If this doesn't make any sense to you, just accept the default '$dflt'.
3574 EOM
3575 rp='Use the PerlIO abstraction layer?'
3576 . ./myread
3577 case "$ans" in
3578 y|Y) 
3579         val="$define"
3580         ;;
3581 *)      
3582         echo "Ok, doing things the stdio way."
3583         val="$undef"
3584         ;;
3585 esac
3586 set useperlio
3587 eval $setvar 
3588
3589 case "$usesocks" in
3590 $define|true|[yY]*)
3591         case "$useperlio" in
3592         $define|true|[yY]*) ;;
3593         *)      cat >&4 <<EOM
3594
3595 You are using the SOCKS proxy protocol library which means that you
3596 should also use the PerlIO layer.  You may be headed for trouble.
3597
3598 EOM
3599                 ;;
3600         esac
3601         ;;
3602 esac
3603
3604         
3605 case "$usethreads" in
3606 $define|true|[yY]*)     dflt='y';;
3607 *)     # Catch case where user specified ithreads or 5005threads but
3608        # forgot -Dusethreads (A.D. 4/2002)
3609        case "$useithreads$use5005threads" in
3610        *$define*)      
3611                 case "$useperlio" in
3612                 "$define")      dflt='y' ;;
3613                 *)              dflt='n' ;;
3614                 esac
3615                 ;;
3616        *)       dflt='n';;
3617        esac
3618        ;;
3619 esac
3620 cat <<EOM
3621
3622 Perl can be built to take advantage of threads on some systems.
3623 To do so, Configure can be run with -Dusethreads.
3624
3625 Note that Perl built with threading support runs slightly slower
3626 and uses more memory than plain Perl. The current implementation
3627 is believed to be stable, but it is fairly new, and so should be
3628 treated with caution.
3629
3630 If this doesn't make any sense to you, just accept the default '$dflt'.
3631 EOM
3632 rp='Build a threading Perl?'
3633 . ./myread
3634 case "$ans" in
3635 y|Y)    val="$define" ;;
3636 *)      val="$undef" ;;
3637 esac
3638 set usethreads
3639 eval $setvar
3640
3641 case "$usethreads" in
3642 $define)
3643         $cat <<EOM
3644
3645 Since release 5.6, Perl has had two different threading implementations,
3646 the newer interpreter-based version (ithreads) with one interpreter per
3647 thread, and the older 5.005 version (5005threads).
3648 The 5005threads version is effectively unmaintained and will probably be
3649 removed in Perl 5.10, so there should be no need to build a Perl using it
3650 unless needed for backwards compatibility with some existing 5.005threads
3651 code.
3652
3653 EOM
3654         : Default to ithreads unless overridden on command line or with
3655         : old config.sh
3656         dflt='y'
3657         case "$use5005threads" in
3658                 $define|true|[yY]*) dflt='n';;
3659         esac
3660         case "$useithreads" in
3661                 $undef|false|[nN]*) dflt='n';;
3662         esac
3663         rp='Use the newer interpreter-based ithreads?'
3664         . ./myread
3665         case "$ans" in
3666         y|Y)    val="$define" ;;
3667         *)      val="$undef" ;;
3668         esac
3669         set useithreads
3670         eval $setvar
3671         : Now set use5005threads to the opposite value.
3672         case "$useithreads" in
3673         $define) val="$undef" ;;
3674         *) val="$define" ;;
3675         esac
3676         set use5005threads
3677         eval $setvar
3678         ;;
3679 *)
3680         useithreads="$undef"
3681         use5005threads="$undef"
3682         ;;
3683 esac
3684
3685 case "$useithreads$use5005threads" in
3686 "$define$define")
3687         $cat >&4 <<EOM
3688
3689 You cannot have both the ithreads and the 5.005 threads enabled
3690 at the same time.  Disabling the 5.005 threads since they are
3691 much less stable than the ithreads.
3692
3693 EOM
3694         use5005threads="$undef"
3695         ;;
3696 esac
3697
3698 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3699         cat >&4 <<EOF
3700 ***
3701 *** To build with ithreads you must also use the PerlIO layer.
3702 *** Cannot continue, aborting.
3703 ***
3704 EOF
3705         exit 1
3706 fi
3707
3708 case "$d_oldpthreads" in
3709 '')     : Configure tests would be welcome here.  For now, assume undef.
3710         val="$undef" ;;
3711 *)      val="$d_oldpthreads" ;;
3712 esac
3713 set d_oldpthreads
3714 eval $setvar
3715
3716
3717 : Look for a hint-file generated 'call-back-unit'.  If the
3718 : user has specified that a threading perl is to be built,
3719 : we may need to set or change some other defaults.
3720 if $test -f usethreads.cbu; then
3721     echo "Your platform has some specific hints regarding threaded builds, using them..."
3722     . ./usethreads.cbu
3723 else
3724     case "$usethreads" in
3725         "$define"|true|[yY]*)
3726                 $cat <<EOM
3727 (Your platform does not have any specific hints for threaded builds.
3728  Assuming POSIX threads, then.)
3729 EOM
3730         ;;
3731     esac
3732 fi
3733
3734 cat <<EOM
3735
3736 Perl can be built so that multiple Perl interpreters can coexist
3737 within the same Perl executable.
3738 EOM
3739
3740 case "$useithreads" in
3741 $define)
3742         cat <<EOM
3743 This multiple interpreter support is required for interpreter-based threads.
3744 EOM
3745         val="$define"
3746         ;;
3747 *)      case "$usemultiplicity" in
3748         $define|true|[yY]*)     dflt='y';;
3749         *) dflt='n';;
3750         esac
3751         echo " "
3752         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3753         rp='Build Perl for multiplicity?'
3754         . ./myread
3755         case "$ans" in
3756         y|Y)    val="$define" ;;
3757         *)      val="$undef" ;;
3758         esac
3759         ;;
3760 esac
3761 set usemultiplicity
3762 eval $setvar
3763
3764
3765 case "$usemorebits" in
3766 "$define"|true|[yY]*)
3767         use64bitint="$define"
3768         uselongdouble="$define"
3769         usemorebits="$define"
3770         ;;
3771 *)      usemorebits="$undef"
3772         ;;
3773 esac
3774
3775 : make some quick guesses about what we are up against
3776 echo " "
3777 $echo $n "Hmm...  $c"
3778 echo exit 1 >bsd
3779 echo exit 1 >usg
3780 echo exit 1 >v7
3781 echo exit 1 >osf1
3782 echo exit 1 >eunice
3783 echo exit 1 >xenix
3784 echo exit 1 >venix
3785 echo exit 1 >os2
3786 d_bsd="$undef"
3787 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3788 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3789 then
3790         echo "Looks kind of like an OSF/1 system, but we'll see..."
3791         echo exit 0 >osf1
3792 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3793         xxx=`./loc addbib blurfl $pth`
3794         if $test -f $xxx; then
3795         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3796                 echo exit 0 >bsd
3797                 echo exit 0 >usg
3798         else
3799                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3800                         echo "Looks kind of like an extended USG system, but we'll see..."
3801                 else
3802                         echo "Looks kind of like a USG system, but we'll see..."
3803                 fi
3804                 echo exit 0 >usg
3805         fi
3806 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3807         echo "Looks kind of like a BSD system, but we'll see..."
3808         d_bsd="$define"
3809         echo exit 0 >bsd
3810 else
3811         echo "Looks kind of like a Version 7 system, but we'll see..."
3812         echo exit 0 >v7
3813 fi
3814 case "$eunicefix" in
3815 *unixtovms*)
3816         $cat <<'EOI'
3817 There is, however, a strange, musty smell in the air that reminds me of
3818 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3819 EOI
3820         echo exit 0 >eunice
3821         d_eunice="$define"
3822 : it so happens the Eunice I know will not run shell scripts in Unix format
3823         ;;
3824 *)
3825         echo " "
3826         echo "Congratulations.  You aren't running Eunice."
3827         d_eunice="$undef"
3828         ;;
3829 esac
3830 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3831 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3832 : semicolon as a patch separator
3833 case "$p_" in
3834 :) ;;
3835 *)
3836         $cat <<'EOI'
3837 I have the feeling something is not exactly right, however...don't tell me...
3838 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3839 (Or you may be running DOS with DJGPP.)
3840 EOI
3841         echo exit 0 >os2
3842         ;;
3843 esac
3844 if test -f /xenix; then
3845         echo "Actually, this looks more like a XENIX system..."
3846         echo exit 0 >xenix
3847         d_xenix="$define"
3848 else
3849         echo " "
3850         echo "It's not Xenix..."
3851         d_xenix="$undef"
3852 fi
3853 chmod +x xenix
3854 $eunicefix xenix
3855 if test -f /venix; then
3856         echo "Actually, this looks more like a VENIX system..."
3857         echo exit 0 >venix
3858 else
3859         echo " "
3860         if ./xenix; then
3861                 : null
3862         else
3863                 echo "Nor is it Venix..."
3864         fi
3865 fi
3866 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3867 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3868 $rm -f foo
3869
3870 case "$cc" in
3871 '') dflt=cc;;
3872 *) dflt="$cc";;
3873 esac
3874 rp="Use which C compiler?"
3875 . ./myread
3876 cc="$ans"
3877
3878 : See if they have not cc but they do have gcc
3879 . ./trygcc
3880 : Look for a hint-file generated 'call-back-unit'.  Now that the
3881 : user has specified the compiler, we may need to set or change some
3882 : other defaults.
3883 if $test -f cc.cbu; then
3884     . ./cc.cbu
3885 fi
3886 . ./checkcc
3887
3888 echo " "
3889 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3890 $cat >try.c <<EOM
3891 #include <stdio.h>
3892 int main() {
3893 #ifdef __GNUC__
3894 #ifdef __VERSION__
3895         printf("%s\n", __VERSION__);
3896 #else
3897         printf("%s\n", "1");
3898 #endif
3899 #endif
3900         return(0);
3901 }
3902 EOM
3903 if $cc -o try $ccflags $ldflags try.c; then
3904         gccversion=`$run ./try`
3905         case "$gccversion" in
3906         '') echo "You are not using GNU cc." ;;
3907         *)  echo "You are using GNU cc $gccversion."
3908             ccname=gcc
3909             ;;
3910         esac
3911 else
3912         echo " "
3913         echo "*** WHOA THERE!!! ***" >&4
3914         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3915         case "$knowitall" in
3916         '')
3917         echo "    You'd better start hunting for one and let me know about it." >&4
3918                 exit 1
3919                 ;;
3920         esac
3921 fi
3922 $rm -f try try.*
3923 case "$gccversion" in
3924 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3925 esac
3926 case "$gccversion" in
3927 '') gccosandvers='' ;;
3928 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3929    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3930    gccshortvers=''
3931    case "$gccosandvers" in
3932    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3933    $osname$osvers) ;; # looking good
3934    $osname*) cat <<EOM >&4
3935
3936 *** WHOA THERE!!! ***
3937
3938     Your gcc has not been compiled for the exact release of
3939     your operating system ($gccosandvers versus $osname$osvers).
3940
3941     In general it is a good idea to keep gcc synchronized with
3942     the operating system because otherwise serious problems
3943     may ensue when trying to compile software, like Perl.
3944
3945     I'm trying to be optimistic here, though, and will continue.
3946     If later during the configuration and build icky compilation
3947     problems appear (headerfile conflicts being the most common
3948     manifestation), I suggest reinstalling the gcc to match
3949     your operating system release.
3950
3951 EOM
3952       ;;
3953    *) gccosandvers='' ;; # failed to parse, better be silent
3954    esac
3955    ;;
3956 esac
3957 case "$ccname" in
3958 '') ccname="$cc" ;;
3959 esac
3960
3961 # gcc 3.* complain about adding -Idirectories that they already know about,
3962 # so we will take those off from locincpth.
3963 case "$gccversion" in
3964 3*)
3965     echo "main(){}">try.c
3966     for incdir in $locincpth; do
3967        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3968              grep '^c[cp]p*[01]: warning: changing search order '`
3969        if test "X$warn" != X; then
3970            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3971        fi
3972     done
3973     $rm -f try try.*
3974 esac
3975
3976 : decide how portable to be.  Allow command line overrides.
3977 case "$d_portable" in
3978 "$undef") ;;
3979 *)      d_portable="$define" ;;
3980 esac
3981
3982 : set up shell script to do ~ expansion
3983 cat >filexp <<EOSS
3984 $startsh
3985 : expand filename
3986 case "\$1" in
3987  ~/*|~)
3988         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3989         ;;
3990  ~*)
3991         if $test -f /bin/csh; then
3992                 /bin/csh -f -c "glob \$1"
3993                 failed=\$?
3994                 echo ""
3995                 exit \$failed
3996         else
3997                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3998                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3999                 if $test ! -d "\$dir"; then
4000                         me=\`basename \$0\`
4001                         echo "\$me: can't locate home directory for: \$name" >&2
4002                         exit 1
4003                 fi
4004                 case "\$1" in
4005                 */*)
4006                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4007                         ;;
4008                 *)
4009                         echo \$dir
4010                         ;;
4011                 esac
4012         fi
4013         ;;
4014 *)
4015         echo \$1
4016         ;;
4017 esac
4018 EOSS
4019 chmod +x filexp
4020 $eunicefix filexp
4021
4022 : now set up to get a file name
4023 cat <<EOS >getfile
4024 $startsh
4025 EOS
4026 cat <<'EOSC' >>getfile
4027 tilde=''
4028 fullpath=''
4029 already=''
4030 skip=''
4031 none_ok=''
4032 exp_file=''
4033 nopath_ok=''
4034 orig_rp="$rp"
4035 orig_dflt="$dflt"
4036 case "$gfpth" in
4037 '') gfpth='.' ;;
4038 esac
4039
4040 case "$fn" in
4041 *\(*)
4042         : getfile will accept an answer from the comma-separated list
4043         : enclosed in parentheses even if it does not meet other criteria.
4044         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4045         fn=`echo $fn | sed 's/(.*)//'`
4046         ;;
4047 esac
4048
4049 case "$fn" in
4050 *:*)
4051         loc_file=`expr $fn : '.*:\(.*\)'`
4052         fn=`expr $fn : '\(.*\):.*'`
4053         ;;
4054 esac
4055
4056 case "$fn" in
4057 *~*) tilde=true;;
4058 esac
4059 case "$fn" in
4060 */*) fullpath=true;;
4061 esac
4062 case "$fn" in
4063 *+*) skip=true;;
4064 esac
4065 case "$fn" in
4066 *n*) none_ok=true;;
4067 esac
4068 case "$fn" in
4069 *e*) exp_file=true;;
4070 esac
4071 case "$fn" in
4072 *p*) nopath_ok=true;;
4073 esac
4074
4075 case "$fn" in
4076 *f*) type='File';;
4077 *d*) type='Directory';;
4078 *l*) type='Locate';;
4079 esac
4080
4081 what="$type"
4082 case "$what" in
4083 Locate) what='File';;
4084 esac
4085
4086 case "$exp_file" in
4087 '')
4088         case "$d_portable" in
4089         "$define") ;;
4090         *) exp_file=true;;
4091         esac
4092         ;;
4093 esac
4094
4095 cd ..
4096 while test "$type"; do
4097         redo=''
4098         rp="$orig_rp"
4099         dflt="$orig_dflt"
4100         case "$tilde" in
4101         true) rp="$rp (~name ok)";;
4102         esac
4103         . UU/myread
4104         if test -f UU/getfile.ok && \
4105                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4106         then
4107                 value="$ans"
4108                 ansexp="$ans"
4109                 break
4110         fi
4111         case "$ans" in
4112         none)
4113                 value=''
4114                 ansexp=''
4115                 case "$none_ok" in
4116                 true) type='';;
4117                 esac
4118                 ;;
4119         *)
4120                 case "$tilde" in
4121                 '') value="$ans"
4122                         ansexp="$ans";;
4123                 *)
4124                         value=`UU/filexp $ans`
4125                         case $? in
4126                         0)
4127                                 if test "$ans" != "$value"; then
4128                                         echo "(That expands to $value on this system.)"
4129                                 fi
4130                                 ;;
4131                         *) value="$ans";;
4132                         esac
4133                         ansexp="$value"
4134                         case "$exp_file" in
4135                         '') value="$ans";;
4136                         esac
4137                         ;;
4138                 esac
4139                 case "$fullpath" in
4140                 true)
4141                         case "$ansexp" in
4142                         /*) value="$ansexp" ;;
4143                         [a-zA-Z]:/*) value="$ansexp" ;;
4144                         *)
4145                                 redo=true
4146                                 case "$already" in
4147                                 true)
4148                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4149                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4150                                         ;;
4151                                 *)
4152                                 echo "Please give a full path name, starting with slash." >&4
4153                                         case "$tilde" in
4154                                         true)
4155                                 echo "Note that using ~name is ok provided it expands well." >&4
4156                                                 already=true
4157                                                 ;;
4158                                         esac
4159                                 esac
4160                                 ;;
4161                         esac
4162                         ;;
4163                 esac
4164                 case "$redo" in
4165                 '')
4166                         case "$type" in
4167                         File)
4168                                 for fp in $gfpth; do
4169                                         if test "X$fp" = X.; then
4170                                             pf="$ansexp"
4171                                         else    
4172                                             pf="$fp/$ansexp"
4173                                         fi
4174                                         if test -f "$pf"; then
4175                                                 type=''
4176                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4177                                         then
4178                                                 echo "($value is not a plain file, but that's ok.)"
4179                                                 type=''
4180                                         fi
4181                                         if test X"$type" = X; then
4182                                             value="$pf"
4183                                             break
4184                                         fi
4185                                 done
4186                                 ;;
4187                         Directory)
4188                                 for fp in $gfpth; do
4189                                         if test "X$fp" = X.; then
4190                                             dir="$ans"
4191                                             direxp="$ansexp"
4192                                         else    
4193                                             dir="$fp/$ansexp"
4194                                             direxp="$fp/$ansexp"
4195                                         fi
4196                                         if test -d "$direxp"; then
4197                                                 type=''
4198                                                 value="$dir"
4199                                                 break
4200                                         fi
4201                                 done
4202                                 ;;
4203                         Locate)
4204                                 if test -d "$ansexp"; then
4205                                         echo "(Looking for $loc_file in directory $value.)"
4206                                         value="$value/$loc_file"
4207                                         ansexp="$ansexp/$loc_file"
4208                                 fi
4209                                 if test -f "$ansexp"; then
4210                                         type=''
4211                                 fi
4212                                 case "$nopath_ok" in
4213                                 true)   case "$value" in
4214                                         */*) ;;
4215                                         *)      echo "Assuming $value will be in people's path."
4216                                                 type=''
4217                                                 ;;
4218                                         esac
4219                                         ;;
4220                                 esac
4221                                 ;;
4222                         esac
4223
4224                         case "$skip" in
4225                         true) type='';
4226                         esac
4227
4228                         case "$type" in
4229                         '') ;;
4230                         *)
4231                                 if test "$fastread" = yes; then
4232                                         dflt=y
4233                                 else
4234                                         dflt=n
4235                                 fi
4236                                 rp="$what $value doesn't exist.  Use that name anyway?"
4237                                 . UU/myread
4238                                 dflt=''
4239                                 case "$ans" in
4240                                 y*) type='';;
4241                                 *) echo " ";;
4242                                 esac
4243                                 ;;
4244                         esac
4245                         ;;
4246                 esac
4247                 ;;
4248         esac
4249 done
4250 cd UU
4251 ans="$value"
4252 rp="$orig_rp"
4253 dflt="$orig_dflt"
4254 rm -f getfile.ok
4255 test "X$gfpthkeep" != Xy && gfpth=""
4256 EOSC
4257
4258 : What should the include directory be ?
4259 echo " "
4260 $echo $n "Hmm...  $c"
4261 dflt='/usr/include'
4262 incpath=''
4263 mips_type=''
4264 if $test -f /bin/mips && /bin/mips; then
4265         echo "Looks like a MIPS system..."
4266         $cat >usr.c <<'EOCP'
4267 #ifdef SYSTYPE_BSD43
4268 /bsd43
4269 #endif
4270 EOCP
4271         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4272                 dflt='/bsd43/usr/include'
4273                 incpath='/bsd43'
4274                 mips_type='BSD 4.3'
4275         else
4276                 mips_type='System V'
4277         fi
4278         $rm -f usr.c usr.out
4279         echo "and you're compiling with the $mips_type compiler and libraries."
4280         xxx_prompt=y
4281         echo "exit 0" >mips
4282 else
4283         echo "Doesn't look like a MIPS system."
4284         xxx_prompt=n
4285         echo "exit 1" >mips
4286 fi
4287 chmod +x mips
4288 $eunicefix mips
4289 case "$usrinc" in
4290 '') ;;
4291 *) dflt="$usrinc";;
4292 esac
4293 case "$xxx_prompt" in
4294 y)      fn=d/
4295         echo " "
4296         rp='Where are the include files you want to use?'
4297         . ./getfile
4298         usrinc="$ans"
4299         ;;
4300 *)      usrinc="$dflt"
4301         ;;
4302 esac
4303
4304 : see how we invoke the C preprocessor
4305 echo " "
4306 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4307 cat <<'EOT' >testcpp.c
4308 #define ABC abc
4309 #define XYZ xyz
4310 ABC.XYZ
4311 EOT
4312 cd ..
4313 if test ! -f cppstdin; then
4314         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4315                 # AIX cc -E doesn't show the absolute headerfile
4316                 # locations but we'll cheat by using the -M flag.
4317                 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
4318         else
4319                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4320         fi
4321 else
4322         echo "Keeping your $hint cppstdin wrapper."
4323 fi
4324 chmod 755 cppstdin
4325 wrapper=`pwd`/cppstdin
4326 ok='false'
4327 cd UU
4328
4329 if $test "X$cppstdin" != "X" && \
4330         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4331         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4332 then
4333         echo "You used to use $cppstdin $cppminus so we'll use that again."
4334         case "$cpprun" in
4335         '') echo "But let's see if we can live without a wrapper..." ;;
4336         *)
4337                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4338                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4339                 then
4340                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4341                         ok='true'
4342                 else
4343                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4344                 fi
4345                 ;;
4346         esac
4347 else
4348         case "$cppstdin" in
4349         '') ;;
4350         *)
4351                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4352                 ;;
4353         esac
4354 fi
4355
4356 if $ok; then
4357         : nothing
4358 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4359         $cc -E <testcpp.c >testcpp.out 2>&1; \
4360         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4361         echo "Yup, it does."
4362         x_cpp="$cc -E"
4363         x_minus='';
4364 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4365         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4366         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4367         echo "Yup, it does."
4368         x_cpp="$cc -E"
4369         x_minus='-';
4370 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4371         $cc -P <testcpp.c >testcpp.out 2>&1; \
4372         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4373         echo "Yipee, that works!"
4374         x_cpp="$cc -P"
4375         x_minus='';
4376 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4377         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4378         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4379         echo "At long last!"
4380         x_cpp="$cc -P"
4381         x_minus='-';
4382 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4383         $cpp <testcpp.c >testcpp.out 2>&1; \
4384         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4385         echo "It works!"
4386         x_cpp="$cpp"
4387         x_minus='';
4388 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4389         $cpp - <testcpp.c >testcpp.out 2>&1; \
4390         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4391         echo "Hooray, it works!  I was beginning to wonder."
4392         x_cpp="$cpp"
4393         x_minus='-';
4394 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4395         $wrapper <testcpp.c >testcpp.out 2>&1; \
4396         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4397         x_cpp="$wrapper"
4398         x_minus=''
4399         echo "Eureka!"
4400 else
4401         dflt=''
4402         rp="No dice.  I can't find a C preprocessor.  Name one:"
4403         . ./myread
4404         x_cpp="$ans"
4405         x_minus=''
4406         $x_cpp <testcpp.c >testcpp.out 2>&1
4407         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4408                 echo "OK, that will do." >&4
4409         else
4410 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4411                 exit 1
4412         fi
4413 fi
4414
4415 case "$ok" in
4416 false)
4417         cppstdin="$x_cpp"
4418         cppminus="$x_minus"
4419         cpprun="$x_cpp"
4420         cpplast="$x_minus"
4421         set X $x_cpp
4422         shift
4423         case "$1" in
4424         "$cpp")
4425                 echo "Perhaps can we force $cc -E using a wrapper..."
4426                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4427                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4428                 then
4429                         echo "Yup, we can."
4430                         cppstdin="$wrapper"
4431                         cppminus='';
4432                 else
4433                         echo "Nope, we'll have to live without it..."
4434                 fi
4435                 ;;
4436         esac
4437         case "$cpprun" in
4438         "$wrapper")
4439                 cpprun=''
4440                 cpplast=''
4441                 ;;
4442         esac
4443         ;;
4444 esac
4445
4446 case "$cppstdin" in
4447 "$wrapper"|'cppstdin') ;;
4448 *) $rm -f $wrapper;;
4449 esac
4450 $rm -f testcpp.c testcpp.out
4451
4452 : Set private lib path
4453 case "$plibpth" in
4454 '') if ./mips; then
4455                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4456         fi;;
4457 esac
4458 case "$libpth" in
4459 ' ') dlist='';;
4460 '') dlist="$loclibpth $plibpth $glibpth";;
4461 *) dlist="$libpth";;
4462 esac
4463
4464 : Now check and see which directories actually exist, avoiding duplicates
4465 libpth=''
4466 for xxx in $dlist
4467 do
4468     if $test -d $xxx; then
4469                 case " $libpth " in
4470                 *" $xxx "*) ;;
4471                 *) libpth="$libpth $xxx";;
4472                 esac
4473     fi
4474 done
4475 $cat <<'EOM'
4476
4477 Some systems have incompatible or broken versions of libraries.  Among
4478 the directories listed in the question below, please remove any you
4479 know not to be holding relevant libraries, and add any that are needed.
4480 Say "none" for none.
4481
4482 EOM
4483 case "$libpth" in
4484 '') dflt='none';;
4485 *)
4486         set X $libpth
4487         shift
4488         dflt=${1+"$@"}
4489         ;;
4490 esac
4491 rp="Directories to use for library searches?"
4492 . ./myread
4493 case "$ans" in
4494 none) libpth=' ';;
4495 *) libpth="$ans";;
4496 esac
4497
4498 : compute shared library extension
4499 case "$so" in
4500 '')
4501         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4502                 dflt='sl'
4503         else
4504                 dflt='so'
4505         fi
4506         ;;
4507 *) dflt="$so";;
4508 esac
4509 $cat <<EOM
4510
4511 On some systems, shared libraries may be available.  Answer 'none' if
4512 you want to suppress searching of shared libraries for the remainder
4513 of this configuration.
4514
4515 EOM
4516 rp='What is the file extension used for shared libraries?'
4517 . ./myread
4518 so="$ans"
4519
4520 : Define several unixisms.
4521 : Hints files or command line option can be used to override them.
4522 : The convoluted testing is in case hints files set either the old
4523 : or the new name.
4524 case "$_exe" in
4525 '')     case "$exe_ext" in
4526         '')     ;;
4527         *)      _exe="$exe_ext" ;;
4528         esac
4529         ;;
4530 esac
4531 case "$_a" in
4532 '')     case "$lib_ext" in
4533     '') _a='.a';;
4534         *)      _a="$lib_ext" ;;
4535         esac
4536         ;;
4537 esac
4538 case "$_o" in
4539 '') case "$obj_ext" in
4540         '')     _o='.o';;
4541         *)      _o="$obj_ext";;
4542         esac
4543         ;;
4544 esac
4545 case "$p_" in
4546 '') case "$path_sep" in
4547         '')     p_=':';;
4548         *)      p_="$path_sep";;
4549         esac
4550         ;;
4551 esac
4552 exe_ext=$_exe
4553 lib_ext=$_a
4554 obj_ext=$_o
4555 path_sep=$p_
4556
4557 : Which makefile gets called first.  This is used by make depend.
4558 case "$firstmakefile" in
4559 '') firstmakefile='makefile';;
4560 esac
4561
4562 case "$ccflags" in
4563 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4564 esac
4565
4566 case "$uselongdouble" in
4567 $define|true|[yY]*)     dflt='y';;
4568 *) dflt='n';;
4569 esac
4570 cat <<EOM
4571
4572 Perl can be built to take advantage of long doubles which
4573 (if available) may give more accuracy and range for floating point numbers.
4574
4575 If this doesn't make any sense to you, just accept the default '$dflt'.
4576 EOM
4577 rp='Try to use long doubles if available?'
4578 . ./myread
4579 case "$ans" in
4580 y|Y)    val="$define"   ;;
4581 *)      val="$undef"    ;;
4582 esac
4583 set uselongdouble
4584 eval $setvar
4585
4586 case "$uselongdouble" in
4587 true|[yY]*) uselongdouble="$define" ;;
4588 esac
4589
4590 : Look for a hint-file generated 'call-back-unit'.  If the
4591 : user has specified that long doubles should be used,
4592 : we may need to set or change some other defaults.
4593 if $test -f uselongdouble.cbu; then
4594     echo "Your platform has some specific hints regarding long doubles, using them..."
4595     . ./uselongdouble.cbu
4596 else
4597     case "$uselongdouble" in
4598         $define)
4599                 $cat <<EOM
4600 (Your platform does not have any specific hints for long doubles.)
4601 EOM
4602         ;;
4603     esac
4604 fi
4605
4606 : Looking for optional libraries
4607 echo " "
4608 echo "Checking for optional libraries..." >&4
4609 case "$libs" in
4610 ' '|'') dflt='';;
4611 *) dflt="$libs";;
4612 esac
4613 case "$libswanted" in
4614 '') libswanted='c_s';;
4615 esac
4616 case "$usesocks" in
4617 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4618 esac
4619 libsfound=''
4620 libsfiles=''
4621 libsdirs=''
4622 libspath=''
4623 for thisdir in $libpth $xlibpth; do
4624   test -d $thisdir && libspath="$libspath $thisdir"
4625 done
4626 for thislib in $libswanted; do
4627         for thisdir in $libspath; do
4628             xxx=''
4629             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4630                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4631                 $test -f "$xxx" && eval $libscheck
4632                 $test -f "$xxx" && libstyle=shared
4633             fi
4634             if test ! -f "$xxx"; then
4635                 xxx=$thisdir/lib$thislib.$so
4636                 $test -f "$xxx" && eval $libscheck
4637                 $test -f "$xxx" && libstyle=shared
4638             fi  
4639             if test ! -f "$xxx"; then
4640                 xxx=$thisdir/lib$thislib$_a
4641                 $test -f "$xxx" && eval $libscheck
4642                 $test -f "$xxx" && libstyle=static
4643             fi
4644             if test ! -f "$xxx"; then
4645                 xxx=$thisdir/$thislib$_a
4646                 $test -f "$xxx" && eval $libscheck
4647                 $test -f "$xxx" && libstyle=static
4648             fi
4649             if test ! -f "$xxx"; then
4650                 xxx=$thisdir/lib${thislib}_s$_a
4651                 $test -f "$xxx" && eval $libscheck
4652                 $test -f "$xxx" && libstyle=static
4653                 $test -f "$xxx" && thislib=${thislib}_s
4654             fi
4655             if test ! -f "$xxx"; then
4656                 xxx=$thisdir/Slib$thislib$_a
4657                 $test -f "$xxx" && eval $libscheck
4658                 $test -f "$xxx" && libstyle=static
4659             fi
4660             if $test -f "$xxx"; then
4661                 case "$libstyle" in
4662                 shared) echo "Found -l$thislib (shared)." ;;
4663                 static) echo "Found -l$thislib." ;;
4664                 *)      echo "Found -l$thislib ($libstyle)." ;;
4665                 esac
4666                 case " $dflt " in
4667                 *"-l$thislib "*);;
4668                 *) dflt="$dflt -l$thislib"
4669                    libsfound="$libsfound $xxx"
4670                    yyy=`basename $xxx`
4671                    libsfiles="$libsfiles $yyy"
4672                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4673                    case " $libsdirs " in
4674                    *" $yyy "*) ;;
4675                    *) libsdirs="$libsdirs $yyy" ;;
4676                    esac
4677                    ;;
4678                 esac
4679                 break
4680             fi  
4681         done
4682         if $test ! -f "$xxx"; then
4683             echo "No -l$thislib."
4684         fi
4685 done
4686 set X $dflt
4687 shift
4688 dflt="$*"
4689 case "$libs" in
4690 '') dflt="$dflt";;
4691 *) dflt="$libs";;
4692 esac
4693 case "$dflt" in
4694 ' '|'') dflt='none';;
4695 esac
4696
4697 $cat <<EOM
4698
4699 In order to compile $package on your machine, a number of libraries
4700 are usually needed.  Include any other special libraries here as well.
4701 Say "none" for none.  The default list is almost always right.
4702 EOM
4703
4704 echo " "
4705 rp="What libraries to use?"
4706 . ./myread
4707 case "$ans" in
4708 none) libs=' ';;
4709 *) libs="$ans";;
4710 esac
4711
4712 : determine optimization, if desired, or use for debug flag also
4713 case "$optimize" in
4714 ' '|$undef) dflt='none';;
4715 '') dflt='-O';;
4716 *) dflt="$optimize";;
4717 esac
4718 $cat <<EOH
4719
4720 By default, $package compiles with the -O flag to use the optimizer.
4721 Alternately, you might want to use the symbolic debugger, which uses
4722 the -g flag (on traditional Unix systems).  Either flag can be
4723 specified here.  To use neither flag, specify the word "none".
4724
4725 EOH
4726 rp="What optimizer/debugger flag should be used?"
4727 . ./myread
4728 optimize="$ans"
4729 case "$optimize" in
4730 'none') optimize=" ";;
4731 esac
4732
4733 dflt=''
4734 : We will not override a previous value, but we might want to
4735 : augment a hint file
4736 case "$hint" in
4737 default|recommended)
4738         case "$gccversion" in
4739         1*) dflt='-fpcc-struct-return' ;;
4740         esac
4741         case "$optimize" in
4742         *-g*) dflt="$dflt -DDEBUGGING";;
4743         esac
4744         case "$gccversion" in
4745         2*) if test -d /etc/conf/kconfig.d &&
4746                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4747                 then
4748                         # Interactive Systems (ISC) POSIX mode.
4749                         dflt="$dflt -posix"
4750                 fi
4751                 ;;
4752         esac
4753         case "$gccversion" in
4754         1*) ;;
4755         2.[0-8]*) ;;
4756         ?*)     echo " "
4757                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4758                 echo 'int main(void) { return 0; }' > gcctest.c
4759                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4760                         echo "Yes, it does." 2>&1
4761                         case "$ccflags" in
4762                         *strict-aliasing*)
4763                                 echo "Leaving current flags $ccflags alone." 2>&1
4764                                 ;;
4765                         *) dflt="$dflt -fno-strict-aliasing" ;;
4766                         esac
4767                 else
4768                         echo "Nope, it doesn't, but that's ok." 2>&1
4769                 fi
4770                 ;;
4771         esac
4772         # For gcc, adding -pipe speeds up compilations for some, but apparently
4773         # some assemblers can't read from stdin.  (It also slows down compilations
4774         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4775         case "$gccversion" in
4776         ?*)     echo " "
4777                 echo "Checking if your compiler accepts -pipe" 2>&1
4778                 echo 'int main(void) { return 0; }' > gcctest.c
4779                 if $cc -pipe -o gcctest gcctest.c; then
4780                         echo "Yes, it does." 2>&1
4781                         case "$ccflags" in
4782                         *-pipe*)
4783                                 echo "Leaving current flags $ccflags alone." 2>&1
4784                                 ;;
4785                         *) dflt="$dflt -pipe" ;;
4786                         esac
4787                 else
4788                         echo "Nope, it doesn't, but that's ok." 2>&1
4789                 fi
4790
4791                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4792                 echo 'int main(void) { return 0; }' > gcctest.c
4793                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4794                         echo "Yes, it does." 2>&1
4795                         case "$ccflags" in
4796                         *-Wdeclaration-after-statement*)
4797                                 echo "Leaving current flags $ccflags alone." 2>&1
4798                                 ;;
4799                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4800                         esac
4801                 else
4802                         echo "Nope, it doesn't, but that's ok." 2>&1
4803                 fi
4804                 ;;
4805         esac
4806         ;;
4807 esac
4808
4809 case "$mips_type" in
4810 *BSD*|'') inclwanted="$locincpth $usrinc";;
4811 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4812 esac
4813 for thisincl in $inclwanted; do
4814         if $test -d $thisincl; then
4815                 if $test x$thisincl != x$usrinc; then
4816                         case "$dflt" in
4817                         *" -I$thisincl "*);;
4818                         *) dflt="$dflt -I$thisincl ";;
4819                         esac
4820                 fi
4821         fi
4822 done
4823
4824 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4825         xxx=true;
4826 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4827         xxx=true;
4828 else
4829         xxx=false;
4830 fi;
4831 if $xxx; then
4832         case "$dflt" in
4833         *$2*);;
4834         *) dflt="$dflt -D$2";;
4835         esac;
4836 fi'
4837
4838 set signal.h LANGUAGE_C; eval $inctest
4839
4840 case "$usesocks" in
4841 $define)
4842         ccflags="$ccflags -DSOCKS"
4843         ;;
4844 esac
4845
4846 case "$hint" in
4847 default|recommended) dflt="$ccflags $dflt" ;;
4848 *) dflt="$ccflags";;
4849 esac
4850
4851 case "$dflt" in
4852 ''|' ') dflt=none;;
4853 esac
4854
4855 $cat <<EOH
4856
4857 Your C compiler may want other flags.  For this question you should include
4858 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4859 but you should NOT include libraries or ld flags like -lwhatever.  If you
4860 want $package to honor its debug switch, you should include -DDEBUGGING here.
4861 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4862
4863 To use no flags, specify the word "none".
4864
4865 EOH
4866 set X $dflt
4867 shift
4868 dflt=${1+"$@"}
4869 rp="Any additional cc flags?"
4870 . ./myread
4871 case "$ans" in
4872 none) ccflags='';;
4873 *) ccflags="$ans";;
4874 esac
4875
4876 : the following weeds options from ccflags that are of no interest to cpp
4877 case "$cppflags" in
4878 '') cppflags="$ccflags" ;;
4879 *)  cppflags="$cppflags $ccflags" ;;
4880 esac
4881 case "$gccversion" in
4882 1*) cppflags="$cppflags -D__GNUC__"
4883 esac
4884 case "$mips_type" in
4885 '');;
4886 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4887 esac
4888 case "$cppflags" in
4889 '');;
4890 *)
4891         echo " "
4892         echo "Let me guess what the preprocessor flags are..." >&4
4893         set X $cppflags
4894         shift
4895         cppflags=''
4896         $cat >cpp.c <<'EOM'
4897 #define BLURFL foo
4898
4899 BLURFL xx LFRULB
4900 EOM
4901         previous=''
4902         for flag in $*
4903         do
4904                 case "$flag" in
4905                 -*) ftry="$flag";;
4906                 *) ftry="$previous $flag";;
4907                 esac
4908                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4909                         >cpp1.out 2>/dev/null && \
4910                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4911                         >cpp2.out 2>/dev/null && \
4912                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4913                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4914                 then
4915                         cppflags="$cppflags $ftry"
4916                         previous=''
4917                 else
4918                         previous="$flag"
4919                 fi
4920         done
4921         set X $cppflags
4922         shift
4923         cppflags=${1+"$@"}
4924         case "$cppflags" in
4925         *-*)  echo "They appear to be: $cppflags";;
4926         esac
4927         $rm -f cpp.c cpp?.out
4928         ;;
4929 esac
4930
4931 : flags used in final linking phase
4932 case "$ldflags" in
4933 '') if ./venix; then
4934                 dflt='-i -z'
4935         else
4936                 dflt=''
4937         fi
4938         case "$ccflags" in
4939         *-posix*) dflt="$dflt -posix" ;;
4940         esac
4941         ;;
4942 *) dflt="$ldflags";;
4943 esac
4944
4945 : Try to guess additional flags to pick up local libraries.
4946 for thislibdir in $libpth; do
4947         case " $loclibpth " in
4948         *" $thislibdir "*)
4949                 case "$dflt " in
4950                 *"-L$thislibdir "*) ;;
4951                 *)  dflt="$dflt -L$thislibdir" ;;
4952                 esac
4953                 ;;
4954         esac
4955 done
4956
4957 case "$dflt" in
4958 '') dflt='none' ;;
4959 esac
4960
4961 $cat <<EOH
4962
4963 Your C linker may need flags.  For this question you should
4964 include -L/whatever and any other flags used by the C linker, but you
4965 should NOT include libraries like -lwhatever.
4966
4967 Make sure you include the appropriate -L/path flags if your C linker
4968 does not normally search all of the directories you specified above,
4969 namely
4970         $libpth
4971 To use no flags, specify the word "none".
4972
4973 EOH
4974
4975 rp="Any additional ld flags (NOT including libraries)?"
4976 . ./myread
4977 case "$ans" in
4978 none) ldflags='';;
4979 *) ldflags="$ans";;
4980 esac
4981 rmlist="$rmlist pdp11"
4982
4983 : coherency check
4984 echo " "
4985 echo "Checking your choice of C compiler and flags for coherency..." >&4
4986 $cat > try.c <<'EOF'
4987 #include <stdio.h>
4988 int main() { printf("Ok\n"); return(0); }
4989 EOF
4990 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4991 shift
4992 $cat >try.msg <<'EOM'
4993 I've tried to compile and run the following simple program:
4994
4995 EOM
4996 $cat try.c >> try.msg
4997
4998 $cat >> try.msg <<EOM
4999
5000 I used the command:
5001
5002         $*
5003         $run ./try
5004
5005 and I got the following output:
5006
5007 EOM
5008 dflt=y
5009 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5010         if $sh -c "$run ./try" >>try.msg 2>&1; then
5011                 xxx=`$run ./try`
5012                 case "$xxx" in
5013                 "Ok") dflt=n ;;
5014                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5015                         case " $libs " in
5016                         *" -lsfio "*)
5017                                 cat >> try.msg <<'EOQS'
5018 If $libs contains -lsfio, and sfio is mis-configured, then it
5019 sometimes (apparently) runs and exits with a 0 status, but with no
5020 output!  It may have to do with sfio's use of _exit vs. exit.
5021
5022 EOQS
5023                                 rp="You have a big problem.  Shall I abort Configure"
5024                                 dflt=y
5025                                 ;;
5026                         esac
5027                         ;;
5028                 esac
5029         else
5030                 echo "The program compiled OK, but exited with status $?." >>try.msg
5031                 rp="You have a problem.  Shall I abort Configure"
5032                 dflt=y
5033         fi
5034 else
5035         echo "I can't compile the test program." >>try.msg
5036         rp="You have a BIG problem.  Shall I abort Configure"
5037         dflt=y
5038 fi
5039 case "$dflt" in
5040 y)
5041         $cat try.msg >&4
5042         case "$knowitall" in
5043         '')
5044                 echo "(The supplied flags or libraries might be incorrect.)"
5045                 ;;
5046         *) dflt=n;;
5047         esac
5048         echo " "
5049         . ./myread
5050         case "$ans" in
5051         n*|N*) ;;
5052         *)      echo "Ok.  Stopping Configure." >&4
5053                 exit 1
5054                 ;;
5055         esac
5056         ;;
5057 n) echo "OK, that should do.";;
5058 esac
5059 $rm -f try try.* core
5060
5061 : define a shorthand compile call
5062 compile='
5063 mc_file=$1;
5064 shift;
5065 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5066 : define a shorthand compile call for compilations that should be ok.
5067 compile_ok='
5068 mc_file=$1;
5069 shift;
5070 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5071
5072 : determine filename position in cpp output
5073 echo " "
5074 echo "Computing filename position in cpp output for #include directives..." >&4
5075 case "$osname" in
5076 vos) testaccess=-e ;;
5077 *)   testaccess=-r ;;
5078 esac
5079 echo '#include <stdio.h>' > foo.c
5080 $cat >fieldn <<EOF
5081 $startsh
5082 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5083 $grep '^[       ]*#.*stdio\.h' | \
5084 while read cline; do
5085         pos=1
5086         set \$cline
5087         while $test \$# -gt 0; do
5088                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5089                         echo "\$pos"
5090                         exit 0
5091                 fi
5092                 shift
5093                 pos=\`expr \$pos + 1\`
5094         done
5095 done
5096 EOF
5097 chmod +x fieldn
5098 fieldn=`./fieldn`
5099 $rm -f foo.c fieldn
5100 case $fieldn in
5101 '') pos='???';;
5102 1) pos=first;;
5103 2) pos=second;;
5104 3) pos=third;;
5105 *) pos="${fieldn}th";;
5106 esac
5107 echo "Your cpp writes the filename in the $pos field of the line."
5108
5109 case "$osname" in
5110 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5111 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5112 *)   cppfilter='' ;;
5113 esac
5114 : locate header file
5115 $cat >findhdr <<EOF
5116 $startsh
5117 wanted=\$1
5118 name=''
5119 for usrincdir in $usrinc
5120 do
5121         if test -f \$usrincdir/\$wanted; then
5122                 echo "\$usrincdir/\$wanted"
5123                 exit 0
5124         fi
5125 done
5126 awkprg='{ print \$$fieldn }'
5127 echo "#include <\$wanted>" > foo\$\$.c
5128 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5129 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5130 while read cline; do
5131         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5132         case "\$name" in
5133         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5134         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5135         *) exit 2;;
5136         esac;
5137 done;
5138 #
5139 # status = 0: grep returned 0 lines, case statement not executed
5140 # status = 1: headerfile found
5141 # status = 2: while loop executed, no headerfile found
5142 #
5143 status=\$?
5144 $rm -f foo\$\$.c;
5145 if test \$status -eq 1; then
5146         exit 0;
5147 fi
5148 exit 1
5149 EOF
5150 chmod +x findhdr
5151
5152 : define an alternate in-header-list? function
5153 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5154 cont=true; xxf="echo \"<\$1> found.\" >&4";
5155 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5156 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5157 esac;
5158 case $# in 4) instead=instead;; *) instead="at last";; esac;
5159 while $test "$cont"; do
5160         xxx=`./findhdr $1`
5161         var=$2; eval "was=\$$2";
5162         if $test "$xxx" && $test -r "$xxx";
5163         then eval $xxf;
5164         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5165                 cont="";
5166         else eval $xxnf;
5167         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5168         set $yyy; shift; shift; yyy=$@;
5169         case $# in 0) cont="";;
5170         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5171                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5172         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5173                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5174         esac;
5175 done;
5176 while $test "$yyy";
5177 do set $yyy; var=$2; eval "was=\$$2";
5178         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5179         set $yyy; shift; shift; yyy=$@;
5180 done'
5181
5182 : see if stdlib is available
5183 set stdlib.h i_stdlib
5184 eval $inhdr
5185
5186 : check for lengths of integral types
5187 echo " "
5188 case "$intsize" in
5189 '')
5190         echo "Checking to see how big your integers are..." >&4
5191         $cat >try.c <<EOCP
5192 #include <stdio.h>
5193 #$i_stdlib I_STDLIB
5194 #ifdef I_STDLIB
5195 #include <stdlib.h>
5196 #endif
5197 int main()
5198 {
5199         printf("intsize=%d;\n", (int)sizeof(int));
5200         printf("longsize=%d;\n", (int)sizeof(long));
5201         printf("shortsize=%d;\n", (int)sizeof(short));
5202         exit(0);
5203 }
5204 EOCP
5205         set try
5206         if eval $compile_ok && $run ./try > /dev/null; then
5207                 eval `$run ./try`
5208                 echo "Your integers are $intsize bytes long."
5209                 echo "Your long integers are $longsize bytes long."
5210                 echo "Your short integers are $shortsize bytes long."
5211         else
5212                 $cat >&4 <<EOM
5213 !
5214 Help! I can't compile and run the intsize test program: please enlighten me!
5215 (This is probably a misconfiguration in your system or libraries, and
5216 you really ought to fix it.  Still, I'll try anyway.)
5217 !
5218 EOM
5219                 dflt=4
5220                 rp="What is the size of an integer (in bytes)?"
5221                 . ./myread
5222                 intsize="$ans"
5223                 dflt=$intsize
5224                 rp="What is the size of a long integer (in bytes)?"
5225                 . ./myread
5226                 longsize="$ans"
5227                 dflt=2
5228                 rp="What is the size of a short integer (in bytes)?"
5229                 . ./myread
5230                 shortsize="$ans"
5231         fi
5232         ;;
5233 esac
5234 $rm -f try try.*
5235
5236 : check for long long
5237 echo " "
5238 echo "Checking to see if you have long long..." >&4
5239 echo 'int main() { long long x = 7; return 0; }' > try.c
5240 set try
5241 if eval $compile; then
5242         val="$define"
5243         echo "You have long long."
5244 else
5245         val="$undef"
5246         echo "You do not have long long."
5247 fi
5248 $rm try.*
5249 set d_longlong
5250 eval $setvar
5251
5252 : check for length of long long
5253 case "${d_longlong}${longlongsize}" in
5254 $define)
5255         echo " "
5256         echo "Checking to see how big your long longs are..." >&4
5257         $cat >try.c <<'EOCP'
5258 #include <stdio.h>
5259 int main()
5260 {
5261     printf("%d\n", (int)sizeof(long long));
5262     return(0);
5263 }
5264 EOCP
5265         set try
5266         if eval $compile_ok; then
5267                 longlongsize=`$run ./try`
5268                 echo "Your long longs are $longlongsize bytes long."
5269         else
5270                 dflt='8'
5271                 echo " "
5272                 echo "(I can't seem to compile the test program.  Guessing...)"
5273                 rp="What is the size of a long long (in bytes)?"
5274                 . ./myread
5275                 longlongsize="$ans"
5276         fi
5277         if $test "X$longsize" = "X$longlongsize"; then
5278                 echo "(That isn't any different from an ordinary long.)"
5279         fi      
5280         ;;
5281 esac
5282 $rm -f try.* try
5283
5284 : see if inttypes.h is available
5285 : we want a real compile instead of Inhdr because some systems
5286 : have an inttypes.h which includes non-existent headers
5287 echo " "
5288 $cat >try.c <<EOCP
5289 #include <inttypes.h>
5290 int main() {
5291         static int32_t foo32 = 0x12345678;
5292 }
5293 EOCP
5294 set try
5295 if eval $compile; then
5296         echo "<inttypes.h> found." >&4
5297         val="$define"
5298 else
5299         echo "<inttypes.h> NOT found." >&4
5300         val="$undef"
5301 fi
5302 $rm -f try.c try
5303 set i_inttypes
5304 eval $setvar
5305
5306 : check for int64_t
5307 echo " "
5308 echo "Checking to see if you have int64_t..." >&4
5309 $cat >try.c <<EOCP
5310 #include <sys/types.h>
5311 #$i_inttypes I_INTTYPES
5312 #ifdef I_INTTYPES
5313 #include <inttypes.h>
5314 #endif
5315 int main() { int64_t x = 7; }
5316 EOCP
5317 set try
5318 if eval $compile; then
5319         val="$define"
5320         echo "You have int64_t."
5321 else
5322         val="$undef"
5323         echo "You do not have int64_t."
5324 fi
5325 $rm -f try try.*
5326 set d_int64_t
5327 eval $setvar
5328
5329
5330 echo " "
5331 echo "Checking which 64-bit integer type we could use..." >&4
5332
5333 case "$intsize" in
5334 8) val=int
5335    set quadtype
5336    eval $setvar
5337    val='"unsigned int"'
5338    set uquadtype
5339    eval $setvar
5340    quadkind=1
5341    ;;
5342 *) case "$longsize" in
5343    8) val=long
5344       set quadtype
5345       eval $setvar
5346       val='"unsigned long"'
5347       set uquadtype
5348       eval $setvar
5349       quadkind=2
5350       ;;
5351    *) case "$d_longlong:$longlongsize" in
5352       define:8)
5353         val='"long long"'
5354         set quadtype
5355         eval $setvar
5356         val='"unsigned long long"'
5357         set uquadtype
5358         eval $setvar
5359         quadkind=3
5360         ;;
5361       *) case "$d_int64_t" in
5362          define)
5363            val=int64_t
5364            set quadtype
5365            eval $setvar
5366            val=uint64_t
5367            set uquadtype
5368            eval $setvar
5369            quadkind=4
5370            ;;
5371          esac
5372          ;;
5373       esac
5374       ;;
5375    esac
5376    ;;
5377 esac
5378
5379 case "$quadtype" in
5380 '')     echo "Alas, no 64-bit integer types in sight." >&4
5381         d_quad="$undef"
5382         ;;
5383 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5384         d_quad="$define"
5385         ;;
5386 esac
5387
5388
5389 case "$uselonglong" in
5390 "$define"|true|[yY]*)
5391         cat <<EOM >&4
5392
5393 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5394 EOM
5395         use64bitint="$define"
5396         ;;
5397 esac                          
5398 case "$use64bits" in
5399 "$define"|true|[yY]*)
5400         cat <<EOM >&4
5401
5402 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5403 EOM
5404         use64bitint="$define"
5405         ;;
5406 esac                          
5407 case "$use64bitints" in
5408 "$define"|true|[yY]*)
5409         cat <<EOM >&4
5410
5411 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5412 EOM
5413         use64bitint="$define"
5414         ;;
5415 esac                          
5416 case "$use64bitsint" in
5417 "$define"|true|[yY]*)
5418         cat <<EOM >&4
5419
5420 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5421 EOM
5422         use64bitint="$define"
5423         ;;
5424 esac                          
5425 case "$uselonglongs" in
5426 "$define"|true|[yY]*)
5427         cat <<EOM >&4
5428
5429 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5430 EOM
5431         use64bitint="$define"
5432         ;;
5433 esac                          
5434 case "$use64bitsall" in
5435 "$define"|true|[yY]*)
5436         cat <<EOM >&4
5437
5438 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5439 EOM
5440         use64bitall="$define"
5441         ;;
5442 esac                          
5443
5444 case "$ccflags" in
5445 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5446 esac
5447 case "$use64bitall" in
5448 "$define"|true|[yY]*) use64bitint="$define" ;;
5449 esac
5450
5451 case "$longsize" in
5452 8) cat <<EOM
5453
5454 You have natively 64-bit long integers.
5455 EOM
5456    val="$define"
5457    ;;
5458 *) case "$use64bitint" in
5459    "$define"|true|[yY]*) dflt='y';;
5460    *) dflt='n';;
5461    esac
5462    case "$d_quad" in
5463    "$define") ;;
5464    *) dflt='n' ;;
5465    esac
5466    cat <<EOM
5467
5468 Perl can be built to take advantage of 64-bit integer types
5469 on some systems.  To do so, Configure can be run with -Duse64bitint.
5470 Choosing this option will most probably introduce binary incompatibilities.
5471
5472 If this doesn't make any sense to you, just accept the default '$dflt'.
5473 (The default has been chosen based on your configuration.)
5474 EOM
5475    rp='Try to use 64-bit integers, if available?'
5476    . ./myread
5477    case "$ans" in
5478    [yY]*) val="$define" ;;
5479    *)     val="$undef"  ;;
5480    esac
5481    ;;
5482 esac
5483 set use64bitint
5484 eval $setvar
5485
5486 case "$use64bitall" in
5487 "$define"|true|[yY]*) dflt='y' ;;
5488 *) case "$longsize" in
5489    8) dflt='y' ;;
5490    *) dflt='n' ;;
5491    esac
5492    ;;
5493 esac    
5494 cat <<EOM
5495
5496 You may also choose to try maximal 64-bitness.  It means using as much
5497 64-bitness as possible on the platform.  This in turn means even more
5498 binary incompatibilities.  On the other hand, your platform may not
5499 have any more 64-bitness available than what you already have chosen.
5500
5501 If this doesn't make any sense to you, just accept the default '$dflt'.
5502 (The default has been chosen based on your configuration.)
5503 EOM
5504 rp='Try to use maximal 64-bit support, if available?'
5505 . ./myread
5506 case "$ans" in
5507 [yY]*) val="$define" ;;
5508 *)     val="$undef"  ;;
5509 esac
5510 set use64bitall
5511 eval $setvar
5512 case "$use64bitall" in
5513 "$define")
5514         case "$use64bitint" in
5515         "$undef")
5516                 cat <<EOM
5517
5518 Since you have chosen a maximally 64-bit build, I'm also turning on
5519 the use of 64-bit integers.
5520 EOM
5521                 use64bitint="$define" ;;
5522         esac
5523         ;;
5524 esac
5525
5526 : Look for a hint-file generated 'call-back-unit'.  If the
5527 : user has specified that a 64-bit perl is to be built,
5528 : we may need to set or change some other defaults.
5529 if $test -f use64bitint.cbu; then
5530         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5531         . ./use64bitint.cbu
5532 fi
5533 case "$use64bitint" in
5534 "$define"|true|[yY]*)
5535         case "$longsize" in
5536         4) case "$archname64" in
5537            '') archname64=64int ;;
5538            esac
5539            ;;
5540         esac
5541         ;;
5542 esac
5543
5544 : Look for a hint-file generated 'call-back-unit'.  If the
5545 : user has specified that a maximally 64-bit perl is to be built,
5546 : we may need to set or change some other defaults.
5547 if $test -f use64bitall.cbu; then
5548         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5549         . ./use64bitall.cbu
5550 fi
5551 case "$use64bitall" in
5552 "$define"|true|[yY]*)
5553         case "$longsize" in
5554         4) case "$archname64" in
5555            ''|64int) archname64=64all ;;
5556            esac
5557            ;;
5558         esac
5559         ;;
5560 esac
5561
5562 case "$d_quad:$use64bitint" in
5563 $undef:$define)
5564         cat >&4 <<EOF
5565
5566 *** You have chosen to use 64-bit integers,
5567 *** but none can be found.
5568 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5569 *** Cannot continue, aborting.
5570
5571 EOF
5572         exit 1
5573         ;;
5574 esac
5575
5576 : check for length of double
5577 echo " "
5578 case "$doublesize" in
5579 '')
5580         echo "Checking to see how big your double precision numbers are..." >&4
5581         $cat >try.c <<EOCP
5582 #include <stdio.h>
5583 #$i_stdlib I_STDLIB
5584 #ifdef I_STDLIB
5585 #include <stdlib.h>
5586 #endif
5587 int main()
5588 {
5589     printf("%d\n", (int)sizeof(double));
5590     exit(0);
5591 }
5592 EOCP
5593         set try
5594         if eval $compile_ok; then
5595                 doublesize=`$run ./try`
5596                 echo "Your double is $doublesize bytes long."
5597         else
5598                 dflt='8'
5599                 echo "(I can't seem to compile the test program.  Guessing...)"
5600                 rp="What is the size of a double precision number (in bytes)?"
5601                 . ./myread
5602                 doublesize="$ans"
5603         fi
5604         ;;
5605 esac
5606 $rm -f try.c try
5607
5608 : check for long doubles
5609 echo " "
5610 echo "Checking to see if you have long double..." >&4
5611 echo 'int main() { long double x = 7.0; }' > try.c
5612 set try
5613 if eval $compile; then
5614         val="$define"
5615         echo "You have long double."
5616 else
5617         val="$undef"
5618         echo "You do not have long double."
5619 fi
5620 $rm try.*
5621 set d_longdbl
5622 eval $setvar
5623
5624 : check for length of long double
5625 case "${d_longdbl}${longdblsize}" in
5626 $define)
5627         echo " "
5628         echo "Checking to see how big your long doubles are..." >&4
5629         $cat >try.c <<'EOCP'
5630 #include <stdio.h>
5631 int main()
5632 {
5633         printf("%d\n", sizeof(long double));
5634 }
5635 EOCP
5636         set try
5637         set try
5638         if eval $compile; then
5639                 longdblsize=`$run ./try`
5640                 echo "Your long doubles are $longdblsize bytes long."
5641         else
5642                 dflt='8'
5643                 echo " "
5644                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5645                 rp="What is the size of a long double (in bytes)?"
5646                 . ./myread
5647                 longdblsize="$ans"
5648         fi
5649         if $test "X$doublesize" = "X$longdblsize"; then
5650                 echo "That isn't any different from an ordinary double."
5651                 echo "I'll keep your setting anyway, but you may see some"
5652                 echo "harmless compilation warnings."
5653         fi      
5654         ;;
5655 esac
5656 $rm -f try.* try
5657
5658 : determine the architecture name
5659 echo " "
5660 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5661         tarch=`arch`"-$osname"
5662 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5663         if uname -m > tmparch 2>&1 ; then
5664                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5665                         -e 's/$/'"-$osname/" tmparch`
5666         else
5667                 tarch="$osname"
5668         fi
5669         $rm -f tmparch
5670 else
5671         tarch="$osname"
5672 fi
5673 case "$myarchname" in
5674 ''|"$tarch") ;;
5675 *)
5676         echo "(Your architecture name used to be $myarchname.)"
5677         archname=''
5678         ;;
5679 esac
5680 case "$targetarch" in
5681 '') ;;
5682 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5683 esac
5684 myarchname="$tarch"
5685 case "$archname" in
5686 '') dflt="$tarch";;
5687 *) dflt="$archname";;
5688 esac
5689 rp='What is your architecture name'
5690 . ./myread
5691 archname="$ans"
5692 case "$usethreads" in
5693 $define)
5694         echo "Threads selected." >&4
5695         case "$archname" in
5696         *-thread*) echo "...and architecture name already has -thread." >&4
5697                 ;;
5698         *)      archname="$archname-thread"
5699                 echo "...setting architecture name to $archname." >&4
5700                 ;;
5701         esac
5702         ;;
5703 esac
5704 case "$usemultiplicity" in
5705 $define)
5706         echo "Multiplicity selected." >&4
5707         case "$archname" in
5708         *-multi*) echo "...and architecture name already has -multi." >&4
5709                 ;;
5710         *)      archname="$archname-multi"
5711                 echo "...setting architecture name to $archname." >&4
5712                 ;;
5713         esac
5714         ;;
5715 esac
5716 case "$use64bitint$use64bitall" in
5717 *"$define"*)
5718         case "$archname64" in
5719         '')
5720                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5721                 ;;
5722         *)
5723                 case "$use64bitint" in
5724                 "$define") echo "64 bit integers selected." >&4 ;;
5725                 esac
5726                 case "$use64bitall" in
5727                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5728                 esac
5729                 case "$archname" in
5730                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5731                         ;;
5732                 *)      archname="$archname-$archname64"
5733                         echo "...setting architecture name to $archname." >&4
5734                         ;;
5735                 esac
5736                 ;;
5737         esac
5738 esac
5739 case "$uselongdouble" in
5740 $define)
5741         echo "Long doubles selected." >&4
5742         case "$longdblsize" in
5743         $doublesize)
5744                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5745                 ;;
5746         *)
5747                 case "$archname" in
5748                 *-ld*) echo "...and architecture name already has -ld." >&4
5749                         ;;
5750                 *)      archname="$archname-ld"
5751                         echo "...setting architecture name to $archname." >&4
5752                         ;;
5753                 esac
5754                 ;;
5755         esac
5756         ;;
5757 esac
5758 case "$useperlio" in
5759 $define)
5760         echo "Perlio selected." >&4
5761         ;;
5762 *)
5763         echo "Perlio not selected, using stdio." >&4
5764         case "$archname" in
5765         *-stdio*) echo "...and architecture name already has -stdio." >&4
5766                 ;;
5767         *)      archname="$archname-stdio"
5768                 echo "...setting architecture name to $archname." >&4
5769                 ;;
5770         esac
5771         ;;
5772 esac
5773 if $test -f archname.cbu; then
5774         echo "Your platform has some specific hints for architecture name, using them..."
5775         . ./archname.cbu
5776 fi
5777
5778 : determine root of directory hierarchy where package will be installed.
5779 case "$prefix" in
5780 '')
5781         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5782         ;;
5783 *?/)
5784         dflt=`echo "$prefix" | sed 's/.$//'`
5785         ;;
5786 *)
5787         dflt="$prefix"
5788         ;;
5789 esac
5790 $cat <<EOM
5791
5792 By default, $package will be installed in $dflt/bin, manual pages
5793 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5794 installation directories. Typically this is something like /usr/local.
5795 If you wish to have binaries under /usr/bin but other parts of the
5796 installation under /usr/local, that's ok: you will be prompted
5797 separately for each of the installation directories, the prefix being
5798 only used to set the defaults.
5799
5800 EOM
5801 fn=d~
5802 rp='Installation prefix to use?'
5803 . ./getfile
5804 oldprefix=''
5805 case "$prefix" in
5806 '') ;;
5807 *)
5808         case "$ans" in
5809         "$prefix") ;;
5810         *) oldprefix="$prefix";;
5811         esac
5812         ;;
5813 esac
5814 prefix="$ans"
5815 prefixexp="$ansexp"
5816
5817 case "$afsroot" in
5818 '')     afsroot=/afs ;;
5819 *)      afsroot=$afsroot ;;
5820 esac
5821
5822 : is AFS running?
5823 echo " "
5824 case "$afs" in
5825 $define|true)   afs=true ;;
5826 $undef|false)   afs=false ;;
5827 *)      if test -d $afsroot; then
5828                 afs=true
5829         else
5830                 afs=false
5831         fi
5832         ;;
5833 esac
5834 if $afs; then
5835         echo "AFS may be running... I'll be extra cautious then..." >&4
5836 else
5837         echo "AFS does not seem to be running..." >&4
5838 fi
5839
5840 : determine installation prefix for where package is to be installed.
5841 if $afs; then 
5842 $cat <<EOM
5843
5844 Since you are running AFS, I need to distinguish the directory in which
5845 files will reside from the directory in which they are installed (and from
5846 which they are presumably copied to the former directory by occult means).
5847
5848 EOM
5849         case "$installprefix" in
5850         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5851         *) dflt="$installprefix";;
5852         esac
5853 else
5854 $cat <<EOM
5855
5856 In some special cases, particularly when building $package for distribution,
5857 it is convenient to distinguish the directory in which files should be
5858 installed from the directory ($prefix) in which they will
5859 eventually reside.  For most users, these two directories are the same.
5860
5861 EOM
5862         case "$installprefix" in
5863         '') dflt=$prefix ;;
5864         *) dflt=$installprefix;;
5865         esac
5866 fi
5867 fn=d~
5868 rp='What installation prefix should I use for installing files?'
5869 . ./getfile
5870 installprefix="$ans"
5871 installprefixexp="$ansexp"
5872
5873 : set the prefixit variable, to compute a suitable default value
5874 prefixit='case "$3" in
5875 ""|none)
5876         case "$oldprefix" in
5877         "") eval "$1=\"\$$2\"";;
5878         *)
5879                 case "$3" in
5880                 "") eval "$1=";;
5881                 none)
5882                         eval "tp=\"\$$2\"";
5883                         case "$tp" in
5884                         ""|" ") eval "$1=\"\$$2\"";;
5885                         *) eval "$1=";;
5886                         esac;;
5887                 esac;;
5888         esac;;
5889 *)
5890         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5891         case "$tp" in
5892         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5893         /*-$oldprefix/*|\~*-$oldprefix/*)
5894                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5895         *) eval "$1=\"\$$2\"";;
5896         esac;;
5897 esac'
5898
5899 : get the patchlevel
5900 echo " "
5901 echo "Getting the current patchlevel..." >&4
5902 if $test -r $rsrc/patchlevel.h;then
5903         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5904         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5905         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5906         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5907         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5908         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5909         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5910 else
5911         revision=0
5912         patchlevel=0
5913         subversion=0
5914         api_revision=0
5915         api_version=0
5916         api_subversion=0
5917         perl_patchlevel=0
5918         $echo "(You do not have patchlevel.h.  Eek.)"
5919 fi
5920 if $test -r $rsrc/.patch ; then
5921         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5922                 perl_patchlevel=`cat $rsrc/.patch`
5923         fi
5924 fi
5925 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5926 version_patchlevel_string="version $patchlevel subversion $subversion"
5927 case "$perl_patchlevel" in
5928 0|'') ;;
5929 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5930 esac
5931
5932 $echo "(You have $package $version_patchlevel_string.)"
5933
5934 case "$osname" in
5935 dos|vms)
5936         : XXX Should be a Configure test for double-dots in filenames.
5937         version=`echo $revision $patchlevel $subversion | \
5938                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5939         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5940                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5941         ;;
5942 *)
5943         version=`echo $revision $patchlevel $subversion | \
5944                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5945         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5946                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5947         ;;
5948 esac
5949 : Special case the 5.005_xx maintenance series, which used 5.005
5950 : without any subversion label as a subdirectory in $sitelib
5951 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5952         api_versionstring='5.005'
5953 fi
5954
5955 : determine installation style
5956 : For now, try to deduce it from prefix unless it is already set.
5957 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5958 case "$installstyle" in
5959 '')     case "$prefix" in
5960                 *perl*) dflt='lib';;
5961                 *) dflt='lib/perl5' ;;
5962         esac
5963         ;;
5964 *)      dflt="$installstyle" ;;
5965 esac
5966 : Probably not worth prompting for this since we prompt for all
5967 : the directories individually, and the prompt would be too long and
5968 : confusing anyway.
5969 installstyle=$dflt
5970
5971
5972 : Perform the prefixexp/installprefixexp correction if necessary
5973 cat <<EOS >installprefix
5974 $startsh
5975 EOS
5976 cat <<'EOSC' >>installprefix
5977 : Change installation prefix, if necessary.
5978 if $test X"$prefix" != X"$installprefix"; then
5979         eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
5980 else
5981         eval "install${prefixvar}=\"\$${prefixvar}exp\""
5982 fi
5983 EOSC
5984
5985 : Set variables such as privlib and privlibexp from the output of ./getfile
5986 : performing the prefixexp/installprefixexp correction if necessary.
5987 cat <<EOS >setprefixvar
5988 $startsh
5989 EOS
5990 cat <<'EOSC' >>setprefixvar
5991 eval "${prefixvar}=\"\$ans\""
5992 eval "${prefixvar}exp=\"\$ansexp\""
5993 . ./installprefix
5994 EOSC
5995
5996 : determine where public executables go
5997 echo " "
5998 set dflt bin bin
5999 eval $prefixit
6000 fn=d~
6001 rp='Pathname where the public executables will reside?'
6002 . ./getfile
6003 if $test "X$ansexp" != "X$binexp"; then
6004         installbin=''
6005 fi
6006 prefixvar=bin
6007 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6008 . ./setprefixvar
6009
6010 case "$userelocatableinc" in
6011 $define|true|[yY]*)     dflt='y';;
6012 *) dflt='n';;
6013 esac
6014 cat <<EOM
6015
6016 Would you like to build Perl so that the installation is relocatable, so that
6017 library paths in @INC are determined relative to the path of the perl binary?
6018 This is not advised for system Perl installs, or if you need to run setid
6019 scripts or scripts under taint mode.
6020
6021 If this doesn't make any sense to you, just accept the default '$dflt'.
6022 EOM
6023 rp='Use relocatable @INC?'
6024 . ./myread
6025 case "$ans" in
6026 y|Y)    val="$define" ;;     
6027 *)      val="$undef" ;;
6028 esac
6029 set userelocatableinc
6030 eval $setvar
6031
6032 : Default prefix is now "up one level from where the binaries are"
6033 case "$userelocatableinc" in
6034 $define|true|[yY]*) prefix=".../.."
6035                     prefixexp=".../..";;
6036 esac
6037
6038
6039 : determine where private library files go
6040 : Usual default is /usr/local/lib/perl5/$version.
6041 : Also allow things like /opt/perl/lib/$version, since 
6042 : /opt/perl/lib/perl5... would be redundant.
6043 : The default "style" setting is made in installstyle.U
6044 case "$installstyle" in
6045 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6046 *)       set dflt privlib lib/$version ;;
6047 esac
6048 eval $prefixit
6049 $cat <<EOM
6050
6051 There are some auxiliary files for $package that need to be put into a
6052 private library directory that is accessible by everyone.
6053
6054 EOM
6055 fn=d~+
6056 rp='Pathname where the private library files will reside?'
6057 . ./getfile
6058 prefixvar=privlib
6059 . ./setprefixvar
6060
6061 : set the prefixup variable, to restore leading tilda escape
6062 prefixup='case "$prefixexp" in
6063 "$prefix") ;;
6064 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6065 esac'
6066
6067 : determine where public architecture dependent libraries go
6068 set archlib archlib
6069 eval $prefixit
6070 : privlib default is /usr/local/lib/$package/$version
6071 : archlib default is /usr/local/lib/$package/$version/$archname
6072 : privlib may have an optional trailing /share.
6073 tdflt=`echo $privlib | $sed 's,/share$,,'`
6074 tdflt=$tdflt/$archname
6075 case "$archlib" in
6076 '')     dflt=$tdflt
6077         ;;
6078 *)      dflt="$archlib"
6079     ;;
6080 esac
6081 $cat <<EOM
6082
6083 $spackage contains architecture-dependent library files.  If you are
6084 sharing libraries in a heterogeneous environment, you might store
6085 these files in a separate location.  Otherwise, you can just include
6086 them with the rest of the public library files.
6087
6088 EOM
6089 fn=d+~
6090 rp='Where do you want to put the public architecture-dependent libraries?'
6091 . ./getfile
6092 prefixvar=archlib
6093 . ./setprefixvar
6094 if $test X"$archlib" = X"$privlib"; then
6095         d_archlib="$undef"
6096 else
6097         d_archlib="$define"
6098 fi
6099
6100 : see if setuid scripts can be secure
6101 $cat <<EOM
6102
6103 Some kernels have a bug that prevents setuid #! scripts from being
6104 secure.  Some sites have disabled setuid #! scripts because of this.
6105
6106 First let's decide if your kernel supports secure setuid #! scripts.
6107 (If setuid #! scripts would be secure but have been disabled anyway,
6108 don't say that they are secure if asked.)
6109
6110 EOM
6111
6112 val="$undef"
6113 if $test -d /dev/fd; then
6114         echo "#!$ls" >reflect
6115         chmod +x,u+s reflect
6116         ./reflect >flect 2>&1
6117         if $contains "/dev/fd" flect >/dev/null; then
6118                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6119                 val="$define"
6120         else
6121                 $cat <<EOM
6122 If you are not sure if they are secure, I can check but I'll need a
6123 username and password different from the one you are using right now.
6124 If you don't have such a username or don't want me to test, simply
6125 enter 'none'.
6126
6127 EOM
6128                 rp='Other username to test security of setuid scripts with?'
6129                 dflt='none'
6130                 . ./myread
6131                 case "$ans" in
6132                 n|none)
6133                         case "$d_suidsafe" in
6134                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6135                                 dflt=n;;
6136                         "$undef")
6137                                 echo "Well, the $hint value is *not* secure." >&4
6138                                 dflt=n;;
6139                         *)      echo "Well, the $hint value *is* secure." >&4
6140                                 dflt=y;;
6141                         esac
6142                         ;;
6143                 *)
6144                         $rm -f reflect flect
6145                         echo "#!$ls" >reflect
6146                         chmod +x,u+s reflect
6147                         echo >flect
6148                         chmod a+w flect
6149                         echo '"su" will (probably) prompt you for '"$ans's password."
6150                         su $ans -c './reflect >flect'
6151                         if $contains "/dev/fd" flect >/dev/null; then
6152                                 echo "Okay, it looks like setuid scripts are secure." >&4
6153                                 dflt=y
6154                         else
6155                                 echo "I don't think setuid scripts are secure." >&4
6156                                 dflt=n
6157                         fi
6158                         ;;
6159                 esac
6160                 rp='Does your kernel have *secure* setuid scripts?'
6161                 . ./myread
6162                 case "$ans" in
6163                 [yY]*)  val="$define";;
6164                 *)      val="$undef";;
6165                 esac
6166         fi
6167 else
6168         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6169         echo "(That's for file descriptors, not floppy disks.)"
6170         val="$undef"
6171 fi
6172 set d_suidsafe
6173 eval $setvar
6174
6175 $rm -f reflect flect
6176
6177 : now see if they want to do setuid emulation
6178 echo " "
6179 val="$undef"
6180 case "$d_suidsafe" in
6181 "$define")
6182         val="$undef"
6183         echo "No need to emulate SUID scripts since they are secure here." >&4
6184         ;;
6185 *)
6186         $cat <<EOM
6187 Some systems have disabled setuid scripts, especially systems where
6188 setuid scripts cannot be secure.  On systems where setuid scripts have
6189 been disabled, the setuid/setgid bits on scripts are currently
6190 useless.  It is possible for $package to detect those bits and emulate
6191 setuid/setgid in a secure fashion.  This emulation will only work if
6192 setuid scripts have been disabled in your kernel.
6193
6194 EOM
6195         case "$d_dosuid" in
6196         "$define") dflt=y ;;
6197         *) dflt=n ;;
6198         esac
6199         rp="Do you want to do setuid/setgid emulation?"
6200         . ./myread
6201         case "$ans" in
6202         [yY]*)  val="$define";;
6203         *)      val="$undef";;
6204         esac
6205         ;;
6206 esac
6207 set d_dosuid
6208 eval $setvar
6209
6210 : see if this is a malloc.h system
6211 : we want a real compile instead of Inhdr because some systems have a
6212 : malloc.h that just gives a compile error saying to use stdlib.h instead
6213 echo " "
6214 $cat >try.c <<EOCP
6215 #include <stdlib.h>
6216 #include <malloc.h>
6217 int main () { return 0; }
6218 EOCP
6219 set try
6220 if eval $compile; then
6221     echo "<malloc.h> found." >&4
6222     val="$define"
6223 else
6224     echo "<malloc.h> NOT found." >&4
6225     val="$undef"
6226 fi
6227 $rm -f try.c try
6228 set i_malloc
6229 eval $setvar
6230
6231 : check for void type
6232 echo " "
6233 echo "Checking to see how well your C compiler groks the void type..." >&4
6234 case "$voidflags" in
6235 '')
6236         $cat >try.c <<EOCP
6237 #$i_stdlib I_STDLIB
6238 #ifdef I_STDLIB
6239 #include <stdlib.h>
6240 #endif
6241 #if TRY & 1
6242 void sub() {
6243 #else
6244 sub() {
6245 #endif
6246         extern void moo();      /* function returning void */
6247         void (*goo)();          /* ptr to func returning void */
6248 #if TRY & 8
6249         void *hue;              /* generic ptr */
6250 #endif
6251 #if TRY & 2
6252         void (*foo[10])();
6253 #endif
6254
6255 #if TRY & 4
6256         if(goo == moo) {
6257                 exit(0);
6258         }
6259 #endif
6260         exit(0);
6261 }
6262 int main() { sub(); }
6263 EOCP
6264         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6265                 voidflags=$defvoidused
6266         echo "Good.  It appears to support void to the level $package wants.">&4
6267                 if $contains warning .out >/dev/null 2>&1; then
6268                         echo "However, you might get some warnings that look like this:"
6269                         $cat .out
6270                 fi
6271         else
6272 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6273                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6274                         echo "It supports 1..."
6275                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6276                                 echo "It also supports 2..."
6277                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6278                                         voidflags=7
6279                                         echo "And it supports 4 but not 8 definitely."
6280                                 else
6281                                         echo "It doesn't support 4..."
6282                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6283                                                 voidflags=11
6284                                                 echo "But it supports 8."
6285                                         else
6286                                                 voidflags=3
6287                                                 echo "Neither does it support 8."
6288                                         fi
6289                                 fi
6290                         else
6291                                 echo "It does not support 2..."
6292                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6293                                         voidflags=13
6294                                         echo "But it supports 4 and 8."
6295                                 else
6296                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6297                                                 voidflags=5
6298                                                 echo "And it supports 4 but has not heard about 8."
6299                                         else
6300                                                 echo "However it supports 8 but not 4."
6301                                         fi
6302                                 fi
6303                         fi
6304                 else
6305                         echo "There is no support at all for void."
6306                         voidflags=0
6307                 fi
6308         fi
6309 esac
6310 case "$voidflags" in
6311 "$defvoidused") ;;
6312 *)      $cat >&4 <<'EOM'
6313   Support flag bits are:
6314     1: basic void declarations.
6315     2: arrays of pointers to functions returning void.
6316     4: operations between pointers to and addresses of void functions.
6317     8: generic void pointers.
6318 EOM
6319         dflt="$voidflags";
6320         rp="Your void support flags add up to what?"
6321         . ./myread
6322         voidflags="$ans"
6323         ;;
6324 esac
6325 $rm -f try.* .out
6326
6327 : check for length of pointer
6328 echo " "
6329 case "$ptrsize" in
6330 '')
6331         echo "Checking to see how big your pointers are..." >&4
6332         if test "$voidflags" -gt 7; then
6333                 echo '#define VOID_PTR char *' > try.c
6334         else
6335                 echo '#define VOID_PTR void *' > try.c
6336         fi
6337         $cat >>try.c <<EOCP
6338 #include <stdio.h>
6339 #$i_stdlib I_STDLIB
6340 #ifdef I_STDLIB
6341 #include <stdlib.h>
6342 #endif
6343 int main()
6344 {
6345     printf("%d\n", (int)sizeof(VOID_PTR));
6346     exit(0);
6347 }
6348 EOCP
6349         set try
6350         if eval $compile_ok; then
6351                 ptrsize=`$run ./try`
6352                 echo "Your pointers are $ptrsize bytes long."
6353         else
6354                 dflt='4'
6355                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6356                 rp="What is the size of a pointer (in bytes)?"
6357                 . ./myread
6358                 ptrsize="$ans"
6359         fi
6360         ;;
6361 esac
6362 $rm -f try.c try
6363 case "$use64bitall" in
6364 "$define"|true|[yY]*)
6365         case "$ptrsize" in
6366         4)      cat <<EOM >&4
6367
6368 *** You have chosen a maximally 64-bit build,
6369 *** but your pointers are only 4 bytes wide.
6370 *** Please rerun Configure without -Duse64bitall.
6371 EOM
6372                 case "$d_quad" in
6373                 define)
6374                         cat <<EOM >&4
6375 *** Since you have quads, you could possibly try with -Duse64bitint.
6376 EOM
6377                         ;;
6378                 esac
6379                 cat <<EOM >&4
6380 *** Cannot continue, aborting.
6381
6382 EOM
6383
6384                 exit 1
6385                 ;;
6386         esac
6387         ;;
6388 esac
6389
6390
6391 : determine whether to use malloc wrapping
6392 echo " "
6393 case "$usemallocwrap" in
6394 [yY]*|true|$define)     dflt='y' ;;
6395 [nN]*|false|$undef)     dflt='n' ;;
6396 *)      case "$usedevel" in
6397         [yY]*|true|$define)     dflt='y' ;;
6398         *) dflt='n' ;;
6399         esac
6400         ;;
6401 esac
6402 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6403 . ./myread
6404 usemallocwrap="$ans"
6405 case "$ans" in
6406 y*|true)
6407         usemallocwrap="$define" ;;
6408 *)
6409         usemallocwrap="$undef" ;;
6410 esac
6411
6412 : determine which malloc to compile in
6413 echo " "
6414 case "$usemymalloc" in
6415 [yY]*|true|$define)     dflt='y' ;;
6416 [nN]*|false|$undef)     dflt='n' ;;
6417 *)      case "$ptrsize" in
6418         4) dflt='y' ;;
6419         *) dflt='n' ;;
6420         esac
6421         ;;
6422 esac
6423 rp="Do you wish to attempt to use the malloc that comes with $package?"
6424 . ./myread
6425 usemymalloc="$ans"
6426 case "$ans" in
6427 y*|true)
6428         usemymalloc='y'
6429         mallocsrc='malloc.c'
6430         mallocobj="malloc$_o"
6431         d_mymalloc="$define"
6432         case "$libs" in
6433         *-lmalloc*)
6434                 : Remove malloc from list of libraries to use
6435                 echo "Removing unneeded -lmalloc from library list" >&4
6436                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6437                 shift
6438                 libs="$*"
6439                 echo "libs = $libs" >&4
6440                 ;;
6441         esac
6442         ;;
6443 *)
6444         usemymalloc='n'
6445         mallocsrc=''
6446         mallocobj=''
6447         d_mymalloc="$undef"
6448         ;;
6449 esac
6450
6451 : compute the return types of malloc and free
6452 echo " "
6453 $cat >malloc.c <<END
6454 #$i_malloc I_MALLOC
6455 #$i_stdlib I_STDLIB
6456 #include <stdio.h>
6457 #include <sys/types.h>
6458 #ifdef I_MALLOC
6459 #include <malloc.h>
6460 #endif
6461 #ifdef I_STDLIB
6462 #include <stdlib.h>
6463 #endif
6464 #ifdef TRY_MALLOC
6465 void *malloc();
6466 #endif
6467 #ifdef TRY_FREE
6468 void free();
6469 #endif
6470 END
6471 case "$malloctype" in
6472 '')
6473         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6474                 malloctype='void *'
6475         else
6476                 malloctype='char *'
6477         fi
6478         ;;
6479 esac
6480 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6481
6482 case "$freetype" in
6483 '')
6484         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6485                 freetype='void'
6486         else
6487                 freetype='int'
6488         fi
6489         ;;
6490 esac
6491 echo "Your system uses $freetype free(), it would seem." >&4
6492 $rm -f malloc.[co]
6493 $cat <<EOM
6494
6495 After $package is installed, you may wish to install various
6496 add-on modules and utilities.  Typically, these add-ons will
6497 be installed under $prefix with the rest
6498 of this package.  However, you may wish to install such add-ons
6499 elsewhere under a different prefix.
6500
6501 If you do not wish to put everything under a single prefix, that's
6502 ok.  You will be prompted for the individual locations; this siteprefix
6503 is only used to suggest the defaults.
6504
6505 The default should be fine for most people.
6506
6507 EOM
6508 fn=d~+
6509 rp='Installation prefix to use for add-on modules and utilities?'
6510 : XXX Here might be another good place for an installstyle setting.
6511 case "$siteprefix" in
6512 '') dflt=$prefix ;;
6513 *)  dflt=$siteprefix ;;
6514 esac
6515 . ./getfile
6516 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6517 oldsiteprefix=''
6518 case "$siteprefix" in
6519 '') ;;
6520 *)      case "$ans" in
6521         "$prefix") ;;
6522         *) oldsiteprefix="$prefix";;
6523         esac
6524         ;;
6525 esac
6526 siteprefix="$ans"
6527 siteprefixexp="$ansexp"
6528
6529 : determine where site specific libraries go.
6530 : Usual default is /usr/local/lib/perl5/site_perl/$version
6531 : The default "style" setting is made in installstyle.U
6532 : XXX No longer works with Prefixit stuff.
6533 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6534 case "$sitelib" in
6535 '') case "$installstyle" in
6536         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6537         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6538         esac
6539         ;;
6540 *)      dflt="$sitelib"
6541         ;;
6542 esac
6543 $cat <<EOM
6544
6545 The installation process will create a directory for
6546 site-specific extensions and modules.  Most users find it convenient
6547 to place all site-specific files in this directory rather than in the
6548 main distribution directory.
6549
6550 EOM
6551 fn=d~+
6552 rp='Pathname for the site-specific library files?'
6553 . ./getfile
6554 prefixvar=sitelib
6555 . ./setprefixvar
6556 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6557
6558 : determine where site specific architecture-dependent libraries go.
6559 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6560 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6561 : sitelib may have an optional trailing /share.
6562 case "$sitearch" in
6563 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6564         dflt="$dflt/$archname"
6565         ;;
6566 *)      dflt="$sitearch"
6567         ;;
6568 esac
6569 set sitearch sitearch none
6570 eval $prefixit
6571 $cat <<EOM
6572
6573 The installation process will also create a directory for
6574 architecture-dependent site-specific extensions and modules.
6575
6576 EOM
6577 fn=d~+
6578 rp='Pathname for the site-specific architecture-dependent library files?'
6579 . ./getfile
6580 prefixvar=sitearch
6581 . ./setprefixvar
6582
6583 $cat <<EOM
6584
6585 The installation process will also create a directory for
6586 vendor-supplied add-ons.  Vendors who supply perl with their system
6587 may find it convenient to place all vendor-supplied files in this
6588 directory rather than in the main distribution directory.  This will
6589 ease upgrades between binary-compatible maintenance versions of perl.
6590
6591 Of course you may also use these directories in whatever way you see
6592 fit.  For example, you might use them to access modules shared over a
6593 company-wide network.
6594
6595 The default answer should be fine for most people.
6596 This causes further questions about vendor add-ons to be skipped
6597 and no vendor-specific directories will be configured for perl.
6598
6599 EOM
6600 rp='Do you want to configure vendor-specific add-on directories?'
6601 case "$usevendorprefix" in
6602 define|true|[yY]*) dflt=y ;;
6603 *)      : User may have set vendorprefix directly on Configure command line.
6604         case "$vendorprefix" in
6605         ''|' ') dflt=n ;;
6606         *)      dflt=y ;;
6607         esac
6608         ;;
6609 esac
6610 . ./myread
6611 case "$ans" in
6612 [yY]*)  fn=d~+
6613         rp='Installation prefix to use for vendor-supplied add-ons?'
6614         case "$vendorprefix" in
6615         '') dflt='' ;;
6616         *)  dflt=$vendorprefix ;;
6617         esac
6618         . ./getfile
6619         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6620         oldvendorprefix=''
6621         case "$vendorprefix" in
6622         '') ;;
6623         *)      case "$ans" in
6624                 "$prefix") ;;
6625                 *) oldvendorprefix="$prefix";;
6626                 esac
6627                 ;;
6628         esac
6629         usevendorprefix="$define"
6630         vendorprefix="$ans"
6631         vendorprefixexp="$ansexp"
6632         ;;
6633 *)      usevendorprefix="$undef"
6634         vendorprefix=''
6635         vendorprefixexp=''
6636         ;;
6637 esac
6638
6639 case "$vendorprefix" in
6640 '')     d_vendorlib="$undef"
6641         vendorlib=''
6642         vendorlibexp=''
6643         ;;
6644 *)      d_vendorlib="$define"
6645         : determine where vendor-supplied modules go.
6646         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6647         case "$vendorlib" in
6648         '')
6649                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6650                 case "$installstyle" in
6651                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6652                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6653                 esac
6654                 ;;
6655         *)      dflt="$vendorlib"
6656                 ;;
6657         esac
6658         fn=d~+
6659         rp='Pathname for the vendor-supplied library files?'
6660         . ./getfile
6661         vendorlib="$ans"
6662         vendorlibexp="$ansexp"
6663         ;;
6664 esac
6665 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6666 prefixvar=vendorlib
6667 . ./installprefix
6668
6669 case "$vendorprefix" in
6670 '')     d_vendorarch="$undef"
6671         vendorarch=''
6672         vendorarchexp=''
6673         ;;
6674 *)      d_vendorarch="$define"
6675         : determine where vendor-supplied architecture-dependent libraries go.
6676         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6677         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6678         : vendorlib may have an optional trailing /share.
6679         case "$vendorarch" in
6680         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6681                 dflt="$dflt/$archname"
6682                 ;;
6683         *)      dflt="$vendorarch" ;;
6684         esac
6685         fn=d~+
6686         rp='Pathname for vendor-supplied architecture-dependent files?'
6687         . ./getfile
6688         vendorarch="$ans"
6689         vendorarchexp="$ansexp"
6690         ;;
6691 esac
6692 prefixvar=vendorarch
6693 . ./installprefix
6694
6695 : Final catch-all directories to search
6696 $cat <<EOM
6697
6698 Lastly, you can have perl look in other directories for extensions and
6699 modules in addition to those already specified.
6700 These directories will be searched after 
6701         $sitearch 
6702         $sitelib 
6703 EOM
6704 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6705 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6706 echo ' '
6707 case "$otherlibdirs" in
6708 ''|' ') dflt='none' ;;
6709 *)      dflt="$otherlibdirs" ;;
6710 esac
6711 $cat <<EOM
6712 Enter a colon-separated set of extra paths to include in perl's @INC
6713 search path, or enter 'none' for no extra paths.
6714
6715 EOM
6716
6717 rp='Colon-separated list of additional directories for perl to search?'
6718 . ./myread
6719 case "$ans" in
6720 ' '|''|none)    otherlibdirs=' ' ;;     
6721 *)      otherlibdirs="$ans" ;;
6722 esac
6723 case "$otherlibdirs" in
6724 ' ') val=$undef ;;
6725 *)      val=$define ;;
6726 esac
6727 set d_perl_otherlibdirs
6728 eval $setvar
6729
6730 : Cruising for prototypes
6731 echo " "
6732 echo "Checking out function prototypes..." >&4
6733 $cat >prototype.c <<EOCP
6734 #$i_stdlib I_STDLIB
6735 #ifdef I_STDLIB
6736 #include <stdlib.h>
6737 #endif
6738 int main(int argc, char *argv[]) {
6739         exit(0);}
6740 EOCP
6741 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6742         echo "Your C compiler appears to support function prototypes."
6743         val="$define"
6744 else
6745         echo "Your C compiler doesn't seem to understand function prototypes."
6746         val="$undef"
6747 fi
6748 set prototype
6749 eval $setvar
6750 $rm -f prototype*
6751
6752 case "$prototype" in
6753 "$define") ;;
6754 *)      ansi2knr='ansi2knr'
6755         echo " "
6756         cat <<EOM >&4
6757
6758 $me:  FATAL ERROR:
6759 This version of $package can only be compiled by a compiler that 
6760 understands function prototypes.  Unfortunately, your C compiler 
6761         $cc $ccflags
6762 doesn't seem to understand them.  Sorry about that.
6763
6764 If GNU cc is available for your system, perhaps you could try that instead.  
6765
6766 Eventually, we hope to support building Perl with pre-ANSI compilers.
6767 If you would like to help in that effort, please contact <perlbug@perl.org>.
6768
6769 Aborting Configure now.
6770 EOM
6771         exit 2
6772         ;;
6773 esac
6774
6775 echo " "
6776 case "$extras" in
6777 '') dflt='n';;
6778 *) dflt='y';;
6779 esac
6780 cat <<EOM
6781 Perl can be built with extra modules or bundles of modules which
6782 will be fetched from the CPAN and installed alongside Perl.
6783
6784 Notice that you will need access to the CPAN; either via the Internet,
6785 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6786 be asked later to configure the CPAN.pm module which will in turn do
6787 the installation of the rest of the extra modules or bundles.)
6788
6789 Notice also that if the modules require any external software such as
6790 libraries and headers (the libz library and the zlib.h header for the
6791 Compress::Zlib module, for example) you MUST have any such software
6792 already installed, this configuration process will NOT install such
6793 things for you.
6794
6795 If this doesn't make any sense to you, just accept the default '$dflt'.
6796 EOM
6797 rp='Install any extra modules (y or n)?'
6798 . ./myread
6799 case "$ans" in
6800 y|Y)
6801         cat <<EOM
6802
6803 Please list any extra modules or bundles to be installed from CPAN,
6804 with spaces between the names.  The names can be in any format the
6805 'install' command of CPAN.pm will understand.  (Answer 'none',
6806 without the quotes, to install no extra modules or bundles.)
6807 EOM
6808         rp='Extras?'
6809         dflt="$extras"
6810         . ./myread
6811         extras="$ans"
6812 esac
6813 case "$extras" in
6814 ''|'none')
6815         val=''
6816         $rm -f ../extras.lst
6817         ;;
6818 *)      echo "(Saving the list of extras for later...)"
6819         echo "$extras" > ../extras.lst
6820         val="'$extras'"
6821         ;;
6822 esac
6823 set extras
6824 eval $setvar
6825 echo " "
6826
6827 : determine where html pages for programs go
6828 set html1dir html1dir none
6829 eval $prefixit
6830 $cat <<EOM
6831
6832 If you wish to install html files for programs in $spackage, indicate 
6833 the appropriate directory here.  To skip installing html files,
6834 answer "none".
6835 EOM
6836 case "$html1dir" in
6837 ''|none|$undef|' ') dflt=none ;;
6838 *) dflt=$html1dir ;;
6839 esac
6840 fn=dn+~
6841 rp="Directory for the main $spackage html pages?"
6842 . ./getfile
6843 prefixvar=html1dir
6844 . ./setprefixvar
6845 : Use ' ' for none so value is preserved next time through Configure
6846 $test X"$html1dir" = "X" && html1dir=' '
6847
6848 : determine where html pages for libraries and modules go
6849 set html3dir html3dir none
6850 eval $prefixit
6851 $cat <<EOM
6852
6853 If you wish to install html files for modules associated with $spackage,
6854 indicate the appropriate directory here.  To skip installing html files,
6855 answer "none".
6856 EOM
6857 : There is no obvious default.  If they have specified html1dir, then
6858 : try to key off that, possibly changing .../html1 into .../html3.
6859 case "$html3dir" in
6860 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6861 *) dflt=$html3dir ;;
6862 esac
6863 fn=dn+~
6864 rp="Directory for the $spackage module html pages?"
6865 . ./getfile
6866 prefixvar=html3dir
6867 . ./setprefixvar
6868 : Use ' ' for none so value is preserved next time through Configure
6869 $test X"$html3dir" = "X" && html3dir=' '
6870
6871 : Find perl5.005 or later.
6872 echo "Looking for a previously installed perl5.005 or later... "
6873 case "$perl5" in
6874 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6875                 : Check if this perl is recent and can load a simple module
6876                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6877                         perl5=$tdir/perl
6878                         break;
6879                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6880                         perl5=$tdir/perl5
6881                         break;
6882                 fi
6883         done
6884         ;;
6885 *)      perl5="$perl5"
6886         ;;
6887 esac
6888 case "$perl5" in
6889 '')     echo "None found.  That's ok.";;
6890 *)      echo "Using $perl5." ;;
6891 esac
6892
6893 : Determine list of previous versions to include in @INC
6894 $cat > getverlist <<EOPL
6895 #!$perl5 -w
6896 use File::Basename;
6897 \$api_versionstring = "$api_versionstring";
6898 \$version = "$version";
6899 \$stem = "$sitelib_stem";
6900 \$archname = "$archname";
6901 EOPL
6902         $cat >> getverlist <<'EOPL'
6903 # Can't have leading @ because metaconfig interprets it as a command!
6904 ;@inc_version_list=();
6905 # XXX Redo to do opendir/readdir? 
6906 if (-d $stem) {
6907     chdir($stem);
6908     ;@candidates = glob("5.*");
6909 }
6910 else {
6911     ;@candidates = ();
6912 }
6913
6914 # XXX ToDo:  These comparisons must be reworked when two-digit
6915 # subversions come along, so that 5.7.10 compares as greater than
6916 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6917 # widespread that we can use the built-in version vectors rather
6918 # than reinventing them here.  For 5.6.0, however, we must
6919 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6920 foreach $d (@candidates) {
6921     if ($d lt $version) {
6922         if ($d ge $api_versionstring) {
6923             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6924         }
6925         elsif ($d ge "5.005") {
6926             unshift(@inc_version_list, grep { -d } $d);
6927         }
6928     }
6929     else {
6930         # Skip newer version.  I.e. don't look in
6931         # 5.7.0 if we're installing 5.6.1.
6932     }
6933 }
6934
6935 if (@inc_version_list) {
6936     print join(' ', @inc_version_list);
6937 }
6938 else {
6939     # Blank space to preserve value for next Configure run.
6940     print " ";
6941 }
6942 EOPL
6943 chmod +x getverlist
6944 case "$inc_version_list" in
6945 '')     if test -x "$perl5$exe_ext"; then
6946                 dflt=`$perl5 getverlist`
6947         else
6948                 dflt='none'
6949         fi
6950         ;;
6951 $undef) dflt='none' ;;
6952 *)  eval dflt=\"$inc_version_list\" ;;
6953 esac
6954 case "$dflt" in
6955 ''|' ') dflt=none ;;
6956 esac
6957 case "$dflt" in
6958 5.005) dflt=none ;;
6959 esac
6960 $cat <<EOM
6961
6962 In order to ease the process of upgrading, this version of perl 
6963 can be configured to use modules built and installed with earlier 
6964 versions of perl that were installed under $prefix.  Specify here
6965 the list of earlier versions that this version of perl should check.
6966 If Configure detected no earlier versions of perl installed under
6967 $prefix, then the list will be empty.  Answer 'none' to tell perl
6968 to not search earlier versions.
6969
6970 The default should almost always be sensible, so if you're not sure,
6971 just accept the default.
6972 EOM
6973
6974 rp='List of earlier versions to include in @INC?'
6975 . ./myread
6976 case "$ans" in
6977 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6978 *) inc_version_list="$ans" ;;
6979 esac
6980 case "$inc_version_list" in
6981 ''|' ') 
6982         inc_version_list_init='0';;
6983 *)      inc_version_list_init=`echo $inc_version_list |
6984                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6985         ;;
6986 esac
6987 $rm -f getverlist
6988
6989 : determine whether to install perl also as /usr/bin/perl
6990
6991 echo " "
6992 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6993         $cat <<EOM
6994 Many scripts expect perl to be installed as /usr/bin/perl.
6995
6996 If you want to, I can install the perl you are about to compile
6997 as /usr/bin/perl (in addition to $bin/perl).
6998 EOM
6999         if test -f /usr/bin/perl; then
7000             $cat <<EOM
7001
7002 However, please note that because you already have a /usr/bin/perl,
7003 overwriting that with a new Perl would very probably cause problems.
7004 Therefore I'm assuming you don't want to do that (unless you insist).
7005
7006 EOM
7007             case "$installusrbinperl" in
7008             "$define"|[yY]*)    dflt='y';;
7009             *)                  dflt='n';;
7010             esac
7011         else
7012             $cat <<EOM
7013
7014 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7015
7016 EOM
7017             case "$installusrbinperl" in
7018             "$undef"|[nN]*)     dflt='n';;
7019             *)                  dflt='y';;
7020             esac
7021         fi
7022         rp="Do you want to install perl as /usr/bin/perl?"
7023         . ./myread
7024         case "$ans" in
7025         [yY]*)  val="$define";;
7026         *)      val="$undef" ;;
7027         esac
7028 else
7029         val="$undef"
7030 fi
7031 set installusrbinperl
7032 eval $setvar
7033
7034 echo " "
7035 echo "Checking for GNU C Library..." >&4
7036 cat >try.c <<'EOCP'
7037 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7038    alone are insufficient to distinguish different versions, such as
7039    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7040    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7041 */
7042 #include <stdio.h>
7043 int main(void)
7044 {
7045 #ifdef __GLIBC__
7046 #   ifdef __GLIBC_MINOR__
7047 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7048 #           include <gnu/libc-version.h>
7049             printf("%s\n",  gnu_get_libc_version());
7050 #       else
7051             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7052 #       endif
7053 #   else
7054         printf("%d\n",  __GLIBC__);
7055 #   endif
7056     return 0;
7057 #else
7058     return 1;
7059 #endif
7060 }
7061 EOCP
7062 set try
7063 if eval $compile_ok && $run ./try > glibc.ver; then
7064         val="$define"
7065         gnulibc_version=`$cat glibc.ver`
7066         echo "You are using the GNU C Library version $gnulibc_version"
7067 else
7068         val="$undef"
7069         gnulibc_version=''
7070         echo "You are not using the GNU C Library"
7071 fi
7072 $rm -f try try.* glibc.ver
7073 set d_gnulibc
7074 eval $setvar
7075
7076 : see if nm is to be used to determine whether a symbol is defined or not
7077 case "$usenm" in
7078 '')
7079         dflt=''
7080         case "$d_gnulibc" in
7081         "$define")
7082                 echo " "
7083                 echo "nm probably won't work on the GNU C Library." >&4
7084                 dflt=n
7085                 ;;
7086         esac
7087         case "$dflt" in
7088         '') 
7089                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7090                         echo " "
7091                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7092                         echo "'nm' won't be sufficient on this sytem." >&4
7093                         dflt=n
7094                 fi
7095                 ;;
7096         esac
7097         case "$dflt" in
7098         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7099                 if $test $dflt -gt 20; then
7100                         dflt=y
7101                 else
7102                         dflt=n
7103                 fi
7104                 ;;
7105         esac
7106         ;;
7107 *)
7108         case "$usenm" in
7109         true|$define) dflt=y;;
7110         *) dflt=n;;
7111         esac
7112         ;;
7113 esac
7114 $cat <<EOM
7115
7116 I can use $nm to extract the symbols from your C libraries. This
7117 is a time consuming task which may generate huge output on the disk (up
7118 to 3 megabytes) but that should make the symbols extraction faster. The
7119 alternative is to skip the 'nm' extraction part and to compile a small
7120 test program instead to determine whether each symbol is present. If
7121 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7122 this may be the best solution.
7123
7124 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7125
7126 EOM
7127 rp="Shall I use $nm to extract C symbols from the libraries?"
7128 . ./myread
7129 case "$ans" in
7130 [Nn]*) usenm=false;;
7131 *) usenm=true;;
7132 esac
7133
7134 runnm=$usenm
7135 case "$reuseval" in
7136 true) runnm=false;;
7137 esac
7138
7139 : nm options which may be necessary
7140 case "$nm_opt" in
7141 '') if $test -f /mach_boot; then
7142                 nm_opt=''       # Mach
7143         elif $test -d /usr/ccs/lib; then
7144                 nm_opt='-p'     # Solaris (and SunOS?)
7145         elif $test -f /dgux; then
7146                 nm_opt='-p'     # DG-UX
7147         elif $test -f /lib64/rld; then
7148                 nm_opt='-p'     # 64-bit Irix
7149         else
7150                 nm_opt=''
7151         fi;;
7152 esac
7153
7154 : nm options which may be necessary for shared libraries but illegal
7155 : for archive libraries.  Thank you, Linux.
7156 case "$nm_so_opt" in
7157 '')     case "$myuname" in
7158         *linux*|gnu*)
7159                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7160                         nm_so_opt='--dynamic'
7161                 fi
7162                 ;;
7163         esac
7164         ;;
7165 esac
7166
7167 case "$runnm" in
7168 true)
7169 : get list of predefined functions in a handy place
7170 echo " "
7171 case "$libc" in
7172 '') libc=unknown
7173         case "$libs" in
7174         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7175         esac
7176         ;;
7177 esac
7178 case "$libs" in
7179 '') ;;
7180 *)  for thislib in $libs; do
7181         case "$thislib" in
7182         -lc|-lc_s)
7183                 : Handle C library specially below.
7184                 ;;
7185         -l*)
7186                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7187                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7188                         :
7189                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7190                         :
7191                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7192                         :
7193                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7194                         :
7195                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7196                         :
7197                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7198                         :
7199                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7200                         :
7201                 else
7202                         try=''
7203                 fi
7204                 libnames="$libnames $try"
7205                 ;;
7206         *) libnames="$libnames $thislib" ;;
7207         esac
7208         done
7209         ;;
7210 esac
7211 xxx=normal
7212 case "$libc" in
7213 unknown)
7214         set /lib/libc.$so
7215         for xxx in $libpth; do
7216                 $test -r $1 || set $xxx/libc.$so
7217                 : The messy sed command sorts on library version numbers.
7218                 $test -r $1 || \
7219                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7220                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7221                                 h
7222                                 s/[0-9][0-9]*/0000&/g
7223                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7224                                 G
7225                                 s/\n/ /' | \
7226                          $sort | $sed -e 's/^.* //'`
7227                 eval set \$$#
7228         done
7229         $test -r $1 || set /usr/ccs/lib/libc.$so
7230         $test -r $1 || set /lib/libsys_s$_a
7231         ;;
7232 *)
7233         set blurfl
7234         ;;
7235 esac
7236 if $test -r "$1"; then
7237         echo "Your (shared) C library seems to be in $1."
7238         libc="$1"
7239 elif $test -r /lib/libc && $test -r /lib/clib; then
7240         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7241         xxx=apollo
7242         libc='/lib/clib /lib/libc'
7243         if $test -r /lib/syslib; then
7244                 echo "(Your math library is in /lib/syslib.)"
7245                 libc="$libc /lib/syslib"
7246         fi
7247 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7248         echo "Your C library seems to be in $libc, as you said before."
7249 elif $test -r $incpath/usr/lib/libc$_a; then
7250         libc=$incpath/usr/lib/libc$_a;
7251         echo "Your C library seems to be in $libc.  That's fine."
7252 elif $test -r /lib/libc$_a; then
7253         libc=/lib/libc$_a;
7254         echo "Your C library seems to be in $libc.  You're normal."
7255 else
7256         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7257                 :
7258         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7259                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7260         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7261                 :
7262         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7263                 :
7264         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7265                 :
7266         else
7267                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7268         fi
7269         if $test -r "$tans"; then
7270                 echo "Your C library seems to be in $tans, of all places."
7271                 libc=$tans
7272         else
7273                 libc='blurfl'
7274         fi
7275 fi
7276 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7277         dflt="$libc"
7278         cat <<EOM
7279
7280 If the guess above is wrong (which it might be if you're using a strange
7281 compiler, or your machine supports multiple models), you can override it here.
7282
7283 EOM
7284 else
7285         dflt=''
7286         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7287         cat >&4 <<EOM
7288 I can't seem to find your C library.  I've looked in the following places:
7289
7290 EOM
7291         $sed 's/^/      /' libpath
7292         cat <<EOM
7293
7294 None of these seems to contain your C library. I need to get its name...
7295
7296 EOM
7297 fi
7298 fn=f
7299 rp='Where is your C library?'
7300 . ./getfile
7301 libc="$ans"
7302
7303 echo " "
7304 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7305 set X `cat libnames`
7306 shift
7307 xxx=files
7308 case $# in 1) xxx=file; esac
7309 echo "Extracting names from the following $xxx for later perusal:" >&4
7310 echo " "
7311 $sed 's/^/      /' libnames >&4
7312 echo " "
7313 $echo $n "This may take a while...$c" >&4
7314
7315 for file in $*; do
7316         case $file in
7317         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7318         *) $nm $nm_opt $file 2>/dev/null;;
7319         esac
7320 done >libc.tmp
7321
7322 $echo $n ".$c"
7323 $grep fprintf libc.tmp > libc.ptf
7324 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7325 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7326 xxx='[ADTSIW]'
7327 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7328         eval $xscan;\
7329         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7330                 eval $xrun
7331 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7332         eval $xscan;\
7333         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7334                 eval $xrun
7335 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7336         eval $xscan;\
7337         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7338                 eval $xrun
7339 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7340         eval $xscan;\
7341         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7342                 eval $xrun
7343 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7344         eval $xscan;\
7345         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7346                 eval $xrun
7347 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7348         eval $xscan;\
7349         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7350                 eval $xrun
7351 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7352                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7353         eval $xscan;\
7354         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7355                 eval $xrun
7356 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7357         eval $xscan;\
7358         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7359                 eval $xrun
7360 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7361         eval $xscan;\
7362         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7363                 eval $xrun
7364 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7365         eval $xscan;\
7366         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7367                 eval $xrun
7368 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7369         eval $xscan;\
7370         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7371                 eval $xrun
7372 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7373         eval $xscan;\
7374         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7375                 eval $xrun
7376 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7377         eval $xscan;\
7378         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7379                 eval $xrun
7380 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7381         eval $xscan;\
7382         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7383                 eval $xrun
7384 else
7385         $nm -p $* 2>/dev/null >libc.tmp
7386         $grep fprintf libc.tmp > libc.ptf
7387         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7388                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7389         then
7390                 nm_opt='-p'
7391                 eval $xrun
7392         else
7393                 echo " "
7394                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7395                 com=''
7396                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7397                         for thisname in $libnames $libc; do
7398                                 $ar t $thisname >>libc.tmp
7399                         done
7400                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7401                         echo "Ok." >&4
7402                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7403                         # Repeat libc to extract forwarders to DLL entries too
7404                         for thisname in $libnames $libc; do
7405                                 $ar tv $thisname >>libc.tmp
7406                                 # Revision 50 of EMX has bug in $ar.
7407                                 # it will not extract forwarders to DLL entries
7408                                 # Use emximp which will extract exactly them.
7409                                 emximp -o tmp.imp $thisname \
7410                                     2>/dev/null && \
7411                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7412                                     < tmp.imp >>libc.tmp
7413                                 $rm tmp.imp
7414                         done
7415                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7416                         echo "Ok." >&4
7417                 else
7418                         echo "$ar didn't seem to work right." >&4
7419                         echo "Maybe this is a Cray...trying bld instead..." >&4
7420                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7421                         then
7422                                 for thisname in $libnames; do
7423                                         bld t $libnames | \
7424                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7425                                         $ar t $thisname >>libc.tmp
7426                                 done
7427                                 echo "Ok." >&4
7428                         else
7429                                 echo "That didn't work either.  Giving up." >&4
7430                                 exit 1
7431                         fi
7432                 fi
7433         fi
7434 fi
7435 nm_extract="$com"
7436 case "$PASE" in
7437 define)
7438     echo " "
7439     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7440     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7441     ;;
7442 *)  if $test -f /lib/syscalls.exp; then
7443         echo " "
7444         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7445         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7446     fi
7447     ;;
7448 esac
7449 ;;
7450 esac
7451 $rm -f libnames libpath
7452
7453 : see if dld is available
7454 set dld.h i_dld
7455 eval $inhdr
7456
7457 : is a C symbol defined?
7458 csym='tlook=$1;
7459 case "$3" in
7460 -v) tf=libc.tmp; tdc="";;
7461 -a) tf=libc.tmp; tdc="[]";;
7462 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7463 esac;
7464 tx=yes;
7465 case "$reuseval-$4" in
7466 true-) ;;
7467 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7468 esac;
7469 case "$tx" in
7470 yes)
7471         tval=false;
7472         if $test "$runnm" = true; then
7473                 if $contains $tlook $tf >/dev/null 2>&1; then
7474                         tval=true;
7475                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7476                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7477                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7478                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7479                         $rm -f try$_exe try.c core core.* try.core;
7480                 fi;
7481         else
7482                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7483                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7484                 $rm -f try$_exe try.c;
7485         fi;
7486         ;;
7487 *)
7488         case "$tval" in
7489         $define) tval=true;;
7490         *) tval=false;;
7491         esac;
7492         ;;
7493 esac;
7494 eval "$2=$tval"'
7495
7496 : define an is-in-libc? function
7497 inlibc='echo " "; td=$define; tu=$undef;
7498 sym=$1; var=$2; eval "was=\$$2";
7499 tx=yes;
7500 case "$reuseval$was" in
7501 true) ;;
7502 true*) tx=no;;
7503 esac;
7504 case "$tx" in
7505 yes)
7506         set $sym tres -f;
7507         eval $csym;
7508         case "$tres" in
7509         true)
7510                 echo "$sym() found." >&4;
7511                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7512         *)
7513                 echo "$sym() NOT found." >&4;
7514                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7515         esac;;
7516 *)
7517         case "$was" in
7518         $define) echo "$sym() found." >&4;;
7519         *) echo "$sym() NOT found." >&4;;
7520         esac;;
7521 esac'
7522
7523 : see if dlopen exists
7524 xxx_runnm="$runnm"
7525 runnm=false
7526 set dlopen d_dlopen
7527 eval $inlibc
7528 runnm="$xxx_runnm"
7529
7530 : determine which dynamic loading, if any, to compile in
7531 echo " "
7532 dldir="ext/DynaLoader"
7533 case "$usedl" in
7534 $define|y|true)
7535         dflt='y'
7536         usedl="$define"
7537         ;;
7538 $undef|n|false)
7539         dflt='n'
7540         usedl="$undef"
7541         ;;
7542 *) 
7543         dflt='n'
7544         case "$d_dlopen" in
7545             $define) dflt='y' ;;
7546         esac
7547         case "$i_dld" in
7548             $define) dflt='y' ;;
7549         esac
7550         : Does a dl_xxx.xs file exist for this operating system
7551         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7552         ;;
7553 esac
7554 rp="Do you wish to use dynamic loading?"
7555 . ./myread
7556 usedl="$ans"
7557 case "$ans" in
7558 y*) usedl="$define"
7559         case "$dlsrc" in
7560         '')
7561                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7562                         dflt="$dldir/dl_${osname}.xs"
7563                 elif $test "$d_dlopen" = "$define" ; then
7564                         dflt="$dldir/dl_dlopen.xs"
7565                 elif $test "$i_dld" = "$define" ; then
7566                         dflt="$dldir/dl_dld.xs"
7567                 else
7568                         dflt=''
7569                 fi
7570                 ;;
7571         *)      dflt="$dldir/$dlsrc"
7572                 ;;
7573         esac
7574     echo "The following dynamic loading files are available:"
7575         : Can not go over to $dldir because getfile has path hard-coded in.
7576         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7577         rp="Source file to use for dynamic loading"
7578         fn="fne"
7579         gfpth="$src"
7580         . ./getfile
7581         usedl="$define"
7582         : emulate basename
7583         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7584
7585         $cat << EOM
7586
7587 Some systems may require passing special flags to $cc -c to
7588 compile modules that will be used to create a shared library.
7589 To use no flags, say "none".
7590
7591 EOM
7592     case "$cccdlflags" in
7593     '') case "$gccversion" in
7594                 '') case "$osname" in
7595                         hpux)   dflt='+z' ;;
7596                         next)   dflt='none' ;;
7597                         irix*)  dflt='-KPIC' ;;
7598                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7599                         sunos)  dflt='-pic' ;;
7600                         *)      dflt='none' ;;
7601                     esac
7602                         ;;
7603                 *)  case "$osname" in
7604                         darwin) dflt='none' ;;
7605                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7606                         *)      dflt='-fpic' ;;
7607                     esac ;;
7608             esac ;;
7609         ' ') dflt='none' ;;
7610     *)  dflt="$cccdlflags" ;;
7611     esac
7612     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7613     . ./myread
7614     case "$ans" in
7615     none) cccdlflags=' ' ;;
7616     *) cccdlflags="$ans" ;;
7617     esac
7618
7619     cat << EOM
7620
7621 Some systems use ld to create libraries that can be dynamically loaded,
7622 while other systems (such as those using ELF) use $cc.
7623
7624 EOM
7625         case "$ld" in
7626         '')     $cat >try.c <<EOM
7627 /* Test for whether ELF binaries are produced */
7628 #include <fcntl.h>
7629 #$i_stdlib I_STDLIB
7630 #ifdef I_STDLIB
7631 #include <stdlib.h>
7632 #endif
7633 int main() {
7634         char b[4];
7635         int i = open("a.out",O_RDONLY);
7636         if(i == -1) 
7637                 exit(1); /* fail */
7638         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7639                 exit(0); /* succeed (yes, it's ELF) */
7640         else
7641                 exit(1); /* fail */
7642 }
7643 EOM
7644                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7645                         cat <<EOM
7646 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7647 EOM
7648                         dflt="$cc"
7649                 else
7650                         echo "I'll use ld to build dynamic libraries."
7651                         dflt='ld'
7652                 fi
7653                 rm -f try.c a.out
7654                 ;;
7655         *)      dflt="$ld"
7656                 ;;
7657         esac
7658
7659     rp="What command should be used to create dynamic libraries?"
7660     . ./myread
7661         ld="$ans"
7662
7663     cat << EOM
7664
7665 Some systems may require passing special flags to $ld to create a
7666 library that can be dynamically loaded.  If your ld flags include
7667 -L/other/path options to locate libraries outside your loader's normal
7668 search path, you may need to specify those -L options here as well.  To
7669 use no flags, say "none".
7670
7671 EOM
7672     case "$lddlflags" in
7673     '') case "$osname" in
7674                         beos) dflt='-nostart' ;;
7675                         hpux) dflt='-b';
7676                               case "$gccversion" in
7677                               '') dflt="$dflt +vnocompatwarnings" ;;
7678                               esac
7679                               ;;        
7680                         linux|irix*|gnu*)       dflt='-shared' ;;
7681                         next)  dflt='none' ;;
7682                         solaris) dflt='-G' ;;
7683                         sunos) dflt='-assert nodefinitions' ;;
7684                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7685                 *)     dflt='none' ;;
7686                         esac
7687                         ;;
7688     *) dflt="$lddlflags" ;;
7689     esac
7690
7691         : Try to guess additional flags to pick up local libraries.
7692         : Be careful not to append to a plain 'none'
7693         case "$dflt" in
7694         none) dflt='' ;;
7695         esac
7696         for thisflag in $ldflags; do
7697                 case "$thisflag" in
7698                 -L*|-R*|-Wl,-R*)
7699                         case " $dflt " in
7700                         *" $thisflag "*) ;;
7701                         *) dflt="$dflt $thisflag" ;;
7702                         esac
7703                         ;;
7704                 esac
7705         done
7706
7707         case "$dflt" in
7708         ''|' ') dflt='none' ;;
7709         esac
7710
7711     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7712     . ./myread
7713     case "$ans" in
7714     none) lddlflags=' ' ;;
7715     *) lddlflags="$ans" ;;
7716     esac
7717
7718         cat <<EOM
7719
7720 Some systems may require passing special flags to $cc to indicate that
7721 the resulting executable will use dynamic linking.  To use no flags,
7722 say "none".
7723
7724 EOM
7725     case "$ccdlflags" in
7726     '') case "$osname" in
7727             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7728             next|sunos) dflt='none' ;;
7729             *)          dflt='none' ;;
7730             esac ;;
7731     ' ')  dflt='none' ;;
7732     *)  dflt="$ccdlflags" ;;
7733     esac
7734     rp="Any special flags to pass to $cc to use dynamic linking?"
7735     . ./myread
7736     case "$ans" in
7737     none) ccdlflags=' ' ;;
7738     *) ccdlflags="$ans" ;;
7739     esac
7740     ;;
7741 *)  usedl="$undef"
7742         ld='ld'
7743     dlsrc='dl_none.xs'
7744     lddlflags=''
7745     ccdlflags=''
7746     ;;
7747 esac
7748
7749 also=''
7750 case "$usedl" in
7751 $undef)
7752         # No dynamic loading being used, so don't bother even to prompt.
7753         useshrplib='false'
7754         ;;
7755 *)      case "$useshrplib" in
7756         '')     case "$osname" in
7757                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7758                         dflt=y
7759                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7760                         ;;
7761                 next*)
7762                         case "$osvers" in
7763                         4*)     dflt=y
7764                                 also='Building a shared libperl is needed for MAB support.'
7765                                 ;;
7766                         *)      dflt=n
7767                                 ;;
7768                         esac
7769                         ;;
7770                 *)      dflt=n
7771                         ;;
7772                 esac
7773                 ;;
7774         $define|true|[Yy]*)
7775                 dflt=y
7776                 ;;
7777         *)      dflt=n
7778                 ;;
7779         esac
7780         $cat << EOM
7781
7782 The perl executable is normally obtained by linking perlmain.c with
7783 libperl${_a}, any static extensions (usually just DynaLoader), and
7784 any other libraries needed on this system (such as -lm, etc.).  Since
7785 your system supports dynamic loading, it is probably possible to build
7786 a shared libperl.$so.  If you will have more than one executable linked
7787 to libperl.$so, this will significantly reduce the size of each
7788 executable, but it may have a noticeable effect on performance.  The
7789 default is probably sensible for your system.
7790 $also
7791
7792 EOM
7793         rp="Build a shared libperl.$so (y/n)"
7794         . ./myread
7795         case "$ans" in
7796         true|$define|[Yy]*)
7797                 useshrplib='true'  ;;
7798         *)      useshrplib='false' ;;
7799         esac
7800         ;;
7801 esac
7802
7803 case "$useshrplib" in
7804 true)
7805         case "$libperl" in
7806         '')
7807                 # Figure out a good name for libperl.so.  Since it gets stored in
7808                 # a version-specific architecture-dependent library, the version
7809                 # number isn't really that important, except for making cc/ld happy.
7810                 #
7811                 # A name such as libperl.so.3.1
7812                 majmin="libperl.$so.$patchlevel.$subversion"
7813                 # A name such as libperl.so.301
7814                 majonly=`echo $patchlevel $subversion |
7815                         $awk '{printf "%d%02d", $1, $2}'`
7816                 majonly=libperl.$so.$majonly
7817                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7818                 # rely on figuring it out from the naming of libc.
7819                 case "${osname}${osvers}" in
7820                 next4*)
7821                         dflt=libperl.5.$so
7822                         # XXX How handle the --version stuff for MAB?
7823                         ;;
7824                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7825                         dflt=libperl.$so
7826                         ;;
7827                 cygwin*) # ld links against an importlib
7828                         dflt=libperl$lib_ext
7829                         ;;
7830                 *)      # Try to guess based on whether libc has major.minor.
7831                         case "$libc" in
7832                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7833                         *libc.$so.[0-9]*) dflt=$majonly ;;
7834                         *)      dflt=libperl.$so ;;
7835                         esac
7836                         ;;
7837                 esac
7838                 ;;
7839         *)      dflt=$libperl
7840                 ;;
7841         esac
7842         cat << EOM
7843
7844 I need to select a good name for the shared libperl.  If your system uses
7845 library names with major and minor numbers, then you might want something
7846 like $majmin.  Alternatively, if your system uses a single version
7847 number for shared libraries, then you might want to use $majonly.
7848 Or, your system might be quite happy with a simple libperl.$so.
7849
7850 Since the shared libperl will get installed into a version-specific
7851 architecture-dependent directory, the version number of the shared perl
7852 library probably isn't important, so the default should be o.k.
7853
7854 EOM
7855         rp='What name do you want to give to the shared libperl?'
7856         . ./myread
7857         libperl=$ans
7858         echo "Ok, I'll use $libperl"
7859         ;;
7860 *)
7861         libperl="libperl${_a}"
7862         ;;
7863 esac
7864
7865 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7866 case "$shrpdir" in
7867 '') ;;
7868 *)      $cat >&4 <<EOM
7869 WARNING:  Use of the shrpdir variable for the installation location of
7870 the shared $libperl is not supported.  It was never documented and
7871 will not work in this version.  Let me (perlbug@perl.org)
7872 know of any problems this may cause.
7873
7874 EOM
7875         case "$shrpdir" in
7876         "$archlibexp/CORE")
7877                 $cat >&4 <<EOM
7878 But your current setting of $shrpdir is
7879 the default anyway, so it's harmless.
7880 EOM
7881                 ;;
7882         *)
7883                 $cat >&4 <<EOM
7884 Further, your current attempted setting of $shrpdir
7885 conflicts with the value of $archlibexp/CORE
7886 that installperl will use.
7887 EOM
7888                 ;;
7889         esac
7890         ;;
7891 esac
7892
7893 # How will the perl executable find the installed shared $libperl?
7894 # Add $xxx to ccdlflags.
7895 # If we can't figure out a command-line option, use $shrpenv to
7896 # set env LD_RUN_PATH.  The main perl makefile uses this.
7897 shrpdir=$archlibexp/CORE
7898 xxx=''
7899 tmp_shrpenv=''
7900 if "$useshrplib"; then
7901     case "$osname" in 
7902         aix)
7903                 # We'll set it in Makefile.SH...
7904                 ;;
7905         solaris)
7906                 xxx="-R $shrpdir"
7907                 ;;
7908         freebsd|netbsd|openbsd|interix|dragonfly)
7909                 xxx="-Wl,-R$shrpdir"
7910                 ;;
7911         bsdos|linux|irix*|dec_osf|gnu*)
7912                 xxx="-Wl,-rpath,$shrpdir"
7913                 ;;
7914         next)
7915                 # next doesn't like the default...
7916                 ;;
7917         beos)
7918                 # beos doesn't like the default, either.
7919                 ;;
7920         hpux*)
7921                 # hpux doesn't like the default, either.
7922                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7923                 ;;
7924         *)
7925                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7926                 ;;
7927         esac
7928         case "$xxx" in
7929         '') ;;
7930         *)      
7931                 # Only add $xxx if it isn't already in ccdlflags.
7932                 case " $ccdlflags " in
7933                 *" $xxx "*)     ;;
7934                 *)      ccdlflags="$ccdlflags $xxx"
7935                         cat <<EOM >&4
7936
7937 Adding $xxx to the flags
7938 passed to $ld so that the perl executable will find the 
7939 installed shared $libperl.
7940
7941 EOM
7942                         ;;
7943                 esac
7944                 ;;
7945         esac
7946 fi
7947 # Fix ccdlflags in AIX for building external extensions.
7948 # (For building Perl itself bare -bE:perl.exp is needed,
7949 #  Makefile.SH takes care of this.)
7950 case "$osname" in
7951 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7952 esac
7953 # Respect a hint or command-line value.
7954 case "$shrpenv" in
7955 '') shrpenv="$tmp_shrpenv" ;;
7956 esac
7957 case "$ldlibpthname" in
7958 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7959 none)   ldlibpthname='' ;;
7960 esac
7961
7962 : determine where manual pages are on this system
7963 echo " "
7964 case "$sysman" in
7965 '') 
7966         syspath='/usr/share/man/man1 /usr/man/man1'
7967         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7968         syspath="$syspath /usr/man/u_man/man1"
7969         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7970         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7971         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7972         sysman=`./loc . /usr/man/man1 $syspath`
7973         ;;
7974 esac
7975 if $test -d "$sysman"; then
7976         echo "System manual is in $sysman." >&4
7977 else
7978         echo "Could not find manual pages in source form." >&4
7979 fi
7980
7981 : determine where manual pages go
7982 set man1dir man1dir none
7983 eval $prefixit
7984 $cat <<EOM
7985
7986 $spackage has manual pages available in source form.
7987 EOM
7988 case "$nroff" in
7989 nroff)
7990         echo "However, you don't have nroff, so they're probably useless to you."
7991         case "$man1dir" in
7992         '') man1dir="none";;
7993         esac;;
7994 esac
7995 echo "If you don't want the manual sources installed, answer 'none'."
7996 case "$man1dir" in
7997 ' ') dflt=none
7998         ;;
7999 '')
8000         lookpath="$prefixexp/share/man/man1"
8001         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8002         lookpath="$lookpath $prefixexp/man/p_man/man1"
8003         lookpath="$lookpath $prefixexp/man/u_man/man1"
8004         lookpath="$lookpath $prefixexp/man/man.1"
8005         case "$sysman" in
8006         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8007         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8008         esac
8009         set dflt
8010         eval $prefixup
8011         ;;
8012 *)  dflt="$man1dir"
8013         ;;
8014 esac
8015 echo " "
8016 fn=dn+~
8017 rp="Where do the main $spackage manual pages (source) go?"
8018 . ./getfile
8019 if $test "X$man1direxp" != "X$ansexp"; then
8020         installman1dir=''
8021 fi
8022 prefixvar=man1dir
8023 . ./setprefixvar
8024
8025 case "$man1dir" in
8026 '')     man1dir=' '
8027         installman1dir='';;
8028 esac
8029
8030 : What suffix to use on installed man pages
8031
8032 case "$man1dir" in
8033 ' ')
8034         man1ext='0'
8035         ;;
8036 *)
8037         rp="What suffix should be used for the main $spackage man pages?"
8038         case "$man1ext" in
8039         '')     case "$man1dir" in
8040                 *1)  dflt=1 ;;
8041                 *1p) dflt=1p ;;
8042                 *1pm) dflt=1pm ;;
8043                 *l) dflt=l;;
8044                 *n) dflt=n;;
8045                 *o) dflt=o;;
8046                 *p) dflt=p;;
8047                 *C) dflt=C;;
8048                 *L) dflt=L;;
8049                 *L1) dflt=L1;;
8050                 *) dflt=1;;
8051                 esac
8052                 ;;
8053         *)      dflt="$man1ext";;
8054         esac
8055         . ./myread
8056         man1ext="$ans"
8057         ;;
8058 esac
8059
8060 : see if we can have long filenames
8061 echo " "
8062 first=123456789abcdef
8063 $rm -f $first
8064 if (echo hi >$first) 2>/dev/null; then
8065         if $test -f 123456789abcde; then
8066                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8067                 val="$undef"
8068         else
8069                 echo 'You can have filenames longer than 14 characters.'>&4
8070                 val="$define"
8071         fi
8072 else
8073         $cat <<'EOM'
8074 You can't have filenames longer than 14 chars.
8075 You can't even think about them!
8076 EOM
8077         val="$undef"
8078 fi 
8079 set d_flexfnam
8080 eval $setvar
8081 $rm -rf 123456789abcde*
8082
8083 : determine where library module manual pages go
8084 set man3dir man3dir none
8085 eval $prefixit
8086 $cat <<EOM
8087
8088 $spackage has manual pages for many of the library modules.
8089 EOM
8090
8091 case "$nroff" in
8092 nroff)
8093         $cat <<'EOM'
8094 However, you don't have nroff, so they're probably useless to you.
8095 EOM
8096         case "$man3dir" in
8097         '') man3dir="none";;
8098         esac;;
8099 esac
8100
8101 case "$d_flexfnam" in
8102 undef)
8103         $cat <<'EOM'
8104 However, your system can't handle the long file names like File::Basename.3. 
8105 EOM
8106         case "$man3dir" in
8107         '') man3dir="none";;
8108         esac;;
8109 esac
8110
8111 echo "If you don't want the manual sources installed, answer 'none'."
8112 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8113 case "$man3dir" in
8114 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8115         if $test -d "$privlib/man/man3"; then
8116                 cat <<EOM >&4
8117
8118 WARNING:  Previous versions of perl installed man3 pages into
8119 $privlib/man/man3.  This version will suggest a 
8120 new default of $dflt.  
8121 EOM
8122                 tdflt=$dflt
8123                 dflt='n'
8124                 rp='Do you wish to preserve the old behavior?(y/n)'
8125                 . ./myread
8126                 case "$ans" in
8127                 y*) dflt="$privlib/man/man3" ;;
8128                 *)  dflt=$tdflt ;;
8129                 esac
8130     fi
8131         ;;
8132 *)      dflt="$man3dir" ;;
8133 esac
8134 case "$dflt" in
8135 ' ') dflt=none ;;
8136 esac
8137 echo " "
8138 fn=dn+~
8139 rp="Where do the $package library man pages (source) go?"
8140 . ./getfile
8141 prefixvar=man3dir
8142 . ./setprefixvar
8143
8144 case "$man3dir" in
8145 '')     man3dir=' '
8146         installman3dir='';;
8147 esac
8148
8149 : What suffix to use on installed man pages
8150 case "$man3dir" in
8151 ' ')
8152         man3ext='0'
8153         ;;
8154 *)
8155         rp="What suffix should be used for the $package library man pages?"
8156         case "$man3ext" in
8157         '')     case "$man3dir" in
8158                 *3)  dflt=3 ;;
8159                 *3p) dflt=3p ;;
8160                 *3pm) dflt=3pm ;;
8161                 *l) dflt=l;;
8162                 *n) dflt=n;;
8163                 *o) dflt=o;;
8164                 *p) dflt=p;;
8165                 *C) dflt=C;;
8166                 *L) dflt=L;;
8167                 *L3) dflt=L3;;
8168                 *) dflt=3;;
8169                 esac
8170                 ;;
8171         *)      dflt="$man3ext";;
8172         esac
8173         . ./myread
8174         man3ext="$ans"
8175         ;;
8176 esac
8177
8178 : see if we have to deal with yellow pages, now NIS.
8179 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8180         if $test -f /usr/etc/nibindd; then
8181                 echo " "
8182                 echo "I'm fairly confident you're on a NeXT."
8183                 echo " "
8184                 rp='Do you get the hosts file via NetInfo?'
8185                 dflt=y
8186                 case "$hostcat" in
8187                 nidump*) ;;
8188                 '') ;;
8189                 *) dflt=n;;
8190                 esac
8191                 . ./myread
8192                 case "$ans" in
8193                 y*) hostcat='nidump hosts .';;
8194                 *)      case "$hostcat" in
8195                         nidump*) hostcat='';;
8196                         esac
8197                         ;;
8198                 esac
8199         fi
8200         case "$hostcat" in
8201         nidump*) ;;
8202         *)
8203                 case "$hostcat" in
8204                 *ypcat*) dflt=y;;
8205                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8206                                 dflt=y
8207                         else
8208                                 dflt=n
8209                         fi;;
8210                 *) dflt=n;;
8211                 esac
8212                 echo " "
8213                 rp='Are you getting the hosts file via yellow pages?'
8214                 . ./myread
8215                 case "$ans" in
8216                 y*) hostcat='ypcat hosts';;
8217                 *) hostcat='cat /etc/hosts';;
8218                 esac
8219                 ;;
8220         esac
8221 fi
8222 case "$hostcat" in
8223 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8224 esac
8225 case "$groupcat" in
8226 '') test -f /etc/group && groupcat='cat /etc/group';;
8227 esac
8228 case "$passcat" in
8229 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8230 esac
8231
8232 : now get the host name
8233 echo " "
8234 echo "Figuring out host name..." >&4
8235 case "$myhostname" in
8236 '') cont=true
8237         echo 'Maybe "hostname" will work...'
8238         if tans=`sh -c hostname 2>&1` ; then
8239                 myhostname=$tans
8240                 phostname=hostname
8241                 cont=''
8242         fi
8243         ;;
8244 *) cont='';;
8245 esac
8246 if $test "$cont"; then
8247         if ./xenix; then
8248                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8249                 if tans=`cat /etc/systemid 2>&1` ; then
8250                         myhostname=$tans
8251                         phostname='cat /etc/systemid'
8252                         echo "Whadyaknow.  Xenix always was a bit strange..."
8253                         cont=''
8254                 fi
8255         elif $test -r /etc/systemid; then
8256                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8257         fi
8258 fi
8259 if $test "$cont"; then
8260         echo 'No, maybe "uuname -l" will work...'
8261         if tans=`sh -c 'uuname -l' 2>&1` ; then
8262                 myhostname=$tans
8263                 phostname='uuname -l'
8264         else
8265                 echo 'Strange.  Maybe "uname -n" will work...'
8266                 if tans=`sh -c 'uname -n' 2>&1` ; then
8267                         myhostname=$tans
8268                         phostname='uname -n'
8269                 else
8270                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8271                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8272                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8273                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8274                         else
8275                                 case "$myhostname" in
8276                                 '') echo "Does this machine have an identity crisis or something?"
8277                                         phostname='';;
8278                                 *)
8279                                         echo "Well, you said $myhostname before..."
8280                                         phostname='echo $myhostname';;
8281                                 esac
8282                         fi
8283                 fi
8284         fi
8285 fi
8286 case "$myhostname" in
8287 '') myhostname=noname ;;
8288 esac
8289 : you do not want to know about this
8290 set $myhostname
8291 myhostname=$1
8292
8293 : verify guess
8294 if $test "$myhostname" ; then
8295         dflt=y
8296         rp='Your host name appears to be "'$myhostname'".'" Right?"
8297         . ./myread
8298         case "$ans" in
8299         y*) ;;
8300         *) myhostname='';;
8301         esac
8302 fi
8303
8304 : bad guess or no guess
8305 while $test "X$myhostname" = X ; do
8306         dflt=''
8307         rp="Please type the (one word) name of your host:"
8308         . ./myread
8309         myhostname="$ans"
8310 done
8311
8312 : translate upper to lower if necessary
8313 case "$myhostname" in
8314 *[A-Z]*)
8315         echo "(Normalizing case in your host name)"
8316         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8317         ;;
8318 esac
8319
8320 case "$myhostname" in
8321 *.*)
8322         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8323         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8324         echo "(Trimming domain name from host name--host name is now $myhostname)"
8325         ;;
8326 *) case "$mydomain" in
8327         '')
8328                 {
8329                         test "X$hostcat" = "Xypcat hosts" &&
8330                         ypmatch "$myhostname" hosts 2>/dev/null |\
8331                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8332                         $test -s hosts
8333                 } || {
8334                         test "X$hostcat" != "X" &&
8335                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8336                                         /[       ]$myhostname[  . ]/p" > hosts
8337                 }
8338                 tmp_re="[       . ]"
8339                 if $test -f hosts; then
8340                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8341                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8342                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8343                                 hosts | $sort | $uniq | \
8344                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8345                         case `$echo X$dflt` in
8346                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8347                                 dflt=.
8348                                 ;;
8349                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8350                                 ;;
8351                         esac
8352                 else
8353                         echo "(I cannot locate a hosts database anywhere)"
8354                         dflt=.
8355                 fi
8356                 case "$dflt" in
8357                 .)
8358                         tans=`./loc resolv.conf X /etc /usr/etc`
8359                         if $test -f "$tans"; then
8360                                 echo "(Attempting domain name extraction from $tans)"
8361                                 dflt=.`$sed -n -e 's/   / /g' \
8362                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8363                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8364                                 case "$dflt" in
8365                                 .) dflt=.`$sed -n -e 's/        / /g' \
8366                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8367                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8368                                         ;;
8369                                 esac
8370                         fi
8371                         ;;
8372                 esac
8373                 case "$dflt" in
8374                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8375                         dflt=.`sh -c domainname 2>/dev/null`
8376                         case "$dflt" in
8377                         '') dflt='.';;
8378                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8379                         esac
8380                         ;;
8381                 esac
8382                 case "$dflt$osname" in
8383                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8384                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8385                         ;;
8386                 esac
8387                 case "$dflt" in
8388                 .) echo "(Lost all hope -- silly guess then)"
8389                         dflt='.nonet'
8390                         ;;
8391                 esac
8392                 $rm -f hosts
8393                 ;;
8394         *) dflt="$mydomain";;
8395         esac;;
8396 esac
8397 echo " "
8398 rp="What is your domain name?"
8399 . ./myread
8400 tans="$ans"
8401 case "$ans" in
8402 '') ;;
8403 .*) ;;
8404 *) tans=".$tans";;
8405 esac
8406 mydomain="$tans"
8407
8408 : translate upper to lower if necessary
8409 case "$mydomain" in
8410 *[A-Z]*)
8411         echo "(Normalizing case in your domain name)"
8412         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8413         ;;
8414 esac
8415
8416 : a little sanity check here
8417 case "$phostname" in
8418 '') ;;
8419 *)
8420         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8421         $myhostname$mydomain|$myhostname) ;;
8422         *)
8423                 case "$phostname" in
8424                 sed*)
8425                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8426                         ;;
8427                 *)
8428                         echo "(That doesn't agree with your $phostname command, by the way.)"
8429                         ;;
8430                 esac
8431         ;;
8432         esac
8433         ;;
8434 esac
8435
8436 $cat <<EOM
8437
8438 I need to get your e-mail address in Internet format if possible, i.e.
8439 something like user@host.domain. Please answer accurately since I have
8440 no easy means to double check it. The default value provided below
8441 is most probably close to reality but may not be valid from outside
8442 your organization...
8443
8444 EOM
8445 cont=x
8446 while test "$cont"; do
8447         case "$cf_email" in
8448         '') dflt="$cf_by@$myhostname$mydomain";;
8449         *) dflt="$cf_email";;
8450         esac
8451         rp='What is your e-mail address?'
8452         . ./myread
8453         cf_email="$ans"
8454         case "$cf_email" in
8455         *@*.*) cont='' ;;
8456         *)
8457                 rp='Address does not look like an Internet one.  Use it anyway?'
8458                 case "$fastread" in
8459                 yes) dflt=y ;;
8460                 *) dflt=n ;;
8461                 esac
8462                 . ./myread
8463                 case "$ans" in
8464                 y*) cont='' ;;
8465                 *) echo " " ;;
8466                 esac
8467                 ;;
8468         esac
8469 done
8470
8471 $cat <<EOM
8472
8473 If you or somebody else will be maintaining perl at your site, please
8474 fill in the correct e-mail address here so that they may be contacted
8475 if necessary. Currently, the "perlbug" program included with perl
8476 will send mail to this address in addition to perlbug@perl.org. You may
8477 enter "none" for no administrator.
8478
8479 EOM
8480 case "$perladmin" in
8481 '') dflt="$cf_email";;
8482 *) dflt="$perladmin";;
8483 esac
8484 rp='Perl administrator e-mail address'
8485 . ./myread
8486 perladmin="$ans"
8487
8488 : determine whether to only install version-specific parts.
8489 echo " "
8490 $cat <<EOM
8491 Do you want to install only the version-specific parts of the perl
8492 distribution?  Usually you do *not* want to do this.
8493 EOM
8494 case "$versiononly" in
8495 "$define"|[Yy]*|true) dflt='y' ;;
8496 *) dflt='n';
8497 esac
8498 rp="Do you want to install only the version-specific parts of perl?"
8499 . ./myread
8500 case "$ans" in
8501 [yY]*)  val="$define";;
8502 *)      val="$undef" ;;
8503 esac
8504 set versiononly
8505 eval $setvar
8506
8507 case "$versiononly" in
8508 "$define") inc_version_list=''
8509            inc_version_list_init=0
8510            ;;
8511 esac
8512
8513 : figure out how to guarantee perl startup
8514 case "$startperl" in
8515 '')
8516         case "$sharpbang" in
8517         *!)
8518                 $cat <<EOH
8519
8520 I can use the #! construct to start perl on your system. This will
8521 make startup of perl scripts faster, but may cause problems if you
8522 want to share those scripts and perl is not in a standard place
8523 ($binexp/perl) on all your platforms. The alternative is to force
8524 a shell by starting the script with a single ':' character.
8525
8526 EOH
8527                 case "$versiononly" in
8528                 "$define")      dflt="$binexp/perl$version";;  
8529                 *)              dflt="$binexp/perl";;
8530                 esac
8531                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8532                 . ./myread
8533                 case "$ans" in
8534                 none)   startperl=": # use perl";;
8535                 *)      startperl="#!$ans"
8536                         if $test 30 -lt `echo "$ans" | wc -c`; then
8537                                 $cat >&4 <<EOM
8538
8539 WARNING:  Some systems limit the #! command to 32 characters.
8540 If you experience difficulty running Perl scripts with #!, try
8541 installing Perl in a directory with a shorter pathname.
8542
8543 EOM
8544                         fi ;;
8545                 esac
8546                 ;;
8547         *) startperl=": # use perl"
8548                 ;;
8549         esac
8550         ;;
8551 esac
8552 echo "I'll use $startperl to start perl scripts."
8553
8554 : figure best path for perl in scripts
8555 case "$perlpath" in
8556 '')
8557         case "$versiononly" in
8558         "$define")      perlpath="$binexp/perl$version";;
8559         *)              perlpath="$binexp/perl";;
8560         esac
8561         case "$startperl" in
8562         *!*) ;;
8563         *)
8564                 $cat <<EOH
8565
8566 I will use the "eval 'exec'" idiom to start Perl on your system.
8567 I can use the full path of your Perl binary for this purpose, but
8568 doing so may cause problems if you want to share those scripts and
8569 Perl is not always in a standard place ($binexp/perl).
8570
8571 EOH
8572                 dflt="$binexp/perl"
8573                 rp="What path shall I use in \"eval 'exec'\"?"
8574                 . ./myread
8575                 perlpath="$ans"
8576                 ;;
8577         esac
8578         ;;
8579 esac
8580 case "$startperl" in
8581 *!*)    ;;
8582 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8583 esac
8584
8585 : determine where public executable scripts go
8586 set scriptdir scriptdir
8587 eval $prefixit
8588 case "$scriptdir" in
8589 '')
8590         dflt="$bin"
8591         : guess some guesses
8592         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8593         $test -d /usr/share/bin     && dflt=/usr/share/bin
8594         $test -d /usr/local/script  && dflt=/usr/local/script
8595         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8596         $test -d $prefixexp/script  && dflt=$prefixexp/script
8597         set dflt
8598         eval $prefixup
8599         ;;
8600 *)  dflt="$scriptdir"
8601         ;;
8602 esac
8603 $cat <<EOM
8604  
8605 Some installations have a separate directory just for executable scripts so
8606 that they can mount it across multiple architectures but keep the scripts in
8607 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8608 Or you might just lump your scripts in with all your other executables.
8609  
8610 EOM
8611 fn=d~
8612 rp='Where do you keep publicly executable scripts?'
8613 . ./getfile
8614 if $test "X$ansexp" != "X$scriptdirexp"; then
8615         installscript=''
8616 fi
8617 prefixvar=scriptdir
8618 . ./setprefixvar
8619 : A little fix up for an irregularly named variable.
8620 installscript="$installscriptdir"
8621
8622
8623 : determine where add-on public executables go
8624 case "$sitebin" in
8625 '')     dflt=$siteprefix/bin ;;
8626 *)      dflt=$sitebin ;;
8627 esac
8628 fn=d~
8629 rp='Pathname where the add-on public executables should be installed?'
8630 . ./getfile
8631 prefixvar=sitebin
8632 . ./setprefixvar
8633
8634 : determine where add-on html pages go
8635 : There is no standard location, so try to copy the previously-selected
8636 : directory structure for the core html pages.
8637 case "$sitehtml1dir" in
8638 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8639 *)     dflt=$sitehtml1dir ;;
8640 esac
8641 case "$dflt" in
8642 ''|' ') dflt=none ;;
8643 esac
8644 fn=dn+~
8645 rp='Pathname where the site-specific html pages should be installed?'
8646 . ./getfile
8647 prefixvar=sitehtml1dir
8648 . ./setprefixvar
8649
8650 : determine where add-on library html pages go
8651 : There is no standard location, so try to copy the previously-selected
8652 : directory structure for the core html pages.
8653 case "$sitehtml3dir" in
8654 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8655 *)     dflt=$sitehtml3dir ;;
8656 esac
8657 case "$dflt" in
8658 ''|' ') dflt=none ;;
8659 esac
8660 fn=dn+~
8661 rp='Pathname where the site-specific library html pages should be installed?'
8662 . ./getfile
8663 prefixvar=sitehtml3dir
8664 . ./setprefixvar
8665
8666 : determine where add-on manual pages go
8667 case "$siteman1dir" in
8668 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8669 *)      dflt=$siteman1dir ;;
8670 esac
8671 case "$dflt" in
8672 ''|' ') dflt=none ;;
8673 esac
8674 fn=dn+~
8675 rp='Pathname where the site-specific manual pages should be installed?'
8676 . ./getfile
8677 prefixvar=siteman1dir
8678 . ./setprefixvar
8679
8680 : determine where add-on library man pages go
8681 case "$siteman3dir" in
8682 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8683 *)      dflt=$siteman3dir ;;
8684 esac
8685 case "$dflt" in
8686 ''|' ') dflt=none ;;
8687 esac
8688 fn=dn+~
8689 rp='Pathname where the site-specific library manual pages should be installed?'
8690 . ./getfile
8691 prefixvar=siteman3dir
8692 . ./setprefixvar
8693
8694 : determine where add-on public executable scripts go
8695 case "$sitescript" in
8696 '')     dflt=$siteprefix/script
8697         $test -d $dflt || dflt=$sitebin ;;
8698 *)  dflt="$sitescript" ;;
8699 esac
8700 fn=d~+
8701 rp='Pathname where add-on public executable scripts should be installed?'
8702 . ./getfile
8703 prefixvar=sitescript
8704 . ./setprefixvar
8705
8706 case "$usefaststdio" in
8707 $define|true|[yY]*|'')
8708         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8709         case "$xversion" in
8710         [68])   dflt='y' ;;
8711         *)      dflt='n' ;;
8712         esac
8713         ;;
8714 *) dflt='n';;
8715 esac
8716 cat <<EOM
8717
8718 Perl can be built to use 'fast stdio', which means using the stdio
8719 library but also directly manipulating the stdio buffers to enable
8720 faster I/O.  Using stdio is better for backward compatibility (especially
8721 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8722 interface has been preferred instead of stdio.
8723
8724 If this doesn't make any sense to you, just accept the default '$dflt'.
8725 EOM
8726 rp='Use the "fast stdio" if available?'
8727 . ./myread
8728 case "$ans" in
8729 y|Y)    val="$define" ;;     
8730 *)      val="$undef" ;;
8731 esac
8732 set usefaststdio
8733 eval $setvar
8734
8735
8736 : define an is-a-typedef? function
8737 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8738 case "$inclist" in
8739 "") inclist="sys/types.h";;
8740 esac;
8741 eval "varval=\$$var";
8742 case "$varval" in
8743 "")
8744         $rm -f temp.c;
8745         for inc in $inclist; do
8746                 echo "#include <$inc>" >>temp.c;
8747         done;
8748         echo "#ifdef $type" >> temp.c;
8749         echo "printf(\"We have $type\");" >> temp.c;
8750         echo "#endif" >> temp.c;
8751         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8752         if $contains $type temp.E >/dev/null 2>&1; then
8753                 eval "$var=\$type";
8754         else
8755                 eval "$var=\$def";
8756         fi;
8757         $rm -f temp.?;;
8758 *) eval "$var=\$varval";;
8759 esac'
8760
8761 : define an is-a-typedef? function that prompts if the type is not available.
8762 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8763 case "$inclist" in
8764 "") inclist="sys/types.h";;
8765 esac;
8766 eval "varval=\$$var";
8767 case "$varval" in
8768 "")
8769         $rm -f temp.c;
8770         for inc in $inclist; do
8771                 echo "#include <$inc>" >>temp.c;
8772         done;
8773         echo "#ifdef $type" >> temp.c;
8774         echo "printf(\"We have $type\");" >> temp.c;
8775         echo "#endif" >> temp.c;
8776         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8777         echo " " ;
8778         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8779         if $contains $type temp.E >/dev/null 2>&1; then
8780                 echo "$type found." >&4;
8781                 eval "$var=\$type";
8782         else
8783                 echo "$type NOT found." >&4;
8784                 dflt="$def";
8785                 . ./myread ;
8786                 eval "$var=\$ans";
8787         fi;
8788         $rm -f temp.?;;
8789 *) eval "$var=\$varval";;
8790 esac'
8791
8792 : see what type lseek is declared as in the kernel
8793 rp="What is the type used for lseek's offset on this system?"
8794 set off_t lseektype long stdio.h sys/types.h
8795 eval $typedef_ask
8796
8797 echo " "
8798 echo "Checking to see how big your file offsets are..." >&4
8799 $cat >try.c <<EOCP
8800 #include <sys/types.h>
8801 #include <stdio.h>
8802 int main()
8803 {
8804     printf("%d\n", (int)sizeof($lseektype));
8805     return(0); 
8806 }
8807 EOCP
8808 set try
8809 if eval $compile_ok; then
8810         lseeksize=`$run ./try`
8811         echo "Your file offsets are $lseeksize bytes long."
8812 else
8813         dflt=$longsize
8814         echo " "
8815         echo "(I can't seem to compile the test program.  Guessing...)"
8816         rp="What is the size of your file offsets (in bytes)?"
8817         . ./myread
8818         lseeksize="$ans"
8819 fi
8820 $rm -f try.c try
8821
8822 : see what type file positions are declared as in the library
8823 rp="What is the type for file position used by fsetpos()?"
8824 set fpos_t fpostype long stdio.h sys/types.h
8825 eval $typedef_ask
8826
8827 echo " "
8828 case "$fpostype" in
8829 *_t) zzz="$fpostype"    ;;
8830 *)   zzz="fpos_t"       ;;
8831 esac
8832 echo "Checking the size of $zzz..." >&4 
8833 cat > try.c <<EOCP
8834 #include <sys/types.h>
8835 #include <stdio.h>
8836 #$i_stdlib I_STDLIB
8837 #ifdef I_STDLIB
8838 #include <stdlib.h>
8839 #endif
8840 int main() {
8841     printf("%d\n", (int)sizeof($fpostype));
8842     exit(0);
8843 }
8844 EOCP
8845 set try
8846 if eval $compile_ok; then
8847         yyy=`$run ./try`
8848         case "$yyy" in
8849         '')     fpossize=4
8850                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8851                 ;;
8852         *)      fpossize=$yyy
8853                 echo "Your $zzz is $fpossize bytes long."
8854                 ;;
8855         esac
8856 else
8857         dflt="$longsize"
8858         echo " " >&4
8859         echo "(I can't compile the test program.  Guessing...)" >&4
8860         rp="What is the size of your file positions (in bytes)?"
8861         . ./myread
8862         fpossize="$ans"
8863 fi
8864
8865 # Backward compatibility (uselfs is deprecated).
8866 case "$uselfs" in
8867 "$define"|true|[yY]*)
8868         cat <<EOM >&4
8869
8870 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8871 EOM
8872         uselargefiles="$define"
8873         ;;
8874 esac                          
8875
8876 case "$lseeksize:$fpossize" in
8877 8:8) cat <<EOM
8878
8879 You can have files larger than 2 gigabytes.
8880 EOM
8881    val="$define" ;;
8882 *)    case "$uselargefiles" in
8883    "$undef"|false|[nN]*) dflt='n' ;;
8884    *)   dflt='y' ;;
8885    esac
8886    cat <<EOM
8887
8888 Perl can be built to understand large files (files larger than 2 gigabytes)
8889 on some systems.  To do so, Configure can be run with -Duselargefiles.
8890
8891 If this doesn't make any sense to you, just accept the default '$dflt'.
8892 EOM
8893    rp='Try to understand large files, if available?'
8894    . ./myread
8895    case "$ans" in
8896    y|Y)         val="$define" ;;
8897    *)           val="$undef"  ;;
8898    esac
8899    ;;
8900 esac
8901 set uselargefiles
8902 eval $setvar
8903 : Look for a hint-file generated 'call-back-unit'.  If the
8904 : user has specified that a large files perl is to be built,
8905 : we may need to set or change some other defaults.
8906 if $test -f uselargefiles.cbu; then
8907         echo "Your platform has some specific hints regarding large file builds, using them..."
8908         . ./uselargefiles.cbu
8909 fi
8910 case "$uselargefiles" in
8911 "$define")
8912         if $test -f uselargefiles.cbu; then
8913                 echo " "
8914                 echo "Rechecking to see how big your file offsets are..." >&4
8915                 $cat >try.c <<EOCP
8916 #include <sys/types.h>
8917 #include <stdio.h>
8918 int main()
8919 {
8920     printf("%d\n", (int)sizeof($lseektype));
8921     return(0); 
8922 }
8923 EOCP
8924                 set try
8925                 if eval $compile_ok; then
8926                         lseeksize=`$run ./try`
8927                         $echo "Your file offsets are now $lseeksize bytes long."
8928                 else
8929                         dflt="$lseeksize"
8930                         echo " "
8931                         echo "(I can't seem to compile the test program.  Guessing...)"
8932                         rp="What is the size of your file offsets (in bytes)?"
8933                         . ./myread
8934                         lseeksize="$ans"
8935                 fi
8936                 case "$fpostype" in
8937                 *_t) zzz="$fpostype"    ;;
8938                 *)   zzz="fpos_t"       ;;
8939                 esac
8940                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8941                 $cat > try.c <<EOCP
8942 #include <sys/types.h>
8943 #include <stdio.h>
8944 #$i_stdlib I_STDLIB
8945 #ifdef I_STDLIB
8946 #include <stdlib.h>
8947 #endif
8948 int main() {
8949     printf("%d\n", (int)sizeof($fpostype));
8950     return(0);
8951 }
8952 EOCP
8953                 set try
8954                 if eval $compile_ok; then
8955                         yyy=`$run ./try`
8956                         dflt="$lseeksize"
8957                         case "$yyy" in
8958                         '')     echo " "
8959                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8960                                 ;;
8961                         *)      fpossize=$yyy
8962                                 echo " $fpossize bytes." >&4
8963                                 ;;
8964                         esac
8965                 else
8966                         dflt="$fpossize"
8967                         echo " "
8968                         echo "(I can't compile the test program.  Guessing...)" >&4
8969                         rp="What is the size of your file positions (in bytes)?"
8970                         . ./myread
8971                         fpossize="$ans"
8972                 fi
8973                 $rm -f try.c try
8974         fi
8975         ;;
8976 esac
8977
8978 case "$vendorprefix" in
8979 '')     d_vendorbin="$undef"
8980         vendorbin=''
8981         vendorbinexp=''
8982         ;;
8983 *)      d_vendorbin="$define"
8984         : determine where vendor-supplied executables go.
8985         case "$vendorbin" in
8986         '') dflt=$vendorprefix/bin ;;
8987         *)      dflt="$vendorbin" ;;
8988         esac
8989         fn=d~+
8990         rp='Pathname for the vendor-supplied executables directory?'
8991         . ./getfile
8992         vendorbin="$ans"
8993         vendorbinexp="$ansexp"
8994         ;;
8995 esac
8996 prefixvar=vendorbin
8997 . ./installprefix
8998
8999 case "$vendorprefix" in
9000 '')     vendorhtml1dir=''
9001         vendorhtml1direxp=''
9002         ;;
9003 *)      : determine where vendor-supplied html pages go.
9004         : There is no standard location, so try to copy the previously-selected
9005         : directory structure for the core html pages.
9006         : XXX Better default suggestions would be welcome.
9007         case "$vendorhtml1dir" in
9008         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9009         *)      dflt=$vendorhtml1dir ;;
9010         esac
9011         case "$dflt" in
9012         ''|' ') dflt=none ;;
9013         esac
9014         fn=dn+~
9015         rp='Pathname for the vendor-supplied html pages?'
9016         . ./getfile
9017         vendorhtml1dir="$ans"
9018         vendorhtml1direxp="$ansexp"
9019         ;;
9020 esac
9021 : Use ' ' for none so value is preserved next time through Configure
9022 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9023 prefixvar=vendorhtml1dir
9024 . ./installprefix
9025
9026 case "$vendorprefix" in
9027 '')     vendorhtml3dir=''
9028         vendorhtml3direxp=''
9029         ;;
9030 *)      : determine where vendor-supplied module html pages go.
9031         : There is no standard location, so try to copy the previously-selected
9032         : directory structure for the core html pages.
9033         : XXX Better default suggestions would be welcome.
9034         case "$vendorhtml3dir" in
9035         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9036         *)      dflt=$vendorhtml3dir ;;
9037         esac
9038         case "$dflt" in
9039         ''|' ') dflt=none ;;
9040         esac
9041         fn=dn+~
9042         rp='Pathname for the vendor-supplied html pages?'
9043         . ./getfile
9044         vendorhtml3dir="$ans"
9045         vendorhtml3direxp="$ansexp"
9046         ;;
9047 esac
9048 : Use ' ' for none so value is preserved next time through Configure
9049 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9050 prefixvar=vendorhtml3dir
9051 . ./installprefix
9052
9053 case "$vendorprefix" in
9054 '')     vendorman1dir=''
9055         vendorman1direxp=''
9056         ;;
9057 *)      : determine where vendor-supplied manual pages go.
9058         case "$vendorman1dir" in
9059         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9060         *)      dflt=$vendorman1dir ;;
9061         esac
9062         case "$dflt" in
9063         ''|' ') dflt=none ;;
9064         esac
9065         fn=nd~+
9066         rp='Pathname for the vendor-supplied manual section 1 pages?'
9067         . ./getfile
9068         vendorman1dir="$ans"
9069         vendorman1direxp="$ansexp"
9070         ;;
9071 esac
9072 : Use ' ' for none so value is preserved next time through Configure
9073 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9074 prefixvar=vendorman1dir
9075 . ./installprefix
9076
9077 case "$vendorprefix" in
9078 '')     vendorman3dir=''
9079         vendorman3direxp=''
9080         ;;
9081 *)      : determine where vendor-supplied module manual pages go.
9082         case "$vendorman3dir" in
9083         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9084         *)      dflt=$vendorman3dir ;;
9085         esac
9086         case "$dflt" in
9087         ''|' ') dflt=none ;;
9088         esac
9089         fn=nd~+
9090         rp='Pathname for the vendor-supplied manual section 3 pages?'
9091         . ./getfile
9092         vendorman3dir="$ans"
9093         vendorman3direxp="$ansexp"
9094         ;;
9095 esac
9096 : Use ' ' for none so value is preserved next time through Configure
9097 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9098 prefixvar=vendorman3dir
9099 . ./installprefix
9100
9101 case "$vendorprefix" in
9102 '')     d_vendorscript="$undef"
9103         vendorscript=''
9104         vendorscriptexp=''
9105         ;;
9106 *)      d_vendorscript="$define"
9107         : determine where vendor-supplied scripts go.
9108         case "$vendorscript" in
9109         '')     dflt=$vendorprefix/script
9110                 $test -d $dflt || dflt=$vendorbin ;;
9111         *)  dflt="$vendorscript" ;;
9112         esac
9113         $cat <<EOM
9114
9115 The installation process will create a directory for 
9116 vendor-supplied scripts.
9117
9118 EOM
9119         fn=d~+
9120         rp='Pathname for the vendor-supplied scripts directory?'
9121         . ./getfile
9122         vendorscript="$ans"
9123         vendorscriptexp="$ansexp"
9124         ;;
9125 esac
9126 prefixvar=vendorscript
9127 . ./installprefix
9128
9129 : see if qgcvt exists
9130 set qgcvt d_qgcvt
9131 eval $inlibc
9132
9133 echo " "
9134
9135 if $test X"$d_longdbl" = X"$define"; then
9136
9137 echo "Checking how to print long doubles..." >&4
9138
9139 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9140         $cat >try.c <<'EOCP'
9141 #include <sys/types.h>
9142 #include <stdio.h>
9143 int main() {
9144   double d = 123.456;
9145   printf("%.3f\n", d);
9146 }
9147 EOCP
9148         set try
9149         if eval $compile; then
9150                 yyy=`$run ./try`
9151                 case "$yyy" in
9152                 123.456)
9153                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9154                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9155                         echo "We will use %f."
9156                         ;;
9157                 esac
9158         fi
9159 fi
9160
9161 if $test X"$sPRIfldbl" = X; then
9162         $cat >try.c <<'EOCP'
9163 #include <sys/types.h>
9164 #include <stdio.h>
9165 int main() {
9166   long double d = 123.456;
9167   printf("%.3Lf\n", d);
9168 }
9169 EOCP
9170         set try
9171         if eval $compile; then
9172                 yyy=`$run ./try`
9173                 case "$yyy" in
9174                 123.456)
9175                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9176                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9177                         echo "We will use %Lf."
9178                         ;;
9179                 esac
9180         fi
9181 fi
9182
9183 if $test X"$sPRIfldbl" = X; then
9184         $cat >try.c <<'EOCP'
9185 #include <sys/types.h>
9186 #include <stdio.h>
9187 int main() {
9188   long double d = 123.456;
9189   printf("%.3llf\n", d);
9190 }
9191 EOCP
9192         set try
9193         if eval $compile; then
9194                 yyy=`$run ./try`
9195                 case "$yyy" in
9196                 123.456)
9197                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9198                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9199                         echo "We will use %llf."
9200                         ;;
9201                 esac
9202         fi
9203 fi
9204
9205 if $test X"$sPRIfldbl" = X; then
9206         $cat >try.c <<'EOCP'
9207 #include <sys/types.h>
9208 #include <stdio.h>
9209 int main() {
9210   long double d = 123.456;
9211   printf("%.3lf\n", d);
9212 }
9213 EOCP
9214         set try
9215         if eval $compile; then
9216                 yyy=`$run ./try`
9217                 case "$yyy" in
9218                 123.456)
9219                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9220                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9221                         echo "We will use %lf."
9222                         ;;
9223                 esac
9224         fi
9225 fi
9226
9227 if $test X"$sPRIfldbl" = X; then
9228         echo "Cannot figure out how to print long doubles." >&4
9229 else
9230         sSCNfldbl=$sPRIfldbl    # expect consistency
9231 fi
9232
9233 $rm -f try try.*
9234
9235 fi # d_longdbl
9236
9237 case "$sPRIfldbl" in
9238 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9239         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9240         d_SCNfldbl="$undef";
9241         ;;
9242 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9243         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9244         d_SCNfldbl="$define";
9245         ;;
9246 esac
9247
9248 : Check how to convert floats to strings.
9249
9250 if test "X$d_Gconvert" = X; then
9251
9252 echo " "
9253 echo "Checking for an efficient way to convert floats to strings."
9254 echo " " > try.c
9255 case "$uselongdouble" in
9256 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9257 esac
9258 case "$d_longdbl" in
9259 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9260 esac
9261 case "$d_PRIgldbl" in
9262 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9263 esac
9264 $cat >>try.c <<EOP
9265 #ifdef TRY_gconvert
9266 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9267 char *myname = "gconvert";
9268 #endif
9269 #ifdef TRY_gcvt
9270 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9271 char *myname = "gcvt";
9272 #endif
9273 #ifdef TRY_qgcvt
9274 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9275 char *myname = "qgcvt";
9276 #define DOUBLETYPE long double
9277 #endif
9278 #ifdef TRY_sprintf
9279 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9280 #ifdef HAS_PRIgldbl
9281 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9282 #else
9283 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9284 #endif
9285 #else
9286 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9287 #endif
9288 char *myname = "sprintf";
9289 #endif
9290
9291 #ifndef DOUBLETYPE
9292 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9293 #define DOUBLETYPE long double
9294 #else
9295 #define DOUBLETYPE double
9296 #endif
9297 #endif
9298
9299 #include <stdio.h>
9300
9301 #define I_STDLIB $i_stdlib
9302 #ifdef I_STDLIB
9303 #include <stdlib.h>
9304 #endif
9305
9306 int
9307 checkit(expect, got)
9308 char *expect;
9309 char *got;
9310 {
9311     if (strcmp(expect, got)) {
9312                 printf("%s oddity:  Expected %s, got %s\n",
9313                         myname, expect, got);
9314                 exit(1);
9315         }
9316 }
9317
9318 int main()
9319
9320         char buf[64]; 
9321         buf[63] = '\0';
9322
9323         /* This must be 1st test on (which?) platform */
9324         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9325         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9326         checkit("0.1", buf);
9327
9328         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9329         checkit("0.01", buf);
9330
9331         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9332         checkit("0.001", buf);
9333
9334         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9335         checkit("0.0001", buf);
9336
9337         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9338         if (strlen(buf) > 5)
9339             checkit("9e-005", buf); /* for Microsoft ?? */
9340         else
9341             checkit("9e-05", buf);
9342
9343         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9344         checkit("1", buf);
9345
9346         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9347         checkit("1.1", buf);
9348
9349         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9350         checkit("1.01", buf);
9351
9352         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9353         checkit("1.001", buf);
9354
9355         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9356         checkit("1.0001", buf);
9357
9358         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9359         checkit("1.00001", buf);
9360
9361         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9362         checkit("1.000001", buf);
9363
9364         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9365         checkit("0", buf);
9366
9367         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9368         checkit("-1", buf);
9369
9370         /* Some Linux gcvt's give 1.e+5 here. */
9371         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9372         checkit("100000", buf);
9373         
9374         /* Some Linux gcvt's give -1.e+5 here. */
9375         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9376         checkit("-100000", buf);
9377
9378         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9379         checkit("123.456", buf);
9380
9381         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9382         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9383         /* 34 should be enough to scare even long double
9384          * places into using the e notation. */
9385         if (strlen(buf) > 5)
9386             checkit("1e+034", buf); /* for Microsoft */
9387         else
9388             checkit("1e+34", buf);
9389
9390         /* For Perl, if you add additional tests here, also add them to
9391          * t/base/num.t for benefit of platforms not using Configure or
9392          * overriding d_Gconvert */
9393
9394         exit(0);
9395 }
9396 EOP
9397 : first add preferred functions to our list
9398 xxx_list=""
9399 for xxx_convert in $gconvert_preference; do
9400     case $xxx_convert in
9401     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9402     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9403     esac 
9404 done
9405 : then add any others
9406 for xxx_convert in gconvert gcvt sprintf; do
9407     case "$xxx_list" in
9408     *$xxx_convert*) ;;
9409     *) xxx_list="$xxx_list $xxx_convert" ;;
9410     esac 
9411 done
9412
9413 case "$d_longdbl$uselongdouble" in
9414 "$define$define")
9415     : again, add prefered functions to our list first
9416     xxx_ld_list=""
9417     for xxx_convert in $gconvert_ld_preference; do
9418         case $xxx_convert in
9419         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9420         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9421         esac
9422     done
9423     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9424     for xxx_convert in qgcvt sprintf $xxx_list; do
9425         case "$xxx_ld_list" in
9426         $xxx_convert*|*" $xxx_convert"*) ;;
9427         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9428         esac
9429     done
9430     : if sprintf cannot do long doubles, move it to the end
9431     if test "$d_PRIgldbl" != "$define"; then
9432         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9433     fi
9434     : if no qgcvt, remove it
9435     if test "$d_qgcvt" != "$define"; then
9436         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9437     fi
9438     : use the ld_list
9439     xxx_list="$xxx_ld_list"
9440     ;;
9441 esac
9442
9443 for xxx_convert in $xxx_list; do
9444         echo "Trying $xxx_convert..."
9445         $rm -f try try$_o
9446         set try -DTRY_$xxx_convert
9447         if eval $compile; then
9448                 echo "$xxx_convert() found." >&4
9449                 if $run ./try; then
9450                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9451                         break;
9452                 else
9453                         echo "...But $xxx_convert didn't work as I expected."
9454                         xxx_convert=''
9455                 fi
9456         else
9457                 echo "$xxx_convert NOT found." >&4
9458         fi
9459 done
9460
9461 if test X$xxx_convert = X; then
9462     echo "*** WHOA THERE!!! ***" >&4
9463     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9464     xxx_convert=sprintf
9465 fi
9466
9467 case "$xxx_convert" in
9468 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9469 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9470 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9471 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9472    "$define$define$define")
9473       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9474    "$define$define$undef")
9475       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9476    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9477    esac
9478    ;;  
9479 esac
9480
9481 fi
9482
9483 : see if _fwalk exists
9484 set fwalk d__fwalk
9485 eval $inlibc
9486
9487 : Initialize h_fcntl
9488 h_fcntl=false
9489
9490 : Initialize h_sysfile
9491 h_sysfile=false
9492
9493 : access call always available on UNIX
9494 set access d_access
9495 eval $inlibc
9496
9497 : locate the flags for 'access()'
9498 case "$d_access" in
9499 "$define")
9500         echo " "
9501         $cat >access.c <<EOCP
9502 #include <sys/types.h>
9503 #ifdef I_FCNTL
9504 #include <fcntl.h>
9505 #endif
9506 #ifdef I_SYS_FILE
9507 #include <sys/file.h>
9508 #endif
9509 #ifdef I_UNISTD
9510 #include <unistd.h>
9511 #endif
9512 #$i_stdlib I_STDLIB
9513 #ifdef I_STDLIB
9514 #include <stdlib.h>
9515 #endif
9516 int main() {
9517         exit(R_OK);
9518 }
9519 EOCP
9520         : check sys/file.h first, no particular reason here
9521         if $test `./findhdr sys/file.h` && \
9522                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9523                 h_sysfile=true;
9524                 echo "<sys/file.h> defines the *_OK access constants." >&4
9525         elif $test `./findhdr fcntl.h` && \
9526                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9527                 h_fcntl=true;
9528                 echo "<fcntl.h> defines the *_OK access constants." >&4
9529         elif $test `./findhdr unistd.h` && \
9530                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9531                 echo "<unistd.h> defines the *_OK access constants." >&4
9532         else
9533                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9534         fi
9535         ;;
9536 esac
9537 $rm -f access*
9538
9539 : see if accessx exists
9540 set accessx d_accessx
9541 eval $inlibc
9542
9543 : see if aintl exists
9544 set aintl d_aintl
9545 eval $inlibc
9546
9547 : see if alarm exists
9548 set alarm d_alarm
9549 eval $inlibc
9550
9551 : see if POSIX threads are available
9552 set pthread.h i_pthread
9553 eval $inhdr
9554
9555 : define a fucntion to check prototypes
9556 $cat > protochk <<EOSH
9557 $startsh
9558 cc="$cc"
9559 optimize="$optimize"
9560 ccflags="$ccflags"
9561 prototype="$prototype"
9562 define="$define"
9563 rm=$rm
9564 usethreads=$usethreads
9565 i_pthread=$i_pthread
9566 pthread_h_first=$pthread_h_first
9567 EOSH
9568
9569 $cat >> protochk <<'EOSH'
9570
9571 $rm -f try.c
9572 foo="$1"
9573 shift
9574 while test $# -ge 2; do
9575         case "$1" in
9576                 $define) echo "#include <$2>" >> try.c ;;
9577                 literal) echo "$2" >> try.c ;;
9578         esac
9579     # Extra magic for the benefit of systems that need pthread.h
9580     # to be included early to correctly detect threadsafe functions.
9581     # Such functions must guarantee themselves, though, that the usethreads
9582     # and i_pthread have been defined, before calling protochk.
9583     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9584         echo "#include <pthread.h>" >> try.c
9585         pthread_h_done=yes
9586     fi
9587     shift 2
9588 done
9589 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9590 cat >> try.c <<'EOCP'
9591 #ifdef CAN_PROTOTYPE
9592 #define _(args) args
9593 #else
9594 #define _(args) ()
9595 #endif
9596 EOCP
9597 echo "$foo" >> try.c
9598 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9599 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9600 status=$?
9601 $rm -f try.[co]
9602 exit $status
9603 EOSH
9604 chmod +x protochk
9605 $eunicefix protochk
9606
9607 hasproto='varname=$1; func=$2; shift; shift;
9608 while $test $# -ge 2; do
9609         case "$1" in
9610         $define) echo "#include <$2>";;
9611         esac ;
9612     shift 2;
9613 done > try.c;
9614 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9615 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9616         echo "$func() prototype found.";
9617         val="$define";
9618 else
9619         echo "$func() prototype NOT found.";
9620         val="$undef";
9621 fi;
9622 set $varname;
9623 eval $setvar;
9624 $rm -f try.c tryout.c'
9625
9626 : see if sys/types.h has to be included
9627 set sys/types.h i_systypes
9628 eval $inhdr
9629
9630 : see if sys/select.h has to be included
9631 set sys/select.h i_sysselct
9632 eval $inhdr
9633
9634 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9635 while $test $# -ge 2; do
9636         case "$1" in
9637         $define) echo "#include <$2>";;
9638         esac ;
9639     shift 2;
9640 done > try.c;
9641 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9642 set try;
9643 if eval $compile; then
9644         val="$define";
9645 else
9646         val="$undef";
9647 fi;
9648 set $varname;
9649 eval $setvar;
9650 $rm -f try.c try.o'
9651
9652 : see if we should include time.h, sys/time.h, or both
9653 echo " "
9654 if test "X$timeincl" = X; then
9655         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9656         $echo $n "I'm now running the test program...$c"
9657         $cat >try.c <<EOCP
9658 #include <sys/types.h>
9659 #ifdef I_TIME
9660 #include <time.h>
9661 #endif
9662 #ifdef I_SYSTIME
9663 #ifdef SYSTIMEKERNEL
9664 #define KERNEL
9665 #endif
9666 #include <sys/time.h>
9667 #endif
9668 #ifdef I_SYSSELECT
9669 #include <sys/select.h>
9670 #endif
9671 #$i_stdlib I_STDLIB
9672 #ifdef I_STDLIB
9673 #include <stdlib.h>
9674 #endif
9675 int main()
9676 {
9677         struct tm foo;
9678 #ifdef S_TIMEVAL
9679         struct timeval bar;
9680 #endif
9681 #ifdef S_TIMEZONE
9682         struct timezone tzp;
9683 #endif
9684         if (foo.tm_sec == foo.tm_sec)
9685                 exit(0);
9686 #ifdef S_TIMEVAL
9687         if (bar.tv_sec == bar.tv_sec)
9688                 exit(0);
9689 #endif
9690         exit(1);
9691 }
9692 EOCP
9693         flags=''
9694         for s_timezone in '-DS_TIMEZONE' ''; do
9695         sysselect=''
9696         for s_timeval in '-DS_TIMEVAL' ''; do
9697         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9698         for i_time in '' '-DI_TIME'; do
9699         for i_systime in '-DI_SYSTIME' ''; do
9700                 case "$flags" in
9701                 '') $echo $n ".$c"
9702                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9703                         if eval $compile; then
9704                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9705                                 shift
9706                                 flags="$*"
9707                                 echo " "
9708                                 $echo $n "Succeeded with $flags$c"
9709                         fi
9710                         ;;
9711                 esac
9712         done
9713         done
9714         done
9715         done
9716         done
9717         timeincl=''
9718         echo " "
9719         case "$flags" in
9720         *SYSTIMEKERNEL*) i_systimek="$define"
9721                 timeincl=`./findhdr sys/time.h`
9722                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9723         *) i_systimek="$undef";;
9724         esac
9725         case "$flags" in
9726         *I_TIME*) i_time="$define"
9727                 timeincl=`./findhdr time.h`" $timeincl"
9728                 echo "We'll include <time.h>." >&4;;
9729         *) i_time="$undef";;
9730         esac
9731         case "$flags" in
9732         *I_SYSTIME*) i_systime="$define"
9733                 timeincl=`./findhdr sys/time.h`" $timeincl"
9734                 echo "We'll include <sys/time.h>." >&4;;
9735         *) i_systime="$undef";;
9736         esac
9737         $rm -f try.c try
9738 fi
9739 : see if struct tm knows about tm_zone
9740 case "$i_systime$i_time" in
9741 *$define*) 
9742         echo " "
9743         echo "Checking to see if your struct tm has tm_zone field..." >&4
9744         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9745         eval $hasfield
9746         ;;
9747 *)      val="$undef"
9748         set d_tm_tm_zone
9749         eval $setvar
9750         ;;
9751 esac
9752 case "$d_tm_tm_zone" in
9753 "$define")      echo "Yes, it does."   ;;
9754 *)              echo "No, it doesn't." ;;
9755 esac
9756 : see if struct tm knows about tm_gmtoff
9757 case "$i_systime$i_time" in
9758 *$define*) 
9759         echo " "
9760         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9761         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9762         eval $hasfield
9763         ;;
9764 *)      val="$undef"
9765         set d_tm_tm_gmtoff
9766         eval $setvar
9767         ;;
9768 esac
9769 case "$d_tm_tm_gmtoff" in
9770 "$define")      echo "Yes, it does."   ;;
9771 *)              echo "No, it doesn't." ;;
9772 esac
9773
9774 : see if asctime_r exists
9775 set asctime_r d_asctime_r
9776 eval $inlibc
9777 case "$d_asctime_r" in
9778 "$define")
9779         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9780         case "$d_asctime_r_proto:$usethreads" in
9781         ":define")      d_asctime_r_proto=define
9782                 set d_asctime_r_proto asctime_r $hdrs
9783                 eval $hasproto ;;
9784         *)      ;;
9785         esac
9786         case "$d_asctime_r_proto" in
9787         define)
9788         case "$asctime_r_proto" in
9789         ''|0) try='char* asctime_r(const struct tm*, char*);'
9790         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9791         esac
9792         case "$asctime_r_proto" in
9793         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9794         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9795         esac
9796         case "$asctime_r_proto" in
9797         ''|0) try='int asctime_r(const struct tm*, char*);'
9798         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9799         esac
9800         case "$asctime_r_proto" in
9801         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9802         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9803         esac
9804         case "$asctime_r_proto" in
9805         ''|0)   d_asctime_r=undef
9806                 asctime_r_proto=0
9807                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9808         * )     case "$asctime_r_proto" in
9809                 REENTRANT_PROTO*) ;;
9810                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9811                 esac
9812                 echo "Prototype: $try" ;;
9813         esac
9814         ;;
9815         *)      case "$usethreads" in
9816                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9817                 esac
9818                 d_asctime_r=undef
9819                 asctime_r_proto=0
9820                 ;;
9821         esac
9822         ;;
9823 *)      asctime_r_proto=0
9824         ;;
9825 esac
9826
9827 : see if atolf exists
9828 set atolf d_atolf
9829 eval $inlibc
9830
9831 : see if atoll exists
9832 set atoll d_atoll
9833 eval $inlibc
9834
9835 : Look for GCC-style attribute format
9836 case "$d_attribute_format" in
9837 '')
9838 echo " "
9839 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9840 $cat >attrib.c <<'EOCP'
9841 #include <stdio.h>
9842 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9843 EOCP
9844 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9845         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9846                 echo "Your C compiler doesn't support __attribute__((format))."
9847                 val="$undef"
9848         else
9849                 echo "Your C compiler supports __attribute__((format))."
9850                 val="$define"
9851         fi
9852 else
9853         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9854         val="$undef"
9855 fi
9856 ;;
9857 *) val="$d_attribute_format" ;;
9858 esac
9859 set d_attribute_format
9860 eval $setvar
9861 $rm -f attrib*
9862
9863 : Look for GCC-style attribute malloc
9864 case "$d_attribute_malloc" in
9865 '')
9866 echo " "
9867 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9868 $cat >attrib.c <<'EOCP'
9869 #include <stdio.h>
9870 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9871 EOCP
9872 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9873         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9874                 echo "Your C compiler doesn't support __attribute__((malloc))."
9875                 val="$undef"
9876         else
9877                 echo "Your C compiler supports __attribute__((malloc))."
9878                 val="$define"
9879         fi
9880 else
9881         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9882         val="$undef"
9883 fi
9884 ;;
9885 *) val="$d_attribute_malloc" ;;
9886 esac
9887 set d_attribute_malloc
9888 eval $setvar
9889 $rm -f attrib*
9890
9891 : Look for GCC-style attribute nonnull
9892 case "$d_attribute_nonnull" in
9893 '')
9894 echo " "
9895 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9896 $cat >attrib.c <<'EOCP'
9897 #include <stdio.h>
9898 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9899 EOCP
9900 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9901         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9902                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9903                 val="$undef"
9904         else
9905                 echo "Your C compiler supports __attribute__((nonnull))."
9906                 val="$define"
9907         fi
9908 else
9909         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9910         val="$undef"
9911 fi
9912 ;;
9913 *) val="$d_attribute_nonnull" ;;
9914 esac
9915 set d_attribute_nonnull
9916 eval $setvar
9917 $rm -f attrib*
9918
9919 : Look for GCC-style attribute noreturn
9920 case "$d_attribute_noreturn" in
9921 '')
9922 echo " "
9923 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9924 $cat >attrib.c <<'EOCP'
9925 #include <stdio.h>
9926 void fall_over_dead( void ) __attribute__((noreturn));
9927 EOCP
9928 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9929         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9930                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9931                 val="$undef"
9932         else
9933                 echo "Your C compiler supports __attribute__((noreturn))."
9934                 val="$define"
9935         fi
9936 else
9937         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9938         val="$undef"
9939 fi
9940 ;;
9941 *) val="$d_attribute_noreturn" ;;
9942 esac
9943 set d_attribute_noreturn
9944 eval $setvar
9945 $rm -f attrib*
9946
9947 : Look for GCC-style attribute pure
9948 case "$d_attribute_pure" in
9949 '')
9950 echo " "
9951 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
9952 $cat >attrib.c <<'EOCP'
9953 #include <stdio.h>
9954 int square( int n ) __attribute__((pure));
9955 EOCP
9956 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9957         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9958                 echo "Your C compiler doesn't support __attribute__((pure))."
9959                 val="$undef"
9960         else
9961                 echo "Your C compiler supports __attribute__((pure))."
9962                 val="$define"
9963         fi
9964 else
9965         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9966         val="$undef"
9967 fi
9968 ;;
9969 *) val="$d_attribute_pure" ;;
9970 esac
9971 set d_attribute_pure
9972 eval $setvar
9973 $rm -f attrib*
9974
9975 : Look for GCC-style attribute unused
9976 case "$d_attribute_unused" in
9977 '')
9978 echo " "
9979 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
9980 $cat >attrib.c <<'EOCP'
9981 #include <stdio.h>
9982 int do_something( int dummy __attribute__((unused)), int n );
9983 EOCP
9984 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9985         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9986                 echo "Your C compiler doesn't support __attribute__((unused))."
9987                 val="$undef"
9988         else
9989                 echo "Your C compiler supports __attribute__((unused))."
9990                 val="$define"
9991         fi
9992 else
9993         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9994         val="$undef"
9995 fi
9996 ;;
9997 *) val="$d_attribute_unused" ;;
9998 esac
9999 set d_attribute_unused
10000 eval $setvar
10001 $rm -f attrib*
10002
10003 : Look for GCC-style attribute warn_unused_result
10004 case "$d_attribute_warn_unused_result" in
10005 '')
10006 echo " "
10007 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10008 $cat >attrib.c <<'EOCP'
10009 #include <stdio.h>
10010 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10011 EOCP
10012 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10013         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10014                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10015                 val="$undef"
10016         else
10017                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10018                 val="$define"
10019         fi
10020 else
10021         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10022         val="$undef"
10023 fi
10024 ;;
10025 *) val="$d_attribute_warn_unused_result" ;;
10026 esac
10027 set d_attribute_warn_unused_result
10028 eval $setvar
10029 $rm -f attrib*
10030
10031 : see if bcmp exists
10032 set bcmp d_bcmp
10033 eval $inlibc
10034
10035 : see if bcopy exists
10036 set bcopy d_bcopy
10037 eval $inlibc
10038
10039 : see if this is a unistd.h system
10040 set unistd.h i_unistd
10041 eval $inhdr
10042
10043 : see if getpgrp exists
10044 set getpgrp d_getpgrp
10045 eval $inlibc
10046
10047 case "$d_getpgrp" in
10048 "$define")
10049         echo " "
10050         echo "Checking to see which flavor of getpgrp is in use..."
10051         $cat >try.c <<EOP
10052 #$i_unistd I_UNISTD
10053 #include <sys/types.h>
10054 #ifdef I_UNISTD
10055 #  include <unistd.h>
10056 #endif
10057 #$i_stdlib I_STDLIB
10058 #ifdef I_STDLIB
10059 #include <stdlib.h>
10060 #endif
10061 int main()
10062 {
10063         if (getuid() == 0) {
10064                 printf("(I see you are running Configure as super-user...)\n");
10065                 setuid(1);
10066         }
10067 #ifdef TRY_BSD_PGRP
10068         if (getpgrp(1) == 0)
10069                 exit(0);
10070 #else
10071         if (getpgrp() > 0)
10072                 exit(0);
10073 #endif
10074         exit(1);
10075 }
10076 EOP
10077         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10078                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10079                 val="$define"
10080         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10081                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10082                 val="$undef"
10083         else
10084                 echo "I can't seem to compile and run the test program."
10085                 if ./usg; then
10086                         xxx="a USG one, i.e. you use getpgrp()."
10087                 else
10088                         # SVR4 systems can appear rather BSD-ish.
10089                         case "$i_unistd" in
10090                         $undef)
10091                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10092                                 val="$define"
10093                                 ;;
10094                         $define)
10095                                 xxx="probably a USG one, i.e. you use getpgrp()."
10096                                 val="$undef"
10097                                 ;;
10098                         esac
10099                 fi
10100                 echo "Assuming your getpgrp is $xxx" >&4
10101         fi
10102         ;;
10103 *) val="$undef";;
10104 esac
10105 set d_bsdgetpgrp
10106 eval $setvar
10107 $rm -f try try.*
10108
10109 : see if setpgrp exists
10110 set setpgrp d_setpgrp
10111 eval $inlibc
10112
10113 case "$d_setpgrp" in
10114 "$define")
10115         echo " "
10116         echo "Checking to see which flavor of setpgrp is in use..."
10117         $cat >try.c <<EOP
10118 #$i_unistd I_UNISTD
10119 #include <sys/types.h>
10120 #ifdef I_UNISTD
10121 #  include <unistd.h>
10122 #endif
10123 #$i_stdlib I_STDLIB
10124 #ifdef I_STDLIB
10125 #include <stdlib.h>
10126 #endif
10127 int main()
10128 {
10129         if (getuid() == 0) {
10130                 printf("(I see you are running Configure as super-user...)\n");
10131                 setuid(1);
10132         }
10133 #ifdef TRY_BSD_PGRP
10134         if (-1 == setpgrp(1, 1))
10135                 exit(0);
10136 #else
10137         if (setpgrp() != -1)
10138                 exit(0);
10139 #endif
10140         exit(1);
10141 }
10142 EOP
10143         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10144                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10145                 val="$define"
10146         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10147                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10148                 val="$undef"
10149         else
10150                 echo "(I can't seem to compile and run the test program.)"
10151                 if ./usg; then
10152                         xxx="a USG one, i.e. you use setpgrp()."
10153                 else
10154                         # SVR4 systems can appear rather BSD-ish.
10155                         case "$i_unistd" in
10156                         $undef)
10157                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10158                                 val="$define"
10159                                 ;;
10160                         $define)
10161                                 xxx="probably a USG one, i.e. you use setpgrp()."
10162                                 val="$undef"
10163                                 ;;
10164                         esac
10165                 fi
10166                 echo "Assuming your setpgrp is $xxx" >&4
10167         fi
10168         ;;
10169 *) val="$undef";;
10170 esac
10171 set d_bsdsetpgrp
10172 eval $setvar
10173 $rm -f try try.*
10174 : Look for GCC-style __builtin_choose_expr
10175 case "$d_builtin_choose_expr" in
10176 '')
10177     echo " "
10178     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10179     $cat >try.c <<'EOCP'
10180 #include <assert.h>
10181 #include <stdlib.h>
10182 #include <stdio.h>
10183
10184 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10185
10186 int main(void) {
10187     assert( SYRINX(1) == 2112 );
10188     assert( SYRINX(1) != 5150 );
10189     assert( SYRINX(0) == 5150 );
10190     assert( SYRINX(0) != 2112 );
10191     puts( "All good!" );
10192     exit(0);
10193 }
10194
10195 EOCP
10196     set try
10197     if eval $compile; then
10198         echo "Your C compiler supports __builtin_choose_expr."
10199         val="$define"
10200     else
10201         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10202         val="$undef"
10203     fi
10204 ;;
10205 *) val="$d_builtin_choose_expr" ;;
10206 esac
10207
10208 set d_builtin_choose_expr
10209 eval $setvar
10210 $rm -f try.* try core core.try.*
10211
10212 : Look for GCC-style __builtin_expect
10213 case "$d_builtin_expect" in
10214 '')
10215     echo " "
10216     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10217     $cat >builtin.c <<'EOCP'
10218 int main(void) {
10219     int n = 50;
10220     if ( __builtin_expect(n, 0) ) n = 1;
10221 }
10222 EOCP
10223     set try
10224     if eval $compile; then
10225         echo "Your C compiler supports __builtin_choose_expr."
10226         val="$define"
10227     else
10228         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10229         val="$undef"
10230     fi
10231     ;;
10232 *) val="$d_builtin_expect" ;;
10233 esac
10234
10235 set d_builtin_expect
10236 eval $setvar
10237 $rm -f try.* try core core.try.*
10238
10239 : see if bzero exists
10240 set bzero d_bzero
10241 eval $inlibc
10242
10243 : see if signal is declared as pointer to function returning int or void
10244 echo " "
10245 xxx=`./findhdr signal.h`
10246 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10247 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10248         echo "You have int (*signal())() instead of void." >&4
10249         val="$undef"
10250 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10251         echo "You have void (*signal())()." >&4
10252         val="$define"
10253 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10254         echo "You have int (*signal())() instead of void." >&4
10255         val="$undef"
10256 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10257         echo "You have void (*signal())()." >&4
10258         val="$define"
10259 else
10260         case "$d_voidsig" in
10261         '')
10262         echo "I can't determine whether signal handler returns void or int..." >&4
10263                 dflt=void
10264                 rp="What type does your signal handler return?"
10265                 . ./myread
10266                 case "$ans" in
10267                 v*) val="$define";;
10268                 *) val="$undef";;
10269                 esac;;
10270         "$define")
10271                 echo "As you already told me, signal handler returns void." >&4
10272                 val="$define"
10273                 ;;
10274         *)      echo "As you already told me, signal handler returns int." >&4
10275                 val="$undef"
10276                 ;;
10277         esac
10278 fi
10279 set d_voidsig
10280 eval $setvar
10281 case "$d_voidsig" in
10282 "$define") signal_t="void";;
10283 *) signal_t="int";;
10284 esac
10285 $rm -f $$.tmp
10286
10287 : check for ability to cast large floats to 32-bit ints.
10288 echo " "
10289 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10290 if $test "$intsize" -ge 4; then
10291         xxx=int
10292 else
10293         xxx=long
10294 fi
10295 $cat >try.c <<EOCP
10296 #include <stdio.h>
10297 #$i_stdlib I_STDLIB
10298 #ifdef I_STDLIB
10299 #include <stdlib.h>
10300 #endif
10301 #include <sys/types.h>
10302 #include <signal.h>
10303 $signal_t blech(s) int s; { exit(3); }
10304 int main()
10305 {
10306         $xxx i32;
10307         double f, g;
10308         int result = 0;
10309         char str[16];
10310         signal(SIGFPE, blech);
10311
10312         /* Don't let compiler optimize the test away.  Store the number 
10313            in a writable string for gcc to pass to sscanf under HP/UX.
10314         */
10315         sprintf(str, "2147483647");
10316         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10317         g = 10 * f;
10318         i32  = ($xxx) g;
10319
10320         /* x86 processors will probably give 0x8000 0000, which is a
10321            sign change.  We don't want that.  We want to mimic SPARC
10322            behavior here, which is to preserve the sign and give
10323            back 0x7fff ffff.
10324         */
10325         if (i32 != ($xxx) f)
10326                 result |= 1;
10327         exit(result);
10328 }
10329 EOCP
10330 set try
10331 if eval $compile_ok; then
10332         $run ./try
10333         yyy=$?
10334 else
10335         echo "(I can't seem to compile the test program--assuming it can't)"
10336         yyy=1
10337 fi
10338 case "$yyy" in
10339 0)      val="$define"
10340         echo "Yup, it can."
10341         ;;
10342 *)      val="$undef"
10343         echo "Nope, it can't."
10344         ;;
10345 esac
10346 set d_casti32
10347 eval $setvar
10348 $rm -f try try.*
10349
10350 : check for ability to cast negative floats to unsigned
10351 echo " "
10352 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10353 $cat >try.c <<EOCP
10354 #include <stdio.h>
10355 #$i_stdlib I_STDLIB
10356 #ifdef I_STDLIB
10357 #include <stdlib.h>
10358 #endif
10359 #include <sys/types.h>
10360 #include <signal.h>
10361 $signal_t blech(s) int s; { exit(7); }
10362 $signal_t blech_in_list(s) int s; { exit(4); }
10363 unsigned long dummy_long(p) unsigned long p; { return p; }
10364 unsigned int dummy_int(p) unsigned int p; { return p; }
10365 unsigned short dummy_short(p) unsigned short p; { return p; }
10366 int main()
10367 {
10368         double f;
10369         unsigned long along;
10370         unsigned int aint;
10371         unsigned short ashort;
10372         int result = 0;
10373         char str[16];
10374         
10375         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10376            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10377            optimized the whole file away
10378         */
10379         /* Store the number in a writable string for gcc to pass to 
10380            sscanf under HP/UX.
10381         */
10382         sprintf(str, "-123");
10383         sscanf(str, "%lf", &f);  /* f = -123.; */
10384
10385         signal(SIGFPE, blech);
10386         along = (unsigned long)f;
10387         aint = (unsigned int)f;
10388         ashort = (unsigned short)f;
10389         if (along != (unsigned long)-123)
10390                 result |= 1;
10391         if (aint != (unsigned int)-123)
10392                 result |= 1;
10393         if (ashort != (unsigned short)-123)
10394                 result |= 1;
10395         sprintf(str, "1073741824.");
10396         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10397         f = f + f;
10398         along = 0;
10399         along = (unsigned long)f;
10400         if (along != 0x80000000)
10401                 result |= 2;
10402         f -= 1.;
10403         along = 0;
10404         along = (unsigned long)f;
10405         if (along != 0x7fffffff)
10406                 result |= 1;
10407         f += 2.;
10408         along = 0;
10409         along = (unsigned long)f;
10410         if (along != 0x80000001)
10411                 result |= 2;
10412         if (result)
10413                 exit(result);
10414         signal(SIGFPE, blech_in_list);
10415         sprintf(str, "123.");
10416         sscanf(str, "%lf", &f);  /* f = 123.; */
10417         along = dummy_long((unsigned long)f);
10418         aint = dummy_int((unsigned int)f);
10419         ashort = dummy_short((unsigned short)f);
10420         if (along != (unsigned long)123)
10421                 result |= 4;
10422         if (aint != (unsigned int)123)
10423                 result |= 4;
10424         if (ashort != (unsigned short)123)
10425                 result |= 4;
10426         exit(result);
10427
10428 }
10429 EOCP
10430 set try
10431 if eval $compile_ok; then
10432         $run ./try
10433         castflags=$?
10434 else
10435         echo "(I can't seem to compile the test program--assuming it can't)"
10436         castflags=7
10437 fi
10438 case "$castflags" in
10439 0)      val="$define"
10440         echo "Yup, it can."
10441         ;;
10442 *)      val="$undef"
10443         echo "Nope, it can't."
10444         ;;
10445 esac
10446 set d_castneg
10447 eval $setvar
10448 $rm -f try.*
10449
10450 : see if vprintf exists
10451 echo " "
10452 if set vprintf val -f d_vprintf; eval $csym; $val; then
10453         echo 'vprintf() found.' >&4
10454         val="$define"
10455         $cat >try.c <<EOF
10456 #include <varargs.h>
10457 #$i_stdlib I_STDLIB
10458 #ifdef I_STDLIB
10459 #include <stdlib.h>
10460 #endif
10461
10462 int main() { xxx("foo"); }
10463
10464 xxx(va_alist)
10465 va_dcl
10466 {
10467         va_list args;
10468         char buf[10];
10469
10470         va_start(args);
10471         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10472 }
10473 EOF
10474         set try
10475         if eval $compile && $run ./try; then
10476                 echo "Your vsprintf() returns (int)." >&4
10477                 val2="$undef"
10478         else
10479                 echo "Your vsprintf() returns (char*)." >&4
10480                 val2="$define"
10481         fi
10482 else
10483         echo 'vprintf() NOT found.' >&4
10484                 val="$undef"
10485                 val2="$undef"
10486 fi
10487 $rm -f try try.*
10488 set d_vprintf
10489 eval $setvar
10490 val=$val2
10491 set d_charvspr
10492 eval $setvar
10493
10494 : see if chown exists
10495 set chown d_chown
10496 eval $inlibc
10497
10498 : see if chroot exists
10499 set chroot d_chroot
10500 eval $inlibc
10501
10502 : see if chsize exists
10503 set chsize d_chsize
10504 eval $inlibc
10505
10506 : see if class exists
10507 set class d_class
10508 eval $inlibc
10509
10510 : see if clearenv exists
10511 set clearenv d_clearenv
10512 eval $inlibc
10513
10514 hasstruct='varname=$1; struct=$2; shift; shift;
10515 while $test $# -ge 2; do
10516         case "$1" in
10517         $define) echo "#include <$2>";;
10518         esac ;
10519     shift 2;
10520 done > try.c;
10521 echo "int main () { struct $struct foo; }" >> try.c;
10522 set try;
10523 if eval $compile; then
10524         val="$define";
10525 else
10526         val="$undef";
10527 fi;
10528 set $varname;
10529 eval $setvar;
10530 $rm -f try.c try.o'
10531
10532 socketlib=''
10533 sockethdr=''
10534 : see whether socket exists
10535 echo " "
10536 $echo $n "Hmm... $c" >&4
10537 if set socket val -f d_socket; eval $csym; $val; then
10538         echo "Looks like you have Berkeley networking support." >&4
10539         d_socket="$define"
10540         if set setsockopt val -f; eval $csym; $val; then
10541                 d_oldsock="$undef"
10542         else
10543                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10544                 d_oldsock="$define"
10545         fi
10546 else
10547         if $contains socklib libc.list >/dev/null 2>&1; then
10548                 echo "Looks like you have Berkeley networking support." >&4
10549                 d_socket="$define"
10550                 : we will have to assume that it supports the 4.2 BSD interface
10551                 d_oldsock="$undef"
10552         else
10553                 echo "You don't have Berkeley networking in libc$_a..." >&4
10554                 if test "X$d_socket" = "X$define"; then
10555                    echo "...but you seem to believe that you have sockets." >&4
10556                 else
10557                         for net in net socket
10558                         do
10559                                 if test -f /usr/lib/lib$net$_a; then
10560                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10561                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10562                                         if $contains socket libc.list >/dev/null 2>&1; then
10563                                                 d_socket="$define"
10564                                                 socketlib="-l$net"
10565                                                 case "$net" in
10566                                                 net)
10567                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10568                                                         sockethdr="-I/usr/netinclude"
10569                                                         ;;
10570                                                 esac
10571                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10572                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10573                                                         d_oldsock="$undef"
10574                                                 else
10575                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10576                                                         d_oldsock="$define"
10577                                                 fi
10578                                                 break
10579                                         fi
10580                                 fi
10581                         done
10582                         if test "X$d_socket" != "X$define"; then
10583                            echo "or anywhere else I see." >&4
10584                            d_socket="$undef"
10585                            d_oldsock="$undef"
10586                         fi
10587                 fi
10588         fi
10589 fi
10590
10591 : see if socketpair exists
10592 set socketpair d_sockpair
10593 eval $inlibc
10594
10595
10596 echo " "
10597 echo "Checking the availability of certain socket constants..." >&4
10598 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10599         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10600         $cat >try.c <<EOF
10601 #include <sys/types.h>
10602 #include <sys/socket.h>
10603 int main() {
10604     int i = $ENUM;
10605 }
10606 EOF
10607         val="$undef"
10608         set try; if eval $compile; then
10609                 val="$define"
10610         fi
10611         set d_${enum}; eval $setvar
10612         $rm -f try.c try
10613 done
10614
10615 : see if this is a sys/uio.h system
10616 set sys/uio.h i_sysuio
10617 eval $inhdr
10618
10619
10620 echo " "
10621 echo "Checking to see if your system supports struct cmsghdr..." >&4
10622 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10623 eval $hasstruct
10624 case "$d_cmsghdr_s" in
10625 "$define")      echo "Yes, it does."   ;;
10626 *)              echo "No, it doesn't." ;;
10627 esac
10628
10629
10630 : check for const keyword
10631 echo " "
10632 echo 'Checking to see if your C compiler knows about "const"...' >&4
10633 $cat >const.c <<'EOCP'
10634 typedef struct spug { int drokk; } spug;
10635 int main()
10636 {
10637         const char *foo;
10638         const spug y;
10639 }
10640 EOCP
10641 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10642         val="$define"
10643         echo "Yup, it does."
10644 else
10645         val="$undef"
10646         echo "Nope, it doesn't."
10647 fi
10648 set d_const
10649 eval $setvar
10650
10651 : see if copysignl exists
10652 set copysignl d_copysignl
10653 eval $inlibc
10654
10655 : see if crypt exists
10656 echo " "
10657 set crypt d_crypt
10658 eval $inlibc
10659 case "$d_crypt" in
10660 $define) cryptlib='' ;;
10661 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10662                 echo 'crypt() found.' >&4
10663                 val="$define"
10664                 cryptlib=''
10665         else
10666                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10667                 if $test -z "$cryptlib"; then
10668                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10669                 else
10670                         cryptlib=-lcrypt
10671                 fi
10672                 if $test -z "$cryptlib"; then
10673                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10674                 else
10675                         cryptlib=-lcrypt
10676                 fi
10677                 if $test -z "$cryptlib"; then
10678                         cryptlib=`./loc libcrypt$_a "" $libpth`
10679                 else
10680                         cryptlib=-lcrypt
10681                 fi
10682                 if $test -z "$cryptlib"; then
10683                         echo 'crypt() NOT found.' >&4
10684                         val="$undef"
10685                 else
10686                         val="$define"
10687                 fi
10688         fi
10689         set d_crypt
10690         eval $setvar
10691         ;;
10692 esac
10693
10694 : see if this is a crypt.h system
10695 set crypt.h i_crypt
10696 eval $inhdr
10697
10698 : see if crypt_r exists
10699 set crypt_r d_crypt_r
10700 eval $inlibc
10701 case "$d_crypt_r" in
10702 "$define")
10703         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10704         case "$d_crypt_r_proto:$usethreads" in
10705         ":define")      d_crypt_r_proto=define
10706                 set d_crypt_r_proto crypt_r $hdrs
10707                 eval $hasproto ;;
10708         *)      ;;
10709         esac
10710         case "$d_crypt_r_proto" in
10711         define)
10712         case "$crypt_r_proto" in
10713         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10714         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10715         esac
10716         case "$crypt_r_proto" in
10717         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10718         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10719         esac
10720         case "$crypt_r_proto" in
10721         ''|0)   d_crypt_r=undef
10722                 crypt_r_proto=0
10723                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10724         * )     case "$crypt_r_proto" in
10725                 REENTRANT_PROTO*) ;;
10726                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10727                 esac
10728                 echo "Prototype: $try" ;;
10729         esac
10730         ;;
10731         *)      case "$usethreads" in
10732                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10733                 esac
10734                 d_crypt_r=undef
10735                 crypt_r_proto=0
10736                 ;;
10737         esac
10738         ;;
10739 *)      crypt_r_proto=0
10740         ;;
10741 esac
10742
10743 : get csh whereabouts
10744 case "$csh" in
10745 'csh') val="$undef" ;;
10746 *) val="$define" ;;
10747 esac
10748 set d_csh
10749 eval $setvar
10750 : Respect a hint or command line value for full_csh.
10751 case "$full_csh" in
10752 '') full_csh=$csh ;;
10753 esac
10754
10755 : see if ctermid_r exists
10756 set ctermid_r d_ctermid_r
10757 eval $inlibc
10758 case "$d_ctermid_r" in
10759 "$define")
10760         hdrs="$i_systypes sys/types.h define stdio.h "
10761         case "$d_ctermid_r_proto:$usethreads" in
10762         ":define")      d_ctermid_r_proto=define
10763                 set d_ctermid_r_proto ctermid_r $hdrs
10764                 eval $hasproto ;;
10765         *)      ;;
10766         esac
10767         case "$d_ctermid_r_proto" in
10768         define)
10769         case "$ctermid_r_proto" in
10770         ''|0) try='char* ctermid_r(char*);'
10771         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10772         esac
10773         case "$ctermid_r_proto" in
10774         ''|0)   d_ctermid_r=undef
10775                 ctermid_r_proto=0
10776                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10777         * )     case "$ctermid_r_proto" in
10778                 REENTRANT_PROTO*) ;;
10779                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10780                 esac
10781                 echo "Prototype: $try" ;;
10782         esac
10783         ;;
10784         *)      case "$usethreads" in
10785                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10786                 esac
10787                 d_ctermid_r=undef
10788                 ctermid_r_proto=0
10789                 ;;
10790         esac
10791         ;;
10792 *)      ctermid_r_proto=0
10793         ;;
10794 esac
10795
10796 : see if ctime_r exists
10797 set ctime_r d_ctime_r
10798 eval $inlibc
10799 case "$d_ctime_r" in
10800 "$define")
10801         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10802         case "$d_ctime_r_proto:$usethreads" in
10803         ":define")      d_ctime_r_proto=define
10804                 set d_ctime_r_proto ctime_r $hdrs
10805                 eval $hasproto ;;
10806         *)      ;;
10807         esac
10808         case "$d_ctime_r_proto" in
10809         define)
10810         case "$ctime_r_proto" in
10811         ''|0) try='char* ctime_r(const time_t*, char*);'
10812         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10813         esac
10814         case "$ctime_r_proto" in
10815         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10816         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10817         esac
10818         case "$ctime_r_proto" in
10819         ''|0) try='int ctime_r(const time_t*, char*);'
10820         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10821         esac
10822         case "$ctime_r_proto" in
10823         ''|0) try='int ctime_r(const time_t*, char*, int);'
10824         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10825         esac
10826         case "$ctime_r_proto" in
10827         ''|0)   d_ctime_r=undef
10828                 ctime_r_proto=0
10829                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10830         * )     case "$ctime_r_proto" in
10831                 REENTRANT_PROTO*) ;;
10832                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10833                 esac
10834                 echo "Prototype: $try" ;;
10835         esac
10836         ;;
10837         *)      case "$usethreads" in
10838                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10839                 esac
10840                 d_ctime_r=undef
10841                 ctime_r_proto=0
10842                 ;;
10843         esac
10844         ;;
10845 *)      ctime_r_proto=0
10846         ;;
10847 esac
10848
10849 : see if cuserid exists
10850 set cuserid d_cuserid
10851 eval $inlibc
10852
10853 : see if this is a limits.h system
10854 set limits.h i_limits
10855 eval $inhdr
10856
10857 : see if this is a float.h system
10858 set float.h i_float
10859 eval $inhdr
10860
10861 : See if number of significant digits in a double precision number is known
10862 echo " "
10863 $cat >dbl_dig.c <<EOM
10864 #$i_limits I_LIMITS
10865 #$i_float I_FLOAT
10866 #ifdef I_LIMITS
10867 #include <limits.h>
10868 #endif
10869 #ifdef I_FLOAT
10870 #include <float.h>
10871 #endif
10872 #ifdef DBL_DIG
10873 printf("Contains DBL_DIG");
10874 #endif
10875 EOM
10876 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10877 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10878         echo "DBL_DIG found." >&4
10879         val="$define"
10880 else
10881         echo "DBL_DIG NOT found." >&4
10882         val="$undef"
10883 fi
10884 $rm -f dbl_dig.?
10885 set d_dbl_dig
10886 eval $setvar
10887
10888 : see if dbm.h is available
10889 : see if dbmclose exists
10890 set dbmclose d_dbmclose
10891 eval $inlibc
10892
10893 case "$d_dbmclose" in
10894 $define)
10895         set dbm.h i_dbm
10896         eval $inhdr
10897         case "$i_dbm" in
10898         $define)
10899                 val="$undef"
10900                 set i_rpcsvcdbm
10901                 eval $setvar
10902                 ;;
10903         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10904                 eval $inhdr
10905                 ;;
10906         esac
10907         ;;
10908 *)      echo "We won't be including <dbm.h>"
10909         val="$undef"
10910         set i_dbm
10911         eval $setvar
10912         val="$undef"
10913         set i_rpcsvcdbm
10914         eval $setvar
10915         ;;
10916 esac
10917
10918 : see if prototype for dbminit is available
10919 echo " "
10920 set d_dbminitproto dbminit $i_dbm dbm.h
10921 eval $hasproto
10922
10923 : see if difftime exists
10924 set difftime d_difftime
10925 eval $inlibc
10926
10927 : see if this is a dirent system
10928 echo " "
10929 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10930         val="$define"
10931         echo "<dirent.h> found." >&4
10932 else
10933         val="$undef"
10934         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10935                 echo "<sys/dir.h> found." >&4
10936                 echo " "
10937         else
10938                 xinc=`./findhdr sys/ndir.h`
10939         fi
10940         echo "<dirent.h> NOT found." >&4
10941 fi
10942 set i_dirent
10943 eval $setvar
10944
10945 : Look for type of directory structure.
10946 echo " "
10947 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10948
10949 case "$direntrytype" in
10950 ''|' ')
10951         case "$i_dirent" in
10952         $define) guess1='struct dirent' ;;
10953         *) guess1='struct direct'  ;;
10954         esac
10955         ;;
10956 *)      guess1="$direntrytype"
10957         ;;
10958 esac
10959
10960 case "$guess1" in
10961 'struct dirent') guess2='struct direct' ;;
10962 *) guess2='struct dirent' ;;
10963 esac
10964                 
10965 if $contains "$guess1" try.c >/dev/null 2>&1; then
10966         direntrytype="$guess1"
10967         echo "Your directory entries are $direntrytype." >&4
10968 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10969         direntrytype="$guess2"
10970         echo "Your directory entries seem to be $direntrytype." >&4
10971 else
10972         echo "I don't recognize your system's directory entries." >&4
10973         rp="What type is used for directory entries on this system?"
10974         dflt="$guess1"
10975         . ./myread
10976         direntrytype="$ans"
10977 fi
10978 $rm -f try.c
10979
10980
10981 : see if the directory entry stores field length
10982 echo " "
10983 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10984 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10985         echo "Good, your directory entry keeps length information in d_namlen." >&4
10986         val="$define"
10987 else
10988         echo "Your directory entry does not know about the d_namlen field." >&4
10989         val="$undef"
10990 fi
10991 set d_dirnamlen
10992 eval $setvar
10993 $rm -f try.c
10994
10995 : see if this is an sysdir system
10996 set sys/dir.h i_sysdir
10997 eval $inhdr
10998
10999 : see if this is an sysndir system
11000 set sys/ndir.h i_sysndir
11001 eval $inhdr
11002
11003 : Look for dirfd
11004 echo " "
11005 $cat >dirfd.c <<EOM
11006 #include <stdio.h>
11007 #$i_stdlib I_STDLIB
11008 #ifdef I_STDLIB
11009 #include <stdlib.h>
11010 #endif
11011 #$i_dirent I_DIRENT             /**/
11012 #$i_sysdir I_SYS_DIR            /**/
11013 #$i_sysndir I_SYS_NDIR          /**/
11014 #$i_systypes I_SYS_TYPES        /**/
11015 #if defined(I_SYS_TYPES)
11016 #include <sys/types.h>
11017 #endif
11018 #if defined(I_DIRENT)
11019 #include <dirent.h>
11020 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11021 #include <sys/dir.h>
11022 #endif
11023 #else
11024 #ifdef I_SYS_NDIR
11025 #include <sys/ndir.h>
11026 #else
11027 #ifdef I_SYS_DIR
11028 #ifdef hp9000s500
11029 #include <ndir.h>       /* may be wrong in the future */
11030 #else
11031 #include <sys/dir.h>
11032 #endif
11033 #endif
11034 #endif
11035 #endif 
11036 int main() {
11037         DIR *dirp = opendir(".");
11038         if (dirfd(dirp) >= 0)
11039                 exit(0);
11040         else
11041                 exit(1);
11042 }
11043 EOM
11044 val=$undef
11045 set dirfd
11046 if eval $compile; then
11047         val="$define"
11048 fi
11049 case "$val" in
11050 $define)        echo "dirfd() found." >&4       ;;
11051 *)              echo "dirfd() NOT found." >&4   ;;
11052 esac
11053 set d_dirfd
11054 eval $setvar
11055 $rm -f dirfd*
11056
11057 : see if dlerror exists
11058 xxx_runnm="$runnm"
11059 runnm=false
11060 set dlerror d_dlerror
11061 eval $inlibc
11062 runnm="$xxx_runnm"
11063
11064 : see if dlfcn is available
11065 set dlfcn.h i_dlfcn
11066 eval $inhdr
11067
11068 case "$usedl" in
11069 $define|y|true)
11070         $cat << EOM
11071
11072 On a few systems, the dynamically loaded modules that perl generates and uses
11073 will need a different extension than shared libs. The default will probably
11074 be appropriate.
11075
11076 EOM
11077         case "$dlext" in
11078         '')     dflt="$so" ;;
11079         *)      dflt="$dlext" ;;
11080         esac
11081         rp='What is the extension of dynamically loaded modules'
11082         . ./myread
11083         dlext="$ans"
11084         ;;
11085 *)
11086         dlext="none"
11087         ;;
11088 esac
11089
11090 : Check if dlsym need a leading underscore
11091 echo " "
11092 val="$undef"
11093
11094 case "$dlsrc" in
11095 dl_dlopen.xs)
11096         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11097         $cat >dyna.c <<'EOM'
11098 fred () { }
11099 EOM
11100
11101 $cat >fred.c<<EOM
11102
11103 #include <stdio.h>
11104 #$i_stdlib I_STDLIB
11105 #ifdef I_STDLIB
11106 #include <stdlib.h>
11107 #endif
11108 #$i_dlfcn I_DLFCN
11109 #ifdef I_DLFCN
11110 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11111 #else
11112 #include <sys/types.h>
11113 #include <nlist.h>
11114 #include <link.h>
11115 #endif
11116
11117 extern int fred() ;
11118
11119 int main()
11120 {
11121     void * handle ;
11122     void * symbol ;
11123 #ifndef RTLD_LAZY
11124     int mode = 1 ;
11125 #else
11126     int mode = RTLD_LAZY ;
11127 #endif
11128     handle = dlopen("./dyna.$dlext", mode) ;
11129     if (handle == NULL) {
11130         printf ("1\n") ;
11131         fflush (stdout) ;
11132         exit(0);
11133     }
11134     symbol = dlsym(handle, "fred") ;
11135     if (symbol == NULL) {
11136         /* try putting a leading underscore */
11137         symbol = dlsym(handle, "_fred") ;
11138         if (symbol == NULL) {
11139             printf ("2\n") ;
11140             fflush (stdout) ;
11141             exit(0);
11142         }
11143         printf ("3\n") ;
11144     }
11145     else
11146         printf ("4\n") ;
11147     fflush (stdout) ;
11148     exit(0);
11149 }
11150 EOM
11151         : Call the object file tmp-dyna.o in case dlext=o.
11152         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11153                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11154                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11155                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11156                 xxx=`$run ./fred`
11157                 case $xxx in
11158                 1)      echo "Test program failed using dlopen." >&4
11159                         echo "Perhaps you should not use dynamic loading." >&4;;
11160                 2)      echo "Test program failed using dlsym." >&4
11161                         echo "Perhaps you should not use dynamic loading." >&4;;
11162                 3)      echo "dlsym needs a leading underscore" >&4
11163                         val="$define" ;;
11164                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11165                 esac
11166         else
11167                 echo "I can't compile and run the test program." >&4
11168                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11169         fi
11170         ;;
11171 esac
11172                 
11173 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11174
11175 set d_dlsymun
11176 eval $setvar
11177
11178 : see if drand48_r exists
11179 set drand48_r d_drand48_r
11180 eval $inlibc
11181 case "$d_drand48_r" in
11182 "$define")
11183         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11184         case "$d_drand48_r_proto:$usethreads" in
11185         ":define")      d_drand48_r_proto=define
11186                 set d_drand48_r_proto drand48_r $hdrs
11187                 eval $hasproto ;;
11188         *)      ;;
11189         esac
11190         case "$d_drand48_r_proto" in
11191         define)
11192         case "$drand48_r_proto" in
11193         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11194         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11195         esac
11196         case "$drand48_r_proto" in
11197         ''|0)   d_drand48_r=undef
11198                 drand48_r_proto=0
11199                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11200         * )     case "$drand48_r_proto" in
11201                 REENTRANT_PROTO*) ;;
11202                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11203                 esac
11204                 echo "Prototype: $try" ;;
11205         esac
11206         ;;
11207         *)      case "$usethreads" in
11208                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11209                 esac
11210                 d_drand48_r=undef
11211                 drand48_r_proto=0
11212                 ;;
11213         esac
11214         ;;
11215 *)      drand48_r_proto=0
11216         ;;
11217 esac
11218
11219 : see if prototype for drand48 is available
11220 echo " "
11221 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11222 eval $hasproto
11223
11224 : see if dup2 exists
11225 set dup2 d_dup2
11226 eval $inlibc
11227
11228 : see if eaccess exists
11229 set eaccess d_eaccess
11230 eval $inlibc
11231
11232 : see if endgrent exists
11233 set endgrent d_endgrent
11234 eval $inlibc
11235
11236 : see if this is an grp system
11237 set grp.h i_grp
11238 eval $inhdr
11239
11240 case "$i_grp" in
11241 $define)
11242         xxx=`./findhdr grp.h`
11243         $cppstdin $cppflags $cppminus < $xxx >$$.h
11244
11245         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11246                 val="$define"
11247         else
11248                 val="$undef"
11249         fi
11250         set d_grpasswd
11251         eval $setvar
11252
11253         $rm -f $$.h
11254         ;;
11255 *)
11256         val="$undef";
11257         set d_grpasswd; eval $setvar
11258         ;;
11259 esac
11260
11261 : see if endgrent_r exists
11262 set endgrent_r d_endgrent_r
11263 eval $inlibc
11264 case "$d_endgrent_r" in
11265 "$define")
11266         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11267         case "$d_endgrent_r_proto:$usethreads" in
11268         ":define")      d_endgrent_r_proto=define
11269                 set d_endgrent_r_proto endgrent_r $hdrs
11270                 eval $hasproto ;;
11271         *)      ;;
11272         esac
11273         case "$d_endgrent_r_proto" in
11274         define)
11275         case "$endgrent_r_proto" in
11276         ''|0) try='int endgrent_r(FILE**);'
11277         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11278         esac
11279         case "$endgrent_r_proto" in
11280         ''|0) try='void endgrent_r(FILE**);'
11281         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11282         esac
11283         case "$endgrent_r_proto" in
11284         ''|0)   d_endgrent_r=undef
11285                 endgrent_r_proto=0
11286                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11287         * )     case "$endgrent_r_proto" in
11288                 REENTRANT_PROTO*) ;;
11289                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11290                 esac
11291                 echo "Prototype: $try" ;;
11292         esac
11293         ;;
11294         *)      case "$usethreads" in
11295                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11296                 esac
11297                 d_endgrent_r=undef
11298                 endgrent_r_proto=0
11299                 ;;
11300         esac
11301         ;;
11302 *)      endgrent_r_proto=0
11303         ;;
11304 esac
11305
11306 : see if endhostent exists
11307 set endhostent d_endhent
11308 eval $inlibc
11309
11310 : see if this is a netdb.h system
11311 set netdb.h i_netdb
11312 eval $inhdr
11313
11314 : see if endhostent_r exists
11315 set endhostent_r d_endhostent_r
11316 eval $inlibc
11317 case "$d_endhostent_r" in
11318 "$define")
11319         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11320         case "$d_endhostent_r_proto:$usethreads" in
11321         ":define")      d_endhostent_r_proto=define
11322                 set d_endhostent_r_proto endhostent_r $hdrs
11323                 eval $hasproto ;;
11324         *)      ;;
11325         esac
11326         case "$d_endhostent_r_proto" in
11327         define)
11328         case "$endhostent_r_proto" in
11329         ''|0) try='int endhostent_r(struct hostent_data*);'
11330         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11331         esac
11332         case "$endhostent_r_proto" in
11333         ''|0) try='void endhostent_r(struct hostent_data*);'
11334         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11335         esac
11336         case "$endhostent_r_proto" in
11337         ''|0)   d_endhostent_r=undef
11338                 endhostent_r_proto=0
11339                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11340         * )     case "$endhostent_r_proto" in
11341                 REENTRANT_PROTO*) ;;
11342                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11343                 esac
11344                 echo "Prototype: $try" ;;
11345         esac
11346         ;;
11347         *)      case "$usethreads" in
11348                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11349                 esac
11350                 d_endhostent_r=undef
11351                 endhostent_r_proto=0
11352                 ;;
11353         esac
11354         ;;
11355 *)      endhostent_r_proto=0
11356         ;;
11357 esac
11358
11359 : see if endnetent exists
11360 set endnetent d_endnent
11361 eval $inlibc
11362
11363 : see if endnetent_r exists
11364 set endnetent_r d_endnetent_r
11365 eval $inlibc
11366 case "$d_endnetent_r" in
11367 "$define")
11368         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11369         case "$d_endnetent_r_proto:$usethreads" in
11370         ":define")      d_endnetent_r_proto=define
11371                 set d_endnetent_r_proto endnetent_r $hdrs
11372                 eval $hasproto ;;
11373         *)      ;;
11374         esac
11375         case "$d_endnetent_r_proto" in
11376         define)
11377         case "$endnetent_r_proto" in
11378         ''|0) try='int endnetent_r(struct netent_data*);'
11379         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11380         esac
11381         case "$endnetent_r_proto" in
11382         ''|0) try='void endnetent_r(struct netent_data*);'
11383         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11384         esac
11385         case "$endnetent_r_proto" in
11386         ''|0)   d_endnetent_r=undef
11387                 endnetent_r_proto=0
11388                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11389         * )     case "$endnetent_r_proto" in
11390                 REENTRANT_PROTO*) ;;
11391                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11392                 esac
11393                 echo "Prototype: $try" ;;
11394         esac
11395         ;;
11396         *)      case "$usethreads" in
11397                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11398                 esac
11399                 d_endnetent_r=undef
11400                 endnetent_r_proto=0
11401                 ;;
11402         esac
11403         ;;
11404 *)      endnetent_r_proto=0
11405         ;;
11406 esac
11407
11408 : see if endprotoent exists
11409 set endprotoent d_endpent
11410 eval $inlibc
11411
11412 : see if endprotoent_r exists
11413 set endprotoent_r d_endprotoent_r
11414 eval $inlibc
11415 case "$d_endprotoent_r" in
11416 "$define")
11417         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11418         case "$d_endprotoent_r_proto:$usethreads" in
11419         ":define")      d_endprotoent_r_proto=define
11420                 set d_endprotoent_r_proto endprotoent_r $hdrs
11421                 eval $hasproto ;;
11422         *)      ;;
11423         esac
11424         case "$d_endprotoent_r_proto" in
11425         define)
11426         case "$endprotoent_r_proto" in
11427         ''|0) try='int endprotoent_r(struct protoent_data*);'
11428         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11429         esac
11430         case "$endprotoent_r_proto" in
11431         ''|0) try='void endprotoent_r(struct protoent_data*);'
11432         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11433         esac
11434         case "$endprotoent_r_proto" in
11435         ''|0)   d_endprotoent_r=undef
11436                 endprotoent_r_proto=0
11437                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11438         * )     case "$endprotoent_r_proto" in
11439                 REENTRANT_PROTO*) ;;
11440                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11441                 esac
11442                 echo "Prototype: $try" ;;
11443         esac
11444         ;;
11445         *)      case "$usethreads" in
11446                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11447                 esac
11448                 d_endprotoent_r=undef
11449                 endprotoent_r_proto=0
11450                 ;;
11451         esac
11452         ;;
11453 *)      endprotoent_r_proto=0
11454         ;;
11455 esac
11456
11457 : see if endpwent exists
11458 set endpwent d_endpwent
11459 eval $inlibc
11460
11461 : see if this is a pwd.h system
11462 set pwd.h i_pwd
11463 eval $inhdr
11464
11465 case "$i_pwd" in
11466 $define)
11467         xxx=`./findhdr pwd.h`
11468         $cppstdin $cppflags $cppminus < $xxx >$$.h
11469
11470         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11471                 val="$define"
11472         else
11473                 val="$undef"
11474         fi
11475         set d_pwquota
11476         eval $setvar
11477
11478         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11479                 val="$define"
11480         else
11481                 val="$undef"
11482         fi
11483         set d_pwage
11484         eval $setvar
11485
11486         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11487                 val="$define"
11488         else
11489                 val="$undef"
11490         fi
11491         set d_pwchange
11492         eval $setvar
11493
11494         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11495                 val="$define"
11496         else
11497                 val="$undef"
11498         fi
11499         set d_pwclass
11500         eval $setvar
11501
11502         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11503                 val="$define"
11504         else
11505                 val="$undef"
11506         fi
11507         set d_pwexpire
11508         eval $setvar
11509
11510         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11511                 val="$define"
11512         else
11513                 val="$undef"
11514         fi
11515         set d_pwcomment
11516         eval $setvar
11517
11518         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11519                 val="$define"
11520         else
11521                 val="$undef"
11522         fi
11523         set d_pwgecos
11524         eval $setvar
11525
11526         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11527                 val="$define"
11528         else
11529                 val="$undef"
11530         fi
11531         set d_pwpasswd
11532         eval $setvar
11533
11534         $rm -f $$.h
11535         ;;
11536 *)
11537         val="$undef"; 
11538         set d_pwquota; eval $setvar
11539         set d_pwage; eval $setvar
11540         set d_pwchange; eval $setvar
11541         set d_pwclass; eval $setvar
11542         set d_pwexpire; eval $setvar
11543         set d_pwcomment; eval $setvar
11544         set d_pwgecos; eval $setvar
11545         set d_pwpasswd; eval $setvar
11546         ;;
11547 esac
11548
11549 : see if endpwent_r exists
11550 set endpwent_r d_endpwent_r
11551 eval $inlibc
11552 case "$d_endpwent_r" in
11553 "$define")
11554         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11555         case "$d_endpwent_r_proto:$usethreads" in
11556         ":define")      d_endpwent_r_proto=define
11557                 set d_endpwent_r_proto endpwent_r $hdrs
11558                 eval $hasproto ;;
11559         *)      ;;
11560         esac
11561         case "$d_endpwent_r_proto" in
11562         define)
11563         case "$endpwent_r_proto" in
11564         ''|0) try='int endpwent_r(FILE**);'
11565         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11566         esac
11567         case "$endpwent_r_proto" in
11568         ''|0) try='void endpwent_r(FILE**);'
11569         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11570         esac
11571         case "$endpwent_r_proto" in
11572         ''|0)   d_endpwent_r=undef
11573                 endpwent_r_proto=0
11574                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11575         * )     case "$endpwent_r_proto" in
11576                 REENTRANT_PROTO*) ;;
11577                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11578                 esac
11579                 echo "Prototype: $try" ;;
11580         esac
11581         ;;
11582         *)      case "$usethreads" in
11583                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11584                 esac
11585                 d_endpwent_r=undef
11586                 endpwent_r_proto=0
11587                 ;;
11588         esac
11589         ;;
11590 *)      endpwent_r_proto=0
11591         ;;
11592 esac
11593
11594 : see if endservent exists
11595 set endservent d_endsent
11596 eval $inlibc
11597
11598 : see if endservent_r exists
11599 set endservent_r d_endservent_r
11600 eval $inlibc
11601 case "$d_endservent_r" in
11602 "$define")
11603         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11604         case "$d_endservent_r_proto:$usethreads" in
11605         ":define")      d_endservent_r_proto=define
11606                 set d_endservent_r_proto endservent_r $hdrs
11607                 eval $hasproto ;;
11608         *)      ;;
11609         esac
11610         case "$d_endservent_r_proto" in
11611         define)
11612         case "$endservent_r_proto" in
11613         ''|0) try='int endservent_r(struct servent_data*);'
11614         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11615         esac
11616         case "$endservent_r_proto" in
11617         ''|0) try='void endservent_r(struct servent_data*);'
11618         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11619         esac
11620         case "$endservent_r_proto" in
11621         ''|0)   d_endservent_r=undef
11622                 endservent_r_proto=0
11623                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11624         * )     case "$endservent_r_proto" in
11625                 REENTRANT_PROTO*) ;;
11626                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11627                 esac
11628                 echo "Prototype: $try" ;;
11629         esac
11630         ;;
11631         *)      case "$usethreads" in
11632                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11633                 esac
11634                 d_endservent_r=undef
11635                 endservent_r_proto=0
11636                 ;;
11637         esac
11638         ;;
11639 *)      endservent_r_proto=0
11640         ;;
11641 esac
11642
11643 : Locate the flags for 'open()'
11644 echo " "
11645 $cat >try.c <<EOCP
11646 #include <sys/types.h>
11647 #ifdef I_FCNTL
11648 #include <fcntl.h>
11649 #endif
11650 #ifdef I_SYS_FILE
11651 #include <sys/file.h>
11652 #endif
11653 #$i_stdlib I_STDLIB
11654 #ifdef I_STDLIB
11655 #include <stdlib.h>
11656 #endif
11657 int main() {
11658         if(O_RDONLY);
11659 #ifdef O_TRUNC
11660         exit(0);
11661 #else
11662         exit(1);
11663 #endif
11664 }
11665 EOCP
11666 : check sys/file.h first to get FREAD on Sun
11667 if $test `./findhdr sys/file.h` && \
11668                 set try -DI_SYS_FILE && eval $compile; then
11669         h_sysfile=true;
11670         echo "<sys/file.h> defines the O_* constants..." >&4
11671         if $run ./try; then
11672                 echo "and you have the 3 argument form of open()." >&4
11673                 val="$define"
11674         else
11675                 echo "but not the 3 argument form of open().  Oh, well." >&4
11676                 val="$undef"
11677         fi
11678 elif $test `./findhdr fcntl.h` && \
11679                 set try -DI_FCNTL && eval $compile; then
11680         h_fcntl=true;
11681         echo "<fcntl.h> defines the O_* constants..." >&4
11682         if $run ./try; then
11683                 echo "and you have the 3 argument form of open()." >&4
11684                 val="$define"
11685         else
11686                 echo "but not the 3 argument form of open().  Oh, well." >&4
11687                 val="$undef"
11688         fi
11689 else
11690         val="$undef"
11691         echo "I can't find the O_* constant definitions!  You got problems." >&4
11692 fi
11693 set d_open3
11694 eval $setvar
11695 $rm -f try try.*
11696
11697 : see which of string.h or strings.h is needed
11698 echo " "
11699 strings=`./findhdr string.h`
11700 if $test "$strings" && $test -r "$strings"; then
11701         echo "Using <string.h> instead of <strings.h>." >&4
11702         val="$define"
11703 else
11704         val="$undef"
11705         strings=`./findhdr strings.h`
11706         if $test "$strings" && $test -r "$strings"; then
11707                 echo "Using <strings.h> instead of <string.h>." >&4
11708         else
11709                 echo "No string header found -- You'll surely have problems." >&4
11710         fi
11711 fi
11712 set i_string
11713 eval $setvar
11714 case "$i_string" in
11715 "$undef") strings=`./findhdr strings.h`;;
11716 *)        strings=`./findhdr string.h`;;
11717 esac
11718
11719 : see if this is a sys/file.h system
11720 val=''
11721 set sys/file.h val
11722 eval $inhdr
11723
11724 : do we need to include sys/file.h ?
11725 case "$val" in
11726 "$define")
11727         echo " "
11728         if $h_sysfile; then
11729                 val="$define"
11730                 echo "We'll be including <sys/file.h>." >&4
11731         else
11732                 val="$undef"
11733                 echo "We won't be including <sys/file.h>." >&4
11734         fi
11735         ;;
11736 *)
11737         h_sysfile=false
11738         ;;
11739 esac
11740 set i_sysfile
11741 eval $setvar
11742
11743 : see if fcntl.h is there
11744 val=''
11745 set fcntl.h val
11746 eval $inhdr
11747
11748 : see if we can include fcntl.h
11749 case "$val" in
11750 "$define")
11751         echo " "
11752         if $h_fcntl; then
11753                 val="$define"
11754                 echo "We'll be including <fcntl.h>." >&4
11755         else
11756                 val="$undef"
11757                 if $h_sysfile; then
11758         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11759                 else
11760                         echo "We won't be including <fcntl.h>." >&4
11761                 fi
11762         fi
11763         ;;
11764 *)
11765         h_fcntl=false
11766         val="$undef"
11767         ;;
11768 esac
11769 set i_fcntl
11770 eval $setvar
11771
11772 : check for non-blocking I/O stuff
11773 case "$h_sysfile" in
11774 true) echo "#include <sys/file.h>" > head.c;;
11775 *)
11776        case "$h_fcntl" in
11777        true) echo "#include <fcntl.h>" > head.c;;
11778        *) echo "#include <sys/fcntl.h>" > head.c;;
11779        esac
11780        ;;
11781 esac
11782 echo " "
11783 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11784 case "$o_nonblock" in
11785 '')
11786         $cat head.c > try.c
11787         $cat >>try.c <<EOCP
11788 #include <stdio.h>
11789 #$i_stdlib I_STDLIB
11790 #ifdef I_STDLIB
11791 #include <stdlib.h>
11792 #endif
11793 #$i_fcntl I_FCNTL
11794 #ifdef I_FCNTL
11795 #include <fcntl.h>
11796 #endif
11797 int main() {
11798 #ifdef O_NONBLOCK
11799         printf("O_NONBLOCK\n");
11800         exit(0);
11801 #endif
11802 #ifdef O_NDELAY
11803         printf("O_NDELAY\n");
11804         exit(0);
11805 #endif
11806 #ifdef FNDELAY
11807         printf("FNDELAY\n");
11808         exit(0);
11809 #endif
11810         exit(0);
11811 }
11812 EOCP
11813         set try
11814         if eval $compile_ok; then
11815                 o_nonblock=`$run ./try`
11816                 case "$o_nonblock" in
11817                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11818                 *) echo "Seems like we can use $o_nonblock.";;
11819                 esac
11820         else
11821                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11822         fi
11823         ;;
11824 *) echo "Using $hint value $o_nonblock.";;
11825 esac
11826 $rm -f try try.* .out core
11827
11828 echo " "
11829 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11830 case "$eagain" in
11831 '')
11832         $cat head.c > try.c
11833         $cat >>try.c <<EOCP
11834 #include <errno.h>
11835 #include <sys/types.h>
11836 #include <signal.h>
11837 #include <stdio.h> 
11838 #$i_stdlib I_STDLIB
11839 #ifdef I_STDLIB
11840 #include <stdlib.h>
11841 #endif
11842 #$i_fcntl I_FCNTL
11843 #ifdef I_FCNTL
11844 #include <fcntl.h>
11845 #endif
11846 #define MY_O_NONBLOCK $o_nonblock
11847 #ifndef errno  /* XXX need better Configure test */
11848 extern int errno;
11849 #endif
11850 #$i_unistd I_UNISTD
11851 #ifdef I_UNISTD
11852 #include <unistd.h>
11853 #endif
11854 #$i_string I_STRING
11855 #ifdef I_STRING
11856 #include <string.h>
11857 #else
11858 #include <strings.h>
11859 #endif
11860 $signal_t blech(x) int x; { exit(3); }
11861 EOCP
11862         $cat >> try.c <<'EOCP'
11863 int main()
11864 {
11865         int pd[2];
11866         int pu[2];
11867         char buf[1];
11868         char string[100];
11869
11870         pipe(pd);       /* Down: child -> parent */
11871         pipe(pu);       /* Up: parent -> child */
11872         if (0 != fork()) {
11873                 int ret;
11874                 close(pd[1]);   /* Parent reads from pd[0] */
11875                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11876 #ifdef F_SETFL
11877                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11878                         exit(1);
11879 #else
11880                 exit(4);
11881 #endif
11882                 signal(SIGALRM, blech);
11883                 alarm(5);
11884                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11885                         exit(2);
11886                 sprintf(string, "%d\n", ret);
11887                 write(2, string, strlen(string));
11888                 alarm(0);
11889 #ifdef EAGAIN
11890                 if (errno == EAGAIN) {
11891                         printf("EAGAIN\n");
11892                         goto ok;
11893                 }
11894 #endif
11895 #ifdef EWOULDBLOCK
11896                 if (errno == EWOULDBLOCK)
11897                         printf("EWOULDBLOCK\n");
11898 #endif
11899         ok:
11900                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11901                 sleep(2);                               /* Give it time to close our pipe */
11902                 alarm(5);
11903                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11904                 alarm(0);
11905                 sprintf(string, "%d\n", ret);
11906                 write(4, string, strlen(string));
11907                 exit(0);
11908         }
11909
11910         close(pd[0]);                   /* We write to pd[1] */
11911         close(pu[1]);                   /* We read from pu[0] */
11912         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11913         close(pd[1]);                   /* Pipe pd is now fully closed! */
11914         exit(0);                                /* Bye bye, thank you for playing! */
11915 }
11916 EOCP
11917         set try
11918         if eval $compile_ok; then
11919                 echo "$startsh" >mtry
11920                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11921                 chmod +x mtry
11922                 ./mtry >/dev/null 2>&1
11923                 case $? in
11924                 0) eagain=`$cat try.out`;;
11925                 1) echo "Could not perform non-blocking setting!";;
11926                 2) echo "I did a successful read() for something that was not there!";;
11927                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11928                 4) echo "Could not find F_SETFL!";;
11929                 *) echo "Something terribly wrong happened during testing.";;
11930                 esac
11931                 rd_nodata=`$cat try.ret`
11932                 echo "A read() system call with no data present returns $rd_nodata."
11933                 case "$rd_nodata" in
11934                 0|-1) ;;
11935                 *)
11936                         echo "(That's peculiar, fixing that to be -1.)"
11937                         rd_nodata=-1
11938                         ;;
11939                 esac
11940                 case "$eagain" in
11941                 '')
11942                         echo "Forcing errno EAGAIN on read() with no data available."
11943                         eagain=EAGAIN
11944                         ;;
11945                 *)
11946                         echo "Your read() sets errno to $eagain when no data is available."
11947                         ;;
11948                 esac
11949                 status=`$cat try.err`
11950                 case "$status" in
11951                 0) echo "And it correctly returns 0 to signal EOF.";;
11952                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11953                 *) echo "However, your read() returns '$status' on EOF??";;
11954                 esac
11955                 val="$define"
11956                 if test "$status" = "$rd_nodata"; then
11957                         echo "WARNING: you can't distinguish between EOF and no data!"
11958                         val="$undef"
11959                 fi
11960         else
11961                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11962                 eagain=EAGAIN
11963         fi
11964         set d_eofnblk
11965         eval $setvar
11966         ;;
11967 *)
11968         echo "Using $hint value $eagain."
11969         echo "Your read() returns $rd_nodata when no data is present."
11970         case "$d_eofnblk" in
11971         "$define") echo "And you can see EOF because read() returns 0.";;
11972         "$undef") echo "But you can't see EOF status from read() returned value.";;
11973         *)
11974                 echo "(Assuming you can't see EOF status from read anyway.)"
11975                 d_eofnblk=$undef
11976                 ;;
11977         esac
11978         ;;
11979 esac
11980 $rm -f try try.* .out core head.c mtry
11981
11982 : see if _ptr and _cnt from stdio act std
11983 echo " "
11984
11985 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11986         echo "(Looks like you have stdio.h from BSD.)"
11987         case "$stdio_ptr" in
11988         '') stdio_ptr='((fp)->_p)'
11989                 ptr_lval=$define
11990                 ;;
11991         *)      ptr_lval=$d_stdio_ptr_lval;;
11992         esac
11993         case "$stdio_cnt" in
11994         '') stdio_cnt='((fp)->_r)'
11995                 cnt_lval=$define
11996                 ;;
11997         *)      cnt_lval=$d_stdio_cnt_lval;;
11998         esac
11999         case "$stdio_base" in
12000         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12001         esac
12002         case "$stdio_bufsiz" in
12003         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12004         esac
12005 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12006         echo "(Looks like you have stdio.h from Linux.)"
12007         case "$stdio_ptr" in
12008         '') stdio_ptr='((fp)->_IO_read_ptr)'
12009                 ptr_lval=$define
12010                 ;;
12011         *)      ptr_lval=$d_stdio_ptr_lval;;
12012         esac
12013         case "$stdio_cnt" in
12014         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12015                 cnt_lval=$undef
12016                 ;;
12017         *)      cnt_lval=$d_stdio_cnt_lval;;
12018         esac
12019         case "$stdio_base" in
12020         '') stdio_base='((fp)->_IO_read_base)';;
12021         esac
12022         case "$stdio_bufsiz" in
12023         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12024         esac
12025 else
12026         case "$stdio_ptr" in
12027         '') stdio_ptr='((fp)->_ptr)'
12028                 ptr_lval=$define
12029                 ;;
12030         *)      ptr_lval=$d_stdio_ptr_lval;;
12031         esac
12032         case "$stdio_cnt" in
12033         '') stdio_cnt='((fp)->_cnt)'
12034                 cnt_lval=$define
12035                 ;;
12036         *)      cnt_lval=$d_stdio_cnt_lval;;
12037         esac
12038         case "$stdio_base" in
12039         '') stdio_base='((fp)->_base)';;
12040         esac
12041         case "$stdio_bufsiz" in
12042         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12043         esac
12044 fi
12045
12046 : test whether _ptr and _cnt really work
12047 echo "Checking how std your stdio is..." >&4
12048 $cat >try.c <<EOP
12049 #include <stdio.h>
12050 #$i_stdlib I_STDLIB
12051 #ifdef I_STDLIB
12052 #include <stdlib.h>
12053 #endif
12054 #define FILE_ptr(fp)    $stdio_ptr
12055 #define FILE_cnt(fp)    $stdio_cnt
12056 int main() {
12057         FILE *fp = fopen("try.c", "r");
12058         char c = getc(fp);
12059         if (
12060                 18 <= FILE_cnt(fp) &&
12061                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12062         )
12063                 exit(0);
12064         exit(1);
12065 }
12066 EOP
12067 val="$undef"
12068 set try
12069 if eval $compile && $to try.c; then
12070         if $run ./try; then
12071                 echo "Your stdio acts pretty std."
12072                 val="$define"
12073         else
12074                 echo "Your stdio isn't very std."
12075         fi
12076 else
12077         echo "Your stdio doesn't appear very std."
12078 fi
12079 $rm -f try.c try
12080
12081 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12082 # direct buffer manipulation no longer works.  The Configure tests
12083 # should be changed to correctly detect this, but until then,
12084 # the following check should at least let perl compile and run.
12085 # (This quick fix should be updated before 5.8.1.)
12086 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12087 # A. Dougherty, June 3, 2002.
12088 case "$d_gnulibc" in
12089 $define)
12090         case "$gnulibc_version" in
12091         2.[01]*)  ;;
12092         2.2) ;;
12093         2.2.[0-9]) ;;
12094         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12095                 val="$undef"
12096                 ;;
12097         esac
12098         ;;
12099 esac
12100 set d_stdstdio
12101 eval $setvar
12102
12103 : Can _ptr be used as an lvalue?
12104 case "$d_stdstdio$ptr_lval" in
12105 $define$define) val=$define ;;
12106 *) val=$undef ;;
12107 esac
12108 set d_stdio_ptr_lval
12109 eval $setvar
12110
12111 : Can _cnt be used as an lvalue?
12112 case "$d_stdstdio$cnt_lval" in
12113 $define$define) val=$define ;;
12114 *) val=$undef ;;
12115 esac
12116 set d_stdio_cnt_lval
12117 eval $setvar
12118
12119
12120 : test whether setting _ptr sets _cnt as a side effect
12121 d_stdio_ptr_lval_sets_cnt="$undef"
12122 d_stdio_ptr_lval_nochange_cnt="$undef"
12123 case "$d_stdio_ptr_lval$d_stdstdio" in
12124 $define$define)
12125         echo "Checking to see what happens if we set the stdio ptr..." >&4
12126 $cat >try.c <<EOP
12127 #include <stdio.h>
12128 /* Can we scream? */
12129 /* Eat dust sed :-) */
12130 /* In the buffer space, no one can hear you scream. */
12131 #$i_stdlib I_STDLIB
12132 #ifdef I_STDLIB
12133 #include <stdlib.h>
12134 #endif
12135 #define FILE_ptr(fp)    $stdio_ptr
12136 #define FILE_cnt(fp)    $stdio_cnt
12137 #include <sys/types.h>
12138 int main() {
12139         FILE *fp = fopen("try.c", "r");
12140         int c;
12141         char *ptr;
12142         size_t cnt;
12143         if (!fp) {
12144             puts("Fail even to read");
12145             exit(1);
12146         }
12147         c = getc(fp); /* Read away the first # */
12148         if (c == EOF) {
12149             puts("Fail even to read");
12150             exit(1);
12151         }
12152         if (!(
12153                 18 <= FILE_cnt(fp) &&
12154                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12155         )) {
12156                 puts("Fail even to read");
12157                 exit (1);
12158         }
12159         ptr = (char*) FILE_ptr(fp);
12160         cnt = (size_t)FILE_cnt(fp);
12161
12162         FILE_ptr(fp) += 42;
12163
12164         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12165                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12166                 exit (1);
12167         }
12168         if (FILE_cnt(fp) <= 20) {
12169                 printf ("Fail (<20 chars to test)");
12170                 exit (1);
12171         }
12172         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12173                 puts("Fail compare");
12174                 exit (1);
12175         }
12176         if (cnt == FILE_cnt(fp)) {
12177                 puts("Pass_unchanged");
12178                 exit (0);
12179         }       
12180         if (FILE_cnt(fp) == (cnt - 42)) {
12181                 puts("Pass_changed");
12182                 exit (0);
12183         }
12184         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12185         return 1;
12186
12187 }
12188 EOP
12189         set try
12190         if eval $compile && $to try.c; then
12191                 case `$run ./try` in
12192                 Pass_changed)
12193                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12194                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12195                 Pass_unchanged)
12196                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12197                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12198                 Fail*)
12199                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12200                 *)
12201                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12202         esac
12203         else
12204                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12205         fi
12206         $rm -f try.c try
12207         ;;
12208 esac
12209
12210 : see if _base is also standard
12211 val="$undef"
12212 case "$d_stdstdio" in
12213 $define)
12214         $cat >try.c <<EOP
12215 #include <stdio.h>
12216 #$i_stdlib I_STDLIB
12217 #ifdef I_STDLIB
12218 #include <stdlib.h>
12219 #endif
12220 #define FILE_base(fp)   $stdio_base
12221 #define FILE_bufsiz(fp) $stdio_bufsiz
12222 int main() {
12223         FILE *fp = fopen("try.c", "r");
12224         char c = getc(fp);
12225         if (
12226                 19 <= FILE_bufsiz(fp) &&
12227                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12228         )
12229                 exit(0);
12230         exit(1);
12231 }
12232 EOP
12233         set try
12234         if eval $compile && $to try.c; then
12235                 if $run ./try; then
12236                         echo "And its _base field acts std."
12237                         val="$define"
12238                 else
12239                         echo "But its _base field isn't std."
12240                 fi
12241         else
12242                 echo "However, it seems to be lacking the _base field."
12243         fi
12244         $rm -f try.c try
12245         ;;
12246 esac
12247 set d_stdiobase
12248 eval $setvar
12249
12250 : see if fast_stdio exists
12251 val="$undef"
12252 case "$d_stdstdio:$d_stdio_ptr_lval" in
12253 "$define:$define")
12254         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12255         *$define*)
12256                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12257                 val="$define"
12258                 ;;
12259         esac
12260         ;;
12261 esac
12262 set d_faststdio
12263 eval $setvar
12264
12265
12266
12267 : see if fchdir exists
12268 set fchdir d_fchdir
12269 eval $inlibc
12270
12271 : see if fchmod exists
12272 set fchmod d_fchmod
12273 eval $inlibc
12274
12275 : see if fchown exists
12276 set fchown d_fchown
12277 eval $inlibc
12278
12279 : see if this is an fcntl system
12280 set fcntl d_fcntl
12281 eval $inlibc
12282
12283 echo " "
12284 : See if fcntl-based locking works.
12285 $cat >try.c <<EOCP
12286 #$i_stdlib I_STDLIB
12287 #ifdef I_STDLIB
12288 #include <stdlib.h>
12289 #endif
12290 #include <unistd.h>
12291 #include <fcntl.h>
12292 #include <signal.h>
12293 $signal_t blech(x) int x; { exit(3); }
12294 int main() {
12295 #if defined(F_SETLK) && defined(F_SETLKW)
12296      struct flock flock;
12297      int retval, fd;
12298      fd = open("try.c", O_RDONLY);
12299      flock.l_type = F_RDLCK;
12300      flock.l_whence = SEEK_SET;
12301      flock.l_start = flock.l_len = 0;
12302      signal(SIGALRM, blech);
12303      alarm(10);
12304      retval = fcntl(fd, F_SETLK, &flock);
12305      close(fd);
12306      (retval < 0 ? exit(2) : exit(0));
12307 #else
12308      exit(2);
12309 #endif
12310 }
12311 EOCP
12312 echo "Checking if fcntl-based file locking works... "
12313 case "$d_fcntl" in
12314 "$define")
12315         set try
12316         if eval $compile_ok; then
12317                 if $run ./try; then
12318                         echo "Yes, it seems to work."
12319                         val="$define"
12320                 else
12321                         echo "Nope, it didn't work."
12322                         val="$undef"
12323                         case "$?" in
12324                         3) $cat >&4 <<EOM
12325 ***
12326 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12327 *** This is (almost) impossible.
12328 *** If your NFS lock daemons are not feeling well, something like
12329 *** this may happen, please investigate.  Cannot continue, aborting.
12330 ***
12331 EOM
12332                                 exit 1
12333                                 ;;
12334                         esac
12335                 fi
12336         else
12337                 echo "I'm unable to compile the test program, so I'll assume not."
12338                 val="$undef"
12339         fi
12340         ;;
12341 *) val="$undef";
12342         echo "Nope, since you don't even have fcntl()."
12343         ;;
12344 esac
12345 set d_fcntl_can_lock
12346 eval $setvar
12347 $rm -f try*
12348
12349
12350 : check for fd_set items
12351 $cat <<EOM
12352
12353 Checking to see how well your C compiler handles fd_set and friends ...
12354 EOM
12355 $cat >try.c <<EOCP
12356 #$i_stdlib I_STDLIB
12357 #ifdef I_STDLIB
12358 #include <stdlib.h>
12359 #endif
12360 #$i_systime I_SYS_TIME
12361 #$i_sysselct I_SYS_SELECT
12362 #$d_socket HAS_SOCKET
12363 #include <sys/types.h>
12364 #ifdef HAS_SOCKET
12365 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12366 #endif
12367 #ifdef I_SYS_TIME
12368 #include <sys/time.h>
12369 #endif
12370 #ifdef I_SYS_SELECT
12371 #include <sys/select.h>
12372 #endif
12373 int main() {
12374         fd_set fds;
12375
12376 #ifdef TRYBITS
12377         if(fds.fds_bits);
12378 #endif
12379
12380 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12381         exit(0);
12382 #else
12383         exit(1);
12384 #endif
12385 }
12386 EOCP
12387 set try -DTRYBITS
12388 if eval $compile; then
12389         d_fds_bits="$define"
12390         d_fd_set="$define"
12391         echo "Well, your system knows about the normal fd_set typedef..." >&4
12392         if $run ./try; then
12393                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12394                 d_fd_macros="$define"
12395         else
12396                 $cat >&4 <<'EOM'
12397 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12398 EOM
12399                 d_fd_macros="$undef"
12400         fi
12401 else
12402         $cat <<'EOM'
12403 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12404 EOM
12405         set try
12406         if eval $compile; then
12407                 d_fds_bits="$undef"
12408                 d_fd_set="$define"
12409                 echo "Well, your system has some sort of fd_set available..." >&4
12410                 if $run ./try; then
12411                         echo "and you have the normal fd_set macros." >&4
12412                         d_fd_macros="$define"
12413                 else
12414                         $cat <<'EOM'
12415 but not the normal fd_set macros!  Gross!  More work for me...
12416 EOM
12417                         d_fd_macros="$undef"
12418                 fi
12419         else
12420         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12421                 d_fd_set="$undef"
12422                 d_fds_bits="$undef"
12423                 d_fd_macros="$undef"
12424         fi
12425 fi
12426 $rm -f try try.*
12427
12428 : see if fgetpos exists
12429 set fgetpos d_fgetpos
12430 eval $inlibc
12431
12432 : see if finite exists
12433 set finite d_finite
12434 eval $inlibc
12435
12436 : see if finitel exists
12437 set finitel d_finitel
12438 eval $inlibc
12439
12440 : see if flock exists
12441 set flock d_flock
12442 eval $inlibc
12443
12444 : see if prototype for flock is available
12445 echo " "
12446 set d_flockproto flock $i_sysfile sys/file.h
12447 eval $hasproto
12448
12449 : see if fork exists
12450 set fork d_fork
12451 eval $inlibc
12452
12453 : see if fp_class exists
12454 set fp_class d_fp_class
12455 eval $inlibc
12456
12457 : see if pathconf exists
12458 set pathconf d_pathconf
12459 eval $inlibc
12460
12461 : see if fpathconf exists
12462 set fpathconf d_fpathconf
12463 eval $inlibc
12464
12465 : see if fpclass exists
12466 set fpclass d_fpclass
12467 eval $inlibc
12468
12469 : see if fpclassify exists
12470 set fpclassify d_fpclassify
12471 eval $inlibc
12472
12473 : see if fpclassl exists
12474 set fpclassl d_fpclassl
12475 eval $inlibc
12476
12477
12478 : check for fpos64_t
12479 echo " "
12480 echo "Checking to see if you have fpos64_t..." >&4
12481 $cat >try.c <<EOCP
12482 #include <stdio.h>
12483 int main() { fpos64_t x = 7; }
12484 EOCP
12485 set try
12486 if eval $compile; then
12487         val="$define"
12488         echo "You have fpos64_t."
12489 else
12490         val="$undef"
12491         echo "You do not have fpos64_t."
12492         case "$fpossize" in
12493         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12494         esac
12495 fi
12496 $rm -f try.* try
12497 set d_fpos64_t
12498 eval $setvar
12499
12500 : see if frexpl exists
12501 set frexpl d_frexpl
12502 eval $inlibc
12503
12504 : see if this is a sys/param system
12505 set sys/param.h i_sysparam
12506 eval $inhdr
12507
12508 : see if this is a sys/mount.h system
12509 set sys/mount.h i_sysmount
12510 eval $inhdr
12511
12512
12513 echo " "
12514 echo "Checking to see if your system supports struct fs_data..." >&4
12515 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12516 eval $hasstruct
12517 case "$d_fs_data_s" in
12518 "$define")      echo "Yes, it does."   ;;
12519 *)              echo "No, it doesn't." ;;
12520 esac
12521
12522 : see if fseeko exists
12523 set fseeko d_fseeko
12524 eval $inlibc
12525 case "$longsize" in
12526 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12527 esac
12528
12529 : see if fsetpos exists
12530 set fsetpos d_fsetpos
12531 eval $inlibc
12532
12533
12534 : see if fstatfs exists
12535 set fstatfs d_fstatfs
12536 eval $inlibc
12537
12538
12539 : see if statvfs exists
12540 set statvfs d_statvfs
12541 eval $inlibc
12542
12543 : see if fstatvfs exists
12544 set fstatvfs d_fstatvfs
12545 eval $inlibc
12546
12547
12548 : see if fsync exists
12549 set fsync d_fsync
12550 eval $inlibc
12551
12552 : see if ftello exists
12553 set ftello d_ftello
12554 eval $inlibc
12555 case "$longsize" in
12556 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12557 esac
12558
12559 d_futimes="$undef"
12560 : check for a working futimes
12561 echo " "
12562 echo "Checking for a working futimes()" >&4
12563 $cat >try.c <<EOCP
12564 #include <stdio.h>
12565 #include <sys/time.h>
12566 #include <errno.h>
12567 #include <fcntl.h>
12568
12569 int main ()
12570 {
12571     int fd, rv;
12572     fd = open ("try.c", O_RDWR);
12573     if (-1 == fd) exit (1);
12574     rv = futimes (fd, NULL);
12575     exit (rv == -1 ? errno : 0);
12576 }
12577 EOCP
12578 set try
12579 if eval $compile; then
12580     `$run ./try`
12581     rc=$?
12582     case "$rc" in
12583         0)  echo "Yes, it does" >&4
12584             d_futimes="$define"
12585             ;;
12586         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12587             ;;
12588     esac
12589 else
12590     echo "No, it does not (probably harmless)\n" >&4
12591 fi
12592 $rm -f try.* try core core.try.*
12593
12594 : see if getcwd exists
12595 set getcwd d_getcwd
12596 eval $inlibc
12597
12598 : see if getespwnam exists
12599 set getespwnam d_getespwnam
12600 eval $inlibc
12601
12602
12603 : see if getfsstat exists
12604 set getfsstat d_getfsstat
12605 eval $inlibc
12606
12607 : see if getgrent exists
12608 set getgrent d_getgrent
12609 eval $inlibc
12610
12611 : see if getgrent_r exists
12612 set getgrent_r d_getgrent_r
12613 eval $inlibc
12614 case "$d_getgrent_r" in
12615 "$define")
12616         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12617         case "$d_getgrent_r_proto:$usethreads" in
12618         ":define")      d_getgrent_r_proto=define
12619                 set d_getgrent_r_proto getgrent_r $hdrs
12620                 eval $hasproto ;;
12621         *)      ;;
12622         esac
12623         case "$d_getgrent_r_proto" in
12624         define)
12625         case "$getgrent_r_proto" in
12626         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12627         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12628         esac
12629         case "$getgrent_r_proto" in
12630         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12631         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12632         esac
12633         case "$getgrent_r_proto" in
12634         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12635         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12636         esac
12637         case "$getgrent_r_proto" in
12638         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12639         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12640         esac
12641         case "$getgrent_r_proto" in
12642         ''|0) try='int getgrent_r(struct group*, char*, int);'
12643         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12644         esac
12645         case "$getgrent_r_proto" in
12646         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12647         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12648         esac
12649         case "$getgrent_r_proto" in
12650         ''|0)   d_getgrent_r=undef
12651                 getgrent_r_proto=0
12652                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12653         * )     case "$getgrent_r_proto" in
12654                 REENTRANT_PROTO*) ;;
12655                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12656                 esac
12657                 echo "Prototype: $try" ;;
12658         esac
12659         ;;
12660         *)      case "$usethreads" in
12661                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12662                 esac
12663                 d_getgrent_r=undef
12664                 getgrent_r_proto=0
12665                 ;;
12666         esac
12667         ;;
12668 *)      getgrent_r_proto=0
12669         ;;
12670 esac
12671
12672 : see if getgrgid_r exists
12673 set getgrgid_r d_getgrgid_r
12674 eval $inlibc
12675 case "$d_getgrgid_r" in
12676 "$define")
12677         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12678         case "$d_getgrgid_r_proto:$usethreads" in
12679         ":define")      d_getgrgid_r_proto=define
12680                 set d_getgrgid_r_proto getgrgid_r $hdrs
12681                 eval $hasproto ;;
12682         *)      ;;
12683         esac
12684         case "$d_getgrgid_r_proto" in
12685         define)
12686         case "$getgrgid_r_proto" in
12687         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12688         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12689         esac
12690         case "$getgrgid_r_proto" in
12691         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12692         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12693         esac
12694         case "$getgrgid_r_proto" in
12695         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12696         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12697         esac
12698         case "$getgrgid_r_proto" in
12699         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12700         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12701         esac
12702         case "$getgrgid_r_proto" in
12703         ''|0)   d_getgrgid_r=undef
12704                 getgrgid_r_proto=0
12705                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12706         * )     case "$getgrgid_r_proto" in
12707                 REENTRANT_PROTO*) ;;
12708                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12709                 esac
12710                 echo "Prototype: $try" ;;
12711         esac
12712         ;;
12713         *)      case "$usethreads" in
12714                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12715                 esac
12716                 d_getgrgid_r=undef
12717                 getgrgid_r_proto=0
12718                 ;;
12719         esac
12720         ;;
12721 *)      getgrgid_r_proto=0
12722         ;;
12723 esac
12724
12725 : see if getgrnam_r exists
12726 set getgrnam_r d_getgrnam_r
12727 eval $inlibc
12728 case "$d_getgrnam_r" in
12729 "$define")
12730         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12731         case "$d_getgrnam_r_proto:$usethreads" in
12732         ":define")      d_getgrnam_r_proto=define
12733                 set d_getgrnam_r_proto getgrnam_r $hdrs
12734                 eval $hasproto ;;
12735         *)      ;;
12736         esac
12737         case "$d_getgrnam_r_proto" in
12738         define)
12739         case "$getgrnam_r_proto" in
12740         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12741         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12742         esac
12743         case "$getgrnam_r_proto" in
12744         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12745         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12746         esac
12747         case "$getgrnam_r_proto" in
12748         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12749         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12750         esac
12751         case "$getgrnam_r_proto" in
12752         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12753         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12754         esac
12755         case "$getgrnam_r_proto" in
12756         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12757         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12758         esac
12759         case "$getgrnam_r_proto" in
12760         ''|0)   d_getgrnam_r=undef
12761                 getgrnam_r_proto=0
12762                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12763         * )     case "$getgrnam_r_proto" in
12764                 REENTRANT_PROTO*) ;;
12765                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12766                 esac
12767                 echo "Prototype: $try" ;;
12768         esac
12769         ;;
12770         *)      case "$usethreads" in
12771                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12772                 esac
12773                 d_getgrnam_r=undef
12774                 getgrnam_r_proto=0
12775                 ;;
12776         esac
12777         ;;
12778 *)      getgrnam_r_proto=0
12779         ;;
12780 esac
12781
12782 : see if gethostbyaddr exists
12783 set gethostbyaddr d_gethbyaddr
12784 eval $inlibc
12785
12786 : see if gethostbyname exists
12787 set gethostbyname d_gethbyname
12788 eval $inlibc
12789
12790 : see if gethostent exists
12791 set gethostent d_gethent
12792 eval $inlibc
12793
12794 : see how we will look up host name
12795 echo " "
12796 call=''
12797 if set gethostname val -f d_gethname; eval $csym; $val; then
12798         echo 'gethostname() found.' >&4
12799         d_gethname="$define"
12800         call=gethostname
12801 fi
12802 if set uname val -f d_uname; eval $csym; $val; then
12803         if ./xenix; then
12804                 $cat <<'EOM'
12805 uname() was found, but you're running xenix, and older versions of xenix
12806 have a broken uname(). If you don't really know whether your xenix is old
12807 enough to have a broken system call, use the default answer.
12808
12809 EOM
12810                 dflt=y
12811                 case "$d_uname" in
12812                 "$define") dflt=n;;
12813                 esac
12814                 rp='Is your uname() broken?'
12815                 . ./myread
12816                 case "$ans" in
12817                 n*) d_uname="$define"; call=uname;;
12818                 esac
12819         else
12820                 echo 'uname() found.' >&4
12821                 d_uname="$define"
12822                 case "$call" in
12823                 '') call=uname ;;
12824                 esac
12825         fi
12826 fi
12827 case "$d_gethname" in
12828 '') d_gethname="$undef";;
12829 esac
12830 case "$d_uname" in
12831 '') d_uname="$undef";;
12832 esac
12833 case "$d_uname$d_gethname" in
12834 *define*)
12835         dflt=n
12836         cat <<EOM
12837  
12838 Every now and then someone has a $call() that lies about the hostname
12839 but can't be fixed for political or economic reasons.  If you wish, I can
12840 pretend $call() isn't there and maybe compute hostname at run-time
12841 thanks to the '$phostname' command.
12842
12843 EOM
12844         rp="Shall I ignore $call() from now on?"
12845         . ./myread
12846         case "$ans" in
12847         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12848         esac;;
12849 esac
12850 case "$phostname" in
12851 '') aphostname='';;
12852 *) case "$aphostname" in
12853         /*) ;;
12854         *) set X $phostname
12855                 shift
12856                 file=$1
12857                 shift
12858                 file=`./loc $file $file $pth`
12859                 aphostname=`echo $file $*`
12860                 ;;
12861         esac
12862         ;;
12863 esac
12864 case "$d_uname$d_gethname" in
12865 *define*) ;;
12866 *)
12867         case "$phostname" in
12868         '')
12869                 echo "There will be no way for $package to get your hostname." >&4;;
12870         *)
12871         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12872                 ;;
12873         esac;;
12874 esac
12875 case "$d_phostname" in
12876 '') d_phostname="$undef";;
12877 esac
12878
12879 : see if gethostbyaddr_r exists
12880 set gethostbyaddr_r d_gethostbyaddr_r
12881 eval $inlibc
12882 case "$d_gethostbyaddr_r" in
12883 "$define")
12884         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12885         case "$d_gethostbyaddr_r_proto:$usethreads" in
12886         ":define")      d_gethostbyaddr_r_proto=define
12887                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12888                 eval $hasproto ;;
12889         *)      ;;
12890         esac
12891         case "$d_gethostbyaddr_r_proto" in
12892         define)
12893         case "$gethostbyaddr_r_proto" in
12894         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12895         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12896         esac
12897         case "$gethostbyaddr_r_proto" in
12898         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12899         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12900         esac
12901         case "$gethostbyaddr_r_proto" in
12902         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12903         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12904         esac
12905         case "$gethostbyaddr_r_proto" in
12906         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12907         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12908         esac
12909         case "$gethostbyaddr_r_proto" in
12910         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12911         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12912         esac
12913         case "$gethostbyaddr_r_proto" in
12914         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12915         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12916         esac
12917         case "$gethostbyaddr_r_proto" in
12918         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12919         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12920         esac
12921         case "$gethostbyaddr_r_proto" in
12922         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12923         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12924         esac
12925         case "$gethostbyaddr_r_proto" in
12926         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12927         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12928         esac
12929         case "$gethostbyaddr_r_proto" in
12930         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12931         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12932         esac
12933         case "$gethostbyaddr_r_proto" in
12934         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12935         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12936         esac
12937         case "$gethostbyaddr_r_proto" in
12938         ''|0)   d_gethostbyaddr_r=undef
12939                 gethostbyaddr_r_proto=0
12940                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12941         * )     case "$gethostbyaddr_r_proto" in
12942                 REENTRANT_PROTO*) ;;
12943                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12944                 esac
12945                 echo "Prototype: $try" ;;
12946         esac
12947         ;;
12948         *)      case "$usethreads" in
12949                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12950                 esac
12951                 d_gethostbyaddr_r=undef
12952                 gethostbyaddr_r_proto=0
12953                 ;;
12954         esac
12955         ;;
12956 *)      gethostbyaddr_r_proto=0
12957         ;;
12958 esac
12959
12960 : see if gethostbyname_r exists
12961 set gethostbyname_r d_gethostbyname_r
12962 eval $inlibc
12963 case "$d_gethostbyname_r" in
12964 "$define")
12965         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12966         case "$d_gethostbyname_r_proto:$usethreads" in
12967         ":define")      d_gethostbyname_r_proto=define
12968                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12969                 eval $hasproto ;;
12970         *)      ;;
12971         esac
12972         case "$d_gethostbyname_r_proto" in
12973         define)
12974         case "$gethostbyname_r_proto" in
12975         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12976         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12977         esac
12978         case "$gethostbyname_r_proto" in
12979         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12980         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12981         esac
12982         case "$gethostbyname_r_proto" in
12983         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12984         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12985         esac
12986         case "$gethostbyname_r_proto" in
12987         ''|0)   d_gethostbyname_r=undef
12988                 gethostbyname_r_proto=0
12989                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12990         * )     case "$gethostbyname_r_proto" in
12991                 REENTRANT_PROTO*) ;;
12992                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12993                 esac
12994                 echo "Prototype: $try" ;;
12995         esac
12996         ;;
12997         *)      case "$usethreads" in
12998                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12999                 esac
13000                 d_gethostbyname_r=undef
13001                 gethostbyname_r_proto=0
13002                 ;;
13003         esac
13004         ;;
13005 *)      gethostbyname_r_proto=0
13006         ;;
13007 esac
13008
13009 : see if gethostent_r exists
13010 set gethostent_r d_gethostent_r
13011 eval $inlibc
13012 case "$d_gethostent_r" in
13013 "$define")
13014         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13015         case "$d_gethostent_r_proto:$usethreads" in
13016         ":define")      d_gethostent_r_proto=define
13017                 set d_gethostent_r_proto gethostent_r $hdrs
13018                 eval $hasproto ;;
13019         *)      ;;
13020         esac
13021         case "$d_gethostent_r_proto" in
13022         define)
13023         case "$gethostent_r_proto" in
13024         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13025         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13026         esac
13027         case "$gethostent_r_proto" in
13028         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13029         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13030         esac
13031         case "$gethostent_r_proto" in
13032         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13033         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13034         esac
13035         case "$gethostent_r_proto" in
13036         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13037         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13038         esac
13039         case "$gethostent_r_proto" in
13040         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13041         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13042         esac
13043         case "$gethostent_r_proto" in
13044         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13045         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13046         esac
13047         case "$gethostent_r_proto" in
13048         ''|0)   d_gethostent_r=undef
13049                 gethostent_r_proto=0
13050                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13051         * )     case "$gethostent_r_proto" in
13052                 REENTRANT_PROTO*) ;;
13053                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13054                 esac
13055                 echo "Prototype: $try" ;;
13056         esac
13057         ;;
13058         *)      case "$usethreads" in
13059                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13060                 esac
13061                 d_gethostent_r=undef
13062                 gethostent_r_proto=0
13063                 ;;
13064         esac
13065         ;;
13066 *)      gethostent_r_proto=0
13067         ;;
13068 esac
13069
13070 : see if prototypes for various gethostxxx netdb.h functions are available
13071 echo " "
13072 set d_gethostprotos gethostent $i_netdb netdb.h
13073 eval $hasproto
13074
13075 : see if getitimer exists
13076 set getitimer d_getitimer
13077 eval $inlibc
13078
13079 : see if getlogin exists
13080 set getlogin d_getlogin
13081 eval $inlibc
13082
13083 : see if getlogin_r exists
13084 set getlogin_r d_getlogin_r
13085 eval $inlibc
13086 case "$d_getlogin_r" in
13087 "$define")
13088         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13089         case "$d_getlogin_r_proto:$usethreads" in
13090         ":define")      d_getlogin_r_proto=define
13091                 set d_getlogin_r_proto getlogin_r $hdrs
13092                 eval $hasproto ;;
13093         *)      ;;
13094         esac
13095         case "$d_getlogin_r_proto" in
13096         define)
13097         case "$getlogin_r_proto" in
13098         ''|0) try='int getlogin_r(char*, size_t);'
13099         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13100         esac
13101         case "$getlogin_r_proto" in
13102         ''|0) try='int getlogin_r(char*, int);'
13103         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13104         esac
13105         case "$getlogin_r_proto" in
13106         ''|0) try='char* getlogin_r(char*, size_t);'
13107         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13108         esac
13109         case "$getlogin_r_proto" in
13110         ''|0) try='char* getlogin_r(char*, int);'
13111         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13112         esac
13113         case "$getlogin_r_proto" in
13114         ''|0)   d_getlogin_r=undef
13115                 getlogin_r_proto=0
13116                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13117         * )     case "$getlogin_r_proto" in
13118                 REENTRANT_PROTO*) ;;
13119                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13120                 esac
13121                 echo "Prototype: $try" ;;
13122         esac
13123         ;;
13124         *)      case "$usethreads" in
13125                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13126                 esac
13127                 d_getlogin_r=undef
13128                 getlogin_r_proto=0
13129                 ;;
13130         esac
13131         ;;
13132 *)      getlogin_r_proto=0
13133         ;;
13134 esac
13135
13136 : see if getmnt exists
13137 set getmnt d_getmnt
13138 eval $inlibc
13139
13140 : see if getmntent exists
13141 set getmntent d_getmntent
13142 eval $inlibc
13143
13144 : see if getnetbyaddr exists
13145 set getnetbyaddr d_getnbyaddr
13146 eval $inlibc
13147
13148 : see if getnetbyname exists
13149 set getnetbyname d_getnbyname
13150 eval $inlibc
13151
13152 : see if getnetent exists
13153 set getnetent d_getnent
13154 eval $inlibc
13155
13156 : see if getnetbyaddr_r exists
13157 set getnetbyaddr_r d_getnetbyaddr_r
13158 eval $inlibc
13159 case "$d_getnetbyaddr_r" in
13160 "$define")
13161         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13162         case "$d_getnetbyaddr_r_proto:$usethreads" in
13163         ":define")      d_getnetbyaddr_r_proto=define
13164                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13165                 eval $hasproto ;;
13166         *)      ;;
13167         esac
13168         case "$d_getnetbyaddr_r_proto" in
13169         define)
13170         case "$getnetbyaddr_r_proto" in
13171         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13172         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13173         esac
13174         case "$getnetbyaddr_r_proto" in
13175         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13176         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13177         esac
13178         case "$getnetbyaddr_r_proto" in
13179         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13180         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13181         esac
13182         case "$getnetbyaddr_r_proto" in
13183         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13184         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13185         esac
13186         case "$getnetbyaddr_r_proto" in
13187         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13188         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13189         esac
13190         case "$getnetbyaddr_r_proto" in
13191         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13192         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13193         esac
13194         case "$getnetbyaddr_r_proto" in
13195         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13196         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13197         esac
13198         case "$getnetbyaddr_r_proto" in
13199         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13200         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13201         esac
13202         case "$getnetbyaddr_r_proto" in
13203         ''|0)   d_getnetbyaddr_r=undef
13204                 getnetbyaddr_r_proto=0
13205                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13206         * )     case "$getnetbyaddr_r_proto" in
13207                 REENTRANT_PROTO*) ;;
13208                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13209                 esac
13210                 echo "Prototype: $try" ;;
13211         esac
13212         ;;
13213         *)      case "$usethreads" in
13214                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13215                 esac
13216                 d_getnetbyaddr_r=undef
13217                 getnetbyaddr_r_proto=0
13218                 ;;
13219         esac
13220         ;;
13221 *)      getnetbyaddr_r_proto=0
13222         ;;
13223 esac
13224
13225 : see if getnetbyname_r exists
13226 set getnetbyname_r d_getnetbyname_r
13227 eval $inlibc
13228 case "$d_getnetbyname_r" in
13229 "$define")
13230         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13231         case "$d_getnetbyname_r_proto:$usethreads" in
13232         ":define")      d_getnetbyname_r_proto=define
13233                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13234                 eval $hasproto ;;
13235         *)      ;;
13236         esac
13237         case "$d_getnetbyname_r_proto" in
13238         define)
13239         case "$getnetbyname_r_proto" in
13240         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13241         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13242         esac
13243         case "$getnetbyname_r_proto" in
13244         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13245         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13246         esac
13247         case "$getnetbyname_r_proto" in
13248         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13249         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13250         esac
13251         case "$getnetbyname_r_proto" in
13252         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13253         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13254         esac
13255         case "$getnetbyname_r_proto" in
13256         ''|0)   d_getnetbyname_r=undef
13257                 getnetbyname_r_proto=0
13258                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13259         * )     case "$getnetbyname_r_proto" in
13260                 REENTRANT_PROTO*) ;;
13261                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13262                 esac
13263                 echo "Prototype: $try" ;;
13264         esac
13265         ;;
13266         *)      case "$usethreads" in
13267                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13268                 esac
13269                 d_getnetbyname_r=undef
13270                 getnetbyname_r_proto=0
13271                 ;;
13272         esac
13273         ;;
13274 *)      getnetbyname_r_proto=0
13275         ;;
13276 esac
13277
13278 : see if getnetent_r exists
13279 set getnetent_r d_getnetent_r
13280 eval $inlibc
13281 case "$d_getnetent_r" in
13282 "$define")
13283         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13284         case "$d_getnetent_r_proto:$usethreads" in
13285         ":define")      d_getnetent_r_proto=define
13286                 set d_getnetent_r_proto getnetent_r $hdrs
13287                 eval $hasproto ;;
13288         *)      ;;
13289         esac
13290         case "$d_getnetent_r_proto" in
13291         define)
13292         case "$getnetent_r_proto" in
13293         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13294         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13295         esac
13296         case "$getnetent_r_proto" in
13297         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13298         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13299         esac
13300         case "$getnetent_r_proto" in
13301         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13302         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13303         esac
13304         case "$getnetent_r_proto" in
13305         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13306         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13307         esac
13308         case "$getnetent_r_proto" in
13309         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13310         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13311         esac
13312         case "$getnetent_r_proto" in
13313         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13314         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13315         esac
13316         case "$getnetent_r_proto" in
13317         ''|0)   d_getnetent_r=undef
13318                 getnetent_r_proto=0
13319                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13320         * )     case "$getnetent_r_proto" in
13321                 REENTRANT_PROTO*) ;;
13322                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13323                 esac
13324                 echo "Prototype: $try" ;;
13325         esac
13326         ;;
13327         *)      case "$usethreads" in
13328                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13329                 esac
13330                 d_getnetent_r=undef
13331                 getnetent_r_proto=0
13332                 ;;
13333         esac
13334         ;;
13335 *)      getnetent_r_proto=0
13336         ;;
13337 esac
13338
13339 : see if prototypes for various getnetxxx netdb.h functions are available
13340 echo " "
13341 set d_getnetprotos getnetent $i_netdb netdb.h
13342 eval $hasproto
13343
13344 : see if getpagesize exists
13345 set getpagesize d_getpagsz
13346 eval $inlibc
13347
13348
13349 : see if getprotobyname exists
13350 set getprotobyname d_getpbyname
13351 eval $inlibc
13352
13353 : see if getprotobynumber exists
13354 set getprotobynumber d_getpbynumber
13355 eval $inlibc
13356
13357 : see if getprotoent exists
13358 set getprotoent d_getpent
13359 eval $inlibc
13360
13361 : see if getpgid exists
13362 set getpgid d_getpgid
13363 eval $inlibc
13364
13365 : see if getpgrp2 exists
13366 set getpgrp2 d_getpgrp2
13367 eval $inlibc
13368
13369 : see if getppid exists
13370 set getppid d_getppid
13371 eval $inlibc
13372
13373 : see if getpriority exists
13374 set getpriority d_getprior
13375 eval $inlibc
13376
13377 : see if getprotobyname_r exists
13378 set getprotobyname_r d_getprotobyname_r
13379 eval $inlibc
13380 case "$d_getprotobyname_r" in
13381 "$define")
13382         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13383         case "$d_getprotobyname_r_proto:$usethreads" in
13384         ":define")      d_getprotobyname_r_proto=define
13385                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13386                 eval $hasproto ;;
13387         *)      ;;
13388         esac
13389         case "$d_getprotobyname_r_proto" in
13390         define)
13391         case "$getprotobyname_r_proto" in
13392         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13393         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13394         esac
13395         case "$getprotobyname_r_proto" in
13396         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13397         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13398         esac
13399         case "$getprotobyname_r_proto" in
13400         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13401         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13402         esac
13403         case "$getprotobyname_r_proto" in
13404         ''|0)   d_getprotobyname_r=undef
13405                 getprotobyname_r_proto=0
13406                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13407         * )     case "$getprotobyname_r_proto" in
13408                 REENTRANT_PROTO*) ;;
13409                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13410                 esac
13411                 echo "Prototype: $try" ;;
13412         esac
13413         ;;
13414         *)      case "$usethreads" in
13415                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13416                 esac
13417                 d_getprotobyname_r=undef
13418                 getprotobyname_r_proto=0
13419                 ;;
13420         esac
13421         ;;
13422 *)      getprotobyname_r_proto=0
13423         ;;
13424 esac
13425
13426 : see if getprotobynumber_r exists
13427 set getprotobynumber_r d_getprotobynumber_r
13428 eval $inlibc
13429 case "$d_getprotobynumber_r" in
13430 "$define")
13431         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13432         case "$d_getprotobynumber_r_proto:$usethreads" in
13433         ":define")      d_getprotobynumber_r_proto=define
13434                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13435                 eval $hasproto ;;
13436         *)      ;;
13437         esac
13438         case "$d_getprotobynumber_r_proto" in
13439         define)
13440         case "$getprotobynumber_r_proto" in
13441         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13442         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13443         esac
13444         case "$getprotobynumber_r_proto" in
13445         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13446         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13447         esac
13448         case "$getprotobynumber_r_proto" in
13449         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13450         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13451         esac
13452         case "$getprotobynumber_r_proto" in
13453         ''|0)   d_getprotobynumber_r=undef
13454                 getprotobynumber_r_proto=0
13455                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13456         * )     case "$getprotobynumber_r_proto" in
13457                 REENTRANT_PROTO*) ;;
13458                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13459                 esac
13460                 echo "Prototype: $try" ;;
13461         esac
13462         ;;
13463         *)      case "$usethreads" in
13464                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13465                 esac
13466                 d_getprotobynumber_r=undef
13467                 getprotobynumber_r_proto=0
13468                 ;;
13469         esac
13470         ;;
13471 *)      getprotobynumber_r_proto=0
13472         ;;
13473 esac
13474
13475 : see if getprotoent_r exists
13476 set getprotoent_r d_getprotoent_r
13477 eval $inlibc
13478 case "$d_getprotoent_r" in
13479 "$define")
13480         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13481         case "$d_getprotoent_r_proto:$usethreads" in
13482         ":define")      d_getprotoent_r_proto=define
13483                 set d_getprotoent_r_proto getprotoent_r $hdrs
13484                 eval $hasproto ;;
13485         *)      ;;
13486         esac
13487         case "$d_getprotoent_r_proto" in
13488         define)
13489         case "$getprotoent_r_proto" in
13490         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13491         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13492         esac
13493         case "$getprotoent_r_proto" in
13494         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13495         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13496         esac
13497         case "$getprotoent_r_proto" in
13498         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13499         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13500         esac
13501         case "$getprotoent_r_proto" in
13502         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13503         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13504         esac
13505         case "$getprotoent_r_proto" in
13506         ''|0)   d_getprotoent_r=undef
13507                 getprotoent_r_proto=0
13508                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13509         * )     case "$getprotoent_r_proto" in
13510                 REENTRANT_PROTO*) ;;
13511                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13512                 esac
13513                 echo "Prototype: $try" ;;
13514         esac
13515         ;;
13516         *)      case "$usethreads" in
13517                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13518                 esac
13519                 d_getprotoent_r=undef
13520                 getprotoent_r_proto=0
13521                 ;;
13522         esac
13523         ;;
13524 *)      getprotoent_r_proto=0
13525         ;;
13526 esac
13527
13528 : see if prototypes for various getprotoxxx netdb.h functions are available
13529 echo " "
13530 set d_getprotoprotos getprotoent $i_netdb netdb.h
13531 eval $hasproto
13532
13533 : see if getprpwnam exists
13534 set getprpwnam d_getprpwnam
13535 eval $inlibc
13536
13537 : see if getpwent exists
13538 set getpwent d_getpwent
13539 eval $inlibc
13540
13541 : see if getpwent_r exists
13542 set getpwent_r d_getpwent_r
13543 eval $inlibc
13544 case "$d_getpwent_r" in
13545 "$define")
13546         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13547         case "$d_getpwent_r_proto:$usethreads" in
13548         ":define")      d_getpwent_r_proto=define
13549                 set d_getpwent_r_proto getpwent_r $hdrs
13550                 eval $hasproto ;;
13551         *)      ;;
13552         esac
13553         case "$d_getpwent_r_proto" in
13554         define)
13555         case "$getpwent_r_proto" in
13556         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13557         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13558         esac
13559         case "$getpwent_r_proto" in
13560         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13561         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13562         esac
13563         case "$getpwent_r_proto" in
13564         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13565         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13566         esac
13567         case "$getpwent_r_proto" in
13568         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13569         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13570         esac
13571         case "$getpwent_r_proto" in
13572         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13573         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13574         esac
13575         case "$getpwent_r_proto" in
13576         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13577         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13578         esac
13579         case "$getpwent_r_proto" in
13580         ''|0)   d_getpwent_r=undef
13581                 getpwent_r_proto=0
13582                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13583         * )     case "$getpwent_r_proto" in
13584                 REENTRANT_PROTO*) ;;
13585                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13586                 esac
13587                 echo "Prototype: $try" ;;
13588         esac
13589         ;;
13590         *)      case "$usethreads" in
13591                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13592                 esac
13593                 d_getpwent_r=undef
13594                 getpwent_r_proto=0
13595                 ;;
13596         esac
13597         ;;
13598 *)      getpwent_r_proto=0
13599         ;;
13600 esac
13601
13602 : see if getpwnam_r exists
13603 set getpwnam_r d_getpwnam_r
13604 eval $inlibc
13605 case "$d_getpwnam_r" in
13606 "$define")
13607         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13608         case "$d_getpwnam_r_proto:$usethreads" in
13609         ":define")      d_getpwnam_r_proto=define
13610                 set d_getpwnam_r_proto getpwnam_r $hdrs
13611                 eval $hasproto ;;
13612         *)      ;;
13613         esac
13614         case "$d_getpwnam_r_proto" in
13615         define)
13616         case "$getpwnam_r_proto" in
13617         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13618         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13619         esac
13620         case "$getpwnam_r_proto" in
13621         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13622         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13623         esac
13624         case "$getpwnam_r_proto" in
13625         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13626         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13627         esac
13628         case "$getpwnam_r_proto" in
13629         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13630         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13631         esac
13632         case "$getpwnam_r_proto" in
13633         ''|0)   d_getpwnam_r=undef
13634                 getpwnam_r_proto=0
13635                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13636         * )     case "$getpwnam_r_proto" in
13637                 REENTRANT_PROTO*) ;;
13638                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13639                 esac
13640                 echo "Prototype: $try" ;;
13641         esac
13642         ;;
13643         *)      case "$usethreads" in
13644                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13645                 esac
13646                 d_getpwnam_r=undef
13647                 getpwnam_r_proto=0
13648                 ;;
13649         esac
13650         ;;
13651 *)      getpwnam_r_proto=0
13652         ;;
13653 esac
13654
13655 : see if getpwuid_r exists
13656 set getpwuid_r d_getpwuid_r
13657 eval $inlibc
13658 case "$d_getpwuid_r" in
13659 "$define")
13660         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13661         case "$d_getpwuid_r_proto:$usethreads" in
13662         ":define")      d_getpwuid_r_proto=define
13663                 set d_getpwuid_r_proto getpwuid_r $hdrs
13664                 eval $hasproto ;;
13665         *)      ;;
13666         esac
13667         case "$d_getpwuid_r_proto" in
13668         define)
13669         case "$getpwuid_r_proto" in
13670         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13671         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13672         esac
13673         case "$getpwuid_r_proto" in
13674         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13675         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13676         esac
13677         case "$getpwuid_r_proto" in
13678         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13679         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13680         esac
13681         case "$getpwuid_r_proto" in
13682         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13683         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13684         esac
13685         case "$getpwuid_r_proto" in
13686         ''|0)   d_getpwuid_r=undef
13687                 getpwuid_r_proto=0
13688                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13689         * )     case "$getpwuid_r_proto" in
13690                 REENTRANT_PROTO*) ;;
13691                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13692                 esac
13693                 echo "Prototype: $try" ;;
13694         esac
13695         ;;
13696         *)      case "$usethreads" in
13697                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13698                 esac
13699                 d_getpwuid_r=undef
13700                 getpwuid_r_proto=0
13701                 ;;
13702         esac
13703         ;;
13704 *)      getpwuid_r_proto=0
13705         ;;
13706 esac
13707
13708
13709 : see if getservbyname exists
13710 set getservbyname d_getsbyname
13711 eval $inlibc
13712
13713 : see if getservbyport exists
13714 set getservbyport d_getsbyport
13715 eval $inlibc
13716
13717 : see if getservent exists
13718 set getservent d_getsent
13719 eval $inlibc
13720
13721 : see if getservbyname_r exists
13722 set getservbyname_r d_getservbyname_r
13723 eval $inlibc
13724 case "$d_getservbyname_r" in
13725 "$define")
13726         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13727         case "$d_getservbyname_r_proto:$usethreads" in
13728         ":define")      d_getservbyname_r_proto=define
13729                 set d_getservbyname_r_proto getservbyname_r $hdrs
13730                 eval $hasproto ;;
13731         *)      ;;
13732         esac
13733         case "$d_getservbyname_r_proto" in
13734         define)
13735         case "$getservbyname_r_proto" in
13736         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13737         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13738         esac
13739         case "$getservbyname_r_proto" in
13740         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13741         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13742         esac
13743         case "$getservbyname_r_proto" in
13744         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13745         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13746         esac
13747         case "$getservbyname_r_proto" in
13748         ''|0)   d_getservbyname_r=undef
13749                 getservbyname_r_proto=0
13750                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13751         * )     case "$getservbyname_r_proto" in
13752                 REENTRANT_PROTO*) ;;
13753                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13754                 esac
13755                 echo "Prototype: $try" ;;
13756         esac
13757         ;;
13758         *)      case "$usethreads" in
13759                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13760                 esac
13761                 d_getservbyname_r=undef
13762                 getservbyname_r_proto=0
13763                 ;;
13764         esac
13765         ;;
13766 *)      getservbyname_r_proto=0
13767         ;;
13768 esac
13769
13770 : see if getservbyport_r exists
13771 set getservbyport_r d_getservbyport_r
13772 eval $inlibc
13773 case "$d_getservbyport_r" in
13774 "$define")
13775         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13776         case "$d_getservbyport_r_proto:$usethreads" in
13777         ":define")      d_getservbyport_r_proto=define
13778                 set d_getservbyport_r_proto getservbyport_r $hdrs
13779                 eval $hasproto ;;
13780         *)      ;;
13781         esac
13782         case "$d_getservbyport_r_proto" in
13783         define)
13784         case "$getservbyport_r_proto" in
13785         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13786         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13787         esac
13788         case "$getservbyport_r_proto" in
13789         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13790         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13791         esac
13792         case "$getservbyport_r_proto" in
13793         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13794         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13795         esac
13796         case "$getservbyport_r_proto" in
13797         ''|0)   d_getservbyport_r=undef
13798                 getservbyport_r_proto=0
13799                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13800         * )     case "$getservbyport_r_proto" in
13801                 REENTRANT_PROTO*) ;;
13802                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13803                 esac
13804                 echo "Prototype: $try" ;;
13805         esac
13806         ;;
13807         *)      case "$usethreads" in
13808                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13809                 esac
13810                 d_getservbyport_r=undef
13811                 getservbyport_r_proto=0
13812                 ;;
13813         esac
13814         ;;
13815 *)      getservbyport_r_proto=0
13816         ;;
13817 esac
13818
13819 : see if getservent_r exists
13820 set getservent_r d_getservent_r
13821 eval $inlibc
13822 case "$d_getservent_r" in
13823 "$define")
13824         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13825         case "$d_getservent_r_proto:$usethreads" in
13826         ":define")      d_getservent_r_proto=define
13827                 set d_getservent_r_proto getservent_r $hdrs
13828                 eval $hasproto ;;
13829         *)      ;;
13830         esac
13831         case "$d_getservent_r_proto" in
13832         define)
13833         case "$getservent_r_proto" in
13834         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13835         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13836         esac
13837         case "$getservent_r_proto" in
13838         ''|0) try='int getservent_r(struct servent*, char*, int);'
13839         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13840         esac
13841         case "$getservent_r_proto" in
13842         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13843         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13844         esac
13845         case "$getservent_r_proto" in
13846         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13847         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13848         esac
13849         case "$getservent_r_proto" in
13850         ''|0)   d_getservent_r=undef
13851                 getservent_r_proto=0
13852                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13853         * )     case "$getservent_r_proto" in
13854                 REENTRANT_PROTO*) ;;
13855                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13856                 esac
13857                 echo "Prototype: $try" ;;
13858         esac
13859         ;;
13860         *)      case "$usethreads" in
13861                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13862                 esac
13863                 d_getservent_r=undef
13864                 getservent_r_proto=0
13865                 ;;
13866         esac
13867         ;;
13868 *)      getservent_r_proto=0
13869         ;;
13870 esac
13871
13872 : see if prototypes for various getservxxx netdb.h functions are available
13873 echo " "
13874 set d_getservprotos getservent $i_netdb netdb.h
13875 eval $hasproto
13876
13877 : see if getspnam exists
13878 set getspnam d_getspnam
13879 eval $inlibc
13880
13881 : see if this is a shadow.h system
13882 set shadow.h i_shadow
13883 eval $inhdr
13884
13885 : see if getspnam_r exists
13886 set getspnam_r d_getspnam_r
13887 eval $inlibc
13888 case "$d_getspnam_r" in
13889 "$define")
13890         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13891         case "$d_getspnam_r_proto:$usethreads" in
13892         ":define")      d_getspnam_r_proto=define
13893                 set d_getspnam_r_proto getspnam_r $hdrs
13894                 eval $hasproto ;;
13895         *)      ;;
13896         esac
13897         case "$d_getspnam_r_proto" in
13898         define)
13899         case "$getspnam_r_proto" in
13900         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13901         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13902         esac
13903         case "$getspnam_r_proto" in
13904         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13905         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13906         esac
13907         case "$getspnam_r_proto" in
13908         ''|0)   d_getspnam_r=undef
13909                 getspnam_r_proto=0
13910                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13911         * )     case "$getspnam_r_proto" in
13912                 REENTRANT_PROTO*) ;;
13913                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13914                 esac
13915                 echo "Prototype: $try" ;;
13916         esac
13917         ;;
13918         *)      case "$usethreads" in
13919                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13920                 esac
13921                 d_getspnam_r=undef
13922                 getspnam_r_proto=0
13923                 ;;
13924         esac
13925         ;;
13926 *)      getspnam_r_proto=0
13927         ;;
13928 esac
13929
13930 : see if gettimeofday or ftime exists
13931 set gettimeofday d_gettimeod
13932 eval $inlibc
13933 case "$d_gettimeod" in
13934 "$undef")
13935         set ftime d_ftime 
13936         eval $inlibc
13937         ;;
13938 *)
13939         val="$undef"; set d_ftime; eval $setvar
13940         ;;
13941 esac
13942 case "$d_gettimeod$d_ftime" in
13943 "$undef$undef")
13944         echo " "
13945         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13946         ;;
13947 esac
13948
13949 : see if gmtime_r exists
13950 set gmtime_r d_gmtime_r
13951 eval $inlibc
13952 case "$d_gmtime_r" in
13953 "$define")
13954         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13955         case "$d_gmtime_r_proto:$usethreads" in
13956         ":define")      d_gmtime_r_proto=define
13957                 set d_gmtime_r_proto gmtime_r $hdrs
13958                 eval $hasproto ;;
13959         *)      ;;
13960         esac
13961         case "$d_gmtime_r_proto" in
13962         define)
13963         case "$gmtime_r_proto" in
13964         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13965         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13966         esac
13967         case "$gmtime_r_proto" in
13968         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13969         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13970         esac
13971         case "$gmtime_r_proto" in
13972         ''|0)   d_gmtime_r=undef
13973                 gmtime_r_proto=0
13974                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13975         * )     case "$gmtime_r_proto" in
13976                 REENTRANT_PROTO*) ;;
13977                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13978                 esac
13979                 echo "Prototype: $try" ;;
13980         esac
13981         ;;
13982         *)      case "$usethreads" in
13983                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13984                 esac
13985                 d_gmtime_r=undef
13986                 gmtime_r_proto=0
13987                 ;;
13988         esac
13989         ;;
13990 *)      gmtime_r_proto=0
13991         ;;
13992 esac
13993
13994 : see if hasmntopt exists
13995 set hasmntopt d_hasmntopt
13996 eval $inlibc
13997
13998 : see if this is a netinet/in.h or sys/in.h system
13999 set netinet/in.h i_niin sys/in.h i_sysin
14000 eval $inhdr
14001
14002 : see if arpa/inet.h has to be included
14003 set arpa/inet.h i_arpainet
14004 eval $inhdr
14005
14006 : see if htonl --and friends-- exists
14007 val=''
14008 set htonl val
14009 eval $inlibc
14010
14011 : Maybe they are macros.
14012 case "$val" in
14013 $undef)
14014         $cat >htonl.c <<EOM
14015 #include <stdio.h>
14016 #include <sys/types.h>
14017 #$i_niin I_NETINET_IN
14018 #$i_sysin I_SYS_IN
14019 #$i_arpainet I_ARPA_INET
14020 #ifdef I_NETINET_IN
14021 #include <netinet/in.h>
14022 #endif
14023 #ifdef I_SYS_IN
14024 #include <sys/in.h>
14025 #endif
14026 #ifdef I_ARPA_INET
14027 #include <arpa/inet.h>
14028 #endif
14029 #ifdef htonl
14030 printf("Defined as a macro.");
14031 #endif
14032 EOM
14033         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14034         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14035                 val="$define"
14036                 echo "But it seems to be defined as a macro." >&4
14037         fi
14038         $rm -f htonl.?
14039         ;;
14040 esac
14041 set d_htonl
14042 eval $setvar
14043
14044 : see if ilogbl exists
14045 set ilogbl d_ilogbl
14046 eval $inlibc
14047
14048 : index or strchr
14049 echo " "
14050 if set index val -f; eval $csym; $val; then
14051         if set strchr val -f d_strchr; eval $csym; $val; then
14052                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14053                         val="$define"
14054                         vali="$undef"
14055                         echo "strchr() found." >&4
14056                 else
14057                         val="$undef"
14058                         vali="$define"
14059                         echo "index() found." >&4
14060                 fi
14061         else
14062                 val="$undef"
14063                 vali="$define"
14064                 echo "index() found." >&4
14065         fi
14066 else
14067         if set strchr val -f d_strchr; eval $csym; $val; then
14068                 val="$define"
14069                 vali="$undef"
14070                 echo "strchr() found." >&4
14071         else
14072                 echo "No index() or strchr() found!" >&4
14073                 val="$undef"
14074                 vali="$undef"
14075         fi
14076 fi
14077 set d_strchr; eval $setvar
14078 val="$vali"
14079 set d_index; eval $setvar
14080
14081 : check whether inet_aton exists
14082 set inet_aton d_inetaton
14083 eval $inlibc
14084
14085 : Look for isascii
14086 echo " "
14087 $cat >isascii.c <<EOCP
14088 #include <stdio.h>
14089 #include <ctype.h>
14090 #$i_stdlib I_STDLIB
14091 #ifdef I_STDLIB
14092 #include <stdlib.h>
14093 #endif
14094 int main() {
14095         int c = 'A';
14096         if (isascii(c))
14097                 exit(0);
14098         else
14099                 exit(1);
14100 }
14101 EOCP
14102 set isascii
14103 if eval $compile; then
14104         echo "isascii() found." >&4
14105         val="$define"
14106 else
14107         echo "isascii() NOT found." >&4
14108         val="$undef"
14109 fi
14110 set d_isascii
14111 eval $setvar
14112 $rm -f isascii*
14113
14114 : see if isfinite exists
14115 set isfinite d_isfinite
14116 eval $inlibc
14117
14118 : see if isinf exists
14119 set isinf d_isinf
14120 eval $inlibc
14121
14122 : see if isnan exists
14123 set isnan d_isnan
14124 eval $inlibc
14125
14126 : see if isnanl exists
14127 set isnanl d_isnanl
14128 eval $inlibc
14129
14130 : see if killpg exists
14131 set killpg d_killpg
14132 eval $inlibc
14133
14134 : see if lchown exists
14135 echo " "
14136 $cat > try.c <<'EOCP'
14137 /* System header to define __stub macros and hopefully few prototypes,
14138     which can conflict with char lchown(); below.  */
14139 #include <assert.h>
14140 /* Override any gcc2 internal prototype to avoid an error.  */
14141 /* We use char because int might match the return type of a gcc2
14142    builtin and then its argument prototype would still apply.  */
14143 char lchown();
14144 int main() {
14145     /*  The GNU C library defines this for functions which it implements
14146         to always fail with ENOSYS.  Some functions are actually named
14147         something starting with __ and the normal name is an alias.  */
14148 #if defined (__stub_lchown) || defined (__stub___lchown)
14149 choke me
14150 #else
14151 lchown();
14152 #endif
14153 ; return 0; }
14154 EOCP
14155 set try
14156 if eval $compile; then
14157     $echo "lchown() found." >&4
14158     val="$define"
14159 else
14160     $echo "lchown() NOT found." >&4
14161     val="$undef"
14162 fi
14163 set d_lchown
14164 eval $setvar
14165
14166 : See if number of significant digits in a double precision number is known
14167 echo " "
14168 $cat >ldbl_dig.c <<EOM
14169 #$i_limits I_LIMITS
14170 #$i_float I_FLOAT
14171 #ifdef I_LIMITS
14172 #include <limits.h>
14173 #endif
14174 #ifdef I_FLOAT
14175 #include <float.h>
14176 #endif
14177 #ifdef LDBL_DIG
14178 printf("Contains LDBL_DIG");
14179 #endif
14180 EOM
14181 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14182 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14183         echo "LDBL_DIG found." >&4
14184         val="$define"
14185 else
14186         echo "LDBL_DIG NOT found." >&4
14187         val="$undef"
14188 fi
14189 $rm -f ldbl_dig.?
14190 set d_ldbl_dig
14191 eval $setvar
14192
14193 : see if this is a math.h system
14194 set math.h i_math
14195 eval $inhdr
14196
14197 d_libm_lib_version="$undef"
14198 case $i_math in
14199     $define)
14200         : check to see if math.h defines _LIB_VERSION
14201         echo " "
14202         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14203         $cat >try.c <<EOCP
14204 #include <unistd.h>
14205 #include <math.h>
14206 int main (int argc, char *argv[])
14207 {
14208     printf ("%d\n", _LIB_VERSION);
14209     return (0);
14210     } /* main */
14211 EOCP
14212         set try
14213         if eval $compile; then
14214             foo=`$run ./try`
14215             echo "Yes, it does ($foo)" >&4
14216             d_libm_lib_version="$define"
14217         else
14218             echo "No, it does not (probably harmless)\n" >&4
14219             fi
14220         $rm -f try.* try core core.try.*
14221         ;;
14222
14223     esac
14224
14225 : see if link exists
14226 set link d_link
14227 eval $inlibc
14228
14229 : see if localtime_r exists
14230 set localtime_r d_localtime_r
14231 eval $inlibc
14232 case "$d_localtime_r" in
14233 "$define")
14234         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14235         case "$d_localtime_r_proto:$usethreads" in
14236         ":define")      d_localtime_r_proto=define
14237                 set d_localtime_r_proto localtime_r $hdrs
14238                 eval $hasproto ;;
14239         *)      ;;
14240         esac
14241         case "$d_localtime_r_proto" in
14242         define)
14243         case "$localtime_r_proto" in
14244         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14245         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14246         esac
14247         case "$localtime_r_proto" in
14248         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14249         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14250         esac
14251         case "$localtime_r_proto" in
14252         ''|0)   d_localtime_r=undef
14253                 localtime_r_proto=0
14254                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14255         * )     case "$localtime_r_proto" in
14256                 REENTRANT_PROTO*) ;;
14257                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14258                 esac
14259                 echo "Prototype: $try" ;;
14260         esac
14261         ;;
14262         *)      case "$usethreads" in
14263                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14264                 esac
14265                 d_localtime_r=undef
14266                 localtime_r_proto=0
14267                 ;;
14268         esac
14269         ;;
14270 *)      localtime_r_proto=0
14271         ;;
14272 esac
14273
14274 : see if localeconv exists
14275 set localeconv d_locconv
14276 eval $inlibc
14277
14278 : see if lockf exists
14279 set lockf d_lockf
14280 eval $inlibc
14281
14282 : see if prototype for lseek is available
14283 echo " "
14284 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14285 eval $hasproto
14286
14287 : see if lstat exists
14288 set lstat d_lstat
14289 eval $inlibc
14290
14291 : see if madvise exists
14292 set madvise d_madvise
14293 eval $inlibc
14294
14295 : see if malloc_size exists
14296 set malloc_size d_malloc_size
14297 eval $inlibc
14298
14299 : see if malloc_size_good exists
14300 set malloc_good_size d_malloc_good_size
14301 eval $inlibc
14302
14303 : see if mblen exists
14304 set mblen d_mblen
14305 eval $inlibc
14306
14307 : see if mbstowcs exists
14308 set mbstowcs d_mbstowcs
14309 eval $inlibc
14310
14311 : see if mbtowc exists
14312 set mbtowc d_mbtowc
14313 eval $inlibc
14314
14315 : see if memchr exists
14316 set memchr d_memchr
14317 eval $inlibc
14318
14319 : see if memcmp exists
14320 set memcmp d_memcmp
14321 eval $inlibc
14322
14323 : see if memcpy exists
14324 set memcpy d_memcpy
14325 eval $inlibc
14326
14327 : see if memmove exists
14328 set memmove d_memmove
14329 eval $inlibc
14330
14331 : see if memset exists
14332 set memset d_memset
14333 eval $inlibc
14334
14335 : see if mkdir exists
14336 set mkdir d_mkdir
14337 eval $inlibc
14338
14339 : see if mkdtemp exists
14340 set mkdtemp d_mkdtemp
14341 eval $inlibc
14342
14343 : see if mkfifo exists
14344 set mkfifo d_mkfifo
14345 eval $inlibc
14346
14347 : see if mkstemp exists
14348 set mkstemp d_mkstemp
14349 eval $inlibc
14350
14351 : see if mkstemps exists
14352 set mkstemps d_mkstemps
14353 eval $inlibc
14354
14355 : see if mktime exists
14356 set mktime d_mktime
14357 eval $inlibc
14358
14359 : see if this is a sys/mman.h system
14360 set sys/mman.h i_sysmman
14361 eval $inhdr
14362
14363 : see if mmap exists
14364 set mmap d_mmap
14365 eval $inlibc
14366 : see what shmat returns
14367 : default to something harmless
14368 mmaptype='void *'
14369 case "$i_sysmman$d_mmap" in
14370 "$define$define")
14371         $cat >mmap.c <<'END'
14372 #include <sys/mman.h>
14373 void *mmap();
14374 END
14375         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14376                 mmaptype='void *'
14377         else
14378                 mmaptype='caddr_t'
14379         fi
14380         echo "and it returns ($mmaptype)." >&4
14381         ;;
14382 esac
14383
14384
14385
14386 : see if sqrtl exists
14387 set sqrtl d_sqrtl
14388 eval $inlibc
14389
14390 : see if scalbnl exists
14391 set scalbnl d_scalbnl
14392 eval $inlibc
14393
14394 : see if modfl exists
14395 set modfl d_modfl
14396 eval $inlibc
14397
14398 : see if prototype for modfl is available
14399 echo " "
14400 set d_modflproto modfl $i_math math.h
14401 eval $hasproto
14402
14403 d_modfl_pow32_bug="$undef"
14404
14405 case "$d_longdbl$d_modfl" in
14406 $define$define)
14407         $cat <<EOM
14408 Checking to see whether your modfl() is okay for large values...
14409 EOM
14410 $cat >try.c <<EOCP
14411 #include <math.h> 
14412 #include <stdio.h>
14413 EOCP
14414 if $test "X$d_modflproto" != "X$define"; then
14415         $cat >>try.c <<EOCP
14416 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14417 long double modfl (long double, long double *);
14418 EOCP
14419 fi
14420 $cat >>try.c <<EOCP
14421 int main() {
14422     long double nv = 4294967303.15;
14423     long double v, w;
14424     v = modfl(nv, &w);         
14425 #ifdef __GLIBC__
14426     printf("glibc");
14427 #endif
14428     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14429     return 0;
14430 }
14431 EOCP
14432         case "$osname:$gccversion" in
14433         aix:)   saveccflags="$ccflags"
14434                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14435         esac
14436         set try
14437         if eval $compile; then
14438                 foo=`$run ./try`
14439                 case "$foo" in
14440                 *" 4294967303.150000 1.150000 4294967302.000000")
14441                         echo >&4 "Your modfl() is broken for large values."
14442                         d_modfl_pow32_bug="$define"
14443                         case "$foo" in
14444                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14445                         ;;
14446                         esac
14447                         ;;
14448                 *" 4294967303.150000 0.150000 4294967303.000000")
14449                         echo >&4 "Your modfl() seems okay for large values."
14450                         ;;
14451                 *)      echo >&4 "I don't understand your modfl() at all."
14452                         d_modfl="$undef"
14453                         ;;
14454                 esac
14455                 $rm -f try.* try core core.try.*
14456         else
14457                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14458                 d_modfl="$undef"
14459         fi
14460         case "$osname:$gccversion" in
14461         aix:)   ccflags="$saveccflags" ;; # restore
14462         esac
14463         ;;
14464 esac
14465
14466 if $test "$uselongdouble" = "$define"; then
14467     message=""
14468     if $test "$d_sqrtl" != "$define"; then
14469         message="$message sqrtl"
14470     fi
14471     if $test "$d_modfl" != "$define"; then
14472         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14473             echo "You have both aintl and copysignl, so I can emulate modfl."
14474         else
14475             message="$message modfl"
14476         fi
14477     fi
14478     if $test "$d_frexpl" != "$define"; then
14479         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14480             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14481         else
14482             message="$message frexpl"
14483         fi
14484     fi
14485
14486     if $test "$message" != ""; then
14487         $cat <<EOM >&4
14488
14489 *** You requested the use of long doubles but you do not seem to have
14490 *** the following mathematical functions needed for long double support:
14491 ***    $message
14492 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14493 *** Cannot continue, aborting.
14494
14495 EOM
14496
14497         exit 1
14498     fi
14499 fi
14500
14501 : see if mprotect exists
14502 set mprotect d_mprotect
14503 eval $inlibc
14504
14505 : see if msgctl exists
14506 set msgctl d_msgctl
14507 eval $inlibc
14508
14509 : see if msgget exists
14510 set msgget d_msgget
14511 eval $inlibc
14512
14513 : see if msgsnd exists
14514 set msgsnd d_msgsnd
14515 eval $inlibc
14516
14517 : see if msgrcv exists
14518 set msgrcv d_msgrcv
14519 eval $inlibc
14520
14521 : see how much of the 'msg*(2)' library is present.
14522 h_msg=true
14523 echo " "
14524 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14525 *"$undef"*) h_msg=false;;
14526 esac
14527 case "$osname" in
14528 freebsd)
14529     case "`ipcs 2>&1`" in
14530     "SVID messages"*"not configured"*)
14531         echo "Your $osname does not have the msg*(2) configured." >&4
14532         h_msg=false
14533         val="$undef"
14534         set msgctl d_msgctl
14535         eval $setvar
14536         set msgget d_msgget
14537         eval $setvar
14538         set msgsnd d_msgsnd
14539         eval $setvar
14540         set msgrcv d_msgrcv
14541         eval $setvar
14542         ;;
14543     esac
14544     ;;
14545 esac
14546 : we could also check for sys/ipc.h ...
14547 if $h_msg && $test `./findhdr sys/msg.h`; then
14548         echo "You have the full msg*(2) library." >&4
14549         val="$define"
14550 else
14551         echo "You don't have the full msg*(2) library." >&4
14552         val="$undef"
14553 fi
14554 set d_msg
14555 eval $setvar
14556
14557
14558 echo " "
14559 echo "Checking to see if your system supports struct msghdr..." >&4
14560 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14561 eval $hasstruct
14562 case "$d_msghdr_s" in
14563 "$define")      echo "Yes, it does."   ;;
14564 *)              echo "No, it doesn't." ;;
14565 esac
14566
14567
14568 : see if msync exists
14569 set msync d_msync
14570 eval $inlibc
14571
14572 : see if munmap exists
14573 set munmap d_munmap
14574 eval $inlibc
14575
14576 : see if nice exists
14577 set nice d_nice
14578 eval $inlibc
14579
14580 : see if this is a langinfo.h system
14581 set langinfo.h i_langinfo
14582 eval $inhdr
14583
14584 : see if nl_langinfo exists
14585 set nl_langinfo d_nl_langinfo
14586 eval $inlibc
14587
14588 : check for length of character
14589 echo " "
14590 case "$charsize" in
14591 '')
14592         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14593         $cat >try.c <<EOCP
14594 #include <stdio.h>
14595 #$i_stdlib I_STDLIB
14596 #ifdef I_STDLIB
14597 #include <stdlib.h>
14598 #endif
14599 int main()
14600 {
14601     printf("%d\n", (int)sizeof(char));
14602     exit(0);
14603 }
14604 EOCP
14605         set try
14606         if eval $compile_ok; then
14607                 dflt=`$run ./try`
14608         else
14609                 dflt='1'
14610                 echo "(I can't seem to compile the test program.  Guessing...)"
14611         fi
14612         ;;
14613 *)
14614         dflt="$charsize"
14615         ;;
14616 esac
14617 rp="What is the size of a character (in bytes)?"
14618 . ./myread
14619 charsize="$ans"
14620 $rm -f try.c try
14621
14622 : check for volatile keyword
14623 echo " "
14624 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14625 $cat >try.c <<'EOCP'
14626 int main()
14627 {
14628         typedef struct _goo_struct goo_struct;
14629         goo_struct * volatile goo = ((goo_struct *)0);
14630         struct _goo_struct {
14631                 long long_int;
14632                 int reg_int;
14633                 char char_var;
14634         };
14635         typedef unsigned short foo_t;
14636         char *volatile foo;
14637         volatile int bar;
14638         volatile foo_t blech;
14639         foo = foo;
14640 }
14641 EOCP
14642 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14643         val="$define"
14644         echo "Yup, it does."
14645 else
14646         val="$undef"
14647         echo "Nope, it doesn't."
14648 fi
14649 set d_volatile
14650 eval $setvar
14651 $rm -f try.*
14652
14653
14654 echo " "
14655 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14656
14657 case "$use64bitint:$d_quad:$quadtype" in
14658 define:define:?*)
14659         ivtype="$quadtype"
14660         uvtype="$uquadtype"
14661         ivsize=8
14662         uvsize=8
14663         ;;
14664 *)      ivtype="long"
14665         uvtype="unsigned long"
14666         ivsize=$longsize
14667         uvsize=$longsize
14668         ;;
14669 esac
14670
14671 case "$uselongdouble:$d_longdbl" in
14672 define:define)
14673         nvtype="long double"
14674         nvsize=$longdblsize
14675         ;;
14676 *)      nvtype=double
14677         nvsize=$doublesize
14678         ;;
14679 esac
14680
14681 $echo "(IV will be "$ivtype", $ivsize bytes)"
14682 $echo "(UV will be "$uvtype", $uvsize bytes)"
14683 $echo "(NV will be "$nvtype", $nvsize bytes)"
14684
14685 $cat >try.c <<EOCP
14686 #$i_inttypes I_INTTYPES
14687 #ifdef I_INTTYPES
14688 #include <inttypes.h>
14689 #endif
14690 #include <stdio.h>
14691 int main() {
14692 #ifdef INT8
14693    int8_t i =  INT8_MAX;
14694   uint8_t u = UINT8_MAX;
14695   printf("int8_t\n");
14696 #endif
14697 #ifdef INT16
14698    int16_t i =  INT16_MAX;
14699   uint16_t i = UINT16_MAX;
14700   printf("int16_t\n");
14701 #endif
14702 #ifdef INT32
14703    int32_t i =  INT32_MAX;
14704   uint32_t u = UINT32_MAX;
14705   printf("int32_t\n");
14706 #endif
14707 }
14708 EOCP
14709
14710 case "$i8type" in
14711 '')     case "$charsize" in
14712         1)      i8type=char
14713                 u8type="unsigned char"
14714                 i8size=$charsize
14715                 u8size=$charsize
14716                 ;;
14717         esac
14718         ;;
14719 esac
14720 case "$i8type" in
14721 '')     set try -DINT8
14722         if eval $compile; then
14723                 case "`$run ./try`" in
14724                 int8_t) i8type=int8_t
14725                         u8type=uint8_t
14726                         i8size=1
14727                         u8size=1
14728                         ;;
14729                 esac
14730         fi
14731         ;;
14732 esac
14733 case "$i8type" in
14734 '')     if $test $charsize -ge 1; then
14735                 i8type=char
14736                 u8type="unsigned char"
14737                 i8size=$charsize
14738                 u8size=$charsize
14739         fi
14740         ;;
14741 esac
14742
14743 case "$i16type" in
14744 '')     case "$shortsize" in
14745         2)      i16type=short
14746                 u16type="unsigned short"
14747                 i16size=$shortsize
14748                 u16size=$shortsize
14749                 ;;
14750         esac
14751         ;;
14752 esac
14753 case "$i16type" in
14754 '')     set try -DINT16
14755         if eval $compile; then
14756                 case "`$run ./try`" in
14757                 int16_t)
14758                         i16type=int16_t
14759                         u16type=uint16_t
14760                         i16size=2
14761                         u16size=2
14762                         ;;
14763                 esac
14764         fi
14765         ;;
14766 esac
14767 case "$i16type" in
14768 '')     if $test $shortsize -ge 2; then
14769                 i16type=short
14770                 u16type="unsigned short"
14771                 i16size=$shortsize
14772                 u16size=$shortsize
14773         fi
14774         ;;
14775 esac
14776
14777 case "$i32type" in
14778 '')     case "$longsize" in
14779         4)      i32type=long
14780                 u32type="unsigned long"
14781                 i32size=$longsize
14782                 u32size=$longsize
14783                 ;;
14784         *)      case "$intsize" in
14785                 4)      i32type=int
14786                         u32type="unsigned int"
14787                         i32size=$intsize
14788                         u32size=$intsize
14789                         ;;
14790                 esac
14791                 ;;
14792         esac
14793         ;;
14794 esac
14795 case "$i32type" in
14796 '')     set try -DINT32
14797         if eval $compile; then
14798                 case "`$run ./try`" in
14799                 int32_t)
14800                         i32type=int32_t
14801                         u32type=uint32_t
14802                         i32size=4
14803                         u32size=4
14804                         ;;
14805                 esac
14806         fi
14807         ;;
14808 esac
14809 case "$i32type" in
14810 '')     if $test $intsize -ge 4; then
14811                 i32type=int
14812                 u32type="unsigned int"
14813                 i32size=$intsize
14814                 u32size=$intsize
14815         fi
14816         ;;
14817 esac
14818
14819 case "$i64type" in
14820 '')     case "$d_quad:$quadtype" in
14821         define:?*)
14822                 i64type="$quadtype"
14823                 u64type="$uquadtype"
14824                 i64size=8
14825                 u64size=8
14826                 ;;
14827         esac
14828         ;;
14829 esac
14830
14831 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14832 : volatile so that the compiler has to store it out to memory.
14833 if test X"$d_volatile" = X"$define"; then
14834         volatile=volatile
14835 fi
14836 $cat <<EOP >try.c
14837 #include <stdio.h>
14838 #$i_stdlib I_STDLIB
14839 #ifdef I_STDLIB
14840 #include <stdlib.h>
14841 #endif
14842 #include <sys/types.h>
14843 #include <signal.h>
14844 #ifdef SIGFPE
14845 $volatile int bletched = 0;
14846 $signal_t blech(s) int s; { bletched = 1; }
14847 #endif
14848 int main() {
14849     $uvtype u = 0;
14850     $nvtype d;
14851     int     n = 8 * $uvsize;
14852     int     i;
14853 #ifdef SIGFPE
14854     signal(SIGFPE, blech);
14855 #endif
14856
14857     for (i = 0; i < n; i++) {
14858       u = u << 1 | ($uvtype)1;
14859       d = ($nvtype)u;
14860       if (($uvtype)d != u)
14861         break;
14862       if (d <= 0)
14863         break;
14864       d = ($nvtype)(u - 1);
14865       if (($uvtype)d != (u - 1))
14866         break;
14867 #ifdef SIGFPE
14868       if (bletched) {
14869         break;
14870 #endif
14871       } 
14872     }
14873     printf("%d\n", ((i == n) ? -n : i));
14874     exit(0);
14875 }
14876 EOP
14877 set try
14878
14879 d_nv_preserves_uv="$undef"
14880 if eval $compile; then
14881         nv_preserves_uv_bits="`$run ./try`"
14882 fi
14883 case "$nv_preserves_uv_bits" in
14884 \-[1-9]*)       
14885         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14886         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14887         d_nv_preserves_uv="$define"
14888         ;;
14889 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14890         d_nv_preserves_uv="$undef" ;;
14891 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14892         nv_preserves_uv_bits="$undef" ;;
14893 esac
14894
14895 $rm -f try.* try
14896
14897 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14898 : volatile so that the compiler has to store it out to memory.
14899 if test X"$d_volatile" = X"$define"; then
14900         volatile=volatile
14901 fi
14902 $cat <<EOP >try.c
14903 #include <stdio.h>
14904 #$i_stdlib I_STDLIB
14905 #ifdef I_STDLIB
14906 #include <stdlib.h>
14907 #endif
14908 #$i_string I_STRING
14909 #ifdef I_STRING
14910 #  include <string.h>
14911 #else
14912 #  include <strings.h>
14913 #endif
14914 #include <sys/types.h>
14915 #include <signal.h>
14916 #ifdef SIGFPE
14917 $volatile int bletched = 0;
14918 $signal_t blech(s) int s; { bletched = 1; }
14919 #endif
14920
14921 int checkit($nvtype d, char *where) {
14922     unsigned char *p = (char *)&d;
14923     unsigned char *end = p + sizeof(d);
14924     int fail = 0;
14925
14926     while (p < end)
14927         fail += *p++;
14928
14929     if (!fail)
14930         return 0;
14931
14932     p = (char *)&d;
14933     printf("No - %s: 0x", where);
14934     while (p < end)
14935         printf ("%02X", *p++);
14936     printf("\n");
14937     return 1;
14938 }
14939
14940 int main(int argc, char **argv) {
14941     $nvtype d = 0.0;
14942     int fail = 0;
14943     fail += checkit(d, "0.0");
14944
14945     /* The compiler shouldn't be assuming that bletched is 0  */
14946     d = bletched;
14947
14948     fail += checkit(d, "bleched");
14949
14950 #ifdef SIGFPE
14951     signal(SIGFPE, blech);
14952 #endif
14953
14954     /* Paranoia - the compiler should have no way of knowing that ANSI says
14955        that argv[argc] will always be NULL.  Actually, if it did assume this it
14956        would be buggy, as this is C and main() can be called from elsewhere in
14957        the program.  */
14958     d = argv[argc] ? 1 : 0;
14959
14960     if (d) {
14961         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14962     }
14963
14964     fail += checkit(d, "ternary");
14965
14966     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14967
14968     if (d != 0.0) {
14969         printf("No - memset doesn't give 0.0\n");
14970         /* This might just blow up:  */
14971         printf("(gives %g)\n", d);
14972         return 1;
14973     }
14974     
14975 #ifdef SIGFPE
14976     if (bletched) {
14977         printf("No - something bleched\n");
14978         return 1;
14979     }
14980 #endif
14981     if (fail) {
14982       printf("No - %d fail(s)\n", fail);
14983       return 1;
14984     }
14985     printf("Yes\n");
14986     return 0;
14987 }
14988 EOP
14989 set try
14990
14991 d_nv_zero_is_allbits_zero="$undef"
14992 if eval $compile; then
14993     xxx="`$run ./try`"
14994     case "$?" in
14995         0)
14996             case "$xxx" in
14997                 Yes)  cat >&4 <<EOM
14998 0.0 is represented as all bits zero in memory
14999 EOM
15000                     d_nv_zero_is_allbits_zero="$define"
15001                     ;;
15002                 *)  cat >&4 <<EOM
15003 0.0 is not represented as all bits zero in memory
15004 EOM
15005                     d_nv_zero_is_allbits_zero="$undef"
15006                     ;;
15007             esac
15008             ;;
15009         *)  cat >&4 <<EOM
15010 0.0 is not represented as all bits zero in memory
15011 EOM
15012             d_nv_zero_is_allbits_zero="$undef"
15013             ;;
15014     esac
15015 fi
15016
15017 $rm -f try.* try
15018
15019
15020 : check for off64_t
15021 echo " "
15022 echo "Checking to see if you have off64_t..." >&4
15023 $cat >try.c <<EOCP
15024 #include <sys/types.h>
15025 #include <unistd.h>
15026 int main() { off64_t x = 7; }
15027 EOCP
15028 set try
15029 if eval $compile; then
15030         val="$define"
15031         echo "You have off64_t."
15032 else
15033         val="$undef"
15034         echo "You do not have off64_t."
15035         case "$lseeksize" in
15036         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15037         esac
15038 fi
15039 $rm -f try.* try
15040 set d_off64_t
15041 eval $setvar
15042
15043 : how to create joinable pthreads
15044 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15045         echo " "
15046         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15047         $cat >try.c <<'EOCP'
15048 #include <pthread.h>
15049 int main() {
15050     int detachstate = JOINABLE;
15051 }
15052 EOCP
15053         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15054         if eval $compile; then
15055                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15056                 val="$undef" # Yes, undef.
15057                 set d_old_pthread_create_joinable
15058                 eval $setvar
15059                 val=""
15060                 set old_pthread_create_joinable
15061                 eval $setvar
15062         else
15063                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15064                 if eval $compile; then
15065                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15066                         val="$define"
15067                         set d_old_pthread_create_joinable
15068                         eval $setvar
15069                         val=PTHREAD_CREATE_UNDETACHED
15070                         set old_pthread_create_joinable
15071                         eval $setvar
15072                 else            
15073                         set try -DJOINABLE=__UNDETACHED
15074                         if eval $compile; then
15075                                 echo "You seem to use __UNDETACHED." >&4
15076                                 val="$define"
15077                                 set d_old_pthread_create_joinable
15078                                 eval $setvar
15079                                 val=__UNDETACHED
15080                                 set old_pthread_create_joinable
15081                                 eval $setvar
15082                         else
15083                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15084                                 val="$define"
15085                                 set d_old_pthread_create_joinable
15086                                 eval $setvar
15087                                 val=0
15088                                 set old_pthread_create_joinable
15089                                 eval $setvar
15090                         fi
15091                 fi
15092         fi
15093         $rm -f try try.*
15094 else
15095     d_old_pthread_create_joinable="$undef"
15096     old_pthread_create_joinable=""
15097 fi
15098
15099 : see if pause exists
15100 set pause d_pause
15101 eval $inlibc
15102
15103 : see if pipe exists
15104 set pipe d_pipe
15105 eval $inlibc
15106
15107 : see if poll exists
15108 set poll d_poll
15109 eval $inlibc
15110
15111 : see if readlink exists
15112 set readlink d_readlink
15113 eval $inlibc
15114
15115 echo " "
15116 procselfexe=''
15117 val="$undef"
15118 case "$d_readlink" in
15119 "$define")
15120         if $issymlink /proc/self/exe ; then
15121                 $ls -l /proc/self/exe > reflect
15122                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15123                         echo "You have Linux-like /proc/self/exe."
15124                         procselfexe='"/proc/self/exe"'
15125                         val="$define"
15126                 fi
15127         fi
15128         if $issymlink /proc/curproc/file ; then
15129                 $ls -l /proc/curproc/file > reflect
15130                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15131                         echo "You have BSD-like /proc/curproc/file."
15132                         procselfexe='"/proc/curproc/file"'
15133                         val="$define"
15134                 fi
15135         fi
15136         ;;
15137 esac
15138 $rm -f reflect
15139 set d_procselfexe
15140 eval $setvar
15141
15142 : see whether the pthread_atfork exists
15143 $cat >try.c <<EOP
15144 #include <pthread.h>
15145 #include <stdio.h>
15146 int main() {
15147 #ifdef  PTHREAD_ATFORK
15148         pthread_atfork(NULL,NULL,NULL);
15149 #endif
15150 }
15151 EOP
15152
15153 : see if pthread_atfork exists
15154 set try -DPTHREAD_ATFORK
15155 if eval $compile; then
15156     val="$define"
15157 else
15158     val="$undef"
15159 fi
15160 case "$usethreads" in
15161 $define)
15162         case "$val" in
15163         $define) echo 'pthread_atfork found.' >&4        ;;
15164         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15165         esac
15166 esac
15167 set d_pthread_atfork
15168 eval $setvar
15169
15170 : see if pthread_attr_setscope exists
15171 set pthread_attr_setscope d_pthread_attr_setscope
15172 eval $inlibc
15173
15174
15175 : see whether the various POSIXish _yields exist
15176 $cat >try.c <<EOP
15177 #include <pthread.h>
15178 #include <stdio.h>
15179 int main() {
15180 #ifdef SCHED_YIELD
15181         sched_yield();
15182 #else
15183 #ifdef PTHREAD_YIELD
15184         pthread_yield();
15185 #else
15186 #ifdef PTHREAD_YIELD_NULL
15187         pthread_yield(NULL);
15188 #endif
15189 #endif
15190 #endif
15191 }
15192 EOP
15193 : see if sched_yield exists
15194 set try -DSCHED_YIELD
15195 if eval $compile; then
15196     val="$define"
15197     sched_yield='sched_yield()'
15198 else
15199     val="$undef"
15200 fi
15201 case "$usethreads" in
15202 $define)
15203         case "$val" in
15204         $define) echo 'sched_yield() found.' >&4        ;;
15205         *)       echo 'sched_yield() NOT found.' >&4    ;;
15206         esac
15207 esac
15208 set d_sched_yield
15209 eval $setvar
15210
15211 : see if pthread_yield exists
15212 set try -DPTHREAD_YIELD
15213 if eval $compile; then
15214     val="$define"
15215     case "$sched_yield" in
15216     '') sched_yield='pthread_yield()' ;;
15217     esac
15218 else
15219     set try -DPTHREAD_YIELD_NULL
15220     if eval $compile; then
15221         val="$define"
15222         case "$sched_yield" in
15223         '') sched_yield='pthread_yield(NULL)' ;;
15224         esac
15225     else
15226         val="$undef"
15227     fi
15228 fi
15229 case "$usethreads" in
15230 $define)
15231         case "$val" in
15232         $define) echo 'pthread_yield() found.' >&4      ;;
15233         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15234         esac
15235         ;;
15236 esac
15237 set d_pthread_yield
15238 eval $setvar
15239
15240 case "$sched_yield" in
15241 '') sched_yield=undef ;;
15242 esac
15243
15244 $rm -f try try.*
15245
15246 : see if random_r exists
15247 set random_r d_random_r
15248 eval $inlibc
15249 case "$d_random_r" in
15250 "$define")
15251         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15252         case "$d_random_r_proto:$usethreads" in
15253         ":define")      d_random_r_proto=define
15254                 set d_random_r_proto random_r $hdrs
15255                 eval $hasproto ;;
15256         *)      ;;
15257         esac
15258         case "$d_random_r_proto" in
15259         define)
15260         case "$random_r_proto" in
15261         ''|0) try='int random_r(int*, struct random_data*);'
15262         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15263         esac
15264         case "$random_r_proto" in
15265         ''|0) try='int random_r(long*, struct random_data*);'
15266         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15267         esac
15268         case "$random_r_proto" in
15269         ''|0) try='int random_r(struct random_data*, int32_t*);'
15270         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15271         esac
15272         case "$random_r_proto" in
15273         ''|0)   d_random_r=undef
15274                 random_r_proto=0
15275                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15276         * )     case "$random_r_proto" in
15277                 REENTRANT_PROTO*) ;;
15278                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15279                 esac
15280                 echo "Prototype: $try" ;;
15281         esac
15282         ;;
15283         *)      case "$usethreads" in
15284                 define) echo "random_r has no prototype, not using it." >&4 ;;
15285                 esac
15286                 d_random_r=undef
15287                 random_r_proto=0
15288                 ;;
15289         esac
15290         ;;
15291 *)      random_r_proto=0
15292         ;;
15293 esac
15294
15295 : see if readdir and friends exist
15296 set readdir d_readdir
15297 eval $inlibc
15298 set seekdir d_seekdir
15299 eval $inlibc
15300 set telldir d_telldir
15301 eval $inlibc
15302 set rewinddir d_rewinddir
15303 eval $inlibc
15304
15305 : see if readdir64_r exists
15306 set readdir64_r d_readdir64_r
15307 eval $inlibc
15308 case "$d_readdir64_r" in
15309 "$define")
15310         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15311         case "$d_readdir64_r_proto:$usethreads" in
15312         ":define")      d_readdir64_r_proto=define
15313                 set d_readdir64_r_proto readdir64_r $hdrs
15314                 eval $hasproto ;;
15315         *)      ;;
15316         esac
15317         case "$d_readdir64_r_proto" in
15318         define)
15319         case "$readdir64_r_proto" in
15320         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15321         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15322         esac
15323         case "$readdir64_r_proto" in
15324         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15325         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15326         esac
15327         case "$readdir64_r_proto" in
15328         ''|0)   d_readdir64_r=undef
15329                 readdir64_r_proto=0
15330                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15331         * )     case "$readdir64_r_proto" in
15332                 REENTRANT_PROTO*) ;;
15333                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15334                 esac
15335                 echo "Prototype: $try" ;;
15336         esac
15337         ;;
15338         *)      case "$usethreads" in
15339                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15340                 esac
15341                 d_readdir64_r=undef
15342                 readdir64_r_proto=0
15343                 ;;
15344         esac
15345         ;;
15346 *)      readdir64_r_proto=0
15347         ;;
15348 esac
15349
15350 : see if readdir_r exists
15351 set readdir_r d_readdir_r
15352 eval $inlibc
15353 case "$d_readdir_r" in
15354 "$define")
15355         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15356         case "$d_readdir_r_proto:$usethreads" in
15357         ":define")      d_readdir_r_proto=define
15358                 set d_readdir_r_proto readdir_r $hdrs
15359                 eval $hasproto ;;
15360         *)      ;;
15361         esac
15362         case "$d_readdir_r_proto" in
15363         define)
15364         case "$readdir_r_proto" in
15365         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15366         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15367         esac
15368         case "$readdir_r_proto" in
15369         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15370         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15371         esac
15372         case "$readdir_r_proto" in
15373         ''|0)   d_readdir_r=undef
15374                 readdir_r_proto=0
15375                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15376         * )     case "$readdir_r_proto" in
15377                 REENTRANT_PROTO*) ;;
15378                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15379                 esac
15380                 echo "Prototype: $try" ;;
15381         esac
15382         ;;
15383         *)      case "$usethreads" in
15384                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15385                 esac
15386                 d_readdir_r=undef
15387                 readdir_r_proto=0
15388                 ;;
15389         esac
15390         ;;
15391 *)      readdir_r_proto=0
15392         ;;
15393 esac
15394
15395 : see if readv exists
15396 set readv d_readv
15397 eval $inlibc
15398
15399 : see if recvmsg exists
15400 set recvmsg d_recvmsg
15401 eval $inlibc
15402
15403 : see if rename exists
15404 set rename d_rename
15405 eval $inlibc
15406
15407 : see if rmdir exists
15408 set rmdir d_rmdir
15409 eval $inlibc
15410
15411 : see if memory.h is available.
15412 val=''
15413 set memory.h val
15414 eval $inhdr
15415
15416 : See if it conflicts with string.h
15417 case "$val" in
15418 $define)
15419         case "$strings" in
15420         '') ;;
15421         *)
15422                 $cppstdin $cppflags $cppminus < $strings > mem.h
15423                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15424                         echo " "
15425                         echo "We won't be including <memory.h>."
15426                         val="$undef"
15427                 fi
15428                 $rm -f mem.h
15429                 ;;
15430         esac
15431 esac
15432 set i_memory
15433 eval $setvar
15434
15435 : can bcopy handle overlapping blocks?
15436 echo " "
15437 val="$undef"
15438 case "$d_memmove" in
15439 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15440 *)      case "$d_bcopy" in
15441         "$define")
15442                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15443                 $cat >try.c <<EOCP
15444 #$i_memory I_MEMORY
15445 #$i_stdlib I_STDLIB
15446 #$i_string I_STRING
15447 #$i_unistd I_UNISTD
15448 EOCP
15449         $cat >>try.c <<'EOCP'
15450 #include <stdio.h>
15451 #ifdef I_MEMORY
15452 #  include <memory.h>
15453 #endif
15454 #ifdef I_STDLIB
15455 #  include <stdlib.h>
15456 #endif
15457 #ifdef I_STRING
15458 #  include <string.h>
15459 #else
15460 #  include <strings.h>
15461 #endif
15462 #ifdef I_UNISTD
15463 #  include <unistd.h>  /* Needed for NetBSD */
15464 #endif
15465 int main()
15466 {
15467 char buf[128], abc[128];
15468 char *b;
15469 int len;
15470 int off;
15471 int align;
15472
15473 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15474    try to store the string in read-only memory. */
15475 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15476
15477 for (align = 7; align >= 0; align--) {
15478         for (len = 36; len; len--) {
15479                 b = buf+align;
15480                 bcopy(abc, b, len);
15481                 for (off = 1; off <= len; off++) {
15482                         bcopy(b, b+off, len);
15483                         bcopy(b+off, b, len);
15484                         if (bcmp(b, abc, len))
15485                                 exit(1);
15486                 }
15487         }
15488 }
15489 exit(0);
15490 }
15491 EOCP
15492                 set try
15493                 if eval $compile_ok; then
15494                         if ./try 2>/dev/null; then
15495                                 echo "Yes, it can."
15496                                 val="$define"
15497                         else
15498                                 echo "It can't, sorry."
15499                         fi
15500                 else
15501                         echo "(I can't compile the test program, so we'll assume not...)"
15502                 fi
15503                 ;;
15504         esac
15505         $rm -f try.* try core
15506         ;;
15507 esac
15508 set d_safebcpy
15509 eval $setvar
15510
15511 : can memcpy handle overlapping blocks?
15512 echo " "
15513 val="$undef"
15514 case "$d_memmove" in
15515 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15516 *)      case "$d_memcpy" in
15517         "$define")
15518                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15519                 $cat >try.c <<EOCP
15520 #$i_memory I_MEMORY
15521 #$i_stdlib I_STDLIB
15522 #$i_string I_STRING
15523 #$i_unistd I_UNISTD
15524 EOCP
15525         $cat >>try.c <<'EOCP'
15526 #include <stdio.h>
15527 #ifdef I_MEMORY
15528 #  include <memory.h>
15529 #endif
15530 #ifdef I_STDLIB
15531 #  include <stdlib.h>
15532 #endif
15533 #ifdef I_STRING
15534 #  include <string.h>
15535 #else
15536 #  include <strings.h>
15537 #endif
15538 #ifdef I_UNISTD
15539 #  include <unistd.h>  /* Needed for NetBSD */
15540 #endif
15541 int main()
15542 {
15543 char buf[128], abc[128];
15544 char *b;
15545 int len;
15546 int off;
15547 int align;
15548
15549 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15550    try to store the string in read-only memory. */
15551 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15552
15553 for (align = 7; align >= 0; align--) {
15554         for (len = 36; len; len--) {
15555                 b = buf+align;
15556                 memcpy(b, abc, len);
15557                 for (off = 1; off <= len; off++) {
15558                         memcpy(b+off, b, len);
15559                         memcpy(b, b+off, len);
15560                         if (memcmp(b, abc, len))
15561                                 exit(1);
15562                 }
15563         }
15564 }
15565 exit(0);
15566 }
15567 EOCP
15568                 set try
15569                 if eval $compile_ok; then
15570                         if ./try 2>/dev/null; then
15571                                 echo "Yes, it can."
15572                                 val="$define"
15573                         else
15574                                 echo "It can't, sorry."
15575                         fi
15576                 else
15577                         echo "(I can't compile the test program, so we'll assume not...)"
15578                 fi
15579                 ;;
15580         esac
15581         $rm -f try.* try core
15582         ;;
15583 esac
15584 set d_safemcpy
15585 eval $setvar
15586
15587 : can memcmp be trusted to compare relative magnitude?
15588 val="$undef"
15589 case "$d_memcmp" in
15590 "$define")
15591         echo " "
15592         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15593         $cat >try.c <<EOCP
15594 #$i_memory I_MEMORY
15595 #$i_stdlib I_STDLIB
15596 #$i_string I_STRING
15597 #$i_unistd I_UNISTD
15598 EOCP
15599         $cat >>try.c <<'EOCP'
15600 #include <stdio.h>
15601 #ifdef I_MEMORY
15602 #  include <memory.h>
15603 #endif
15604 #ifdef I_STDLIB
15605 #  include <stdlib.h>
15606 #endif
15607 #ifdef I_STRING
15608 #  include <string.h>
15609 #else
15610 #  include <strings.h>
15611 #endif
15612 #ifdef I_UNISTD
15613 #  include <unistd.h>  /* Needed for NetBSD */
15614 #endif
15615 int main()
15616 {
15617 char a = -1;
15618 char b = 0;
15619 if ((a < b) && memcmp(&a, &b, 1) < 0)
15620         exit(1);
15621 exit(0);
15622 }
15623 EOCP
15624         set try
15625         if eval $compile_ok; then
15626                 if $run ./try 2>/dev/null; then
15627                         echo "Yes, it can."
15628                         val="$define"
15629                 else
15630                         echo "No, it can't (it uses signed chars)."
15631                 fi
15632         else
15633                 echo "(I can't compile the test program, so we'll assume not...)"
15634         fi
15635         ;;
15636 esac
15637 $rm -f try.* try core
15638 set d_sanemcmp
15639 eval $setvar
15640
15641 : see if prototype for sbrk is available
15642 echo " "
15643 set d_sbrkproto sbrk $i_unistd unistd.h
15644 eval $hasproto
15645
15646 : see if select exists
15647 set select d_select
15648 eval $inlibc
15649
15650 : see if semctl exists
15651 set semctl d_semctl
15652 eval $inlibc
15653
15654 : see if semget exists
15655 set semget d_semget
15656 eval $inlibc
15657
15658 : see if semop exists
15659 set semop d_semop
15660 eval $inlibc
15661
15662 : see how much of the 'sem*(2)' library is present.
15663 h_sem=true
15664 echo " "
15665 case "$d_semctl$d_semget$d_semop" in
15666 *"$undef"*) h_sem=false;;
15667 esac
15668 case "$osname" in
15669 freebsd)
15670     case "`ipcs 2>&1`" in
15671     "SVID messages"*"not configured"*)
15672         echo "Your $osname does not have the sem*(2) configured." >&4
15673         h_sem=false
15674         val="$undef"
15675         set semctl d_semctl
15676         eval $setvar
15677         set semget d_semget
15678         eval $setvar
15679         set semop d_semop
15680         eval $setvar
15681         ;;
15682     esac
15683     ;;
15684 esac
15685 : we could also check for sys/ipc.h ...
15686 if $h_sem && $test `./findhdr sys/sem.h`; then
15687         echo "You have the full sem*(2) library." >&4
15688         val="$define"
15689 else
15690         echo "You don't have the full sem*(2) library." >&4
15691         val="$undef"
15692 fi
15693 set d_sem
15694 eval $setvar
15695
15696 : see whether sys/sem.h defines union semun
15697 echo " "
15698 $cat > try.c <<'END'
15699 #include <sys/types.h>
15700 #include <sys/ipc.h>
15701 #include <sys/sem.h>
15702 int main () { union semun semun; semun.buf = 0; }
15703 END
15704 set try
15705 if eval $compile; then
15706     echo "You have union semun in <sys/sem.h>." >&4
15707     val="$define"
15708 else
15709     echo "You do not have union semun in <sys/sem.h>." >&4
15710     val="$undef"
15711 fi
15712 $rm -f try try.c
15713 set d_union_semun
15714 eval $setvar
15715
15716 : see how to do semctl IPC_STAT
15717 case "$d_sem" in
15718 $define)
15719     echo " "
15720     $cat > try.h <<END
15721 #ifndef S_IRUSR
15722 #   ifdef S_IREAD
15723 #       define S_IRUSR S_IREAD
15724 #       define S_IWUSR S_IWRITE
15725 #       define S_IXUSR S_IEXEC
15726 #   else
15727 #       define S_IRUSR 0400
15728 #       define S_IWUSR 0200
15729 #       define S_IXUSR 0100
15730 #   endif
15731 #   define S_IRGRP (S_IRUSR>>3)
15732 #   define S_IWGRP (S_IWUSR>>3)
15733 #   define S_IXGRP (S_IXUSR>>3)
15734 #   define S_IROTH (S_IRUSR>>6)
15735 #   define S_IWOTH (S_IWUSR>>6)
15736 #   define S_IXOTH (S_IXUSR>>6)
15737 #endif
15738 #ifndef S_IRWXU
15739 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15740 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15741 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15742 #endif
15743 END
15744     : see whether semctl IPC_STAT can use union semun
15745     case "$d_semctl_semun" in
15746     '')
15747       val="$undef"
15748       $cat > try.c <<END
15749 #include <sys/types.h>
15750 #include <sys/ipc.h>
15751 #include <sys/sem.h>
15752 #include <sys/stat.h>
15753 #include <stdio.h>
15754 #include <errno.h>
15755 #include "try.h"
15756 #ifndef errno
15757 extern int errno;
15758 #endif
15759 #$d_union_semun HAS_UNION_SEMUN
15760 int main() {
15761     union semun
15762 #ifndef HAS_UNION_SEMUN
15763     {
15764         int val;
15765         struct semid_ds *buf;
15766         unsigned short *array;
15767     }
15768 #endif
15769     arg;
15770     int sem, st;
15771
15772 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15773     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15774     if (sem > -1) {
15775         struct semid_ds argbuf;
15776         arg.buf = &argbuf;
15777 #       ifdef IPC_STAT
15778         st = semctl(sem, 0, IPC_STAT, arg);
15779         if (st == 0)
15780             printf("semun\n");
15781         else
15782 #       endif /* IPC_STAT */
15783             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15784 #       ifdef IPC_RMID
15785         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15786 #       endif /* IPC_RMID */
15787             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15788     } else
15789 #endif /* IPC_PRIVATE && ... */
15790         printf("semget failed: errno = %d\n", errno);
15791   return 0;
15792 }
15793 END
15794       set try
15795       if eval $compile; then
15796           xxx=`$run ./try`
15797           case "$xxx" in
15798           semun) val="$define" ;;
15799           esac
15800       fi
15801       $rm -f try try.c
15802       set d_semctl_semun
15803       eval $setvar
15804       ;;
15805     esac
15806     case "$d_semctl_semun" in
15807     $define)
15808         echo "You can use union semun for semctl IPC_STAT." >&4
15809         also='also'
15810         ;;
15811     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15812         also=''
15813         ;;
15814     esac
15815
15816     : see whether semctl IPC_STAT can use struct semid_ds pointer
15817     case "$d_semctl_semid_ds" in
15818     '')
15819       val="$undef"
15820       $cat > try.c <<'END'
15821 #include <sys/types.h>
15822 #include <sys/ipc.h>
15823 #include <sys/sem.h>
15824 #include <sys/stat.h>
15825 #include "try.h"
15826 #include <stdio.h>
15827 #include <errno.h>
15828 #ifndef errno
15829 extern int errno;
15830 #endif
15831 int main() {
15832     struct semid_ds arg;
15833     int sem, st;
15834
15835 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15836     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15837     if (sem > -1) {
15838 #       ifdef IPC_STAT
15839         st = semctl(sem, 0, IPC_STAT, &arg);
15840         if (st == 0)
15841             printf("semid_ds\n");
15842         else
15843 #       endif /* IPC_STAT */
15844             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15845 #       ifdef IPC_RMID
15846         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15847 #       endif /* IPC_RMID */
15848             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15849     } else
15850 #endif /* IPC_PRIVATE && ... */
15851         printf("semget failed: errno = %d\n", errno);
15852
15853     return 0;
15854 }
15855 END
15856       set try
15857       if eval $compile; then
15858           xxx=`$run ./try`
15859           case "$xxx" in
15860           semid_ds) val="$define" ;;
15861           esac
15862       fi
15863       $rm -f try try.c
15864       set d_semctl_semid_ds
15865       eval $setvar
15866       ;;
15867     esac
15868     case "$d_semctl_semid_ds" in
15869     $define)
15870         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15871         ;;
15872     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15873         ;;
15874     esac
15875     $rm -f try.h
15876     ;;
15877 *)  val="$undef"
15878
15879     # We do not have the full sem*(2) library, so assume we can not
15880     # use either.
15881
15882     set d_semctl_semun
15883     eval $setvar
15884
15885     set d_semctl_semid_ds
15886     eval $setvar
15887     ;;
15888 esac
15889
15890 : see if sendmsg exists
15891 set sendmsg d_sendmsg
15892 eval $inlibc
15893
15894 : see if setegid exists
15895 set setegid d_setegid
15896 eval $inlibc
15897
15898 : see if seteuid exists
15899 set seteuid d_seteuid
15900 eval $inlibc
15901
15902 : see if setgrent exists
15903 set setgrent d_setgrent
15904 eval $inlibc
15905
15906 : see if setgrent_r exists
15907 set setgrent_r d_setgrent_r
15908 eval $inlibc
15909 case "$d_setgrent_r" in
15910 "$define")
15911         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15912         case "$d_setgrent_r_proto:$usethreads" in
15913         ":define")      d_setgrent_r_proto=define
15914                 set d_setgrent_r_proto setgrent_r $hdrs
15915                 eval $hasproto ;;
15916         *)      ;;
15917         esac
15918         case "$d_setgrent_r_proto" in
15919         define)
15920         case "$setgrent_r_proto" in
15921         ''|0) try='int setgrent_r(FILE**);'
15922         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15923         esac
15924         case "$setgrent_r_proto" in
15925         ''|0) try='void setgrent_r(FILE**);'
15926         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15927         esac
15928         case "$setgrent_r_proto" in
15929         ''|0)   d_setgrent_r=undef
15930                 setgrent_r_proto=0
15931                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15932         * )     case "$setgrent_r_proto" in
15933                 REENTRANT_PROTO*) ;;
15934                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15935                 esac
15936                 echo "Prototype: $try" ;;
15937         esac
15938         ;;
15939         *)      case "$usethreads" in
15940                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15941                 esac
15942                 d_setgrent_r=undef
15943                 setgrent_r_proto=0
15944                 ;;
15945         esac
15946         ;;
15947 *)      setgrent_r_proto=0
15948         ;;
15949 esac
15950
15951 : see if sethostent exists
15952 set sethostent d_sethent
15953 eval $inlibc
15954
15955 : see if sethostent_r exists
15956 set sethostent_r d_sethostent_r
15957 eval $inlibc
15958 case "$d_sethostent_r" in
15959 "$define")
15960         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15961         case "$d_sethostent_r_proto:$usethreads" in
15962         ":define")      d_sethostent_r_proto=define
15963                 set d_sethostent_r_proto sethostent_r $hdrs
15964                 eval $hasproto ;;
15965         *)      ;;
15966         esac
15967         case "$d_sethostent_r_proto" in
15968         define)
15969         case "$sethostent_r_proto" in
15970         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15971         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15972         esac
15973         case "$sethostent_r_proto" in
15974         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15975         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15976         esac
15977         case "$sethostent_r_proto" in
15978         ''|0)   d_sethostent_r=undef
15979                 sethostent_r_proto=0
15980                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15981         * )     case "$sethostent_r_proto" in
15982                 REENTRANT_PROTO*) ;;
15983                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15984                 esac
15985                 echo "Prototype: $try" ;;
15986         esac
15987         ;;
15988         *)      case "$usethreads" in
15989                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15990                 esac
15991                 d_sethostent_r=undef
15992                 sethostent_r_proto=0
15993                 ;;
15994         esac
15995         ;;
15996 *)      sethostent_r_proto=0
15997         ;;
15998 esac
15999
16000 : see if setitimer exists
16001 set setitimer d_setitimer
16002 eval $inlibc
16003
16004 : see if setlinebuf exists
16005 set setlinebuf d_setlinebuf
16006 eval $inlibc
16007
16008 : see if setlocale exists
16009 set setlocale d_setlocale
16010 eval $inlibc
16011
16012 : see if locale.h is available
16013 set locale.h i_locale
16014 eval $inhdr
16015
16016 : see if setlocale_r exists
16017 set setlocale_r d_setlocale_r
16018 eval $inlibc
16019 case "$d_setlocale_r" in
16020 "$define")
16021         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16022         case "$d_setlocale_r_proto:$usethreads" in
16023         ":define")      d_setlocale_r_proto=define
16024                 set d_setlocale_r_proto setlocale_r $hdrs
16025                 eval $hasproto ;;
16026         *)      ;;
16027         esac
16028         case "$d_setlocale_r_proto" in
16029         define)
16030         case "$setlocale_r_proto" in
16031         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16032         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16033         esac
16034         case "$setlocale_r_proto" in
16035         ''|0)   d_setlocale_r=undef
16036                 setlocale_r_proto=0
16037                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16038         * )     case "$setlocale_r_proto" in
16039                 REENTRANT_PROTO*) ;;
16040                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16041                 esac
16042                 echo "Prototype: $try" ;;
16043         esac
16044         ;;
16045         *)      case "$usethreads" in
16046                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16047                 esac
16048                 d_setlocale_r=undef
16049                 setlocale_r_proto=0
16050                 ;;
16051         esac
16052         ;;
16053 *)      setlocale_r_proto=0
16054         ;;
16055 esac
16056
16057 : see if setnetent exists
16058 set setnetent d_setnent
16059 eval $inlibc
16060
16061 : see if setnetent_r exists
16062 set setnetent_r d_setnetent_r
16063 eval $inlibc
16064 case "$d_setnetent_r" in
16065 "$define")
16066         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16067         case "$d_setnetent_r_proto:$usethreads" in
16068         ":define")      d_setnetent_r_proto=define
16069                 set d_setnetent_r_proto setnetent_r $hdrs
16070                 eval $hasproto ;;
16071         *)      ;;
16072         esac
16073         case "$d_setnetent_r_proto" in
16074         define)
16075         case "$setnetent_r_proto" in
16076         ''|0) try='int setnetent_r(int, struct netent_data*);'
16077         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16078         esac
16079         case "$setnetent_r_proto" in
16080         ''|0) try='void setnetent_r(int, struct netent_data*);'
16081         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16082         esac
16083         case "$setnetent_r_proto" in
16084         ''|0)   d_setnetent_r=undef
16085                 setnetent_r_proto=0
16086                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16087         * )     case "$setnetent_r_proto" in
16088                 REENTRANT_PROTO*) ;;
16089                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16090                 esac
16091                 echo "Prototype: $try" ;;
16092         esac
16093         ;;
16094         *)      case "$usethreads" in
16095                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16096                 esac
16097                 d_setnetent_r=undef
16098                 setnetent_r_proto=0
16099                 ;;
16100         esac
16101         ;;
16102 *)      setnetent_r_proto=0
16103         ;;
16104 esac
16105
16106 : see if setprotoent exists
16107 set setprotoent d_setpent
16108 eval $inlibc
16109
16110 : see if setpgid exists
16111 set setpgid d_setpgid
16112 eval $inlibc
16113
16114 : see if setpgrp2 exists
16115 set setpgrp2 d_setpgrp2
16116 eval $inlibc
16117
16118 : see if setpriority exists
16119 set setpriority d_setprior
16120 eval $inlibc
16121
16122 : see if setproctitle exists
16123 set setproctitle d_setproctitle
16124 eval $inlibc
16125
16126 : see if setprotoent_r exists
16127 set setprotoent_r d_setprotoent_r
16128 eval $inlibc
16129 case "$d_setprotoent_r" in
16130 "$define")
16131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16132         case "$d_setprotoent_r_proto:$usethreads" in
16133         ":define")      d_setprotoent_r_proto=define
16134                 set d_setprotoent_r_proto setprotoent_r $hdrs
16135                 eval $hasproto ;;
16136         *)      ;;
16137         esac
16138         case "$d_setprotoent_r_proto" in
16139         define)
16140         case "$setprotoent_r_proto" in
16141         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16142         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16143         esac
16144         case "$setprotoent_r_proto" in
16145         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16146         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16147         esac
16148         case "$setprotoent_r_proto" in
16149         ''|0)   d_setprotoent_r=undef
16150                 setprotoent_r_proto=0
16151                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16152         * )     case "$setprotoent_r_proto" in
16153                 REENTRANT_PROTO*) ;;
16154                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16155                 esac
16156                 echo "Prototype: $try" ;;
16157         esac
16158         ;;
16159         *)      case "$usethreads" in
16160                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16161                 esac
16162                 d_setprotoent_r=undef
16163                 setprotoent_r_proto=0
16164                 ;;
16165         esac
16166         ;;
16167 *)      setprotoent_r_proto=0
16168         ;;
16169 esac
16170
16171 : see if setpwent exists
16172 set setpwent d_setpwent
16173 eval $inlibc
16174
16175 : see if setpwent_r exists
16176 set setpwent_r d_setpwent_r
16177 eval $inlibc
16178 case "$d_setpwent_r" in
16179 "$define")
16180         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16181         case "$d_setpwent_r_proto:$usethreads" in
16182         ":define")      d_setpwent_r_proto=define
16183                 set d_setpwent_r_proto setpwent_r $hdrs
16184                 eval $hasproto ;;
16185         *)      ;;
16186         esac
16187         case "$d_setpwent_r_proto" in
16188         define)
16189         case "$setpwent_r_proto" in
16190         ''|0) try='int setpwent_r(FILE**);'
16191         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16192         esac
16193         case "$setpwent_r_proto" in
16194         ''|0) try='void setpwent_r(FILE**);'
16195         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16196         esac
16197         case "$setpwent_r_proto" in
16198         ''|0)   d_setpwent_r=undef
16199                 setpwent_r_proto=0
16200                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16201         * )     case "$setpwent_r_proto" in
16202                 REENTRANT_PROTO*) ;;
16203                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16204                 esac
16205                 echo "Prototype: $try" ;;
16206         esac
16207         ;;
16208         *)      case "$usethreads" in
16209                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16210                 esac
16211                 d_setpwent_r=undef
16212                 setpwent_r_proto=0
16213                 ;;
16214         esac
16215         ;;
16216 *)      setpwent_r_proto=0
16217         ;;
16218 esac
16219
16220 : see if setregid exists
16221 set setregid d_setregid
16222 eval $inlibc
16223 set setresgid d_setresgid
16224 eval $inlibc
16225
16226 : see if setreuid exists
16227 set setreuid d_setreuid
16228 eval $inlibc
16229 set setresuid d_setresuid
16230 eval $inlibc
16231
16232 : see if setrgid exists
16233 set setrgid d_setrgid
16234 eval $inlibc
16235
16236 : see if setruid exists
16237 set setruid d_setruid
16238 eval $inlibc
16239
16240 : see if setservent exists
16241 set setservent d_setsent
16242 eval $inlibc
16243
16244 : see if setservent_r exists
16245 set setservent_r d_setservent_r
16246 eval $inlibc
16247 case "$d_setservent_r" in
16248 "$define")
16249         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16250         case "$d_setservent_r_proto:$usethreads" in
16251         ":define")      d_setservent_r_proto=define
16252                 set d_setservent_r_proto setservent_r $hdrs
16253                 eval $hasproto ;;
16254         *)      ;;
16255         esac
16256         case "$d_setservent_r_proto" in
16257         define)
16258         case "$setservent_r_proto" in
16259         ''|0) try='int setservent_r(int, struct servent_data*);'
16260         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16261         esac
16262         case "$setservent_r_proto" in
16263         ''|0) try='void setservent_r(int, struct servent_data*);'
16264         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16265         esac
16266         case "$setservent_r_proto" in
16267         ''|0)   d_setservent_r=undef
16268                 setservent_r_proto=0
16269                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16270         * )     case "$setservent_r_proto" in
16271                 REENTRANT_PROTO*) ;;
16272                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16273                 esac
16274                 echo "Prototype: $try" ;;
16275         esac
16276         ;;
16277         *)      case "$usethreads" in
16278                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16279                 esac
16280                 d_setservent_r=undef
16281                 setservent_r_proto=0
16282                 ;;
16283         esac
16284         ;;
16285 *)      setservent_r_proto=0
16286         ;;
16287 esac
16288
16289 : see if setsid exists
16290 set setsid d_setsid
16291 eval $inlibc
16292
16293 : see if setvbuf exists
16294 set setvbuf d_setvbuf
16295 eval $inlibc
16296
16297 : see if sfio.h is available
16298 set sfio.h i_sfio
16299 eval $inhdr
16300
16301
16302 : see if sfio library is available
16303 case "$i_sfio" in
16304 $define)
16305         val=''
16306         set sfreserve val
16307         eval $inlibc
16308         ;;
16309 *)
16310         val="$undef"
16311         ;;
16312 esac
16313 : Ok, but do we want to use it.
16314 case "$val" in
16315 $define)
16316         case "$usesfio" in
16317         true|$define|[yY]*) dflt='y';;
16318         *) dflt='n';;
16319         esac
16320         echo "$package can use the sfio library, but it is experimental."
16321         case "$useperlio" in
16322         "$undef")
16323             echo "For sfio also the PerlIO abstraction layer is needed."
16324             echo "Earlier you said you wouldn't want that."
16325             ;;
16326         esac
16327         rp="You seem to have sfio available, do you want to try using it?"
16328         . ./myread
16329         case "$ans" in
16330         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16331                 useperlio="$define"
16332                 val="$define"
16333                 ;;
16334         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16335                 val="$undef"
16336                 ;;
16337         esac
16338         ;;
16339 *)      case "$usesfio" in
16340         true|$define|[yY]*)
16341                 echo "Sorry, cannot find sfio on this machine." >&4
16342                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16343                 val="$undef"
16344                 ;;
16345         esac
16346         ;;
16347 esac
16348 set d_sfio
16349 eval $setvar
16350 case "$d_sfio" in
16351 $define) usesfio='true';;
16352 *) usesfio='false';;
16353 esac
16354 case "$d_sfio" in
16355 $define) ;;
16356 *)      : Remove sfio from list of libraries to use
16357         case "$libs" in
16358         *-lsfio*)
16359                 echo "Removing unneeded -lsfio from library list" >&4
16360                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16361                 shift
16362                 libs="$*"
16363                 echo "libs = $libs" >&4
16364                 ;;
16365         esac
16366 ;;
16367 esac
16368
16369
16370 : see if shmctl exists
16371 set shmctl d_shmctl
16372 eval $inlibc
16373
16374 : see if shmget exists
16375 set shmget d_shmget
16376 eval $inlibc
16377
16378 : see if shmat exists
16379 set shmat d_shmat
16380 eval $inlibc
16381 : see what shmat returns
16382 case "$d_shmat" in
16383 "$define")
16384         $cat >shmat.c <<'END'
16385 #include <sys/shm.h>
16386 void *shmat();
16387 END
16388         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16389                 shmattype='void *'
16390         else
16391                 shmattype='char *'
16392         fi
16393         echo "and it returns ($shmattype)." >&4
16394         : see if a prototype for shmat is available
16395         xxx=`./findhdr sys/shm.h`
16396         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16397         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16398                 val="$define"
16399         else
16400                 val="$undef"
16401         fi
16402         $rm -f shmat.[co]
16403         ;;
16404 *)
16405         val="$undef"
16406         ;;
16407 esac
16408 set d_shmatprototype
16409 eval $setvar
16410
16411 : see if shmdt exists
16412 set shmdt d_shmdt
16413 eval $inlibc
16414
16415 : see how much of the 'shm*(2)' library is present.
16416 h_shm=true
16417 echo " "
16418 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16419 *"$undef"*) h_shm=false;;
16420 esac
16421 case "$osname" in
16422 freebsd)
16423     case "`ipcs 2>&1`" in
16424     "SVID shared memory"*"not configured"*)
16425         echo "Your $osname does not have the shm*(2) configured." >&4
16426         h_shm=false
16427         val="$undef"
16428         set shmctl d_shmctl
16429         evat $setvar
16430         set shmget d_shmget
16431         evat $setvar
16432         set shmat d_shmat
16433         evat $setvar
16434         set shmdt d_shmdt
16435         evat $setvar
16436         ;;
16437     esac
16438     ;;
16439 esac
16440 : we could also check for sys/ipc.h ...
16441 if $h_shm && $test `./findhdr sys/shm.h`; then
16442         echo "You have the full shm*(2) library." >&4
16443         val="$define"
16444 else
16445         echo "You don't have the full shm*(2) library." >&4
16446         val="$undef"
16447 fi
16448 set d_shm
16449 eval $setvar
16450
16451 echo " "
16452 : see if we have sigaction
16453 if set sigaction val -f d_sigaction; eval $csym; $val; then
16454         echo 'sigaction() found.' >&4
16455         $cat > try.c <<EOP
16456 #include <stdio.h>
16457 #include <sys/types.h>
16458 #include <signal.h>
16459 #$i_stdlib I_STDLIB
16460 #ifdef I_STDLIB
16461 #include <stdlib.h>
16462 #endif
16463 int main()
16464 {
16465     struct sigaction act, oact;
16466     act.sa_flags = 0;
16467     oact.sa_handler = 0;
16468     /* so that act and oact are used */
16469     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16470 }
16471 EOP
16472         set try
16473         if eval $compile_ok; then
16474                 val="$define"
16475         else
16476                 echo "But you don't seem to have a useable struct sigaction." >&4
16477                 val="$undef"
16478         fi
16479 else
16480         echo 'sigaction NOT found.' >&4
16481         val="$undef"
16482 fi
16483 set d_sigaction; eval $setvar
16484 $rm -f try try$_o try.c
16485
16486 : see if sigprocmask exists
16487 set sigprocmask d_sigprocmask
16488 eval $inlibc
16489
16490 : see if sigsetjmp exists
16491 echo " "
16492 case "$d_sigsetjmp" in
16493 '')
16494         $cat >try.c <<EOP
16495 #include <setjmp.h>
16496 #$i_stdlib I_STDLIB
16497 #ifdef I_STDLIB
16498 #include <stdlib.h>
16499 #endif
16500 sigjmp_buf env;
16501 int set = 1;
16502 int main()
16503 {
16504         if (sigsetjmp(env,1))
16505                 exit(set);
16506         set = 0;
16507         siglongjmp(env, 1);
16508         exit(1);
16509 }
16510 EOP
16511         set try
16512         if eval $compile; then
16513                 if $run ./try >/dev/null 2>&1; then
16514                         echo "POSIX sigsetjmp found." >&4
16515                         val="$define"
16516                 else
16517                         $cat >&4 <<EOM
16518 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16519 I'll ignore them.
16520 EOM
16521                         val="$undef"
16522                 fi
16523         else
16524                 echo "sigsetjmp not found." >&4
16525                 val="$undef"
16526         fi
16527         ;;
16528 *) val="$d_sigsetjmp"
16529         case "$d_sigsetjmp" in
16530         $define) echo "POSIX sigsetjmp found." >&4;;
16531         $undef) echo "sigsetjmp not found." >&4;;
16532         esac
16533         ;;
16534 esac
16535 set d_sigsetjmp
16536 eval $setvar
16537 $rm -f try.c try
16538
16539 : see if snprintf exists
16540 set snprintf d_snprintf
16541 eval $inlibc
16542
16543 : see if vsnprintf exists
16544 set vsnprintf d_vsnprintf
16545 eval $inlibc
16546
16547 case "$d_snprintf-$d_vsnprintf" in
16548 "$define-$define")
16549     $cat <<EOM
16550 Checking whether your snprintf() and vsnprintf() work okay...
16551 EOM
16552     $cat >try.c <<'EOCP'
16553 /* v?snprintf testing logic courtesy of Russ Allbery.
16554  * According to C99:
16555  * - if the buffer is too short it still must be \0-terminated
16556  * - if the buffer is too short the potentially required length
16557  *   must be returned and not -1
16558  * - if the buffer is NULL the potentially required length
16559  *   must be returned and not -1 or core dump
16560  */
16561 #include <stdio.h>
16562 #include <stdarg.h>
16563
16564 char buf[2];
16565
16566 int test (char *format, ...)
16567 {
16568     va_list args;
16569     int count;
16570
16571     va_start (args, format);
16572     count = vsnprintf (buf, sizeof buf, format, args);
16573     va_end (args);
16574     return count;
16575 }
16576
16577 int main ()
16578 {
16579     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16580              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16581 }
16582 EOCP
16583     set try
16584     if eval $compile; then
16585         `$run ./try`
16586         case "$?" in
16587         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16588         *) cat <<EOM >&4
16589 Your snprintf() and snprintf() don't seem to be working okay.
16590 EOM
16591            d_snprintf="$undef"
16592            d_vsnprintf="$undef"
16593            ;;
16594         esac
16595     else
16596         echo "(I can't seem to compile the test program--assuming they don't)"
16597         d_snprintf="$undef"
16598         d_vsnprintf="$undef"
16599     fi
16600     $rm -f try.* try core core.try.*
16601     ;;
16602 esac
16603
16604 : see if sockatmark exists
16605 set sockatmark d_sockatmark
16606 eval $inlibc
16607
16608 : see if prototype for sockatmark is available
16609 echo " "
16610 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16611 eval $hasproto
16612
16613 : see if socks5_init exists
16614 set socks5_init d_socks5_init
16615 eval $inlibc
16616
16617 : see if sprintf returns the length of the string in the buffer as per ANSI
16618 $echo "Checking whether sprintf returns the length of the string..." >&4
16619 $cat <<EOP >try.c
16620 #include <stdio.h>
16621 #$i_stdlib I_STDLIB
16622 #ifdef I_STDLIB
16623 #include <stdlib.h>
16624 #endif
16625 #$i_string I_STRING
16626 #ifdef I_STRING
16627 #  include <string.h>
16628 #else
16629 #  include <strings.h>
16630 #endif
16631 #$i_math I_MATH
16632 #ifdef I_MATH
16633 #include <math.h>
16634 #endif
16635
16636 char buffer[256];
16637
16638 int check (size_t expect, int test) {
16639   size_t got = strlen(buffer);
16640   if (expect == got)
16641     return 0;
16642
16643   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16644        test, buffer);
16645   exit (test);
16646 }
16647
16648 int main(int argc, char **argv) {
16649   int test = 0;
16650
16651   check(sprintf(buffer, ""), ++test);
16652   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16653   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16654
16655   return 0;
16656 }
16657 EOP
16658 set try
16659
16660 d_sprintf_returns_strlen="$undef"
16661 if eval $compile; then
16662     xxx="`$run ./try`"
16663     case "$?" in
16664         0) cat >&4 <<EOM
16665 sprintf returns the length of the string (as ANSI says it should)
16666 EOM
16667         d_sprintf_returns_strlen="$define"
16668         ;;
16669         *) cat >&4 <<EOM
16670 sprintf does not return the length of the string (how old is this system?)
16671 EOM
16672         d_sprintf_returns_strlen="$undef"
16673         ;;
16674     esac
16675 fi
16676
16677 $rm -f try.* try
16678
16679 : see if srand48_r exists
16680 set srand48_r d_srand48_r
16681 eval $inlibc
16682 case "$d_srand48_r" in
16683 "$define")
16684         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16685         case "$d_srand48_r_proto:$usethreads" in
16686         ":define")      d_srand48_r_proto=define
16687                 set d_srand48_r_proto srand48_r $hdrs
16688                 eval $hasproto ;;
16689         *)      ;;
16690         esac
16691         case "$d_srand48_r_proto" in
16692         define)
16693         case "$srand48_r_proto" in
16694         ''|0) try='int srand48_r(long, struct drand48_data*);'
16695         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16696         esac
16697         case "$srand48_r_proto" in
16698         ''|0)   d_srand48_r=undef
16699                 srand48_r_proto=0
16700                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16701         * )     case "$srand48_r_proto" in
16702                 REENTRANT_PROTO*) ;;
16703                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16704                 esac
16705                 echo "Prototype: $try" ;;
16706         esac
16707         ;;
16708         *)      case "$usethreads" in
16709                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16710                 esac
16711                 d_srand48_r=undef
16712                 srand48_r_proto=0
16713                 ;;
16714         esac
16715         ;;
16716 *)      srand48_r_proto=0
16717         ;;
16718 esac
16719
16720 : see if srandom_r exists
16721 set srandom_r d_srandom_r
16722 eval $inlibc
16723 case "$d_srandom_r" in
16724 "$define")
16725         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16726         case "$d_srandom_r_proto:$usethreads" in
16727         ":define")      d_srandom_r_proto=define
16728                 set d_srandom_r_proto srandom_r $hdrs
16729                 eval $hasproto ;;
16730         *)      ;;
16731         esac
16732         case "$d_srandom_r_proto" in
16733         define)
16734         case "$srandom_r_proto" in
16735         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16736         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16737         esac
16738         case "$srandom_r_proto" in
16739         ''|0)   d_srandom_r=undef
16740                 srandom_r_proto=0
16741                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16742         * )     case "$srandom_r_proto" in
16743                 REENTRANT_PROTO*) ;;
16744                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16745                 esac
16746                 echo "Prototype: $try" ;;
16747         esac
16748         ;;
16749         *)      case "$usethreads" in
16750                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16751                 esac
16752                 d_srandom_r=undef
16753                 srandom_r_proto=0
16754                 ;;
16755         esac
16756         ;;
16757 *)      srandom_r_proto=0
16758         ;;
16759 esac
16760
16761 : see if prototype for setresgid is available
16762 echo " "
16763 set d_sresgproto setresgid $i_unistd unistd.h
16764 eval $hasproto
16765
16766 : see if prototype for setresuid is available
16767 echo " "
16768 set d_sresuproto setresuid $i_unistd unistd.h
16769 eval $hasproto
16770
16771 : see if sys/stat.h is available
16772 set sys/stat.h i_sysstat
16773 eval $inhdr
16774
16775
16776 : see if stat knows about block sizes
16777 echo " "
16778 echo "Checking to see if your struct stat has st_blocks field..." >&4
16779 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16780 eval $hasfield
16781
16782
16783 : see if this is a sys/vfs.h system
16784 set sys/vfs.h i_sysvfs
16785 eval $inhdr
16786
16787
16788 : see if this is a sys/statfs.h system
16789 set sys/statfs.h i_sysstatfs
16790 eval $inhdr
16791
16792
16793 echo " "
16794 echo "Checking to see if your system supports struct statfs..." >&4
16795 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
16796 eval $hasstruct
16797 case "$d_statfs_s" in
16798 "$define")      echo "Yes, it does."   ;;
16799 *)              echo "No, it doesn't." ;;
16800 esac
16801
16802
16803
16804 : see if struct statfs knows about f_flags
16805 case "$d_statfs_s" in
16806 define) 
16807         echo " "
16808         echo "Checking to see if your struct statfs has f_flags field..." >&4
16809         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
16810         eval $hasfield
16811         ;;
16812 *)      val="$undef"
16813         set d_statfs_f_flags
16814         eval $setvar
16815         ;;
16816 esac
16817 case "$d_statfs_f_flags" in
16818 "$define")      echo "Yes, it does."   ;;
16819 *)              echo "No, it doesn't." ;;
16820 esac
16821
16822 $cat >&4 <<EOM
16823 Checking how to access stdio streams by file descriptor number...
16824 EOM
16825 case "$stdio_stream_array" in
16826 '')     $cat >try.c <<EOCP
16827 #include <stdio.h>
16828 int main() {
16829   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16830     printf("yes\n");
16831 }
16832 EOCP
16833         for s in _iob __iob __sF
16834         do
16835                 set try -DSTDIO_STREAM_ARRAY=$s
16836                 if eval $compile; then
16837                         case "`$run ./try`" in
16838                         yes)    stdio_stream_array=$s; break ;;
16839                         esac
16840                 fi
16841         done
16842         $rm -f try.* try$exe_ext
16843 esac
16844 case "$stdio_stream_array" in
16845 '')     $cat >&4 <<EOM
16846 I can't figure out how to access stdio streams by file descriptor number.
16847 EOM
16848         d_stdio_stream_array="$undef"
16849         ;;
16850 *)      $cat >&4 <<EOM
16851 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16852 EOM
16853         d_stdio_stream_array="$define"
16854         ;;
16855 esac
16856
16857 : see if strcoll exists
16858 set strcoll d_strcoll
16859 eval $inlibc
16860
16861 : check for structure copying
16862 echo " "
16863 echo "Checking to see if your C compiler can copy structs..." >&4
16864 $cat >try.c <<'EOCP'
16865 int main()
16866 {
16867         struct blurfl {
16868                 int dyick;
16869         } foo, bar;
16870
16871         foo = bar;
16872 }
16873 EOCP
16874 if $cc -c try.c >/dev/null 2>&1 ; then
16875         val="$define"
16876         echo "Yup, it can."
16877 else
16878         val="$undef"
16879         echo "Nope, it can't."
16880 fi
16881 set d_strctcpy
16882 eval $setvar
16883 $rm -f try.*
16884
16885 : see if strerror and/or sys_errlist[] exist
16886 echo " "
16887 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16888     if set strerror val -f d_strerror; eval $csym; $val; then
16889                 echo 'strerror() found.' >&4
16890                 d_strerror="$define"
16891                 d_strerrm='strerror(e)'
16892                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16893                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16894                         d_syserrlst="$define"
16895                 else
16896                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16897                         d_syserrlst="$undef"
16898                 fi
16899     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16900                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16901                 echo 'strerror() found in string header.' >&4
16902                 d_strerror="$define"
16903                 d_strerrm='strerror(e)'
16904                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16905                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16906                                 d_syserrlst="$define"
16907                 else
16908                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16909                         d_syserrlst="$undef"
16910                 fi
16911     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16912                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16913                 d_strerror="$undef"
16914                 d_syserrlst="$define"
16915                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16916     else
16917                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16918                 d_strerror="$undef"
16919                 d_syserrlst="$undef"
16920                 d_strerrm='"unknown"'
16921     fi
16922 fi
16923
16924 : see if strerror_r exists
16925 set strerror_r d_strerror_r
16926 eval $inlibc
16927 case "$d_strerror_r" in
16928 "$define")
16929         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16930         case "$d_strerror_r_proto:$usethreads" in
16931         ":define")      d_strerror_r_proto=define
16932                 set d_strerror_r_proto strerror_r $hdrs
16933                 eval $hasproto ;;
16934         *)      ;;
16935         esac
16936         case "$d_strerror_r_proto" in
16937         define)
16938         case "$strerror_r_proto" in
16939         ''|0) try='int strerror_r(int, char*, size_t);'
16940         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16941         esac
16942         case "$strerror_r_proto" in
16943         ''|0) try='int strerror_r(int, char*, int);'
16944         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16945         esac
16946         case "$strerror_r_proto" in
16947         ''|0) try='char* strerror_r(int, char*, size_t);'
16948         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16949         esac
16950         case "$strerror_r_proto" in
16951         ''|0)   d_strerror_r=undef
16952                 strerror_r_proto=0
16953                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16954         * )     case "$strerror_r_proto" in
16955                 REENTRANT_PROTO*) ;;
16956                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16957                 esac
16958                 echo "Prototype: $try" ;;
16959         esac
16960         ;;
16961         *)      case "$usethreads" in
16962                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16963                 esac
16964                 d_strerror_r=undef
16965                 strerror_r_proto=0
16966                 ;;
16967         esac
16968         ;;
16969 *)      strerror_r_proto=0
16970         ;;
16971 esac
16972
16973 : see if strftime exists
16974 set strftime d_strftime
16975 eval $inlibc
16976
16977 : see if strlcat exists
16978 set strlcat d_strlcat
16979 eval $inlibc
16980
16981 : see if strlcpy exists
16982 set strlcpy d_strlcpy
16983 eval $inlibc
16984
16985 : see if strtod exists
16986 set strtod d_strtod
16987 eval $inlibc
16988
16989 : see if strtol exists
16990 set strtol d_strtol
16991 eval $inlibc
16992
16993 : see if strtold exists
16994 set strtold d_strtold
16995 eval $inlibc
16996
16997 : see if strtoll exists
16998 set strtoll d_strtoll
16999 eval $inlibc
17000
17001 case "$d_longlong-$d_strtoll" in
17002 "$define-$define")
17003         $cat <<EOM
17004 Checking whether your strtoll() works okay...
17005 EOM
17006         $cat >try.c <<'EOCP'
17007 #include <errno.h>
17008 #ifdef __hpux
17009 #define strtoll __strtoll
17010 #endif
17011 #ifdef __EMX__
17012 #define strtoll _strtoll
17013 #endif
17014 #include <stdio.h>
17015 extern long long int strtoll(char *s, char **, int); 
17016 static int bad = 0;
17017 int check(char *s, long long ell, int een) {
17018         long long gll;
17019         errno = 0;
17020         gll = strtoll(s, 0, 10);
17021         if (!((gll == ell) && (errno == een)))
17022                 bad++;
17023 }
17024 int main() {
17025         check(" 1",                                      1LL, 0);
17026         check(" 0",                                      0LL, 0);
17027         check("-1",                                     -1LL, 0);
17028         check("-9223372036854775808", -9223372036854775808LL, 0);
17029         check("-9223372036854775808", -9223372036854775808LL, 0);
17030         check(" 9223372036854775807",  9223372036854775807LL, 0);
17031         check("-9223372036854775808", -9223372036854775808LL, 0);
17032         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17033         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17034         if (!bad)
17035                 printf("ok\n");
17036 }
17037 EOCP
17038         set try
17039         if eval $compile; then
17040                 yyy=`$run ./try`
17041                 case "$yyy" in
17042                 ok) echo "Your strtoll() seems to be working okay." ;;
17043                 *) cat <<EOM >&4
17044 Your strtoll() doesn't seem to be working okay.
17045 EOM
17046                    d_strtoll="$undef"
17047                    ;;
17048                 esac
17049         else
17050                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17051                 d_strtoll="$undef"
17052         fi
17053         ;;
17054 esac
17055
17056 : see if strtoq exists
17057 set strtoq d_strtoq
17058 eval $inlibc
17059
17060 : see if strtoul exists
17061 set strtoul d_strtoul
17062 eval $inlibc
17063
17064 case "$d_strtoul" in
17065 "$define")
17066         $cat <<EOM
17067 Checking whether your strtoul() works okay...
17068 EOM
17069         $cat >try.c <<'EOCP'
17070 #include <errno.h>
17071 #include <stdio.h>
17072 extern unsigned long int strtoul(char *s, char **, int); 
17073 static int bad = 0;
17074 void check(char *s, unsigned long eul, int een) {
17075         unsigned long gul;
17076         errno = 0;
17077         gul = strtoul(s, 0, 10);
17078         if (!((gul == eul) && (errno == een)))
17079                 bad++;
17080 }
17081 int main() {
17082         check(" 1", 1L, 0);
17083         check(" 0", 0L, 0);
17084 EOCP
17085         case "$longsize" in
17086         8)
17087             $cat >>try.c <<'EOCP'
17088         check("18446744073709551615", 18446744073709551615UL, 0);
17089         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17090 #if 0 /* strtoul() for /^-/ strings is undefined. */
17091         check("-1", 18446744073709551615UL, 0);
17092         check("-18446744073709551614", 2, 0);
17093         check("-18446744073709551615", 1, 0);
17094         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17095         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17096 #endif
17097 EOCP
17098                 ;;
17099         4)
17100                     $cat >>try.c <<'EOCP'
17101         check("4294967295", 4294967295UL, 0);
17102         check("4294967296", 4294967295UL, ERANGE);
17103 #if 0 /* strtoul() for /^-/ strings is undefined. */
17104         check("-1", 4294967295UL, 0);
17105         check("-4294967294", 2, 0);
17106         check("-4294967295", 1, 0);
17107         check("-4294967296", 4294967295UL, ERANGE);
17108         check("-4294967297", 4294967295UL, ERANGE);
17109 #endif
17110 EOCP
17111                 ;;
17112         *)
17113 : Should we write these tests to be more portable by sprintf-ing
17114 : ~0 and then manipulating that char string as input for strtol?
17115                 ;;
17116         esac
17117         $cat >>try.c <<'EOCP'
17118         if (!bad)
17119                 printf("ok\n");
17120         return 0;
17121 }
17122 EOCP
17123         set try
17124         if eval $compile; then
17125                 case "`$run ./try`" in
17126                 ok) echo "Your strtoul() seems to be working okay." ;;
17127                 *) cat <<EOM >&4
17128 Your strtoul() doesn't seem to be working okay.
17129 EOM
17130                    d_strtoul="$undef"
17131                    ;;
17132                 esac
17133         fi
17134         ;;
17135 esac
17136
17137 : see if strtoull exists
17138 set strtoull d_strtoull
17139 eval $inlibc
17140
17141 case "$d_longlong-$d_strtoull" in
17142 "$define-$define")
17143         $cat <<EOM
17144 Checking whether your strtoull() works okay...
17145 EOM
17146         $cat >try.c <<'EOCP'
17147 #include <errno.h>
17148 #ifdef __hpux
17149 #define strtoull __strtoull
17150 #endif
17151 #include <stdio.h>
17152 extern unsigned long long int strtoull(char *s, char **, int); 
17153 static int bad = 0;
17154 int check(char *s, long long eull, int een) {
17155         long long gull;
17156         errno = 0;
17157         gull = strtoull(s, 0, 10);
17158         if (!((gull == eull) && (errno == een)))
17159                 bad++;
17160 }
17161 int main() {
17162         check(" 1",                                        1LL, 0);
17163         check(" 0",                                        0LL, 0);
17164         check("18446744073709551615",  18446744073709551615ULL, 0);
17165         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17166 #if 0 /* strtoull() for /^-/ strings is undefined. */
17167         check("-1",                    18446744073709551615ULL, 0);
17168         check("-18446744073709551614",                     2LL, 0);
17169         check("-18446744073709551615",                     1LL, 0);
17170         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17171         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17172 #endif
17173         if (!bad)
17174                 printf("ok\n");
17175 }
17176 EOCP
17177         set try
17178         if eval $compile; then
17179                 case "`$run ./try`" in
17180                 ok) echo "Your strtoull() seems to be working okay." ;;
17181                 *) cat <<EOM >&4
17182 Your strtoull() doesn't seem to be working okay.
17183 EOM
17184                    d_strtoull="$undef"
17185                    ;;
17186                 esac
17187         fi
17188         ;;
17189 esac
17190
17191 : see if strtouq exists
17192 set strtouq d_strtouq
17193 eval $inlibc
17194
17195 case "$d_strtouq" in
17196 "$define")
17197         $cat <<EOM
17198 Checking whether your strtouq() works okay...
17199 EOM
17200         $cat >try.c <<'EOCP'
17201 #include <errno.h>
17202 #include <stdio.h>
17203 extern unsigned long long int strtouq(char *s, char **, int); 
17204 static int bad = 0;
17205 void check(char *s, unsigned long long eull, int een) {
17206         unsigned long long gull;
17207         errno = 0;
17208         gull = strtouq(s, 0, 10);
17209         if (!((gull == eull) && (errno == een)))
17210                 bad++;
17211 }
17212 int main() {
17213         check(" 1",                                        1LL, 0);
17214         check(" 0",                                        0LL, 0);
17215         check("18446744073709551615",  18446744073709551615ULL, 0);
17216         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17217 #if 0 /* strtouq() for /^-/ strings is undefined. */
17218         check("-1",                    18446744073709551615ULL, 0);
17219         check("-18446744073709551614",                     2LL, 0);
17220         check("-18446744073709551615",                     1LL, 0);
17221         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17222         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17223 #endif
17224         if (!bad)
17225                 printf("ok\n");
17226         return 0;
17227 }
17228 EOCP
17229         set try
17230         if eval $compile; then
17231                 case "`$run ./try`" in
17232                 ok) echo "Your strtouq() seems to be working okay." ;;
17233                 *) cat <<EOM >&4
17234 Your strtouq() doesn't seem to be working okay.
17235 EOM
17236                    d_strtouq="$undef"
17237                    ;;
17238                 esac
17239         fi
17240         ;;
17241 esac
17242
17243 : see if strxfrm exists
17244 set strxfrm d_strxfrm
17245 eval $inlibc
17246
17247 : see if symlink exists
17248 set symlink d_symlink
17249 eval $inlibc
17250
17251 : see if syscall exists
17252 set syscall d_syscall
17253 eval $inlibc
17254
17255 : see if prototype for syscall is available
17256 echo " "
17257 set d_syscallproto syscall $i_unistd unistd.h
17258 eval $hasproto
17259
17260 : see if sysconf exists
17261 set sysconf d_sysconf
17262 eval $inlibc
17263
17264 : see if system exists
17265 set system d_system
17266 eval $inlibc
17267
17268 : see if tcgetpgrp exists
17269 set tcgetpgrp d_tcgetpgrp
17270 eval $inlibc
17271
17272 : see if tcsetpgrp exists
17273 set tcsetpgrp d_tcsetpgrp
17274 eval $inlibc
17275
17276 : see if prototype for telldir is available
17277 echo " "
17278 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17279 eval $hasproto
17280
17281 : see if time exists
17282 echo " "
17283 if test "X$d_time" = X -o X"$timetype" = X; then
17284     if set time val -f d_time; eval $csym; $val; then
17285                 echo 'time() found.' >&4
17286                 val="$define"
17287                 rp="What is the type returned by time() on this system?"
17288                 set time_t timetype long stdio.h sys/types.h
17289                 eval $typedef_ask
17290     else
17291                 echo 'time() not found, hope that will do.' >&4
17292                 val="$undef"
17293                 timetype='int';
17294     fi
17295     set d_time
17296     eval $setvar
17297 fi
17298
17299 : see if this is a sys/times.h system
17300 set sys/times.h i_systimes
17301 eval $inhdr
17302
17303 : see if times exists
17304 echo " "
17305 if set times val -f d_times; eval $csym; $val; then
17306         echo 'times() found.' >&4
17307         d_times="$define"
17308         inc=''
17309         case "$i_systimes" in
17310         "$define") inc='sys/times.h';;
17311         esac
17312         rp="What is the type returned by times() on this system?"
17313         set clock_t clocktype long stdio.h sys/types.h $inc
17314         eval $typedef_ask
17315 else
17316         echo 'times() NOT found, hope that will do.' >&4
17317         d_times="$undef"
17318         clocktype='int'
17319 fi
17320
17321 : see if tmpnam_r exists
17322 set tmpnam_r d_tmpnam_r
17323 eval $inlibc
17324 case "$d_tmpnam_r" in
17325 "$define")
17326         hdrs="$i_systypes sys/types.h define stdio.h "
17327         case "$d_tmpnam_r_proto:$usethreads" in
17328         ":define")      d_tmpnam_r_proto=define
17329                 set d_tmpnam_r_proto tmpnam_r $hdrs
17330                 eval $hasproto ;;
17331         *)      ;;
17332         esac
17333         case "$d_tmpnam_r_proto" in
17334         define)
17335         case "$tmpnam_r_proto" in
17336         ''|0) try='char* tmpnam_r(char*);'
17337         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17338         esac
17339         case "$tmpnam_r_proto" in
17340         ''|0)   d_tmpnam_r=undef
17341                 tmpnam_r_proto=0
17342                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17343         * )     case "$tmpnam_r_proto" in
17344                 REENTRANT_PROTO*) ;;
17345                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17346                 esac
17347                 echo "Prototype: $try" ;;
17348         esac
17349         ;;
17350         *)      case "$usethreads" in
17351                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17352                 esac
17353                 d_tmpnam_r=undef
17354                 tmpnam_r_proto=0
17355                 ;;
17356         esac
17357         ;;
17358 *)      tmpnam_r_proto=0
17359         ;;
17360 esac
17361
17362 : see if truncate exists
17363 set truncate d_truncate
17364 eval $inlibc
17365
17366 : see if ttyname_r exists
17367 set ttyname_r d_ttyname_r
17368 eval $inlibc
17369 case "$d_ttyname_r" in
17370 "$define")
17371         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17372         case "$d_ttyname_r_proto:$usethreads" in
17373         ":define")      d_ttyname_r_proto=define
17374                 set d_ttyname_r_proto ttyname_r $hdrs
17375                 eval $hasproto ;;
17376         *)      ;;
17377         esac
17378         case "$d_ttyname_r_proto" in
17379         define)
17380         case "$ttyname_r_proto" in
17381         ''|0) try='int ttyname_r(int, char*, size_t);'
17382         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17383         esac
17384         case "$ttyname_r_proto" in
17385         ''|0) try='int ttyname_r(int, char*, int);'
17386         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17387         esac
17388         case "$ttyname_r_proto" in
17389         ''|0) try='char* ttyname_r(int, char*, int);'
17390         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17391         esac
17392         case "$ttyname_r_proto" in
17393         ''|0)   d_ttyname_r=undef
17394                 ttyname_r_proto=0
17395                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17396         * )     case "$ttyname_r_proto" in
17397                 REENTRANT_PROTO*) ;;
17398                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17399                 esac
17400                 echo "Prototype: $try" ;;
17401         esac
17402         ;;
17403         *)      case "$usethreads" in
17404                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17405                 esac
17406                 d_ttyname_r=undef
17407                 ttyname_r_proto=0
17408                 ;;
17409         esac
17410         ;;
17411 *)      ttyname_r_proto=0
17412         ;;
17413 esac
17414
17415 : see if tzname[] exists
17416 echo " "
17417 if set tzname val -a d_tzname; eval $csym; $val; then
17418         val="$define"
17419         echo 'tzname[] found.' >&4
17420 else
17421         val="$undef"
17422         echo 'tzname[] NOT found.' >&4
17423 fi
17424 set d_tzname
17425 eval $setvar
17426
17427 case "$osname" in
17428 next|rhapsody|darwin) multiarch="$define" ;;
17429 esac
17430 case "$multiarch" in
17431 ''|[nN]*) multiarch="$undef" ;;
17432 esac
17433
17434 : check for ordering of bytes in a UV
17435 echo " "
17436 case "$usecrosscompile$multiarch" in
17437 *$define*)
17438         $cat <<EOM
17439 You seem to be either cross-compiling or doing a multiarchitecture build,
17440 skipping the byteorder check.
17441
17442 EOM
17443         byteorder='ffff'
17444         ;;
17445 *)
17446         case "$byteorder" in
17447         '')
17448                 $cat <<'EOM'
17449 In the following, larger digits indicate more significance.  A big-endian
17450 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17451 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17452 machines may have weird orders like 3412.  A Cray will report 87654321,
17453 an Alpha will report 12345678. If the test program works the default is
17454 probably right.
17455 I'm now running the test program...
17456 EOM
17457                 $cat >try.c <<EOCP
17458 #include <stdio.h>
17459 #$i_stdlib I_STDLIB
17460 #ifdef I_STDLIB
17461 #include <stdlib.h>
17462 #endif
17463 #include <sys/types.h>
17464 typedef $uvtype UV;
17465 int main()
17466 {
17467         int i;
17468         union {
17469                 UV l;
17470                 char c[$uvsize];
17471         } u;
17472
17473         if ($uvsize > 4)
17474                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17475         else
17476                 u.l = (UV)0x04030201;
17477         for (i = 0; i < $uvsize; i++)
17478                 printf("%c", u.c[i]+'0');
17479         printf("\n");
17480         exit(0);
17481 }
17482 EOCP
17483                 xxx_prompt=y
17484                 set try
17485                 if eval $compile && ./try > /dev/null; then
17486                         dflt=`$run ./try`
17487                         case "$dflt" in
17488                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17489                                 echo "(The test program ran ok.)"
17490                                 echo "byteorder=$dflt"
17491                                 xxx_prompt=n
17492                         ;;
17493                         ????|????????) echo "(The test program ran ok.)" ;;
17494                         *) echo "(The test program didn't run right for some reason.)" ;;
17495                         esac
17496                 else
17497                         dflt='4321'
17498                         cat <<'EOM'
17499 (I can't seem to compile the test program.  Guessing big-endian...)
17500 EOM
17501                 fi
17502                 case "$xxx_prompt" in
17503                 y)
17504                         rp="What is the order of bytes in $uvtype?"
17505                         . ./myread
17506                         byteorder="$ans"
17507                         ;;
17508                 *)      byteorder=$dflt
17509                         ;;
17510                 esac
17511                 ;;
17512         esac
17513         $rm -f try.c try
17514         ;;
17515 esac
17516
17517
17518 $cat <<EOM
17519
17520 Checking to see whether you can access character data unalignedly...
17521 EOM
17522 case "$d_u32align" in
17523 '')   $cat >try.c <<EOCP
17524 #include <stdio.h>
17525 #$i_stdlib I_STDLIB
17526 #ifdef I_STDLIB
17527 #include <stdlib.h>
17528 #endif
17529 #define U32 $u32type
17530 #define BYTEORDER 0x$byteorder
17531 #define U8 $u8type
17532 #include <signal.h>
17533 #ifdef SIGBUS
17534 $signal_t bletch(s) int s; { exit(4); }
17535 #endif
17536 int main() {
17537 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17538     U8 buf[8];
17539     U32 *up;
17540     int i;
17541
17542     if (sizeof(U32) != 4) {
17543         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17544         exit(1);
17545     }
17546
17547     fflush(stdout);
17548
17549 #ifdef SIGBUS
17550     signal(SIGBUS, bletch);
17551 #endif
17552
17553     buf[0] = 0;
17554     buf[1] = 0;
17555     buf[2] = 0;
17556     buf[3] = 1;
17557     buf[4] = 0;
17558     buf[5] = 0;
17559     buf[6] = 0;
17560     buf[7] = 1;
17561
17562     for (i = 0; i < 4; i++) {
17563         up = (U32*)(buf + i);
17564         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17565                (*up == 1 << (8*(3-i)))  /* little-endian */
17566               )
17567            )
17568         {
17569             printf("read failed (%x)\n", *up);
17570             exit(2);
17571         }
17572     }
17573
17574     /* write test */
17575     for (i = 0; i < 4; i++) {
17576         up = (U32*)(buf + i);
17577         *up = 0xBeef;
17578         if (*up != 0xBeef) {
17579             printf("write failed (%x)\n", *up);
17580             exit(3);
17581         }
17582     }
17583
17584     exit(0);
17585 #else
17586     printf("1\n");
17587     exit(1);
17588 #endif
17589     return 0;
17590 }
17591 EOCP
17592 set try
17593 if eval $compile_ok; then
17594         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17595         $run ./try 2>&1 >/dev/null
17596         case "$?" in
17597         0)      cat >&4 <<EOM
17598 You can access character data pretty unalignedly.
17599 EOM
17600                 d_u32align="$undef"
17601                 ;;
17602         *)      cat >&4 <<EOM
17603 It seems that you must access character data in an aligned manner.
17604 EOM
17605                 d_u32align="$define"
17606                 ;;
17607         esac
17608 else
17609         rp='Can you access character data at unaligned addresses?'
17610         dflt='n'
17611         . ./myread
17612         case "$ans" in
17613         [yY]*)  d_u32align="$undef"  ;;
17614         *)      d_u32align="$define" ;;
17615         esac
17616 fi
17617 $rm -f core core.try.* try.core
17618 ;;
17619 esac
17620
17621 : see if ualarm exists
17622 set ualarm d_ualarm
17623 eval $inlibc
17624
17625 : see if umask exists
17626 set umask d_umask
17627 eval $inlibc
17628
17629 : see if unordered exists
17630 set unordered d_unordered
17631 eval $inlibc
17632
17633 : see if unsetenv exists
17634 set unsetenv d_unsetenv
17635 eval $inlibc
17636
17637 : see if usleep exists
17638 set usleep d_usleep
17639 eval $inlibc
17640
17641 : see if prototype for usleep is available
17642 echo " "
17643 set d_usleepproto usleep $i_unistd unistd.h
17644 eval $hasproto
17645
17646 : see if ustat exists
17647 set ustat d_ustat
17648 eval $inlibc
17649
17650 : backward compatibility for d_hvfork
17651 if test X$d_hvfork != X; then
17652         d_vfork="$d_hvfork"
17653         d_hvfork=''
17654 fi
17655 : see if there is a vfork
17656 val=''
17657 set vfork val
17658 eval $inlibc
17659
17660 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17661 : perl on Solaris 2.x, and probably elsewhere.
17662 case "$val" in
17663 $define)
17664         echo " "
17665         case "$usevfork" in
17666         false) dflt='n';;
17667         *) dflt='y';;
17668         esac
17669         cat <<'EOM'
17670  
17671 Perl can only use a vfork() that doesn't suffer from strict
17672 restrictions on calling functions or modifying global data in
17673 the child.  For example, glibc-2.1 contains such a vfork()
17674 that is unsuitable.  If your system provides a proper fork()
17675 call, chances are that you do NOT want perl to use vfork().
17676
17677 EOM
17678         rp="Do you still want to use vfork()?"
17679         . ./myread
17680         case "$ans" in
17681         y|Y) ;;
17682         *)
17683                 echo "Ok, we won't use vfork()."
17684                 val="$undef"
17685                 ;;
17686         esac
17687         ;;
17688 esac
17689 set d_vfork
17690 eval $setvar
17691 case "$d_vfork" in
17692 $define) usevfork='true';;
17693 *) usevfork='false';;
17694 esac
17695
17696 : see if closedir exists
17697 set closedir d_closedir
17698 eval $inlibc
17699
17700 case "$d_closedir" in
17701 "$define")
17702         echo " "
17703         echo "Checking whether closedir() returns a status..." >&4
17704         cat > try.c <<EOM
17705 #$i_dirent I_DIRENT             /**/
17706 #$i_sysdir I_SYS_DIR            /**/
17707 #$i_sysndir I_SYS_NDIR          /**/
17708 #$i_systypes I_SYS_TYPES        /**/
17709
17710 #if defined(I_SYS_TYPES)
17711 #include <sys/types.h>
17712 #endif
17713 #if defined(I_DIRENT)
17714 #include <dirent.h>
17715 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17716 #include <sys/dir.h>
17717 #endif
17718 #else
17719 #ifdef I_SYS_NDIR
17720 #include <sys/ndir.h>
17721 #else
17722 #ifdef I_SYS_DIR
17723 #ifdef hp9000s500
17724 #include <ndir.h>       /* may be wrong in the future */
17725 #else
17726 #include <sys/dir.h>
17727 #endif
17728 #endif
17729 #endif
17730 #endif 
17731 int main() { return closedir(opendir(".")); }
17732 EOM
17733         set try
17734         if eval $compile_ok; then
17735                 if $run ./try > /dev/null 2>&1 ; then
17736                         echo "Yes, it does."
17737                         val="$undef"
17738                 else
17739                         echo "No, it doesn't."
17740                         val="$define"
17741                 fi
17742         else
17743                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17744                 val="$define"
17745         fi
17746         ;;
17747 *)
17748         val="$undef";
17749         ;;
17750 esac
17751 set d_void_closedir
17752 eval $setvar
17753 $rm -f try try.*
17754 : see if there is a wait4
17755 set wait4 d_wait4
17756 eval $inlibc
17757
17758 : see if waitpid exists
17759 set waitpid d_waitpid
17760 eval $inlibc
17761
17762 : see if wcstombs exists
17763 set wcstombs d_wcstombs
17764 eval $inlibc
17765
17766 : see if wctomb exists
17767 set wctomb d_wctomb
17768 eval $inlibc
17769
17770 : see if writev exists
17771 set writev d_writev
17772 eval $inlibc
17773
17774 : preserve RCS keywords in files with variable substitution, grrr
17775 Date='$Date'
17776 Id='$Id'
17777 Log='$Log'
17778 RCSfile='$RCSfile'
17779 Revision='$Revision'
17780
17781 : check for alignment requirements
17782 echo " "
17783 case "$usecrosscompile$multiarch" in
17784 *$define*)
17785         $cat <<EOM
17786 You seem to be either cross-compiling or doing a multiarchitecture build,
17787 skipping the memory alignment check.
17788
17789 EOM
17790         case "$alignbytes" in
17791         '') alignbytes=8 ;;
17792         esac
17793         ;;
17794 *)
17795         case "$alignbytes" in
17796         '') echo "Checking alignment constraints..." >&4
17797                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17798                         $cat >try.c <<'EOCP'
17799 typedef long double NV;
17800 EOCP
17801                 else
17802                         $cat >try.c <<'EOCP'
17803 typedef double NV;
17804 EOCP
17805                 fi
17806                 $cat >>try.c <<'EOCP'
17807 #include <stdio.h>
17808 struct foobar {
17809         char foo;
17810         NV bar;
17811 } try_algn;
17812 int main()
17813 {
17814     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17815     return(0);
17816 }
17817 EOCP
17818                 set try
17819                 if eval $compile_ok; then
17820                         dflt=`$run ./try`
17821                 else
17822                         dflt='8'
17823                         echo "(I can't seem to compile the test program...)"
17824                 fi
17825                 ;;
17826         *) dflt="$alignbytes"
17827                 ;;
17828         esac
17829         rp="Doubles must be aligned on a how-many-byte boundary?"
17830         . ./myread
17831         alignbytes="$ans"
17832         $rm -f try.c try
17833         ;;
17834 esac
17835
17836
17837 : set the base revision
17838 baserev=5.0
17839
17840 : how do we concatenate cpp tokens here?
17841 echo " "
17842 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17843 $cat >cpp_stuff.c <<'EOCP'
17844 #define RCAT(a,b)a/**/b
17845 #define ACAT(a,b)a ## b
17846 RCAT(Rei,ser)
17847 ACAT(Cir,cus)
17848 EOCP
17849 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17850 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17851         echo "Oh!  Smells like ANSI's been here." >&4
17852         echo "We can catify or stringify, separately or together!"
17853         cpp_stuff=42
17854 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17855         echo "Ah, yes!  The good old days!" >&4
17856         echo "However, in the good old days we don't know how to stringify and"
17857         echo "catify at the same time."
17858         cpp_stuff=1
17859 else
17860         $cat >&4 <<EOM
17861 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17862 You're going to have to edit the values of CAT[2-5] in config.h...
17863 EOM
17864         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17865 fi
17866 $rm -f cpp_stuff.*
17867
17868 : see if this is a db.h system
17869 set db.h i_db
17870 eval $inhdr
17871
17872 case "$i_db" in
17873 $define)
17874         : Check db version.
17875         echo " "
17876         echo "Checking Berkeley DB version ..." >&4
17877         $cat >try.c <<EOCP
17878 #$d_const HASCONST
17879 #ifndef HASCONST
17880 #define const
17881 #endif
17882 #include <sys/types.h>
17883 #include <stdio.h>
17884 #$i_stdlib I_STDLIB
17885 #ifdef I_STDLIB
17886 #include <stdlib.h>
17887 #endif
17888 #include <db.h>
17889 int main(int argc, char *argv[])
17890 {
17891 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17892     int Major, Minor, Patch ;
17893     unsigned long Version ;
17894     (void)db_version(&Major, &Minor, &Patch) ;
17895     if (argc == 2) {
17896         printf("%d %d %d %d %d %d\n",
17897                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17898                Major, Minor, Patch);
17899         exit(0);
17900     }
17901     printf("You have Berkeley DB Version 2 or greater.\n");
17902
17903     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17904                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17905     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17906                 Major, Minor, Patch) ;
17907
17908     /* check that db.h & libdb are compatible */
17909     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17910         printf("db.h and libdb are incompatible.\n") ;
17911         exit(3);        
17912     }
17913
17914     printf("db.h and libdb are compatible.\n") ;
17915
17916     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17917                 + DB_VERSION_PATCH ;
17918
17919     /* needs to be >= 2.3.4 */
17920     if (Version < 2003004) {
17921     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17922         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17923         exit(2);        
17924     }
17925
17926     exit(0);
17927 #else
17928 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17929     if (argc == 2) {
17930         printf("1 0 0\n");
17931         exit(0);
17932     }
17933     printf("You have Berkeley DB Version 1.\n");
17934     exit(0);    /* DB version < 2: the coast is clear. */
17935 #else
17936     exit(1);    /* <db.h> not Berkeley DB? */
17937 #endif
17938 #endif
17939 }
17940 EOCP
17941         set try
17942         if eval $compile_ok && $run ./try; then
17943                 echo 'Looks OK.' >&4
17944                 set `$run ./try 1`
17945                 db_version_major=$1
17946                 db_version_minor=$2
17947                 db_version_patch=$3
17948         else
17949                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17950                 i_db=$undef
17951                 case " $libs " in
17952                 *"-ldb "*)
17953                         : Remove db from list of libraries to use
17954                         echo "Removing unusable -ldb from library list" >&4
17955                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17956                         shift
17957                         libs="$*"
17958                         echo "libs = $libs" >&4
17959                         ;;
17960                 esac
17961         fi
17962         $rm -f try.*
17963         ;;
17964 esac
17965
17966 case "$i_db" in
17967 define)
17968         : Check the return type needed for hash 
17969         echo " "
17970         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17971         $cat >try.c <<EOCP
17972 #$d_const HASCONST
17973 #ifndef HASCONST
17974 #define const
17975 #endif
17976 #include <sys/types.h>
17977 #include <db.h>
17978
17979 #ifndef DB_VERSION_MAJOR
17980 u_int32_t hash_cb (ptr, size)
17981 const void *ptr;
17982 size_t size;
17983 {
17984 }
17985 HASHINFO info;
17986 int main()
17987 {
17988         info.hash = hash_cb;
17989 }
17990 #endif
17991 EOCP
17992         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17993                 if $contains warning try.out >>/dev/null 2>&1 ; then
17994                         db_hashtype='int'
17995                 else
17996                         db_hashtype='u_int32_t'
17997                 fi
17998         else
17999                 : XXX Maybe we should just give up here.
18000                 db_hashtype=u_int32_t
18001                 $cat try.out >&4
18002                 echo "Help:  I can't seem to compile the db test program." >&4
18003                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18004         fi
18005         $rm -f try.*
18006         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18007         ;;
18008 *)      db_hashtype=u_int32_t
18009         ;;
18010 esac
18011 case "$i_db" in
18012 define)
18013         : Check the return type needed for prefix 
18014         echo " "
18015         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18016         cat >try.c <<EOCP
18017 #$d_const HASCONST
18018 #ifndef HASCONST
18019 #define const
18020 #endif
18021 #include <sys/types.h>
18022 #include <db.h>
18023
18024 #ifndef DB_VERSION_MAJOR
18025 size_t prefix_cb (key1, key2)
18026 const DBT *key1;
18027 const DBT *key2;
18028 {
18029 }
18030 BTREEINFO info;
18031 int main()
18032 {
18033         info.prefix = prefix_cb;
18034 }
18035 #endif
18036 EOCP
18037         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18038                 if $contains warning try.out >>/dev/null 2>&1 ; then
18039                         db_prefixtype='int'
18040                 else
18041                         db_prefixtype='size_t'
18042                 fi
18043         else
18044                 db_prefixtype='size_t'
18045                 : XXX Maybe we should just give up here.
18046                 $cat try.out >&4
18047                 echo "Help:  I can't seem to compile the db test program." >&4
18048                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18049         fi
18050         $rm -f try.*
18051         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18052         ;;
18053 *)      db_prefixtype='size_t'
18054         ;;
18055 esac
18056
18057
18058 : How can we generate normalized random numbers ?
18059 echo " "
18060 echo "Looking for a random number function..." >&4
18061 case "$randfunc" in
18062 '')
18063         if set drand48 val -f; eval $csym; $val; then
18064                 dflt="drand48"
18065                 echo "Good, found drand48()." >&4
18066         elif set random val -f; eval $csym; $val; then
18067                 dflt="random"
18068                 echo "OK, found random()." >&4
18069         else
18070                 dflt="rand"
18071                 echo "Yick, looks like I have to use rand()." >&4
18072         fi
18073         echo " "
18074         ;;
18075 *)
18076         dflt="$randfunc"
18077         ;;
18078 esac
18079 cont=true
18080
18081 case "$ccflags" in
18082 *-Dmy_rand=*|*-Dmy_srand=*)
18083         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18084         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18085         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18086         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18087         ;;
18088 esac
18089
18090 while $test "$cont"; do
18091         rp="Use which function to generate random numbers?"
18092         . ./myread
18093         if $test "$ans" = "$dflt"; then
18094                 : null
18095         else
18096                 randbits=''
18097         fi
18098         randfunc="$ans"
18099         if set $ans val -f; eval $csym; $val; then
18100                 cont=''
18101         else
18102                 dflt=y
18103                 rp="I cannot find function $ans. Use that name anyway?"
18104                 . ./myread
18105                 dflt=rand
18106                 case "$ans" in
18107                         [yY]*) cont='';;
18108                 esac
18109         fi
18110         case "$cont" in
18111         '')
18112                 case "$randfunc" in
18113                 drand48)
18114                         drand01="drand48()"
18115                         seedfunc="srand48"
18116                         randbits=48
18117                         randseedtype=long
18118                         ;;
18119                 rand|random)
18120                         case "$randbits" in
18121                         '')
18122 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18123                                 $cat >try.c <<EOCP
18124 #$i_unistd I_UNISTD
18125 #$i_stdlib I_STDLIB
18126 #include <stdio.h>
18127 #ifdef I_UNISTD
18128 #  include <unistd.h>
18129 #endif
18130 #ifdef I_STDLIB
18131 #  include <stdlib.h>
18132 #endif
18133 int main()
18134 {
18135         register int i;
18136         register unsigned long tmp;
18137         register unsigned long max = 0L;
18138
18139         for (i = 1000; i; i--) {
18140                 tmp = (unsigned long) $randfunc();
18141                 if (tmp > max) max = tmp;
18142         }
18143         for (i = 0; max; i++)
18144                 max /= 2;
18145         printf("%d\n",i);
18146 }
18147 EOCP
18148                                 set try
18149                                 if eval $compile_ok; then
18150                                         dflt=`try`
18151                                 else
18152                                         dflt='?'
18153                                         echo "(I can't seem to compile the test program...)"
18154                                 fi
18155                                 ;;
18156                         *)
18157                                 dflt="$randbits"
18158                                 ;;
18159                         esac
18160                         rp="How many bits does your $randfunc() function produce?"
18161                         . ./myread
18162                         randbits="$ans"
18163                         $rm -f try.c try
18164                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18165                         seedfunc="s$randfunc"
18166                         randseedtype=unsigned
18167                         ;;
18168                 *)
18169                         dflt="31"
18170                         rp="How many bits does your $randfunc() function produce?"
18171                         . ./myread
18172                         randbits="$ans"
18173                         seedfunc="s$randfunc"
18174                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18175                         if set $seedfunc val -f; eval $csym; $val; then
18176                                 echo "(Using $seedfunc() to seed random generator)"
18177                         else
18178                                 echo "(Warning: no $seedfunc() to seed random generator)"
18179                                 seedfunc=rand
18180                         fi
18181                         randseedtype=unsigned
18182                         ;;
18183                 esac
18184                 ;;
18185         esac
18186 done
18187
18188 echo " "
18189 echo "Determining whether or not we are on an EBCDIC system..." >&4
18190 $cat >try.c <<'EOM'
18191 int main()
18192 {
18193   if ('M'==0xd4) return 0;
18194   return 1;
18195 }
18196 EOM
18197
18198 val=$undef
18199 set try
18200 if eval $compile_ok; then
18201         if $run ./try; then
18202                 echo "You seem to speak EBCDIC." >&4
18203                 val="$define"
18204         else
18205                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18206         fi
18207 else
18208         echo "I'm unable to compile the test program." >&4
18209         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18210 fi
18211 $rm -f try try.*
18212 set ebcdic
18213 eval $setvar
18214
18215 echo " "
18216 $cat >&4 <<EOM
18217 Checking how to flush all pending stdio output...
18218 EOM
18219 # I only know how to find the first 32 possibly open files on SunOS.
18220 # See also hints/sunos_4_1.sh and util.c  --AD
18221 case "$osname" in
18222 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18223 esac
18224 $cat >>try.c <<EOCP
18225 #include <stdio.h>
18226 #$i_stdlib I_STDLIB
18227 #ifdef I_STDLIB
18228 #include <stdlib.h>
18229 #endif
18230 #$i_unistd I_UNISTD
18231 #ifdef I_UNISTD
18232 # include <unistd.h>
18233 #endif
18234 #$d_sysconf HAS_SYSCONF
18235 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18236 #ifdef HAS_STDIO_STREAM_ARRAY
18237 # define STDIO_STREAM_ARRAY $stdio_stream_array
18238 #endif
18239 int main() {
18240   FILE* p;
18241   unlink("try.out");
18242   p = fopen("try.out", "w");
18243 #ifdef TRY_FPUTC
18244   fputc('x', p);
18245 #else
18246 # ifdef TRY_FPRINTF
18247   fprintf(p, "x");
18248 # endif
18249 #endif
18250 #ifdef TRY_FFLUSH_NULL
18251   fflush(NULL);
18252 #endif
18253 #ifdef TRY_FFLUSH_ALL
18254   {
18255     long open_max = -1;
18256 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18257     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18258 # else
18259 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18260     open_max = sysconf(_SC_OPEN_MAX);
18261 #  else
18262 #   ifdef FOPEN_MAX
18263     open_max = FOPEN_MAX;
18264 #   else
18265 #    ifdef OPEN_MAX
18266     open_max = OPEN_MAX;
18267 #    else
18268 #     ifdef _NFILE
18269     open_max = _NFILE;
18270 #     endif
18271 #    endif
18272 #   endif
18273 #  endif
18274 # endif 
18275 # ifdef HAS_STDIO_STREAM_ARRAY
18276     if (open_max > 0) {
18277       long i;
18278       for (i = 0; i < open_max; i++)
18279             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18280                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18281                 STDIO_STREAM_ARRAY[i]._flag)
18282                 fflush(&STDIO_STREAM_ARRAY[i]);
18283     }   
18284   }
18285 # endif
18286 #endif
18287   _exit(42);
18288 }
18289 EOCP
18290 : first we have to find out how _not_ to flush
18291 $to try.c
18292 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18293     output=''
18294     set try -DTRY_FPUTC
18295     if eval $compile; then
18296             $run ./try 2>/dev/null
18297             code="$?"
18298             $from try.out
18299             if $test ! -s try.out -a "X$code" = X42; then
18300                 output=-DTRY_FPUTC
18301             fi
18302     fi
18303     case "$output" in
18304     '')
18305             set try -DTRY_FPRINTF
18306             if eval $compile; then
18307                     $run ./try 2>/dev/null
18308                     code="$?"
18309                     $from try.out
18310                     if $test ! -s try.out -a "X$code" = X42; then
18311                         output=-DTRY_FPRINTF
18312                     fi
18313             fi
18314         ;;
18315     esac
18316 fi
18317 : check for fflush NULL behaviour
18318 case "$fflushNULL" in
18319 '')     set try -DTRY_FFLUSH_NULL $output
18320         if eval $compile; then
18321                 $run ./try 2>/dev/null
18322                 code="$?"
18323                 $from try.out
18324                 if $test -s try.out -a "X$code" = X42; then
18325                         fflushNULL="`$cat try.out`"
18326                 else
18327                         if $test "X$code" != X42; then
18328                                 $cat >&4 <<EOM
18329 (If this test failed, don't worry, we'll try another method shortly.)
18330 EOM
18331                         fi
18332                 fi
18333         fi
18334         $rm -f core try.core core.try.*
18335         case "$fflushNULL" in
18336         x)      $cat >&4 <<EOM
18337 Your fflush(NULL) works okay for output streams.
18338 Let's see if it clobbers input pipes...
18339 EOM
18340 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18341 # bug that improperly flushes the input end of pipes.  So we avoid the
18342 # autoflush on fork/system/exec support for now. :-(
18343 $cat >tryp.c <<EOCP
18344 #include <stdio.h>
18345 int
18346 main(int argc, char **argv)
18347 {
18348     char buf[1024];
18349     int i;
18350     char *bp = buf;
18351     while (1) {
18352         while ((i = getc(stdin)) != -1
18353                && (*bp++ = i) != '\n'
18354                && bp < &buf[1024])
18355         /* DO NOTHING */ ;
18356         *bp = '\0';
18357         fprintf(stdout, "%s", buf);
18358         fflush(NULL);
18359         if (i == -1)
18360             return 0;
18361         bp = buf;
18362     }
18363 }
18364 EOCP
18365                 fflushNULL="$define"
18366                 set tryp
18367                 if eval $compile; then
18368                     $rm -f tryp.out
18369                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18370                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18371                        $cat >&4 <<EOM
18372 fflush(NULL) seems to behave okay with input streams.
18373 EOM
18374                         fflushNULL="$define"
18375                     else
18376                         $cat >&4 <<EOM
18377 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18378 EOM
18379                         fflushNULL="$undef"
18380                     fi
18381                 fi
18382                 $rm -f core tryp.c tryp.core core.tryp.*
18383                 ;;
18384         '')     $cat >&4 <<EOM
18385 Your fflush(NULL) isn't working (contrary to ANSI C).
18386 EOM
18387                 fflushNULL="$undef"
18388                 ;;
18389         *)      $cat >&4 <<EOM
18390 Cannot figure out whether your fflush(NULL) works or not.
18391 I'm assuming it doesn't (contrary to ANSI C).
18392 EOM
18393                 fflushNULL="$undef"
18394                 ;;
18395         esac
18396         ;;
18397 $define|true|[yY]*)
18398         fflushNULL="$define"
18399         ;;
18400 *)
18401         fflushNULL="$undef"
18402         ;;
18403 esac
18404 : check explicit looping only if NULL did not work, and if the pipe
18405 : bug does not show up on an explicit flush too
18406 case "$fflushNULL" in
18407 "$undef")
18408         $cat >tryp.c <<EOCP
18409 #include <stdio.h>
18410 int
18411 main(int argc, char **argv)
18412 {
18413     char buf[1024];
18414     int i;
18415     char *bp = buf;
18416     while (1) {
18417         while ((i = getc(stdin)) != -1
18418                && (*bp++ = i) != '\n'
18419                && bp < &buf[1024])
18420         /* DO NOTHING */ ;
18421         *bp = '\0';
18422         fprintf(stdout, "%s", buf);
18423         fflush(stdin);
18424         if (i == -1)
18425             return 0;
18426         bp = buf;
18427     }
18428 }
18429 EOCP
18430         set tryp
18431         if eval $compile; then
18432             $rm -f tryp.out
18433             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18434             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18435                $cat >&4 <<EOM
18436 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18437 EOM
18438                 : now check for fflushall behaviour
18439                 case "$fflushall" in
18440                 '')     set try -DTRY_FFLUSH_ALL $output
18441                         if eval $compile; then
18442                                 $cat >&4 <<EOM
18443 (Now testing the other method--but note that this also may fail.)
18444 EOM
18445                                 $run ./try 2>/dev/null
18446                                 code=$?
18447                                 $from try.out
18448                                 if $test -s try.out -a "X$code" = X42; then
18449                                         fflushall="`$cat try.out`"
18450                                 fi
18451                         fi
18452                         $rm -f core try.core core.try.*
18453                         case "$fflushall" in
18454                         x)      $cat >&4 <<EOM
18455 Whew. Flushing explicitly all the stdio streams works.
18456 EOM
18457                                 fflushall="$define"
18458                                 ;;
18459                         '')     $cat >&4 <<EOM
18460 Sigh. Flushing explicitly all the stdio streams doesn't work.
18461 EOM
18462                                 fflushall="$undef"
18463                                 ;;
18464                         *)      $cat >&4 <<EOM
18465 Cannot figure out whether flushing stdio streams explicitly works or not.
18466 I'm assuming it doesn't.
18467 EOM
18468                                 fflushall="$undef"
18469                                 ;;
18470                         esac
18471                         ;;
18472                 "$define"|true|[yY]*)
18473                         fflushall="$define"
18474                         ;;
18475                 *)
18476                         fflushall="$undef"
18477                         ;;
18478                 esac
18479             else
18480                 $cat >&4 <<EOM
18481 All is futile.  Even fflush(stdin) clobbers input pipes!
18482 EOM
18483                 fflushall="$undef"
18484             fi
18485         else
18486             fflushall="$undef"
18487         fi
18488         $rm -f core tryp.c tryp.core core.tryp.*
18489         ;;
18490 *)      fflushall="$undef"
18491         ;;
18492 esac
18493
18494 case "$fflushNULL$fflushall" in
18495 undefundef)
18496         $cat <<EOM
18497 OK, I give up.  I cannot figure out how to flush pending stdio output.
18498 We won't be flushing handles at all before fork/exec/popen.
18499 EOM
18500         ;;
18501 esac
18502 $rm -f try.* try$exe_ext
18503
18504 : Store the full pathname to the ar program for use in the C program
18505 : Respect a hint or command line value for full_ar.
18506 case "$full_ar" in
18507 '') full_ar=$ar ;;
18508 esac
18509
18510 : Store the full pathname to the sed program for use in the C program
18511 full_sed=$sed
18512
18513 : see what type gids are declared as in the kernel
18514 echo " "
18515 echo "Looking for the type for group ids returned by getgid()."
18516 set gid_t gidtype xxx stdio.h sys/types.h
18517 eval $typedef
18518 case "$gidtype" in
18519 xxx)
18520         xxx=`./findhdr sys/user.h`
18521         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18522         case $1 in
18523         unsigned) dflt="$1 $2" ;;
18524         *) dflt="$1" ;;
18525         esac
18526         ;;
18527 *) dflt="$gidtype";;
18528 esac
18529 case "$gidtype" in
18530 gid_t) echo "gid_t found." ;;
18531 *)      rp="What is the type for group ids returned by getgid()?"
18532         . ./myread
18533         gidtype="$ans"
18534         ;;
18535 esac
18536
18537 echo " "
18538 case "$gidtype" in
18539 *_t) zzz="$gidtype"     ;;
18540 *)   zzz="gid"          ;;
18541 esac
18542 echo "Checking the size of $zzz..." >&4 
18543 cat > try.c <<EOCP
18544 #include <sys/types.h>
18545 #include <stdio.h>
18546 #$i_stdlib I_STDLIB
18547 #ifdef I_STDLIB
18548 #include <stdlib.h>
18549 #endif
18550 int main() {
18551     printf("%d\n", (int)sizeof($gidtype));
18552     exit(0);
18553 }
18554 EOCP
18555 set try
18556 if eval $compile_ok; then
18557         yyy=`$run ./try`
18558         case "$yyy" in
18559         '')     gidsize=4
18560                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18561                 ;;
18562         *)      gidsize=$yyy
18563                 echo "Your $zzz is $gidsize bytes long."
18564                 ;;
18565         esac
18566 else
18567         gidsize=4
18568         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18569 fi
18570
18571
18572 echo " "
18573 case "$gidtype" in
18574 *_t) zzz="$gidtype"     ;;
18575 *)   zzz="gid"          ;;
18576 esac
18577 echo "Checking the sign of $zzz..." >&4 
18578 cat > try.c <<EOCP
18579 #include <sys/types.h>
18580 #include <stdio.h>
18581 int main() {
18582         $gidtype foo = -1;
18583         if (foo < 0)
18584                 printf("-1\n");
18585         else
18586                 printf("1\n");
18587 }
18588 EOCP
18589 set try
18590 if eval $compile; then
18591         yyy=`$run ./try`
18592         case "$yyy" in
18593         '')     gidsign=1
18594                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18595                 ;;
18596         *)      gidsign=$yyy
18597                 case "$gidsign" in
18598                  1) echo "Your $zzz is unsigned." ;;
18599                 -1) echo "Your $zzz is signed."   ;;
18600                 esac
18601                 ;;
18602         esac
18603 else
18604         gidsign=1
18605         echo "(I can't compile the test program--guessing unsigned.)" >&4
18606 fi
18607
18608
18609 echo " "
18610
18611 if $test X"$quadtype" != X; then
18612
18613 echo "Checking how to print 64-bit integers..." >&4
18614
18615 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18616         $cat >try.c <<'EOCP'
18617 #include <sys/types.h>
18618 #include <stdio.h>
18619 int main() {
18620   int q = 12345678901;
18621   printf("%ld\n", q);
18622 }
18623 EOCP
18624         set try
18625         if eval $compile; then
18626                 yyy=`$run ./try`
18627                 case "$yyy" in
18628                 12345678901)
18629                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18630                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18631                         echo "We will use %d."
18632                         ;;
18633                 esac
18634         fi
18635 fi
18636
18637 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18638         $cat >try.c <<'EOCP'
18639 #include <sys/types.h>
18640 #include <stdio.h>
18641 int main() {
18642   long q = 12345678901;
18643   printf("%ld\n", q);
18644 }
18645 EOCP
18646         set try
18647         if eval $compile; then
18648                 yyy=`$run ./try`
18649                 case "$yyy" in
18650                 12345678901)
18651                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18652                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18653                         echo "We will use %ld."
18654                         ;;
18655                 esac
18656         fi
18657 fi
18658
18659 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18660         $cat >try.c <<'EOCP'
18661 #include <sys/types.h>
18662 #include <inttypes.h>
18663 #include <stdio.h>
18664 int main() {
18665   int64_t q = 12345678901;
18666   printf("%" PRId64 "\n", q);
18667 }
18668 EOCP
18669         set try
18670         if eval $compile; then
18671                 yyy=`$run ./try`
18672                 case "$yyy" in
18673                 12345678901)
18674                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18675                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18676                         echo "We will use the C9X style."
18677                         ;;
18678                 esac
18679         fi
18680 fi
18681
18682 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18683         $cat >try.c <<EOCP
18684 #include <sys/types.h>
18685 #include <stdio.h>
18686 int main() {
18687   $quadtype q = 12345678901;
18688   printf("%Ld\n", q);
18689 }
18690 EOCP
18691         set try
18692         if eval $compile; then
18693                 yyy=`$run ./try`
18694                 case "$yyy" in
18695                 12345678901)
18696                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18697                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18698                         echo "We will use %Ld."
18699                         ;;
18700                 esac
18701         fi
18702 fi
18703
18704 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18705         $cat >try.c <<'EOCP'
18706 #include <sys/types.h>
18707 #include <stdio.h>
18708 int main() {
18709   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18710   printf("%lld\n", q);
18711 }
18712 EOCP
18713         set try
18714         if eval $compile; then
18715                 yyy=`$run ./try`
18716                 case "$yyy" in
18717                 12345678901)
18718                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18719                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18720                         echo "We will use the %lld style."
18721                         ;;
18722                 esac
18723         fi
18724 fi
18725
18726 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18727         $cat >try.c <<EOCP
18728 #include <sys/types.h>
18729 #include <stdio.h>
18730 int main() {
18731   $quadtype q = 12345678901;
18732   printf("%qd\n", q);
18733 }
18734 EOCP
18735         set try
18736         if eval $compile; then
18737                 yyy=`$run ./try`
18738                 case "$yyy" in
18739                 12345678901)
18740                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18741                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18742                         echo "We will use %qd."
18743                         ;;
18744                 esac
18745         fi
18746 fi
18747
18748 if $test X"$sPRId64" = X; then
18749         echo "Cannot figure out how to print 64-bit integers." >&4
18750 fi
18751
18752 $rm -f try try.*
18753
18754 fi
18755
18756 case "$sPRId64" in
18757 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18758         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18759         ;;
18760 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18761         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18762         ;;
18763 esac
18764
18765
18766 echo " "
18767 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18768
18769 if $test X"$ivsize" = X8; then
18770         ivdformat="$sPRId64"
18771         uvuformat="$sPRIu64"
18772         uvoformat="$sPRIo64"
18773         uvxformat="$sPRIx64"
18774         uvXUformat="$sPRIXU64"
18775 else
18776         if $test X"$ivsize" = X"$longsize"; then
18777                 ivdformat='"ld"'
18778                 uvuformat='"lu"'
18779                 uvoformat='"lo"'
18780                 uvxformat='"lx"'
18781                 uvXUformat='"lX"'
18782         else
18783                 if $test X"$ivsize" = X"$intsize"; then
18784                         ivdformat='"d"'
18785                         uvuformat='"u"'
18786                         uvoformat='"o"'
18787                         uvxformat='"x"'
18788                         uvXUformat='"X"'
18789                 else
18790                         : far out
18791                         if $test X"$ivsize" = X"$shortsize"; then
18792                                 ivdformat='"hd"'
18793                                 uvuformat='"hu"'
18794                                 uvoformat='"ho"'
18795                                 uvxformat='"hx"'
18796                                 uvXUformat='"hX"'
18797                         fi
18798                 fi
18799         fi
18800 fi
18801
18802 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18803         nveformat="$sPRIeldbl"
18804         nvfformat="$sPRIfldbl"
18805         nvgformat="$sPRIgldbl"
18806         nvEUformat="$sPRIEUldbl"
18807         nvFUformat="$sPRIFUldbl"
18808         nvGUformat="$sPRIGUldbl"
18809 else
18810         nveformat='"e"'
18811         nvfformat='"f"'
18812         nvgformat='"g"'
18813         nvEUformat='"E"'
18814         nvFUformat='"F"'
18815         nvGUformat='"G"'
18816 fi
18817
18818 case "$ivdformat" in
18819 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18820     exit 1
18821     ;;
18822 esac
18823
18824
18825 echo " "
18826 $echo "Checking the format string to be used for gids..." >&4
18827
18828 case "$gidsign" in
18829 -1)     if $test X"$gidsize" = X"$ivsize"; then
18830                 gidformat="$ivdformat"
18831         else
18832                 if $test X"$gidsize" = X"$longsize"; then
18833                         gidformat='"ld"'
18834                 else
18835                         if $test X"$gidsize" = X"$intsize"; then
18836                                 gidformat='"d"'
18837                         else
18838                                 if $test X"$gidsize" = X"$shortsize"; then
18839                                         gidformat='"hd"'
18840                                 fi
18841                         fi
18842                 fi
18843         fi
18844         ;;
18845 *)      if $test X"$gidsize" = X"$uvsize"; then
18846                 gidformat="$uvuformat"
18847         else
18848                 if $test X"$gidsize" = X"$longsize"; then
18849                         gidformat='"lu"'
18850                 else
18851                         if $test X"$gidsize" = X"$intsize"; then
18852                                 gidformat='"u"'
18853                         else
18854                                 if $test X"$gidsize" = X"$shortsize"; then
18855                                         gidformat='"hu"'
18856                                 fi
18857                         fi
18858                 fi
18859         fi
18860         ;;
18861 esac
18862
18863 : see if getgroups exists
18864 set getgroups d_getgrps
18865 eval $inlibc
18866
18867 : see if setgroups exists
18868 set setgroups d_setgrps
18869 eval $inlibc
18870
18871
18872 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18873 echo " "
18874 case "$d_getgrps$d_setgrps" in
18875 *define*)
18876         case "$groupstype" in
18877         '') dflt="$gidtype" ;;
18878         *)  dflt="$groupstype" ;;
18879         esac
18880         $cat <<EOM
18881 What type of pointer is the second argument to getgroups() and setgroups()?
18882 Usually this is the same as group ids, $gidtype, but not always.
18883
18884 EOM
18885         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18886         . ./myread
18887         groupstype="$ans"
18888         ;;
18889 *)  groupstype="$gidtype";;
18890 esac
18891
18892
18893 case "$mad" in
18894 $define|true|[yY]*)     dflt='y' ;;
18895 *)                      dflt='n' ;;
18896 esac
18897 cat <<EOM
18898
18899 Would you like to build with Misc Attribute Decoration? This is development
18900 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18901 overhead on the interpreter.
18902
18903 If this doesn't make any sense to you, just accept the default '$dflt'.
18904 EOM
18905 rp='Build Perl with MAD?'
18906 . ./myread
18907 case "$ans" in
18908 y|Y)    val="$define"
18909         madlyh='madly.h madly.act madly.tab'
18910         madlysrc='madly.c'
18911         madlyobj="madly$_o" ;;
18912 *)      val="$undef"
18913         madlyh=''
18914         madlysrc=''
18915         madlyobj='' ;;
18916 esac
18917 set mad
18918 eval $setvar
18919
18920 echo " "
18921 echo "Checking if your $make program sets \$(MAKE)..." >&4
18922 case "$make_set_make" in
18923 '')
18924         $sed 's/^X //' > testmake.mak << 'EOF'
18925 Xall:
18926 X       @echo 'maketemp="$(MAKE)"'
18927 EOF
18928         case "`$make -f testmake.mak 2>/dev/null`" in
18929         *maketemp=*) make_set_make='#' ;;
18930         *)      make_set_make="MAKE=$make" ;;
18931         esac
18932         $rm -f testmake.mak
18933         ;;
18934 esac
18935 case "$make_set_make" in
18936 '#') echo "Yup, it does.";;
18937 *) echo "Nope, it doesn't.";;
18938 esac
18939
18940 : see what type is used for mode_t
18941 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18942 set mode_t modetype int stdio.h sys/types.h
18943 eval $typedef_ask
18944
18945 : see if stdarg is available
18946 echo " "
18947 if $test `./findhdr stdarg.h`; then
18948         echo "<stdarg.h> found." >&4
18949         valstd="$define"
18950 else
18951         echo "<stdarg.h> NOT found." >&4
18952         valstd="$undef"
18953 fi
18954
18955 : see if varags is available
18956 echo " "
18957 if $test `./findhdr varargs.h`; then
18958         echo "<varargs.h> found." >&4
18959 else
18960         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18961 fi
18962
18963 : set up the varargs testing programs
18964 $cat > varargs.c <<EOP
18965 #ifdef I_STDARG
18966 #include <stdarg.h>
18967 #endif
18968 #ifdef I_VARARGS
18969 #include <varargs.h>
18970 #endif
18971
18972 #ifdef I_STDARG
18973 int f(char *p, ...)
18974 #else
18975 int f(va_alist)
18976 va_dcl
18977 #endif
18978 {
18979         va_list ap;
18980 #ifndef I_STDARG
18981         char *p;
18982 #endif
18983 #ifdef I_STDARG
18984         va_start(ap,p);
18985 #else
18986         va_start(ap);
18987         p = va_arg(ap, char *);
18988 #endif
18989         va_end(ap);
18990 }
18991 EOP
18992 $cat > varargs <<EOP
18993 $startsh
18994 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18995         echo "true"
18996 else
18997         echo "false"
18998 fi
18999 $rm -f varargs$_o
19000 EOP
19001 chmod +x varargs
19002
19003 : now check which varargs header should be included
19004 echo " "
19005 i_varhdr=''
19006 case "$valstd" in
19007 "$define")
19008         if `./varargs I_STDARG`; then
19009                 val='stdarg.h'
19010         elif `./varargs I_VARARGS`; then
19011                 val='varargs.h'
19012         fi
19013         ;;
19014 *)
19015         if `./varargs I_VARARGS`; then
19016                 val='varargs.h'
19017         fi
19018         ;;
19019 esac
19020 case "$val" in
19021 '')
19022 echo "I could not find the definition for va_dcl... You have problems..." >&4
19023         val="$undef"; set i_stdarg; eval $setvar
19024         val="$undef"; set i_varargs; eval $setvar
19025         ;;
19026 *) 
19027         set i_varhdr
19028         eval $setvar
19029         case "$i_varhdr" in
19030         stdarg.h)
19031                 val="$define"; set i_stdarg; eval $setvar
19032                 val="$undef"; set i_varargs; eval $setvar
19033                 ;;
19034         varargs.h)
19035                 val="$undef"; set i_stdarg; eval $setvar
19036                 val="$define"; set i_varargs; eval $setvar
19037                 ;;
19038         esac
19039         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19040 esac
19041 $rm -f varargs*
19042
19043 : see if we need va_copy
19044 echo " "
19045 case "$i_stdarg" in
19046 "$define")
19047         $cat >try.c <<EOCP
19048 #include <stdarg.h>
19049 #include <stdio.h>
19050 #$i_stdlib I_STDLIB
19051 #ifdef I_STDLIB
19052 #include <stdlib.h>
19053 #endif
19054 #include <signal.h>
19055
19056 int
19057 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19058 {
19059   return vfprintf(f, fmt, *valp);
19060 }
19061  
19062 int    
19063 myvfprintf(FILE *f, const  char *fmt, va_list val)
19064 {
19065   return ivfprintf(f, fmt, &val);
19066 }
19067       
19068 int
19069 myprintf(char *fmt, ...) 
19070 {
19071   va_list val;
19072   va_start(val, fmt);
19073   return myvfprintf(stdout, fmt, val); 
19074 }         
19075
19076 int
19077 main(int ac, char **av)
19078 {
19079   signal(SIGSEGV, exit);
19080
19081   myprintf("%s%cs all right, then\n", "that", '\'');                            
19082   exit(0);      
19083 }
19084 EOCP
19085         set try
19086         if eval $compile && $run ./try 2>&1 >/dev/null; then
19087                 case "`$run ./try`" in
19088                 "that's all right, then")
19089                         okay=yes
19090                         ;;
19091                 esac
19092         fi
19093         case "$okay" in
19094         yes)    echo "It seems that you don't need va_copy()." >&4
19095                 need_va_copy="$undef"
19096                 ;;
19097         *)      echo "It seems that va_copy() or similar will be needed." >&4
19098                 need_va_copy="$define"
19099                 ;;
19100         esac
19101         $rm -f try.* core core.* *.core *.core.*
19102         ;;
19103 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19104         ;;
19105 esac
19106
19107 : see what type is used for size_t
19108 rp="What is the type used for the length parameter for string functions?"
19109 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19110 eval $typedef_ask
19111
19112 : check for type of arguments to gethostbyaddr. 
19113 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19114         case "$d_gethbyaddr" in
19115         $define)
19116                 $cat <<EOM
19117
19118 Checking to see what type of arguments are accepted by gethostbyaddr().
19119 EOM
19120                 hdrs="$define sys/types.h
19121                         $d_socket sys/socket.h 
19122                         $i_niin netinet/in.h 
19123                         $i_netdb netdb.h
19124                         $i_unistd unistd.h"
19125                 : The first arg can 'char *' or 'void *'
19126                 : The second arg is some of integral type
19127                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19128                         for yyy in size_t long int; do
19129                                 case "$netdb_host_type" in
19130                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19131                                         if ./protochk "$try" $hdrs; then
19132                                                 echo "Your system accepts $xxx for the first arg."
19133                                                 echo "...and $yyy for the second arg."
19134                                                 netdb_host_type="$xxx"
19135                                                 netdb_hlen_type="$yyy"
19136                                         fi
19137                                         ;;
19138                                 esac
19139                         done
19140                 done
19141                 : In case none of those worked, prompt the user.
19142                 case "$netdb_host_type" in
19143                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19144                         dflt='char *'
19145                         . ./myread
19146                         netdb_host_type=$ans
19147                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19148                         dflt="$sizetype"
19149                         . ./myread
19150                         netdb_hlen_type=$ans
19151                         ;;
19152                 esac
19153                 ;;
19154         *)      : no gethostbyaddr, so pick harmless defaults
19155                 netdb_host_type='char *'
19156                 netdb_hlen_type="$sizetype"
19157                 ;;
19158         esac
19159         # Remove the "const" if needed. -- but then we'll have a 
19160         # prototype clash!
19161         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19162 fi
19163
19164 : check for type of argument to gethostbyname. 
19165 if test "X$netdb_name_type" = X ; then
19166         case "$d_gethbyname" in
19167         $define)
19168                 $cat <<EOM
19169
19170 Checking to see what type of argument is accepted by gethostbyname().
19171 EOM
19172                 hdrs="$define sys/types.h
19173                         $d_socket sys/socket.h 
19174                         $i_niin netinet/in.h 
19175                         $i_netdb netdb.h
19176                         $i_unistd unistd.h"
19177                 for xxx in "const char *" "char *"; do
19178                         case "$netdb_name_type" in
19179                         '')     try="extern struct hostent *gethostbyname($xxx);"
19180                                 if ./protochk "$try" $hdrs; then
19181                                         echo "Your system accepts $xxx."
19182                                         netdb_name_type="$xxx"
19183                                 fi
19184                                 ;;
19185                         esac
19186                 done
19187                 : In case none of those worked, prompt the user.
19188                 case "$netdb_name_type" in
19189                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19190                         dflt='char *'
19191                         . ./myread
19192                         netdb_name_type=$ans
19193                         ;;
19194                 esac
19195                 ;;
19196         *)      : no gethostbyname, so pick harmless default
19197                 netdb_name_type='char *'
19198                 ;;
19199         esac
19200 fi
19201
19202 : check for type of 1st argument to getnetbyaddr. 
19203 if test "X$netdb_net_type" = X ; then
19204         case "$d_getnbyaddr" in
19205         $define)
19206                 $cat <<EOM
19207
19208 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19209 EOM
19210                 hdrs="$define sys/types.h
19211                         $d_socket sys/socket.h 
19212                         $i_niin netinet/in.h 
19213                         $i_netdb netdb.h
19214                         $i_unistd unistd.h"
19215                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19216                         case "$netdb_net_type" in
19217                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19218                                 if ./protochk "$try" $hdrs; then
19219                                         echo "Your system accepts $xxx."
19220                                         netdb_net_type="$xxx"
19221                                 fi
19222                                 ;;
19223                         esac
19224                 done
19225                 : In case none of those worked, prompt the user.
19226                 case "$netdb_net_type" in
19227                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19228                         dflt='long'
19229                         . ./myread
19230                         netdb_net_type=$ans
19231                         ;;
19232                 esac
19233                 ;;
19234         *)      : no getnetbyaddr, so pick harmless default
19235                 netdb_net_type='long'
19236                 ;;
19237         esac
19238 fi
19239 : locate the preferred pager for this system
19240 fn=f/
19241 case "$pager" in
19242 '')
19243         dflt=''
19244         case "$pg" in
19245         /*) dflt=$pg;;
19246         [a-zA-Z]:/*) dflt=$pg;;
19247         esac
19248         case "$more" in
19249         /*) dflt=$more;;
19250         [a-zA-Z]:/*) dflt=$more;;
19251         esac
19252         case "$less" in
19253         /*) dflt=$less;;
19254         [a-zA-Z]:/*) dflt=$less;;
19255         esac
19256         case "$dflt" in
19257         '') dflt=/usr/ucb/more;;
19258         esac
19259         ;;
19260 *)      dflt="$pager"
19261         : Instruct ./getfile to trust the hinted or previous pager value,
19262         : even if it does not begin with a slash.  For example, on os2,
19263         : pager might be cmd /c more.  See comments in UU/getfile.
19264         fn="f/($pager)"
19265         ;;
19266 esac
19267 echo " "
19268 rp='What pager is used on your system?'
19269 . ./getfile
19270 pager="$ans"
19271
19272 : see what type pids are declared as in the kernel
19273 rp="What is the type of process ids on this system?"
19274 set pid_t pidtype int stdio.h sys/types.h
19275 eval $typedef_ask
19276
19277 : see if ar generates random libraries by itself
19278 echo " "
19279 echo "Checking how to generate random libraries on your machine..." >&4
19280 echo 'int bar1() { return bar2(); }' > bar1.c
19281 echo 'int bar2() { return 2; }' > bar2.c
19282 $cat > foo.c <<EOP
19283 #$i_stdlib I_STDLIB
19284 #ifdef I_STDLIB
19285 #include <stdlib.h>
19286 #endif
19287 int main() { printf("%d\n", bar1()); exit(0); }
19288 EOP
19289 $cc $ccflags -c bar1.c >/dev/null 2>&1
19290 $cc $ccflags -c bar2.c >/dev/null 2>&1
19291 $cc $ccflags -c foo.c >/dev/null 2>&1
19292 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19293 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19294         $run ./foobar >/dev/null 2>&1; then
19295         echo "$ar appears to generate random libraries itself."
19296         orderlib=false
19297         if [ "X$ranlib" = "X" ]; then
19298             ranlib=":"
19299         fi
19300 elif $ar s bar$_a >/dev/null 2>&1 &&
19301         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19302         $run ./foobar >/dev/null 2>&1; then
19303                 echo "a table of contents needs to be added with '$ar s'."
19304                 orderlib=false
19305                 ranlib="$ar s"
19306 elif $ar ts bar$_a >/dev/null 2>&1 &&
19307         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19308         $run ./foobar >/dev/null 2>&1; then
19309                 echo "a table of contents needs to be added with '$ar ts'."
19310                 orderlib=false
19311                 ranlib="$ar ts"
19312 else
19313         case "$ranlib" in
19314         :) ranlib='';;
19315         '')
19316                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19317                 $test -f $ranlib || ranlib=''
19318                 ;;
19319         esac
19320         if $test -n "$ranlib"; then
19321                 echo "your system has '$ranlib'; we'll use that."
19322                 orderlib=false
19323         else
19324                 echo "your system doesn't seem to support random libraries"
19325                 echo "so we'll use lorder and tsort to order the libraries."
19326                 orderlib=true
19327                 ranlib=":"
19328         fi
19329 fi
19330 $rm -f foo* bar*
19331
19332 : check for type of arguments to select. 
19333 case "$selecttype" in
19334 '') case "$d_select" in
19335         $define)
19336                 echo " "
19337                 $cat <<EOM
19338 Checking to see what type of arguments are accepted by select().
19339 EOM
19340                 hdrs="$define sys/types.h
19341                         $i_systime sys/time.h 
19342                         $i_sysselct sys/select.h
19343                         $d_socket sys/socket.h"
19344                 : The first arg can be int, unsigned, or size_t
19345                 : The last arg may or may not be 'const'
19346                 val=''
19347                 : void pointer has been seen but using that
19348                 : breaks the selectminbits test
19349                 for xxx in 'fd_set *' 'int *'; do
19350                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19351                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19352                                         case "$val" in
19353                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19354                                                 if ./protochk "$try" $hdrs; then
19355                                                         echo "Your system accepts $xxx."
19356                                                         val="$xxx"
19357                                                 fi
19358                                                 ;;
19359                                         esac
19360                                 done
19361                         done
19362                 done
19363                 case "$val" in
19364                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19365                         case "$d_fd_set" in
19366                                 $define) dflt="fd_set *" ;;
19367                                 *)              dflt="int *" ;;
19368                         esac
19369                         . ./myread
19370                         val=$ans
19371                         ;;
19372                 esac
19373                 selecttype="$val"
19374                 ;;
19375         *)      : no select, so pick a harmless default
19376                 selecttype='int *'
19377                 ;;
19378         esac
19379         ;;
19380 esac
19381
19382 : check for the select 'width'
19383 case "$selectminbits" in
19384 '') safebits=`expr $ptrsize \* 8`
19385     case "$d_select" in
19386         $define)
19387                 $cat <<EOM
19388
19389 Checking to see on how many bits at a time your select() operates...
19390 EOM
19391                 $cat >try.c <<EOCP
19392 #include <sys/types.h>
19393 #$i_time I_TIME
19394 #$i_systime I_SYS_TIME
19395 #$i_systimek I_SYS_TIME_KERNEL
19396 #ifdef I_TIME
19397 #   include <time.h>
19398 #endif
19399 #ifdef I_SYS_TIME
19400 #   ifdef I_SYS_TIME_KERNEL
19401 #       define KERNEL
19402 #   endif
19403 #   include <sys/time.h>
19404 #   ifdef I_SYS_TIME_KERNEL
19405 #       undef KERNEL
19406 #   endif
19407 #endif
19408 #$i_sysselct I_SYS_SELECT
19409 #ifdef I_SYS_SELECT
19410 #include <sys/select.h>
19411 #endif
19412 #$d_socket HAS_SOCKET
19413 #ifdef HAS_SOCKET
19414 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19415 #endif
19416 #include <stdio.h>
19417 #$i_stdlib I_STDLIB
19418 #ifdef I_STDLIB
19419 #include <stdlib.h>
19420 #endif
19421 $selecttype b;
19422 #define S sizeof(*(b))
19423 #define MINBITS 64
19424 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19425 #define NBITS  (NBYTES * 8)
19426 int main() {
19427     char *s = malloc(NBYTES);
19428     struct timeval t;
19429     int i;
19430     FILE* fp;
19431     int fd;
19432
19433     if (!s)
19434         exit(1);
19435     fclose(stdin);
19436     fp = fopen("try.c", "r");
19437     if (fp == 0)
19438       exit(2);
19439     fd = fileno(fp);
19440     if (fd < 0)
19441       exit(3);
19442     b = ($selecttype)s;
19443     for (i = 0; i < NBITS; i++)
19444         FD_SET(i, b);
19445     t.tv_sec  = 0;
19446     t.tv_usec = 0;
19447     select(fd + 1, b, 0, 0, &t);
19448     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19449     free(s);
19450     printf("%d\n", i + 1);
19451     return 0;
19452 }
19453 EOCP
19454                 set try
19455                 if eval $compile_ok; then
19456                         selectminbits=`$run ./try`
19457                         case "$selectminbits" in
19458                         '')     cat >&4 <<EOM
19459 Cannot figure out on how many bits at a time your select() operates.
19460 I'll play safe and guess it is $safebits bits.
19461 EOM
19462                                 selectminbits=$safebits
19463                                 bits="$safebits bits"
19464                                 ;;
19465                         1)      bits="1 bit" ;;
19466                         *)      bits="$selectminbits bits" ;;
19467                         esac
19468                         echo "Your select() operates on $bits at a time." >&4
19469                 else
19470                         rp='What is the minimum number of bits your select() operates on?'
19471                         case "$byteorder" in
19472                         12345678)       dflt=64 ;;
19473                         1234)           dflt=32 ;;
19474                         *)              dflt=1  ;;
19475                         esac
19476                         . ./myread
19477                         val=$ans
19478                         selectminbits="$val"
19479                 fi
19480                 $rm -f try.* try
19481                 ;;
19482         *)      : no select, so pick a harmless default
19483                 selectminbits=$safebits
19484                 ;;
19485         esac
19486         ;;
19487 esac
19488
19489 : Trace out the files included by signal.h, then look for SIGxxx names.
19490 : Remove SIGARRAYSIZE used by HPUX.
19491 : Remove SIGSTKSIZE used by Linux.
19492 : Remove SIGSTKSZ used by Posix.
19493 : Remove SIGTYP void lines used by OS2.
19494 : Some cpps, like os390, dont give the file name anywhere
19495 if [ "X$fieldn" = X ]; then
19496         : Just make some guesses.  We check them later.
19497         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19498 else
19499         xxx=`echo '#include <signal.h>' |
19500         $cppstdin $cppminus $cppflags 2>/dev/null |
19501         $grep '^[       ]*#.*include' | 
19502         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19503 fi
19504 : Check this list of files to be sure we have parsed the cpp output ok.
19505 : This will also avoid potentially non-existent files, such 
19506 : as ../foo/bar.h
19507 xxxfiles=''
19508 for xx in $xxx /dev/null ; do
19509         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19510 done
19511 : If we have found no files, at least try signal.h
19512 case "$xxxfiles" in
19513 '')     xxxfiles=`./findhdr signal.h` ;;
19514 esac
19515 xxx=`awk '
19516 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19517         print substr($2, 4, 20)
19518 }
19519 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19520         print substr($3, 4, 20)
19521 }' $xxxfiles`
19522 : Append some common names just in case the awk scan failed.
19523 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19524 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19525 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19526 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19527 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19528
19529 : generate a few handy files for later
19530 $cat > signal.c <<EOCP
19531 #include <sys/types.h>
19532 #include <signal.h>
19533 #$i_stdlib I_STDLIB
19534 #ifdef I_STDLIB
19535 #include <stdlib.h>
19536 #endif
19537 #include <stdio.h>
19538 int main() {
19539
19540 /* Strange style to avoid deeply-nested #if/#else/#endif */
19541 #ifndef NSIG
19542 #  ifdef _NSIG
19543 #    define NSIG (_NSIG)
19544 #  endif
19545 #endif
19546
19547 #ifndef NSIG
19548 #  ifdef SIGMAX
19549 #    define NSIG (SIGMAX+1)
19550 #  endif
19551 #endif
19552
19553 #ifndef NSIG
19554 #  ifdef SIG_MAX
19555 #    define NSIG (SIG_MAX+1)
19556 #  endif
19557 #endif
19558
19559 #ifndef NSIG
19560 #  ifdef _SIG_MAX
19561 #    define NSIG (_SIG_MAX+1)
19562 #  endif
19563 #endif
19564
19565 #ifndef NSIG
19566 #  ifdef MAXSIG
19567 #    define NSIG (MAXSIG+1)
19568 #  endif
19569 #endif
19570
19571 #ifndef NSIG
19572 #  ifdef MAX_SIG
19573 #    define NSIG (MAX_SIG+1)
19574 #  endif
19575 #endif
19576
19577 #ifndef NSIG
19578 #  ifdef SIGARRAYSIZE
19579 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19580 #  endif
19581 #endif
19582
19583 #ifndef NSIG
19584 #  ifdef _sys_nsig
19585 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19586 #  endif
19587 #endif
19588
19589 /* Default to some arbitrary number that's big enough to get most
19590    of the common signals.
19591 */
19592 #ifndef NSIG
19593 #    define NSIG 50
19594 #endif
19595
19596 printf("NSIG %d\n", NSIG);
19597
19598 #ifndef JUST_NSIG
19599
19600 EOCP
19601
19602 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19603 {
19604         printf "#ifdef SIG"; printf $1; printf "\n"
19605         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19606         printf $1; printf ");\n"
19607         printf "#endif\n"
19608 }
19609 END {
19610         printf "#endif /* JUST_NSIG */\n";
19611         printf "exit(0);\n}\n";
19612 }
19613 ' >>signal.c
19614 $cat >signal.awk <<'EOP'
19615 BEGIN { ndups = 0 }
19616 $1 ~ /^NSIG$/ { nsig = $2 }
19617 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19618     if ($2 > maxsig) { maxsig = $2 }
19619     if (sig_name[$2]) {
19620         dup_name[ndups] = $1
19621         dup_num[ndups] = $2
19622         ndups++ 
19623     }
19624     else {
19625         sig_name[$2] = $1
19626         sig_num[$2] = $2
19627     }
19628 }
19629 END { 
19630     if (nsig == 0) {
19631         nsig = maxsig + 1
19632     }
19633     printf("NSIG %d\n", nsig);
19634     for (n = 1; n < nsig; n++) {
19635         if (sig_name[n]) {
19636             printf("%s %d\n", sig_name[n], sig_num[n])
19637         }
19638         else {
19639             printf("NUM%d %d\n", n, n) 
19640         }
19641     }
19642     for (n = 0; n < ndups; n++) {
19643         printf("%s %d\n", dup_name[n], dup_num[n])
19644     }
19645 }
19646 EOP
19647 $cat >signal_cmd <<EOS
19648 $startsh
19649 if $test -s signal.lst; then
19650     echo "Using your existing signal.lst file"
19651         exit 0
19652 fi
19653 xxx="$xxx"
19654 EOS
19655 $cat >>signal_cmd <<'EOS'
19656
19657 set signal
19658 if eval $compile_ok; then
19659         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19660 else
19661         echo "(I can't seem be able to compile the whole test program)" >&4
19662         echo "(I'll try it in little pieces.)" >&4
19663         set signal -DJUST_NSIG
19664         if eval $compile_ok; then
19665                 $run ./signal$_exe > signal.nsg
19666                 $cat signal.nsg
19667         else
19668                 echo "I can't seem to figure out how many signals you have." >&4
19669                 echo "Guessing 50." >&4
19670                 echo 'NSIG 50' > signal.nsg
19671         fi
19672         : Now look at all the signal names, one at a time.
19673         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19674                 $cat > signal.c <<EOCP
19675 #include <sys/types.h>
19676 #include <signal.h>
19677 #include <stdio.h>
19678 int main() {
19679 printf("$xx %d\n", SIG${xx});
19680 return 0;
19681 }
19682 EOCP
19683                 set signal
19684                 if eval $compile; then
19685                         echo "SIG${xx} found."
19686                         $run ./signal$_exe  >> signal.ls1
19687                 else
19688                         echo "SIG${xx} NOT found."
19689                 fi
19690         done
19691         if $test -s signal.ls1; then
19692                 $cat signal.nsg signal.ls1 |
19693                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19694         fi
19695
19696 fi
19697 if $test -s signal.lst; then
19698         :
19699 else
19700         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19701         echo 'kill -l' >signal
19702         set X `csh -f <signal`
19703         $rm -f signal
19704         shift
19705         case $# in
19706         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19707         esac
19708         echo $@ | $tr ' ' $trnl | \
19709             $awk '{ printf "%s %d\n", $1, ++s; }
19710                   END { printf "NSIG %d\n", ++s }' >signal.lst
19711 fi
19712 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19713 EOS
19714 chmod a+x signal_cmd
19715 $eunicefix signal_cmd
19716
19717 : generate list of signal names
19718 echo " "
19719 case "$sig_name_init" in
19720 '') doinit=yes ;;
19721 *)  case "$sig_num_init" in
19722     ''|*,*) doinit=yes ;;
19723     esac ;;
19724 esac
19725 case "$doinit" in
19726 yes)
19727         echo "Generating a list of signal names and numbers..." >&4
19728         . ./signal_cmd
19729         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19730         sig_name=`$awk 'BEGIN { printf "ZERO " }
19731                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19732         sig_num=`$awk  'BEGIN { printf "0 " }
19733                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19734         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19735                              !/^NSIG/   { printf "\"%s\", ", $1 }
19736                              END        { printf "0\n" }' signal.lst`
19737         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19738                              !/^NSIG/   { printf "%d, ", $2}
19739                              END        { printf "0\n"}' signal.lst`
19740         ;;
19741 esac
19742 echo "The following $sig_count signals are available:"
19743 echo " "
19744 echo $sig_name | $awk \
19745 'BEGIN { linelen = 0 }
19746 {
19747         for (i = 1; i <= NF; i++) {
19748                 name = "SIG" $i " "
19749                 linelen = linelen + length(name)
19750                 if (linelen > 70) {
19751                         printf "\n"
19752                         linelen = length(name)
19753                 }
19754                 printf "%s", name
19755         }
19756         printf "\n"
19757 }'
19758 sig_size=`echo $sig_name | awk '{print NF}'`
19759 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19760
19761 echo " "
19762 case "$sizetype" in
19763 *_t) zzz="$sizetype"    ;;
19764 *)   zzz="filesize"     ;;
19765 esac
19766 echo "Checking the size of $zzz..." >&4 
19767 cat > try.c <<EOCP
19768 #include <sys/types.h>
19769 #include <stdio.h>
19770 #$i_stdlib I_STDLIB
19771 #ifdef I_STDLIB
19772 #include <stdlib.h>
19773 #endif
19774 int main() {
19775     printf("%d\n", (int)sizeof($sizetype));
19776     exit(0);
19777 }
19778 EOCP
19779 set try
19780 if eval $compile_ok; then
19781         yyy=`$run ./try`
19782         case "$yyy" in
19783         '')     sizesize=4
19784                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19785                 ;;
19786         *)      sizesize=$yyy
19787                 echo "Your $zzz size is $sizesize bytes."
19788                 ;;
19789         esac
19790 else
19791         sizesize=4
19792         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19793 fi
19794
19795
19796 : check for socklen_t
19797 echo " "
19798 echo "Checking to see if you have socklen_t..." >&4
19799 $cat >try.c <<EOCP
19800 #include <sys/types.h>
19801 #$d_socket HAS_SOCKET
19802 #ifdef HAS_SOCKET
19803 #include <sys/socket.h>
19804 #endif
19805 int main() { socklen_t x = 16; }
19806 EOCP
19807 set try
19808 if eval $compile; then
19809         val="$define"
19810         echo "You have socklen_t."
19811 else
19812         val="$undef"
19813         echo "You do not have socklen_t."
19814         case "$sizetype" in
19815         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19816         esac
19817 fi
19818 $rm -f try try.*
19819 set d_socklen_t
19820 eval $setvar
19821
19822 : see if this is a socks.h system
19823 set socks.h i_socks
19824 eval $inhdr
19825
19826 : check for type of the size argument to socket calls
19827 case "$d_socket" in
19828 "$define")
19829         $cat <<EOM
19830
19831 Checking to see what type is the last argument of accept().
19832 EOM
19833         yyy=''
19834         case "$d_socklen_t" in
19835         "$define") yyy="$yyy socklen_t"
19836         esac
19837         yyy="$yyy $sizetype int long unsigned"
19838         for xxx in $yyy; do
19839                 case "$socksizetype" in
19840                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19841                         case "$usesocks" in
19842                         "$define")
19843                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19844                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19845                                         socksizetype="$xxx"
19846                                 fi
19847                                 ;;
19848                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19849                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19850                                         socksizetype="$xxx"
19851                                 fi
19852                                 ;;
19853                         esac
19854                         ;;
19855                 esac
19856         done
19857 : In case none of those worked, prompt the user.
19858         case "$socksizetype" in
19859         '')     rp='What is the type for socket address structure sizes?'
19860                 dflt='int'
19861                 . ./myread
19862                 socksizetype=$ans
19863                 ;;
19864         esac
19865         ;;
19866 *)      : no sockets, so pick relatively harmless default
19867         socksizetype='int'
19868         ;;
19869 esac
19870
19871 : see what type is used for signed size_t
19872 set ssize_t ssizetype int stdio.h sys/types.h
19873 eval $typedef
19874 dflt="$ssizetype"
19875 $cat > try.c <<EOM
19876 #include <stdio.h>
19877 #$i_stdlib I_STDLIB
19878 #ifdef I_STDLIB
19879 #include <stdlib.h>
19880 #endif
19881 #include <sys/types.h>
19882 #define Size_t $sizetype
19883 #define SSize_t $dflt
19884 int main()
19885 {
19886         if (sizeof(Size_t) == sizeof(SSize_t))
19887                 printf("$dflt\n");
19888         else if (sizeof(Size_t) == sizeof(int))
19889                 printf("int\n");
19890         else 
19891                 printf("long\n");
19892         exit(0);
19893 }
19894 EOM
19895 echo " "
19896 set try
19897 if eval $compile_ok && $run ./try > /dev/null; then
19898         ssizetype=`$run ./try`
19899         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19900 else
19901         $cat >&4 <<EOM
19902 Help! I can't compile and run the ssize_t test program: please enlighten me!
19903 (This is probably a misconfiguration in your system or libraries, and
19904 you really ought to fix it.  Still, I'll try anyway.)
19905
19906 I need a type that is the same size as $sizetype, but is guaranteed to
19907 be signed.  Common values are ssize_t, int and long.
19908
19909 EOM
19910         rp="What signed type is the same size as $sizetype?"
19911         . ./myread
19912         ssizetype="$ans"
19913 fi
19914 $rm -f try try.*
19915
19916 : see what type of char stdio uses.
19917 echo " "
19918 echo '#include <stdio.h>' > stdio.c
19919 $cppstdin $cppminus < stdio.c > stdioh
19920 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19921         echo "Your stdio uses unsigned chars." >&4
19922         stdchar="unsigned char"
19923 else
19924         echo "Your stdio uses signed chars." >&4
19925         stdchar="char"
19926 fi
19927 $rm -f stdio.* stdioh
19928
19929 : see what type uids are declared as in the kernel
19930 echo " "
19931 echo "Looking for the type for user ids returned by getuid()."
19932 set uid_t uidtype xxx stdio.h sys/types.h
19933 eval $typedef
19934 case "$uidtype" in
19935 xxx)
19936         xxx=`./findhdr sys/user.h`
19937         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19938         case $1 in
19939         unsigned) dflt="$1 $2" ;;
19940         *) dflt="$1" ;;
19941         esac
19942         ;;
19943 *) dflt="$uidtype";;
19944 esac
19945 case "$uidtype" in
19946 uid_t)  echo "uid_t found." ;;
19947 *)      rp="What is the type for user ids returned by getuid()?"
19948         . ./myread
19949         uidtype="$ans"
19950         ;;
19951 esac
19952
19953 echo " "
19954 case "$uidtype" in
19955 *_t) zzz="$uidtype"     ;;
19956 *)   zzz="uid"          ;;
19957 esac
19958 echo "Checking the size of $zzz..." >&4 
19959 cat > try.c <<EOCP
19960 #include <sys/types.h>
19961 #include <stdio.h>
19962 #$i_stdlib I_STDLIB
19963 #ifdef I_STDLIB
19964 #include <stdlib.h>
19965 #endif
19966 int main() {
19967     printf("%d\n", (int)sizeof($uidtype));
19968     exit(0);
19969 }
19970 EOCP
19971 set try
19972 if eval $compile_ok; then
19973         yyy=`$run ./try`
19974         case "$yyy" in
19975         '')     uidsize=4
19976                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19977                 ;;
19978         *)      uidsize=$yyy
19979                 echo "Your $zzz is $uidsize bytes long."
19980                 ;;
19981         esac
19982 else
19983         uidsize=4
19984         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19985 fi
19986
19987 echo " "
19988 case "$uidtype" in
19989 *_t) zzz="$uidtype"     ;;
19990 *)   zzz="uid"          ;;
19991 esac
19992 echo "Checking the sign of $zzz..." >&4
19993 cat > try.c <<EOCP
19994 #include <sys/types.h>
19995 #include <stdio.h>
19996 int main() {
19997         $uidtype foo = -1;
19998         if (foo < 0)
19999                 printf("-1\n");
20000         else
20001                 printf("1\n");
20002 }
20003 EOCP
20004 set try
20005 if eval $compile; then
20006         yyy=`$run ./try`
20007         case "$yyy" in
20008         '')     uidsign=1
20009                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20010                 ;;
20011         *)      uidsign=$yyy
20012                 case "$uidsign" in
20013                  1) echo "Your $zzz is unsigned." ;;
20014                 -1) echo "Your $zzz is signed."   ;;
20015                 esac
20016                 ;;
20017         esac
20018 else
20019         uidsign=1
20020         echo "(I can't compile the test program--guessing unsigned.)" >&4
20021 fi
20022
20023
20024
20025 echo " "
20026 $echo "Checking the format string to be used for uids..." >&4
20027
20028 case "$uidsign" in
20029 -1)     if $test X"$uidsize" = X"$ivsize"; then
20030                 uidformat="$ivdformat"
20031         else
20032                 if $test X"$uidsize" = X"$longsize"; then
20033                         uidformat='"ld"'
20034                 else
20035                         if $test X"$uidsize" = X"$intsize"; then
20036                                 uidformat='"d"'
20037                         else
20038                                 if $test X"$uidsize" = X"$shortsize"; then
20039                                         uidformat='"hd"'
20040                                 fi
20041                         fi
20042                 fi
20043         fi
20044         ;;
20045 *)      if $test X"$uidsize" = X"$uvsize"; then
20046                 uidformat="$uvuformat"
20047         else
20048                 if $test X"$uidsize" = X"$longsize"; then
20049                         uidformat='"lu"'
20050                 else
20051                         if $test X"$uidsize" = X"$intsize"; then
20052                                 uidformat='"u"'
20053                         else
20054                                 if $test X"$uidsize" = X"$shortsize"; then
20055                                         uidformat='"hu"'
20056                                 fi
20057                         fi
20058                 fi
20059         fi
20060         ;;
20061 esac
20062
20063
20064 case "$usesitecustomize" in
20065     $define|true|[Yy]*)
20066         usesitecustomize="$define"
20067         ;;
20068     *)
20069         usesitecustomize="$undef"
20070         ;;
20071     esac
20072
20073 : determine compiler compiler
20074 case "$yacc" in
20075 '')
20076         dflt=yacc;;
20077 *)
20078         dflt="$yacc";;
20079 esac
20080 echo " "
20081 comp='yacc'
20082 if $test -f "$byacc$_exe"; then
20083         dflt="$byacc"
20084         comp="byacc or $comp"
20085 fi
20086 if $test -f "$bison$_exe"; then
20087         comp="$comp or bison -y"
20088 fi
20089 rp="Which compiler compiler ($comp) shall I use?"
20090 . ./myread
20091 yacc="$ans"
20092 case "$yacc" in
20093 *bis*)
20094         case "$yacc" in
20095         *-y*) ;;
20096         *)
20097                 yacc="$yacc -y"
20098                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20099                 ;;
20100         esac
20101         ;;
20102 esac
20103
20104 : see if this is a fp.h system
20105 set fp.h i_fp
20106 eval $inhdr
20107
20108 : see if this is a fp_class.h system
20109 set fp_class.h i_fp_class
20110 eval $inhdr
20111
20112 : see if this is a ieeefp.h system
20113 case "$i_ieeefp" in
20114 '' ) set ieeefp.h i_ieeefp
20115      eval $inhdr
20116      ;;
20117 esac
20118
20119 : see if this is a libutil.h system
20120 set libutil.h i_libutil
20121 eval $inhdr
20122
20123 : see if mach cthreads are available
20124 if test "X$usethreads" = "X$define"; then
20125         set mach/cthreads.h i_machcthr
20126         eval $inhdr
20127 else
20128         i_machcthr="$undef"
20129 fi
20130
20131
20132
20133 : see if this is a mntent.h system
20134 set mntent.h i_mntent
20135 eval $inhdr
20136
20137 : see if ndbm.h is available
20138 set ndbm.h t_ndbm
20139 eval $inhdr
20140
20141 case "$t_ndbm" in
20142 $undef)
20143     # Some Linux distributions such as RedHat 7.1 put the
20144     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20145     if $test -f /usr/include/gdbm/ndbm.h; then
20146         echo '<gdbm/ndbm.h> found.'
20147         ccflags="$ccflags -I/usr/include/gdbm"
20148         cppflags="$cppflags -I/usr/include/gdbm"
20149         t_ndbm=$define
20150     fi
20151     ;;
20152 esac
20153
20154 case "$t_ndbm" in
20155 $define)
20156         : see if dbm_open exists
20157         set dbm_open d_dbm_open
20158         eval $inlibc
20159         case "$d_dbm_open" in
20160         $undef)
20161                 t_ndbm="$undef"
20162                 echo "We won't be including <ndbm.h>"
20163                 ;;
20164         esac
20165         ;;
20166 esac
20167 val="$t_ndbm"
20168 set i_ndbm
20169 eval $setvar
20170
20171 : see if net/errno.h is available
20172 val=''
20173 set net/errno.h val
20174 eval $inhdr
20175
20176 : Unfortunately, it causes problems on some systems.  Arrgh.
20177 case "$val" in
20178 $define)
20179         cat > try.c <<'EOM'
20180 #include <stdio.h>
20181 #include <errno.h>
20182 #include <net/errno.h>
20183 int func()
20184 {
20185         return ENOTSOCK;
20186 }
20187 EOM
20188         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20189                 echo "We'll be including <net/errno.h>." >&4
20190         else
20191                 echo "We won't be including <net/errno.h>." >&4
20192                 val="$undef"
20193         fi
20194         $rm -f try.* try
20195         ;;
20196 esac
20197 set i_neterrno
20198 eval $setvar
20199
20200 : see if netinet/tcp.h is available
20201 set netinet/tcp.h i_netinettcp
20202 eval $inhdr
20203
20204 : see if this is a poll.h system
20205 set poll.h i_poll
20206 eval $inhdr
20207
20208 : see if this is a prot.h system
20209 set prot.h i_prot
20210 eval $inhdr
20211
20212 echo " "
20213 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20214 $cat <<'EOSH' > Cppsym.know
20215 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20216 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20217 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20218 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20219 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20220 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20221 bull c cadmus clipper CMU COFF COMPILER_VERSION
20222 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20223 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20224 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20225 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20226 GLIBC GLIBC_MINOR
20227 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20228 H3050R H3050RX hbullx20 hcx host_mips
20229 hp200 hp300 hp700 HP700 hp800 hp9000
20230 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20231 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20232 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20233 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20234 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20235 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20236 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20237 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20238 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20239 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20240 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20241 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20242 MATH_HAS_NO_SIDE_EFFECTS
20243 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20244 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20245 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20246 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20247 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20248 NetBSD news1500 news1700 news1800 news1900 news3700
20249 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20250 ns32016 ns32332 ns32k nsc32000
20251 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20252 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20253 pc532 pdp11 PGC PIC plexus PORTAR posix
20254 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20255 POSIX_C_SOURCE POSIX_SOURCE POWER
20256 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20257 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20258 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20259 sony sony_news sonyrisc sparc sparclite spectrum
20260 stardent stdc STDC_EXT stratos sun sun3 sun386
20261 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20262 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20263 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20264 sysV68 sysV88 Tek4132 Tek4300 titan
20265 TM3200 TM5400 TM5600
20266 tower tower32 tower32_200 tower32_600 tower32_700
20267 tower32_800 tower32_850 tss
20268 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20269 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20270 unix UNIX95 UNIX99 unixpc unos
20271 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20272 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20273 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20274 USGr4 USGr4_2
20275 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20276 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20277 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20278 z8000
20279 EOSH
20280 # Maybe put other stuff here too.
20281 cat <<EOSH >>Cppsym.know
20282 $osname
20283 EOSH
20284 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20285 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20286 $cat Cppsym.know > Cppsym.c
20287 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20288 $rm -f Cppsym.a Cppsym.b Cppsym.c
20289 cat <<EOSH > Cppsym
20290 $startsh
20291 if $test \$# -gt 0; then
20292     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20293     if $test -s Cppsym.got; then
20294         $rm -f Cppsym.got
20295         exit 0
20296     fi
20297     $rm -f Cppsym.got
20298     exit 1
20299 else
20300     $tr " " "$trnl" | ./Cppsym.try
20301     exit 0
20302 fi
20303 EOSH
20304 chmod +x Cppsym
20305 $eunicefix Cppsym
20306 cat <<EOSH > Cppsym.try
20307 $startsh
20308 cat <<'EOCP' > try.c
20309 #include <stdio.h>
20310 #if cpp_stuff == 1
20311 #define STRINGIFY(a)    "a"
20312 #endif
20313 #if cpp_stuff == 42
20314 #define StGiFy(a)  #a
20315 #define STRINGIFY(a)    StGiFy(a)
20316 #endif
20317 #if $cpp_stuff != 1 && $cpp_stuff != 42
20318 #   include "Bletch: How does this C preprocessor stringify macros?"
20319 #endif
20320 int main() {
20321 EOCP
20322 $awk \\
20323 EOSH
20324 cat <<'EOSH' >> Cppsym.try
20325 'length($1) > 0 {
20326     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20327     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20328     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20329     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20330 }'       >> try.c
20331 echo 'return 0;}' >> try.c
20332 EOSH
20333 cat <<EOSH >> Cppsym.try
20334 ccflags="$ccflags"
20335 case "$osname-$gccversion" in
20336 irix-) ccflags="\$ccflags -woff 1178" ;;
20337 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20338 esac
20339 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20340 EOSH
20341 chmod +x Cppsym.try
20342 $eunicefix Cppsym.try
20343 ./Cppsym < Cppsym.know > Cppsym.true
20344 : Add in any linux cpp "predefined macros":
20345 case "$osname::$gccversion" in
20346   *linux*::*.*)
20347     tHdrH=_tmpHdr
20348     rm -f $tHdrH'.h' $tHdrH
20349     touch $tHdrH'.h'
20350     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20351        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20352        if [ -s $tHdrH'_cppsym.real' ]; then
20353           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20354        fi
20355     fi
20356     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20357   ;;
20358 esac
20359 : now check the C compiler for additional symbols
20360 postprocess_cc_v=''
20361 case "$osname" in
20362 aix) postprocess_cc_v="|$tr , ' '" ;;
20363 esac
20364 $cat >ccsym <<EOS
20365 $startsh
20366 $cat >tmp.c <<EOF
20367 extern int foo;
20368 EOF
20369 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20370 do
20371         case "\$i" in
20372         -D*) echo "\$i" | $sed 's/^-D//';;
20373         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20374         esac
20375 done
20376 $rm -f try.c
20377 EOS
20378 postprocess_cc_v=''
20379 chmod +x ccsym
20380 $eunicefix ccsym
20381 ./ccsym > ccsym1.raw
20382 if $test -s ccsym1.raw; then
20383        $sort ccsym1.raw | $uniq >ccsym.raw
20384 else
20385        mv ccsym1.raw ccsym.raw
20386 fi
20387
20388 $awk '/\=/ { print $0; next }
20389         { print $0"=1" }' ccsym.raw >ccsym.list
20390 $comm -13 Cppsym.true ccsym.list >ccsym.own
20391 $comm -12 Cppsym.true ccsym.list >ccsym.com
20392 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20393 also=''
20394 if $test -z ccsym.raw; then
20395         echo "Your C compiler doesn't seem to define any symbols!" >&4
20396         echo " "
20397         echo "However, your C preprocessor defines the following symbols:"
20398         $cat Cppsym.true
20399         ccsymbols=''
20400         cppsymbols=`$cat Cppsym.true`
20401         cppsymbols=`echo $cppsymbols`
20402         cppccsymbols="$cppsymbols"
20403 else
20404         if $test -s ccsym.com; then
20405                 echo "Your C compiler and pre-processor define these symbols:"
20406                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20407                 also='also '
20408                 symbols='ones'
20409                 cppccsymbols=`$cat ccsym.com`
20410                 cppccsymbols=`echo $cppccsymbols`
20411                 $test "$silent" || sleep 1
20412         fi
20413         if $test -s ccsym.cpp; then
20414                 $test "$also" && echo " "
20415                 echo "Your C pre-processor ${also}defines the following symbols:"
20416                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20417                 also='further '
20418                 cppsymbols=`$cat ccsym.cpp`
20419                 cppsymbols=`echo $cppsymbols`
20420                 $test "$silent" || sleep 1
20421         fi
20422         if $test -s ccsym.own; then
20423                 $test "$also" && echo " "
20424                 echo "Your C compiler ${also}defines the following cpp symbols:"
20425                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20426                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20427                 ccsymbols=`$cat ccsym.own`
20428                 ccsymbols=`echo $ccsymbols`
20429                 $test "$silent" || sleep 1
20430         fi
20431 fi
20432
20433 : see if this is a termio system
20434 val="$undef"
20435 val2="$undef"
20436 val3="$undef"
20437 if $test `./findhdr termios.h`; then
20438         set tcsetattr i_termios
20439         eval $inlibc
20440         val3="$i_termios"
20441 fi
20442 echo " "
20443 case "$val3" in
20444 "$define") echo "You have POSIX termios.h... good!" >&4;;
20445 *) if ./Cppsym pyr; then
20446                 case "`/bin/universe`" in
20447                 ucb) if $test `./findhdr sgtty.h`; then
20448                                 val2="$define"
20449                                 echo "<sgtty.h> found." >&4
20450                         else
20451                                 echo "System is pyramid with BSD universe."
20452                                 echo "<sgtty.h> not found--you could have problems." >&4
20453                         fi;;
20454                 *) if $test `./findhdr termio.h`; then
20455                                 val="$define"
20456                                 echo "<termio.h> found." >&4
20457                         else
20458                                 echo "System is pyramid with USG universe."
20459                                 echo "<termio.h> not found--you could have problems." >&4
20460                         fi;;
20461                 esac
20462         elif ./usg; then
20463                 if $test `./findhdr termio.h`; then
20464                         echo "<termio.h> found." >&4
20465                         val="$define"
20466                 elif $test `./findhdr sgtty.h`; then
20467                         echo "<sgtty.h> found." >&4
20468                         val2="$define"
20469                 else
20470 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20471                 fi
20472         else
20473                 if $test `./findhdr sgtty.h`; then
20474                         echo "<sgtty.h> found." >&4
20475                         val2="$define"
20476                 elif $test `./findhdr termio.h`; then
20477                         echo "<termio.h> found." >&4
20478                         val="$define"
20479                 else
20480 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20481                 fi
20482         fi;;
20483 esac
20484 set i_termio; eval $setvar
20485 val=$val2; set i_sgtty; eval $setvar
20486 val=$val3; set i_termios; eval $setvar
20487
20488 : see if stddef is available
20489 set stddef.h i_stddef
20490 eval $inhdr
20491
20492 : see if this is a sunmath.h system
20493 set sunmath.h i_sunmath
20494 eval $inhdr
20495
20496 : see if sys/access.h is available
20497 set sys/access.h i_sysaccess
20498 eval $inhdr
20499
20500 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20501 set sys/filio.h i_sysfilio
20502 eval $inhdr
20503 echo " "
20504 if $test `./findhdr sys/ioctl.h`; then
20505         val="$define"
20506         echo '<sys/ioctl.h> found.' >&4
20507 else
20508         val="$undef"
20509         if $test $i_sysfilio = "$define"; then
20510             echo '<sys/ioctl.h> NOT found.' >&4
20511         else
20512                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20513                 $test $i_termio = "$define" && xxx="termio.h"
20514                 $test $i_termios = "$define" && xxx="termios.h"
20515 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20516         fi
20517 fi
20518 set i_sysioctl
20519 eval $setvar
20520
20521 : see if socket ioctl defs are in sys/sockio.h
20522 echo " "
20523 xxx=`./findhdr sys/sockio.h`
20524 if $test "$xxx"; then
20525         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20526                 val="$define"
20527                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20528         else
20529                 val="$undef"
20530                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20531         fi
20532 else
20533         val="$undef"
20534         $cat <<EOM
20535 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20536 EOM
20537 fi
20538 set i_syssockio
20539 eval $setvar
20540
20541
20542 : see if this is a syslog.h system
20543 set syslog.h i_syslog
20544 eval $inhdr
20545
20546
20547 : see if this is a sys/mode.h system
20548 set sys/mode.h i_sysmode
20549 eval $inhdr
20550
20551 : see if sys/resource.h has to be included
20552 set sys/resource.h i_sysresrc
20553 eval $inhdr
20554
20555 : see if sys/security.h is available
20556 set sys/security.h i_syssecrt
20557 eval $inhdr
20558
20559 : see if this is a sys/statvfs.h system
20560 set sys/statvfs.h i_sysstatvfs
20561 eval $inhdr
20562
20563 : see if this is a sys/un.h system
20564 set sys/un.h i_sysun
20565 eval $inhdr
20566
20567
20568 : see if this is a sys/utsname.h system
20569 set sys/utsname.h i_sysutsname
20570 eval $inhdr
20571
20572 : see if this is a syswait system
20573 set sys/wait.h i_syswait
20574 eval $inhdr
20575
20576 : see if this is a ustat.h system
20577 set ustat.h i_ustat
20578 eval $inhdr
20579
20580 : see if this is an utime system
20581 set utime.h i_utime
20582 eval $inhdr
20583
20584 : see if this is a values.h system
20585 set values.h i_values
20586 eval $inhdr
20587
20588 : see if this is a vfork system
20589 case "$d_vfork" in
20590 "$define")
20591         set vfork.h i_vfork
20592         eval $inhdr
20593         ;;
20594 *)
20595         i_vfork="$undef"
20596         ;;
20597 esac
20598
20599 : see if gdbm.h is available
20600 set gdbm.h t_gdbm
20601 eval $inhdr
20602 case "$t_gdbm" in
20603 $define)
20604         : see if gdbm_open exists
20605         set gdbm_open d_gdbm_open
20606         eval $inlibc
20607         case "$d_gdbm_open" in
20608         $undef)
20609                 t_gdbm="$undef"
20610                 echo "We won't be including <gdbm.h>"
20611                 ;;
20612         esac
20613         ;;
20614 esac
20615 val="$t_gdbm"
20616 set i_gdbm
20617 eval $setvar
20618
20619 echo " "
20620 echo "Looking for extensions..." >&4
20621 : If we are using the old config.sh, known_extensions may contain
20622 : old or inaccurate or duplicate values.
20623 known_extensions=''
20624 nonxs_extensions=''
20625 : We do not use find because it might not be available.
20626 : We do not just use MANIFEST because the user may have dropped
20627 : some additional extensions into the source tree and expect them
20628 : to be built.
20629
20630 : Function to recursively find available extensions, ignoring DynaLoader
20631 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20632 find_extensions='
20633     for xxx in *; do
20634        case "$xxx" in
20635            DynaLoader|dynaload) ;;
20636            *)
20637            if $test -f $xxx/$xxx.xs; then
20638                known_extensions="$known_extensions $1$xxx";
20639            elif $test -f $xxx/Makefile.PL; then
20640                nonxs_extensions="$nonxs_extensions $1$xxx";
20641            else
20642                if $test -d $xxx -a $# -lt 10; then
20643                    set $1$xxx/ $*;
20644                    cd "$xxx";
20645                    eval $find_extensions;
20646                    cd ..;
20647                    shift;
20648                fi;
20649            fi
20650            ;;
20651        esac;
20652     done'
20653 tdir=`pwd`
20654 cd "$rsrc/ext"
20655 set X
20656 shift
20657 eval $find_extensions
20658 # Special case:  Add in threads/shared since it is not picked up by the
20659 # recursive find above (and adding in general recursive finding breaks
20660 # SDBM_File/sdbm).  A.D.  10/25/2001.
20661 known_extensions="$known_extensions threads/shared"
20662 set X $nonxs_extensions
20663 shift
20664 nonxs_extensions="$*"
20665 set X $known_extensions
20666 shift
20667 known_extensions="$*"
20668 cd "$tdir"
20669
20670 : Now see which are supported on this system.
20671 avail_ext=''
20672 for xxx in $known_extensions ; do
20673         case "$xxx" in
20674         DB_File|db_file)
20675                 case "$i_db" in
20676                 $define) avail_ext="$avail_ext $xxx" ;;
20677                 esac
20678                 ;;
20679         GDBM_File|gdbm_fil)
20680                 case "$i_gdbm" in 
20681                 $define) avail_ext="$avail_ext $xxx" ;;
20682                 esac
20683                 ;;
20684         I18N/Langinfo|i18n_lan)
20685                 case "$i_langinfo$d_nl_langinfo" in 
20686                 $define$define) avail_ext="$avail_ext $xxx" ;;
20687                 esac
20688                 ;;
20689         NDBM_File|ndbm_fil)
20690                 case "$i_ndbm" in
20691                 $define)
20692                     case "$osname-$use64bitint" in
20693                     hpux-define)
20694                         case "$libs" in
20695                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20696                         esac
20697                         ;;
20698                     *) avail_ext="$avail_ext $xxx" ;;
20699                     esac
20700                     ;;
20701                 esac
20702                 ;;
20703         ODBM_File|odbm_fil) 
20704                 case "${i_dbm}${i_rpcsvcdbm}" in
20705                 *"${define}"*)
20706                     case "$osname-$use64bitint" in
20707                     hpux-define)
20708                         case "$libs" in
20709                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20710                         esac
20711                         ;;
20712                     *) avail_ext="$avail_ext $xxx" ;;
20713                     esac
20714                     ;;
20715                 esac
20716                 ;;
20717         POSIX|posix)
20718                 case "$useposix" in
20719                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20720                 esac
20721                 ;;
20722         Opcode|opcode)
20723                 case "$useopcode" in
20724                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20725                 esac
20726                 ;;
20727         Socket|socket)
20728                 case "$d_socket" in 
20729                 true|$define|y)
20730                     case "$osname" in
20731                     beos) ;; # not unless BONE
20732                     *) avail_ext="$avail_ext $xxx" ;;
20733                     esac
20734                     ;;
20735                 esac
20736                 ;;
20737         Sys/Syslog|sys/syslog)
20738                 : XXX syslog requires socket
20739                 case "$d_socket" in 
20740                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20741                 esac
20742                 ;;
20743         Thread|thread)
20744                 case "$usethreads" in
20745                 true|$define|y)
20746                         case "$useithreads" in
20747                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20748                         esac
20749                 esac
20750                 ;;
20751         XS/APItest|xs/apitest)
20752                 # This is just for testing.  Skip it unless we have dynamic loading.
20753
20754                 case "$usedl" in
20755                 $define) avail_ext="$avail_ext $xxx" ;;
20756                 esac
20757                 ;;
20758         XS/Typemap|xs/typemap)
20759                 # This is just for testing.  Skip it unless we have dynamic loading.
20760                 case "$usedl" in
20761                 $define) avail_ext="$avail_ext $xxx" ;;
20762                 esac
20763                 ;;
20764         threads|threads/shared)
20765                 # threads and threads::shared are special cases.
20766                 # To stop people from asking "Perl 5.8.0 was supposed
20767                 # to have this new fancy threads implementation but my
20768                 # perl doesn't have it" and from people trying to
20769                 # (re)install the threads module using CPAN.pm and
20770                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20771                 # the threads.pm and threads/shared.pm will always be
20772                 # there, croaking informatively ("you need to rebuild
20773                 # all of Perl with threads, sorry") when threads haven't
20774                 # been compiled in.
20775                 # --jhi
20776                 avail_ext="$avail_ext $xxx"
20777                 ;;
20778         IPC/SysV|ipc/sysv)
20779                 : XXX Do we need a useipcsysv variable here
20780                 case "${d_msg}${d_sem}${d_shm}" in 
20781                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20782                 esac
20783                 ;;
20784         *)      avail_ext="$avail_ext $xxx"
20785                 ;;
20786         esac
20787 done
20788
20789 set X $avail_ext
20790 shift
20791 avail_ext="$*"
20792
20793 case "$onlyextensions" in
20794 '') ;;
20795 *)  keepextensions=''
20796     echo "You have requested that only certains extensions be included..." >&4
20797     for i in $onlyextensions; do
20798         case " $avail_ext " in
20799         *" $i "*)
20800             echo "Keeping extension $i."
20801             keepextensions="$keepextensions $i"
20802             ;;
20803         *) echo "Ignoring extension $i." ;;
20804         esac
20805     done
20806     avail_ext="$keepextensions"
20807     ;;
20808 esac
20809
20810 case "$noextensions" in
20811 '') ;;
20812 *)  keepextensions=''
20813     echo "You have requested that certain extensions be ignored..." >&4
20814     for i in $avail_ext; do
20815         case " $noextensions " in
20816         *" $i "*) echo "Ignoring extension $i." ;;
20817         *) echo "Keeping extension $i.";
20818            keepextensions="$keepextensions $i"
20819            ;;
20820         esac
20821     done
20822     avail_ext="$keepextensions"
20823     ;;
20824 esac
20825
20826 : Now see which nonxs extensions are supported on this system.
20827 : For now assume all are.
20828 nonxs_ext=''
20829 for xxx in $nonxs_extensions ; do
20830         case "$xxx" in
20831         *)      nonxs_ext="$nonxs_ext $xxx"
20832                 ;;
20833         esac
20834 done
20835
20836 set X $nonxs_ext
20837 shift
20838 nonxs_ext="$*"
20839
20840 case $usedl in
20841 $define)
20842         $cat <<EOM
20843 A number of extensions are supplied with $package.  You may choose to
20844 compile these extensions for dynamic loading (the default), compile
20845 them into the $package executable (static loading), or not include
20846 them at all.  Answer "none" to include no extensions.
20847 Note that DynaLoader is always built and need not be mentioned here.
20848
20849 EOM
20850         case "$dynamic_ext" in
20851         '')
20852                 : Exclude those listed in static_ext
20853                 dflt=''
20854                 for xxx in $avail_ext; do
20855                         case " $static_ext " in
20856                         *" $xxx "*) ;;
20857                         *) dflt="$dflt $xxx" ;;
20858                         esac
20859                 done
20860                 set X $dflt
20861                 shift
20862                 dflt="$*"
20863                 ;;
20864         *)      dflt="$dynamic_ext"
20865                 # Perhaps we are reusing an old out-of-date config.sh.
20866                 case "$hint" in
20867                 previous)
20868                         if test X"$dynamic_ext" != X"$avail_ext"; then
20869                                 $cat <<EOM
20870 NOTICE:  Your previous config.sh list may be incorrect. 
20871 The extensions now available to you are 
20872         ${avail_ext}
20873 but the default list from your previous config.sh is
20874         ${dynamic_ext} 
20875
20876 EOM
20877                         fi
20878                         ;;
20879                 esac
20880                 ;;
20881         esac
20882         case "$dflt" in
20883         '')     dflt=none;;
20884         esac
20885         rp="What extensions do you wish to load dynamically?"
20886         . ./myread
20887         case "$ans" in
20888         none) dynamic_ext=' ' ;;
20889         *) dynamic_ext="$ans" ;;
20890         esac
20891
20892         case "$static_ext" in
20893         '')
20894                 : Exclude those already listed in dynamic linking
20895                 dflt=''
20896                 for xxx in $avail_ext; do
20897                         case " $dynamic_ext " in
20898                         *" $xxx "*) ;;
20899                         *) dflt="$dflt $xxx" ;;
20900                         esac
20901                 done
20902                 set X $dflt
20903                 shift
20904                 dflt="$*"
20905                 ;;
20906         *)  dflt="$static_ext" 
20907                 ;;
20908         esac
20909
20910         case "$dflt" in
20911         '')     dflt=none;;
20912         esac
20913         rp="What extensions do you wish to load statically?"
20914         . ./myread
20915         case "$ans" in
20916         none) static_ext=' ' ;;
20917         *) static_ext="$ans" ;;
20918         esac
20919         ;;
20920 *)
20921         $cat <<EOM
20922 A number of extensions are supplied with $package.  Answer "none" 
20923 to include no extensions. 
20924 Note that DynaLoader is always built and need not be mentioned here.
20925
20926 EOM
20927         case "$static_ext" in
20928         '') dflt="$avail_ext" ;;
20929         *)      dflt="$static_ext"
20930                 # Perhaps we are reusing an old out-of-date config.sh.
20931                 case "$hint" in
20932                 previous)
20933                         if test X"$static_ext" != X"$avail_ext"; then
20934                                 $cat <<EOM
20935 NOTICE:  Your previous config.sh list may be incorrect. 
20936 The extensions now available to you are 
20937         ${avail_ext}
20938 but the default list from your previous config.sh is
20939         ${static_ext} 
20940
20941 EOM
20942                         fi
20943                         ;;
20944                 esac
20945                 ;;
20946         esac
20947         : Exclude those that are not xs extensions
20948         case "$dflt" in
20949         '')     dflt=none;;
20950         esac
20951         rp="What extensions do you wish to include?"
20952         . ./myread
20953         case "$ans" in
20954         none) static_ext=' ' ;;
20955         *) static_ext="$ans" ;;
20956         esac
20957         ;;
20958 esac
20959 #        
20960 # Encode is a special case.  If we are building Encode as a static
20961 # extension, we need to explicitly list its subextensions as well.
20962 # For other nested extensions, this is handled automatically by
20963 # the appropriate Makefile.PL.
20964 case " $static_ext " in
20965         *" Encode "*) # Add the subextensions of Encode
20966         cd "$rsrc/ext"
20967         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20968                 static_ext="$static_ext Encode/$xxx"
20969         done
20970         cd "$tdir"
20971         ;;
20972 esac
20973
20974 set X $dynamic_ext $static_ext $nonxs_ext
20975 shift
20976 extensions="$*"
20977
20978 # Sanity check:  We require an extension suitable for use with
20979 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20980 # should show up as failures in the test suite, but it's helpful to
20981 # catch them now.) The 'extensions' list is normally sorted
20982 # alphabetically, so we need to accept either
20983 #    DB_File ... Fcntl ... IO  ....
20984 # or something like
20985 #    Fcntl ... NDBM_File ... IO  ....
20986 case " $extensions"  in
20987 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20988 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20989 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20990 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20991    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20992    ;;
20993 esac
20994
20995 : Remove libraries needed only for extensions
20996 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20997 : The exception is SunOS 4.x, which needs them.
20998 case "${osname}X${osvers}" in
20999 sunos*X4*)
21000     perllibs="$libs"
21001     ;;
21002 *) case "$usedl" in
21003     $define|true|[yY]*)
21004             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21005             shift
21006             perllibs="$*"
21007             ;;
21008     *)  perllibs="$libs"
21009             ;;
21010     esac
21011     ;;
21012 esac
21013
21014 : Remove build directory name from cppstdin so it can be used from
21015 : either the present location or the final installed location.
21016 echo " "
21017 : Get out of the UU directory to get correct path name.
21018 cd ..
21019 case "$cppstdin" in
21020 `pwd`/cppstdin)
21021         echo "Stripping down cppstdin path name"
21022         cppstdin=cppstdin
21023         ;;
21024 esac
21025 cd UU
21026
21027 : end of configuration questions
21028 echo " "
21029 echo "End of configuration questions."
21030 echo " "
21031
21032 : back to where it started
21033 if test -d ../UU; then
21034         cd ..
21035 fi
21036
21037 : configuration may be patched via a 'config.arch' file
21038 if $test -f config.arch; then
21039         echo "I see a config.arch file, loading it."
21040         . ./config.arch
21041 fi
21042
21043 : configuration may be patched via a 'config.over' file
21044 if $test -f config.over; then
21045         echo " "
21046         dflt=y
21047         rp='I see a config.over file.  Do you wish to load it?'
21048         . UU/myread
21049         case "$ans" in
21050         n*) echo "OK, I'll ignore it.";;
21051         *)      . ./config.over
21052                 echo "Configuration override changes have been loaded."
21053                 ;;
21054         esac
21055 fi
21056
21057 : in case they want portability, strip down executable paths
21058 case "$d_portable" in
21059 "$define")
21060         echo " "
21061         echo "Stripping down executable paths..." >&4
21062         for file in $loclist $trylist; do
21063                 eval temp=\$$file
21064                 eval $file=`basename $temp`
21065         done
21066         ;;
21067 esac
21068
21069 : create config.sh file
21070 echo " "
21071 echo "Creating config.sh..." >&4
21072 $spitshell <<EOT >config.sh
21073 $startsh
21074 #
21075 # This file was produced by running the Configure script. It holds all the
21076 # definitions figured out by Configure. Should you modify one of these values,
21077 # do not forget to propagate your changes by running "Configure -der". You may
21078 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21079 #
21080
21081 # Package name      : $package
21082 # Source directory  : $src
21083 # Configuration time: $cf_time
21084 # Configured by     : $cf_by
21085 # Target system     : $myuname
21086
21087 Author='$Author'
21088 Date='$Date'
21089 Header='$Header'
21090 Id='$Id'
21091 Locker='$Locker'
21092 Log='$Log'
21093 Mcc='$Mcc'
21094 RCSfile='$RCSfile'
21095 Revision='$Revision'
21096 Source='$Source'
21097 State='$State'
21098 _a='$_a'
21099 _exe='$_exe'
21100 _o='$_o'
21101 afs='$afs'
21102 afsroot='$afsroot'
21103 alignbytes='$alignbytes'
21104 ansi2knr='$ansi2knr'
21105 aphostname='$aphostname'
21106 api_revision='$api_revision'
21107 api_subversion='$api_subversion'
21108 api_version='$api_version'
21109 api_versionstring='$api_versionstring'
21110 ar='$ar'
21111 archlib='$archlib'
21112 archlibexp='$archlibexp'
21113 archname64='$archname64'
21114 archname='$archname'
21115 archobjs='$archobjs'
21116 asctime_r_proto='$asctime_r_proto'
21117 awk='$awk'
21118 baserev='$baserev'
21119 bash='$bash'
21120 bin='$bin'
21121 binexp='$binexp'
21122 bison='$bison'
21123 byacc='$byacc'
21124 byteorder='$byteorder'
21125 c='$c'
21126 castflags='$castflags'
21127 cat='$cat'
21128 cc='$cc'
21129 cccdlflags='$cccdlflags'
21130 ccdlflags='$ccdlflags'
21131 ccflags='$ccflags'
21132 ccflags_uselargefiles='$ccflags_uselargefiles'
21133 ccname='$ccname'
21134 ccsymbols='$ccsymbols'
21135 ccversion='$ccversion'
21136 cf_by='$cf_by'
21137 cf_email='$cf_email'
21138 cf_time='$cf_time'
21139 charsize='$charsize'
21140 chgrp='$chgrp'
21141 chmod='$chmod'
21142 chown='$chown'
21143 clocktype='$clocktype'
21144 comm='$comm'
21145 compress='$compress'
21146 contains='$contains'
21147 cp='$cp'
21148 cpio='$cpio'
21149 cpp='$cpp'
21150 cpp_stuff='$cpp_stuff'
21151 cppccsymbols='$cppccsymbols'
21152 cppflags='$cppflags'
21153 cpplast='$cpplast'
21154 cppminus='$cppminus'
21155 cpprun='$cpprun'
21156 cppstdin='$cppstdin'
21157 cppsymbols='$cppsymbols'
21158 crypt_r_proto='$crypt_r_proto'
21159 cryptlib='$cryptlib'
21160 csh='$csh'
21161 ctermid_r_proto='$ctermid_r_proto'
21162 ctime_r_proto='$ctime_r_proto'
21163 d_Gconvert='$d_Gconvert'
21164 d_PRIEUldbl='$d_PRIEUldbl'
21165 d_PRIFUldbl='$d_PRIFUldbl'
21166 d_PRIGUldbl='$d_PRIGUldbl'
21167 d_PRIXU64='$d_PRIXU64'
21168 d_PRId64='$d_PRId64'
21169 d_PRIeldbl='$d_PRIeldbl'
21170 d_PRIfldbl='$d_PRIfldbl'
21171 d_PRIgldbl='$d_PRIgldbl'
21172 d_PRIi64='$d_PRIi64'
21173 d_PRIo64='$d_PRIo64'
21174 d_PRIu64='$d_PRIu64'
21175 d_PRIx64='$d_PRIx64'
21176 d_SCNfldbl='$d_SCNfldbl'
21177 d__fwalk='$d__fwalk'
21178 d_access='$d_access'
21179 d_accessx='$d_accessx'
21180 d_aintl='$d_aintl'
21181 d_alarm='$d_alarm'
21182 d_archlib='$d_archlib'
21183 d_asctime_r='$d_asctime_r'
21184 d_atolf='$d_atolf'
21185 d_atoll='$d_atoll'
21186 d_attribute_format='$d_attribute_format'
21187 d_attribute_malloc='$d_attribute_malloc'
21188 d_attribute_nonnull='$d_attribute_nonnull'
21189 d_attribute_noreturn='$d_attribute_noreturn'
21190 d_attribute_pure='$d_attribute_pure'
21191 d_attribute_unused='$d_attribute_unused'
21192 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21193 d_bcmp='$d_bcmp'
21194 d_bcopy='$d_bcopy'
21195 d_bsd='$d_bsd'
21196 d_bsdgetpgrp='$d_bsdgetpgrp'
21197 d_bsdsetpgrp='$d_bsdsetpgrp'
21198 d_builtin_choose_expr='$d_builtin_choose_expr'
21199 d_builtin_expect='$d_builtin_expect'
21200 d_bzero='$d_bzero'
21201 d_casti32='$d_casti32'
21202 d_castneg='$d_castneg'
21203 d_charvspr='$d_charvspr'
21204 d_chown='$d_chown'
21205 d_chroot='$d_chroot'
21206 d_chsize='$d_chsize'
21207 d_class='$d_class'
21208 d_clearenv='$d_clearenv'
21209 d_closedir='$d_closedir'
21210 d_cmsghdr_s='$d_cmsghdr_s'
21211 d_const='$d_const'
21212 d_copysignl='$d_copysignl'
21213 d_crypt='$d_crypt'
21214 d_crypt_r='$d_crypt_r'
21215 d_csh='$d_csh'
21216 d_ctermid_r='$d_ctermid_r'
21217 d_ctime_r='$d_ctime_r'
21218 d_cuserid='$d_cuserid'
21219 d_dbl_dig='$d_dbl_dig'
21220 d_dbminitproto='$d_dbminitproto'
21221 d_difftime='$d_difftime'
21222 d_dirfd='$d_dirfd'
21223 d_dirnamlen='$d_dirnamlen'
21224 d_dlerror='$d_dlerror'
21225 d_dlopen='$d_dlopen'
21226 d_dlsymun='$d_dlsymun'
21227 d_dosuid='$d_dosuid'
21228 d_drand48_r='$d_drand48_r'
21229 d_drand48proto='$d_drand48proto'
21230 d_dup2='$d_dup2'
21231 d_eaccess='$d_eaccess'
21232 d_endgrent='$d_endgrent'
21233 d_endgrent_r='$d_endgrent_r'
21234 d_endhent='$d_endhent'
21235 d_endhostent_r='$d_endhostent_r'
21236 d_endnent='$d_endnent'
21237 d_endnetent_r='$d_endnetent_r'
21238 d_endpent='$d_endpent'
21239 d_endprotoent_r='$d_endprotoent_r'
21240 d_endpwent='$d_endpwent'
21241 d_endpwent_r='$d_endpwent_r'
21242 d_endsent='$d_endsent'
21243 d_endservent_r='$d_endservent_r'
21244 d_eofnblk='$d_eofnblk'
21245 d_eunice='$d_eunice'
21246 d_faststdio='$d_faststdio'
21247 d_fchdir='$d_fchdir'
21248 d_fchmod='$d_fchmod'
21249 d_fchown='$d_fchown'
21250 d_fcntl='$d_fcntl'
21251 d_fcntl_can_lock='$d_fcntl_can_lock'
21252 d_fd_macros='$d_fd_macros'
21253 d_fd_set='$d_fd_set'
21254 d_fds_bits='$d_fds_bits'
21255 d_fgetpos='$d_fgetpos'
21256 d_finite='$d_finite'
21257 d_finitel='$d_finitel'
21258 d_flexfnam='$d_flexfnam'
21259 d_flock='$d_flock'
21260 d_flockproto='$d_flockproto'
21261 d_fork='$d_fork'
21262 d_fp_class='$d_fp_class'
21263 d_fpathconf='$d_fpathconf'
21264 d_fpclass='$d_fpclass'
21265 d_fpclassify='$d_fpclassify'
21266 d_fpclassl='$d_fpclassl'
21267 d_fpos64_t='$d_fpos64_t'
21268 d_frexpl='$d_frexpl'
21269 d_fs_data_s='$d_fs_data_s'
21270 d_fseeko='$d_fseeko'
21271 d_fsetpos='$d_fsetpos'
21272 d_fstatfs='$d_fstatfs'
21273 d_fstatvfs='$d_fstatvfs'
21274 d_fsync='$d_fsync'
21275 d_ftello='$d_ftello'
21276 d_ftime='$d_ftime'
21277 d_futimes='$d_futimes'
21278 d_getcwd='$d_getcwd'
21279 d_getespwnam='$d_getespwnam'
21280 d_getfsstat='$d_getfsstat'
21281 d_getgrent='$d_getgrent'
21282 d_getgrent_r='$d_getgrent_r'
21283 d_getgrgid_r='$d_getgrgid_r'
21284 d_getgrnam_r='$d_getgrnam_r'
21285 d_getgrps='$d_getgrps'
21286 d_gethbyaddr='$d_gethbyaddr'
21287 d_gethbyname='$d_gethbyname'
21288 d_gethent='$d_gethent'
21289 d_gethname='$d_gethname'
21290 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21291 d_gethostbyname_r='$d_gethostbyname_r'
21292 d_gethostent_r='$d_gethostent_r'
21293 d_gethostprotos='$d_gethostprotos'
21294 d_getitimer='$d_getitimer'
21295 d_getlogin='$d_getlogin'
21296 d_getlogin_r='$d_getlogin_r'
21297 d_getmnt='$d_getmnt'
21298 d_getmntent='$d_getmntent'
21299 d_getnbyaddr='$d_getnbyaddr'
21300 d_getnbyname='$d_getnbyname'
21301 d_getnent='$d_getnent'
21302 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21303 d_getnetbyname_r='$d_getnetbyname_r'
21304 d_getnetent_r='$d_getnetent_r'
21305 d_getnetprotos='$d_getnetprotos'
21306 d_getpagsz='$d_getpagsz'
21307 d_getpbyname='$d_getpbyname'
21308 d_getpbynumber='$d_getpbynumber'
21309 d_getpent='$d_getpent'
21310 d_getpgid='$d_getpgid'
21311 d_getpgrp2='$d_getpgrp2'
21312 d_getpgrp='$d_getpgrp'
21313 d_getppid='$d_getppid'
21314 d_getprior='$d_getprior'
21315 d_getprotobyname_r='$d_getprotobyname_r'
21316 d_getprotobynumber_r='$d_getprotobynumber_r'
21317 d_getprotoent_r='$d_getprotoent_r'
21318 d_getprotoprotos='$d_getprotoprotos'
21319 d_getprpwnam='$d_getprpwnam'
21320 d_getpwent='$d_getpwent'
21321 d_getpwent_r='$d_getpwent_r'
21322 d_getpwnam_r='$d_getpwnam_r'
21323 d_getpwuid_r='$d_getpwuid_r'
21324 d_getsbyname='$d_getsbyname'
21325 d_getsbyport='$d_getsbyport'
21326 d_getsent='$d_getsent'
21327 d_getservbyname_r='$d_getservbyname_r'
21328 d_getservbyport_r='$d_getservbyport_r'
21329 d_getservent_r='$d_getservent_r'
21330 d_getservprotos='$d_getservprotos'
21331 d_getspnam='$d_getspnam'
21332 d_getspnam_r='$d_getspnam_r'
21333 d_gettimeod='$d_gettimeod'
21334 d_gmtime_r='$d_gmtime_r'
21335 d_gnulibc='$d_gnulibc'
21336 d_grpasswd='$d_grpasswd'
21337 d_hasmntopt='$d_hasmntopt'
21338 d_htonl='$d_htonl'
21339 d_ilogbl='$d_ilogbl'
21340 d_index='$d_index'
21341 d_inetaton='$d_inetaton'
21342 d_int64_t='$d_int64_t'
21343 d_isascii='$d_isascii'
21344 d_isfinite='$d_isfinite'
21345 d_isinf='$d_isinf'
21346 d_isnan='$d_isnan'
21347 d_isnanl='$d_isnanl'
21348 d_killpg='$d_killpg'
21349 d_lchown='$d_lchown'
21350 d_ldbl_dig='$d_ldbl_dig'
21351 d_libm_lib_version='$d_libm_lib_version'
21352 d_link='$d_link'
21353 d_localtime_r='$d_localtime_r'
21354 d_locconv='$d_locconv'
21355 d_lockf='$d_lockf'
21356 d_longdbl='$d_longdbl'
21357 d_longlong='$d_longlong'
21358 d_lseekproto='$d_lseekproto'
21359 d_lstat='$d_lstat'
21360 d_madvise='$d_madvise'
21361 d_malloc_good_size='$d_malloc_good_size'
21362 d_malloc_size='$d_malloc_size'
21363 d_mblen='$d_mblen'
21364 d_mbstowcs='$d_mbstowcs'
21365 d_mbtowc='$d_mbtowc'
21366 d_memchr='$d_memchr'
21367 d_memcmp='$d_memcmp'
21368 d_memcpy='$d_memcpy'
21369 d_memmove='$d_memmove'
21370 d_memset='$d_memset'
21371 d_mkdir='$d_mkdir'
21372 d_mkdtemp='$d_mkdtemp'
21373 d_mkfifo='$d_mkfifo'
21374 d_mkstemp='$d_mkstemp'
21375 d_mkstemps='$d_mkstemps'
21376 d_mktime='$d_mktime'
21377 d_mmap='$d_mmap'
21378 d_modfl='$d_modfl'
21379 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21380 d_modflproto='$d_modflproto'
21381 d_mprotect='$d_mprotect'
21382 d_msg='$d_msg'
21383 d_msg_ctrunc='$d_msg_ctrunc'
21384 d_msg_dontroute='$d_msg_dontroute'
21385 d_msg_oob='$d_msg_oob'
21386 d_msg_peek='$d_msg_peek'
21387 d_msg_proxy='$d_msg_proxy'
21388 d_msgctl='$d_msgctl'
21389 d_msgget='$d_msgget'
21390 d_msghdr_s='$d_msghdr_s'
21391 d_msgrcv='$d_msgrcv'
21392 d_msgsnd='$d_msgsnd'
21393 d_msync='$d_msync'
21394 d_munmap='$d_munmap'
21395 d_mymalloc='$d_mymalloc'
21396 d_nice='$d_nice'
21397 d_nl_langinfo='$d_nl_langinfo'
21398 d_nv_preserves_uv='$d_nv_preserves_uv'
21399 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21400 d_off64_t='$d_off64_t'
21401 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21402 d_oldpthreads='$d_oldpthreads'
21403 d_oldsock='$d_oldsock'
21404 d_open3='$d_open3'
21405 d_pathconf='$d_pathconf'
21406 d_pause='$d_pause'
21407 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21408 d_phostname='$d_phostname'
21409 d_pipe='$d_pipe'
21410 d_poll='$d_poll'
21411 d_portable='$d_portable'
21412 d_procselfexe='$d_procselfexe'
21413 d_pthread_atfork='$d_pthread_atfork'
21414 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21415 d_pthread_yield='$d_pthread_yield'
21416 d_pwage='$d_pwage'
21417 d_pwchange='$d_pwchange'
21418 d_pwclass='$d_pwclass'
21419 d_pwcomment='$d_pwcomment'
21420 d_pwexpire='$d_pwexpire'
21421 d_pwgecos='$d_pwgecos'
21422 d_pwpasswd='$d_pwpasswd'
21423 d_pwquota='$d_pwquota'
21424 d_qgcvt='$d_qgcvt'
21425 d_quad='$d_quad'
21426 d_random_r='$d_random_r'
21427 d_readdir64_r='$d_readdir64_r'
21428 d_readdir='$d_readdir'
21429 d_readdir_r='$d_readdir_r'
21430 d_readlink='$d_readlink'
21431 d_readv='$d_readv'
21432 d_recvmsg='$d_recvmsg'
21433 d_rename='$d_rename'
21434 d_rewinddir='$d_rewinddir'
21435 d_rmdir='$d_rmdir'
21436 d_safebcpy='$d_safebcpy'
21437 d_safemcpy='$d_safemcpy'
21438 d_sanemcmp='$d_sanemcmp'
21439 d_sbrkproto='$d_sbrkproto'
21440 d_scalbnl='$d_scalbnl'
21441 d_sched_yield='$d_sched_yield'
21442 d_scm_rights='$d_scm_rights'
21443 d_seekdir='$d_seekdir'
21444 d_select='$d_select'
21445 d_sem='$d_sem'
21446 d_semctl='$d_semctl'
21447 d_semctl_semid_ds='$d_semctl_semid_ds'
21448 d_semctl_semun='$d_semctl_semun'
21449 d_semget='$d_semget'
21450 d_semop='$d_semop'
21451 d_sendmsg='$d_sendmsg'
21452 d_setegid='$d_setegid'
21453 d_seteuid='$d_seteuid'
21454 d_setgrent='$d_setgrent'
21455 d_setgrent_r='$d_setgrent_r'
21456 d_setgrps='$d_setgrps'
21457 d_sethent='$d_sethent'
21458 d_sethostent_r='$d_sethostent_r'
21459 d_setitimer='$d_setitimer'
21460 d_setlinebuf='$d_setlinebuf'
21461 d_setlocale='$d_setlocale'
21462 d_setlocale_r='$d_setlocale_r'
21463 d_setnent='$d_setnent'
21464 d_setnetent_r='$d_setnetent_r'
21465 d_setpent='$d_setpent'
21466 d_setpgid='$d_setpgid'
21467 d_setpgrp2='$d_setpgrp2'
21468 d_setpgrp='$d_setpgrp'
21469 d_setprior='$d_setprior'
21470 d_setproctitle='$d_setproctitle'
21471 d_setprotoent_r='$d_setprotoent_r'
21472 d_setpwent='$d_setpwent'
21473 d_setpwent_r='$d_setpwent_r'
21474 d_setregid='$d_setregid'
21475 d_setresgid='$d_setresgid'
21476 d_setresuid='$d_setresuid'
21477 d_setreuid='$d_setreuid'
21478 d_setrgid='$d_setrgid'
21479 d_setruid='$d_setruid'
21480 d_setsent='$d_setsent'
21481 d_setservent_r='$d_setservent_r'
21482 d_setsid='$d_setsid'
21483 d_setvbuf='$d_setvbuf'
21484 d_sfio='$d_sfio'
21485 d_shm='$d_shm'
21486 d_shmat='$d_shmat'
21487 d_shmatprototype='$d_shmatprototype'
21488 d_shmctl='$d_shmctl'
21489 d_shmdt='$d_shmdt'
21490 d_shmget='$d_shmget'
21491 d_sigaction='$d_sigaction'
21492 d_sigprocmask='$d_sigprocmask'
21493 d_sigsetjmp='$d_sigsetjmp'
21494 d_snprintf='$d_snprintf'
21495 d_sockatmark='$d_sockatmark'
21496 d_sockatmarkproto='$d_sockatmarkproto'
21497 d_socket='$d_socket'
21498 d_socklen_t='$d_socklen_t'
21499 d_sockpair='$d_sockpair'
21500 d_socks5_init='$d_socks5_init'
21501 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21502 d_sqrtl='$d_sqrtl'
21503 d_srand48_r='$d_srand48_r'
21504 d_srandom_r='$d_srandom_r'
21505 d_sresgproto='$d_sresgproto'
21506 d_sresuproto='$d_sresuproto'
21507 d_statblks='$d_statblks'
21508 d_statfs_f_flags='$d_statfs_f_flags'
21509 d_statfs_s='$d_statfs_s'
21510 d_statvfs='$d_statvfs'
21511 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21512 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21513 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21514 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21515 d_stdio_stream_array='$d_stdio_stream_array'
21516 d_stdiobase='$d_stdiobase'
21517 d_stdstdio='$d_stdstdio'
21518 d_strchr='$d_strchr'
21519 d_strcoll='$d_strcoll'
21520 d_strctcpy='$d_strctcpy'
21521 d_strerrm='$d_strerrm'
21522 d_strerror='$d_strerror'
21523 d_strerror_r='$d_strerror_r'
21524 d_strftime='$d_strftime'
21525 d_strlcat='$d_strlcat'
21526 d_strlcpy='$d_strlcpy'
21527 d_strtod='$d_strtod'
21528 d_strtol='$d_strtol'
21529 d_strtold='$d_strtold'
21530 d_strtoll='$d_strtoll'
21531 d_strtoq='$d_strtoq'
21532 d_strtoul='$d_strtoul'
21533 d_strtoull='$d_strtoull'
21534 d_strtouq='$d_strtouq'
21535 d_strxfrm='$d_strxfrm'
21536 d_suidsafe='$d_suidsafe'
21537 d_symlink='$d_symlink'
21538 d_syscall='$d_syscall'
21539 d_syscallproto='$d_syscallproto'
21540 d_sysconf='$d_sysconf'
21541 d_sysernlst='$d_sysernlst'
21542 d_syserrlst='$d_syserrlst'
21543 d_system='$d_system'
21544 d_tcgetpgrp='$d_tcgetpgrp'
21545 d_tcsetpgrp='$d_tcsetpgrp'
21546 d_telldir='$d_telldir'
21547 d_telldirproto='$d_telldirproto'
21548 d_time='$d_time'
21549 d_times='$d_times'
21550 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21551 d_tm_tm_zone='$d_tm_tm_zone'
21552 d_tmpnam_r='$d_tmpnam_r'
21553 d_truncate='$d_truncate'
21554 d_ttyname_r='$d_ttyname_r'
21555 d_tzname='$d_tzname'
21556 d_u32align='$d_u32align'
21557 d_ualarm='$d_ualarm'
21558 d_umask='$d_umask'
21559 d_uname='$d_uname'
21560 d_union_semun='$d_union_semun'
21561 d_unordered='$d_unordered'
21562 d_unsetenv='$d_unsetenv'
21563 d_usleep='$d_usleep'
21564 d_usleepproto='$d_usleepproto'
21565 d_ustat='$d_ustat'
21566 d_vendorarch='$d_vendorarch'
21567 d_vendorbin='$d_vendorbin'
21568 d_vendorlib='$d_vendorlib'
21569 d_vendorscript='$d_vendorscript'
21570 d_vfork='$d_vfork'
21571 d_void_closedir='$d_void_closedir'
21572 d_voidsig='$d_voidsig'
21573 d_voidtty='$d_voidtty'
21574 d_volatile='$d_volatile'
21575 d_vprintf='$d_vprintf'
21576 d_vsnprintf='$d_vsnprintf'
21577 d_wait4='$d_wait4'
21578 d_waitpid='$d_waitpid'
21579 d_wcstombs='$d_wcstombs'
21580 d_wctomb='$d_wctomb'
21581 d_writev='$d_writev'
21582 d_xenix='$d_xenix'
21583 date='$date'
21584 db_hashtype='$db_hashtype'
21585 db_prefixtype='$db_prefixtype'
21586 db_version_major='$db_version_major'
21587 db_version_minor='$db_version_minor'
21588 db_version_patch='$db_version_patch'
21589 defvoidused='$defvoidused'
21590 direntrytype='$direntrytype'
21591 dlext='$dlext'
21592 dlsrc='$dlsrc'
21593 doublesize='$doublesize'
21594 drand01='$drand01'
21595 drand48_r_proto='$drand48_r_proto'
21596 dynamic_ext='$dynamic_ext'
21597 eagain='$eagain'
21598 ebcdic='$ebcdic'
21599 echo='$echo'
21600 egrep='$egrep'
21601 emacs='$emacs'
21602 endgrent_r_proto='$endgrent_r_proto'
21603 endhostent_r_proto='$endhostent_r_proto'
21604 endnetent_r_proto='$endnetent_r_proto'
21605 endprotoent_r_proto='$endprotoent_r_proto'
21606 endpwent_r_proto='$endpwent_r_proto'
21607 endservent_r_proto='$endservent_r_proto'
21608 eunicefix='$eunicefix'
21609 exe_ext='$exe_ext'
21610 expr='$expr'
21611 extensions='$extensions'
21612 extras='$extras'
21613 fflushNULL='$fflushNULL'
21614 fflushall='$fflushall'
21615 find='$find'
21616 firstmakefile='$firstmakefile'
21617 flex='$flex'
21618 fpossize='$fpossize'
21619 fpostype='$fpostype'
21620 freetype='$freetype'
21621 from='$from'
21622 full_ar='$full_ar'
21623 full_csh='$full_csh'
21624 full_sed='$full_sed'
21625 gccansipedantic='$gccansipedantic'
21626 gccosandvers='$gccosandvers'
21627 gccversion='$gccversion'
21628 getgrent_r_proto='$getgrent_r_proto'
21629 getgrgid_r_proto='$getgrgid_r_proto'
21630 getgrnam_r_proto='$getgrnam_r_proto'
21631 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21632 gethostbyname_r_proto='$gethostbyname_r_proto'
21633 gethostent_r_proto='$gethostent_r_proto'
21634 getlogin_r_proto='$getlogin_r_proto'
21635 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21636 getnetbyname_r_proto='$getnetbyname_r_proto'
21637 getnetent_r_proto='$getnetent_r_proto'
21638 getprotobyname_r_proto='$getprotobyname_r_proto'
21639 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21640 getprotoent_r_proto='$getprotoent_r_proto'
21641 getpwent_r_proto='$getpwent_r_proto'
21642 getpwnam_r_proto='$getpwnam_r_proto'
21643 getpwuid_r_proto='$getpwuid_r_proto'
21644 getservbyname_r_proto='$getservbyname_r_proto'
21645 getservbyport_r_proto='$getservbyport_r_proto'
21646 getservent_r_proto='$getservent_r_proto'
21647 getspnam_r_proto='$getspnam_r_proto'
21648 gidformat='$gidformat'
21649 gidsign='$gidsign'
21650 gidsize='$gidsize'
21651 gidtype='$gidtype'
21652 glibpth='$glibpth'
21653 gmake='$gmake'
21654 gmtime_r_proto='$gmtime_r_proto'
21655 gnulibc_version='$gnulibc_version'
21656 grep='$grep'
21657 groupcat='$groupcat'
21658 groupstype='$groupstype'
21659 gzip='$gzip'
21660 h_fcntl='$h_fcntl'
21661 h_sysfile='$h_sysfile'
21662 hint='$hint'
21663 hostcat='$hostcat'
21664 html1dir='$html1dir'
21665 html1direxp='$html1direxp'
21666 html3dir='$html3dir'
21667 html3direxp='$html3direxp'
21668 i16size='$i16size'
21669 i16type='$i16type'
21670 i32size='$i32size'
21671 i32type='$i32type'
21672 i64size='$i64size'
21673 i64type='$i64type'
21674 i8size='$i8size'
21675 i8type='$i8type'
21676 i_arpainet='$i_arpainet'
21677 i_bsdioctl='$i_bsdioctl'
21678 i_crypt='$i_crypt'
21679 i_db='$i_db'
21680 i_dbm='$i_dbm'
21681 i_dirent='$i_dirent'
21682 i_dld='$i_dld'
21683 i_dlfcn='$i_dlfcn'
21684 i_fcntl='$i_fcntl'
21685 i_float='$i_float'
21686 i_fp='$i_fp'
21687 i_fp_class='$i_fp_class'
21688 i_gdbm='$i_gdbm'
21689 i_grp='$i_grp'
21690 i_ieeefp='$i_ieeefp'
21691 i_inttypes='$i_inttypes'
21692 i_langinfo='$i_langinfo'
21693 i_libutil='$i_libutil'
21694 i_limits='$i_limits'
21695 i_locale='$i_locale'
21696 i_machcthr='$i_machcthr'
21697 i_malloc='$i_malloc'
21698 i_math='$i_math'
21699 i_memory='$i_memory'
21700 i_mntent='$i_mntent'
21701 i_ndbm='$i_ndbm'
21702 i_netdb='$i_netdb'
21703 i_neterrno='$i_neterrno'
21704 i_netinettcp='$i_netinettcp'
21705 i_niin='$i_niin'
21706 i_poll='$i_poll'
21707 i_prot='$i_prot'
21708 i_pthread='$i_pthread'
21709 i_pwd='$i_pwd'
21710 i_rpcsvcdbm='$i_rpcsvcdbm'
21711 i_sfio='$i_sfio'
21712 i_sgtty='$i_sgtty'
21713 i_shadow='$i_shadow'
21714 i_socks='$i_socks'
21715 i_stdarg='$i_stdarg'
21716 i_stddef='$i_stddef'
21717 i_stdlib='$i_stdlib'
21718 i_string='$i_string'
21719 i_sunmath='$i_sunmath'
21720 i_sysaccess='$i_sysaccess'
21721 i_sysdir='$i_sysdir'
21722 i_sysfile='$i_sysfile'
21723 i_sysfilio='$i_sysfilio'
21724 i_sysin='$i_sysin'
21725 i_sysioctl='$i_sysioctl'
21726 i_syslog='$i_syslog'
21727 i_sysmman='$i_sysmman'
21728 i_sysmode='$i_sysmode'
21729 i_sysmount='$i_sysmount'
21730 i_sysndir='$i_sysndir'
21731 i_sysparam='$i_sysparam'
21732 i_sysresrc='$i_sysresrc'
21733 i_syssecrt='$i_syssecrt'
21734 i_sysselct='$i_sysselct'
21735 i_syssockio='$i_syssockio'
21736 i_sysstat='$i_sysstat'
21737 i_sysstatfs='$i_sysstatfs'
21738 i_sysstatvfs='$i_sysstatvfs'
21739 i_systime='$i_systime'
21740 i_systimek='$i_systimek'
21741 i_systimes='$i_systimes'
21742 i_systypes='$i_systypes'
21743 i_sysuio='$i_sysuio'
21744 i_sysun='$i_sysun'
21745 i_sysutsname='$i_sysutsname'
21746 i_sysvfs='$i_sysvfs'
21747 i_syswait='$i_syswait'
21748 i_termio='$i_termio'
21749 i_termios='$i_termios'
21750 i_time='$i_time'
21751 i_unistd='$i_unistd'
21752 i_ustat='$i_ustat'
21753 i_utime='$i_utime'
21754 i_values='$i_values'
21755 i_varargs='$i_varargs'
21756 i_varhdr='$i_varhdr'
21757 i_vfork='$i_vfork'
21758 ignore_versioned_solibs='$ignore_versioned_solibs'
21759 inc_version_list='$inc_version_list'
21760 inc_version_list_init='$inc_version_list_init'
21761 incpath='$incpath'
21762 inews='$inews'
21763 installarchlib='$installarchlib'
21764 installbin='$installbin'
21765 installhtml1dir='$installhtml1dir'
21766 installhtml3dir='$installhtml3dir'
21767 installman1dir='$installman1dir'
21768 installman3dir='$installman3dir'
21769 installprefix='$installprefix'
21770 installprefixexp='$installprefixexp'
21771 installprivlib='$installprivlib'
21772 installscript='$installscript'
21773 installsitearch='$installsitearch'
21774 installsitebin='$installsitebin'
21775 installsitehtml1dir='$installsitehtml1dir'
21776 installsitehtml3dir='$installsitehtml3dir'
21777 installsitelib='$installsitelib'
21778 installsiteman1dir='$installsiteman1dir'
21779 installsiteman3dir='$installsiteman3dir'
21780 installsitescript='$installsitescript'
21781 installstyle='$installstyle'
21782 installusrbinperl='$installusrbinperl'
21783 installvendorarch='$installvendorarch'
21784 installvendorbin='$installvendorbin'
21785 installvendorhtml1dir='$installvendorhtml1dir'
21786 installvendorhtml3dir='$installvendorhtml3dir'
21787 installvendorlib='$installvendorlib'
21788 installvendorman1dir='$installvendorman1dir'
21789 installvendorman3dir='$installvendorman3dir'
21790 installvendorscript='$installvendorscript'
21791 intsize='$intsize'
21792 issymlink='$issymlink'
21793 ivdformat='$ivdformat'
21794 ivsize='$ivsize'
21795 ivtype='$ivtype'
21796 known_extensions='$known_extensions'
21797 ksh='$ksh'
21798 ld='$ld'
21799 lddlflags='$lddlflags'
21800 ldflags='$ldflags'
21801 ldflags_uselargefiles='$ldflags_uselargefiles'
21802 ldlibpthname='$ldlibpthname'
21803 less='$less'
21804 lib_ext='$lib_ext'
21805 libc='$libc'
21806 libperl='$libperl'
21807 libpth='$libpth'
21808 libs='$libs'
21809 libsdirs='$libsdirs'
21810 libsfiles='$libsfiles'
21811 libsfound='$libsfound'
21812 libspath='$libspath'
21813 libswanted='$libswanted'
21814 libswanted_uselargefiles='$libswanted_uselargefiles'
21815 line='$line'
21816 lint='$lint'
21817 lkflags='$lkflags'
21818 ln='$ln'
21819 lns='$lns'
21820 localtime_r_proto='$localtime_r_proto'
21821 locincpth='$locincpth'
21822 loclibpth='$loclibpth'
21823 longdblsize='$longdblsize'
21824 longlongsize='$longlongsize'
21825 longsize='$longsize'
21826 lp='$lp'
21827 lpr='$lpr'
21828 ls='$ls'
21829 lseeksize='$lseeksize'
21830 lseektype='$lseektype'
21831 mad='$mad'
21832 mail='$mail'
21833 mailx='$mailx'
21834 make='$make'
21835 make_set_make='$make_set_make'
21836 mallocobj='$mallocobj'
21837 mallocsrc='$mallocsrc'
21838 madlyh='$madlyh'
21839 madlyobj='$madlyobj'
21840 madlysrc='$madlysrc'
21841 malloctype='$malloctype'
21842 man1dir='$man1dir'
21843 man1direxp='$man1direxp'
21844 man1ext='$man1ext'
21845 man3dir='$man3dir'
21846 man3direxp='$man3direxp'
21847 man3ext='$man3ext'
21848 mips_type='$mips_type'
21849 mistrustnm='$mistrustnm'
21850 mkdir='$mkdir'
21851 mmaptype='$mmaptype'
21852 modetype='$modetype'
21853 more='$more'
21854 multiarch='$multiarch'
21855 mv='$mv'
21856 myarchname='$myarchname'
21857 mydomain='$mydomain'
21858 myhostname='$myhostname'
21859 myuname='$myuname'
21860 n='$n'
21861 need_va_copy='$need_va_copy'
21862 netdb_hlen_type='$netdb_hlen_type'
21863 netdb_host_type='$netdb_host_type'
21864 netdb_name_type='$netdb_name_type'
21865 netdb_net_type='$netdb_net_type'
21866 nm='$nm'
21867 nm_opt='$nm_opt'
21868 nm_so_opt='$nm_so_opt'
21869 nonxs_ext='$nonxs_ext'
21870 nroff='$nroff'
21871 nvEUformat='$nvEUformat'
21872 nvFUformat='$nvFUformat'
21873 nvGUformat='$nvGUformat'
21874 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21875 nveformat='$nveformat'
21876 nvfformat='$nvfformat'
21877 nvgformat='$nvgformat'
21878 nvsize='$nvsize'
21879 nvtype='$nvtype'
21880 o_nonblock='$o_nonblock'
21881 obj_ext='$obj_ext'
21882 old_pthread_create_joinable='$old_pthread_create_joinable'
21883 optimize='$optimize'
21884 orderlib='$orderlib'
21885 osname='$osname'
21886 osvers='$osvers'
21887 otherlibdirs='$otherlibdirs'
21888 package='$package'
21889 pager='$pager'
21890 passcat='$passcat'
21891 patchlevel='$patchlevel'
21892 path_sep='$path_sep'
21893 perl5='$perl5'
21894 perl='$perl'
21895 perl_patchlevel='$perl_patchlevel'
21896 perladmin='$perladmin'
21897 perllibs='$perllibs'
21898 perlpath='$perlpath'
21899 pg='$pg'
21900 phostname='$phostname'
21901 pidtype='$pidtype'
21902 plibpth='$plibpth'
21903 pmake='$pmake'
21904 pr='$pr'
21905 prefix='$prefix'
21906 prefixexp='$prefixexp'
21907 privlib='$privlib'
21908 privlibexp='$privlibexp'
21909 procselfexe='$procselfexe'
21910 prototype='$prototype'
21911 ptrsize='$ptrsize'
21912 quadkind='$quadkind'
21913 quadtype='$quadtype'
21914 randbits='$randbits'
21915 randfunc='$randfunc'
21916 random_r_proto='$random_r_proto'
21917 randseedtype='$randseedtype'
21918 ranlib='$ranlib'
21919 rd_nodata='$rd_nodata'
21920 readdir64_r_proto='$readdir64_r_proto'
21921 readdir_r_proto='$readdir_r_proto'
21922 revision='$revision'
21923 rm='$rm'
21924 rmail='$rmail'
21925 run='$run'
21926 runnm='$runnm'
21927 sPRIEUldbl='$sPRIEUldbl'
21928 sPRIFUldbl='$sPRIFUldbl'
21929 sPRIGUldbl='$sPRIGUldbl'
21930 sPRIXU64='$sPRIXU64'
21931 sPRId64='$sPRId64'
21932 sPRIeldbl='$sPRIeldbl'
21933 sPRIfldbl='$sPRIfldbl'
21934 sPRIgldbl='$sPRIgldbl'
21935 sPRIi64='$sPRIi64'
21936 sPRIo64='$sPRIo64'
21937 sPRIu64='$sPRIu64'
21938 sPRIx64='$sPRIx64'
21939 sSCNfldbl='$sSCNfldbl'
21940 sched_yield='$sched_yield'
21941 scriptdir='$scriptdir'
21942 scriptdirexp='$scriptdirexp'
21943 sed='$sed'
21944 seedfunc='$seedfunc'
21945 selectminbits='$selectminbits'
21946 selecttype='$selecttype'
21947 sendmail='$sendmail'
21948 setgrent_r_proto='$setgrent_r_proto'
21949 sethostent_r_proto='$sethostent_r_proto'
21950 setlocale_r_proto='$setlocale_r_proto'
21951 setnetent_r_proto='$setnetent_r_proto'
21952 setprotoent_r_proto='$setprotoent_r_proto'
21953 setpwent_r_proto='$setpwent_r_proto'
21954 setservent_r_proto='$setservent_r_proto'
21955 sh='$sh'
21956 shar='$shar'
21957 sharpbang='$sharpbang'
21958 shmattype='$shmattype'
21959 shortsize='$shortsize'
21960 shrpenv='$shrpenv'
21961 shsharp='$shsharp'
21962 sig_count='$sig_count'
21963 sig_name='$sig_name'
21964 sig_name_init='$sig_name_init'
21965 sig_num='$sig_num'
21966 sig_num_init='$sig_num_init'
21967 sig_size='$sig_size'
21968 signal_t='$signal_t'
21969 sitearch='$sitearch'
21970 sitearchexp='$sitearchexp'
21971 sitebin='$sitebin'
21972 sitebinexp='$sitebinexp'
21973 sitehtml1dir='$sitehtml1dir'
21974 sitehtml1direxp='$sitehtml1direxp'
21975 sitehtml3dir='$sitehtml3dir'
21976 sitehtml3direxp='$sitehtml3direxp'
21977 sitelib='$sitelib'
21978 sitelib_stem='$sitelib_stem'
21979 sitelibexp='$sitelibexp'
21980 siteman1dir='$siteman1dir'
21981 siteman1direxp='$siteman1direxp'
21982 siteman3dir='$siteman3dir'
21983 siteman3direxp='$siteman3direxp'
21984 siteprefix='$siteprefix'
21985 siteprefixexp='$siteprefixexp'
21986 sitescript='$sitescript'
21987 sitescriptexp='$sitescriptexp'
21988 sizesize='$sizesize'
21989 sizetype='$sizetype'
21990 sleep='$sleep'
21991 smail='$smail'
21992 so='$so'
21993 sockethdr='$sockethdr'
21994 socketlib='$socketlib'
21995 socksizetype='$socksizetype'
21996 sort='$sort'
21997 spackage='$spackage'
21998 spitshell='$spitshell'
21999 srand48_r_proto='$srand48_r_proto'
22000 srandom_r_proto='$srandom_r_proto'
22001 src='$src'
22002 ssizetype='$ssizetype'
22003 startperl='$startperl'
22004 startsh='$startsh'
22005 static_ext='$static_ext'
22006 stdchar='$stdchar'
22007 stdio_base='$stdio_base'
22008 stdio_bufsiz='$stdio_bufsiz'
22009 stdio_cnt='$stdio_cnt'
22010 stdio_filbuf='$stdio_filbuf'
22011 stdio_ptr='$stdio_ptr'
22012 stdio_stream_array='$stdio_stream_array'
22013 strerror_r_proto='$strerror_r_proto'
22014 strings='$strings'
22015 submit='$submit'
22016 subversion='$subversion'
22017 sysman='$sysman'
22018 tail='$tail'
22019 tar='$tar'
22020 targetarch='$targetarch'
22021 tbl='$tbl'
22022 tee='$tee'
22023 test='$test'
22024 timeincl='$timeincl'
22025 timetype='$timetype'
22026 tmpnam_r_proto='$tmpnam_r_proto'
22027 to='$to'
22028 touch='$touch'
22029 tr='$tr'
22030 trnl='$trnl'
22031 troff='$troff'
22032 ttyname_r_proto='$ttyname_r_proto'
22033 u16size='$u16size'
22034 u16type='$u16type'
22035 u32size='$u32size'
22036 u32type='$u32type'
22037 u64size='$u64size'
22038 u64type='$u64type'
22039 u8size='$u8size'
22040 u8type='$u8type'
22041 uidformat='$uidformat'
22042 uidsign='$uidsign'
22043 uidsize='$uidsize'
22044 uidtype='$uidtype'
22045 uname='$uname'
22046 uniq='$uniq'
22047 uquadtype='$uquadtype'
22048 use5005threads='$use5005threads'
22049 use64bitall='$use64bitall'
22050 use64bitint='$use64bitint'
22051 usecrosscompile='$usecrosscompile'
22052 usedl='$usedl'
22053 usefaststdio='$usefaststdio'
22054 useithreads='$useithreads'
22055 uselargefiles='$uselargefiles'
22056 uselongdouble='$uselongdouble'
22057 usemallocwrap='$usemallocwrap'
22058 usemorebits='$usemorebits'
22059 usemultiplicity='$usemultiplicity'
22060 usemymalloc='$usemymalloc'
22061 usenm='$usenm'
22062 useopcode='$useopcode'
22063 useperlio='$useperlio'
22064 useposix='$useposix'
22065 usereentrant='$usereentrant'
22066 userelocatableinc='$userelocatableinc'
22067 usesfio='$usesfio'
22068 useshrplib='$useshrplib'
22069 usesitecustomize='$usesitecustomize'
22070 usesocks='$usesocks'
22071 usethreads='$usethreads'
22072 usevendorprefix='$usevendorprefix'
22073 usevfork='$usevfork'
22074 usrinc='$usrinc'
22075 uuname='$uuname'
22076 uvXUformat='$uvXUformat'
22077 uvoformat='$uvoformat'
22078 uvsize='$uvsize'
22079 uvtype='$uvtype'
22080 uvuformat='$uvuformat'
22081 uvxformat='$uvxformat'
22082 vendorarch='$vendorarch'
22083 vendorarchexp='$vendorarchexp'
22084 vendorbin='$vendorbin'
22085 vendorbinexp='$vendorbinexp'
22086 vendorhtml1dir='$vendorhtml1dir'
22087 vendorhtml1direxp='$vendorhtml1direxp'
22088 vendorhtml3dir='$vendorhtml3dir'
22089 vendorhtml3direxp='$vendorhtml3direxp'
22090 vendorlib='$vendorlib'
22091 vendorlib_stem='$vendorlib_stem'
22092 vendorlibexp='$vendorlibexp'
22093 vendorman1dir='$vendorman1dir'
22094 vendorman1direxp='$vendorman1direxp'
22095 vendorman3dir='$vendorman3dir'
22096 vendorman3direxp='$vendorman3direxp'
22097 vendorprefix='$vendorprefix'
22098 vendorprefixexp='$vendorprefixexp'
22099 vendorscript='$vendorscript'
22100 vendorscriptexp='$vendorscriptexp'
22101 version='$version'
22102 version_patchlevel_string='$version_patchlevel_string'
22103 versiononly='$versiononly'
22104 vi='$vi'
22105 voidflags='$voidflags'
22106 xlibpth='$xlibpth'
22107 yacc='$yacc'
22108 yaccflags='$yaccflags'
22109 zcat='$zcat'
22110 zip='$zip'
22111 EOT
22112
22113 : Add in command line options if available
22114 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22115
22116 : add special variables
22117 $test -f $src/patchlevel.h && \
22118 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22119 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22120 echo "PERL_CONFIG_SH=true" >>config.sh
22121
22122 : propagate old symbols
22123 if $test -f UU/config.sh; then
22124         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22125         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22126         $sort | $uniq -u >UU/oldsyms
22127         set X `cat UU/oldsyms`
22128         shift
22129         case $# in
22130         0) ;;
22131         *)
22132                 cat <<EOM
22133 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22134 EOM
22135                 echo "# Variables propagated from previous config.sh file." >>config.sh
22136                 for sym in `cat UU/oldsyms`; do
22137                         echo "    Propagating $hint variable "'$'"$sym..."
22138                         eval 'tmp="$'"${sym}"'"'
22139                         echo "$tmp" | \
22140                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22141                 done
22142                 ;;
22143         esac
22144 fi
22145
22146 : Finish up by extracting the .SH files
22147 case "$alldone" in
22148 exit)
22149         $rm -rf UU
22150         echo "Extraction done."
22151         exit 0
22152         ;;
22153 cont)
22154         ;;
22155 '')
22156         dflt=''
22157         nostick=true
22158         $cat <<EOM
22159
22160 If you'd like to make any changes to the config.sh file before I begin
22161 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22162
22163 EOM
22164         rp="Press return or use a shell escape to edit config.sh:"
22165         . UU/myread
22166         nostick=''
22167         case "$ans" in
22168         '') ;;
22169         *) : in case they cannot read
22170                 sh 1>&4 -c "$ans";;
22171         esac
22172         ;;
22173 esac
22174
22175 : if this fails, just run all the .SH files by hand
22176 . ./config.sh
22177
22178 echo " "
22179 exec 1>&4
22180 pwd=`pwd`
22181 . ./UU/extract
22182 cd "$pwd"
22183
22184 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22185         dflt=y
22186         case "$silent" in
22187         true) ;;
22188         *)
22189                 $cat <<EOM
22190
22191 Now you need to generate make dependencies by running "$make depend".
22192 You might prefer to run it in background: "$make depend > makedepend.out &"
22193 It can take a while, so you might not want to run it right now.
22194
22195 EOM
22196                 ;;
22197         esac
22198         rp="Run $make depend now?"
22199         . UU/myread
22200         case "$ans" in
22201         y*)
22202                 $make depend && echo "Now you must run '$make'."
22203                 ;;
22204         *)
22205                 echo "You must run '$make depend' then '$make'."
22206                 ;;
22207         esac
22208 elif test -f [Mm]akefile; then
22209         echo " "
22210         echo "Now you must run a $make."
22211 else
22212         echo "Configure done."
22213 fi
22214
22215 if $test -f Policy.sh; then
22216     $cat <<EOM
22217
22218 If you compile $package on a different machine or from a different object
22219 directory, copy the Policy.sh file from this object directory to the
22220 new one before you run Configure -- this will help you with most of
22221 the policy defaults.
22222
22223 EOM
22224 fi
22225 if $test -f config.msg; then
22226     echo "Hmm.  I also noted the following information while running:"
22227     echo " "
22228     $cat config.msg >&4
22229     $rm -f config.msg
22230 fi
22231 $rm -f kit*isdone ark*isdone
22232 $rm -rf UU
22233
22234 : End of Configure
22235